Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
feat: add Vite plugins for WASM support and top-level await functionality
Tonhocf8b7c96dc2e
diff --git a/package.json b/package.jsonindex 840b141b..3bcdce44 100644--- a/package.json+++ b/package.json@@ -77,6 +77,8 @@"svelte-check": "^4.0.0","typescript": "~5.6.2","vite": "^6.0.3",+ "vite-plugin-top-level-await": "^1.5.0",+ "vite-plugin-wasm": "^3.4.1","vitest": "^4.1.4"}}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 8ee362d3..a63c1673 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -171,6 +171,12 @@ importers:vite:specifier: ^6.0.3version: 6.4.1(@types/[email protected])([email protected])+ vite-plugin-top-level-await:+ specifier: ^1.5.0+ vite-plugin-wasm:+ specifier: ^3.4.1vitest:specifier: ^4.1.4version: 4.1.4(@types/[email protected])([email protected](@types/[email protected])([email protected]))@@ -424,6 +430,15 @@ packages:'@polka/[email protected]':resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==}+ '@rollup/[email protected]':+ 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/[email protected]':resolution: {integrity: sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg==}cpu: [arm]@@ -614,6 +629,102 @@ packages:'@sveltekit-i18n/[email protected]':resolution: {integrity: sha512-/gtzLlqm/sox7EoPKD56BxGZktK/syGc79EbJAPWY5KVitQD9SM0TP8yJCqDxTVPk7Lk0WJhrBGUE2Nn0f5M1w==}+ '@swc/[email protected]':+ resolution: {integrity: sha512-N+L0uXhuO7FIfzqwgxmzv0zIpV0qEp8wPX3QQs2p4atjMoywup2JTeDlXPw+z9pWJGCae3JjM+tZ6myclI+2gA==}+ engines: {node: '>=10'}+ cpu: [arm64]+ os: [darwin]++ '@swc/[email protected]':+ resolution: {integrity: sha512-/Il4QHSOhV4FekbsDtkrNmKbsX26oSysvgrRswa/RYOHXAkwXDbB4jaeKq6PsJLSPkzJ2KzQ061gtBnk0vNHfA==}+ engines: {node: '>=10'}+ cpu: [x64]+ os: [darwin]++ '@swc/[email protected]':+ resolution: {integrity: sha512-C64hBnBxq4viOPQ8hlx+2lJ23bzZBGnjw7ryALmS+0Q3zHmwO8lw1/DArLENw4Q18/0w5wdEO1k3m1wWNtKGqQ==}+ engines: {node: '>=10'}+ cpu: [arm]+ os: [linux]++ '@swc/[email protected]':+ resolution: {integrity: sha512-TRJfnJbX3jqpxRDRoieMzRiCBS5jOmXNb3iQXmcgjFEHKLnAgK1RZRU8Cq1MsPqO4jAJp/ld1G4O3fXuxv85uw==}+ engines: {node: '>=10'}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]++ '@swc/[email protected]':+ resolution: {integrity: sha512-il7tYM+CpUNzieQbwAjFT1P8zqAhmGWNAGhQZBnxurXZ0aNn+5nqYFTEUKNZl7QibtT0uQXzTZrNGHCIj6Y1Og==}+ engines: {node: '>=10'}+ cpu: [arm64]+ os: [linux]+ libc: [musl]++ '@swc/[email protected]':+ resolution: {integrity: sha512-ZtNBwN0Z7CFj9Il0FcPaKdjgP7URyKu/3RfH46vq+0paOBqLj4NYldD6Qo//Duif/7IOtAraUfDOmp0PLAufog==}+ engines: {node: '>=10'}+ cpu: [ppc64]+ os: [linux]+ libc: [glibc]++ '@swc/[email protected]':+ resolution: {integrity: sha512-De1IyajoOmhOYYjw/lx66bKlyDpHZTueqwpDrWgf5O7T6d1ODeJJO9/OqMBmrBQc5C+dNnlmIufHsp4QVCWufA==}+ engines: {node: '>=10'}+ cpu: [s390x]+ os: [linux]+ libc: [glibc]++ '@swc/[email protected]':+ resolution: {integrity: sha512-mGTH0YxmUN+x6vRN/I6NOk5X0ogNktkwPnJ94IMvR7QjhRDwL0O8RXEDhyUM0YtwWrryBOqaJQBX4zruxEPRGw==}+ engines: {node: '>=10'}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ '@swc/[email protected]':+ resolution: {integrity: sha512-hj628ZkSEJf6zMf5VMbYrG2O6QqyTIp2qwY6VlCjvIa9lAEZ5c2lfPblCLVGYubTeLJDxadLB/CxqQYOQABeEQ==}+ engines: {node: '>=10'}+ cpu: [x64]+ os: [linux]+ libc: [musl]++ '@swc/[email protected]':+ resolution: {integrity: sha512-GV2oohtN2/5+KSccl86VULu3aT+LrISC8uzgSq0FRnikpD+Zwc+sBlXmoKQ+Db6jI57ITUOIB8jRkdGMABC29g==}+ engines: {node: '>=10'}+ cpu: [arm64]+ os: [win32]++ '@swc/[email protected]':+ resolution: {integrity: sha512-gtyvzSNR8DHKfFEA2uqb8Ld1myqi6uEg2jyeUq3ikn5ytYs7H8RpZYC8mdy4NXr8hfcdJfCLXPlYaqqfBXpoEQ==}+ engines: {node: '>=10'}+ cpu: [ia32]+ os: [win32]++ '@swc/[email protected]':+ resolution: {integrity: sha512-d6fRqQSkJI+kmMEBWaDQ7TMl8+YjLYbwRUPZQ9DY0ORBJeTzOrG0twvfvlZ2xgw6jA0ScQKgfBm4vHLSLl5Hqg==}+ engines: {node: '>=10'}+ cpu: [x64]+ os: [win32]++ '@swc/[email protected]':+ resolution: {integrity: sha512-jOlwnFV2xhuuZeAUILGFULeR6vDPfijEJ57evfocwznQldLU3w2cZ9bSDryY9ip+AsM3r1NJKzf47V2NXebkeQ==}+ engines: {node: '>=10'}+ peerDependencies:+ '@swc/helpers': '>=0.5.17'+ peerDependenciesMeta:+ '@swc/helpers':+ optional: true++ '@swc/[email protected]':+ resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==}++ '@swc/[email protected]':+ resolution: {integrity: sha512-lyMwd7WGgG79RS7EERZV3T8wMdmPq3xwyg+1nmAM64kIhx5yl+juO2PYIHb7vTiPgPCj8LYjsNV2T5wiQHUEaw==}++ '@swc/[email protected]':+ resolution: {integrity: sha512-uZPBvYMwjvTtyNm018KFV6ino5ZL4z9riN/tBsfTSgbfONW9Jn+ca88+UeEIdMOZY5Dm+y2OBf6o0kxa1wfD0A==}+'@tauri-apps/[email protected]':resolution: {integrity: sha512-hKL/jWf293UDSUN09rR69hrToyIXBb8CjGaWC7gfinvnQrBVvnLr08FeFi38gxtugAVyVcTa5/FD/Xnkb1siBw==}@@ -1821,6 +1932,11 @@ packages:resolution: {integrity: sha512-ZgpWDC5gmNiuY9CnLVXEH8rl50xhRCuLNA97fAUnKi8RRuV4E6KG31pDTsLVUKnohJE0I3XDrTeEydAXRw47xg==}engines: {node: '>=18.17'}+ resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==}+ deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).+ hasBin: true+resolution: {integrity: sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ==}hasBin: true@@ -1829,6 +1945,16 @@ packages:resolution: {integrity: sha512-pI2aixBuOpu/LSnRgNJ40tU/KFW+x1X+O2bW1hz946ZZShDM5oqRXF9pavDOuckHAHPgUN9HYUr9vUNTBUPF1Q==}engines: {node: '>=16'}+ resolution: {integrity: sha512-bNhUreLamTIkoulCR9aDXbTbhLk6n1YE8NJUTTxl5RYskNRtzOR0ASzSjBVRtNdjIfngDXo11qOsybGLNsrdww==}+ peerDependencies:+ vite: '>=2.8'++ resolution: {integrity: sha512-mL/QPziiIA4RAA6DkaZZzOstdwbW5jO4Vz7Zenj0wieKWBlNvIvX5L5ljum9lcUX0ShNfBgCNLKTjNkRVVqcsw==}+ peerDependencies:+ vite: ^2 || ^3 || ^4 || ^5 || ^6 || ^7 || ^8+resolution: {integrity: sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==}engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}@@ -2141,6 +2267,10 @@ snapshots:'@polka/[email protected]': {}+ '@rollup/[email protected]([email protected])':+ optionalDependencies:+ rollup: 4.57.1+'@rollup/[email protected]':optional: true@@ -2275,6 +2405,68 @@ snapshots:'@sveltekit-i18n/[email protected]': {}+ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ optional: true++ '@swc/[email protected]':+ dependencies:+ '@swc/counter': 0.1.3+ '@swc/types': 0.1.26+ optionalDependencies:+ '@swc/core-darwin-arm64': 1.15.33+ '@swc/core-darwin-x64': 1.15.33+ '@swc/core-linux-arm-gnueabihf': 1.15.33+ '@swc/core-linux-arm64-gnu': 1.15.33+ '@swc/core-linux-arm64-musl': 1.15.33+ '@swc/core-linux-ppc64-gnu': 1.15.33+ '@swc/core-linux-s390x-gnu': 1.15.33+ '@swc/core-linux-x64-gnu': 1.15.33+ '@swc/core-linux-x64-musl': 1.15.33+ '@swc/core-win32-arm64-msvc': 1.15.33+ '@swc/core-win32-ia32-msvc': 1.15.33+ '@swc/core-win32-x64-msvc': 1.15.33++ '@swc/[email protected]': {}++ '@swc/[email protected]':+ dependencies:+ '@swc/counter': 0.1.3++ '@swc/[email protected]': {}+'@tauri-apps/[email protected]': {}'@tauri-apps/[email protected]':@@ -3609,6 +3801,8 @@ snapshots:+ [email protected]: {}+@@ -3617,6 +3811,21 @@ snapshots:media-captions: 0.0.18type-fest: 3.13.1+ [email protected]([email protected])([email protected](@types/[email protected])([email protected])):+ dependencies:+ '@rollup/plugin-virtual': 3.0.2([email protected])+ '@swc/core': 1.15.33+ '@swc/wasm': 1.15.33+ uuid: 10.0.0+ vite: 6.4.1(@types/[email protected])([email protected])+ transitivePeerDependencies:+ - '@swc/helpers'+ - rollup++ dependencies:+ vite: 6.4.1(@types/[email protected])([email protected])+dependencies:esbuild: 0.25.12diff --git a/vite.config.js b/vite.config.jsindex 4efae78d..07382e32 100644--- a/vite.config.js+++ b/vite.config.js@@ -1,5 +1,7 @@import { defineConfig } from "vite";import { sveltekit } from "@sveltejs/kit/vite";+import wasm from "vite-plugin-wasm";+import topLevelAwait from "vite-plugin-top-level-await";import { execSync, spawnSync } from "child_process";import { readFileSync, existsSync } from "fs";import path from "path";@@ -58,7 +60,27 @@ export default defineConfig(async ({ command }) => {(isBuild && process.env.OMNIGET_I18N_STRICT !== "0");return {- plugins: [i18nKeysPlugin({ strict: strictI18n }), sveltekit()],+ plugins: [+ i18nKeysPlugin({ strict: strictI18n }),+ wasm(),+ topLevelAwait(),+ sveltekit(),+ ],++ // PlantUML / Graphviz packages ship WASM + workers that need special+ // handling. `optimizeDeps.exclude` keeps the dep optimizer out of the way+ // so vite-plugin-wasm gets to handle the wasm imports. The graphviz+ // package internally spawns a worker — Vite 6 requires worker.format=es+ // for code-splitting builds, otherwise it errors with "Invalid value 'iife'".+ optimizeDeps: {+ exclude: [+ "@kookyleo/plantuml-little-web",+ "@kookyleo/graphviz-anywhere-web",+ ],+ },+ worker: {+ format: "es",+ },define: {__COMMIT_HASH__: JSON.stringify(gitInfo.hash),