From 713cee381e95fc9769390f50d735e37bcfbe0f67 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Fri, 18 Oct 2024 21:13:54 +0900 Subject: [PATCH 01/18] feat(resolve)!: allow removing conditions --- docs/config/shared-options.md | 5 +- docs/config/ssr-options.md | 2 +- packages/vite/src/node/config.ts | 10 ++-- packages/vite/src/node/constants.ts | 10 ++++ packages/vite/src/node/packages.ts | 12 ++--- packages/vite/src/node/plugins/css.ts | 6 +-- packages/vite/src/node/plugins/resolve.ts | 60 +++++++++-------------- packages/vite/src/node/ssr/fetchModule.ts | 7 +-- playground/resolve/vite.config.js | 9 +++- playground/ssr-conditions/vite.config.js | 10 +++- playground/ssr-webworker/vite.config.js | 9 +++- 11 files changed, 75 insertions(+), 65 deletions(-) diff --git a/docs/config/shared-options.md b/docs/config/shared-options.md index 3502d31a26ffb2..5d7840b265af09 100644 --- a/docs/config/shared-options.md +++ b/docs/config/shared-options.md @@ -117,6 +117,7 @@ For SSR builds, deduplication does not work for ESM build outputs configured fro ## resolve.conditions - **Type:** `string[]` +- **Default:** `['module', 'browser', 'node', 'production', 'development']` Additional allowed conditions when resolving [Conditional Exports](https://nodejs.org/api/packages.html#packages_conditional_exports) from a package. @@ -135,7 +136,9 @@ A package with conditional exports may have the following `exports` field in its Here, `import` and `require` are "conditions". Conditions can be nested and should be specified from most specific to least specific. -Vite has a list of "allowed conditions" and will match the first condition that is in the allowed list. The default allowed conditions are: `import`, `module`, `browser`, `default`, and `production/development` based on current mode. The `resolve.conditions` config option allows specifying additional allowed conditions. +Some of the default conditions (`production`, `development`, `browser`, `node`) are only applied when the requirements are met. For example, `production` is only applied when `process.env.NODE_ENV === 'production'`, and `browser` is only applied when the environment is `webCompatible`. The `resolve.conditions` config option allows specifying additional allowed conditions and those conditions will be applied unconditionally. + +Note that `import`, `require`, `default` conditions are always applied if the requirements are met. :::warning Resolving subpath exports Export keys ending with "/" is deprecated by Node and may not work well. Please contact the package author to use [`*` subpath patterns](https://nodejs.org/api/packages.html#package-entry-points) instead. diff --git a/docs/config/ssr-options.md b/docs/config/ssr-options.md index 8cb7fb9a41b348..5da559d655e968 100644 --- a/docs/config/ssr-options.md +++ b/docs/config/ssr-options.md @@ -43,6 +43,6 @@ These conditions are used in the plugin pipeline, and only affect non-externaliz ## ssr.resolve.externalConditions - **Type:** `string[]` -- **Default:** `[]` +- **Default:** `['node']` Conditions that are used during ssr import (including `ssrLoadModule`) of externalized dependencies. diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 5eb1045ef51c65..0f1f6b08bf8b74 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -15,8 +15,10 @@ import { withTrailingSlash } from '../shared/utils' import { CLIENT_ENTRY, DEFAULT_ASSETS_RE, + DEFAULT_CONDITIONS, DEFAULT_CONFIG_FILES, DEFAULT_EXTENSIONS, + DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_MAIN_FIELDS, ENV_ENTRY, FS_PREFIX, @@ -739,8 +741,9 @@ function resolveEnvironmentResolveOptions( ): ResolvedAllResolveOptions { const resolvedResolve: ResolvedAllResolveOptions = { mainFields: resolve?.mainFields ?? DEFAULT_MAIN_FIELDS, - conditions: resolve?.conditions ?? [], - externalConditions: resolve?.externalConditions ?? [], + conditions: resolve?.conditions ?? DEFAULT_CONDITIONS, + externalConditions: + resolve?.externalConditions ?? DEFAULT_EXTERNAL_CONDITIONS, external: resolve?.external ?? [], noExternal: resolve?.noExternal ?? [], extensions: resolve?.extensions ?? DEFAULT_EXTENSIONS, @@ -1570,11 +1573,10 @@ async function bundleConfigFile( preferRelative: false, tryIndex: true, mainFields: [], - conditions: [], + conditions: ['node'], externalConditions: [], external: [], noExternal: [], - overrideConditions: ['node'], dedupe: [], extensions: DEFAULT_EXTENSIONS, preserveSymlinks: false, diff --git a/packages/vite/src/node/constants.ts b/packages/vite/src/node/constants.ts index 3acc2f759037e5..36823e1381a046 100644 --- a/packages/vite/src/node/constants.ts +++ b/packages/vite/src/node/constants.ts @@ -46,6 +46,16 @@ export const DEFAULT_MAIN_FIELDS = [ 'jsnext', ] +export const DEFAULT_CONDITIONS = [ + 'module', + 'browser', + 'node', + 'production', + 'development', +] + +export const DEFAULT_EXTERNAL_CONDITIONS = ['node'] + // Baseline support browserslist // "defaults and supports es6-module and supports es6-module-dynamic-import" // Higher browser versions may be needed for extra features. diff --git a/packages/vite/src/node/packages.ts b/packages/vite/src/node/packages.ts index ffabe43f89595a..175505d49e5373 100644 --- a/packages/vite/src/node/packages.ts +++ b/packages/vite/src/node/packages.ts @@ -9,7 +9,7 @@ import { tryStatSync, } from './utils' import type { Plugin } from './plugin' -import type { InternalResolveOptionsWithOverrideConditions } from './plugins/resolve' +import type { InternalResolveOptions } from './plugins/resolve' let pnp: typeof import('pnpapi') | undefined if (process.versions.pnp) { @@ -27,11 +27,11 @@ export interface PackageData { setResolvedCache: ( key: string, entry: string, - options: InternalResolveOptionsWithOverrideConditions, + options: InternalResolveOptions, ) => void getResolvedCache: ( key: string, - options: InternalResolveOptionsWithOverrideConditions, + options: InternalResolveOptions, ) => string | undefined data: { [field: string]: any @@ -223,10 +223,7 @@ export function loadPackageData(pkgPath: string): PackageData { return pkg } -function getResolveCacheKey( - key: string, - options: InternalResolveOptionsWithOverrideConditions, -) { +function getResolveCacheKey(key: string, options: InternalResolveOptions) { // cache key needs to include options which affect // `resolvePackageEntry` or `resolveDeepImport` return [ @@ -234,7 +231,6 @@ function getResolveCacheKey( options.webCompatible ? '1' : '0', options.isRequire ? '1' : '0', options.conditions.join('_'), - options.overrideConditions?.join('_') || '', options.extensions.join('_'), options.mainFields.join('_'), ].join('|') diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 1b430588b6f6d3..24338f65a29108 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -1079,7 +1079,7 @@ function createCSSResolvers(config: ResolvedConfig): CSSAtImportResolvers { return (cssResolve ??= createBackCompatIdResolver(config, { extensions: ['.css'], mainFields: ['style'], - conditions: ['style'], + conditions: ['style', 'production', 'development'], tryIndex: false, preferRelative: true, })) @@ -1090,7 +1090,7 @@ function createCSSResolvers(config: ResolvedConfig): CSSAtImportResolvers { const resolver = createBackCompatIdResolver(config, { extensions: ['.scss', '.sass', '.css'], mainFields: ['sass', 'style'], - conditions: ['sass', 'style'], + conditions: ['sass', 'style', 'production', 'development'], tryIndex: true, tryPrefix: '_', preferRelative: true, @@ -1109,7 +1109,7 @@ function createCSSResolvers(config: ResolvedConfig): CSSAtImportResolvers { return (lessResolve ??= createBackCompatIdResolver(config, { extensions: ['.less', '.css'], mainFields: ['less', 'style'], - conditions: ['less', 'style'], + conditions: ['less', 'style', 'production', 'development'], tryIndex: false, preferRelative: true, })) diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts index b930324db960fe..f63b10577bc978 100644 --- a/packages/vite/src/node/plugins/resolve.ts +++ b/packages/vite/src/node/plugins/resolve.ts @@ -736,18 +736,10 @@ function tryCleanFsResolve( } } -export type InternalResolveOptionsWithOverrideConditions = - InternalResolveOptions & { - /** - * @internal - */ - overrideConditions?: string[] - } - export function tryNodeResolve( id: string, importer: string | null | undefined, - options: InternalResolveOptionsWithOverrideConditions, + options: InternalResolveOptions, depsOptimizer?: DepsOptimizer, ssr: boolean = false, externalize?: boolean, @@ -1117,35 +1109,31 @@ function packageEntryFailure(id: string, details?: string) { function resolveExportsOrImports( pkg: PackageData['data'], key: string, - options: InternalResolveOptionsWithOverrideConditions, + options: InternalResolveOptions, type: 'imports' | 'exports', ) { - const additionalConditions = new Set( - options.overrideConditions || [ - 'production', - 'development', - 'module', - ...options.conditions, - ], + const conditions = [...options.conditions, 'require', 'import'].filter( + (condition) => { + switch (condition) { + case 'production': + return options.isProduction + case 'development': + return !options.isProduction + case 'require': + return options.isRequire + case 'import': + return !options.isRequire + case 'node': + return !options.webCompatible + case 'browser': + return options.webCompatible + } + return true + }, ) - const conditions = [...additionalConditions].filter((condition) => { - switch (condition) { - case 'production': - return options.isProduction - case 'development': - return !options.isProduction - } - return true - }) - const fn = type === 'imports' ? imports : exports - const result = fn(pkg, key, { - browser: options.webCompatible && !additionalConditions.has('node'), - require: options.isRequire && !additionalConditions.has('import'), - conditions, - }) - + const result = fn(pkg, key, { conditions, unsafe: true }) return result ? result[0] : undefined } @@ -1183,11 +1171,7 @@ function resolveDeepImport( `${path.join(dir, 'package.json')}.`, ) } - } else if ( - options.webCompatible && - options.mainFields.includes('browser') && - isObject(browserField) - ) { + } else if (options.mainFields.includes('browser') && isObject(browserField)) { // resolve without postfix (see #7098) const { file, postfix } = splitFileAndPostfix(relativeId) const mapped = mapWithBrowserField(file, browserField) diff --git a/packages/vite/src/node/ssr/fetchModule.ts b/packages/vite/src/node/ssr/fetchModule.ts index 4e04718ecbe903..fab14d024d3b83 100644 --- a/packages/vite/src/node/ssr/fetchModule.ts +++ b/packages/vite/src/node/ssr/fetchModule.ts @@ -49,15 +49,10 @@ export async function fetchModule( importer, { mainFields: ['main'], - conditions: [], + conditions: [...externalConditions, 'production', 'development'], externalConditions, external: [], noExternal: [], - overrideConditions: [ - ...externalConditions, - 'production', - 'development', - ], extensions: ['.js', '.cjs', '.json'], dedupe, preserveSymlinks, diff --git a/playground/resolve/vite.config.js b/playground/resolve/vite.config.js index a840ec103298d1..9d2bbeadd02273 100644 --- a/playground/resolve/vite.config.js +++ b/playground/resolve/vite.config.js @@ -28,7 +28,14 @@ export default defineConfig({ resolve: { extensions: ['.mjs', '.js', '.es', '.ts'], mainFields: ['browser', 'custom', 'module'], - conditions: ['custom'], + conditions: [ + 'module', + 'browser', + 'node', + 'production', + 'development', + 'custom', + ], }, define: { VITE_CONFIG_DEP_TEST: a, diff --git a/playground/ssr-conditions/vite.config.js b/playground/ssr-conditions/vite.config.js index 41727adaf5f811..f905c17dff5a7f 100644 --- a/playground/ssr-conditions/vite.config.js +++ b/playground/ssr-conditions/vite.config.js @@ -5,8 +5,14 @@ export default defineConfig({ external: ['@vitejs/test-ssr-conditions-external'], noExternal: ['@vitejs/test-ssr-conditions-no-external'], resolve: { - conditions: ['react-server'], - externalConditions: ['workerd', 'react-server'], + conditions: [ + 'module', + 'node', + 'production', + 'development', + 'react-server', + ], + externalConditions: ['node', 'workerd', 'react-server'], }, }, }) diff --git a/playground/ssr-webworker/vite.config.js b/playground/ssr-webworker/vite.config.js index 3c10b035b550a2..41dc7bfb64fa55 100644 --- a/playground/ssr-webworker/vite.config.js +++ b/playground/ssr-webworker/vite.config.js @@ -6,7 +6,14 @@ export default defineConfig({ }, resolve: { dedupe: ['react'], - conditions: ['worker'], + conditions: [ + 'module', + 'browser', + 'node', + 'production', + 'development', + 'worker', + ], }, ssr: { target: 'webworker', From 15f4875ddb389b2f7f066b6f40da1b7527c96614 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Fri, 18 Oct 2024 21:23:00 +0900 Subject: [PATCH 02/18] chore: remove unrelated diff --- packages/vite/src/node/plugins/resolve.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts index f63b10577bc978..db5c7f0392e663 100644 --- a/packages/vite/src/node/plugins/resolve.ts +++ b/packages/vite/src/node/plugins/resolve.ts @@ -1171,7 +1171,11 @@ function resolveDeepImport( `${path.join(dir, 'package.json')}.`, ) } - } else if (options.mainFields.includes('browser') && isObject(browserField)) { + } else if ( + options.webCompatible && + options.mainFields.includes('browser') && + isObject(browserField) + ) { // resolve without postfix (see #7098) const { file, postfix } = splitFileAndPostfix(relativeId) const mapped = mapWithBrowserField(file, browserField) From c8ab916f5a4aa0f125564488d9ae01ab9d5867a3 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 22 Oct 2024 19:42:06 +0900 Subject: [PATCH 03/18] chore: try set default value first --- packages/vite/src/node/config.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 0f1f6b08bf8b74..870e2e60be257a 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -878,6 +878,8 @@ export async function resolveConfig( const isBuild = command === 'build' + config = mergeConfig({ resolve: { conditions: DEFAULT_CONDITIONS } }, config) + // run config hooks const userPlugins = [...prePlugins, ...normalPlugins, ...postPlugins] config = await runConfigHook(config, userPlugins, configEnv) From 7ebc95895d3ee9557386bdcb0581d02713d2133b Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 22 Oct 2024 19:57:48 +0900 Subject: [PATCH 04/18] chore: don't use local vite for vitest for now --- package.json | 3 +- pnpm-lock.yaml | 305 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 301 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index a48ecc09c66669..01faf2e2fa8151 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,8 @@ "packageManager": "pnpm@9.12.2", "pnpm": { "overrides": { - "vite": "workspace:*" + "vite": "workspace:*", + "vitest>vite": "^5.4.9" }, "patchedDependencies": { "chokidar@3.6.0": "patches/chokidar@3.6.0.patch", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a0f1a57f33959f..2eb01c3f86e67b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,6 +6,7 @@ settings: overrides: vite: workspace:* + vitest>vite: ^5.4.9 patchedDependencies: acorn@8.13.0: @@ -138,7 +139,7 @@ importers: version: link:packages/vite vitest: specifier: ^2.1.3 - version: 2.1.3(@types/node@20.16.13) + version: 2.1.3(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0) docs: devDependencies: @@ -2269,6 +2270,12 @@ packages: cpu: [ppc64] os: [aix] + '@esbuild/aix-ppc64@0.21.5': + resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + '@esbuild/aix-ppc64@0.23.0': resolution: {integrity: sha512-3sG8Zwa5fMcA9bgqB8AfWPQ+HFke6uD3h1s3RIwUNK8EG7a4buxvuFTs3j1IMs2NXAk9F30C/FF4vxRgQCcmoQ==} engines: {node: '>=18'} @@ -2293,6 +2300,12 @@ packages: cpu: [arm64] os: [android] + '@esbuild/android-arm64@0.21.5': + resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm64@0.23.0': resolution: {integrity: sha512-EuHFUYkAVfU4qBdyivULuu03FhJO4IJN9PGuABGrFy4vUuzk91P2d+npxHcFdpUnfYKy0PuV+n6bKIpHOB3prQ==} engines: {node: '>=18'} @@ -2317,6 +2330,12 @@ packages: cpu: [arm] os: [android] + '@esbuild/android-arm@0.21.5': + resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + '@esbuild/android-arm@0.23.0': resolution: {integrity: sha512-+KuOHTKKyIKgEEqKbGTK8W7mPp+hKinbMBeEnNzjJGyFcWsfrXjSTNluJHCY1RqhxFurdD8uNXQDei7qDlR6+g==} engines: {node: '>=18'} @@ -2341,6 +2360,12 @@ packages: cpu: [x64] os: [android] + '@esbuild/android-x64@0.21.5': + resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + '@esbuild/android-x64@0.23.0': resolution: {integrity: sha512-WRrmKidLoKDl56LsbBMhzTTBxrsVwTKdNbKDalbEZr0tcsBgCLbEtoNthOW6PX942YiYq8HzEnb4yWQMLQuipQ==} engines: {node: '>=18'} @@ -2365,6 +2390,12 @@ packages: cpu: [arm64] os: [darwin] + '@esbuild/darwin-arm64@0.21.5': + resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-arm64@0.23.0': resolution: {integrity: sha512-YLntie/IdS31H54Ogdn+v50NuoWF5BDkEUFpiOChVa9UnKpftgwzZRrI4J132ETIi+D8n6xh9IviFV3eXdxfow==} engines: {node: '>=18'} @@ -2389,6 +2420,12 @@ packages: cpu: [x64] os: [darwin] + '@esbuild/darwin-x64@0.21.5': + resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + '@esbuild/darwin-x64@0.23.0': resolution: {integrity: sha512-IMQ6eme4AfznElesHUPDZ+teuGwoRmVuuixu7sv92ZkdQcPbsNHzutd+rAfaBKo8YK3IrBEi9SLLKWJdEvJniQ==} engines: {node: '>=18'} @@ -2413,6 +2450,12 @@ packages: cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-arm64@0.21.5': + resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-arm64@0.23.0': resolution: {integrity: sha512-0muYWCng5vqaxobq6LB3YNtevDFSAZGlgtLoAc81PjUfiFz36n4KMpwhtAd4he8ToSI3TGyuhyx5xmiWNYZFyw==} engines: {node: '>=18'} @@ -2437,6 +2480,12 @@ packages: cpu: [x64] os: [freebsd] + '@esbuild/freebsd-x64@0.21.5': + resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + '@esbuild/freebsd-x64@0.23.0': resolution: {integrity: sha512-XKDVu8IsD0/q3foBzsXGt/KjD/yTKBCIwOHE1XwiXmrRwrX6Hbnd5Eqn/WvDekddK21tfszBSrE/WMaZh+1buQ==} engines: {node: '>=18'} @@ -2461,6 +2510,12 @@ packages: cpu: [arm64] os: [linux] + '@esbuild/linux-arm64@0.21.5': + resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm64@0.23.0': resolution: {integrity: sha512-j1t5iG8jE7BhonbsEg5d9qOYcVZv/Rv6tghaXM/Ug9xahM0nX/H2gfu6X6z11QRTMT6+aywOMA8TDkhPo8aCGw==} engines: {node: '>=18'} @@ -2485,6 +2540,12 @@ packages: cpu: [arm] os: [linux] + '@esbuild/linux-arm@0.21.5': + resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + '@esbuild/linux-arm@0.23.0': resolution: {integrity: sha512-SEELSTEtOFu5LPykzA395Mc+54RMg1EUgXP+iw2SJ72+ooMwVsgfuwXo5Fn0wXNgWZsTVHwY2cg4Vi/bOD88qw==} engines: {node: '>=18'} @@ -2509,6 +2570,12 @@ packages: cpu: [ia32] os: [linux] + '@esbuild/linux-ia32@0.21.5': + resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-ia32@0.23.0': resolution: {integrity: sha512-P7O5Tkh2NbgIm2R6x1zGJJsnacDzTFcRWZyTTMgFdVit6E98LTxO+v8LCCLWRvPrjdzXHx9FEOA8oAZPyApWUA==} engines: {node: '>=18'} @@ -2533,6 +2600,12 @@ packages: cpu: [loong64] os: [linux] + '@esbuild/linux-loong64@0.21.5': + resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-loong64@0.23.0': resolution: {integrity: sha512-InQwepswq6urikQiIC/kkx412fqUZudBO4SYKu0N+tGhXRWUqAx+Q+341tFV6QdBifpjYgUndV1hhMq3WeJi7A==} engines: {node: '>=18'} @@ -2557,6 +2630,12 @@ packages: cpu: [mips64el] os: [linux] + '@esbuild/linux-mips64el@0.21.5': + resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-mips64el@0.23.0': resolution: {integrity: sha512-J9rflLtqdYrxHv2FqXE2i1ELgNjT+JFURt/uDMoPQLcjWQA5wDKgQA4t/dTqGa88ZVECKaD0TctwsUfHbVoi4w==} engines: {node: '>=18'} @@ -2581,6 +2660,12 @@ packages: cpu: [ppc64] os: [linux] + '@esbuild/linux-ppc64@0.21.5': + resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-ppc64@0.23.0': resolution: {integrity: sha512-cShCXtEOVc5GxU0fM+dsFD10qZ5UpcQ8AM22bYj0u/yaAykWnqXJDpd77ublcX6vdDsWLuweeuSNZk4yUxZwtw==} engines: {node: '>=18'} @@ -2605,6 +2690,12 @@ packages: cpu: [riscv64] os: [linux] + '@esbuild/linux-riscv64@0.21.5': + resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-riscv64@0.23.0': resolution: {integrity: sha512-HEtaN7Y5UB4tZPeQmgz/UhzoEyYftbMXrBCUjINGjh3uil+rB/QzzpMshz3cNUxqXN7Vr93zzVtpIDL99t9aRw==} engines: {node: '>=18'} @@ -2629,6 +2720,12 @@ packages: cpu: [s390x] os: [linux] + '@esbuild/linux-s390x@0.21.5': + resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-s390x@0.23.0': resolution: {integrity: sha512-WDi3+NVAuyjg/Wxi+o5KPqRbZY0QhI9TjrEEm+8dmpY9Xir8+HE/HNx2JoLckhKbFopW0RdO2D72w8trZOV+Wg==} engines: {node: '>=18'} @@ -2653,6 +2750,12 @@ packages: cpu: [x64] os: [linux] + '@esbuild/linux-x64@0.21.5': + resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + '@esbuild/linux-x64@0.23.0': resolution: {integrity: sha512-a3pMQhUEJkITgAw6e0bWA+F+vFtCciMjW/LPtoj99MhVt+Mfb6bbL9hu2wmTZgNd994qTAEw+U/r6k3qHWWaOQ==} engines: {node: '>=18'} @@ -2677,6 +2780,12 @@ packages: cpu: [x64] os: [netbsd] + '@esbuild/netbsd-x64@0.21.5': + resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + '@esbuild/netbsd-x64@0.23.0': resolution: {integrity: sha512-cRK+YDem7lFTs2Q5nEv/HHc4LnrfBCbH5+JHu6wm2eP+d8OZNoSMYgPZJq78vqQ9g+9+nMuIsAO7skzphRXHyw==} engines: {node: '>=18'} @@ -2713,6 +2822,12 @@ packages: cpu: [x64] os: [openbsd] + '@esbuild/openbsd-x64@0.21.5': + resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + '@esbuild/openbsd-x64@0.23.0': resolution: {integrity: sha512-6p3nHpby0DM/v15IFKMjAaayFhqnXV52aEmv1whZHX56pdkK+MEaLoQWj+H42ssFarP1PcomVhbsR4pkz09qBg==} engines: {node: '>=18'} @@ -2737,6 +2852,12 @@ packages: cpu: [x64] os: [sunos] + '@esbuild/sunos-x64@0.21.5': + resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + '@esbuild/sunos-x64@0.23.0': resolution: {integrity: sha512-BFelBGfrBwk6LVrmFzCq1u1dZbG4zy/Kp93w2+y83Q5UGYF1d8sCzeLI9NXjKyujjBBniQa8R8PzLFAUrSM9OA==} engines: {node: '>=18'} @@ -2761,6 +2882,12 @@ packages: cpu: [arm64] os: [win32] + '@esbuild/win32-arm64@0.21.5': + resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-arm64@0.23.0': resolution: {integrity: sha512-lY6AC8p4Cnb7xYHuIxQ6iYPe6MfO2CC43XXKo9nBXDb35krYt7KGhQnOkRGar5psxYkircpCqfbNDB4uJbS2jQ==} engines: {node: '>=18'} @@ -2785,6 +2912,12 @@ packages: cpu: [ia32] os: [win32] + '@esbuild/win32-ia32@0.21.5': + resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-ia32@0.23.0': resolution: {integrity: sha512-7L1bHlOTcO4ByvI7OXVI5pNN6HSu6pUQq9yodga8izeuB1KcT2UkHaH6118QJwopExPn0rMHIseCTx1CRo/uNA==} engines: {node: '>=18'} @@ -2809,6 +2942,12 @@ packages: cpu: [x64] os: [win32] + '@esbuild/win32-x64@0.21.5': + resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + '@esbuild/win32-x64@0.23.0': resolution: {integrity: sha512-Arm+WgUFLUATuoxCJcahGuk6Yj9Pzxd6l11Zb/2aAuv5kWWvvfhLFo2fni4uSK5vzlUdCGZ/BdV5tH8klj8p8g==} engines: {node: '>=18'} @@ -4555,6 +4694,11 @@ packages: engines: {node: '>=12'} hasBin: true + esbuild@0.21.5: + resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} + engines: {node: '>=12'} + hasBin: true + esbuild@0.23.0: resolution: {integrity: sha512-1lvV17H2bMYda/WaFb2jLPeHU3zml2k4/yagNMG8Q/YtfMjCwEUZa2eXXMgZTVSL5q1n4H7sQ0X6CdJDqqeCFA==} engines: {node: '>=18'} @@ -6943,6 +7087,37 @@ packages: engines: {node: ^18.0.0 || >=20.0.0} hasBin: true + vite@5.4.9: + resolution: {integrity: sha512-20OVpJHh0PAM0oSOELa5GaZNWeDjcAvQjGXy2Uyr+Tp+/D2/Hdz6NLgpJLsarPTA2QJ6v8mX2P1ZfbsSKvdMkg==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@types/node': ^18.0.0 || >=20.0.0 + less: '*' + lightningcss: ^1.21.0 + sass: '*' + sass-embedded: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + vitepress-plugin-group-icons@1.3.0: resolution: {integrity: sha512-E6Up5HyWh0gxmy2v1v1VVzQpL9UOZuHgoqOmSNBMTRv2rSwg6nk8MeIiJD0tJ0xtWrY5dwG69ENZPyFoD+fVoA==} @@ -7953,6 +8128,9 @@ snapshots: '@esbuild/aix-ppc64@0.19.11': optional: true + '@esbuild/aix-ppc64@0.21.5': + optional: true + '@esbuild/aix-ppc64@0.23.0': optional: true @@ -7965,6 +8143,9 @@ snapshots: '@esbuild/android-arm64@0.19.11': optional: true + '@esbuild/android-arm64@0.21.5': + optional: true + '@esbuild/android-arm64@0.23.0': optional: true @@ -7977,6 +8158,9 @@ snapshots: '@esbuild/android-arm@0.19.11': optional: true + '@esbuild/android-arm@0.21.5': + optional: true + '@esbuild/android-arm@0.23.0': optional: true @@ -7989,6 +8173,9 @@ snapshots: '@esbuild/android-x64@0.19.11': optional: true + '@esbuild/android-x64@0.21.5': + optional: true + '@esbuild/android-x64@0.23.0': optional: true @@ -8001,6 +8188,9 @@ snapshots: '@esbuild/darwin-arm64@0.19.11': optional: true + '@esbuild/darwin-arm64@0.21.5': + optional: true + '@esbuild/darwin-arm64@0.23.0': optional: true @@ -8013,6 +8203,9 @@ snapshots: '@esbuild/darwin-x64@0.19.11': optional: true + '@esbuild/darwin-x64@0.21.5': + optional: true + '@esbuild/darwin-x64@0.23.0': optional: true @@ -8025,6 +8218,9 @@ snapshots: '@esbuild/freebsd-arm64@0.19.11': optional: true + '@esbuild/freebsd-arm64@0.21.5': + optional: true + '@esbuild/freebsd-arm64@0.23.0': optional: true @@ -8037,6 +8233,9 @@ snapshots: '@esbuild/freebsd-x64@0.19.11': optional: true + '@esbuild/freebsd-x64@0.21.5': + optional: true + '@esbuild/freebsd-x64@0.23.0': optional: true @@ -8049,6 +8248,9 @@ snapshots: '@esbuild/linux-arm64@0.19.11': optional: true + '@esbuild/linux-arm64@0.21.5': + optional: true + '@esbuild/linux-arm64@0.23.0': optional: true @@ -8061,6 +8263,9 @@ snapshots: '@esbuild/linux-arm@0.19.11': optional: true + '@esbuild/linux-arm@0.21.5': + optional: true + '@esbuild/linux-arm@0.23.0': optional: true @@ -8073,6 +8278,9 @@ snapshots: '@esbuild/linux-ia32@0.19.11': optional: true + '@esbuild/linux-ia32@0.21.5': + optional: true + '@esbuild/linux-ia32@0.23.0': optional: true @@ -8085,6 +8293,9 @@ snapshots: '@esbuild/linux-loong64@0.19.11': optional: true + '@esbuild/linux-loong64@0.21.5': + optional: true + '@esbuild/linux-loong64@0.23.0': optional: true @@ -8097,6 +8308,9 @@ snapshots: '@esbuild/linux-mips64el@0.19.11': optional: true + '@esbuild/linux-mips64el@0.21.5': + optional: true + '@esbuild/linux-mips64el@0.23.0': optional: true @@ -8109,6 +8323,9 @@ snapshots: '@esbuild/linux-ppc64@0.19.11': optional: true + '@esbuild/linux-ppc64@0.21.5': + optional: true + '@esbuild/linux-ppc64@0.23.0': optional: true @@ -8121,6 +8338,9 @@ snapshots: '@esbuild/linux-riscv64@0.19.11': optional: true + '@esbuild/linux-riscv64@0.21.5': + optional: true + '@esbuild/linux-riscv64@0.23.0': optional: true @@ -8133,6 +8353,9 @@ snapshots: '@esbuild/linux-s390x@0.19.11': optional: true + '@esbuild/linux-s390x@0.21.5': + optional: true + '@esbuild/linux-s390x@0.23.0': optional: true @@ -8145,6 +8368,9 @@ snapshots: '@esbuild/linux-x64@0.19.11': optional: true + '@esbuild/linux-x64@0.21.5': + optional: true + '@esbuild/linux-x64@0.23.0': optional: true @@ -8157,6 +8383,9 @@ snapshots: '@esbuild/netbsd-x64@0.19.11': optional: true + '@esbuild/netbsd-x64@0.21.5': + optional: true + '@esbuild/netbsd-x64@0.23.0': optional: true @@ -8175,6 +8404,9 @@ snapshots: '@esbuild/openbsd-x64@0.19.11': optional: true + '@esbuild/openbsd-x64@0.21.5': + optional: true + '@esbuild/openbsd-x64@0.23.0': optional: true @@ -8187,6 +8419,9 @@ snapshots: '@esbuild/sunos-x64@0.19.11': optional: true + '@esbuild/sunos-x64@0.21.5': + optional: true + '@esbuild/sunos-x64@0.23.0': optional: true @@ -8199,6 +8434,9 @@ snapshots: '@esbuild/win32-arm64@0.19.11': optional: true + '@esbuild/win32-arm64@0.21.5': + optional: true + '@esbuild/win32-arm64@0.23.0': optional: true @@ -8211,6 +8449,9 @@ snapshots: '@esbuild/win32-ia32@0.19.11': optional: true + '@esbuild/win32-ia32@0.21.5': + optional: true + '@esbuild/win32-ia32@0.23.0': optional: true @@ -8223,6 +8464,9 @@ snapshots: '@esbuild/win32-x64@0.19.11': optional: true + '@esbuild/win32-x64@0.21.5': + optional: true + '@esbuild/win32-x64@0.23.0': optional: true @@ -9118,13 +9362,13 @@ snapshots: chai: 5.1.1 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.3(vite@packages+vite)': + '@vitest/mocker@2.1.3(vite@5.4.9(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0))': dependencies: '@vitest/spy': 2.1.3 estree-walker: 3.0.3 magic-string: 0.30.12 optionalDependencies: - vite: link:packages/vite + vite: 5.4.9(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0) '@vitest/pretty-format@2.1.3': dependencies: @@ -10025,6 +10269,32 @@ snapshots: '@esbuild/win32-ia32': 0.19.11 '@esbuild/win32-x64': 0.19.11 + esbuild@0.21.5: + optionalDependencies: + '@esbuild/aix-ppc64': 0.21.5 + '@esbuild/android-arm': 0.21.5 + '@esbuild/android-arm64': 0.21.5 + '@esbuild/android-x64': 0.21.5 + '@esbuild/darwin-arm64': 0.21.5 + '@esbuild/darwin-x64': 0.21.5 + '@esbuild/freebsd-arm64': 0.21.5 + '@esbuild/freebsd-x64': 0.21.5 + '@esbuild/linux-arm': 0.21.5 + '@esbuild/linux-arm64': 0.21.5 + '@esbuild/linux-ia32': 0.21.5 + '@esbuild/linux-loong64': 0.21.5 + '@esbuild/linux-mips64el': 0.21.5 + '@esbuild/linux-ppc64': 0.21.5 + '@esbuild/linux-riscv64': 0.21.5 + '@esbuild/linux-s390x': 0.21.5 + '@esbuild/linux-x64': 0.21.5 + '@esbuild/netbsd-x64': 0.21.5 + '@esbuild/openbsd-x64': 0.21.5 + '@esbuild/sunos-x64': 0.21.5 + '@esbuild/win32-arm64': 0.21.5 + '@esbuild/win32-ia32': 0.21.5 + '@esbuild/win32-x64': 0.21.5 + esbuild@0.23.0: optionalDependencies: '@esbuild/aix-ppc64': 0.23.0 @@ -12709,6 +12979,22 @@ snapshots: transitivePeerDependencies: - supports-color + vite@5.4.9(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0): + dependencies: + esbuild: 0.21.5 + postcss: 8.4.47 + rollup: 4.22.5 + optionalDependencies: + '@types/node': 20.16.13 + fsevents: 2.3.3 + less: 4.2.0 + lightningcss: 1.27.0 + sass: 1.80.3 + sass-embedded: 1.80.3 + stylus: 0.64.0 + sugarss: 4.0.1(postcss@8.4.47) + terser: 5.36.0 + vitepress-plugin-group-icons@1.3.0: dependencies: '@iconify-json/logos': 1.2.3 @@ -12758,10 +13044,10 @@ snapshots: - typescript - universal-cookie - vitest@2.1.3(@types/node@20.16.13): + vitest@2.1.3(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0): dependencies: '@vitest/expect': 2.1.3 - '@vitest/mocker': 2.1.3(vite@packages+vite) + '@vitest/mocker': 2.1.3(vite@5.4.9(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0)) '@vitest/pretty-format': 2.1.3 '@vitest/runner': 2.1.3 '@vitest/snapshot': 2.1.3 @@ -12776,14 +13062,21 @@ snapshots: tinyexec: 0.3.0 tinypool: 1.0.0 tinyrainbow: 1.2.0 - vite: link:packages/vite + vite: 5.4.9(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0) vite-node: 2.1.3 why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 20.16.13 transitivePeerDependencies: + - less + - lightningcss - msw + - sass + - sass-embedded + - stylus + - sugarss - supports-color + - terser void-elements@3.1.0: {} From 2f833c77fb951a85b7172a62bd7154a300ed5757 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:46:00 +0900 Subject: [PATCH 05/18] Revert "chore: don't use local vite for vitest for now" This reverts commit 7ebc95895d3ee9557386bdcb0581d02713d2133b. --- package.json | 3 +- pnpm-lock.yaml | 305 +------------------------------------------------ 2 files changed, 7 insertions(+), 301 deletions(-) diff --git a/package.json b/package.json index 01faf2e2fa8151..a48ecc09c66669 100644 --- a/package.json +++ b/package.json @@ -99,8 +99,7 @@ "packageManager": "pnpm@9.12.2", "pnpm": { "overrides": { - "vite": "workspace:*", - "vitest>vite": "^5.4.9" + "vite": "workspace:*" }, "patchedDependencies": { "chokidar@3.6.0": "patches/chokidar@3.6.0.patch", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2eb01c3f86e67b..a0f1a57f33959f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,6 @@ settings: overrides: vite: workspace:* - vitest>vite: ^5.4.9 patchedDependencies: acorn@8.13.0: @@ -139,7 +138,7 @@ importers: version: link:packages/vite vitest: specifier: ^2.1.3 - version: 2.1.3(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0) + version: 2.1.3(@types/node@20.16.13) docs: devDependencies: @@ -2270,12 +2269,6 @@ packages: cpu: [ppc64] os: [aix] - '@esbuild/aix-ppc64@0.21.5': - resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [aix] - '@esbuild/aix-ppc64@0.23.0': resolution: {integrity: sha512-3sG8Zwa5fMcA9bgqB8AfWPQ+HFke6uD3h1s3RIwUNK8EG7a4buxvuFTs3j1IMs2NXAk9F30C/FF4vxRgQCcmoQ==} engines: {node: '>=18'} @@ -2300,12 +2293,6 @@ packages: cpu: [arm64] os: [android] - '@esbuild/android-arm64@0.21.5': - resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==} - engines: {node: '>=12'} - cpu: [arm64] - os: [android] - '@esbuild/android-arm64@0.23.0': resolution: {integrity: sha512-EuHFUYkAVfU4qBdyivULuu03FhJO4IJN9PGuABGrFy4vUuzk91P2d+npxHcFdpUnfYKy0PuV+n6bKIpHOB3prQ==} engines: {node: '>=18'} @@ -2330,12 +2317,6 @@ packages: cpu: [arm] os: [android] - '@esbuild/android-arm@0.21.5': - resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==} - engines: {node: '>=12'} - cpu: [arm] - os: [android] - '@esbuild/android-arm@0.23.0': resolution: {integrity: sha512-+KuOHTKKyIKgEEqKbGTK8W7mPp+hKinbMBeEnNzjJGyFcWsfrXjSTNluJHCY1RqhxFurdD8uNXQDei7qDlR6+g==} engines: {node: '>=18'} @@ -2360,12 +2341,6 @@ packages: cpu: [x64] os: [android] - '@esbuild/android-x64@0.21.5': - resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - '@esbuild/android-x64@0.23.0': resolution: {integrity: sha512-WRrmKidLoKDl56LsbBMhzTTBxrsVwTKdNbKDalbEZr0tcsBgCLbEtoNthOW6PX942YiYq8HzEnb4yWQMLQuipQ==} engines: {node: '>=18'} @@ -2390,12 +2365,6 @@ packages: cpu: [arm64] os: [darwin] - '@esbuild/darwin-arm64@0.21.5': - resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - '@esbuild/darwin-arm64@0.23.0': resolution: {integrity: sha512-YLntie/IdS31H54Ogdn+v50NuoWF5BDkEUFpiOChVa9UnKpftgwzZRrI4J132ETIi+D8n6xh9IviFV3eXdxfow==} engines: {node: '>=18'} @@ -2420,12 +2389,6 @@ packages: cpu: [x64] os: [darwin] - '@esbuild/darwin-x64@0.21.5': - resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - '@esbuild/darwin-x64@0.23.0': resolution: {integrity: sha512-IMQ6eme4AfznElesHUPDZ+teuGwoRmVuuixu7sv92ZkdQcPbsNHzutd+rAfaBKo8YK3IrBEi9SLLKWJdEvJniQ==} engines: {node: '>=18'} @@ -2450,12 +2413,6 @@ packages: cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-arm64@0.21.5': - resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - '@esbuild/freebsd-arm64@0.23.0': resolution: {integrity: sha512-0muYWCng5vqaxobq6LB3YNtevDFSAZGlgtLoAc81PjUfiFz36n4KMpwhtAd4he8ToSI3TGyuhyx5xmiWNYZFyw==} engines: {node: '>=18'} @@ -2480,12 +2437,6 @@ packages: cpu: [x64] os: [freebsd] - '@esbuild/freebsd-x64@0.21.5': - resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - '@esbuild/freebsd-x64@0.23.0': resolution: {integrity: sha512-XKDVu8IsD0/q3foBzsXGt/KjD/yTKBCIwOHE1XwiXmrRwrX6Hbnd5Eqn/WvDekddK21tfszBSrE/WMaZh+1buQ==} engines: {node: '>=18'} @@ -2510,12 +2461,6 @@ packages: cpu: [arm64] os: [linux] - '@esbuild/linux-arm64@0.21.5': - resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - '@esbuild/linux-arm64@0.23.0': resolution: {integrity: sha512-j1t5iG8jE7BhonbsEg5d9qOYcVZv/Rv6tghaXM/Ug9xahM0nX/H2gfu6X6z11QRTMT6+aywOMA8TDkhPo8aCGw==} engines: {node: '>=18'} @@ -2540,12 +2485,6 @@ packages: cpu: [arm] os: [linux] - '@esbuild/linux-arm@0.21.5': - resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - '@esbuild/linux-arm@0.23.0': resolution: {integrity: sha512-SEELSTEtOFu5LPykzA395Mc+54RMg1EUgXP+iw2SJ72+ooMwVsgfuwXo5Fn0wXNgWZsTVHwY2cg4Vi/bOD88qw==} engines: {node: '>=18'} @@ -2570,12 +2509,6 @@ packages: cpu: [ia32] os: [linux] - '@esbuild/linux-ia32@0.21.5': - resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - '@esbuild/linux-ia32@0.23.0': resolution: {integrity: sha512-P7O5Tkh2NbgIm2R6x1zGJJsnacDzTFcRWZyTTMgFdVit6E98LTxO+v8LCCLWRvPrjdzXHx9FEOA8oAZPyApWUA==} engines: {node: '>=18'} @@ -2600,12 +2533,6 @@ packages: cpu: [loong64] os: [linux] - '@esbuild/linux-loong64@0.21.5': - resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==} - engines: {node: '>=12'} - cpu: [loong64] - os: [linux] - '@esbuild/linux-loong64@0.23.0': resolution: {integrity: sha512-InQwepswq6urikQiIC/kkx412fqUZudBO4SYKu0N+tGhXRWUqAx+Q+341tFV6QdBifpjYgUndV1hhMq3WeJi7A==} engines: {node: '>=18'} @@ -2630,12 +2557,6 @@ packages: cpu: [mips64el] os: [linux] - '@esbuild/linux-mips64el@0.21.5': - resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - '@esbuild/linux-mips64el@0.23.0': resolution: {integrity: sha512-J9rflLtqdYrxHv2FqXE2i1ELgNjT+JFURt/uDMoPQLcjWQA5wDKgQA4t/dTqGa88ZVECKaD0TctwsUfHbVoi4w==} engines: {node: '>=18'} @@ -2660,12 +2581,6 @@ packages: cpu: [ppc64] os: [linux] - '@esbuild/linux-ppc64@0.21.5': - resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - '@esbuild/linux-ppc64@0.23.0': resolution: {integrity: sha512-cShCXtEOVc5GxU0fM+dsFD10qZ5UpcQ8AM22bYj0u/yaAykWnqXJDpd77ublcX6vdDsWLuweeuSNZk4yUxZwtw==} engines: {node: '>=18'} @@ -2690,12 +2605,6 @@ packages: cpu: [riscv64] os: [linux] - '@esbuild/linux-riscv64@0.21.5': - resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - '@esbuild/linux-riscv64@0.23.0': resolution: {integrity: sha512-HEtaN7Y5UB4tZPeQmgz/UhzoEyYftbMXrBCUjINGjh3uil+rB/QzzpMshz3cNUxqXN7Vr93zzVtpIDL99t9aRw==} engines: {node: '>=18'} @@ -2720,12 +2629,6 @@ packages: cpu: [s390x] os: [linux] - '@esbuild/linux-s390x@0.21.5': - resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - '@esbuild/linux-s390x@0.23.0': resolution: {integrity: sha512-WDi3+NVAuyjg/Wxi+o5KPqRbZY0QhI9TjrEEm+8dmpY9Xir8+HE/HNx2JoLckhKbFopW0RdO2D72w8trZOV+Wg==} engines: {node: '>=18'} @@ -2750,12 +2653,6 @@ packages: cpu: [x64] os: [linux] - '@esbuild/linux-x64@0.21.5': - resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - '@esbuild/linux-x64@0.23.0': resolution: {integrity: sha512-a3pMQhUEJkITgAw6e0bWA+F+vFtCciMjW/LPtoj99MhVt+Mfb6bbL9hu2wmTZgNd994qTAEw+U/r6k3qHWWaOQ==} engines: {node: '>=18'} @@ -2780,12 +2677,6 @@ packages: cpu: [x64] os: [netbsd] - '@esbuild/netbsd-x64@0.21.5': - resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - '@esbuild/netbsd-x64@0.23.0': resolution: {integrity: sha512-cRK+YDem7lFTs2Q5nEv/HHc4LnrfBCbH5+JHu6wm2eP+d8OZNoSMYgPZJq78vqQ9g+9+nMuIsAO7skzphRXHyw==} engines: {node: '>=18'} @@ -2822,12 +2713,6 @@ packages: cpu: [x64] os: [openbsd] - '@esbuild/openbsd-x64@0.21.5': - resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - '@esbuild/openbsd-x64@0.23.0': resolution: {integrity: sha512-6p3nHpby0DM/v15IFKMjAaayFhqnXV52aEmv1whZHX56pdkK+MEaLoQWj+H42ssFarP1PcomVhbsR4pkz09qBg==} engines: {node: '>=18'} @@ -2852,12 +2737,6 @@ packages: cpu: [x64] os: [sunos] - '@esbuild/sunos-x64@0.21.5': - resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - '@esbuild/sunos-x64@0.23.0': resolution: {integrity: sha512-BFelBGfrBwk6LVrmFzCq1u1dZbG4zy/Kp93w2+y83Q5UGYF1d8sCzeLI9NXjKyujjBBniQa8R8PzLFAUrSM9OA==} engines: {node: '>=18'} @@ -2882,12 +2761,6 @@ packages: cpu: [arm64] os: [win32] - '@esbuild/win32-arm64@0.21.5': - resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - '@esbuild/win32-arm64@0.23.0': resolution: {integrity: sha512-lY6AC8p4Cnb7xYHuIxQ6iYPe6MfO2CC43XXKo9nBXDb35krYt7KGhQnOkRGar5psxYkircpCqfbNDB4uJbS2jQ==} engines: {node: '>=18'} @@ -2912,12 +2785,6 @@ packages: cpu: [ia32] os: [win32] - '@esbuild/win32-ia32@0.21.5': - resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - '@esbuild/win32-ia32@0.23.0': resolution: {integrity: sha512-7L1bHlOTcO4ByvI7OXVI5pNN6HSu6pUQq9yodga8izeuB1KcT2UkHaH6118QJwopExPn0rMHIseCTx1CRo/uNA==} engines: {node: '>=18'} @@ -2942,12 +2809,6 @@ packages: cpu: [x64] os: [win32] - '@esbuild/win32-x64@0.21.5': - resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - '@esbuild/win32-x64@0.23.0': resolution: {integrity: sha512-Arm+WgUFLUATuoxCJcahGuk6Yj9Pzxd6l11Zb/2aAuv5kWWvvfhLFo2fni4uSK5vzlUdCGZ/BdV5tH8klj8p8g==} engines: {node: '>=18'} @@ -4694,11 +4555,6 @@ packages: engines: {node: '>=12'} hasBin: true - esbuild@0.21.5: - resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} - engines: {node: '>=12'} - hasBin: true - esbuild@0.23.0: resolution: {integrity: sha512-1lvV17H2bMYda/WaFb2jLPeHU3zml2k4/yagNMG8Q/YtfMjCwEUZa2eXXMgZTVSL5q1n4H7sQ0X6CdJDqqeCFA==} engines: {node: '>=18'} @@ -7087,37 +6943,6 @@ packages: engines: {node: ^18.0.0 || >=20.0.0} hasBin: true - vite@5.4.9: - resolution: {integrity: sha512-20OVpJHh0PAM0oSOELa5GaZNWeDjcAvQjGXy2Uyr+Tp+/D2/Hdz6NLgpJLsarPTA2QJ6v8mX2P1ZfbsSKvdMkg==} - engines: {node: ^18.0.0 || >=20.0.0} - hasBin: true - peerDependencies: - '@types/node': ^18.0.0 || >=20.0.0 - less: '*' - lightningcss: ^1.21.0 - sass: '*' - sass-embedded: '*' - stylus: '*' - sugarss: '*' - terser: ^5.4.0 - peerDependenciesMeta: - '@types/node': - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - sass-embedded: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - vitepress-plugin-group-icons@1.3.0: resolution: {integrity: sha512-E6Up5HyWh0gxmy2v1v1VVzQpL9UOZuHgoqOmSNBMTRv2rSwg6nk8MeIiJD0tJ0xtWrY5dwG69ENZPyFoD+fVoA==} @@ -8128,9 +7953,6 @@ snapshots: '@esbuild/aix-ppc64@0.19.11': optional: true - '@esbuild/aix-ppc64@0.21.5': - optional: true - '@esbuild/aix-ppc64@0.23.0': optional: true @@ -8143,9 +7965,6 @@ snapshots: '@esbuild/android-arm64@0.19.11': optional: true - '@esbuild/android-arm64@0.21.5': - optional: true - '@esbuild/android-arm64@0.23.0': optional: true @@ -8158,9 +7977,6 @@ snapshots: '@esbuild/android-arm@0.19.11': optional: true - '@esbuild/android-arm@0.21.5': - optional: true - '@esbuild/android-arm@0.23.0': optional: true @@ -8173,9 +7989,6 @@ snapshots: '@esbuild/android-x64@0.19.11': optional: true - '@esbuild/android-x64@0.21.5': - optional: true - '@esbuild/android-x64@0.23.0': optional: true @@ -8188,9 +8001,6 @@ snapshots: '@esbuild/darwin-arm64@0.19.11': optional: true - '@esbuild/darwin-arm64@0.21.5': - optional: true - '@esbuild/darwin-arm64@0.23.0': optional: true @@ -8203,9 +8013,6 @@ snapshots: '@esbuild/darwin-x64@0.19.11': optional: true - '@esbuild/darwin-x64@0.21.5': - optional: true - '@esbuild/darwin-x64@0.23.0': optional: true @@ -8218,9 +8025,6 @@ snapshots: '@esbuild/freebsd-arm64@0.19.11': optional: true - '@esbuild/freebsd-arm64@0.21.5': - optional: true - '@esbuild/freebsd-arm64@0.23.0': optional: true @@ -8233,9 +8037,6 @@ snapshots: '@esbuild/freebsd-x64@0.19.11': optional: true - '@esbuild/freebsd-x64@0.21.5': - optional: true - '@esbuild/freebsd-x64@0.23.0': optional: true @@ -8248,9 +8049,6 @@ snapshots: '@esbuild/linux-arm64@0.19.11': optional: true - '@esbuild/linux-arm64@0.21.5': - optional: true - '@esbuild/linux-arm64@0.23.0': optional: true @@ -8263,9 +8061,6 @@ snapshots: '@esbuild/linux-arm@0.19.11': optional: true - '@esbuild/linux-arm@0.21.5': - optional: true - '@esbuild/linux-arm@0.23.0': optional: true @@ -8278,9 +8073,6 @@ snapshots: '@esbuild/linux-ia32@0.19.11': optional: true - '@esbuild/linux-ia32@0.21.5': - optional: true - '@esbuild/linux-ia32@0.23.0': optional: true @@ -8293,9 +8085,6 @@ snapshots: '@esbuild/linux-loong64@0.19.11': optional: true - '@esbuild/linux-loong64@0.21.5': - optional: true - '@esbuild/linux-loong64@0.23.0': optional: true @@ -8308,9 +8097,6 @@ snapshots: '@esbuild/linux-mips64el@0.19.11': optional: true - '@esbuild/linux-mips64el@0.21.5': - optional: true - '@esbuild/linux-mips64el@0.23.0': optional: true @@ -8323,9 +8109,6 @@ snapshots: '@esbuild/linux-ppc64@0.19.11': optional: true - '@esbuild/linux-ppc64@0.21.5': - optional: true - '@esbuild/linux-ppc64@0.23.0': optional: true @@ -8338,9 +8121,6 @@ snapshots: '@esbuild/linux-riscv64@0.19.11': optional: true - '@esbuild/linux-riscv64@0.21.5': - optional: true - '@esbuild/linux-riscv64@0.23.0': optional: true @@ -8353,9 +8133,6 @@ snapshots: '@esbuild/linux-s390x@0.19.11': optional: true - '@esbuild/linux-s390x@0.21.5': - optional: true - '@esbuild/linux-s390x@0.23.0': optional: true @@ -8368,9 +8145,6 @@ snapshots: '@esbuild/linux-x64@0.19.11': optional: true - '@esbuild/linux-x64@0.21.5': - optional: true - '@esbuild/linux-x64@0.23.0': optional: true @@ -8383,9 +8157,6 @@ snapshots: '@esbuild/netbsd-x64@0.19.11': optional: true - '@esbuild/netbsd-x64@0.21.5': - optional: true - '@esbuild/netbsd-x64@0.23.0': optional: true @@ -8404,9 +8175,6 @@ snapshots: '@esbuild/openbsd-x64@0.19.11': optional: true - '@esbuild/openbsd-x64@0.21.5': - optional: true - '@esbuild/openbsd-x64@0.23.0': optional: true @@ -8419,9 +8187,6 @@ snapshots: '@esbuild/sunos-x64@0.19.11': optional: true - '@esbuild/sunos-x64@0.21.5': - optional: true - '@esbuild/sunos-x64@0.23.0': optional: true @@ -8434,9 +8199,6 @@ snapshots: '@esbuild/win32-arm64@0.19.11': optional: true - '@esbuild/win32-arm64@0.21.5': - optional: true - '@esbuild/win32-arm64@0.23.0': optional: true @@ -8449,9 +8211,6 @@ snapshots: '@esbuild/win32-ia32@0.19.11': optional: true - '@esbuild/win32-ia32@0.21.5': - optional: true - '@esbuild/win32-ia32@0.23.0': optional: true @@ -8464,9 +8223,6 @@ snapshots: '@esbuild/win32-x64@0.19.11': optional: true - '@esbuild/win32-x64@0.21.5': - optional: true - '@esbuild/win32-x64@0.23.0': optional: true @@ -9362,13 +9118,13 @@ snapshots: chai: 5.1.1 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.3(vite@5.4.9(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0))': + '@vitest/mocker@2.1.3(vite@packages+vite)': dependencies: '@vitest/spy': 2.1.3 estree-walker: 3.0.3 magic-string: 0.30.12 optionalDependencies: - vite: 5.4.9(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0) + vite: link:packages/vite '@vitest/pretty-format@2.1.3': dependencies: @@ -10269,32 +10025,6 @@ snapshots: '@esbuild/win32-ia32': 0.19.11 '@esbuild/win32-x64': 0.19.11 - esbuild@0.21.5: - optionalDependencies: - '@esbuild/aix-ppc64': 0.21.5 - '@esbuild/android-arm': 0.21.5 - '@esbuild/android-arm64': 0.21.5 - '@esbuild/android-x64': 0.21.5 - '@esbuild/darwin-arm64': 0.21.5 - '@esbuild/darwin-x64': 0.21.5 - '@esbuild/freebsd-arm64': 0.21.5 - '@esbuild/freebsd-x64': 0.21.5 - '@esbuild/linux-arm': 0.21.5 - '@esbuild/linux-arm64': 0.21.5 - '@esbuild/linux-ia32': 0.21.5 - '@esbuild/linux-loong64': 0.21.5 - '@esbuild/linux-mips64el': 0.21.5 - '@esbuild/linux-ppc64': 0.21.5 - '@esbuild/linux-riscv64': 0.21.5 - '@esbuild/linux-s390x': 0.21.5 - '@esbuild/linux-x64': 0.21.5 - '@esbuild/netbsd-x64': 0.21.5 - '@esbuild/openbsd-x64': 0.21.5 - '@esbuild/sunos-x64': 0.21.5 - '@esbuild/win32-arm64': 0.21.5 - '@esbuild/win32-ia32': 0.21.5 - '@esbuild/win32-x64': 0.21.5 - esbuild@0.23.0: optionalDependencies: '@esbuild/aix-ppc64': 0.23.0 @@ -12979,22 +12709,6 @@ snapshots: transitivePeerDependencies: - supports-color - vite@5.4.9(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0): - dependencies: - esbuild: 0.21.5 - postcss: 8.4.47 - rollup: 4.22.5 - optionalDependencies: - '@types/node': 20.16.13 - fsevents: 2.3.3 - less: 4.2.0 - lightningcss: 1.27.0 - sass: 1.80.3 - sass-embedded: 1.80.3 - stylus: 0.64.0 - sugarss: 4.0.1(postcss@8.4.47) - terser: 5.36.0 - vitepress-plugin-group-icons@1.3.0: dependencies: '@iconify-json/logos': 1.2.3 @@ -13044,10 +12758,10 @@ snapshots: - typescript - universal-cookie - vitest@2.1.3(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0): + vitest@2.1.3(@types/node@20.16.13): dependencies: '@vitest/expect': 2.1.3 - '@vitest/mocker': 2.1.3(vite@5.4.9(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0)) + '@vitest/mocker': 2.1.3(vite@packages+vite) '@vitest/pretty-format': 2.1.3 '@vitest/runner': 2.1.3 '@vitest/snapshot': 2.1.3 @@ -13062,21 +12776,14 @@ snapshots: tinyexec: 0.3.0 tinypool: 1.0.0 tinyrainbow: 1.2.0 - vite: 5.4.9(@types/node@20.16.13)(less@4.2.0)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(stylus@0.64.0)(sugarss@4.0.1(postcss@8.4.47))(terser@5.36.0) + vite: link:packages/vite vite-node: 2.1.3 why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 20.16.13 transitivePeerDependencies: - - less - - lightningcss - msw - - sass - - sass-embedded - - stylus - - sugarss - supports-color - - terser void-elements@3.1.0: {} From c3bf6d8ca088360eaa6a82273896921164b98f41 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:12:37 +0900 Subject: [PATCH 06/18] chore: try patch vitest --- package.json | 3 ++- patches/vitest.patch | 49 ++++++++++++++++++++++++++++++++++++++++++++ pnpm-lock.yaml | 7 +++++-- 3 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 patches/vitest.patch diff --git a/package.json b/package.json index a48ecc09c66669..d0961a567804b6 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,8 @@ "chokidar@3.6.0": "patches/chokidar@3.6.0.patch", "http-proxy@1.18.1": "patches/http-proxy@1.18.1.patch", "sirv@3.0.0": "patches/sirv@3.0.0.patch", - "acorn@8.13.0": "patches/acorn@8.13.0.patch" + "acorn@8.13.0": "patches/acorn@8.13.0.patch", + "vitest": "patches/vitest.patch" }, "peerDependencyRules": { "allowedVersions": { diff --git a/patches/vitest.patch b/patches/vitest.patch new file mode 100644 index 00000000000000..5b2ea484bdc37a --- /dev/null +++ b/patches/vitest.patch @@ -0,0 +1,49 @@ +diff --git a/dist/chunks/resolveConfig.Dha6ilPI.js b/dist/chunks/resolveConfig.Dha6ilPI.js +index dac3d35f0ebc93e7979e51d3df38964277a6e6c9..b175a9fbf077921781a1ade383109b4b4465cb7c 100644 +--- a/dist/chunks/resolveConfig.Dha6ilPI.js ++++ b/dist/chunks/resolveConfig.Dha6ilPI.js +@@ -156,7 +156,7 @@ function requireUtils$1 () { + + flat(args); + return result; +- }; ++ }; + } (utils$1)); + return utils$1; + } +@@ -1806,7 +1806,7 @@ function requireUtils () { + output = `(?:^(?!${output}).*$)`; + } + return output; +- }; ++ }; + } (utils)); + return utils; + } +@@ -4578,7 +4578,7 @@ function createThreadsPool(ctx, { execArgv, env }) { + ctx.state.addProcessTimeoutCause( + `Failed to terminate worker while running ${files.join( + ", " +- )}. ++ )}. + See https://vitest.dev/guide/common-errors.html#failed-to-terminate-worker for troubleshooting.` + ); + } else if (ctx.isCancelling && error instanceof Error && /The task has been cancelled/.test(error.message)) { +@@ -4837,7 +4837,7 @@ function createVmThreadsPool(ctx, { execArgv, env }) { + ctx.state.addProcessTimeoutCause( + `Failed to terminate worker while running ${files.join( + ", " +- )}. ++ )}. + See https://vitest.dev/guide/common-errors.html#failed-to-terminate-worker for troubleshooting.` + ); + } else if (ctx.isCancelling && error instanceof Error && /The task has been cancelled/.test(error.message)) { +@@ -5208,7 +5208,7 @@ function createPool(ctx) { + const potentialConditions = /* @__PURE__ */ new Set([ + "production", + "development", +- ...ctx.server.config.resolve.conditions ++ // ...ctx.server.config.resolve.conditions + ]); + const conditions = [...potentialConditions].filter((condition) => { + if (condition === "production") { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a0f1a57f33959f..0f8614ec365a32 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ patchedDependencies: sirv@3.0.0: hash: plxlsciwiebyhal5sm4vtpekka path: patches/sirv@3.0.0.patch + vitest: + hash: 4lwmb4rvdtbdrdx3wvyapxjsxq + path: patches/vitest.patch importers: @@ -138,7 +141,7 @@ importers: version: link:packages/vite vitest: specifier: ^2.1.3 - version: 2.1.3(@types/node@20.16.13) + version: 2.1.3(patch_hash=4lwmb4rvdtbdrdx3wvyapxjsxq)(@types/node@20.16.13) docs: devDependencies: @@ -12758,7 +12761,7 @@ snapshots: - typescript - universal-cookie - vitest@2.1.3(@types/node@20.16.13): + vitest@2.1.3(patch_hash=4lwmb4rvdtbdrdx3wvyapxjsxq)(@types/node@20.16.13): dependencies: '@vitest/expect': 2.1.3 '@vitest/mocker': 2.1.3(vite@packages+vite) From 0cb8863ad528b4c6a79fbd2f82ddc7d6856d5ae4 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:39:34 +0900 Subject: [PATCH 07/18] Revert "chore: try patch vitest" This reverts commit c3bf6d8ca088360eaa6a82273896921164b98f41. --- package.json | 3 +-- patches/vitest.patch | 49 -------------------------------------------- pnpm-lock.yaml | 7 ++----- 3 files changed, 3 insertions(+), 56 deletions(-) delete mode 100644 patches/vitest.patch diff --git a/package.json b/package.json index d0961a567804b6..a48ecc09c66669 100644 --- a/package.json +++ b/package.json @@ -105,8 +105,7 @@ "chokidar@3.6.0": "patches/chokidar@3.6.0.patch", "http-proxy@1.18.1": "patches/http-proxy@1.18.1.patch", "sirv@3.0.0": "patches/sirv@3.0.0.patch", - "acorn@8.13.0": "patches/acorn@8.13.0.patch", - "vitest": "patches/vitest.patch" + "acorn@8.13.0": "patches/acorn@8.13.0.patch" }, "peerDependencyRules": { "allowedVersions": { diff --git a/patches/vitest.patch b/patches/vitest.patch deleted file mode 100644 index 5b2ea484bdc37a..00000000000000 --- a/patches/vitest.patch +++ /dev/null @@ -1,49 +0,0 @@ -diff --git a/dist/chunks/resolveConfig.Dha6ilPI.js b/dist/chunks/resolveConfig.Dha6ilPI.js -index dac3d35f0ebc93e7979e51d3df38964277a6e6c9..b175a9fbf077921781a1ade383109b4b4465cb7c 100644 ---- a/dist/chunks/resolveConfig.Dha6ilPI.js -+++ b/dist/chunks/resolveConfig.Dha6ilPI.js -@@ -156,7 +156,7 @@ function requireUtils$1 () { - - flat(args); - return result; -- }; -+ }; - } (utils$1)); - return utils$1; - } -@@ -1806,7 +1806,7 @@ function requireUtils () { - output = `(?:^(?!${output}).*$)`; - } - return output; -- }; -+ }; - } (utils)); - return utils; - } -@@ -4578,7 +4578,7 @@ function createThreadsPool(ctx, { execArgv, env }) { - ctx.state.addProcessTimeoutCause( - `Failed to terminate worker while running ${files.join( - ", " -- )}. -+ )}. - See https://vitest.dev/guide/common-errors.html#failed-to-terminate-worker for troubleshooting.` - ); - } else if (ctx.isCancelling && error instanceof Error && /The task has been cancelled/.test(error.message)) { -@@ -4837,7 +4837,7 @@ function createVmThreadsPool(ctx, { execArgv, env }) { - ctx.state.addProcessTimeoutCause( - `Failed to terminate worker while running ${files.join( - ", " -- )}. -+ )}. - See https://vitest.dev/guide/common-errors.html#failed-to-terminate-worker for troubleshooting.` - ); - } else if (ctx.isCancelling && error instanceof Error && /The task has been cancelled/.test(error.message)) { -@@ -5208,7 +5208,7 @@ function createPool(ctx) { - const potentialConditions = /* @__PURE__ */ new Set([ - "production", - "development", -- ...ctx.server.config.resolve.conditions -+ // ...ctx.server.config.resolve.conditions - ]); - const conditions = [...potentialConditions].filter((condition) => { - if (condition === "production") { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 734633b6e2a8a7..31e590d93219a5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,9 +20,6 @@ patchedDependencies: sirv@3.0.0: hash: plxlsciwiebyhal5sm4vtpekka path: patches/sirv@3.0.0.patch - vitest: - hash: 4lwmb4rvdtbdrdx3wvyapxjsxq - path: patches/vitest.patch importers: @@ -141,7 +138,7 @@ importers: version: link:packages/vite vitest: specifier: ^2.1.3 - version: 2.1.3(patch_hash=4lwmb4rvdtbdrdx3wvyapxjsxq)(@types/node@20.16.13) + version: 2.1.3(@types/node@20.16.13) docs: devDependencies: @@ -12767,7 +12764,7 @@ snapshots: - typescript - universal-cookie - vitest@2.1.3(patch_hash=4lwmb4rvdtbdrdx3wvyapxjsxq)(@types/node@20.16.13): + vitest@2.1.3(@types/node@20.16.13): dependencies: '@vitest/expect': 2.1.3 '@vitest/mocker': 2.1.3(vite@packages+vite) From ff6a3d8c9c0fbe598dfd389dd4b8c5b7f3d6f0c4 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:39:43 +0900 Subject: [PATCH 08/18] Revert "chore: try set default value first" This reverts commit c8ab916f5a4aa0f125564488d9ae01ab9d5867a3. --- packages/vite/src/node/config.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 870e2e60be257a..0f1f6b08bf8b74 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -878,8 +878,6 @@ export async function resolveConfig( const isBuild = command === 'build' - config = mergeConfig({ resolve: { conditions: DEFAULT_CONDITIONS } }, config) - // run config hooks const userPlugins = [...prePlugins, ...normalPlugins, ...postPlugins] config = await runConfigHook(config, userPlugins, configEnv) From edcf8f3eca8e009382fdbc1a9e2a1771f8badca6 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:48:35 +0900 Subject: [PATCH 09/18] refactor: remove `webCompatible` --- .../src/node/__tests__/environment.spec.ts | 94 +++---------------- .../test-dep-conditions/index.custom2.js | 1 - .../test-dep-conditions/index.custom3.js | 1 - .../fixtures/test-dep-conditions/package.json | 2 - packages/vite/src/node/baseEnvironment.ts | 1 - packages/vite/src/node/build.ts | 23 +++-- packages/vite/src/node/config.ts | 51 ++++++---- packages/vite/src/node/external.ts | 3 +- packages/vite/src/node/optimizer/index.ts | 3 +- packages/vite/src/node/packages.ts | 1 - packages/vite/src/node/plugins/define.ts | 6 +- packages/vite/src/node/plugins/resolve.ts | 29 +----- packages/vite/src/node/ssr/fetchModule.ts | 1 - packages/vite/src/node/ssr/index.ts | 2 +- 14 files changed, 76 insertions(+), 142 deletions(-) delete mode 100644 packages/vite/src/node/__tests__/fixtures/test-dep-conditions/index.custom2.js delete mode 100644 packages/vite/src/node/__tests__/fixtures/test-dep-conditions/index.custom3.js diff --git a/packages/vite/src/node/__tests__/environment.spec.ts b/packages/vite/src/node/__tests__/environment.spec.ts index 081d2204cc8920..75b12136c5cd2d 100644 --- a/packages/vite/src/node/__tests__/environment.spec.ts +++ b/packages/vite/src/node/__tests__/environment.spec.ts @@ -21,7 +21,7 @@ describe('custom environment conditions', () => { ws: false, }, environments: { - // no web / default + // default ssr: { resolve: { noExternal, @@ -36,9 +36,8 @@ describe('custom environment conditions', () => { }, }, }, - // web / worker + // worker worker: { - webCompatible: true, resolve: { noExternal, conditions: ['worker'], @@ -54,9 +53,8 @@ describe('custom environment conditions', () => { }, }, }, - // web / custom1 + // custom1 custom1: { - webCompatible: true, resolve: { noExternal, conditions: ['custom1'], @@ -72,54 +70,17 @@ describe('custom environment conditions', () => { }, }, }, - // no web / custom2 - custom2: { - webCompatible: false, + // same as custom1 + custom1_2: { resolve: { noExternal, - conditions: ['custom2'], - externalConditions: ['custom2'], - }, - build: { - outDir: path.join( - import.meta.dirname, - 'fixtures/test-dep-conditions/dist/custom2', - ), - rollupOptions: { - input: { index: '@vitejs/test-dep-conditions' }, - }, - }, - }, - // no web / custom3 - custom3: { - webCompatible: false, - resolve: { - noExternal, - conditions: ['custom3'], - externalConditions: ['custom3'], - }, - build: { - outDir: path.join( - import.meta.dirname, - 'fixtures/test-dep-conditions/dist/custom3', - ), - rollupOptions: { - input: { index: '@vitejs/test-dep-conditions' }, - }, - }, - }, - // same as custom3 - custom3_2: { - webCompatible: false, - resolve: { - noExternal, - conditions: ['custom3'], - externalConditions: ['custom3'], + conditions: ['custom1'], + externalConditions: ['custom1'], }, build: { outDir: path.join( import.meta.dirname, - 'fixtures/test-dep-conditions/dist/custom3_2', + 'fixtures/test-dep-conditions/dist/custom1_2', ), rollupOptions: { input: { index: '@vitejs/test-dep-conditions' }, @@ -135,14 +96,7 @@ describe('custom environment conditions', () => { onTestFinished(() => server.close()) const results: Record = {} - for (const key of [ - 'ssr', - 'worker', - 'custom1', - 'custom2', - 'custom3', - 'custom3_2', - ]) { + for (const key of ['ssr', 'worker', 'custom1', 'custom1_2']) { const runner = createServerModuleRunner(server.environments[key], { hmr: { logger: false, @@ -155,9 +109,7 @@ describe('custom environment conditions', () => { expect(results).toMatchInlineSnapshot(` { "custom1": "index.custom1.js", - "custom2": "index.custom2.js", - "custom3": "index.custom3.js", - "custom3_2": "index.custom3.js", + "custom1_2": "index.custom1.js", "ssr": "index.default.js", "worker": "index.worker.js", } @@ -169,14 +121,7 @@ describe('custom environment conditions', () => { onTestFinished(() => server.close()) const results: Record = {} - for (const key of [ - 'ssr', - 'worker', - 'custom1', - 'custom2', - 'custom3', - 'custom3_2', - ]) { + for (const key of ['ssr', 'worker', 'custom1', 'custom1_2']) { const runner = createServerModuleRunner(server.environments[key], { hmr: { logger: false, @@ -191,9 +136,7 @@ describe('custom environment conditions', () => { expect(results).toMatchInlineSnapshot(` { "custom1": "index.custom1.js", - "custom2": "index.custom2.js", - "custom3": "index.custom3.js", - "custom3_2": "index.custom3.js", + "custom1_2": "index.custom1.js", "ssr": "index.default.js", "worker": "index.worker.js", } @@ -222,14 +165,7 @@ describe('custom environment conditions', () => { test('build', async () => { const builder = await createBuilder(getConfig({ noExternal: true })) const results: Record = {} - for (const key of [ - 'ssr', - 'worker', - 'custom1', - 'custom2', - 'custom3', - 'custom3_2', - ]) { + for (const key of ['ssr', 'worker', 'custom1', 'custom1_2']) { const output = await builder.build(builder.environments[key]) const chunk = (output as RollupOutput).output[0] const mod = await import( @@ -245,9 +181,7 @@ describe('custom environment conditions', () => { expect(results).toMatchInlineSnapshot(` { "custom1": "index.custom1.js", - "custom2": "index.custom2.js", - "custom3": "index.custom3.js", - "custom3_2": "index.custom3.js", + "custom1_2": "index.custom1.js", "ssr": "index.default.js", "worker": "index.worker.js", } diff --git a/packages/vite/src/node/__tests__/fixtures/test-dep-conditions/index.custom2.js b/packages/vite/src/node/__tests__/fixtures/test-dep-conditions/index.custom2.js deleted file mode 100644 index 1125676cc5f4a7..00000000000000 --- a/packages/vite/src/node/__tests__/fixtures/test-dep-conditions/index.custom2.js +++ /dev/null @@ -1 +0,0 @@ -export default 'index.custom2.js' diff --git a/packages/vite/src/node/__tests__/fixtures/test-dep-conditions/index.custom3.js b/packages/vite/src/node/__tests__/fixtures/test-dep-conditions/index.custom3.js deleted file mode 100644 index d12538a6469888..00000000000000 --- a/packages/vite/src/node/__tests__/fixtures/test-dep-conditions/index.custom3.js +++ /dev/null @@ -1 +0,0 @@ -export default 'index.custom3.js' diff --git a/packages/vite/src/node/__tests__/fixtures/test-dep-conditions/package.json b/packages/vite/src/node/__tests__/fixtures/test-dep-conditions/package.json index 08f9558e16cc65..454b99b924e3be 100644 --- a/packages/vite/src/node/__tests__/fixtures/test-dep-conditions/package.json +++ b/packages/vite/src/node/__tests__/fixtures/test-dep-conditions/package.json @@ -6,8 +6,6 @@ ".": { "style": "./index.css", "custom1": "./index.custom1.js", - "custom2": "./index.custom2.js", - "custom3": "./index.custom3.js", "worker": "./index.worker.js", "browser": "./index.browser.js", "default": "./index.default.js" diff --git a/packages/vite/src/node/baseEnvironment.ts b/packages/vite/src/node/baseEnvironment.ts index 730eb26e9e6d7b..499097b6e4fe99 100644 --- a/packages/vite/src/node/baseEnvironment.ts +++ b/packages/vite/src/node/baseEnvironment.ts @@ -17,7 +17,6 @@ export function getDefaultResolvedEnvironmentOptions( define: config.define, resolve: config.resolve, consumer: 'server', - webCompatible: false, dev: config.dev, build: config.build, } diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index ccf6dab5ee5551..71d80eb62edc10 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -343,6 +343,8 @@ export function resolveBuildEnvironmentOptions( logger: Logger, root: string, consumer: 'client' | 'server' | undefined, + // Backward compatibility + isSsrTargetWebworkerEnvironment?: boolean, ): ResolvedBuildEnvironmentOptions { const deprecatedPolyfillModulePreload = raw?.polyfillModulePreload const { polyfillModulePreload, ...rest } = raw @@ -454,6 +456,19 @@ export function resolveBuildEnvironmentOptions( resolved.cssMinify = !!resolved.minify } + if (isSsrTargetWebworkerEnvironment) { + resolved.rollupOptions ??= {} + resolved.rollupOptions.output ??= {} + const output = resolved.rollupOptions.output + for (const out of arraify(output)) { + out.entryFileNames ??= `[name].js` + out.chunkFileNames ??= `[name]-[hash].js` + const input = resolved.rollupOptions.input + out.inlineDynamicImports ??= + !input || typeof input === 'string' || Object.keys(input).length === 1 + } + } + return resolved } @@ -724,7 +739,7 @@ export async function buildEnvironment( const format = output.format || 'es' const jsExt = - !environment.config.webCompatible || libOptions + environment.config.consumer === 'server' || libOptions ? resolveOutputJsExtension( format, findNearestPackageData(root, packageCache)?.data.type, @@ -762,11 +777,7 @@ export async function buildEnvironment( ? `[name].[ext]` : path.posix.join(options.assetsDir, `[name]-[hash].[ext]`), inlineDynamicImports: - output.format === 'umd' || - output.format === 'iife' || - (environment.config.consumer === 'server' && - environment.config.webCompatible && - (typeof input === 'string' || Object.keys(input).length === 1)), + output.format === 'umd' || output.format === 'iife', ...output, } } diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 0f1f6b08bf8b74..24a8612db019fa 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -4,7 +4,7 @@ import path from 'node:path' import { pathToFileURL } from 'node:url' import { promisify } from 'node:util' import { performance } from 'node:perf_hooks' -import { createRequire } from 'node:module' +import { builtinModules, createRequire } from 'node:module' import colors from 'picocolors' import type { Alias, AliasOptions } from 'dep-types/alias' import { build } from 'esbuild' @@ -249,10 +249,9 @@ export interface SharedEnvironmentOptions { */ consumer?: 'client' | 'server' /** - * Runtime Compatibility - * Temporal options, we should remove these in favor of fine-grained control + * Don't replace `process.env` to a static value. */ - webCompatible?: boolean // was ssr.target === 'webworker' + keepProcessEnv?: boolean } export interface EnvironmentOptions extends SharedEnvironmentOptions { @@ -272,14 +271,14 @@ export type ResolvedEnvironmentOptions = { define?: Record resolve: ResolvedResolveOptions consumer: 'client' | 'server' - webCompatible: boolean + keepProcessEnv?: boolean dev: ResolvedDevEnvironmentOptions build: ResolvedBuildEnvironmentOptions } export type DefaultEnvironmentOptions = Omit< EnvironmentOptions, - 'consumer' | 'webCompatible' | 'resolve' + 'consumer' | 'resolve' > & { resolve?: AllResolveOptions } @@ -633,20 +632,27 @@ function resolveEnvironmentOptions( environmentName: string, // Backward compatibility skipSsrTransform?: boolean, + ssrTargetWebworker?: boolean, ): ResolvedEnvironmentOptions { + const isClientEnvironment = environmentName === 'client' + const consumer = + options.consumer ?? (isClientEnvironment ? 'client' : 'server') + const isSsrTargetWebworkerEnvironment = + ssrTargetWebworker && environmentName === 'ssr' const resolve = resolveEnvironmentResolveOptions( options.resolve, alias, preserveSymlinks, logger, + consumer, + isSsrTargetWebworkerEnvironment, ) - const isClientEnvironment = environmentName === 'client' - const consumer = - options.consumer ?? (isClientEnvironment ? 'client' : 'server') return { resolve, + keepProcessEnv: + options.keepProcessEnv ?? + (isSsrTargetWebworkerEnvironment ? false : consumer === 'server'), consumer, - webCompatible: options.webCompatible ?? consumer === 'client', dev: resolveDevEnvironmentOptions( options.dev, resolve.preserveSymlinks, @@ -659,6 +665,7 @@ function resolveEnvironmentOptions( logger, resolvedRoot, consumer, + isSsrTargetWebworkerEnvironment, ), } } @@ -738,13 +745,26 @@ function resolveEnvironmentResolveOptions( alias: Alias[], preserveSymlinks: boolean, logger: Logger, + consumer: 'client' | 'server' | undefined, + // Backward compatibility + isSsrTargetWebworkerEnvironment?: boolean, ): ResolvedAllResolveOptions { + let conditions = resolve?.conditions + conditions ??= + consumer === 'client' || isSsrTargetWebworkerEnvironment + ? DEFAULT_CONDITIONS.filter((c) => c !== 'node') + : DEFAULT_CONDITIONS.filter((c) => c !== 'browser') + const resolvedResolve: ResolvedAllResolveOptions = { mainFields: resolve?.mainFields ?? DEFAULT_MAIN_FIELDS, - conditions: resolve?.conditions ?? DEFAULT_CONDITIONS, + conditions, externalConditions: resolve?.externalConditions ?? DEFAULT_EXTERNAL_CONDITIONS, - external: resolve?.external ?? [], + external: + resolve?.external ?? + (consumer === 'server' && !isSsrTargetWebworkerEnvironment + ? builtinModules + : []), noExternal: resolve?.noExternal ?? [], extensions: resolve?.extensions ?? DEFAULT_EXTENSIONS, dedupe: resolve?.dedupe ?? [], @@ -780,6 +800,7 @@ function resolveResolveOptions( alias, preserveSymlinks, logger, + undefined, ) } @@ -950,10 +971,6 @@ export async function resolveConfig( config.ssr?.resolve?.externalConditions configEnvironmentsSsr.resolve.external ??= config.ssr?.external configEnvironmentsSsr.resolve.noExternal ??= config.ssr?.noExternal - - if (config.ssr?.target === 'webworker') { - configEnvironmentsSsr.webCompatible = true - } } if (config.build?.ssrEmitAssets !== undefined) { @@ -996,6 +1013,7 @@ export async function resolveConfig( logger, environmentName, config.experimental?.skipSsrTransform, + config.ssr?.target === 'webworker', ) } @@ -1582,7 +1600,6 @@ async function bundleConfigFile( preserveSymlinks: false, packageCache, isRequire, - webCompatible: false, })?.id } diff --git a/packages/vite/src/node/external.ts b/packages/vite/src/node/external.ts index e55eabb7f4ce7f..2087a122f1ca88 100644 --- a/packages/vite/src/node/external.ts +++ b/packages/vite/src/node/external.ts @@ -53,7 +53,7 @@ export function createIsConfiguredAsExternal( environment: PartialEnvironment, ): (id: string, importer?: string) => boolean { const { config } = environment - const { root, resolve, webCompatible } = config + const { root, resolve } = config const { external, noExternal } = resolve const noExternalFilter = typeof noExternal !== 'boolean' && @@ -68,7 +68,6 @@ export function createIsConfiguredAsExternal( isProduction: false, isBuild: true, conditions: targetConditions, - webCompatible, } const isExternalizable = ( diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index 3de6a04367b3ab..d08abe394d3f28 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -761,7 +761,7 @@ async function prepareEsbuildOptimizerRun( ), } - const platform = environment.config.webCompatible ? 'browser' : 'node' + const platform = environment.config.consumer === 'client' ? 'browser' : 'node' const external = [...(optimizeDeps?.exclude ?? [])] @@ -1176,7 +1176,6 @@ function getConfigHash(environment: Environment): string { plugins: optimizeDeps?.esbuildOptions?.plugins?.map((p) => p.name), }, }, - webCompatible: config.webCompatible, }, (_, value) => { if (typeof value === 'function' || value instanceof RegExp) { diff --git a/packages/vite/src/node/packages.ts b/packages/vite/src/node/packages.ts index 175505d49e5373..f03a3f1a3d058b 100644 --- a/packages/vite/src/node/packages.ts +++ b/packages/vite/src/node/packages.ts @@ -228,7 +228,6 @@ function getResolveCacheKey(key: string, options: InternalResolveOptions) { // `resolvePackageEntry` or `resolveDeepImport` return [ key, - options.webCompatible ? '1' : '0', options.isRequire ? '1' : '0', options.conditions.join('_'), options.extensions.join('_'), diff --git a/packages/vite/src/node/plugins/define.ts b/packages/vite/src/node/plugins/define.ts index 39d7b6bf8f3f5e..8fc7f979b998e2 100644 --- a/packages/vite/src/node/plugins/define.ts +++ b/packages/vite/src/node/plugins/define.ts @@ -58,10 +58,10 @@ export function definePlugin(config: ResolvedConfig): Plugin { } function generatePattern(environment: Environment) { - const replaceProcessEnv = environment.config.webCompatible + const keepProcessEnv = environment.config.keepProcessEnv const define: Record = { - ...(replaceProcessEnv ? processEnv : {}), + ...(keepProcessEnv ? {} : processEnv), ...importMetaKeys, ...userDefine, ...importMetaFallbackKeys, @@ -85,7 +85,7 @@ export function definePlugin(config: ResolvedConfig): Plugin { // Create regex pattern as a fast check before running esbuild const patternKeys = Object.keys(userDefine) - if (replaceProcessEnv && Object.keys(processEnv).length) { + if (!keepProcessEnv && Object.keys(processEnv).length) { patternKeys.push('process.env') } if (Object.keys(importMetaKeys).length) { diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts index 96294af91d0aab..57290715594608 100644 --- a/packages/vite/src/node/plugins/resolve.ts +++ b/packages/vite/src/node/plugins/resolve.ts @@ -117,7 +117,6 @@ interface ResolvePluginOptions { tryPrefix?: string preferRelative?: boolean isRequire?: boolean - webCompatible?: boolean // #3040 // when the importer is a ts module, // if the specifier requests a non-existent `.js/jsx/mjs/cjs` file, @@ -238,7 +237,6 @@ export function resolvePlugin( const options: InternalResolveOptions = { isRequire, ...environmentResolveOptions, - webCompatible: currentEnvironmentOptions.webCompatible, ...resolveOptions, // plugin options + resolve options overrides scan: resolveOpts?.scan ?? resolveOptions.scan, } @@ -330,7 +328,6 @@ export function resolvePlugin( } if ( - options.webCompatible && options.mainFields.includes('browser') && (res = tryResolveBrowserMapping( fsPath, @@ -423,7 +420,6 @@ export function resolvePlugin( } if ( - options.webCompatible && options.mainFields.includes('browser') && (res = tryResolveBrowserMapping( id, @@ -456,7 +452,6 @@ export function resolvePlugin( if (isBuiltin(id)) { if (currentEnvironmentOptions.consumer === 'server') { if ( - options.webCompatible && options.noExternal === true && // if both noExternal and external are true, noExternal will take the higher priority and bundle it. // only if the id is explicitly listed in external, we will externalize it and skip this error. @@ -1001,11 +996,9 @@ export function resolvePackageEntry( if (!entryPoint) { for (const field of options.mainFields) { if (field === 'browser') { - if (options.webCompatible) { - entryPoint = tryResolveBrowserEntry(dir, data, options) - if (entryPoint) { - break - } + entryPoint = tryResolveBrowserEntry(dir, data, options) + if (entryPoint) { + break } } else if (typeof data[field] === 'string') { entryPoint = data[field] @@ -1033,11 +1026,7 @@ export function resolvePackageEntry( } else { // resolve object browser field in package.json const { browser: browserField } = data - if ( - options.webCompatible && - options.mainFields.includes('browser') && - isObject(browserField) - ) { + if (options.mainFields.includes('browser') && isObject(browserField)) { entry = mapWithBrowserField(entry, browserField) || entry } } @@ -1092,10 +1081,6 @@ function resolveExportsOrImports( return options.isRequire case 'import': return !options.isRequire - case 'node': - return !options.webCompatible - case 'browser': - return options.webCompatible } return true }, @@ -1140,11 +1125,7 @@ function resolveDeepImport( `${path.join(dir, 'package.json')}.`, ) } - } else if ( - options.webCompatible && - options.mainFields.includes('browser') && - isObject(browserField) - ) { + } else if (options.mainFields.includes('browser') && isObject(browserField)) { // resolve without postfix (see #7098) const { file, postfix } = splitFileAndPostfix(relativeId) const mapped = mapWithBrowserField(file, browserField) diff --git a/packages/vite/src/node/ssr/fetchModule.ts b/packages/vite/src/node/ssr/fetchModule.ts index 66d28052879a89..8bfeb2357d1931 100644 --- a/packages/vite/src/node/ssr/fetchModule.ts +++ b/packages/vite/src/node/ssr/fetchModule.ts @@ -57,7 +57,6 @@ export async function fetchModule( isProduction, root, packageCache: environment.config.packageCache, - webCompatible: environment.config.webCompatible, }) if (!resolved) { const err: any = new Error( diff --git a/packages/vite/src/node/ssr/index.ts b/packages/vite/src/node/ssr/index.ts index dc597ea41a3b04..34d4dbb9683f3c 100644 --- a/packages/vite/src/node/ssr/index.ts +++ b/packages/vite/src/node/ssr/index.ts @@ -11,7 +11,7 @@ export interface SSROptions { /** * Define the target for the ssr build. The browser field in package.json * is ignored for node but used if webworker is the target - * This option may be replaced by the experimental `environmentOptions.webCompatible` + * This option will be removed in a future major version * @default 'node' */ target?: SSRTarget From 1a4121cfbcdb6002fbb65cb6f178ef6e3eb8a9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Tue, 29 Oct 2024 19:11:27 +0900 Subject: [PATCH 10/18] docs: update Co-authored-by: Bjorn Lu --- docs/config/shared-options.md | 2 +- packages/vite/src/node/config.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/config/shared-options.md b/docs/config/shared-options.md index 22ed4c728bde19..a71890a8df5a4b 100644 --- a/docs/config/shared-options.md +++ b/docs/config/shared-options.md @@ -136,7 +136,7 @@ A package with conditional exports may have the following `exports` field in its Here, `import` and `require` are "conditions". Conditions can be nested and should be specified from most specific to least specific. -Some of the default conditions (`production`, `development`, `browser`, `node`) are only applied when the requirements are met. For example, `production` is only applied when `process.env.NODE_ENV === 'production'`, and `browser` is only applied when the environment is `webCompatible`. The `resolve.conditions` config option allows specifying additional allowed conditions and those conditions will be applied unconditionally. +Some of the default conditions (`production`, `development`) are only applied when the requirements are met. For example, `production` is only applied when `process.env.NODE_ENV === 'production'`. The `resolve.conditions` config option allows specifying additional allowed conditions and those conditions will be applied unconditionally. Note that `import`, `require`, `default` conditions are always applied if the requirements are met. diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index e5f5e2c5c04b76..ab3dab1bdeee76 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -244,7 +244,8 @@ export interface SharedEnvironmentOptions { */ consumer?: 'client' | 'server' /** - * Don't replace `process.env` to a static value. + * If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime. + * Otherwise, it is statically replaced as an empty object. */ keepProcessEnv?: boolean /** From 41bfab44314f40e8302e6ab5afbfc395bfc9d3d9 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:23:55 +0900 Subject: [PATCH 11/18] test: don't add node to conditions --- playground/resolve/vite.config.js | 9 +-------- playground/ssr-webworker/vite.config.js | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/playground/resolve/vite.config.js b/playground/resolve/vite.config.js index 7e0d8ebdde8ca2..1a705641e57e1a 100644 --- a/playground/resolve/vite.config.js +++ b/playground/resolve/vite.config.js @@ -32,14 +32,7 @@ export default defineConfig({ resolve: { extensions: ['.mjs', '.js', '.es', '.ts'], mainFields: ['browser', 'custom', 'module'], - conditions: [ - 'module', - 'browser', - 'node', - 'production', - 'development', - 'custom', - ], + conditions: ['module', 'browser', 'production', 'development', 'custom'], }, define: { VITE_CONFIG_DEP_TEST: a, diff --git a/playground/ssr-webworker/vite.config.js b/playground/ssr-webworker/vite.config.js index 41dc7bfb64fa55..60325c48213138 100644 --- a/playground/ssr-webworker/vite.config.js +++ b/playground/ssr-webworker/vite.config.js @@ -6,14 +6,7 @@ export default defineConfig({ }, resolve: { dedupe: ['react'], - conditions: [ - 'module', - 'browser', - 'node', - 'production', - 'development', - 'worker', - ], + conditions: ['module', 'browser', 'production', 'development', 'worker'], }, ssr: { target: 'webworker', From 405f65a91e1e714d1d7e73ace04b3dc4051ffcba Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:27:35 +0900 Subject: [PATCH 12/18] docs: add migration guide --- docs/guide/migration.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/guide/migration.md b/docs/guide/migration.md index a48b9faccb8db4..1d79fc4bde9ae5 100644 --- a/docs/guide/migration.md +++ b/docs/guide/migration.md @@ -12,6 +12,24 @@ The experimental Vite Runtime API evolved into the Module Runner API, released i ## General Changes +### Default value for `resolve.conditions` + +This change does not affect users that did not configure [`resolve.conditions`](/config/shared-options#resolve-conditions) / [`ssr.resolve.conditions`](/config/ssr-options#ssr-resolve-conditions) / [`ssr.resolve.externalConditions`](/config/ssr-options#ssr-resolve-externalconditions). + +In Vite 5, the default value for `resolve.conditions` was `[]` and some conditions were added internally. + +From Vite 6, some of the conditions are no longer added internally and need to be included in the config values. +The conditions that are no longer added internally for + +- `resolve.conditions` are `['module', 'browser', 'production', 'development']` +- `ssr.resolve.conditions` are `['module', 'node', 'production', 'development']` + For example, if you previously specified: + +The default values for those options are updated to the corresponding values. + +If you specified a custom value for `resolve.conditions` or `ssr.resolve.conditions`, you need to update it to include the new conditions. +For example, if you previously specified `['custom']` for `resolve.conditions`, you need to specify `['custom', 'module', 'browser', 'production', 'development']` instead. + ### JSON stringify In Vite 5, when [`json.stringify: true`](/config/shared-options#json-stringify) is set, [`json.namedExports`](/config/shared-options#json-namedexports) was disabled. From 980ac560f8ebce4944c5b05c4bdc91600abcfd07 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 30 Oct 2024 19:44:27 +0900 Subject: [PATCH 13/18] feat!: don't inherit `resolve.conditions` and `resolve.mainFields` for other environments --- docs/config/shared-options.md | 2 +- docs/config/ssr-options.md | 3 +-- docs/guide/migration.md | 5 ++--- packages/vite/src/node/config.ts | 8 +++++++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/config/shared-options.md b/docs/config/shared-options.md index a71890a8df5a4b..fc1c2353de954d 100644 --- a/docs/config/shared-options.md +++ b/docs/config/shared-options.md @@ -117,7 +117,7 @@ For SSR builds, deduplication does not work for ESM build outputs configured fro ## resolve.conditions - **Type:** `string[]` -- **Default:** `['module', 'browser', 'node', 'production', 'development']` +- **Default:** `['module', 'browser', 'production', 'development']` Additional allowed conditions when resolving [Conditional Exports](https://nodejs.org/api/packages.html#packages_conditional_exports) from a package. diff --git a/docs/config/ssr-options.md b/docs/config/ssr-options.md index 5da559d655e968..f8078fff5517a0 100644 --- a/docs/config/ssr-options.md +++ b/docs/config/ssr-options.md @@ -34,10 +34,9 @@ Build target for the SSR server. ## ssr.resolve.conditions - **Type:** `string[]` +- **Default:** `['module', 'node', 'production', 'development']` (`['module', 'browser', 'production', 'development']` for `ssr.target === 'webworker'`) - **Related:** [Resolve Conditions](./shared-options.md#resolve-conditions) -Defaults to the root [`resolve.conditions`](./shared-options.md#resolve-conditions). - These conditions are used in the plugin pipeline, and only affect non-externalized dependencies during the SSR build. Use `ssr.resolve.externalConditions` to affect externalized imports. ## ssr.resolve.externalConditions diff --git a/docs/guide/migration.md b/docs/guide/migration.md index 1d79fc4bde9ae5..7c9cf067c5eec9 100644 --- a/docs/guide/migration.md +++ b/docs/guide/migration.md @@ -16,16 +16,15 @@ The experimental Vite Runtime API evolved into the Module Runner API, released i This change does not affect users that did not configure [`resolve.conditions`](/config/shared-options#resolve-conditions) / [`ssr.resolve.conditions`](/config/ssr-options#ssr-resolve-conditions) / [`ssr.resolve.externalConditions`](/config/ssr-options#ssr-resolve-externalconditions). -In Vite 5, the default value for `resolve.conditions` was `[]` and some conditions were added internally. +In Vite 5, the default value for `resolve.conditions` was `[]` and some conditions were added internally. The default value for `ssr.resolve.conditions` was the value of `resolve.conditions`. From Vite 6, some of the conditions are no longer added internally and need to be included in the config values. The conditions that are no longer added internally for - `resolve.conditions` are `['module', 'browser', 'production', 'development']` - `ssr.resolve.conditions` are `['module', 'node', 'production', 'development']` - For example, if you previously specified: -The default values for those options are updated to the corresponding values. +The default values for those options are updated to the corresponding values and `ssr.resolve.conditions` no longer uses `resolve.conditions` as the default value. If you specified a custom value for `resolve.conditions` or `ssr.resolve.conditions`, you need to update it to include the new conditions. For example, if you previously specified `['custom']` for `resolve.conditions`, you need to specify `['custom', 'module', 'browser', 'production', 'development']` instead. diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index ab3dab1bdeee76..98c459d579c8d6 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -674,7 +674,12 @@ export function getDefaultEnvironmentOptions( ): EnvironmentOptions { return { define: config.define, - resolve: config.resolve, + resolve: { + ...config.resolve, + // mainFields and conditions are not inherited + mainFields: undefined, + conditions: undefined, + }, dev: config.dev, build: config.build, } @@ -988,6 +993,7 @@ export async function resolveConfig( // Some top level options only apply to the client environment const defaultClientEnvironmentOptions = { ...defaultEnvironmentOptions, + resolve: config.resolve, // inherit everything including mainFields and conditions optimizeDeps: config.optimizeDeps, } const defaultNonClientEnvironmentOptions = { From 49850110d395269608df4c718f5c5eb82d72b47f Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 30 Oct 2024 20:30:51 +0900 Subject: [PATCH 14/18] feat: introduce `DEV_PROD_CONDITION` variable --- docs/config/shared-options.md | 4 ++-- docs/config/ssr-options.md | 2 +- docs/guide/migration.md | 8 +++---- packages/vite/src/node/constants.ts | 15 ++++++++++-- packages/vite/src/node/plugins/css.ts | 7 +++--- packages/vite/src/node/plugins/resolve.ts | 28 +++++++++++------------ packages/vite/src/node/publicUtils.ts | 2 +- packages/vite/src/node/ssr/fetchModule.ts | 3 ++- playground/resolve/vite.config.js | 4 ++-- playground/ssr-conditions/vite.config.js | 10 ++------ playground/ssr-webworker/vite.config.js | 6 +++-- 11 files changed, 48 insertions(+), 41 deletions(-) diff --git a/docs/config/shared-options.md b/docs/config/shared-options.md index fc1c2353de954d..280267e41bd493 100644 --- a/docs/config/shared-options.md +++ b/docs/config/shared-options.md @@ -117,7 +117,7 @@ For SSR builds, deduplication does not work for ESM build outputs configured fro ## resolve.conditions - **Type:** `string[]` -- **Default:** `['module', 'browser', 'production', 'development']` +- **Default:** `['module', 'browser', DEV_PROD_CONDITION]` Additional allowed conditions when resolving [Conditional Exports](https://nodejs.org/api/packages.html#packages_conditional_exports) from a package. @@ -136,7 +136,7 @@ A package with conditional exports may have the following `exports` field in its Here, `import` and `require` are "conditions". Conditions can be nested and should be specified from most specific to least specific. -Some of the default conditions (`production`, `development`) are only applied when the requirements are met. For example, `production` is only applied when `process.env.NODE_ENV === 'production'`. The `resolve.conditions` config option allows specifying additional allowed conditions and those conditions will be applied unconditionally. +`DEV_PROD_CONDITION` is a special variable that is replaced with `production` or `development` depending on the value of `process.env.NODE_ENV`. It is replaced with `production` when `process.env.NODE_ENV === 'production'` and `development` otherwise. Note that `import`, `require`, `default` conditions are always applied if the requirements are met. diff --git a/docs/config/ssr-options.md b/docs/config/ssr-options.md index f8078fff5517a0..e2bce5a4d97dc9 100644 --- a/docs/config/ssr-options.md +++ b/docs/config/ssr-options.md @@ -34,7 +34,7 @@ Build target for the SSR server. ## ssr.resolve.conditions - **Type:** `string[]` -- **Default:** `['module', 'node', 'production', 'development']` (`['module', 'browser', 'production', 'development']` for `ssr.target === 'webworker'`) +- **Default:** `['module', 'node', DEV_PROD_CONDITION]` (`['module', 'browser', DEV_PROD_CONDITION]` for `ssr.target === 'webworker'`) - **Related:** [Resolve Conditions](./shared-options.md#resolve-conditions) These conditions are used in the plugin pipeline, and only affect non-externalized dependencies during the SSR build. Use `ssr.resolve.externalConditions` to affect externalized imports. diff --git a/docs/guide/migration.md b/docs/guide/migration.md index 7c9cf067c5eec9..76c228ceffd323 100644 --- a/docs/guide/migration.md +++ b/docs/guide/migration.md @@ -21,13 +21,13 @@ In Vite 5, the default value for `resolve.conditions` was `[]` and some conditio From Vite 6, some of the conditions are no longer added internally and need to be included in the config values. The conditions that are no longer added internally for -- `resolve.conditions` are `['module', 'browser', 'production', 'development']` -- `ssr.resolve.conditions` are `['module', 'node', 'production', 'development']` +- `resolve.conditions` are `['module', 'browser', DEV_PROD_CONDITION]` +- `ssr.resolve.conditions` are `['module', 'node', DEV_PROD_CONDITION]` -The default values for those options are updated to the corresponding values and `ssr.resolve.conditions` no longer uses `resolve.conditions` as the default value. +The default values for those options are updated to the corresponding values and `ssr.resolve.conditions` no longer uses `resolve.conditions` as the default value. Note that `DEV_PROD_CONDITION` is a special variable that is replaced with `production` or `development` depending on the value of `process.env.NODE_ENV`. If you specified a custom value for `resolve.conditions` or `ssr.resolve.conditions`, you need to update it to include the new conditions. -For example, if you previously specified `['custom']` for `resolve.conditions`, you need to specify `['custom', 'module', 'browser', 'production', 'development']` instead. +For example, if you previously specified `['custom']` for `resolve.conditions`, you need to specify `['custom', 'module', 'browser', DEV_PROD_CONDITION]` instead. ### JSON stringify diff --git a/packages/vite/src/node/constants.ts b/packages/vite/src/node/constants.ts index 36823e1381a046..5ff84afd422163 100644 --- a/packages/vite/src/node/constants.ts +++ b/packages/vite/src/node/constants.ts @@ -46,12 +46,23 @@ export const DEFAULT_MAIN_FIELDS = [ 'jsnext', ] +// using " and $ as conditions would usually avoid using $ or " +// as it makes difficult to use the condition in command line or json +// also avoiding a symbol so that dual package hazard won't be a problem +type SpecialCondition = `vite$"${T}"` & { __brand: never } + +/** + * A special condition that would be replaced with production or development + * depending on NODE_ENV env variable + */ +export const DEV_PROD_CONDITION = + `vite$"dev-prod"` as SpecialCondition<'dev-prod'> + export const DEFAULT_CONDITIONS = [ 'module', 'browser', 'node', - 'production', - 'development', + DEV_PROD_CONDITION, ] export const DEFAULT_EXTERNAL_CONDITIONS = ['node'] diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index a7c44c9d58259a..36fb5b37d6633b 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -44,6 +44,7 @@ import { import { CLIENT_PUBLIC_PATH, CSS_LANGS_RE, + DEV_PROD_CONDITION, ESBUILD_MODULES_TARGET, SPECIAL_QUERY_RE, } from '../constants' @@ -1092,7 +1093,7 @@ function createCSSResolvers(config: ResolvedConfig): CSSAtImportResolvers { return (cssResolve ??= createBackCompatIdResolver(config, { extensions: ['.css'], mainFields: ['style'], - conditions: ['style', 'production', 'development'], + conditions: ['style', DEV_PROD_CONDITION], tryIndex: false, preferRelative: true, })) @@ -1103,7 +1104,7 @@ function createCSSResolvers(config: ResolvedConfig): CSSAtImportResolvers { const resolver = createBackCompatIdResolver(config, { extensions: ['.scss', '.sass', '.css'], mainFields: ['sass', 'style'], - conditions: ['sass', 'style', 'production', 'development'], + conditions: ['sass', 'style', DEV_PROD_CONDITION], tryIndex: true, tryPrefix: '_', preferRelative: true, @@ -1122,7 +1123,7 @@ function createCSSResolvers(config: ResolvedConfig): CSSAtImportResolvers { return (lessResolve ??= createBackCompatIdResolver(config, { extensions: ['.less', '.css'], mainFields: ['less', 'style'], - conditions: ['less', 'style', 'production', 'development'], + conditions: ['less', 'style', DEV_PROD_CONDITION], tryIndex: false, preferRelative: true, })) diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts index 8da9b327117eec..b10ac6c357f7ad 100644 --- a/packages/vite/src/node/plugins/resolve.ts +++ b/packages/vite/src/node/plugins/resolve.ts @@ -9,6 +9,7 @@ import type { Plugin } from '../plugin' import { CLIENT_ENTRY, DEP_VERSION_RE, + DEV_PROD_CONDITION, ENV_ENTRY, FS_PREFIX, OPTIMIZABLE_ENTRY_RE, @@ -1078,21 +1079,18 @@ function resolveExportsOrImports( options: InternalResolveOptions, type: 'imports' | 'exports', ) { - const conditions = [...options.conditions, 'require', 'import'].filter( - (condition) => { - switch (condition) { - case 'production': - return options.isProduction - case 'development': - return !options.isProduction - case 'require': - return options.isRequire - case 'import': - return !options.isRequire - } - return true - }, - ) + const conditions = options.conditions.map((condition) => { + if (condition === DEV_PROD_CONDITION) { + return options.isProduction ? 'production' : 'development' + } + return condition + }) + + if (options.isRequire) { + conditions.push('require') + } else { + conditions.push('import') + } const fn = type === 'imports' ? imports : exports const result = fn(pkg, key, { conditions, unsafe: true }) diff --git a/packages/vite/src/node/publicUtils.ts b/packages/vite/src/node/publicUtils.ts index a9cad7a5106db6..1099318b047bf9 100644 --- a/packages/vite/src/node/publicUtils.ts +++ b/packages/vite/src/node/publicUtils.ts @@ -3,7 +3,7 @@ * This file will be bundled to ESM and CJS and redirected by ../index.cjs * Please control the side-effects by checking the ./dist/node-cjs/publicUtils.cjs bundle */ -export { VERSION as version } from './constants' +export { VERSION as version, DEV_PROD_CONDITION } from './constants' export { version as esbuildVersion } from 'esbuild' export { splitVendorChunkPlugin, diff --git a/packages/vite/src/node/ssr/fetchModule.ts b/packages/vite/src/node/ssr/fetchModule.ts index 8bfeb2357d1931..74ab1e3717c1db 100644 --- a/packages/vite/src/node/ssr/fetchModule.ts +++ b/packages/vite/src/node/ssr/fetchModule.ts @@ -3,6 +3,7 @@ import type { FetchResult } from 'vite/module-runner' import type { EnvironmentModuleNode, TransformResult } from '..' import { tryNodeResolve } from '../plugins/resolve' import { isBuiltin, isExternalUrl, isFilePathESM } from '../utils' +import { DEV_PROD_CONDITION } from '../constants' import { unwrapId } from '../../shared/utils' import { MODULE_RUNNER_SOURCEMAPPING_SOURCE, @@ -46,7 +47,7 @@ export async function fetchModule( const resolved = tryNodeResolve(url, importer, { mainFields: ['main'], - conditions: [...externalConditions, 'production', 'development'], + conditions: [...externalConditions, DEV_PROD_CONDITION], externalConditions, external: [], noExternal: [], diff --git a/playground/resolve/vite.config.js b/playground/resolve/vite.config.js index 1a705641e57e1a..fb29107a623443 100644 --- a/playground/resolve/vite.config.js +++ b/playground/resolve/vite.config.js @@ -1,5 +1,5 @@ import path from 'node:path' -import { defineConfig, normalizePath } from 'vite' +import { DEV_PROD_CONDITION, defineConfig, normalizePath } from 'vite' import { a } from './config-dep.cjs' const virtualFile = '@virtual-file' @@ -32,7 +32,7 @@ export default defineConfig({ resolve: { extensions: ['.mjs', '.js', '.es', '.ts'], mainFields: ['browser', 'custom', 'module'], - conditions: ['module', 'browser', 'production', 'development', 'custom'], + conditions: ['module', 'browser', DEV_PROD_CONDITION, 'custom'], }, define: { VITE_CONFIG_DEP_TEST: a, diff --git a/playground/ssr-conditions/vite.config.js b/playground/ssr-conditions/vite.config.js index f905c17dff5a7f..ae9882084169ed 100644 --- a/playground/ssr-conditions/vite.config.js +++ b/playground/ssr-conditions/vite.config.js @@ -1,17 +1,11 @@ -import { defineConfig } from 'vite' +import { DEV_PROD_CONDITION, defineConfig } from 'vite' export default defineConfig({ ssr: { external: ['@vitejs/test-ssr-conditions-external'], noExternal: ['@vitejs/test-ssr-conditions-no-external'], resolve: { - conditions: [ - 'module', - 'node', - 'production', - 'development', - 'react-server', - ], + conditions: ['module', 'node', DEV_PROD_CONDITION, 'react-server'], externalConditions: ['node', 'workerd', 'react-server'], }, }, diff --git a/playground/ssr-webworker/vite.config.js b/playground/ssr-webworker/vite.config.js index 60325c48213138..48e30d11272920 100644 --- a/playground/ssr-webworker/vite.config.js +++ b/playground/ssr-webworker/vite.config.js @@ -1,4 +1,4 @@ -import { defineConfig } from 'vite' +import { DEV_PROD_CONDITION, defineConfig } from 'vite' export default defineConfig({ build: { @@ -6,7 +6,6 @@ export default defineConfig({ }, resolve: { dedupe: ['react'], - conditions: ['module', 'browser', 'production', 'development', 'worker'], }, ssr: { target: 'webworker', @@ -14,6 +13,9 @@ export default defineConfig({ // Some webworker builds may choose to externalize node builtins as they may be implemented // in the runtime, and so we can externalize it when bundling. external: ['node:assert'], + resolve: { + conditions: ['module', 'browser', DEV_PROD_CONDITION, 'worker'], + }, }, plugins: [ { From 92c26585ca39b1681966bca134204016ad72932b Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 30 Oct 2024 20:34:28 +0900 Subject: [PATCH 15/18] fix: remove DEV_PROD_CONDITION from `fetchModule` --- packages/vite/src/node/ssr/fetchModule.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/vite/src/node/ssr/fetchModule.ts b/packages/vite/src/node/ssr/fetchModule.ts index 74ab1e3717c1db..d3851b37e7053c 100644 --- a/packages/vite/src/node/ssr/fetchModule.ts +++ b/packages/vite/src/node/ssr/fetchModule.ts @@ -3,7 +3,6 @@ import type { FetchResult } from 'vite/module-runner' import type { EnvironmentModuleNode, TransformResult } from '..' import { tryNodeResolve } from '../plugins/resolve' import { isBuiltin, isExternalUrl, isFilePathESM } from '../utils' -import { DEV_PROD_CONDITION } from '../constants' import { unwrapId } from '../../shared/utils' import { MODULE_RUNNER_SOURCEMAPPING_SOURCE, @@ -47,7 +46,7 @@ export async function fetchModule( const resolved = tryNodeResolve(url, importer, { mainFields: ['main'], - conditions: [...externalConditions, DEV_PROD_CONDITION], + conditions: externalConditions, externalConditions, external: [], noExternal: [], From 68ff9fb0746bf243b64d0a04fa9d638e27582a5b Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 30 Oct 2024 20:45:46 +0900 Subject: [PATCH 16/18] fix: log.inspectOpts seems to be undefined? --- packages/vite/src/node/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 2a5faa6cc8079d..4ae3f29b128b11 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -169,7 +169,7 @@ export function createDebugger( const { onlyWhenFocused, depth } = options // @ts-expect-error - The log function is bound to inspectOpts, but the type is not reflected - if (depth && log.inspectOpts.depth == null) { + if (depth && log.inspectOpts && log.inspectOpts.depth == null) { // @ts-expect-error - The log function is bound to inspectOpts, but the type is not reflected log.inspectOpts.depth = options.depth } From a40eb20a5ece4eef5e10faa53be5d63a38a4f117 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Thu, 31 Oct 2024 23:13:22 +0900 Subject: [PATCH 17/18] refactor: replace DEV_PROD_CONDITION with `development|production` --- docs/config/shared-options.md | 4 ++-- docs/config/ssr-options.md | 2 +- docs/guide/migration.md | 8 ++++---- packages/vite/src/node/constants.ts | 8 +------- packages/vite/src/node/publicUtils.ts | 2 +- playground/resolve/vite.config.js | 4 ++-- playground/ssr-conditions/vite.config.js | 4 ++-- playground/ssr-webworker/vite.config.js | 4 ++-- 8 files changed, 15 insertions(+), 21 deletions(-) diff --git a/docs/config/shared-options.md b/docs/config/shared-options.md index 280267e41bd493..c047c8a4aace54 100644 --- a/docs/config/shared-options.md +++ b/docs/config/shared-options.md @@ -117,7 +117,7 @@ For SSR builds, deduplication does not work for ESM build outputs configured fro ## resolve.conditions - **Type:** `string[]` -- **Default:** `['module', 'browser', DEV_PROD_CONDITION]` +- **Default:** `['module', 'browser', 'development|production']` Additional allowed conditions when resolving [Conditional Exports](https://nodejs.org/api/packages.html#packages_conditional_exports) from a package. @@ -136,7 +136,7 @@ A package with conditional exports may have the following `exports` field in its Here, `import` and `require` are "conditions". Conditions can be nested and should be specified from most specific to least specific. -`DEV_PROD_CONDITION` is a special variable that is replaced with `production` or `development` depending on the value of `process.env.NODE_ENV`. It is replaced with `production` when `process.env.NODE_ENV === 'production'` and `development` otherwise. +`development|production` is a special variable that is replaced with `production` or `development` depending on the value of `process.env.NODE_ENV`. It is replaced with `production` when `process.env.NODE_ENV === 'production'` and `development` otherwise. Note that `import`, `require`, `default` conditions are always applied if the requirements are met. diff --git a/docs/config/ssr-options.md b/docs/config/ssr-options.md index e2bce5a4d97dc9..7e7d8983928fc0 100644 --- a/docs/config/ssr-options.md +++ b/docs/config/ssr-options.md @@ -34,7 +34,7 @@ Build target for the SSR server. ## ssr.resolve.conditions - **Type:** `string[]` -- **Default:** `['module', 'node', DEV_PROD_CONDITION]` (`['module', 'browser', DEV_PROD_CONDITION]` for `ssr.target === 'webworker'`) +- **Default:** `['module', 'node', 'development|production']` (`['module', 'browser', 'development|production']` for `ssr.target === 'webworker'`) - **Related:** [Resolve Conditions](./shared-options.md#resolve-conditions) These conditions are used in the plugin pipeline, and only affect non-externalized dependencies during the SSR build. Use `ssr.resolve.externalConditions` to affect externalized imports. diff --git a/docs/guide/migration.md b/docs/guide/migration.md index 97a20f7b59e1aa..3f0dfba79eb377 100644 --- a/docs/guide/migration.md +++ b/docs/guide/migration.md @@ -21,13 +21,13 @@ In Vite 5, the default value for `resolve.conditions` was `[]` and some conditio From Vite 6, some of the conditions are no longer added internally and need to be included in the config values. The conditions that are no longer added internally for -- `resolve.conditions` are `['module', 'browser', DEV_PROD_CONDITION]` -- `ssr.resolve.conditions` are `['module', 'node', DEV_PROD_CONDITION]` +- `resolve.conditions` are `['module', 'browser', 'development|production']` +- `ssr.resolve.conditions` are `['module', 'node', 'development|production']` -The default values for those options are updated to the corresponding values and `ssr.resolve.conditions` no longer uses `resolve.conditions` as the default value. Note that `DEV_PROD_CONDITION` is a special variable that is replaced with `production` or `development` depending on the value of `process.env.NODE_ENV`. +The default values for those options are updated to the corresponding values and `ssr.resolve.conditions` no longer uses `resolve.conditions` as the default value. Note that `development|production` is a special variable that is replaced with `production` or `development` depending on the value of `process.env.NODE_ENV`. If you specified a custom value for `resolve.conditions` or `ssr.resolve.conditions`, you need to update it to include the new conditions. -For example, if you previously specified `['custom']` for `resolve.conditions`, you need to specify `['custom', 'module', 'browser', DEV_PROD_CONDITION]` instead. +For example, if you previously specified `['custom']` for `resolve.conditions`, you need to specify `['custom', 'module', 'browser', 'development|production']` instead. ### JSON stringify diff --git a/packages/vite/src/node/constants.ts b/packages/vite/src/node/constants.ts index 5ff84afd422163..270dbef7b7ac91 100644 --- a/packages/vite/src/node/constants.ts +++ b/packages/vite/src/node/constants.ts @@ -46,17 +46,11 @@ export const DEFAULT_MAIN_FIELDS = [ 'jsnext', ] -// using " and $ as conditions would usually avoid using $ or " -// as it makes difficult to use the condition in command line or json -// also avoiding a symbol so that dual package hazard won't be a problem -type SpecialCondition = `vite$"${T}"` & { __brand: never } - /** * A special condition that would be replaced with production or development * depending on NODE_ENV env variable */ -export const DEV_PROD_CONDITION = - `vite$"dev-prod"` as SpecialCondition<'dev-prod'> +export const DEV_PROD_CONDITION = `development|production` as const export const DEFAULT_CONDITIONS = [ 'module', diff --git a/packages/vite/src/node/publicUtils.ts b/packages/vite/src/node/publicUtils.ts index 1099318b047bf9..a9cad7a5106db6 100644 --- a/packages/vite/src/node/publicUtils.ts +++ b/packages/vite/src/node/publicUtils.ts @@ -3,7 +3,7 @@ * This file will be bundled to ESM and CJS and redirected by ../index.cjs * Please control the side-effects by checking the ./dist/node-cjs/publicUtils.cjs bundle */ -export { VERSION as version, DEV_PROD_CONDITION } from './constants' +export { VERSION as version } from './constants' export { version as esbuildVersion } from 'esbuild' export { splitVendorChunkPlugin, diff --git a/playground/resolve/vite.config.js b/playground/resolve/vite.config.js index fb29107a623443..d12eb2283c3333 100644 --- a/playground/resolve/vite.config.js +++ b/playground/resolve/vite.config.js @@ -1,5 +1,5 @@ import path from 'node:path' -import { DEV_PROD_CONDITION, defineConfig, normalizePath } from 'vite' +import { defineConfig, normalizePath } from 'vite' import { a } from './config-dep.cjs' const virtualFile = '@virtual-file' @@ -32,7 +32,7 @@ export default defineConfig({ resolve: { extensions: ['.mjs', '.js', '.es', '.ts'], mainFields: ['browser', 'custom', 'module'], - conditions: ['module', 'browser', DEV_PROD_CONDITION, 'custom'], + conditions: ['module', 'browser', 'development|production', 'custom'], }, define: { VITE_CONFIG_DEP_TEST: a, diff --git a/playground/ssr-conditions/vite.config.js b/playground/ssr-conditions/vite.config.js index ae9882084169ed..e59e1c2a612556 100644 --- a/playground/ssr-conditions/vite.config.js +++ b/playground/ssr-conditions/vite.config.js @@ -1,11 +1,11 @@ -import { DEV_PROD_CONDITION, defineConfig } from 'vite' +import { defineConfig } from 'vite' export default defineConfig({ ssr: { external: ['@vitejs/test-ssr-conditions-external'], noExternal: ['@vitejs/test-ssr-conditions-no-external'], resolve: { - conditions: ['module', 'node', DEV_PROD_CONDITION, 'react-server'], + conditions: ['module', 'node', 'development|production', 'react-server'], externalConditions: ['node', 'workerd', 'react-server'], }, }, diff --git a/playground/ssr-webworker/vite.config.js b/playground/ssr-webworker/vite.config.js index 48e30d11272920..223b79e5f8ba4c 100644 --- a/playground/ssr-webworker/vite.config.js +++ b/playground/ssr-webworker/vite.config.js @@ -1,4 +1,4 @@ -import { DEV_PROD_CONDITION, defineConfig } from 'vite' +import { defineConfig } from 'vite' export default defineConfig({ build: { @@ -14,7 +14,7 @@ export default defineConfig({ // in the runtime, and so we can externalize it when bundling. external: ['node:assert'], resolve: { - conditions: ['module', 'browser', DEV_PROD_CONDITION, 'worker'], + conditions: ['module', 'browser', 'development|production', 'worker'], }, }, plugins: [ From c6a234a069ffe39a71d79ecb84511205fc9ebf78 Mon Sep 17 00:00:00 2001 From: patak <583075+patak-dev@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:46:56 +0100 Subject: [PATCH 18/18] chore: wording --- docs/config/shared-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/config/shared-options.md b/docs/config/shared-options.md index c047c8a4aace54..ada6b3f30ab127 100644 --- a/docs/config/shared-options.md +++ b/docs/config/shared-options.md @@ -136,7 +136,7 @@ A package with conditional exports may have the following `exports` field in its Here, `import` and `require` are "conditions". Conditions can be nested and should be specified from most specific to least specific. -`development|production` is a special variable that is replaced with `production` or `development` depending on the value of `process.env.NODE_ENV`. It is replaced with `production` when `process.env.NODE_ENV === 'production'` and `development` otherwise. +`development|production` is a special value that is replaced with `production` or `development` depending on the value of `process.env.NODE_ENV`. It is replaced with `production` when `process.env.NODE_ENV === 'production'` and `development` otherwise. Note that `import`, `require`, `default` conditions are always applied if the requirements are met.