chore: remove buffer dependency from package.json and package-lock.json, and update encoding logic in template editor actions

This commit is contained in:
kastov 2026-03-22 04:51:50 +03:00
parent c05f7f3f29
commit 1768ef0280
No known key found for this signature in database
GPG key ID: 1B27BE29057F4C90
6 changed files with 4 additions and 75 deletions

View file

@ -162,11 +162,6 @@
<script>
window.global = window
</script>
<script type="module">
import { Buffer } from 'buffer'
window.Buffer = Buffer
</script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

65
package-lock.json generated
View file

@ -47,7 +47,6 @@
"@tanstack/react-virtual": "3.13.12",
"@virtuoso.dev/masonry": "^1.4.0",
"axios": "^1.13.6",
"buffer": "^6.0.3",
"clsx": "^2.1.1",
"color-hash": "^2.0.2",
"consola": "^3.4.2",
@ -5526,26 +5525,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/baseline-browser-mapping": {
"version": "2.10.8",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.8.tgz",
@ -5636,30 +5615,6 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
}
},
"node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT",
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
}
},
"node_modules/buffer-crc32": {
"version": "0.2.13",
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
@ -9153,26 +9108,6 @@
"node": ">=4"
}
},
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "BSD-3-Clause"
},
"node_modules/ignore": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",

View file

@ -71,7 +71,6 @@
"@tanstack/react-virtual": "3.13.12",
"@virtuoso.dev/masonry": "^1.4.0",
"axios": "^1.13.6",
"buffer": "^6.0.3",
"clsx": "^2.1.1",
"color-hash": "^2.0.2",
"consola": "^3.4.2",

View file

@ -13,6 +13,7 @@ import { useClipboard, useDisclosure, useMediaQuery } from '@mantine/hooks'
import { PiCheckSquareOffset, PiFloppyDisk } from 'react-icons/pi'
import { ActionIcon, Button, Group, Menu } from '@mantine/core'
import { useTranslation } from 'react-i18next'
import { encode } from '@stablelib/base64'
import { RefObject } from 'react'
import { useDownloadTemplate } from '@shared/ui/load-templates/use-download-template'
@ -66,7 +67,7 @@ export function TemplateEditorActionsFeature(props: Props) {
updateConfig({
variables: {
uuid: template.uuid,
encodedTemplateYaml: Buffer.from(currentValue, 'utf-8').toString('base64')
encodedTemplateYaml: encode(new TextEncoder().encode(currentValue))
}
})
}

View file

@ -6,6 +6,7 @@ import 'monaco-yaml/yaml.worker.js'
import { Box, Card, Paper } from '@mantine/core'
import { useLayoutEffect, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { decode } from '@stablelib/base64'
import { TemplateEditorActionsFeature } from '@features/dashboard/subscription-templates/template-editor-actions'
import { monacoTheme } from '@shared/constants/monaco-theme/monaco-theme'
@ -30,7 +31,7 @@ export function SubscriptionTemplateEditorWidget(props: Props) {
const getConfig = () => {
if (editorType === 'yaml') {
return template.encodedTemplateYaml
? Buffer.from(template.encodedTemplateYaml, 'base64').toString()
? new TextDecoder().decode(decode(template.encodedTemplateYaml))
: ''
}
return JSON.stringify(template.templateJson, null, 2)

View file

@ -67,8 +67,6 @@ export default defineConfig({
utils: [
'nanoid',
'ufo',
'base64-js',
'buffer',
'consola',
'semver',
'is-svg',