mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-11-22 06:09:55 +00:00
build(web,sign): drop vite-plugin-node-polyfills and its elliptic dependency (#70)
vite-plugin-node-polyfills depends on node-stdlib-browser, which always installs crypto-browserify -> browserify-sign/create-ecdh -> elliptic (GHSA-848j-6mx2-7j84, no patched release). No module in either bundle ever imported the crypto polyfill; what the plugin actually provided was three injected globals and the `events` alias. sign: the only call sites were @pezkuwi/x-global (`global`, after a globalThis check), shared/lib env helpers (`process`, typeof-guarded) and bn.js's optional Buffer probe (try/catch; BN#toBuffer has no callers). The plugin, the process shim alias and the `buffer` pre-bundle entry are removed outright. web: WalletConnect calls `Buffer.from` unguarded and imports `events`, so the globals are still needed. src/lib/node-globals.ts now provides Buffer/global/process, injected as scoped imports by @rollup/plugin-inject in the build and by esbuild's inject in the dev pre-bundle - the same 18 modules the plugin injected into, and still nothing written onto globalThis. `events` becomes a direct dependency. The unused shim files, the vitest shim aliases and the `elliptic` override are removed.
This commit is contained in:
1 parent
d703331d85
commit
11fbe41a8a
16 files changed
+62
-3079
No files matched your search
+2
-2
@@ -69,6 +69,7 @@
|
||||
"date-fns": "^3.6.0",
|
||||
"dompurify": "^3.4.17",
|
||||
"embla-carousel-react": "^8.3.0",
|
||||
"events": "^3.3.0",
|
||||
"highlight.js": "^11.9.0",
|
||||
"i18next": "^23.7.6",
|
||||
"i18next-browser-languagedetector": "^7.2.0",
|
||||
@@ -116,7 +117,6 @@
|
||||
"@pezkuwi/x-textencoder": "^14.0.26",
|
||||
"@pezkuwi/x-ws": "^14.0.26",
|
||||
"@pezkuwi/networks": "^14.0.26",
|
||||
"elliptic": "^6.6.1",
|
||||
"@tailwindcss/typography": {
|
||||
"postcss-selector-parser": "6.1.5"
|
||||
},
|
||||
@@ -126,6 +126,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.9.0",
|
||||
"@rollup/plugin-inject": "^5.0.5",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
"@testing-library/react": "^16.3.0",
|
||||
@@ -152,7 +153,6 @@
|
||||
"typescript": "^5.5.3",
|
||||
"typescript-eslint": "^8.0.1",
|
||||
"vite": "^7.3.7",
|
||||
"vite-plugin-node-polyfills": "^0.25.0",
|
||||
"vite-plugin-subresource-integrity": "^0.0.12",
|
||||
"vitest": "^4.1.12"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user