From 46059b1da73c73a86c695eb65964048abf19a8f9 Mon Sep 17 00:00:00 2001 From: "David R. Myers" Date: Fri, 22 Dec 2023 23:38:40 -0500 Subject: [PATCH 1/4] Add support for subpath polyfills --- README.md | 4 +++- package.json | 2 ++ pnpm-lock.yaml | 19 +++++++++++++++ src/index.ts | 65 +++++++++++++++++++++++++++++++++++++------------- src/utils.ts | 34 +++++++++++++++++++++++--- 5 files changed, 104 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index cf9f0f0..d591f8a 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,9 @@ export default defineConfig({ // Override the default polyfills for specific modules. overrides: { // Since `fs` is not supported in browsers, we can use the `memfs` package to polyfill it. - fs: 'memfs', + 'fs': 'memfs', + // Subpaths can be specified as well. + 'path/posix': 'path-browserify', }, // Whether to polyfill `node:` protocol imports. protocolImports: true, diff --git a/package.json b/package.json index 841df36..d9134b0 100644 --- a/package.json +++ b/package.json @@ -95,10 +95,12 @@ }, "dependencies": { "@rollup/plugin-inject": "^5.0.5", + "browser-resolve": "^2.0.0", "node-stdlib-browser": "^1.2.0" }, "devDependencies": { "@playwright/test": "^1.40.1", + "@types/browser-resolve": "^2.0.4", "@types/node": "^18.18.8", "buffer": "6.0.3", "esbuild": "^0.19.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d6f5ed5..dd5bc12 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: '@rollup/plugin-inject': specifier: ^5.0.5 version: 5.0.5(rollup@4.6.0) + browser-resolve: + specifier: ^2.0.0 + version: 2.0.0 node-stdlib-browser: specifier: ^1.2.0 version: 1.2.0 @@ -27,6 +30,9 @@ importers: '@playwright/test': specifier: ^1.40.1 version: 1.40.1 + '@types/browser-resolve': + specifier: ^2.0.4 + version: 2.0.4 '@types/node': specifier: ^18.18.8 version: 18.18.8 @@ -675,6 +681,9 @@ packages: '@types/babel__traverse@7.20.3': resolution: {integrity: sha512-Lsh766rGEFbaxMIDH7Qa+Yha8cMVI3qAK6CHt3OR0YfxOIn5Z54iHiyDRycHrBqeIiqGa20Kpsv1cavfBKkRSw==} + '@types/browser-resolve@2.0.4': + resolution: {integrity: sha512-6qR8ne4oBrfDcM1ZM+CY+OY29zQ22+7bgrLDDCeyt7QNqyIh+tJkmnN18dg7PrxnEVy3YG7Gs61NQJvOc5tTpA==} + '@types/estree@1.0.4': resolution: {integrity: sha512-2JwWnHK9H+wUZNorf2Zr6ves96WHoWDJIftkcxPKsS7Djta6Zu519LarhRNljPXkpsZR2ZMwNCPeW7omW07BJw==} @@ -711,6 +720,9 @@ packages: '@types/react@18.2.34': resolution: {integrity: sha512-U6eW/alrRk37FU/MS2RYMjx0Va2JGIVXELTODaTIYgvWGCV4Y4TfTUzG8DdmpDNIT0Xpj/R7GfyHOJJrDttcvg==} + '@types/resolve@1.20.6': + resolution: {integrity: sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==} + '@types/scheduler@0.16.5': resolution: {integrity: sha512-s/FPdYRmZR8SjLWGMCuax7r3qCWQw9QKHzXVukAuuIJkXkDRwp+Pu5LMIVFi0Fxbav35WURicYr8u1QsoybnQw==} @@ -1935,6 +1947,7 @@ packages: lodash.isequal@4.5.0: resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} + deprecated: This package is deprecated. Use require('node:util').isDeepStrictEqual instead. lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} @@ -3370,6 +3383,10 @@ snapshots: dependencies: '@babel/types': 7.23.0 + '@types/browser-resolve@2.0.4': + dependencies: + '@types/resolve': 1.20.6 + '@types/estree@1.0.4': {} '@types/estree@1.0.5': {} @@ -3406,6 +3423,8 @@ snapshots: '@types/scheduler': 0.16.5 csstype: 3.1.2 + '@types/resolve@1.20.6': {} + '@types/scheduler@0.16.5': {} '@types/semver@7.5.6': {} diff --git a/src/index.ts b/src/index.ts index 3359a85..0df675f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,15 +1,20 @@ import { createRequire } from 'node:module' import inject from '@rollup/plugin-inject' +import browserResolve from 'browser-resolve' import stdLibBrowser from 'node-stdlib-browser' import { handleCircularDependancyWarning } from 'node-stdlib-browser/helpers/rollup/plugin' import esbuildPlugin from 'node-stdlib-browser/helpers/esbuild/plugin' import type { Plugin } from 'vite' -import { compareModuleNames, isEnabled, isNodeProtocolImport, toRegExp, withoutNodeProtocol } from './utils' +import { compareModuleNames, isEnabled, isNodeProtocolImport, resolvePolyfill, toEntries, toRegExp, withoutNodeProtocol } from './utils' -export type BuildTarget = 'build' | 'dev' +export type BareModuleName = T extends `node:${infer P}` ? P : never +export type BareModuleNameWithSubpath = T extends `node:${infer P}` ? `${P}/${string}` : never export type BooleanOrBuildTarget = boolean | BuildTarget +export type BuildTarget = 'build' | 'dev' export type ModuleName = keyof typeof stdLibBrowser -export type ModuleNameWithoutNodePrefix = T extends `node:${infer P}` ? P : never +export type OverrideOptions = { + +} export type PolyfillOptions = { /** @@ -22,7 +27,7 @@ export type PolyfillOptions = { * }) * ``` */ - include?: ModuleNameWithoutNodePrefix[], + include?: BareModuleName[], /** * @example * @@ -32,7 +37,7 @@ export type PolyfillOptions = { * }) * ``` */ - exclude?: ModuleNameWithoutNodePrefix[], + exclude?: BareModuleName[], /** * Specify whether specific globals should be polyfilled. * @@ -66,7 +71,7 @@ export type PolyfillOptions = { * }) * ``` */ - overrides?: { [Key in ModuleNameWithoutNodePrefix]?: string }, + overrides?: { [Key in BareModuleName | BareModuleNameWithSubpath]?: string }, /** * Specify whether the Node protocol version of an import (e.g. `node:buffer`) should be polyfilled too. * @@ -76,14 +81,14 @@ export type PolyfillOptions = { } export type PolyfillOptionsResolved = { - include: ModuleNameWithoutNodePrefix[], - exclude: ModuleNameWithoutNodePrefix[], + include: BareModuleName[], + exclude: BareModuleName[], globals: { Buffer: BooleanOrBuildTarget, global: BooleanOrBuildTarget, process: BooleanOrBuildTarget, }, - overrides: { [Key in ModuleNameWithoutNodePrefix]?: string }, + overrides: { [Key in BareModuleName | BareModuleNameWithSubpath]?: string }, protocolImports: boolean, } @@ -153,16 +158,16 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => { return optionsResolved.exclude.some((excludedName) => compareModuleNames(moduleName, excludedName)) } - const toOverride = (name: ModuleNameWithoutNodePrefix): string | void => { - if (isEnabled(optionsResolved.globals.Buffer, 'dev') && /^buffer$/.test(name)) { + const toOverride = (name: BareModuleName): string | void => { + if (/^buffer$/.test(name)) { return 'vite-plugin-node-polyfills/shims/buffer' } - if (isEnabled(optionsResolved.globals.global, 'dev') && /^global$/.test(name)) { + if (/^global$/.test(name)) { return 'vite-plugin-node-polyfills/shims/global' } - if (isEnabled(optionsResolved.globals.process, 'dev') && /^process$/.test(name)) { + if (/^process$/.test(name)) { return 'vite-plugin-node-polyfills/shims/process' } @@ -201,6 +206,7 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => { return { name: 'vite-plugin-node-polyfills', + enforce: 'pre', config: (config, env) => { const isDev = env.command === 'serve' @@ -246,21 +252,25 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => { ...globalShimPaths, ], plugins: [ - esbuildPlugin(polyfills), + esbuildPlugin({ + ...polyfills, + }), // Supress the 'injected path "..." cannot be marked as external' error in Vite 4 (emitted by esbuild). // https://github.com/evanw/esbuild/blob/edede3c49ad6adddc6ea5b3c78c6ea7507e03020/internal/bundler/bundler.go#L1469 { name: 'vite-plugin-node-polyfills-shims-resolver', - setup(build) { + setup: (build) => { for (const globalShimPath of globalShimPaths) { const globalShimsFilter = toRegExp(globalShimPath) // https://esbuild.github.io/plugins/#on-resolve build.onResolve({ filter: globalShimsFilter }, () => { + const resolved = browserResolve.sync(globalShimPath) + return { // https://github.com/evanw/esbuild/blob/edede3c49ad6adddc6ea5b3c78c6ea7507e03020/internal/bundler/bundler.go#L1468 external: false, - path: globalShimPath, + path: resolved, } }) } @@ -277,5 +287,28 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => { }, } }, + async resolveId(id) { + for (const [moduleName, modulePath] of toEntries(polyfills)) { + if (id.startsWith(modulePath)) { + // Grab the subpath without the forward slash. E.g. `path/posix` -> `posix` + const moduleSubpath = id.slice(modulePath.length + 1) + + if (moduleSubpath.length > 0) { + const moduleNameWithoutProtocol = withoutNodeProtocol(moduleName) + const overrideName = `${moduleNameWithoutProtocol}/${moduleSubpath}` as const + const override = optionsResolved.overrides[overrideName] + + if (!override) { + // Todo: Maybe throw error? + return undefined + } + + return await resolvePolyfill(this, override) + } + + return browserResolve.sync(modulePath) + } + } + }, } } diff --git a/src/utils.ts b/src/utils.ts index b72d360..deb1478 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,8 @@ -import type { BooleanOrBuildTarget, ModuleName, ModuleNameWithoutNodePrefix } from './index' +import type { PluginContext } from 'rollup' +import type { BareModuleName, BooleanOrBuildTarget, ModuleName } from './index' + +export type Identity = T +export type ObjectToEntries = Identity<{ [K in keyof T]: [K, T[K]] }[keyof T][]> export const compareModuleNames = (moduleA: ModuleName, moduleB: ModuleName) => { return withoutNodeProtocol(moduleA) === withoutNodeProtocol(moduleB) @@ -15,6 +19,30 @@ export const isNodeProtocolImport = (name: string) => { return name.startsWith('node:') } +export const resolvePolyfill = async (context: PluginContext, name: string) => { + const consumerResolved = await context.resolve(name) + + if (consumerResolved) { + return consumerResolved + } + + const provider = await context.resolve('vite-plugin-node-polyfills') + const providerResolved = await context.resolve(name, provider!.id) + + if (providerResolved) { + return providerResolved + } + + const upstream = await context.resolve('node-stdlib-browser', provider!.id) + const upstreamResolved = await context.resolve(name, upstream!.id) + + return upstreamResolved +} + +export const toEntries = >(object: T): ObjectToEntries => { + return Object.entries(object) as ObjectToEntries +} + export const toRegExp = (text: string) => { // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping const escapedText = text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') @@ -22,6 +50,6 @@ export const toRegExp = (text: string) => { return new RegExp(`^${escapedText}$`) } -export const withoutNodeProtocol = (name: ModuleName): ModuleNameWithoutNodePrefix => { - return name.replace(/^node:/, '') as ModuleNameWithoutNodePrefix +export const withoutNodeProtocol = (name: ModuleName): BareModuleName => { + return name.replace(/^node:/, '') as BareModuleName } From da7339a7bf6a6aec1fa548f7369c92ec1c5e47ae Mon Sep 17 00:00:00 2001 From: "David R. Myers" Date: Fri, 22 Dec 2023 23:41:22 -0500 Subject: [PATCH 2/4] Add example SolidJS app --- examples/solid/index.html | 12 + examples/solid/package.json | 17 ++ examples/solid/src/main.ts | 4 + examples/solid/vite.config.ts | 18 ++ package.json | 2 + pnpm-lock.yaml | 409 ++++++++++++++++++++++++++++++++++ 6 files changed, 462 insertions(+) create mode 100644 examples/solid/index.html create mode 100644 examples/solid/package.json create mode 100644 examples/solid/src/main.ts create mode 100644 examples/solid/vite.config.ts diff --git a/examples/solid/index.html b/examples/solid/index.html new file mode 100644 index 0000000..13ea7f9 --- /dev/null +++ b/examples/solid/index.html @@ -0,0 +1,12 @@ + + + + + + Example (Solid) + + +
+ + + diff --git a/examples/solid/package.json b/examples/solid/package.json new file mode 100644 index 0000000..b056397 --- /dev/null +++ b/examples/solid/package.json @@ -0,0 +1,17 @@ +{ + "type": "module", + "private": true, + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "solid-js": "^1.8.7" + }, + "devDependencies": { + "vite": "^5.0.2", + "vite-plugin-node-polyfills": "workspace:*", + "vite-plugin-solid": "^2.8.0" + } +} diff --git a/examples/solid/src/main.ts b/examples/solid/src/main.ts new file mode 100644 index 0000000..71d325c --- /dev/null +++ b/examples/solid/src/main.ts @@ -0,0 +1,4 @@ +// eslint-disable-next-line unicorn/prefer-node-protocol +import { join } from 'path/posix' + +document.querySelector('#solid-app')!.textContent = join('foo', 'bar') diff --git a/examples/solid/vite.config.ts b/examples/solid/vite.config.ts new file mode 100644 index 0000000..1e63dbb --- /dev/null +++ b/examples/solid/vite.config.ts @@ -0,0 +1,18 @@ +import { defineConfig } from 'vite' +import { nodePolyfills } from 'vite-plugin-node-polyfills' +import solid from 'vite-plugin-solid' + +export default defineConfig({ + optimizeDeps: { + force: true, + }, + plugins: [ + nodePolyfills({ + overrides: { + 'path/posix': 'path-browserify', + }, + }), + // comment/uncomment it: + solid(), + ], +}) diff --git a/package.json b/package.json index d9134b0..2ab5c19 100644 --- a/package.json +++ b/package.json @@ -76,9 +76,11 @@ "test": "run-p test:build test:error-repros test:unit", "test:build": "run-p test:build:*", "test:build:react": "pnpm -C ./examples/react run build", + "test:build:solid": "pnpm -C ./examples/solid run build", "test:build:vanilla": "pnpm -C ./examples/vanilla run build", "test:build:vue": "pnpm -C ./examples/vue run build", "test:dev:react": "pnpm -C ./examples/react run dev", + "test:dev:solid": "pnpm -C ./examples/solid run dev", "test:dev:vanilla": "pnpm -C ./examples/vanilla run dev", "test:dev:vue": "pnpm -C ./examples/vue run dev", "test:error-repros": "run-p test:error-repros:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dd5bc12..06a5618 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -115,6 +115,22 @@ importers: specifier: workspace:* version: link:../.. + examples/solid: + dependencies: + solid-js: + specifier: ^1.8.7 + version: 1.9.5 + devDependencies: + vite: + specifier: ^5.0.2 + version: 5.1.0(@types/node@18.18.8) + vite-plugin-node-polyfills: + specifier: workspace:* + version: link:../.. + vite-plugin-solid: + specifier: ^2.8.0 + version: 2.11.6(solid-js@1.9.5)(vite@5.1.0(@types/node@18.18.8)) + examples/vanilla: devDependencies: '@types/lodash-es': @@ -256,22 +272,42 @@ packages: resolution: {integrity: sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==} engines: {node: '>=6.9.0'} + '@babel/code-frame@7.26.2': + resolution: {integrity: sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==} + engines: {node: '>=6.9.0'} + '@babel/compat-data@7.23.2': resolution: {integrity: sha512-0S9TQMmDHlqAZ2ITT95irXKfxN9bncq8ZCoJhun3nHL/lLUxd2NKBJYoNGWH7S0hz6fRQwWlAWn/ILM0C70KZQ==} engines: {node: '>=6.9.0'} + '@babel/compat-data@7.26.8': + resolution: {integrity: sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==} + engines: {node: '>=6.9.0'} + '@babel/core@7.23.2': resolution: {integrity: sha512-n7s51eWdaWZ3vGT2tD4T7J6eJs3QoBXydv7vkUM06Bf1cbVD2Kc2UrkzhiQwobfV7NwOnQXYL7UBJ5VPU+RGoQ==} engines: {node: '>=6.9.0'} + '@babel/core@7.26.10': + resolution: {integrity: sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==} + engines: {node: '>=6.9.0'} + '@babel/generator@7.23.0': resolution: {integrity: sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==} engines: {node: '>=6.9.0'} + '@babel/generator@7.26.10': + resolution: {integrity: sha512-rRHT8siFIXQrAYOYqZQVsAr8vJ+cBNqcVAY6m5V8/4QqzaPl+zDBe6cLEPRDuNOUf3ww8RfJVlOyQMoSI+5Ang==} + engines: {node: '>=6.9.0'} + '@babel/helper-compilation-targets@7.22.15': resolution: {integrity: sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==} engines: {node: '>=6.9.0'} + '@babel/helper-compilation-targets@7.26.5': + resolution: {integrity: sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==} + engines: {node: '>=6.9.0'} + '@babel/helper-environment-visitor@7.22.20': resolution: {integrity: sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==} engines: {node: '>=6.9.0'} @@ -284,20 +320,38 @@ packages: resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} engines: {node: '>=6.9.0'} + '@babel/helper-module-imports@7.18.6': + resolution: {integrity: sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==} + engines: {node: '>=6.9.0'} + '@babel/helper-module-imports@7.22.15': resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==} engines: {node: '>=6.9.0'} + '@babel/helper-module-imports@7.25.9': + resolution: {integrity: sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==} + engines: {node: '>=6.9.0'} + '@babel/helper-module-transforms@7.23.0': resolution: {integrity: sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 + '@babel/helper-module-transforms@7.26.0': + resolution: {integrity: sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + '@babel/helper-plugin-utils@7.22.5': resolution: {integrity: sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==} engines: {node: '>=6.9.0'} + '@babel/helper-plugin-utils@7.26.5': + resolution: {integrity: sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==} + engines: {node: '>=6.9.0'} + '@babel/helper-simple-access@7.22.5': resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} engines: {node: '>=6.9.0'} @@ -310,18 +364,34 @@ packages: resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} engines: {node: '>=6.9.0'} + '@babel/helper-string-parser@7.25.9': + resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==} + engines: {node: '>=6.9.0'} + '@babel/helper-validator-identifier@7.22.20': resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} engines: {node: '>=6.9.0'} + '@babel/helper-validator-identifier@7.25.9': + resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==} + engines: {node: '>=6.9.0'} + '@babel/helper-validator-option@7.22.15': resolution: {integrity: sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==} engines: {node: '>=6.9.0'} + '@babel/helper-validator-option@7.25.9': + resolution: {integrity: sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==} + engines: {node: '>=6.9.0'} + '@babel/helpers@7.23.2': resolution: {integrity: sha512-lzchcp8SjTSVe/fPmLwtWVBFC7+Tbn8LGHDVfDp9JGxpAY5opSaEFgt8UQvrnECWOTdji2mOWMz1rOhkHscmGQ==} engines: {node: '>=6.9.0'} + '@babel/helpers@7.26.10': + resolution: {integrity: sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==} + engines: {node: '>=6.9.0'} + '@babel/highlight@7.22.20': resolution: {integrity: sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==} engines: {node: '>=6.9.0'} @@ -331,6 +401,17 @@ packages: engines: {node: '>=6.0.0'} hasBin: true + '@babel/parser@7.26.10': + resolution: {integrity: sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==} + engines: {node: '>=6.0.0'} + hasBin: true + + '@babel/plugin-syntax-jsx@7.25.9': + resolution: {integrity: sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + '@babel/plugin-transform-react-jsx-self@7.22.5': resolution: {integrity: sha512-nTh2ogNUtxbiSbxaT4Ds6aXnXEipHweN9YRgOX/oNXdf0cCrGn/+2LozFa3lnPV5D90MkjhgckCPBrsoSc1a7g==} engines: {node: '>=6.9.0'} @@ -347,14 +428,26 @@ packages: resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==} engines: {node: '>=6.9.0'} + '@babel/template@7.26.9': + resolution: {integrity: sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==} + engines: {node: '>=6.9.0'} + '@babel/traverse@7.23.2': resolution: {integrity: sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==} engines: {node: '>=6.9.0'} + '@babel/traverse@7.26.10': + resolution: {integrity: sha512-k8NuDrxr0WrPH5Aupqb2LCVURP/S0vBEn5mK6iH+GIYob66U5EtoZvcdudR2jQ4cmTwhEwW1DLB+Yyas9zjF6A==} + engines: {node: '>=6.9.0'} + '@babel/types@7.23.0': resolution: {integrity: sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==} engines: {node: '>=6.9.0'} + '@babel/types@7.26.10': + resolution: {integrity: sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==} + engines: {node: '>=6.9.0'} + '@esbuild/android-arm64@0.19.8': resolution: {integrity: sha512-B8JbS61bEunhfx8kasogFENgQfr/dIp+ggYXwTqdbMAgGDhRa3AaPpQMuQU0rNxDLECj6FhDzk1cF9WHMVwrtA==} engines: {node: '>=12'} @@ -528,6 +621,10 @@ packages: resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} engines: {node: '>=6.0.0'} + '@jridgewell/gen-mapping@0.3.8': + resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==} + engines: {node: '>=6.0.0'} + '@jridgewell/resolve-uri@3.1.1': resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} engines: {node: '>=6.0.0'} @@ -536,12 +633,19 @@ packages: resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} engines: {node: '>=6.0.0'} + '@jridgewell/set-array@1.2.1': + resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} + engines: {node: '>=6.0.0'} + '@jridgewell/sourcemap-codec@1.4.15': resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} '@jridgewell/trace-mapping@0.3.20': resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} + '@jridgewell/trace-mapping@0.3.25': + resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -672,6 +776,9 @@ packages: '@types/babel__core@7.20.3': resolution: {integrity: sha512-54fjTSeSHwfan8AyHWrKbfBWiEUrNTZsUwPTDSNaaP1QDQIZbeNUg3a59E9D+375MzUw/x1vx2/0F5LBz+AeYA==} + '@types/babel__core@7.20.5': + resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} + '@types/babel__generator@7.6.6': resolution: {integrity: sha512-66BXMKb/sUWbMdBNdMvajU7i/44RkrA3z/Yt1c7R5xejt8qh84iU54yUWCtm0QwGJlDcf/gg4zd/x4mpLAlb/w==} @@ -932,6 +1039,16 @@ packages: resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} engines: {node: '>= 0.4'} + babel-plugin-jsx-dom-expressions@0.39.7: + resolution: {integrity: sha512-8GzVmFla7jaTNWW8W+lTMl9YGva4/06CtwJjySnkYtt8G1v9weCzc2SuF1DfrudcCNb2Doetc1FRg33swBYZCA==} + peerDependencies: + '@babel/core': ^7.20.12 + + babel-preset-solid@1.9.5: + resolution: {integrity: sha512-85I3osODJ1LvZbv8wFozROV1vXq32BubqHXAGu73A//TRs3NLI1OFP83AQBUTSQHwgZQmARjHlJciym3we+V+w==} + peerDependencies: + '@babel/core': ^7.0.0 + balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -992,6 +1109,11 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true + browserslist@4.24.4: + resolution: {integrity: sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + buffer-xor@1.0.3: resolution: {integrity: sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==} @@ -1026,6 +1148,9 @@ packages: caniuse-lite@1.0.30001559: resolution: {integrity: sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==} + caniuse-lite@1.0.30001707: + resolution: {integrity: sha512-3qtRjw/HQSMlDWf+X79N206fepf4SOOU6SQLMaq/0KkZLmSjPxAkBOQQ+FxbHKfHmYLZFfdWsO3KA90ceHPSnw==} + chai@4.3.10: resolution: {integrity: sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==} engines: {node: '>=4'} @@ -1214,6 +1339,9 @@ packages: electron-to-chromium@1.4.576: resolution: {integrity: sha512-yXsZyXJfAqzWk1WKryr0Wl0MN2D47xodPvEEwlVePBnhU5E7raevLQR+E6b9JAD3GfL/7MbAL9ZtWQQPcLx7wA==} + electron-to-chromium@1.5.123: + resolution: {integrity: sha512-refir3NlutEZqlKaBLK0tzlVLe5P2wDKS7UQt/3SpibizgsRAPOsqQC3ffw1nlv3ze5gjRQZYHoPymgVZkplFA==} + elliptic@6.5.4: resolution: {integrity: sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==} @@ -1251,6 +1379,10 @@ packages: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + escape-string-regexp@1.0.5: resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} engines: {node: '>=0.8.0'} @@ -1655,6 +1787,9 @@ packages: hosted-git-info@2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} + html-entities@2.3.3: + resolution: {integrity: sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==} + htmlparser2@8.0.2: resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==} @@ -1992,6 +2127,10 @@ packages: resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==} engines: {node: '>= 0.10.0'} + merge-anything@5.1.7: + resolution: {integrity: sha512-eRtbOb1N5iyH0tkQDAoQ4Ipsp/5qSR79Dzrz8hEPxRX10RWWR/iQXdoKmBSRCThY1Fh5EhISDtpSc93fpxUniQ==} + engines: {node: '>=12.13'} + merge-stream@2.0.0: resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} @@ -2069,6 +2208,9 @@ packages: node-releases@2.0.13: resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==} + node-releases@2.0.19: + resolution: {integrity: sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==} + node-stdlib-browser@1.2.0: resolution: {integrity: sha512-VSjFxUhRhkyed8AtLwSCkMrJRfQ3e2lGtG3sP6FEgaLKBBbxM/dLfjRe1+iLhjvyLFW3tBQ8+c0pcOtXGbAZJg==} engines: {node: '>=10'} @@ -2189,6 +2331,9 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} + parse5@7.2.1: + resolution: {integrity: sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==} + path-browserify@1.0.1: resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} @@ -2236,6 +2381,9 @@ packages: picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -2442,6 +2590,16 @@ packages: engines: {node: '>=10'} hasBin: true + seroval-plugins@1.2.1: + resolution: {integrity: sha512-H5vs53+39+x4Udwp4J5rNZfgFuA+Lt+uU+09w1gYBVWomtAl98B+E9w7yC05Xc81/HgLvJdlyqJbU0fJCKCmdw==} + engines: {node: '>=10'} + peerDependencies: + seroval: ^1.0 + + seroval@1.2.1: + resolution: {integrity: sha512-yBxFFs3zmkvKNmR0pFSU//rIsYjuX418TnlDmc2weaq5XFDqDIV/NOMPBoLrbxjLH42p4UzRuXHryXh9dYcKcw==} + engines: {node: '>=10'} + set-function-length@1.1.1: resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} engines: {node: '>= 0.4'} @@ -2497,6 +2655,14 @@ packages: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} + solid-js@1.9.5: + resolution: {integrity: sha512-ogI3DaFcyn6UhYhrgcyRAMbu/buBJitYQASZz5WzfQVPP10RD2AbCoRZ517psnezrasyCbWzIxZ6kVqet768xw==} + + solid-refresh@0.6.3: + resolution: {integrity: sha512-F3aPsX6hVw9ttm5LYlth8Q15x6MlI/J3Dn+o3EQyRTtTxidepSTwAYdozt01/YA+7ObcciagGEyXIopGZzQtbA==} + peerDependencies: + solid-js: ^1.3 + source-map-js@1.0.2: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} @@ -2721,6 +2887,12 @@ packages: peerDependencies: browserslist: '>= 4.21.0' + update-browserslist-db@1.1.3: + resolution: {integrity: sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} @@ -2738,6 +2910,9 @@ packages: util@0.12.5: resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} + validate-html-nesting@1.2.2: + resolution: {integrity: sha512-hGdgQozCsQJMyfK5urgFcWEqsSSrK63Awe0t/IMR0bZ0QMtnuaiHzThW81guu3qx9abLi99NEuiaN6P9gVYsNg==} + validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} @@ -2764,6 +2939,16 @@ packages: '@nuxt/kit': optional: true + vite-plugin-solid@2.11.6: + resolution: {integrity: sha512-Sl5CTqJTGyEeOsmdH6BOgalIZlwH3t4/y0RQuFLMGnvWMBvxb4+lq7x3BSiAw6etf0QexfNJW7HSOO/Qf7pigg==} + peerDependencies: + '@testing-library/jest-dom': ^5.16.6 || ^5.17.0 || ^6.* + solid-js: ^1.7.2 + vite: ^5.0.2 + peerDependenciesMeta: + '@testing-library/jest-dom': + optional: true + vite@5.0.2: resolution: {integrity: sha512-6CCq1CAJCNM1ya2ZZA7+jS2KgnhbzvxakmlIjN24cF/PXhRMzpM/z8QgsVJA/Dm5fWUWnVEsmtBoMhmerPxT0g==} engines: {node: ^18.0.0 || >=20.0.0} @@ -2820,6 +3005,14 @@ packages: terser: optional: true + vitefu@1.0.6: + resolution: {integrity: sha512-+Rex1GlappUyNN6UfwbVZne/9cYC4+R2XDk9xkNXBKMw6HQagdX9PgZ8V2v1WUSK1wfBLp7qbI1+XSNIlB1xmA==} + peerDependencies: + vite: ^5.0.2 + peerDependenciesMeta: + vite: + optional: true + vitest@1.2.2: resolution: {integrity: sha512-d5Ouvrnms3GD9USIK36KG8OZ5bEvKEkITFtnGv56HFaSlbItJuYr7hv2Lkn903+AvRAgSixiamozUVfORUekjw==} engines: {node: ^18.0.0 || >=20.0.0} @@ -3011,8 +3204,16 @@ snapshots: '@babel/highlight': 7.22.20 chalk: 2.4.2 + '@babel/code-frame@7.26.2': + dependencies: + '@babel/helper-validator-identifier': 7.25.9 + js-tokens: 4.0.0 + picocolors: 1.0.0 + '@babel/compat-data@7.23.2': {} + '@babel/compat-data@7.26.8': {} + '@babel/core@7.23.2': dependencies: '@ampproject/remapping': 2.2.1 @@ -3033,6 +3234,26 @@ snapshots: transitivePeerDependencies: - supports-color + '@babel/core@7.26.10': + dependencies: + '@ampproject/remapping': 2.2.1 + '@babel/code-frame': 7.26.2 + '@babel/generator': 7.26.10 + '@babel/helper-compilation-targets': 7.26.5 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.10) + '@babel/helpers': 7.26.10 + '@babel/parser': 7.26.10 + '@babel/template': 7.26.9 + '@babel/traverse': 7.26.10 + '@babel/types': 7.26.10 + convert-source-map: 2.0.0 + debug: 4.3.4 + gensync: 1.0.0-beta.2 + json5: 2.2.3 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + '@babel/generator@7.23.0': dependencies: '@babel/types': 7.23.0 @@ -3040,6 +3261,14 @@ snapshots: '@jridgewell/trace-mapping': 0.3.20 jsesc: 2.5.2 + '@babel/generator@7.26.10': + dependencies: + '@babel/parser': 7.26.10 + '@babel/types': 7.26.10 + '@jridgewell/gen-mapping': 0.3.8 + '@jridgewell/trace-mapping': 0.3.25 + jsesc: 3.0.2 + '@babel/helper-compilation-targets@7.22.15': dependencies: '@babel/compat-data': 7.23.2 @@ -3048,6 +3277,14 @@ snapshots: lru-cache: 5.1.1 semver: 6.3.1 + '@babel/helper-compilation-targets@7.26.5': + dependencies: + '@babel/compat-data': 7.26.8 + '@babel/helper-validator-option': 7.25.9 + browserslist: 4.24.4 + lru-cache: 5.1.1 + semver: 6.3.1 + '@babel/helper-environment-visitor@7.22.20': {} '@babel/helper-function-name@7.23.0': @@ -3059,10 +3296,21 @@ snapshots: dependencies: '@babel/types': 7.23.0 + '@babel/helper-module-imports@7.18.6': + dependencies: + '@babel/types': 7.23.0 + '@babel/helper-module-imports@7.22.15': dependencies: '@babel/types': 7.23.0 + '@babel/helper-module-imports@7.25.9': + dependencies: + '@babel/traverse': 7.26.10 + '@babel/types': 7.26.10 + transitivePeerDependencies: + - supports-color + '@babel/helper-module-transforms@7.23.0(@babel/core@7.23.2)': dependencies: '@babel/core': 7.23.2 @@ -3072,8 +3320,19 @@ snapshots: '@babel/helper-split-export-declaration': 7.22.6 '@babel/helper-validator-identifier': 7.22.20 + '@babel/helper-module-transforms@7.26.0(@babel/core@7.26.10)': + dependencies: + '@babel/core': 7.26.10 + '@babel/helper-module-imports': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 + '@babel/traverse': 7.26.10 + transitivePeerDependencies: + - supports-color + '@babel/helper-plugin-utils@7.22.5': {} + '@babel/helper-plugin-utils@7.26.5': {} + '@babel/helper-simple-access@7.22.5': dependencies: '@babel/types': 7.23.0 @@ -3084,10 +3343,16 @@ snapshots: '@babel/helper-string-parser@7.22.5': {} + '@babel/helper-string-parser@7.25.9': {} + '@babel/helper-validator-identifier@7.22.20': {} + '@babel/helper-validator-identifier@7.25.9': {} + '@babel/helper-validator-option@7.22.15': {} + '@babel/helper-validator-option@7.25.9': {} + '@babel/helpers@7.23.2': dependencies: '@babel/template': 7.22.15 @@ -3096,6 +3361,11 @@ snapshots: transitivePeerDependencies: - supports-color + '@babel/helpers@7.26.10': + dependencies: + '@babel/template': 7.26.9 + '@babel/types': 7.26.10 + '@babel/highlight@7.22.20': dependencies: '@babel/helper-validator-identifier': 7.22.20 @@ -3106,6 +3376,15 @@ snapshots: dependencies: '@babel/types': 7.23.0 + '@babel/parser@7.26.10': + dependencies: + '@babel/types': 7.26.10 + + '@babel/plugin-syntax-jsx@7.25.9(@babel/core@7.26.10)': + dependencies: + '@babel/core': 7.26.10 + '@babel/helper-plugin-utils': 7.26.5 + '@babel/plugin-transform-react-jsx-self@7.22.5(@babel/core@7.23.2)': dependencies: '@babel/core': 7.23.2 @@ -3122,6 +3401,12 @@ snapshots: '@babel/parser': 7.23.0 '@babel/types': 7.23.0 + '@babel/template@7.26.9': + dependencies: + '@babel/code-frame': 7.26.2 + '@babel/parser': 7.26.10 + '@babel/types': 7.26.10 + '@babel/traverse@7.23.2': dependencies: '@babel/code-frame': 7.22.13 @@ -3137,12 +3422,29 @@ snapshots: transitivePeerDependencies: - supports-color + '@babel/traverse@7.26.10': + dependencies: + '@babel/code-frame': 7.26.2 + '@babel/generator': 7.26.10 + '@babel/parser': 7.26.10 + '@babel/template': 7.26.9 + '@babel/types': 7.26.10 + debug: 4.3.4 + globals: 11.12.0 + transitivePeerDependencies: + - supports-color + '@babel/types@7.23.0': dependencies: '@babel/helper-string-parser': 7.22.5 '@babel/helper-validator-identifier': 7.22.20 to-fast-properties: 2.0.0 + '@babel/types@7.26.10': + dependencies: + '@babel/helper-string-parser': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 + '@esbuild/android-arm64@0.19.8': optional: true @@ -3256,10 +3558,18 @@ snapshots: '@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/trace-mapping': 0.3.20 + '@jridgewell/gen-mapping@0.3.8': + dependencies: + '@jridgewell/set-array': 1.2.1 + '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/trace-mapping': 0.3.25 + '@jridgewell/resolve-uri@3.1.1': {} '@jridgewell/set-array@1.1.2': {} + '@jridgewell/set-array@1.2.1': {} + '@jridgewell/sourcemap-codec@1.4.15': {} '@jridgewell/trace-mapping@0.3.20': @@ -3267,6 +3577,11 @@ snapshots: '@jridgewell/resolve-uri': 3.1.1 '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/trace-mapping@0.3.25': + dependencies: + '@jridgewell/resolve-uri': 3.1.1 + '@jridgewell/sourcemap-codec': 1.4.15 + '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -3370,6 +3685,14 @@ snapshots: '@types/babel__template': 7.4.3 '@types/babel__traverse': 7.20.3 + '@types/babel__core@7.20.5': + dependencies: + '@babel/parser': 7.23.0 + '@babel/types': 7.23.0 + '@types/babel__generator': 7.6.6 + '@types/babel__template': 7.4.3 + '@types/babel__traverse': 7.20.3 + '@types/babel__generator@7.6.6': dependencies: '@babel/types': 7.23.0 @@ -3720,6 +4043,21 @@ snapshots: available-typed-arrays@1.0.5: {} + babel-plugin-jsx-dom-expressions@0.39.7(@babel/core@7.26.10): + dependencies: + '@babel/core': 7.26.10 + '@babel/helper-module-imports': 7.18.6 + '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.26.10) + '@babel/types': 7.23.0 + html-entities: 2.3.3 + parse5: 7.2.1 + validate-html-nesting: 1.2.2 + + babel-preset-solid@1.9.5(@babel/core@7.26.10): + dependencies: + '@babel/core': 7.26.10 + babel-plugin-jsx-dom-expressions: 0.39.7(@babel/core@7.26.10) + balanced-match@1.0.2: {} base64-js@1.5.1: {} @@ -3801,6 +4139,13 @@ snapshots: node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) + browserslist@4.24.4: + dependencies: + caniuse-lite: 1.0.30001707 + electron-to-chromium: 1.5.123 + node-releases: 2.0.19 + update-browserslist-db: 1.1.3(browserslist@4.24.4) + buffer-xor@1.0.3: {} buffer@6.0.3(patch_hash=zkkuxompt5d553skpnegwi5wuy): @@ -3832,6 +4177,8 @@ snapshots: caniuse-lite@1.0.30001559: {} + caniuse-lite@1.0.30001707: {} + chai@4.3.10: dependencies: assertion-error: 1.1.0 @@ -4045,6 +4392,8 @@ snapshots: electron-to-chromium@1.4.576: {} + electron-to-chromium@1.5.123: {} + elliptic@6.5.4: dependencies: bn.js: 4.12.0 @@ -4148,6 +4497,8 @@ snapshots: escalade@3.1.1: {} + escalade@3.2.0: {} + escape-string-regexp@1.0.5: {} escape-string-regexp@4.0.0: {} @@ -4651,6 +5002,8 @@ snapshots: hosted-git-info@2.8.9: {} + html-entities@2.3.3: {} + htmlparser2@8.0.2: dependencies: domelementtype: 2.3.0 @@ -4958,6 +5311,10 @@ snapshots: memorystream@0.3.1: {} + merge-anything@5.1.7: + dependencies: + is-what: 4.1.16 + merge-stream@2.0.0: {} merge2@1.4.1: {} @@ -5020,6 +5377,8 @@ snapshots: node-releases@2.0.13: {} + node-releases@2.0.19: {} + node-stdlib-browser@1.2.0: dependencies: assert: 2.1.0 @@ -5210,6 +5569,10 @@ snapshots: json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 + parse5@7.2.1: + dependencies: + entities: 4.5.0 + path-browserify@1.0.1: {} path-exists@4.0.0: {} @@ -5244,6 +5607,8 @@ snapshots: picocolors@1.0.0: {} + picocolors@1.1.1: {} + picomatch@2.3.1: {} pidtree@0.3.1: {} @@ -5468,6 +5833,12 @@ snapshots: dependencies: lru-cache: 6.0.0 + seroval-plugins@1.2.1(seroval@1.2.1): + dependencies: + seroval: 1.2.1 + + seroval@1.2.1: {} + set-function-length@1.1.1: dependencies: define-data-property: 1.1.1 @@ -5522,6 +5893,19 @@ snapshots: slash@3.0.0: {} + solid-js@1.9.5: + dependencies: + csstype: 3.1.2 + seroval: 1.2.1 + seroval-plugins: 1.2.1(seroval@1.2.1) + + solid-refresh@0.6.3(solid-js@1.9.5): + dependencies: + '@babel/generator': 7.26.10 + '@babel/helper-module-imports': 7.22.15 + '@babel/types': 7.26.10 + solid-js: 1.9.5 + source-map-js@1.0.2: {} spdx-correct@3.2.0: @@ -5734,6 +6118,12 @@ snapshots: escalade: 3.1.1 picocolors: 1.0.0 + update-browserslist-db@1.1.3(browserslist@4.24.4): + dependencies: + browserslist: 4.24.4 + escalade: 3.2.0 + picocolors: 1.1.1 + uri-js@4.4.1: dependencies: punycode: 2.3.1 @@ -5757,6 +6147,8 @@ snapshots: is-typed-array: 1.1.12 which-typed-array: 1.1.13 + validate-html-nesting@1.2.2: {} + validate-npm-package-license@3.0.4: dependencies: spdx-correct: 3.2.0 @@ -5816,6 +6208,19 @@ snapshots: - rollup - supports-color + vite-plugin-solid@2.11.6(solid-js@1.9.5)(vite@5.1.0(@types/node@18.18.8)): + dependencies: + '@babel/core': 7.26.10 + '@types/babel__core': 7.20.5 + babel-preset-solid: 1.9.5(@babel/core@7.26.10) + merge-anything: 5.1.7 + solid-js: 1.9.5 + solid-refresh: 0.6.3(solid-js@1.9.5) + vite: 5.1.0(@types/node@18.18.8) + vitefu: 1.0.6(vite@5.1.0(@types/node@18.18.8)) + transitivePeerDependencies: + - supports-color + vite@5.0.2(@types/node@18.18.8): dependencies: esbuild: 0.19.8 @@ -5834,6 +6239,10 @@ snapshots: '@types/node': 18.18.8 fsevents: 2.3.3 + vitefu@1.0.6(vite@5.1.0(@types/node@18.18.8)): + optionalDependencies: + vite: 5.1.0(@types/node@18.18.8) + vitest@1.2.2(@types/node@18.18.8): dependencies: '@vitest/expect': 1.2.2 From 905b858eef0c8809567ef2f9f863c191771031b9 Mon Sep 17 00:00:00 2001 From: "David R. Myers" Date: Fri, 22 Dec 2023 23:49:27 -0500 Subject: [PATCH 3/4] Make sure globals can be overridden too --- src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0df675f..cc53bbe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -159,6 +159,10 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => { } const toOverride = (name: BareModuleName): string | void => { + if (name in optionsResolved.overrides) { + return optionsResolved.overrides[name] + } + if (/^buffer$/.test(name)) { return 'vite-plugin-node-polyfills/shims/buffer' } @@ -170,10 +174,6 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => { if (/^process$/.test(name)) { return 'vite-plugin-node-polyfills/shims/process' } - - if (name in optionsResolved.overrides) { - return optionsResolved.overrides[name] - } } const polyfills = (Object.entries(stdLibBrowser) as Array<[ModuleName, string]>).reduce>((included, [name, value]) => { From ab135fa33d8e8a51238e0f5b709f559a3b703045 Mon Sep 17 00:00:00 2001 From: "David R. Myers" Date: Wed, 7 Feb 2024 21:06:50 -0500 Subject: [PATCH 4/4] wip: stashing latest changes --- .github/workflows/ci.yml | 3 ++- examples/vue/vite.config.ts | 8 ++++++++ package.json | 4 +++- pnpm-lock.yaml | 34 ++++++++++++++++++++++++++++++++++ src/index.ts | 29 +++++++++++++++++++++++++++-- src/utils.ts | 15 +++++++++++++++ 6 files changed, 89 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce69e48..f1959a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,8 @@ jobs: - uses: ./.github/actions/install-dependencies - run: pnpm build:core - run: pnpm build:shims - - run: pnpm -r test + - run: pnpm test:unit + - run: pnpm test:build typecheck: runs-on: ubuntu-latest steps: diff --git a/examples/vue/vite.config.ts b/examples/vue/vite.config.ts index c490e34..a9fbe49 100644 --- a/examples/vue/vite.config.ts +++ b/examples/vue/vite.config.ts @@ -4,6 +4,14 @@ import { nodePolyfills } from 'vite-plugin-node-polyfills' // https://vitejs.dev/config/ export default defineConfig({ + build: { + lib: { + entry: './src/main.ts', + fileName: 'index', + formats: ['es', 'cjs'], + }, + minify: false, + }, plugins: [ nodePolyfills(), vue(), diff --git a/package.json b/package.json index 2ab5c19..6af4c30 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,9 @@ "dependencies": { "@rollup/plugin-inject": "^5.0.5", "browser-resolve": "^2.0.0", - "node-stdlib-browser": "^1.2.0" + "node-stdlib-browser": "^1.2.0", + "pkg-dir": "^8.0.0", + "resolve-esm": "^2.0.3" }, "devDependencies": { "@playwright/test": "^1.40.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 06a5618..f8d07c3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,6 +26,12 @@ importers: node-stdlib-browser: specifier: ^1.2.0 version: 1.2.0 + pkg-dir: + specifier: ^8.0.0 + version: 8.0.0 + resolve-esm: + specifier: ^2.0.3 + version: 2.0.3 devDependencies: '@playwright/test': specifier: ^1.40.1 @@ -1145,6 +1151,10 @@ packages: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} + callsites@4.1.0: + resolution: {integrity: sha512-aBMbD1Xxay75ViYezwT40aQONfr+pSXTHwNKvIXhXD6+LY3F1dLIcceoC5OZKBVHbXcysz1hL9D2w0JJIMXpUw==} + engines: {node: '>=12.20'} + caniuse-lite@1.0.30001559: resolution: {integrity: sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==} @@ -1641,6 +1651,10 @@ packages: resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} engines: {node: '>=8'} + find-up-simple@1.0.1: + resolution: {integrity: sha512-afd4O7zpqHeRyg4PfDQsXmlDe2PfdHtJt6Akt8jOWaApLOZk5JXs6VMR29lz03pRe9mpykrRCYIYxaJYcfpncQ==} + engines: {node: '>=18'} + find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} @@ -2401,6 +2415,10 @@ packages: resolution: {integrity: sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==} engines: {node: '>=10'} + pkg-dir@8.0.0: + resolution: {integrity: sha512-4peoBq4Wks0riS0z8741NVv+/8IiTvqnZAr8QGgtdifrtpdXbNw/FxRS1l6NFqm4EMzuS0EDqNNx4XGaz8cuyQ==} + engines: {node: '>=18'} + pkg-types@1.0.3: resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} @@ -2524,6 +2542,10 @@ packages: remove-accents@0.4.2: resolution: {integrity: sha512-7pXIJqJOq5tFgG1A2Zxti3Ht8jJF337m4sowbuHsW30ZnkQFnDzy9qBNhgzX8ZLW4+UBcXiiR7SwR6pokHsxiA==} + resolve-esm@2.0.3: + resolution: {integrity: sha512-M1Bqazc53Xy3Sdken2UmlSouyiKaeugDYORcw3khZ4/+wFHCQDEE1clPMeSMd0y9JSUCpUazca5ALXewxZdIbg==} + engines: {node: '>=16'} + resolve-from@4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} @@ -4175,6 +4197,8 @@ snapshots: callsites@3.1.0: {} + callsites@4.1.0: {} + caniuse-lite@1.0.30001559: {} caniuse-lite@1.0.30001707: {} @@ -4850,6 +4874,8 @@ snapshots: dependencies: to-regex-range: 5.0.1 + find-up-simple@1.0.1: {} + find-up@4.1.0: dependencies: locate-path: 5.0.0 @@ -5619,6 +5645,10 @@ snapshots: dependencies: find-up: 5.0.0 + pkg-dir@8.0.0: + dependencies: + find-up-simple: 1.0.1 + pkg-types@1.0.3: dependencies: jsonc-parser: 3.2.0 @@ -5753,6 +5783,10 @@ snapshots: remove-accents@0.4.2: {} + resolve-esm@2.0.3: + dependencies: + callsites: 4.1.0 + resolve-from@4.0.0: {} resolve@1.22.8: diff --git a/src/index.ts b/src/index.ts index cc53bbe..091f2f4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,8 +4,19 @@ import browserResolve from 'browser-resolve' import stdLibBrowser from 'node-stdlib-browser' import { handleCircularDependancyWarning } from 'node-stdlib-browser/helpers/rollup/plugin' import esbuildPlugin from 'node-stdlib-browser/helpers/esbuild/plugin' +import { packageDirectorySync } from 'pkg-dir' +import { importMetaResolve } from 'resolve-esm' import type { Plugin } from 'vite' -import { compareModuleNames, isEnabled, isNodeProtocolImport, resolvePolyfill, toEntries, toRegExp, withoutNodeProtocol } from './utils' +import { + compareModuleNames, + isEnabled, + isNodeProtocolImport, + resolve, + resolvePolyfill, + toEntries, + toRegExp, + withoutNodeProtocol, +} from './utils' export type BareModuleName = T extends `node:${infer P}` ? P : never export type BareModuleNameWithSubpath = T extends `node:${infer P}` ? `${P}/${string}` : never @@ -266,6 +277,9 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => { // https://esbuild.github.io/plugins/#on-resolve build.onResolve({ filter: globalShimsFilter }, () => { const resolved = browserResolve.sync(globalShimPath) + const newResolved = importMetaResolve(globalShimPath) + + console.log(newResolved) return { // https://github.com/evanw/esbuild/blob/edede3c49ad6adddc6ea5b3c78c6ea7507e03020/internal/bundler/bundler.go#L1468 @@ -306,7 +320,18 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => { return await resolvePolyfill(this, override) } - return browserResolve.sync(modulePath) + const newResolved = new URL(importMetaResolve(modulePath)) + + console.log('importMetaResolve', newResolved) + console.log('resolve', resolve(moduleName)) + + const resolved = browserResolve.sync(modulePath) + const pkgDir = packageDirectorySync({ cwd: resolved }) + + console.log('browserResolve', resolved) + console.log('pkgDir', pkgDir) + + return resolved } } }, diff --git a/src/utils.ts b/src/utils.ts index deb1478..de9b0ec 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,3 +1,4 @@ +import { importMetaResolve } from 'resolve-esm' import type { PluginContext } from 'rollup' import type { BareModuleName, BooleanOrBuildTarget, ModuleName } from './index' @@ -19,6 +20,20 @@ export const isNodeProtocolImport = (name: string) => { return name.startsWith('node:') } +export const resolve = (name: string) => { + const consumerResolved = importMetaResolve(name, process.cwd()) + + if (consumerResolved) { + return consumerResolved + } + + const providerResolved = importMetaResolve(name) + + if (providerResolved) { + return providerResolved + } +} + export const resolvePolyfill = async (context: PluginContext, name: string) => { const consumerResolved = await context.resolve(name)