diff --git a/components.d.ts b/components.d.ts index a190f7a3..73fec6aa 100644 --- a/components.d.ts +++ b/components.d.ts @@ -68,6 +68,7 @@ declare module '@vue/runtime-core' { 'CTextCopyable.demo': typeof import('./src/ui/c-text-copyable/c-text-copyable.demo.vue')['default'] CTooltip: typeof import('./src/ui/c-tooltip/c-tooltip.vue')['default'] 'CTooltip.demo': typeof import('./src/ui/c-tooltip/c-tooltip.demo.vue')['default'] + CurlConverter: typeof import('./src/tools/curl-converter/curl-converter.vue')['default'] DateTimeConverter: typeof import('./src/tools/date-time-converter/date-time-converter.vue')['default'] 'DemoHome.page': typeof import('./src/ui/demo/demo-home.page.vue')['default'] DemoWrapper: typeof import('./src/ui/demo/demo-wrapper.vue')['default'] diff --git a/package.json b/package.json index abc7caac..5e0b78b4 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "cron-validator": "^1.3.1", "cronstrue": "^2.26.0", "crypto-js": "^4.1.1", + "curlconverter": "^4.10.1", "date-fns": "^2.29.3", "decomposerize": "^1.4.1", "dns-query": "^0.11.2", @@ -174,6 +175,7 @@ "vite": "^4.4.9", "vite-plugin-node-polyfills": "^0.22.0", "vite-plugin-pwa": "^0.16.0", + "vite-plugin-top-level-await": "^1.4.2", "vite-plugin-vue-markdown": "^0.23.5", "vite-svg-loader": "^4.0.0", "vitest": "^0.34.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8f7d8694..7380d973 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -92,6 +92,9 @@ importers: crypto-js: specifier: ^4.1.1 version: 4.1.1 + curlconverter: + specifier: ^4.10.1 + version: 4.11.0 date-fns: specifier: ^2.29.3 version: 2.29.3 @@ -414,6 +417,9 @@ importers: vite-plugin-pwa: specifier: ^0.16.0 version: 0.16.0(vite@4.4.9(@types/node@18.15.11)(less@4.1.3)(sass@1.80.4)(terser@5.24.0))(workbox-build@7.0.0)(workbox-window@7.0.0) + vite-plugin-top-level-await: + specifier: ^1.4.2 + version: 1.4.4(rollup@2.79.1)(vite@4.4.9(@types/node@18.15.11)(less@4.1.3)(sass@1.80.4)(terser@5.24.0)) vite-plugin-vue-markdown: specifier: ^0.23.5 version: 0.23.5(rollup@2.79.1)(vite@4.4.9(@types/node@18.15.11)(less@4.1.3)(sass@1.80.4)(terser@5.24.0)) @@ -1795,6 +1801,15 @@ packages: peerDependencies: rollup: ^1.20.0 || ^2.0.0 + '@rollup/plugin-virtual@3.0.2': + resolution: {integrity: sha512-10monEYsBp3scM4/ND4LNH5Rxvh3e/cVeL3jWTgZ2SrQ+BmUoQcopVQvnaMcOnykb1VkxUFuDAN+0FnpTFRy2A==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + '@rollup/pluginutils@3.1.0': resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==} engines: {node: '>= 8.0.0'} @@ -1842,6 +1857,81 @@ packages: '@svgdotjs/svg.js@3.2.4': resolution: {integrity: sha512-BjJ/7vWNowlX3Z8O4ywT58DqbNRyYlkk6Yz/D13aB7hGmfQTvGX4Tkgtm/ApYlu9M7lCQi15xUEidqMUmdMYwg==} + '@swc/core-darwin-arm64@1.8.0': + resolution: {integrity: sha512-TIus1/SE/Ud4g84hCnchcagu+LfyndSDy5r5qf64nflojejDidPU9Fp1InzQhQpEgIpntnZID/KFCP5rQnvsIw==} + engines: {node: '>=10'} + cpu: [arm64] + os: [darwin] + + '@swc/core-darwin-x64@1.8.0': + resolution: {integrity: sha512-yCb1FHCX/HUmNRGB1X3CFJ1WPKXMosZVUe3K2TrosCGvytwgaLoW5FS0bZg5Qv6cEUERQBg75cJnOUPwLLRCVg==} + engines: {node: '>=10'} + cpu: [x64] + os: [darwin] + + '@swc/core-linux-arm-gnueabihf@1.8.0': + resolution: {integrity: sha512-6TdjVdiLaSW+eGiHKEojMDlx673nowrPHa6nM6toWgRzy8tIZgjPOguVKJDoMnoHuvO7SkOLCUiMRw0rTskypA==} + engines: {node: '>=10'} + cpu: [arm] + os: [linux] + + '@swc/core-linux-arm64-gnu@1.8.0': + resolution: {integrity: sha512-TU2YcTornnyZiJUabRuk7Xtvzaep11FwK77IkFomjN9/Os5s25B8ea652c2fAQMe9RsM84FPVmX303ohxavjKQ==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + + '@swc/core-linux-arm64-musl@1.8.0': + resolution: {integrity: sha512-2CdPTEKxx2hJIj/B0fn8L8k2coo/FDS95smzXyi2bov5FcrP6Ohboq8roFBYgj38fkHusXjY8qt+cCH7yXWAdg==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + + '@swc/core-linux-x64-gnu@1.8.0': + resolution: {integrity: sha512-14StQBifCs/AMsySdU95OmwNJr9LOVqo6rcTFt2b7XaWpe/AyeuMJFxcndLgUewksJHpfepzCTwNdbcYmuNo6A==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + + '@swc/core-linux-x64-musl@1.8.0': + resolution: {integrity: sha512-qemJnAQlYqKCfWNqVv5SG8uGvw8JotwU86cuFUkq35oTB+dsSFM3b83+B1giGTKKFOh2nfWT7bvPXTKk+aUjew==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + + '@swc/core-win32-arm64-msvc@1.8.0': + resolution: {integrity: sha512-fXt5vZbnrVdXZzGj2qRnZtY3uh+NtLCaFjS2uD9w8ssdbjhbDZYlJCj2JINOjv35ttEfAD2goiYmVa5P/Ypl+g==} + engines: {node: '>=10'} + cpu: [arm64] + os: [win32] + + '@swc/core-win32-ia32-msvc@1.8.0': + resolution: {integrity: sha512-W4FA2vSJ+bGYiTj6gspxghSdKQNLfLMo65AH07u797x7I+YJj8amnFY/fQRlroDv5Dez/FHTv14oPlTlNFUpIw==} + engines: {node: '>=10'} + cpu: [ia32] + os: [win32] + + '@swc/core-win32-x64-msvc@1.8.0': + resolution: {integrity: sha512-Il4y8XwKDV0Bnk0IpA00kGcSQC6I9XOIinW5egTutnwIDfDE+qsD0j+0isW5H76GetY3/Ze0lVxeOXLAUgpegA==} + engines: {node: '>=10'} + cpu: [x64] + os: [win32] + + '@swc/core@1.8.0': + resolution: {integrity: sha512-EF8C5lp1RKMp3426tAKwQyVbg4Zcn/2FDax3cz8EcOXYQJM/ctB687IvBm9Ciej1wMcQ/dMRg+OB4Xl8BGLBoA==} + engines: {node: '>=10'} + peerDependencies: + '@swc/helpers': '*' + peerDependenciesMeta: + '@swc/helpers': + optional: true + + '@swc/counter@0.1.3': + resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} + + '@swc/types@0.1.14': + resolution: {integrity: sha512-PbSmTiYCN+GMrvfjrMo9bdY+f2COnwbdnoMw7rqU/PI5jXpKjxOGZ0qqZCImxnT81NkNsKnmEpvu+hRXLBeCJg==} + '@tabler/icons-vue@3.20.0': resolution: {integrity: sha512-kymV0q+bFNqU6bmdlnfK9ru88xFydYIs+jfe0160bLTmcq94ZxcLfXO5JLMq5kjntUSNb4fBvGk0mXB7aDCYnA==} peerDependencies: @@ -3096,6 +3186,10 @@ packages: csstype@3.1.2: resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} + curlconverter@4.11.0: + resolution: {integrity: sha512-jBSvfDN10L6rGWVlkAYgtkIG8lYprDvtBgos7mafxtv15keYeQWsxUgnzns3JmqEcGJMeaGlDNdRUszURPCUaw==} + hasBin: true + dash-get@1.0.2: resolution: {integrity: sha512-4FbVrHDwfOASx7uQVxeiCTo7ggSdYZbqs8lH+WU6ViypPlDbe9y6IP5VVUDQBv9DcnyaiPT5XT0UWHgJ64zLeQ==} @@ -4502,6 +4596,9 @@ packages: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true + lossless-json@4.0.2: + resolution: {integrity: sha512-+z0EaLi2UcWi8MZRxA5iTb6m4Ys4E80uftGY+yG5KNFJb5EceQXOhdW/pWJZ8m97s26u7yZZAYMcKWNztSZssA==} + loupe@2.3.6: resolution: {integrity: sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==} @@ -4763,6 +4860,10 @@ packages: node-addon-api@7.1.1: resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==} + node-addon-api@8.2.1: + resolution: {integrity: sha512-vmEOvxwiH8tlOcv4SyE8RH34rI5/nWVaigUeAUPawC6f0+HoDthwI0vkMu4tbtsZrXq6QXFfrkhjofzKEs5tpA==} + engines: {node: ^18 || ^20 || >= 21} + node-domexception@1.0.0: resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} engines: {node: '>=10.5.0'} @@ -4787,6 +4888,10 @@ packages: resolution: {integrity: sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==} engines: {node: '>= 6.13.0'} + node-gyp-build@4.8.2: + resolution: {integrity: sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==} + hasBin: true + node-releases@2.0.12: resolution: {integrity: sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==} @@ -5818,6 +5923,18 @@ packages: resolution: {integrity: sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==} engines: {node: '>=14'} + tree-sitter-bash@0.23.1: + resolution: {integrity: sha512-9rOVcfrTQsnNapHPsacaNATEurBdNqozcbyHJNVvI85PMNilcWnD9FM4HaA/L4IDfgvS7F9OStON4I7tY+ANEQ==} + peerDependencies: + tree-sitter: ^0.21.1 + tree_sitter: '*' + peerDependenciesMeta: + tree_sitter: + optional: true + + tree-sitter@0.21.1: + resolution: {integrity: sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==} + treemate@0.3.11: resolution: {integrity: sha512-M8RGFoKtZ8dF+iwJfAJTOH/SM4KluKOKRJpjCMhI8bG3qB74zrFoArKZ62ll0Fr3mqkMJiQOmWYkdYgDeITYQg==} @@ -6098,6 +6215,10 @@ packages: util@0.12.5: resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} + uuid@10.0.0: + resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} + hasBin: true + uuid@9.0.0: resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==} hasBin: true @@ -6137,6 +6258,11 @@ packages: workbox-build: ^7.0.0 workbox-window: ^7.0.0 + vite-plugin-top-level-await@1.4.4: + resolution: {integrity: sha512-QyxQbvcMkgt+kDb12m2P8Ed35Sp6nXP+l8ptGrnHV9zgYDUpraO0CPdlqLSeBqvY2DToR52nutDG7mIHuysdiw==} + peerDependencies: + vite: '>=2.8' + vite-plugin-vue-markdown@0.23.5: resolution: {integrity: sha512-NXTZ4y+n691gLPWayMBbh4jldQeaqDp9e9WjWUYbn9obsLqS9qU+hr4RAruDq5kP4siTOp7JDV34Sw5eA7WxLg==} peerDependencies: @@ -6304,6 +6430,9 @@ packages: resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==} engines: {node: '>= 8'} + web-tree-sitter@0.24.3: + resolution: {integrity: sha512-uR9YNewr1S2EzPKE+y39nAwaTyobBaZRG/IsfkB/OT4v0lXtNj5WjtHKgn2h7eOYUWIZh5rK9Px7tI6S9CRKdA==} + webcrack@2.14.1: resolution: {integrity: sha512-ScAvB+51n0YkfBhZwqsrqmsWeYrZmXDJaCZU7ZYMnot3CVdzHRXgzDw0rw7hO9eusOOHc3pvPw6pqme6s6ritw==} hasBin: true @@ -6491,6 +6620,10 @@ packages: resolution: {integrity: sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==} engines: {node: '>= 14'} + yamljs@0.3.0: + resolution: {integrity: sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==} + hasBin: true + yargs-parser@13.1.2: resolution: {integrity: sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==} @@ -8181,6 +8314,10 @@ snapshots: magic-string: 0.25.9 rollup: 2.79.1 + '@rollup/plugin-virtual@3.0.2(rollup@2.79.1)': + optionalDependencies: + rollup: 2.79.1 + '@rollup/pluginutils@3.1.0(rollup@2.79.1)': dependencies: '@types/estree': 0.0.39 @@ -8228,6 +8365,58 @@ snapshots: '@svgdotjs/svg.js@3.2.4': {} + '@swc/core-darwin-arm64@1.8.0': + optional: true + + '@swc/core-darwin-x64@1.8.0': + optional: true + + '@swc/core-linux-arm-gnueabihf@1.8.0': + optional: true + + '@swc/core-linux-arm64-gnu@1.8.0': + optional: true + + '@swc/core-linux-arm64-musl@1.8.0': + optional: true + + '@swc/core-linux-x64-gnu@1.8.0': + optional: true + + '@swc/core-linux-x64-musl@1.8.0': + optional: true + + '@swc/core-win32-arm64-msvc@1.8.0': + optional: true + + '@swc/core-win32-ia32-msvc@1.8.0': + optional: true + + '@swc/core-win32-x64-msvc@1.8.0': + optional: true + + '@swc/core@1.8.0': + dependencies: + '@swc/counter': 0.1.3 + '@swc/types': 0.1.14 + optionalDependencies: + '@swc/core-darwin-arm64': 1.8.0 + '@swc/core-darwin-x64': 1.8.0 + '@swc/core-linux-arm-gnueabihf': 1.8.0 + '@swc/core-linux-arm64-gnu': 1.8.0 + '@swc/core-linux-arm64-musl': 1.8.0 + '@swc/core-linux-x64-gnu': 1.8.0 + '@swc/core-linux-x64-musl': 1.8.0 + '@swc/core-win32-arm64-msvc': 1.8.0 + '@swc/core-win32-ia32-msvc': 1.8.0 + '@swc/core-win32-x64-msvc': 1.8.0 + + '@swc/counter@0.1.3': {} + + '@swc/types@0.1.14': + dependencies: + '@swc/counter': 0.1.3 + '@tabler/icons-vue@3.20.0(vue@3.3.4)': dependencies: '@tabler/icons': 3.20.0 @@ -9833,6 +10022,17 @@ snapshots: csstype@3.1.2: {} + curlconverter@4.11.0: + dependencies: + jsesc: 3.0.2 + lossless-json: 4.0.2 + tree-sitter: 0.21.1 + tree-sitter-bash: 0.23.1(tree-sitter@0.21.1) + web-tree-sitter: 0.24.3 + yamljs: 0.3.0 + transitivePeerDependencies: + - tree_sitter + dash-get@1.0.2: {} data-uri-to-buffer@4.0.1: {} @@ -11339,6 +11539,8 @@ snapshots: dependencies: js-tokens: 4.0.0 + lossless-json@4.0.2: {} + loupe@2.3.6: dependencies: get-func-name: 2.0.0 @@ -11628,6 +11830,8 @@ snapshots: node-addon-api@7.1.1: {} + node-addon-api@8.2.1: {} + node-domexception@1.0.0: {} node-fetch-native@1.4.1: {} @@ -11644,6 +11848,8 @@ snapshots: node-forge@1.3.1: {} + node-gyp-build@4.8.2: {} + node-releases@2.0.12: {} node-releases@2.0.13: {} @@ -12858,6 +13064,17 @@ snapshots: dependencies: punycode: 2.3.1 + tree-sitter-bash@0.23.1(tree-sitter@0.21.1): + dependencies: + node-addon-api: 8.2.1 + node-gyp-build: 4.8.2 + tree-sitter: 0.21.1 + + tree-sitter@0.21.1: + dependencies: + node-addon-api: 8.2.1 + node-gyp-build: 4.8.2 + treemate@0.3.11: {} ts-api-utils@1.0.1(typescript@5.2.2): @@ -13161,6 +13378,8 @@ snapshots: is-typed-array: 1.1.12 which-typed-array: 1.1.13 + uuid@10.0.0: {} + uuid@9.0.0: {} validate-npm-package-license@3.0.4: @@ -13276,6 +13495,16 @@ snapshots: transitivePeerDependencies: - supports-color + vite-plugin-top-level-await@1.4.4(rollup@2.79.1)(vite@4.4.9(@types/node@18.15.11)(less@4.1.3)(sass@1.80.4)(terser@5.24.0)): + dependencies: + '@rollup/plugin-virtual': 3.0.2(rollup@2.79.1) + '@swc/core': 1.8.0 + uuid: 10.0.0 + vite: 4.4.9(@types/node@18.15.11)(less@4.1.3)(sass@1.80.4)(terser@5.24.0) + transitivePeerDependencies: + - '@swc/helpers' + - rollup + vite-plugin-vue-markdown@0.23.5(rollup@2.79.1)(vite@4.4.9(@types/node@18.15.11)(less@4.1.3)(sass@1.80.4)(terser@5.24.0)): dependencies: '@antfu/utils': 0.7.4 @@ -13439,6 +13668,8 @@ snapshots: web-streams-polyfill@3.2.1: {} + web-tree-sitter@0.24.3: {} + webcrack@2.14.1: dependencies: '@babel/generator': 7.26.2 @@ -13681,6 +13912,11 @@ snapshots: yaml@2.2.1: {} + yamljs@0.3.0: + dependencies: + argparse: 1.0.10 + glob: 7.2.3 + yargs-parser@13.1.2: dependencies: camelcase: 5.3.1 diff --git a/public/tree-sitter-bash.wasm b/public/tree-sitter-bash.wasm new file mode 100755 index 00000000..869f41d8 Binary files /dev/null and b/public/tree-sitter-bash.wasm differ diff --git a/public/tree-sitter.wasm b/public/tree-sitter.wasm new file mode 100755 index 00000000..0ac880b8 Binary files /dev/null and b/public/tree-sitter.wasm differ diff --git a/src/tools/curl-converter/curl-converter.vue b/src/tools/curl-converter/curl-converter.vue new file mode 100644 index 00000000..e55fecc3 --- /dev/null +++ b/src/tools/curl-converter/curl-converter.vue @@ -0,0 +1,133 @@ + + + diff --git a/src/tools/curl-converter/index.ts b/src/tools/curl-converter/index.ts new file mode 100644 index 00000000..1e13664d --- /dev/null +++ b/src/tools/curl-converter/index.ts @@ -0,0 +1,12 @@ +import { ExternalLink } from '@vicons/tabler'; +import { defineTool } from '../tool'; + +export const tool = defineTool({ + name: 'Curl Converter', + path: '/curl-converter', + description: 'Generate common coding languages version of provided curl command line', + keywords: ['curl', 'code', 'language', 'generator'], + component: () => import('./curl-converter.vue'), + icon: ExternalLink, + createdAt: new Date('2024-04-20'), +}); diff --git a/src/tools/index.ts b/src/tools/index.ts index 6bdf047a..f45cb940 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -31,6 +31,7 @@ import { tool as propertiesToYaml } from './properties-to-yaml'; import { tool as apiTester } from './api-tester'; import { tool as imageToCss } from './image-to-css'; import { tool as jsonToSchema } from './json-to-schema'; +import { tool as curlConverter } from './curl-converter'; import { tool as pdfSignatureChecker } from './pdf-signature-checker'; import { tool as uuidConverter } from './uuid-converter'; import { tool as numeronymGenerator } from './numeronym-generator'; @@ -219,6 +220,7 @@ export const toolsByCategory: ToolCategory[] = [ regexMemo, extractTextFromHtml, jsonToSchema, + curlConverter, ], }, { diff --git a/vite.config.ts b/vite.config.ts index aba6aa3f..05ac9af0 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -16,6 +16,7 @@ import markdown from 'vite-plugin-vue-markdown'; import svgLoader from 'vite-svg-loader'; import { configDefaults } from 'vitest/config'; import { nodePolyfills } from 'vite-plugin-node-polyfills'; +import topLevelAwait from "vite-plugin-top-level-await"; const baseUrl = process.env.BASE_URL ?? '/'; @@ -105,6 +106,12 @@ export default defineConfig({ nodePolyfills({ exclude: ['fs'], }), + topLevelAwait({ + // The export name of top-level await promise for each chunk module + promiseExportName: '__tla', + // The function to generate import names of top-level await promise in each chunk module + promiseImportName: i => `__tla_${i}`, + }), ], base: baseUrl, resolve: {