From 4098310e9324ba1d4d05f3cd82286a0d3b0cc23a Mon Sep 17 00:00:00 2001 From: jiachen Date: Thu, 18 Mar 2021 12:42:41 +0800 Subject: [PATCH 0001/1287] feat(plugin-legacy): add `protocol` to support build file can be opened in file protocol --- packages/plugin-legacy/README.md | 19 +++++++++++++++++++ packages/plugin-legacy/index.d.ts | 4 ++++ packages/plugin-legacy/index.js | 11 ++++++----- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/packages/plugin-legacy/README.md b/packages/plugin-legacy/README.md index cc38130d184691..32ba351935b4e0 100644 --- a/packages/plugin-legacy/README.md +++ b/packages/plugin-legacy/README.md @@ -106,6 +106,25 @@ export default { } ``` +### `protocol` + +- **Type:** `'http'` | `'file'` +- **Default:** `'http'` + + Set protocol as `file` to support local app, which host on file protocol: + + ```js + import legacy from '@vitejs/plugin-legacy' + + export default { + plugins: [ + legacy({ + protocol: 'file' + }) + ] + } + ``` + ## Polyfill Specifiers Polyfill specifier strings for `polyfills` and `modernPolyfills` can be either of the following: diff --git a/packages/plugin-legacy/index.d.ts b/packages/plugin-legacy/index.d.ts index 1e2c1b81f08cd1..17ea4d84ddc7a1 100644 --- a/packages/plugin-legacy/index.d.ts +++ b/packages/plugin-legacy/index.d.ts @@ -22,6 +22,10 @@ export interface Options { * default: true */ renderLegacyChunks?: boolean + /** + * default: http + */ + protocol?: 'file' | 'http' } declare function createPlugin(options?: Options): Plugin diff --git a/packages/plugin-legacy/index.js b/packages/plugin-legacy/index.js index 3eb0e863bf7bb1..c0f40fd78e0b76 100644 --- a/packages/plugin-legacy/index.js +++ b/packages/plugin-legacy/index.js @@ -31,6 +31,7 @@ function viteLegacyPlugin(options = {}) { let config const targets = options.targets || 'defaults' const genLegacy = options.renderLegacyChunks !== false + const isFileProtocol = options.protocol === 'file' const debugFlag = process.env.DEBUG const isDebug = debugFlag === 'vite:*' || debugFlag === 'vite:legacy' @@ -280,7 +281,7 @@ function viteLegacyPlugin(options = {}) { const modernPolyfillFilename = facadeToModernPolyfillMap.get( chunk.facadeModuleId ) - if (modernPolyfillFilename) { + if (modernPolyfillFilename && !isFileProtocol) { tags.push({ tag: 'script', attrs: { @@ -301,7 +302,7 @@ function viteLegacyPlugin(options = {}) { // 2. inject Safari 10 nomodule fix tags.push({ tag: 'script', - attrs: { nomodule: true }, + attrs: isFileProtocol ? {} : { nomodule: true }, children: safari10NoModuleFix, injectTo: 'body' }) @@ -314,7 +315,7 @@ function viteLegacyPlugin(options = {}) { tags.push({ tag: 'script', attrs: { - nomodule: true, + ...(isFileProtocol ? {} : { nomodule: true }), src: `${config.base}${legacyPolyfillFilename}` }, injectTo: 'body' @@ -333,7 +334,7 @@ function viteLegacyPlugin(options = {}) { tags.push({ tag: 'script', attrs: { - nomodule: true, + ...(isFileProtocol ? {} : { nomodule: true }), // we set the entry path on the element as an attribute so that the // script content will stay consistent - which allows using a constant // hash value for CSP. @@ -350,7 +351,7 @@ function viteLegacyPlugin(options = {}) { } return { - html, + html: isFileProtocol ? html.replace(//g, '') : html, tags } }, From 4d0453dbe9e195352c3c03caa8694dbf37a513c8 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 26 Nov 2021 15:24:27 +0800 Subject: [PATCH 0002/1287] release: plugin-vue@1.10.1 --- packages/plugin-vue/CHANGELOG.md | 9 +++++++++ packages/plugin-vue/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue/CHANGELOG.md b/packages/plugin-vue/CHANGELOG.md index ac697f9f35712a..15cfcbecef213b 100644 --- a/packages/plugin-vue/CHANGELOG.md +++ b/packages/plugin-vue/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.10.1](https://github.com/vitejs/vite/compare/plugin-vue@1.10.0...plugin-vue@1.10.1) (2021-11-26) + + +### Bug Fixes + +* **plugin-vue:** fix hmr issue in vuejs/vue-next[#4358](https://github.com/vitejs/vite/issues/4358) ([709e4b0](https://github.com/vitejs/vite/commit/709e4b0428d8cdc8299b22898c76e58d66ca92c9)) + + + # [1.10.0](https://github.com/vitejs/vite/compare/plugin-vue@1.10.0-beta.1...plugin-vue@1.10.0) (2021-11-22) diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 7adc5369ffb750..b2bdc3d34300d4 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue", - "version": "1.10.0", + "version": "1.10.1", "license": "MIT", "author": "Evan You", "files": [ From c2784390ae4cfc1150b63c86a70a240f0f319967 Mon Sep 17 00:00:00 2001 From: yuuang <569105585@qq.com> Date: Fri, 26 Nov 2021 23:48:09 +0800 Subject: [PATCH 0003/1287] fix: build pluginContext types error (#5846) --- packages/vite/src/node/server/pluginContainer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vite/src/node/server/pluginContainer.ts b/packages/vite/src/node/server/pluginContainer.ts index 2bd91e4f1a38ef..91f0f81201ace1 100644 --- a/packages/vite/src/node/server/pluginContainer.ts +++ b/packages/vite/src/node/server/pluginContainer.ts @@ -121,6 +121,7 @@ type PluginContext = Omit< | 'isExternal' | 'moduleIds' | 'resolveId' + | 'load' > export let parser = acorn.Parser.extend( From 19d2b6ab9cf2c5ba40f52c345f71d67f321c0776 Mon Sep 17 00:00:00 2001 From: sanyuan <39261479+sanyuan0704@users.noreply.github.com> Date: Sat, 27 Nov 2021 00:17:03 +0800 Subject: [PATCH 0004/1287] fix: always bundle config file, fix config hmr (#5779) --- packages/playground/resolve/config-dep.js | 3 ++ packages/playground/resolve/vite.config.js | 4 +++ packages/vite/src/node/config.ts | 32 ++-------------------- 3 files changed, 10 insertions(+), 29 deletions(-) create mode 100644 packages/playground/resolve/config-dep.js diff --git a/packages/playground/resolve/config-dep.js b/packages/playground/resolve/config-dep.js new file mode 100644 index 00000000000000..84de4f6be3796d --- /dev/null +++ b/packages/playground/resolve/config-dep.js @@ -0,0 +1,3 @@ +module.exports = { + a: 1 +} \ No newline at end of file diff --git a/packages/playground/resolve/vite.config.js b/packages/playground/resolve/vite.config.js index 036033e6a5f220..e69de3fa778397 100644 --- a/packages/playground/resolve/vite.config.js +++ b/packages/playground/resolve/vite.config.js @@ -2,6 +2,7 @@ const virtualFile = '@virtual-file' const virtualId = '\0' + virtualFile const customVirtualFile = '@custom-virtual-file' +const { a } = require('./config-dep'); module.exports = { resolve: { @@ -9,6 +10,9 @@ module.exports = { mainFields: ['custom', 'module'], conditions: ['custom'] }, + define: { + VITE_CONFIG_DEP_TEST: a + }, plugins: [ { name: 'virtual-module', diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 3b66d555f2a23c..8ae523c4e7715e 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -829,13 +829,13 @@ export async function loadConfigFromFile( if (isESM) { const fileUrl = require('url').pathToFileURL(resolvedPath) + const bundled = await bundleConfigFile(resolvedPath, true) + dependencies = bundled.dependencies if (isTS) { // before we can register loaders without requiring users to run node // with --experimental-loader themselves, we have to do a hack here: // bundle the config file w/ ts transforms first, write it to disk, // load it with native Node ESM, then delete the file. - const bundled = await bundleConfigFile(resolvedPath, true) - dependencies = bundled.dependencies fs.writeFileSync(resolvedPath + '.js', bundled.code) userConfig = (await dynamicImport(`${fileUrl}.js?t=${Date.now()}`)) .default @@ -850,34 +850,8 @@ export async function loadConfigFromFile( } } - if (!isTS && !isESM) { - // 1. try to directly require the module (assuming commonjs) - try { - // clear cache in case of server restart - delete require.cache[require.resolve(resolvedPath)] - userConfig = require(resolvedPath) - debug(`cjs config loaded in ${getTime()}`) - } catch (e) { - const ignored = new RegExp( - [ - `Cannot use import statement`, - `Must use import to load ES Module`, - // #1635, #2050 some Node 12.x versions don't have esm detection - // so it throws normal syntax errors when encountering esm syntax - `Unexpected token`, - `Unexpected identifier` - ].join('|') - ) - if (!ignored.test(e.message)) { - throw e - } - } - } - if (!userConfig) { - // 2. if we reach here, the file is ts or using es import syntax, or - // the user has type: "module" in their package.json (#917) - // transpile es import syntax to require syntax using esbuild. + // Bundle config file and transpile it to cjs using esbuild. const bundled = await bundleConfigFile(resolvedPath) dependencies = bundled.dependencies userConfig = await loadConfigFromBundledFile(resolvedPath, bundled.code) From 4a05a6e2f69c3a799fee651d182beeb176abfaac Mon Sep 17 00:00:00 2001 From: Niputi <7137178+Niputi@users.noreply.github.com> Date: Sat, 27 Nov 2021 16:09:56 +0100 Subject: [PATCH 0005/1287] fix: `isBuiltin` using patched native `builtinModules` (#5827) --- packages/vite/package.json | 1 - packages/vite/src/node/utils.ts | 24 ++++++++++++++++++++---- pnpm-lock.yaml | 2 -- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/packages/vite/package.json b/packages/vite/package.json index acc7e93c313c70..43419bfc4be8b4 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -79,7 +79,6 @@ "acorn": "^8.6.0", "acorn-class-fields": "^1.0.0", "acorn-static-class-features": "^1.0.0", - "builtin-modules": "^3.2.0", "cac": "6.7.9", "chalk": "^4.1.2", "chokidar": "^3.5.2", diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 23f41b769b2fe5..4f005f21c3cf54 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -12,7 +12,7 @@ import { ENV_PUBLIC_PATH } from './constants' import resolve from 'resolve' -import builtins from 'builtin-modules' +import { builtinModules } from 'module' import { FSWatcher } from 'chokidar' import remapping from '@ampproject/remapping' import { @@ -37,10 +37,26 @@ export const flattenId = (id: string): string => export const normalizeId = (id: string): string => id.replace(/(\s*>\s*)/g, ' > ') +//TODO: revisit later to see if the edge case that "compiling using node v12 code to be run in node v16 in the server" is what we intend to support. +const builtins = new Set([ + ...builtinModules, + 'assert/strict', + 'diagnostics_channel', + 'dns/promises', + 'fs/promises', + 'path/posix', + 'path/win32', + 'readline/promises', + 'stream/consumers', + 'stream/promises', + 'stream/web', + 'timers/promises', + 'util/types', + 'wasi' +]) + export function isBuiltin(id: string): boolean { - const deepMatch = id.match(deepImportRE) - id = deepMatch ? deepMatch[1] || deepMatch[2] : id - return builtins.includes(id) + return builtins.has(id.replace(/^node:/, '')) } export function moduleListContains( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2e51778d7bb0d1..a7011891db1cbc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -700,7 +700,6 @@ importers: acorn: ^8.6.0 acorn-class-fields: ^1.0.0 acorn-static-class-features: ^1.0.0 - builtin-modules: ^3.2.0 cac: 6.7.9 chalk: ^4.1.2 chokidar: ^3.5.2 @@ -779,7 +778,6 @@ importers: acorn: 8.6.0 acorn-class-fields: 1.0.0_acorn@8.6.0 acorn-static-class-features: 1.0.0_acorn@8.6.0 - builtin-modules: 3.2.0 cac: 6.7.9 chalk: 4.1.2 chokidar: 3.5.2 From 7bf9f65286244878b65b4d4d950999abcfa7f948 Mon Sep 17 00:00:00 2001 From: patak-js Date: Sat, 27 Nov 2021 16:40:20 +0100 Subject: [PATCH 0006/1287] release: v2.7.0-beta.9 --- packages/vite/CHANGELOG.md | 22 ++++++++++++++++++++++ packages/vite/LICENSE.md | 17 ----------------- packages/vite/package.json | 2 +- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index c7bf4f3fa7f4c7..d52439248ce9bc 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,25 @@ +# [2.7.0-beta.9](https://github.com/vitejs/vite/compare/v2.7.0-beta.8...v2.7.0-beta.9) (2021-11-27) + + +### Bug Fixes + +* `isBuiltin` using patched native `builtinModules` ([#5827](https://github.com/vitejs/vite/issues/5827)) ([4a05a6e](https://github.com/vitejs/vite/commit/4a05a6e2f69c3a799fee651d182beeb176abfaac)) +* always bundle config file, fix config hmr ([#5779](https://github.com/vitejs/vite/issues/5779)) ([19d2b6a](https://github.com/vitejs/vite/commit/19d2b6ab9cf2c5ba40f52c345f71d67f321c0776)) +* build pluginContext types error ([#5846](https://github.com/vitejs/vite/issues/5846)) ([c278439](https://github.com/vitejs/vite/commit/c2784390ae4cfc1150b63c86a70a240f0f319967)) +* circular dependency hmr causes refresh crash ([#4589](https://github.com/vitejs/vite/issues/4589)) ([00d8c9b](https://github.com/vitejs/vite/commit/00d8c9b7ffcfa2a3f888ef5752f57682cdea91b2)) +* replace asset references in CSS returned to JS ([#5729](https://github.com/vitejs/vite/issues/5729)) ([880026e](https://github.com/vitejs/vite/commit/880026e414d5745233ff2b67799cd386001bddd8)) +* resolve addons using nodeResolve() ([#5809](https://github.com/vitejs/vite/issues/5809)) ([d288772](https://github.com/vitejs/vite/commit/d2887729911d52e3117a7649e85460b346f04b54)) +* throw full error causing preprocessor to not load ([#5816](https://github.com/vitejs/vite/issues/5816)) ([f6fcd21](https://github.com/vitejs/vite/commit/f6fcd2190e18f2ad20766a164411351b2220cf52)) +* unicode path html entry point ([#5821](https://github.com/vitejs/vite/issues/5821)) ([#5823](https://github.com/vitejs/vite/issues/5823)) ([2048195](https://github.com/vitejs/vite/commit/20481950dce58e21d06d0d7da0325a3788e683c5)) +* unminified build breaks __vitePreload ([#5785](https://github.com/vitejs/vite/issues/5785)) ([757a74a](https://github.com/vitejs/vite/commit/757a74aa41f3b12505557637daec2058423cfd23)) + + +### Features + +* lint for missing type="module" attribute ([#5837](https://github.com/vitejs/vite/issues/5837)) ([#5838](https://github.com/vitejs/vite/issues/5838)) ([494e358](https://github.com/vitejs/vite/commit/494e3586fef5865ddc99f3cff48856495c4373f1)) + + + # [2.7.0-beta.8](https://github.com/vitejs/vite/compare/v2.7.0-beta.7...v2.7.0-beta.8) (2021-11-19) diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index 5f63f6317a6e59..a77f5adb62043b 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -836,23 +836,6 @@ Repository: micromatch/braces --------------------------------------- -## builtin-modules -License: MIT -By: Sindre Sorhus -Repository: sindresorhus/builtin-modules - -> MIT License -> -> Copyright (c) Sindre Sorhus (https://sindresorhus.com) -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------- - ## bytes License: MIT By: TJ Holowaychuk, Jed Watson, Théo FIDRY diff --git a/packages/vite/package.json b/packages/vite/package.json index 43419bfc4be8b4..b0596493bc6f4d 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.7.0-beta.8", + "version": "2.7.0-beta.9", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From 8a8b296a1275d5bce77fc7f1b054d515579f4997 Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Sat, 27 Nov 2021 22:46:55 +0630 Subject: [PATCH 0007/1287] docs: css.modules.localsConvention is null by default, fix #5650 (#5864) --- docs/config/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index 79d282fb51a0a3..e8be0ee13c7f5c 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -236,9 +236,9 @@ export default defineConfig(async ({ command, mode }) => { | ((name: string, filename: string, css: string) => string) hashPrefix?: string /** - * default: 'camelCaseOnly' + * default: null */ - localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' + localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | null } ``` From f1b8b5fc9600e4c8607dbd572f5a9d7d8a588e78 Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Sat, 27 Nov 2021 23:13:34 +0630 Subject: [PATCH 0008/1287] docs: replace build.brotliSize with build.reportCompressedSize [ci skip] (#5863) --- docs/config/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index e8be0ee13c7f5c..647266448c52c2 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -786,12 +786,12 @@ export default defineConfig({ By default, Vite will empty the `outDir` on build if it is inside project root. It will emit a warning if `outDir` is outside of root to avoid accidentally removing important files. You can explicitly set this option to suppress the warning. This is also available via command line as `--emptyOutDir`. -### build.brotliSize +### build.reportCompressedSize - **Type:** `boolean` - **Default:** `true` - Enable/disable brotli-compressed size reporting. Compressing large output files can be slow, so disabling this may increase build performance for large projects. + Enable/disable gzip-compressed size reporting. Compressing large output files can be slow, so disabling this may increase build performance for large projects. ### build.chunkSizeWarningLimit From 5c07cec7214948da73fbbc33c7f5c83bf7f6cd2e Mon Sep 17 00:00:00 2001 From: OneNail <31649110+OneNail@users.noreply.github.com> Date: Sun, 28 Nov 2021 21:29:59 +0800 Subject: [PATCH 0009/1287] fix(plugin-vue): misleading error thrown after refresh or hmr (#5870) Co-authored-by: Anthony Fu --- packages/plugin-vue/src/utils/error.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/plugin-vue/src/utils/error.ts b/packages/plugin-vue/src/utils/error.ts index a2916cc6646a6f..8c5e3f5d8a5b9e 100644 --- a/packages/plugin-vue/src/utils/error.ts +++ b/packages/plugin-vue/src/utils/error.ts @@ -5,16 +5,22 @@ export function createRollupError( id: string, error: CompilerError | SyntaxError ): RollupError { - ;(error as RollupError).id = id - ;(error as RollupError).plugin = 'vue' + const { message, name, stack } = error + const rollupError: RollupError = { + id, + plugin: 'vue', + message, + name, + stack + } if ('code' in error && error.loc) { - ;(error as any).loc = { + rollupError.loc = { file: id, line: error.loc.start.line, column: error.loc.start.column } } - return error as RollupError + return rollupError } From c344865851b1f140f51b2f8d03821419114ac3b9 Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Sun, 28 Nov 2021 20:11:47 +0630 Subject: [PATCH 0010/1287] chore: format & check with prettier (#5869) --- .github/workflows/ci.yml | 3 +++ docs/config/index.md | 7 ++++++- docs/guide/api-plugin.md | 1 - .../index.html" | 1 - packages/playground/resolve/config-dep.js | 2 +- packages/playground/resolve/vite.config.js | 2 +- packages/playground/ssr-vue/src/pages/Home.vue | 5 ++++- packages/plugin-vue/src/main.ts | 4 +--- packages/vite/src/node/plugins/asset.ts | 6 +----- packages/vite/src/node/plugins/css.ts | 14 +++++++++----- 10 files changed, 26 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af17a906be4fdb..0e946cf9b4fda1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,3 +91,6 @@ jobs: - name: Lint run: pnpm run lint + + - name: Check formatting + run: pnpm prettier --check . diff --git a/docs/config/index.md b/docs/config/index.md index 647266448c52c2..fc3ec5b8752d48 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -238,7 +238,12 @@ export default defineConfig(async ({ command, mode }) => { /** * default: null */ - localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | null + localsConvention?: + | 'camelCase' + | 'camelCaseOnly' + | 'dashes' + | 'dashesOnly' + | null } ``` diff --git a/docs/guide/api-plugin.md b/docs/guide/api-plugin.md index ddccdd36c6296b..058130cec38414 100644 --- a/docs/guide/api-plugin.md +++ b/docs/guide/api-plugin.md @@ -40,7 +40,6 @@ Vite convention for virtual modules is to prefix the user-facing path with `virt Note that modules directly derived from a real file, as in the case of a script module in a Single File Component (like a .vue or .svelte SFC) don't need to follow this convention. SFCs generally generate a set of submodules when processed but the code in these can be mapped back to the filesystem. Using `\0` for these submodules would prevent sourcemaps from working correctly. - ## Plugins config Users will add plugins to the project `devDependencies` and configure them using the `plugins` array option. diff --git "a/packages/playground/html/unicode-path/\344\270\255\346\226\207-\343\201\253\343\201\273\343\202\223\343\201\224-\355\225\234\352\270\200-\360\237\214\225\360\237\214\226\360\237\214\227/index.html" "b/packages/playground/html/unicode-path/\344\270\255\346\226\207-\343\201\253\343\201\273\343\202\223\343\201\224-\355\225\234\352\270\200-\360\237\214\225\360\237\214\226\360\237\214\227/index.html" index 083283dab90380..f3c55befe1f315 100644 --- "a/packages/playground/html/unicode-path/\344\270\255\346\226\207-\343\201\253\343\201\273\343\202\223\343\201\224-\355\225\234\352\270\200-\360\237\214\225\360\237\214\226\360\237\214\227/index.html" +++ "b/packages/playground/html/unicode-path/\344\270\255\346\226\207-\343\201\253\343\201\273\343\202\223\343\201\224-\355\225\234\352\270\200-\360\237\214\225\360\237\214\226\360\237\214\227/index.html" @@ -1,2 +1 @@

unicode-path

- diff --git a/packages/playground/resolve/config-dep.js b/packages/playground/resolve/config-dep.js index 84de4f6be3796d..8bc3563c743bcd 100644 --- a/packages/playground/resolve/config-dep.js +++ b/packages/playground/resolve/config-dep.js @@ -1,3 +1,3 @@ module.exports = { a: 1 -} \ No newline at end of file +} diff --git a/packages/playground/resolve/vite.config.js b/packages/playground/resolve/vite.config.js index e69de3fa778397..be1b75e431383a 100644 --- a/packages/playground/resolve/vite.config.js +++ b/packages/playground/resolve/vite.config.js @@ -2,7 +2,7 @@ const virtualFile = '@virtual-file' const virtualId = '\0' + virtualFile const customVirtualFile = '@custom-virtual-file' -const { a } = require('./config-dep'); +const { a } = require('./config-dep') module.exports = { resolve: { diff --git a/packages/playground/ssr-vue/src/pages/Home.vue b/packages/playground/ssr-vue/src/pages/Home.vue index 1ef187c0361ffb..eef2ee086f8967 100644 --- a/packages/playground/ssr-vue/src/pages/Home.vue +++ b/packages/playground/ssr-vue/src/pages/Home.vue @@ -9,7 +9,10 @@

this will be styled with a font-face

{{ state.url }}

{{ state.protocol }}

-
encrypted message:

{{ encryptedMsg }}

+
+ encrypted message: +

{{ encryptedMsg }}

+
diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index ca2835d41be799..bb3076763844bd 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -269,9 +269,7 @@ async function genScriptCode( scriptCode = compiler.rewriteDefault( script.content, '_sfc_main', - script.lang === 'ts' - ? ['typescript'] - : undefined + script.lang === 'ts' ? ['typescript'] : undefined ) map = script.map } else { diff --git a/packages/vite/src/node/plugins/asset.ts b/packages/vite/src/node/plugins/asset.ts index 75dc3dcaa3f71d..2cd423ae528c79 100644 --- a/packages/vite/src/node/plugins/asset.ts +++ b/packages/vite/src/node/plugins/asset.ts @@ -98,11 +98,7 @@ export function assetPlugin(config: ResolvedConfig): Plugin { const file = getAssetFilename(hash, config) || this.getFileName(hash) registerAssetToChunk(chunk, file) const outputFilepath = config.base + file + postfix - s.overwrite( - match.index, - match.index + full.length, - outputFilepath - ) + s.overwrite(match.index, match.index + full.length, outputFilepath) } if (s) { diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 19181acd66f430..2a66e7b5cb4b93 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -1002,12 +1002,16 @@ function loadPreprocessor(lang: PreprocessLang, root: string): any { return (loadedPreprocessors[lang] = require(resolved)) } catch (e) { if (e.code === 'MODULE_NOT_FOUND') { - throw new Error(`Preprocessor dependency "${lang}" not found. Did you install it?`); + throw new Error( + `Preprocessor dependency "${lang}" not found. Did you install it?` + ) } else { - const message = new Error(`Preprocessor dependency "${lang}" failed to load:\n${e.message}`); - message.stack = e.stack + '\n' + message.stack; - throw message; - } + const message = new Error( + `Preprocessor dependency "${lang}" failed to load:\n${e.message}` + ) + message.stack = e.stack + '\n' + message.stack + throw message + } } } From 6891f0fd696f0a594771b18f5a79069c138b315e Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Sun, 28 Nov 2021 21:06:17 +0630 Subject: [PATCH 0011/1287] ci: add release tag action [ci skip] (#5807) --- .github/workflows/release-tag.yml | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/release-tag.yml diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml new file mode 100644 index 00000000000000..5ed9495899340a --- /dev/null +++ b/.github/workflows/release-tag.yml @@ -0,0 +1,40 @@ +name: release + +on: + push: + tags: + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 + - "plugin-*" # Push events to matching plugin-*, i.e. plugin-(vue|vue-jsx|react|legacy)@1.0.0 + - "create-vite*" # # Push events to matching create-vite*, i.e. create-vite@1.0.0 + +# $GITHUB_REF_NAME - https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Get pkgName for tag + id: tag + run: | + # matching v2.0.0 / v2.0.0-beta.8 etc + if [[ $GITHUB_REF_NAME =~ ^v.+ ]]; then + pkgName="vite" + else + # `%@*` truncates @ and version number from the right side. + # https://stackoverflow.com/questions/9532654/expression-after-last-specific-character + pkgName=${GITHUB_REF_NAME%@*} + fi + + echo "::set-output name=pkgName::$pkgName" + + - name: Create Release for Tag + id: release_tag + uses: yyx990803/release-tag@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + body: | + Please refer to [CHANGELOG.md](https://github.com/vitejs/vite/blob/${{ github.ref_name }}/packages/${{ steps.tag.outputs.pkgName }}/CHANGELOG.md) for details. From 868cd2f32732c3cb8930a78050d92359c747b575 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Sun, 28 Nov 2021 09:44:42 -0800 Subject: [PATCH 0012/1287] chore: remove duplicate workspaces declaration (#5862) --- package.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package.json b/package.json index 7ce2344796b294..c2c231d8c9eba3 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,6 @@ { "name": "vite-monorepo", "private": true, - "workspaces": [ - "packages/*", - "packages/playground/*" - ], "engines": { "node": ">=12.0.0" }, From 2b91e5aadaee0947eb9864367ae85762573a8dc4 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Mon, 29 Nov 2021 20:55:40 +0800 Subject: [PATCH 0013/1287] fix(resolve): dont overwrite `isRequire` from `baseOptions` (#5872) --- packages/vite/src/node/plugins/resolve.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts index e68c62b8c0aea0..74cc7f0ea7109b 100644 --- a/packages/vite/src/node/plugins/resolve.ts +++ b/packages/vite/src/node/plugins/resolve.ts @@ -119,9 +119,9 @@ export function resolvePlugin(baseOptions: InternalResolveOptions): Plugin { resolveOpts?.custom?.['node-resolve']?.isRequire ?? false const options: InternalResolveOptions = { - ...baseOptions, - isRequire, + + ...baseOptions, isFromTsImporter: isTsRequest(importer ?? '') } From 775babac40da546b01b8b8cbd7dff32b5cfcee6d Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Mon, 29 Nov 2021 05:40:44 -0800 Subject: [PATCH 0014/1287] chore: use cjs extension with scripts (#5877) --- .eslintrc.js => .eslintrc.cjs | 0 CONTRIBUTING.md | 2 +- jest.config.ts | 6 +++--- package.json | 2 +- packages/create-app/package.json | 2 +- packages/create-vite/package.json | 2 +- packages/playground/alias/package.json | 2 +- packages/playground/optimize-deps/package.json | 2 +- packages/playground/optimize-missing-deps/package.json | 2 +- packages/plugin-legacy/package.json | 2 +- packages/plugin-react/package.json | 2 +- packages/plugin-vue-jsx/package.json | 2 +- packages/plugin-vue/package.json | 2 +- packages/vite/package.json | 4 ++-- packages/vite/scripts/{patchTypes.js => patchTypes.cjs} | 0 scripts/{jestEnv.js => jestEnv.cjs} | 0 scripts/{jestGlobalSetup.js => jestGlobalSetup.cjs} | 0 scripts/{jestGlobalTeardown.js => jestGlobalTeardown.cjs} | 0 scripts/{patchFileDeps.js => patchFileDeps.cjs} | 0 scripts/{release.js => release.cjs} | 0 scripts/{verifyCommit.js => verifyCommit.cjs} | 0 21 files changed, 16 insertions(+), 16 deletions(-) rename .eslintrc.js => .eslintrc.cjs (100%) rename packages/vite/scripts/{patchTypes.js => patchTypes.cjs} (100%) rename scripts/{jestEnv.js => jestEnv.cjs} (100%) rename scripts/{jestGlobalSetup.js => jestGlobalSetup.cjs} (100%) rename scripts/{jestGlobalTeardown.js => jestGlobalTeardown.cjs} (100%) rename scripts/{patchFileDeps.js => patchFileDeps.cjs} (100%) rename scripts/{release.js => release.cjs} (100%) rename scripts/{verifyCommit.js => verifyCommit.cjs} (100%) diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 100% rename from .eslintrc.js rename to .eslintrc.cjs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 88028ffad9b8de..54ac9f4d4ddc81 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -100,7 +100,7 @@ To work around this, playground packages that uses the `file:` protocol should a ```jsonc "scripts": { //... - "postinstall": "node ../../../scripts/patchFileDeps" + "postinstall": "node ../../../scripts/patchFileDeps.cjs" } ``` diff --git a/jest.config.ts b/jest.config.ts index e17a90841914e7..7d4831524d01c3 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -7,9 +7,9 @@ const config: Config.InitialOptions = { ? ['**/playground/**/*.spec.[jt]s?(x)'] : ['**/*.spec.[jt]s?(x)'], testTimeout: process.env.CI ? 30000 : 10000, - globalSetup: './scripts/jestGlobalSetup.js', - globalTeardown: './scripts/jestGlobalTeardown.js', - testEnvironment: './scripts/jestEnv.js', + globalSetup: './scripts/jestGlobalSetup.cjs', + globalTeardown: './scripts/jestGlobalTeardown.cjs', + testEnvironment: './scripts/jestEnv.cjs', setupFilesAfterEnv: ['./scripts/jestPerTestSetup.ts'], watchPathIgnorePatterns: ['/packages/temp'], modulePathIgnorePatterns: ['/packages/temp'], diff --git a/package.json b/package.json index c2c231d8c9eba3..1343fc1cbd7052 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ }, "gitHooks": { "pre-commit": "lint-staged --concurrent false", - "commit-msg": "node scripts/verifyCommit.js" + "commit-msg": "node scripts/verifyCommit.cjs" }, "lint-staged": { "*": [ diff --git a/packages/create-app/package.json b/packages/create-app/package.json index 95005a81361960..bd66205c22dcc3 100644 --- a/packages/create-app/package.json +++ b/packages/create-app/package.json @@ -12,7 +12,7 @@ }, "main": "index.js", "scripts": { - "release": "node ../../scripts/release.js --skipBuild" + "release": "node ../../scripts/release.cjs --skipBuild" }, "engines": { "node": ">=12.0.0" diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json index ec4f2dc064eb1a..6c50d4a4284217 100644 --- a/packages/create-vite/package.json +++ b/packages/create-vite/package.json @@ -14,7 +14,7 @@ "main": "index.js", "scripts": { "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package create-vite", - "release": "node updateVersions && node ../../scripts/release.js --skipBuild" + "release": "node updateVersions && node ../../scripts/release.cjs --skipBuild" }, "engines": { "node": ">=12.0.0" diff --git a/packages/playground/alias/package.json b/packages/playground/alias/package.json index 6dd796c11ecbd2..1d208eb68d6513 100644 --- a/packages/playground/alias/package.json +++ b/packages/playground/alias/package.json @@ -7,7 +7,7 @@ "build": "vite build", "debug": "node --inspect-brk ../../vite/bin/vite", "preview": "vite preview", - "postinstall": "node ../../../scripts/patchFileDeps" + "postinstall": "node ../../../scripts/patchFileDeps.cjs" }, "dependencies": { "aliased-module": "file:./dir/module", diff --git a/packages/playground/optimize-deps/package.json b/packages/playground/optimize-deps/package.json index 181f44ab957ad2..67410700820be5 100644 --- a/packages/playground/optimize-deps/package.json +++ b/packages/playground/optimize-deps/package.json @@ -7,7 +7,7 @@ "build": "vite build", "debug": "node --inspect-brk ../../vite/bin/vite", "preview": "vite preview", - "postinstall": "node ../../../scripts/patchFileDeps" + "postinstall": "node ../../../scripts/patchFileDeps.cjs" }, "dependencies": { "axios": "^0.24.0", diff --git a/packages/playground/optimize-missing-deps/package.json b/packages/playground/optimize-missing-deps/package.json index 4d2590591158e6..74e17dd60704a6 100644 --- a/packages/playground/optimize-missing-deps/package.json +++ b/packages/playground/optimize-missing-deps/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "scripts": { "dev": "node server", - "postinstall": "node ../../../scripts/patchFileDeps" + "postinstall": "node ../../../scripts/patchFileDeps.cjs" }, "dependencies": { "missing-dep": "file:./missing-dep", diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index 3a7f8f9435889b..2ab7f597861915 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -11,7 +11,7 @@ "types": "index.d.ts", "scripts": { "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-legacy", - "release": "node ../../scripts/release.js --skipBuild" + "release": "node ../../scripts/release.cjs --skipBuild" }, "engines": { "node": ">=12.0.0" diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 5e639904cf88b8..a8942b2abf9e41 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -18,7 +18,7 @@ "build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@babel/* --external:@rollup/* --external:resolve --external:react-refresh/* --outfile=dist/index.js", "build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-react", - "release": "node ../../scripts/release.js" + "release": "node ../../scripts/release.cjs" }, "engines": { "node": ">=12.0.0" diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 7099ded621f79b..3a400dda99bd32 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -11,7 +11,7 @@ "types": "index.d.ts", "scripts": { "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-vue-jsx", - "release": "node ../../scripts/release.js --skipBuild" + "release": "node ../../scripts/release.cjs --skipBuild" }, "engines": { "node": ">=12.0.0" diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index b2bdc3d34300d4..41001dc51e2e9f 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -16,7 +16,7 @@ "build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@vue/compiler-sfc --external:vue/compiler-sfc --external:vite --outfile=dist/index.js", "build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-vue", - "release": "node ../../scripts/release.js" + "release": "node ../../scripts/release.cjs" }, "engines": { "node": ">=12.0.0" diff --git a/packages/vite/package.json b/packages/vite/package.json index b0596493bc6f4d..efb6ed33c4986f 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -35,12 +35,12 @@ "build-types": "run-s build-temp-types patch-types roll-types", "build-temp-types": "tsc --emitDeclarationOnly --outDir temp/node -p src/node", "ci-build": "rimraf dist && run-s build-bundle build-types", - "patch-types": "node scripts/patchTypes", + "patch-types": "node scripts/patchTypes.cjs", "roll-types": "api-extractor run && rimraf temp", "lint": "eslint --ext .ts src/**", "format": "prettier --write --parser typescript \"src/**/*.ts\"", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path .", - "release": "node ../../scripts/release.js" + "release": "node ../../scripts/release.cjs" }, "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!", "dependencies": { diff --git a/packages/vite/scripts/patchTypes.js b/packages/vite/scripts/patchTypes.cjs similarity index 100% rename from packages/vite/scripts/patchTypes.js rename to packages/vite/scripts/patchTypes.cjs diff --git a/scripts/jestEnv.js b/scripts/jestEnv.cjs similarity index 100% rename from scripts/jestEnv.js rename to scripts/jestEnv.cjs diff --git a/scripts/jestGlobalSetup.js b/scripts/jestGlobalSetup.cjs similarity index 100% rename from scripts/jestGlobalSetup.js rename to scripts/jestGlobalSetup.cjs diff --git a/scripts/jestGlobalTeardown.js b/scripts/jestGlobalTeardown.cjs similarity index 100% rename from scripts/jestGlobalTeardown.js rename to scripts/jestGlobalTeardown.cjs diff --git a/scripts/patchFileDeps.js b/scripts/patchFileDeps.cjs similarity index 100% rename from scripts/patchFileDeps.js rename to scripts/patchFileDeps.cjs diff --git a/scripts/release.js b/scripts/release.cjs similarity index 100% rename from scripts/release.js rename to scripts/release.cjs diff --git a/scripts/verifyCommit.js b/scripts/verifyCommit.cjs similarity index 100% rename from scripts/verifyCommit.js rename to scripts/verifyCommit.cjs From 1809fccab6267a68336b8374428a88c0514f4ac7 Mon Sep 17 00:00:00 2001 From: QiChang Li Date: Mon, 29 Nov 2021 23:56:26 +0800 Subject: [PATCH 0015/1287] docs: fix @vitejs/plugin-react broken link (#5892) --- docs/guide/backend-integration.md | 2 +- docs/guide/migration.md | 2 +- docs/guide/ssr.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guide/backend-integration.md b/docs/guide/backend-integration.md index 06fbce487ef3fd..a30831e735fff7 100644 --- a/docs/guide/backend-integration.md +++ b/docs/guide/backend-integration.md @@ -39,7 +39,7 @@ If you need a custom integration, you can follow the steps in this guide to conf Also make sure the server is configured to serve static assets in the Vite working directory, otherwise assets such as images won't be loaded properly. - Note if you are using React with `@vitejs/plugin-react-refresh`, you'll also need to add this before the above scripts, since the plugin is not able to modify the HTML you are serving: + Note if you are using React with `@vitejs/plugin-react`, you'll also need to add this before the above scripts, since the plugin is not able to modify the HTML you are serving: ```html diff --git a/packages/playground/ssr-vue/vite.config.js b/packages/playground/ssr-vue/vite.config.js index 1ff2cac01ff1bd..897b47ca7c2ec8 100644 --- a/packages/playground/ssr-vue/vite.config.js +++ b/packages/playground/ssr-vue/vite.config.js @@ -5,9 +5,6 @@ const vueJsx = require('@vitejs/plugin-vue-jsx') * @type {import('vite').UserConfig} */ module.exports = { - optimizeDeps: { - exclude: ['bcrypt'] - }, plugins: [ vuePlugin(), vueJsx(), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a7011891db1cbc..210c92ed29b5b7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -454,6 +454,28 @@ importers: packages/playground/resolve/inline-package: specifiers: {} + packages/playground/ssr-deps: + specifiers: + cross-env: ^7.0.3 + express: ^4.17.1 + node-addon: link:./node-addon + read-file-content: file:./read-file-content + dependencies: + node-addon: link:node-addon + read-file-content: link:read-file-content + devDependencies: + cross-env: 7.0.3 + express: 4.17.1 + + packages/playground/ssr-deps/node-addon: + specifiers: + node-gyp: ^8.4.1 + dependencies: + node-gyp: 8.4.1 + + packages/playground/ssr-deps/read-file-content: + specifiers: {} + packages/playground/ssr-html: specifiers: cross-env: ^7.0.3 @@ -499,7 +521,6 @@ importers: specifiers: '@vitejs/plugin-vue': workspace:* '@vitejs/plugin-vue-jsx': workspace:* - bcrypt: ^5.0.1 compression: ^1.7.4 cross-env: ^7.0.3 dep-import-type: link:./dep-import-type @@ -510,7 +531,6 @@ importers: vue-router: ^4.0.0 vuex: ^4.0.2 dependencies: - bcrypt: 5.0.1 example-external-component: link:example-external-component vue: 3.2.23 vue-router: 4.0.12_vue@3.2.23 @@ -1516,6 +1536,10 @@ packages: resolution: {integrity: sha512-bprfNmYt1opFUFEtD2XfY/kEsm13bzHQgU80uMjhuK0DJ914IjolT1GytpkdM6tJ4MBvyiJPP+bTtWO+BZ7c7w==} dev: true + /@gar/promisify/1.1.2: + resolution: {integrity: sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw==} + dev: false + /@humanwhocodes/config-array/0.6.0: resolution: {integrity: sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A==} engines: {node: '>=10.10.0'} @@ -1752,23 +1776,6 @@ packages: engines: {node: '>=6.0.0'} dev: true - /@mapbox/node-pre-gyp/1.0.7: - resolution: {integrity: sha512-PplSvl4pJ5N3BkVjAdDzpPhVUPdC73JgttkR+LnBx2OORC1GCQsBjUeEuipf9uOaAM1SbxcdZFfR3KDTKm2S0A==} - hasBin: true - dependencies: - detect-libc: 1.0.3 - https-proxy-agent: 5.0.0 - make-dir: 3.1.0 - node-fetch: 2.6.6 - nopt: 5.0.0 - npmlog: 6.0.0 - rimraf: 3.0.2 - semver: 7.3.5 - tar: 6.1.11 - transitivePeerDependencies: - - supports-color - dev: false - /@microsoft/api-extractor-model/7.13.16: resolution: {integrity: sha512-ttdxVXsTWL5dd26W1YNLe3LgDsE0EE273aZlcLe58W0opymBybCYU1Mn+OHQM8BuErrdvdN8LdpWAAbkiOEN/Q==} dependencies: @@ -1836,6 +1843,21 @@ packages: '@nodelib/fs.scandir': 2.1.5 fastq: 1.13.0 + /@npmcli/fs/1.0.0: + resolution: {integrity: sha512-8ltnOpRR/oJbOp8vaGUnipOi3bqkcW+sLHFlyXIr08OGHmVJLB1Hn7QtGXbYcpVtH1gAYZTlmDXtE4YV0+AMMQ==} + dependencies: + '@gar/promisify': 1.1.2 + semver: 7.3.5 + dev: false + + /@npmcli/move-file/1.1.2: + resolution: {integrity: sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==} + engines: {node: '>=10'} + dependencies: + mkdirp: 1.0.4 + rimraf: 3.0.2 + dev: false + /@peculiar/asn1-schema/2.0.38: resolution: {integrity: sha512-zZ64UpCTm9me15nuCpPgJghSdbEm8atcDQPCyK+bKXjZAQ1735NCZXCSCfbckbQ4MH36Rm9403n/qMq77LFDzQ==} dependencies: @@ -2009,7 +2031,6 @@ packages: /@tootallnate/once/1.1.2: resolution: {integrity: sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==} engines: {node: '>= 6'} - dev: true /@tsconfig/node10/1.0.8: resolution: {integrity: sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==} @@ -2664,13 +2685,23 @@ packages: transitivePeerDependencies: - supports-color + /agentkeepalive/4.1.4: + resolution: {integrity: sha512-+V/rGa3EuU74H6wR04plBb7Ks10FbtUQgRj/FQOG7uUIEuaINI+AiqJR1k6t3SVNs7o7ZjIdus6706qqzVq8jQ==} + engines: {node: '>= 8.0.0'} + dependencies: + debug: 4.3.2 + depd: 1.1.2 + humanize-ms: 1.2.1 + transitivePeerDependencies: + - supports-color + dev: false + /aggregate-error/3.1.0: resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} engines: {node: '>=8'} dependencies: clean-stack: 2.2.0 indent-string: 4.0.0 - dev: true /ajv/6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} @@ -2952,17 +2983,6 @@ packages: engines: {node: '>=6.0.0'} dev: true - /bcrypt/5.0.1: - resolution: {integrity: sha512-9BTgmrhZM2t1bNuDtrtIMVSmmxZBrJ71n8Wg+YgdjHuIWYF7SjjmCPZFB+/5i/o/PIeRpwVJR3P+NrpIItUjqw==} - engines: {node: '>= 10.0.0'} - requiresBuild: true - dependencies: - '@mapbox/node-pre-gyp': 1.0.7 - node-addon-api: 3.2.1 - transitivePeerDependencies: - - supports-color - dev: false - /big.js/5.2.2: resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==} dev: true @@ -3061,6 +3081,30 @@ packages: engines: {node: '>=8'} dev: true + /cacache/15.3.0: + resolution: {integrity: sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==} + engines: {node: '>= 10'} + dependencies: + '@npmcli/fs': 1.0.0 + '@npmcli/move-file': 1.1.2 + chownr: 2.0.0 + fs-minipass: 2.1.0 + glob: 7.2.0 + infer-owner: 1.0.4 + lru-cache: 6.0.0 + minipass: 3.1.5 + minipass-collect: 1.0.2 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + mkdirp: 1.0.4 + p-map: 4.0.0 + promise-inflight: 1.0.1 + rimraf: 3.0.2 + ssri: 8.0.1 + tar: 6.1.11 + unique-filename: 1.1.1 + dev: false + /call-bind/1.0.2: resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} dependencies: @@ -3177,7 +3221,6 @@ packages: /clean-stack/2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} engines: {node: '>=6'} - dev: true /cli-cursor/3.1.0: resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==} @@ -3849,18 +3892,11 @@ packages: /depd/1.1.2: resolution: {integrity: sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=} engines: {node: '>= 0.6'} - dev: true /destroy/1.0.4: resolution: {integrity: sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=} dev: true - /detect-libc/1.0.3: - resolution: {integrity: sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=} - engines: {node: '>=0.10'} - hasBin: true - dev: false - /detect-newline/3.1.0: resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} engines: {node: '>=8'} @@ -3976,6 +4012,14 @@ packages: engines: {node: '>= 0.8'} dev: true + /encoding/0.1.13: + resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==} + requiresBuild: true + dependencies: + iconv-lite: 0.6.3 + dev: false + optional: true + /end-of-stream/1.4.4: resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} dependencies: @@ -3992,7 +4036,10 @@ packages: /env-paths/2.2.1: resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} engines: {node: '>=6'} - dev: true + + /err-code/2.0.3: + resolution: {integrity: sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==} + dev: false /errno/0.1.8: resolution: {integrity: sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==} @@ -5010,7 +5057,6 @@ packages: /http-cache-semantics/4.1.0: resolution: {integrity: sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==} - dev: true /http-errors/1.7.2: resolution: {integrity: sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==} @@ -5043,7 +5089,6 @@ packages: debug: 4.3.2 transitivePeerDependencies: - supports-color - dev: true /http-proxy/1.18.1_debug@4.3.2: resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==} @@ -5070,6 +5115,12 @@ packages: engines: {node: '>=10.17.0'} dev: true + /humanize-ms/1.2.1: + resolution: {integrity: sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=} + dependencies: + ms: 2.1.3 + dev: false + /iconv-lite/0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} @@ -5077,6 +5128,14 @@ packages: safer-buffer: 2.1.2 dev: true + /iconv-lite/0.6.3: + resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} + engines: {node: '>=0.10.0'} + dependencies: + safer-buffer: 2.1.2 + dev: false + optional: true + /icss-replace-symbols/1.1.0: resolution: {integrity: sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=} dev: true @@ -5144,12 +5203,14 @@ packages: /imurmurhash/0.1.4: resolution: {integrity: sha1-khi5srkoojixPcT7a21XbyMUU+o=} engines: {node: '>=0.8.19'} - dev: true /indent-string/4.0.0: resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} engines: {node: '>=8'} - dev: true + + /infer-owner/1.0.4: + resolution: {integrity: sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==} + dev: false /inflight/1.0.6: resolution: {integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=} @@ -5198,7 +5259,6 @@ packages: /ip/1.1.5: resolution: {integrity: sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=} - dev: true /ipaddr.js/1.9.1: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} @@ -5304,6 +5364,10 @@ packages: dependencies: is-extglob: 2.1.1 + /is-lambda/1.0.1: + resolution: {integrity: sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=} + dev: false + /is-module/1.0.0: resolution: {integrity: sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=} dev: true @@ -5422,7 +5486,6 @@ packages: /isexe/2.0.0: resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=} - dev: true /istanbul-lib-coverage/3.2.0: resolution: {integrity: sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==} @@ -6335,11 +6398,36 @@ packages: engines: {node: '>=8'} dependencies: semver: 6.3.0 + dev: true /make-error/1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} dev: true + /make-fetch-happen/9.1.0: + resolution: {integrity: sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==} + engines: {node: '>= 10'} + dependencies: + agentkeepalive: 4.1.4 + cacache: 15.3.0 + http-cache-semantics: 4.1.0 + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.0 + is-lambda: 1.0.1 + lru-cache: 6.0.0 + minipass: 3.1.5 + minipass-collect: 1.0.2 + minipass-fetch: 1.4.1 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + negotiator: 0.6.2 + promise-retry: 2.0.1 + socks-proxy-agent: 6.1.0 + ssri: 8.0.1 + transitivePeerDependencies: + - supports-color + dev: false + /makeerror/1.0.12: resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} dependencies: @@ -6526,6 +6614,45 @@ packages: /minimist/1.2.5: resolution: {integrity: sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==} + /minipass-collect/1.0.2: + resolution: {integrity: sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==} + engines: {node: '>= 8'} + dependencies: + minipass: 3.1.5 + dev: false + + /minipass-fetch/1.4.1: + resolution: {integrity: sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==} + engines: {node: '>=8'} + dependencies: + minipass: 3.1.5 + minipass-sized: 1.0.3 + minizlib: 2.1.2 + optionalDependencies: + encoding: 0.1.13 + dev: false + + /minipass-flush/1.0.5: + resolution: {integrity: sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==} + engines: {node: '>= 8'} + dependencies: + minipass: 3.1.5 + dev: false + + /minipass-pipeline/1.2.4: + resolution: {integrity: sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==} + engines: {node: '>=8'} + dependencies: + minipass: 3.1.5 + dev: false + + /minipass-sized/1.0.3: + resolution: {integrity: sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==} + engines: {node: '>=8'} + dependencies: + minipass: 3.1.5 + dev: false + /minipass/3.1.5: resolution: {integrity: sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw==} engines: {node: '>=8'} @@ -6573,8 +6700,6 @@ packages: /ms/2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - dev: true - optional: true /mustache/4.2.0: resolution: {integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==} @@ -6605,7 +6730,6 @@ packages: /negotiator/0.6.2: resolution: {integrity: sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==} engines: {node: '>= 0.6'} - dev: true /neo-async/2.6.2: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} @@ -6619,10 +6743,6 @@ packages: resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==} dev: true - /node-addon-api/3.2.1: - resolution: {integrity: sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==} - dev: false - /node-cron/2.0.3: resolution: {integrity: sha512-eJI+QitXlwcgiZwNNSRbqsjeZMp5shyajMR81RZCqeW0ZDEj4zU9tpd4nTh/1JsBiKbF8d08FCewiipDmVIYjg==} engines: {node: '>=6.0.0'} @@ -6643,12 +6763,32 @@ packages: engines: {node: 4.x || >=6.0.0} dependencies: whatwg-url: 5.0.0 + dev: true /node-forge/0.10.0: resolution: {integrity: sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==} engines: {node: '>= 6.0.0'} dev: true + /node-gyp/8.4.1: + resolution: {integrity: sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w==} + engines: {node: '>= 10.12.0'} + hasBin: true + dependencies: + env-paths: 2.2.1 + glob: 7.2.0 + graceful-fs: 4.2.8 + make-fetch-happen: 9.1.0 + nopt: 5.0.0 + npmlog: 6.0.0 + rimraf: 3.0.2 + semver: 7.3.5 + tar: 6.1.11 + which: 2.0.2 + transitivePeerDependencies: + - supports-color + dev: false + /node-int64/0.4.0: resolution: {integrity: sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=} dev: true @@ -6888,7 +7028,6 @@ packages: engines: {node: '>=10'} dependencies: aggregate-error: 3.1.0 - dev: true /p-try/1.0.0: resolution: {integrity: sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=} @@ -7262,6 +7401,18 @@ packages: engines: {node: '>=0.4.0'} dev: true + /promise-inflight/1.0.1: + resolution: {integrity: sha1-mEcocL8igTL8vdhoEputEsPAKeM=} + dev: false + + /promise-retry/2.0.1: + resolution: {integrity: sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==} + engines: {node: '>=10'} + dependencies: + err-code: 2.0.3 + retry: 0.12.0 + dev: false + /promise/7.3.1: resolution: {integrity: sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==} dependencies: @@ -7728,7 +7879,6 @@ packages: /retry/0.12.0: resolution: {integrity: sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=} engines: {node: '>= 4'} - dev: true /reusify/1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} @@ -7792,7 +7942,6 @@ packages: /safer-buffer/2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - dev: true /sanitize-filename/1.6.3: resolution: {integrity: sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==} @@ -7990,7 +8139,6 @@ packages: /smart-buffer/4.2.0: resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} - dev: true /socks-proxy-agent/6.1.0: resolution: {integrity: sha512-57e7lwCN4Tzt3mXz25VxOErJKXlPfXmkMLnk310v/jwW20jWRVcgsOit+xNkN3eIEdB47GwnfAEBLacZ/wVIKg==} @@ -8001,7 +8149,6 @@ packages: socks: 2.6.1 transitivePeerDependencies: - supports-color - dev: true /socks/2.6.1: resolution: {integrity: sha512-kLQ9N5ucj8uIcxrDwjm0Jsqk06xdpBjGNQtpXy4Q8/QY2k+fY7nZH8CARy+hkbG+SGAovmzzuauCpBlb8FrnBA==} @@ -8009,7 +8156,6 @@ packages: dependencies: ip: 1.1.5 smart-buffer: 4.2.0 - dev: true /source-map-js/0.6.2: resolution: {integrity: sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==} @@ -8116,6 +8262,13 @@ packages: resolution: {integrity: sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=} dev: true + /ssri/8.0.1: + resolution: {integrity: sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==} + engines: {node: '>= 8'} + dependencies: + minipass: 3.1.5 + dev: false + /stack-trace/0.0.10: resolution: {integrity: sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=} dev: true @@ -8561,6 +8714,7 @@ packages: /tr46/0.0.3: resolution: {integrity: sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=} + dev: true /tr46/2.1.0: resolution: {integrity: sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==} @@ -8783,6 +8937,18 @@ packages: which-boxed-primitive: 1.0.2 dev: true + /unique-filename/1.1.1: + resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==} + dependencies: + unique-slug: 2.0.2 + dev: false + + /unique-slug/2.0.2: + resolution: {integrity: sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==} + dependencies: + imurmurhash: 0.1.4 + dev: false + /universalify/0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} @@ -8949,6 +9115,7 @@ packages: /webidl-conversions/3.0.1: resolution: {integrity: sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=} + dev: true /webidl-conversions/5.0.0: resolution: {integrity: sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==} @@ -8975,6 +9142,7 @@ packages: dependencies: tr46: 0.0.3 webidl-conversions: 3.0.1 + dev: true /whatwg-url/8.7.0: resolution: {integrity: sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==} @@ -9008,7 +9176,6 @@ packages: hasBin: true dependencies: isexe: 2.0.0 - dev: true /wide-align/1.1.5: resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} From 5b8c58bf9d2fe141cea9bde9492ccbedf9b76213 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Thu, 2 Dec 2021 10:19:55 -0500 Subject: [PATCH 0025/1287] fix: invalidate inlined proxy scripts on change (#5891) --- .../vite/src/node/server/middlewares/indexHtml.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/node/server/middlewares/indexHtml.ts b/packages/vite/src/node/server/middlewares/indexHtml.ts index a5f46ab31f4e00..e257628a35a746 100644 --- a/packages/vite/src/node/server/middlewares/indexHtml.ts +++ b/packages/vite/src/node/server/middlewares/indexHtml.ts @@ -121,12 +121,20 @@ const devHtmlHook: IndexHtmlTransformHook = async ( addToHTMLProxyCache(config, url, scriptModuleIndex, contents) // inline js module. convert to src="proxy" + const modulePath = `${ + config.base + htmlPath.slice(1) + }?html-proxy&index=${scriptModuleIndex}.js` + + // invalidate the module so the newly cached contents will be served + const module = server?.moduleGraph.getModuleById(modulePath) + if (module) { + server?.moduleGraph.invalidateModule(module) + } + s.overwrite( node.loc.start.offset, node.loc.end.offset, - `` + `` ) } } From 7edabb46de3ce63e078e0cda7cd3ed9e5cdd0f2a Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 2 Dec 2021 07:26:04 -0800 Subject: [PATCH 0026/1287] fix: read the correct package.json in ssrExternal (#5927) Fixes #5890 --- packages/vite/src/node/ssr/ssrExternal.ts | 33 ++++++++++++++++------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/packages/vite/src/node/ssr/ssrExternal.ts b/packages/vite/src/node/ssr/ssrExternal.ts index f846c64edd1aaa..3549d5653dfc95 100644 --- a/packages/vite/src/node/ssr/ssrExternal.ts +++ b/packages/vite/src/node/ssr/ssrExternal.ts @@ -8,7 +8,7 @@ import { normalizePath, resolveFrom } from '../utils' -import { ResolvedConfig } from '..' +import { Logger, ResolvedConfig } from '..' import { createFilter } from '@rollup/pluginutils' const debug = createDebugger('vite:ssr-external') @@ -37,7 +37,8 @@ export function resolveSSRExternal( config.root, config.resolve.preserveSymlinks, ssrExternals, - seen + seen, + config.logger ) const importedDeps = knownImports.map(getNpmPackageName).filter(isDefined) @@ -68,17 +69,18 @@ function collectExternals( root: string, preserveSymlinks: boolean | undefined, ssrExternals: Set, - seen: Set + seen: Set, + logger: Logger ) { - const pkgContent = lookupFile(root, ['package.json']) - if (!pkgContent) { + const rootPkgContent = lookupFile(root, ['package.json']) + if (!rootPkgContent) { return } - const pkg = JSON.parse(pkgContent) + const rootPkg = JSON.parse(rootPkgContent) const deps = { - ...pkg.devDependencies, - ...pkg.dependencies + ...rootPkg.devDependencies, + ...rootPkg.dependencies } const resolveOptions: InternalResolveOptions = { @@ -141,6 +143,14 @@ function collectExternals( // or are there others like SystemJS / AMD that we'd need to handle? // for now, we'll just leave this as is else if (/\.m?js$/.test(esmEntry)) { + const pkgPath = resolveFrom(`${id}/package.json`, root) + const pkgContent = fs.readFileSync(pkgPath, 'utf-8') + + if (!pkgContent) { + continue + } + const pkg = JSON.parse(pkgContent) + if (pkg.type === 'module' || esmEntry.endsWith('.mjs')) { ssrExternals.add(id) continue @@ -149,12 +159,17 @@ function collectExternals( const content = fs.readFileSync(esmEntry, 'utf-8') if (/\bmodule\.exports\b|\bexports[.\[]|\brequire\s*\(/.test(content)) { ssrExternals.add(id) + continue } + + logger.warn( + `${id} is incorrectly packaged. Please contact the package author to fix.` + ) } } for (const depRoot of depsToTrace) { - collectExternals(depRoot, preserveSymlinks, ssrExternals, seen) + collectExternals(depRoot, preserveSymlinks, ssrExternals, seen, logger) } } From 21d79d753af145f2c7ebb7dd5b0b1a4a298f96c5 Mon Sep 17 00:00:00 2001 From: Rom Brillout Date: Thu, 2 Dec 2021 21:53:12 +0100 Subject: [PATCH 0027/1287] fix: SSR import in dev can't resolve default import (fix #5706) (#5923) --- packages/vite/src/node/ssr/ssrModuleLoader.ts | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/packages/vite/src/node/ssr/ssrModuleLoader.ts b/packages/vite/src/node/ssr/ssrModuleLoader.ts index 07deb0a44c3a7c..ffd6838790af8e 100644 --- a/packages/vite/src/node/ssr/ssrModuleLoader.ts +++ b/packages/vite/src/node/ssr/ssrModuleLoader.ts @@ -263,19 +263,15 @@ async function nodeImport( try { const mod = await dynamicImport(url) - return proxyESM(id, mod) + return proxyESM(mod) } finally { unhookNodeResolve() } } // rollup-style default import interop for cjs -function proxyESM(id: string, mod: any) { - const defaultExport = mod.__esModule - ? mod.default - : mod.default - ? mod.default - : mod +function proxyESM(mod: any) { + const defaultExport = getDefaultExport(mod) return new Proxy(mod, { get(mod, prop) { if (prop === 'default') return defaultExport @@ -283,3 +279,34 @@ function proxyESM(id: string, mod: any) { } }) } + +function getDefaultExport(moduleExports: any) { + // `moduleExports` is one of the following: + // - `const moduleExports = require(file)` + // - `const moduleExports = await import(file)` + let defaultExport = + 'default' in moduleExports ? moduleExports.default : moduleExports + + // Node.js doesn't support `__esModule`, see https://github.com/nodejs/node/issues/40891 + // This means we need to unwrap the `__esModule` wrapper ourselves. + // + // For example: + // ```ts + // export default 'hi' + // ``` + // + // Which TypeScript transpiles to: + // ```js + // use strict"; + // exports.__esModule = true; + // exports["default"] = 'hi'; + // ``` + // + // This means that `moduleExports.default` denotes `{ __esModule, default: 'hi }` thus the actual + // default lives in `moduleExports.default.default`. + if (defaultExport && '__esModule' in defaultExport) { + defaultExport = defaultExport.default + } + + return defaultExport +} From aaa26a32501c857d854e9d9daca2a88a9e086392 Mon Sep 17 00:00:00 2001 From: patak-js Date: Thu, 2 Dec 2021 22:08:55 +0100 Subject: [PATCH 0028/1287] release: v2.7.0-beta.10 --- .../ssr-deps/node-addon/build/Makefile | 324 ++++++++++++++++ .../Release/.deps/Release/cpp_addon.node.d | 1 + .../.deps/Release/obj.target/cpp_addon.node.d | 1 + .../Release/obj.target/cpp_addon/main.o.d | 23 ++ .../node-addon/build/Release/cpp_addon.node | Bin 0 -> 13288 bytes .../build/Release/obj.target/cpp_addon.node | Bin 0 -> 13288 bytes .../build/Release/obj.target/cpp_addon/main.o | Bin 0 -> 4368 bytes .../node-addon/build/binding.Makefile | 6 + .../ssr-deps/node-addon/build/config.gypi | 351 ++++++++++++++++++ .../node-addon/build/cpp_addon.target.mk | 159 ++++++++ packages/vite/CHANGELOG.md | 14 + packages/vite/package.json | 2 +- 12 files changed, 880 insertions(+), 1 deletion(-) create mode 100644 packages/playground/ssr-deps/node-addon/build/Makefile create mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d create mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d create mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d create mode 100755 packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node create mode 100755 packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node create mode 100644 packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o create mode 100644 packages/playground/ssr-deps/node-addon/build/binding.Makefile create mode 100644 packages/playground/ssr-deps/node-addon/build/config.gypi create mode 100644 packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk diff --git a/packages/playground/ssr-deps/node-addon/build/Makefile b/packages/playground/ssr-deps/node-addon/build/Makefile new file mode 100644 index 00000000000000..83ce3f09d28c03 --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/Makefile @@ -0,0 +1,324 @@ +# We borrow heavily from the kernel build setup, though we are simpler since +# we don't have Kconfig tweaking settings on us. + +# The implicit make rules have it looking for RCS files, among other things. +# We instead explicitly write all the rules we care about. +# It's even quicker (saves ~200ms) to pass -r on the command line. +MAKEFLAGS=-r + +# The source directory tree. +srcdir := .. +abs_srcdir := $(abspath $(srcdir)) + +# The name of the builddir. +builddir_name ?= . + +# The V=1 flag on command line makes us verbosely print command lines. +ifdef V + quiet= +else + quiet=quiet_ +endif + +# Specify BUILDTYPE=Release on the command line for a release build. +BUILDTYPE ?= Release + +# Directory all our build output goes into. +# Note that this must be two directories beneath src/ for unit tests to pass, +# as they reach into the src/ directory for data with relative paths. +builddir ?= $(builddir_name)/$(BUILDTYPE) +abs_builddir := $(abspath $(builddir)) +depsdir := $(builddir)/.deps + +# Object output directory. +obj := $(builddir)/obj +abs_obj := $(abspath $(obj)) + +# We build up a list of every single one of the targets so we can slurp in the +# generated dependency rule Makefiles in one pass. +all_deps := + + + +CC.target ?= $(CC) +CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS) +CXX.target ?= $(CXX) +CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS) +LINK.target ?= $(LINK) +LDFLAGS.target ?= $(LDFLAGS) +AR.target ?= $(AR) + +# C++ apps need to be linked with g++. +LINK ?= $(CXX.target) + +# TODO(evan): move all cross-compilation logic to gyp-time so we don't need +# to replicate this environment fallback in make as well. +CC.host ?= gcc +CFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host) +CXX.host ?= g++ +CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host) +LINK.host ?= $(CXX.host) +LDFLAGS.host ?= $(LDFLAGS_host) +AR.host ?= ar + +# Define a dir function that can handle spaces. +# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions +# "leading spaces cannot appear in the text of the first argument as written. +# These characters can be put into the argument value by variable substitution." +empty := +space := $(empty) $(empty) + +# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces +replace_spaces = $(subst $(space),?,$1) +unreplace_spaces = $(subst ?,$(space),$1) +dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1))) + +# Flags to make gcc output dependency info. Note that you need to be +# careful here to use the flags that ccache and distcc can understand. +# We write to a dep file on the side first and then rename at the end +# so we can't end up with a broken dep file. +depfile = $(depsdir)/$(call replace_spaces,$@).d +DEPFLAGS = -MMD -MF $(depfile).raw + +# We have to fixup the deps output in a few ways. +# (1) the file output should mention the proper .o file. +# ccache or distcc lose the path to the target, so we convert a rule of +# the form: +# foobar.o: DEP1 DEP2 +# into +# path/to/foobar.o: DEP1 DEP2 +# (2) we want missing files not to cause us to fail to build. +# We want to rewrite +# foobar.o: DEP1 DEP2 \ +# DEP3 +# to +# DEP1: +# DEP2: +# DEP3: +# so if the files are missing, they're just considered phony rules. +# We have to do some pretty insane escaping to get those backslashes +# and dollar signs past make, the shell, and sed at the same time. +# Doesn't work with spaces, but that's fine: .d files have spaces in +# their names replaced with other characters. +define fixup_dep +# The depfile may not exist if the input file didn't have any #includes. +touch $(depfile).raw +# Fixup path as in (1). +sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef + +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c + +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@") + +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) + +quiet_cmd_alink_thin = AR($(TOOLSET)) $@ +cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) + +# Due to circular dependencies between libraries :(, we wrap the +# special "figure out circular dependencies" flags around the entire +# input list during linking. +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group + +# We support two kinds of shared objects (.so): +# 1) shared_library, which is just bundling together many dependent libraries +# into a link line. +# 2) loadable_module, which is generating a module intended for dlopen(). +# +# They differ only slightly: +# In the former case, we want to package all dependent code into the .so. +# In the latter case, we want to package just the API exposed by the +# outermost module. +# This means shared_library uses --whole-archive, while loadable_module doesn't. +# (Note that --whole-archive is incompatible with the --start-group used in +# normal linking.) + +# Other shared-object link notes: +# - Set SONAME to the library filename so our binaries don't reference +# the local, absolute paths used on the link command-line. +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) + + +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' + +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain ? instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds until one fails. +define do_postbuilds + @E=0;\ + for p in $(POSTBUILDS); do\ + eval $$p;\ + E=$$?;\ + if [ $$E -ne 0 ]; then\ + break;\ + fi;\ + done;\ + if [ $$E -ne 0 ]; then\ + rm -rf "$@";\ + exit $$E;\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains ? for +# spaces already and dirx strips the ? characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word 1,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "all" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: all +all: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +TOOLSET := target +# Suffix rules, putting all outputs into $(obj). +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + + +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,cpp_addon.target.mk)))),) + include cpp_addon.target.mk +endif + +quiet_cmd_regen_makefile = ACTION Regenerating $@ +cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/matias/.cache/node-gyp/16.9.1" "-Dnode_gyp_dir=/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp" "-Dnode_lib_file=/home/matias/.cache/node-gyp/16.9.1/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/matias/vite/packages/playground/ssr-deps/node-addon" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/matias/vite/packages/playground/ssr-deps/node-addon/build/config.gypi -I/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi -I/home/matias/.cache/node-gyp/16.9.1/include/node/common.gypi "--toplevel-dir=." binding.gyp +Makefile: $(srcdir)/../../../../../.cache/node-gyp/16.9.1/include/node/common.gypi $(srcdir)/../../../../../../../usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi $(srcdir)/binding.gyp $(srcdir)/build/config.gypi + $(call do_cmd,regen_makefile) + +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d new file mode 100644 index 00000000000000..4be797e6cbdf6e --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d @@ -0,0 +1 @@ +cmd_Release/cpp_addon.node := ln -f "Release/obj.target/cpp_addon.node" "Release/cpp_addon.node" 2>/dev/null || (rm -rf "Release/cpp_addon.node" && cp -af "Release/obj.target/cpp_addon.node" "Release/cpp_addon.node") diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d new file mode 100644 index 00000000000000..9f4d87550d1f0a --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d @@ -0,0 +1 @@ +cmd_Release/obj.target/cpp_addon.node := g++ -o Release/obj.target/cpp_addon.node -shared -pthread -rdynamic -m64 -Wl,-soname=cpp_addon.node -Wl,--start-group Release/obj.target/cpp_addon/main.o -Wl,--end-group diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d new file mode 100644 index 00000000000000..2955b089117c85 --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d @@ -0,0 +1,23 @@ +cmd_Release/obj.target/cpp_addon/main.o := g++ -o Release/obj.target/cpp_addon/main.o ../main.cpp '-DNODE_GYP_MODULE_NAME=cpp_addon' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/home/matias/.cache/node-gyp/16.9.1/include/node -I/home/matias/.cache/node-gyp/16.9.1/src -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++14 -MMD -MF ./Release/.deps/Release/obj.target/cpp_addon/main.o.d.raw -c +Release/obj.target/cpp_addon/main.o: ../main.cpp \ + /home/matias/.cache/node-gyp/16.9.1/include/node/node.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/cppgc/common.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8-internal.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8-version.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8-platform.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/node_version.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8.h +../main.cpp: +/home/matias/.cache/node-gyp/16.9.1/include/node/node.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/cppgc/common.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8-internal.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8-version.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8-platform.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/node_version.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8.h: diff --git a/packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node b/packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node new file mode 100755 index 0000000000000000000000000000000000000000..67c3f500cb518bfb96782ef1aeab0acc72d09ef3 GIT binary patch literal 13288 zcmeHOeQX@X6`%7tiAn6(I3Y0!kOhSjC@en5Un!*c?3}X>7suqBkN{z`zFXTz?rx8} zy!*EDS5Iew5p2KN>Pg{Xe(hFl)Chfy0n#2+Jb?i-W4QFQPT7)?t8QI z_V)JfT0m;0N;lE@&HK%JZ{EC}o!yyzc_RkV9%!^6qKru#z&@74Z}D=@0+o2hrZpCRUQp6Q7WL|`u-facka&gY zyci16I!lbz0>$5)Xm``iLXIfPVi|hNj9@*vnzJRe-GUiW(z^}x(9aKAnuOq9(O;#w zG>Lc+6~p0UTMIV4@Y^}KkG=B1HDk4V)=zzP=VNDk*M0lz=B_6)*afyX!;j+s=&a;n zwY}4bT>`%r`1J;U{m%J!Q{VmJn_qlj@ztR>&fI(8vgc;rTmAMg-xW~+Ay>H!c*%t! z+X@}g*qqI;!8pp{YbwaE1IN)vcbTXl|6~RGAkHMW5#Wa_*hyBf^JUN}=l@?S$p5B- z{53GHa&~+b>~w=234ZRf7l5nWAn^U%{yMfGNky&i1J}&zS!;s@*TeX+9OUxrSvALB(P>^*TZ(ujOXOgOp#f^lTHno(gs!WY0q9#*E zfiQJoc()qSQ~FpmZR)Av-F-15p$}^#G2Ln_-=c;mG&G>aqW6Q~9llmYkHw7JjZ`eM z_twF-qup(-{h37Aj2ekPEfyQm!bb)YqsG8sNbT6K#WH#z5CA=t>>nN&(om|Pk4d_F}>L}Gds6zlwv~7K)A~ zG&7UJ$VLJ1Z39ozW-1dlja08bt{sgUDb)70hoTWZFggmc;DH>%uDA7(n{-`#C64=i zFicwvlnSx!qG8*YwVMRHLb^Gq#dU}0pen9<;bMrZvlXO^B^{;*Lq0xOdkTd*U^??z zP;|L=`0UGwv!e^A)viq197qou<~U3?Y{vT`d_)b8A5llOXpAL{h_1$sNG7JMH0xO` zIue%ChTO?iJ))T!sEwr4)~y6kBErJSq^d#$LA%LMF;L&&(AyX zi%A&hv%(+jbBzOU5%>zgoL50|;3AYPnTvu+3Od_U=N;Mg}6#eu_x zwabtLcP{Y<9JqLe17R{AwP~f`GqAYS8qVxgZw<_n~}%R=Vv*;5_t@H z{v_vXkjGHxpXB`C)&h?q&Y$4?pOMGV=BGISC*(1t`6TDxKpv-5{xIiXK^{Y!AL9JW z$YV(JJ)D0Dc?@N~mGeJF9z&RyINt{R=n3F?*{95Gp94h6zI7=7JP3@+jhl}1rp8S> z7=z|KG=tc(*HLWSd5|{y{pPt@h^ zzW^{ykxP{6CS@A@9%{j;z}YnBWj*$+@5_Z>9&@GNv=f@iM=vwzHe zmK%6o$-WZIo(pD|at8r8K5GWRom>OTPY32A%2vzWOouX~pSjb2m;aFeZog{BHcz~ltb!$5OLVca;OXMsKo6w6wRFwgyanP;NOv$1|f-3bW6X25ap z(E_#>P-b;g|LT@qjjQgfn_{cezl^B{*e9~IQU3x0FZH-D$~uWovz z=C+3A{$t+pmC#9G)qeQPt_PXps02RocV#Zu*RWjqy!Wx%nPs0_9z3?9W)3wJyjjtw zXW)lpnz}0@VmqBT$V%H3HQLR3lK0Ks5r@2vj5R-;DsBx6=74 zou}ey0v0^W#X@IpcMG1*?C5(Aoz>BIoJ%b=`+Rq!;OQ)MgW%~r7x%|lXfJ&B!jggf zqHu)HEFY~!)cWR&v{f96(wXBi;UAqfwxAFc0W&5^oTszYZegF!6X>jSJ(ptaggE3R zJSiL`KP910XQ9*|91C#&dxRjIJ#k)$vqizzi}t??-gyQqT=<_7`fl#-^qdIrauL{d zf__ZUPC@$x-7n~NzpQH(EVG_Q*B6^!O*Fjah)76$isKwvUr*A zy4?P17N7;iVaUrG?R*Lc4ECGYx5~<2Y_BiH^39Cam12AiS$oQ+=0 zfG9H`y=)yTH&4B6eaUxqwCCkn6i&<5x20P4-cm8jAoBQ~rw~v2Msx+>9_aT;;ZKiH zybfqNI~{aHUf5Z1UH4iTxTnl~*Z{c1 zZ599N1e~6A&XzkW;3$KCeTC!B9VPvpGd1(W`czc$luUSJtB8?ZtE^D#ItHtEtS$HAv?fKO|sDx z>6+|)*ZnkkEp zQ!Qbbx;&Q1$Rn9(EOJ9M!Z zGEeH0p(>9Vz+w&>lli?TrwpFDBi>NhSe|*D_oiN`NKlEpT#{PJPvuGeE`wT0w)5?e^HTvI|q9{(x?3b(H>eGJ9rcPm~(>n;!2VMHKFC$9hB{Rem z{ftYW_HRUE6j)(^`XzfaE`2)pAxh^VB<~*omxMme6WR|Fy_OUOrTItn387DJy7Ted zUHb0+pLXff{*vggT>2C@g1-k9+>+A#qC7^*(|5;<^oc$Xy12C=eS05;8$Bo_XK@9d z@Si~g&OOqneJ%YzhE69|^ z*?&oo=eAeEsI#UkE$*;b81S4EbA`wsT7U5VAm1$w>u>TJi#|*jPBdbF&VuIx<@C>f O+>(0FDGYVD{=Wc8x$V*b literal 0 HcmV?d00001 diff --git a/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node b/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node new file mode 100755 index 0000000000000000000000000000000000000000..67c3f500cb518bfb96782ef1aeab0acc72d09ef3 GIT binary patch literal 13288 zcmeHOeQX@X6`%7tiAn6(I3Y0!kOhSjC@en5Un!*c?3}X>7suqBkN{z`zFXTz?rx8} zy!*EDS5Iew5p2KN>Pg{Xe(hFl)Chfy0n#2+Jb?i-W4QFQPT7)?t8QI z_V)JfT0m;0N;lE@&HK%JZ{EC}o!yyzc_RkV9%!^6qKru#z&@74Z}D=@0+o2hrZpCRUQp6Q7WL|`u-facka&gY zyci16I!lbz0>$5)Xm``iLXIfPVi|hNj9@*vnzJRe-GUiW(z^}x(9aKAnuOq9(O;#w zG>Lc+6~p0UTMIV4@Y^}KkG=B1HDk4V)=zzP=VNDk*M0lz=B_6)*afyX!;j+s=&a;n zwY}4bT>`%r`1J;U{m%J!Q{VmJn_qlj@ztR>&fI(8vgc;rTmAMg-xW~+Ay>H!c*%t! z+X@}g*qqI;!8pp{YbwaE1IN)vcbTXl|6~RGAkHMW5#Wa_*hyBf^JUN}=l@?S$p5B- z{53GHa&~+b>~w=234ZRf7l5nWAn^U%{yMfGNky&i1J}&zS!;s@*TeX+9OUxrSvALB(P>^*TZ(ujOXOgOp#f^lTHno(gs!WY0q9#*E zfiQJoc()qSQ~FpmZR)Av-F-15p$}^#G2Ln_-=c;mG&G>aqW6Q~9llmYkHw7JjZ`eM z_twF-qup(-{h37Aj2ekPEfyQm!bb)YqsG8sNbT6K#WH#z5CA=t>>nN&(om|Pk4d_F}>L}Gds6zlwv~7K)A~ zG&7UJ$VLJ1Z39ozW-1dlja08bt{sgUDb)70hoTWZFggmc;DH>%uDA7(n{-`#C64=i zFicwvlnSx!qG8*YwVMRHLb^Gq#dU}0pen9<;bMrZvlXO^B^{;*Lq0xOdkTd*U^??z zP;|L=`0UGwv!e^A)viq197qou<~U3?Y{vT`d_)b8A5llOXpAL{h_1$sNG7JMH0xO` zIue%ChTO?iJ))T!sEwr4)~y6kBErJSq^d#$LA%LMF;L&&(AyX zi%A&hv%(+jbBzOU5%>zgoL50|;3AYPnTvu+3Od_U=N;Mg}6#eu_x zwabtLcP{Y<9JqLe17R{AwP~f`GqAYS8qVxgZw<_n~}%R=Vv*;5_t@H z{v_vXkjGHxpXB`C)&h?q&Y$4?pOMGV=BGISC*(1t`6TDxKpv-5{xIiXK^{Y!AL9JW z$YV(JJ)D0Dc?@N~mGeJF9z&RyINt{R=n3F?*{95Gp94h6zI7=7JP3@+jhl}1rp8S> z7=z|KG=tc(*HLWSd5|{y{pPt@h^ zzW^{ykxP{6CS@A@9%{j;z}YnBWj*$+@5_Z>9&@GNv=f@iM=vwzHe zmK%6o$-WZIo(pD|at8r8K5GWRom>OTPY32A%2vzWOouX~pSjb2m;aFeZog{BHcz~ltb!$5OLVca;OXMsKo6w6wRFwgyanP;NOv$1|f-3bW6X25ap z(E_#>P-b;g|LT@qjjQgfn_{cezl^B{*e9~IQU3x0FZH-D$~uWovz z=C+3A{$t+pmC#9G)qeQPt_PXps02RocV#Zu*RWjqy!Wx%nPs0_9z3?9W)3wJyjjtw zXW)lpnz}0@VmqBT$V%H3HQLR3lK0Ks5r@2vj5R-;DsBx6=74 zou}ey0v0^W#X@IpcMG1*?C5(Aoz>BIoJ%b=`+Rq!;OQ)MgW%~r7x%|lXfJ&B!jggf zqHu)HEFY~!)cWR&v{f96(wXBi;UAqfwxAFc0W&5^oTszYZegF!6X>jSJ(ptaggE3R zJSiL`KP910XQ9*|91C#&dxRjIJ#k)$vqizzi}t??-gyQqT=<_7`fl#-^qdIrauL{d zf__ZUPC@$x-7n~NzpQH(EVG_Q*B6^!O*Fjah)76$isKwvUr*A zy4?P17N7;iVaUrG?R*Lc4ECGYx5~<2Y_BiH^39Cam12AiS$oQ+=0 zfG9H`y=)yTH&4B6eaUxqwCCkn6i&<5x20P4-cm8jAoBQ~rw~v2Msx+>9_aT;;ZKiH zybfqNI~{aHUf5Z1UH4iTxTnl~*Z{c1 zZ599N1e~6A&XzkW;3$KCeTC!B9VPvpGd1(W`czc$luUSJtB8?ZtE^D#ItHtEtS$HAv?fKO|sDx z>6+|)*ZnkkEp zQ!Qbbx;&Q1$Rn9(EOJ9M!Z zGEeH0p(>9Vz+w&>lli?TrwpFDBi>NhSe|*D_oiN`NKlEpT#{PJPvuGeE`wT0w)5?e^HTvI|q9{(x?3b(H>eGJ9rcPm~(>n;!2VMHKFC$9hB{Rem z{ftYW_HRUE6j)(^`XzfaE`2)pAxh^VB<~*omxMme6WR|Fy_OUOrTItn387DJy7Ted zUHb0+pLXff{*vggT>2C@g1-k9+>+A#qC7^*(|5;<^oc$Xy12C=eS05;8$Bo_XK@9d z@Si~g&OOqneJ%YzhE69|^ z*?&oo=eAeEsI#UkE$*;b81S4EbA`wsT7U5VAm1$w>u>TJi#|*jPBdbF&VuIx<@C>f O+>(0FDGYVD{=Wc8x$V*b literal 0 HcmV?d00001 diff --git a/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o b/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o new file mode 100644 index 0000000000000000000000000000000000000000..088f7174574579a7049a29fc9c0372a4205fa7b7 GIT binary patch literal 4368 zcmbtWU2GIp6u#|3sr*(Dh#E|YFUCZYdd{7DwztDWwQ)Ai94$qx=8p zbAPnzwKaNeru8?R)h{e~TlHF-UW@7e$TofMTI;EatDD;6ESLtkHqs_dO>JsFkA~pi zznwUq7*C8PM$_}9%bAqF1l~JydTrINPIT>Si|PV*llJfG{#D(-9ys-X7S8zs&ocE} zXg4%HaqX`vOc~J9)yhMPk6=nSF@{M1e3Ktn8<>|0{>m{x7=! zJ-A8xOB^`A;Aya&fM3%Vb9zs(+-jdbZ{0kVcqK8Bcr{^Q5#9#Jf#*B5OWfklr}g}U z@fU$3t5|e8jyrBK_Y}+HfGNt}l3B2oY`M&!8D=i$*yxW0_U8cVP{xVh36%N?Nq-=9 zD4BerqjPMsYJ1g=ex*<8+S60zBlS&nKbdTg8wk~oPP-XqPNC^u2-=?m!cT4$R~uc82q9n2A-lM##Tqc;HBk0d@Uf& z63%l0>`7=%3}*w0lLCE=MQ0e3_!1rX8{}bKkFkw)os{Rea{v1G3OveFj7gV>aMTO^ zW~rWh?*S`9YZDx~d#3^Zbp!kdz|sF{=u!BYf&Lz}DF54G8c4REsozN0zX&xr=O z-vD21fZu9>FEzm1;AlqW#p>6G;aX=370+^w<%`5PneI1APOe(Cn37I*;h)NklWLca z*AKsnjvXHEo*wA#8m!t`ui)58vsj!ov*%Lwl#?3H7=7brv1)0W#*Cr#k%Nh}ab$2X zqm3G)iGyj)0B>l&FXOod`;4j%TdxhePHD`W8qh|-ygyZOil%32BZspvRC|CBa7Sm$ zmR1n<-Qxpl_o$P0vSv{$mAzSQ8fJP^cELmUeS89!v+u~{Su5-D_3+3PKWY3GVoChL@~q`GoNB6QtB|FVOmV|&(&AX{cq! z_z$JjfF@GP^corr69y)?KT|kkn_kt$dKUmt_rppmo?Fd&j(gC`o6`lyMQgP;Q^;A` z)D+Z$7jgtc?@!V)VYhg7)cY2$s*q-#21d)Z?WeSHv$^>I5&JWiH*A(HY2{!lc71s> z#P0L}dnHqHJ)BW_vh{7!G$V!K{a>)VK@qaTmep=!lTRfZie4~Gq>jfw|n)yU@0 z8B=DV$ZRKPi4$LcAn@Lx8yp@leoNlNuN{!5aS{aQH$x*lfglLtTc8pC9)cixazS_U+n4T4#PMy1Yem7@q99J+G&t_WKM>+$43rN3AFK!0M4}4? zF>I&Bct-Sy$?IWCWwzv*lhAu^(C0~Wt)i*mwZoL0>6uKKtW=odIygYOs;Dp|5+J7Q zRm%b@z)fkGu4~Q;fLj5ZDOsmff=iJpw&PjK(D2wE{?G`Xl{cnbc(TQU|7X_$_E@_W zIm0*(4W)>alFUUFoVs;5bw8I$T`n?Po z-Xr1s{}%Cy4-_smral8`RQy)_msD2T2%ZF z5nmU4jE^M=$FBf}@u^Ora*5-E41)KyETSy+eS8BZ36pteg}scS9_D^1urR$WfJ-3< zw0?pwf)bT~J|chIXR@dI<9foexo_GK(c?L!J;Zsk$H$bYh}T6N=v|@7aQ^5wMBy$j Oi}in8cNi#P`+otuZNl#W literal 0 HcmV?d00001 diff --git a/packages/playground/ssr-deps/node-addon/build/binding.Makefile b/packages/playground/ssr-deps/node-addon/build/binding.Makefile new file mode 100644 index 00000000000000..9521a57df40291 --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/binding.Makefile @@ -0,0 +1,6 @@ +# This file is generated by gyp; do not edit. + +export builddir_name ?= ./build/. +.PHONY: all +all: + $(MAKE) cpp_addon diff --git a/packages/playground/ssr-deps/node-addon/build/config.gypi b/packages/playground/ssr-deps/node-addon/build/config.gypi new file mode 100644 index 00000000000000..815e24a35e5c83 --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/config.gypi @@ -0,0 +1,351 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "asan": 0, + "coverage": "false", + "dcheck_always_on": 0, + "debug_nghttp2": "false", + "debug_node": "false", + "enable_lto": "false", + "enable_pgo_generate": "false", + "enable_pgo_use": "false", + "error_on_warn": "false", + "force_dynamic_crt": 0, + "gas_version": "2.30", + "host_arch": "x64", + "icu_data_in": "../../deps/icu-tmp/icudt69l.dat", + "icu_endianness": "l", + "icu_gyp_path": "tools/icu/icu-generic.gyp", + "icu_path": "deps/icu-small", + "icu_small": "false", + "icu_ver_major": "69", + "is_debug": 0, + "llvm_version": "0.0", + "napi_build_version": "8", + "node_byteorder": "little", + "node_debug_lib": "false", + "node_enable_d8": "false", + "node_install_npm": "true", + "node_library_files": [ + "lib/diagnostics_channel.js", + "lib/path.js", + "lib/punycode.js", + "lib/tty.js", + "lib/_stream_wrap.js", + "lib/querystring.js", + "lib/_tls_common.js", + "lib/_tls_wrap.js", + "lib/assert.js", + "lib/async_hooks.js", + "lib/child_process.js", + "lib/cluster.js", + "lib/dns.js", + "lib/util.js", + "lib/vm.js", + "lib/worker_threads.js", + "lib/url.js", + "lib/buffer.js", + "lib/wasi.js", + "lib/process.js", + "lib/console.js", + "lib/constants.js", + "lib/events.js", + "lib/fs.js", + "lib/_stream_duplex.js", + "lib/module.js", + "lib/domain.js", + "lib/zlib.js", + "lib/_http_client.js", + "lib/_http_server.js", + "lib/_stream_writable.js", + "lib/http.js", + "lib/https.js", + "lib/inspector.js", + "lib/trace_events.js", + "lib/_http_incoming.js", + "lib/http2.js", + "lib/os.js", + "lib/string_decoder.js", + "lib/_stream_passthrough.js", + "lib/_stream_readable.js", + "lib/_stream_transform.js", + "lib/crypto.js", + "lib/timers.js", + "lib/repl.js", + "lib/_http_agent.js", + "lib/_http_common.js", + "lib/_http_outgoing.js", + "lib/net.js", + "lib/perf_hooks.js", + "lib/readline.js", + "lib/v8.js", + "lib/sys.js", + "lib/tls.js", + "lib/stream.js", + "lib/dgram.js", + "lib/dns/promises.js", + "lib/stream/consumers.js", + "lib/stream/promises.js", + "lib/stream/web.js", + "lib/assert/strict.js", + "lib/internal/async_hooks.js", + "lib/internal/heap_utils.js", + "lib/internal/blob.js", + "lib/internal/freeze_intrinsics.js", + "lib/internal/inspector_async_hook.js", + "lib/internal/linkedlist.js", + "lib/internal/js_stream_socket.js", + "lib/internal/url.js", + "lib/internal/socketaddress.js", + "lib/internal/util.js", + "lib/internal/options.js", + "lib/internal/repl.js", + "lib/internal/child_process.js", + "lib/internal/errors.js", + "lib/internal/event_target.js", + "lib/internal/v8_prof_polyfill.js", + "lib/internal/v8_prof_processor.js", + "lib/internal/validators.js", + "lib/internal/buffer.js", + "lib/internal/encoding.js", + "lib/internal/watchdog.js", + "lib/internal/trace_events_async_hooks.js", + "lib/internal/constants.js", + "lib/internal/abort_controller.js", + "lib/internal/blocklist.js", + "lib/internal/querystring.js", + "lib/internal/net.js", + "lib/internal/cli_table.js", + "lib/internal/fixed_queue.js", + "lib/internal/priority_queue.js", + "lib/internal/tty.js", + "lib/internal/assert.js", + "lib/internal/timers.js", + "lib/internal/socket_list.js", + "lib/internal/error_serdes.js", + "lib/internal/freelist.js", + "lib/internal/dgram.js", + "lib/internal/histogram.js", + "lib/internal/http.js", + "lib/internal/idna.js", + "lib/internal/worker.js", + "lib/internal/dtrace.js", + "lib/internal/stream_base_commons.js", + "lib/internal/bootstrap/environment.js", + "lib/internal/bootstrap/loaders.js", + "lib/internal/bootstrap/pre_execution.js", + "lib/internal/bootstrap/node.js", + "lib/internal/bootstrap/switches/does_not_own_process_state.js", + "lib/internal/bootstrap/switches/is_not_main_thread.js", + "lib/internal/bootstrap/switches/does_own_process_state.js", + "lib/internal/bootstrap/switches/is_main_thread.js", + "lib/internal/debugger/inspect_repl.js", + "lib/internal/debugger/inspect.js", + "lib/internal/debugger/inspect_client.js", + "lib/internal/cluster/shared_handle.js", + "lib/internal/cluster/child.js", + "lib/internal/cluster/primary.js", + "lib/internal/cluster/round_robin_handle.js", + "lib/internal/cluster/utils.js", + "lib/internal/cluster/worker.js", + "lib/internal/crypto/aes.js", + "lib/internal/crypto/certificate.js", + "lib/internal/crypto/cipher.js", + "lib/internal/crypto/diffiehellman.js", + "lib/internal/crypto/hash.js", + "lib/internal/crypto/hashnames.js", + "lib/internal/crypto/hkdf.js", + "lib/internal/crypto/keys.js", + "lib/internal/crypto/mac.js", + "lib/internal/crypto/pbkdf2.js", + "lib/internal/crypto/random.js", + "lib/internal/crypto/scrypt.js", + "lib/internal/crypto/sig.js", + "lib/internal/crypto/util.js", + "lib/internal/crypto/webcrypto.js", + "lib/internal/crypto/x509.js", + "lib/internal/crypto/dsa.js", + "lib/internal/crypto/ec.js", + "lib/internal/crypto/keygen.js", + "lib/internal/crypto/rsa.js", + "lib/internal/dns/promises.js", + "lib/internal/dns/utils.js", + "lib/internal/fs/dir.js", + "lib/internal/fs/read_file_context.js", + "lib/internal/fs/streams.js", + "lib/internal/fs/sync_write_stream.js", + "lib/internal/fs/utils.js", + "lib/internal/fs/watchers.js", + "lib/internal/fs/promises.js", + "lib/internal/fs/rimraf.js", + "lib/internal/fs/cp/cp-sync.js", + "lib/internal/fs/cp/cp.js", + "lib/internal/http2/compat.js", + "lib/internal/http2/util.js", + "lib/internal/http2/core.js", + "lib/internal/modules/package_json_reader.js", + "lib/internal/modules/run_main.js", + "lib/internal/modules/cjs/loader.js", + "lib/internal/modules/cjs/helpers.js", + "lib/internal/modules/esm/loader.js", + "lib/internal/modules/esm/transform_source.js", + "lib/internal/modules/esm/module_job.js", + "lib/internal/modules/esm/module_map.js", + "lib/internal/modules/esm/resolve.js", + "lib/internal/modules/esm/translators.js", + "lib/internal/modules/esm/get_format.js", + "lib/internal/modules/esm/create_dynamic_module.js", + "lib/internal/modules/esm/get_source.js", + "lib/internal/legacy/processbinding.js", + "lib/internal/process/policy.js", + "lib/internal/process/worker_thread_only.js", + "lib/internal/process/esm_loader.js", + "lib/internal/process/execution.js", + "lib/internal/process/per_thread.js", + "lib/internal/process/promises.js", + "lib/internal/process/report.js", + "lib/internal/process/signal.js", + "lib/internal/process/task_queues.js", + "lib/internal/process/warning.js", + "lib/internal/repl/history.js", + "lib/internal/repl/utils.js", + "lib/internal/repl/await.js", + "lib/internal/streams/legacy.js", + "lib/internal/streams/passthrough.js", + "lib/internal/streams/buffer_list.js", + "lib/internal/streams/from.js", + "lib/internal/streams/lazy_transform.js", + "lib/internal/streams/state.js", + "lib/internal/streams/transform.js", + "lib/internal/streams/add-abort-signal.js", + "lib/internal/streams/compose.js", + "lib/internal/streams/destroy.js", + "lib/internal/streams/duplex.js", + "lib/internal/streams/duplexify.js", + "lib/internal/streams/end-of-stream.js", + "lib/internal/streams/pipeline.js", + "lib/internal/streams/readable.js", + "lib/internal/streams/utils.js", + "lib/internal/streams/writable.js", + "lib/internal/test/binding.js", + "lib/internal/test/transfer.js", + "lib/internal/util/comparisons.js", + "lib/internal/util/debuglog.js", + "lib/internal/util/inspect.js", + "lib/internal/util/inspector.js", + "lib/internal/util/iterable_weak_map.js", + "lib/internal/util/types.js", + "lib/internal/main/check_syntax.js", + "lib/internal/main/eval_stdin.js", + "lib/internal/main/prof_process.js", + "lib/internal/main/run_main_module.js", + "lib/internal/main/print_help.js", + "lib/internal/main/repl.js", + "lib/internal/main/inspect.js", + "lib/internal/main/worker_thread.js", + "lib/internal/main/eval_string.js", + "lib/internal/tls/parse-cert-string.js", + "lib/internal/tls/secure-context.js", + "lib/internal/tls/secure-pair.js", + "lib/internal/vm/module.js", + "lib/internal/child_process/serialization.js", + "lib/internal/per_context/domexception.js", + "lib/internal/per_context/messageport.js", + "lib/internal/per_context/primordials.js", + "lib/internal/worker/io.js", + "lib/internal/worker/js_transferable.js", + "lib/internal/assert/calltracker.js", + "lib/internal/assert/assertion_error.js", + "lib/internal/perf/event_loop_delay.js", + "lib/internal/perf/event_loop_utilization.js", + "lib/internal/perf/nodetiming.js", + "lib/internal/perf/observe.js", + "lib/internal/perf/performance.js", + "lib/internal/perf/performance_entry.js", + "lib/internal/perf/timerify.js", + "lib/internal/perf/usertiming.js", + "lib/internal/perf/utils.js", + "lib/internal/webstreams/encoding.js", + "lib/internal/webstreams/queuingstrategies.js", + "lib/internal/webstreams/readablestream.js", + "lib/internal/webstreams/transfer.js", + "lib/internal/webstreams/transformstream.js", + "lib/internal/webstreams/util.js", + "lib/internal/webstreams/writablestream.js", + "lib/internal/source_map/source_map.js", + "lib/internal/source_map/source_map_cache.js", + "lib/internal/source_map/prepare_stack_trace.js", + "lib/internal/console/global.js", + "lib/internal/console/constructor.js", + "lib/internal/readline/utils.js", + "lib/internal/readline/callbacks.js", + "lib/internal/readline/emitKeypressEvents.js", + "lib/internal/policy/manifest.js", + "lib/internal/policy/sri.js", + "lib/fs/promises.js", + "lib/util/types.js", + "lib/path/posix.js", + "lib/path/win32.js", + "lib/timers/promises.js" + ], + "node_module_version": 93, + "node_no_browser_globals": "false", + "node_prefix": "/", + "node_release_urlbase": "https://nodejs.org/download/release/", + "node_section_ordering_info": "", + "node_shared": "false", + "node_shared_brotli": "false", + "node_shared_cares": "false", + "node_shared_http_parser": "false", + "node_shared_libuv": "false", + "node_shared_nghttp2": "false", + "node_shared_nghttp3": "false", + "node_shared_ngtcp2": "false", + "node_shared_openssl": "false", + "node_shared_zlib": "false", + "node_tag": "", + "node_target_type": "executable", + "node_use_bundled_v8": "true", + "node_use_dtrace": "false", + "node_use_etw": "false", + "node_use_node_code_cache": "true", + "node_use_node_snapshot": "true", + "node_use_openssl": "true", + "node_use_v8_platform": "true", + "node_with_ltcg": "false", + "node_without_node_options": "false", + "openssl_fips": "", + "openssl_is_fips": "false", + "openssl_quic": "true", + "ossfuzz": "false", + "shlib_suffix": "so.93", + "target_arch": "x64", + "v8_enable_31bit_smis_on_64bit_arch": 0, + "v8_enable_gdbjit": 0, + "v8_enable_i18n_support": 1, + "v8_enable_inspector": 1, + "v8_enable_lite_mode": 0, + "v8_enable_object_print": 1, + "v8_enable_pointer_compression": 0, + "v8_enable_webassembly": 1, + "v8_no_strict_aliasing": 1, + "v8_optimized_debug": 1, + "v8_promise_internal_field_count": 1, + "v8_random_seed": 0, + "v8_trace_maps": 0, + "v8_use_siphash": 1, + "want_separate_host_toolset": 0, + "nodedir": "/home/matias/.cache/node-gyp/16.9.1", + "standalone_static_library": 1, + "user_agent": "pnpm/6.21.0 npm/? node/v16.9.1 linux x64", + "registry": "https://registry.npmjs.org/", + "node_gyp": "/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" + } +} diff --git a/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk b/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk new file mode 100644 index 00000000000000..4a2de286352df8 --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk @@ -0,0 +1,159 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := cpp_addon +DEFS_Debug := \ + '-DNODE_GYP_MODULE_NAME=cpp_addon' \ + '-DUSING_UV_SHARED=1' \ + '-DUSING_V8_SHARED=1' \ + '-DV8_DEPRECATION_WARNINGS=1' \ + '-DV8_DEPRECATION_WARNINGS' \ + '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ + '-D_GLIBCXX_USE_CXX11_ABI=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-D__STDC_FORMAT_MACROS' \ + '-DOPENSSL_NO_PINSHARED' \ + '-DOPENSSL_THREADS' \ + '-DBUILDING_NODE_EXTENSION' \ + '-DDEBUG' \ + '-D_DEBUG' \ + '-DV8_ENABLE_CHECKS' + +# Flags passed to all source files. +CFLAGS_Debug := \ + -fPIC \ + -pthread \ + -Wall \ + -Wextra \ + -Wno-unused-parameter \ + -m64 \ + -g \ + -O0 + +# Flags passed to only C files. +CFLAGS_C_Debug := + +# Flags passed to only C++ files. +CFLAGS_CC_Debug := \ + -fno-rtti \ + -fno-exceptions \ + -std=gnu++14 + +INCS_Debug := \ + -I/home/matias/.cache/node-gyp/16.9.1/include/node \ + -I/home/matias/.cache/node-gyp/16.9.1/src \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include + +DEFS_Release := \ + '-DNODE_GYP_MODULE_NAME=cpp_addon' \ + '-DUSING_UV_SHARED=1' \ + '-DUSING_V8_SHARED=1' \ + '-DV8_DEPRECATION_WARNINGS=1' \ + '-DV8_DEPRECATION_WARNINGS' \ + '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ + '-D_GLIBCXX_USE_CXX11_ABI=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-D__STDC_FORMAT_MACROS' \ + '-DOPENSSL_NO_PINSHARED' \ + '-DOPENSSL_THREADS' \ + '-DBUILDING_NODE_EXTENSION' + +# Flags passed to all source files. +CFLAGS_Release := \ + -fPIC \ + -pthread \ + -Wall \ + -Wextra \ + -Wno-unused-parameter \ + -m64 \ + -O3 \ + -fno-omit-frame-pointer + +# Flags passed to only C files. +CFLAGS_C_Release := + +# Flags passed to only C++ files. +CFLAGS_CC_Release := \ + -fno-rtti \ + -fno-exceptions \ + -std=gnu++14 + +INCS_Release := \ + -I/home/matias/.cache/node-gyp/16.9.1/include/node \ + -I/home/matias/.cache/node-gyp/16.9.1/src \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include + +OBJS := \ + $(obj).target/$(TARGET)/main.o + +# Add to the list of files we specially track dependencies for. +all_deps += $(OBJS) + +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual. +$(OBJS): TOOLSET := $(TOOLSET) +$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) +$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) + +# Suffix rules, putting all outputs into $(obj). + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# Try building from generated source, too. + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# End of this set of suffix rules +### Rules for final target. +LDFLAGS_Debug := \ + -pthread \ + -rdynamic \ + -m64 + +LDFLAGS_Release := \ + -pthread \ + -rdynamic \ + -m64 + +LIBS := + +$(obj).target/cpp_addon.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) +$(obj).target/cpp_addon.node: LIBS := $(LIBS) +$(obj).target/cpp_addon.node: TOOLSET := $(TOOLSET) +$(obj).target/cpp_addon.node: $(OBJS) FORCE_DO_CMD + $(call do_cmd,solink_module) + +all_deps += $(obj).target/cpp_addon.node +# Add target alias +.PHONY: cpp_addon +cpp_addon: $(builddir)/cpp_addon.node + +# Copy this to the executable output path. +$(builddir)/cpp_addon.node: TOOLSET := $(TOOLSET) +$(builddir)/cpp_addon.node: $(obj).target/cpp_addon.node FORCE_DO_CMD + $(call do_cmd,copy) + +all_deps += $(builddir)/cpp_addon.node +# Short alias for building this executable. +.PHONY: cpp_addon.node +cpp_addon.node: $(obj).target/cpp_addon.node $(builddir)/cpp_addon.node + +# Add executable to "all" target. +.PHONY: all +all: $(builddir)/cpp_addon.node + diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index d52439248ce9bc..acaad87b075002 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,17 @@ +# [2.7.0-beta.10](https://github.com/vitejs/vite/compare/v2.7.0-beta.9...v2.7.0-beta.10) (2021-12-02) + + +### Bug Fixes + +* invalidate inlined proxy scripts on change ([#5891](https://github.com/vitejs/vite/issues/5891)) ([5b8c58b](https://github.com/vitejs/vite/commit/5b8c58bf9d2fe141cea9bde9492ccbedf9b76213)) +* read the correct package.json in ssrExternal ([#5927](https://github.com/vitejs/vite/issues/5927)) ([7edabb4](https://github.com/vitejs/vite/commit/7edabb46de3ce63e078e0cda7cd3ed9e5cdd0f2a)), closes [#5890](https://github.com/vitejs/vite/issues/5890) +* **resolve:** dont overwrite `isRequire` from `baseOptions` ([#5872](https://github.com/vitejs/vite/issues/5872)) ([2b91e5a](https://github.com/vitejs/vite/commit/2b91e5aadaee0947eb9864367ae85762573a8dc4)) +* **scan:** handle local scripts with lang=ts ([#5850](https://github.com/vitejs/vite/issues/5850)) ([7ed8702](https://github.com/vitejs/vite/commit/7ed870273206b5e9dcedda6f0149b7b3324dea45)) +* SSR import in dev can't resolve default import (fix [#5706](https://github.com/vitejs/vite/issues/5706)) ([#5923](https://github.com/vitejs/vite/issues/5923)) ([21d79d7](https://github.com/vitejs/vite/commit/21d79d753af145f2c7ebb7dd5b0b1a4a298f96c5)) +* **ssr:** skip dedupe require if noExternal true ([#5928](https://github.com/vitejs/vite/issues/5928)) ([f6aa7fe](https://github.com/vitejs/vite/commit/f6aa7fe401737ef584ccf34b6042a32b8e5e8c5d)) + + + # [2.7.0-beta.9](https://github.com/vitejs/vite/compare/v2.7.0-beta.8...v2.7.0-beta.9) (2021-11-27) diff --git a/packages/vite/package.json b/packages/vite/package.json index efb6ed33c4986f..25a678fba08b84 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.7.0-beta.9", + "version": "2.7.0-beta.10", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From fb12992988940bf278fce5444f9b908b848560b0 Mon Sep 17 00:00:00 2001 From: ygj6 <7699524+ygj6@users.noreply.github.com> Date: Fri, 3 Dec 2021 17:42:20 +0800 Subject: [PATCH 0029/1287] chore: git ignores the compilation output dir (#5951) --- .gitignore | 3 +- .../ssr-deps/node-addon/build/Makefile | 324 ---------------- .../Release/.deps/Release/cpp_addon.node.d | 1 - .../.deps/Release/obj.target/cpp_addon.node.d | 1 - .../Release/obj.target/cpp_addon/main.o.d | 23 -- .../node-addon/build/Release/cpp_addon.node | Bin 13288 -> 0 bytes .../build/Release/obj.target/cpp_addon.node | Bin 13288 -> 0 bytes .../build/Release/obj.target/cpp_addon/main.o | Bin 4368 -> 0 bytes .../node-addon/build/binding.Makefile | 6 - .../ssr-deps/node-addon/build/config.gypi | 351 ------------------ .../node-addon/build/cpp_addon.target.mk | 159 -------- 11 files changed, 2 insertions(+), 866 deletions(-) delete mode 100644 packages/playground/ssr-deps/node-addon/build/Makefile delete mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d delete mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d delete mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d delete mode 100755 packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node delete mode 100755 packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node delete mode 100644 packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o delete mode 100644 packages/playground/ssr-deps/node-addon/build/binding.Makefile delete mode 100644 packages/playground/ssr-deps/node-addon/build/config.gypi delete mode 100644 packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk diff --git a/.gitignore b/.gitignore index 57d35eff1d78b7..200acefca621e6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ explorations *.local /packages/vite/LICENSE *.cpuprofile -/.vscode/ \ No newline at end of file +/.vscode/ +/packages/playground/ssr-deps/node-addon/build/ diff --git a/packages/playground/ssr-deps/node-addon/build/Makefile b/packages/playground/ssr-deps/node-addon/build/Makefile deleted file mode 100644 index 83ce3f09d28c03..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/Makefile +++ /dev/null @@ -1,324 +0,0 @@ -# We borrow heavily from the kernel build setup, though we are simpler since -# we don't have Kconfig tweaking settings on us. - -# The implicit make rules have it looking for RCS files, among other things. -# We instead explicitly write all the rules we care about. -# It's even quicker (saves ~200ms) to pass -r on the command line. -MAKEFLAGS=-r - -# The source directory tree. -srcdir := .. -abs_srcdir := $(abspath $(srcdir)) - -# The name of the builddir. -builddir_name ?= . - -# The V=1 flag on command line makes us verbosely print command lines. -ifdef V - quiet= -else - quiet=quiet_ -endif - -# Specify BUILDTYPE=Release on the command line for a release build. -BUILDTYPE ?= Release - -# Directory all our build output goes into. -# Note that this must be two directories beneath src/ for unit tests to pass, -# as they reach into the src/ directory for data with relative paths. -builddir ?= $(builddir_name)/$(BUILDTYPE) -abs_builddir := $(abspath $(builddir)) -depsdir := $(builddir)/.deps - -# Object output directory. -obj := $(builddir)/obj -abs_obj := $(abspath $(obj)) - -# We build up a list of every single one of the targets so we can slurp in the -# generated dependency rule Makefiles in one pass. -all_deps := - - - -CC.target ?= $(CC) -CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS) -CXX.target ?= $(CXX) -CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS) -LINK.target ?= $(LINK) -LDFLAGS.target ?= $(LDFLAGS) -AR.target ?= $(AR) - -# C++ apps need to be linked with g++. -LINK ?= $(CXX.target) - -# TODO(evan): move all cross-compilation logic to gyp-time so we don't need -# to replicate this environment fallback in make as well. -CC.host ?= gcc -CFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host) -CXX.host ?= g++ -CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host) -LINK.host ?= $(CXX.host) -LDFLAGS.host ?= $(LDFLAGS_host) -AR.host ?= ar - -# Define a dir function that can handle spaces. -# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions -# "leading spaces cannot appear in the text of the first argument as written. -# These characters can be put into the argument value by variable substitution." -empty := -space := $(empty) $(empty) - -# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces -replace_spaces = $(subst $(space),?,$1) -unreplace_spaces = $(subst ?,$(space),$1) -dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1))) - -# Flags to make gcc output dependency info. Note that you need to be -# careful here to use the flags that ccache and distcc can understand. -# We write to a dep file on the side first and then rename at the end -# so we can't end up with a broken dep file. -depfile = $(depsdir)/$(call replace_spaces,$@).d -DEPFLAGS = -MMD -MF $(depfile).raw - -# We have to fixup the deps output in a few ways. -# (1) the file output should mention the proper .o file. -# ccache or distcc lose the path to the target, so we convert a rule of -# the form: -# foobar.o: DEP1 DEP2 -# into -# path/to/foobar.o: DEP1 DEP2 -# (2) we want missing files not to cause us to fail to build. -# We want to rewrite -# foobar.o: DEP1 DEP2 \ -# DEP3 -# to -# DEP1: -# DEP2: -# DEP3: -# so if the files are missing, they're just considered phony rules. -# We have to do some pretty insane escaping to get those backslashes -# and dollar signs past make, the shell, and sed at the same time. -# Doesn't work with spaces, but that's fine: .d files have spaces in -# their names replaced with other characters. -define fixup_dep -# The depfile may not exist if the input file didn't have any #includes. -touch $(depfile).raw -# Fixup path as in (1). -sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile) -# Add extra rules as in (2). -# We remove slashes and replace spaces with new lines; -# remove blank lines; -# delete the first line and append a colon to the remaining lines. -sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ - grep -v '^$$' |\ - sed -e 1d -e 's|$$|:|' \ - >> $(depfile) -rm $(depfile).raw -endef - -# Command definitions: -# - cmd_foo is the actual command to run; -# - quiet_cmd_foo is the brief-output summary of the command. - -quiet_cmd_cc = CC($(TOOLSET)) $@ -cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c - -quiet_cmd_cxx = CXX($(TOOLSET)) $@ -cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c - -quiet_cmd_touch = TOUCH $@ -cmd_touch = touch $@ - -quiet_cmd_copy = COPY $@ -# send stderr to /dev/null to ignore messages when linking directories. -cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@") - -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) - -# Due to circular dependencies between libraries :(, we wrap the -# special "figure out circular dependencies" flags around the entire -# input list during linking. -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group - -# We support two kinds of shared objects (.so): -# 1) shared_library, which is just bundling together many dependent libraries -# into a link line. -# 2) loadable_module, which is generating a module intended for dlopen(). -# -# They differ only slightly: -# In the former case, we want to package all dependent code into the .so. -# In the latter case, we want to package just the API exposed by the -# outermost module. -# This means shared_library uses --whole-archive, while loadable_module doesn't. -# (Note that --whole-archive is incompatible with the --start-group used in -# normal linking.) - -# Other shared-object link notes: -# - Set SONAME to the library filename so our binaries don't reference -# the local, absolute paths used on the link command-line. -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) - - -# Define an escape_quotes function to escape single quotes. -# This allows us to handle quotes properly as long as we always use -# use single quotes and escape_quotes. -escape_quotes = $(subst ','\'',$(1)) -# This comment is here just to include a ' to unconfuse syntax highlighting. -# Define an escape_vars function to escape '$' variable syntax. -# This allows us to read/write command lines with shell variables (e.g. -# $LD_LIBRARY_PATH), without triggering make substitution. -escape_vars = $(subst $$,$$$$,$(1)) -# Helper that expands to a shell command to echo a string exactly as it is in -# make. This uses printf instead of echo because printf's behaviour with respect -# to escape sequences is more portable than echo's across different shells -# (e.g., dash, bash). -exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' - -# Helper to compare the command we're about to run against the command -# we logged the last time we ran the command. Produces an empty -# string (false) when the commands match. -# Tricky point: Make has no string-equality test function. -# The kernel uses the following, but it seems like it would have false -# positives, where one string reordered its arguments. -# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ -# $(filter-out $(cmd_$@), $(cmd_$(1)))) -# We instead substitute each for the empty string into the other, and -# say they're equal if both substitutions produce the empty string. -# .d files contain ? instead of spaces, take that into account. -command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ - $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) - -# Helper that is non-empty when a prerequisite changes. -# Normally make does this implicitly, but we force rules to always run -# so we can check their command lines. -# $? -- new prerequisites -# $| -- order-only dependencies -prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) - -# Helper that executes all postbuilds until one fails. -define do_postbuilds - @E=0;\ - for p in $(POSTBUILDS); do\ - eval $$p;\ - E=$$?;\ - if [ $$E -ne 0 ]; then\ - break;\ - fi;\ - done;\ - if [ $$E -ne 0 ]; then\ - rm -rf "$@";\ - exit $$E;\ - fi -endef - -# do_cmd: run a command via the above cmd_foo names, if necessary. -# Should always run for a given target to handle command-line changes. -# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. -# Third argument, if non-zero, makes it do POSTBUILDS processing. -# Note: We intentionally do NOT call dirx for depfile, since it contains ? for -# spaces already and dirx strips the ? characters. -define do_cmd -$(if $(or $(command_changed),$(prereq_changed)), - @$(call exact_echo, $($(quiet)cmd_$(1))) - @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" - $(if $(findstring flock,$(word 1,$(cmd_$1))), - @$(cmd_$(1)) - @echo " $(quiet_cmd_$(1)): Finished", - @$(cmd_$(1)) - ) - @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) - @$(if $(2),$(fixup_dep)) - $(if $(and $(3), $(POSTBUILDS)), - $(call do_postbuilds) - ) -) -endef - -# Declare the "all" target first so it is the default, -# even though we don't have the deps yet. -.PHONY: all -all: - -# make looks for ways to re-generate included makefiles, but in our case, we -# don't have a direct way. Explicitly telling make that it has nothing to do -# for them makes it go faster. -%.d: ; - -# Use FORCE_DO_CMD to force a target to run. Should be coupled with -# do_cmd. -.PHONY: FORCE_DO_CMD -FORCE_DO_CMD: - -TOOLSET := target -# Suffix rules, putting all outputs into $(obj). -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) - -# Try building from generated source, too. -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) - -$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) - - -ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ - $(findstring $(join ^,$(prefix)),\ - $(join ^,cpp_addon.target.mk)))),) - include cpp_addon.target.mk -endif - -quiet_cmd_regen_makefile = ACTION Regenerating $@ -cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/matias/.cache/node-gyp/16.9.1" "-Dnode_gyp_dir=/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp" "-Dnode_lib_file=/home/matias/.cache/node-gyp/16.9.1/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/matias/vite/packages/playground/ssr-deps/node-addon" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/matias/vite/packages/playground/ssr-deps/node-addon/build/config.gypi -I/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi -I/home/matias/.cache/node-gyp/16.9.1/include/node/common.gypi "--toplevel-dir=." binding.gyp -Makefile: $(srcdir)/../../../../../.cache/node-gyp/16.9.1/include/node/common.gypi $(srcdir)/../../../../../../../usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi $(srcdir)/binding.gyp $(srcdir)/build/config.gypi - $(call do_cmd,regen_makefile) - -# "all" is a concatenation of the "all" targets from all the included -# sub-makefiles. This is just here to clarify. -all: - -# Add in dependency-tracking rules. $(all_deps) is the list of every single -# target in our tree. Only consider the ones with .d (dependency) info: -d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) -ifneq ($(d_files),) - include $(d_files) -endif diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d deleted file mode 100644 index 4be797e6cbdf6e..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/cpp_addon.node := ln -f "Release/obj.target/cpp_addon.node" "Release/cpp_addon.node" 2>/dev/null || (rm -rf "Release/cpp_addon.node" && cp -af "Release/obj.target/cpp_addon.node" "Release/cpp_addon.node") diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d deleted file mode 100644 index 9f4d87550d1f0a..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/obj.target/cpp_addon.node := g++ -o Release/obj.target/cpp_addon.node -shared -pthread -rdynamic -m64 -Wl,-soname=cpp_addon.node -Wl,--start-group Release/obj.target/cpp_addon/main.o -Wl,--end-group diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d deleted file mode 100644 index 2955b089117c85..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d +++ /dev/null @@ -1,23 +0,0 @@ -cmd_Release/obj.target/cpp_addon/main.o := g++ -o Release/obj.target/cpp_addon/main.o ../main.cpp '-DNODE_GYP_MODULE_NAME=cpp_addon' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/home/matias/.cache/node-gyp/16.9.1/include/node -I/home/matias/.cache/node-gyp/16.9.1/src -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++14 -MMD -MF ./Release/.deps/Release/obj.target/cpp_addon/main.o.d.raw -c -Release/obj.target/cpp_addon/main.o: ../main.cpp \ - /home/matias/.cache/node-gyp/16.9.1/include/node/node.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/cppgc/common.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8-internal.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8-version.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8-platform.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/node_version.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8.h -../main.cpp: -/home/matias/.cache/node-gyp/16.9.1/include/node/node.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/cppgc/common.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8-internal.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8-version.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8-platform.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/node_version.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8.h: diff --git a/packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node b/packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node deleted file mode 100755 index 67c3f500cb518bfb96782ef1aeab0acc72d09ef3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13288 zcmeHOeQX@X6`%7tiAn6(I3Y0!kOhSjC@en5Un!*c?3}X>7suqBkN{z`zFXTz?rx8} zy!*EDS5Iew5p2KN>Pg{Xe(hFl)Chfy0n#2+Jb?i-W4QFQPT7)?t8QI z_V)JfT0m;0N;lE@&HK%JZ{EC}o!yyzc_RkV9%!^6qKru#z&@74Z}D=@0+o2hrZpCRUQp6Q7WL|`u-facka&gY zyci16I!lbz0>$5)Xm``iLXIfPVi|hNj9@*vnzJRe-GUiW(z^}x(9aKAnuOq9(O;#w zG>Lc+6~p0UTMIV4@Y^}KkG=B1HDk4V)=zzP=VNDk*M0lz=B_6)*afyX!;j+s=&a;n zwY}4bT>`%r`1J;U{m%J!Q{VmJn_qlj@ztR>&fI(8vgc;rTmAMg-xW~+Ay>H!c*%t! z+X@}g*qqI;!8pp{YbwaE1IN)vcbTXl|6~RGAkHMW5#Wa_*hyBf^JUN}=l@?S$p5B- z{53GHa&~+b>~w=234ZRf7l5nWAn^U%{yMfGNky&i1J}&zS!;s@*TeX+9OUxrSvALB(P>^*TZ(ujOXOgOp#f^lTHno(gs!WY0q9#*E zfiQJoc()qSQ~FpmZR)Av-F-15p$}^#G2Ln_-=c;mG&G>aqW6Q~9llmYkHw7JjZ`eM z_twF-qup(-{h37Aj2ekPEfyQm!bb)YqsG8sNbT6K#WH#z5CA=t>>nN&(om|Pk4d_F}>L}Gds6zlwv~7K)A~ zG&7UJ$VLJ1Z39ozW-1dlja08bt{sgUDb)70hoTWZFggmc;DH>%uDA7(n{-`#C64=i zFicwvlnSx!qG8*YwVMRHLb^Gq#dU}0pen9<;bMrZvlXO^B^{;*Lq0xOdkTd*U^??z zP;|L=`0UGwv!e^A)viq197qou<~U3?Y{vT`d_)b8A5llOXpAL{h_1$sNG7JMH0xO` zIue%ChTO?iJ))T!sEwr4)~y6kBErJSq^d#$LA%LMF;L&&(AyX zi%A&hv%(+jbBzOU5%>zgoL50|;3AYPnTvu+3Od_U=N;Mg}6#eu_x zwabtLcP{Y<9JqLe17R{AwP~f`GqAYS8qVxgZw<_n~}%R=Vv*;5_t@H z{v_vXkjGHxpXB`C)&h?q&Y$4?pOMGV=BGISC*(1t`6TDxKpv-5{xIiXK^{Y!AL9JW z$YV(JJ)D0Dc?@N~mGeJF9z&RyINt{R=n3F?*{95Gp94h6zI7=7JP3@+jhl}1rp8S> z7=z|KG=tc(*HLWSd5|{y{pPt@h^ zzW^{ykxP{6CS@A@9%{j;z}YnBWj*$+@5_Z>9&@GNv=f@iM=vwzHe zmK%6o$-WZIo(pD|at8r8K5GWRom>OTPY32A%2vzWOouX~pSjb2m;aFeZog{BHcz~ltb!$5OLVca;OXMsKo6w6wRFwgyanP;NOv$1|f-3bW6X25ap z(E_#>P-b;g|LT@qjjQgfn_{cezl^B{*e9~IQU3x0FZH-D$~uWovz z=C+3A{$t+pmC#9G)qeQPt_PXps02RocV#Zu*RWjqy!Wx%nPs0_9z3?9W)3wJyjjtw zXW)lpnz}0@VmqBT$V%H3HQLR3lK0Ks5r@2vj5R-;DsBx6=74 zou}ey0v0^W#X@IpcMG1*?C5(Aoz>BIoJ%b=`+Rq!;OQ)MgW%~r7x%|lXfJ&B!jggf zqHu)HEFY~!)cWR&v{f96(wXBi;UAqfwxAFc0W&5^oTszYZegF!6X>jSJ(ptaggE3R zJSiL`KP910XQ9*|91C#&dxRjIJ#k)$vqizzi}t??-gyQqT=<_7`fl#-^qdIrauL{d zf__ZUPC@$x-7n~NzpQH(EVG_Q*B6^!O*Fjah)76$isKwvUr*A zy4?P17N7;iVaUrG?R*Lc4ECGYx5~<2Y_BiH^39Cam12AiS$oQ+=0 zfG9H`y=)yTH&4B6eaUxqwCCkn6i&<5x20P4-cm8jAoBQ~rw~v2Msx+>9_aT;;ZKiH zybfqNI~{aHUf5Z1UH4iTxTnl~*Z{c1 zZ599N1e~6A&XzkW;3$KCeTC!B9VPvpGd1(W`czc$luUSJtB8?ZtE^D#ItHtEtS$HAv?fKO|sDx z>6+|)*ZnkkEp zQ!Qbbx;&Q1$Rn9(EOJ9M!Z zGEeH0p(>9Vz+w&>lli?TrwpFDBi>NhSe|*D_oiN`NKlEpT#{PJPvuGeE`wT0w)5?e^HTvI|q9{(x?3b(H>eGJ9rcPm~(>n;!2VMHKFC$9hB{Rem z{ftYW_HRUE6j)(^`XzfaE`2)pAxh^VB<~*omxMme6WR|Fy_OUOrTItn387DJy7Ted zUHb0+pLXff{*vggT>2C@g1-k9+>+A#qC7^*(|5;<^oc$Xy12C=eS05;8$Bo_XK@9d z@Si~g&OOqneJ%YzhE69|^ z*?&oo=eAeEsI#UkE$*;b81S4EbA`wsT7U5VAm1$w>u>TJi#|*jPBdbF&VuIx<@C>f O+>(0FDGYVD{=Wc8x$V*b diff --git a/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node b/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node deleted file mode 100755 index 67c3f500cb518bfb96782ef1aeab0acc72d09ef3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13288 zcmeHOeQX@X6`%7tiAn6(I3Y0!kOhSjC@en5Un!*c?3}X>7suqBkN{z`zFXTz?rx8} zy!*EDS5Iew5p2KN>Pg{Xe(hFl)Chfy0n#2+Jb?i-W4QFQPT7)?t8QI z_V)JfT0m;0N;lE@&HK%JZ{EC}o!yyzc_RkV9%!^6qKru#z&@74Z}D=@0+o2hrZpCRUQp6Q7WL|`u-facka&gY zyci16I!lbz0>$5)Xm``iLXIfPVi|hNj9@*vnzJRe-GUiW(z^}x(9aKAnuOq9(O;#w zG>Lc+6~p0UTMIV4@Y^}KkG=B1HDk4V)=zzP=VNDk*M0lz=B_6)*afyX!;j+s=&a;n zwY}4bT>`%r`1J;U{m%J!Q{VmJn_qlj@ztR>&fI(8vgc;rTmAMg-xW~+Ay>H!c*%t! z+X@}g*qqI;!8pp{YbwaE1IN)vcbTXl|6~RGAkHMW5#Wa_*hyBf^JUN}=l@?S$p5B- z{53GHa&~+b>~w=234ZRf7l5nWAn^U%{yMfGNky&i1J}&zS!;s@*TeX+9OUxrSvALB(P>^*TZ(ujOXOgOp#f^lTHno(gs!WY0q9#*E zfiQJoc()qSQ~FpmZR)Av-F-15p$}^#G2Ln_-=c;mG&G>aqW6Q~9llmYkHw7JjZ`eM z_twF-qup(-{h37Aj2ekPEfyQm!bb)YqsG8sNbT6K#WH#z5CA=t>>nN&(om|Pk4d_F}>L}Gds6zlwv~7K)A~ zG&7UJ$VLJ1Z39ozW-1dlja08bt{sgUDb)70hoTWZFggmc;DH>%uDA7(n{-`#C64=i zFicwvlnSx!qG8*YwVMRHLb^Gq#dU}0pen9<;bMrZvlXO^B^{;*Lq0xOdkTd*U^??z zP;|L=`0UGwv!e^A)viq197qou<~U3?Y{vT`d_)b8A5llOXpAL{h_1$sNG7JMH0xO` zIue%ChTO?iJ))T!sEwr4)~y6kBErJSq^d#$LA%LMF;L&&(AyX zi%A&hv%(+jbBzOU5%>zgoL50|;3AYPnTvu+3Od_U=N;Mg}6#eu_x zwabtLcP{Y<9JqLe17R{AwP~f`GqAYS8qVxgZw<_n~}%R=Vv*;5_t@H z{v_vXkjGHxpXB`C)&h?q&Y$4?pOMGV=BGISC*(1t`6TDxKpv-5{xIiXK^{Y!AL9JW z$YV(JJ)D0Dc?@N~mGeJF9z&RyINt{R=n3F?*{95Gp94h6zI7=7JP3@+jhl}1rp8S> z7=z|KG=tc(*HLWSd5|{y{pPt@h^ zzW^{ykxP{6CS@A@9%{j;z}YnBWj*$+@5_Z>9&@GNv=f@iM=vwzHe zmK%6o$-WZIo(pD|at8r8K5GWRom>OTPY32A%2vzWOouX~pSjb2m;aFeZog{BHcz~ltb!$5OLVca;OXMsKo6w6wRFwgyanP;NOv$1|f-3bW6X25ap z(E_#>P-b;g|LT@qjjQgfn_{cezl^B{*e9~IQU3x0FZH-D$~uWovz z=C+3A{$t+pmC#9G)qeQPt_PXps02RocV#Zu*RWjqy!Wx%nPs0_9z3?9W)3wJyjjtw zXW)lpnz}0@VmqBT$V%H3HQLR3lK0Ks5r@2vj5R-;DsBx6=74 zou}ey0v0^W#X@IpcMG1*?C5(Aoz>BIoJ%b=`+Rq!;OQ)MgW%~r7x%|lXfJ&B!jggf zqHu)HEFY~!)cWR&v{f96(wXBi;UAqfwxAFc0W&5^oTszYZegF!6X>jSJ(ptaggE3R zJSiL`KP910XQ9*|91C#&dxRjIJ#k)$vqizzi}t??-gyQqT=<_7`fl#-^qdIrauL{d zf__ZUPC@$x-7n~NzpQH(EVG_Q*B6^!O*Fjah)76$isKwvUr*A zy4?P17N7;iVaUrG?R*Lc4ECGYx5~<2Y_BiH^39Cam12AiS$oQ+=0 zfG9H`y=)yTH&4B6eaUxqwCCkn6i&<5x20P4-cm8jAoBQ~rw~v2Msx+>9_aT;;ZKiH zybfqNI~{aHUf5Z1UH4iTxTnl~*Z{c1 zZ599N1e~6A&XzkW;3$KCeTC!B9VPvpGd1(W`czc$luUSJtB8?ZtE^D#ItHtEtS$HAv?fKO|sDx z>6+|)*ZnkkEp zQ!Qbbx;&Q1$Rn9(EOJ9M!Z zGEeH0p(>9Vz+w&>lli?TrwpFDBi>NhSe|*D_oiN`NKlEpT#{PJPvuGeE`wT0w)5?e^HTvI|q9{(x?3b(H>eGJ9rcPm~(>n;!2VMHKFC$9hB{Rem z{ftYW_HRUE6j)(^`XzfaE`2)pAxh^VB<~*omxMme6WR|Fy_OUOrTItn387DJy7Ted zUHb0+pLXff{*vggT>2C@g1-k9+>+A#qC7^*(|5;<^oc$Xy12C=eS05;8$Bo_XK@9d z@Si~g&OOqneJ%YzhE69|^ z*?&oo=eAeEsI#UkE$*;b81S4EbA`wsT7U5VAm1$w>u>TJi#|*jPBdbF&VuIx<@C>f O+>(0FDGYVD{=Wc8x$V*b diff --git a/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o b/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o deleted file mode 100644 index 088f7174574579a7049a29fc9c0372a4205fa7b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4368 zcmbtWU2GIp6u#|3sr*(Dh#E|YFUCZYdd{7DwztDWwQ)Ai94$qx=8p zbAPnzwKaNeru8?R)h{e~TlHF-UW@7e$TofMTI;EatDD;6ESLtkHqs_dO>JsFkA~pi zznwUq7*C8PM$_}9%bAqF1l~JydTrINPIT>Si|PV*llJfG{#D(-9ys-X7S8zs&ocE} zXg4%HaqX`vOc~J9)yhMPk6=nSF@{M1e3Ktn8<>|0{>m{x7=! zJ-A8xOB^`A;Aya&fM3%Vb9zs(+-jdbZ{0kVcqK8Bcr{^Q5#9#Jf#*B5OWfklr}g}U z@fU$3t5|e8jyrBK_Y}+HfGNt}l3B2oY`M&!8D=i$*yxW0_U8cVP{xVh36%N?Nq-=9 zD4BerqjPMsYJ1g=ex*<8+S60zBlS&nKbdTg8wk~oPP-XqPNC^u2-=?m!cT4$R~uc82q9n2A-lM##Tqc;HBk0d@Uf& z63%l0>`7=%3}*w0lLCE=MQ0e3_!1rX8{}bKkFkw)os{Rea{v1G3OveFj7gV>aMTO^ zW~rWh?*S`9YZDx~d#3^Zbp!kdz|sF{=u!BYf&Lz}DF54G8c4REsozN0zX&xr=O z-vD21fZu9>FEzm1;AlqW#p>6G;aX=370+^w<%`5PneI1APOe(Cn37I*;h)NklWLca z*AKsnjvXHEo*wA#8m!t`ui)58vsj!ov*%Lwl#?3H7=7brv1)0W#*Cr#k%Nh}ab$2X zqm3G)iGyj)0B>l&FXOod`;4j%TdxhePHD`W8qh|-ygyZOil%32BZspvRC|CBa7Sm$ zmR1n<-Qxpl_o$P0vSv{$mAzSQ8fJP^cELmUeS89!v+u~{Su5-D_3+3PKWY3GVoChL@~q`GoNB6QtB|FVOmV|&(&AX{cq! z_z$JjfF@GP^corr69y)?KT|kkn_kt$dKUmt_rppmo?Fd&j(gC`o6`lyMQgP;Q^;A` z)D+Z$7jgtc?@!V)VYhg7)cY2$s*q-#21d)Z?WeSHv$^>I5&JWiH*A(HY2{!lc71s> z#P0L}dnHqHJ)BW_vh{7!G$V!K{a>)VK@qaTmep=!lTRfZie4~Gq>jfw|n)yU@0 z8B=DV$ZRKPi4$LcAn@Lx8yp@leoNlNuN{!5aS{aQH$x*lfglLtTc8pC9)cixazS_U+n4T4#PMy1Yem7@q99J+G&t_WKM>+$43rN3AFK!0M4}4? zF>I&Bct-Sy$?IWCWwzv*lhAu^(C0~Wt)i*mwZoL0>6uKKtW=odIygYOs;Dp|5+J7Q zRm%b@z)fkGu4~Q;fLj5ZDOsmff=iJpw&PjK(D2wE{?G`Xl{cnbc(TQU|7X_$_E@_W zIm0*(4W)>alFUUFoVs;5bw8I$T`n?Po z-Xr1s{}%Cy4-_smral8`RQy)_msD2T2%ZF z5nmU4jE^M=$FBf}@u^Ora*5-E41)KyETSy+eS8BZ36pteg}scS9_D^1urR$WfJ-3< zw0?pwf)bT~J|chIXR@dI<9foexo_GK(c?L!J;Zsk$H$bYh}T6N=v|@7aQ^5wMBy$j Oi}in8cNi#P`+otuZNl#W diff --git a/packages/playground/ssr-deps/node-addon/build/binding.Makefile b/packages/playground/ssr-deps/node-addon/build/binding.Makefile deleted file mode 100644 index 9521a57df40291..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/binding.Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# This file is generated by gyp; do not edit. - -export builddir_name ?= ./build/. -.PHONY: all -all: - $(MAKE) cpp_addon diff --git a/packages/playground/ssr-deps/node-addon/build/config.gypi b/packages/playground/ssr-deps/node-addon/build/config.gypi deleted file mode 100644 index 815e24a35e5c83..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/config.gypi +++ /dev/null @@ -1,351 +0,0 @@ -# Do not edit. File was generated by node-gyp's "configure" step -{ - "target_defaults": { - "cflags": [], - "default_configuration": "Release", - "defines": [], - "include_dirs": [], - "libraries": [] - }, - "variables": { - "asan": 0, - "coverage": "false", - "dcheck_always_on": 0, - "debug_nghttp2": "false", - "debug_node": "false", - "enable_lto": "false", - "enable_pgo_generate": "false", - "enable_pgo_use": "false", - "error_on_warn": "false", - "force_dynamic_crt": 0, - "gas_version": "2.30", - "host_arch": "x64", - "icu_data_in": "../../deps/icu-tmp/icudt69l.dat", - "icu_endianness": "l", - "icu_gyp_path": "tools/icu/icu-generic.gyp", - "icu_path": "deps/icu-small", - "icu_small": "false", - "icu_ver_major": "69", - "is_debug": 0, - "llvm_version": "0.0", - "napi_build_version": "8", - "node_byteorder": "little", - "node_debug_lib": "false", - "node_enable_d8": "false", - "node_install_npm": "true", - "node_library_files": [ - "lib/diagnostics_channel.js", - "lib/path.js", - "lib/punycode.js", - "lib/tty.js", - "lib/_stream_wrap.js", - "lib/querystring.js", - "lib/_tls_common.js", - "lib/_tls_wrap.js", - "lib/assert.js", - "lib/async_hooks.js", - "lib/child_process.js", - "lib/cluster.js", - "lib/dns.js", - "lib/util.js", - "lib/vm.js", - "lib/worker_threads.js", - "lib/url.js", - "lib/buffer.js", - "lib/wasi.js", - "lib/process.js", - "lib/console.js", - "lib/constants.js", - "lib/events.js", - "lib/fs.js", - "lib/_stream_duplex.js", - "lib/module.js", - "lib/domain.js", - "lib/zlib.js", - "lib/_http_client.js", - "lib/_http_server.js", - "lib/_stream_writable.js", - "lib/http.js", - "lib/https.js", - "lib/inspector.js", - "lib/trace_events.js", - "lib/_http_incoming.js", - "lib/http2.js", - "lib/os.js", - "lib/string_decoder.js", - "lib/_stream_passthrough.js", - "lib/_stream_readable.js", - "lib/_stream_transform.js", - "lib/crypto.js", - "lib/timers.js", - "lib/repl.js", - "lib/_http_agent.js", - "lib/_http_common.js", - "lib/_http_outgoing.js", - "lib/net.js", - "lib/perf_hooks.js", - "lib/readline.js", - "lib/v8.js", - "lib/sys.js", - "lib/tls.js", - "lib/stream.js", - "lib/dgram.js", - "lib/dns/promises.js", - "lib/stream/consumers.js", - "lib/stream/promises.js", - "lib/stream/web.js", - "lib/assert/strict.js", - "lib/internal/async_hooks.js", - "lib/internal/heap_utils.js", - "lib/internal/blob.js", - "lib/internal/freeze_intrinsics.js", - "lib/internal/inspector_async_hook.js", - "lib/internal/linkedlist.js", - "lib/internal/js_stream_socket.js", - "lib/internal/url.js", - "lib/internal/socketaddress.js", - "lib/internal/util.js", - "lib/internal/options.js", - "lib/internal/repl.js", - "lib/internal/child_process.js", - "lib/internal/errors.js", - "lib/internal/event_target.js", - "lib/internal/v8_prof_polyfill.js", - "lib/internal/v8_prof_processor.js", - "lib/internal/validators.js", - "lib/internal/buffer.js", - "lib/internal/encoding.js", - "lib/internal/watchdog.js", - "lib/internal/trace_events_async_hooks.js", - "lib/internal/constants.js", - "lib/internal/abort_controller.js", - "lib/internal/blocklist.js", - "lib/internal/querystring.js", - "lib/internal/net.js", - "lib/internal/cli_table.js", - "lib/internal/fixed_queue.js", - "lib/internal/priority_queue.js", - "lib/internal/tty.js", - "lib/internal/assert.js", - "lib/internal/timers.js", - "lib/internal/socket_list.js", - "lib/internal/error_serdes.js", - "lib/internal/freelist.js", - "lib/internal/dgram.js", - "lib/internal/histogram.js", - "lib/internal/http.js", - "lib/internal/idna.js", - "lib/internal/worker.js", - "lib/internal/dtrace.js", - "lib/internal/stream_base_commons.js", - "lib/internal/bootstrap/environment.js", - "lib/internal/bootstrap/loaders.js", - "lib/internal/bootstrap/pre_execution.js", - "lib/internal/bootstrap/node.js", - "lib/internal/bootstrap/switches/does_not_own_process_state.js", - "lib/internal/bootstrap/switches/is_not_main_thread.js", - "lib/internal/bootstrap/switches/does_own_process_state.js", - "lib/internal/bootstrap/switches/is_main_thread.js", - "lib/internal/debugger/inspect_repl.js", - "lib/internal/debugger/inspect.js", - "lib/internal/debugger/inspect_client.js", - "lib/internal/cluster/shared_handle.js", - "lib/internal/cluster/child.js", - "lib/internal/cluster/primary.js", - "lib/internal/cluster/round_robin_handle.js", - "lib/internal/cluster/utils.js", - "lib/internal/cluster/worker.js", - "lib/internal/crypto/aes.js", - "lib/internal/crypto/certificate.js", - "lib/internal/crypto/cipher.js", - "lib/internal/crypto/diffiehellman.js", - "lib/internal/crypto/hash.js", - "lib/internal/crypto/hashnames.js", - "lib/internal/crypto/hkdf.js", - "lib/internal/crypto/keys.js", - "lib/internal/crypto/mac.js", - "lib/internal/crypto/pbkdf2.js", - "lib/internal/crypto/random.js", - "lib/internal/crypto/scrypt.js", - "lib/internal/crypto/sig.js", - "lib/internal/crypto/util.js", - "lib/internal/crypto/webcrypto.js", - "lib/internal/crypto/x509.js", - "lib/internal/crypto/dsa.js", - "lib/internal/crypto/ec.js", - "lib/internal/crypto/keygen.js", - "lib/internal/crypto/rsa.js", - "lib/internal/dns/promises.js", - "lib/internal/dns/utils.js", - "lib/internal/fs/dir.js", - "lib/internal/fs/read_file_context.js", - "lib/internal/fs/streams.js", - "lib/internal/fs/sync_write_stream.js", - "lib/internal/fs/utils.js", - "lib/internal/fs/watchers.js", - "lib/internal/fs/promises.js", - "lib/internal/fs/rimraf.js", - "lib/internal/fs/cp/cp-sync.js", - "lib/internal/fs/cp/cp.js", - "lib/internal/http2/compat.js", - "lib/internal/http2/util.js", - "lib/internal/http2/core.js", - "lib/internal/modules/package_json_reader.js", - "lib/internal/modules/run_main.js", - "lib/internal/modules/cjs/loader.js", - "lib/internal/modules/cjs/helpers.js", - "lib/internal/modules/esm/loader.js", - "lib/internal/modules/esm/transform_source.js", - "lib/internal/modules/esm/module_job.js", - "lib/internal/modules/esm/module_map.js", - "lib/internal/modules/esm/resolve.js", - "lib/internal/modules/esm/translators.js", - "lib/internal/modules/esm/get_format.js", - "lib/internal/modules/esm/create_dynamic_module.js", - "lib/internal/modules/esm/get_source.js", - "lib/internal/legacy/processbinding.js", - "lib/internal/process/policy.js", - "lib/internal/process/worker_thread_only.js", - "lib/internal/process/esm_loader.js", - "lib/internal/process/execution.js", - "lib/internal/process/per_thread.js", - "lib/internal/process/promises.js", - "lib/internal/process/report.js", - "lib/internal/process/signal.js", - "lib/internal/process/task_queues.js", - "lib/internal/process/warning.js", - "lib/internal/repl/history.js", - "lib/internal/repl/utils.js", - "lib/internal/repl/await.js", - "lib/internal/streams/legacy.js", - "lib/internal/streams/passthrough.js", - "lib/internal/streams/buffer_list.js", - "lib/internal/streams/from.js", - "lib/internal/streams/lazy_transform.js", - "lib/internal/streams/state.js", - "lib/internal/streams/transform.js", - "lib/internal/streams/add-abort-signal.js", - "lib/internal/streams/compose.js", - "lib/internal/streams/destroy.js", - "lib/internal/streams/duplex.js", - "lib/internal/streams/duplexify.js", - "lib/internal/streams/end-of-stream.js", - "lib/internal/streams/pipeline.js", - "lib/internal/streams/readable.js", - "lib/internal/streams/utils.js", - "lib/internal/streams/writable.js", - "lib/internal/test/binding.js", - "lib/internal/test/transfer.js", - "lib/internal/util/comparisons.js", - "lib/internal/util/debuglog.js", - "lib/internal/util/inspect.js", - "lib/internal/util/inspector.js", - "lib/internal/util/iterable_weak_map.js", - "lib/internal/util/types.js", - "lib/internal/main/check_syntax.js", - "lib/internal/main/eval_stdin.js", - "lib/internal/main/prof_process.js", - "lib/internal/main/run_main_module.js", - "lib/internal/main/print_help.js", - "lib/internal/main/repl.js", - "lib/internal/main/inspect.js", - "lib/internal/main/worker_thread.js", - "lib/internal/main/eval_string.js", - "lib/internal/tls/parse-cert-string.js", - "lib/internal/tls/secure-context.js", - "lib/internal/tls/secure-pair.js", - "lib/internal/vm/module.js", - "lib/internal/child_process/serialization.js", - "lib/internal/per_context/domexception.js", - "lib/internal/per_context/messageport.js", - "lib/internal/per_context/primordials.js", - "lib/internal/worker/io.js", - "lib/internal/worker/js_transferable.js", - "lib/internal/assert/calltracker.js", - "lib/internal/assert/assertion_error.js", - "lib/internal/perf/event_loop_delay.js", - "lib/internal/perf/event_loop_utilization.js", - "lib/internal/perf/nodetiming.js", - "lib/internal/perf/observe.js", - "lib/internal/perf/performance.js", - "lib/internal/perf/performance_entry.js", - "lib/internal/perf/timerify.js", - "lib/internal/perf/usertiming.js", - "lib/internal/perf/utils.js", - "lib/internal/webstreams/encoding.js", - "lib/internal/webstreams/queuingstrategies.js", - "lib/internal/webstreams/readablestream.js", - "lib/internal/webstreams/transfer.js", - "lib/internal/webstreams/transformstream.js", - "lib/internal/webstreams/util.js", - "lib/internal/webstreams/writablestream.js", - "lib/internal/source_map/source_map.js", - "lib/internal/source_map/source_map_cache.js", - "lib/internal/source_map/prepare_stack_trace.js", - "lib/internal/console/global.js", - "lib/internal/console/constructor.js", - "lib/internal/readline/utils.js", - "lib/internal/readline/callbacks.js", - "lib/internal/readline/emitKeypressEvents.js", - "lib/internal/policy/manifest.js", - "lib/internal/policy/sri.js", - "lib/fs/promises.js", - "lib/util/types.js", - "lib/path/posix.js", - "lib/path/win32.js", - "lib/timers/promises.js" - ], - "node_module_version": 93, - "node_no_browser_globals": "false", - "node_prefix": "/", - "node_release_urlbase": "https://nodejs.org/download/release/", - "node_section_ordering_info": "", - "node_shared": "false", - "node_shared_brotli": "false", - "node_shared_cares": "false", - "node_shared_http_parser": "false", - "node_shared_libuv": "false", - "node_shared_nghttp2": "false", - "node_shared_nghttp3": "false", - "node_shared_ngtcp2": "false", - "node_shared_openssl": "false", - "node_shared_zlib": "false", - "node_tag": "", - "node_target_type": "executable", - "node_use_bundled_v8": "true", - "node_use_dtrace": "false", - "node_use_etw": "false", - "node_use_node_code_cache": "true", - "node_use_node_snapshot": "true", - "node_use_openssl": "true", - "node_use_v8_platform": "true", - "node_with_ltcg": "false", - "node_without_node_options": "false", - "openssl_fips": "", - "openssl_is_fips": "false", - "openssl_quic": "true", - "ossfuzz": "false", - "shlib_suffix": "so.93", - "target_arch": "x64", - "v8_enable_31bit_smis_on_64bit_arch": 0, - "v8_enable_gdbjit": 0, - "v8_enable_i18n_support": 1, - "v8_enable_inspector": 1, - "v8_enable_lite_mode": 0, - "v8_enable_object_print": 1, - "v8_enable_pointer_compression": 0, - "v8_enable_webassembly": 1, - "v8_no_strict_aliasing": 1, - "v8_optimized_debug": 1, - "v8_promise_internal_field_count": 1, - "v8_random_seed": 0, - "v8_trace_maps": 0, - "v8_use_siphash": 1, - "want_separate_host_toolset": 0, - "nodedir": "/home/matias/.cache/node-gyp/16.9.1", - "standalone_static_library": 1, - "user_agent": "pnpm/6.21.0 npm/? node/v16.9.1 linux x64", - "registry": "https://registry.npmjs.org/", - "node_gyp": "/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" - } -} diff --git a/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk b/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk deleted file mode 100644 index 4a2de286352df8..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk +++ /dev/null @@ -1,159 +0,0 @@ -# This file is generated by gyp; do not edit. - -TOOLSET := target -TARGET := cpp_addon -DEFS_Debug := \ - '-DNODE_GYP_MODULE_NAME=cpp_addon' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-DV8_DEPRECATION_WARNINGS' \ - '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ - '-D_GLIBCXX_USE_CXX11_ABI=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-D__STDC_FORMAT_MACROS' \ - '-DOPENSSL_NO_PINSHARED' \ - '-DOPENSSL_THREADS' \ - '-DBUILDING_NODE_EXTENSION' \ - '-DDEBUG' \ - '-D_DEBUG' \ - '-DV8_ENABLE_CHECKS' - -# Flags passed to all source files. -CFLAGS_Debug := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -m64 \ - -g \ - -O0 - -# Flags passed to only C files. -CFLAGS_C_Debug := - -# Flags passed to only C++ files. -CFLAGS_CC_Debug := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++14 - -INCS_Debug := \ - -I/home/matias/.cache/node-gyp/16.9.1/include/node \ - -I/home/matias/.cache/node-gyp/16.9.1/src \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include - -DEFS_Release := \ - '-DNODE_GYP_MODULE_NAME=cpp_addon' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-DV8_DEPRECATION_WARNINGS' \ - '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ - '-D_GLIBCXX_USE_CXX11_ABI=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-D__STDC_FORMAT_MACROS' \ - '-DOPENSSL_NO_PINSHARED' \ - '-DOPENSSL_THREADS' \ - '-DBUILDING_NODE_EXTENSION' - -# Flags passed to all source files. -CFLAGS_Release := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -m64 \ - -O3 \ - -fno-omit-frame-pointer - -# Flags passed to only C files. -CFLAGS_C_Release := - -# Flags passed to only C++ files. -CFLAGS_CC_Release := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++14 - -INCS_Release := \ - -I/home/matias/.cache/node-gyp/16.9.1/include/node \ - -I/home/matias/.cache/node-gyp/16.9.1/src \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include - -OBJS := \ - $(obj).target/$(TARGET)/main.o - -# Add to the list of files we specially track dependencies for. -all_deps += $(OBJS) - -# CFLAGS et al overrides must be target-local. -# See "Target-specific Variable Values" in the GNU Make manual. -$(OBJS): TOOLSET := $(TOOLSET) -$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) -$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) - -# Suffix rules, putting all outputs into $(obj). - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# Try building from generated source, too. - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# End of this set of suffix rules -### Rules for final target. -LDFLAGS_Debug := \ - -pthread \ - -rdynamic \ - -m64 - -LDFLAGS_Release := \ - -pthread \ - -rdynamic \ - -m64 - -LIBS := - -$(obj).target/cpp_addon.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) -$(obj).target/cpp_addon.node: LIBS := $(LIBS) -$(obj).target/cpp_addon.node: TOOLSET := $(TOOLSET) -$(obj).target/cpp_addon.node: $(OBJS) FORCE_DO_CMD - $(call do_cmd,solink_module) - -all_deps += $(obj).target/cpp_addon.node -# Add target alias -.PHONY: cpp_addon -cpp_addon: $(builddir)/cpp_addon.node - -# Copy this to the executable output path. -$(builddir)/cpp_addon.node: TOOLSET := $(TOOLSET) -$(builddir)/cpp_addon.node: $(obj).target/cpp_addon.node FORCE_DO_CMD - $(call do_cmd,copy) - -all_deps += $(builddir)/cpp_addon.node -# Short alias for building this executable. -.PHONY: cpp_addon.node -cpp_addon.node: $(obj).target/cpp_addon.node $(builddir)/cpp_addon.node - -# Add executable to "all" target. -.PHONY: all -all: $(builddir)/cpp_addon.node - From ae3a44357896dd73d0eaf67fa42e8920bfa2c601 Mon Sep 17 00:00:00 2001 From: shj Date: Sat, 4 Dec 2021 04:51:25 +0900 Subject: [PATCH 0030/1287] docs: remove newlines & use main branch instead of master (#5957) --- docs/config/index.md | 3 +-- docs/guide/static-deploy.md | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index 4074fa0fad71cb..f870503d1987d5 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -926,8 +926,7 @@ export default defineConfig({ Options to pass to esbuild during the dep scanning and optimization. - Certain options are omitted since changing them would not be compatible - with Vite's dep optimization. + Certain options are omitted since changing them would not be compatible with Vite's dep optimization. - `external` is also omitted, use Vite's `optimizeDeps.exclude` option - `plugins` are merged with Vite's dep plugin diff --git a/docs/guide/static-deploy.md b/docs/guide/static-deploy.md index fbb94fe9f75149..95f7b0ae5ed174 100644 --- a/docs/guide/static-deploy.md +++ b/docs/guide/static-deploy.md @@ -87,7 +87,7 @@ Now the `preview` method will launch the server at http://localhost:8080. # git push -f git@github.com:/.github.io.git main # if you are deploying to https://.github.io/ - # git push -f git@github.com:/.git master:gh-pages + # git push -f git@github.com:/.git main:gh-pages cd - ``` @@ -127,7 +127,7 @@ You can also run the above script in your CI setup to enable automatic deploymen github_token: $GITHUB_TOKEN keep_history: true on: - branch: master + branch: main ``` ## GitLab Pages and GitLab CI @@ -259,7 +259,7 @@ You can also deploy to a [custom domain](http://surge.sh/help/adding-a-custom-do ```bash # publish site - $ git push heroku master + $ git push heroku main # opens a browser to view the Dashboard version of Heroku CI $ heroku open From c768ffd266a85d8ea5dcaf790dd99cd37fff7bf2 Mon Sep 17 00:00:00 2001 From: Saurabh Daware Date: Sat, 4 Dec 2021 01:33:38 +0530 Subject: [PATCH 0031/1287] docs(ssr): add server.js entry to folder structure (#5960) --- docs/guide/ssr.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/guide/ssr.md b/docs/guide/ssr.md index bfad7dc71ab961..c5ee7206e51126 100644 --- a/docs/guide/ssr.md +++ b/docs/guide/ssr.md @@ -31,6 +31,7 @@ A typical SSR application will have the following source file structure: ``` - index.html +- server.js # main application server - src/ - main.js # exports env-agnostic (universal) app code - entry-client.js # mounts the app to a DOM element From 4ece719229ac606aac93e5a267228582f54574bc Mon Sep 17 00:00:00 2001 From: Saurabh Daware Date: Sat, 4 Dec 2021 17:30:24 +0530 Subject: [PATCH 0032/1287] docs(ssr): update middlewareMode comment (#5959) --- docs/guide/ssr.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guide/ssr.md b/docs/guide/ssr.md index c5ee7206e51126..115517ffddde25 100644 --- a/docs/guide/ssr.md +++ b/docs/guide/ssr.md @@ -77,8 +77,8 @@ async function createServer() { // Create Vite server in middleware mode. This disables Vite's own HTML // serving logic and let the parent server take control. // - // If you want to use Vite's own HTML serving logic (using Vite as - // a development middleware), using 'html' instead. + // In middleware mode, if you want to use Vite's own HTML serving logic + // use `'html'` as the `middlewareMode` (ref https://vitejs.dev/config/#server-middlewaremode) const vite = await createViteServer({ server: { middlewareMode: 'ssr' } }) From a47b663ad06af8c5bf87128035f6b112de0ecd16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20Ayg=C3=BCn?= Date: Mon, 6 Dec 2021 10:15:01 +0300 Subject: [PATCH 0033/1287] fix(ssr): allow primitive default exports and forwarded exports (#5973) --- .../ssr-deps/__tests__/ssr-deps.spec.ts | 31 +++++++++++++ .../ssr-deps/forwarded-export/index.js | 2 + .../ssr-deps/forwarded-export/package.json | 5 +++ .../ssr-deps/object-assigned-exports/index.js | 9 ++++ .../object-assigned-exports/package.json | 5 +++ packages/playground/ssr-deps/package.json | 6 ++- .../ssr-deps/primitive-export/index.js | 1 + .../ssr-deps/primitive-export/package.json | 5 +++ packages/playground/ssr-deps/src/app.js | 18 ++++++++ .../ssr-deps/ts-transpiled-exports/index.js | 8 ++++ .../ts-transpiled-exports/package.json | 5 +++ packages/vite/src/node/ssr/ssrModuleLoader.ts | 44 ++++++------------- pnpm-lock.yaml | 20 +++++++++ 13 files changed, 128 insertions(+), 31 deletions(-) create mode 100644 packages/playground/ssr-deps/forwarded-export/index.js create mode 100644 packages/playground/ssr-deps/forwarded-export/package.json create mode 100644 packages/playground/ssr-deps/object-assigned-exports/index.js create mode 100644 packages/playground/ssr-deps/object-assigned-exports/package.json create mode 100644 packages/playground/ssr-deps/primitive-export/index.js create mode 100644 packages/playground/ssr-deps/primitive-export/package.json create mode 100644 packages/playground/ssr-deps/ts-transpiled-exports/index.js create mode 100644 packages/playground/ssr-deps/ts-transpiled-exports/package.json diff --git a/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts b/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts index 5559bb1e9adb83..4873b55eb82461 100644 --- a/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts +++ b/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts @@ -17,3 +17,34 @@ test('msg read by fs/promises', async () => { await page.goto(url) expect(await page.textContent('.file-message')).toMatch('File Content!') }) + +test('msg from primitive export', async () => { + await page.goto(url) + expect(await page.textContent('.primitive-export-message')).toMatch( + 'Hello World!' + ) +}) + +test('msg from TS transpiled exports', async () => { + await page.goto(url) + expect(await page.textContent('.ts-default-export-message')).toMatch( + 'Hello World!' + ) + expect(await page.textContent('.ts-named-export-message')).toMatch( + 'Hello World!' + ) +}) + +test('msg from Object.assign exports', async () => { + await page.goto(url) + expect(await page.textContent('.object-assigned-exports-message')).toMatch( + 'Hello World!' + ) +}) + +test('msg from forwarded exports', async () => { + await page.goto(url) + expect(await page.textContent('.forwarded-export-message')).toMatch( + 'Hello World!' + ) +}) diff --git a/packages/playground/ssr-deps/forwarded-export/index.js b/packages/playground/ssr-deps/forwarded-export/index.js new file mode 100644 index 00000000000000..0b9f314d00015e --- /dev/null +++ b/packages/playground/ssr-deps/forwarded-export/index.js @@ -0,0 +1,2 @@ +const original = require('object-assigned-exports') +module.exports = original diff --git a/packages/playground/ssr-deps/forwarded-export/package.json b/packages/playground/ssr-deps/forwarded-export/package.json new file mode 100644 index 00000000000000..49b7f792ba9c1d --- /dev/null +++ b/packages/playground/ssr-deps/forwarded-export/package.json @@ -0,0 +1,5 @@ +{ + "name": "forwarded-export", + "version": "0.0.0", + "private": true +} diff --git a/packages/playground/ssr-deps/object-assigned-exports/index.js b/packages/playground/ssr-deps/object-assigned-exports/index.js new file mode 100644 index 00000000000000..d6510e38f3a36f --- /dev/null +++ b/packages/playground/ssr-deps/object-assigned-exports/index.js @@ -0,0 +1,9 @@ +Object.defineProperty(exports, '__esModule', { value: true }) + +const obj = { + hello() { + return 'Hello World!' + } +} + +Object.assign(exports, obj) diff --git a/packages/playground/ssr-deps/object-assigned-exports/package.json b/packages/playground/ssr-deps/object-assigned-exports/package.json new file mode 100644 index 00000000000000..cdbb4d04c95bbf --- /dev/null +++ b/packages/playground/ssr-deps/object-assigned-exports/package.json @@ -0,0 +1,5 @@ +{ + "name": "object-assigned-exports", + "version": "0.0.0", + "private": true +} diff --git a/packages/playground/ssr-deps/package.json b/packages/playground/ssr-deps/package.json index 2e1f7a9deba490..ab6b29a9fb59eb 100644 --- a/packages/playground/ssr-deps/package.json +++ b/packages/playground/ssr-deps/package.json @@ -10,7 +10,11 @@ }, "dependencies": { "node-addon": "link:./node-addon", - "read-file-content": "file:./read-file-content" + "primitive-export": "link:./primitive-export", + "read-file-content": "file:./read-file-content", + "ts-transpiled-exports": "link:./ts-transpiled-exports", + "object-assigned-exports": "link:./object-assigned-exports", + "forwarded-export": "link:./forwarded-export" }, "devDependencies": { "cross-env": "^7.0.3", diff --git a/packages/playground/ssr-deps/primitive-export/index.js b/packages/playground/ssr-deps/primitive-export/index.js new file mode 100644 index 00000000000000..0701a4664b7537 --- /dev/null +++ b/packages/playground/ssr-deps/primitive-export/index.js @@ -0,0 +1 @@ +module.exports = 'Hello World!' diff --git a/packages/playground/ssr-deps/primitive-export/package.json b/packages/playground/ssr-deps/primitive-export/package.json new file mode 100644 index 00000000000000..c7a766db70b2e1 --- /dev/null +++ b/packages/playground/ssr-deps/primitive-export/package.json @@ -0,0 +1,5 @@ +{ + "name": "primitive-export", + "version": "0.0.0", + "private": true +} diff --git a/packages/playground/ssr-deps/src/app.js b/packages/playground/ssr-deps/src/app.js index 46cca814e08444..c7748978264fc9 100644 --- a/packages/playground/ssr-deps/src/app.js +++ b/packages/playground/ssr-deps/src/app.js @@ -1,6 +1,10 @@ import path from 'path' import { hello } from 'node-addon' import readFileContent from 'read-file-content' +import primitiveExport from 'primitive-export' +import tsDefaultExport, { hello as tsNamedExport } from 'ts-transpiled-exports' +import objectAssignedExports from 'object-assigned-exports' +import forwardedExport from 'forwarded-export' export async function render(url, rootDir) { let html = '' @@ -11,5 +15,19 @@ export async function render(url, rootDir) { const fileContent = await readFileContent(path.resolve(rootDir, 'message')) html += `\n

msg read via fs/promises: ${fileContent}

` + html += `\n

message from primitive export: ${primitiveExport}

` + + const tsDefaultExportMessage = tsDefaultExport() + html += `\n

message from ts-default-export: ${tsDefaultExportMessage}

` + + const tsNamedExportMessage = tsNamedExport() + html += `\n

message from ts-named-export: ${tsNamedExportMessage}

` + + const objectAssignedExportsMessage = objectAssignedExports.hello() + html += `\n

message from object-assigned-exports: ${objectAssignedExportsMessage}

` + + const forwardedExportMessage = forwardedExport.hello() + html += `\n

message from forwarded-export: ${forwardedExportMessage}

` + return html + '\n' } diff --git a/packages/playground/ssr-deps/ts-transpiled-exports/index.js b/packages/playground/ssr-deps/ts-transpiled-exports/index.js new file mode 100644 index 00000000000000..882c5fee653a8b --- /dev/null +++ b/packages/playground/ssr-deps/ts-transpiled-exports/index.js @@ -0,0 +1,8 @@ +'use strict' +Object.defineProperty(exports, '__esModule', { value: true }) +exports.hello = void 0 +function hello() { + return 'Hello World!' +} +exports.hello = hello +exports.default = hello diff --git a/packages/playground/ssr-deps/ts-transpiled-exports/package.json b/packages/playground/ssr-deps/ts-transpiled-exports/package.json new file mode 100644 index 00000000000000..f975d9d736c7f2 --- /dev/null +++ b/packages/playground/ssr-deps/ts-transpiled-exports/package.json @@ -0,0 +1,5 @@ +{ + "name": "ts-transpiled-exports", + "version": "0.0.0", + "private": true +} diff --git a/packages/vite/src/node/ssr/ssrModuleLoader.ts b/packages/vite/src/node/ssr/ssrModuleLoader.ts index ffd6838790af8e..0627e1e98ae4f9 100644 --- a/packages/vite/src/node/ssr/ssrModuleLoader.ts +++ b/packages/vite/src/node/ssr/ssrModuleLoader.ts @@ -271,7 +271,18 @@ async function nodeImport( // rollup-style default import interop for cjs function proxyESM(mod: any) { - const defaultExport = getDefaultExport(mod) + // This is the only sensible option when the exports object is a primitve + if (isPrimitive(mod)) return { default: mod } + + let defaultExport = 'default' in mod ? mod.default : mod + + if (!isPrimitive(defaultExport) && '__esModule' in defaultExport) { + mod = defaultExport + if ('default' in defaultExport) { + defaultExport = defaultExport.default + } + } + return new Proxy(mod, { get(mod, prop) { if (prop === 'default') return defaultExport @@ -280,33 +291,6 @@ function proxyESM(mod: any) { }) } -function getDefaultExport(moduleExports: any) { - // `moduleExports` is one of the following: - // - `const moduleExports = require(file)` - // - `const moduleExports = await import(file)` - let defaultExport = - 'default' in moduleExports ? moduleExports.default : moduleExports - - // Node.js doesn't support `__esModule`, see https://github.com/nodejs/node/issues/40891 - // This means we need to unwrap the `__esModule` wrapper ourselves. - // - // For example: - // ```ts - // export default 'hi' - // ``` - // - // Which TypeScript transpiles to: - // ```js - // use strict"; - // exports.__esModule = true; - // exports["default"] = 'hi'; - // ``` - // - // This means that `moduleExports.default` denotes `{ __esModule, default: 'hi }` thus the actual - // default lives in `moduleExports.default.default`. - if (defaultExport && '__esModule' in defaultExport) { - defaultExport = defaultExport.default - } - - return defaultExport +function isPrimitive(value: any) { + return !value || (typeof value !== 'object' && typeof value !== 'function') } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 210c92ed29b5b7..65883837bdd6dc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -458,24 +458,44 @@ importers: specifiers: cross-env: ^7.0.3 express: ^4.17.1 + forwarded-export: link:./forwarded-export node-addon: link:./node-addon + object-assigned-exports: link:./object-assigned-exports + primitive-export: link:./primitive-export read-file-content: file:./read-file-content + ts-transpiled-exports: link:./ts-transpiled-exports dependencies: + forwarded-export: link:forwarded-export node-addon: link:node-addon + object-assigned-exports: link:object-assigned-exports + primitive-export: link:primitive-export read-file-content: link:read-file-content + ts-transpiled-exports: link:ts-transpiled-exports devDependencies: cross-env: 7.0.3 express: 4.17.1 + packages/playground/ssr-deps/forwarded-export: + specifiers: {} + packages/playground/ssr-deps/node-addon: specifiers: node-gyp: ^8.4.1 dependencies: node-gyp: 8.4.1 + packages/playground/ssr-deps/object-assigned-exports: + specifiers: {} + + packages/playground/ssr-deps/primitive-export: + specifiers: {} + packages/playground/ssr-deps/read-file-content: specifiers: {} + packages/playground/ssr-deps/ts-transpiled-exports: + specifiers: {} + packages/playground/ssr-html: specifiers: cross-env: ^7.0.3 From 49f28e23cae0ad588fc89374918d3a5e942c5075 Mon Sep 17 00:00:00 2001 From: patak-js Date: Mon, 6 Dec 2021 08:32:20 +0100 Subject: [PATCH 0034/1287] release: v2.7.0-beta.11 --- packages/vite/CHANGELOG.md | 9 +++++++++ packages/vite/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index acaad87b075002..71dc2f7ebd95cb 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,12 @@ +# [2.7.0-beta.11](https://github.com/vitejs/vite/compare/v2.7.0-beta.10...v2.7.0-beta.11) (2021-12-06) + + +### Bug Fixes + +* **ssr:** allow primitive default exports and forwarded exports ([#5973](https://github.com/vitejs/vite/issues/5973)) ([a47b663](https://github.com/vitejs/vite/commit/a47b663ad06af8c5bf87128035f6b112de0ecd16)) + + + # [2.7.0-beta.10](https://github.com/vitejs/vite/compare/v2.7.0-beta.9...v2.7.0-beta.10) (2021-12-02) diff --git a/packages/vite/package.json b/packages/vite/package.json index 25a678fba08b84..549037d8ddfc9f 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.7.0-beta.10", + "version": "2.7.0-beta.11", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From 8184feba29c6a89d58bc4437977d22658e946e0c Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 7 Dec 2021 14:34:12 +0800 Subject: [PATCH 0035/1287] feat: expose `ssrTransform` to server (#5983) Co-authored-by: patak --- packages/vite/src/node/server/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index 8f922a5471918c..b17180c81d5e64 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -55,6 +55,7 @@ import { rebindErrorStacktrace, ssrRewriteStacktrace } from '../ssr/ssrStacktrace' +import { ssrTransform } from '../ssr/ssrTransform' import { createMissingImporterRegisterFn } from '../optimizer/registerMissing' import { resolveHostname } from '../utils' import { searchForWorkspaceRoot } from './searchRoot' @@ -62,6 +63,7 @@ import { CLIENT_DIR } from '../constants' import { printCommonServerUrls } from '../logger' import { performance } from 'perf_hooks' import { invalidatePackageData } from '../packages' +import { SourceMap } from 'rollup' export { searchForWorkspaceRoot } from './searchRoot' @@ -206,6 +208,15 @@ export interface ViteDevServer { options?: EsbuildTransformOptions, inMap?: object ): Promise + /** + * Transform module code into SSR format. + * @experimental + */ + ssrTransform( + code: string, + inMap: SourceMap | null, + url: string + ): Promise /** * Load a given URL as an instantiated module for SSR. */ @@ -337,6 +348,7 @@ export async function createServer( pluginContainer: container, ws, moduleGraph, + ssrTransform, transformWithEsbuild, transformRequest(url, options) { return transformRequest(url, server, options) From 075128a8dd0a2680540179dad2277a797f793199 Mon Sep 17 00:00:00 2001 From: patak-js Date: Tue, 7 Dec 2021 09:57:48 +0100 Subject: [PATCH 0036/1287] release: v2.7.0 --- packages/vite/CHANGELOG.md | 9 +++++++++ packages/vite/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 71dc2f7ebd95cb..13817465f09763 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,12 @@ +# [2.7.0](https://github.com/vitejs/vite/compare/v2.7.0-beta.11...v2.7.0) (2021-12-07) + + +### Features + +* expose `ssrTransform` to server ([#5983](https://github.com/vitejs/vite/issues/5983)) ([8184feb](https://github.com/vitejs/vite/commit/8184feba29c6a89d58bc4437977d22658e946e0c)) + + + # [2.7.0-beta.11](https://github.com/vitejs/vite/compare/v2.7.0-beta.10...v2.7.0-beta.11) (2021-12-06) diff --git a/packages/vite/package.json b/packages/vite/package.json index 549037d8ddfc9f..2dafab95ae3b12 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.7.0-beta.11", + "version": "2.7.0", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From a7a986f9b74157c20adec89a24b78e434b902152 Mon Sep 17 00:00:00 2001 From: patak-js Date: Tue, 7 Dec 2021 10:00:37 +0100 Subject: [PATCH 0037/1287] release: plugin-vue@1.10.2 --- packages/plugin-vue/CHANGELOG.md | 9 +++++++++ packages/plugin-vue/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue/CHANGELOG.md b/packages/plugin-vue/CHANGELOG.md index 15cfcbecef213b..afa7152989f48a 100644 --- a/packages/plugin-vue/CHANGELOG.md +++ b/packages/plugin-vue/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.10.2](https://github.com/vitejs/vite/compare/plugin-vue@1.10.1...plugin-vue@1.10.2) (2021-12-07) + + +### Bug Fixes + +* **plugin-vue:** misleading error thrown after refresh or hmr ([#5870](https://github.com/vitejs/vite/issues/5870)) ([5c07cec](https://github.com/vitejs/vite/commit/5c07cec7214948da73fbbc33c7f5c83bf7f6cd2e)) + + + ## [1.10.1](https://github.com/vitejs/vite/compare/plugin-vue@1.10.0...plugin-vue@1.10.1) (2021-11-26) diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 41001dc51e2e9f..2d82864408cf1c 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue", - "version": "1.10.1", + "version": "1.10.2", "license": "MIT", "author": "Evan You", "files": [ From cc642afba9bf1b5c7408c22a279e84b18519e65e Mon Sep 17 00:00:00 2001 From: patak-js Date: Tue, 7 Dec 2021 10:04:08 +0100 Subject: [PATCH 0038/1287] release: plugin-vue-jsx@1.3.1 --- packages/plugin-vue-jsx/CHANGELOG.md | 4 ++++ packages/plugin-vue-jsx/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue-jsx/CHANGELOG.md b/packages/plugin-vue-jsx/CHANGELOG.md index 310ff252d3be03..7bd6d06debcac6 100644 --- a/packages/plugin-vue-jsx/CHANGELOG.md +++ b/packages/plugin-vue-jsx/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.3.1](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.3.0...plugin-vue-jsx@1.3.1) (2021-12-07) + + + # [1.3.0](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.3.0-beta.0...plugin-vue-jsx@1.3.0) (2021-11-22) diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 3a400dda99bd32..9d0e73583c2e51 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue-jsx", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "author": "Evan You", "files": [ From a3be90cfff092819576263e378915d69c5292b8f Mon Sep 17 00:00:00 2001 From: patak-js Date: Tue, 7 Dec 2021 10:05:34 +0100 Subject: [PATCH 0039/1287] release: plugin-react@1.1.1 --- packages/plugin-react/CHANGELOG.md | 4 ++++ packages/plugin-react/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/plugin-react/CHANGELOG.md b/packages/plugin-react/CHANGELOG.md index 2ed02eec161858..c3887f6943b521 100644 --- a/packages/plugin-react/CHANGELOG.md +++ b/packages/plugin-react/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.1.1](https://github.com/vitejs/vite/compare/plugin-react@1.1.0...plugin-react@1.1.1) (2021-12-07) + + + # [1.1.0](https://github.com/vitejs/vite/compare/plugin-react@1.1.0-beta.1...plugin-react@1.1.0) (2021-11-22) diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index a8942b2abf9e41..5e60ed73b10833 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-react", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "author": "Evan You", "contributors": [ From 79cf69e7b2987982f02beef0e7e15bb27500dfd7 Mon Sep 17 00:00:00 2001 From: patak-js Date: Tue, 7 Dec 2021 10:07:31 +0100 Subject: [PATCH 0040/1287] release: plugin-legacy@1.6.4 --- packages/plugin-legacy/CHANGELOG.md | 4 ++++ packages/plugin-legacy/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/plugin-legacy/CHANGELOG.md b/packages/plugin-legacy/CHANGELOG.md index 077f29eaa790c0..4a97f73fa2b1a3 100644 --- a/packages/plugin-legacy/CHANGELOG.md +++ b/packages/plugin-legacy/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.6.4](https://github.com/vitejs/vite/compare/plugin-legacy@1.6.3...plugin-legacy@1.6.4) (2021-12-07) + + + ## [1.6.3](https://github.com/vitejs/vite/compare/plugin-legacy@1.6.2...plugin-legacy@1.6.3) (2021-11-22) diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index 2ab7f597861915..2c08940d5f335d 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-legacy", - "version": "1.6.3", + "version": "1.6.4", "license": "MIT", "author": "Evan You", "files": [ From 8d9b3939b033f014ff2eaf0c4b175fff1d0a9864 Mon Sep 17 00:00:00 2001 From: patak-js Date: Tue, 7 Dec 2021 10:08:12 +0100 Subject: [PATCH 0041/1287] release: create-vite@2.7.0 --- packages/create-vite/CHANGELOG.md | 9 +++++++++ packages/create-vite/package.json | 2 +- packages/create-vite/template-lit-ts/package.json | 2 +- packages/create-vite/template-lit/package.json | 2 +- packages/create-vite/template-preact-ts/package.json | 2 +- packages/create-vite/template-preact/package.json | 2 +- packages/create-vite/template-react-ts/package.json | 2 +- packages/create-vite/template-react/package.json | 2 +- packages/create-vite/template-svelte-ts/package.json | 2 +- packages/create-vite/template-svelte/package.json | 2 +- packages/create-vite/template-vanilla-ts/package.json | 2 +- packages/create-vite/template-vanilla/package.json | 2 +- packages/create-vite/template-vue-ts/package.json | 4 ++-- packages/create-vite/template-vue/package.json | 4 ++-- 14 files changed, 24 insertions(+), 15 deletions(-) diff --git a/packages/create-vite/CHANGELOG.md b/packages/create-vite/CHANGELOG.md index 9ab9031c9dbc5e..15177ce5f95fe2 100644 --- a/packages/create-vite/CHANGELOG.md +++ b/packages/create-vite/CHANGELOG.md @@ -1,3 +1,12 @@ +# [2.7.0](https://github.com/vitejs/vite/compare/create-vite@2.6.6...create-vite@2.7.0) (2021-12-07) + + +### Bug Fixes + +* **create-vite:** update vue-tsc for dts flags ([#5453](https://github.com/vitejs/vite/issues/5453)) ([c93bc3d](https://github.com/vitejs/vite/commit/c93bc3df90b5c4e8e25ffd864ae53a3ae7559315)) + + + ## [2.6.6](https://github.com/vitejs/vite/compare/create-vite@2.6.5...create-vite@2.6.6) (2021-10-07) diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json index 6c50d4a4284217..148917ba383642 100644 --- a/packages/create-vite/package.json +++ b/packages/create-vite/package.json @@ -1,6 +1,6 @@ { "name": "create-vite", - "version": "2.6.6", + "version": "2.7.0", "license": "MIT", "author": "Evan You", "bin": { diff --git a/packages/create-vite/template-lit-ts/package.json b/packages/create-vite/template-lit-ts/package.json index cb1223e353ba87..fcc4d78b72bf0b 100644 --- a/packages/create-vite/template-lit-ts/package.json +++ b/packages/create-vite/template-lit-ts/package.json @@ -18,7 +18,7 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.6.13", + "vite": "^2.7.0", "typescript": "^4.4.4" } } diff --git a/packages/create-vite/template-lit/package.json b/packages/create-vite/template-lit/package.json index 1db755e53d6793..9864c7b7e2fcc5 100644 --- a/packages/create-vite/template-lit/package.json +++ b/packages/create-vite/template-lit/package.json @@ -16,6 +16,6 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.6.13" + "vite": "^2.7.0" } } diff --git a/packages/create-vite/template-preact-ts/package.json b/packages/create-vite/template-preact-ts/package.json index 232a4928f400a7..091c1356335cdf 100644 --- a/packages/create-vite/template-preact-ts/package.json +++ b/packages/create-vite/template-preact-ts/package.json @@ -12,6 +12,6 @@ "devDependencies": { "@preact/preset-vite": "^2.1.5", "typescript": "^4.4.4", - "vite": "^2.6.13" + "vite": "^2.7.0" } } diff --git a/packages/create-vite/template-preact/package.json b/packages/create-vite/template-preact/package.json index 581350d5797c85..1ba3ee754d4f32 100644 --- a/packages/create-vite/template-preact/package.json +++ b/packages/create-vite/template-preact/package.json @@ -11,6 +11,6 @@ }, "devDependencies": { "@preact/preset-vite": "^2.1.5", - "vite": "^2.6.13" + "vite": "^2.7.0" } } diff --git a/packages/create-vite/template-react-ts/package.json b/packages/create-vite/template-react-ts/package.json index f85994c5273f1a..a15b23787a5dd7 100644 --- a/packages/create-vite/template-react-ts/package.json +++ b/packages/create-vite/template-react-ts/package.json @@ -15,6 +15,6 @@ "@types/react-dom": "^17.0.10", "@vitejs/plugin-react": "^1.0.7", "typescript": "^4.4.4", - "vite": "^2.6.13" + "vite": "^2.7.0" } } diff --git a/packages/create-vite/template-react/package.json b/packages/create-vite/template-react/package.json index 302ea55153ea11..dd4dcddef1191e 100644 --- a/packages/create-vite/template-react/package.json +++ b/packages/create-vite/template-react/package.json @@ -12,6 +12,6 @@ }, "devDependencies": { "@vitejs/plugin-react": "^1.0.7", - "vite": "^2.6.13" + "vite": "^2.7.0" } } diff --git a/packages/create-vite/template-svelte-ts/package.json b/packages/create-vite/template-svelte-ts/package.json index 1f6009d7fbf4c6..30ac18e133e52a 100644 --- a/packages/create-vite/template-svelte-ts/package.json +++ b/packages/create-vite/template-svelte-ts/package.json @@ -16,6 +16,6 @@ "svelte-preprocess": "^4.9.8", "tslib": "^2.3.1", "typescript": "^4.4.4", - "vite": "^2.6.13" + "vite": "^2.7.0" } } diff --git a/packages/create-vite/template-svelte/package.json b/packages/create-vite/template-svelte/package.json index f438d1acbdc972..46847c242ed996 100644 --- a/packages/create-vite/template-svelte/package.json +++ b/packages/create-vite/template-svelte/package.json @@ -10,6 +10,6 @@ "devDependencies": { "@sveltejs/vite-plugin-svelte": "^1.0.0-next.30", "svelte": "^3.44.0", - "vite": "^2.6.13" + "vite": "^2.7.0" } } diff --git a/packages/create-vite/template-vanilla-ts/package.json b/packages/create-vite/template-vanilla-ts/package.json index f5ead1b62c6066..7256a8e2e3c10e 100644 --- a/packages/create-vite/template-vanilla-ts/package.json +++ b/packages/create-vite/template-vanilla-ts/package.json @@ -8,6 +8,6 @@ }, "devDependencies": { "typescript": "^4.4.4", - "vite": "^2.6.13" + "vite": "^2.7.0" } } diff --git a/packages/create-vite/template-vanilla/package.json b/packages/create-vite/template-vanilla/package.json index 89411d9e9146ab..eee96669c91888 100644 --- a/packages/create-vite/template-vanilla/package.json +++ b/packages/create-vite/template-vanilla/package.json @@ -7,6 +7,6 @@ "preview": "vite preview" }, "devDependencies": { - "vite": "^2.6.13" + "vite": "^2.7.0" } } diff --git a/packages/create-vite/template-vue-ts/package.json b/packages/create-vite/template-vue-ts/package.json index 7a531c83934185..cdf88c987fbe9f 100644 --- a/packages/create-vite/template-vue-ts/package.json +++ b/packages/create-vite/template-vue-ts/package.json @@ -10,9 +10,9 @@ "vue": "^3.2.23" }, "devDependencies": { - "@vitejs/plugin-vue": "^1.9.4", + "@vitejs/plugin-vue": "^1.10.2", "typescript": "^4.4.4", - "vite": "^2.6.13", + "vite": "^2.7.0", "vue-tsc": "^0.28.10" } } diff --git a/packages/create-vite/template-vue/package.json b/packages/create-vite/template-vue/package.json index 1ae577be5931b6..e47a7484ea000e 100644 --- a/packages/create-vite/template-vue/package.json +++ b/packages/create-vite/template-vue/package.json @@ -10,7 +10,7 @@ "vue": "^3.2.23" }, "devDependencies": { - "@vitejs/plugin-vue": "^1.9.4", - "vite": "^2.6.13" + "@vitejs/plugin-vue": "^1.10.2", + "vite": "^2.7.0" } } From dc0845c582de96a94166c6d027a91d19876f2219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E6=B8=B8=E5=90=9B?= Date: Tue, 7 Dec 2021 17:23:59 +0800 Subject: [PATCH 0042/1287] docs(ssr): fix tip Note block render (#5984) --- docs/guide/ssr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/ssr.md b/docs/guide/ssr.md index 115517ffddde25..e60f06e12789ed 100644 --- a/docs/guide/ssr.md +++ b/docs/guide/ssr.md @@ -251,7 +251,7 @@ export function mySSRPlugin() { The options object in `load` and `transform` is optional, rollup is not currently using this object but may extend these hooks with additional metadata in the future. -::: tip Note +:::tip Note Before Vite 2.7, this was informed to plugin hooks with a positional `ssr` param instead of using the `options` object. All major frameworks and plugins are updated but you may find outdated posts using the previous API. ::: From 11027892aa601c6600f98a03c0e141439cea1240 Mon Sep 17 00:00:00 2001 From: patak Date: Tue, 7 Dec 2021 11:28:24 +0100 Subject: [PATCH 0043/1287] chore: update changelog for 2.7 (#5985) --- packages/vite/CHANGELOG.md | 61 ++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 13817465f09763..1bd80b9028b7f9 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,5 +1,37 @@ # [2.7.0](https://github.com/vitejs/vite/compare/v2.7.0-beta.11...v2.7.0) (2021-12-07) +- 🎉 Revamped SSR dependency handling +- 🧩 API consolidation +- 🛑 server.fs.strict by default + +### BREAKING CHANGES + +- `server.fs.strict` is `true` by default ([#5341](https://github.com/vitejs/vite/pull/5341)) + See [server filesystem restriction docs](https://vitejs.dev/config/#server-fs-strict) for more details. +- Plugin hooks `ssr` param to object in `resolveId`, `load`, and `transform` ([#5253](https://github.com/vitejs/vite/pull/5253)) + Previous to this release, the `ssr` param was passed as a `boolean` in the last parameter of each hook. The new interface for these hooks is now: + ```ts + export interface Plugin extends RollupPlugin { + // ... other hooks + resolveId?(this: PluginContext, source: string, importer: string | undefined, options: { + custom?: CustomPluginOptions; + ssr?: boolean; + }): Promise | ResolveIdResult; + load?(this: PluginContext, id: string, options?: { + ssr?: boolean; + }): Promise | LoadResult; + transform?(this: TransformPluginContext, code: string, id: string, options?: { + ssr?: boolean; + }): Promise | TransformResult; + } + ``` + In your plugins, you can check if the last param is a boolean or an object to be backward compatible with 2.6 and give some time to users to migrate to Vite 2.7. +- `server.pluginContainer` options object for `resolveId`, `load`, and `transform` ([#5294](https://github.com/vitejs/vite/pull/5294)) +- Normalize scripts and commands naming ([#5207](https://github.com/vitejs/vite/pull/5207)) + Adds a new `vite dev` command alias for `vite serve`, preparing for the new release of create-vite where package scripts are renamed to `dev`, `build`, and `preview`. +- Align experimental `preview` api ([#5407](https://github.com/vitejs/vite/pull/5407)) + This API was first introduced in 2.6 and it is still in flux. +- resolve `rollupOptions.input` paths ([#5601](https://github.com/vitejs/vite/pull/5601)) ### Features @@ -160,35 +192,6 @@ # [2.7.0-beta.0](https://github.com/vitejs/vite/compare/v2.6.13...v2.7.0-beta.0) (2021-10-28) - -### BREAKING CHANGES - -- `server.fs.strict` is `true` by default ([#5341](https://github.com/vitejs/vite/pull/5341)) - See [server filesystem restriction docs](https://vitejs.dev/config/#server-fs-strict) for more details. -- Plugin hooks `ssr` param to object in `resolveId`, `load`, and `transform` ([#5253](https://github.com/vitejs/vite/pull/5253)) - Previous to this release, the `ssr` param was passed as a `boolean` in the last parameter of each hook. The new interface for these hooks is now: - ```ts - export interface Plugin extends RollupPlugin { - // ... other hooks - resolveId?(this: PluginContext, source: string, importer: string | undefined, options: { - custom?: CustomPluginOptions; - ssr?: boolean; - }): Promise | ResolveIdResult; - load?(this: PluginContext, id: string, options?: { - ssr?: boolean; - }): Promise | LoadResult; - transform?(this: TransformPluginContext, code: string, id: string, options?: { - ssr?: boolean; - }): Promise | TransformResult; - } - ``` - In your plugins, you can check if the last param is a boolean or an object to be backward compatible with 2.6 and give some time to users to migrate to Vite 2.7. -- `server.pluginContainer` options object for `resolveId`, `load`, and `transform` ([#5294](https://github.com/vitejs/vite/pull/5294)) -- Normalize scripts and commands naming ([#5207](https://github.com/vitejs/vite/pull/5207)) - Adds a new `vite dev` command alias for `vite serve`, preparing for the new release of create-vite where package scripts are renamed to `dev`, `build`, and `preview`. -- Align experimental `preview` api ([#5407](https://github.com/vitejs/vite/pull/5407)) - This API was first introduced in 2.6 and it is still in flux. - ### Bug Fixes * add `import` support to `ssrModuleLoader` ([#5197](https://github.com/vitejs/vite/issues/5197)) ([baba1f9](https://github.com/vitejs/vite/commit/baba1f9e8fb22254b3858bcc1ffe89b334736068)) From 79aa68744cf17553448bce5c175a25f785e4a743 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 7 Dec 2021 23:51:17 +0800 Subject: [PATCH 0044/1287] fix(ssr): `ssrTransform` handling for empty ArrayPattern (#5988) --- packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts | 6 ++++++ packages/vite/src/node/ssr/ssrTransform.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts index a5c452d79c60e9..f63c9f5036767f 100644 --- a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts +++ b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts @@ -375,3 +375,9 @@ test('overwrite bindings', async () => { " `) }) + +test('Empty array pattern', async () => { + expect( + (await ssrTransform(`const [, LHS, RHS] = inMatch;`, null, null)).code + ).toMatchInlineSnapshot(`"const [, LHS, RHS] = inMatch;"`) +}) diff --git a/packages/vite/src/node/ssr/ssrTransform.ts b/packages/vite/src/node/ssr/ssrTransform.ts index 487208560a7e9b..394906816453f9 100644 --- a/packages/vite/src/node/ssr/ssrTransform.ts +++ b/packages/vite/src/node/ssr/ssrTransform.ts @@ -347,7 +347,7 @@ function walk( } }) } else if (node.id.type === 'ArrayPattern') { - node.id.elements.forEach((element) => { + node.id.elements.filter(Boolean).forEach((element) => { setScope(parentFunction, (element as Identifier).name) }) } else { From b625a2cf3730fda94d934b23bcec0c859bfa0b24 Mon Sep 17 00:00:00 2001 From: patak-js Date: Tue, 7 Dec 2021 18:28:22 +0100 Subject: [PATCH 0045/1287] release: v2.7.1 --- packages/vite/CHANGELOG.md | 9 +++++++++ packages/vite/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 1bd80b9028b7f9..382ae98efe085d 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,12 @@ +## [2.7.1](https://github.com/vitejs/vite/compare/v2.7.0...v2.7.1) (2021-12-07) + + +### Bug Fixes + +* **ssr:** `ssrTransform` handling for empty ArrayPattern ([#5988](https://github.com/vitejs/vite/issues/5988)) ([79aa687](https://github.com/vitejs/vite/commit/79aa68744cf17553448bce5c175a25f785e4a743)) + + + # [2.7.0](https://github.com/vitejs/vite/compare/v2.7.0-beta.11...v2.7.0) (2021-12-07) - 🎉 Revamped SSR dependency handling diff --git a/packages/vite/package.json b/packages/vite/package.json index 2dafab95ae3b12..3fcee0399cd05d 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.7.0", + "version": "2.7.1", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From df7aec7d2a567af1dfbab76e5765aba80dc3cb5c Mon Sep 17 00:00:00 2001 From: poyoho <36070057+poyoho@users.noreply.github.com> Date: Wed, 8 Dec 2021 22:42:42 +0800 Subject: [PATCH 0046/1287] fix(plugin-vue): multiple vue files using the same src file (fix #5925, #5447) (#5994) --- packages/playground/vue/src-import/SrcImport.vue | 3 ++- packages/playground/vue/src-import/script.ts | 6 ++++++ .../playground/vue/src-import/srcImportStyle.vue | 7 +++++++ .../playground/vue/src-import/srcImportStyle2.vue | 4 ++++ packages/playground/vue/src-import/style2.css | 3 +++ packages/playground/vue/src-import/template.html | 2 ++ packages/plugin-vue/src/index.ts | 7 +++++-- packages/plugin-vue/src/main.ts | 10 +++++----- packages/plugin-vue/src/utils/descriptorCache.ts | 15 ++++++++++++--- packages/plugin-vue/src/utils/query.ts | 5 +---- 10 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 packages/playground/vue/src-import/srcImportStyle.vue create mode 100644 packages/playground/vue/src-import/srcImportStyle2.vue create mode 100644 packages/playground/vue/src-import/style2.css diff --git a/packages/playground/vue/src-import/SrcImport.vue b/packages/playground/vue/src-import/SrcImport.vue index ac7ec78c869e65..d70e1f48a84331 100644 --- a/packages/playground/vue/src-import/SrcImport.vue +++ b/packages/playground/vue/src-import/SrcImport.vue @@ -1,3 +1,4 @@ + + - diff --git a/packages/playground/vue/src-import/script.ts b/packages/playground/vue/src-import/script.ts index c7712fc4b755b6..54e6e35db41f46 100644 --- a/packages/playground/vue/src-import/script.ts +++ b/packages/playground/vue/src-import/script.ts @@ -1,6 +1,12 @@ import { defineComponent } from 'vue' +import SrcImportStyle from './srcImportStyle.vue' +import SrcImportStyle2 from './srcImportStyle2.vue' export default defineComponent({ + components: { + SrcImportStyle, + SrcImportStyle2 + }, setup() { return { msg: 'hello from script src!' diff --git a/packages/playground/vue/src-import/srcImportStyle.vue b/packages/playground/vue/src-import/srcImportStyle.vue new file mode 100644 index 00000000000000..de91769858fe93 --- /dev/null +++ b/packages/playground/vue/src-import/srcImportStyle.vue @@ -0,0 +1,7 @@ + + + diff --git a/packages/playground/vue/src-import/srcImportStyle2.vue b/packages/playground/vue/src-import/srcImportStyle2.vue new file mode 100644 index 00000000000000..1e0f327413103e --- /dev/null +++ b/packages/playground/vue/src-import/srcImportStyle2.vue @@ -0,0 +1,4 @@ + + diff --git a/packages/playground/vue/src-import/style2.css b/packages/playground/vue/src-import/style2.css new file mode 100644 index 00000000000000..8c93cb983cc09d --- /dev/null +++ b/packages/playground/vue/src-import/style2.css @@ -0,0 +1,3 @@ +.src-imports-script { + color: #0088ff; +} diff --git a/packages/playground/vue/src-import/template.html b/packages/playground/vue/src-import/template.html index 305bbad0fbc2f6..6b55c545daac6a 100644 --- a/packages/playground/vue/src-import/template.html +++ b/packages/playground/vue/src-import/template.html @@ -1,3 +1,5 @@

SFC Src Imports

{{ msg }}
This should be tan
+ + diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index 71ec6e7a4bef47..9862a9daaf9044 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -9,7 +9,7 @@ import { } from '@vue/compiler-sfc' import { compiler } from './compiler' import { parseVueRequest } from './utils/query' -import { getDescriptor } from './utils/descriptorCache' +import { getDescriptor, getSrcDescriptor } from './utils/descriptorCache' import { getResolvedScript } from './script' import { transformMain } from './main' import { handleHotUpdate } from './handleHotUpdate' @@ -223,7 +223,10 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { ) } else { // sub block request - const descriptor = getDescriptor(filename, options)! + const descriptor = query.src + ? getSrcDescriptor(filename, query)! + : getDescriptor(filename, options)! + if (query.type === 'template') { return transformTemplateAsModule(code, descriptor, options, this, ssr) } else if (query.type === 'style') { diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index bb3076763844bd..9df5ba44da9043 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -6,7 +6,7 @@ import { ResolvedOptions } from '.' import { createDescriptor, getPrevDescriptor, - setDescriptor + setSrcDescriptor } from './utils/descriptorCache' import { PluginContext, SourceMap, TransformPluginContext } from 'rollup' import { normalizePath } from '@rollup/pluginutils' @@ -237,7 +237,7 @@ async function genTemplateCode( await linkSrcToDescriptor(template.src, descriptor, pluginContext) } const src = template.src || descriptor.filename - const srcQuery = template.src ? `&src` : `` + const srcQuery = template.src ? `&src=${descriptor.id}` : `` const attrsQuery = attrsToQuery(template.attrs, 'js', true) const query = `?vue&type=template${srcQuery}${attrsQuery}` const request = JSON.stringify(src + query) @@ -279,7 +279,7 @@ async function genScriptCode( const src = script.src || descriptor.filename const langFallback = (script.src && path.extname(src).slice(1)) || 'js' const attrsQuery = attrsToQuery(script.attrs, langFallback) - const srcQuery = script.src ? `&src` : `` + const srcQuery = script.src ? `&src=${descriptor.id}` : `` const query = `?vue&type=script${srcQuery}${attrsQuery}` const request = JSON.stringify(src + query) scriptCode = @@ -310,7 +310,7 @@ async function genStyleCode( // do not include module in default query, since we use it to indicate // that the module needs to export the modules json const attrsQuery = attrsToQuery(style.attrs, 'css') - const srcQuery = style.src ? `&src` : `` + const srcQuery = style.src ? `&src=${descriptor.id}` : `` const directQuery = asCustomElement ? `&inline` : `` const query = `?vue&type=style&index=${i}${srcQuery}${directQuery}` const styleRequest = src + query + attrsQuery @@ -397,7 +397,7 @@ async function linkSrcToDescriptor( (await pluginContext.resolve(src, descriptor.filename))?.id || src // #1812 if the src points to a dep file, the resolved id may contain a // version query. - setDescriptor(srcFile.replace(/\?.*$/, ''), descriptor) + setSrcDescriptor(srcFile.replace(/\?.*$/, ''), descriptor) } // these are built-in query parameters so should be ignored diff --git a/packages/plugin-vue/src/utils/descriptorCache.ts b/packages/plugin-vue/src/utils/descriptorCache.ts index dde91e21d077e5..432b5f8f792255 100644 --- a/packages/plugin-vue/src/utils/descriptorCache.ts +++ b/packages/plugin-vue/src/utils/descriptorCache.ts @@ -3,7 +3,7 @@ import path from 'path' import slash from 'slash' import hash from 'hash-sum' import { CompilerError, SFCDescriptor } from '@vue/compiler-sfc' -import { ResolvedOptions } from '..' +import { ResolvedOptions, VueQuery } from '..' import { compiler } from '../compiler' // node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts SFCParseResult should be exported so it can be re-used @@ -66,6 +66,15 @@ export function getDescriptor( } } -export function setDescriptor(filename: string, entry: SFCDescriptor): void { - cache.set(filename, entry) +export function getSrcDescriptor( + filename: string, + query: VueQuery +): SFCDescriptor { + return cache.get(`${filename}?src=${query.src}`)! +} + +export function setSrcDescriptor(filename: string, entry: SFCDescriptor): void { + // if multiple Vue files use the same src file, they will be overwritten + // should use other key + cache.set(`${filename}?src=${entry.id}`, entry) } diff --git a/packages/plugin-vue/src/utils/query.ts b/packages/plugin-vue/src/utils/query.ts index bd99ab6fa8bb55..d41cb1be2cf536 100644 --- a/packages/plugin-vue/src/utils/query.ts +++ b/packages/plugin-vue/src/utils/query.ts @@ -2,7 +2,7 @@ import qs from 'querystring' export interface VueQuery { vue?: boolean - src?: boolean + src?: string type?: 'script' | 'template' | 'style' | 'custom' index?: number lang?: string @@ -18,9 +18,6 @@ export function parseVueRequest(id: string): { if (query.vue != null) { query.vue = true } - if (query.src != null) { - query.src = true - } if (query.index != null) { query.index = Number(query.index) } From 8161d4a9359ebb17ed80be8143a697427ab132a7 Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Thu, 9 Dec 2021 04:02:27 -0500 Subject: [PATCH 0047/1287] chore: use node tsconfig in all src/node builds (#6019) --- packages/vite/rollup.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vite/rollup.config.js b/packages/vite/rollup.config.js index f7fb887a09c809..8d125102d7d8dd 100644 --- a/packages/vite/rollup.config.js +++ b/packages/vite/rollup.config.js @@ -124,6 +124,8 @@ const createNodeConfig = (isProduction) => { }), nodeResolve({ preferBuiltins: true }), typescript({ + tsconfig: 'src/node/tsconfig.json', + module: 'esnext', target: 'es2019', include: ['src/**/*.ts', 'types/**'], exclude: ['src/**/__tests__/**'], @@ -133,7 +135,6 @@ const createNodeConfig = (isProduction) => { ...(isProduction ? {} : { - tsconfig: 'tsconfig.base.json', declaration: true, declarationDir: path.resolve(__dirname, 'dist/') }) From e1d82fc853e67943faa395b9b4ff0575cf614bd0 Mon Sep 17 00:00:00 2001 From: ygj6 <7699524+ygj6@users.noreply.github.com> Date: Thu, 9 Dec 2021 21:36:21 +0800 Subject: [PATCH 0048/1287] test: use `bcrypt` instead of `node-addon` (#6036) --- .gitignore | 1 - .../ssr-deps/__tests__/ssr-deps.spec.ts | 6 +- .../playground/ssr-deps/node-addon/README.md | 3 - .../ssr-deps/node-addon/binding.gyp | 10 - .../playground/ssr-deps/node-addon/index.js | 3 - .../playground/ssr-deps/node-addon/main.cpp | 15 - .../ssr-deps/node-addon/package.json | 11 - packages/playground/ssr-deps/package.json | 10 +- packages/playground/ssr-deps/src/app.js | 6 +- packages/playground/ssr-deps/vite.config.js | 7 +- pnpm-lock.yaml | 379 +++++++----------- 11 files changed, 166 insertions(+), 285 deletions(-) delete mode 100644 packages/playground/ssr-deps/node-addon/README.md delete mode 100644 packages/playground/ssr-deps/node-addon/binding.gyp delete mode 100644 packages/playground/ssr-deps/node-addon/index.js delete mode 100644 packages/playground/ssr-deps/node-addon/main.cpp delete mode 100644 packages/playground/ssr-deps/node-addon/package.json diff --git a/.gitignore b/.gitignore index 200acefca621e6..6a9f8063929462 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,3 @@ explorations /packages/vite/LICENSE *.cpuprofile /.vscode/ -/packages/playground/ssr-deps/node-addon/build/ diff --git a/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts b/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts index 4873b55eb82461..4922310a8b0ca8 100644 --- a/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts +++ b/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts @@ -8,9 +8,11 @@ const url = `http://localhost:${port}` * NOTE: This test will always succeed now, unless the temporary workaround for Jest can be removed * See https://github.com/vitejs/vite/pull/5197#issuecomment-938054077 */ -test('msg from node addon', async () => { +test('msg should be encrypted', async () => { await page.goto(url) - expect(await page.textContent('.node-addon-msg')).toMatch('Hello World!') + expect(await page.textContent('.encrypted-msg')).not.toMatch( + 'Secret Message!' + ) }) test('msg read by fs/promises', async () => { diff --git a/packages/playground/ssr-deps/node-addon/README.md b/packages/playground/ssr-deps/node-addon/README.md deleted file mode 100644 index 824c79ebc5a832..00000000000000 --- a/packages/playground/ssr-deps/node-addon/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This test aim to correctly resolve the `.node` file when loading CJS and ESM using dynamic import - -Steps to build `.node` file, refer to [here](https://nodejs.org/api/addons.html#building) diff --git a/packages/playground/ssr-deps/node-addon/binding.gyp b/packages/playground/ssr-deps/node-addon/binding.gyp deleted file mode 100644 index e141d88eb32edb..00000000000000 --- a/packages/playground/ssr-deps/node-addon/binding.gyp +++ /dev/null @@ -1,10 +0,0 @@ -{ - "targets": [ - { - "target_name": "cpp_addon", - "sources": [ - "main.cpp" - ] - } - ] -} diff --git a/packages/playground/ssr-deps/node-addon/index.js b/packages/playground/ssr-deps/node-addon/index.js deleted file mode 100644 index 75bf8b92e50ebb..00000000000000 --- a/packages/playground/ssr-deps/node-addon/index.js +++ /dev/null @@ -1,3 +0,0 @@ -const path = require('path') -const cpp = require(path.resolve(__dirname, './build/Release/cpp_addon.node')) -exports.hello = cpp.hello diff --git a/packages/playground/ssr-deps/node-addon/main.cpp b/packages/playground/ssr-deps/node-addon/main.cpp deleted file mode 100644 index fcc5de956aae7e..00000000000000 --- a/packages/playground/ssr-deps/node-addon/main.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -using namespace v8; - -void HelloWorld(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - Local hello = String::NewFromUtf8(isolate, "Hello World!", NewStringType::kNormal).ToLocalChecked(); - args.GetReturnValue().Set(hello); -} - -void Init(Local exports) { - NODE_SET_METHOD(exports, "hello", HelloWorld); -} - -NODE_MODULE(cpp_addon, Init) diff --git a/packages/playground/ssr-deps/node-addon/package.json b/packages/playground/ssr-deps/node-addon/package.json deleted file mode 100644 index 50a4ab21c20419..00000000000000 --- a/packages/playground/ssr-deps/node-addon/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "node-addon", - "version": "0.0.0", - "private": true, - "scripts": { - "install": "node-gyp install && node-gyp rebuild" - }, - "dependencies": { - "node-gyp": "^8.4.1" - } -} diff --git a/packages/playground/ssr-deps/package.json b/packages/playground/ssr-deps/package.json index ab6b29a9fb59eb..4ba3c45031731b 100644 --- a/packages/playground/ssr-deps/package.json +++ b/packages/playground/ssr-deps/package.json @@ -9,12 +9,12 @@ "postinstall": "node ../../../scripts/patchFileDeps.cjs" }, "dependencies": { - "node-addon": "link:./node-addon", - "primitive-export": "link:./primitive-export", + "bcrypt": "^5.0.1", + "forwarded-export": "file:./forwarded-export", + "object-assigned-exports": "file:./object-assigned-exports", + "primitive-export": "file:./primitive-export", "read-file-content": "file:./read-file-content", - "ts-transpiled-exports": "link:./ts-transpiled-exports", - "object-assigned-exports": "link:./object-assigned-exports", - "forwarded-export": "link:./forwarded-export" + "ts-transpiled-exports": "file:./ts-transpiled-exports" }, "devDependencies": { "cross-env": "^7.0.3", diff --git a/packages/playground/ssr-deps/src/app.js b/packages/playground/ssr-deps/src/app.js index c7748978264fc9..bbe6ec7f396219 100644 --- a/packages/playground/ssr-deps/src/app.js +++ b/packages/playground/ssr-deps/src/app.js @@ -1,16 +1,16 @@ import path from 'path' -import { hello } from 'node-addon' import readFileContent from 'read-file-content' import primitiveExport from 'primitive-export' import tsDefaultExport, { hello as tsNamedExport } from 'ts-transpiled-exports' import objectAssignedExports from 'object-assigned-exports' import forwardedExport from 'forwarded-export' +import bcrypt from 'bcrypt' export async function render(url, rootDir) { let html = '' - const nodeAddonMsg = hello() - html += `\n

message from node addon: ${nodeAddonMsg}

` + const encryptedMsg = await bcrypt.hash('Secret Message!', 10) + html += `\n

encrypted message: ${encryptedMsg}

` const fileContent = await readFileContent(path.resolve(rootDir, 'message')) html += `\n

msg read via fs/promises: ${fileContent}

` diff --git a/packages/playground/ssr-deps/vite.config.js b/packages/playground/ssr-deps/vite.config.js index 491f4c924a8c62..96a2eb87f4cb2d 100644 --- a/packages/playground/ssr-deps/vite.config.js +++ b/packages/playground/ssr-deps/vite.config.js @@ -2,10 +2,7 @@ * @type {import('vite').UserConfig} */ module.exports = { - resolve: { - // The dependency `node-addon` needs to be linked to node_modules and preserve symlinks, - // because the `.node` file cannot be unlinked in Windows after being filed to node_modules - // ref: https://github.com/nodejs/node/issues/24878/ - preserveSymlinks: true + ssr: { + external: ['object-assigned-exports'] } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 65883837bdd6dc..e8410cd78ab97c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -456,17 +456,17 @@ importers: packages/playground/ssr-deps: specifiers: + bcrypt: ^5.0.1 cross-env: ^7.0.3 express: ^4.17.1 - forwarded-export: link:./forwarded-export - node-addon: link:./node-addon - object-assigned-exports: link:./object-assigned-exports - primitive-export: link:./primitive-export + forwarded-export: file:./forwarded-export + object-assigned-exports: file:./object-assigned-exports + primitive-export: file:./primitive-export read-file-content: file:./read-file-content - ts-transpiled-exports: link:./ts-transpiled-exports + ts-transpiled-exports: file:./ts-transpiled-exports dependencies: + bcrypt: 5.0.1 forwarded-export: link:forwarded-export - node-addon: link:node-addon object-assigned-exports: link:object-assigned-exports primitive-export: link:primitive-export read-file-content: link:read-file-content @@ -478,12 +478,6 @@ importers: packages/playground/ssr-deps/forwarded-export: specifiers: {} - packages/playground/ssr-deps/node-addon: - specifiers: - node-gyp: ^8.4.1 - dependencies: - node-gyp: 8.4.1 - packages/playground/ssr-deps/object-assigned-exports: specifiers: {} @@ -1556,10 +1550,6 @@ packages: resolution: {integrity: sha512-bprfNmYt1opFUFEtD2XfY/kEsm13bzHQgU80uMjhuK0DJ914IjolT1GytpkdM6tJ4MBvyiJPP+bTtWO+BZ7c7w==} dev: true - /@gar/promisify/1.1.2: - resolution: {integrity: sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw==} - dev: false - /@humanwhocodes/config-array/0.6.0: resolution: {integrity: sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A==} engines: {node: '>=10.10.0'} @@ -1667,6 +1657,16 @@ packages: jest-mock: 27.3.0 dev: true + /@jest/environment/27.4.2: + resolution: {integrity: sha512-uSljKxh/rGlHlmhyeG4ZoVK9hOec+EPBkwTHkHKQ2EqDu5K+MaG9uJZ8o1CbRsSdZqSuhXvJCYhBWsORPPg6qw==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + dependencies: + '@jest/fake-timers': 27.4.2 + '@jest/types': 27.4.2 + '@types/node': 16.11.9 + jest-mock: 27.4.2 + dev: true + /@jest/fake-timers/27.3.1: resolution: {integrity: sha512-M3ZFgwwlqJtWZ+QkBG5NmC23A9w+A6ZxNsO5nJxJsKYt4yguBd3i8TpjQz5NfCX91nEve1KqD9RA2Q+Q1uWqoA==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} @@ -1679,6 +1679,18 @@ packages: jest-util: 27.3.1 dev: true + /@jest/fake-timers/27.4.2: + resolution: {integrity: sha512-f/Xpzn5YQk5adtqBgvw1V6bF8Nx3hY0OIRRpCvWcfPl0EAjdqWPdhH3t/3XpiWZqtjIEHDyMKP9ajpva1l4Zmg==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + dependencies: + '@jest/types': 27.4.2 + '@sinonjs/fake-timers': 8.1.0 + '@types/node': 16.11.9 + jest-message-util: 27.4.2 + jest-mock: 27.4.2 + jest-util: 27.4.2 + dev: true + /@jest/globals/27.3.1: resolution: {integrity: sha512-Q651FWiWQAIFiN+zS51xqhdZ8g9b88nGCobC87argAxA7nMfNQq0Q0i9zTfQYgLa6qFXk2cGANEqfK051CZ8Pg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} @@ -1791,11 +1803,39 @@ packages: chalk: 4.1.2 dev: true + /@jest/types/27.4.2: + resolution: {integrity: sha512-j35yw0PMTPpZsUoOBiuHzr1zTYoad1cVIE0ajEjcrJONxxrko/IRGKkXx3os0Nsi4Hu3+5VmDbVfq5WhG/pWAg==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + dependencies: + '@types/istanbul-lib-coverage': 2.0.3 + '@types/istanbul-reports': 3.0.1 + '@types/node': 16.11.9 + '@types/yargs': 16.0.4 + chalk: 4.1.2 + dev: true + /@jridgewell/resolve-uri/1.0.0: resolution: {integrity: sha512-9oLAnygRMi8Q5QkYEU4XWK04B+nuoXoxjRvRxgjuChkLZFBja0YPSgdZ7dZtwhncLBcQe/I/E+fLuk5qxcYVJA==} engines: {node: '>=6.0.0'} dev: true + /@mapbox/node-pre-gyp/1.0.7: + resolution: {integrity: sha512-PplSvl4pJ5N3BkVjAdDzpPhVUPdC73JgttkR+LnBx2OORC1GCQsBjUeEuipf9uOaAM1SbxcdZFfR3KDTKm2S0A==} + hasBin: true + dependencies: + detect-libc: 1.0.3 + https-proxy-agent: 5.0.0 + make-dir: 3.1.0 + node-fetch: 2.6.6 + nopt: 5.0.0 + npmlog: 6.0.0 + rimraf: 3.0.2 + semver: 7.3.5 + tar: 6.1.11 + transitivePeerDependencies: + - supports-color + dev: false + /@microsoft/api-extractor-model/7.13.16: resolution: {integrity: sha512-ttdxVXsTWL5dd26W1YNLe3LgDsE0EE273aZlcLe58W0opymBybCYU1Mn+OHQM8BuErrdvdN8LdpWAAbkiOEN/Q==} dependencies: @@ -1863,21 +1903,6 @@ packages: '@nodelib/fs.scandir': 2.1.5 fastq: 1.13.0 - /@npmcli/fs/1.0.0: - resolution: {integrity: sha512-8ltnOpRR/oJbOp8vaGUnipOi3bqkcW+sLHFlyXIr08OGHmVJLB1Hn7QtGXbYcpVtH1gAYZTlmDXtE4YV0+AMMQ==} - dependencies: - '@gar/promisify': 1.1.2 - semver: 7.3.5 - dev: false - - /@npmcli/move-file/1.1.2: - resolution: {integrity: sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==} - engines: {node: '>=10'} - dependencies: - mkdirp: 1.0.4 - rimraf: 3.0.2 - dev: false - /@peculiar/asn1-schema/2.0.38: resolution: {integrity: sha512-zZ64UpCTm9me15nuCpPgJghSdbEm8atcDQPCyK+bKXjZAQ1735NCZXCSCfbckbQ4MH36Rm9403n/qMq77LFDzQ==} dependencies: @@ -2051,6 +2076,7 @@ packages: /@tootallnate/once/1.1.2: resolution: {integrity: sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==} engines: {node: '>= 6'} + dev: true /@tsconfig/node10/1.0.8: resolution: {integrity: sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==} @@ -2705,23 +2731,13 @@ packages: transitivePeerDependencies: - supports-color - /agentkeepalive/4.1.4: - resolution: {integrity: sha512-+V/rGa3EuU74H6wR04plBb7Ks10FbtUQgRj/FQOG7uUIEuaINI+AiqJR1k6t3SVNs7o7ZjIdus6706qqzVq8jQ==} - engines: {node: '>= 8.0.0'} - dependencies: - debug: 4.3.2 - depd: 1.1.2 - humanize-ms: 1.2.1 - transitivePeerDependencies: - - supports-color - dev: false - /aggregate-error/3.1.0: resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} engines: {node: '>=8'} dependencies: clean-stack: 2.2.0 indent-string: 4.0.0 + dev: true /ajv/6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} @@ -3003,6 +3019,17 @@ packages: engines: {node: '>=6.0.0'} dev: true + /bcrypt/5.0.1: + resolution: {integrity: sha512-9BTgmrhZM2t1bNuDtrtIMVSmmxZBrJ71n8Wg+YgdjHuIWYF7SjjmCPZFB+/5i/o/PIeRpwVJR3P+NrpIItUjqw==} + engines: {node: '>= 10.0.0'} + requiresBuild: true + dependencies: + '@mapbox/node-pre-gyp': 1.0.7 + node-addon-api: 3.2.1 + transitivePeerDependencies: + - supports-color + dev: false + /big.js/5.2.2: resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==} dev: true @@ -3101,30 +3128,6 @@ packages: engines: {node: '>=8'} dev: true - /cacache/15.3.0: - resolution: {integrity: sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==} - engines: {node: '>= 10'} - dependencies: - '@npmcli/fs': 1.0.0 - '@npmcli/move-file': 1.1.2 - chownr: 2.0.0 - fs-minipass: 2.1.0 - glob: 7.2.0 - infer-owner: 1.0.4 - lru-cache: 6.0.0 - minipass: 3.1.5 - minipass-collect: 1.0.2 - minipass-flush: 1.0.5 - minipass-pipeline: 1.2.4 - mkdirp: 1.0.4 - p-map: 4.0.0 - promise-inflight: 1.0.1 - rimraf: 3.0.2 - ssri: 8.0.1 - tar: 6.1.11 - unique-filename: 1.1.1 - dev: false - /call-bind/1.0.2: resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} dependencies: @@ -3241,6 +3244,7 @@ packages: /clean-stack/2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} engines: {node: '>=6'} + dev: true /cli-cursor/3.1.0: resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==} @@ -3912,11 +3916,18 @@ packages: /depd/1.1.2: resolution: {integrity: sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=} engines: {node: '>= 0.6'} + dev: true /destroy/1.0.4: resolution: {integrity: sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=} dev: true + /detect-libc/1.0.3: + resolution: {integrity: sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=} + engines: {node: '>=0.10'} + hasBin: true + dev: false + /detect-newline/3.1.0: resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} engines: {node: '>=8'} @@ -4032,14 +4043,6 @@ packages: engines: {node: '>= 0.8'} dev: true - /encoding/0.1.13: - resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==} - requiresBuild: true - dependencies: - iconv-lite: 0.6.3 - dev: false - optional: true - /end-of-stream/1.4.4: resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} dependencies: @@ -4056,10 +4059,7 @@ packages: /env-paths/2.2.1: resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} engines: {node: '>=6'} - - /err-code/2.0.3: - resolution: {integrity: sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==} - dev: false + dev: true /errno/0.1.8: resolution: {integrity: sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==} @@ -5077,6 +5077,7 @@ packages: /http-cache-semantics/4.1.0: resolution: {integrity: sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==} + dev: true /http-errors/1.7.2: resolution: {integrity: sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==} @@ -5109,6 +5110,7 @@ packages: debug: 4.3.2 transitivePeerDependencies: - supports-color + dev: true /http-proxy/1.18.1_debug@4.3.2: resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==} @@ -5135,12 +5137,6 @@ packages: engines: {node: '>=10.17.0'} dev: true - /humanize-ms/1.2.1: - resolution: {integrity: sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=} - dependencies: - ms: 2.1.3 - dev: false - /iconv-lite/0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} @@ -5148,14 +5144,6 @@ packages: safer-buffer: 2.1.2 dev: true - /iconv-lite/0.6.3: - resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} - engines: {node: '>=0.10.0'} - dependencies: - safer-buffer: 2.1.2 - dev: false - optional: true - /icss-replace-symbols/1.1.0: resolution: {integrity: sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=} dev: true @@ -5223,14 +5211,12 @@ packages: /imurmurhash/0.1.4: resolution: {integrity: sha1-khi5srkoojixPcT7a21XbyMUU+o=} engines: {node: '>=0.8.19'} + dev: true /indent-string/4.0.0: resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} engines: {node: '>=8'} - - /infer-owner/1.0.4: - resolution: {integrity: sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==} - dev: false + dev: true /inflight/1.0.6: resolution: {integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=} @@ -5279,6 +5265,7 @@ packages: /ip/1.1.5: resolution: {integrity: sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=} + dev: true /ipaddr.js/1.9.1: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} @@ -5384,10 +5371,6 @@ packages: dependencies: is-extglob: 2.1.1 - /is-lambda/1.0.1: - resolution: {integrity: sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=} - dev: false - /is-module/1.0.0: resolution: {integrity: sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=} dev: true @@ -5506,6 +5489,7 @@ packages: /isexe/2.0.0: resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=} + dev: true /istanbul-lib-coverage/3.2.0: resolution: {integrity: sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==} @@ -5651,7 +5635,7 @@ packages: graceful-fs: 4.2.8 jest-circus: 27.3.1 jest-environment-jsdom: 27.3.1 - jest-environment-node: 27.3.1 + jest-environment-node: 27.4.2 jest-get-type: 27.3.1 jest-jasmine2: 27.3.1 jest-regex-util: 27.0.6 @@ -5715,16 +5699,16 @@ packages: - utf-8-validate dev: true - /jest-environment-node/27.3.1: - resolution: {integrity: sha512-T89F/FgkE8waqrTSA7/ydMkcc52uYPgZZ6q8OaZgyiZkJb5QNNCF6oPZjH9IfPFfcc9uBWh1574N0kY0pSvTXw==} + /jest-environment-node/27.4.2: + resolution: {integrity: sha512-nzTZ5nJ+FabuZPH2YVci7SZIHpvtNRHPt8+vipLkCnAgXGjVzHm7XJWdnNqXbAkExIgiKeVEkVMNZOZE/LeiIg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/environment': 27.3.1 - '@jest/fake-timers': 27.3.1 - '@jest/types': 27.2.5 + '@jest/environment': 27.4.2 + '@jest/fake-timers': 27.4.2 + '@jest/types': 27.4.2 '@types/node': 16.11.9 - jest-mock: 27.3.0 - jest-util: 27.3.1 + jest-mock: 27.4.2 + jest-util: 27.4.2 dev: true /jest-get-type/27.3.1: @@ -5811,6 +5795,21 @@ packages: stack-utils: 2.0.5 dev: true + /jest-message-util/27.4.2: + resolution: {integrity: sha512-OMRqRNd9E0DkBLZpFtZkAGYOXl6ZpoMtQJWTAREJKDOFa0M6ptB7L67tp+cszMBkvSgKOhNtQp2Vbcz3ZZKo/w==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + dependencies: + '@babel/code-frame': 7.16.0 + '@jest/types': 27.4.2 + '@types/stack-utils': 2.0.1 + chalk: 4.1.2 + graceful-fs: 4.2.8 + micromatch: 4.0.4 + pretty-format: 27.4.2 + slash: 3.0.0 + stack-utils: 2.0.5 + dev: true + /jest-mock/27.3.0: resolution: {integrity: sha512-ziZiLk0elZOQjD08bLkegBzv5hCABu/c8Ytx45nJKkysQwGaonvmTxwjLqEA4qGdasq9o2I8/HtdGMNnVsMTGw==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} @@ -5819,6 +5818,14 @@ packages: '@types/node': 16.11.9 dev: true + /jest-mock/27.4.2: + resolution: {integrity: sha512-PDDPuyhoukk20JrQKeofK12hqtSka7mWH0QQuxSNgrdiPsrnYYLS6wbzu/HDlxZRzji5ylLRULeuI/vmZZDrYA==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + dependencies: + '@jest/types': 27.4.2 + '@types/node': 16.11.9 + dev: true + /jest-pnp-resolver/1.2.2_jest-resolve@27.3.1: resolution: {integrity: sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==} engines: {node: '>=6'} @@ -5879,7 +5886,7 @@ packages: graceful-fs: 4.2.8 jest-docblock: 27.0.6 jest-environment-jsdom: 27.3.1 - jest-environment-node: 27.3.1 + jest-environment-node: 27.4.2 jest-haste-map: 27.3.1 jest-leak-detector: 27.3.1 jest-message-util: 27.3.1 @@ -5982,6 +5989,18 @@ packages: picomatch: 2.3.0 dev: true + /jest-util/27.4.2: + resolution: {integrity: sha512-YuxxpXU6nlMan9qyLuxHaMMOzXAl5aGZWCSzben5DhLHemYQxCc4YK+4L3ZrCutT8GPQ+ui9k5D8rUJoDioMnA==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + dependencies: + '@jest/types': 27.4.2 + '@types/node': 16.11.9 + chalk: 4.1.2 + ci-info: 3.2.0 + graceful-fs: 4.2.8 + picomatch: 2.3.0 + dev: true + /jest-validate/27.3.1: resolution: {integrity: sha512-3H0XCHDFLA9uDII67Bwi1Vy7AqwA5HqEEjyy934lgVhtJ3eisw6ShOF1MDmRPspyikef5MyExvIm0/TuLzZ86Q==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} @@ -6418,36 +6437,11 @@ packages: engines: {node: '>=8'} dependencies: semver: 6.3.0 - dev: true /make-error/1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} dev: true - /make-fetch-happen/9.1.0: - resolution: {integrity: sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==} - engines: {node: '>= 10'} - dependencies: - agentkeepalive: 4.1.4 - cacache: 15.3.0 - http-cache-semantics: 4.1.0 - http-proxy-agent: 4.0.1 - https-proxy-agent: 5.0.0 - is-lambda: 1.0.1 - lru-cache: 6.0.0 - minipass: 3.1.5 - minipass-collect: 1.0.2 - minipass-fetch: 1.4.1 - minipass-flush: 1.0.5 - minipass-pipeline: 1.2.4 - negotiator: 0.6.2 - promise-retry: 2.0.1 - socks-proxy-agent: 6.1.0 - ssri: 8.0.1 - transitivePeerDependencies: - - supports-color - dev: false - /makeerror/1.0.12: resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} dependencies: @@ -6634,45 +6628,6 @@ packages: /minimist/1.2.5: resolution: {integrity: sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==} - /minipass-collect/1.0.2: - resolution: {integrity: sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==} - engines: {node: '>= 8'} - dependencies: - minipass: 3.1.5 - dev: false - - /minipass-fetch/1.4.1: - resolution: {integrity: sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==} - engines: {node: '>=8'} - dependencies: - minipass: 3.1.5 - minipass-sized: 1.0.3 - minizlib: 2.1.2 - optionalDependencies: - encoding: 0.1.13 - dev: false - - /minipass-flush/1.0.5: - resolution: {integrity: sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==} - engines: {node: '>= 8'} - dependencies: - minipass: 3.1.5 - dev: false - - /minipass-pipeline/1.2.4: - resolution: {integrity: sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==} - engines: {node: '>=8'} - dependencies: - minipass: 3.1.5 - dev: false - - /minipass-sized/1.0.3: - resolution: {integrity: sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==} - engines: {node: '>=8'} - dependencies: - minipass: 3.1.5 - dev: false - /minipass/3.1.5: resolution: {integrity: sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw==} engines: {node: '>=8'} @@ -6720,6 +6675,8 @@ packages: /ms/2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + dev: true + optional: true /mustache/4.2.0: resolution: {integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==} @@ -6750,6 +6707,7 @@ packages: /negotiator/0.6.2: resolution: {integrity: sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==} engines: {node: '>= 0.6'} + dev: true /neo-async/2.6.2: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} @@ -6763,6 +6721,10 @@ packages: resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==} dev: true + /node-addon-api/3.2.1: + resolution: {integrity: sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==} + dev: false + /node-cron/2.0.3: resolution: {integrity: sha512-eJI+QitXlwcgiZwNNSRbqsjeZMp5shyajMR81RZCqeW0ZDEj4zU9tpd4nTh/1JsBiKbF8d08FCewiipDmVIYjg==} engines: {node: '>=6.0.0'} @@ -6783,32 +6745,12 @@ packages: engines: {node: 4.x || >=6.0.0} dependencies: whatwg-url: 5.0.0 - dev: true /node-forge/0.10.0: resolution: {integrity: sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==} engines: {node: '>= 6.0.0'} dev: true - /node-gyp/8.4.1: - resolution: {integrity: sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w==} - engines: {node: '>= 10.12.0'} - hasBin: true - dependencies: - env-paths: 2.2.1 - glob: 7.2.0 - graceful-fs: 4.2.8 - make-fetch-happen: 9.1.0 - nopt: 5.0.0 - npmlog: 6.0.0 - rimraf: 3.0.2 - semver: 7.3.5 - tar: 6.1.11 - which: 2.0.2 - transitivePeerDependencies: - - supports-color - dev: false - /node-int64/0.4.0: resolution: {integrity: sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=} dev: true @@ -7048,6 +6990,7 @@ packages: engines: {node: '>=10'} dependencies: aggregate-error: 3.1.0 + dev: true /p-try/1.0.0: resolution: {integrity: sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=} @@ -7403,6 +7346,16 @@ packages: react-is: 17.0.2 dev: true + /pretty-format/27.4.2: + resolution: {integrity: sha512-p0wNtJ9oLuvgOQDEIZ9zQjZffK7KtyR6Si0jnXULIDwrlNF8Cuir3AZP0hHv0jmKuNN/edOnbMjnzd4uTcmWiw==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + dependencies: + '@jest/types': 27.4.2 + ansi-regex: 5.0.1 + ansi-styles: 5.2.0 + react-is: 17.0.2 + dev: true + /pretty-hrtime/1.0.3: resolution: {integrity: sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=} engines: {node: '>= 0.8'} @@ -7421,18 +7374,6 @@ packages: engines: {node: '>=0.4.0'} dev: true - /promise-inflight/1.0.1: - resolution: {integrity: sha1-mEcocL8igTL8vdhoEputEsPAKeM=} - dev: false - - /promise-retry/2.0.1: - resolution: {integrity: sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==} - engines: {node: '>=10'} - dependencies: - err-code: 2.0.3 - retry: 0.12.0 - dev: false - /promise/7.3.1: resolution: {integrity: sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==} dependencies: @@ -7899,6 +7840,7 @@ packages: /retry/0.12.0: resolution: {integrity: sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=} engines: {node: '>= 4'} + dev: true /reusify/1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} @@ -7962,6 +7904,7 @@ packages: /safer-buffer/2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + dev: true /sanitize-filename/1.6.3: resolution: {integrity: sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==} @@ -8159,6 +8102,7 @@ packages: /smart-buffer/4.2.0: resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} + dev: true /socks-proxy-agent/6.1.0: resolution: {integrity: sha512-57e7lwCN4Tzt3mXz25VxOErJKXlPfXmkMLnk310v/jwW20jWRVcgsOit+xNkN3eIEdB47GwnfAEBLacZ/wVIKg==} @@ -8169,6 +8113,7 @@ packages: socks: 2.6.1 transitivePeerDependencies: - supports-color + dev: true /socks/2.6.1: resolution: {integrity: sha512-kLQ9N5ucj8uIcxrDwjm0Jsqk06xdpBjGNQtpXy4Q8/QY2k+fY7nZH8CARy+hkbG+SGAovmzzuauCpBlb8FrnBA==} @@ -8176,6 +8121,7 @@ packages: dependencies: ip: 1.1.5 smart-buffer: 4.2.0 + dev: true /source-map-js/0.6.2: resolution: {integrity: sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==} @@ -8282,13 +8228,6 @@ packages: resolution: {integrity: sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=} dev: true - /ssri/8.0.1: - resolution: {integrity: sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==} - engines: {node: '>= 8'} - dependencies: - minipass: 3.1.5 - dev: false - /stack-trace/0.0.10: resolution: {integrity: sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=} dev: true @@ -8734,7 +8673,6 @@ packages: /tr46/0.0.3: resolution: {integrity: sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=} - dev: true /tr46/2.1.0: resolution: {integrity: sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==} @@ -8957,18 +8895,6 @@ packages: which-boxed-primitive: 1.0.2 dev: true - /unique-filename/1.1.1: - resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==} - dependencies: - unique-slug: 2.0.2 - dev: false - - /unique-slug/2.0.2: - resolution: {integrity: sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==} - dependencies: - imurmurhash: 0.1.4 - dev: false - /universalify/0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} @@ -9135,7 +9061,6 @@ packages: /webidl-conversions/3.0.1: resolution: {integrity: sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=} - dev: true /webidl-conversions/5.0.0: resolution: {integrity: sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==} @@ -9162,7 +9087,6 @@ packages: dependencies: tr46: 0.0.3 webidl-conversions: 3.0.1 - dev: true /whatwg-url/8.7.0: resolution: {integrity: sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==} @@ -9196,6 +9120,7 @@ packages: hasBin: true dependencies: isexe: 2.0.0 + dev: true /wide-align/1.1.5: resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} From d4c5cff551ad9fb721243f8abdbf0c78f5b5a7ec Mon Sep 17 00:00:00 2001 From: ygj6 <7699524+ygj6@users.noreply.github.com> Date: Sat, 11 Dec 2021 02:52:51 +0800 Subject: [PATCH 0049/1287] fix(lexGlobPattern): edge case of glob import (#6022) --- docs/guide/features.md | 1 + packages/playground/glob-import/index.html | 8 ++++- packages/vite/src/node/importGlob.ts | 34 +++++++++++++++++++++- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/docs/guide/features.md b/docs/guide/features.md index bd082c3f82254d..d46b3cdcc80f23 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -296,6 +296,7 @@ Note that: - The glob patterns are treated like import specifiers: they must be either relative (start with `./`) or absolute (start with `/`, resolved relative to project root). - The glob matching is done via `fast-glob` - check out its documentation for [supported glob patterns](https://github.com/mrmlnc/fast-glob#pattern-syntax). - You should also be aware that glob imports do not accept variables, you need to directly pass the string pattern. +- The glob patterns cannot contain the same quote string (i.e. `'`, `"`, `` ` ``) as outer quotes, e.g. `'/Tom\'s files/**'`, use `"/Tom's files/**"` instead. ## WebAssembly diff --git a/packages/playground/glob-import/index.html b/packages/playground/glob-import/index.html index b38a194e21b4f2..2262c65414db67 100644 --- a/packages/playground/glob-import/index.html +++ b/packages/playground/glob-import/index.html @@ -2,7 +2,13 @@ diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index 9aa4e4f4a289e0..119ec49d5afdc0 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -58,7 +58,7 @@ export function htmlInlineScriptProxyPlugin(config: ResolvedConfig): Plugin { const file = cleanUrl(id) const url = file.replace(normalizePath(config.root), '') const result = htmlProxyMap.get(config)!.get(url)![index] - if (result) { + if (typeof result === 'string') { return result } else { throw new Error(`No matching HTML proxy module found from ${id}`) From 5f3f6b7b406cb3371084057c74814eb36175e5cf Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Sun, 12 Dec 2021 13:09:53 +0630 Subject: [PATCH 0052/1287] fix: allow overwriting `define` options in vue & vue-jsx plugins (#6072) --- packages/plugin-vue-jsx/index.js | 11 ++++++++--- packages/plugin-vue/src/index.ts | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/plugin-vue-jsx/index.js b/packages/plugin-vue-jsx/index.js index a520ae176dd770..56c50fe2ff5e6d 100644 --- a/packages/plugin-vue-jsx/index.js +++ b/packages/plugin-vue-jsx/index.js @@ -48,6 +48,12 @@ function vueJsxPlugin(options = {}) { name: 'vite:vue-jsx', config(config) { + const optionsApi = config.define + ? config.define.__VUE_OPTIONS_API__ + : undefined + const devTools = config.define + ? config.define.__VUE_PROD_DEVTOOLS__ + : undefined return { // only apply esbuild to ts files // since we are handling jsx and tsx now @@ -55,9 +61,8 @@ function vueJsxPlugin(options = {}) { include: /\.ts$/ }, define: { - __VUE_OPTIONS_API__: true, - __VUE_PROD_DEVTOOLS__: false, - ...config.define + __VUE_OPTIONS_API__: optionsApi != null ? optionsApi : true, + __VUE_PROD_DEVTOOLS__: devTools != null ? devTools : false } } }, diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index 4df81155719459..26e2709b580c21 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -130,8 +130,8 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { config() { return { define: { - __VUE_OPTIONS_API__: true, - __VUE_PROD_DEVTOOLS__: false + __VUE_OPTIONS_API__: config.define?.__VUE_OPTIONS_API__ ?? true, + __VUE_PROD_DEVTOOLS__: config.define?.__VUE_PROD_DEVTOOLS__ ?? false }, ssr: { external: ['vue', '@vue/server-renderer'] From 5e60562254e47d2ad0aaa246d3c5016e498d98bf Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 12 Dec 2021 14:44:53 +0800 Subject: [PATCH 0053/1287] chore: bump vue version --- .../create-vite/template-vue-ts/package.json | 2 +- .../create-vite/template-vue/package.json | 2 +- packages/playground/alias/package.json | 2 +- packages/playground/extensions/package.json | 2 +- packages/playground/json/package.json | 2 +- .../playground/optimize-deps/package.json | 2 +- packages/playground/preload/package.json | 2 +- packages/playground/ssr-vue/package.json | 2 +- packages/playground/tailwind/package.json | 2 +- packages/playground/vue-jsx/package.json | 2 +- packages/playground/vue/package.json | 2 +- pnpm-lock.yaml | 164 +++++++++--------- 12 files changed, 93 insertions(+), 93 deletions(-) diff --git a/packages/create-vite/template-vue-ts/package.json b/packages/create-vite/template-vue-ts/package.json index cdf88c987fbe9f..7636704b2fca3c 100644 --- a/packages/create-vite/template-vue-ts/package.json +++ b/packages/create-vite/template-vue-ts/package.json @@ -7,7 +7,7 @@ "preview": "vite preview" }, "dependencies": { - "vue": "^3.2.23" + "vue": "^3.2.25" }, "devDependencies": { "@vitejs/plugin-vue": "^1.10.2", diff --git a/packages/create-vite/template-vue/package.json b/packages/create-vite/template-vue/package.json index e47a7484ea000e..8ed9d0c6a6d2ae 100644 --- a/packages/create-vite/template-vue/package.json +++ b/packages/create-vite/template-vue/package.json @@ -7,7 +7,7 @@ "preview": "vite preview" }, "dependencies": { - "vue": "^3.2.23" + "vue": "^3.2.25" }, "devDependencies": { "@vitejs/plugin-vue": "^1.10.2", diff --git a/packages/playground/alias/package.json b/packages/playground/alias/package.json index 1d208eb68d6513..6d17bbe99eac6d 100644 --- a/packages/playground/alias/package.json +++ b/packages/playground/alias/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "aliased-module": "file:./dir/module", - "vue": "^3.2.23" + "vue": "^3.2.25" }, "devDependencies": { "resolve-linked": "workspace:*" diff --git a/packages/playground/extensions/package.json b/packages/playground/extensions/package.json index 389a6e9c3cdff9..d09b7da4d5300b 100644 --- a/packages/playground/extensions/package.json +++ b/packages/playground/extensions/package.json @@ -9,6 +9,6 @@ "preview": "vite preview" }, "dependencies": { - "vue": "^3.2.23" + "vue": "^3.2.25" } } diff --git a/packages/playground/json/package.json b/packages/playground/json/package.json index a051accdb4883f..ae49085bf36367 100644 --- a/packages/playground/json/package.json +++ b/packages/playground/json/package.json @@ -9,6 +9,6 @@ "preview": "vite preview" }, "devDependencies": { - "vue": "^3.2.23" + "vue": "^3.2.25" } } diff --git a/packages/playground/optimize-deps/package.json b/packages/playground/optimize-deps/package.json index 67410700820be5..ca3bbd8e5b7c1f 100644 --- a/packages/playground/optimize-deps/package.json +++ b/packages/playground/optimize-deps/package.json @@ -23,7 +23,7 @@ "react": "^17.0.2", "react-dom": "^17.0.2", "resolve-linked": "workspace:0.0.0", - "vue": "^3.2.23", + "vue": "^3.2.25", "vuex": "^4.0.0" }, "devDependencies": { diff --git a/packages/playground/preload/package.json b/packages/playground/preload/package.json index 96d5c7b01f30e3..5e65dafc8099c4 100644 --- a/packages/playground/preload/package.json +++ b/packages/playground/preload/package.json @@ -9,7 +9,7 @@ "preview": "vite preview" }, "dependencies": { - "vue": "^3.2.23", + "vue": "^3.2.25", "vue-router": "^4.0.0" }, "devDependencies": { diff --git a/packages/playground/ssr-vue/package.json b/packages/playground/ssr-vue/package.json index 70c108aa89dcc6..4a385336a97603 100644 --- a/packages/playground/ssr-vue/package.json +++ b/packages/playground/ssr-vue/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "example-external-component": "file:example-external-component", - "vue": "^3.2.23", + "vue": "^3.2.25", "vue-router": "^4.0.0", "vuex": "^4.0.2" }, diff --git a/packages/playground/tailwind/package.json b/packages/playground/tailwind/package.json index 70c65b5fc69eff..ff79908d386e96 100644 --- a/packages/playground/tailwind/package.json +++ b/packages/playground/tailwind/package.json @@ -11,7 +11,7 @@ "dependencies": { "autoprefixer": "^10.4.0", "tailwindcss": "^2.2.19", - "vue": "^3.2.23", + "vue": "^3.2.25", "vue-router": "^4.0.0" }, "devDependencies": { diff --git a/packages/playground/vue-jsx/package.json b/packages/playground/vue-jsx/package.json index 5ffc6f21c58270..4b2135906b2833 100644 --- a/packages/playground/vue-jsx/package.json +++ b/packages/playground/vue-jsx/package.json @@ -9,7 +9,7 @@ "preview": "vite preview" }, "dependencies": { - "vue": "^3.2.23" + "vue": "^3.2.25" }, "devDependencies": { "@vitejs/plugin-vue": "workspace:*", diff --git a/packages/playground/vue/package.json b/packages/playground/vue/package.json index 473a63afa9a289..f493e9028b6ec3 100644 --- a/packages/playground/vue/package.json +++ b/packages/playground/vue/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "lodash-es": "^4.17.21", - "vue": "^3.2.23" + "vue": "^3.2.25" }, "devDependencies": { "@vitejs/plugin-vue": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2ec461353e2985..8e775dd4470891 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -106,10 +106,10 @@ importers: specifiers: aliased-module: file:./dir/module resolve-linked: workspace:* - vue: ^3.2.23 + vue: ^3.2.25 dependencies: aliased-module: link:dir/module - vue: 3.2.23 + vue: 3.2.25 devDependencies: resolve-linked: link:../resolve-linked @@ -180,9 +180,9 @@ importers: packages/playground/extensions: specifiers: - vue: ^3.2.23 + vue: ^3.2.25 dependencies: - vue: 3.2.23 + vue: 3.2.25 packages/playground/file-delete-restore: specifiers: @@ -209,9 +209,9 @@ importers: packages/playground/json: specifiers: - vue: ^3.2.23 + vue: ^3.2.25 devDependencies: - vue: 3.2.23 + vue: 3.2.25 packages/playground/legacy: specifiers: @@ -290,7 +290,7 @@ importers: react: ^17.0.2 react-dom: ^17.0.2 resolve-linked: workspace:0.0.0 - vue: ^3.2.23 + vue: ^3.2.25 vuex: ^4.0.0 dependencies: axios: 0.24.0 @@ -306,8 +306,8 @@ importers: react: 17.0.2 react-dom: 17.0.2_react@17.0.2 resolve-linked: link:../resolve-linked - vue: 3.2.23 - vuex: 4.0.2_vue@3.2.23 + vue: 3.2.25 + vuex: 4.0.2_vue@3.2.25 devDependencies: '@vitejs/plugin-vue': link:../../plugin-vue @@ -364,11 +364,11 @@ importers: packages/playground/preload: specifiers: '@vitejs/plugin-vue': workspace:* - vue: ^3.2.23 + vue: ^3.2.25 vue-router: ^4.0.0 dependencies: - vue: 3.2.23 - vue-router: 4.0.12_vue@3.2.23 + vue: 3.2.25 + vue-router: 4.0.12_vue@3.2.25 devDependencies: '@vitejs/plugin-vue': link:../../plugin-vue @@ -541,14 +541,14 @@ importers: example-external-component: file:example-external-component express: ^4.17.1 serve-static: ^1.14.1 - vue: ^3.2.23 + vue: ^3.2.25 vue-router: ^4.0.0 vuex: ^4.0.2 dependencies: example-external-component: link:example-external-component - vue: 3.2.23 - vue-router: 4.0.12_vue@3.2.23 - vuex: 4.0.2_vue@3.2.23 + vue: 3.2.25 + vue-router: 4.0.12_vue@3.2.25 + vuex: 4.0.2_vue@3.2.25 devDependencies: '@vitejs/plugin-vue': link:../../plugin-vue '@vitejs/plugin-vue-jsx': link:../../plugin-vue-jsx @@ -580,13 +580,13 @@ importers: '@vitejs/plugin-vue': workspace:* autoprefixer: ^10.4.0 tailwindcss: ^2.2.19 - vue: ^3.2.23 + vue: ^3.2.25 vue-router: ^4.0.0 dependencies: autoprefixer: 10.4.0 tailwindcss: 2.2.19_6d1fa3babc9cc84b994ff99ef39d1aff - vue: 3.2.23 - vue-router: 4.0.12_vue@3.2.23 + vue: 3.2.25 + vue-router: 4.0.12_vue@3.2.25 devDependencies: '@vitejs/plugin-vue': link:../../plugin-vue @@ -605,10 +605,10 @@ importers: pug: ^3.0.2 sass: ^1.43.4 stylus: ^0.55.0 - vue: ^3.2.23 + vue: ^3.2.25 dependencies: lodash-es: 4.17.21 - vue: 3.2.23 + vue: 3.2.25 devDependencies: '@vitejs/plugin-vue': link:../../plugin-vue js-yaml: 4.1.0 @@ -621,9 +621,9 @@ importers: specifiers: '@vitejs/plugin-vue': workspace:* '@vitejs/plugin-vue-jsx': workspace:* - vue: ^3.2.23 + vue: ^3.2.25 dependencies: - vue: 3.2.23 + vue: 3.2.25 devDependencies: '@vitejs/plugin-vue': link:../../plugin-vue '@vitejs/plugin-vue-jsx': link:../../plugin-vue-jsx @@ -677,7 +677,7 @@ importers: rollup: ^2.59.0 slash: ^4.0.0 source-map: ^0.6.1 - vue: ^3.2.23 + vue: ^3.2.25 devDependencies: '@rollup/pluginutils': 4.1.1 '@types/hash-sum': 1.0.0 @@ -686,7 +686,7 @@ importers: rollup: 2.59.0 slash: 4.0.0 source-map: 0.6.1 - vue: 3.2.23 + vue: 3.2.25 packages/plugin-vue-jsx: specifiers: @@ -2448,11 +2448,11 @@ packages: source-map: 0.6.1 dev: true - /@vue/compiler-core/3.2.23: - resolution: {integrity: sha512-4ZhiI/orx+7EJ1B+0zjgvXMV2uRN+XBfG06UN2sJfND9rH5gtEQT3QmO4erum1o6Irl7y754W8/KSaDJh4EUQg==} + /@vue/compiler-core/3.2.25: + resolution: {integrity: sha512-FlffKezIqztTCTyG0klkYRwhdyL6b1PTTCIerPb4p2R9qQaczccTX5g9ysi9w6tpLQ48a1WiXnFDJhWD7XoqwA==} dependencies: '@babel/parser': 7.16.4 - '@vue/shared': 3.2.23 + '@vue/shared': 3.2.25 estree-walker: 2.0.2 source-map: 0.6.1 @@ -2470,11 +2470,11 @@ packages: '@vue/shared': 3.2.22 dev: true - /@vue/compiler-dom/3.2.23: - resolution: {integrity: sha512-X2Nw8QFc5lgoK3kio5ktM95nqmLUH+q+N/PbV4kCHzF1avqv/EGLnAhaaF0Iu4bewNvHJAAhhwPZFeoV/22nbw==} + /@vue/compiler-dom/3.2.25: + resolution: {integrity: sha512-4JrburkRg4VWbc8AKpzKFWbNY4MDXshqjFl53+vINq7zaw3Z7aSqnLv0EkKh8B8ynf/MYsAdygGutyVbEWYxOw==} dependencies: - '@vue/compiler-core': 3.2.23 - '@vue/shared': 3.2.23 + '@vue/compiler-core': 3.2.25 + '@vue/shared': 3.2.25 /@vue/compiler-sfc/3.2.21: resolution: {integrity: sha512-+yDlUSebKpz/ovxM2vLRRx7w/gVfY767pOfYTgbIhAs+ogvIV2BsIt4fpxlThnlCNChJ+yE0ERUNoROv2kEGEQ==} @@ -2491,15 +2491,15 @@ packages: source-map: 0.6.1 dev: true - /@vue/compiler-sfc/3.2.23: - resolution: {integrity: sha512-Aw+pb50Q5zTjyvWod8mNKmYZDRGHJBptmNNWE+84ZxrzEztPgMz8cNYIzWGbwcFVkmJlhvioAMvKnB+LM/sjSA==} + /@vue/compiler-sfc/3.2.25: + resolution: {integrity: sha512-PminuOYIcFI7UZn+mdy2OPbogyAb0IHkVuqwmLDJiSRFhc/QAXQnO9KdS4nez3bQ9XlQmoAveQzcZuekHzdb5w==} dependencies: '@babel/parser': 7.16.4 - '@vue/compiler-core': 3.2.23 - '@vue/compiler-dom': 3.2.23 - '@vue/compiler-ssr': 3.2.23 - '@vue/ref-transform': 3.2.23 - '@vue/shared': 3.2.23 + '@vue/compiler-core': 3.2.25 + '@vue/compiler-dom': 3.2.25 + '@vue/compiler-ssr': 3.2.25 + '@vue/reactivity-transform': 3.2.25 + '@vue/shared': 3.2.25 estree-walker: 2.0.2 magic-string: 0.25.7 postcss: 8.3.11 @@ -2512,26 +2512,35 @@ packages: '@vue/shared': 3.2.21 dev: true - /@vue/compiler-ssr/3.2.23: - resolution: {integrity: sha512-Bqzn4jFyXPK1Ehqiq7e/czS8n62gtYF1Zfeu0DrR5uv+SBllh7LIvZjZU6+c8qbocAd3/T3I3gn2cZGmnDb6zg==} + /@vue/compiler-ssr/3.2.25: + resolution: {integrity: sha512-+BAl8U5D3JkGR6086PFx1BQQ5km3z9fT88hy/7lzf8i3vEDdPQodadnX2t6tndFjIux05MEKg43DeocOojT0mw==} dependencies: - '@vue/compiler-dom': 3.2.23 - '@vue/shared': 3.2.23 + '@vue/compiler-dom': 3.2.25 + '@vue/shared': 3.2.25 /@vue/devtools-api/6.0.0-beta.20: resolution: {integrity: sha512-21u2jFOk8jbAneeGpDwZQ0W66RJa0IBDUyVl6SgKnn2cRFjLWzKj+ukXjpLhYr1KASyCe5E5U4jXwChVo0YUAw==} dev: false + /@vue/reactivity-transform/3.2.25: + resolution: {integrity: sha512-fOiW67PUalicMfMr4Sc9l8mUtkN7ZD+G1/zJV8blzQ8GEZSeRcJm11gqve6Ps623ju5YORu7V/Q1gZoOJ9WO4g==} + dependencies: + '@babel/parser': 7.16.4 + '@vue/compiler-core': 3.2.25 + '@vue/shared': 3.2.25 + estree-walker: 2.0.2 + magic-string: 0.25.7 + /@vue/reactivity/3.2.21: resolution: {integrity: sha512-7C57zFm/5E3SSTUhVuYj1InDwuJ+GIVQ/z+H43C9sST85gIThGXVhksl1yWTAadf8Yz4T5lSbqi5Ds8U/ueWcw==} dependencies: '@vue/shared': 3.2.21 dev: true - /@vue/reactivity/3.2.23: - resolution: {integrity: sha512-8RGVr/5Kpgb/EkCjgHXqttgA5IMc6n0lIXFY4TVbMkzdXrvaIhzBd7Te44oIDsTSYVKZLpfHd6/wEnuDqE8vFw==} + /@vue/reactivity/3.2.25: + resolution: {integrity: sha512-Dxc/u/dxoneIDqyfmuwPVBR0G3OQJqe3Dtz4z3NGt+CGj4UuOZQfN5raJPmp6xGYgrtC6PAWoCgHhyrgr1qCtg==} dependencies: - '@vue/shared': 3.2.23 + '@vue/shared': 3.2.25 /@vue/ref-transform/3.2.21: resolution: {integrity: sha512-uiEWWBsrGeun9O7dQExYWzXO3rHm/YdtFNXDVqCSoPypzOVxWxdiL+8hHeWzxMB58fVuV2sT80aUtIVyaBVZgQ==} @@ -2543,15 +2552,6 @@ packages: magic-string: 0.25.7 dev: true - /@vue/ref-transform/3.2.23: - resolution: {integrity: sha512-gW0GD2PSAs/th7mC7tPB/UwpIQxclbApVtsDtscDmOJXb2+cdu60ny+SuHNgfrlUT/JqWKQHq7jFKO4woxLNaA==} - dependencies: - '@babel/parser': 7.16.4 - '@vue/compiler-core': 3.2.23 - '@vue/shared': 3.2.23 - estree-walker: 2.0.2 - magic-string: 0.25.7 - /@vue/runtime-core/3.2.21: resolution: {integrity: sha512-7oOxKaU0D2IunOAMOOHZgJVrHg63xwng8BZx3fbgmakqEIMwHhQcp+5GV1sOg/sWW7R4UhaRDIUCukO2GRVK2Q==} dependencies: @@ -2559,11 +2559,11 @@ packages: '@vue/shared': 3.2.21 dev: true - /@vue/runtime-core/3.2.23: - resolution: {integrity: sha512-wSI5lmY2kCGLf89iiygqxVh6/5bsawz78Me9n1x4U2bHnN0yf3PWyuhN0WgIE8VfEaF7e75E333uboNEIFjgkg==} + /@vue/runtime-core/3.2.25: + resolution: {integrity: sha512-2+fo5+lofT4xr8W2rtjyz+AM+UB1U/UNLH6ISFdHWNWuveSWxF+vkCQaATmhp6O3XA7QJAbHoRqIZor20EWSfQ==} dependencies: - '@vue/reactivity': 3.2.23 - '@vue/shared': 3.2.23 + '@vue/reactivity': 3.2.25 + '@vue/shared': 3.2.25 /@vue/runtime-dom/3.2.21: resolution: {integrity: sha512-apBdriD6QsI4ywbllY8kjr9/0scGuStDuvLbJULPQkFPtHzntd51bP5PQTQVAEIc9kwnTozmj6x6ZdX/cwo7xA==} @@ -2573,11 +2573,11 @@ packages: csstype: 2.6.18 dev: true - /@vue/runtime-dom/3.2.23: - resolution: {integrity: sha512-z6lp0888NkLmxD9j2sGoll8Kb7J743s8s6w7GbiyUc4WZwm0KJ35B4qTFDMoIU0G7CatS6Z+yRTpPHc6srtByg==} + /@vue/runtime-dom/3.2.25: + resolution: {integrity: sha512-3gGeyHnygn4yG6bssRKhQIxnE8vgB8FtYUUwoYoA/Pm0vZ+bGPoZax4TbtZD9eW9rvs8CY8boNp4t/sJaPJrRQ==} dependencies: - '@vue/runtime-core': 3.2.23 - '@vue/shared': 3.2.23 + '@vue/runtime-core': 3.2.25 + '@vue/shared': 3.2.25 csstype: 2.6.18 /@vue/server-renderer/3.2.21_vue@3.2.21: @@ -2590,14 +2590,14 @@ packages: vue: 3.2.21 dev: true - /@vue/server-renderer/3.2.23_vue@3.2.23: - resolution: {integrity: sha512-mgQ2VAE5WjeZELJKNbwE69uiBNpN+3LyL0ZDki1bJWVwHD2fhPfx7pwyYuiucE81xz2LxVsyGxhKKUL997g8vw==} + /@vue/server-renderer/3.2.25_vue@3.2.25: + resolution: {integrity: sha512-qFRmcyeyyhWbnTPn6cbCZ4bjeuPLSkUpFa98p4LEJtFBFbxjGnrHXHOjYxCY3Lznmxe0kMM3qG4t3GnjcXP12w==} peerDependencies: - vue: 3.2.23 + vue: 3.2.25 dependencies: - '@vue/compiler-ssr': 3.2.23 - '@vue/shared': 3.2.23 - vue: 3.2.23 + '@vue/compiler-ssr': 3.2.25 + '@vue/shared': 3.2.25 + vue: 3.2.25 /@vue/shared/3.2.21: resolution: {integrity: sha512-5EQmIPK6gw4UVYUbM959B0uPsJ58+xoMESCZs3N89XyvJ9e+fX4pqEPrOGV8OroIk3SbEvJcC+eYc8BH9JQrHA==} @@ -2607,8 +2607,8 @@ packages: resolution: {integrity: sha512-qWVav014mpjEtbWbEgl0q9pEyrrIySKum8UVYjwhC6njrKzknLZPvfuYdQyVbApsqr94tf/3dP4pCuZmmjdCWQ==} dev: true - /@vue/shared/3.2.23: - resolution: {integrity: sha512-U+/Jefa0QfXUF2qVy9Dqlrb6HKJSr9/wJcM66wXmWcTOoqg7hOWzF4qruDle51pyF4x3wMn6TSH54UdjKjCKMA==} + /@vue/shared/3.2.25: + resolution: {integrity: sha512-DkHJFV2gw9WBRmUCa21eyG0WvlF0l1QFOgTkWj29O4mt2Tv3BSE5PQOKhUruZIym4bBYCqx9ZGtoD1WohDprow==} /@wessberg/stringutil/1.0.19: resolution: {integrity: sha512-9AZHVXWlpN8Cn9k5BC/O0Dzb9E9xfEMXzYrNunwvkUTvuK7xgQPVRZpLo+jWCOZ5r8oBa8NIrHuPEu1hzbb6bg==} @@ -8986,13 +8986,13 @@ packages: engines: {node: '>=0.10.0'} dev: true - /vue-router/4.0.12_vue@3.2.23: + /vue-router/4.0.12_vue@3.2.25: resolution: {integrity: sha512-CPXvfqe+mZLB1kBWssssTiWg4EQERyqJZes7USiqfW9B5N2x+nHlnsM1D3b5CaJ6qgCvMmYJnz+G0iWjNCvXrg==} peerDependencies: vue: ^3.0.0 dependencies: '@vue/devtools-api': 6.0.0-beta.20 - vue: 3.2.23 + vue: 3.2.25 dev: false /vue/3.2.21: @@ -9005,22 +9005,22 @@ packages: '@vue/shared': 3.2.21 dev: true - /vue/3.2.23: - resolution: {integrity: sha512-MGp9JZC37lzGhwSu6c1tQxrQbXbw7XKFqtYh7SFwNrNK899FPxGAHwSHMZijMChTSC3uZrD2BGO/3EHOgMJ0cw==} + /vue/3.2.25: + resolution: {integrity: sha512-jU3t7fyQDHoCWCqhmRrnSmYZvHC35tOJTP704di7HGfq5EcFA1cU/1ZPjUV1eCxJev65Khjyfni+vk9oa+eTtw==} dependencies: - '@vue/compiler-dom': 3.2.23 - '@vue/compiler-sfc': 3.2.23 - '@vue/runtime-dom': 3.2.23 - '@vue/server-renderer': 3.2.23_vue@3.2.23 - '@vue/shared': 3.2.23 + '@vue/compiler-dom': 3.2.25 + '@vue/compiler-sfc': 3.2.25 + '@vue/runtime-dom': 3.2.25 + '@vue/server-renderer': 3.2.25_vue@3.2.25 + '@vue/shared': 3.2.25 - /vuex/4.0.2_vue@3.2.23: + /vuex/4.0.2_vue@3.2.25: resolution: {integrity: sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==} peerDependencies: vue: ^3.0.2 dependencies: '@vue/devtools-api': 6.0.0-beta.20 - vue: 3.2.23 + vue: 3.2.25 dev: false /w3c-hr-time/1.0.2: From 955d0fecd936b8175d7a7e4355eab855eb4567f8 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 12 Dec 2021 14:57:32 +0800 Subject: [PATCH 0054/1287] feat(plugin-vue): add `reactivityTransform` option. Enabling this option will apply both ref transform and props destructure transform. BREAKING CHANGE: `refTransform` option has been replaced by `reactivityTransform` option. Now also requires vue@^3.2.25. --- packages/playground/vue/Main.vue | 4 ++-- ...fTransform.vue => ReactivityTransform.vue} | 5 +++- packages/playground/vue/vite.config.ts | 3 +-- packages/plugin-vue/package.json | 4 ++-- packages/plugin-vue/src/index.ts | 23 +++++++++++-------- packages/plugin-vue/src/script.ts | 2 +- pnpm-lock.yaml | 2 ++ 7 files changed, 26 insertions(+), 17 deletions(-) rename packages/playground/vue/{RefTransform.vue => ReactivityTransform.vue} (58%) diff --git a/packages/playground/vue/Main.vue b/packages/playground/vue/Main.vue index a65c9d7480920e..d10ae401f7aa8e 100644 --- a/packages/playground/vue/Main.vue +++ b/packages/playground/vue/Main.vue @@ -18,7 +18,7 @@ - + @@ -33,7 +33,7 @@ import SrcImport from './src-import/SrcImport.vue' import Slotted from './Slotted.vue' import ScanDep from './ScanDep.vue' import AsyncComponent from './AsyncComponent.vue' -import RefTransform from './RefTransform.vue' +import ReactivityTransform from './ReactivityTransform.vue' import SetupImportTemplate from './setup-import-template/SetupImportTemplate.vue' import { ref } from 'vue' diff --git a/packages/playground/vue/RefTransform.vue b/packages/playground/vue/ReactivityTransform.vue similarity index 58% rename from packages/playground/vue/RefTransform.vue rename to packages/playground/vue/ReactivityTransform.vue index ef7942fdc0e5c3..0dc2b09343d641 100644 --- a/packages/playground/vue/RefTransform.vue +++ b/packages/playground/vue/ReactivityTransform.vue @@ -1,9 +1,12 @@ diff --git a/packages/playground/vue/vite.config.ts b/packages/playground/vue/vite.config.ts index 4245af73426958..82efdac5e9f876 100644 --- a/packages/playground/vue/vite.config.ts +++ b/packages/playground/vue/vite.config.ts @@ -1,4 +1,3 @@ -import path from 'path' import { defineConfig } from 'vite' import vuePlugin from '@vitejs/plugin-vue' import { vueI18nPlugin } from './CustomBlockPlugin' @@ -11,7 +10,7 @@ export default defineConfig({ }, plugins: [ vuePlugin({ - refTransform: true + reactivityTransform: true }), vueI18nPlugin ], diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 07dde9cdcf6bb6..3cae7402a4113e 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -32,7 +32,7 @@ "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-vue#readme", "peerDependencies": { "vite": "^2.5.10", - "vue": "^3.2.13" + "vue": "^3.2.25" }, "devDependencies": { "@rollup/pluginutils": "^4.1.1", @@ -42,6 +42,6 @@ "rollup": "^2.59.0", "slash": "^4.0.0", "source-map": "^0.6.1", - "vue": "^3.2.23" + "vue": "^3.2.25" } } diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index 26e2709b580c21..7535a8c9a978e6 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -42,10 +42,10 @@ export interface Options { customElement?: boolean | string | RegExp | (string | RegExp)[] /** - * Enable Vue ref transform (experimental). - * https://github.com/vuejs/vue-next/tree/master/packages/ref-transform + * Enable Vue reactivity transform (experimental). + * https://github.com/vuejs/vue-next/tree/master/packages/reactivity-transform * - * **requires Vue \>= 3.2.5** + * **requires vue\@^3.2.25** * * - `true`: transform will be enabled for all vue,js(x),ts(x) files except * those inside node_modules @@ -55,7 +55,12 @@ export interface Options { * * @default false */ - refTransform?: boolean | string | RegExp | (string | RegExp)[] + reactivityTransform?: boolean | string | RegExp | (string | RegExp)[] + + /** + * @deprecated use `reactivityTransform` instead. + */ + refTransform?: any /** * @deprecated the plugin now auto-detects whether it's being invoked for ssr. @@ -80,7 +85,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { include = /\.vue$/, exclude, customElement = /\.ce\.vue$/, - refTransform = false + reactivityTransform = false } = rawOptions const filter = createFilter(include, exclude) @@ -91,11 +96,11 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { : createFilter(customElement) const refTransformFilter = - refTransform === false + reactivityTransform === false ? () => false - : refTransform === true + : reactivityTransform === true ? createFilter(/\.(j|t)sx?$/, /node_modules/) - : createFilter(refTransform) + : createFilter(reactivityTransform) let options: ResolvedOptions = { isProduction: process.env.NODE_ENV === 'production', @@ -103,7 +108,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { include, exclude, customElement, - refTransform, + reactivityTransform, root: process.cwd(), sourceMap: true, compiler: null as any // to be set in configResolved diff --git a/packages/plugin-vue/src/script.ts b/packages/plugin-vue/src/script.ts index aa4f9a7a1b4af8..241eca21eefea1 100644 --- a/packages/plugin-vue/src/script.ts +++ b/packages/plugin-vue/src/script.ts @@ -53,7 +53,7 @@ export function resolveScript( id: descriptor.id, isProd: options.isProduction, inlineTemplate: isUseInlineTemplate(descriptor, !options.devServer), - refTransform: options.refTransform !== false, + reactivityTransform: options.reactivityTransform !== false, templateOptions: resolveTemplateCompilerOptions(descriptor, options, ssr), sourceMap: options.sourceMap }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e775dd4470891..6ce38611d7168a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -99,8 +99,10 @@ importers: packages/playground: specifiers: css-color-names: ^1.0.1 + vue: ^3.2.25 devDependencies: css-color-names: 1.0.1 + vue: 3.2.25 packages/playground/alias: specifiers: From d50edacb7c56c362bdd0c64b8038ee7c9c36e25c Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 12 Dec 2021 15:26:48 +0800 Subject: [PATCH 0055/1287] chore: fix lockfile + missing args --- packages/plugin-vue/src/index.ts | 2 +- pnpm-lock.yaml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index 7535a8c9a978e6..f407e578f99188 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -132,7 +132,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { return handleHotUpdate(ctx, options) }, - config() { + config(config) { return { define: { __VUE_OPTIONS_API__: config.define?.__VUE_OPTIONS_API__ ?? true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6ce38611d7168a..8e775dd4470891 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -99,10 +99,8 @@ importers: packages/playground: specifiers: css-color-names: ^1.0.1 - vue: ^3.2.25 devDependencies: css-color-names: 1.0.1 - vue: 3.2.25 packages/playground/alias: specifiers: From 51138cc31826468aaa7369c656bae960c144ec59 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 12 Dec 2021 15:29:56 +0800 Subject: [PATCH 0056/1287] chore(plugin-vue): remove deprecated options --- packages/plugin-vue/src/index.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index f407e578f99188..60e73ead755591 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -57,16 +57,6 @@ export interface Options { */ reactivityTransform?: boolean | string | RegExp | (string | RegExp)[] - /** - * @deprecated use `reactivityTransform` instead. - */ - refTransform?: any - - /** - * @deprecated the plugin now auto-detects whether it's being invoked for ssr. - */ - ssr?: boolean - /** * Use custom compiler-sfc instance. Can be used to force a specific version. */ @@ -117,7 +107,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { // Temporal handling for 2.7 breaking change const isSSR = (opt: { ssr?: boolean } | boolean | undefined) => opt === undefined - ? !!options.ssr + ? false : typeof opt === 'boolean' ? opt : opt?.ssr === true From 69106f4e434bd931c921e78310c4336477d1e5b5 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 12 Dec 2021 15:32:23 +0800 Subject: [PATCH 0057/1287] chore(plugin-vue): comments and readme --- packages/plugin-vue/README.md | 10 ++++------ packages/plugin-vue/src/index.ts | 4 ---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/plugin-vue/README.md b/packages/plugin-vue/README.md index 96f9cbb1414a84..b8889fbaae35a6 100644 --- a/packages/plugin-vue/README.md +++ b/packages/plugin-vue/README.md @@ -22,7 +22,7 @@ export interface Options { isProduction?: boolean /** - * Transform Vue SFCs into custom elements (requires Vue >= 3.2.0) + * Transform Vue SFCs into custom elements (requires vue@^3.2.0) * - `true` -> all `*.vue` imports are converted into custom elements * - `string | RegExp` -> matched files are converted into custom elements * @@ -31,10 +31,8 @@ export interface Options { customElement?: boolean | string | RegExp | (string | RegExp)[] /** - * Enable Vue ref transform (experimental). - * https://github.com/vuejs/vue-next/tree/master/packages/ref-transform - * - * **requires Vue \>= 3.2.5** + * Enable Vue reactivity transform (experimental, requires vue@^3.2.25). + * https://github.com/vuejs/vue-next/tree/master/packages/reactivity-transform * * - `true`: transform will be enabled for all vue,js(x),ts(x) files except * those inside node_modules @@ -44,7 +42,7 @@ export interface Options { * * @default false */ - refTransform?: boolean | string | RegExp | (string | RegExp)[] + reactivityTransform?: boolean | string | RegExp | (string | RegExp)[] // options to pass on to vue/compiler-sfc script?: Partial diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index 60e73ead755591..51ac057232aef0 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -33,7 +33,6 @@ export interface Options { /** * Transform Vue SFCs into custom elements. - * **requires Vue \>= 3.2.0 & Vite \>= 2.4.4** * - `true`: all `*.vue` imports are converted into custom elements * - `string | RegExp`: matched files are converted into custom elements * @@ -44,9 +43,6 @@ export interface Options { /** * Enable Vue reactivity transform (experimental). * https://github.com/vuejs/vue-next/tree/master/packages/reactivity-transform - * - * **requires vue\@^3.2.25** - * * - `true`: transform will be enabled for all vue,js(x),ts(x) files except * those inside node_modules * - `string | RegExp`: apply to vue + only matched files (will include From 73c08ff6375e800975ea1bfdc9ba62421b5c73d5 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 12 Dec 2021 15:59:49 +0800 Subject: [PATCH 0058/1287] release: plugin-vue@2.0.0 --- packages/plugin-vue/CHANGELOG.md | 27 +++++++++++++++++++++++++++ packages/plugin-vue/package.json | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue/CHANGELOG.md b/packages/plugin-vue/CHANGELOG.md index afa7152989f48a..1fdb317038839d 100644 --- a/packages/plugin-vue/CHANGELOG.md +++ b/packages/plugin-vue/CHANGELOG.md @@ -1,3 +1,30 @@ +# [2.0.0](https://github.com/vitejs/vite/compare/plugin-vue@1.10.2...plugin-vue@2.0.0) (2021-12-12) + + +### Bug Fixes + +* allow overwriting `define` options in vue & vue-jsx plugins ([#6072](https://github.com/vitejs/vite/issues/6072)) ([5f3f6b7](https://github.com/vitejs/vite/commit/5f3f6b7b406cb3371084057c74814eb36175e5cf)) +* **plugin-vue:** multiple vue files using the same src file (fix [#5925](https://github.com/vitejs/vite/issues/5925), [#5447](https://github.com/vitejs/vite/issues/5447)) ([#5994](https://github.com/vitejs/vite/issues/5994)) ([df7aec7](https://github.com/vitejs/vite/commit/df7aec7d2a567af1dfbab76e5765aba80dc3cb5c)) + + +### Code Refactoring + +* **plugin-vue:** resolve vue/compiler-sfc from project root ([ce8b0fe](https://github.com/vitejs/vite/commit/ce8b0feae334cc224b3f4d2fdb2bffbb62322acf)) + + +### Features + +* **plugin-vue:** add `reactivityTransform` option. ([955d0fe](https://github.com/vitejs/vite/commit/955d0fecd936b8175d7a7e4355eab855eb4567f8)) + + +### BREAKING CHANGES + +* **plugin-vue:** `refTransform` option has been replaced by +`reactivityTransform` option. Now also requires vue@^3.2.25. +* **plugin-vue:** now requires vue@^3.2.13 as peer dep + + + ## [1.10.2](https://github.com/vitejs/vite/compare/plugin-vue@1.10.1...plugin-vue@1.10.2) (2021-12-07) diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 3cae7402a4113e..0a07360c48fb5c 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue", - "version": "1.10.2", + "version": "2.0.0", "license": "MIT", "author": "Evan You", "files": [ From cdebb49c558864cb09019dd3e62a2f5335a05ee8 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 12 Dec 2021 16:03:15 +0800 Subject: [PATCH 0059/1287] chore: update create-vite templates --- packages/create-vite/template-lit-ts/package.json | 2 +- packages/create-vite/template-lit/package.json | 2 +- packages/create-vite/template-preact-ts/package.json | 2 +- packages/create-vite/template-preact/package.json | 2 +- packages/create-vite/template-react-ts/package.json | 2 +- packages/create-vite/template-react/package.json | 2 +- packages/create-vite/template-svelte-ts/package.json | 2 +- packages/create-vite/template-svelte/package.json | 2 +- packages/create-vite/template-vanilla-ts/package.json | 2 +- packages/create-vite/template-vanilla/package.json | 2 +- packages/create-vite/template-vue-ts/package.json | 6 +++--- packages/create-vite/template-vue/package.json | 4 ++-- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/create-vite/template-lit-ts/package.json b/packages/create-vite/template-lit-ts/package.json index fcc4d78b72bf0b..6ee9ff7bb21359 100644 --- a/packages/create-vite/template-lit-ts/package.json +++ b/packages/create-vite/template-lit-ts/package.json @@ -18,7 +18,7 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.7.0", + "vite": "^2.7.1", "typescript": "^4.4.4" } } diff --git a/packages/create-vite/template-lit/package.json b/packages/create-vite/template-lit/package.json index 9864c7b7e2fcc5..7cc9fd8c5e2598 100644 --- a/packages/create-vite/template-lit/package.json +++ b/packages/create-vite/template-lit/package.json @@ -16,6 +16,6 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.7.0" + "vite": "^2.7.1" } } diff --git a/packages/create-vite/template-preact-ts/package.json b/packages/create-vite/template-preact-ts/package.json index 091c1356335cdf..db136f5be2181d 100644 --- a/packages/create-vite/template-preact-ts/package.json +++ b/packages/create-vite/template-preact-ts/package.json @@ -12,6 +12,6 @@ "devDependencies": { "@preact/preset-vite": "^2.1.5", "typescript": "^4.4.4", - "vite": "^2.7.0" + "vite": "^2.7.1" } } diff --git a/packages/create-vite/template-preact/package.json b/packages/create-vite/template-preact/package.json index 1ba3ee754d4f32..2dd16f7cd73171 100644 --- a/packages/create-vite/template-preact/package.json +++ b/packages/create-vite/template-preact/package.json @@ -11,6 +11,6 @@ }, "devDependencies": { "@preact/preset-vite": "^2.1.5", - "vite": "^2.7.0" + "vite": "^2.7.1" } } diff --git a/packages/create-vite/template-react-ts/package.json b/packages/create-vite/template-react-ts/package.json index a15b23787a5dd7..0800f4ef314907 100644 --- a/packages/create-vite/template-react-ts/package.json +++ b/packages/create-vite/template-react-ts/package.json @@ -15,6 +15,6 @@ "@types/react-dom": "^17.0.10", "@vitejs/plugin-react": "^1.0.7", "typescript": "^4.4.4", - "vite": "^2.7.0" + "vite": "^2.7.1" } } diff --git a/packages/create-vite/template-react/package.json b/packages/create-vite/template-react/package.json index dd4dcddef1191e..d461e794cbb2c5 100644 --- a/packages/create-vite/template-react/package.json +++ b/packages/create-vite/template-react/package.json @@ -12,6 +12,6 @@ }, "devDependencies": { "@vitejs/plugin-react": "^1.0.7", - "vite": "^2.7.0" + "vite": "^2.7.1" } } diff --git a/packages/create-vite/template-svelte-ts/package.json b/packages/create-vite/template-svelte-ts/package.json index 30ac18e133e52a..23b556b0e63858 100644 --- a/packages/create-vite/template-svelte-ts/package.json +++ b/packages/create-vite/template-svelte-ts/package.json @@ -16,6 +16,6 @@ "svelte-preprocess": "^4.9.8", "tslib": "^2.3.1", "typescript": "^4.4.4", - "vite": "^2.7.0" + "vite": "^2.7.1" } } diff --git a/packages/create-vite/template-svelte/package.json b/packages/create-vite/template-svelte/package.json index 46847c242ed996..b13662d77c4fd0 100644 --- a/packages/create-vite/template-svelte/package.json +++ b/packages/create-vite/template-svelte/package.json @@ -10,6 +10,6 @@ "devDependencies": { "@sveltejs/vite-plugin-svelte": "^1.0.0-next.30", "svelte": "^3.44.0", - "vite": "^2.7.0" + "vite": "^2.7.1" } } diff --git a/packages/create-vite/template-vanilla-ts/package.json b/packages/create-vite/template-vanilla-ts/package.json index 7256a8e2e3c10e..4f9c527b2861da 100644 --- a/packages/create-vite/template-vanilla-ts/package.json +++ b/packages/create-vite/template-vanilla-ts/package.json @@ -8,6 +8,6 @@ }, "devDependencies": { "typescript": "^4.4.4", - "vite": "^2.7.0" + "vite": "^2.7.1" } } diff --git a/packages/create-vite/template-vanilla/package.json b/packages/create-vite/template-vanilla/package.json index eee96669c91888..33f927b4d8ee81 100644 --- a/packages/create-vite/template-vanilla/package.json +++ b/packages/create-vite/template-vanilla/package.json @@ -7,6 +7,6 @@ "preview": "vite preview" }, "devDependencies": { - "vite": "^2.7.0" + "vite": "^2.7.1" } } diff --git a/packages/create-vite/template-vue-ts/package.json b/packages/create-vite/template-vue-ts/package.json index 7636704b2fca3c..8dfaf6aadc4712 100644 --- a/packages/create-vite/template-vue-ts/package.json +++ b/packages/create-vite/template-vue-ts/package.json @@ -10,9 +10,9 @@ "vue": "^3.2.25" }, "devDependencies": { - "@vitejs/plugin-vue": "^1.10.2", + "@vitejs/plugin-vue": "^2.0.0", "typescript": "^4.4.4", - "vite": "^2.7.0", - "vue-tsc": "^0.28.10" + "vite": "^2.7.1", + "vue-tsc": "^0.29.8" } } diff --git a/packages/create-vite/template-vue/package.json b/packages/create-vite/template-vue/package.json index 8ed9d0c6a6d2ae..e28e07d17a0b94 100644 --- a/packages/create-vite/template-vue/package.json +++ b/packages/create-vite/template-vue/package.json @@ -10,7 +10,7 @@ "vue": "^3.2.25" }, "devDependencies": { - "@vitejs/plugin-vue": "^1.10.2", - "vite": "^2.7.0" + "@vitejs/plugin-vue": "^2.0.0", + "vite": "^2.7.1" } } From 745c2ec42e11d4da77482be59d7092cb9ab3eed9 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 12 Dec 2021 16:03:26 +0800 Subject: [PATCH 0060/1287] release: create-vite@2.7.1 --- packages/create-vite/CHANGELOG.md | 4 ++++ packages/create-vite/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/create-vite/CHANGELOG.md b/packages/create-vite/CHANGELOG.md index 15177ce5f95fe2..2fabb6b3699f0c 100644 --- a/packages/create-vite/CHANGELOG.md +++ b/packages/create-vite/CHANGELOG.md @@ -1,3 +1,7 @@ +## [2.7.1](https://github.com/vitejs/vite/compare/create-vite@2.7.0...create-vite@2.7.1) (2021-12-12) + + + # [2.7.0](https://github.com/vitejs/vite/compare/create-vite@2.6.6...create-vite@2.7.0) (2021-12-07) diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json index 148917ba383642..6c505735f90bcd 100644 --- a/packages/create-vite/package.json +++ b/packages/create-vite/package.json @@ -1,6 +1,6 @@ { "name": "create-vite", - "version": "2.7.0", + "version": "2.7.1", "license": "MIT", "author": "Evan You", "bin": { From 1ded1a835bfb64f2c70c8c153e979b7911c9a8c1 Mon Sep 17 00:00:00 2001 From: Niputi <7137178+Niputi@users.noreply.github.com> Date: Sun, 12 Dec 2021 17:15:13 +0100 Subject: [PATCH 0061/1287] fix: ws types (#6083) --- packages/vite/package.json | 4 +- packages/vite/src/node/index.ts | 2 +- packages/vite/src/node/server/ws.ts | 5 +- packages/vite/types/ws.d.ts | 558 ++++++++++++++-------------- pnpm-lock.yaml | 22 +- 5 files changed, 297 insertions(+), 294 deletions(-) diff --git a/packages/vite/package.json b/packages/vite/package.json index 3fcee0399cd05d..56df1eedb6e609 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -74,7 +74,7 @@ "@types/resolve": "^1.20.1", "@types/sass": "~1.43.0", "@types/stylus": "^0.48.36", - "@types/ws": "^8.2.0", + "@types/ws": "^8.2.2", "@vue/compiler-dom": "^3.2.22", "acorn": "^8.6.0", "acorn-class-fields": "^1.0.0", @@ -117,7 +117,7 @@ "tsconfck": "1.1.1", "tslib": "^2.3.1", "types": "link:./types", - "ws": "^8.2.3" + "ws": "^8.3.0" }, "peerDependencies": { "less": "*", diff --git a/packages/vite/src/node/index.ts b/packages/vite/src/node/index.ts index 5b92990f83a221..306d651d2ce07c 100644 --- a/packages/vite/src/node/index.ts +++ b/packages/vite/src/node/index.ts @@ -83,7 +83,7 @@ export type { ErrorPayload } from 'types/hmrPayload' export type { Connect } from 'types/connect' -export type { WebSocket } from 'types/ws' +export type { WebSocket, WebSocketAlias } from 'types/ws' export type { HttpProxy } from 'types/http-proxy' export type { FSWatcher, WatchOptions } from 'types/chokidar' export type { Terser } from 'types/terser' diff --git a/packages/vite/src/node/server/ws.ts b/packages/vite/src/node/server/ws.ts index 74b4ad8142e81a..8e0bbe7058bcb8 100644 --- a/packages/vite/src/node/server/ws.ts +++ b/packages/vite/src/node/server/ws.ts @@ -5,6 +5,7 @@ import { ServerOptions as HttpsServerOptions } from 'https' import { WebSocketServer as WebSocket, ServerOptions } from 'ws' +import { WebSocket as WebSocketTypes } from 'types/ws' import { ErrorPayload, HMRPayload } from 'types/hmrPayload' import { ResolvedConfig } from '..' import { isObject } from '../utils' @@ -12,8 +13,8 @@ import { Socket } from 'net' export const HMR_HEADER = 'vite-hmr' export interface WebSocketServer { - on: WebSocket['on'] - off: WebSocket['off'] + on: WebSocketTypes.Server['on'] + off: WebSocketTypes.Server['off'] send(payload: HMRPayload): void close(): Promise } diff --git a/packages/vite/types/ws.d.ts b/packages/vite/types/ws.d.ts index 3a174f9df47ea7..6c14174e098f0b 100644 --- a/packages/vite/types/ws.d.ts +++ b/packages/vite/types/ws.d.ts @@ -1,7 +1,4 @@ -// Inlined to avoid extra dependency -// MIT Licensed https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/LICENSE - -// Type definitions for ws 7.4 +// Type definitions for ws 8.2 // Project: https://github.com/websockets/ws // Definitions by: Paul Loyd // Margus Lamp @@ -24,286 +21,273 @@ import { Server as HTTPServer } from 'http' import { Server as HTTPSServer } from 'https' -import { Socket } from 'net' import { Duplex, DuplexOptions } from 'stream' import { SecureContextOptions } from 'tls' import { URL } from 'url' import { ZlibOptions } from 'zlib' -export declare namespace WebSocket { - // WebSocket socket. - export class WebSocket extends EventEmitter { - /** The connection is not yet open. */ - static readonly CONNECTING: 0 - /** The connection is open and ready to communicate. */ - static readonly OPEN: 1 - /** The connection is in the process of closing. */ - static readonly CLOSING: 2 - /** The connection is closed. */ - static readonly CLOSED: 3 - - binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments' - readonly bufferedAmount: number - readonly extensions: string - readonly protocol: string - /** The current state of the connection */ - readonly readyState: - | typeof WebSocket.CONNECTING - | typeof WebSocket.OPEN - | typeof WebSocket.CLOSING - | typeof WebSocket.CLOSED - readonly url: string - - /** The connection is not yet open. */ - readonly CONNECTING: 0 - /** The connection is open and ready to communicate. */ - readonly OPEN: 1 - /** The connection is in the process of closing. */ - readonly CLOSING: 2 - /** The connection is closed. */ - readonly CLOSED: 3 - - onopen: (event: WebSocket.OpenEvent) => void - onerror: (event: WebSocket.ErrorEvent) => void - onclose: (event: WebSocket.CloseEvent) => void - onmessage: (event: WebSocket.MessageEvent) => void - - constructor( - address: string | URL, - options?: WebSocket.ClientOptions | ClientRequestArgs - ) - constructor( - address: string | URL, - protocols?: string | string[], - options?: WebSocket.ClientOptions | ClientRequestArgs - ) - - close(code?: number, data?: string): void - ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void - pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void - send(data: any, cb?: (err?: Error) => void): void - send( - data: any, - options: { - mask?: boolean | undefined - binary?: boolean | undefined - compress?: boolean | undefined - fin?: boolean | undefined - }, - cb?: (err?: Error) => void - ): void - terminate(): void - - // HTML5 WebSocket events - addEventListener( - method: 'message', - cb: (event: { data: any; type: string; target: WebSocket }) => void, - options?: WebSocket.EventListenerOptions - ): void - addEventListener( - method: 'close', - cb: (event: { - wasClean: boolean - code: number - reason: string - target: WebSocket - }) => void, - options?: WebSocket.EventListenerOptions - ): void - addEventListener( - method: 'error', - cb: (event: { - error: any - message: any - type: string - target: WebSocket - }) => void, - options?: WebSocket.EventListenerOptions - ): void - addEventListener( - method: 'open', - cb: (event: { target: WebSocket }) => void, - options?: WebSocket.EventListenerOptions - ): void - addEventListener( - method: string, - listener: () => void, - options?: WebSocket.EventListenerOptions - ): void - - removeEventListener( - method: 'message', - cb?: (event: { data: any; type: string; target: WebSocket }) => void - ): void - removeEventListener( - method: 'close', - cb?: (event: { - wasClean: boolean - code: number - reason: string - target: WebSocket - }) => void - ): void - removeEventListener( - method: 'error', - cb?: (event: { - error: any - message: any - type: string - target: WebSocket - }) => void - ): void - removeEventListener( - method: 'open', - cb?: (event: { target: WebSocket }) => void - ): void - removeEventListener(method: string, listener?: () => void): void - - // Events - on( - event: 'close', - listener: (this: WebSocket, code: number, reason: string) => void - ): this - on(event: 'error', listener: (this: WebSocket, err: Error) => void): this - on( - event: 'upgrade', - listener: (this: WebSocket, request: IncomingMessage) => void - ): this - on( - event: 'message', - listener: (this: WebSocket, data: WebSocket.Data) => void - ): this - on(event: 'open', listener: (this: WebSocket) => void): this - on( - event: 'ping' | 'pong', - listener: (this: WebSocket, data: Buffer) => void - ): this - on( - event: 'unexpected-response', - listener: ( - this: WebSocket, - request: ClientRequest, - response: IncomingMessage - ) => void - ): this - on( - event: string | symbol, - listener: (this: WebSocket, ...args: any[]) => void - ): this - - once( - event: 'close', - listener: (this: WebSocket, code: number, reason: string) => void - ): this - once(event: 'error', listener: (this: WebSocket, err: Error) => void): this - once( - event: 'upgrade', - listener: (this: WebSocket, request: IncomingMessage) => void - ): this - once( - event: 'message', - listener: (this: WebSocket, data: WebSocket.Data) => void - ): this - once(event: 'open', listener: (this: WebSocket) => void): this - once( - event: 'ping' | 'pong', - listener: (this: WebSocket, data: Buffer) => void - ): this - once( - event: 'unexpected-response', - listener: ( - this: WebSocket, - request: ClientRequest, - response: IncomingMessage - ) => void - ): this - once( - event: string | symbol, - listener: (this: WebSocket, ...args: any[]) => void - ): this - - off( - event: 'close', - listener: (this: WebSocket, code: number, reason: string) => void - ): this - off(event: 'error', listener: (this: WebSocket, err: Error) => void): this - off( - event: 'upgrade', - listener: (this: WebSocket, request: IncomingMessage) => void - ): this - off( - event: 'message', - listener: (this: WebSocket, data: WebSocket.Data) => void - ): this - off(event: 'open', listener: (this: WebSocket) => void): this - off( - event: 'ping' | 'pong', - listener: (this: WebSocket, data: Buffer) => void - ): this - off( - event: 'unexpected-response', - listener: ( - this: WebSocket, - request: ClientRequest, - response: IncomingMessage - ) => void - ): this - off( - event: string | symbol, - listener: (this: WebSocket, ...args: any[]) => void - ): this +// WebSocket socket. +declare class WebSocket extends EventEmitter { + /** The connection is not yet open. */ + static readonly CONNECTING: 0 + /** The connection is open and ready to communicate. */ + static readonly OPEN: 1 + /** The connection is in the process of closing. */ + static readonly CLOSING: 2 + /** The connection is closed. */ + static readonly CLOSED: 3 + + binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments' + readonly bufferedAmount: number + readonly extensions: string + readonly protocol: string + /** The current state of the connection */ + readonly readyState: + | typeof WebSocket.CONNECTING + | typeof WebSocket.OPEN + | typeof WebSocket.CLOSING + | typeof WebSocket.CLOSED + readonly url: string + + /** The connection is not yet open. */ + readonly CONNECTING: 0 + /** The connection is open and ready to communicate. */ + readonly OPEN: 1 + /** The connection is in the process of closing. */ + readonly CLOSING: 2 + /** The connection is closed. */ + readonly CLOSED: 3 + + onopen: (event: WebSocket.Event) => void + onerror: (event: WebSocket.ErrorEvent) => void + onclose: (event: WebSocket.CloseEvent) => void + onmessage: (event: WebSocket.MessageEvent) => void + + constructor( + address: string | URL, + options?: WebSocket.ClientOptions | ClientRequestArgs + ) + constructor( + address: string | URL, + protocols?: string | string[], + options?: WebSocket.ClientOptions | ClientRequestArgs + ) + + close(code?: number, data?: string | Buffer): void + ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void + pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void + send(data: any, cb?: (err?: Error) => void): void + send( + data: any, + options: { + mask?: boolean | undefined + binary?: boolean | undefined + compress?: boolean | undefined + fin?: boolean | undefined + }, + cb?: (err?: Error) => void + ): void + terminate(): void + + // HTML5 WebSocket events + addEventListener( + method: 'message', + cb: (event: WebSocket.MessageEvent) => void, + options?: WebSocket.EventListenerOptions + ): void + addEventListener( + method: 'close', + cb: (event: WebSocket.CloseEvent) => void, + options?: WebSocket.EventListenerOptions + ): void + addEventListener( + method: 'error', + cb: (event: WebSocket.ErrorEvent) => void, + options?: WebSocket.EventListenerOptions + ): void + addEventListener( + method: 'open', + cb: (event: WebSocket.Event) => void, + options?: WebSocket.EventListenerOptions + ): void + + removeEventListener( + method: 'message', + cb: (event: WebSocket.MessageEvent) => void + ): void + removeEventListener( + method: 'close', + cb: (event: WebSocket.CloseEvent) => void + ): void + removeEventListener( + method: 'error', + cb: (event: WebSocket.ErrorEvent) => void + ): void + removeEventListener( + method: 'open', + cb: (event: WebSocket.Event) => void + ): void + + // Events + on( + event: 'close', + listener: (this: WebSocket, code: number, reason: Buffer) => void + ): this + on(event: 'error', listener: (this: WebSocket, err: Error) => void): this + on( + event: 'upgrade', + listener: (this: WebSocket, request: IncomingMessage) => void + ): this + on( + event: 'message', + listener: ( + this: WebSocket, + data: WebSocket.RawData, + isBinary: boolean + ) => void + ): this + on(event: 'open', listener: (this: WebSocket) => void): this + on( + event: 'ping' | 'pong', + listener: (this: WebSocket, data: Buffer) => void + ): this + on( + event: 'unexpected-response', + listener: ( + this: WebSocket, + request: ClientRequest, + response: IncomingMessage + ) => void + ): this + on( + event: string | symbol, + listener: (this: WebSocket, ...args: any[]) => void + ): this + + once( + event: 'close', + listener: (this: WebSocket, code: number, reason: Buffer) => void + ): this + once(event: 'error', listener: (this: WebSocket, err: Error) => void): this + once( + event: 'upgrade', + listener: (this: WebSocket, request: IncomingMessage) => void + ): this + once( + event: 'message', + listener: ( + this: WebSocket, + data: WebSocket.RawData, + isBinary: boolean + ) => void + ): this + once(event: 'open', listener: (this: WebSocket) => void): this + once( + event: 'ping' | 'pong', + listener: (this: WebSocket, data: Buffer) => void + ): this + once( + event: 'unexpected-response', + listener: ( + this: WebSocket, + request: ClientRequest, + response: IncomingMessage + ) => void + ): this + once( + event: string | symbol, + listener: (this: WebSocket, ...args: any[]) => void + ): this + + off( + event: 'close', + listener: (this: WebSocket, code: number, reason: Buffer) => void + ): this + off(event: 'error', listener: (this: WebSocket, err: Error) => void): this + off( + event: 'upgrade', + listener: (this: WebSocket, request: IncomingMessage) => void + ): this + off( + event: 'message', + listener: ( + this: WebSocket, + data: WebSocket.RawData, + isBinary: boolean + ) => void + ): this + off(event: 'open', listener: (this: WebSocket) => void): this + off( + event: 'ping' | 'pong', + listener: (this: WebSocket, data: Buffer) => void + ): this + off( + event: 'unexpected-response', + listener: ( + this: WebSocket, + request: ClientRequest, + response: IncomingMessage + ) => void + ): this + off( + event: string | symbol, + listener: (this: WebSocket, ...args: any[]) => void + ): this + + addListener( + event: 'close', + listener: (code: number, reason: Buffer) => void + ): this + addListener(event: 'error', listener: (err: Error) => void): this + addListener( + event: 'upgrade', + listener: (request: IncomingMessage) => void + ): this + addListener( + event: 'message', + listener: (data: WebSocket.RawData, isBinary: boolean) => void + ): this + addListener(event: 'open', listener: () => void): this + addListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this + addListener( + event: 'unexpected-response', + listener: (request: ClientRequest, response: IncomingMessage) => void + ): this + addListener(event: string | symbol, listener: (...args: any[]) => void): this + + removeListener( + event: 'close', + listener: (code: number, reason: Buffer) => void + ): this + removeListener(event: 'error', listener: (err: Error) => void): this + removeListener( + event: 'upgrade', + listener: (request: IncomingMessage) => void + ): this + removeListener( + event: 'message', + listener: (data: WebSocket.RawData, isBinary: boolean) => void + ): this + removeListener(event: 'open', listener: () => void): this + removeListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this + removeListener( + event: 'unexpected-response', + listener: (request: ClientRequest, response: IncomingMessage) => void + ): this + removeListener( + event: string | symbol, + listener: (...args: any[]) => void + ): this +} - addListener( - event: 'close', - listener: (code: number, message: string) => void - ): this - addListener(event: 'error', listener: (err: Error) => void): this - addListener( - event: 'upgrade', - listener: (request: IncomingMessage) => void - ): this - addListener( - event: 'message', - listener: (data: WebSocket.Data) => void - ): this - addListener(event: 'open', listener: () => void): this - addListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this - addListener( - event: 'unexpected-response', - listener: (request: ClientRequest, response: IncomingMessage) => void - ): this - addListener( - event: string | symbol, - listener: (...args: any[]) => void - ): this +declare const WebSocketAlias: typeof WebSocket +type WebSocketAlias = WebSocket - removeListener( - event: 'close', - listener: (code: number, message: string) => void - ): this - removeListener(event: 'error', listener: (err: Error) => void): this - removeListener( - event: 'upgrade', - listener: (request: IncomingMessage) => void - ): this - removeListener( - event: 'message', - listener: (data: WebSocket.Data) => void - ): this - removeListener(event: 'open', listener: () => void): this - removeListener( - event: 'ping' | 'pong', - listener: (data: Buffer) => void - ): this - removeListener( - event: 'unexpected-response', - listener: (request: ClientRequest, response: IncomingMessage) => void - ): this - removeListener( - event: string | symbol, - listener: (...args: any[]) => void - ): this - } +declare namespace WebSocket { + /** + * Data represents the raw message payload received over the WebSocket. + */ + type RawData = Buffer | ArrayBuffer | Buffer[] /** * Data represents the message payload received over the WebSocket. @@ -382,7 +366,7 @@ export declare namespace WebSocket { concurrencyLimit?: number | undefined } - interface OpenEvent { + interface Event { type: string target: WebSocket } @@ -421,12 +405,16 @@ export declare namespace WebSocket { | VerifyClientCallbackAsync | VerifyClientCallbackSync | undefined - handleProtocols?: any + handleProtocols?: ( + protocols: Set, + request: IncomingMessage + ) => string | false path?: string | undefined noServer?: boolean | undefined clientTracking?: boolean | undefined perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined maxPayload?: number | undefined + skipUTF8Validation?: boolean | undefined } interface AddressInfo { @@ -436,7 +424,7 @@ export declare namespace WebSocket { } // WebSocket Server - export class Server extends EventEmitter { + class Server extends EventEmitter { options: ServerOptions path: string clients: Set @@ -447,7 +435,7 @@ export declare namespace WebSocket { close(cb?: (err?: Error) => void): void handleUpgrade( request: IncomingMessage, - socket: Socket, + socket: Duplex, upgradeHead: Buffer, callback: (client: WebSocket, request: IncomingMessage) => void ): void @@ -524,9 +512,17 @@ export declare namespace WebSocket { ): this } + const WebSocketServer: typeof Server + type WebSocketServer = Server + const WebSocket: typeof WebSocketAlias + type WebSocket = WebSocketAlias + // WebSocket stream function createWebSocketStream( websocket: WebSocket, options?: DuplexOptions ): Duplex } + +//export = WebSocket; +export { WebSocket, WebSocketAlias } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e775dd4470891..572696f0c3bbd9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -704,6 +704,12 @@ importers: '@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.16.0 hash-sum: 2.0.0 + packages/temp: + specifiers: + css-color-names: ^1.0.1 + devDependencies: + css-color-names: 1.0.1 + packages/vite: specifiers: '@ampproject/remapping': ^1.0.1 @@ -727,7 +733,7 @@ importers: '@types/resolve': ^1.20.1 '@types/sass': ~1.43.0 '@types/stylus': ^0.48.36 - '@types/ws': ^8.2.0 + '@types/ws': ^8.2.2 '@vue/compiler-dom': ^3.2.22 acorn: ^8.6.0 acorn-class-fields: ^1.0.0 @@ -775,7 +781,7 @@ importers: tsconfck: 1.1.1 tslib: ^2.3.1 types: link:./types - ws: ^8.2.3 + ws: ^8.3.0 dependencies: esbuild: 0.13.12 postcss: 8.3.11 @@ -805,7 +811,7 @@ importers: '@types/resolve': 1.20.1 '@types/sass': 1.43.0 '@types/stylus': 0.48.36 - '@types/ws': 8.2.0 + '@types/ws': 8.2.2 '@vue/compiler-dom': 3.2.22 acorn: 8.6.0 acorn-class-fields: 1.0.0_acorn@8.6.0 @@ -848,7 +854,7 @@ importers: tsconfck: 1.1.1_typescript@4.4.4 tslib: 2.3.1 types: link:types - ws: 8.2.3 + ws: 8.3.0 packages: @@ -2279,8 +2285,8 @@ packages: '@types/node': 16.11.9 dev: true - /@types/ws/8.2.0: - resolution: {integrity: sha512-cyeefcUCgJlEk+hk2h3N+MqKKsPViQgF5boi9TTHSK+PoR9KWBb/C5ccPcDyAqgsbAYHTwulch725DV84+pSpg==} + /@types/ws/8.2.2: + resolution: {integrity: sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==} dependencies: '@types/node': 16.11.9 dev: true @@ -9188,8 +9194,8 @@ packages: optional: true dev: true - /ws/8.2.3: - resolution: {integrity: sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==} + /ws/8.3.0: + resolution: {integrity: sha512-Gs5EZtpqZzLvmIM59w4igITU57lrtYVFneaa434VROv4thzJyV6UjIL3D42lslWlI+D4KzLYnxSwtfuiO79sNw==} engines: {node: '>=10.0.0'} peerDependencies: bufferutil: ^4.0.1 From 9c2843cf0506844ee32f042a04c22c440434df2a Mon Sep 17 00:00:00 2001 From: Aaron Bassett Date: Sun, 12 Dec 2021 13:09:30 -0500 Subject: [PATCH 0062/1287] fix: ignore babel config when running restore-jsx (#6047) --- packages/plugin-react/src/jsx-runtime/restore-jsx.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/plugin-react/src/jsx-runtime/restore-jsx.ts b/packages/plugin-react/src/jsx-runtime/restore-jsx.ts index 250fe43ce4d0c8..095f7c586e43a1 100644 --- a/packages/plugin-react/src/jsx-runtime/restore-jsx.ts +++ b/packages/plugin-react/src/jsx-runtime/restore-jsx.ts @@ -48,6 +48,8 @@ export async function restoreJSX( babelRestoreJSX ||= import('./babel-restore-jsx') const result = await babel.transformAsync(code, { + babelrc: false, + configFile: false, ast: true, code: false, filename, From 61d076ae0ce724ffc5242358d067f7b1438d24bb Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Sun, 12 Dec 2021 11:45:30 -0800 Subject: [PATCH 0063/1287] docs: improve instructions for testing local changes against other packages (#6084) --- CONTRIBUTING.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 54ac9f4d4ddc81..fe17b0f3befe36 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,24 +12,24 @@ To develop and test the core `vite` package: 2. Go to `packages/vite` and run `pnpm run dev`. This starts `rollup` in watch mode. -3. Run `pnpm link --global` in `packages/vite`. This links `vite` globally so that you can: - - - Run `pnpm link --global vite` in another Vite project to use the locally built Vite; - - Use the `vite` binary anywhere. - - If your project has `vite` as a nested dependency, you can customize the dependency resolution instead depending on the package manager used. For pnpm, add this in your project's root `package.json`: - - ```json - { - "pnpm": { - "overrides": { - "vite": "link:../path/to/vite/packages/vite" - } - } - } - ``` +## Testing Vite against external packages + +You may wish to test your locally-modified copy of Vite against another package that is built with Vite. For pnpm, after building Vite, you can use [`pnpm.overrides`](https://pnpm.io/package_json#pnpmoverrides). Please note that `pnpm.overrides` must be specified in the root `package.json` and you must first list the package as a dependency in the root `package.json`: + +```json +{ + "dependencies": { + "vite": "^2.0.0" + }, + "pnpm": { + "overrides": { + "vite": "link:../path/to/vite/packages/vite" + } + } +} +``` - And re-run `pnpm install` to link the package. +And re-run `pnpm install` to link the package. ## Running Tests From 2d9a684ee60728eba23f34b02521b0c5cc831629 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 13 Dec 2021 11:38:34 +0100 Subject: [PATCH 0064/1287] release: plugin-vue-jsx@1.3.2 --- .../ssr-deps/node-addon/build/Makefile | 324 ++++++++++++++++ .../Release/.deps/Release/cpp_addon.node.d | 1 + .../.deps/Release/obj.target/cpp_addon.node.d | 1 + .../Release/obj.target/cpp_addon/main.o.d | 23 ++ .../node-addon/build/Release/cpp_addon.node | Bin 0 -> 13288 bytes .../build/Release/obj.target/cpp_addon.node | Bin 0 -> 13288 bytes .../build/Release/obj.target/cpp_addon/main.o | Bin 0 -> 4368 bytes .../node-addon/build/binding.Makefile | 6 + .../ssr-deps/node-addon/build/config.gypi | 351 ++++++++++++++++++ .../node-addon/build/cpp_addon.target.mk | 159 ++++++++ packages/plugin-vue-jsx/CHANGELOG.md | 9 + packages/plugin-vue-jsx/package.json | 2 +- pnpm-lock.yaml | 6 - 13 files changed, 875 insertions(+), 7 deletions(-) create mode 100644 packages/playground/ssr-deps/node-addon/build/Makefile create mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d create mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d create mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d create mode 100755 packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node create mode 100755 packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node create mode 100644 packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o create mode 100644 packages/playground/ssr-deps/node-addon/build/binding.Makefile create mode 100644 packages/playground/ssr-deps/node-addon/build/config.gypi create mode 100644 packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk diff --git a/packages/playground/ssr-deps/node-addon/build/Makefile b/packages/playground/ssr-deps/node-addon/build/Makefile new file mode 100644 index 00000000000000..83ce3f09d28c03 --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/Makefile @@ -0,0 +1,324 @@ +# We borrow heavily from the kernel build setup, though we are simpler since +# we don't have Kconfig tweaking settings on us. + +# The implicit make rules have it looking for RCS files, among other things. +# We instead explicitly write all the rules we care about. +# It's even quicker (saves ~200ms) to pass -r on the command line. +MAKEFLAGS=-r + +# The source directory tree. +srcdir := .. +abs_srcdir := $(abspath $(srcdir)) + +# The name of the builddir. +builddir_name ?= . + +# The V=1 flag on command line makes us verbosely print command lines. +ifdef V + quiet= +else + quiet=quiet_ +endif + +# Specify BUILDTYPE=Release on the command line for a release build. +BUILDTYPE ?= Release + +# Directory all our build output goes into. +# Note that this must be two directories beneath src/ for unit tests to pass, +# as they reach into the src/ directory for data with relative paths. +builddir ?= $(builddir_name)/$(BUILDTYPE) +abs_builddir := $(abspath $(builddir)) +depsdir := $(builddir)/.deps + +# Object output directory. +obj := $(builddir)/obj +abs_obj := $(abspath $(obj)) + +# We build up a list of every single one of the targets so we can slurp in the +# generated dependency rule Makefiles in one pass. +all_deps := + + + +CC.target ?= $(CC) +CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS) +CXX.target ?= $(CXX) +CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS) +LINK.target ?= $(LINK) +LDFLAGS.target ?= $(LDFLAGS) +AR.target ?= $(AR) + +# C++ apps need to be linked with g++. +LINK ?= $(CXX.target) + +# TODO(evan): move all cross-compilation logic to gyp-time so we don't need +# to replicate this environment fallback in make as well. +CC.host ?= gcc +CFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host) +CXX.host ?= g++ +CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host) +LINK.host ?= $(CXX.host) +LDFLAGS.host ?= $(LDFLAGS_host) +AR.host ?= ar + +# Define a dir function that can handle spaces. +# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions +# "leading spaces cannot appear in the text of the first argument as written. +# These characters can be put into the argument value by variable substitution." +empty := +space := $(empty) $(empty) + +# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces +replace_spaces = $(subst $(space),?,$1) +unreplace_spaces = $(subst ?,$(space),$1) +dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1))) + +# Flags to make gcc output dependency info. Note that you need to be +# careful here to use the flags that ccache and distcc can understand. +# We write to a dep file on the side first and then rename at the end +# so we can't end up with a broken dep file. +depfile = $(depsdir)/$(call replace_spaces,$@).d +DEPFLAGS = -MMD -MF $(depfile).raw + +# We have to fixup the deps output in a few ways. +# (1) the file output should mention the proper .o file. +# ccache or distcc lose the path to the target, so we convert a rule of +# the form: +# foobar.o: DEP1 DEP2 +# into +# path/to/foobar.o: DEP1 DEP2 +# (2) we want missing files not to cause us to fail to build. +# We want to rewrite +# foobar.o: DEP1 DEP2 \ +# DEP3 +# to +# DEP1: +# DEP2: +# DEP3: +# so if the files are missing, they're just considered phony rules. +# We have to do some pretty insane escaping to get those backslashes +# and dollar signs past make, the shell, and sed at the same time. +# Doesn't work with spaces, but that's fine: .d files have spaces in +# their names replaced with other characters. +define fixup_dep +# The depfile may not exist if the input file didn't have any #includes. +touch $(depfile).raw +# Fixup path as in (1). +sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef + +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c + +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@") + +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) + +quiet_cmd_alink_thin = AR($(TOOLSET)) $@ +cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) + +# Due to circular dependencies between libraries :(, we wrap the +# special "figure out circular dependencies" flags around the entire +# input list during linking. +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group + +# We support two kinds of shared objects (.so): +# 1) shared_library, which is just bundling together many dependent libraries +# into a link line. +# 2) loadable_module, which is generating a module intended for dlopen(). +# +# They differ only slightly: +# In the former case, we want to package all dependent code into the .so. +# In the latter case, we want to package just the API exposed by the +# outermost module. +# This means shared_library uses --whole-archive, while loadable_module doesn't. +# (Note that --whole-archive is incompatible with the --start-group used in +# normal linking.) + +# Other shared-object link notes: +# - Set SONAME to the library filename so our binaries don't reference +# the local, absolute paths used on the link command-line. +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) + + +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' + +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain ? instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds until one fails. +define do_postbuilds + @E=0;\ + for p in $(POSTBUILDS); do\ + eval $$p;\ + E=$$?;\ + if [ $$E -ne 0 ]; then\ + break;\ + fi;\ + done;\ + if [ $$E -ne 0 ]; then\ + rm -rf "$@";\ + exit $$E;\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains ? for +# spaces already and dirx strips the ? characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word 1,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "all" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: all +all: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +TOOLSET := target +# Suffix rules, putting all outputs into $(obj). +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + + +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,cpp_addon.target.mk)))),) + include cpp_addon.target.mk +endif + +quiet_cmd_regen_makefile = ACTION Regenerating $@ +cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/matias/.cache/node-gyp/16.9.1" "-Dnode_gyp_dir=/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp" "-Dnode_lib_file=/home/matias/.cache/node-gyp/16.9.1/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/matias/vite/packages/playground/ssr-deps/node-addon" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/matias/vite/packages/playground/ssr-deps/node-addon/build/config.gypi -I/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi -I/home/matias/.cache/node-gyp/16.9.1/include/node/common.gypi "--toplevel-dir=." binding.gyp +Makefile: $(srcdir)/../../../../../.cache/node-gyp/16.9.1/include/node/common.gypi $(srcdir)/../../../../../../../usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi $(srcdir)/binding.gyp $(srcdir)/build/config.gypi + $(call do_cmd,regen_makefile) + +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d new file mode 100644 index 00000000000000..4be797e6cbdf6e --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d @@ -0,0 +1 @@ +cmd_Release/cpp_addon.node := ln -f "Release/obj.target/cpp_addon.node" "Release/cpp_addon.node" 2>/dev/null || (rm -rf "Release/cpp_addon.node" && cp -af "Release/obj.target/cpp_addon.node" "Release/cpp_addon.node") diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d new file mode 100644 index 00000000000000..9f4d87550d1f0a --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d @@ -0,0 +1 @@ +cmd_Release/obj.target/cpp_addon.node := g++ -o Release/obj.target/cpp_addon.node -shared -pthread -rdynamic -m64 -Wl,-soname=cpp_addon.node -Wl,--start-group Release/obj.target/cpp_addon/main.o -Wl,--end-group diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d new file mode 100644 index 00000000000000..2955b089117c85 --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d @@ -0,0 +1,23 @@ +cmd_Release/obj.target/cpp_addon/main.o := g++ -o Release/obj.target/cpp_addon/main.o ../main.cpp '-DNODE_GYP_MODULE_NAME=cpp_addon' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/home/matias/.cache/node-gyp/16.9.1/include/node -I/home/matias/.cache/node-gyp/16.9.1/src -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++14 -MMD -MF ./Release/.deps/Release/obj.target/cpp_addon/main.o.d.raw -c +Release/obj.target/cpp_addon/main.o: ../main.cpp \ + /home/matias/.cache/node-gyp/16.9.1/include/node/node.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/cppgc/common.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8-internal.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8-version.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8-platform.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/node_version.h \ + /home/matias/.cache/node-gyp/16.9.1/include/node/v8.h +../main.cpp: +/home/matias/.cache/node-gyp/16.9.1/include/node/node.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/cppgc/common.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8-internal.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8-version.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8-platform.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/node_version.h: +/home/matias/.cache/node-gyp/16.9.1/include/node/v8.h: diff --git a/packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node b/packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node new file mode 100755 index 0000000000000000000000000000000000000000..67c3f500cb518bfb96782ef1aeab0acc72d09ef3 GIT binary patch literal 13288 zcmeHOeQX@X6`%7tiAn6(I3Y0!kOhSjC@en5Un!*c?3}X>7suqBkN{z`zFXTz?rx8} zy!*EDS5Iew5p2KN>Pg{Xe(hFl)Chfy0n#2+Jb?i-W4QFQPT7)?t8QI z_V)JfT0m;0N;lE@&HK%JZ{EC}o!yyzc_RkV9%!^6qKru#z&@74Z}D=@0+o2hrZpCRUQp6Q7WL|`u-facka&gY zyci16I!lbz0>$5)Xm``iLXIfPVi|hNj9@*vnzJRe-GUiW(z^}x(9aKAnuOq9(O;#w zG>Lc+6~p0UTMIV4@Y^}KkG=B1HDk4V)=zzP=VNDk*M0lz=B_6)*afyX!;j+s=&a;n zwY}4bT>`%r`1J;U{m%J!Q{VmJn_qlj@ztR>&fI(8vgc;rTmAMg-xW~+Ay>H!c*%t! z+X@}g*qqI;!8pp{YbwaE1IN)vcbTXl|6~RGAkHMW5#Wa_*hyBf^JUN}=l@?S$p5B- z{53GHa&~+b>~w=234ZRf7l5nWAn^U%{yMfGNky&i1J}&zS!;s@*TeX+9OUxrSvALB(P>^*TZ(ujOXOgOp#f^lTHno(gs!WY0q9#*E zfiQJoc()qSQ~FpmZR)Av-F-15p$}^#G2Ln_-=c;mG&G>aqW6Q~9llmYkHw7JjZ`eM z_twF-qup(-{h37Aj2ekPEfyQm!bb)YqsG8sNbT6K#WH#z5CA=t>>nN&(om|Pk4d_F}>L}Gds6zlwv~7K)A~ zG&7UJ$VLJ1Z39ozW-1dlja08bt{sgUDb)70hoTWZFggmc;DH>%uDA7(n{-`#C64=i zFicwvlnSx!qG8*YwVMRHLb^Gq#dU}0pen9<;bMrZvlXO^B^{;*Lq0xOdkTd*U^??z zP;|L=`0UGwv!e^A)viq197qou<~U3?Y{vT`d_)b8A5llOXpAL{h_1$sNG7JMH0xO` zIue%ChTO?iJ))T!sEwr4)~y6kBErJSq^d#$LA%LMF;L&&(AyX zi%A&hv%(+jbBzOU5%>zgoL50|;3AYPnTvu+3Od_U=N;Mg}6#eu_x zwabtLcP{Y<9JqLe17R{AwP~f`GqAYS8qVxgZw<_n~}%R=Vv*;5_t@H z{v_vXkjGHxpXB`C)&h?q&Y$4?pOMGV=BGISC*(1t`6TDxKpv-5{xIiXK^{Y!AL9JW z$YV(JJ)D0Dc?@N~mGeJF9z&RyINt{R=n3F?*{95Gp94h6zI7=7JP3@+jhl}1rp8S> z7=z|KG=tc(*HLWSd5|{y{pPt@h^ zzW^{ykxP{6CS@A@9%{j;z}YnBWj*$+@5_Z>9&@GNv=f@iM=vwzHe zmK%6o$-WZIo(pD|at8r8K5GWRom>OTPY32A%2vzWOouX~pSjb2m;aFeZog{BHcz~ltb!$5OLVca;OXMsKo6w6wRFwgyanP;NOv$1|f-3bW6X25ap z(E_#>P-b;g|LT@qjjQgfn_{cezl^B{*e9~IQU3x0FZH-D$~uWovz z=C+3A{$t+pmC#9G)qeQPt_PXps02RocV#Zu*RWjqy!Wx%nPs0_9z3?9W)3wJyjjtw zXW)lpnz}0@VmqBT$V%H3HQLR3lK0Ks5r@2vj5R-;DsBx6=74 zou}ey0v0^W#X@IpcMG1*?C5(Aoz>BIoJ%b=`+Rq!;OQ)MgW%~r7x%|lXfJ&B!jggf zqHu)HEFY~!)cWR&v{f96(wXBi;UAqfwxAFc0W&5^oTszYZegF!6X>jSJ(ptaggE3R zJSiL`KP910XQ9*|91C#&dxRjIJ#k)$vqizzi}t??-gyQqT=<_7`fl#-^qdIrauL{d zf__ZUPC@$x-7n~NzpQH(EVG_Q*B6^!O*Fjah)76$isKwvUr*A zy4?P17N7;iVaUrG?R*Lc4ECGYx5~<2Y_BiH^39Cam12AiS$oQ+=0 zfG9H`y=)yTH&4B6eaUxqwCCkn6i&<5x20P4-cm8jAoBQ~rw~v2Msx+>9_aT;;ZKiH zybfqNI~{aHUf5Z1UH4iTxTnl~*Z{c1 zZ599N1e~6A&XzkW;3$KCeTC!B9VPvpGd1(W`czc$luUSJtB8?ZtE^D#ItHtEtS$HAv?fKO|sDx z>6+|)*ZnkkEp zQ!Qbbx;&Q1$Rn9(EOJ9M!Z zGEeH0p(>9Vz+w&>lli?TrwpFDBi>NhSe|*D_oiN`NKlEpT#{PJPvuGeE`wT0w)5?e^HTvI|q9{(x?3b(H>eGJ9rcPm~(>n;!2VMHKFC$9hB{Rem z{ftYW_HRUE6j)(^`XzfaE`2)pAxh^VB<~*omxMme6WR|Fy_OUOrTItn387DJy7Ted zUHb0+pLXff{*vggT>2C@g1-k9+>+A#qC7^*(|5;<^oc$Xy12C=eS05;8$Bo_XK@9d z@Si~g&OOqneJ%YzhE69|^ z*?&oo=eAeEsI#UkE$*;b81S4EbA`wsT7U5VAm1$w>u>TJi#|*jPBdbF&VuIx<@C>f O+>(0FDGYVD{=Wc8x$V*b literal 0 HcmV?d00001 diff --git a/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node b/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node new file mode 100755 index 0000000000000000000000000000000000000000..67c3f500cb518bfb96782ef1aeab0acc72d09ef3 GIT binary patch literal 13288 zcmeHOeQX@X6`%7tiAn6(I3Y0!kOhSjC@en5Un!*c?3}X>7suqBkN{z`zFXTz?rx8} zy!*EDS5Iew5p2KN>Pg{Xe(hFl)Chfy0n#2+Jb?i-W4QFQPT7)?t8QI z_V)JfT0m;0N;lE@&HK%JZ{EC}o!yyzc_RkV9%!^6qKru#z&@74Z}D=@0+o2hrZpCRUQp6Q7WL|`u-facka&gY zyci16I!lbz0>$5)Xm``iLXIfPVi|hNj9@*vnzJRe-GUiW(z^}x(9aKAnuOq9(O;#w zG>Lc+6~p0UTMIV4@Y^}KkG=B1HDk4V)=zzP=VNDk*M0lz=B_6)*afyX!;j+s=&a;n zwY}4bT>`%r`1J;U{m%J!Q{VmJn_qlj@ztR>&fI(8vgc;rTmAMg-xW~+Ay>H!c*%t! z+X@}g*qqI;!8pp{YbwaE1IN)vcbTXl|6~RGAkHMW5#Wa_*hyBf^JUN}=l@?S$p5B- z{53GHa&~+b>~w=234ZRf7l5nWAn^U%{yMfGNky&i1J}&zS!;s@*TeX+9OUxrSvALB(P>^*TZ(ujOXOgOp#f^lTHno(gs!WY0q9#*E zfiQJoc()qSQ~FpmZR)Av-F-15p$}^#G2Ln_-=c;mG&G>aqW6Q~9llmYkHw7JjZ`eM z_twF-qup(-{h37Aj2ekPEfyQm!bb)YqsG8sNbT6K#WH#z5CA=t>>nN&(om|Pk4d_F}>L}Gds6zlwv~7K)A~ zG&7UJ$VLJ1Z39ozW-1dlja08bt{sgUDb)70hoTWZFggmc;DH>%uDA7(n{-`#C64=i zFicwvlnSx!qG8*YwVMRHLb^Gq#dU}0pen9<;bMrZvlXO^B^{;*Lq0xOdkTd*U^??z zP;|L=`0UGwv!e^A)viq197qou<~U3?Y{vT`d_)b8A5llOXpAL{h_1$sNG7JMH0xO` zIue%ChTO?iJ))T!sEwr4)~y6kBErJSq^d#$LA%LMF;L&&(AyX zi%A&hv%(+jbBzOU5%>zgoL50|;3AYPnTvu+3Od_U=N;Mg}6#eu_x zwabtLcP{Y<9JqLe17R{AwP~f`GqAYS8qVxgZw<_n~}%R=Vv*;5_t@H z{v_vXkjGHxpXB`C)&h?q&Y$4?pOMGV=BGISC*(1t`6TDxKpv-5{xIiXK^{Y!AL9JW z$YV(JJ)D0Dc?@N~mGeJF9z&RyINt{R=n3F?*{95Gp94h6zI7=7JP3@+jhl}1rp8S> z7=z|KG=tc(*HLWSd5|{y{pPt@h^ zzW^{ykxP{6CS@A@9%{j;z}YnBWj*$+@5_Z>9&@GNv=f@iM=vwzHe zmK%6o$-WZIo(pD|at8r8K5GWRom>OTPY32A%2vzWOouX~pSjb2m;aFeZog{BHcz~ltb!$5OLVca;OXMsKo6w6wRFwgyanP;NOv$1|f-3bW6X25ap z(E_#>P-b;g|LT@qjjQgfn_{cezl^B{*e9~IQU3x0FZH-D$~uWovz z=C+3A{$t+pmC#9G)qeQPt_PXps02RocV#Zu*RWjqy!Wx%nPs0_9z3?9W)3wJyjjtw zXW)lpnz}0@VmqBT$V%H3HQLR3lK0Ks5r@2vj5R-;DsBx6=74 zou}ey0v0^W#X@IpcMG1*?C5(Aoz>BIoJ%b=`+Rq!;OQ)MgW%~r7x%|lXfJ&B!jggf zqHu)HEFY~!)cWR&v{f96(wXBi;UAqfwxAFc0W&5^oTszYZegF!6X>jSJ(ptaggE3R zJSiL`KP910XQ9*|91C#&dxRjIJ#k)$vqizzi}t??-gyQqT=<_7`fl#-^qdIrauL{d zf__ZUPC@$x-7n~NzpQH(EVG_Q*B6^!O*Fjah)76$isKwvUr*A zy4?P17N7;iVaUrG?R*Lc4ECGYx5~<2Y_BiH^39Cam12AiS$oQ+=0 zfG9H`y=)yTH&4B6eaUxqwCCkn6i&<5x20P4-cm8jAoBQ~rw~v2Msx+>9_aT;;ZKiH zybfqNI~{aHUf5Z1UH4iTxTnl~*Z{c1 zZ599N1e~6A&XzkW;3$KCeTC!B9VPvpGd1(W`czc$luUSJtB8?ZtE^D#ItHtEtS$HAv?fKO|sDx z>6+|)*ZnkkEp zQ!Qbbx;&Q1$Rn9(EOJ9M!Z zGEeH0p(>9Vz+w&>lli?TrwpFDBi>NhSe|*D_oiN`NKlEpT#{PJPvuGeE`wT0w)5?e^HTvI|q9{(x?3b(H>eGJ9rcPm~(>n;!2VMHKFC$9hB{Rem z{ftYW_HRUE6j)(^`XzfaE`2)pAxh^VB<~*omxMme6WR|Fy_OUOrTItn387DJy7Ted zUHb0+pLXff{*vggT>2C@g1-k9+>+A#qC7^*(|5;<^oc$Xy12C=eS05;8$Bo_XK@9d z@Si~g&OOqneJ%YzhE69|^ z*?&oo=eAeEsI#UkE$*;b81S4EbA`wsT7U5VAm1$w>u>TJi#|*jPBdbF&VuIx<@C>f O+>(0FDGYVD{=Wc8x$V*b literal 0 HcmV?d00001 diff --git a/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o b/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o new file mode 100644 index 0000000000000000000000000000000000000000..088f7174574579a7049a29fc9c0372a4205fa7b7 GIT binary patch literal 4368 zcmbtWU2GIp6u#|3sr*(Dh#E|YFUCZYdd{7DwztDWwQ)Ai94$qx=8p zbAPnzwKaNeru8?R)h{e~TlHF-UW@7e$TofMTI;EatDD;6ESLtkHqs_dO>JsFkA~pi zznwUq7*C8PM$_}9%bAqF1l~JydTrINPIT>Si|PV*llJfG{#D(-9ys-X7S8zs&ocE} zXg4%HaqX`vOc~J9)yhMPk6=nSF@{M1e3Ktn8<>|0{>m{x7=! zJ-A8xOB^`A;Aya&fM3%Vb9zs(+-jdbZ{0kVcqK8Bcr{^Q5#9#Jf#*B5OWfklr}g}U z@fU$3t5|e8jyrBK_Y}+HfGNt}l3B2oY`M&!8D=i$*yxW0_U8cVP{xVh36%N?Nq-=9 zD4BerqjPMsYJ1g=ex*<8+S60zBlS&nKbdTg8wk~oPP-XqPNC^u2-=?m!cT4$R~uc82q9n2A-lM##Tqc;HBk0d@Uf& z63%l0>`7=%3}*w0lLCE=MQ0e3_!1rX8{}bKkFkw)os{Rea{v1G3OveFj7gV>aMTO^ zW~rWh?*S`9YZDx~d#3^Zbp!kdz|sF{=u!BYf&Lz}DF54G8c4REsozN0zX&xr=O z-vD21fZu9>FEzm1;AlqW#p>6G;aX=370+^w<%`5PneI1APOe(Cn37I*;h)NklWLca z*AKsnjvXHEo*wA#8m!t`ui)58vsj!ov*%Lwl#?3H7=7brv1)0W#*Cr#k%Nh}ab$2X zqm3G)iGyj)0B>l&FXOod`;4j%TdxhePHD`W8qh|-ygyZOil%32BZspvRC|CBa7Sm$ zmR1n<-Qxpl_o$P0vSv{$mAzSQ8fJP^cELmUeS89!v+u~{Su5-D_3+3PKWY3GVoChL@~q`GoNB6QtB|FVOmV|&(&AX{cq! z_z$JjfF@GP^corr69y)?KT|kkn_kt$dKUmt_rppmo?Fd&j(gC`o6`lyMQgP;Q^;A` z)D+Z$7jgtc?@!V)VYhg7)cY2$s*q-#21d)Z?WeSHv$^>I5&JWiH*A(HY2{!lc71s> z#P0L}dnHqHJ)BW_vh{7!G$V!K{a>)VK@qaTmep=!lTRfZie4~Gq>jfw|n)yU@0 z8B=DV$ZRKPi4$LcAn@Lx8yp@leoNlNuN{!5aS{aQH$x*lfglLtTc8pC9)cixazS_U+n4T4#PMy1Yem7@q99J+G&t_WKM>+$43rN3AFK!0M4}4? zF>I&Bct-Sy$?IWCWwzv*lhAu^(C0~Wt)i*mwZoL0>6uKKtW=odIygYOs;Dp|5+J7Q zRm%b@z)fkGu4~Q;fLj5ZDOsmff=iJpw&PjK(D2wE{?G`Xl{cnbc(TQU|7X_$_E@_W zIm0*(4W)>alFUUFoVs;5bw8I$T`n?Po z-Xr1s{}%Cy4-_smral8`RQy)_msD2T2%ZF z5nmU4jE^M=$FBf}@u^Ora*5-E41)KyETSy+eS8BZ36pteg}scS9_D^1urR$WfJ-3< zw0?pwf)bT~J|chIXR@dI<9foexo_GK(c?L!J;Zsk$H$bYh}T6N=v|@7aQ^5wMBy$j Oi}in8cNi#P`+otuZNl#W literal 0 HcmV?d00001 diff --git a/packages/playground/ssr-deps/node-addon/build/binding.Makefile b/packages/playground/ssr-deps/node-addon/build/binding.Makefile new file mode 100644 index 00000000000000..9521a57df40291 --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/binding.Makefile @@ -0,0 +1,6 @@ +# This file is generated by gyp; do not edit. + +export builddir_name ?= ./build/. +.PHONY: all +all: + $(MAKE) cpp_addon diff --git a/packages/playground/ssr-deps/node-addon/build/config.gypi b/packages/playground/ssr-deps/node-addon/build/config.gypi new file mode 100644 index 00000000000000..815e24a35e5c83 --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/config.gypi @@ -0,0 +1,351 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "asan": 0, + "coverage": "false", + "dcheck_always_on": 0, + "debug_nghttp2": "false", + "debug_node": "false", + "enable_lto": "false", + "enable_pgo_generate": "false", + "enable_pgo_use": "false", + "error_on_warn": "false", + "force_dynamic_crt": 0, + "gas_version": "2.30", + "host_arch": "x64", + "icu_data_in": "../../deps/icu-tmp/icudt69l.dat", + "icu_endianness": "l", + "icu_gyp_path": "tools/icu/icu-generic.gyp", + "icu_path": "deps/icu-small", + "icu_small": "false", + "icu_ver_major": "69", + "is_debug": 0, + "llvm_version": "0.0", + "napi_build_version": "8", + "node_byteorder": "little", + "node_debug_lib": "false", + "node_enable_d8": "false", + "node_install_npm": "true", + "node_library_files": [ + "lib/diagnostics_channel.js", + "lib/path.js", + "lib/punycode.js", + "lib/tty.js", + "lib/_stream_wrap.js", + "lib/querystring.js", + "lib/_tls_common.js", + "lib/_tls_wrap.js", + "lib/assert.js", + "lib/async_hooks.js", + "lib/child_process.js", + "lib/cluster.js", + "lib/dns.js", + "lib/util.js", + "lib/vm.js", + "lib/worker_threads.js", + "lib/url.js", + "lib/buffer.js", + "lib/wasi.js", + "lib/process.js", + "lib/console.js", + "lib/constants.js", + "lib/events.js", + "lib/fs.js", + "lib/_stream_duplex.js", + "lib/module.js", + "lib/domain.js", + "lib/zlib.js", + "lib/_http_client.js", + "lib/_http_server.js", + "lib/_stream_writable.js", + "lib/http.js", + "lib/https.js", + "lib/inspector.js", + "lib/trace_events.js", + "lib/_http_incoming.js", + "lib/http2.js", + "lib/os.js", + "lib/string_decoder.js", + "lib/_stream_passthrough.js", + "lib/_stream_readable.js", + "lib/_stream_transform.js", + "lib/crypto.js", + "lib/timers.js", + "lib/repl.js", + "lib/_http_agent.js", + "lib/_http_common.js", + "lib/_http_outgoing.js", + "lib/net.js", + "lib/perf_hooks.js", + "lib/readline.js", + "lib/v8.js", + "lib/sys.js", + "lib/tls.js", + "lib/stream.js", + "lib/dgram.js", + "lib/dns/promises.js", + "lib/stream/consumers.js", + "lib/stream/promises.js", + "lib/stream/web.js", + "lib/assert/strict.js", + "lib/internal/async_hooks.js", + "lib/internal/heap_utils.js", + "lib/internal/blob.js", + "lib/internal/freeze_intrinsics.js", + "lib/internal/inspector_async_hook.js", + "lib/internal/linkedlist.js", + "lib/internal/js_stream_socket.js", + "lib/internal/url.js", + "lib/internal/socketaddress.js", + "lib/internal/util.js", + "lib/internal/options.js", + "lib/internal/repl.js", + "lib/internal/child_process.js", + "lib/internal/errors.js", + "lib/internal/event_target.js", + "lib/internal/v8_prof_polyfill.js", + "lib/internal/v8_prof_processor.js", + "lib/internal/validators.js", + "lib/internal/buffer.js", + "lib/internal/encoding.js", + "lib/internal/watchdog.js", + "lib/internal/trace_events_async_hooks.js", + "lib/internal/constants.js", + "lib/internal/abort_controller.js", + "lib/internal/blocklist.js", + "lib/internal/querystring.js", + "lib/internal/net.js", + "lib/internal/cli_table.js", + "lib/internal/fixed_queue.js", + "lib/internal/priority_queue.js", + "lib/internal/tty.js", + "lib/internal/assert.js", + "lib/internal/timers.js", + "lib/internal/socket_list.js", + "lib/internal/error_serdes.js", + "lib/internal/freelist.js", + "lib/internal/dgram.js", + "lib/internal/histogram.js", + "lib/internal/http.js", + "lib/internal/idna.js", + "lib/internal/worker.js", + "lib/internal/dtrace.js", + "lib/internal/stream_base_commons.js", + "lib/internal/bootstrap/environment.js", + "lib/internal/bootstrap/loaders.js", + "lib/internal/bootstrap/pre_execution.js", + "lib/internal/bootstrap/node.js", + "lib/internal/bootstrap/switches/does_not_own_process_state.js", + "lib/internal/bootstrap/switches/is_not_main_thread.js", + "lib/internal/bootstrap/switches/does_own_process_state.js", + "lib/internal/bootstrap/switches/is_main_thread.js", + "lib/internal/debugger/inspect_repl.js", + "lib/internal/debugger/inspect.js", + "lib/internal/debugger/inspect_client.js", + "lib/internal/cluster/shared_handle.js", + "lib/internal/cluster/child.js", + "lib/internal/cluster/primary.js", + "lib/internal/cluster/round_robin_handle.js", + "lib/internal/cluster/utils.js", + "lib/internal/cluster/worker.js", + "lib/internal/crypto/aes.js", + "lib/internal/crypto/certificate.js", + "lib/internal/crypto/cipher.js", + "lib/internal/crypto/diffiehellman.js", + "lib/internal/crypto/hash.js", + "lib/internal/crypto/hashnames.js", + "lib/internal/crypto/hkdf.js", + "lib/internal/crypto/keys.js", + "lib/internal/crypto/mac.js", + "lib/internal/crypto/pbkdf2.js", + "lib/internal/crypto/random.js", + "lib/internal/crypto/scrypt.js", + "lib/internal/crypto/sig.js", + "lib/internal/crypto/util.js", + "lib/internal/crypto/webcrypto.js", + "lib/internal/crypto/x509.js", + "lib/internal/crypto/dsa.js", + "lib/internal/crypto/ec.js", + "lib/internal/crypto/keygen.js", + "lib/internal/crypto/rsa.js", + "lib/internal/dns/promises.js", + "lib/internal/dns/utils.js", + "lib/internal/fs/dir.js", + "lib/internal/fs/read_file_context.js", + "lib/internal/fs/streams.js", + "lib/internal/fs/sync_write_stream.js", + "lib/internal/fs/utils.js", + "lib/internal/fs/watchers.js", + "lib/internal/fs/promises.js", + "lib/internal/fs/rimraf.js", + "lib/internal/fs/cp/cp-sync.js", + "lib/internal/fs/cp/cp.js", + "lib/internal/http2/compat.js", + "lib/internal/http2/util.js", + "lib/internal/http2/core.js", + "lib/internal/modules/package_json_reader.js", + "lib/internal/modules/run_main.js", + "lib/internal/modules/cjs/loader.js", + "lib/internal/modules/cjs/helpers.js", + "lib/internal/modules/esm/loader.js", + "lib/internal/modules/esm/transform_source.js", + "lib/internal/modules/esm/module_job.js", + "lib/internal/modules/esm/module_map.js", + "lib/internal/modules/esm/resolve.js", + "lib/internal/modules/esm/translators.js", + "lib/internal/modules/esm/get_format.js", + "lib/internal/modules/esm/create_dynamic_module.js", + "lib/internal/modules/esm/get_source.js", + "lib/internal/legacy/processbinding.js", + "lib/internal/process/policy.js", + "lib/internal/process/worker_thread_only.js", + "lib/internal/process/esm_loader.js", + "lib/internal/process/execution.js", + "lib/internal/process/per_thread.js", + "lib/internal/process/promises.js", + "lib/internal/process/report.js", + "lib/internal/process/signal.js", + "lib/internal/process/task_queues.js", + "lib/internal/process/warning.js", + "lib/internal/repl/history.js", + "lib/internal/repl/utils.js", + "lib/internal/repl/await.js", + "lib/internal/streams/legacy.js", + "lib/internal/streams/passthrough.js", + "lib/internal/streams/buffer_list.js", + "lib/internal/streams/from.js", + "lib/internal/streams/lazy_transform.js", + "lib/internal/streams/state.js", + "lib/internal/streams/transform.js", + "lib/internal/streams/add-abort-signal.js", + "lib/internal/streams/compose.js", + "lib/internal/streams/destroy.js", + "lib/internal/streams/duplex.js", + "lib/internal/streams/duplexify.js", + "lib/internal/streams/end-of-stream.js", + "lib/internal/streams/pipeline.js", + "lib/internal/streams/readable.js", + "lib/internal/streams/utils.js", + "lib/internal/streams/writable.js", + "lib/internal/test/binding.js", + "lib/internal/test/transfer.js", + "lib/internal/util/comparisons.js", + "lib/internal/util/debuglog.js", + "lib/internal/util/inspect.js", + "lib/internal/util/inspector.js", + "lib/internal/util/iterable_weak_map.js", + "lib/internal/util/types.js", + "lib/internal/main/check_syntax.js", + "lib/internal/main/eval_stdin.js", + "lib/internal/main/prof_process.js", + "lib/internal/main/run_main_module.js", + "lib/internal/main/print_help.js", + "lib/internal/main/repl.js", + "lib/internal/main/inspect.js", + "lib/internal/main/worker_thread.js", + "lib/internal/main/eval_string.js", + "lib/internal/tls/parse-cert-string.js", + "lib/internal/tls/secure-context.js", + "lib/internal/tls/secure-pair.js", + "lib/internal/vm/module.js", + "lib/internal/child_process/serialization.js", + "lib/internal/per_context/domexception.js", + "lib/internal/per_context/messageport.js", + "lib/internal/per_context/primordials.js", + "lib/internal/worker/io.js", + "lib/internal/worker/js_transferable.js", + "lib/internal/assert/calltracker.js", + "lib/internal/assert/assertion_error.js", + "lib/internal/perf/event_loop_delay.js", + "lib/internal/perf/event_loop_utilization.js", + "lib/internal/perf/nodetiming.js", + "lib/internal/perf/observe.js", + "lib/internal/perf/performance.js", + "lib/internal/perf/performance_entry.js", + "lib/internal/perf/timerify.js", + "lib/internal/perf/usertiming.js", + "lib/internal/perf/utils.js", + "lib/internal/webstreams/encoding.js", + "lib/internal/webstreams/queuingstrategies.js", + "lib/internal/webstreams/readablestream.js", + "lib/internal/webstreams/transfer.js", + "lib/internal/webstreams/transformstream.js", + "lib/internal/webstreams/util.js", + "lib/internal/webstreams/writablestream.js", + "lib/internal/source_map/source_map.js", + "lib/internal/source_map/source_map_cache.js", + "lib/internal/source_map/prepare_stack_trace.js", + "lib/internal/console/global.js", + "lib/internal/console/constructor.js", + "lib/internal/readline/utils.js", + "lib/internal/readline/callbacks.js", + "lib/internal/readline/emitKeypressEvents.js", + "lib/internal/policy/manifest.js", + "lib/internal/policy/sri.js", + "lib/fs/promises.js", + "lib/util/types.js", + "lib/path/posix.js", + "lib/path/win32.js", + "lib/timers/promises.js" + ], + "node_module_version": 93, + "node_no_browser_globals": "false", + "node_prefix": "/", + "node_release_urlbase": "https://nodejs.org/download/release/", + "node_section_ordering_info": "", + "node_shared": "false", + "node_shared_brotli": "false", + "node_shared_cares": "false", + "node_shared_http_parser": "false", + "node_shared_libuv": "false", + "node_shared_nghttp2": "false", + "node_shared_nghttp3": "false", + "node_shared_ngtcp2": "false", + "node_shared_openssl": "false", + "node_shared_zlib": "false", + "node_tag": "", + "node_target_type": "executable", + "node_use_bundled_v8": "true", + "node_use_dtrace": "false", + "node_use_etw": "false", + "node_use_node_code_cache": "true", + "node_use_node_snapshot": "true", + "node_use_openssl": "true", + "node_use_v8_platform": "true", + "node_with_ltcg": "false", + "node_without_node_options": "false", + "openssl_fips": "", + "openssl_is_fips": "false", + "openssl_quic": "true", + "ossfuzz": "false", + "shlib_suffix": "so.93", + "target_arch": "x64", + "v8_enable_31bit_smis_on_64bit_arch": 0, + "v8_enable_gdbjit": 0, + "v8_enable_i18n_support": 1, + "v8_enable_inspector": 1, + "v8_enable_lite_mode": 0, + "v8_enable_object_print": 1, + "v8_enable_pointer_compression": 0, + "v8_enable_webassembly": 1, + "v8_no_strict_aliasing": 1, + "v8_optimized_debug": 1, + "v8_promise_internal_field_count": 1, + "v8_random_seed": 0, + "v8_trace_maps": 0, + "v8_use_siphash": 1, + "want_separate_host_toolset": 0, + "nodedir": "/home/matias/.cache/node-gyp/16.9.1", + "standalone_static_library": 1, + "user_agent": "pnpm/6.21.0 npm/? node/v16.9.1 linux x64", + "registry": "https://registry.npmjs.org/", + "node_gyp": "/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" + } +} diff --git a/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk b/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk new file mode 100644 index 00000000000000..4a2de286352df8 --- /dev/null +++ b/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk @@ -0,0 +1,159 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := cpp_addon +DEFS_Debug := \ + '-DNODE_GYP_MODULE_NAME=cpp_addon' \ + '-DUSING_UV_SHARED=1' \ + '-DUSING_V8_SHARED=1' \ + '-DV8_DEPRECATION_WARNINGS=1' \ + '-DV8_DEPRECATION_WARNINGS' \ + '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ + '-D_GLIBCXX_USE_CXX11_ABI=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-D__STDC_FORMAT_MACROS' \ + '-DOPENSSL_NO_PINSHARED' \ + '-DOPENSSL_THREADS' \ + '-DBUILDING_NODE_EXTENSION' \ + '-DDEBUG' \ + '-D_DEBUG' \ + '-DV8_ENABLE_CHECKS' + +# Flags passed to all source files. +CFLAGS_Debug := \ + -fPIC \ + -pthread \ + -Wall \ + -Wextra \ + -Wno-unused-parameter \ + -m64 \ + -g \ + -O0 + +# Flags passed to only C files. +CFLAGS_C_Debug := + +# Flags passed to only C++ files. +CFLAGS_CC_Debug := \ + -fno-rtti \ + -fno-exceptions \ + -std=gnu++14 + +INCS_Debug := \ + -I/home/matias/.cache/node-gyp/16.9.1/include/node \ + -I/home/matias/.cache/node-gyp/16.9.1/src \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include + +DEFS_Release := \ + '-DNODE_GYP_MODULE_NAME=cpp_addon' \ + '-DUSING_UV_SHARED=1' \ + '-DUSING_V8_SHARED=1' \ + '-DV8_DEPRECATION_WARNINGS=1' \ + '-DV8_DEPRECATION_WARNINGS' \ + '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ + '-D_GLIBCXX_USE_CXX11_ABI=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-D__STDC_FORMAT_MACROS' \ + '-DOPENSSL_NO_PINSHARED' \ + '-DOPENSSL_THREADS' \ + '-DBUILDING_NODE_EXTENSION' + +# Flags passed to all source files. +CFLAGS_Release := \ + -fPIC \ + -pthread \ + -Wall \ + -Wextra \ + -Wno-unused-parameter \ + -m64 \ + -O3 \ + -fno-omit-frame-pointer + +# Flags passed to only C files. +CFLAGS_C_Release := + +# Flags passed to only C++ files. +CFLAGS_CC_Release := \ + -fno-rtti \ + -fno-exceptions \ + -std=gnu++14 + +INCS_Release := \ + -I/home/matias/.cache/node-gyp/16.9.1/include/node \ + -I/home/matias/.cache/node-gyp/16.9.1/src \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib \ + -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include + +OBJS := \ + $(obj).target/$(TARGET)/main.o + +# Add to the list of files we specially track dependencies for. +all_deps += $(OBJS) + +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual. +$(OBJS): TOOLSET := $(TOOLSET) +$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) +$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) + +# Suffix rules, putting all outputs into $(obj). + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# Try building from generated source, too. + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# End of this set of suffix rules +### Rules for final target. +LDFLAGS_Debug := \ + -pthread \ + -rdynamic \ + -m64 + +LDFLAGS_Release := \ + -pthread \ + -rdynamic \ + -m64 + +LIBS := + +$(obj).target/cpp_addon.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) +$(obj).target/cpp_addon.node: LIBS := $(LIBS) +$(obj).target/cpp_addon.node: TOOLSET := $(TOOLSET) +$(obj).target/cpp_addon.node: $(OBJS) FORCE_DO_CMD + $(call do_cmd,solink_module) + +all_deps += $(obj).target/cpp_addon.node +# Add target alias +.PHONY: cpp_addon +cpp_addon: $(builddir)/cpp_addon.node + +# Copy this to the executable output path. +$(builddir)/cpp_addon.node: TOOLSET := $(TOOLSET) +$(builddir)/cpp_addon.node: $(obj).target/cpp_addon.node FORCE_DO_CMD + $(call do_cmd,copy) + +all_deps += $(builddir)/cpp_addon.node +# Short alias for building this executable. +.PHONY: cpp_addon.node +cpp_addon.node: $(obj).target/cpp_addon.node $(builddir)/cpp_addon.node + +# Add executable to "all" target. +.PHONY: all +all: $(builddir)/cpp_addon.node + diff --git a/packages/plugin-vue-jsx/CHANGELOG.md b/packages/plugin-vue-jsx/CHANGELOG.md index 7bd6d06debcac6..6483054fc5e070 100644 --- a/packages/plugin-vue-jsx/CHANGELOG.md +++ b/packages/plugin-vue-jsx/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.3.2](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.3.1...plugin-vue-jsx@1.3.2) (2021-12-13) + + +### Bug Fixes + +* allow overwriting `define` options in vue & vue-jsx plugins ([#6072](https://github.com/vitejs/vite/issues/6072)) ([5f3f6b7](https://github.com/vitejs/vite/commit/5f3f6b7b406cb3371084057c74814eb36175e5cf)) + + + ## [1.3.1](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.3.0...plugin-vue-jsx@1.3.1) (2021-12-07) diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 9d0e73583c2e51..76bacceb6ec2d5 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue-jsx", - "version": "1.3.1", + "version": "1.3.2", "license": "MIT", "author": "Evan You", "files": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 572696f0c3bbd9..2af95d41ebc029 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -704,12 +704,6 @@ importers: '@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.16.0 hash-sum: 2.0.0 - packages/temp: - specifiers: - css-color-names: ^1.0.1 - devDependencies: - css-color-names: 1.0.1 - packages/vite: specifiers: '@ampproject/remapping': ^1.0.1 From 3e71100162afc564a31ac1e972b33fca4b75c8d6 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 13 Dec 2021 11:40:16 +0100 Subject: [PATCH 0065/1287] release: v2.7.2 --- packages/vite/CHANGELOG.md | 11 +++++++++++ packages/vite/package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 382ae98efe085d..d59ef2107df298 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,14 @@ +## [2.7.2](https://github.com/vitejs/vite/compare/v2.7.1...v2.7.2) (2021-12-13) + + +### Bug Fixes + +* **html:** empty script ([#6057](https://github.com/vitejs/vite/issues/6057)) ([1487223](https://github.com/vitejs/vite/commit/1487223f39b7555b1050b660d847eabf4d20249f)) +* **lexGlobPattern:** edge case of glob import ([#6022](https://github.com/vitejs/vite/issues/6022)) ([d4c5cff](https://github.com/vitejs/vite/commit/d4c5cff551ad9fb721243f8abdbf0c78f5b5a7ec)) +* ws types ([#6083](https://github.com/vitejs/vite/issues/6083)) ([1ded1a8](https://github.com/vitejs/vite/commit/1ded1a835bfb64f2c70c8c153e979b7911c9a8c1)) + + + ## [2.7.1](https://github.com/vitejs/vite/compare/v2.7.0...v2.7.1) (2021-12-07) diff --git a/packages/vite/package.json b/packages/vite/package.json index 56df1eedb6e609..0636dbd0bb8192 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.7.1", + "version": "2.7.2", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From 16b6a1ebe3f690699cf1e2f4010f902ab26eaa93 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 13 Dec 2021 11:42:02 +0100 Subject: [PATCH 0066/1287] release: plugin-react@1.1.2 --- packages/plugin-react/CHANGELOG.md | 9 +++++++++ packages/plugin-react/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/plugin-react/CHANGELOG.md b/packages/plugin-react/CHANGELOG.md index c3887f6943b521..f0310312556c39 100644 --- a/packages/plugin-react/CHANGELOG.md +++ b/packages/plugin-react/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.1.2](https://github.com/vitejs/vite/compare/plugin-react@1.1.1...plugin-react@1.1.2) (2021-12-13) + + +### Bug Fixes + +* ignore babel config when running restore-jsx ([#6047](https://github.com/vitejs/vite/issues/6047)) ([9c2843c](https://github.com/vitejs/vite/commit/9c2843cf0506844ee32f042a04c22c440434df2a)) + + + ## [1.1.1](https://github.com/vitejs/vite/compare/plugin-react@1.1.0...plugin-react@1.1.1) (2021-12-07) diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 5e60ed73b10833..360add3a0e6695 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-react", - "version": "1.1.1", + "version": "1.1.2", "license": "MIT", "author": "Evan You", "contributors": [ From ab06081e1d377fa01f4d5fcd417310c9ea961aee Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 13 Dec 2021 11:42:53 +0100 Subject: [PATCH 0067/1287] release: create-vite@2.7.2 --- packages/create-vite/CHANGELOG.md | 4 ++++ packages/create-vite/package.json | 2 +- packages/create-vite/template-lit-ts/package.json | 2 +- packages/create-vite/template-lit/package.json | 2 +- packages/create-vite/template-preact-ts/package.json | 2 +- packages/create-vite/template-preact/package.json | 2 +- packages/create-vite/template-react-ts/package.json | 2 +- packages/create-vite/template-react/package.json | 2 +- packages/create-vite/template-svelte-ts/package.json | 2 +- packages/create-vite/template-svelte/package.json | 2 +- packages/create-vite/template-vanilla-ts/package.json | 2 +- packages/create-vite/template-vanilla/package.json | 2 +- packages/create-vite/template-vue-ts/package.json | 2 +- packages/create-vite/template-vue/package.json | 2 +- 14 files changed, 17 insertions(+), 13 deletions(-) diff --git a/packages/create-vite/CHANGELOG.md b/packages/create-vite/CHANGELOG.md index 2fabb6b3699f0c..7769233043e03b 100644 --- a/packages/create-vite/CHANGELOG.md +++ b/packages/create-vite/CHANGELOG.md @@ -1,3 +1,7 @@ +## [2.7.2](https://github.com/vitejs/vite/compare/create-vite@2.7.1...create-vite@2.7.2) (2021-12-13) + + + ## [2.7.1](https://github.com/vitejs/vite/compare/create-vite@2.7.0...create-vite@2.7.1) (2021-12-12) diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json index 6c505735f90bcd..ab62f2b95229f7 100644 --- a/packages/create-vite/package.json +++ b/packages/create-vite/package.json @@ -1,6 +1,6 @@ { "name": "create-vite", - "version": "2.7.1", + "version": "2.7.2", "license": "MIT", "author": "Evan You", "bin": { diff --git a/packages/create-vite/template-lit-ts/package.json b/packages/create-vite/template-lit-ts/package.json index 6ee9ff7bb21359..d12d080cea1cb5 100644 --- a/packages/create-vite/template-lit-ts/package.json +++ b/packages/create-vite/template-lit-ts/package.json @@ -18,7 +18,7 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.7.1", + "vite": "^2.7.2", "typescript": "^4.4.4" } } diff --git a/packages/create-vite/template-lit/package.json b/packages/create-vite/template-lit/package.json index 7cc9fd8c5e2598..1081fd506aa25a 100644 --- a/packages/create-vite/template-lit/package.json +++ b/packages/create-vite/template-lit/package.json @@ -16,6 +16,6 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.7.1" + "vite": "^2.7.2" } } diff --git a/packages/create-vite/template-preact-ts/package.json b/packages/create-vite/template-preact-ts/package.json index db136f5be2181d..b567edbda3d67a 100644 --- a/packages/create-vite/template-preact-ts/package.json +++ b/packages/create-vite/template-preact-ts/package.json @@ -12,6 +12,6 @@ "devDependencies": { "@preact/preset-vite": "^2.1.5", "typescript": "^4.4.4", - "vite": "^2.7.1" + "vite": "^2.7.2" } } diff --git a/packages/create-vite/template-preact/package.json b/packages/create-vite/template-preact/package.json index 2dd16f7cd73171..dcfc501e7f2c24 100644 --- a/packages/create-vite/template-preact/package.json +++ b/packages/create-vite/template-preact/package.json @@ -11,6 +11,6 @@ }, "devDependencies": { "@preact/preset-vite": "^2.1.5", - "vite": "^2.7.1" + "vite": "^2.7.2" } } diff --git a/packages/create-vite/template-react-ts/package.json b/packages/create-vite/template-react-ts/package.json index 0800f4ef314907..a589326d901e6a 100644 --- a/packages/create-vite/template-react-ts/package.json +++ b/packages/create-vite/template-react-ts/package.json @@ -15,6 +15,6 @@ "@types/react-dom": "^17.0.10", "@vitejs/plugin-react": "^1.0.7", "typescript": "^4.4.4", - "vite": "^2.7.1" + "vite": "^2.7.2" } } diff --git a/packages/create-vite/template-react/package.json b/packages/create-vite/template-react/package.json index d461e794cbb2c5..e9a2984db1960a 100644 --- a/packages/create-vite/template-react/package.json +++ b/packages/create-vite/template-react/package.json @@ -12,6 +12,6 @@ }, "devDependencies": { "@vitejs/plugin-react": "^1.0.7", - "vite": "^2.7.1" + "vite": "^2.7.2" } } diff --git a/packages/create-vite/template-svelte-ts/package.json b/packages/create-vite/template-svelte-ts/package.json index 23b556b0e63858..61ef1e3187c1bd 100644 --- a/packages/create-vite/template-svelte-ts/package.json +++ b/packages/create-vite/template-svelte-ts/package.json @@ -16,6 +16,6 @@ "svelte-preprocess": "^4.9.8", "tslib": "^2.3.1", "typescript": "^4.4.4", - "vite": "^2.7.1" + "vite": "^2.7.2" } } diff --git a/packages/create-vite/template-svelte/package.json b/packages/create-vite/template-svelte/package.json index b13662d77c4fd0..4a4ac5796dae47 100644 --- a/packages/create-vite/template-svelte/package.json +++ b/packages/create-vite/template-svelte/package.json @@ -10,6 +10,6 @@ "devDependencies": { "@sveltejs/vite-plugin-svelte": "^1.0.0-next.30", "svelte": "^3.44.0", - "vite": "^2.7.1" + "vite": "^2.7.2" } } diff --git a/packages/create-vite/template-vanilla-ts/package.json b/packages/create-vite/template-vanilla-ts/package.json index 4f9c527b2861da..fa4fbf59746c84 100644 --- a/packages/create-vite/template-vanilla-ts/package.json +++ b/packages/create-vite/template-vanilla-ts/package.json @@ -8,6 +8,6 @@ }, "devDependencies": { "typescript": "^4.4.4", - "vite": "^2.7.1" + "vite": "^2.7.2" } } diff --git a/packages/create-vite/template-vanilla/package.json b/packages/create-vite/template-vanilla/package.json index 33f927b4d8ee81..e8dc2c73fc5388 100644 --- a/packages/create-vite/template-vanilla/package.json +++ b/packages/create-vite/template-vanilla/package.json @@ -7,6 +7,6 @@ "preview": "vite preview" }, "devDependencies": { - "vite": "^2.7.1" + "vite": "^2.7.2" } } diff --git a/packages/create-vite/template-vue-ts/package.json b/packages/create-vite/template-vue-ts/package.json index 8dfaf6aadc4712..74528fb2e15f4e 100644 --- a/packages/create-vite/template-vue-ts/package.json +++ b/packages/create-vite/template-vue-ts/package.json @@ -12,7 +12,7 @@ "devDependencies": { "@vitejs/plugin-vue": "^2.0.0", "typescript": "^4.4.4", - "vite": "^2.7.1", + "vite": "^2.7.2", "vue-tsc": "^0.29.8" } } diff --git a/packages/create-vite/template-vue/package.json b/packages/create-vite/template-vue/package.json index e28e07d17a0b94..6d2e335a7ac937 100644 --- a/packages/create-vite/template-vue/package.json +++ b/packages/create-vite/template-vue/package.json @@ -11,6 +11,6 @@ }, "devDependencies": { "@vitejs/plugin-vue": "^2.0.0", - "vite": "^2.7.1" + "vite": "^2.7.2" } } From 03734417cde10807ab2dd0d71b08c26081aac0b7 Mon Sep 17 00:00:00 2001 From: ygj6 <7699524+ygj6@users.noreply.github.com> Date: Mon, 13 Dec 2021 22:47:02 +0800 Subject: [PATCH 0068/1287] fix(ssr): robust regexp to check cjs content (#6053) --- .../ssr-deps/__tests__/ssr-deps.spec.ts | 21 +++++++++++++++++++ .../define-properties-exports/index.js | 8 +++++++ .../define-properties-exports/package.json | 5 +++++ .../ssr-deps/define-property-exports/index.js | 5 +++++ .../define-property-exports/package.json | 5 +++++ .../only-object-assigned-exports/index.js | 5 +++++ .../only-object-assigned-exports/package.json | 5 +++++ packages/playground/ssr-deps/package.json | 3 +++ packages/playground/ssr-deps/src/app.js | 12 +++++++++++ packages/playground/ssr-deps/vite.config.js | 8 ------- packages/vite/src/node/ssr/ssrExternal.ts | 5 ++++- pnpm-lock.yaml | 15 +++++++++++++ 12 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 packages/playground/ssr-deps/define-properties-exports/index.js create mode 100644 packages/playground/ssr-deps/define-properties-exports/package.json create mode 100644 packages/playground/ssr-deps/define-property-exports/index.js create mode 100644 packages/playground/ssr-deps/define-property-exports/package.json create mode 100644 packages/playground/ssr-deps/only-object-assigned-exports/index.js create mode 100644 packages/playground/ssr-deps/only-object-assigned-exports/package.json delete mode 100644 packages/playground/ssr-deps/vite.config.js diff --git a/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts b/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts index 4922310a8b0ca8..8a201c9eb87455 100644 --- a/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts +++ b/packages/playground/ssr-deps/__tests__/ssr-deps.spec.ts @@ -50,3 +50,24 @@ test('msg from forwarded exports', async () => { 'Hello World!' ) }) + +test('msg from define properties exports', async () => { + await page.goto(url) + expect(await page.textContent('.define-properties-exports-msg')).toMatch( + 'Hello World!' + ) +}) + +test('msg from define property exports', async () => { + await page.goto(url) + expect(await page.textContent('.define-property-exports-msg')).toMatch( + 'Hello World!' + ) +}) + +test('msg from only object assigned exports', async () => { + await page.goto(url) + expect(await page.textContent('.only-object-assigned-exports-msg')).toMatch( + 'Hello World!' + ) +}) diff --git a/packages/playground/ssr-deps/define-properties-exports/index.js b/packages/playground/ssr-deps/define-properties-exports/index.js new file mode 100644 index 00000000000000..5bdd02be906469 --- /dev/null +++ b/packages/playground/ssr-deps/define-properties-exports/index.js @@ -0,0 +1,8 @@ +// prettier-ignore +Object.defineProperties ( exports , { + hello: { + value() { + return 'Hello World!' + } + } +}) diff --git a/packages/playground/ssr-deps/define-properties-exports/package.json b/packages/playground/ssr-deps/define-properties-exports/package.json new file mode 100644 index 00000000000000..7555314741d981 --- /dev/null +++ b/packages/playground/ssr-deps/define-properties-exports/package.json @@ -0,0 +1,5 @@ +{ + "name": "define-properties-exports", + "version": "0.0.0", + "private": true +} diff --git a/packages/playground/ssr-deps/define-property-exports/index.js b/packages/playground/ssr-deps/define-property-exports/index.js new file mode 100644 index 00000000000000..4506dd6200051e --- /dev/null +++ b/packages/playground/ssr-deps/define-property-exports/index.js @@ -0,0 +1,5 @@ +Object.defineProperty(exports, 'hello', { + value() { + return 'Hello World!' + } +}) diff --git a/packages/playground/ssr-deps/define-property-exports/package.json b/packages/playground/ssr-deps/define-property-exports/package.json new file mode 100644 index 00000000000000..02373646db832e --- /dev/null +++ b/packages/playground/ssr-deps/define-property-exports/package.json @@ -0,0 +1,5 @@ +{ + "name": "define-property-exports", + "version": "0.0.0", + "private": true +} diff --git a/packages/playground/ssr-deps/only-object-assigned-exports/index.js b/packages/playground/ssr-deps/only-object-assigned-exports/index.js new file mode 100644 index 00000000000000..b6a4ab368b133d --- /dev/null +++ b/packages/playground/ssr-deps/only-object-assigned-exports/index.js @@ -0,0 +1,5 @@ +Object.assign(exports, { + hello() { + return 'Hello World!' + } +}) diff --git a/packages/playground/ssr-deps/only-object-assigned-exports/package.json b/packages/playground/ssr-deps/only-object-assigned-exports/package.json new file mode 100644 index 00000000000000..b74c5215385df3 --- /dev/null +++ b/packages/playground/ssr-deps/only-object-assigned-exports/package.json @@ -0,0 +1,5 @@ +{ + "name": "only-object-assigned-exports", + "version": "0.0.0", + "private": true +} diff --git a/packages/playground/ssr-deps/package.json b/packages/playground/ssr-deps/package.json index 4ba3c45031731b..a4dfb83e6a0783 100644 --- a/packages/playground/ssr-deps/package.json +++ b/packages/playground/ssr-deps/package.json @@ -10,8 +10,11 @@ }, "dependencies": { "bcrypt": "^5.0.1", + "define-properties-exports": "file:./define-properties-exports", + "define-property-exports": "file:./define-property-exports", "forwarded-export": "file:./forwarded-export", "object-assigned-exports": "file:./object-assigned-exports", + "only-object-assigned-exports": "file:./only-object-assigned-exports", "primitive-export": "file:./primitive-export", "read-file-content": "file:./read-file-content", "ts-transpiled-exports": "file:./ts-transpiled-exports" diff --git a/packages/playground/ssr-deps/src/app.js b/packages/playground/ssr-deps/src/app.js index bbe6ec7f396219..da8883c6a9452b 100644 --- a/packages/playground/ssr-deps/src/app.js +++ b/packages/playground/ssr-deps/src/app.js @@ -5,6 +5,9 @@ import tsDefaultExport, { hello as tsNamedExport } from 'ts-transpiled-exports' import objectAssignedExports from 'object-assigned-exports' import forwardedExport from 'forwarded-export' import bcrypt from 'bcrypt' +import definePropertiesExports from 'define-properties-exports' +import definePropertyExports from 'define-property-exports' +import onlyObjectAssignedExports from 'only-object-assigned-exports' export async function render(url, rootDir) { let html = '' @@ -29,5 +32,14 @@ export async function render(url, rootDir) { const forwardedExportMessage = forwardedExport.hello() html += `\n

message from forwarded-export: ${forwardedExportMessage}

` + const definePropertiesExportsMsg = definePropertiesExports.hello() + html += `\n

message from define-properties-exports: ${definePropertiesExportsMsg}

` + + const definePropertyExportsMsg = definePropertyExports.hello() + html += `\n

message from define-property-exports: ${definePropertyExportsMsg}

` + + const onlyObjectAssignedExportsMessage = onlyObjectAssignedExports.hello() + html += `\n

message from only-object-assigned-exports: ${onlyObjectAssignedExportsMessage}

` + return html + '\n' } diff --git a/packages/playground/ssr-deps/vite.config.js b/packages/playground/ssr-deps/vite.config.js deleted file mode 100644 index 96a2eb87f4cb2d..00000000000000 --- a/packages/playground/ssr-deps/vite.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @type {import('vite').UserConfig} - */ -module.exports = { - ssr: { - external: ['object-assigned-exports'] - } -} diff --git a/packages/vite/src/node/ssr/ssrExternal.ts b/packages/vite/src/node/ssr/ssrExternal.ts index 3549d5653dfc95..07cfaa9c238bcf 100644 --- a/packages/vite/src/node/ssr/ssrExternal.ts +++ b/packages/vite/src/node/ssr/ssrExternal.ts @@ -64,6 +64,9 @@ export function resolveSSRExternal( return externals } +const CJS_CONTENT_RE = + /\bmodule\.exports\b|\bexports[.\[]|\brequire\s*\(|\bObject\.(defineProperty|defineProperties|assign)\s*\(\s*exports\b/ + // do we need to do this ahead of time or could we do it lazily? function collectExternals( root: string, @@ -157,7 +160,7 @@ function collectExternals( } // check if the entry is cjs const content = fs.readFileSync(esmEntry, 'utf-8') - if (/\bmodule\.exports\b|\bexports[.\[]|\brequire\s*\(/.test(content)) { + if (CJS_CONTENT_RE.test(content)) { ssrExternals.add(id) continue } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2af95d41ebc029..6c16ab43a73020 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -458,16 +458,22 @@ importers: specifiers: bcrypt: ^5.0.1 cross-env: ^7.0.3 + define-properties-exports: file:./define-properties-exports + define-property-exports: file:./define-property-exports express: ^4.17.1 forwarded-export: file:./forwarded-export object-assigned-exports: file:./object-assigned-exports + only-object-assigned-exports: file:./only-object-assigned-exports primitive-export: file:./primitive-export read-file-content: file:./read-file-content ts-transpiled-exports: file:./ts-transpiled-exports dependencies: bcrypt: 5.0.1 + define-properties-exports: link:define-properties-exports + define-property-exports: link:define-property-exports forwarded-export: link:forwarded-export object-assigned-exports: link:object-assigned-exports + only-object-assigned-exports: link:only-object-assigned-exports primitive-export: link:primitive-export read-file-content: link:read-file-content ts-transpiled-exports: link:ts-transpiled-exports @@ -475,12 +481,21 @@ importers: cross-env: 7.0.3 express: 4.17.1 + packages/playground/ssr-deps/define-properties-exports: + specifiers: {} + + packages/playground/ssr-deps/define-property-exports: + specifiers: {} + packages/playground/ssr-deps/forwarded-export: specifiers: {} packages/playground/ssr-deps/object-assigned-exports: specifiers: {} + packages/playground/ssr-deps/only-object-assigned-exports: + specifiers: {} + packages/playground/ssr-deps/primitive-export: specifiers: {} From 8735294055ce16308a6b8302eba4538f4a2931d0 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 14 Dec 2021 02:02:50 +0800 Subject: [PATCH 0069/1287] fix(plugin-react): only detect preamble in hmr context (#6096) --- packages/plugin-react/src/fast-refresh.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/plugin-react/src/fast-refresh.ts b/packages/plugin-react/src/fast-refresh.ts index 76d163e4d665e2..70562bbbdfc5b7 100644 --- a/packages/plugin-react/src/fast-refresh.ts +++ b/packages/plugin-react/src/fast-refresh.ts @@ -35,14 +35,14 @@ import RefreshRuntime from "${runtimePublicPath}"; let prevRefreshReg; let prevRefreshSig; -if (!window.__vite_plugin_react_preamble_installed__) { - throw new Error( - "@vitejs/plugin-react can't detect preamble. Something is wrong. " + - "See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201" - ); -} - if (import.meta.hot) { + if (!window.__vite_plugin_react_preamble_installed__) { + throw new Error( + "@vitejs/plugin-react can't detect preamble. Something is wrong. " + + "See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201" + ); + } + prevRefreshReg = window.$RefreshReg$; prevRefreshSig = window.$RefreshSig$; window.$RefreshReg$ = (type, id) => { From 6cdf13ae808a99b7aca6d278bee2ebe6e51d0846 Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Tue, 14 Dec 2021 02:04:02 +0630 Subject: [PATCH 0070/1287] fix: do not overwrite rollupOptions.input in dev (#6025) --- packages/vite/src/node/__tests__/dev.spec.ts | 18 +++++++++++++++++ packages/vite/src/node/build.ts | 21 ++++++++++---------- packages/vite/src/node/config.ts | 6 +++++- 3 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 packages/vite/src/node/__tests__/dev.spec.ts diff --git a/packages/vite/src/node/__tests__/dev.spec.ts b/packages/vite/src/node/__tests__/dev.spec.ts new file mode 100644 index 00000000000000..3eefd7b4b903c1 --- /dev/null +++ b/packages/vite/src/node/__tests__/dev.spec.ts @@ -0,0 +1,18 @@ +import { resolveConfig } from '..' + +describe('resolveBuildOptions in dev', () => { + test('build.rollupOptions should not have input in lib', async () => { + const config = await resolveConfig( + { + build: { + lib: { + entry: './index.js' + } + } + }, + 'serve' + ) + + expect(config.build.rollupOptions).not.toHaveProperty('input') + }) +}) diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index cef74c7ac57f88..8761edf65c66b3 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -236,7 +236,8 @@ export type ResolvedBuildOptions = Required< export function resolveBuildOptions( root: string, - raw?: BuildOptions + raw?: BuildOptions, + isBuild?: boolean ): ResolvedBuildOptions { const resolved: ResolvedBuildOptions = { target: 'modules', @@ -291,14 +292,12 @@ export function resolveBuildOptions( ]) ) : resolve(raw.rollupOptions.input) - } else { - input = resolve( - raw?.lib - ? raw.lib.entry - : typeof raw?.ssr === 'string' - ? raw.ssr - : 'index.html' - ) + } else if (raw?.lib && isBuild) { + input = resolve(raw.lib.entry) + } else if (typeof raw?.ssr === 'string') { + input = resolve(raw.ssr) + } else if (isBuild) { + input = resolve('index.html') } if (!!raw?.ssr && typeof input === 'string' && input.endsWith('.html')) { @@ -308,7 +307,9 @@ export function resolveBuildOptions( ) } - resolved.rollupOptions.input = input + if (input) { + resolved.rollupOptions.input = input + } // handle special build targets if (resolved.target === 'modules') { diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 8ae523c4e7715e..59c5d90ce108d2 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -367,7 +367,11 @@ export async function resolveConfig( // resolve public base url const BASE_URL = resolveBaseUrl(config.base, command === 'build', logger) - const resolvedBuildOptions = resolveBuildOptions(resolvedRoot, config.build) + const resolvedBuildOptions = resolveBuildOptions( + resolvedRoot, + config.build, + command === 'build' + ) // resolve cache directory const pkgPath = lookupFile( From 4bdf5d70b52e4d7dd6436efd30e1046250d3bbfe Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 13 Dec 2021 22:06:09 +0100 Subject: [PATCH 0071/1287] release: plugin-react@1.1.3 --- packages/plugin-react/CHANGELOG.md | 9 +++++++++ packages/plugin-react/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/plugin-react/CHANGELOG.md b/packages/plugin-react/CHANGELOG.md index f0310312556c39..cf0df9a2d33b17 100644 --- a/packages/plugin-react/CHANGELOG.md +++ b/packages/plugin-react/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.1.3](https://github.com/vitejs/vite/compare/plugin-react@1.1.2...plugin-react@1.1.3) (2021-12-13) + + +### Bug Fixes + +* **plugin-react:** only detect preamble in hmr context ([#6096](https://github.com/vitejs/vite/issues/6096)) ([8735294](https://github.com/vitejs/vite/commit/8735294055ce16308a6b8302eba4538f4a2931d0)) + + + ## [1.1.2](https://github.com/vitejs/vite/compare/plugin-react@1.1.1...plugin-react@1.1.2) (2021-12-13) diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 360add3a0e6695..44e44fdc1ed234 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-react", - "version": "1.1.2", + "version": "1.1.3", "license": "MIT", "author": "Evan You", "contributors": [ From 5ec49befad4d7b5e7cc14f14520ba96d5b6f6d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=87=AF?= <46395105+sufuWang@users.noreply.github.com> Date: Tue, 14 Dec 2021 16:34:20 +0800 Subject: [PATCH 0072/1287] fix(plugin-vue): error.length is zero (#6106) --- packages/plugin-vue/src/utils/descriptorCache.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-vue/src/utils/descriptorCache.ts b/packages/plugin-vue/src/utils/descriptorCache.ts index ab6d777388c6d4..990f679d0ac08b 100644 --- a/packages/plugin-vue/src/utils/descriptorCache.ts +++ b/packages/plugin-vue/src/utils/descriptorCache.ts @@ -58,7 +58,7 @@ export function getDescriptor( fs.readFileSync(filename, 'utf-8'), options ) - if (errors) { + if (errors.length) { throw errors[0] } return descriptor From a02403869dc6dd9173bb0d9ea028e3372cfa22cc Mon Sep 17 00:00:00 2001 From: patak-dev Date: Tue, 14 Dec 2021 13:53:08 +0100 Subject: [PATCH 0073/1287] release: plugin-vue@2.0.1 --- packages/plugin-vue/CHANGELOG.md | 9 +++++++++ packages/plugin-vue/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue/CHANGELOG.md b/packages/plugin-vue/CHANGELOG.md index 1fdb317038839d..ed5f600a645818 100644 --- a/packages/plugin-vue/CHANGELOG.md +++ b/packages/plugin-vue/CHANGELOG.md @@ -1,3 +1,12 @@ +## [2.0.1](https://github.com/vitejs/vite/compare/plugin-vue@2.0.0...plugin-vue@2.0.1) (2021-12-14) + + +### Bug Fixes + +* **plugin-vue:** error.length is zero ([#6106](https://github.com/vitejs/vite/issues/6106)) ([5ec49be](https://github.com/vitejs/vite/commit/5ec49befad4d7b5e7cc14f14520ba96d5b6f6d69)) + + + # [2.0.0](https://github.com/vitejs/vite/compare/plugin-vue@1.10.2...plugin-vue@2.0.0) (2021-12-12) diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 0a07360c48fb5c..a779030008adef 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue", - "version": "2.0.0", + "version": "2.0.1", "license": "MIT", "author": "Evan You", "files": [ From 3ceffcca66311f9a7d71612a596b84888c3f843b Mon Sep 17 00:00:00 2001 From: CHOYSEN Date: Wed, 15 Dec 2021 00:04:45 +0800 Subject: [PATCH 0074/1287] fix: respect new port when change the config file (#6075) --- packages/vite/src/node/server/hmr.ts | 6 +++++- packages/vite/src/node/server/index.ts | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/vite/src/node/server/hmr.ts b/packages/vite/src/node/server/hmr.ts index aff8e3d096c44b..4c8f26a4a57a16 100644 --- a/packages/vite/src/node/server/hmr.ts +++ b/packages/vite/src/node/server/hmr.ts @@ -61,7 +61,11 @@ export async function handleHMRUpdate( ), { clear: true, timestamp: true } ) - await server.restart() + try { + await server.restart() + } catch (e) { + config.logger.error(chalk.red(e)) + } return } diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index b17180c81d5e64..f5a2f4ca35e9c2 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -720,7 +720,7 @@ export function resolveServerOptions( async function restartServer(server: ViteDevServer) { // @ts-ignore global.__vite_start_time = performance.now() - const { port } = server.config.server + const { port: prevPort, host: prevHost } = server.config.server await server.close() @@ -740,9 +740,19 @@ async function restartServer(server: ViteDevServer) { server[key] = newServer[key] } } - if (!server.config.server.middlewareMode) { + + const { + logger, + server: { port, host, middlewareMode } + } = server.config + if (!middlewareMode) { await server.listen(port, true) + logger.info('server restarted.', { timestamp: true }) + if (port !== prevPort || host !== prevHost) { + logger.info('\n') + server.printUrls() + } } else { - server.config.logger.info('server restarted.', { timestamp: true }) + logger.info('server restarted.', { timestamp: true }) } } From cab55b32de62e0de7d7789e8c2a1f04a8eae3a3f Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 15 Dec 2021 13:55:50 +0800 Subject: [PATCH 0075/1287] chore: remove deprecated create-app package --- packages/create-app/README.md | 5 ---- packages/create-app/index.js | 43 -------------------------------- packages/create-app/package.json | 33 ------------------------ 3 files changed, 81 deletions(-) delete mode 100644 packages/create-app/README.md delete mode 100755 packages/create-app/index.js delete mode 100644 packages/create-app/package.json diff --git a/packages/create-app/README.md b/packages/create-app/README.md deleted file mode 100644 index edb1dbc6f7ab5b..00000000000000 --- a/packages/create-app/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# @vitejs/create-app - -## DEPRECATED - -Use `npm init vite` instead diff --git a/packages/create-app/index.js b/packages/create-app/index.js deleted file mode 100755 index 602fcdba3d5ab9..00000000000000 --- a/packages/create-app/index.js +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env node -/* eslint-disable node/shebang */ - -const { yellow, green } = require('kolorist') - -const alternativeCommands = { - yarn: 'yarn create vite', - pnpm: 'pnpm create vite', - npm: 'npm init vite', - unknown: 'npm init vite' -} - -function getPackageManager() { - if (!process.env.npm_execpath) { - return 'unknown' - } - - if (process.env.npm_execpath.indexOf('yarn') !== -1) { - return 'yarn' - } - if (process.env.npm_execpath.indexOf('pnpm') !== -1) { - return 'pnpm' - } - if (process.env.npm_execpath.indexOf('npm') !== -1) { - return 'npm' - } - - return 'unknown' -} - -const packageManager = getPackageManager() - -const alternativeCommand = alternativeCommands[packageManager] - -console.warn( - yellow( - `\n@vitejs/create-app is deprecated, use ${green( - alternativeCommand - )} instead\n` - ) -) - -require('create-vite') diff --git a/packages/create-app/package.json b/packages/create-app/package.json deleted file mode 100644 index bd66205c22dcc3..00000000000000 --- a/packages/create-app/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "@vitejs/create-app", - "version": "2.5.2", - "license": "MIT", - "author": "Evan You", - "files": [ - "index.js" - ], - "bin": { - "create-app": "index.js", - "cva": "index.js" - }, - "main": "index.js", - "scripts": { - "release": "node ../../scripts/release.cjs --skipBuild" - }, - "engines": { - "node": ">=12.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/vitejs/vite.git", - "directory": "packages/create-app" - }, - "bugs": { - "url": "https://github.com/vitejs/vite/issues" - }, - "homepage": "https://github.com/vitejs/vite/tree/main/packages/create-app#readme", - "dependencies": { - "create-vite": "latest", - "kolorist": "^1.5.0" - } -} From 611fa037a72a1179c27794353ffad6ed27e10d1a Mon Sep 17 00:00:00 2001 From: Sam Richard Date: Wed, 15 Dec 2021 06:04:16 -0500 Subject: [PATCH 0076/1287] fix: Improve post-build asset update check (#6113) --- packages/playground/html/emptyAttr.html | 12 +++++++ packages/playground/html/link.html | 12 +++++++ packages/playground/html/vite.config.js | 3 ++ packages/vite/src/node/plugins/html.ts | 47 +++++++++++++++---------- 4 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 packages/playground/html/emptyAttr.html create mode 100644 packages/playground/html/link.html diff --git a/packages/playground/html/emptyAttr.html b/packages/playground/html/emptyAttr.html new file mode 100644 index 00000000000000..30c647017690dd --- /dev/null +++ b/packages/playground/html/emptyAttr.html @@ -0,0 +1,12 @@ + + + + + + + Empty Attr + + + + + diff --git a/packages/playground/html/link.html b/packages/playground/html/link.html new file mode 100644 index 00000000000000..1ec95eedeab182 --- /dev/null +++ b/packages/playground/html/link.html @@ -0,0 +1,12 @@ + + + + + + + Link to rollup config + + + A Link to a Rollup Import + + diff --git a/packages/playground/html/vite.config.js b/packages/playground/html/vite.config.js index 09fb2fd337e7ee..1703e02cc05366 100644 --- a/packages/playground/html/vite.config.js +++ b/packages/playground/html/vite.config.js @@ -11,6 +11,9 @@ module.exports = { nested: resolve(__dirname, 'nested/index.html'), scriptAsync: resolve(__dirname, 'scriptAsync.html'), scriptMixed: resolve(__dirname, 'scriptMixed.html'), + emptyAttr: resolve(__dirname, 'emptyAttr.html'), + link: resolve(__dirname, 'link.html'), + 'link/target': resolve(__dirname, 'index.html'), zeroJS: resolve(__dirname, 'zeroJS.html'), noHead: resolve(__dirname, 'noHead.html'), noBody: resolve(__dirname, 'noBody.html'), diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index 119ec49d5afdc0..1ddc494fdb64c0 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -299,27 +299,36 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin { } // for each encountered asset url, rewrite original html so that it - // references the post-build location. + // references the post-build location, ignoring empty attributes and + // attributes that directly reference named output. + const namedOutput = Object.keys( + config?.build?.rollupOptions?.input || {} + ) for (const attr of assetUrls) { const value = attr.value! - try { - const url = - attr.name === 'srcset' - ? await processSrcSet(value.content, ({ url }) => - urlToBuiltUrl(url, id, config, this) - ) - : await urlToBuiltUrl(value.content, id, config, this) - - s.overwrite( - value.loc.start.offset, - value.loc.end.offset, - `"${url}"` - ) - } catch (e) { - // #1885 preload may be pointing to urls that do not exist - // locally on disk - if (e.code !== 'ENOENT') { - throw e + const content = value.content + if ( + content !== '' && // Empty attribute + !namedOutput.includes(content) && // Direct reference to named output + !namedOutput.includes(content.replace(/^\//, '')) // Allow for absolute references as named output can't be an absolute path + ) { + try { + const url = + attr.name === 'srcset' + ? await processSrcSet(content, ({ url }) => + urlToBuiltUrl(url, id, config, this) + ) + : await urlToBuiltUrl(content, id, config, this) + + s.overwrite( + value.loc.start.offset, + value.loc.end.offset, + `"${url}"` + ) + } catch (e) { + if (e.code !== 'ENOENT') { + throw e + } } } } From dd79858ab70d2591e1239ddb19e1ce38d9913b4c Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Wed, 15 Dec 2021 05:10:00 -0600 Subject: [PATCH 0077/1287] refactor: simplify filter callback (#6119) --- packages/vite/src/node/build.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index 8761edf65c66b3..a0be3015059871 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -357,7 +357,7 @@ export function resolveBuildPlugins(config: ResolvedConfig): { dynamicImportVars(options.dynamicImportVarsOptions), assetImportMetaUrlPlugin(config), ...(options.rollupOptions.plugins - ? (options.rollupOptions.plugins.filter((p) => !!p) as Plugin[]) + ? (options.rollupOptions.plugins.filter(Boolean) as Plugin[]) : []) ], post: [ From 717cb08f8611fd1a15cfd614d346185ffe8a61fd Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Wed, 15 Dec 2021 11:55:54 -0800 Subject: [PATCH 0078/1287] fix: improve warning message for malformed packages (#6086) --- packages/vite/src/node/ssr/ssrExternal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/ssr/ssrExternal.ts b/packages/vite/src/node/ssr/ssrExternal.ts index 07cfaa9c238bcf..b6d98aad5f1565 100644 --- a/packages/vite/src/node/ssr/ssrExternal.ts +++ b/packages/vite/src/node/ssr/ssrExternal.ts @@ -166,7 +166,7 @@ function collectExternals( } logger.warn( - `${id} is incorrectly packaged. Please contact the package author to fix.` + `${id} doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.` ) } } From b9871bbed57c5964b3393e798b0ef2526471d692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Wouts?= Date: Thu, 16 Dec 2021 16:52:39 +1100 Subject: [PATCH 0079/1287] fix: terminate WebSocket connections before closing WebSocket server (#6115) --- packages/vite/src/node/server/ws.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/vite/src/node/server/ws.ts b/packages/vite/src/node/server/ws.ts index 8e0bbe7058bcb8..598216df700296 100644 --- a/packages/vite/src/node/server/ws.ts +++ b/packages/vite/src/node/server/ws.ts @@ -114,6 +114,9 @@ export function createWebSocketServer( close() { return new Promise((resolve, reject) => { + wss.clients.forEach((client) => { + client.terminate() + }) wss.close((err) => { if (err) { reject(err) From 0be532acd474d9ccfc0593fd0f956e04a1c029ea Mon Sep 17 00:00:00 2001 From: ygj6 <7699524+ygj6@users.noreply.github.com> Date: Thu, 16 Dec 2021 20:23:12 +0800 Subject: [PATCH 0080/1287] test: correct the confusing test case (#6139) --- packages/playground/worker/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/playground/worker/index.html b/packages/playground/worker/index.html index 1ce429eece42cc..20888835122fac 100644 --- a/packages/playground/worker/index.html +++ b/packages/playground/worker/index.html @@ -59,12 +59,12 @@ sharedWorker.port.start() const tsOutputWorker = new TSOutputWorker() - worker.addEventListener('message', (e) => { + tsOutputWorker.addEventListener('message', (e) => { text('.pong-ts-output', e.data.msg) }) document.querySelector('.ping-ts-output').addEventListener('click', () => { - inlineWorker.postMessage('ping') + tsOutputWorker.postMessage('ping') }) function text(el, text) { From e002f4f4a578ae63156e756abac0487f42b4cdcd Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Thu, 16 Dec 2021 20:25:55 +0800 Subject: [PATCH 0081/1287] fix: pending reload never timeout (#6120) --- .../src/node/server/middlewares/transform.ts | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/packages/vite/src/node/server/middlewares/transform.ts b/packages/vite/src/node/server/middlewares/transform.ts index a68308f391e363..df7f21223a19b9 100644 --- a/packages/vite/src/node/server/middlewares/transform.ts +++ b/packages/vite/src/node/server/middlewares/transform.ts @@ -74,23 +74,29 @@ export function transformMiddleware( !req.url?.startsWith(CLIENT_PUBLIC_PATH) && !req.url?.includes('vite/dist/client') ) { - // missing dep pending reload, hold request until reload happens - server._pendingReload.then(() => - // If the refresh has not happened after timeout, Vite considers - // something unexpected has happened. In this case, Vite - // returns an empty response that will error. - setTimeout(() => { - // Don't do anything if response has already been sent - if (res.writableEnded) return + try { + // missing dep pending reload, hold request until reload happens + await Promise.race([ + server._pendingReload, + // If the refresh has not happened after timeout, Vite considers + // something unexpected has happened. In this case, Vite + // returns an empty response that will error. + new Promise((_, reject) => + setTimeout(reject, NEW_DEPENDENCY_BUILD_TIMEOUT) + ) + ]) + } catch { + // Don't do anything if response has already been sent + if (!res.writableEnded) { // status code request timeout res.statusCode = 408 res.end( `

[vite] Something unexpected happened while optimizing "${req.url}"

` + `

The current page should have reloaded by now

` ) - }, NEW_DEPENDENCY_BUILD_TIMEOUT) - ) - return + } + return + } } let url = decodeURI(removeTimestampQuery(req.url!)).replace( From a08b4c574b32294d925357962d201e314e0f1062 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Thu, 16 Dec 2021 13:44:21 +0100 Subject: [PATCH 0082/1287] release: v2.7.3 --- packages/vite/CHANGELOG.md | 15 +++++++++++++++ packages/vite/package.json | 2 +- pnpm-lock.yaml | 8 -------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index d59ef2107df298..9c7e56dee8f847 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,18 @@ +## [2.7.3](https://github.com/vitejs/vite/compare/v2.7.2...v2.7.3) (2021-12-16) + + +### Bug Fixes + +* do not overwrite rollupOptions.input in dev ([#6025](https://github.com/vitejs/vite/issues/6025)) ([6cdf13a](https://github.com/vitejs/vite/commit/6cdf13ae808a99b7aca6d278bee2ebe6e51d0846)) +* Improve post-build asset update check ([#6113](https://github.com/vitejs/vite/issues/6113)) ([611fa03](https://github.com/vitejs/vite/commit/611fa037a72a1179c27794353ffad6ed27e10d1a)) +* improve warning message for malformed packages ([#6086](https://github.com/vitejs/vite/issues/6086)) ([717cb08](https://github.com/vitejs/vite/commit/717cb08f8611fd1a15cfd614d346185ffe8a61fd)) +* pending reload never timeout ([#6120](https://github.com/vitejs/vite/issues/6120)) ([e002f4f](https://github.com/vitejs/vite/commit/e002f4f4a578ae63156e756abac0487f42b4cdcd)) +* respect new port when change the config file ([#6075](https://github.com/vitejs/vite/issues/6075)) ([3ceffcc](https://github.com/vitejs/vite/commit/3ceffcca66311f9a7d71612a596b84888c3f843b)) +* **ssr:** robust regexp to check cjs content ([#6053](https://github.com/vitejs/vite/issues/6053)) ([0373441](https://github.com/vitejs/vite/commit/03734417cde10807ab2dd0d71b08c26081aac0b7)) +* terminate WebSocket connections before closing WebSocket server ([#6115](https://github.com/vitejs/vite/issues/6115)) ([b9871bb](https://github.com/vitejs/vite/commit/b9871bbed57c5964b3393e798b0ef2526471d692)) + + + ## [2.7.2](https://github.com/vitejs/vite/compare/v2.7.1...v2.7.2) (2021-12-13) diff --git a/packages/vite/package.json b/packages/vite/package.json index 0636dbd0bb8192..ed947b04f3a576 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.7.2", + "version": "2.7.3", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6c16ab43a73020..fb2e71bfdf4b9b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -78,14 +78,6 @@ importers: vitepress: 0.20.1 yorkie: 2.0.0 - packages/create-app: - specifiers: - create-vite: latest - kolorist: ^1.5.0 - dependencies: - create-vite: link:../create-vite - kolorist: 1.5.0 - packages/create-vite: specifiers: kolorist: ^1.5.0 From 5f39c28908ad5441def57cfb2afe341a96c676cb Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 16 Dec 2021 18:52:18 +0000 Subject: [PATCH 0083/1287] refactor: rename `mergeConfig` parameters (#6144) --- packages/vite/src/node/config.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 59c5d90ce108d2..f7f1c3128e0663 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -666,13 +666,13 @@ function resolveBaseUrl( } function mergeConfigRecursively( - a: Record, - b: Record, + defaults: Record, + overrides: Record, rootPath: string ) { - const merged: Record = { ...a } - for (const key in b) { - const value = b[key] + const merged: Record = { ...defaults } + for (const key in overrides) { + const value = overrides[key] if (value == null) { continue } @@ -710,11 +710,11 @@ function mergeConfigRecursively( } export function mergeConfig( - a: Record, - b: Record, + defaults: Record, + overrides: Record, isRoot = true ): Record { - return mergeConfigRecursively(a, b, isRoot ? '' : '.') + return mergeConfigRecursively(defaults, overrides, isRoot ? '' : '.') } function mergeAlias(a: AliasOptions = [], b: AliasOptions = []): Alias[] { From ce65c567a64fad3be4209cbd1132e62e905fe349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20Ayg=C3=BCn?= Date: Thu, 16 Dec 2021 22:20:39 +0300 Subject: [PATCH 0084/1287] fix(plugin-react): restore-jsx bug when component name is lowercase (#6110) --- .../plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts | 6 ++++++ packages/plugin-react/src/jsx-runtime/babel-restore-jsx.ts | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts b/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts index 60e330e4003b03..59d6661bedd11b 100644 --- a/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts +++ b/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts @@ -108,4 +108,10 @@ describe('babel-restore-jsx', () => { ) ).toMatchInlineSnapshot(`"

{foo ?

: null}

;"`) }) + + it('should handle lowercase component names', () => { + expect(jsx('React.createElement(aaa)')).toMatchInlineSnapshot( + `"React.createElement(aaa);"` + ) + }) }) diff --git a/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.ts b/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.ts index 0ac0a1f831c79a..da08f5327a4eae 100644 --- a/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.ts +++ b/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.ts @@ -76,7 +76,7 @@ export default function ({ types: t }: typeof babel): babel.PluginObj { return null } - const name = getJSXIdentifier(node) + const name = getJSXIdentifier(node, true) if (name != null) { return name } @@ -152,9 +152,9 @@ export default function ({ types: t }: typeof babel): babel.PluginObj { return children } - function getJSXIdentifier(node: any) { + function getJSXIdentifier(node: any, tag = false) { //TODO: JSXNamespacedName - if (t.isIdentifier(node)) { + if (t.isIdentifier(node) && (!tag || node.name.match(/^[A-Z]/))) { return t.jsxIdentifier(node.name) } if (t.isStringLiteral(node)) { From 9c8fb04f936c80971138da81c5757c353cb7396e Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Fri, 17 Dec 2021 04:45:30 +0630 Subject: [PATCH 0085/1287] chore: remove node addon dir (#6107) --- .../ssr-deps/node-addon/build/Makefile | 324 ---------------- .../Release/.deps/Release/cpp_addon.node.d | 1 - .../.deps/Release/obj.target/cpp_addon.node.d | 1 - .../Release/obj.target/cpp_addon/main.o.d | 23 -- .../node-addon/build/Release/cpp_addon.node | Bin 13288 -> 0 bytes .../build/Release/obj.target/cpp_addon.node | Bin 13288 -> 0 bytes .../build/Release/obj.target/cpp_addon/main.o | Bin 4368 -> 0 bytes .../node-addon/build/binding.Makefile | 6 - .../ssr-deps/node-addon/build/config.gypi | 351 ------------------ .../node-addon/build/cpp_addon.target.mk | 159 -------- 10 files changed, 865 deletions(-) delete mode 100644 packages/playground/ssr-deps/node-addon/build/Makefile delete mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d delete mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d delete mode 100644 packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d delete mode 100755 packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node delete mode 100755 packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node delete mode 100644 packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o delete mode 100644 packages/playground/ssr-deps/node-addon/build/binding.Makefile delete mode 100644 packages/playground/ssr-deps/node-addon/build/config.gypi delete mode 100644 packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk diff --git a/packages/playground/ssr-deps/node-addon/build/Makefile b/packages/playground/ssr-deps/node-addon/build/Makefile deleted file mode 100644 index 83ce3f09d28c03..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/Makefile +++ /dev/null @@ -1,324 +0,0 @@ -# We borrow heavily from the kernel build setup, though we are simpler since -# we don't have Kconfig tweaking settings on us. - -# The implicit make rules have it looking for RCS files, among other things. -# We instead explicitly write all the rules we care about. -# It's even quicker (saves ~200ms) to pass -r on the command line. -MAKEFLAGS=-r - -# The source directory tree. -srcdir := .. -abs_srcdir := $(abspath $(srcdir)) - -# The name of the builddir. -builddir_name ?= . - -# The V=1 flag on command line makes us verbosely print command lines. -ifdef V - quiet= -else - quiet=quiet_ -endif - -# Specify BUILDTYPE=Release on the command line for a release build. -BUILDTYPE ?= Release - -# Directory all our build output goes into. -# Note that this must be two directories beneath src/ for unit tests to pass, -# as they reach into the src/ directory for data with relative paths. -builddir ?= $(builddir_name)/$(BUILDTYPE) -abs_builddir := $(abspath $(builddir)) -depsdir := $(builddir)/.deps - -# Object output directory. -obj := $(builddir)/obj -abs_obj := $(abspath $(obj)) - -# We build up a list of every single one of the targets so we can slurp in the -# generated dependency rule Makefiles in one pass. -all_deps := - - - -CC.target ?= $(CC) -CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS) -CXX.target ?= $(CXX) -CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS) -LINK.target ?= $(LINK) -LDFLAGS.target ?= $(LDFLAGS) -AR.target ?= $(AR) - -# C++ apps need to be linked with g++. -LINK ?= $(CXX.target) - -# TODO(evan): move all cross-compilation logic to gyp-time so we don't need -# to replicate this environment fallback in make as well. -CC.host ?= gcc -CFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host) -CXX.host ?= g++ -CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host) -LINK.host ?= $(CXX.host) -LDFLAGS.host ?= $(LDFLAGS_host) -AR.host ?= ar - -# Define a dir function that can handle spaces. -# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions -# "leading spaces cannot appear in the text of the first argument as written. -# These characters can be put into the argument value by variable substitution." -empty := -space := $(empty) $(empty) - -# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces -replace_spaces = $(subst $(space),?,$1) -unreplace_spaces = $(subst ?,$(space),$1) -dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1))) - -# Flags to make gcc output dependency info. Note that you need to be -# careful here to use the flags that ccache and distcc can understand. -# We write to a dep file on the side first and then rename at the end -# so we can't end up with a broken dep file. -depfile = $(depsdir)/$(call replace_spaces,$@).d -DEPFLAGS = -MMD -MF $(depfile).raw - -# We have to fixup the deps output in a few ways. -# (1) the file output should mention the proper .o file. -# ccache or distcc lose the path to the target, so we convert a rule of -# the form: -# foobar.o: DEP1 DEP2 -# into -# path/to/foobar.o: DEP1 DEP2 -# (2) we want missing files not to cause us to fail to build. -# We want to rewrite -# foobar.o: DEP1 DEP2 \ -# DEP3 -# to -# DEP1: -# DEP2: -# DEP3: -# so if the files are missing, they're just considered phony rules. -# We have to do some pretty insane escaping to get those backslashes -# and dollar signs past make, the shell, and sed at the same time. -# Doesn't work with spaces, but that's fine: .d files have spaces in -# their names replaced with other characters. -define fixup_dep -# The depfile may not exist if the input file didn't have any #includes. -touch $(depfile).raw -# Fixup path as in (1). -sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile) -# Add extra rules as in (2). -# We remove slashes and replace spaces with new lines; -# remove blank lines; -# delete the first line and append a colon to the remaining lines. -sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ - grep -v '^$$' |\ - sed -e 1d -e 's|$$|:|' \ - >> $(depfile) -rm $(depfile).raw -endef - -# Command definitions: -# - cmd_foo is the actual command to run; -# - quiet_cmd_foo is the brief-output summary of the command. - -quiet_cmd_cc = CC($(TOOLSET)) $@ -cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c - -quiet_cmd_cxx = CXX($(TOOLSET)) $@ -cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c - -quiet_cmd_touch = TOUCH $@ -cmd_touch = touch $@ - -quiet_cmd_copy = COPY $@ -# send stderr to /dev/null to ignore messages when linking directories. -cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@") - -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) - -# Due to circular dependencies between libraries :(, we wrap the -# special "figure out circular dependencies" flags around the entire -# input list during linking. -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group - -# We support two kinds of shared objects (.so): -# 1) shared_library, which is just bundling together many dependent libraries -# into a link line. -# 2) loadable_module, which is generating a module intended for dlopen(). -# -# They differ only slightly: -# In the former case, we want to package all dependent code into the .so. -# In the latter case, we want to package just the API exposed by the -# outermost module. -# This means shared_library uses --whole-archive, while loadable_module doesn't. -# (Note that --whole-archive is incompatible with the --start-group used in -# normal linking.) - -# Other shared-object link notes: -# - Set SONAME to the library filename so our binaries don't reference -# the local, absolute paths used on the link command-line. -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) - - -# Define an escape_quotes function to escape single quotes. -# This allows us to handle quotes properly as long as we always use -# use single quotes and escape_quotes. -escape_quotes = $(subst ','\'',$(1)) -# This comment is here just to include a ' to unconfuse syntax highlighting. -# Define an escape_vars function to escape '$' variable syntax. -# This allows us to read/write command lines with shell variables (e.g. -# $LD_LIBRARY_PATH), without triggering make substitution. -escape_vars = $(subst $$,$$$$,$(1)) -# Helper that expands to a shell command to echo a string exactly as it is in -# make. This uses printf instead of echo because printf's behaviour with respect -# to escape sequences is more portable than echo's across different shells -# (e.g., dash, bash). -exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' - -# Helper to compare the command we're about to run against the command -# we logged the last time we ran the command. Produces an empty -# string (false) when the commands match. -# Tricky point: Make has no string-equality test function. -# The kernel uses the following, but it seems like it would have false -# positives, where one string reordered its arguments. -# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ -# $(filter-out $(cmd_$@), $(cmd_$(1)))) -# We instead substitute each for the empty string into the other, and -# say they're equal if both substitutions produce the empty string. -# .d files contain ? instead of spaces, take that into account. -command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ - $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) - -# Helper that is non-empty when a prerequisite changes. -# Normally make does this implicitly, but we force rules to always run -# so we can check their command lines. -# $? -- new prerequisites -# $| -- order-only dependencies -prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) - -# Helper that executes all postbuilds until one fails. -define do_postbuilds - @E=0;\ - for p in $(POSTBUILDS); do\ - eval $$p;\ - E=$$?;\ - if [ $$E -ne 0 ]; then\ - break;\ - fi;\ - done;\ - if [ $$E -ne 0 ]; then\ - rm -rf "$@";\ - exit $$E;\ - fi -endef - -# do_cmd: run a command via the above cmd_foo names, if necessary. -# Should always run for a given target to handle command-line changes. -# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. -# Third argument, if non-zero, makes it do POSTBUILDS processing. -# Note: We intentionally do NOT call dirx for depfile, since it contains ? for -# spaces already and dirx strips the ? characters. -define do_cmd -$(if $(or $(command_changed),$(prereq_changed)), - @$(call exact_echo, $($(quiet)cmd_$(1))) - @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" - $(if $(findstring flock,$(word 1,$(cmd_$1))), - @$(cmd_$(1)) - @echo " $(quiet_cmd_$(1)): Finished", - @$(cmd_$(1)) - ) - @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) - @$(if $(2),$(fixup_dep)) - $(if $(and $(3), $(POSTBUILDS)), - $(call do_postbuilds) - ) -) -endef - -# Declare the "all" target first so it is the default, -# even though we don't have the deps yet. -.PHONY: all -all: - -# make looks for ways to re-generate included makefiles, but in our case, we -# don't have a direct way. Explicitly telling make that it has nothing to do -# for them makes it go faster. -%.d: ; - -# Use FORCE_DO_CMD to force a target to run. Should be coupled with -# do_cmd. -.PHONY: FORCE_DO_CMD -FORCE_DO_CMD: - -TOOLSET := target -# Suffix rules, putting all outputs into $(obj). -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) - -# Try building from generated source, too. -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) - -$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) - - -ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ - $(findstring $(join ^,$(prefix)),\ - $(join ^,cpp_addon.target.mk)))),) - include cpp_addon.target.mk -endif - -quiet_cmd_regen_makefile = ACTION Regenerating $@ -cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/matias/.cache/node-gyp/16.9.1" "-Dnode_gyp_dir=/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp" "-Dnode_lib_file=/home/matias/.cache/node-gyp/16.9.1/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/matias/vite/packages/playground/ssr-deps/node-addon" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/matias/vite/packages/playground/ssr-deps/node-addon/build/config.gypi -I/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi -I/home/matias/.cache/node-gyp/16.9.1/include/node/common.gypi "--toplevel-dir=." binding.gyp -Makefile: $(srcdir)/../../../../../.cache/node-gyp/16.9.1/include/node/common.gypi $(srcdir)/../../../../../../../usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi $(srcdir)/binding.gyp $(srcdir)/build/config.gypi - $(call do_cmd,regen_makefile) - -# "all" is a concatenation of the "all" targets from all the included -# sub-makefiles. This is just here to clarify. -all: - -# Add in dependency-tracking rules. $(all_deps) is the list of every single -# target in our tree. Only consider the ones with .d (dependency) info: -d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) -ifneq ($(d_files),) - include $(d_files) -endif diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d deleted file mode 100644 index 4be797e6cbdf6e..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/cpp_addon.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/cpp_addon.node := ln -f "Release/obj.target/cpp_addon.node" "Release/cpp_addon.node" 2>/dev/null || (rm -rf "Release/cpp_addon.node" && cp -af "Release/obj.target/cpp_addon.node" "Release/cpp_addon.node") diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d deleted file mode 100644 index 9f4d87550d1f0a..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/obj.target/cpp_addon.node := g++ -o Release/obj.target/cpp_addon.node -shared -pthread -rdynamic -m64 -Wl,-soname=cpp_addon.node -Wl,--start-group Release/obj.target/cpp_addon/main.o -Wl,--end-group diff --git a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d b/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d deleted file mode 100644 index 2955b089117c85..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/Release/.deps/Release/obj.target/cpp_addon/main.o.d +++ /dev/null @@ -1,23 +0,0 @@ -cmd_Release/obj.target/cpp_addon/main.o := g++ -o Release/obj.target/cpp_addon/main.o ../main.cpp '-DNODE_GYP_MODULE_NAME=cpp_addon' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/home/matias/.cache/node-gyp/16.9.1/include/node -I/home/matias/.cache/node-gyp/16.9.1/src -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++14 -MMD -MF ./Release/.deps/Release/obj.target/cpp_addon/main.o.d.raw -c -Release/obj.target/cpp_addon/main.o: ../main.cpp \ - /home/matias/.cache/node-gyp/16.9.1/include/node/node.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/cppgc/common.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8-internal.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8-version.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8-platform.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/node_version.h \ - /home/matias/.cache/node-gyp/16.9.1/include/node/v8.h -../main.cpp: -/home/matias/.cache/node-gyp/16.9.1/include/node/node.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/cppgc/common.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8-internal.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8-version.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8config.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8-platform.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/node_version.h: -/home/matias/.cache/node-gyp/16.9.1/include/node/v8.h: diff --git a/packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node b/packages/playground/ssr-deps/node-addon/build/Release/cpp_addon.node deleted file mode 100755 index 67c3f500cb518bfb96782ef1aeab0acc72d09ef3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13288 zcmeHOeQX@X6`%7tiAn6(I3Y0!kOhSjC@en5Un!*c?3}X>7suqBkN{z`zFXTz?rx8} zy!*EDS5Iew5p2KN>Pg{Xe(hFl)Chfy0n#2+Jb?i-W4QFQPT7)?t8QI z_V)JfT0m;0N;lE@&HK%JZ{EC}o!yyzc_RkV9%!^6qKru#z&@74Z}D=@0+o2hrZpCRUQp6Q7WL|`u-facka&gY zyci16I!lbz0>$5)Xm``iLXIfPVi|hNj9@*vnzJRe-GUiW(z^}x(9aKAnuOq9(O;#w zG>Lc+6~p0UTMIV4@Y^}KkG=B1HDk4V)=zzP=VNDk*M0lz=B_6)*afyX!;j+s=&a;n zwY}4bT>`%r`1J;U{m%J!Q{VmJn_qlj@ztR>&fI(8vgc;rTmAMg-xW~+Ay>H!c*%t! z+X@}g*qqI;!8pp{YbwaE1IN)vcbTXl|6~RGAkHMW5#Wa_*hyBf^JUN}=l@?S$p5B- z{53GHa&~+b>~w=234ZRf7l5nWAn^U%{yMfGNky&i1J}&zS!;s@*TeX+9OUxrSvALB(P>^*TZ(ujOXOgOp#f^lTHno(gs!WY0q9#*E zfiQJoc()qSQ~FpmZR)Av-F-15p$}^#G2Ln_-=c;mG&G>aqW6Q~9llmYkHw7JjZ`eM z_twF-qup(-{h37Aj2ekPEfyQm!bb)YqsG8sNbT6K#WH#z5CA=t>>nN&(om|Pk4d_F}>L}Gds6zlwv~7K)A~ zG&7UJ$VLJ1Z39ozW-1dlja08bt{sgUDb)70hoTWZFggmc;DH>%uDA7(n{-`#C64=i zFicwvlnSx!qG8*YwVMRHLb^Gq#dU}0pen9<;bMrZvlXO^B^{;*Lq0xOdkTd*U^??z zP;|L=`0UGwv!e^A)viq197qou<~U3?Y{vT`d_)b8A5llOXpAL{h_1$sNG7JMH0xO` zIue%ChTO?iJ))T!sEwr4)~y6kBErJSq^d#$LA%LMF;L&&(AyX zi%A&hv%(+jbBzOU5%>zgoL50|;3AYPnTvu+3Od_U=N;Mg}6#eu_x zwabtLcP{Y<9JqLe17R{AwP~f`GqAYS8qVxgZw<_n~}%R=Vv*;5_t@H z{v_vXkjGHxpXB`C)&h?q&Y$4?pOMGV=BGISC*(1t`6TDxKpv-5{xIiXK^{Y!AL9JW z$YV(JJ)D0Dc?@N~mGeJF9z&RyINt{R=n3F?*{95Gp94h6zI7=7JP3@+jhl}1rp8S> z7=z|KG=tc(*HLWSd5|{y{pPt@h^ zzW^{ykxP{6CS@A@9%{j;z}YnBWj*$+@5_Z>9&@GNv=f@iM=vwzHe zmK%6o$-WZIo(pD|at8r8K5GWRom>OTPY32A%2vzWOouX~pSjb2m;aFeZog{BHcz~ltb!$5OLVca;OXMsKo6w6wRFwgyanP;NOv$1|f-3bW6X25ap z(E_#>P-b;g|LT@qjjQgfn_{cezl^B{*e9~IQU3x0FZH-D$~uWovz z=C+3A{$t+pmC#9G)qeQPt_PXps02RocV#Zu*RWjqy!Wx%nPs0_9z3?9W)3wJyjjtw zXW)lpnz}0@VmqBT$V%H3HQLR3lK0Ks5r@2vj5R-;DsBx6=74 zou}ey0v0^W#X@IpcMG1*?C5(Aoz>BIoJ%b=`+Rq!;OQ)MgW%~r7x%|lXfJ&B!jggf zqHu)HEFY~!)cWR&v{f96(wXBi;UAqfwxAFc0W&5^oTszYZegF!6X>jSJ(ptaggE3R zJSiL`KP910XQ9*|91C#&dxRjIJ#k)$vqizzi}t??-gyQqT=<_7`fl#-^qdIrauL{d zf__ZUPC@$x-7n~NzpQH(EVG_Q*B6^!O*Fjah)76$isKwvUr*A zy4?P17N7;iVaUrG?R*Lc4ECGYx5~<2Y_BiH^39Cam12AiS$oQ+=0 zfG9H`y=)yTH&4B6eaUxqwCCkn6i&<5x20P4-cm8jAoBQ~rw~v2Msx+>9_aT;;ZKiH zybfqNI~{aHUf5Z1UH4iTxTnl~*Z{c1 zZ599N1e~6A&XzkW;3$KCeTC!B9VPvpGd1(W`czc$luUSJtB8?ZtE^D#ItHtEtS$HAv?fKO|sDx z>6+|)*ZnkkEp zQ!Qbbx;&Q1$Rn9(EOJ9M!Z zGEeH0p(>9Vz+w&>lli?TrwpFDBi>NhSe|*D_oiN`NKlEpT#{PJPvuGeE`wT0w)5?e^HTvI|q9{(x?3b(H>eGJ9rcPm~(>n;!2VMHKFC$9hB{Rem z{ftYW_HRUE6j)(^`XzfaE`2)pAxh^VB<~*omxMme6WR|Fy_OUOrTItn387DJy7Ted zUHb0+pLXff{*vggT>2C@g1-k9+>+A#qC7^*(|5;<^oc$Xy12C=eS05;8$Bo_XK@9d z@Si~g&OOqneJ%YzhE69|^ z*?&oo=eAeEsI#UkE$*;b81S4EbA`wsT7U5VAm1$w>u>TJi#|*jPBdbF&VuIx<@C>f O+>(0FDGYVD{=Wc8x$V*b diff --git a/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node b/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon.node deleted file mode 100755 index 67c3f500cb518bfb96782ef1aeab0acc72d09ef3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13288 zcmeHOeQX@X6`%7tiAn6(I3Y0!kOhSjC@en5Un!*c?3}X>7suqBkN{z`zFXTz?rx8} zy!*EDS5Iew5p2KN>Pg{Xe(hFl)Chfy0n#2+Jb?i-W4QFQPT7)?t8QI z_V)JfT0m;0N;lE@&HK%JZ{EC}o!yyzc_RkV9%!^6qKru#z&@74Z}D=@0+o2hrZpCRUQp6Q7WL|`u-facka&gY zyci16I!lbz0>$5)Xm``iLXIfPVi|hNj9@*vnzJRe-GUiW(z^}x(9aKAnuOq9(O;#w zG>Lc+6~p0UTMIV4@Y^}KkG=B1HDk4V)=zzP=VNDk*M0lz=B_6)*afyX!;j+s=&a;n zwY}4bT>`%r`1J;U{m%J!Q{VmJn_qlj@ztR>&fI(8vgc;rTmAMg-xW~+Ay>H!c*%t! z+X@}g*qqI;!8pp{YbwaE1IN)vcbTXl|6~RGAkHMW5#Wa_*hyBf^JUN}=l@?S$p5B- z{53GHa&~+b>~w=234ZRf7l5nWAn^U%{yMfGNky&i1J}&zS!;s@*TeX+9OUxrSvALB(P>^*TZ(ujOXOgOp#f^lTHno(gs!WY0q9#*E zfiQJoc()qSQ~FpmZR)Av-F-15p$}^#G2Ln_-=c;mG&G>aqW6Q~9llmYkHw7JjZ`eM z_twF-qup(-{h37Aj2ekPEfyQm!bb)YqsG8sNbT6K#WH#z5CA=t>>nN&(om|Pk4d_F}>L}Gds6zlwv~7K)A~ zG&7UJ$VLJ1Z39ozW-1dlja08bt{sgUDb)70hoTWZFggmc;DH>%uDA7(n{-`#C64=i zFicwvlnSx!qG8*YwVMRHLb^Gq#dU}0pen9<;bMrZvlXO^B^{;*Lq0xOdkTd*U^??z zP;|L=`0UGwv!e^A)viq197qou<~U3?Y{vT`d_)b8A5llOXpAL{h_1$sNG7JMH0xO` zIue%ChTO?iJ))T!sEwr4)~y6kBErJSq^d#$LA%LMF;L&&(AyX zi%A&hv%(+jbBzOU5%>zgoL50|;3AYPnTvu+3Od_U=N;Mg}6#eu_x zwabtLcP{Y<9JqLe17R{AwP~f`GqAYS8qVxgZw<_n~}%R=Vv*;5_t@H z{v_vXkjGHxpXB`C)&h?q&Y$4?pOMGV=BGISC*(1t`6TDxKpv-5{xIiXK^{Y!AL9JW z$YV(JJ)D0Dc?@N~mGeJF9z&RyINt{R=n3F?*{95Gp94h6zI7=7JP3@+jhl}1rp8S> z7=z|KG=tc(*HLWSd5|{y{pPt@h^ zzW^{ykxP{6CS@A@9%{j;z}YnBWj*$+@5_Z>9&@GNv=f@iM=vwzHe zmK%6o$-WZIo(pD|at8r8K5GWRom>OTPY32A%2vzWOouX~pSjb2m;aFeZog{BHcz~ltb!$5OLVca;OXMsKo6w6wRFwgyanP;NOv$1|f-3bW6X25ap z(E_#>P-b;g|LT@qjjQgfn_{cezl^B{*e9~IQU3x0FZH-D$~uWovz z=C+3A{$t+pmC#9G)qeQPt_PXps02RocV#Zu*RWjqy!Wx%nPs0_9z3?9W)3wJyjjtw zXW)lpnz}0@VmqBT$V%H3HQLR3lK0Ks5r@2vj5R-;DsBx6=74 zou}ey0v0^W#X@IpcMG1*?C5(Aoz>BIoJ%b=`+Rq!;OQ)MgW%~r7x%|lXfJ&B!jggf zqHu)HEFY~!)cWR&v{f96(wXBi;UAqfwxAFc0W&5^oTszYZegF!6X>jSJ(ptaggE3R zJSiL`KP910XQ9*|91C#&dxRjIJ#k)$vqizzi}t??-gyQqT=<_7`fl#-^qdIrauL{d zf__ZUPC@$x-7n~NzpQH(EVG_Q*B6^!O*Fjah)76$isKwvUr*A zy4?P17N7;iVaUrG?R*Lc4ECGYx5~<2Y_BiH^39Cam12AiS$oQ+=0 zfG9H`y=)yTH&4B6eaUxqwCCkn6i&<5x20P4-cm8jAoBQ~rw~v2Msx+>9_aT;;ZKiH zybfqNI~{aHUf5Z1UH4iTxTnl~*Z{c1 zZ599N1e~6A&XzkW;3$KCeTC!B9VPvpGd1(W`czc$luUSJtB8?ZtE^D#ItHtEtS$HAv?fKO|sDx z>6+|)*ZnkkEp zQ!Qbbx;&Q1$Rn9(EOJ9M!Z zGEeH0p(>9Vz+w&>lli?TrwpFDBi>NhSe|*D_oiN`NKlEpT#{PJPvuGeE`wT0w)5?e^HTvI|q9{(x?3b(H>eGJ9rcPm~(>n;!2VMHKFC$9hB{Rem z{ftYW_HRUE6j)(^`XzfaE`2)pAxh^VB<~*omxMme6WR|Fy_OUOrTItn387DJy7Ted zUHb0+pLXff{*vggT>2C@g1-k9+>+A#qC7^*(|5;<^oc$Xy12C=eS05;8$Bo_XK@9d z@Si~g&OOqneJ%YzhE69|^ z*?&oo=eAeEsI#UkE$*;b81S4EbA`wsT7U5VAm1$w>u>TJi#|*jPBdbF&VuIx<@C>f O+>(0FDGYVD{=Wc8x$V*b diff --git a/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o b/packages/playground/ssr-deps/node-addon/build/Release/obj.target/cpp_addon/main.o deleted file mode 100644 index 088f7174574579a7049a29fc9c0372a4205fa7b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4368 zcmbtWU2GIp6u#|3sr*(Dh#E|YFUCZYdd{7DwztDWwQ)Ai94$qx=8p zbAPnzwKaNeru8?R)h{e~TlHF-UW@7e$TofMTI;EatDD;6ESLtkHqs_dO>JsFkA~pi zznwUq7*C8PM$_}9%bAqF1l~JydTrINPIT>Si|PV*llJfG{#D(-9ys-X7S8zs&ocE} zXg4%HaqX`vOc~J9)yhMPk6=nSF@{M1e3Ktn8<>|0{>m{x7=! zJ-A8xOB^`A;Aya&fM3%Vb9zs(+-jdbZ{0kVcqK8Bcr{^Q5#9#Jf#*B5OWfklr}g}U z@fU$3t5|e8jyrBK_Y}+HfGNt}l3B2oY`M&!8D=i$*yxW0_U8cVP{xVh36%N?Nq-=9 zD4BerqjPMsYJ1g=ex*<8+S60zBlS&nKbdTg8wk~oPP-XqPNC^u2-=?m!cT4$R~uc82q9n2A-lM##Tqc;HBk0d@Uf& z63%l0>`7=%3}*w0lLCE=MQ0e3_!1rX8{}bKkFkw)os{Rea{v1G3OveFj7gV>aMTO^ zW~rWh?*S`9YZDx~d#3^Zbp!kdz|sF{=u!BYf&Lz}DF54G8c4REsozN0zX&xr=O z-vD21fZu9>FEzm1;AlqW#p>6G;aX=370+^w<%`5PneI1APOe(Cn37I*;h)NklWLca z*AKsnjvXHEo*wA#8m!t`ui)58vsj!ov*%Lwl#?3H7=7brv1)0W#*Cr#k%Nh}ab$2X zqm3G)iGyj)0B>l&FXOod`;4j%TdxhePHD`W8qh|-ygyZOil%32BZspvRC|CBa7Sm$ zmR1n<-Qxpl_o$P0vSv{$mAzSQ8fJP^cELmUeS89!v+u~{Su5-D_3+3PKWY3GVoChL@~q`GoNB6QtB|FVOmV|&(&AX{cq! z_z$JjfF@GP^corr69y)?KT|kkn_kt$dKUmt_rppmo?Fd&j(gC`o6`lyMQgP;Q^;A` z)D+Z$7jgtc?@!V)VYhg7)cY2$s*q-#21d)Z?WeSHv$^>I5&JWiH*A(HY2{!lc71s> z#P0L}dnHqHJ)BW_vh{7!G$V!K{a>)VK@qaTmep=!lTRfZie4~Gq>jfw|n)yU@0 z8B=DV$ZRKPi4$LcAn@Lx8yp@leoNlNuN{!5aS{aQH$x*lfglLtTc8pC9)cixazS_U+n4T4#PMy1Yem7@q99J+G&t_WKM>+$43rN3AFK!0M4}4? zF>I&Bct-Sy$?IWCWwzv*lhAu^(C0~Wt)i*mwZoL0>6uKKtW=odIygYOs;Dp|5+J7Q zRm%b@z)fkGu4~Q;fLj5ZDOsmff=iJpw&PjK(D2wE{?G`Xl{cnbc(TQU|7X_$_E@_W zIm0*(4W)>alFUUFoVs;5bw8I$T`n?Po z-Xr1s{}%Cy4-_smral8`RQy)_msD2T2%ZF z5nmU4jE^M=$FBf}@u^Ora*5-E41)KyETSy+eS8BZ36pteg}scS9_D^1urR$WfJ-3< zw0?pwf)bT~J|chIXR@dI<9foexo_GK(c?L!J;Zsk$H$bYh}T6N=v|@7aQ^5wMBy$j Oi}in8cNi#P`+otuZNl#W diff --git a/packages/playground/ssr-deps/node-addon/build/binding.Makefile b/packages/playground/ssr-deps/node-addon/build/binding.Makefile deleted file mode 100644 index 9521a57df40291..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/binding.Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# This file is generated by gyp; do not edit. - -export builddir_name ?= ./build/. -.PHONY: all -all: - $(MAKE) cpp_addon diff --git a/packages/playground/ssr-deps/node-addon/build/config.gypi b/packages/playground/ssr-deps/node-addon/build/config.gypi deleted file mode 100644 index 815e24a35e5c83..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/config.gypi +++ /dev/null @@ -1,351 +0,0 @@ -# Do not edit. File was generated by node-gyp's "configure" step -{ - "target_defaults": { - "cflags": [], - "default_configuration": "Release", - "defines": [], - "include_dirs": [], - "libraries": [] - }, - "variables": { - "asan": 0, - "coverage": "false", - "dcheck_always_on": 0, - "debug_nghttp2": "false", - "debug_node": "false", - "enable_lto": "false", - "enable_pgo_generate": "false", - "enable_pgo_use": "false", - "error_on_warn": "false", - "force_dynamic_crt": 0, - "gas_version": "2.30", - "host_arch": "x64", - "icu_data_in": "../../deps/icu-tmp/icudt69l.dat", - "icu_endianness": "l", - "icu_gyp_path": "tools/icu/icu-generic.gyp", - "icu_path": "deps/icu-small", - "icu_small": "false", - "icu_ver_major": "69", - "is_debug": 0, - "llvm_version": "0.0", - "napi_build_version": "8", - "node_byteorder": "little", - "node_debug_lib": "false", - "node_enable_d8": "false", - "node_install_npm": "true", - "node_library_files": [ - "lib/diagnostics_channel.js", - "lib/path.js", - "lib/punycode.js", - "lib/tty.js", - "lib/_stream_wrap.js", - "lib/querystring.js", - "lib/_tls_common.js", - "lib/_tls_wrap.js", - "lib/assert.js", - "lib/async_hooks.js", - "lib/child_process.js", - "lib/cluster.js", - "lib/dns.js", - "lib/util.js", - "lib/vm.js", - "lib/worker_threads.js", - "lib/url.js", - "lib/buffer.js", - "lib/wasi.js", - "lib/process.js", - "lib/console.js", - "lib/constants.js", - "lib/events.js", - "lib/fs.js", - "lib/_stream_duplex.js", - "lib/module.js", - "lib/domain.js", - "lib/zlib.js", - "lib/_http_client.js", - "lib/_http_server.js", - "lib/_stream_writable.js", - "lib/http.js", - "lib/https.js", - "lib/inspector.js", - "lib/trace_events.js", - "lib/_http_incoming.js", - "lib/http2.js", - "lib/os.js", - "lib/string_decoder.js", - "lib/_stream_passthrough.js", - "lib/_stream_readable.js", - "lib/_stream_transform.js", - "lib/crypto.js", - "lib/timers.js", - "lib/repl.js", - "lib/_http_agent.js", - "lib/_http_common.js", - "lib/_http_outgoing.js", - "lib/net.js", - "lib/perf_hooks.js", - "lib/readline.js", - "lib/v8.js", - "lib/sys.js", - "lib/tls.js", - "lib/stream.js", - "lib/dgram.js", - "lib/dns/promises.js", - "lib/stream/consumers.js", - "lib/stream/promises.js", - "lib/stream/web.js", - "lib/assert/strict.js", - "lib/internal/async_hooks.js", - "lib/internal/heap_utils.js", - "lib/internal/blob.js", - "lib/internal/freeze_intrinsics.js", - "lib/internal/inspector_async_hook.js", - "lib/internal/linkedlist.js", - "lib/internal/js_stream_socket.js", - "lib/internal/url.js", - "lib/internal/socketaddress.js", - "lib/internal/util.js", - "lib/internal/options.js", - "lib/internal/repl.js", - "lib/internal/child_process.js", - "lib/internal/errors.js", - "lib/internal/event_target.js", - "lib/internal/v8_prof_polyfill.js", - "lib/internal/v8_prof_processor.js", - "lib/internal/validators.js", - "lib/internal/buffer.js", - "lib/internal/encoding.js", - "lib/internal/watchdog.js", - "lib/internal/trace_events_async_hooks.js", - "lib/internal/constants.js", - "lib/internal/abort_controller.js", - "lib/internal/blocklist.js", - "lib/internal/querystring.js", - "lib/internal/net.js", - "lib/internal/cli_table.js", - "lib/internal/fixed_queue.js", - "lib/internal/priority_queue.js", - "lib/internal/tty.js", - "lib/internal/assert.js", - "lib/internal/timers.js", - "lib/internal/socket_list.js", - "lib/internal/error_serdes.js", - "lib/internal/freelist.js", - "lib/internal/dgram.js", - "lib/internal/histogram.js", - "lib/internal/http.js", - "lib/internal/idna.js", - "lib/internal/worker.js", - "lib/internal/dtrace.js", - "lib/internal/stream_base_commons.js", - "lib/internal/bootstrap/environment.js", - "lib/internal/bootstrap/loaders.js", - "lib/internal/bootstrap/pre_execution.js", - "lib/internal/bootstrap/node.js", - "lib/internal/bootstrap/switches/does_not_own_process_state.js", - "lib/internal/bootstrap/switches/is_not_main_thread.js", - "lib/internal/bootstrap/switches/does_own_process_state.js", - "lib/internal/bootstrap/switches/is_main_thread.js", - "lib/internal/debugger/inspect_repl.js", - "lib/internal/debugger/inspect.js", - "lib/internal/debugger/inspect_client.js", - "lib/internal/cluster/shared_handle.js", - "lib/internal/cluster/child.js", - "lib/internal/cluster/primary.js", - "lib/internal/cluster/round_robin_handle.js", - "lib/internal/cluster/utils.js", - "lib/internal/cluster/worker.js", - "lib/internal/crypto/aes.js", - "lib/internal/crypto/certificate.js", - "lib/internal/crypto/cipher.js", - "lib/internal/crypto/diffiehellman.js", - "lib/internal/crypto/hash.js", - "lib/internal/crypto/hashnames.js", - "lib/internal/crypto/hkdf.js", - "lib/internal/crypto/keys.js", - "lib/internal/crypto/mac.js", - "lib/internal/crypto/pbkdf2.js", - "lib/internal/crypto/random.js", - "lib/internal/crypto/scrypt.js", - "lib/internal/crypto/sig.js", - "lib/internal/crypto/util.js", - "lib/internal/crypto/webcrypto.js", - "lib/internal/crypto/x509.js", - "lib/internal/crypto/dsa.js", - "lib/internal/crypto/ec.js", - "lib/internal/crypto/keygen.js", - "lib/internal/crypto/rsa.js", - "lib/internal/dns/promises.js", - "lib/internal/dns/utils.js", - "lib/internal/fs/dir.js", - "lib/internal/fs/read_file_context.js", - "lib/internal/fs/streams.js", - "lib/internal/fs/sync_write_stream.js", - "lib/internal/fs/utils.js", - "lib/internal/fs/watchers.js", - "lib/internal/fs/promises.js", - "lib/internal/fs/rimraf.js", - "lib/internal/fs/cp/cp-sync.js", - "lib/internal/fs/cp/cp.js", - "lib/internal/http2/compat.js", - "lib/internal/http2/util.js", - "lib/internal/http2/core.js", - "lib/internal/modules/package_json_reader.js", - "lib/internal/modules/run_main.js", - "lib/internal/modules/cjs/loader.js", - "lib/internal/modules/cjs/helpers.js", - "lib/internal/modules/esm/loader.js", - "lib/internal/modules/esm/transform_source.js", - "lib/internal/modules/esm/module_job.js", - "lib/internal/modules/esm/module_map.js", - "lib/internal/modules/esm/resolve.js", - "lib/internal/modules/esm/translators.js", - "lib/internal/modules/esm/get_format.js", - "lib/internal/modules/esm/create_dynamic_module.js", - "lib/internal/modules/esm/get_source.js", - "lib/internal/legacy/processbinding.js", - "lib/internal/process/policy.js", - "lib/internal/process/worker_thread_only.js", - "lib/internal/process/esm_loader.js", - "lib/internal/process/execution.js", - "lib/internal/process/per_thread.js", - "lib/internal/process/promises.js", - "lib/internal/process/report.js", - "lib/internal/process/signal.js", - "lib/internal/process/task_queues.js", - "lib/internal/process/warning.js", - "lib/internal/repl/history.js", - "lib/internal/repl/utils.js", - "lib/internal/repl/await.js", - "lib/internal/streams/legacy.js", - "lib/internal/streams/passthrough.js", - "lib/internal/streams/buffer_list.js", - "lib/internal/streams/from.js", - "lib/internal/streams/lazy_transform.js", - "lib/internal/streams/state.js", - "lib/internal/streams/transform.js", - "lib/internal/streams/add-abort-signal.js", - "lib/internal/streams/compose.js", - "lib/internal/streams/destroy.js", - "lib/internal/streams/duplex.js", - "lib/internal/streams/duplexify.js", - "lib/internal/streams/end-of-stream.js", - "lib/internal/streams/pipeline.js", - "lib/internal/streams/readable.js", - "lib/internal/streams/utils.js", - "lib/internal/streams/writable.js", - "lib/internal/test/binding.js", - "lib/internal/test/transfer.js", - "lib/internal/util/comparisons.js", - "lib/internal/util/debuglog.js", - "lib/internal/util/inspect.js", - "lib/internal/util/inspector.js", - "lib/internal/util/iterable_weak_map.js", - "lib/internal/util/types.js", - "lib/internal/main/check_syntax.js", - "lib/internal/main/eval_stdin.js", - "lib/internal/main/prof_process.js", - "lib/internal/main/run_main_module.js", - "lib/internal/main/print_help.js", - "lib/internal/main/repl.js", - "lib/internal/main/inspect.js", - "lib/internal/main/worker_thread.js", - "lib/internal/main/eval_string.js", - "lib/internal/tls/parse-cert-string.js", - "lib/internal/tls/secure-context.js", - "lib/internal/tls/secure-pair.js", - "lib/internal/vm/module.js", - "lib/internal/child_process/serialization.js", - "lib/internal/per_context/domexception.js", - "lib/internal/per_context/messageport.js", - "lib/internal/per_context/primordials.js", - "lib/internal/worker/io.js", - "lib/internal/worker/js_transferable.js", - "lib/internal/assert/calltracker.js", - "lib/internal/assert/assertion_error.js", - "lib/internal/perf/event_loop_delay.js", - "lib/internal/perf/event_loop_utilization.js", - "lib/internal/perf/nodetiming.js", - "lib/internal/perf/observe.js", - "lib/internal/perf/performance.js", - "lib/internal/perf/performance_entry.js", - "lib/internal/perf/timerify.js", - "lib/internal/perf/usertiming.js", - "lib/internal/perf/utils.js", - "lib/internal/webstreams/encoding.js", - "lib/internal/webstreams/queuingstrategies.js", - "lib/internal/webstreams/readablestream.js", - "lib/internal/webstreams/transfer.js", - "lib/internal/webstreams/transformstream.js", - "lib/internal/webstreams/util.js", - "lib/internal/webstreams/writablestream.js", - "lib/internal/source_map/source_map.js", - "lib/internal/source_map/source_map_cache.js", - "lib/internal/source_map/prepare_stack_trace.js", - "lib/internal/console/global.js", - "lib/internal/console/constructor.js", - "lib/internal/readline/utils.js", - "lib/internal/readline/callbacks.js", - "lib/internal/readline/emitKeypressEvents.js", - "lib/internal/policy/manifest.js", - "lib/internal/policy/sri.js", - "lib/fs/promises.js", - "lib/util/types.js", - "lib/path/posix.js", - "lib/path/win32.js", - "lib/timers/promises.js" - ], - "node_module_version": 93, - "node_no_browser_globals": "false", - "node_prefix": "/", - "node_release_urlbase": "https://nodejs.org/download/release/", - "node_section_ordering_info": "", - "node_shared": "false", - "node_shared_brotli": "false", - "node_shared_cares": "false", - "node_shared_http_parser": "false", - "node_shared_libuv": "false", - "node_shared_nghttp2": "false", - "node_shared_nghttp3": "false", - "node_shared_ngtcp2": "false", - "node_shared_openssl": "false", - "node_shared_zlib": "false", - "node_tag": "", - "node_target_type": "executable", - "node_use_bundled_v8": "true", - "node_use_dtrace": "false", - "node_use_etw": "false", - "node_use_node_code_cache": "true", - "node_use_node_snapshot": "true", - "node_use_openssl": "true", - "node_use_v8_platform": "true", - "node_with_ltcg": "false", - "node_without_node_options": "false", - "openssl_fips": "", - "openssl_is_fips": "false", - "openssl_quic": "true", - "ossfuzz": "false", - "shlib_suffix": "so.93", - "target_arch": "x64", - "v8_enable_31bit_smis_on_64bit_arch": 0, - "v8_enable_gdbjit": 0, - "v8_enable_i18n_support": 1, - "v8_enable_inspector": 1, - "v8_enable_lite_mode": 0, - "v8_enable_object_print": 1, - "v8_enable_pointer_compression": 0, - "v8_enable_webassembly": 1, - "v8_no_strict_aliasing": 1, - "v8_optimized_debug": 1, - "v8_promise_internal_field_count": 1, - "v8_random_seed": 0, - "v8_trace_maps": 0, - "v8_use_siphash": 1, - "want_separate_host_toolset": 0, - "nodedir": "/home/matias/.cache/node-gyp/16.9.1", - "standalone_static_library": 1, - "user_agent": "pnpm/6.21.0 npm/? node/v16.9.1 linux x64", - "registry": "https://registry.npmjs.org/", - "node_gyp": "/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" - } -} diff --git a/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk b/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk deleted file mode 100644 index 4a2de286352df8..00000000000000 --- a/packages/playground/ssr-deps/node-addon/build/cpp_addon.target.mk +++ /dev/null @@ -1,159 +0,0 @@ -# This file is generated by gyp; do not edit. - -TOOLSET := target -TARGET := cpp_addon -DEFS_Debug := \ - '-DNODE_GYP_MODULE_NAME=cpp_addon' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-DV8_DEPRECATION_WARNINGS' \ - '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ - '-D_GLIBCXX_USE_CXX11_ABI=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-D__STDC_FORMAT_MACROS' \ - '-DOPENSSL_NO_PINSHARED' \ - '-DOPENSSL_THREADS' \ - '-DBUILDING_NODE_EXTENSION' \ - '-DDEBUG' \ - '-D_DEBUG' \ - '-DV8_ENABLE_CHECKS' - -# Flags passed to all source files. -CFLAGS_Debug := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -m64 \ - -g \ - -O0 - -# Flags passed to only C files. -CFLAGS_C_Debug := - -# Flags passed to only C++ files. -CFLAGS_CC_Debug := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++14 - -INCS_Debug := \ - -I/home/matias/.cache/node-gyp/16.9.1/include/node \ - -I/home/matias/.cache/node-gyp/16.9.1/src \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include - -DEFS_Release := \ - '-DNODE_GYP_MODULE_NAME=cpp_addon' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-DV8_DEPRECATION_WARNINGS' \ - '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ - '-D_GLIBCXX_USE_CXX11_ABI=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-D__STDC_FORMAT_MACROS' \ - '-DOPENSSL_NO_PINSHARED' \ - '-DOPENSSL_THREADS' \ - '-DBUILDING_NODE_EXTENSION' - -# Flags passed to all source files. -CFLAGS_Release := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -m64 \ - -O3 \ - -fno-omit-frame-pointer - -# Flags passed to only C files. -CFLAGS_C_Release := - -# Flags passed to only C++ files. -CFLAGS_CC_Release := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++14 - -INCS_Release := \ - -I/home/matias/.cache/node-gyp/16.9.1/include/node \ - -I/home/matias/.cache/node-gyp/16.9.1/src \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/config \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/openssl/openssl/include \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/uv/include \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/zlib \ - -I/home/matias/.cache/node-gyp/16.9.1/deps/v8/include - -OBJS := \ - $(obj).target/$(TARGET)/main.o - -# Add to the list of files we specially track dependencies for. -all_deps += $(OBJS) - -# CFLAGS et al overrides must be target-local. -# See "Target-specific Variable Values" in the GNU Make manual. -$(OBJS): TOOLSET := $(TOOLSET) -$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) -$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) - -# Suffix rules, putting all outputs into $(obj). - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# Try building from generated source, too. - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# End of this set of suffix rules -### Rules for final target. -LDFLAGS_Debug := \ - -pthread \ - -rdynamic \ - -m64 - -LDFLAGS_Release := \ - -pthread \ - -rdynamic \ - -m64 - -LIBS := - -$(obj).target/cpp_addon.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) -$(obj).target/cpp_addon.node: LIBS := $(LIBS) -$(obj).target/cpp_addon.node: TOOLSET := $(TOOLSET) -$(obj).target/cpp_addon.node: $(OBJS) FORCE_DO_CMD - $(call do_cmd,solink_module) - -all_deps += $(obj).target/cpp_addon.node -# Add target alias -.PHONY: cpp_addon -cpp_addon: $(builddir)/cpp_addon.node - -# Copy this to the executable output path. -$(builddir)/cpp_addon.node: TOOLSET := $(TOOLSET) -$(builddir)/cpp_addon.node: $(obj).target/cpp_addon.node FORCE_DO_CMD - $(call do_cmd,copy) - -all_deps += $(builddir)/cpp_addon.node -# Short alias for building this executable. -.PHONY: cpp_addon.node -cpp_addon.node: $(obj).target/cpp_addon.node $(builddir)/cpp_addon.node - -# Add executable to "all" target. -.PHONY: all -all: $(builddir)/cpp_addon.node - From 39c252e97d0bb001cbcdb519cb1e15171ff2908c Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Thu, 16 Dec 2021 23:52:45 -0600 Subject: [PATCH 0086/1287] chore: delete extra blank line (#6152) --- packages/vite/src/node/server/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index f5a2f4ca35e9c2..b186285ffeff0b 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -749,7 +749,7 @@ async function restartServer(server: ViteDevServer) { await server.listen(port, true) logger.info('server restarted.', { timestamp: true }) if (port !== prevPort || host !== prevHost) { - logger.info('\n') + logger.info('') server.printUrls() } } else { From e19ba6a98d85586d1f54e6b0eed11dcf72e6c651 Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Fri, 17 Dec 2021 15:08:02 +0630 Subject: [PATCH 0087/1287] ci: cancel same in-progress workflow (#6127) --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e946cf9b4fda1..64166e7158caf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,10 @@ on: pull_request: workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + jobs: build: runs-on: ${{ matrix.os }} From aab303f7bd333307c77363259f97a310762c4848 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 17 Dec 2021 12:26:20 +0100 Subject: [PATCH 0088/1287] chore(deps): update all non-major dependencies (#5879) --- package.json | 28 +- packages/plugin-legacy/package.json | 4 +- packages/plugin-react/package.json | 12 +- packages/plugin-vue-jsx/package.json | 4 +- packages/plugin-vue/package.json | 6 +- packages/vite/package.json | 20 +- pnpm-lock.yaml | 1646 +++++++++++++------------- 7 files changed, 879 insertions(+), 841 deletions(-) diff --git a/package.json b/package.json index 1343fc1cbd7052..dcb61a6713fb40 100644 --- a/package.json +++ b/package.json @@ -24,39 +24,39 @@ "ci-docs": "run-s build-vite build-plugin-vue build-docs" }, "devDependencies": { - "@microsoft/api-extractor": "^7.18.19", + "@microsoft/api-extractor": "^7.19.2", "@types/fs-extra": "^9.0.13", "@types/jest": "^27.0.3", - "@types/node": "^16.11.9", + "@types/node": "^16.11.14", "@types/semver": "^7.3.9", - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", + "@typescript-eslint/eslint-plugin": "^5.7.0", + "@typescript-eslint/parser": "^5.7.0", "chalk": "^4.1.2", "conventional-changelog-cli": "^2.1.1", "cross-env": "^7.0.3", "esbuild": "^0.13.12", - "eslint": "^8.3.0", - "eslint-define-config": "^1.1.4", + "eslint": "^8.4.1", + "eslint-define-config": "^1.2.0", "eslint-plugin-node": "^11.1.0", "execa": "^5.1.1", "fs-extra": "^10.0.0", - "jest": "^27.3.1", - "lint-staged": "^12.1.1", + "jest": "^27.4.5", + "lint-staged": "^12.1.2", "minimist": "^1.2.5", "node-fetch": "^2.6.6", "npm-run-all": "^4.1.5", - "playwright-chromium": "^1.16.3", - "prettier": "2.4.1", + "playwright-chromium": "^1.17.1", + "prettier": "2.5.1", "prompts": "^2.4.2", "rimraf": "^3.0.2", "rollup": "^2.59.0", "semver": "^7.3.5", - "sirv": "^1.0.18", - "ts-jest": "^27.0.7", + "sirv": "^1.0.19", + "ts-jest": "^27.1.2", "ts-node": "^10.4.0", "typescript": "~4.4.4", "vite": "workspace:*", - "vitepress": "^0.20.1", + "vitepress": "^0.20.9", "yorkie": "^2.0.0" }, "gitHooks": { @@ -74,7 +74,7 @@ "eslint --ext .ts" ] }, - "packageManager": "pnpm@6.23.0", + "packageManager": "pnpm@6.24.1", "pnpm": { "overrides": { "vite": "workspace:*", diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index 2c08940d5f335d..cd2ecc6a5858a9 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -26,8 +26,8 @@ }, "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme", "dependencies": { - "@babel/standalone": "^7.16.4", - "core-js": "^3.19.1", + "@babel/standalone": "^7.16.6", + "core-js": "^3.20.0", "magic-string": "^0.25.7", "regenerator-runtime": "^0.13.9", "systemjs": "^6.11.0" diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 44e44fdc1ed234..a58d08f6b6834a 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -33,12 +33,12 @@ }, "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-react#readme", "dependencies": { - "@babel/core": "^7.16.0", - "@babel/plugin-transform-react-jsx": "^7.16.0", - "@babel/plugin-transform-react-jsx-development": "^7.16.0", - "@babel/plugin-transform-react-jsx-self": "^7.16.0", - "@babel/plugin-transform-react-jsx-source": "^7.16.0", - "@rollup/pluginutils": "^4.1.1", + "@babel/core": "^7.16.5", + "@babel/plugin-transform-react-jsx": "^7.16.5", + "@babel/plugin-transform-react-jsx-development": "^7.16.5", + "@babel/plugin-transform-react-jsx-self": "^7.16.5", + "@babel/plugin-transform-react-jsx-source": "^7.16.5", + "@rollup/pluginutils": "^4.1.2", "react-refresh": "^0.11.0", "resolve": "^1.20.0" } diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 76bacceb6ec2d5..40ef71dac734ea 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -26,10 +26,10 @@ }, "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-vue-jsx#readme", "dependencies": { - "@babel/core": "^7.16.0", + "@babel/core": "^7.16.5", "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-transform-typescript": "^7.16.1", - "@rollup/pluginutils": "^4.1.1", + "@rollup/pluginutils": "^4.1.2", "@vue/babel-plugin-jsx": "^1.1.1", "hash-sum": "^2.0.0" } diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index a779030008adef..a3721f40f960b5 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -35,13 +35,13 @@ "vue": "^3.2.25" }, "devDependencies": { - "@rollup/pluginutils": "^4.1.1", + "@rollup/pluginutils": "^4.1.2", "@types/hash-sum": "^1.0.0", - "debug": "^4.3.2", + "debug": "^4.3.3", "hash-sum": "^2.0.0", "rollup": "^2.59.0", "slash": "^4.0.0", "source-map": "^0.6.1", - "vue": "^3.2.25" + "vue": "^3.2.26" } } diff --git a/packages/vite/package.json b/packages/vite/package.json index ed947b04f3a576..46b3036da6e022 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -45,7 +45,7 @@ "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!", "dependencies": { "esbuild": "^0.13.12", - "postcss": "^8.3.11", + "postcss": "^8.4.5", "resolve": "^1.20.0", "rollup": "^2.59.0" }, @@ -53,16 +53,16 @@ "fsevents": "~2.3.2" }, "devDependencies": { - "@ampproject/remapping": "^1.0.1", - "@babel/parser": "^7.16.4", + "@ampproject/remapping": "^1.0.2", + "@babel/parser": "^7.16.6", "@babel/types": "^7.16.0", "@rollup/plugin-alias": "^3.1.8", "@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-dynamic-import-vars": "^1.4.1", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "13.0.6", + "@rollup/plugin-node-resolve": "13.1.1", "@rollup/plugin-typescript": "^8.3.0", - "@rollup/pluginutils": "^4.1.1", + "@rollup/pluginutils": "^4.1.2", "@types/convert-source-map": "^1.5.2", "@types/debug": "^4.1.7", "@types/estree": "^0.0.50", @@ -70,12 +70,12 @@ "@types/less": "^3.0.3", "@types/micromatch": "^4.0.2", "@types/mime": "^2.0.3", - "@types/node": "^16.11.9", + "@types/node": "^16.11.14", "@types/resolve": "^1.20.1", - "@types/sass": "~1.43.0", + "@types/sass": "~1.43.1", "@types/stylus": "^0.48.36", "@types/ws": "^8.2.2", - "@vue/compiler-dom": "^3.2.22", + "@vue/compiler-dom": "^3.2.26", "acorn": "^8.6.0", "acorn-class-fields": "^1.0.0", "acorn-static-class-features": "^1.0.0", @@ -87,7 +87,7 @@ "connect-history-api-fallback": "^1.6.0", "convert-source-map": "^1.8.0", "cors": "^2.8.5", - "debug": "^4.3.2", + "debug": "^4.3.3", "dotenv": "^10.0.0", "dotenv-expand": "^5.1.0", "es-module-lexer": "^0.9.3", @@ -109,7 +109,7 @@ "resolve.exports": "^1.1.0", "rollup-plugin-license": "^2.6.0", "selfsigned": "^1.10.11", - "sirv": "^1.0.18", + "sirv": "^1.0.19", "source-map": "^0.6.1", "source-map-support": "^0.5.21", "strip-ansi": "^6.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fb2e71bfdf4b9b..0a476f1e90e12d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,74 +8,74 @@ importers: .: specifiers: - '@microsoft/api-extractor': ^7.18.19 + '@microsoft/api-extractor': ^7.19.2 '@types/fs-extra': ^9.0.13 '@types/jest': ^27.0.3 - '@types/node': ^16.11.9 + '@types/node': ^16.11.14 '@types/semver': ^7.3.9 - '@typescript-eslint/eslint-plugin': ^5.4.0 - '@typescript-eslint/parser': ^5.4.0 + '@typescript-eslint/eslint-plugin': ^5.7.0 + '@typescript-eslint/parser': ^5.7.0 chalk: ^4.1.2 conventional-changelog-cli: ^2.1.1 cross-env: ^7.0.3 esbuild: ^0.13.12 - eslint: ^8.3.0 - eslint-define-config: ^1.1.4 + eslint: ^8.4.1 + eslint-define-config: ^1.2.0 eslint-plugin-node: ^11.1.0 execa: ^5.1.1 fs-extra: ^10.0.0 - jest: ^27.3.1 - lint-staged: ^12.1.1 + jest: ^27.4.5 + lint-staged: ^12.1.2 minimist: ^1.2.5 node-fetch: ^2.6.6 npm-run-all: ^4.1.5 - playwright-chromium: ^1.16.3 - prettier: 2.4.1 + playwright-chromium: ^1.17.1 + prettier: 2.5.1 prompts: ^2.4.2 rimraf: ^3.0.2 rollup: ^2.59.0 semver: ^7.3.5 - sirv: ^1.0.18 - ts-jest: ^27.0.7 + sirv: ^1.0.19 + ts-jest: ^27.1.2 ts-node: ^10.4.0 typescript: ~4.4.4 vite: workspace:* - vitepress: ^0.20.1 + vitepress: ^0.20.9 yorkie: ^2.0.0 devDependencies: - '@microsoft/api-extractor': 7.18.19 + '@microsoft/api-extractor': 7.19.2 '@types/fs-extra': 9.0.13 '@types/jest': 27.0.3 - '@types/node': 16.11.9 + '@types/node': 16.11.14 '@types/semver': 7.3.9 - '@typescript-eslint/eslint-plugin': 5.4.0_8fbd82ef37e23da98dfca9805cf945cd - '@typescript-eslint/parser': 5.4.0_eslint@8.3.0+typescript@4.4.4 + '@typescript-eslint/eslint-plugin': 5.7.0_d7a0d6b59468b4d2ea38f782f4f112e3 + '@typescript-eslint/parser': 5.7.0_eslint@8.4.1+typescript@4.4.4 chalk: 4.1.2 conventional-changelog-cli: 2.1.1 cross-env: 7.0.3 esbuild: 0.13.12 - eslint: 8.3.0 - eslint-define-config: 1.1.4 - eslint-plugin-node: 11.1.0_eslint@8.3.0 + eslint: 8.4.1 + eslint-define-config: 1.2.0 + eslint-plugin-node: 11.1.0_eslint@8.4.1 execa: 5.1.1 fs-extra: 10.0.0 - jest: 27.3.1_ts-node@10.4.0 - lint-staged: 12.1.1 + jest: 27.4.5_ts-node@10.4.0 + lint-staged: 12.1.2 minimist: 1.2.5 node-fetch: 2.6.6 npm-run-all: 4.1.5 - playwright-chromium: 1.16.3 - prettier: 2.4.1 + playwright-chromium: 1.17.1 + prettier: 2.5.1 prompts: 2.4.2 rimraf: 3.0.2 rollup: 2.59.0 semver: 7.3.5 - sirv: 1.0.18 - ts-jest: 27.0.7_b626c82449d36ccae0aa7169b15092e6 - ts-node: 10.4.0_7dd5cf9af763e621261d5cc88a052be2 + sirv: 1.0.19 + ts-jest: 27.1.2_52ee6014196323fc54772ef1ffde0dac + ts-node: 10.4.0_08095b3038b55682110c004d6a64072d typescript: 4.4.4 vite: link:packages/vite - vitepress: 0.20.1 + vitepress: 0.20.9 yorkie: 2.0.0 packages/create-vite: @@ -643,86 +643,86 @@ importers: packages/plugin-legacy: specifiers: - '@babel/standalone': ^7.16.4 - core-js: ^3.19.1 + '@babel/standalone': ^7.16.6 + core-js: ^3.20.0 magic-string: ^0.25.7 regenerator-runtime: ^0.13.9 systemjs: ^6.11.0 dependencies: - '@babel/standalone': 7.16.4 - core-js: 3.19.1 + '@babel/standalone': 7.16.6 + core-js: 3.20.0 magic-string: 0.25.7 regenerator-runtime: 0.13.9 systemjs: 6.11.0 packages/plugin-react: specifiers: - '@babel/core': ^7.16.0 - '@babel/plugin-transform-react-jsx': ^7.16.0 - '@babel/plugin-transform-react-jsx-development': ^7.16.0 - '@babel/plugin-transform-react-jsx-self': ^7.16.0 - '@babel/plugin-transform-react-jsx-source': ^7.16.0 - '@rollup/pluginutils': ^4.1.1 + '@babel/core': ^7.16.5 + '@babel/plugin-transform-react-jsx': ^7.16.5 + '@babel/plugin-transform-react-jsx-development': ^7.16.5 + '@babel/plugin-transform-react-jsx-self': ^7.16.5 + '@babel/plugin-transform-react-jsx-source': ^7.16.5 + '@rollup/pluginutils': ^4.1.2 react-refresh: ^0.11.0 resolve: ^1.20.0 dependencies: - '@babel/core': 7.16.0 - '@babel/plugin-transform-react-jsx': 7.16.0_@babel+core@7.16.0 - '@babel/plugin-transform-react-jsx-development': 7.16.0_@babel+core@7.16.0 - '@babel/plugin-transform-react-jsx-self': 7.16.0_@babel+core@7.16.0 - '@babel/plugin-transform-react-jsx-source': 7.16.0_@babel+core@7.16.0 - '@rollup/pluginutils': 4.1.1 + '@babel/core': 7.16.5 + '@babel/plugin-transform-react-jsx': 7.16.5_@babel+core@7.16.5 + '@babel/plugin-transform-react-jsx-development': 7.16.5_@babel+core@7.16.5 + '@babel/plugin-transform-react-jsx-self': 7.16.5_@babel+core@7.16.5 + '@babel/plugin-transform-react-jsx-source': 7.16.5_@babel+core@7.16.5 + '@rollup/pluginutils': 4.1.2 react-refresh: 0.11.0 resolve: 1.20.0 packages/plugin-vue: specifiers: - '@rollup/pluginutils': ^4.1.1 + '@rollup/pluginutils': ^4.1.2 '@types/hash-sum': ^1.0.0 - debug: ^4.3.2 + debug: ^4.3.3 hash-sum: ^2.0.0 rollup: ^2.59.0 slash: ^4.0.0 source-map: ^0.6.1 - vue: ^3.2.25 + vue: ^3.2.26 devDependencies: - '@rollup/pluginutils': 4.1.1 + '@rollup/pluginutils': 4.1.2 '@types/hash-sum': 1.0.0 - debug: 4.3.2 + debug: 4.3.3 hash-sum: 2.0.0 rollup: 2.59.0 slash: 4.0.0 source-map: 0.6.1 - vue: 3.2.25 + vue: 3.2.26 packages/plugin-vue-jsx: specifiers: - '@babel/core': ^7.16.0 + '@babel/core': ^7.16.5 '@babel/plugin-syntax-import-meta': ^7.10.4 '@babel/plugin-transform-typescript': ^7.16.1 - '@rollup/pluginutils': ^4.1.1 + '@rollup/pluginutils': ^4.1.2 '@vue/babel-plugin-jsx': ^1.1.1 hash-sum: ^2.0.0 dependencies: - '@babel/core': 7.16.0 - '@babel/plugin-syntax-import-meta': 7.10.4_@babel+core@7.16.0 - '@babel/plugin-transform-typescript': 7.16.1_@babel+core@7.16.0 - '@rollup/pluginutils': 4.1.1 - '@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.16.0 + '@babel/core': 7.16.5 + '@babel/plugin-syntax-import-meta': 7.10.4_@babel+core@7.16.5 + '@babel/plugin-transform-typescript': 7.16.1_@babel+core@7.16.5 + '@rollup/pluginutils': 4.1.2 + '@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.16.5 hash-sum: 2.0.0 packages/vite: specifiers: - '@ampproject/remapping': ^1.0.1 - '@babel/parser': ^7.16.4 + '@ampproject/remapping': ^1.0.2 + '@babel/parser': ^7.16.6 '@babel/types': ^7.16.0 '@rollup/plugin-alias': ^3.1.8 '@rollup/plugin-commonjs': ^21.0.1 '@rollup/plugin-dynamic-import-vars': ^1.4.1 '@rollup/plugin-json': ^4.1.0 - '@rollup/plugin-node-resolve': 13.0.6 + '@rollup/plugin-node-resolve': 13.1.1 '@rollup/plugin-typescript': ^8.3.0 - '@rollup/pluginutils': ^4.1.1 + '@rollup/pluginutils': ^4.1.2 '@types/convert-source-map': ^1.5.2 '@types/debug': ^4.1.7 '@types/estree': ^0.0.50 @@ -730,12 +730,12 @@ importers: '@types/less': ^3.0.3 '@types/micromatch': ^4.0.2 '@types/mime': ^2.0.3 - '@types/node': ^16.11.9 + '@types/node': ^16.11.14 '@types/resolve': ^1.20.1 - '@types/sass': ~1.43.0 + '@types/sass': ~1.43.1 '@types/stylus': ^0.48.36 '@types/ws': ^8.2.2 - '@vue/compiler-dom': ^3.2.22 + '@vue/compiler-dom': ^3.2.26 acorn: ^8.6.0 acorn-class-fields: ^1.0.0 acorn-static-class-features: ^1.0.0 @@ -747,7 +747,7 @@ importers: connect-history-api-fallback: ^1.6.0 convert-source-map: ^1.8.0 cors: ^2.8.5 - debug: ^4.3.2 + debug: ^4.3.3 dotenv: ^10.0.0 dotenv-expand: ^5.1.0 es-module-lexer: ^0.9.3 @@ -765,7 +765,7 @@ importers: okie: ^1.0.1 open: ^8.4.0 periscopic: ^2.0.3 - postcss: ^8.3.11 + postcss: ^8.4.5 postcss-import: ^14.0.2 postcss-load-config: ^3.1.0 postcss-modules: ^4.2.2 @@ -774,7 +774,7 @@ importers: rollup: ^2.59.0 rollup-plugin-license: ^2.6.0 selfsigned: ^1.10.11 - sirv: ^1.0.18 + sirv: ^1.0.19 source-map: ^0.6.1 source-map-support: ^0.5.21 strip-ansi: ^6.0.1 @@ -785,22 +785,22 @@ importers: ws: ^8.3.0 dependencies: esbuild: 0.13.12 - postcss: 8.3.11 + postcss: 8.4.5 resolve: 1.20.0 rollup: 2.59.0 optionalDependencies: fsevents: 2.3.2 devDependencies: - '@ampproject/remapping': 1.0.1 - '@babel/parser': 7.16.4 + '@ampproject/remapping': 1.0.2 + '@babel/parser': 7.16.6 '@babel/types': 7.16.0 '@rollup/plugin-alias': 3.1.8_rollup@2.59.0 '@rollup/plugin-commonjs': 21.0.1_rollup@2.59.0 '@rollup/plugin-dynamic-import-vars': 1.4.1_rollup@2.59.0 '@rollup/plugin-json': 4.1.0_rollup@2.59.0 - '@rollup/plugin-node-resolve': 13.0.6_rollup@2.59.0 + '@rollup/plugin-node-resolve': 13.1.1_rollup@2.59.0 '@rollup/plugin-typescript': 8.3.0_80f1acc233e4df93aa4e78959e046afc - '@rollup/pluginutils': 4.1.1 + '@rollup/pluginutils': 4.1.2 '@types/convert-source-map': 1.5.2 '@types/debug': 4.1.7 '@types/estree': 0.0.50 @@ -808,12 +808,12 @@ importers: '@types/less': 3.0.3 '@types/micromatch': 4.0.2 '@types/mime': 2.0.3 - '@types/node': 16.11.9 + '@types/node': 16.11.14 '@types/resolve': 1.20.1 - '@types/sass': 1.43.0 + '@types/sass': 1.43.1 '@types/stylus': 0.48.36 '@types/ws': 8.2.2 - '@vue/compiler-dom': 3.2.22 + '@vue/compiler-dom': 3.2.26 acorn: 8.6.0 acorn-class-fields: 1.0.0_acorn@8.6.0 acorn-static-class-features: 1.0.0_acorn@8.6.0 @@ -825,7 +825,7 @@ importers: connect-history-api-fallback: 1.6.0 convert-source-map: 1.8.0 cors: 2.8.5 - debug: 4.3.2 + debug: 4.3.3 dotenv: 10.0.0 dotenv-expand: 5.1.0 es-module-lexer: 0.9.3 @@ -833,7 +833,7 @@ importers: etag: 1.8.1 execa: 5.1.1 fast-glob: 3.2.7 - http-proxy: 1.18.1_debug@4.3.2 + http-proxy: 1.18.1_debug@4.3.3 launch-editor-middleware: 2.2.1 magic-string: 0.25.7 micromatch: 4.0.4 @@ -841,13 +841,13 @@ importers: okie: 1.0.1 open: 8.4.0 periscopic: 2.0.3 - postcss-import: 14.0.2_postcss@8.3.11 + postcss-import: 14.0.2_postcss@8.4.5 postcss-load-config: 3.1.0_ts-node@10.4.0 - postcss-modules: 4.2.2_postcss@8.3.11 + postcss-modules: 4.2.2_postcss@8.4.5 resolve.exports: 1.1.0 rollup-plugin-license: 2.6.0_rollup@2.59.0 selfsigned: 1.10.11 - sirv: 1.0.18 + sirv: 1.0.19 source-map: 0.6.1 source-map-support: 0.5.21 strip-ansi: 6.0.1 @@ -859,6 +859,26 @@ importers: packages: + /@algolia/autocomplete-core/1.5.0: + resolution: {integrity: sha512-E7+VJwcvwMM8vPeaVn7fNUgix8WHV8A1WUeHDi2KHemCaaGc8lvUnP3QnvhMxiDhTe7OpMEv4o2TBUMyDgThaw==} + dependencies: + '@algolia/autocomplete-shared': 1.5.0 + dev: true + + /@algolia/autocomplete-preset-algolia/1.5.0_algoliasearch@4.11.0: + resolution: {integrity: sha512-iiFxKERGHkvkiupmrFJbvESpP/zv5jSgH714XRiP5LDvUHaYOo4GLAwZCFf2ef/L5tdtPBARvekn6k1Xf33gjA==} + peerDependencies: + '@algolia/client-search': ^4.9.1 + algoliasearch: ^4.9.1 + dependencies: + '@algolia/autocomplete-shared': 1.5.0 + algoliasearch: 4.11.0 + dev: true + + /@algolia/autocomplete-shared/1.5.0: + resolution: {integrity: sha512-bRSkqHHHSwZYbFY3w9hgMyQRm86Wz27bRaGCbNldLfbk0zUjApmE4ajx+ZCVSLqxvcUEjMqZFJzDsder12eKsg==} + dev: true + /@algolia/cache-browser-local-storage/4.11.0: resolution: {integrity: sha512-4sr9vHIG1fVA9dONagdzhsI/6M5mjs/qOe2xUP0yBmwsTsuwiZq3+Xu6D3dsxsuFetcJgC6ydQoCW8b7fDJHYQ==} dependencies: @@ -949,8 +969,8 @@ packages: '@algolia/requester-common': 4.11.0 dev: true - /@ampproject/remapping/1.0.1: - resolution: {integrity: sha512-Ta9bMA3EtUHDaZJXqUoT5cn/EecwOp+SXpKJqxDbDuMbLvEMu6YTyDDuvTWeStODfdmXyfMo7LymQyPkN3BicA==} + /@ampproject/remapping/1.0.2: + resolution: {integrity: sha512-SncaVxs+E3EdoA9xJgHfWPxZfowAgeIsd71VpqCKP6KNKm6s7zSqqvUc70UpKUFsrV3dAmy6qxHoIj5NG+3DiA==} engines: {node: '>=6.0.0'} dependencies: '@jridgewell/resolve-uri': 1.0.0 @@ -967,21 +987,21 @@ packages: resolution: {integrity: sha512-DGjt2QZse5SGd9nfOSqO4WLJ8NN/oHkijbXbPrxuoJO3oIPJL3TciZs9FX+cOHNiY9E9l0opL8g7BmLe3T+9ew==} engines: {node: '>=6.9.0'} - /@babel/core/7.16.0: - resolution: {integrity: sha512-mYZEvshBRHGsIAiyH5PzCFTCfbWfoYbO/jcSdXQSUQu1/pW0xDZAUP7KEc32heqWTAfAHhV9j1vH8Sav7l+JNQ==} + /@babel/core/7.16.5: + resolution: {integrity: sha512-wUcenlLzuWMZ9Zt8S0KmFwGlH6QKRh3vsm/dhDA3CHkiTA45YuG1XkHRcNRl73EFPXDp/d5kVOU0/y7x2w6OaQ==} engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.16.0 - '@babel/generator': 7.16.0 - '@babel/helper-compilation-targets': 7.16.0_@babel+core@7.16.0 - '@babel/helper-module-transforms': 7.16.0 - '@babel/helpers': 7.16.0 - '@babel/parser': 7.16.2 + '@babel/generator': 7.16.5 + '@babel/helper-compilation-targets': 7.16.3_@babel+core@7.16.5 + '@babel/helper-module-transforms': 7.16.5 + '@babel/helpers': 7.16.5 + '@babel/parser': 7.16.6 '@babel/template': 7.16.0 - '@babel/traverse': 7.16.0 + '@babel/traverse': 7.16.5 '@babel/types': 7.16.0 convert-source-map: 1.8.0 - debug: 4.3.2 + debug: 4.3.3 gensync: 1.0.0-beta.2 json5: 2.2.0 semver: 6.3.0 @@ -996,6 +1016,15 @@ packages: '@babel/types': 7.16.0 jsesc: 2.5.2 source-map: 0.5.7 + dev: false + + /@babel/generator/7.16.5: + resolution: {integrity: sha512-kIvCdjZqcdKqoDbVVdt5R99icaRtrtYhYK/xux5qiWCBmfdvEYMFZ68QCrpE5cbFM1JsuArUNs1ZkuKtTtUcZA==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.16.0 + jsesc: 2.5.2 + source-map: 0.5.7 /@babel/helper-annotate-as-pure/7.16.0: resolution: {integrity: sha512-ItmYF9vR4zA8cByDocY05o0LGUkp1zhbTQOH1NFyl5xXEqlTJQCEJjieriw+aFpxo16swMxUnUiKS7a/r4vtHg==} @@ -1004,25 +1033,25 @@ packages: '@babel/types': 7.16.0 dev: false - /@babel/helper-compilation-targets/7.16.0_@babel+core@7.16.0: - resolution: {integrity: sha512-S7iaOT1SYlqK0sQaCi21RX4+13hmdmnxIEAnQUB/eh7GeAnRjOUgTYpLkUOiRXzD+yog1JxP0qyAQZ7ZxVxLVg==} + /@babel/helper-compilation-targets/7.16.3_@babel+core@7.16.5: + resolution: {integrity: sha512-vKsoSQAyBmxS35JUOOt+07cLc6Nk/2ljLIHwmq2/NM6hdioUaqEXq/S+nXvbvXbZkNDlWOymPanJGOc4CBjSJA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: '@babel/compat-data': 7.16.0 - '@babel/core': 7.16.0 + '@babel/core': 7.16.5 '@babel/helper-validator-option': 7.14.5 browserslist: 4.17.6 semver: 6.3.0 - /@babel/helper-create-class-features-plugin/7.16.0_@babel+core@7.16.0: + /@babel/helper-create-class-features-plugin/7.16.0_@babel+core@7.16.5: resolution: {integrity: sha512-XLwWvqEaq19zFlF5PTgOod4bUA+XbkR4WLQBct1bkzmxJGB0ZEJaoKF4c8cgH9oBtCDuYJ8BP5NB9uFiEgO5QA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.16.0 + '@babel/core': 7.16.5 '@babel/helper-annotate-as-pure': 7.16.0 '@babel/helper-function-name': 7.16.0 '@babel/helper-member-expression-to-functions': 7.16.0 @@ -1033,6 +1062,12 @@ packages: - supports-color dev: false + /@babel/helper-environment-visitor/7.16.5: + resolution: {integrity: sha512-ODQyc5AnxmZWm/R2W7fzhamOk1ey8gSguo5SGvF0zcB3uUzRpTRmM/jmLSm9bDMyPlvbyJ+PwPEK0BWIoZ9wjg==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.16.0 + /@babel/helper-function-name/7.16.0: resolution: {integrity: sha512-BZh4mEk1xi2h4HFjWUXRQX5AEx4rvaZxHgax9gcjdLWdkjsY7MKt5p0otjsg5noXw+pB+clMCjw+aEVYADMjog==} engines: {node: '>=6.9.0'} @@ -1058,6 +1093,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.16.0 + dev: false /@babel/helper-module-imports/7.16.0: resolution: {integrity: sha512-kkH7sWzKPq0xt3H1n+ghb4xEMP8k0U7XV3kkB+ZGy69kDk2ySFW1qPi06sjKzFY3t1j6XbJSqr4mF9L7CYVyhg==} @@ -1065,17 +1101,17 @@ packages: dependencies: '@babel/types': 7.16.0 - /@babel/helper-module-transforms/7.16.0: - resolution: {integrity: sha512-My4cr9ATcaBbmaEa8M0dZNA74cfI6gitvUAskgDtAFmAqyFKDSHQo5YstxPbN+lzHl2D9l/YOEFqb2mtUh4gfA==} + /@babel/helper-module-transforms/7.16.5: + resolution: {integrity: sha512-CkvMxgV4ZyyioElFwcuWnDCcNIeyqTkCm9BxXZi73RR1ozqlpboqsbGUNvRTflgZtFbbJ1v5Emvm+lkjMYY/LQ==} engines: {node: '>=6.9.0'} dependencies: + '@babel/helper-environment-visitor': 7.16.5 '@babel/helper-module-imports': 7.16.0 - '@babel/helper-replace-supers': 7.16.0 '@babel/helper-simple-access': 7.16.0 '@babel/helper-split-export-declaration': 7.16.0 '@babel/helper-validator-identifier': 7.15.7 '@babel/template': 7.16.0 - '@babel/traverse': 7.16.0 + '@babel/traverse': 7.16.5 '@babel/types': 7.16.0 transitivePeerDependencies: - supports-color @@ -1085,11 +1121,16 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.16.0 + dev: false /@babel/helper-plugin-utils/7.14.5: resolution: {integrity: sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ==} engines: {node: '>=6.9.0'} + /@babel/helper-plugin-utils/7.16.5: + resolution: {integrity: sha512-59KHWHXxVA9K4HNF4sbHCf+eJeFe0Te/ZFGqBT4OjXhrwvA04sGfaEGsVTdsjoszq0YTP49RC9UKe5g8uN2RwQ==} + engines: {node: '>=6.9.0'} + /@babel/helper-replace-supers/7.16.0: resolution: {integrity: sha512-TQxuQfSCdoha7cpRNJvfaYxxxzmbxXw/+6cS7V02eeDYyhxderSoMVALvwupA54/pZcOTtVeJ0xccp1nGWladA==} engines: {node: '>=6.9.0'} @@ -1100,6 +1141,7 @@ packages: '@babel/types': 7.16.0 transitivePeerDependencies: - supports-color + dev: false /@babel/helper-simple-access/7.16.0: resolution: {integrity: sha512-o1rjBT/gppAqKsYfUdfHq5Rk03lMQrkPHG1OWzHWpLgVXRH4HnMM9Et9CVdIqwkCQlobnGHEJMsgWP/jE1zUiw==} @@ -1121,12 +1163,12 @@ packages: resolution: {integrity: sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==} engines: {node: '>=6.9.0'} - /@babel/helpers/7.16.0: - resolution: {integrity: sha512-dVRM0StFMdKlkt7cVcGgwD8UMaBfWJHl3A83Yfs8GQ3MO0LHIIIMvK7Fa0RGOGUQ10qikLaX6D7o5htcQWgTMQ==} + /@babel/helpers/7.16.5: + resolution: {integrity: sha512-TLgi6Lh71vvMZGEkFuIxzaPsyeYCHQ5jJOOX1f0xXn0uciFuE8cEk0wyBquMcCxBXZ5BJhE2aUB7pnWTD150Tw==} engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.16.0 - '@babel/traverse': 7.16.0 + '@babel/traverse': 7.16.5 '@babel/types': 7.16.0 transitivePeerDependencies: - supports-color @@ -1149,6 +1191,11 @@ packages: engines: {node: '>=6.0.0'} hasBin: true + /@babel/parser/7.16.6: + resolution: {integrity: sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ==} + engines: {node: '>=6.0.0'} + hasBin: true + /@babel/plugin-proposal-pipeline-operator/7.16.0: resolution: {integrity: sha512-y9WbLfaPDDkShmU89N1spx54ELht7rXE2jWDzCgc23OmTwliEK9NSoR8KZdtjr1mR3QfG7D6mcDHmI4M0bhMQA==} engines: {node: '>=6.9.0'} @@ -1159,48 +1206,48 @@ packages: '@babel/plugin-syntax-pipeline-operator': 7.16.0 dev: true - /@babel/plugin-syntax-async-generators/7.8.4_@babel+core@7.16.0: + /@babel/plugin-syntax-async-generators/7.8.4_@babel+core@7.16.5: resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: true - /@babel/plugin-syntax-bigint/7.8.3_@babel+core@7.16.0: + /@babel/plugin-syntax-bigint/7.8.3_@babel+core@7.16.5: resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: true - /@babel/plugin-syntax-class-properties/7.12.13_@babel+core@7.16.0: + /@babel/plugin-syntax-class-properties/7.12.13_@babel+core@7.16.5: resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: true - /@babel/plugin-syntax-import-meta/7.10.4_@babel+core@7.16.0: + /@babel/plugin-syntax-import-meta/7.10.4_@babel+core@7.16.5: resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 + '@babel/core': 7.16.5 '@babel/helper-plugin-utils': 7.14.5 - /@babel/plugin-syntax-json-strings/7.8.3_@babel+core@7.16.0: + /@babel/plugin-syntax-json-strings/7.8.3_@babel+core@7.16.5: resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: true /@babel/plugin-syntax-jsx/7.16.0: @@ -1212,68 +1259,78 @@ packages: '@babel/helper-plugin-utils': 7.14.5 dev: true - /@babel/plugin-syntax-jsx/7.16.0_@babel+core@7.16.0: + /@babel/plugin-syntax-jsx/7.16.0_@babel+core@7.16.5: resolution: {integrity: sha512-8zv2+xiPHwly31RK4RmnEYY5zziuF3O7W2kIDW+07ewWDh6Oi0dRq8kwvulRkFgt6DB97RlKs5c1y068iPlCUg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 + '@babel/core': 7.16.5 '@babel/helper-plugin-utils': 7.14.5 dev: false - /@babel/plugin-syntax-logical-assignment-operators/7.10.4_@babel+core@7.16.0: + /@babel/plugin-syntax-jsx/7.16.5_@babel+core@7.16.5: + resolution: {integrity: sha512-42OGssv9NPk4QHKVgIHlzeLgPOW5rGgfV5jzG90AhcXXIv6hu/eqj63w4VgvRxdvZY3AlYeDgPiSJ3BqAd1Y6Q==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 + dev: false + + /@babel/plugin-syntax-logical-assignment-operators/7.10.4_@babel+core@7.16.5: resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: true - /@babel/plugin-syntax-nullish-coalescing-operator/7.8.3_@babel+core@7.16.0: + /@babel/plugin-syntax-nullish-coalescing-operator/7.8.3_@babel+core@7.16.5: resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: true - /@babel/plugin-syntax-numeric-separator/7.10.4_@babel+core@7.16.0: + /@babel/plugin-syntax-numeric-separator/7.10.4_@babel+core@7.16.5: resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: true - /@babel/plugin-syntax-object-rest-spread/7.8.3_@babel+core@7.16.0: + /@babel/plugin-syntax-object-rest-spread/7.8.3_@babel+core@7.16.5: resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: true - /@babel/plugin-syntax-optional-catch-binding/7.8.3_@babel+core@7.16.0: + /@babel/plugin-syntax-optional-catch-binding/7.8.3_@babel+core@7.16.5: resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: true - /@babel/plugin-syntax-optional-chaining/7.8.3_@babel+core@7.16.0: + /@babel/plugin-syntax-optional-chaining/7.8.3_@babel+core@7.16.5: resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: true /@babel/plugin-syntax-pipeline-operator/7.16.0: @@ -1285,79 +1342,79 @@ packages: '@babel/helper-plugin-utils': 7.14.5 dev: true - /@babel/plugin-syntax-top-level-await/7.14.5_@babel+core@7.16.0: + /@babel/plugin-syntax-top-level-await/7.14.5_@babel+core@7.16.5: resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: true - /@babel/plugin-syntax-typescript/7.16.0_@babel+core@7.16.0: + /@babel/plugin-syntax-typescript/7.16.0_@babel+core@7.16.5: resolution: {integrity: sha512-Xv6mEXqVdaqCBfJFyeab0fH2DnUoMsDmhamxsSi4j8nLd4Vtw213WMJr55xxqipC/YVWyPY3K0blJncPYji+dQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 + '@babel/core': 7.16.5 '@babel/helper-plugin-utils': 7.14.5 - /@babel/plugin-transform-react-jsx-development/7.16.0_@babel+core@7.16.0: - resolution: {integrity: sha512-qq65iSqBRq0Hr3wq57YG2AmW0H6wgTnIzpffTphrUWUgLCOK+zf1f7G0vuOiXrp7dU1qq+fQBoqZ3wCDAkhFzw==} + /@babel/plugin-transform-react-jsx-development/7.16.5_@babel+core@7.16.5: + resolution: {integrity: sha512-uQSLacMZSGLCxOw20dzo1dmLlKkd+DsayoV54q3MHXhbqgPzoiGerZQgNPl/Ro8/OcXV2ugfnkx+rxdS0sN5Uw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/plugin-transform-react-jsx': 7.16.0_@babel+core@7.16.0 + '@babel/core': 7.16.5 + '@babel/plugin-transform-react-jsx': 7.16.5_@babel+core@7.16.5 dev: false - /@babel/plugin-transform-react-jsx-self/7.16.0_@babel+core@7.16.0: - resolution: {integrity: sha512-97yCFY+2GvniqOThOSjPor8xUoDiQ0STVWAQMl3pjhJoFVe5DuXDLZCRSZxu9clx+oRCbTiXGgKEG/Yoyo6Y+w==} + /@babel/plugin-transform-react-jsx-self/7.16.5_@babel+core@7.16.5: + resolution: {integrity: sha512-fvwq+jir1Vn4f5oBS0H/J/gD5CneTD53MHs+NMjlHcha4Sq35fwxI5RtmJGEBXO+M93f/eeD9cAhRPhmLyJiVw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: false - /@babel/plugin-transform-react-jsx-source/7.16.0_@babel+core@7.16.0: - resolution: {integrity: sha512-8yvbGGrHOeb/oyPc9tzNoe9/lmIjz3HLa9Nc5dMGDyNpGjfFrk8D2KdEq9NRkftZzeoQEW6yPQ29TMZtrLiUUA==} + /@babel/plugin-transform-react-jsx-source/7.16.5_@babel+core@7.16.5: + resolution: {integrity: sha512-/eP+nZywJntGLjSPjksAnM9/ELIs3RbiEuTu2/zAOzwwBcfiu+m/iptEq1lERUUtSXubYSHVnVHMr13GR+TwPw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 + '@babel/core': 7.16.5 + '@babel/helper-plugin-utils': 7.16.5 dev: false - /@babel/plugin-transform-react-jsx/7.16.0_@babel+core@7.16.0: - resolution: {integrity: sha512-rqDgIbukZ44pqq7NIRPGPGNklshPkvlmvqjdx3OZcGPk4zGIenYkxDTvl3LsSL8gqcc3ZzGmXPE6hR/u/voNOw==} + /@babel/plugin-transform-react-jsx/7.16.5_@babel+core@7.16.5: + resolution: {integrity: sha512-+arLIz1d7kmwX0fKxTxbnoeG85ONSnLpvdODa4P3pc1sS7CV1hfmtYWufkW/oYsPnkDrEeQFxhUWcFnrXW7jQQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 + '@babel/core': 7.16.5 '@babel/helper-annotate-as-pure': 7.16.0 '@babel/helper-module-imports': 7.16.0 - '@babel/helper-plugin-utils': 7.14.5 - '@babel/plugin-syntax-jsx': 7.16.0_@babel+core@7.16.0 + '@babel/helper-plugin-utils': 7.16.5 + '@babel/plugin-syntax-jsx': 7.16.5_@babel+core@7.16.5 '@babel/types': 7.16.0 dev: false - /@babel/plugin-transform-typescript/7.16.1_@babel+core@7.16.0: + /@babel/plugin-transform-typescript/7.16.1_@babel+core@7.16.5: resolution: {integrity: sha512-NO4XoryBng06jjw/qWEU2LhcLJr1tWkhpMam/H4eas/CDKMX/b2/Ylb6EI256Y7+FVPCawwSM1rrJNOpDiz+Lg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.16.0 - '@babel/helper-create-class-features-plugin': 7.16.0_@babel+core@7.16.0 + '@babel/core': 7.16.5 + '@babel/helper-create-class-features-plugin': 7.16.0_@babel+core@7.16.5 '@babel/helper-plugin-utils': 7.14.5 - '@babel/plugin-syntax-typescript': 7.16.0_@babel+core@7.16.0 + '@babel/plugin-syntax-typescript': 7.16.0_@babel+core@7.16.5 transitivePeerDependencies: - supports-color dev: false @@ -1368,8 +1425,8 @@ packages: dependencies: regenerator-runtime: 0.13.9 - /@babel/standalone/7.16.4: - resolution: {integrity: sha512-FDRLwjeQfPm5jaHNuB+vwNyGCp24Ah3kEsbLzKmh0eSru+QCr4DmjgbRPoz71AwXLVtXU+l/i7MlVlIj5XO7Gw==} + /@babel/standalone/7.16.6: + resolution: {integrity: sha512-wjildVe951w1IPEPN4G76j+y5JFZfJN9gdyP8o9zd61qbiVEecAgORKskK1D/7VrJZrZS+nxDbhj2akEFU2RJw==} engines: {node: '>=6.9.0'} dev: false @@ -1396,6 +1453,24 @@ packages: globals: 11.12.0 transitivePeerDependencies: - supports-color + dev: false + + /@babel/traverse/7.16.5: + resolution: {integrity: sha512-FOCODAzqUMROikDYLYxl4nmwiLlu85rNqBML/A5hKRVXG2LV8d0iMqgPzdYTcIpjZEBB7D6UDU9vxRZiriASdQ==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.16.0 + '@babel/generator': 7.16.5 + '@babel/helper-environment-visitor': 7.16.5 + '@babel/helper-function-name': 7.16.0 + '@babel/helper-hoist-variables': 7.16.0 + '@babel/helper-split-export-declaration': 7.16.0 + '@babel/parser': 7.16.6 + '@babel/types': 7.16.0 + debug: 4.3.3 + globals: 11.12.0 + transitivePeerDependencies: + - supports-color /@babel/types/7.16.0: resolution: {integrity: sha512-PJgg/k3SdLsGb3hhisFvtLOw5ts113klrpLuIPtCJIU+BB24fqq6lf8RWqKJEjzqXR9AEH1rIb5XTqwBHB+kQg==} @@ -1424,30 +1499,35 @@ packages: '@cspotcode/source-map-consumer': 0.8.0 dev: true - /@docsearch/css/1.0.0-alpha.28: - resolution: {integrity: sha512-1AhRzVdAkrWwhaxTX6/R7SnFHz8yLz1W8I/AldlTrfbNvZs9INk1FZiEFTJdgHaP68nhgQNWSGlQiDiI3y2RYg==} + /@docsearch/css/3.0.0-alpha.42: + resolution: {integrity: sha512-AGwI2AXUacYhVOHmYnsXoYDJKO6Ued2W+QO80GERbMLhC7GH5tfvtW5REs/s7jSdcU3vzFoxT8iPDBCh/PkrlQ==} dev: true - /@docsearch/js/1.0.0-alpha.28: - resolution: {integrity: sha512-2g7aPhBy7FoEyeZW2G3LYHWVa8CFvqyozEz8PXt3hyywdFcmEIqmoCRwn8kboVftrOKCjtPcuLCewsaBoB3uiw==} + /@docsearch/js/3.0.0-alpha.42: + resolution: {integrity: sha512-8rxxsvFKS5GzDX2MYMETeib4EOwAkoxVUHFP5R4tSENXojhuCEy3np+k3Q0c9WPT+MUmWLxKJab5jyl0jmaeBQ==} dependencies: - '@docsearch/react': 1.0.0-alpha.28 + '@docsearch/react': 3.0.0-alpha.42 preact: 10.5.15 transitivePeerDependencies: + - '@algolia/client-search' + - '@types/react' - react - react-dom dev: true - /@docsearch/react/1.0.0-alpha.28: - resolution: {integrity: sha512-XjJOnCBXn+UZmtuDmgzlVIHnnvh6yHVwG4aFq8AXN6xJEIX3f180FvGaowFWAxgdtHplJxFGux0Xx4piHqBzIw==} + /@docsearch/react/3.0.0-alpha.42: + resolution: {integrity: sha512-1aOslZJDxwUUcm2QRNmlEePUgL8P5fOAeFdOLDMctHQkV2iTja9/rKVbkP8FZbIUnZxuuCCn8ErLrjD/oXWOag==} peerDependencies: - react: ^16.8.0 - react-dom: ^16.8.0 + '@types/react': '>= 16.8.0 < 18.0.0' + react: '>= 16.8.0 < 18.0.0' + react-dom: '>= 16.8.0 < 18.0.0' dependencies: - '@docsearch/css': 1.0.0-alpha.28 - '@francoischalifour/autocomplete-core': 1.0.0-alpha.28 - '@francoischalifour/autocomplete-preset-algolia': 1.0.0-alpha.28 + '@algolia/autocomplete-core': 1.5.0 + '@algolia/autocomplete-preset-algolia': 1.5.0_algoliasearch@4.11.0 + '@docsearch/css': 3.0.0-alpha.42 algoliasearch: 4.11.0 + transitivePeerDependencies: + - '@algolia/client-search' dev: true /@emotion/babel-plugin/11.3.0: @@ -1530,13 +1610,13 @@ packages: resolution: {integrity: sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==} dev: false - /@eslint/eslintrc/1.0.4: - resolution: {integrity: sha512-h8Vx6MdxwWI2WM8/zREHMoqdgLNXEL4QX3MWSVMdyNJGvXVOs+6lp+m2hc3FnuMHDc4poxFNI20vCk0OmI4G0Q==} + /@eslint/eslintrc/1.0.5: + resolution: {integrity: sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.2 - espree: 9.1.0 + debug: 4.3.3 + espree: 9.2.0 globals: 13.12.0 ignore: 4.0.6 import-fresh: 3.3.0 @@ -1547,20 +1627,12 @@ packages: - supports-color dev: true - /@francoischalifour/autocomplete-core/1.0.0-alpha.28: - resolution: {integrity: sha512-rL9x+72btViw+9icfBKUJjZj87FgjFrD2esuTUqtj4RAX3s4AuVZiN8XEsfjQBSc6qJk31cxlvqZHC/BIyYXgg==} - dev: true - - /@francoischalifour/autocomplete-preset-algolia/1.0.0-alpha.28: - resolution: {integrity: sha512-bprfNmYt1opFUFEtD2XfY/kEsm13bzHQgU80uMjhuK0DJ914IjolT1GytpkdM6tJ4MBvyiJPP+bTtWO+BZ7c7w==} - dev: true - - /@humanwhocodes/config-array/0.6.0: - resolution: {integrity: sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A==} + /@humanwhocodes/config-array/0.9.2: + resolution: {integrity: sha512-UXOuFCGcwciWckOpmfKDq/GyhlTf9pN/BzG//x8p8zTOFEcGuA68ANXheFS0AGvy3qgZqLBUkMs7hqzqCKOVwA==} engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.2 + debug: 4.3.3 minimatch: 3.0.4 transitivePeerDependencies: - supports-color @@ -1595,20 +1667,20 @@ packages: engines: {node: '>=8'} dev: true - /@jest/console/27.3.1: - resolution: {integrity: sha512-RkFNWmv0iui+qsOr/29q9dyfKTTT5DCuP31kUwg7rmOKPT/ozLeGLKJKVIiOfbiKyleUZKIrHwhmiZWVe8IMdw==} + /@jest/console/27.4.2: + resolution: {integrity: sha512-xknHThRsPB/To1FUbi6pCe43y58qFC03zfb6R7fDb/FfC7k2R3i1l+izRBJf8DI46KhYGRaF14Eo9A3qbBoixg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/types': 27.2.5 - '@types/node': 16.11.9 + '@jest/types': 27.4.2 + '@types/node': 16.11.14 chalk: 4.1.2 - jest-message-util: 27.3.1 - jest-util: 27.3.1 + jest-message-util: 27.4.2 + jest-util: 27.4.2 slash: 3.0.0 dev: true - /@jest/core/27.3.1_ts-node@10.4.0: - resolution: {integrity: sha512-DMNE90RR5QKx0EA+wqe3/TNEwiRpOkhshKNxtLxd4rt3IZpCt+RSL+FoJsGeblRZmqdK4upHA/mKKGPPRAifhg==} + /@jest/core/27.4.5_ts-node@10.4.0: + resolution: {integrity: sha512-3tm/Pevmi8bDsgvo73nX8p/WPng6KWlCyScW10FPEoN1HU4pwI83tJ3TsFvi1FfzsjwUlMNEPowgb/rPau/LTQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} peerDependencies: node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 @@ -1616,30 +1688,30 @@ packages: node-notifier: optional: true dependencies: - '@jest/console': 27.3.1 - '@jest/reporters': 27.3.1 - '@jest/test-result': 27.3.1 - '@jest/transform': 27.3.1 - '@jest/types': 27.2.5 - '@types/node': 16.11.9 + '@jest/console': 27.4.2 + '@jest/reporters': 27.4.5 + '@jest/test-result': 27.4.2 + '@jest/transform': 27.4.5 + '@jest/types': 27.4.2 + '@types/node': 16.11.14 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.8.1 exit: 0.1.2 graceful-fs: 4.2.8 - jest-changed-files: 27.3.0 - jest-config: 27.3.1_ts-node@10.4.0 - jest-haste-map: 27.3.1 - jest-message-util: 27.3.1 - jest-regex-util: 27.0.6 - jest-resolve: 27.3.1 - jest-resolve-dependencies: 27.3.1 - jest-runner: 27.3.1 - jest-runtime: 27.3.1 - jest-snapshot: 27.3.1 - jest-util: 27.3.1 - jest-validate: 27.3.1 - jest-watcher: 27.3.1 + jest-changed-files: 27.4.2 + jest-config: 27.4.5_ts-node@10.4.0 + jest-haste-map: 27.4.5 + jest-message-util: 27.4.2 + jest-regex-util: 27.4.0 + jest-resolve: 27.4.5 + jest-resolve-dependencies: 27.4.5 + jest-runner: 27.4.5 + jest-runtime: 27.4.5 + jest-snapshot: 27.4.5 + jest-util: 27.4.2 + jest-validate: 27.4.2 + jest-watcher: 27.4.2 micromatch: 4.0.4 rimraf: 3.0.2 slash: 3.0.0 @@ -1652,61 +1724,39 @@ packages: - utf-8-validate dev: true - /@jest/environment/27.3.1: - resolution: {integrity: sha512-BCKCj4mOVLme6Tanoyc9k0ultp3pnmuyHw73UHRPeeZxirsU/7E3HC4le/VDb/SMzE1JcPnto+XBKFOcoiJzVw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/fake-timers': 27.3.1 - '@jest/types': 27.2.5 - '@types/node': 16.11.9 - jest-mock: 27.3.0 - dev: true - - /@jest/environment/27.4.2: - resolution: {integrity: sha512-uSljKxh/rGlHlmhyeG4ZoVK9hOec+EPBkwTHkHKQ2EqDu5K+MaG9uJZ8o1CbRsSdZqSuhXvJCYhBWsORPPg6qw==} + /@jest/environment/27.4.4: + resolution: {integrity: sha512-q+niMx7cJgt/t/b6dzLOh4W8Ef/8VyKG7hxASK39jakijJzbFBGpptx3RXz13FFV7OishQ9lTbv+dQ5K3EhfDQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/fake-timers': 27.4.2 '@jest/types': 27.4.2 - '@types/node': 16.11.9 + '@types/node': 16.11.14 jest-mock: 27.4.2 dev: true - /@jest/fake-timers/27.3.1: - resolution: {integrity: sha512-M3ZFgwwlqJtWZ+QkBG5NmC23A9w+A6ZxNsO5nJxJsKYt4yguBd3i8TpjQz5NfCX91nEve1KqD9RA2Q+Q1uWqoA==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.2.5 - '@sinonjs/fake-timers': 8.1.0 - '@types/node': 16.11.9 - jest-message-util: 27.3.1 - jest-mock: 27.3.0 - jest-util: 27.3.1 - dev: true - /@jest/fake-timers/27.4.2: resolution: {integrity: sha512-f/Xpzn5YQk5adtqBgvw1V6bF8Nx3hY0OIRRpCvWcfPl0EAjdqWPdhH3t/3XpiWZqtjIEHDyMKP9ajpva1l4Zmg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.4.2 '@sinonjs/fake-timers': 8.1.0 - '@types/node': 16.11.9 + '@types/node': 16.11.14 jest-message-util: 27.4.2 jest-mock: 27.4.2 jest-util: 27.4.2 dev: true - /@jest/globals/27.3.1: - resolution: {integrity: sha512-Q651FWiWQAIFiN+zS51xqhdZ8g9b88nGCobC87argAxA7nMfNQq0Q0i9zTfQYgLa6qFXk2cGANEqfK051CZ8Pg==} + /@jest/globals/27.4.4: + resolution: {integrity: sha512-bqpqQhW30BOreXM8bA8t8JbOQzsq/WnPTnBl+It3UxAD9J8yxEAaBEylHx1dtBapAr/UBk8GidXbzmqnee8tYQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/environment': 27.3.1 - '@jest/types': 27.2.5 - expect: 27.3.1 + '@jest/environment': 27.4.4 + '@jest/types': 27.4.2 + expect: 27.4.2 dev: true - /@jest/reporters/27.3.1: - resolution: {integrity: sha512-m2YxPmL9Qn1emFVgZGEiMwDntDxRRQ2D58tiDQlwYTg5GvbFOKseYCcHtn0WsI8CG4vzPglo3nqbOiT8ySBT/w==} + /@jest/reporters/27.4.5: + resolution: {integrity: sha512-3orsG4vi8zXuBqEoy2LbnC1kuvkg1KQUgqNxmxpQgIOQEPeV0onvZu+qDQnEoX8qTQErtqn/xzcnbpeTuOLSiA==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} peerDependencies: node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 @@ -1715,11 +1765,11 @@ packages: optional: true dependencies: '@bcoe/v8-coverage': 0.2.3 - '@jest/console': 27.3.1 - '@jest/test-result': 27.3.1 - '@jest/transform': 27.3.1 - '@jest/types': 27.2.5 - '@types/node': 16.11.9 + '@jest/console': 27.4.2 + '@jest/test-result': 27.4.2 + '@jest/transform': 27.4.5 + '@jest/types': 27.4.2 + '@types/node': 16.11.14 chalk: 4.1.2 collect-v8-coverage: 1.0.1 exit: 0.1.2 @@ -1730,10 +1780,10 @@ packages: istanbul-lib-report: 3.0.0 istanbul-lib-source-maps: 4.0.1 istanbul-reports: 3.0.5 - jest-haste-map: 27.3.1 - jest-resolve: 27.3.1 - jest-util: 27.3.1 - jest-worker: 27.3.1 + jest-haste-map: 27.4.5 + jest-resolve: 27.4.5 + jest-util: 27.4.2 + jest-worker: 27.4.5 slash: 3.0.0 source-map: 0.6.1 string-length: 4.0.2 @@ -1743,8 +1793,8 @@ packages: - supports-color dev: true - /@jest/source-map/27.0.6: - resolution: {integrity: sha512-Fek4mi5KQrqmlY07T23JRi0e7Z9bXTOOD86V/uS0EIW4PClvPDqZOyFlLpNJheS6QI0FNX1CgmPjtJ4EA/2M+g==} + /@jest/source-map/27.4.0: + resolution: {integrity: sha512-Ntjx9jzP26Bvhbm93z/AKcPRj/9wrkI88/gK60glXDx1q+IeI0rf7Lw2c89Ch6ofonB0On/iRDreQuQ6te9pgQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: callsites: 3.1.0 @@ -1752,42 +1802,42 @@ packages: source-map: 0.6.1 dev: true - /@jest/test-result/27.3.1: - resolution: {integrity: sha512-mLn6Thm+w2yl0opM8J/QnPTqrfS4FoXsXF2WIWJb2O/GBSyResL71BRuMYbYRsGt7ELwS5JGcEcGb52BNrumgg==} + /@jest/test-result/27.4.2: + resolution: {integrity: sha512-kr+bCrra9jfTgxHXHa2UwoQjxvQk3Am6QbpAiJ5x/50LW8llOYrxILkqY0lZRW/hu8FXesnudbql263+EW9iNA==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/console': 27.3.1 - '@jest/types': 27.2.5 + '@jest/console': 27.4.2 + '@jest/types': 27.4.2 '@types/istanbul-lib-coverage': 2.0.3 collect-v8-coverage: 1.0.1 dev: true - /@jest/test-sequencer/27.3.1: - resolution: {integrity: sha512-siySLo07IMEdSjA4fqEnxfIX8lB/lWYsBPwNFtkOvsFQvmBrL3yj3k3uFNZv/JDyApTakRpxbKLJ3CT8UGVCrA==} + /@jest/test-sequencer/27.4.5: + resolution: {integrity: sha512-n5woIn/1v+FT+9hniymHPARA9upYUmfi5Pw9ewVwXCDlK4F5/Gkees9v8vdjGdAIJ2MPHLHodiajLpZZanWzEQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/test-result': 27.3.1 + '@jest/test-result': 27.4.2 graceful-fs: 4.2.8 - jest-haste-map: 27.3.1 - jest-runtime: 27.3.1 + jest-haste-map: 27.4.5 + jest-runtime: 27.4.5 transitivePeerDependencies: - supports-color dev: true - /@jest/transform/27.3.1: - resolution: {integrity: sha512-3fSvQ02kuvjOI1C1ssqMVBKJpZf6nwoCiSu00zAKh5nrp3SptNtZy/8s5deayHnqxhjD9CWDJ+yqQwuQ0ZafXQ==} + /@jest/transform/27.4.5: + resolution: {integrity: sha512-PuMet2UlZtlGzwc6L+aZmR3I7CEBpqadO03pU40l2RNY2fFJ191b9/ITB44LNOhVtsyykx0OZvj0PCyuLm7Eew==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@babel/core': 7.16.0 - '@jest/types': 27.2.5 + '@babel/core': 7.16.5 + '@jest/types': 27.4.2 babel-plugin-istanbul: 6.1.1 chalk: 4.1.2 convert-source-map: 1.8.0 fast-json-stable-stringify: 2.1.0 graceful-fs: 4.2.8 - jest-haste-map: 27.3.1 - jest-regex-util: 27.0.6 - jest-util: 27.3.1 + jest-haste-map: 27.4.5 + jest-regex-util: 27.4.0 + jest-util: 27.4.2 micromatch: 4.0.4 pirates: 4.0.1 slash: 3.0.0 @@ -1797,24 +1847,13 @@ packages: - supports-color dev: true - /@jest/types/27.2.5: - resolution: {integrity: sha512-nmuM4VuDtCZcY+eTpw+0nvstwReMsjPoj7ZR80/BbixulhLaiX+fbv8oeLW8WZlJMcsGQsTmMKT/iTZu1Uy/lQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@types/istanbul-lib-coverage': 2.0.3 - '@types/istanbul-reports': 3.0.1 - '@types/node': 16.11.9 - '@types/yargs': 16.0.4 - chalk: 4.1.2 - dev: true - /@jest/types/27.4.2: resolution: {integrity: sha512-j35yw0PMTPpZsUoOBiuHzr1zTYoad1cVIE0ajEjcrJONxxrko/IRGKkXx3os0Nsi4Hu3+5VmDbVfq5WhG/pWAg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@types/istanbul-lib-coverage': 2.0.3 '@types/istanbul-reports': 3.0.1 - '@types/node': 16.11.9 + '@types/node': 16.11.14 '@types/yargs': 16.0.4 chalk: 4.1.2 dev: true @@ -1841,30 +1880,30 @@ packages: - supports-color dev: false - /@microsoft/api-extractor-model/7.13.16: - resolution: {integrity: sha512-ttdxVXsTWL5dd26W1YNLe3LgDsE0EE273aZlcLe58W0opymBybCYU1Mn+OHQM8BuErrdvdN8LdpWAAbkiOEN/Q==} + /@microsoft/api-extractor-model/7.15.1: + resolution: {integrity: sha512-DWfS1o3oMY0mzdO3OuQbD/9vzn80jwM6tFd7XbiYnkpxwhD83LMGXz7NZWwSh+IaA+9w3LF4w62fT31Qq+dAMw==} dependencies: '@microsoft/tsdoc': 0.13.2 '@microsoft/tsdoc-config': 0.15.2 - '@rushstack/node-core-library': 3.43.2 + '@rushstack/node-core-library': 3.44.2 dev: true - /@microsoft/api-extractor/7.18.19: - resolution: {integrity: sha512-aY+/XR7PtQXtnqNPFRs3/+iVRlQJpo6uLTjO2g7PqmnMywl3GBU3bCgAlV/khZtAQbIs6Le57XxmSE6rOqbcfg==} + /@microsoft/api-extractor/7.19.2: + resolution: {integrity: sha512-LxSa9lwp7eYtM4i5y/1n79QpotPKlmpCrVQbkb0LAHE1sCRHpZDTb6p3cMJthDhYPMjAYKOLfq639GwtZrg23Q==} hasBin: true dependencies: - '@microsoft/api-extractor-model': 7.13.16 + '@microsoft/api-extractor-model': 7.15.1 '@microsoft/tsdoc': 0.13.2 '@microsoft/tsdoc-config': 0.15.2 - '@rushstack/node-core-library': 3.43.2 - '@rushstack/rig-package': 0.3.5 - '@rushstack/ts-command-line': 4.10.4 + '@rushstack/node-core-library': 3.44.2 + '@rushstack/rig-package': 0.3.6 + '@rushstack/ts-command-line': 4.10.5 colors: 1.2.5 lodash: 4.17.21 resolve: 1.17.0 semver: 7.3.5 source-map: 0.6.1 - typescript: 4.4.4 + typescript: 4.5.4 dev: true /@microsoft/tsdoc-config/0.15.2: @@ -1987,8 +2026,8 @@ packages: rollup: 2.59.0 dev: true - /@rollup/plugin-node-resolve/13.0.6_rollup@2.59.0: - resolution: {integrity: sha512-sFsPDMPd4gMqnh2gS0uIxELnoRUp5kBl5knxD2EO0778G1oOJv4G1vyT2cpWz75OU2jDVcXhjVUuTAczGyFNKA==} + /@rollup/plugin-node-resolve/13.1.1_rollup@2.59.0: + resolution: {integrity: sha512-6QKtRevXLrmEig9UiMYt2fSvee9TyltGRfw+qSs6xjUnxwjOzTOqy+/Lpxsgjb8mJn1EQNbCDAvt89O4uzL5kw==} engines: {node: '>= 10.0.0'} peerDependencies: rollup: ^2.42.0 @@ -2029,15 +2068,15 @@ packages: rollup: 2.59.0 dev: true - /@rollup/pluginutils/4.1.1: - resolution: {integrity: sha512-clDjivHqWGXi7u+0d2r2sBi4Ie6VLEAzWMIkvJLnDmxoOhBYOTfzGbOQBA32THHm11/LiJbd01tJUpJsbshSWQ==} + /@rollup/pluginutils/4.1.2: + resolution: {integrity: sha512-ROn4qvkxP9SyPeHaf7uQC/GPFY6L/OWy9+bd9AwcjOAWQwxRscoEyAUD8qCY5o5iL4jqQwoLk2kaTKJPb/HwzQ==} engines: {node: '>= 8.0.0'} dependencies: estree-walker: 2.0.2 picomatch: 2.3.0 - /@rushstack/node-core-library/3.43.2: - resolution: {integrity: sha512-b7AEhSf6CvZgvuDcWMFDeKx2mQSn9AVnMQVyxNxFeHCtLz3gJicqCOlw2GOXM8HKh6PInLdil/NVCDcstwSrIw==} + /@rushstack/node-core-library/3.44.2: + resolution: {integrity: sha512-lQ8Ct267UKkNSJSDxpBWn7SyyITWQ9l3Xqww0V+YY0rMt02r9eiGvwwPaU1ugJW7IMVo6r/HXvgbmpOSPyzGyg==} dependencies: '@types/node': 12.20.24 colors: 1.2.5 @@ -2047,18 +2086,18 @@ packages: resolve: 1.17.0 semver: 7.3.5 timsort: 0.3.0 - z-schema: 3.18.4 + z-schema: 5.0.2 dev: true - /@rushstack/rig-package/0.3.5: - resolution: {integrity: sha512-CvqWw+E81U5lRBN/lUj7Ngr/XQa/PPb2jAS5QcLP7WL+IMUl+3+Cc2qYrsDoB4zke81kz+usWGmBQpBzGMLmAA==} + /@rushstack/rig-package/0.3.6: + resolution: {integrity: sha512-H/uFsAT6cD4JCYrlQXYMZg+wPVECByFoJLGqfGRiTwSS5ngQw9QxnFV2mPG2LrxFUsMjLQ2lsrYr523700XzfA==} dependencies: resolve: 1.17.0 strip-json-comments: 3.1.1 dev: true - /@rushstack/ts-command-line/4.10.4: - resolution: {integrity: sha512-4T5ao4UgDb6LmiRj4GumvG3VT/p6RSMgl7TN7S58ifaAGN2GeTNBajFCDdJs9QQP0d/4tA5p0SFzT7Ps5Byirg==} + /@rushstack/ts-command-line/4.10.5: + resolution: {integrity: sha512-5fVlTDbKsJ5WyT6L7NrnOlLG3uoITKxoqTPP2j0QZEi95kPbVT4+VPZaXXDJtkrao9qrIyig8pLK9WABY1bb3w==} dependencies: '@types/argparse': 1.0.38 argparse: 1.0.10 @@ -2110,7 +2149,7 @@ packages: /@types/babel__core/7.1.16: resolution: {integrity: sha512-EAEHtisTMM+KaKwfWdC3oyllIqswlznXCIVCt7/oRNrh+DhgT4UEBNC/jlADNjvw7UnfbcdkGQcPVZ1xYiLcrQ==} dependencies: - '@babel/parser': 7.16.2 + '@babel/parser': 7.16.6 '@babel/types': 7.16.0 '@types/babel__generator': 7.6.3 '@types/babel__template': 7.4.1 @@ -2126,7 +2165,7 @@ packages: /@types/babel__template/7.4.1: resolution: {integrity: sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==} dependencies: - '@babel/parser': 7.16.2 + '@babel/parser': 7.16.6 '@babel/types': 7.16.0 dev: true @@ -2161,19 +2200,19 @@ packages: /@types/etag/1.8.1: resolution: {integrity: sha512-bsKkeSqN7HYyYntFRAmzcwx/dKW4Wa+KVMTInANlI72PWLQmOpZu96j0OqHZGArW4VQwCmJPteQlXaUDeOB0WQ==} dependencies: - '@types/node': 16.11.9 + '@types/node': 16.11.14 dev: true /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 16.11.9 + '@types/node': 16.11.14 dev: true /@types/graceful-fs/4.1.5: resolution: {integrity: sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==} dependencies: - '@types/node': 16.11.9 + '@types/node': 16.11.14 dev: true /@types/hash-sum/1.0.0: @@ -2237,8 +2276,8 @@ packages: resolution: {integrity: sha512-qjd88DrCxupx/kJD5yQgZdcYKZKSIGBVDIBE1/LTGcNm3d2Np/jxojkdePDdfnBHJc5W7vSMpbJ1aB7p/Py69A==} dev: true - /@types/node/16.11.9: - resolution: {integrity: sha512-MKmdASMf3LtPzwLyRrFjtFFZ48cMf8jmX5VRYrDQiJa8Ybu5VAmkqBWqKU8fdCwD8ysw4mQ9nrEHvzg6gunR7A==} + /@types/node/16.11.14: + resolution: {integrity: sha512-mK6BKLpL0bG6v2CxHbm0ed6RcZrAtTHBTd/ZpnlVPVa3HkumsqLE4BC4u6TQ8D7pnrRbOU0am6epuALs+Ncnzw==} dev: true /@types/normalize-package-data/2.4.1: @@ -2255,17 +2294,17 @@ packages: /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: - '@types/node': 16.11.9 + '@types/node': 16.11.14 dev: true /@types/resolve/1.20.1: resolution: {integrity: sha512-Ku5+GPFa12S3W26Uwtw+xyrtIpaZsGYHH6zxNbZlstmlvMYSZRzOwzwsXbxlVUbHyUucctSyuFtu6bNxwYomIw==} dev: true - /@types/sass/1.43.0: - resolution: {integrity: sha512-DPSXNJ1rYLo88GyF9tuB4bsYGfpKI1a4+wOQmc+LI1SUoocm9QLRSpz0GxxuyjmJsYFIQo/dDlRSSpIXngff+w==} + /@types/sass/1.43.1: + resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==} dependencies: - '@types/node': 16.11.9 + '@types/node': 16.11.14 dev: true /@types/semver/7.3.9: @@ -2283,13 +2322,13 @@ packages: /@types/stylus/0.48.36: resolution: {integrity: sha512-7klEq45BUE8ZJWkYWy1E442DcCs0wi0FkFY1Tjr6EJ7edL77t9w/QmOwlkFumBMqHlatDBtrA2xgfRrGqkUkzg==} dependencies: - '@types/node': 16.11.9 + '@types/node': 16.11.14 dev: true /@types/ws/8.2.2: resolution: {integrity: sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==} dependencies: - '@types/node': 16.11.9 + '@types/node': 16.11.14 dev: true /@types/yargs-parser/20.2.1: @@ -2306,12 +2345,12 @@ packages: resolution: {integrity: sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==} requiresBuild: true dependencies: - '@types/node': 16.11.9 + '@types/node': 16.11.14 dev: true optional: true - /@typescript-eslint/eslint-plugin/5.4.0_8fbd82ef37e23da98dfca9805cf945cd: - resolution: {integrity: sha512-9/yPSBlwzsetCsGEn9j24D8vGQgJkOTr4oMLas/w886ZtzKIs1iyoqFrwsX2fqYEeUwsdBpC21gcjRGo57u0eg==} + /@typescript-eslint/eslint-plugin/5.7.0_d7a0d6b59468b4d2ea38f782f4f112e3: + resolution: {integrity: sha512-8RTGBpNn5a9M628wBPrCbJ+v3YTEOE2qeZb7TDkGKTDXSj36KGRg92SpFFaR/0S3rSXQxM0Og/kV9EyadsYSBg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -2321,11 +2360,11 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/experimental-utils': 5.4.0_eslint@8.3.0+typescript@4.4.4 - '@typescript-eslint/parser': 5.4.0_eslint@8.3.0+typescript@4.4.4 - '@typescript-eslint/scope-manager': 5.4.0 - debug: 4.3.2 - eslint: 8.3.0 + '@typescript-eslint/experimental-utils': 5.7.0_eslint@8.4.1+typescript@4.4.4 + '@typescript-eslint/parser': 5.7.0_eslint@8.4.1+typescript@4.4.4 + '@typescript-eslint/scope-manager': 5.7.0 + debug: 4.3.3 + eslint: 8.4.1 functional-red-black-tree: 1.0.1 ignore: 5.1.9 regexpp: 3.2.0 @@ -2336,26 +2375,26 @@ packages: - supports-color dev: true - /@typescript-eslint/experimental-utils/5.4.0_eslint@8.3.0+typescript@4.4.4: - resolution: {integrity: sha512-Nz2JDIQUdmIGd6p33A+naQmwfkU5KVTLb/5lTk+tLVTDacZKoGQisj8UCxk7onJcrgjIvr8xWqkYI+DbI3TfXg==} + /@typescript-eslint/experimental-utils/5.7.0_eslint@8.4.1+typescript@4.4.4: + resolution: {integrity: sha512-u57eZ5FbEpzN5kSjmVrSesovWslH2ZyNPnaXQMXWgH57d5+EVHEt76W75vVuI9qKZ5BMDKNfRN+pxcPEjQjb2A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' dependencies: '@types/json-schema': 7.0.9 - '@typescript-eslint/scope-manager': 5.4.0 - '@typescript-eslint/types': 5.4.0 - '@typescript-eslint/typescript-estree': 5.4.0_typescript@4.4.4 - eslint: 8.3.0 + '@typescript-eslint/scope-manager': 5.7.0 + '@typescript-eslint/types': 5.7.0 + '@typescript-eslint/typescript-estree': 5.7.0_typescript@4.4.4 + eslint: 8.4.1 eslint-scope: 5.1.1 - eslint-utils: 3.0.0_eslint@8.3.0 + eslint-utils: 3.0.0_eslint@8.4.1 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/parser/5.4.0_eslint@8.3.0+typescript@4.4.4: - resolution: {integrity: sha512-JoB41EmxiYpaEsRwpZEYAJ9XQURPFer8hpkIW9GiaspVLX8oqbqNM8P4EP8HOZg96yaALiLEVWllA2E8vwsIKw==} + /@typescript-eslint/parser/5.7.0_eslint@8.4.1+typescript@4.4.4: + resolution: {integrity: sha512-m/gWCCcS4jXw6vkrPQ1BjZ1vomP01PArgzvauBqzsoZ3urLbsRChexB8/YV8z9HwE3qlJM35FxfKZ1nfP/4x8g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -2364,31 +2403,31 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.4.0 - '@typescript-eslint/types': 5.4.0 - '@typescript-eslint/typescript-estree': 5.4.0_typescript@4.4.4 - debug: 4.3.2 - eslint: 8.3.0 + '@typescript-eslint/scope-manager': 5.7.0 + '@typescript-eslint/types': 5.7.0 + '@typescript-eslint/typescript-estree': 5.7.0_typescript@4.4.4 + debug: 4.3.3 + eslint: 8.4.1 typescript: 4.4.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager/5.4.0: - resolution: {integrity: sha512-pRxFjYwoi8R+n+sibjgF9iUiAELU9ihPBtHzocyW8v8D8G8KeQvXTsW7+CBYIyTYsmhtNk50QPGLE3vrvhM5KA==} + /@typescript-eslint/scope-manager/5.7.0: + resolution: {integrity: sha512-7mxR520DGq5F7sSSgM0HSSMJ+TFUymOeFRMfUfGFAVBv8BR+Jv1vHgAouYUvWRZeszVBJlLcc9fDdktxb5kmxA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.4.0 - '@typescript-eslint/visitor-keys': 5.4.0 + '@typescript-eslint/types': 5.7.0 + '@typescript-eslint/visitor-keys': 5.7.0 dev: true - /@typescript-eslint/types/5.4.0: - resolution: {integrity: sha512-GjXNpmn+n1LvnttarX+sPD6+S7giO+9LxDIGlRl4wK3a7qMWALOHYuVSZpPTfEIklYjaWuMtfKdeByx0AcaThA==} + /@typescript-eslint/types/5.7.0: + resolution: {integrity: sha512-5AeYIF5p2kAneIpnLFve8g50VyAjq7udM7ApZZ9JYjdPjkz0LvODfuSHIDUVnIuUoxafoWzpFyU7Sqbxgi79mA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.4.0_typescript@4.4.4: - resolution: {integrity: sha512-nhlNoBdhKuwiLMx6GrybPT3SFILm5Gij2YBdPEPFlYNFAXUJWX6QRgvi/lwVoadaQEFsizohs6aFRMqsXI2ewA==} + /@typescript-eslint/typescript-estree/5.7.0_typescript@4.4.4: + resolution: {integrity: sha512-aO1Ql+izMrTnPj5aFFlEJkpD4jRqC4Gwhygu2oHK2wfVQpmOPbyDSveJ+r/NQo+PWV43M6uEAeLVbTi09dFLhg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -2396,9 +2435,9 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.4.0 - '@typescript-eslint/visitor-keys': 5.4.0 - debug: 4.3.2 + '@typescript-eslint/types': 5.7.0 + '@typescript-eslint/visitor-keys': 5.7.0 + debug: 4.3.3 globby: 11.0.4 is-glob: 4.0.3 semver: 7.3.5 @@ -2408,11 +2447,11 @@ packages: - supports-color dev: true - /@typescript-eslint/visitor-keys/5.4.0: - resolution: {integrity: sha512-PVbax7MeE7tdLfW5SA0fs8NGVVr+buMPrcj+CWYWPXsZCH8qZ1THufDzbXm1xrZ2b2PA1iENJ0sRq5fuUtvsJg==} + /@typescript-eslint/visitor-keys/5.7.0: + resolution: {integrity: sha512-hdohahZ4lTFcglZSJ3DGdzxQHBSxsLVqHzkiOmKi7xVAWC4y2c1bIMKmPJSrA4aOEoRUPOKQ87Y/taC7yVHpFg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.4.0 + '@typescript-eslint/types': 5.7.0 eslint-visitor-keys: 3.1.0 dev: true @@ -2420,11 +2459,11 @@ packages: resolution: {integrity: sha512-hz4R8tS5jMn8lDq6iD+yWL6XNB699pGIVLk7WSJnn1dbpjaazsjZQkieJoRX6gW5zpYSCFqQ7jUquPNY65tQYA==} dev: false - /@vue/babel-plugin-jsx/1.1.1_@babel+core@7.16.0: + /@vue/babel-plugin-jsx/1.1.1_@babel+core@7.16.5: resolution: {integrity: sha512-j2uVfZjnB5+zkcbc/zsOc0fSNGCMMjaEXP52wdwdIfn0qjFfEYpYZBFKFg+HHnQeJCVrjOeO0YxgaL7DMrym9w==} dependencies: '@babel/helper-module-imports': 7.16.0 - '@babel/plugin-syntax-jsx': 7.16.0_@babel+core@7.16.0 + '@babel/plugin-syntax-jsx': 7.16.0_@babel+core@7.16.5 '@babel/template': 7.16.0 '@babel/traverse': 7.16.0 '@babel/types': 7.16.0 @@ -2437,24 +2476,6 @@ packages: - supports-color dev: false - /@vue/compiler-core/3.2.21: - resolution: {integrity: sha512-NhhiQZNG71KNq1h5pMW/fAXdTF7lJRaSI7LDm2edhHXVz1ROMICo8SreUmQnSf4Fet0UPBVqJ988eF4+936iDQ==} - dependencies: - '@babel/parser': 7.16.2 - '@vue/shared': 3.2.21 - estree-walker: 2.0.2 - source-map: 0.6.1 - dev: true - - /@vue/compiler-core/3.2.22: - resolution: {integrity: sha512-uAkovrVeTcjzpiM4ECmVaMrv/bjdgAaLzvjcGqQPBEyUrcqsCgccT9fHJ/+hWVGhyMahmBwLqcn4guULNx7sdw==} - dependencies: - '@babel/parser': 7.16.2 - '@vue/shared': 3.2.22 - estree-walker: 2.0.2 - source-map: 0.6.1 - dev: true - /@vue/compiler-core/3.2.25: resolution: {integrity: sha512-FlffKezIqztTCTyG0klkYRwhdyL6b1PTTCIerPb4p2R9qQaczccTX5g9ysi9w6tpLQ48a1WiXnFDJhWD7XoqwA==} dependencies: @@ -2463,18 +2484,13 @@ packages: estree-walker: 2.0.2 source-map: 0.6.1 - /@vue/compiler-dom/3.2.21: - resolution: {integrity: sha512-gsJD3DpYZSYquiA7UIPsMDSlAooYWDvHPq9VRsqzJEk2PZtFvLvHPb4aaMD8Ufd62xzYn32cnnkzsEOJhyGilA==} + /@vue/compiler-core/3.2.26: + resolution: {integrity: sha512-N5XNBobZbaASdzY9Lga2D9Lul5vdCIOXvUMd6ThcN8zgqQhPKfCV+wfAJNNJKQkSHudnYRO2gEB+lp0iN3g2Tw==} dependencies: - '@vue/compiler-core': 3.2.21 - '@vue/shared': 3.2.21 - dev: true - - /@vue/compiler-dom/3.2.22: - resolution: {integrity: sha512-VZdsw/VuO1ODs8K7NQwnMQzKITDkIFlYYC03SVnunuf6eNRxBPEonSyqbWNoo6qNaHAEBTG6VVcZC5xC9bAx1g==} - dependencies: - '@vue/compiler-core': 3.2.22 - '@vue/shared': 3.2.22 + '@babel/parser': 7.16.6 + '@vue/shared': 3.2.26 + estree-walker: 2.0.2 + source-map: 0.6.1 dev: true /@vue/compiler-dom/3.2.25: @@ -2483,19 +2499,11 @@ packages: '@vue/compiler-core': 3.2.25 '@vue/shared': 3.2.25 - /@vue/compiler-sfc/3.2.21: - resolution: {integrity: sha512-+yDlUSebKpz/ovxM2vLRRx7w/gVfY767pOfYTgbIhAs+ogvIV2BsIt4fpxlThnlCNChJ+yE0ERUNoROv2kEGEQ==} + /@vue/compiler-dom/3.2.26: + resolution: {integrity: sha512-smBfaOW6mQDxcT3p9TKT6mE22vjxjJL50GFVJiI0chXYGU/xzC05QRGrW3HHVuJrmLTLx5zBhsZ2dIATERbarg==} dependencies: - '@babel/parser': 7.16.2 - '@vue/compiler-core': 3.2.21 - '@vue/compiler-dom': 3.2.21 - '@vue/compiler-ssr': 3.2.21 - '@vue/ref-transform': 3.2.21 - '@vue/shared': 3.2.21 - estree-walker: 2.0.2 - magic-string: 0.25.7 - postcss: 8.3.11 - source-map: 0.6.1 + '@vue/compiler-core': 3.2.26 + '@vue/shared': 3.2.26 dev: true /@vue/compiler-sfc/3.2.25: @@ -2512,11 +2520,19 @@ packages: postcss: 8.3.11 source-map: 0.6.1 - /@vue/compiler-ssr/3.2.21: - resolution: {integrity: sha512-eU+A0iWYy+1zAo2CRIJ0zSVlv1iuGAIbNRCnllSJ31pV1lX3jypJYzGbJlSRAbB7VP6E+tYveVT1Oq8JKewa3g==} + /@vue/compiler-sfc/3.2.26: + resolution: {integrity: sha512-ePpnfktV90UcLdsDQUh2JdiTuhV0Skv2iYXxfNMOK/F3Q+2BO0AulcVcfoksOpTJGmhhfosWfMyEaEf0UaWpIw==} dependencies: - '@vue/compiler-dom': 3.2.21 - '@vue/shared': 3.2.21 + '@babel/parser': 7.16.6 + '@vue/compiler-core': 3.2.26 + '@vue/compiler-dom': 3.2.26 + '@vue/compiler-ssr': 3.2.26 + '@vue/reactivity-transform': 3.2.26 + '@vue/shared': 3.2.26 + estree-walker: 2.0.2 + magic-string: 0.25.7 + postcss: 8.3.11 + source-map: 0.6.1 dev: true /@vue/compiler-ssr/3.2.25: @@ -2525,6 +2541,13 @@ packages: '@vue/compiler-dom': 3.2.25 '@vue/shared': 3.2.25 + /@vue/compiler-ssr/3.2.26: + resolution: {integrity: sha512-2mywLX0ODc4Zn8qBoA2PDCsLEZfpUGZcyoFRLSOjyGGK6wDy2/5kyDOWtf0S0UvtoyVq95OTSGIALjZ4k2q/ag==} + dependencies: + '@vue/compiler-dom': 3.2.26 + '@vue/shared': 3.2.26 + dev: true + /@vue/devtools-api/6.0.0-beta.20: resolution: {integrity: sha512-21u2jFOk8jbAneeGpDwZQ0W66RJa0IBDUyVl6SgKnn2cRFjLWzKj+ukXjpLhYr1KASyCe5E5U4jXwChVo0YUAw==} dev: false @@ -2538,10 +2561,14 @@ packages: estree-walker: 2.0.2 magic-string: 0.25.7 - /@vue/reactivity/3.2.21: - resolution: {integrity: sha512-7C57zFm/5E3SSTUhVuYj1InDwuJ+GIVQ/z+H43C9sST85gIThGXVhksl1yWTAadf8Yz4T5lSbqi5Ds8U/ueWcw==} + /@vue/reactivity-transform/3.2.26: + resolution: {integrity: sha512-XKMyuCmzNA7nvFlYhdKwD78rcnmPb7q46uoR00zkX6yZrUmcCQ5OikiwUEVbvNhL5hBJuvbSO95jB5zkUon+eQ==} dependencies: - '@vue/shared': 3.2.21 + '@babel/parser': 7.16.6 + '@vue/compiler-core': 3.2.26 + '@vue/shared': 3.2.26 + estree-walker: 2.0.2 + magic-string: 0.25.7 dev: true /@vue/reactivity/3.2.25: @@ -2549,21 +2576,10 @@ packages: dependencies: '@vue/shared': 3.2.25 - /@vue/ref-transform/3.2.21: - resolution: {integrity: sha512-uiEWWBsrGeun9O7dQExYWzXO3rHm/YdtFNXDVqCSoPypzOVxWxdiL+8hHeWzxMB58fVuV2sT80aUtIVyaBVZgQ==} + /@vue/reactivity/3.2.26: + resolution: {integrity: sha512-h38bxCZLW6oFJVDlCcAiUKFnXI8xP8d+eO0pcDxx+7dQfSPje2AO6M9S9QO6MrxQB7fGP0DH0dYQ8ksf6hrXKQ==} dependencies: - '@babel/parser': 7.16.2 - '@vue/compiler-core': 3.2.21 - '@vue/shared': 3.2.21 - estree-walker: 2.0.2 - magic-string: 0.25.7 - dev: true - - /@vue/runtime-core/3.2.21: - resolution: {integrity: sha512-7oOxKaU0D2IunOAMOOHZgJVrHg63xwng8BZx3fbgmakqEIMwHhQcp+5GV1sOg/sWW7R4UhaRDIUCukO2GRVK2Q==} - dependencies: - '@vue/reactivity': 3.2.21 - '@vue/shared': 3.2.21 + '@vue/shared': 3.2.26 dev: true /@vue/runtime-core/3.2.25: @@ -2572,12 +2588,11 @@ packages: '@vue/reactivity': 3.2.25 '@vue/shared': 3.2.25 - /@vue/runtime-dom/3.2.21: - resolution: {integrity: sha512-apBdriD6QsI4ywbllY8kjr9/0scGuStDuvLbJULPQkFPtHzntd51bP5PQTQVAEIc9kwnTozmj6x6ZdX/cwo7xA==} + /@vue/runtime-core/3.2.26: + resolution: {integrity: sha512-BcYi7qZ9Nn+CJDJrHQ6Zsmxei2hDW0L6AB4vPvUQGBm2fZyC0GXd/4nVbyA2ubmuhctD5RbYY8L+5GUJszv9mQ==} dependencies: - '@vue/runtime-core': 3.2.21 - '@vue/shared': 3.2.21 - csstype: 2.6.18 + '@vue/reactivity': 3.2.26 + '@vue/shared': 3.2.26 dev: true /@vue/runtime-dom/3.2.25: @@ -2587,14 +2602,12 @@ packages: '@vue/shared': 3.2.25 csstype: 2.6.18 - /@vue/server-renderer/3.2.21_vue@3.2.21: - resolution: {integrity: sha512-QBgYqVgI7XCSBCqGa4LduV9vpfQFdZBOodFmq5Txk5W/v1KrJ1LoOh2Q0RHiRgtoK/UR9uyvRVcYqOmwHkZNEg==} - peerDependencies: - vue: 3.2.21 + /@vue/runtime-dom/3.2.26: + resolution: {integrity: sha512-dY56UIiZI+gjc4e8JQBwAifljyexfVCkIAu/WX8snh8vSOt/gMSEGwPRcl2UpYpBYeyExV8WCbgvwWRNt9cHhQ==} dependencies: - '@vue/compiler-ssr': 3.2.21 - '@vue/shared': 3.2.21 - vue: 3.2.21 + '@vue/runtime-core': 3.2.26 + '@vue/shared': 3.2.26 + csstype: 2.6.18 dev: true /@vue/server-renderer/3.2.25_vue@3.2.25: @@ -2606,17 +2619,23 @@ packages: '@vue/shared': 3.2.25 vue: 3.2.25 - /@vue/shared/3.2.21: - resolution: {integrity: sha512-5EQmIPK6gw4UVYUbM959B0uPsJ58+xoMESCZs3N89XyvJ9e+fX4pqEPrOGV8OroIk3SbEvJcC+eYc8BH9JQrHA==} - dev: true - - /@vue/shared/3.2.22: - resolution: {integrity: sha512-qWVav014mpjEtbWbEgl0q9pEyrrIySKum8UVYjwhC6njrKzknLZPvfuYdQyVbApsqr94tf/3dP4pCuZmmjdCWQ==} + /@vue/server-renderer/3.2.26_vue@3.2.26: + resolution: {integrity: sha512-Jp5SggDUvvUYSBIvYEhy76t4nr1vapY/FIFloWmQzn7UxqaHrrBpbxrqPcTrSgGrcaglj0VBp22BKJNre4aA1w==} + peerDependencies: + vue: 3.2.26 + dependencies: + '@vue/compiler-ssr': 3.2.26 + '@vue/shared': 3.2.26 + vue: 3.2.26 dev: true /@vue/shared/3.2.25: resolution: {integrity: sha512-DkHJFV2gw9WBRmUCa21eyG0WvlF0l1QFOgTkWj29O4mt2Tv3BSE5PQOKhUruZIym4bBYCqx9ZGtoD1WohDprow==} + /@vue/shared/3.2.26: + resolution: {integrity: sha512-vPV6Cq+NIWbH5pZu+V+2QHE9y1qfuTq49uNWw4f7FDEeZaDU2H2cx5jcUZOAKW7qTrUS4k6qZPbMy1x4N96nbA==} + dev: true + /@wessberg/stringutil/1.0.19: resolution: {integrity: sha512-9AZHVXWlpN8Cn9k5BC/O0Dzb9E9xfEMXzYrNunwvkUTvuK7xgQPVRZpLo+jWCOZ5r8oBa8NIrHuPEu1hzbb6bg==} engines: {node: '>=8.0.0'} @@ -2928,18 +2947,18 @@ packages: - debug dev: false - /babel-jest/27.3.1_@babel+core@7.16.0: - resolution: {integrity: sha512-SjIF8hh/ir0peae2D6S6ZKRhUy7q/DnpH7k/V6fT4Bgs/LXXUztOpX4G2tCgq8mLo5HA9mN6NmlFMeYtKmIsTQ==} + /babel-jest/27.4.5_@babel+core@7.16.5: + resolution: {integrity: sha512-3uuUTjXbgtODmSv/DXO9nZfD52IyC2OYTFaXGRzL0kpykzroaquCrD5+lZNafTvZlnNqZHt5pb0M08qVBZnsnA==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} peerDependencies: '@babel/core': ^7.8.0 dependencies: - '@babel/core': 7.16.0 - '@jest/transform': 27.3.1 - '@jest/types': 27.2.5 + '@babel/core': 7.16.5 + '@jest/transform': 27.4.5 + '@jest/types': 27.4.2 '@types/babel__core': 7.1.16 babel-plugin-istanbul: 6.1.1 - babel-preset-jest: 27.2.0_@babel+core@7.16.0 + babel-preset-jest: 27.4.0_@babel+core@7.16.5 chalk: 4.1.2 graceful-fs: 4.2.8 slash: 3.0.0 @@ -2951,7 +2970,7 @@ packages: resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==} engines: {node: '>=8'} dependencies: - '@babel/helper-plugin-utils': 7.14.5 + '@babel/helper-plugin-utils': 7.16.5 '@istanbuljs/load-nyc-config': 1.1.0 '@istanbuljs/schema': 0.1.3 istanbul-lib-instrument: 5.1.0 @@ -2960,8 +2979,8 @@ packages: - supports-color dev: true - /babel-plugin-jest-hoist/27.2.0: - resolution: {integrity: sha512-TOux9khNKdi64mW+0OIhcmbAn75tTlzKhxmiNXevQaPbrBYK7YKjP1jl6NHTJ6XR5UgUrJbCnWlKVnJn29dfjw==} + /babel-plugin-jest-hoist/27.4.0: + resolution: {integrity: sha512-Jcu7qS4OX5kTWBc45Hz7BMmgXuJqRnhatqpUhnzGC3OBYpOmf2tv6jFNwZpwM7wU7MUuv2r9IPS/ZlYOuburVw==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@babel/template': 7.16.0 @@ -2978,35 +2997,35 @@ packages: resolve: 1.20.0 dev: true - /babel-preset-current-node-syntax/1.0.1_@babel+core@7.16.0: + /babel-preset-current-node-syntax/1.0.1_@babel+core@7.16.5: resolution: {integrity: sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.16.0 - '@babel/plugin-syntax-async-generators': 7.8.4_@babel+core@7.16.0 - '@babel/plugin-syntax-bigint': 7.8.3_@babel+core@7.16.0 - '@babel/plugin-syntax-class-properties': 7.12.13_@babel+core@7.16.0 - '@babel/plugin-syntax-import-meta': 7.10.4_@babel+core@7.16.0 - '@babel/plugin-syntax-json-strings': 7.8.3_@babel+core@7.16.0 - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4_@babel+core@7.16.0 - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3_@babel+core@7.16.0 - '@babel/plugin-syntax-numeric-separator': 7.10.4_@babel+core@7.16.0 - '@babel/plugin-syntax-object-rest-spread': 7.8.3_@babel+core@7.16.0 - '@babel/plugin-syntax-optional-catch-binding': 7.8.3_@babel+core@7.16.0 - '@babel/plugin-syntax-optional-chaining': 7.8.3_@babel+core@7.16.0 - '@babel/plugin-syntax-top-level-await': 7.14.5_@babel+core@7.16.0 - dev: true - - /babel-preset-jest/27.2.0_@babel+core@7.16.0: - resolution: {integrity: sha512-z7MgQ3peBwN5L5aCqBKnF6iqdlvZvFUQynEhu0J+X9nHLU72jO3iY331lcYrg+AssJ8q7xsv5/3AICzVmJ/wvg==} + '@babel/core': 7.16.5 + '@babel/plugin-syntax-async-generators': 7.8.4_@babel+core@7.16.5 + '@babel/plugin-syntax-bigint': 7.8.3_@babel+core@7.16.5 + '@babel/plugin-syntax-class-properties': 7.12.13_@babel+core@7.16.5 + '@babel/plugin-syntax-import-meta': 7.10.4_@babel+core@7.16.5 + '@babel/plugin-syntax-json-strings': 7.8.3_@babel+core@7.16.5 + '@babel/plugin-syntax-logical-assignment-operators': 7.10.4_@babel+core@7.16.5 + '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3_@babel+core@7.16.5 + '@babel/plugin-syntax-numeric-separator': 7.10.4_@babel+core@7.16.5 + '@babel/plugin-syntax-object-rest-spread': 7.8.3_@babel+core@7.16.5 + '@babel/plugin-syntax-optional-catch-binding': 7.8.3_@babel+core@7.16.5 + '@babel/plugin-syntax-optional-chaining': 7.8.3_@babel+core@7.16.5 + '@babel/plugin-syntax-top-level-await': 7.14.5_@babel+core@7.16.5 + dev: true + + /babel-preset-jest/27.4.0_@babel+core@7.16.5: + resolution: {integrity: sha512-NK4jGYpnBvNxcGo7/ZpZJr51jCGT+3bwwpVIDY2oNfTxJJldRtB4VAcYdgp1loDE50ODuTu+yBjpMAswv5tlpg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.16.0 - babel-plugin-jest-hoist: 27.2.0 - babel-preset-current-node-syntax: 1.0.1_@babel+core@7.16.0 + '@babel/core': 7.16.5 + babel-plugin-jest-hoist: 27.4.0 + babel-preset-current-node-syntax: 1.0.1_@babel+core@7.16.5 dev: true /babel-walk/3.0.0-canary-5: @@ -3649,8 +3668,8 @@ packages: is-what: 3.14.1 dev: true - /core-js/3.19.1: - resolution: {integrity: sha512-Tnc7E9iKd/b/ff7GFbhwPVzJzPztGrChB8X8GLqoYGdEOG8IpLnK1xPyo3ZoO3HsK6TodJS58VGPOxA+hLHQMg==} + /core-js/3.20.0: + resolution: {integrity: sha512-KjbKU7UEfg4YPpskMtMXPhUKn7m/1OdTHTVjy09ScR2LVaoUXe8Jh0UdvN2EKUR6iKTJph52SJP95mAB0MnVLQ==} requiresBuild: true dev: false @@ -3836,8 +3855,19 @@ packages: dependencies: ms: 2.1.2 - /debug/4.3.2_supports-color@9.0.2: - resolution: {integrity: sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==} + /debug/4.3.3: + resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + + /debug/4.3.3_supports-color@9.0.2: + resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} engines: {node: '>=6.0'} peerDependencies: supports-color: '*' @@ -3959,8 +3989,8 @@ packages: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} dev: false - /diff-sequences/27.0.6: - resolution: {integrity: sha512-ag6wfpBFyNXZ0p8pcuIDS//D8H062ZQJ3fzYxjpmeKjnz8W4pekL3AI8VohmyZmsWW2PWaHgjsmqR6L13101VQ==} + /diff-sequences/27.4.0: + resolution: {integrity: sha512-YqiQzkrsmHMH5uuh8OdQFU9/ZpADnwzml8z0O5HvRNda+5UZsaX/xN+AAxfR2hWq1Y7HZnAzO9J5lJXOuDz2Ww==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dev: true @@ -4319,30 +4349,30 @@ packages: source-map: 0.6.1 dev: true - /eslint-define-config/1.1.4: - resolution: {integrity: sha512-B1o0OTL32lPXwjjCpe+HtowrHqAlldInkU9PWVs+BsSi3E1GgjGIsiEz0g/1jHpBjP8zZMWh+DmdaB7gdLjUKQ==} + /eslint-define-config/1.2.0: + resolution: {integrity: sha512-EQ8d9F9LmJVRfkZW9WgSa5VBAVZialrLZKy0k1062zlhM8KFUyFoAC8xRI+mdp5m81FNMPnpKZfyq0AfJDyNTg==} engines: {node: '>= 16.9.0', npm: '>= 7.0.0', pnpm: '>= 6.17.0'} dev: true - /eslint-plugin-es/3.0.1_eslint@8.3.0: + /eslint-plugin-es/3.0.1_eslint@8.4.1: resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==} engines: {node: '>=8.10.0'} peerDependencies: eslint: '>=4.19.1' dependencies: - eslint: 8.3.0 + eslint: 8.4.1 eslint-utils: 2.1.0 regexpp: 3.2.0 dev: true - /eslint-plugin-node/11.1.0_eslint@8.3.0: + /eslint-plugin-node/11.1.0_eslint@8.4.1: resolution: {integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==} engines: {node: '>=8.10.0'} peerDependencies: eslint: '>=5.16.0' dependencies: - eslint: 8.3.0 - eslint-plugin-es: 3.0.1_eslint@8.3.0 + eslint: 8.4.1 + eslint-plugin-es: 3.0.1_eslint@8.4.1 eslint-utils: 2.1.0 ignore: 5.1.9 minimatch: 3.0.4 @@ -4373,13 +4403,13 @@ packages: eslint-visitor-keys: 1.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.3.0: + /eslint-utils/3.0.0_eslint@8.4.1: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.3.0 + eslint: 8.4.1 eslint-visitor-keys: 2.1.0 dev: true @@ -4398,24 +4428,24 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.3.0: - resolution: {integrity: sha512-aIay56Ph6RxOTC7xyr59Kt3ewX185SaGnAr8eWukoPLeriCrvGjvAubxuvaXOfsxhtwV5g0uBOsyhAom4qJdww==} + /eslint/8.4.1: + resolution: {integrity: sha512-TxU/p7LB1KxQ6+7aztTnO7K0i+h0tDi81YRY9VzB6Id71kNz+fFYnf5HD5UOQmxkzcoa0TlVZf9dpMtUv0GpWg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint/eslintrc': 1.0.4 - '@humanwhocodes/config-array': 0.6.0 + '@eslint/eslintrc': 1.0.5 + '@humanwhocodes/config-array': 0.9.2 ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.2 + debug: 4.3.3 doctrine: 3.0.0 enquirer: 2.3.6 escape-string-regexp: 4.0.0 eslint-scope: 7.1.0 - eslint-utils: 3.0.0_eslint@8.3.0 + eslint-utils: 3.0.0_eslint@8.4.1 eslint-visitor-keys: 3.1.0 - espree: 9.1.0 + espree: 9.2.0 esquery: 1.4.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 @@ -4445,8 +4475,8 @@ packages: - supports-color dev: true - /espree/9.1.0: - resolution: {integrity: sha512-ZgYLvCS1wxOczBYGcQT9DDWgicXwJ4dbocr9uYN+/eresBAUuBu+O4WzB21ufQ/JqQT8gyp7hJ3z8SHii32mTQ==} + /espree/9.2.0: + resolution: {integrity: sha512-oP3utRkynpZWF/F2x/HZJ+AGtnIclaR7z1pYPxy7NYM2fSO6LgK/Rkny8anRSPK/VwEA1eqm2squui0T7ZMOBg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: acorn: 8.6.0 @@ -4543,16 +4573,16 @@ packages: engines: {node: '>= 0.8.0'} dev: true - /expect/27.3.1: - resolution: {integrity: sha512-MrNXV2sL9iDRebWPGOGFdPQRl2eDQNu/uhxIMShjjx74T6kC6jFIkmQ6OqXDtevjGUkyB2IT56RzDBqXf/QPCg==} + /expect/27.4.2: + resolution: {integrity: sha512-BjAXIDC6ZOW+WBFNg96J22D27Nq5ohn+oGcuP2rtOtcjuxNoV9McpQ60PcQWhdFOSBIQdR72e+4HdnbZTFSTyg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/types': 27.2.5 + '@jest/types': 27.4.2 ansi-styles: 5.2.0 - jest-get-type: 27.3.1 - jest-matcher-utils: 27.3.1 - jest-message-util: 27.3.1 - jest-regex-util: 27.0.6 + jest-get-type: 27.4.0 + jest-matcher-utils: 27.4.2 + jest-message-util: 27.4.2 + jest-regex-util: 27.4.0 dev: true /express/4.17.1: @@ -4602,7 +4632,7 @@ packages: engines: {node: '>= 10.17.0'} hasBin: true dependencies: - debug: 4.3.2 + debug: 4.3.3 get-stream: 5.2.0 yauzl: 2.10.0 optionalDependencies: @@ -5112,12 +5142,12 @@ packages: dependencies: '@tootallnate/once': 1.1.2 agent-base: 6.0.2 - debug: 4.3.2 + debug: 4.3.3 transitivePeerDependencies: - supports-color dev: true - /http-proxy/1.18.1_debug@4.3.2: + /http-proxy/1.18.1_debug@4.3.3: resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==} engines: {node: '>=8.0.0'} dependencies: @@ -5153,13 +5183,13 @@ packages: resolution: {integrity: sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=} dev: true - /icss-utils/5.1.0_postcss@8.3.11: + /icss-utils/5.1.0_postcss@8.4.5: resolution: {integrity: sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - postcss: 8.3.11 + postcss: 8.4.5 dev: true /ignore/4.0.6: @@ -5505,7 +5535,7 @@ packages: resolution: {integrity: sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==} engines: {node: '>=8'} dependencies: - '@babel/core': 7.16.0 + '@babel/core': 7.16.5 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.0 semver: 6.3.0 @@ -5517,8 +5547,8 @@ packages: resolution: {integrity: sha512-czwUz525rkOFDJxfKK6mYfIs9zBKILyrZQxjz3ABhjQXhbhFsSbo1HW/BFcsDnfJYJWA6thRR5/TUY2qs5W99Q==} engines: {node: '>=8'} dependencies: - '@babel/core': 7.16.0 - '@babel/parser': 7.16.2 + '@babel/core': 7.16.5 + '@babel/parser': 7.16.6 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.0 semver: 6.3.0 @@ -5539,7 +5569,7 @@ packages: resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} engines: {node: '>=10'} dependencies: - debug: 4.3.2 + debug: 4.3.3 istanbul-lib-coverage: 3.2.0 source-map: 0.6.1 transitivePeerDependencies: @@ -5554,35 +5584,35 @@ packages: istanbul-lib-report: 3.0.0 dev: true - /jest-changed-files/27.3.0: - resolution: {integrity: sha512-9DJs9garMHv4RhylUMZgbdCJ3+jHSkpL9aaVKp13xtXAD80qLTLrqcDZL1PHA9dYA0bCI86Nv2BhkLpLhrBcPg==} + /jest-changed-files/27.4.2: + resolution: {integrity: sha512-/9x8MjekuzUQoPjDHbBiXbNEBauhrPU2ct7m8TfCg69ywt1y/N+yYwGh3gCpnqUS3klYWDU/lSNgv+JhoD2k1A==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/types': 27.2.5 + '@jest/types': 27.4.2 execa: 5.1.1 throat: 6.0.1 dev: true - /jest-circus/27.3.1: - resolution: {integrity: sha512-v1dsM9II6gvXokgqq6Yh2jHCpfg7ZqV4jWY66u7npz24JnhP3NHxI0sKT7+ZMQ7IrOWHYAaeEllOySbDbWsiXw==} + /jest-circus/27.4.5: + resolution: {integrity: sha512-eTNWa9wsvBwPykhMMShheafbwyakcdHZaEYh5iRrQ0PFJxkDP/e3U/FvzGuKWu2WpwUA3C3hPlfpuzvOdTVqnw==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/environment': 27.3.1 - '@jest/test-result': 27.3.1 - '@jest/types': 27.2.5 - '@types/node': 16.11.9 + '@jest/environment': 27.4.4 + '@jest/test-result': 27.4.2 + '@jest/types': 27.4.2 + '@types/node': 16.11.14 chalk: 4.1.2 co: 4.6.0 dedent: 0.7.0 - expect: 27.3.1 + expect: 27.4.2 is-generator-fn: 2.1.0 - jest-each: 27.3.1 - jest-matcher-utils: 27.3.1 - jest-message-util: 27.3.1 - jest-runtime: 27.3.1 - jest-snapshot: 27.3.1 - jest-util: 27.3.1 - pretty-format: 27.3.1 + jest-each: 27.4.2 + jest-matcher-utils: 27.4.2 + jest-message-util: 27.4.2 + jest-runtime: 27.4.5 + jest-snapshot: 27.4.5 + jest-util: 27.4.2 + pretty-format: 27.4.2 slash: 3.0.0 stack-utils: 2.0.5 throat: 6.0.1 @@ -5590,8 +5620,8 @@ packages: - supports-color dev: true - /jest-cli/27.3.1_ts-node@10.4.0: - resolution: {integrity: sha512-WHnCqpfK+6EvT62me6WVs8NhtbjAS4/6vZJnk7/2+oOr50cwAzG4Wxt6RXX0hu6m1169ZGMlhYYUNeKBXCph/Q==} + /jest-cli/27.4.5_ts-node@10.4.0: + resolution: {integrity: sha512-hrky3DSgE0u7sQxaCL7bdebEPHx5QzYmrGuUjaPLmPE8jx5adtvGuOlRspvMoVLTTDOHRnZDoRLYJuA+VCI7Hg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} hasBin: true peerDependencies: @@ -5600,16 +5630,16 @@ packages: node-notifier: optional: true dependencies: - '@jest/core': 27.3.1_ts-node@10.4.0 - '@jest/test-result': 27.3.1 - '@jest/types': 27.2.5 + '@jest/core': 27.4.5_ts-node@10.4.0 + '@jest/test-result': 27.4.2 + '@jest/types': 27.4.2 chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.8 import-local: 3.0.3 - jest-config: 27.3.1_ts-node@10.4.0 - jest-util: 27.3.1 - jest-validate: 27.3.1 + jest-config: 27.4.5_ts-node@10.4.0 + jest-util: 27.4.2 + jest-validate: 27.4.2 prompts: 2.4.2 yargs: 16.2.0 transitivePeerDependencies: @@ -5620,8 +5650,8 @@ packages: - utf-8-validate dev: true - /jest-config/27.3.1_ts-node@10.4.0: - resolution: {integrity: sha512-KY8xOIbIACZ/vdYCKSopL44I0xboxC751IX+DXL2+Wx6DKNycyEfV3rryC3BPm5Uq/BBqDoMrKuqLEUNJmMKKg==} + /jest-config/27.4.5_ts-node@10.4.0: + resolution: {integrity: sha512-t+STVJtPt+fpqQ8GBw850NtSQbnDOw/UzdPfzDaHQ48/AylQlW7LHj3dH+ndxhC1UxJ0Q3qkq7IH+nM1skwTwA==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} peerDependencies: ts-node: '>=9.0.0' @@ -5629,28 +5659,29 @@ packages: ts-node: optional: true dependencies: - '@babel/core': 7.16.0 - '@jest/test-sequencer': 27.3.1 - '@jest/types': 27.2.5 - babel-jest: 27.3.1_@babel+core@7.16.0 + '@babel/core': 7.16.5 + '@jest/test-sequencer': 27.4.5 + '@jest/types': 27.4.2 + babel-jest: 27.4.5_@babel+core@7.16.5 chalk: 4.1.2 ci-info: 3.2.0 deepmerge: 4.2.2 glob: 7.2.0 graceful-fs: 4.2.8 - jest-circus: 27.3.1 - jest-environment-jsdom: 27.3.1 - jest-environment-node: 27.4.2 - jest-get-type: 27.3.1 - jest-jasmine2: 27.3.1 - jest-regex-util: 27.0.6 - jest-resolve: 27.3.1 - jest-runner: 27.3.1 - jest-util: 27.3.1 - jest-validate: 27.3.1 + jest-circus: 27.4.5 + jest-environment-jsdom: 27.4.4 + jest-environment-node: 27.4.4 + jest-get-type: 27.4.0 + jest-jasmine2: 27.4.5 + jest-regex-util: 27.4.0 + jest-resolve: 27.4.5 + jest-runner: 27.4.5 + jest-util: 27.4.2 + jest-validate: 27.4.2 micromatch: 4.0.4 - pretty-format: 27.3.1 - ts-node: 10.4.0_7dd5cf9af763e621261d5cc88a052be2 + pretty-format: 27.4.2 + slash: 3.0.0 + ts-node: 10.4.0_08095b3038b55682110c004d6a64072d transitivePeerDependencies: - bufferutil - canvas @@ -5663,39 +5694,49 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: chalk: 4.1.2 - diff-sequences: 27.0.6 - jest-get-type: 27.3.1 - pretty-format: 27.3.1 + diff-sequences: 27.4.0 + jest-get-type: 27.4.0 + pretty-format: 27.4.2 + dev: true + + /jest-diff/27.4.2: + resolution: {integrity: sha512-ujc9ToyUZDh9KcqvQDkk/gkbf6zSaeEg9AiBxtttXW59H/AcqEYp1ciXAtJp+jXWva5nAf/ePtSsgWwE5mqp4Q==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + dependencies: + chalk: 4.1.2 + diff-sequences: 27.4.0 + jest-get-type: 27.4.0 + pretty-format: 27.4.2 dev: true - /jest-docblock/27.0.6: - resolution: {integrity: sha512-Fid6dPcjwepTFraz0YxIMCi7dejjJ/KL9FBjPYhBp4Sv1Y9PdhImlKZqYU555BlN4TQKaTc+F2Av1z+anVyGkA==} + /jest-docblock/27.4.0: + resolution: {integrity: sha512-7TBazUdCKGV7svZ+gh7C8esAnweJoG+SvcF6Cjqj4l17zA2q1cMwx2JObSioubk317H+cjcHgP+7fTs60paulg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: detect-newline: 3.1.0 dev: true - /jest-each/27.3.1: - resolution: {integrity: sha512-E4SwfzKJWYcvOYCjOxhZcxwL+AY0uFMvdCOwvzgutJiaiodFjkxQQDxHm8FQBeTqDnSmKsQWn7ldMRzTn2zJaQ==} + /jest-each/27.4.2: + resolution: {integrity: sha512-53V2MNyW28CTruB3lXaHNk6PkiIFuzdOC9gR3C6j8YE/ACfrPnz+slB0s17AgU1TtxNzLuHyvNlLJ+8QYw9nBg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/types': 27.2.5 + '@jest/types': 27.4.2 chalk: 4.1.2 - jest-get-type: 27.3.1 - jest-util: 27.3.1 - pretty-format: 27.3.1 + jest-get-type: 27.4.0 + jest-util: 27.4.2 + pretty-format: 27.4.2 dev: true - /jest-environment-jsdom/27.3.1: - resolution: {integrity: sha512-3MOy8qMzIkQlfb3W1TfrD7uZHj+xx8Olix5vMENkj5djPmRqndMaXtpnaZkxmxM+Qc3lo+yVzJjzuXbCcZjAlg==} + /jest-environment-jsdom/27.4.4: + resolution: {integrity: sha512-cYR3ndNfHBqQgFvS1RL7dNqSvD//K56j/q1s2ygNHcfTCAp12zfIromO1w3COmXrxS8hWAh7+CmZmGCIoqGcGA==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/environment': 27.3.1 - '@jest/fake-timers': 27.3.1 - '@jest/types': 27.2.5 - '@types/node': 16.11.9 - jest-mock: 27.3.0 - jest-util: 27.3.1 + '@jest/environment': 27.4.4 + '@jest/fake-timers': 27.4.2 + '@jest/types': 27.4.2 + '@types/node': 16.11.14 + jest-mock: 27.4.2 + jest-util: 27.4.2 jsdom: 16.7.0 transitivePeerDependencies: - bufferutil @@ -5704,100 +5745,85 @@ packages: - utf-8-validate dev: true - /jest-environment-node/27.4.2: - resolution: {integrity: sha512-nzTZ5nJ+FabuZPH2YVci7SZIHpvtNRHPt8+vipLkCnAgXGjVzHm7XJWdnNqXbAkExIgiKeVEkVMNZOZE/LeiIg==} + /jest-environment-node/27.4.4: + resolution: {integrity: sha512-D+v3lbJ2GjQTQR23TK0kY3vFVmSeea05giInI41HHOaJnAwOnmUHTZgUaZL+VxUB43pIzoa7PMwWtCVlIUoVoA==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/environment': 27.4.2 + '@jest/environment': 27.4.4 '@jest/fake-timers': 27.4.2 '@jest/types': 27.4.2 - '@types/node': 16.11.9 + '@types/node': 16.11.14 jest-mock: 27.4.2 jest-util: 27.4.2 dev: true - /jest-get-type/27.3.1: - resolution: {integrity: sha512-+Ilqi8hgHSAdhlQ3s12CAVNd8H96ZkQBfYoXmArzZnOfAtVAJEiPDBirjByEblvG/4LPJmkL+nBqPO3A1YJAEg==} + /jest-get-type/27.4.0: + resolution: {integrity: sha512-tk9o+ld5TWq41DkK14L4wox4s2D9MtTpKaAVzXfr5CUKm5ZK2ExcaFE0qls2W71zE/6R2TxxrK9w2r6svAFDBQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dev: true - /jest-haste-map/27.3.1: - resolution: {integrity: sha512-lYfNZIzwPccDJZIyk9Iz5iQMM/MH56NIIcGj7AFU1YyA4ewWFBl8z+YPJuSCRML/ee2cCt2y3W4K3VXPT6Nhzg==} + /jest-haste-map/27.4.5: + resolution: {integrity: sha512-oJm1b5qhhPs78K24EDGifWS0dELYxnoBiDhatT/FThgB9yxqUm5F6li3Pv+Q+apMBmmPNzOBnZ7ZxWMB1Leq1Q==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/types': 27.2.5 + '@jest/types': 27.4.2 '@types/graceful-fs': 4.1.5 - '@types/node': 16.11.9 + '@types/node': 16.11.14 anymatch: 3.1.2 fb-watchman: 2.0.1 graceful-fs: 4.2.8 - jest-regex-util: 27.0.6 - jest-serializer: 27.0.6 - jest-util: 27.3.1 - jest-worker: 27.3.1 + jest-regex-util: 27.4.0 + jest-serializer: 27.4.0 + jest-util: 27.4.2 + jest-worker: 27.4.5 micromatch: 4.0.4 walker: 1.0.8 optionalDependencies: fsevents: 2.3.2 dev: true - /jest-jasmine2/27.3.1: - resolution: {integrity: sha512-WK11ZUetDQaC09w4/j7o4FZDUIp+4iYWH/Lik34Pv7ukL+DuXFGdnmmi7dT58J2ZYKFB5r13GyE0z3NPeyJmsg==} + /jest-jasmine2/27.4.5: + resolution: {integrity: sha512-oUnvwhJDj2LhOiUB1kdnJjkx8C5PwgUZQb9urF77mELH9DGR4e2GqpWQKBOYXWs5+uTN9BGDqRz3Aeg5Wts7aw==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@babel/traverse': 7.16.0 - '@jest/environment': 27.3.1 - '@jest/source-map': 27.0.6 - '@jest/test-result': 27.3.1 - '@jest/types': 27.2.5 - '@types/node': 16.11.9 + '@babel/traverse': 7.16.5 + '@jest/environment': 27.4.4 + '@jest/source-map': 27.4.0 + '@jest/test-result': 27.4.2 + '@jest/types': 27.4.2 + '@types/node': 16.11.14 chalk: 4.1.2 co: 4.6.0 - expect: 27.3.1 + expect: 27.4.2 is-generator-fn: 2.1.0 - jest-each: 27.3.1 - jest-matcher-utils: 27.3.1 - jest-message-util: 27.3.1 - jest-runtime: 27.3.1 - jest-snapshot: 27.3.1 - jest-util: 27.3.1 - pretty-format: 27.3.1 + jest-each: 27.4.2 + jest-matcher-utils: 27.4.2 + jest-message-util: 27.4.2 + jest-runtime: 27.4.5 + jest-snapshot: 27.4.5 + jest-util: 27.4.2 + pretty-format: 27.4.2 throat: 6.0.1 transitivePeerDependencies: - supports-color dev: true - /jest-leak-detector/27.3.1: - resolution: {integrity: sha512-78QstU9tXbaHzwlRlKmTpjP9k4Pvre5l0r8Spo4SbFFVy/4Abg9I6ZjHwjg2QyKEAMg020XcjP+UgLZIY50yEg==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - jest-get-type: 27.3.1 - pretty-format: 27.3.1 - dev: true - - /jest-matcher-utils/27.3.1: - resolution: {integrity: sha512-hX8N7zXS4k+8bC1Aj0OWpGb7D3gIXxYvPNK1inP5xvE4ztbz3rc4AkI6jGVaerepBnfWB17FL5lWFJT3s7qo8w==} + /jest-leak-detector/27.4.2: + resolution: {integrity: sha512-ml0KvFYZllzPBJWDei3mDzUhyp/M4ubKebX++fPaudpe8OsxUE+m+P6ciVLboQsrzOCWDjE20/eXew9QMx/VGw==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - chalk: 4.1.2 - jest-diff: 27.3.1 - jest-get-type: 27.3.1 - pretty-format: 27.3.1 + jest-get-type: 27.4.0 + pretty-format: 27.4.2 dev: true - /jest-message-util/27.3.1: - resolution: {integrity: sha512-bh3JEmxsTZ/9rTm0jQrPElbY2+y48Rw2t47uMfByNyUVR+OfPh4anuyKsGqsNkXk/TI4JbLRZx+7p7Hdt6q1yg==} + /jest-matcher-utils/27.4.2: + resolution: {integrity: sha512-jyP28er3RRtMv+fmYC/PKG8wvAmfGcSNproVTW2Y0P/OY7/hWUOmsPfxN1jOhM+0u2xU984u2yEagGivz9OBGQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@babel/code-frame': 7.16.0 - '@jest/types': 27.2.5 - '@types/stack-utils': 2.0.1 chalk: 4.1.2 - graceful-fs: 4.2.8 - micromatch: 4.0.4 - pretty-format: 27.3.1 - slash: 3.0.0 - stack-utils: 2.0.5 + jest-diff: 27.4.2 + jest-get-type: 27.4.0 + pretty-format: 27.4.2 dev: true /jest-message-util/27.4.2: @@ -5815,23 +5841,15 @@ packages: stack-utils: 2.0.5 dev: true - /jest-mock/27.3.0: - resolution: {integrity: sha512-ziZiLk0elZOQjD08bLkegBzv5hCABu/c8Ytx45nJKkysQwGaonvmTxwjLqEA4qGdasq9o2I8/HtdGMNnVsMTGw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.2.5 - '@types/node': 16.11.9 - dev: true - /jest-mock/27.4.2: resolution: {integrity: sha512-PDDPuyhoukk20JrQKeofK12hqtSka7mWH0QQuxSNgrdiPsrnYYLS6wbzu/HDlxZRzji5ylLRULeuI/vmZZDrYA==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.4.2 - '@types/node': 16.11.9 + '@types/node': 16.11.14 dev: true - /jest-pnp-resolver/1.2.2_jest-resolve@27.3.1: + /jest-pnp-resolver/1.2.2_jest-resolve@27.4.5: resolution: {integrity: sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==} engines: {node: '>=6'} peerDependencies: @@ -5840,66 +5858,66 @@ packages: jest-resolve: optional: true dependencies: - jest-resolve: 27.3.1 + jest-resolve: 27.4.5 dev: true - /jest-regex-util/27.0.6: - resolution: {integrity: sha512-SUhPzBsGa1IKm8hx2F4NfTGGp+r7BXJ4CulsZ1k2kI+mGLG+lxGrs76veN2LF/aUdGosJBzKgXmNCw+BzFqBDQ==} + /jest-regex-util/27.4.0: + resolution: {integrity: sha512-WeCpMpNnqJYMQoOjm1nTtsgbR4XHAk1u00qDoNBQoykM280+/TmgA5Qh5giC1ecy6a5d4hbSsHzpBtu5yvlbEg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dev: true - /jest-resolve-dependencies/27.3.1: - resolution: {integrity: sha512-X7iLzY8pCiYOnvYo2YrK3P9oSE8/3N2f4pUZMJ8IUcZnT81vlSonya1KTO9ZfKGuC+svE6FHK/XOb8SsoRUV1A==} + /jest-resolve-dependencies/27.4.5: + resolution: {integrity: sha512-elEVvkvRK51y037NshtEkEnukMBWvlPzZHiL847OrIljJ8yIsujD2GXRPqDXC4rEVKbcdsy7W0FxoZb4WmEs7w==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/types': 27.2.5 - jest-regex-util: 27.0.6 - jest-snapshot: 27.3.1 + '@jest/types': 27.4.2 + jest-regex-util: 27.4.0 + jest-snapshot: 27.4.5 transitivePeerDependencies: - supports-color dev: true - /jest-resolve/27.3.1: - resolution: {integrity: sha512-Dfzt25CFSPo3Y3GCbxynRBZzxq9AdyNN+x/v2IqYx6KVT5Z6me2Z/PsSGFSv3cOSUZqJ9pHxilao/I/m9FouLw==} + /jest-resolve/27.4.5: + resolution: {integrity: sha512-xU3z1BuOz/hUhVUL+918KqUgK+skqOuUsAi7A+iwoUldK6/+PW+utK8l8cxIWT9AW7IAhGNXjSAh1UYmjULZZw==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/types': 27.2.5 + '@jest/types': 27.4.2 chalk: 4.1.2 graceful-fs: 4.2.8 - jest-haste-map: 27.3.1 - jest-pnp-resolver: 1.2.2_jest-resolve@27.3.1 - jest-util: 27.3.1 - jest-validate: 27.3.1 + jest-haste-map: 27.4.5 + jest-pnp-resolver: 1.2.2_jest-resolve@27.4.5 + jest-util: 27.4.2 + jest-validate: 27.4.2 resolve: 1.20.0 resolve.exports: 1.1.0 slash: 3.0.0 dev: true - /jest-runner/27.3.1: - resolution: {integrity: sha512-r4W6kBn6sPr3TBwQNmqE94mPlYVn7fLBseeJfo4E2uCTmAyDFm2O5DYAQAFP7Q3YfiA/bMwg8TVsciP7k0xOww==} + /jest-runner/27.4.5: + resolution: {integrity: sha512-/irauncTfmY1WkTaRQGRWcyQLzK1g98GYG/8QvIPviHgO1Fqz1JYeEIsSfF+9mc/UTA6S+IIHFgKyvUrtiBIZg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/console': 27.3.1 - '@jest/environment': 27.3.1 - '@jest/test-result': 27.3.1 - '@jest/transform': 27.3.1 - '@jest/types': 27.2.5 - '@types/node': 16.11.9 + '@jest/console': 27.4.2 + '@jest/environment': 27.4.4 + '@jest/test-result': 27.4.2 + '@jest/transform': 27.4.5 + '@jest/types': 27.4.2 + '@types/node': 16.11.14 chalk: 4.1.2 emittery: 0.8.1 exit: 0.1.2 graceful-fs: 4.2.8 - jest-docblock: 27.0.6 - jest-environment-jsdom: 27.3.1 - jest-environment-node: 27.4.2 - jest-haste-map: 27.3.1 - jest-leak-detector: 27.3.1 - jest-message-util: 27.3.1 - jest-resolve: 27.3.1 - jest-runtime: 27.3.1 - jest-util: 27.3.1 - jest-worker: 27.3.1 - source-map-support: 0.5.20 + jest-docblock: 27.4.0 + jest-environment-jsdom: 27.4.4 + jest-environment-node: 27.4.4 + jest-haste-map: 27.4.5 + jest-leak-detector: 27.4.2 + jest-message-util: 27.4.2 + jest-resolve: 27.4.5 + jest-runtime: 27.4.5 + jest-util: 27.4.2 + jest-worker: 27.4.5 + source-map-support: 0.5.21 throat: 6.0.1 transitivePeerDependencies: - bufferutil @@ -5908,17 +5926,17 @@ packages: - utf-8-validate dev: true - /jest-runtime/27.3.1: - resolution: {integrity: sha512-qtO6VxPbS8umqhEDpjA4pqTkKQ1Hy4ZSi9mDVeE9Za7LKBo2LdW2jmT+Iod3XFaJqINikZQsn2wEi0j9wPRbLg==} + /jest-runtime/27.4.5: + resolution: {integrity: sha512-CIYqwuJQXHQtPd/idgrx4zgJ6iCb6uBjQq1RSAGQrw2S8XifDmoM1Ot8NRd80ooAm+ZNdHVwsktIMGlA1F1FAQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/console': 27.3.1 - '@jest/environment': 27.3.1 - '@jest/globals': 27.3.1 - '@jest/source-map': 27.0.6 - '@jest/test-result': 27.3.1 - '@jest/transform': 27.3.1 - '@jest/types': 27.2.5 + '@jest/console': 27.4.2 + '@jest/environment': 27.4.4 + '@jest/globals': 27.4.4 + '@jest/source-map': 27.4.0 + '@jest/test-result': 27.4.2 + '@jest/transform': 27.4.5 + '@jest/types': 27.4.2 '@types/yargs': 16.0.4 chalk: 4.1.2 cjs-module-lexer: 1.2.2 @@ -5927,14 +5945,14 @@ packages: exit: 0.1.2 glob: 7.2.0 graceful-fs: 4.2.8 - jest-haste-map: 27.3.1 - jest-message-util: 27.3.1 - jest-mock: 27.3.0 - jest-regex-util: 27.0.6 - jest-resolve: 27.3.1 - jest-snapshot: 27.3.1 - jest-util: 27.3.1 - jest-validate: 27.3.1 + jest-haste-map: 27.4.5 + jest-message-util: 27.4.2 + jest-mock: 27.4.2 + jest-regex-util: 27.4.0 + jest-resolve: 27.4.5 + jest-snapshot: 27.4.5 + jest-util: 27.4.2 + jest-validate: 27.4.2 slash: 3.0.0 strip-bom: 4.0.0 yargs: 16.2.0 @@ -5942,106 +5960,94 @@ packages: - supports-color dev: true - /jest-serializer/27.0.6: - resolution: {integrity: sha512-PtGdVK9EGC7dsaziskfqaAPib6wTViY3G8E5wz9tLVPhHyiDNTZn/xjZ4khAw+09QkoOVpn7vF5nPSN6dtBexA==} + /jest-serializer/27.4.0: + resolution: {integrity: sha512-RDhpcn5f1JYTX2pvJAGDcnsNTnsV9bjYPU8xcV+xPwOXnUPOQwf4ZEuiU6G9H1UztH+OapMgu/ckEVwO87PwnQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@types/node': 16.11.9 + '@types/node': 16.11.14 graceful-fs: 4.2.8 dev: true - /jest-snapshot/27.3.1: - resolution: {integrity: sha512-APZyBvSgQgOT0XumwfFu7X3G5elj6TGhCBLbBdn3R1IzYustPGPE38F51dBWMQ8hRXa9je0vAdeVDtqHLvB6lg==} + /jest-snapshot/27.4.5: + resolution: {integrity: sha512-eCi/iM1YJFrJWiT9de4+RpWWWBqsHiYxFG9V9o/n0WXs6GpW4lUt4FAHAgFPTLPqCUVzrMQmSmTZSgQzwqR7IQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@babel/core': 7.16.0 - '@babel/generator': 7.16.0 - '@babel/parser': 7.16.2 - '@babel/plugin-syntax-typescript': 7.16.0_@babel+core@7.16.0 - '@babel/traverse': 7.16.0 + '@babel/core': 7.16.5 + '@babel/generator': 7.16.5 + '@babel/parser': 7.16.6 + '@babel/plugin-syntax-typescript': 7.16.0_@babel+core@7.16.5 + '@babel/traverse': 7.16.5 '@babel/types': 7.16.0 - '@jest/transform': 27.3.1 - '@jest/types': 27.2.5 + '@jest/transform': 27.4.5 + '@jest/types': 27.4.2 '@types/babel__traverse': 7.14.2 '@types/prettier': 2.4.1 - babel-preset-current-node-syntax: 1.0.1_@babel+core@7.16.0 + babel-preset-current-node-syntax: 1.0.1_@babel+core@7.16.5 chalk: 4.1.2 - expect: 27.3.1 + expect: 27.4.2 graceful-fs: 4.2.8 - jest-diff: 27.3.1 - jest-get-type: 27.3.1 - jest-haste-map: 27.3.1 - jest-matcher-utils: 27.3.1 - jest-message-util: 27.3.1 - jest-resolve: 27.3.1 - jest-util: 27.3.1 + jest-diff: 27.4.2 + jest-get-type: 27.4.0 + jest-haste-map: 27.4.5 + jest-matcher-utils: 27.4.2 + jest-message-util: 27.4.2 + jest-resolve: 27.4.5 + jest-util: 27.4.2 natural-compare: 1.4.0 - pretty-format: 27.3.1 + pretty-format: 27.4.2 semver: 7.3.5 transitivePeerDependencies: - supports-color dev: true - /jest-util/27.3.1: - resolution: {integrity: sha512-8fg+ifEH3GDryLQf/eKZck1DEs2YuVPBCMOaHQxVVLmQwl/CDhWzrvChTX4efLZxGrw+AA0mSXv78cyytBt/uw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.2.5 - '@types/node': 16.11.9 - chalk: 4.1.2 - ci-info: 3.2.0 - graceful-fs: 4.2.8 - picomatch: 2.3.0 - dev: true - /jest-util/27.4.2: resolution: {integrity: sha512-YuxxpXU6nlMan9qyLuxHaMMOzXAl5aGZWCSzben5DhLHemYQxCc4YK+4L3ZrCutT8GPQ+ui9k5D8rUJoDioMnA==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.4.2 - '@types/node': 16.11.9 + '@types/node': 16.11.14 chalk: 4.1.2 ci-info: 3.2.0 graceful-fs: 4.2.8 picomatch: 2.3.0 dev: true - /jest-validate/27.3.1: - resolution: {integrity: sha512-3H0XCHDFLA9uDII67Bwi1Vy7AqwA5HqEEjyy934lgVhtJ3eisw6ShOF1MDmRPspyikef5MyExvIm0/TuLzZ86Q==} + /jest-validate/27.4.2: + resolution: {integrity: sha512-hWYsSUej+Fs8ZhOm5vhWzwSLmVaPAxRy+Mr+z5MzeaHm9AxUpXdoVMEW4R86y5gOobVfBsMFLk4Rb+QkiEpx1A==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/types': 27.2.5 + '@jest/types': 27.4.2 camelcase: 6.2.0 chalk: 4.1.2 - jest-get-type: 27.3.1 + jest-get-type: 27.4.0 leven: 3.1.0 - pretty-format: 27.3.1 + pretty-format: 27.4.2 dev: true - /jest-watcher/27.3.1: - resolution: {integrity: sha512-9/xbV6chABsGHWh9yPaAGYVVKurWoP3ZMCv6h+O1v9/+pkOroigs6WzZ0e9gLP/njokUwM7yQhr01LKJVMkaZA==} + /jest-watcher/27.4.2: + resolution: {integrity: sha512-NJvMVyyBeXfDezhWzUOCOYZrUmkSCiatpjpm+nFUid74OZEHk6aMLrZAukIiFDwdbqp6mTM6Ui1w4oc+8EobQg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/test-result': 27.3.1 - '@jest/types': 27.2.5 - '@types/node': 16.11.9 + '@jest/test-result': 27.4.2 + '@jest/types': 27.4.2 + '@types/node': 16.11.14 ansi-escapes: 4.3.2 chalk: 4.1.2 - jest-util: 27.3.1 + jest-util: 27.4.2 string-length: 4.0.2 dev: true - /jest-worker/27.3.1: - resolution: {integrity: sha512-ks3WCzsiZaOPJl/oMsDjaf0TRiSv7ctNgs0FqRr2nARsovz6AWWy4oLElwcquGSz692DzgZQrCLScPNs5YlC4g==} + /jest-worker/27.4.5: + resolution: {integrity: sha512-f2s8kEdy15cv9r7q4KkzGXvlY0JTcmCbMHZBfSQDwW77REr45IDWwd0lksDFeVHH2jJ5pqb90T77XscrjeGzzg==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 16.11.9 + '@types/node': 16.11.14 merge-stream: 2.0.0 supports-color: 8.1.1 dev: true - /jest/27.3.1_ts-node@10.4.0: - resolution: {integrity: sha512-U2AX0AgQGd5EzMsiZpYt8HyZ+nSVIh5ujQ9CPp9EQZJMjXIiSZpJNweZl0swatKRoqHWgGKM3zaSwm4Zaz87ng==} + /jest/27.4.5_ts-node@10.4.0: + resolution: {integrity: sha512-uT5MiVN3Jppt314kidCk47MYIRilJjA/l2mxwiuzzxGUeJIvA8/pDaJOAX5KWvjAo7SCydcW0/4WEtgbLMiJkg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} hasBin: true peerDependencies: @@ -6050,9 +6056,9 @@ packages: node-notifier: optional: true dependencies: - '@jest/core': 27.3.1_ts-node@10.4.0 + '@jest/core': 27.4.5_ts-node@10.4.0 import-local: 3.0.3 - jest-cli: 27.3.1_ts-node@10.4.0 + jest-cli: 27.4.5_ts-node@10.4.0 transitivePeerDependencies: - bufferutil - canvas @@ -6273,15 +6279,15 @@ packages: /lines-and-columns/1.1.6: resolution: {integrity: sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=} - /lint-staged/12.1.1: - resolution: {integrity: sha512-zOmteWgJwTfZXcj6vXSnjeDDI/fvkKI2KOqRdc84ZFc2ZMDKXEeiTITtaskE3HiNrHraFmYVBpnMSZHngLoogA==} + /lint-staged/12.1.2: + resolution: {integrity: sha512-bSMcQVqMW98HLLLR2c2tZ+vnDCnx4fd+0QJBQgN/4XkdspGRPc8DGp7UuOEBe1ApCfJ+wXXumYnJmU+wDo7j9A==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hasBin: true dependencies: cli-truncate: 3.1.0 colorette: 2.0.16 commander: 8.3.0 - debug: 4.3.2_supports-color@9.0.2 + debug: 4.3.3_supports-color@9.0.2 enquirer: 2.3.6 execa: 5.1.1 lilconfig: 2.0.4 @@ -6667,6 +6673,11 @@ packages: resolution: {integrity: sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==} dev: true + /mrmime/1.0.0: + resolution: {integrity: sha512-a70zx7zFfVO7XpnQ2IX1Myh9yY4UYvfld/dikWRnsXxbyvMcfz+u6UfgNAtH+k2QqtJuzVpv6eLTx1G2+WKZbQ==} + engines: {node: '>=10'} + dev: true + /ms/2.0.0: resolution: {integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=} dev: true @@ -7155,26 +7166,26 @@ packages: find-up: 4.1.0 dev: true - /playwright-chromium/1.16.3: - resolution: {integrity: sha512-wXKjf9UYB2WtzC3C+3CCn9bNO6svRGY+F1vjm2UMxW/9wjyclLFkbcV3P6EztGQ0Ngrov9BQwvtmpjIZuKk8dQ==} + /playwright-chromium/1.17.1: + resolution: {integrity: sha512-EnCtsP/QTWWoQV/cFYpt2wgKwcOdoa2iHBlBaldHB8gobtynMKwk96rzldaRS4YimFibIzREFkWCNMrrb3LRMQ==} engines: {node: '>=12'} hasBin: true requiresBuild: true dependencies: - playwright-core: 1.16.3 + playwright-core: 1.17.1 transitivePeerDependencies: - bufferutil - supports-color - utf-8-validate dev: true - /playwright-core/1.16.3: - resolution: {integrity: sha512-16hF27IvQheJee+DbhC941AUZLjbJgfZFWi9YPS4LKEk/lKFhZI+9TiFD0sboYqb9eaEWvul47uR5xxTVbE4iw==} + /playwright-core/1.17.1: + resolution: {integrity: sha512-C3c8RpPiC3qr15fRDN6dx6WnUkPLFmST37gms2aoHPDRvp7EaGDPMMZPpqIm/QWB5J40xDrQCD4YYHz2nBTojQ==} engines: {node: '>=12'} hasBin: true dependencies: commander: 8.3.0 - debug: 4.3.2 + debug: 4.3.3 extract-zip: 2.0.1 https-proxy-agent: 5.0.0 jpeg-js: 0.4.3 @@ -7200,13 +7211,13 @@ packages: engines: {node: '>=10.13.0'} dev: true - /postcss-import/14.0.2_postcss@8.3.11: + /postcss-import/14.0.2_postcss@8.4.5: resolution: {integrity: sha512-BJ2pVK4KhUyMcqjuKs9RijV5tatNzNa73e/32aBVE/ejYPe37iH+6vAu9WvqUkB5OAYgLHzbSvzHnorybJCm9g==} engines: {node: '>=10.0.0'} peerDependencies: postcss: ^8.0.0 dependencies: - postcss: 8.3.11 + postcss: 8.4.5 postcss-value-parser: 4.1.0 read-cache: 1.0.0 resolve: 1.20.0 @@ -7231,51 +7242,51 @@ packages: dependencies: import-cwd: 3.0.0 lilconfig: 2.0.4 - ts-node: 10.4.0_7dd5cf9af763e621261d5cc88a052be2 + ts-node: 10.4.0_08095b3038b55682110c004d6a64072d yaml: 1.10.2 - /postcss-modules-extract-imports/3.0.0_postcss@8.3.11: + /postcss-modules-extract-imports/3.0.0_postcss@8.4.5: resolution: {integrity: sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - postcss: 8.3.11 + postcss: 8.4.5 dev: true - /postcss-modules-local-by-default/4.0.0_postcss@8.3.11: + /postcss-modules-local-by-default/4.0.0_postcss@8.4.5: resolution: {integrity: sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - icss-utils: 5.1.0_postcss@8.3.11 - postcss: 8.3.11 + icss-utils: 5.1.0_postcss@8.4.5 + postcss: 8.4.5 postcss-selector-parser: 6.0.6 postcss-value-parser: 4.1.0 dev: true - /postcss-modules-scope/3.0.0_postcss@8.3.11: + /postcss-modules-scope/3.0.0_postcss@8.4.5: resolution: {integrity: sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - postcss: 8.3.11 + postcss: 8.4.5 postcss-selector-parser: 6.0.6 dev: true - /postcss-modules-values/4.0.0_postcss@8.3.11: + /postcss-modules-values/4.0.0_postcss@8.4.5: resolution: {integrity: sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - icss-utils: 5.1.0_postcss@8.3.11 - postcss: 8.3.11 + icss-utils: 5.1.0_postcss@8.4.5 + postcss: 8.4.5 dev: true - /postcss-modules/4.2.2_postcss@8.3.11: + /postcss-modules/4.2.2_postcss@8.4.5: resolution: {integrity: sha512-/H08MGEmaalv/OU8j6bUKi/kZr2kqGF6huAW8m9UAgOLWtpFdhA14+gPBoymtqyv+D4MLsmqaF2zvIegdCxJXg==} peerDependencies: postcss: ^8.0.0 @@ -7283,11 +7294,11 @@ packages: generic-names: 2.0.1 icss-replace-symbols: 1.1.0 lodash.camelcase: 4.3.0 - postcss: 8.3.11 - postcss-modules-extract-imports: 3.0.0_postcss@8.3.11 - postcss-modules-local-by-default: 4.0.0_postcss@8.3.11 - postcss-modules-scope: 3.0.0_postcss@8.3.11 - postcss-modules-values: 4.0.0_postcss@8.3.11 + postcss: 8.4.5 + postcss-modules-extract-imports: 3.0.0_postcss@8.4.5 + postcss-modules-local-by-default: 4.0.0_postcss@8.4.5 + postcss-modules-scope: 3.0.0_postcss@8.4.5 + postcss-modules-values: 4.0.0_postcss@8.4.5 string-hash: 1.1.3 dev: true @@ -7321,6 +7332,15 @@ packages: picocolors: 1.0.0 source-map-js: 0.6.2 + /postcss/8.4.5: + resolution: {integrity: sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.1.30 + picocolors: 1.0.0 + source-map-js: 1.0.1 + dev: false + /preact/10.5.15: resolution: {integrity: sha512-5chK29n6QcJc3m1lVrKQSQ+V7K1Gb8HeQY6FViQ5AxCAEGu3DaHffWNDkC9+miZgsLvbvU9rxbV1qinGHMHzqA==} dev: true @@ -7335,8 +7355,8 @@ packages: engines: {node: '>= 0.8.0'} dev: true - /prettier/2.4.1: - resolution: {integrity: sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==} + /prettier/2.5.1: + resolution: {integrity: sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==} engines: {node: '>=10.13.0'} hasBin: true dev: true @@ -7345,7 +7365,7 @@ packages: resolution: {integrity: sha512-DR/c+pvFc52nLimLROYjnXPtolawm+uWDxr4FjuLDLUn+ktWnSN851KoHwHzzqq6rfCOjkzN8FLgDrSub6UDuA==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@jest/types': 27.2.5 + '@jest/types': 27.4.2 ansi-regex: 5.0.1 ansi-styles: 5.2.0 react-is: 17.0.2 @@ -8056,12 +8076,12 @@ packages: is-arrayish: 0.3.2 dev: false - /sirv/1.0.18: - resolution: {integrity: sha512-f2AOPogZmXgJ9Ma2M22ZEhc1dNtRIzcEkiflMFeVTRq+OViOZMvH1IPMVOwrKaxpSaHioBJiDR0SluRqGa7atA==} + /sirv/1.0.19: + resolution: {integrity: sha512-JuLThK3TnZG1TAKDwNIqNq6QA2afLOCcm+iE8D1Kj3GA40pSPsxQjjJl0J8X3tsR7T+CP1GavpzLwYkgVLWrZQ==} engines: {node: '>= 10'} dependencies: '@polka/url': 1.0.0-next.21 - mime: 2.6.0 + mrmime: 1.0.0 totalist: 1.1.0 dev: true @@ -8114,7 +8134,7 @@ packages: engines: {node: '>= 10'} dependencies: agent-base: 6.0.2 - debug: 4.3.2 + debug: 4.3.3 socks: 2.6.1 transitivePeerDependencies: - supports-color @@ -8132,6 +8152,11 @@ packages: resolution: {integrity: sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==} engines: {node: '>=0.10.0'} + /source-map-js/1.0.1: + resolution: {integrity: sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==} + engines: {node: '>=0.10.0'} + dev: false + /source-map-resolve/0.6.0: resolution: {integrity: sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==} dependencies: @@ -8697,14 +8722,15 @@ packages: utf8-byte-length: 1.0.4 dev: true - /ts-jest/27.0.7_b626c82449d36ccae0aa7169b15092e6: - resolution: {integrity: sha512-O41shibMqzdafpuP+CkrOL7ykbmLh+FqQrXEmV9CydQ5JBk0Sj0uAEF5TNNe94fZWKm3yYvWa/IbyV4Yg1zK2Q==} + /ts-jest/27.1.2_52ee6014196323fc54772ef1ffde0dac: + resolution: {integrity: sha512-eSOiJOWq6Hhs6Khzk5wKC5sgWIXgXqOCiIl1+3lfnearu58Hj4QpE5tUhQcA3xtZrELbcvAGCsd6HB8OsaVaTA==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} hasBin: true peerDependencies: '@babel/core': '>=7.0.0-beta.0 <8' '@types/jest': ^27.0.0 babel-jest: '>=27.0.0 <28' + esbuild: ~0.14.0 jest: ^27.0.0 typescript: '>=3.8 <5.0' peerDependenciesMeta: @@ -8714,12 +8740,15 @@ packages: optional: true babel-jest: optional: true + esbuild: + optional: true dependencies: '@types/jest': 27.0.3 bs-logger: 0.2.6 + esbuild: 0.13.12 fast-json-stable-stringify: 2.1.0 - jest: 27.3.1_ts-node@10.4.0 - jest-util: 27.3.1 + jest: 27.4.5_ts-node@10.4.0 + jest-util: 27.4.2 json5: 2.2.0 lodash.memoize: 4.1.2 make-error: 1.3.6 @@ -8728,7 +8757,7 @@ packages: yargs-parser: 20.2.9 dev: true - /ts-node/10.4.0_7dd5cf9af763e621261d5cc88a052be2: + /ts-node/10.4.0_08095b3038b55682110c004d6a64072d: resolution: {integrity: sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==} hasBin: true peerDependencies: @@ -8747,7 +8776,7 @@ packages: '@tsconfig/node12': 1.0.9 '@tsconfig/node14': 1.0.1 '@tsconfig/node16': 1.0.2 - '@types/node': 16.11.9 + '@types/node': 16.11.14 acorn: 8.5.0 acorn-walk: 8.2.0 arg: 4.1.3 @@ -8865,6 +8894,12 @@ packages: hasBin: true dev: true + /typescript/4.5.4: + resolution: {integrity: sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==} + engines: {node: '>=4.2.0'} + hasBin: true + dev: true + /typeson-registry/1.0.0-alpha.39: resolution: {integrity: sha512-NeGDEquhw+yfwNhguLPcZ9Oj0fzbADiX4R0WxvoY8nGhy98IbzQy1sezjoEFWOywOboj/DWehI+/aUlRVrJnnw==} engines: {node: '>=10.0.0'} @@ -8958,8 +8993,8 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /validator/8.2.0: - resolution: {integrity: sha512-Yw5wW34fSv5spzTXNkokD6S6/Oq92d8q/t14TqsS3fAiA1RYnxSFSIZ+CY3n6PGGRCq5HhJTSepQvFUS2QUDxA==} + /validator/13.7.0: + resolution: {integrity: sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==} engines: {node: '>= 0.10'} dev: true @@ -8972,18 +9007,20 @@ packages: engines: {node: '>= 0.8'} dev: true - /vitepress/0.20.1: - resolution: {integrity: sha512-2SOlvRv0bvPrQ3RPtp7Fh/G1MKidrsgAgYz18OvV+nIJb9iiYo0GUVHKN3OYswMh+vH78NyTeA1Q5v4YJ/H9LQ==} + /vitepress/0.20.9: + resolution: {integrity: sha512-2Rd6NMS5sTVl+3HDM9EzIMi3JOTNz1DjylvbYEWjxPyCmL3OH0lEez7O4FAijCkS5+i3VcwygxisadonMhtYkw==} engines: {node: '>=12.0.0'} hasBin: true dependencies: - '@docsearch/css': 1.0.0-alpha.28 - '@docsearch/js': 1.0.0-alpha.28 + '@docsearch/css': 3.0.0-alpha.42 + '@docsearch/js': 3.0.0-alpha.42 '@vitejs/plugin-vue': link:packages/plugin-vue prismjs: 1.25.0 vite: link:packages/vite - vue: 3.2.21 + vue: 3.2.26 transitivePeerDependencies: + - '@algolia/client-search' + - '@types/react' - react - react-dom dev: true @@ -9002,16 +9039,6 @@ packages: vue: 3.2.25 dev: false - /vue/3.2.21: - resolution: {integrity: sha512-jpy7ckXdyclfRzqLjL4mtq81AkzQleE54KjZsJg/9OorNVurAxdlU5XpD49GpjKdnftuffKUvx2C5jDOrgc/zg==} - dependencies: - '@vue/compiler-dom': 3.2.21 - '@vue/compiler-sfc': 3.2.21 - '@vue/runtime-dom': 3.2.21 - '@vue/server-renderer': 3.2.21_vue@3.2.21 - '@vue/shared': 3.2.21 - dev: true - /vue/3.2.25: resolution: {integrity: sha512-jU3t7fyQDHoCWCqhmRrnSmYZvHC35tOJTP704di7HGfq5EcFA1cU/1ZPjUV1eCxJev65Khjyfni+vk9oa+eTtw==} dependencies: @@ -9021,6 +9048,16 @@ packages: '@vue/server-renderer': 3.2.25_vue@3.2.25 '@vue/shared': 3.2.25 + /vue/3.2.26: + resolution: {integrity: sha512-KD4lULmskL5cCsEkfhERVRIOEDrfEL9CwAsLYpzptOGjaGFNWo3BQ9g8MAb7RaIO71rmVOziZ/uEN/rHwcUIhg==} + dependencies: + '@vue/compiler-dom': 3.2.26 + '@vue/compiler-sfc': 3.2.26 + '@vue/runtime-dom': 3.2.26 + '@vue/server-renderer': 3.2.26_vue@3.2.26 + '@vue/shared': 3.2.26 + dev: true + /vuex/4.0.2_vue@3.2.25: resolution: {integrity: sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==} peerDependencies: @@ -9292,13 +9329,14 @@ packages: stack-trace: 0.0.10 dev: true - /z-schema/3.18.4: - resolution: {integrity: sha512-DUOKC/IhbkdLKKiV89gw9DUauTV8U/8yJl1sjf6MtDmzevLKOF2duNJ495S3MFVjqZarr+qNGCPbkg4mu4PpLw==} + /z-schema/5.0.2: + resolution: {integrity: sha512-40TH47ukMHq5HrzkeVE40Ad7eIDKaRV2b+Qpi2prLc9X9eFJFzV7tMe5aH12e6avaSS/u5l653EQOv+J9PirPw==} + engines: {node: '>=8.0.0'} hasBin: true dependencies: lodash.get: 4.4.2 lodash.isequal: 4.5.0 - validator: 8.2.0 + validator: 13.7.0 optionalDependencies: commander: 2.20.3 dev: true From 15b6f1ba82731c16b19e00ca3b28b1a898caa4d4 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Sat, 18 Dec 2021 13:06:39 +0100 Subject: [PATCH 0089/1287] chore: convert scripts to TS (#6160) --- CONTRIBUTING.md | 2 +- package.json | 3 +- packages/create-vite/package.json | 2 +- .../{updateVersions.js => updateVersions.ts} | 19 +-- packages/playground/alias/package.json | 2 +- .../playground/optimize-deps/package.json | 2 +- .../optimize-missing-deps/package.json | 2 +- packages/playground/ssr-deps/package.json | 2 +- packages/plugin-legacy/package.json | 2 +- packages/plugin-react/package.json | 2 +- packages/plugin-vue-jsx/package.json | 2 +- packages/plugin-vue/package.json | 2 +- packages/vite/LICENSE.md | 52 ++++++-- packages/vite/package.json | 4 +- packages/vite/scripts/patchTypes.cjs | 70 ----------- packages/vite/scripts/patchTypes.ts | 66 +++++++++++ pnpm-lock.yaml | 8 ++ .../{patchFileDeps.cjs => patchFileDeps.ts} | 21 ++-- scripts/{release.cjs => release.ts} | 112 ++++++------------ scripts/{verifyCommit.cjs => verifyCommit.ts} | 8 +- 20 files changed, 194 insertions(+), 189 deletions(-) rename packages/create-vite/{updateVersions.js => updateVersions.ts} (50%) delete mode 100644 packages/vite/scripts/patchTypes.cjs create mode 100644 packages/vite/scripts/patchTypes.ts rename scripts/{patchFileDeps.cjs => patchFileDeps.ts} (61%) rename scripts/{release.cjs => release.ts} (67%) rename scripts/{verifyCommit.cjs => verifyCommit.ts} (83%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe17b0f3befe36..191eb468a38814 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -100,7 +100,7 @@ To work around this, playground packages that uses the `file:` protocol should a ```jsonc "scripts": { //... - "postinstall": "node ../../../scripts/patchFileDeps.cjs" + "postinstall": "ts-node ../../../scripts/patchFileDeps.ts" } ``` diff --git a/package.json b/package.json index dcb61a6713fb40..c4d6a04d96a1c1 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@types/fs-extra": "^9.0.13", "@types/jest": "^27.0.3", "@types/node": "^16.11.14", + "@types/prompts": "^2.0.14", "@types/semver": "^7.3.9", "@typescript-eslint/eslint-plugin": "^5.7.0", "@typescript-eslint/parser": "^5.7.0", @@ -61,7 +62,7 @@ }, "gitHooks": { "pre-commit": "lint-staged --concurrent false", - "commit-msg": "node scripts/verifyCommit.cjs" + "commit-msg": "ts-node scripts/verifyCommit.ts" }, "lint-staged": { "*": [ diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json index ab62f2b95229f7..bb340a75b5773a 100644 --- a/packages/create-vite/package.json +++ b/packages/create-vite/package.json @@ -14,7 +14,7 @@ "main": "index.js", "scripts": { "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package create-vite", - "release": "node updateVersions && node ../../scripts/release.cjs --skipBuild" + "release": "ts-node updateVersions && ts-node ../../scripts/release.ts --skipBuild" }, "engines": { "node": ">=12.0.0" diff --git a/packages/create-vite/updateVersions.js b/packages/create-vite/updateVersions.ts similarity index 50% rename from packages/create-vite/updateVersions.js rename to packages/create-vite/updateVersions.ts index 6ec2985854c64a..7125fce9119f07 100644 --- a/packages/create-vite/updateVersions.js +++ b/packages/create-vite/updateVersions.ts @@ -1,22 +1,23 @@ -const fs = require('fs') -const path = require('path') +import { readdirSync, writeFileSync } from 'fs' +import { join } from 'path' + const latestVersion = require('../vite/package.json').version const isLatestPreRelease = /beta|alpha|rc/.test(latestVersion) ;(async () => { - const templates = fs - .readdirSync(__dirname) - .filter((d) => d.startsWith('template-')) - for (const t of templates) { - const pkgPath = path.join(__dirname, t, `package.json`) + const templates = readdirSync(__dirname).filter((dir) => + dir.startsWith('template-') + ) + for (const template of templates) { + const pkgPath = join(__dirname, template, `package.json`) const pkg = require(pkgPath) if (!isLatestPreRelease) { pkg.devDependencies.vite = `^` + latestVersion } - if (t.startsWith('template-vue')) { + if (template.startsWith('template-vue')) { pkg.devDependencies['@vitejs/plugin-vue'] = `^` + require('../plugin-vue/package.json').version } - fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') + writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') } })() diff --git a/packages/playground/alias/package.json b/packages/playground/alias/package.json index 6d17bbe99eac6d..853a3efaf2bd93 100644 --- a/packages/playground/alias/package.json +++ b/packages/playground/alias/package.json @@ -7,7 +7,7 @@ "build": "vite build", "debug": "node --inspect-brk ../../vite/bin/vite", "preview": "vite preview", - "postinstall": "node ../../../scripts/patchFileDeps.cjs" + "postinstall": "ts-node ../../../scripts/patchFileDeps.ts" }, "dependencies": { "aliased-module": "file:./dir/module", diff --git a/packages/playground/optimize-deps/package.json b/packages/playground/optimize-deps/package.json index ca3bbd8e5b7c1f..0606343e0dce3c 100644 --- a/packages/playground/optimize-deps/package.json +++ b/packages/playground/optimize-deps/package.json @@ -7,7 +7,7 @@ "build": "vite build", "debug": "node --inspect-brk ../../vite/bin/vite", "preview": "vite preview", - "postinstall": "node ../../../scripts/patchFileDeps.cjs" + "postinstall": "ts-node ../../../scripts/patchFileDeps.ts" }, "dependencies": { "axios": "^0.24.0", diff --git a/packages/playground/optimize-missing-deps/package.json b/packages/playground/optimize-missing-deps/package.json index 74e17dd60704a6..431cf3b33c3847 100644 --- a/packages/playground/optimize-missing-deps/package.json +++ b/packages/playground/optimize-missing-deps/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "scripts": { "dev": "node server", - "postinstall": "node ../../../scripts/patchFileDeps.cjs" + "postinstall": "ts-node ../../../scripts/patchFileDeps.ts" }, "dependencies": { "missing-dep": "file:./missing-dep", diff --git a/packages/playground/ssr-deps/package.json b/packages/playground/ssr-deps/package.json index a4dfb83e6a0783..fac7c150b49924 100644 --- a/packages/playground/ssr-deps/package.json +++ b/packages/playground/ssr-deps/package.json @@ -6,7 +6,7 @@ "dev": "node server", "serve": "cross-env NODE_ENV=production node server", "debug": "node --inspect-brk server", - "postinstall": "node ../../../scripts/patchFileDeps.cjs" + "postinstall": "ts-node ../../../scripts/patchFileDeps.ts" }, "dependencies": { "bcrypt": "^5.0.1", diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index cd2ecc6a5858a9..e0556f1ddaf59c 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -11,7 +11,7 @@ "types": "index.d.ts", "scripts": { "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-legacy", - "release": "node ../../scripts/release.cjs --skipBuild" + "release": "ts-node ../../scripts/release.ts --skipBuild" }, "engines": { "node": ">=12.0.0" diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index a58d08f6b6834a..f95a158155c400 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -18,7 +18,7 @@ "build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@babel/* --external:@rollup/* --external:resolve --external:react-refresh/* --outfile=dist/index.js", "build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-react", - "release": "node ../../scripts/release.cjs" + "release": "ts-node ../../scripts/release.ts" }, "engines": { "node": ">=12.0.0" diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 40ef71dac734ea..b55f44b7e1228e 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -11,7 +11,7 @@ "types": "index.d.ts", "scripts": { "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-vue-jsx", - "release": "node ../../scripts/release.cjs --skipBuild" + "release": "ts-node ../../scripts/release.ts --skipBuild" }, "engines": { "node": ">=12.0.0" diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index a3721f40f960b5..8e76dc4c1ec2fd 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -16,7 +16,7 @@ "build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@vue/compiler-sfc --external:vue/compiler-sfc --external:vite --outfile=dist/index.js", "build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-vue", - "release": "node ../../scripts/release.cjs" + "release": "ts-node ../../scripts/release.ts" }, "engines": { "node": ">=12.0.0" diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index a77f5adb62043b..8541f3d92fc23b 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -1288,26 +1288,27 @@ Repository: https://github.com/mathiasbynens/cssesc.git ## debug License: MIT -By: TJ Holowaychuk, Nathan Rajlich, Andrew Rhyne, Josh Junon -Repository: git://github.com/visionmedia/debug.git +By: Josh Junon, TJ Holowaychuk, Nathan Rajlich, Andrew Rhyne +Repository: git://github.com/debug-js/debug.git > (The MIT License) > -> Copyright (c) 2014 TJ Holowaychuk +> Copyright (c) 2014-2017 TJ Holowaychuk +> Copyright (c) 2018-2021 Josh Junon > -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software -> and associated documentation files (the 'Software'), to deal in the Software without restriction, -> including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software +> and associated documentation files (the 'Software'), to deal in the Software without restriction, +> including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, > and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, > subject to the following conditions: > -> The above copyright notice and this permission notice shall be included in all copies or substantial +> The above copyright notice and this permission notice shall be included in all copies or substantial > portions of the Software. > -> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -> LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +> LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE > SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- @@ -2887,6 +2888,35 @@ Repository: git://github.com/isaacs/minimatch.git --------------------------------------- +## mrmime +License: MIT +By: Luke Edwards +Repository: lukeed/mrmime + +> The MIT License (MIT) +> +> Copyright (c) Luke Edwards (https://lukeed.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + ## ms License: MIT Repository: zeit/ms diff --git a/packages/vite/package.json b/packages/vite/package.json index 46b3036da6e022..9351957e6c7f87 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -35,12 +35,12 @@ "build-types": "run-s build-temp-types patch-types roll-types", "build-temp-types": "tsc --emitDeclarationOnly --outDir temp/node -p src/node", "ci-build": "rimraf dist && run-s build-bundle build-types", - "patch-types": "node scripts/patchTypes.cjs", + "patch-types": "ts-node scripts/patchTypes.ts", "roll-types": "api-extractor run && rimraf temp", "lint": "eslint --ext .ts src/**", "format": "prettier --write --parser typescript \"src/**/*.ts\"", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path .", - "release": "node ../../scripts/release.cjs" + "release": "ts-node ../../scripts/release.ts" }, "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!", "dependencies": { diff --git a/packages/vite/scripts/patchTypes.cjs b/packages/vite/scripts/patchTypes.cjs deleted file mode 100644 index 8be75c47f8d2cb..00000000000000 --- a/packages/vite/scripts/patchTypes.cjs +++ /dev/null @@ -1,70 +0,0 @@ -// @ts-check -const fs = require('fs') -const path = require('path') -const chalk = require('chalk') -const { parse } = require('@babel/parser') -const MagicString = require('magic-string').default -const tempDir = path.resolve(__dirname, '../temp/node') -const typesDir = path.resolve(__dirname, '../types') - -// walk through the temp dts dir, find all import/export of types/* -// and rewrite them into relative imports - so that api-extractor actually -// includes them in the rolled-up final d.ts file. -walkDir(tempDir) -console.log(chalk.green.bold(`patched types/* imports`)) - -function slash(p) { - return p.replace(/\\/g, '/') -} - -/** - * @param {string} dir - */ -function walkDir(dir) { - const files = fs.readdirSync(dir) - for (const file of files) { - const resolved = path.resolve(dir, file) - const isDir = fs.statSync(resolved).isDirectory() - if (isDir) { - walkDir(resolved) - } else { - rewriteFile(resolved) - } - } -} - -/** - * @param {string} file - */ -function rewriteFile(file) { - const content = fs.readFileSync(file, 'utf-8') - const str = new MagicString(content) - let ast - try { - ast = parse(content, { - sourceType: 'module', - plugins: ['typescript', 'classProperties'] - }) - } catch (e) { - console.log(chalk.red(`failed to parse ${file}`)) - throw e - } - for (const statement of ast.program.body) { - if ( - (statement.type === 'ImportDeclaration' || - statement.type === 'ExportNamedDeclaration' || - statement.type === 'ExportAllDeclaration') && - statement.source && - statement.source.value.startsWith('types/') - ) { - const source = statement.source - const absoluteTypePath = path.resolve(typesDir, source.value.slice(6)) - const relativeTypePath = slash( - path.relative(path.dirname(file), absoluteTypePath) - ) - // @ts-ignore - str.overwrite(source.start, source.end, JSON.stringify(relativeTypePath)) - } - } - fs.writeFileSync(file, str.toString()) -} diff --git a/packages/vite/scripts/patchTypes.ts b/packages/vite/scripts/patchTypes.ts new file mode 100644 index 00000000000000..b54cf0389f88b2 --- /dev/null +++ b/packages/vite/scripts/patchTypes.ts @@ -0,0 +1,66 @@ +import type { ParseResult } from '@babel/parser' +import { parse } from '@babel/parser' +import type { File } from '@babel/types' +import chalk from 'chalk' +import { readdirSync, readFileSync, statSync, writeFileSync } from 'fs' +import MagicString from 'magic-string' +import { dirname, relative, resolve } from 'path' + +const tempDir = resolve(__dirname, '../temp/node') +const typesDir = resolve(__dirname, '../types') + +// walk through the temp dts dir, find all import/export of types/* +// and rewrite them into relative imports - so that api-extractor actually +// includes them in the rolled-up final d.ts file. +walkDir(tempDir) +console.log(chalk.green.bold(`patched types/* imports`)) + +function slash(p: string): string { + return p.replace(/\\/g, '/') +} + +function walkDir(dir: string): void { + const files = readdirSync(dir) + for (const file of files) { + const resolved = resolve(dir, file) + const isDir = statSync(resolved).isDirectory() + if (isDir) { + walkDir(resolved) + } else { + rewriteFile(resolved) + } + } +} + +function rewriteFile(file: string): void { + const content = readFileSync(file, 'utf-8') + const str = new MagicString(content) + let ast: ParseResult + try { + ast = parse(content, { + sourceType: 'module', + plugins: ['typescript', 'classProperties'] + }) + } catch (e) { + console.log(chalk.red(`failed to parse ${file}`)) + throw e + } + for (const statement of ast.program.body) { + if ( + (statement.type === 'ImportDeclaration' || + statement.type === 'ExportNamedDeclaration' || + statement.type === 'ExportAllDeclaration') && + statement.source?.value.startsWith('types/') + ) { + const source = statement.source + const absoluteTypePath = resolve(typesDir, source.value.slice(6)) + const relativeTypePath = slash(relative(dirname(file), absoluteTypePath)) + str.overwrite( + source.start!, + source.end!, + JSON.stringify(relativeTypePath) + ) + } + } + writeFileSync(file, str.toString()) +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0a476f1e90e12d..0905c721570719 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,6 +12,7 @@ importers: '@types/fs-extra': ^9.0.13 '@types/jest': ^27.0.3 '@types/node': ^16.11.14 + '@types/prompts': ^2.0.14 '@types/semver': ^7.3.9 '@typescript-eslint/eslint-plugin': ^5.7.0 '@typescript-eslint/parser': ^5.7.0 @@ -47,6 +48,7 @@ importers: '@types/fs-extra': 9.0.13 '@types/jest': 27.0.3 '@types/node': 16.11.14 + '@types/prompts': 2.0.14 '@types/semver': 7.3.9 '@typescript-eslint/eslint-plugin': 5.7.0_d7a0d6b59468b4d2ea38f782f4f112e3 '@typescript-eslint/parser': 5.7.0_eslint@8.4.1+typescript@4.4.4 @@ -2291,6 +2293,12 @@ packages: resolution: {integrity: sha512-Fo79ojj3vdEZOHg3wR9ksAMRz4P3S5fDB5e/YWZiFnyFQI1WY2Vftu9XoXVVtJfxB7Bpce/QTqWSSntkz2Znrw==} dev: true + /@types/prompts/2.0.14: + resolution: {integrity: sha512-HZBd99fKxRWpYCErtm2/yxUZv6/PBI9J7N4TNFffl5JbrYMHBwF25DjQGTW3b3jmXq+9P6/8fCIb2ee57BFfYA==} + dependencies: + '@types/node': 16.11.14 + dev: true + /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: diff --git a/scripts/patchFileDeps.cjs b/scripts/patchFileDeps.ts similarity index 61% rename from scripts/patchFileDeps.cjs rename to scripts/patchFileDeps.ts index dbb42caadd38f4..0e90bbe8adece2 100644 --- a/scripts/patchFileDeps.cjs +++ b/scripts/patchFileDeps.ts @@ -3,19 +3,20 @@ // This script is called from postinstall hooks in playground packages that // uses the file: protocol, and copies the file: deps into node_modules. -const fs = require('fs-extra') -const path = require('path') +import { copySync, removeSync } from 'fs-extra' +import { join, resolve } from 'path' + const root = process.cwd() -const pkg = require(path.join(root, 'package.json')) +const pkg = require(join(root, 'package.json')) -let hasPatched -for (const [key, val] of Object.entries(pkg.dependencies)) { +let hasPatched: boolean = false +for (const [key, val] of Object.entries(pkg.dependencies)) { if (val.startsWith('file:')) { hasPatched = true - const src = path.resolve(root, val.slice('file:'.length)) - const dest = path.resolve(root, 'node_modules', key) - fs.removeSync(dest) - fs.copySync(src, dest, { + const src = resolve(root, val.slice('file:'.length)) + const dest = resolve(root, 'node_modules', key) + removeSync(dest) + copySync(src, dest, { dereference: true }) console.log(`patched ${val}`) @@ -26,5 +27,5 @@ if (hasPatched) { // remove node_modules/.ignored as pnpm will think our patched files are // installed by another package manager and move them into this directory. // On further installs it will error out if this directory is not empty. - fs.removeSync(path.resolve(root, 'node_modules', '.ignored')) + removeSync(resolve(root, 'node_modules', '.ignored')) } diff --git a/scripts/release.cjs b/scripts/release.ts similarity index 67% rename from scripts/release.cjs rename to scripts/release.ts index d7f258bc70d140..37cd2d9cb26ecc 100644 --- a/scripts/release.cjs +++ b/scripts/release.ts @@ -1,37 +1,26 @@ -// @ts-check - /** * modified from https://github.com/vuejs/vue-next/blob/master/scripts/release.js */ -const execa = require('execa') -const path = require('path') -const fs = require('fs') +import chalk from 'chalk' +import type { ExecaChildProcess, Options as ExecaOptions } from 'execa' +import execa from 'execa' +import { readFileSync, writeFileSync } from 'fs' +import path from 'path' +import prompts from 'prompts' +import type { ReleaseType } from 'semver' +import semver from 'semver' + const args = require('minimist')(process.argv.slice(2)) -const semver = require('semver') -const chalk = require('chalk') -const prompts = require('prompts') const pkgDir = process.cwd() const pkgPath = path.resolve(pkgDir, 'package.json') -/** - * @type {{ name: string, version: string }} - */ -const pkg = require(pkgPath) +const pkg: { name: string; version: string } = require(pkgPath) const pkgName = pkg.name.replace(/^@vitejs\//, '') const currentVersion = pkg.version -/** - * @type {boolean} - */ -const isDryRun = args.dry -/** - * @type {boolean} - */ -const skipBuild = args.skipBuild +const isDryRun: boolean = args.dry +const skipBuild: boolean = args.skipBuild -/** - * @type {import('semver').ReleaseType[]} - */ -const versionIncrements = [ +const versionIncrements: ReleaseType[] = [ 'patch', 'minor', 'major', @@ -41,43 +30,33 @@ const versionIncrements = [ 'prerelease' ] -/** - * @param {import('semver').ReleaseType} i - */ -const inc = (i) => semver.inc(currentVersion, i, 'beta') +const inc: (i: ReleaseType) => string = (i) => + semver.inc(currentVersion, i, 'beta') -/** - * @param {string} bin - * @param {string[]} args - * @param {object} opts - */ -const run = (bin, args, opts = {}) => +type RunFn = ( + bin: string, + args: string[], + opts?: ExecaOptions +) => ExecaChildProcess + +const run: RunFn = (bin, args, opts = {}) => execa(bin, args, { stdio: 'inherit', ...opts }) -/** - * @param {string} bin - * @param {string[]} args - * @param {object} opts - */ -const dryRun = (bin, args, opts = {}) => +type DryRunFn = (bin: string, args: string[], opts?: any) => void + +const dryRun: DryRunFn = (bin, args, opts: any) => console.log(chalk.blue(`[dryrun] ${bin} ${args.join(' ')}`), opts) const runIfNotDry = isDryRun ? dryRun : run -/** - * @param {string} msg - */ -const step = (msg) => console.log(chalk.cyan(msg)) +const step: (msg: string) => void = (msg) => console.log(chalk.cyan(msg)) -async function main() { - let targetVersion = args._[0] +async function main(): Promise { + let targetVersion: string | undefined = args._[0] if (!targetVersion) { // no explicit version, offer suggestions - /** - * @type {{ release: string }} - */ - const { release } = await prompts({ + const { release }: { release: string } = await prompts({ type: 'select', name: 'release', message: 'Select release type', @@ -88,10 +67,7 @@ async function main() { }) if (release === 'custom') { - /** - * @type {{ version: string }} - */ - const res = await prompts({ + const res: { version: string } = await prompts({ type: 'text', name: 'version', message: 'Input custom version', @@ -111,10 +87,7 @@ async function main() { pkgName === 'vite' ? `v${targetVersion}` : `${pkgName}@${targetVersion}` if (targetVersion.includes('beta') && !args.tag) { - /** - * @type {{ tagBeta: boolean }} - */ - const { tagBeta } = await prompts({ + const { tagBeta }: { tagBeta: boolean } = await prompts({ type: 'confirm', name: 'tagBeta', message: `Publish under dist-tag "beta"?` @@ -123,10 +96,7 @@ async function main() { if (tagBeta) args.tag = 'beta' } - /** - * @type {{ yes: boolean }} - */ - const { yes } = await prompts({ + const { yes }: { yes: boolean } = await prompts({ type: 'confirm', name: 'yes', message: `Releasing ${tag}. Confirm?` @@ -173,20 +143,16 @@ async function main() { console.log() } -/** - * @param {string} version - */ -function updateVersion(version) { - const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8')) +function updateVersion(version: string): void { + const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')) pkg.version = version - fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') + writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') } -/** - * @param {string} version - * @param {Function} runIfNotDry - */ -async function publishPackage(version, runIfNotDry) { +async function publishPackage( + version: string, + runIfNotDry: RunFn | DryRunFn +): Promise { const publicArgs = [ 'publish', '--no-git-tag-version', diff --git a/scripts/verifyCommit.cjs b/scripts/verifyCommit.ts similarity index 83% rename from scripts/verifyCommit.cjs rename to scripts/verifyCommit.ts index fbbff40796a8d7..437e723c85d17b 100644 --- a/scripts/verifyCommit.cjs +++ b/scripts/verifyCommit.ts @@ -1,8 +1,10 @@ // Invoked on the commit-msg git hook by yorkie. -const chalk = require('chalk') -const msgPath = process.env.GIT_PARAMS -const msg = require('fs').readFileSync(msgPath, 'utf-8').trim() +import chalk from 'chalk' +import { readFileSync } from 'fs' + +const msgPath = process.env.GIT_PARAMS! +const msg = readFileSync(msgPath, 'utf-8').trim() const releaseRE = /^v\d/ const commitRE = From 2762a0e7f0a599ced2c25c9d2baf06ec99ad8cfb Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 18 Dec 2021 21:12:38 +0800 Subject: [PATCH 0090/1287] fix(ssr): ssrTransfrom function argument destructure (#6171) --- .../node/ssr/__tests__/ssrTransform.spec.ts | 25 +++++++++++++++++++ packages/vite/src/node/ssr/ssrTransform.ts | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts index f63c9f5036767f..cdce4cc4f629f8 100644 --- a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts +++ b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts @@ -381,3 +381,28 @@ test('Empty array pattern', async () => { (await ssrTransform(`const [, LHS, RHS] = inMatch;`, null, null)).code ).toMatchInlineSnapshot(`"const [, LHS, RHS] = inMatch;"`) }) + +test('function argument destructure', async () => { + expect( + ( + await ssrTransform( + ` +import { foo, bar } from 'foo' +const a = ({ _ = foo() }) => {} +function b({ _ = bar() }) {} +function c({ _ = bar() + foo() }) {} +`, + null, + null + ) + ).code + ).toMatchInlineSnapshot(` + " + const __vite_ssr_import_0__ = await __vite_ssr_import__(\\"foo\\"); + + const a = ({ _ = __vite_ssr_import_0__.foo() }) => {} + function b({ _ = __vite_ssr_import_0__.bar() }) {} + function c({ _ = __vite_ssr_import_0__.bar() + __vite_ssr_import_0__.foo() }) {} + " + `) +}) diff --git a/packages/vite/src/node/ssr/ssrTransform.ts b/packages/vite/src/node/ssr/ssrTransform.ts index 394906816453f9..5721d06a487987 100644 --- a/packages/vite/src/node/ssr/ssrTransform.ts +++ b/packages/vite/src/node/ssr/ssrTransform.ts @@ -324,7 +324,8 @@ function walk( (parent?.type === 'AssignmentPattern' && parent?.right === child) || (parent?.type === 'TemplateLiteral' && - parent?.expressions.includes(child)) + parent?.expressions.includes(child)) || + (parent?.type === 'CallExpression' && parent?.callee === child) ) { return } From 10e8f857d320cfbb2f0375dac03911484cbc0b33 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Sun, 19 Dec 2021 16:26:40 +0800 Subject: [PATCH 0091/1287] docs: update node version note (#6177) --- docs/guide/index.md | 2 +- package.json | 2 +- packages/create-vite/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guide/index.md b/docs/guide/index.md index d87f039f4d4561..a38140ed54c58d 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -38,7 +38,7 @@ The supported template presets are: ## Scaffolding Your First Vite Project ::: tip Compatibility Note -Vite requires [Node.js](https://nodejs.org/en/) version >=12.0.0. +Vite requires [Node.js](https://nodejs.org/en/) version >=12.2.0. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it. ::: With NPM: diff --git a/package.json b/package.json index c4d6a04d96a1c1..2d1c4d81712298 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vite-monorepo", "private": true, "engines": { - "node": ">=12.0.0" + "node": ">=12.2.0" }, "scripts": { "preinstall": "npx only-allow pnpm", diff --git a/packages/create-vite/README.md b/packages/create-vite/README.md index df50bb2996981f..5e17ee0541f845 100644 --- a/packages/create-vite/README.md +++ b/packages/create-vite/README.md @@ -3,7 +3,7 @@ ## Scaffolding Your First Vite Project > **Compatibility Note:** -> Vite requires [Node.js](https://nodejs.org/en/) version >=12.0.0. +> Vite requires [Node.js](https://nodejs.org/en/) version >=12.2.0. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it. With NPM: From 71868579058512b51991718655e089a78b99d39c Mon Sep 17 00:00:00 2001 From: Shinigami Date: Sun, 19 Dec 2021 12:35:25 +0100 Subject: [PATCH 0092/1287] chore: prefer type imports (#5835) --- .eslintrc.cjs | 6 ++- packages/create-vite/__tests__/cli.spec.ts | 3 +- .../create-vite/template-vue-ts/src/env.d.ts | 2 +- .../playground/react-emotion/vite.config.ts | 3 +- packages/playground/react/vite.config.ts | 3 +- packages/playground/shims.d.ts | 2 +- packages/playground/testUtils.ts | 2 +- .../tsconfig-json/nested-with-extends/main.ts | 1 + .../playground/tsconfig-json/nested/main.ts | 1 + packages/playground/tsconfig-json/src/main.ts | 1 + packages/playground/vue/CustomBlockPlugin.ts | 2 +- .../worker/__tests__/worker.spec.ts | 2 +- packages/plugin-legacy/index.d.ts | 2 +- .../jsx-runtime/babel-import-to-require.ts | 5 +- .../src/jsx-runtime/babel-restore-jsx.ts | 2 +- .../src/jsx-runtime/restore-jsx.ts | 3 +- packages/plugin-vue-jsx/index.d.ts | 6 +-- packages/plugin-vue/src/compiler.ts | 2 +- packages/plugin-vue/src/handleHotUpdate.ts | 6 +-- packages/plugin-vue/src/index.ts | 6 +-- packages/plugin-vue/src/main.ts | 9 ++-- packages/plugin-vue/src/script.ts | 4 +- packages/plugin-vue/src/style.ts | 6 +-- packages/plugin-vue/src/template.ts | 6 +-- .../plugin-vue/src/utils/descriptorCache.ts | 4 +- packages/plugin-vue/src/utils/error.ts | 4 +- packages/vite/src/client/client.ts | 4 +- packages/vite/src/client/overlay.ts | 2 +- .../vite/src/node/__tests__/config.spec.ts | 11 ++-- packages/vite/src/node/build.ts | 18 ++++--- packages/vite/src/node/cli.ts | 7 +-- packages/vite/src/node/config.ts | 49 +++++++---------- packages/vite/src/node/http.ts | 10 ++-- packages/vite/src/node/importGlob.ts | 2 +- packages/vite/src/node/logger.ts | 11 ++-- .../src/node/optimizer/esbuildDepPlugin.ts | 6 +-- packages/vite/src/node/optimizer/index.ts | 5 +- .../src/node/optimizer/registerMissing.ts | 2 +- packages/vite/src/node/optimizer/scan.ts | 11 ++-- packages/vite/src/node/packages.ts | 4 +- packages/vite/src/node/plugin.ts | 14 ++--- packages/vite/src/node/plugins/asset.ts | 6 +-- .../src/node/plugins/assetImportMetaUrl.ts | 4 +- .../vite/src/node/plugins/clientInjections.ts | 4 +- packages/vite/src/node/plugins/css.ts | 12 ++--- packages/vite/src/node/plugins/dataUri.ts | 2 +- packages/vite/src/node/plugins/define.ts | 6 +-- packages/vite/src/node/plugins/esbuild.ts | 15 +++--- packages/vite/src/node/plugins/html.ts | 12 ++--- .../vite/src/node/plugins/importAnalysis.ts | 9 ++-- .../src/node/plugins/importAnalysisBuild.ts | 9 ++-- packages/vite/src/node/plugins/index.ts | 4 +- packages/vite/src/node/plugins/json.ts | 2 +- .../vite/src/node/plugins/loadFallback.ts | 2 +- packages/vite/src/node/plugins/manifest.ts | 6 +-- .../src/node/plugins/modulePreloadPolyfill.ts | 4 +- packages/vite/src/node/plugins/preAlias.ts | 4 +- packages/vite/src/node/plugins/reporter.ts | 4 +- packages/vite/src/node/plugins/resolve.ts | 14 ++--- .../vite/src/node/plugins/ssrRequireHook.ts | 4 +- packages/vite/src/node/plugins/terser.ts | 6 +-- packages/vite/src/node/plugins/wasm.ts | 4 +- packages/vite/src/node/plugins/worker.ts | 6 +-- packages/vite/src/node/preview.ts | 17 +++--- .../server/__tests__/pluginContainer.spec.ts | 8 +-- packages/vite/src/node/server/hmr.ts | 10 ++-- packages/vite/src/node/server/index.ts | 53 +++++++++---------- .../vite/src/node/server/middlewares/base.ts | 4 +- .../vite/src/node/server/middlewares/error.ts | 8 +-- .../src/node/server/middlewares/indexHtml.ts | 9 ++-- .../vite/src/node/server/middlewares/proxy.ts | 8 +-- .../node/server/middlewares/spaFallback.ts | 2 +- .../src/node/server/middlewares/static.ts | 10 ++-- .../vite/src/node/server/middlewares/time.ts | 2 +- .../src/node/server/middlewares/transform.ts | 4 +- packages/vite/src/node/server/moduleGraph.ts | 4 +- packages/vite/src/node/server/openBrowser.ts | 2 +- .../vite/src/node/server/pluginContainer.ts | 12 ++--- packages/vite/src/node/server/send.ts | 4 +- packages/vite/src/node/server/sourcemap.ts | 2 +- .../vite/src/node/server/transformRequest.ts | 4 +- packages/vite/src/node/server/ws.ts | 20 +++---- packages/vite/src/node/ssr/ssrExternal.ts | 5 +- .../vite/src/node/ssr/ssrManifestPlugin.ts | 4 +- packages/vite/src/node/ssr/ssrModuleLoader.ts | 5 +- packages/vite/src/node/ssr/ssrStacktrace.ts | 5 +- packages/vite/src/node/ssr/ssrTransform.ts | 8 +-- packages/vite/src/node/utils.ts | 4 +- packages/vite/types/alias.d.ts | 2 +- packages/vite/types/chokidar.d.ts | 4 +- packages/vite/types/http-proxy.d.ts | 8 +-- packages/vite/types/importMeta.d.ts | 27 +++++----- packages/vite/types/shims.d.ts | 10 ++-- packages/vite/types/ws.d.ts | 12 ++--- scripts/jestPerTestSetup.ts | 9 ++-- 95 files changed, 337 insertions(+), 337 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 578e00417db95b..48a0bd7773b0d7 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -89,7 +89,11 @@ module.exports = defineConfig({ '@typescript-eslint/no-inferrable-types': 'off', '@typescript-eslint/no-non-null-assertion': 'off', // maybe we should turn this on in a new PR '@typescript-eslint/no-unused-vars': 'off', // maybe we should turn this on in a new PR - '@typescript-eslint/no-var-requires': 'off' + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/consistent-type-imports': [ + 'error', + { prefer: 'type-imports' } + ] }, overrides: [ { diff --git a/packages/create-vite/__tests__/cli.spec.ts b/packages/create-vite/__tests__/cli.spec.ts index 307ce36a5a2b35..c52998172149e6 100644 --- a/packages/create-vite/__tests__/cli.spec.ts +++ b/packages/create-vite/__tests__/cli.spec.ts @@ -1,5 +1,6 @@ /* eslint-disable node/no-extraneous-import */ -import { commandSync, ExecaSyncReturnValue, SyncOptions } from 'execa' +import type { ExecaSyncReturnValue, SyncOptions } from 'execa' +import { commandSync } from 'execa' import { mkdirpSync, readdirSync, remove, writeFileSync } from 'fs-extra' import { join } from 'path' diff --git a/packages/create-vite/template-vue-ts/src/env.d.ts b/packages/create-vite/template-vue-ts/src/env.d.ts index d27eb5a311f66a..aafef9509dd5c4 100644 --- a/packages/create-vite/template-vue-ts/src/env.d.ts +++ b/packages/create-vite/template-vue-ts/src/env.d.ts @@ -1,7 +1,7 @@ /// declare module '*.vue' { - import { DefineComponent } from 'vue' + import type { DefineComponent } from 'vue' // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types const component: DefineComponent<{}, {}, any> export default component diff --git a/packages/playground/react-emotion/vite.config.ts b/packages/playground/react-emotion/vite.config.ts index 5b60bc7e26d145..9364c8f616c2f5 100644 --- a/packages/playground/react-emotion/vite.config.ts +++ b/packages/playground/react-emotion/vite.config.ts @@ -1,6 +1,7 @@ import react from '@vitejs/plugin-react' +import type { UserConfig } from 'vite' -const config: import('vite').UserConfig = { +const config: UserConfig = { plugins: [ react({ jsxImportSource: '@emotion/react', diff --git a/packages/playground/react/vite.config.ts b/packages/playground/react/vite.config.ts index e8780031511dac..c6955a131d375f 100644 --- a/packages/playground/react/vite.config.ts +++ b/packages/playground/react/vite.config.ts @@ -1,6 +1,7 @@ import react from '@vitejs/plugin-react' +import type { UserConfig } from 'vite' -const config: import('vite').UserConfig = { +const config: UserConfig = { plugins: [react()], build: { // to make tests faster diff --git a/packages/playground/shims.d.ts b/packages/playground/shims.d.ts index 99ed8eb232b14f..ced8fb1ad585ae 100644 --- a/packages/playground/shims.d.ts +++ b/packages/playground/shims.d.ts @@ -4,7 +4,7 @@ declare module 'css-color-names' { } declare module '*.vue' { - import { ComponentOptions } from 'vue' + import type { ComponentOptions } from 'vue' const component: ComponentOptions export default component } diff --git a/packages/playground/testUtils.ts b/packages/playground/testUtils.ts index 2be13b1aee8cc4..3c6cba769b3ffe 100644 --- a/packages/playground/testUtils.ts +++ b/packages/playground/testUtils.ts @@ -5,7 +5,7 @@ import fs from 'fs' import path from 'path' import colors from 'css-color-names' -import { ElementHandle } from 'playwright-chromium' +import type { ElementHandle } from 'playwright-chromium' import type { Manifest } from 'vite' export function slash(p: string): string { diff --git a/packages/playground/tsconfig-json/nested-with-extends/main.ts b/packages/playground/tsconfig-json/nested-with-extends/main.ts index 557f496c4fe1dc..497708b4f4d226 100644 --- a/packages/playground/tsconfig-json/nested-with-extends/main.ts +++ b/packages/playground/tsconfig-json/nested-with-extends/main.ts @@ -1,4 +1,5 @@ // @ts-nocheck +// eslint-disable-next-line @typescript-eslint/consistent-type-imports import { NestedWithExtendsTypeOnlyClass } from './not-used-type' class NestedWithExtendsBase { diff --git a/packages/playground/tsconfig-json/nested/main.ts b/packages/playground/tsconfig-json/nested/main.ts index c3c23c44ef59f8..306efd0b1a87d9 100644 --- a/packages/playground/tsconfig-json/nested/main.ts +++ b/packages/playground/tsconfig-json/nested/main.ts @@ -1,4 +1,5 @@ // @ts-nocheck +// eslint-disable-next-line @typescript-eslint/consistent-type-imports import { NestedTypeOnlyClass } from './not-used-type' class NestedBase { diff --git a/packages/playground/tsconfig-json/src/main.ts b/packages/playground/tsconfig-json/src/main.ts index 05f1d1a02796ae..6ae1fe03b7d023 100644 --- a/packages/playground/tsconfig-json/src/main.ts +++ b/packages/playground/tsconfig-json/src/main.ts @@ -2,6 +2,7 @@ import '../nested/main' import '../nested-with-extends/main' +// eslint-disable-next-line @typescript-eslint/consistent-type-imports import { MainTypeOnlyClass } from './not-used-type' class MainBase { diff --git a/packages/playground/vue/CustomBlockPlugin.ts b/packages/playground/vue/CustomBlockPlugin.ts index b434bbc24cf324..4f5def023902bc 100644 --- a/packages/playground/vue/CustomBlockPlugin.ts +++ b/packages/playground/vue/CustomBlockPlugin.ts @@ -1,4 +1,4 @@ -import { Plugin } from 'vite' +import type { Plugin } from 'vite' export const vueI18nPlugin: Plugin = { name: 'vue-i18n', diff --git a/packages/playground/worker/__tests__/worker.spec.ts b/packages/playground/worker/__tests__/worker.spec.ts index 46b136edd66d2a..b84ea39fef5d0a 100644 --- a/packages/playground/worker/__tests__/worker.spec.ts +++ b/packages/playground/worker/__tests__/worker.spec.ts @@ -1,7 +1,7 @@ import fs from 'fs' import path from 'path' import { untilUpdated, isBuild, testDir } from '../../testUtils' -import { Page } from 'playwright-chromium' +import type { Page } from 'playwright-chromium' test('normal', async () => { await page.click('.ping') diff --git a/packages/plugin-legacy/index.d.ts b/packages/plugin-legacy/index.d.ts index 612e6cacda9702..8f340f11cba074 100644 --- a/packages/plugin-legacy/index.d.ts +++ b/packages/plugin-legacy/index.d.ts @@ -1,4 +1,4 @@ -import { Plugin } from 'vite' +import type { Plugin } from 'vite' export interface Options { /** diff --git a/packages/plugin-react/src/jsx-runtime/babel-import-to-require.ts b/packages/plugin-react/src/jsx-runtime/babel-import-to-require.ts index 936d88b0c8472b..dc7129862fd976 100644 --- a/packages/plugin-react/src/jsx-runtime/babel-import-to-require.ts +++ b/packages/plugin-react/src/jsx-runtime/babel-import-to-require.ts @@ -1,3 +1,4 @@ +import type * as babelCore from '@babel/core' import type { types as t, Visitor } from '@babel/core' /** @@ -9,9 +10,7 @@ import type { types as t, Visitor } from '@babel/core' * * var _jsx = require("react/jsx-runtime").jsx */ -export function babelImportToRequire({ - types: t -}: typeof import('@babel/core')): { +export function babelImportToRequire({ types: t }: typeof babelCore): { visitor: Visitor } { return { diff --git a/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.ts b/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.ts index da08f5327a4eae..669a0aeeced207 100644 --- a/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.ts +++ b/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.ts @@ -2,7 +2,7 @@ * https://github.com/flying-sheep/babel-plugin-transform-react-createelement-to-jsx * @license GNU General Public License v3.0 */ -import * as babel from '@babel/core' +import type * as babel from '@babel/core' /** * Visitor factory for babel, converting React.createElement(...) to ... diff --git a/packages/plugin-react/src/jsx-runtime/restore-jsx.ts b/packages/plugin-react/src/jsx-runtime/restore-jsx.ts index 095f7c586e43a1..5cc7042a32c55e 100644 --- a/packages/plugin-react/src/jsx-runtime/restore-jsx.ts +++ b/packages/plugin-react/src/jsx-runtime/restore-jsx.ts @@ -1,3 +1,4 @@ +import type * as babelCore from '@babel/core' import type { PluginItem, types as t } from '@babel/core' type RestoredJSX = [result: t.File | null | undefined, isCommonJS: boolean] @@ -8,7 +9,7 @@ const jsxNotFound: RestoredJSX = [null, false] /** Restore JSX from `React.createElement` calls */ export async function restoreJSX( - babel: typeof import('@babel/core'), + babel: typeof babelCore, code: string, filename: string ): Promise { diff --git a/packages/plugin-vue-jsx/index.d.ts b/packages/plugin-vue-jsx/index.d.ts index 2cac80ba56632e..a702c09baa8417 100644 --- a/packages/plugin-vue-jsx/index.d.ts +++ b/packages/plugin-vue-jsx/index.d.ts @@ -1,6 +1,6 @@ -import { Plugin } from 'vite' -import { VueJSXPluginOptions } from '@vue/babel-plugin-jsx' -import { FilterPattern } from '@rollup/pluginutils' +import type { Plugin } from 'vite' +import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx' +import type { FilterPattern } from '@rollup/pluginutils' declare interface FilterOptions { include?: FilterPattern diff --git a/packages/plugin-vue/src/compiler.ts b/packages/plugin-vue/src/compiler.ts index 59350659b9a31e..0fb4eef7d2677a 100644 --- a/packages/plugin-vue/src/compiler.ts +++ b/packages/plugin-vue/src/compiler.ts @@ -5,7 +5,7 @@ declare module 'vue/compiler-sfc' { } } -import * as _compiler from 'vue/compiler-sfc' +import type * as _compiler from 'vue/compiler-sfc' export function resolveCompiler(root: string): typeof _compiler { // resolve from project root first, then fallback to peer dep (if any) diff --git a/packages/plugin-vue/src/handleHotUpdate.ts b/packages/plugin-vue/src/handleHotUpdate.ts index d93e647a1498bf..2bce3950563367 100644 --- a/packages/plugin-vue/src/handleHotUpdate.ts +++ b/packages/plugin-vue/src/handleHotUpdate.ts @@ -1,13 +1,13 @@ import _debug from 'debug' -import { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc' +import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc' import { createDescriptor, getDescriptor, setPrevDescriptor } from './utils/descriptorCache' import { getResolvedScript, setResolvedScript } from './script' -import { ModuleNode, HmrContext } from 'vite' -import { ResolvedOptions } from '.' +import type { ModuleNode, HmrContext } from 'vite' +import type { ResolvedOptions } from '.' const debug = _debug('vite:hmr') diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index 51ac057232aef0..f12dbd5b4cc0ef 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -1,13 +1,13 @@ import fs from 'fs' -import { Plugin, ViteDevServer } from 'vite' +import type { Plugin, ViteDevServer } from 'vite' import { createFilter } from '@rollup/pluginutils' -import { +import type { SFCBlock, SFCScriptCompileOptions, SFCStyleCompileOptions, SFCTemplateCompileOptions } from 'vue/compiler-sfc' -import * as _compiler from 'vue/compiler-sfc' +import type * as _compiler from 'vue/compiler-sfc' import { resolveCompiler } from './compiler' import { parseVueRequest } from './utils/query' import { getDescriptor, getSrcDescriptor } from './utils/descriptorCache' diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index 11dad79cc61733..29c5cffa4cfa81 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -1,18 +1,19 @@ import qs from 'querystring' import path from 'path' -import { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc' -import { ResolvedOptions } from '.' +import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc' +import type { ResolvedOptions } from '.' import { createDescriptor, getPrevDescriptor, setSrcDescriptor } from './utils/descriptorCache' -import { PluginContext, SourceMap, TransformPluginContext } from 'rollup' +import type { PluginContext, SourceMap, TransformPluginContext } from 'rollup' import { normalizePath } from '@rollup/pluginutils' import { resolveScript, isUseInlineTemplate } from './script' import { transformTemplateInMain } from './template' import { isOnlyTemplateChanged, isEqualBlock } from './handleHotUpdate' -import { RawSourceMap, SourceMapConsumer, SourceMapGenerator } from 'source-map' +import type { RawSourceMap } from 'source-map' +import { SourceMapConsumer, SourceMapGenerator } from 'source-map' import { createRollupError } from './utils/error' import { transformWithEsbuild } from 'vite' import { EXPORT_HELPER_ID } from './helper' diff --git a/packages/plugin-vue/src/script.ts b/packages/plugin-vue/src/script.ts index 241eca21eefea1..93610dcf7f6a36 100644 --- a/packages/plugin-vue/src/script.ts +++ b/packages/plugin-vue/src/script.ts @@ -1,5 +1,5 @@ -import { SFCDescriptor, SFCScriptBlock } from 'vue/compiler-sfc' -import { ResolvedOptions } from '.' +import type { SFCDescriptor, SFCScriptBlock } from 'vue/compiler-sfc' +import type { ResolvedOptions } from '.' import { resolveTemplateCompilerOptions } from './template' // ssr and non ssr builds would output different script content diff --git a/packages/plugin-vue/src/style.ts b/packages/plugin-vue/src/style.ts index c27e16591f1de9..ad9d981412f52d 100644 --- a/packages/plugin-vue/src/style.ts +++ b/packages/plugin-vue/src/style.ts @@ -1,6 +1,6 @@ -import { SFCDescriptor } from 'vue/compiler-sfc' -import { TransformPluginContext } from 'rollup' -import { ResolvedOptions } from '.' +import type { SFCDescriptor } from 'vue/compiler-sfc' +import type { TransformPluginContext } from 'rollup' +import type { ResolvedOptions } from '.' // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export async function transformStyle( diff --git a/packages/plugin-vue/src/template.ts b/packages/plugin-vue/src/template.ts index 9ee386b1c90d69..72e9588967556e 100644 --- a/packages/plugin-vue/src/template.ts +++ b/packages/plugin-vue/src/template.ts @@ -1,13 +1,13 @@ import path from 'path' import slash from 'slash' -import { +import type { SFCDescriptor, SFCTemplateCompileOptions, SFCTemplateCompileResults, CompilerOptions } from 'vue/compiler-sfc' -import { PluginContext, TransformPluginContext } from 'rollup' -import { ResolvedOptions } from '.' +import type { PluginContext, TransformPluginContext } from 'rollup' +import type { ResolvedOptions } from '.' import { getResolvedScript } from './script' import { createRollupError } from './utils/error' diff --git a/packages/plugin-vue/src/utils/descriptorCache.ts b/packages/plugin-vue/src/utils/descriptorCache.ts index 990f679d0ac08b..c0b77e72d3e613 100644 --- a/packages/plugin-vue/src/utils/descriptorCache.ts +++ b/packages/plugin-vue/src/utils/descriptorCache.ts @@ -2,8 +2,8 @@ import fs from 'fs' import path from 'path' import slash from 'slash' import hash from 'hash-sum' -import { CompilerError, SFCDescriptor } from 'vue/compiler-sfc' -import { ResolvedOptions, VueQuery } from '..' +import type { CompilerError, SFCDescriptor } from 'vue/compiler-sfc' +import type { ResolvedOptions, VueQuery } from '..' // compiler-sfc should be exported so it can be re-used export interface SFCParseResult { diff --git a/packages/plugin-vue/src/utils/error.ts b/packages/plugin-vue/src/utils/error.ts index 1f3e48d7c7ed44..50999910fabb7b 100644 --- a/packages/plugin-vue/src/utils/error.ts +++ b/packages/plugin-vue/src/utils/error.ts @@ -1,5 +1,5 @@ -import { CompilerError } from 'vue/compiler-sfc' -import { RollupError } from 'rollup' +import type { CompilerError } from 'vue/compiler-sfc' +import type { RollupError } from 'rollup' export function createRollupError( id: string, diff --git a/packages/vite/src/client/client.ts b/packages/vite/src/client/client.ts index 188d6f1a5eb01b..c801b716d0318c 100644 --- a/packages/vite/src/client/client.ts +++ b/packages/vite/src/client/client.ts @@ -1,4 +1,4 @@ -import { +import type { ErrorPayload, FullReloadPayload, HMRPayload, @@ -6,7 +6,7 @@ import { Update, UpdatePayload } from 'types/hmrPayload' -import { CustomEventName } from 'types/customEvent' +import type { CustomEventName } from 'types/customEvent' import { ErrorOverlay, overlayId } from './overlay' // eslint-disable-next-line node/no-missing-import import '@vite/env' diff --git a/packages/vite/src/client/overlay.ts b/packages/vite/src/client/overlay.ts index 536b9df167a83f..150c570fbc8aaf 100644 --- a/packages/vite/src/client/overlay.ts +++ b/packages/vite/src/client/overlay.ts @@ -1,4 +1,4 @@ -import { ErrorPayload } from 'types/hmrPayload' +import type { ErrorPayload } from 'types/hmrPayload' const template = /*html*/ ` +
+ inline style +
+
use style class
+ +

base64

+ +

+ inline style +

+

use style class

+ +

@import

+ + diff --git a/packages/playground/ssr-vue/src/pages/Home.vue b/packages/playground/ssr-vue/src/pages/Home.vue index f03679734dc04b..3ca0ca985fe6ed 100644 --- a/packages/playground/ssr-vue/src/pages/Home.vue +++ b/packages/playground/ssr-vue/src/pages/Home.vue @@ -10,6 +10,11 @@

{{ state.url }}

{{ state.protocol }}

msg from nested virtual module: {{ virtualMsg }}

+ +
+ encrypted message: +

{{ encryptedMsg }}

+
@@ -18,6 +23,7 @@ import foo from '@foo' import { msg as virtualMsg } from '@virtual-file' import { reactive, defineAsyncComponent } from 'vue' +import Button from '../components/button' const ImportType = load('ImportType') const Foo = defineAsyncComponent(() => import('../components/Foo').then((mod) => mod.Foo) diff --git a/packages/vite/src/node/ssr/ssrManifestPlugin.ts b/packages/vite/src/node/ssr/ssrManifestPlugin.ts index 061cd2f419c6ba..e6811eae29b210 100644 --- a/packages/vite/src/node/ssr/ssrManifestPlugin.ts +++ b/packages/vite/src/node/ssr/ssrManifestPlugin.ts @@ -1,9 +1,13 @@ -import { relative } from 'path' -import { normalizePath } from '@rollup/pluginutils' +import { relative, basename, join, dirname } from 'path' +import { parse as parseImports } from 'es-module-lexer' +import type { ImportSpecifier } from 'es-module-lexer' +import type { OutputChunk } from 'rollup' import type { ResolvedConfig } from '..' import type { Plugin } from '../plugin' import { chunkToEmittedCssFileMap } from '../plugins/css' import { chunkToEmittedAssetsMap } from '../plugins/asset' +import { preloadMethod } from '../plugins/importAnalysisBuild' +import { normalizePath } from '../utils' export function ssrManifestPlugin(config: ResolvedConfig): Plugin { // module id => preload assets mapping @@ -40,6 +44,54 @@ export function ssrManifestPlugin(config: ResolvedConfig): Plugin { }) } } + if (chunk.code.includes(preloadMethod)) { + // generate css deps map + const code = chunk.code + let imports: ImportSpecifier[] + try { + imports = parseImports(code)[0].filter((i) => i.d > -1) + } catch (e: any) { + this.error(e, e.idx) + } + if (imports.length) { + for (let index = 0; index < imports.length; index++) { + const { + s: start, + e: end, + n: name, + d: dynamicIndex + } = imports[index] + if (dynamicIndex) { + // check the chunk being imported + const url = code.slice(start, end) + const deps: string[] = [] + const ownerFilename = chunk.fileName + // literal import - trace direct imports and add to deps + const analyzed: Set = new Set() + const addDeps = (filename: string) => { + if (filename === ownerFilename) return + if (analyzed.has(filename)) return + analyzed.add(filename) + const chunk = bundle[filename] as OutputChunk | undefined + if (chunk) { + const cssFiles = chunkToEmittedCssFileMap.get(chunk) + if (cssFiles) { + cssFiles.forEach((file) => { + deps.push(`/${file}`) + }) + } + chunk.imports.forEach(addDeps) + } + } + const normalizedFile = normalizePath( + join(dirname(chunk.fileName), url.slice(1, -1)) + ) + addDeps(normalizedFile) + ssrManifest[basename(name!)] = deps + } + } + } + } } } From 1f032115eff6bc9d65943d1c1ff3668ca6559ae6 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Wed, 5 Jan 2022 15:08:09 +0100 Subject: [PATCH 0166/1287] release: v2.8.0-beta.0 --- packages/vite/CHANGELOG.md | 37 +++++++++++++++++++++++++++++++++++++ packages/vite/package.json | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 87cc0d7eccf139..db3ac75fab3069 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,40 @@ +# [2.8.0-beta.0](https://github.com/vitejs/vite/compare/v2.7.9...v2.8.0-beta.0) (2022-01-05) + + +### Bug Fixes + +* **build:** fix chokidar.ignore override ([#6317](https://github.com/vitejs/vite/issues/6317)) ([aa47549](https://github.com/vitejs/vite/commit/aa475494c61898638a592387ac907a939f1dd938)) +* **build:** fix watch crash with inline module ([#6373](https://github.com/vitejs/vite/issues/6373)) ([49d2f6d](https://github.com/vitejs/vite/commit/49d2f6dbd9445518b022f6c75ca397460a02d9d8)) +* check if e.stack exists in the first place ([#6362](https://github.com/vitejs/vite/issues/6362)) ([f144aa9](https://github.com/vitejs/vite/commit/f144aa9f1df2134dc6695db6e8eff25cac2b5263)) +* correct ssr flag in resolve calls (fix [#6213](https://github.com/vitejs/vite/issues/6213)) ([#6216](https://github.com/vitejs/vite/issues/6216)) ([6dd7d1a](https://github.com/vitejs/vite/commit/6dd7d1a7cb99737dd48e070607d0fe9ece35adab)) +* **css:** no emit assets in html style tag (fix [#5968](https://github.com/vitejs/vite/issues/5968)) ([#6321](https://github.com/vitejs/vite/issues/6321)) ([dc9fce1](https://github.com/vitejs/vite/commit/dc9fce144a957a5e7b3612b27bc657121a882edc)) +* don't force terser on non-legacy (fix [#6266](https://github.com/vitejs/vite/issues/6266)) ([#6272](https://github.com/vitejs/vite/issues/6272)) ([1da104e](https://github.com/vitejs/vite/commit/1da104e8597e2965313e8cd582d032bca551e4ee)) +* prevent dev server crashing on malformed URI (fix [#6300](https://github.com/vitejs/vite/issues/6300)) ([#6308](https://github.com/vitejs/vite/issues/6308)) ([a49d723](https://github.com/vitejs/vite/commit/a49d72358f2d028f62b0e9fcdb096a0e5ddf24c3)) +* replace chalk with picocolors ([#6277](https://github.com/vitejs/vite/issues/6277)) ([5a111ce](https://github.com/vitejs/vite/commit/5a111cedf31f579e3b8c8af5c4442d2e0cd5aa12)) +* replace execa with cross-spawn ([#6299](https://github.com/vitejs/vite/issues/6299)) ([f68ed8b](https://github.com/vitejs/vite/commit/f68ed8b4ebbec01491d069164b28a5948537f0d7)) +* **ssr:** move `vite:ssr-require-hook` after user plugins ([#6306](https://github.com/vitejs/vite/issues/6306)) ([d856c4b](https://github.com/vitejs/vite/commit/d856c4bd6798707e0cbdfc127a2e8b6c00c65dae)) +* strip NULL_BYTE_PLACEHOLDER before transform ([#6390](https://github.com/vitejs/vite/issues/6390)) ([5964949](https://github.com/vitejs/vite/commit/596494948a6e2f697232371b200c2d7a51d386bc)) +* strip query when resolving entry ([#6233](https://github.com/vitejs/vite/issues/6233)) ([000ba2e](https://github.com/vitejs/vite/commit/000ba2e00b14e6c595febfa6dcae862e2d341823)) +* this._implicitHeader is not a function ([#6313](https://github.com/vitejs/vite/issues/6313)) ([c5ba2f2](https://github.com/vitejs/vite/commit/c5ba2f24bd48b88907a1505bdf0a83d6b09f1d2b)) +* upgrade postcss-modules ([#6248](https://github.com/vitejs/vite/issues/6248)) ([ac3f434](https://github.com/vitejs/vite/commit/ac3f434b8b7bc827fd76a28989f8c3ebaa999ee9)) +* use `hires: true` for SSR require hook source map ([#6310](https://github.com/vitejs/vite/issues/6310)) ([0ebeb98](https://github.com/vitejs/vite/commit/0ebeb981789e6c29889db03fc11fd9b80c63883f)) + + +### Features + +* catch postcss error messages ([#6293](https://github.com/vitejs/vite/issues/6293)) ([4d75b2e](https://github.com/vitejs/vite/commit/4d75b2e39d4decd1294f62333bdae4ba577bf1cb)) +* **define:** prevent assignment ([#5515](https://github.com/vitejs/vite/issues/5515)) ([6d4ee18](https://github.com/vitejs/vite/commit/6d4ee18e0c45e7c1fedd36c24b631a8f97f40c0f)) +* import.meta.glob support ?raw ([#5545](https://github.com/vitejs/vite/issues/5545)) ([5279de6](https://github.com/vitejs/vite/commit/5279de6859df61b6191a4c3bfc76da582309a5ec)) +* option to disable pre-transform ([#6309](https://github.com/vitejs/vite/issues/6309)) ([2c14525](https://github.com/vitejs/vite/commit/2c145252b7870e8173886339b69f189878533839)) +* **server:** support headers configurable ([#5580](https://github.com/vitejs/vite/issues/5580)) ([db36e81](https://github.com/vitejs/vite/commit/db36e8158e06ff6a383d03b9680aafc7f62d5033)) +* **server:** trace `error.loc` back to original source ([#5467](https://github.com/vitejs/vite/issues/5467)) ([65cd44d](https://github.com/vitejs/vite/commit/65cd44dcabbf213b24d68cf02d787e7b9e138c21)) +* **ssr:** support preload dynamic css file in html head ([#5705](https://github.com/vitejs/vite/issues/5705)) ([07fca95](https://github.com/vitejs/vite/commit/07fca955519a98e19d4e138a17e19a000eef3f46)) +* support .cjs config file ([#5602](https://github.com/vitejs/vite/issues/5602)) ([cddd986](https://github.com/vitejs/vite/commit/cddd986b2a3c61afd53d6fde88f9f28d3c3a6b00)) +* **vite:** pass mode to preview command ([#6392](https://github.com/vitejs/vite/issues/6392)) ([1ff1103](https://github.com/vitejs/vite/commit/1ff1103ade691b0a3f564609fdc4e76d5122227b)) +* **worker:** support worker format, plugins and rollupOptions (fix [#6191](https://github.com/vitejs/vite/issues/6191)) ([#6351](https://github.com/vitejs/vite/issues/6351)) ([133fcea](https://github.com/vitejs/vite/commit/133fcea5223263b0ae08ac9a0422b55183ebd266)) + + + ## [2.7.9](https://github.com/vitejs/vite/compare/v2.7.8...v2.7.9) (2021-12-28) diff --git a/packages/vite/package.json b/packages/vite/package.json index 4c5960789353d0..44bfeb793c35ae 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.7.9", + "version": "2.8.0-beta.0", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From eb9b374e0f4c9dd1939a9d16ac5d252868b9001b Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Wed, 5 Jan 2022 20:48:11 +0630 Subject: [PATCH 0167/1287] workflow: switch to simple-git-hooks (#6219) --- package.json | 10 ++-- pnpm-lock.yaml | 116 ++++------------------------------------ scripts/verifyCommit.ts | 5 +- 3 files changed, 17 insertions(+), 114 deletions(-) diff --git a/package.json b/package.json index 6c5eb872addfee..732cd385fc1039 100644 --- a/package.json +++ b/package.json @@ -52,17 +52,17 @@ "rimraf": "^3.0.2", "rollup": "^2.59.0", "semver": "^7.3.5", + "simple-git-hooks": "^2.7.0", "sirv": "^2.0.0", "ts-jest": "^27.1.2", "ts-node": "^10.4.0", "typescript": "~4.5.4", "vite": "workspace:*", - "vitepress": "^0.20.10", - "yorkie": "^2.0.0" + "vitepress": "^0.20.10" }, - "gitHooks": { - "pre-commit": "lint-staged --concurrent false", - "commit-msg": "ts-node scripts/verifyCommit.ts" + "simple-git-hooks": { + "pre-commit": "pnpm exec lint-staged --concurrent false", + "commit-msg": "pnpm exec ts-node scripts/verifyCommit.ts $1" }, "lint-staged": { "*": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1d99bd1eb3919c..7dd7112fbc785c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,13 +36,13 @@ importers: rimraf: ^3.0.2 rollup: ^2.59.0 semver: ^7.3.5 + simple-git-hooks: ^2.7.0 sirv: ^2.0.0 ts-jest: ^27.1.2 ts-node: ^10.4.0 typescript: ~4.5.4 vite: workspace:* vitepress: ^0.20.10 - yorkie: ^2.0.0 devDependencies: '@microsoft/api-extractor': 7.19.3 '@types/fs-extra': 9.0.13 @@ -72,13 +72,13 @@ importers: rimraf: 3.0.2 rollup: 2.62.0 semver: 7.3.5 + simple-git-hooks: 2.7.0 sirv: 2.0.0 ts-jest: 27.1.2_1b5a1be2010a86e622f02a11eaeb730f ts-node: 10.4.0_00264fd83560919cd06c986889baae0a typescript: 4.5.4 vite: link:packages/vite vitepress: 0.20.10 - yorkie: 2.0.0 packages/create-vite: specifiers: @@ -3083,10 +3083,6 @@ packages: engines: {node: '>=10'} dev: false - /ci-info/1.6.0: - resolution: {integrity: sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==} - dev: true - /ci-info/3.3.0: resolution: {integrity: sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==} dev: true @@ -3226,6 +3222,7 @@ packages: /commander/2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + requiresBuild: true dev: true /commander/7.2.0: @@ -3544,16 +3541,6 @@ packages: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} dev: true - /create-vite/2.7.2: - resolution: {integrity: sha512-4Eint1oL6GcZWGkgLbSmbzY1UNTkqQyjD9T4aM1YQsltKQ5ZNWDy+rvgYRPV9dR0XD6eLPs8TUUoge1xQCd4BA==} - engines: {node: '>=12.0.0'} - hasBin: true - dependencies: - kolorist: 1.5.0 - minimist: 1.2.5 - prompts: 2.4.2 - dev: false - /cross-env/7.0.3: resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} @@ -3562,14 +3549,6 @@ packages: cross-spawn: 7.0.3 dev: true - /cross-spawn/5.1.0: - resolution: {integrity: sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=} - dependencies: - lru-cache: 4.1.5 - shebang-command: 1.2.0 - which: 1.3.1 - dev: true - /cross-spawn/6.0.5: resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==} engines: {node: '>=4.8'} @@ -4371,19 +4350,6 @@ packages: resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} dev: true - /execa/0.8.0: - resolution: {integrity: sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=} - engines: {node: '>=4'} - dependencies: - cross-spawn: 5.1.0 - get-stream: 3.0.0 - is-stream: 1.1.0 - npm-run-path: 2.0.2 - p-finally: 1.0.0 - signal-exit: 3.0.6 - strip-eof: 1.0.0 - dev: true - /execa/5.1.1: resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} engines: {node: '>=10'} @@ -4702,11 +4668,6 @@ packages: yargs: 16.2.0 dev: true - /get-stream/3.0.0: - resolution: {integrity: sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=} - engines: {node: '>=4'} - dev: true - /get-stream/5.2.0: resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==} engines: {node: '>=8'} @@ -5154,13 +5115,6 @@ packages: engines: {node: '>= 0.4'} dev: true - /is-ci/1.2.1: - resolution: {integrity: sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==} - hasBin: true - dependencies: - ci-info: 1.6.0 - dev: true - /is-color-stop/1.1.0: resolution: {integrity: sha1-z/9HGu5N1cnhWFmPvhKWe1za00U=} dependencies: @@ -5277,11 +5231,6 @@ packages: resolution: {integrity: sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==} dev: true - /is-stream/1.1.0: - resolution: {integrity: sha1-EtSj3U5o4Lec6428hBc66A2RykQ=} - engines: {node: '>=0.10.0'} - dev: true - /is-stream/2.0.1: resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} engines: {node: '>=8'} @@ -6212,13 +6161,6 @@ packages: js-tokens: 4.0.0 dev: false - /lru-cache/4.1.5: - resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} - dependencies: - pseudomap: 1.0.2 - yallist: 2.1.2 - dev: true - /lru-cache/6.0.0: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} engines: {node: '>=10'} @@ -6587,11 +6529,6 @@ packages: validate-npm-package-license: 3.0.4 dev: true - /normalize-path/1.0.0: - resolution: {integrity: sha1-MtDkcvkf80VwHBWoMRAY07CpA3k=} - engines: {node: '>=0.10.0'} - dev: true - /normalize-path/3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -6621,13 +6558,6 @@ packages: string.prototype.padend: 3.1.3 dev: true - /npm-run-path/2.0.2: - resolution: {integrity: sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=} - engines: {node: '>=4'} - dependencies: - path-key: 2.0.1 - dev: true - /npm-run-path/4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -6743,11 +6673,6 @@ packages: word-wrap: 1.2.3 dev: true - /p-finally/1.0.0: - resolution: {integrity: sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=} - engines: {node: '>=4'} - dev: true - /p-limit/1.3.0: resolution: {integrity: sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==} engines: {node: '>=4'} @@ -7204,10 +7129,6 @@ packages: dev: true optional: true - /pseudomap/1.0.2: - resolution: {integrity: sha1-8FKijacOYYkX7wqKw0wa5aaChrM=} - dev: true - /psl/1.8.0: resolution: {integrity: sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==} dev: true @@ -7835,6 +7756,12 @@ packages: /signal-exit/3.0.6: resolution: {integrity: sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==} + /simple-git-hooks/2.7.0: + resolution: {integrity: sha512-nQe6ASMO9zn5/htIrU37xEIHGr9E6wikXelLbOeTcfsX2O++DHaVug7RSQoq+kO7DvZTH37WA5gW49hN9HTDmQ==} + hasBin: true + requiresBuild: true + dev: true + /simple-swizzle/0.2.2: resolution: {integrity: sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=} dependencies: @@ -8127,21 +8054,11 @@ packages: engines: {node: '>=8'} dev: true - /strip-eof/1.0.0: - resolution: {integrity: sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=} - engines: {node: '>=0.10.0'} - dev: true - /strip-final-newline/2.0.0: resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} engines: {node: '>=6'} dev: true - /strip-indent/2.0.0: - resolution: {integrity: sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=} - engines: {node: '>=4'} - dev: true - /strip-indent/3.0.0: resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==} engines: {node: '>=8'} @@ -8993,10 +8910,6 @@ packages: engines: {node: '>=10'} dev: true - /yallist/2.1.2: - resolution: {integrity: sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=} - dev: true - /yallist/4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} @@ -9040,17 +8953,6 @@ packages: engines: {node: '>=6'} dev: true - /yorkie/2.0.0: - resolution: {integrity: sha512-jcKpkthap6x63MB4TxwCyuIGkV0oYP/YRyuQU5UO0Yz/E/ZAu+653/uov+phdmO54n6BcvFRyyt0RRrWdN2mpw==} - engines: {node: '>=4'} - requiresBuild: true - dependencies: - execa: 0.8.0 - is-ci: 1.2.1 - normalize-path: 1.0.0 - strip-indent: 2.0.0 - dev: true - /youch/2.2.2: resolution: {integrity: sha512-/FaCeG3GkuJwaMR34GHVg0l8jCbafZLHiFowSjqLlqhC6OMyf2tPJBu8UirF7/NI9X/R5ai4QfEKUCOxMAGxZQ==} dependencies: diff --git a/scripts/verifyCommit.ts b/scripts/verifyCommit.ts index 47ec89c2d1c9e1..e433e3aa1aa3e5 100644 --- a/scripts/verifyCommit.ts +++ b/scripts/verifyCommit.ts @@ -1,9 +1,10 @@ -// Invoked on the commit-msg git hook by yorkie. +// Invoked on the commit-msg git hook by simple-git-hooks. import colors from 'picocolors' import { readFileSync } from 'fs' -const msgPath = process.env.GIT_PARAMS! +// get $1 from commit-msg script +const msgPath = process.argv[2] const msg = readFileSync(msgPath, 'utf-8').trim() const releaseRE = /^v\d/ From a34561490b4b866d8d4f98c697435dcb68a5c3ed Mon Sep 17 00:00:00 2001 From: poyoho <907415276@qq.com> Date: Thu, 6 Jan 2022 16:40:35 +0800 Subject: [PATCH 0168/1287] feat: new Worker can bundle URL('path', import.meta.url) script (fix #5979) (#6356) --- .../worker/__tests__/worker.spec.ts | 16 +++- packages/playground/worker/index.html | 39 +++++++- packages/playground/worker/newUrl/module.js | 1 + .../worker/newUrl/url-shared-worker.js | 6 ++ .../playground/worker/newUrl/url-worker.js | 3 + packages/vite/src/node/config.ts | 33 ++++++- packages/vite/src/node/plugins/index.ts | 2 + packages/vite/src/node/plugins/worker.ts | 71 +++++++------- .../src/node/plugins/workerImportMetaUrl.ts | 96 +++++++++++++++++++ 9 files changed, 221 insertions(+), 46 deletions(-) create mode 100644 packages/playground/worker/newUrl/module.js create mode 100644 packages/playground/worker/newUrl/url-shared-worker.js create mode 100644 packages/playground/worker/newUrl/url-worker.js create mode 100644 packages/vite/src/node/plugins/workerImportMetaUrl.ts diff --git a/packages/playground/worker/__tests__/worker.spec.ts b/packages/playground/worker/__tests__/worker.spec.ts index 21e1a47141d637..5992a37f933f2a 100644 --- a/packages/playground/worker/__tests__/worker.spec.ts +++ b/packages/playground/worker/__tests__/worker.spec.ts @@ -52,11 +52,11 @@ test.concurrent.each([[true], [false]])('shared worker', async (doTick) => { }) if (isBuild) { + const assetsDir = path.resolve(testDir, 'dist/assets') // assert correct files test('inlined code generation', async () => { - const assetsDir = path.resolve(testDir, 'dist/assets') const files = fs.readdirSync(assetsDir) - expect(files.length).toBe(4) + expect(files.length).toBe(6) const index = files.find((f) => f.includes('index')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const worker = files.find((f) => f.includes('my-worker')) @@ -75,4 +75,16 @@ if (isBuild) { expect(content).toMatch(`(window.URL||window.webkitURL).createObjectURL`) expect(content).toMatch(`window.Blob`) }) + + test('worker need bundle', () => { + fs.readdirSync(assetsDir) + .filter( + (file) => + file.includes('url-worker') || file.includes('url-shared-worker') + ) + .forEach((file) => { + const content = fs.readFileSync(path.resolve(assetsDir, file), 'utf-8') + expect(content.startsWith('(function(){')).toBe(true) + }) + }) } diff --git a/packages/playground/worker/index.html b/packages/playground/worker/index.html index a075134df175e5..be0b3becb5f94f 100644 --- a/packages/playground/worker/index.html +++ b/packages/playground/worker/index.html @@ -20,16 +20,22 @@ 0 +

new Worker(new Url('path', import.meta.url))

+
+ +

new SharedWorker(new Url('path', import.meta.url))

+
+ diff --git a/packages/playground/worker/newUrl/module.js b/packages/playground/worker/newUrl/module.js new file mode 100644 index 00000000000000..8b84d26d5c74f3 --- /dev/null +++ b/packages/playground/worker/newUrl/module.js @@ -0,0 +1 @@ +export default 'A string' diff --git a/packages/playground/worker/newUrl/url-shared-worker.js b/packages/playground/worker/newUrl/url-shared-worker.js new file mode 100644 index 00000000000000..f52de169243056 --- /dev/null +++ b/packages/playground/worker/newUrl/url-shared-worker.js @@ -0,0 +1,6 @@ +import constant from './module' + +self.onconnect = (event) => { + const port = event.ports[0] + port.postMessage(constant) +} diff --git a/packages/playground/worker/newUrl/url-worker.js b/packages/playground/worker/newUrl/url-worker.js new file mode 100644 index 00000000000000..afd91bfe613dc2 --- /dev/null +++ b/packages/playground/worker/newUrl/url-worker.js @@ -0,0 +1,3 @@ +import constant from './module' + +self.postMessage(constant) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 1996e0fd8b8491..68f7e99ddac045 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -222,6 +222,12 @@ export interface SSROptions { target?: SSRTarget } +export interface ResolveWorkerOptions { + format: 'es' | 'iife' + plugins: Plugin[] + rollupOptions: RollupOptions +} + export interface InlineConfig extends UserConfig { configFile?: string | false envFile?: false @@ -230,7 +236,7 @@ export interface InlineConfig extends UserConfig { export type ResolvedConfig = Readonly< Omit< UserConfig, - 'plugins' | 'alias' | 'dedupe' | 'assetsInclude' | 'optimizeDeps' + 'plugins' | 'alias' | 'dedupe' | 'assetsInclude' | 'optimizeDeps' | 'worker' > & { configFile: string | undefined configFileDependencies: string[] @@ -255,6 +261,7 @@ export type ResolvedConfig = Readonly< optimizeDeps: Omit /** @internal */ packageCache: PackageCache + worker: ResolveWorkerOptions } > @@ -326,6 +333,13 @@ export async function resolveConfig( const [prePlugins, normalPlugins, postPlugins] = sortUserPlugins(rawUserPlugins) + // resolve worker + const resolvedWorkerOptions: ResolveWorkerOptions = { + format: config.worker?.format || 'iife', + plugins: [], + rollupOptions: config.worker?.rollupOptions || {} + } + // run config hooks const userPlugins = [...prePlugins, ...normalPlugins, ...postPlugins] for (const p of userPlugins) { @@ -487,9 +501,24 @@ export async function resolveConfig( preserveSymlinks: config.resolve?.preserveSymlinks, ...config.optimizeDeps?.esbuildOptions } - } + }, + worker: resolvedWorkerOptions } + // flat config.worker.plugin + const [workerPrePlugins, workerNormalPlugins, workerPostPlugins] = + sortUserPlugins(config.worker?.plugins as Plugin[]) + const workerResolved = { ...resolved } + resolved.worker.plugins = await resolvePlugins( + workerResolved, + workerPrePlugins, + workerNormalPlugins, + workerPostPlugins + ) + // call configResolved worker plugins hooks + await Promise.all( + resolved.worker.plugins.map((p) => p.configResolved?.(workerResolved)) + ) ;(resolved.plugins as Plugin[]) = await resolvePlugins( resolved, prePlugins, diff --git a/packages/vite/src/node/plugins/index.ts b/packages/vite/src/node/plugins/index.ts index fccdfb449b7ffe..e4f3d453527af3 100644 --- a/packages/vite/src/node/plugins/index.ts +++ b/packages/vite/src/node/plugins/index.ts @@ -15,6 +15,7 @@ import { webWorkerPlugin } from './worker' import { preAliasPlugin } from './preAlias' import { definePlugin } from './define' import { ssrRequireHookPlugin } from './ssrRequireHook' +import { workerImportMetaUrlPlugin } from './workerImportMetaUrl' export async function resolvePlugins( config: ResolvedConfig, @@ -56,6 +57,7 @@ export async function resolvePlugins( ), wasmPlugin(config), webWorkerPlugin(config), + workerImportMetaUrlPlugin(config), assetPlugin(config), ...normalPlugins, definePlugin(config), diff --git a/packages/vite/src/node/plugins/worker.ts b/packages/vite/src/node/plugins/worker.ts index dc9a55ce6ff55d..5ce0936748ea05 100644 --- a/packages/vite/src/node/plugins/worker.ts +++ b/packages/vite/src/node/plugins/worker.ts @@ -1,5 +1,4 @@ import type { ResolvedConfig } from '../config' -import { sortUserPlugins } from '../config' import type { Plugin } from '../plugin' import { fileToUrl, getAssetHash } from './asset' import { cleanUrl, injectQuery, parseRequest } from '../utils' @@ -7,17 +6,40 @@ import type Rollup from 'rollup' import { ENV_PUBLIC_PATH } from '../constants' import path from 'path' import { onRollupWarning } from '../build' -import { resolvePlugins } from '.' const WorkerFileId = 'worker_file' +export async function bundleWorkerEntry( + config: ResolvedConfig, + id: string +): Promise { + // bundle the file as entry to support imports + const rollup = require('rollup') as typeof Rollup + const { plugins, rollupOptions, format } = config.worker + const bundle = await rollup.rollup({ + ...rollupOptions, + input: cleanUrl(id), + plugins, + onwarn(warning, warn) { + onRollupWarning(warning, warn, config) + }, + preserveEntrySignatures: false + }) + let code: string + try { + const { output } = await bundle.generate({ + format, + sourcemap: config.build.sourcemap + }) + code = output[0].code + } finally { + await bundle.close() + } + return Buffer.from(code) +} + export function webWorkerPlugin(config: ResolvedConfig): Plugin { const isBuild = config.command === 'build' - const workerBundleOptions = { - format: config.worker?.format || 'iife', - plugins: sortUserPlugins(config.worker?.plugins as Plugin[]), - rollupOptions: config.worker?.rollupOptions || {} - } return { name: 'vite:worker', @@ -50,39 +72,12 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin { let url: string if (isBuild) { - // bundle the file as entry to support imports - const rollup = require('rollup') as typeof Rollup - const { plugins, rollupOptions, format } = workerBundleOptions - const [prePlugins, normalPlugins, postPlugins] = plugins - const bundle = await rollup.rollup({ - ...rollupOptions, - input: cleanUrl(id), - plugins: await resolvePlugins( - { ...config }, - prePlugins, - normalPlugins, - postPlugins - ), - onwarn(warning, warn) { - onRollupWarning(warning, warn, config) - }, - preserveEntrySignatures: false - }) - let code: string - try { - const { output } = await bundle.generate({ - format, - sourcemap: config.build.sourcemap - }) - code = output[0].code - } finally { - await bundle.close() - } - const content = Buffer.from(code) + const code = await bundleWorkerEntry(config, id) if (query.inline != null) { + const { format } = config.worker const workerOptions = format === 'es' ? '{type: "module"}' : '{}' // inline as blob data url - return `const encodedJs = "${content.toString('base64')}"; + return `const encodedJs = "${code.toString('base64')}"; const blob = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs)], { type: "text/javascript;charset=utf-8" }); export default function WorkerWrapper() { const objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob); @@ -94,7 +89,7 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin { }` } else { const basename = path.parse(cleanUrl(id)).name - const contentHash = getAssetHash(content) + const contentHash = getAssetHash(code) const fileName = path.posix.join( config.build.assetsDir, `${basename}.${contentHash}.js` diff --git a/packages/vite/src/node/plugins/workerImportMetaUrl.ts b/packages/vite/src/node/plugins/workerImportMetaUrl.ts new file mode 100644 index 00000000000000..13c0ef2bb3883b --- /dev/null +++ b/packages/vite/src/node/plugins/workerImportMetaUrl.ts @@ -0,0 +1,96 @@ +import type { ResolvedConfig } from '../config' +import type { Plugin } from '../plugin' +import { getAssetHash, fileToUrl } from './asset' +import { + cleanUrl, + injectQuery, + multilineCommentsRE, + singlelineCommentsRE +} from '../utils' +import path from 'path' +import { bundleWorkerEntry } from './worker' +import { parseRequest } from '../utils' +import { ENV_PUBLIC_PATH } from '../constants' +import MagicString from 'magic-string' + +const WORKER_FILE_ID = 'worker_url_file' + +export function workerImportMetaUrlPlugin(config: ResolvedConfig): Plugin { + const isBuild = config.command === 'build' + + return { + name: 'vite:worker-import-meta-url', + + async transform(code, id, options) { + const query = parseRequest(id) + if (query && query[WORKER_FILE_ID] != null) { + return { + code: `import '${ENV_PUBLIC_PATH}'\n` + code + } + } + if ( + (code.includes('new Worker') || code.includes('new ShareWorker')) && + code.includes('new URL') && + code.includes(`import.meta.url`) + ) { + const importMetaUrlRE = + /\bnew\s+(Worker|SharedWorker)\s*\(\s*(new\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*\))/g + const noCommentsCode = code + .replace(multilineCommentsRE, (m) => ' '.repeat(m.length)) + .replace(singlelineCommentsRE, (m) => ' '.repeat(m.length)) + let match: RegExpExecArray | null + let s: MagicString | null = null + while ((match = importMetaUrlRE.exec(noCommentsCode))) { + const { 0: allExp, 2: exp, 3: rawUrl, index } = match + + const urlIndex = allExp.indexOf(exp) + index + + if (options?.ssr) { + this.error( + `\`new URL(url, import.meta.url)\` is not supported in SSR.`, + urlIndex + ) + } + + // potential dynamic template string + if (rawUrl[0] === '`' && /\$\{/.test(rawUrl)) { + this.error( + `\`new URL(url, import.meta.url)\` is not supported in dynamic template string.`, + urlIndex + ) + } + + s ||= new MagicString(code) + + const file = path.resolve(path.dirname(id), rawUrl.slice(1, -1)) + let url: string + if (isBuild) { + const content = await bundleWorkerEntry(config, file) + const basename = path.parse(cleanUrl(file)).name + const contentHash = getAssetHash(content) + const fileName = path.posix.join( + config.build.assetsDir, + `${basename}.${contentHash}.js` + ) + url = `__VITE_ASSET__${this.emitFile({ + fileName, + type: 'asset', + source: content + })}__` + } else { + url = await fileToUrl(cleanUrl(file), config, this) + url = injectQuery(url, WORKER_FILE_ID) + } + s.overwrite(urlIndex, urlIndex + exp.length, JSON.stringify(url)) + } + if (s) { + return { + code: s.toString(), + map: config.build.sourcemap ? s.generateMap({ hires: true }) : null + } + } + return null + } + } + } +} From bd4c3a5dcbb20da5cfd93daf38932bccb45a7742 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Thu, 6 Jan 2022 10:45:20 +0100 Subject: [PATCH 0169/1287] release: v2.8.0-beta.1 --- packages/vite/CHANGELOG.md | 9 +++++++++ packages/vite/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index db3ac75fab3069..9f35b77c65c961 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,12 @@ +# [2.8.0-beta.1](https://github.com/vitejs/vite/compare/v2.8.0-beta.0...v2.8.0-beta.1) (2022-01-06) + + +### Features + +* new Worker can bundle URL('path', import.meta.url) script (fix [#5979](https://github.com/vitejs/vite/issues/5979)) ([#6356](https://github.com/vitejs/vite/issues/6356)) ([a345614](https://github.com/vitejs/vite/commit/a34561490b4b866d8d4f98c697435dcb68a5c3ed)) + + + # [2.8.0-beta.0](https://github.com/vitejs/vite/compare/v2.7.9...v2.8.0-beta.0) (2022-01-05) diff --git a/packages/vite/package.json b/packages/vite/package.json index 44bfeb793c35ae..eff26ff2eed88b 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.8.0-beta.0", + "version": "2.8.0-beta.1", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From 647168b2b44b82b1a1cbd8e639f74ddf52a5d5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Barr=C3=A9?= Date: Fri, 7 Jan 2022 17:24:44 +0100 Subject: [PATCH 0170/1287] fix: use cacheDir for resolveHttpsConfig (#6416) --- packages/vite/src/node/http.ts | 4 ++-- packages/vite/src/node/server/index.ts | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/node/http.ts b/packages/vite/src/node/http.ts index 28be35c276c6c8..becc2191efac7f 100644 --- a/packages/vite/src/node/http.ts +++ b/packages/vite/src/node/http.ts @@ -121,8 +121,8 @@ export async function resolveHttpServer( } export async function resolveHttpsConfig( - https?: boolean | HttpsServerOptions, - cacheDir?: string + https: boolean | HttpsServerOptions | undefined, + cacheDir: string | undefined ): Promise { if (!https) return undefined diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index 61bda062268d52..edd7f43f84f8b0 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -303,7 +303,10 @@ export async function createServer( const config = await resolveConfig(inlineConfig, 'serve', 'development') const root = config.root const serverConfig = config.server - const httpsOptions = await resolveHttpsConfig(config.server.https) + const httpsOptions = await resolveHttpsConfig( + config.server.https, + config.cacheDir + ) let { middlewareMode } = serverConfig if (middlewareMode === true) { middlewareMode = 'ssr' From 8fb854fd62f0edc9b1d1bab79b7d9b11cd03cf90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E9=9D=92=E5=B7=9D?= <46062972+ShenQingchuan@users.noreply.github.com> Date: Sat, 8 Jan 2022 00:49:29 +0800 Subject: [PATCH 0171/1287] chore: add translation contribution guide. (#6400) * chore: add translation contribution guide. * chore: some fix. * chore: update Co-authored-by: patak-dev --- CONTRIBUTING.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 891e05cff3c5e4..4d1c076df2d544 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -183,3 +183,28 @@ We already have many config options, and we should avoid fixing an issue by addi - Whether the problem can be fixed with a smarter default - Whether the problem has workaround using existing options - Whether the problem can be addressed with a plugin instead + +## Docs translation contribution + +If you would like to start a translation in your language, you are welcome to contribute! Please join [the #translations channel in Vite Land](https://chat.vitejs.dev) to discuss and coordinate with others. + +The english docs are embeded in the main Vite repo, to allow contributors to work on docs, tests and implementation in the same PR. Translations are done by forking the main repo. + +### How to start a translation repo + +1. In order to get all doc files, you first need to clone this repo in your personal account. +2. Keep all the files in `docs/` and remove everything else. + + - You should setup your translation site based on all the files in `docs/` folder as a Vitepress project. + (that said, `package.json` is need). + + - Refresh git history by removing `.git` and then `git init` + +3. Translate the docs. + + - During this stage, you may be translating documents and synchronizing updates at the same time, but don't worry about that, it's very common in translation contribution. + +4. Push your commits to your Github repo. you can setup a netlify preview as well. +5. Use [Ryu-cho](https://github.com/vuejs-translations/ryu-cho) tool to setup a Github Action, automatically track English docs update later. + +We recommend talking with others in Vite Land so you find more contributors for your language to share the maintainance work. Once the translation is done, communicate it to the Vite team so the repo can be moved to the official vitejs org in GitHub. From 4f820e59c5e28787950d415e05f057e35cbb5005 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 10 Jan 2022 09:23:12 +0100 Subject: [PATCH 0172/1287] chore(deps): update dependency node-forge to v1 (#6425) --- packages/vite/package.json | 2 +- pnpm-lock.yaml | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/vite/package.json b/packages/vite/package.json index eff26ff2eed88b..d48e5c33154d59 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -99,7 +99,7 @@ "magic-string": "^0.25.7", "micromatch": "^4.0.4", "mrmime": "^1.0.0", - "node-forge": "^0.10.0", + "node-forge": "^1.2.0", "okie": "^1.0.1", "open": "^8.4.0", "periscopic": "^2.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7dd7112fbc785c..a0336ef4b55d04 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -427,6 +427,9 @@ importers: resolve-exports-path: link:exports-path resolve-linked: link:../resolve-linked + packages/playground/resolve-config: + specifiers: {} + packages/playground/resolve-linked: specifiers: {} @@ -768,7 +771,7 @@ importers: magic-string: ^0.25.7 micromatch: ^4.0.4 mrmime: ^1.0.0 - node-forge: ^0.10.0 + node-forge: ^1.2.0 okie: ^1.0.1 open: ^8.4.0 periscopic: ^2.0.3 @@ -844,7 +847,7 @@ importers: magic-string: 0.25.7 micromatch: 4.0.4 mrmime: 1.0.0 - node-forge: 0.10.0 + node-forge: 1.2.0 okie: 1.0.1 open: 8.4.0 periscopic: 2.0.3 @@ -6495,6 +6498,11 @@ packages: engines: {node: '>= 6.0.0'} dev: true + /node-forge/1.2.0: + resolution: {integrity: sha512-M4AsdaP0bGNaSPtatd/+f76asocI0cFaURRdeQVZvrJBrYp2Qohv5hDbGHykuNqCb1BYjWHjdS6HlN50qbztwA==} + engines: {node: '>= 6.13.0'} + dev: true + /node-int64/0.4.0: resolution: {integrity: sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=} dev: true From 028cbeb34adef217f274be7c4a7dd5c9f9b12b29 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Mon, 10 Jan 2022 03:26:07 -0500 Subject: [PATCH 0173/1287] fix: improve array config merging (#6344) --- .../vite/src/node/__tests__/config.spec.ts | 16 ++++++++++++ packages/vite/src/node/config.ts | 25 ++++++++++--------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/packages/vite/src/node/__tests__/config.spec.ts b/packages/vite/src/node/__tests__/config.spec.ts index dc4452262797fc..7afd67fe792d20 100644 --- a/packages/vite/src/node/__tests__/config.spec.ts +++ b/packages/vite/src/node/__tests__/config.spec.ts @@ -46,6 +46,22 @@ describe('mergeConfig', () => { expect(mergeConfig(baseConfig, newConfig)).toEqual(mergedConfig) }) + test('handles arrays', () => { + const baseConfig: UserConfigExport = { + envPrefix: 'string1' + } + + const newConfig: UserConfigExport = { + envPrefix: ['string2', 'string3'] + } + + const mergedConfig: UserConfigExport = { + envPrefix: ['string1', 'string2', 'string3'] + } + + expect(mergeConfig(baseConfig, newConfig)).toEqual(mergedConfig) + }) + test('handles assetsInclude', () => { const baseConfig: UserConfigExport = { assetsInclude: 'some-string' diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 68f7e99ddac045..931dcc885876a9 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -728,18 +728,6 @@ function mergeConfigRecursively( } const existing = merged[key] - if (Array.isArray(existing) && Array.isArray(value)) { - merged[key] = [...existing, ...value] - continue - } - if (isObject(existing) && isObject(value)) { - merged[key] = mergeConfigRecursively( - existing, - value, - rootPath ? `${rootPath}.${key}` : key - ) - continue - } // fields that require special handling if (existing != null) { @@ -754,6 +742,19 @@ function mergeConfigRecursively( } } + if (Array.isArray(existing) || Array.isArray(value)) { + merged[key] = [...arraify(existing), ...arraify(value)] + continue + } + if (isObject(existing) && isObject(value)) { + merged[key] = mergeConfigRecursively( + existing, + value, + rootPath ? `${rootPath}.${key}` : key + ) + continue + } + merged[key] = value } return merged From ccf7d791497139951fde58168999d44e18f706ee Mon Sep 17 00:00:00 2001 From: Oyster Lee Date: Tue, 11 Jan 2022 16:58:26 +0800 Subject: [PATCH 0174/1287] fix(types): add missing options parameter to importMeta (#6433) --- packages/vite/types/importMeta.d.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/vite/types/importMeta.d.ts b/packages/vite/types/importMeta.d.ts index d93fed42129c26..4ff865658cf372 100644 --- a/packages/vite/types/importMeta.d.ts +++ b/packages/vite/types/importMeta.d.ts @@ -4,6 +4,8 @@ /* eslint-disable @typescript-eslint/consistent-type-imports */ +import type { AssertOptions } from '../src/node/importGlob' + interface ImportMeta { url: string @@ -50,14 +52,20 @@ interface ImportMeta { readonly env: ImportMetaEnv - glob(pattern: string): Record< + glob( + pattern: string, + options?: AssertOptions + ): Record< string, () => Promise<{ [key: string]: any }> > - globEager(pattern: string): Record< + globEager( + pattern: string, + options?: AssertOptions + ): Record< string, { [key: string]: any From 5d7b4c31b8e44add7c192ae8af4b90b9378ae1fe Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Tue, 11 Jan 2022 21:11:30 +0630 Subject: [PATCH 0175/1287] fix(types): dynamic import in import.meta (#6456) ref #6433 --- packages/vite/types/importMeta.d.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/vite/types/importMeta.d.ts b/packages/vite/types/importMeta.d.ts index 4ff865658cf372..2a8e319738ef56 100644 --- a/packages/vite/types/importMeta.d.ts +++ b/packages/vite/types/importMeta.d.ts @@ -4,8 +4,6 @@ /* eslint-disable @typescript-eslint/consistent-type-imports */ -import type { AssertOptions } from '../src/node/importGlob' - interface ImportMeta { url: string @@ -54,7 +52,7 @@ interface ImportMeta { glob( pattern: string, - options?: AssertOptions + options?: import('../src/node/importGlob').AssertOptions ): Record< string, () => Promise<{ @@ -64,7 +62,7 @@ interface ImportMeta { globEager( pattern: string, - options?: AssertOptions + options?: import('../src/node/importGlob').AssertOptions ): Record< string, { From 7541a8d570d9bbf0ab0cd4264cae985dddaf3189 Mon Sep 17 00:00:00 2001 From: Daniel Imfeld Date: Tue, 11 Jan 2022 11:57:31 -1000 Subject: [PATCH 0176/1287] fix: only run build-html plugin on bundler inputs (fix #4067) (#5342) --- .../playground/html/__tests__/html.spec.ts | 19 +++++++++++++++ packages/playground/html/importAsString.html | 5 ++++ packages/playground/html/main.js | 2 ++ packages/playground/html/vite.config.js | 12 ++++++++++ packages/vite/src/node/plugins/html.ts | 23 ++++++++++++++++++- 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 packages/playground/html/importAsString.html diff --git a/packages/playground/html/__tests__/html.spec.ts b/packages/playground/html/__tests__/html.spec.ts index 66f537e5026361..1a663efb146977 100644 --- a/packages/playground/html/__tests__/html.spec.ts +++ b/packages/playground/html/__tests__/html.spec.ts @@ -197,6 +197,25 @@ describe('noBody', () => { }) }) +describe('importAsString', () => { + // The build-html plugin should not alter HTML that is not an input. + test('not transformed', async () => { + const messages = [] + function addConsoleMessage(message) { + messages.push(message.args()[0]) + } + + page.on('console', addConsoleMessage) + await page.goto(viteTestUrl + '/index.html') + await page.waitForLoadState() + page.off('console', addConsoleMessage) + + const result = messages.map((m) => m.toString()).join('\n') + expect(result).toMatch('Some imported HTML') + expect(result).not.toMatch('This is injected') + }) +}) + describe('unicode path', () => { test('direct access', async () => { await page.goto( diff --git a/packages/playground/html/importAsString.html b/packages/playground/html/importAsString.html new file mode 100644 index 00000000000000..a9f57d697bef91 --- /dev/null +++ b/packages/playground/html/importAsString.html @@ -0,0 +1,5 @@ + + + Some imported HTML + + diff --git a/packages/playground/html/main.js b/packages/playground/html/main.js index cd769880553ced..c44ec322c965f7 100644 --- a/packages/playground/html/main.js +++ b/packages/playground/html/main.js @@ -1,4 +1,6 @@ import { msg } from './shared' +import asString from './importAsString.html' import './common.css' console.log(msg + ' from main') +console.log('loaded string ' + asString) diff --git a/packages/playground/html/vite.config.js b/packages/playground/html/vite.config.js index 1703e02cc05366..7dc01af7d9ca79 100644 --- a/packages/playground/html/vite.config.js +++ b/packages/playground/html/vite.config.js @@ -157,6 +157,18 @@ ${ } ] } + }, + { + // Emulate rollup-plugin-string + name: 'import-as-string-module', + transform(code, id) { + if (id.endsWith('importAsString.html')) { + return { + code: `export default ${JSON.stringify(code)}`, + map: { mappings: '' } + } + } + } } ] } diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index 0cbad741d27738..8ddf77aac37f1d 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -214,11 +214,32 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin { // Same reason with `htmlInlineProxyPlugin` isAsyncScriptMap.set(config, new Map()) + const inputFiles = new Set() + return { name: 'vite:build-html', + buildStart({ input }) { + isAsyncScriptMap.set(config, new Map()) + + let allInputs: string[] + if (typeof input === 'string') { + allInputs = [input] + } else if (Array.isArray(input)) { + allInputs = input + } else { + allInputs = Object.values(input) + } + + for (const filename of allInputs) { + if (filename.endsWith('.html')) { + inputFiles.add(normalizePath(filename)) + } + } + }, + async transform(html, id) { - if (id.endsWith('.html')) { + if (inputFiles.has(id)) { const publicPath = `/${slash(path.relative(config.root, id))}` // pre-transform html = await applyHtmlTransforms(html, preHooks, { From 6408a3ab9bd97f1542982755b5044871a78b59d4 Mon Sep 17 00:00:00 2001 From: OneNail <31649110+OneNail@users.noreply.github.com> Date: Wed, 12 Jan 2022 06:08:09 +0800 Subject: [PATCH 0177/1287] feat: add customResolver option to resolve.alias (#5876) --- docs/config/index.md | 4 ++-- .../playground/alias/__tests__/alias.spec.ts | 6 ++++++ packages/playground/alias/customResolver.js | 1 + packages/playground/alias/index.html | 3 +++ packages/playground/alias/vite.config.js | 9 ++++++++- packages/vite/src/node/config.ts | 16 ++++++++++++++-- 6 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 packages/playground/alias/customResolver.js diff --git a/docs/config/index.md b/docs/config/index.md index 040799ce7a0a0d..5d2de719e8ccaa 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -174,9 +174,9 @@ export default defineConfig(async ({ command, mode }) => { ### resolve.alias - **Type:** - `Record | Array<{ find: string | RegExp, replacement: string }>` + `Record | Array<{ find: string | RegExp, replacement: string, customResolver?: ResolverFunction | ResolverObject }>` - Will be passed to `@rollup/plugin-alias` as its [entries option](https://github.com/rollup/plugins/tree/master/packages/alias#entries). Can either be an object, or an array of `{ find, replacement }` pairs. + Will be passed to `@rollup/plugin-alias` as its [entries option](https://github.com/rollup/plugins/tree/master/packages/alias#entries). Can either be an object, or an array of `{ find, replacement, customResolver }` pairs. When aliasing to file system paths, always use absolute paths. Relative alias values will be used as-is and will not be resolved into file system paths. diff --git a/packages/playground/alias/__tests__/alias.spec.ts b/packages/playground/alias/__tests__/alias.spec.ts index 5d6ab59a948a22..835dd37521bc77 100644 --- a/packages/playground/alias/__tests__/alias.spec.ts +++ b/packages/playground/alias/__tests__/alias.spec.ts @@ -43,3 +43,9 @@ test('aliased module', async () => { '[success] aliased module' ) }) + +test('custom resolver', async () => { + expect(await page.textContent('.custom-resolver')).toMatch( + '[success] alias to custom-resolver path' + ) +}) diff --git a/packages/playground/alias/customResolver.js b/packages/playground/alias/customResolver.js new file mode 100644 index 00000000000000..1a793ab006958e --- /dev/null +++ b/packages/playground/alias/customResolver.js @@ -0,0 +1 @@ +export const msg = `[success] alias to custom-resolver path` diff --git a/packages/playground/alias/index.html b/packages/playground/alias/index.html index 00a165234e3354..274e8ae635b71e 100644 --- a/packages/playground/alias/index.html +++ b/packages/playground/alias/index.html @@ -6,6 +6,7 @@

Alias

+

@@ -15,6 +16,7 @@

Alias

import { msg as regexMsg } from 'regex/test' import { msg as depMsg } from 'dep' import { msg as moduleMsg } from 'aliased-module/index.js' + import { msg as customResolverMsg } from 'custom-resolver' function text(el, text) { document.querySelector(el).textContent = text @@ -25,6 +27,7 @@

Alias

text('.regex', regexMsg + ' via regex') text('.dep', depMsg) text('.aliased-module', moduleMsg) + text('.custom-resolver', customResolverMsg) import { createApp } from 'vue' import { ref } from 'foo' diff --git a/packages/playground/alias/vite.config.js b/packages/playground/alias/vite.config.js index 34ed93051964d0..530fe86a3de2cb 100644 --- a/packages/playground/alias/vite.config.js +++ b/packages/playground/alias/vite.config.js @@ -17,7 +17,14 @@ module.exports = { // aliasing an optimized dep { find: 'vue', replacement: 'vue/dist/vue.esm-bundler.js' }, // aliasing one unoptimized dep to an optimized dep - { find: 'foo', replacement: 'vue' } + { find: 'foo', replacement: 'vue' }, + { + find: 'custom-resolver', + replacement: path.resolve(__dirname, 'test.js'), + customResolver(id) { + return id.replace('test.js', 'customResolver.js') + } + } ] }, build: { diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 931dcc885876a9..639f4e9176fda9 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -785,7 +785,11 @@ function normalizeAlias(o: AliasOptions): Alias[] { // https://github.com/vitejs/vite/issues/1363 // work around https://github.com/rollup/plugins/issues/759 -function normalizeSingleAlias({ find, replacement }: Alias): Alias { +function normalizeSingleAlias({ + find, + replacement, + customResolver +}: Alias): Alias { if ( typeof find === 'string' && find.endsWith('/') && @@ -794,7 +798,15 @@ function normalizeSingleAlias({ find, replacement }: Alias): Alias { find = find.slice(0, find.length - 1) replacement = replacement.slice(0, replacement.length - 1) } - return { find, replacement } + + const alias: Alias = { + find, + replacement + } + if (customResolver) { + alias.customResolver = customResolver + } + return alias } export function sortUserPlugins( From 669d7e0f4b6ea4a73d3598ab1473b58c72bf093b Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Wed, 12 Jan 2022 13:37:58 +0100 Subject: [PATCH 0178/1287] feat: allow globs in node_modules when pattern is explicit (#6056) --- .gitignore | 1 + .../glob-import/__tests__/glob-import.spec.ts | 7 ++++ .../glob-import/dir/node_modules/hoge.js | 1 + packages/playground/glob-import/index.html | 39 ++++++++++++------- packages/vite/src/node/importGlob.ts | 3 +- 5 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 packages/playground/glob-import/dir/node_modules/hoge.js diff --git a/.gitignore b/.gitignore index 6a9f8063929462..44abdd7bf563db 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .DS_Store node_modules +!**/glob-import/dir/node_modules dist dist-ssr TODOs.md diff --git a/packages/playground/glob-import/__tests__/glob-import.spec.ts b/packages/playground/glob-import/__tests__/glob-import.spec.ts index 311f94cd00571a..3a2425736548ea 100644 --- a/packages/playground/glob-import/__tests__/glob-import.spec.ts +++ b/packages/playground/glob-import/__tests__/glob-import.spec.ts @@ -45,6 +45,10 @@ const allResult = { } } +const nodeModulesResult = { + '/dir/node_modules/hoge.js': { msg: 'hoge' } +} + const rawResult = { '/dir/baz.json': { msg: 'baz' @@ -55,6 +59,9 @@ test('should work', async () => { expect(await page.textContent('.result')).toBe( JSON.stringify(allResult, null, 2) ) + expect(await page.textContent('.result-node_modules')).toBe( + JSON.stringify(nodeModulesResult, null, 2) + ) }) test('import glob raw', async () => { diff --git a/packages/playground/glob-import/dir/node_modules/hoge.js b/packages/playground/glob-import/dir/node_modules/hoge.js new file mode 100644 index 00000000000000..874eb4312f0dc5 --- /dev/null +++ b/packages/playground/glob-import/dir/node_modules/hoge.js @@ -0,0 +1 @@ +export const msg = 'hoge' diff --git a/packages/playground/glob-import/index.html b/packages/playground/glob-import/index.html index e408ec8adda602..bb5e2f3c18f752 100644 --- a/packages/playground/glob-import/index.html +++ b/packages/playground/glob-import/index.html @@ -1,8 +1,30 @@

+

 

 
 
 
 
 
 

url in style tag

url

diff --git a/packages/playground/vue-lib/src-lib/CompB.vue b/packages/playground/vue-lib/src-lib/CompB.vue new file mode 100644 index 00000000000000..cca30168fb6753 --- /dev/null +++ b/packages/playground/vue-lib/src-lib/CompB.vue @@ -0,0 +1,8 @@ + + diff --git a/packages/playground/vue-lib/src-lib/index.ts b/packages/playground/vue-lib/src-lib/index.ts new file mode 100644 index 00000000000000..f83abd4ec72118 --- /dev/null +++ b/packages/playground/vue-lib/src-lib/index.ts @@ -0,0 +1,2 @@ +export { default as CompA } from './CompA.vue' +export { default as CompB } from './CompB.vue' diff --git a/packages/playground/vue-lib/vite.config.consumer.ts b/packages/playground/vue-lib/vite.config.consumer.ts new file mode 100644 index 00000000000000..9e75b5cfbeabcb --- /dev/null +++ b/packages/playground/vue-lib/vite.config.consumer.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' + +export default defineConfig({ + root: __dirname, + build: { + outDir: 'dist/consumer' + }, + plugins: [vue()] +}) diff --git a/packages/playground/vue-lib/vite.config.lib.ts b/packages/playground/vue-lib/vite.config.lib.ts new file mode 100644 index 00000000000000..a888382d008a8c --- /dev/null +++ b/packages/playground/vue-lib/vite.config.lib.ts @@ -0,0 +1,23 @@ +import path from 'path' +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' + +export default defineConfig({ + root: __dirname, + build: { + outDir: 'dist/lib', + lib: { + entry: path.resolve(__dirname, 'src-lib/index.ts'), + name: 'MyVueLib', + formats: ['es'], + fileName: (format) => `my-vue-lib.${format}.js` + }, + rollupOptions: { + external: ['vue'], + output: { + globals: { vue: 'Vue' } + } + } + }, + plugins: [vue()] +}) diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index 29c5cffa4cfa81..3df0e664748dd5 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -299,7 +299,7 @@ async function genStyleCode( attachedProps: [string, string][] ) { let stylesCode = `` - let hasCSSModules = false + let cssModulesMap: Record | undefined if (descriptor.styles.length) { for (let i = 0; i < descriptor.styles.length; i++) { const style = descriptor.styles[i] @@ -320,12 +320,13 @@ async function genStyleCode( ` diff --git a/packages/playground/vue/Main.vue b/packages/playground/vue/Main.vue index ea14dc8f481b86..d10ae401f7aa8e 100644 --- a/packages/playground/vue/Main.vue +++ b/packages/playground/vue/Main.vue @@ -20,7 +20,6 @@ - + + + + + + diff --git a/docs/.vitepress/theme/SponsorsSidebar.vue b/docs/.vitepress/theme/SponsorsSidebar.vue new file mode 100644 index 00000000000000..bb27c8b5ee157d --- /dev/null +++ b/docs/.vitepress/theme/SponsorsSidebar.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/docs/.vitepress/theme/index.js b/docs/.vitepress/theme/index.js index 5d0a1b7a652039..babdc165f30ed8 100644 --- a/docs/.vitepress/theme/index.js +++ b/docs/.vitepress/theme/index.js @@ -1,7 +1,6 @@ import Theme from 'vitepress/theme' import { h } from 'vue' -import sponsors from './sponsors.json' -import './sponsors.css' +import SponsorsSidebar from './SponsorsSidebar.vue' import './custom.css' export default { @@ -9,29 +8,7 @@ export default { Layout() { return h(Theme.Layout, null, { 'sidebar-bottom': () => - h('div', { class: 'sponsors sidebar' }, [ - h( - 'a', - { - href: 'https://github.com/sponsors/yyx990803', - target: '_blank', - rel: 'noopener' - }, - [h('span', 'Sponsors')] - ), - ...sponsors.map(({ href, src, name, id }) => - h( - 'a', - { - href, - target: '_blank', - rel: 'noopener', - 'aria-label': 'sponsor-img' - }, - [h('img', { src, alt: name, id: `sponsor-${id}` })] - ) - ) - ]) + h('div', { class: 'sponsors sidebar' }, [h(SponsorsSidebar)]) }) } } diff --git a/docs/.vitepress/theme/sponsors.css b/docs/.vitepress/theme/sponsors.css deleted file mode 100644 index 904b4945ed57d6..00000000000000 --- a/docs/.vitepress/theme/sponsors.css +++ /dev/null @@ -1,56 +0,0 @@ -.sponsors { - padding: 0 1.5rem 2rem; - font-size: 0.8rem; -} - -.sponsors a { - color: #999; - margin: 1em 2em; - display: block; -} - -.sponsors img { - max-width: 160px; - max-height: 40px; -} - -.sponsors.frontpage { - text-align: center; -} - -.sponsors.frontpage img { - display: inline-block; - vertical-align: middle; -} - -.sponsors.frontpage h2 { - color: #999; - font-size: 1.2rem; - border: none; -} - -.sponsors.sidebar a img { - max-height: 36px; -} - -.platinum-sponsors { - margin-bottom: 1.5em; -} - -.platinum-sponsors a img { - max-width: 240px; - max-height: 60px; -} - -.gold-sponsors { - display: flex; - flex-wrap: wrap; - justify-content: center; - align-items: center; -} - -/* special cases */ -#sponsor-mux { - padding: 5px 0; - min-height: 36px; -} diff --git a/docs/.vitepress/theme/sponsors.json b/docs/.vitepress/theme/sponsors.json deleted file mode 100644 index 6d788ac4b84808..00000000000000 --- a/docs/.vitepress/theme/sponsors.json +++ /dev/null @@ -1,45 +0,0 @@ -[ - { - "id": "stackblitz", - "name": "StackBlitz", - "href": "https://stackblitz.com/", - "src": "/stackblitz.svg", - "tier": "platinum" - }, - { - "id": "cypress", - "name": "Cypress.io", - "href": "https://cypress.io", - "src": "/cypress.svg" - }, - { - "id": "tailwind", - "name": "Tailwind Labs", - "href": "https://tailwindcss.com", - "src": "/tailwind-labs.svg" - }, - { - "id": "vuejobs", - "name": "Vue Jobs", - "href": "https://vuejobs.com/?ref=vuejs", - "src": "/vuejobs.png" - }, - { - "id": "mux", - "name": "Mux", - "href": "https://mux.com", - "src": "/mux.svg" - }, - { - "id": "plaid", - "name": "Plaid Inc.", - "href": "https://plaid.co.jp/", - "src": "/plaid.svg" - }, - { - "id": "divriots", - "name": "divriots", - "href": "https://divriots.com/", - "src": "/divriots.png" - } -] diff --git a/docs/index.md b/docs/index.md index 81b0eb027e8f05..ce1678de00404e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -23,21 +23,16 @@ features: footer: MIT Licensed | Copyright © 2019-present Evan You & Vite Contributors --- -
-

Sponsors

-
- - - -
-
- - - -
- Become a sponsor on GitHub -
- + +

Sponsors

+ + + + + +

+ Become a sponsor on GitHub +

From 7a2ddb43fbe2b777129818d88792db6e848ce2f6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 10:10:35 +0100 Subject: [PATCH 0263/1287] chore(deps): update dependency @ampproject/remapping to v2 (#6690) --- packages/vite/package.json | 2 +- pnpm-lock.yaml | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/packages/vite/package.json b/packages/vite/package.json index 21b83d49e50622..494b6aebc54ea2 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -53,7 +53,7 @@ "fsevents": "~2.3.2" }, "devDependencies": { - "@ampproject/remapping": "^1.1.1", + "@ampproject/remapping": "^2.1.0", "@babel/parser": "^7.17.0", "@babel/types": "^7.17.0", "@rollup/plugin-alias": "^3.1.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b40b226c292e61..ab4083cb6a7635 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -735,7 +735,7 @@ importers: packages/vite: specifiers: - '@ampproject/remapping': ^1.1.1 + '@ampproject/remapping': ^2.1.0 '@babel/parser': ^7.17.0 '@babel/types': ^7.17.0 '@rollup/plugin-alias': ^3.1.9 @@ -813,7 +813,7 @@ importers: optionalDependencies: fsevents: 2.3.2 devDependencies: - '@ampproject/remapping': 1.1.1 + '@ampproject/remapping': 2.1.0 '@babel/parser': 7.17.0 '@babel/types': 7.17.0 '@rollup/plugin-alias': 3.1.9_rollup@2.62.0 @@ -991,14 +991,6 @@ packages: '@algolia/requester-common': 4.11.0 dev: true - /@ampproject/remapping/1.1.1: - resolution: {integrity: sha512-YVAcA4DKLOj296CF5SrQ8cYiMRiUGc2sqFpLxsDGWE34suHqhGP/5yMsDHKsrh8hs8I5TiRVXNwKPWQpX3iGjw==} - engines: {node: '>=6.0.0'} - dependencies: - '@jridgewell/resolve-uri': 3.0.3 - sourcemap-codec: 1.4.8 - dev: true - /@ampproject/remapping/2.1.0: resolution: {integrity: sha512-d5RysTlJ7hmw5Tw4UxgxcY3lkMe92n8sXCcuLPAyIAHK6j8DefDwtGnVVDgOnv+RnEosulDJ9NPKQL27bDId0g==} engines: {node: '>=6.0.0'} @@ -5157,7 +5149,6 @@ packages: /graceful-fs/4.2.9: resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==} - dev: true /handlebars/4.7.7: resolution: {integrity: sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==} @@ -6333,7 +6324,7 @@ packages: dependencies: universalify: 2.0.0 optionalDependencies: - graceful-fs: 4.2.8 + graceful-fs: 4.2.9 /jsonparse/1.3.1: resolution: {integrity: sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=} @@ -6388,7 +6379,7 @@ packages: tslib: 2.3.1 optionalDependencies: errno: 0.1.8 - graceful-fs: 4.2.8 + graceful-fs: 4.2.9 image-size: 0.5.5 make-dir: 2.1.0 mime: 1.6.0 From 2c02ce7061f9d4a9a8e70a96d89e930b4e6ed448 Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 11 Feb 2022 10:12:03 +0100 Subject: [PATCH 0264/1287] docs: change worker config to object instead of array (#6844) --- packages/vite/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index f436a99d9175e2..f3cf3406306cc8 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -46,10 +46,10 @@ The worker plugins pipeline isn't shared with the main Vite pipeline, there may import PluginX from 'vite-plugin-x' export default { plugins: [ PluginX() ] - worker: [ + worker: { format: 'es', plugins: [ PluginX() ] - ] + } } ``` From f63a72e77214ea31884680a3c5facf4fcee5d226 Mon Sep 17 00:00:00 2001 From: reid j sherman Date: Fri, 11 Feb 2022 01:29:14 -0800 Subject: [PATCH 0265/1287] docs: rename empty git repo from master to main (#6857) --- docs/guide/static-deploy.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/guide/static-deploy.md b/docs/guide/static-deploy.md index 574ceda541da15..43b047dd7f53eb 100644 --- a/docs/guide/static-deploy.md +++ b/docs/guide/static-deploy.md @@ -80,6 +80,7 @@ Now the `preview` method will launch the server at `http://localhost:8080`. # echo 'www.example.com' > CNAME git init + git checkout -b main git add -A git commit -m 'deploy' From 0941620705eea1a08509a4f5a28dd3099a711e58 Mon Sep 17 00:00:00 2001 From: Zheeeng Date: Fri, 11 Feb 2022 19:49:13 +0800 Subject: [PATCH 0266/1287] chore: build signatures (#6841) --- packages/vite/src/node/build.ts | 39 ++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index 7c7d1d18037174..b9936f8583b46c 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -769,7 +769,7 @@ function resolveExternal( ssrExternals: string[], user: ExternalOption | undefined ): ExternalOption { - return ((id, parentId, isResolved) => { + return (id, parentId, isResolved) => { if (shouldExternalizeForSSR(id, ssrExternals)) { return true } @@ -782,7 +782,7 @@ function resolveExternal( return isExternal(id, user) } } - }) as ExternalOption + } } function isExternal(id: string, test: string | RegExp) { @@ -793,39 +793,48 @@ function isExternal(id: string, test: string | RegExp) { } } -function injectSsrFlagToHooks(p: Plugin): Plugin { - const { resolveId, load, transform } = p +function injectSsrFlagToHooks(plugin: Plugin): Plugin { + const { resolveId, load, transform } = plugin return { - ...p, + ...plugin, resolveId: wrapSsrResolveId(resolveId), load: wrapSsrLoad(load), transform: wrapSsrTransform(transform) } } -function wrapSsrResolveId(fn: Function | undefined) { +function wrapSsrResolveId( + fn?: Rollup.ResolveIdHook +): Rollup.ResolveIdHook | undefined { if (!fn) return - return function (this: any, id: any, importer: any, options: any) { + + return function (id, importer, options) { return fn.call(this, id, importer, injectSsrFlag(options)) } } -function wrapSsrLoad(fn: Function | undefined) { +function wrapSsrLoad(fn?: Rollup.LoadHook): Rollup.LoadHook | undefined { if (!fn) return - // Receiving options param to be future-proof if Rollup adds it - return function (this: any, id: any, ...args: any[]) { + + return function (id, ...args) { + // @ts-expect-error: Receiving options param to be future-proof if Rollup adds it return fn.call(this, id, injectSsrFlag(args[0])) } } -function wrapSsrTransform(fn: Function | undefined) { +function wrapSsrTransform( + fn?: Rollup.TransformHook +): Rollup.TransformHook | undefined { if (!fn) return - // Receiving options param to be future-proof if Rollup adds it - return function (this: any, code: any, importer: any, ...args: any[]) { + + return function (code, importer, ...args) { + // @ts-expect-error: Receiving options param to be future-proof if Rollup adds it return fn.call(this, code, importer, injectSsrFlag(args[0])) } } -function injectSsrFlag(options: any = {}) { - return { ...options, ssr: true } +function injectSsrFlag>( + options?: T +): T & { ssr: boolean } { + return { ...(options ?? {}), ssr: true } as T & { ssr: boolean } } From de20c73ef37b179c1791c0f96da04d29cfd48840 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Fri, 11 Feb 2022 19:51:32 +0800 Subject: [PATCH 0267/1287] fix(scan): escape for virtual modules (#6863) --- packages/vite/src/node/optimizer/scan.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/optimizer/scan.ts b/packages/vite/src/node/optimizer/scan.ts index 9ba65d23684305..280776b2e7d38d 100644 --- a/packages/vite/src/node/optimizer/scan.ts +++ b/packages/vite/src/node/optimizer/scan.ts @@ -284,7 +284,7 @@ function esbuildScanPlugin( loader, contents: localContent } - js += `import '${virtualModulePrefix}${path}';\n` + js += `import ${JSON.stringify(virtualModulePrefix + path)}\n` } else { js += content + '\n' } From a3a9941be7017a21c875786683c7b0225e3fdee5 Mon Sep 17 00:00:00 2001 From: Zheeeng Date: Fri, 11 Feb 2022 19:55:29 +0800 Subject: [PATCH 0268/1287] chore(types): remove unnecessary type assertion (#6784) --- packages/vite/src/node/http.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/http.ts b/packages/vite/src/node/http.ts index fd45907ce0b723..f1266ddb93ba12 100644 --- a/packages/vite/src/node/http.ts +++ b/packages/vite/src/node/http.ts @@ -144,7 +144,7 @@ export async function resolveHttpsConfig( function readFileIfExists(value?: string | Buffer | any[]) { if (typeof value === 'string') { try { - return fs.readFileSync(path.resolve(value as string)) + return fs.readFileSync(path.resolve(value)) } catch (e) { return value } From 0282e7a523d1cccdc490c1df20b3013d5144ea19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Cotiniaux?= Date: Fri, 11 Feb 2022 12:56:07 +0100 Subject: [PATCH 0269/1287] chore: remove cancelled sponsor img (#6781) --- docs/public/finclip.png | Bin 13876 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 docs/public/finclip.png diff --git a/docs/public/finclip.png b/docs/public/finclip.png deleted file mode 100644 index 9110e6d56c164d598209d4b26ed019360efa181f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13876 zcmV-4Hp|J0P)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR927@z|H1ONa40RR91Q~&?~0FY#M1ONavo=HSORCodHT?b$k#rogfO8`N^ zMh836q=^L!j|9>ikQnv-?Fx3WJe4A7L{U^aD2fez&+>?XB%}udqED=tAPNGaNN-9_ za(BD?|9!JJo4vcemRv%>UAWBb%s1c6eEZFBzA3vS2#x3xeU&A)VDCL@b@l6FwL>Vm z;e4NTzS7qwTrx{Eq+rh|)oy>ibXX@*Qq{ikZ?03#=;}QzrfB!$F*!R}=5hbos3yMs z(_G3lY1+4L1?n{@UG6n#xI#aFh3XxZ{-dg@OtMH*?T^+iE~aSDQ!z_-vP@$?*rdk4 z^Rr%nw3oi`kev0Ievd-vem5qD8%~1)4d@${*_YoNNPK&T={l%w94pX_PUIFFzHMYK;s>Kmu=xf;dhU+=b1gqA-=4=ZlY!@M^i5I{n*AjRZp< zD|*U!Usu2J@o-)~MV$2Fm#VE=zDcO6`arZhU(T79Fq$U{hf9SC=@F-nTc!?syzr55 zWPZZ&@cEbsZ^SBxfJZdG`2Q}L)DSguYuY@+n7m!8%`W#Xx$YcMsH%RRhc~!8B!9OW zw{+JflyTgA4fqmgey=7^`DU82Fi=3&6_DF|(D3cXIPSkP@urrD+d%hyqSD_bcj%~m zQ(B61yM`2?Ah|obQDEGA8{9x4`S~x@v}ac8fQL+ux+V6wF*aTD8}B_x^;`WhQ9(qf zJg_*m!+HX~;@i5q=~LeLYecomelJgnk~U|VM5S-!8TF1D?znVFMsH5TU1JmGwB%kI zm3a}rCt4kWC0Th~sCKMEm?%2XEdclmALyeOD0TeG^MxbFIDY{V$0}AXZb1Q@Va1BY zkvc&D4=*6n>Xf=bWSwK?S{V?xe z`0|M2E-Ga2=;1GGg%vBfDM3kk4@zH7;k;0$Y!ct7c#ss9B2%CHVhR<+l&~HGb;)qv z1^4uxBiZE<$`hDzC!W6C_#46l7TtoX%_#kR+>Fg?Ds)_N0(Xu$71@ z+WY7bbe%Cd+tq|6f9Uuc|G}n-!~;eu>&cjZ=9;kDgTa7^GKgn-l?j(`VWybNmgd(J#~$j<*q@ocQpux1H!Q( zSs*?{%Aq}NRGykMD_Jk6fsIeE-borMVhi{FOHq|6Dw<4FF`{dJYTI8ZKJLTKDm5GG zvx@HM=9ST+QGK?7Ow4@w>vok#t9Pc1UG|WqD06dOioM^+9|`pi));Q|n^l}DivDZ~ zhC6Az(#ABt{9DT3(xZrPgiSopDXYKnKr>!m-4YQiiadoZ2+^(%%ujC3gp#>HZ6aWR zNrOx?q3}$|&3^KVUC^5T5_kyJ&ijmU!-LvJVl^@++D<4HsJRABz&@gx-PudTag z`J&%BUyLua%pQWN#w<%}C&n+_I!S~;o^RRjj_S1{|YG^VF;iZ_Ot z`Hgh2uCmN%Oa()PMH%P30Oy5-`5PW}I-EZxyuKF3sn~bvy_c|zlP0fLlO}zk!Yq6* z_nCj(PH9p{m#FIDYC&?U)0fOle2l{C<6^=Yoc<5bC*7%er)F!BAs3!e0LF3{g=h2| zX#z@@6DQ67;a=6@oJ)Xflf^4?$6oOb#SI_7vb)3K_=x~FcS?NF{5ao+c6|xUvm7B; zB>9CeZv)oM7iG-t5D=5AD3c(R@t(}B`;$-tA!`iDUSV6 z{w_@@WZ+?{H14Bc8+35zuWaFr3rR3TAQS=JG^|>oH2oZrx@^K3KB*PXf*o&OK?{b> zWyw$uXi8~%XV!d*|9OE(LJ|?4IB#A4@vcmR=TAbRiQt$|x9QF1_OdO_ctPUl{rCy_ z6W`g`nund}Zb0B9p)jpLlc6m+bRlOY(<-69dSk#`=xCEsS2kMds@iZMPF-@W8fnKLZ zC}=+RLx-uUNQ#EA9uBwLW|wdvXn8U>e9(EUcxcbbH8WBcsO^PH*enR ztAY;>F`*#PC={acC5S+Lp}Q;Au2>w+^Wm;nQ^KAHZSsP8pR^8or4HJw8Ky|8u(|NA z?xsTFOqXW;!_`|ULfT`6g*=?QR9NGWhkLqISzh5|$BrH3@jQ&**TVfn=b;KwX6d~I zBLdB|F4!F-$(ZA_c4mw`!>Bo#@gX|Qfyl<6XIk%jajSP&?L#1xb0{?z4lrxICpRy_ zlqR&fi@=tCu?v3FK~$2&RurZ>l?xN+{E*|x$av3|I$WTQ`IrP_9Qi9&EQ&DxJmUl1 z_lmx5Xds%<;zciT_7V&+EFB84g%Frki-k!FE4aDKp;MYjXOq?-E;VV&H>L(1&B>5< zk$*YTv3{xN!CQt}9CzN$dBa;AruKo<8qSAlv6_pVK zzkx)#7i$YZYvsH);BJdI8g3`usG`DsAktT=L(PwYnt_Ym6?_ zGH6OLWeXYu5@$dtWVqp%Kjtbu9hOK~IBc8cIaA|@1e59Uq9MUh-nwS_DTv>uWK37^ zNPl#)8mJ~eyNYFyI&QfJv;f=2E)-T5QFstdZm+RkzWn-=_eJ0to;(pk0glk*H=mEm zo!a;(!9D8{=sswT;f(U09*EvbvvbHj8HGZ14OwHjfNJZ;=I@?>E`5-osQ)V&+TrQi z^0Cq#9|<&w!o(Er9jVIBc~BBTB&!PM4s+2G$sU9aGPd~o^Cur45m>o~B7u5U7;GlF zSCO&N9!f$33pT&!ah*8>XHk#z9 z0yK$~q)Q8ic3i`&7`tFgU+g_!L&&3}5BxBppDP&I!|JZMpc;`IR)vWz-19KT{WCNL z0CG_G0|l_zguX?ooyvXHJK??cy%ncY&Zan2A+PZ6o_?oIeetov>t6z4Q5e3Du?8hz zn?P5ZsJ7nu!`jjQCjFwt%N^UCm8^RbgxB!K!UKAw!83erd7DbRyqlB=LzXFdkM@7U z5N&ynlLYFdFtLTZpTzTgiP;}e5N@N`MCp>EwD#+ab)vP)>VwCQVy;cIS!nK$**3ze z!jV1xVWb`U>e|kBhhr<}M=qfi7HwuO9Wx-L7t8qUi;=%SKh4t6dML7spfwDduJ=bD zYFyu_>!M^;F7umC6so(mj%b;koo(lI#(H?pB(XJCRmJ8=(TN%Mpx?ORyhCwor7-Av z#-Zz(#4=(J6Fw+FQ=8Z$FQo(Rch#?3igvZwz3<2ojy@`lilAkft5{w*vZvpvzLaS{ zbX1(x+qmK|Z?ni8Tg={i64(YLHkKYO9$JrPqw2!no#0;MWydV18L`$Mih4A ze!3(|Td*Q^EoAhNTRd){w2wk*X9TJTy&Z>_XTw%r&vNklkQ8P};ob>Ah>0vQLkG=9 ziHMBsR+!k@?S-by1z7lZ9zN{;uz@OyP*^mgdm=ADFmC$vZ`)TNsoJ3_3`DCb98Dt4 z%bhe>e?8fZ7Z)^W18&df>5+z(T<*k=HXi7cc)bT@%v1%1y%&)Y-N&}Dtb8A6&fw|D zjc6XxW=%o1+q5Y!1I0rD)8%z63R z!=B}!d!wLjVyiQ3LUn{BI3t86w#aHhju2%jQWBJiHOsQu3pJi;j1R}i%PcP*hIu6? ze;L!5Mv|l(u&-$Wrwhe3@-dc)c=(Dlh6lu`e_Ixs!~khh;GYF$U_Rsd1?SbxR^S+6#JO8a*(Uahjt;nMIdIf zdhk!IrfOF;(|@+GiINKFGB#nSO&1;=$Q7FkZ7Yfw?=jNx2ZSP-%C)x2V$7q~eo@$r z-9Hz3rmrcpdKb20{an6c(Ns?wp78`vQUQ1llO@MENvfqhJGV&;1U<*zA?`0Lu0i!L-PPruk3J2>st+j$)J zb3af~w&*o}Ut1TgCDE_KO5$vEnXd=pACkgwX0C<8$?^Z$^e+sPr?AlrwO_^lW5OFh zVrQ1xr*LGi3Zl;*(UUB2aoF@Vr`u)cpGda4PB!x5&!+9Q07sljB;W8ozo%6A#hS=UMO~bv~5WHT)L0ijpm^qAc5Oglm#q4+?6Oq*MFw zB)qw96o$Gpxs5{)nUp9}5HHOc)mL9TqU1NtTHW%`!^%OncSKO%T{>alon~xlpW30r ze;uSnN(}#|ESZ*AtC?O17tjP2XhCbs76pV{v$E7j7=3A|va)g-cn^T(eKFkMP|6R} zqk2!w%F3cLn_j)5Gy98*{1FtdOCW{eibae9(VAvv5*QYR;e7Eep!=Z+uWH>7l!j0T z_C|zFy*%f!E5GG*o^A%dWmjD-|Evww)lz)ozzuOc>8<|36aTT4XYye*g8OPVAaCBk?TS6dG82Z5;nw&d5ajYjF>%Q?wAgo=IuWF?}zv>pn zuDtJ#Bv2qiA5tPweJ*E8!qdLeTj7mI0u7=t#_A3ov+OCn;TjEu`D)24aZefJEWafI zO9CgE1R4}!67%=;bEwK_jHDzi`b{k!)=oEoPcpflwAE=ag~7KckHLmHrDn*@j9^De z#yL$+TIrsI6>AWM!Kbwqpo++qg;to^$jLQ}+fe6GoP^J>!K)P1;$vM(g%5}@WuZ+^ zY)gWNvXBz7Z4C=1S9am}-^B?IV0T*5^+oOdQNKfsJAC=0V`fJFSWE1b@98XaBn7SeUBZX+wM<1JNCi_*!*Iy0YMTk^-=eP=dOv zG_7NM&q~C7`0ENN#~=+cYPzi^ZBB2Io7&-+C%y4L`IWCWsR#GQr<^kX`p#9J^uF%%#}4S4^4u5e(fYb_9+Y?LQ)Ms%)PPFki?6?MJRCq7 zdo|@di60cicUP3J63-x$k{4mh@RD1#~Y3=e)3VO#4ZzEKTZ=pOuZJ_Xr5uhH+CCpaiveNfmdLq?#zp$D2RL!*wYO1PNs!Lsx1a(QN)5=LfAU zysS$nT!W8(t3R`DjVT|VC)~6#%jm(@$E6{!qTXR-PRc^}aBuZg78Z`LuR}q8@kkTR z?@GJ_w@?Tf}EoRt?1$bCde%7P2%{tA^#trl=}kD7|0(;&Z#K>rpY z7ri6p!O!PyPzZxn=k@e}*aepji&bTNNm|EFo}80D*>a_$TE2#qgp`UDh0?YpD_=#Y8isJ@i5f5ORt!W3)Yq{{I%EM>k`?A16+~iD;NEn z(>0`v@_E@t#{6B!qG*l87-8ZM4q>P}po^4+6hRS`(o}C{Arfb`T+HkZrYxG$G-=(c z1x{kEwXzUjx^gED>WSuE#fI;szfeXP#cm(;VT2}s(0{#tq{_LUS{WIjboQ=Ywr`@> zPgTXa-Xw|tAcA?kehNsBAQ#tBo&X;nc#r(}aKS@740ri8{^R6xm02^S#S&vFsOvP| z`|<~;Fg!Jsg&~cq&f`H|t}3)7TZ1DE(FYn0dGYWQfXy{i8N#``MW&p7=<6$rYyum5AnG4p{`VE29F{QslY0uTs3!iT#^vao)9MItP zEMr66&h;rak-e3Ymdpfod$l)TXbi) zzId2W8XD5!4~>-YJF>I7`k`4Hn|jg*x`(oC1+tt&3PRnGhF+?Gqws<*f1o_-Bi?gn zxliGhFMAf6Z{#hcOe88rM3vv7Z5Aql)>IL>Eg3ZS6}Jvf}P+727IcX?(~ba&6b zi2p%DBg9fVDB33H!KzS{26HWcAZ=%jPYr63vcMhz)5d<)j7AhiUKka1yVqi?XAOEs z5C5=cX4f;ecK5`uZ`AFl^VIl+?0sm)@9=xrWlOleyx5FhSOd(23IX?ufo? zcVZ|DElFTBVz~CJ2P^vyzV2#6kee6ZqWcWJEt@S4x6;s8M2RQ;U{k$j%owxEL4B|? zWQCzjN^Zmn@GhhwmnnlRw@G;GC%4a#5^dpwef#6pf$y|#3Hs&wyvLqhyDI%DP1?BS zJCLR$%ZG4;b!!-+&rA+#f{F5OESF@9a2p)Rvit>ma8VhPv4tXmCKch9Y7bHv=)c_R z<^2*fy>>DBO9S-y&0joyzt~^AF|Jk$Lk#E)QP%3oP$86||FY6L@r@t%8Z#h&{=@w* z1I;%uKp0ABN~Q{Xx9_Ml>z-1_F5iiBmfCB|;_8NwN4=d?>sjD1-P!s|v_@SH*6KdhMlmoeO*zt##v zOmP^Nh?!QGVXHk@D9zdUblE=7Obh;X`4w1u`kIuBcP->U>!FJrp0rSuty&kxdD98L z^>nPUSLSX3rVjY>op3qxyNhT9Pt(^_Li34IsM9$6sU1 z!qJ*$1xc-YsV}5xdXNiq==N(;hASZ_f0D8_WuBg$0&C zqgEIye&Va;3g$~-5Cb#_ao}P}|F68qFZXLyr94%(6AN|i2%(y_ZP7gYv8%nNu>*_8 zqVSYJeJG4uKk1oasP_dA^dWva(hz>2`#Bxmkk9G+)N#vpVFtGyTNi?oRc}9h%*+rD zwJa8W{YW6J3PVMN-J&ZEM;eTHPEVfnKQBu>b^P+(0F}11XNJupLt)52dsNNKZ1q!Z zi)(Eq5O#&3f)qS}uHTDxTNh z))mDgRCiU9o(Pu=>hMzcZhD zK^QL3rDF%!aAcoCN&-7YM-m-%xUxWREM?(RYus+VDhyRUZ^AWD8cgx(XyQT@+MYm) zM9MNX-a?kfttWcv>Rn+dr=?l{ut72OlV!Q`U{X%Dltq6QCxoX#6ow>``&`s%k`U1c zu<~Dg1^g30%C%6I;CB3-5TdjSX-UA6fF%J-0(FwWNoi}w7w+z(DC#u)1~a=FB4Rr` zNmOKe(@zk-j8w$O3NkvarW@QZvY-` z2qlTqGX=MHnW#}%e=P}E5(rfSCltWM7VdcfFJ;UzvrJeRStWGA#d_)in@x%-7}{}- z7FhE)@sr>B$quCyY4AB^hBVBYA-@Jz8t~MBmN2nsME7TEI9NVQ0+s}Vk-!N7Ffm1Y z9)cw@iwesoZUG?7?{eKhLJ;;NE(T}q{18Y0u^()~rzM=F0Hm`RxKIKHIB>z60gN7o z?@38gue=dGexxAlvLs+hAg}})HNXrh*fR<(ekN=5sEe0%LG=R=Xz}8H8(w5DO7B!2 zxZ3U%3Ge;d8y{3#23}`t08?WL(LIJ%`C_Lg>Bcjh+&NfxmIN#bm`R{f0!&Qd-bb+F zGo2NfTNKRIEEfg>1T5OM4fn81lqx6THf+MYneKc_I?%@Hq)S{p-y%^PP>Yj~+R?93XfJ4WlsM^Gg0B z{h#!vv_dQi{Jka6C;$e_&Hus+Zd2H!V1@~wY~^mv3J;q7UNJIaaB)hzfO8?43;sCe zki)(NKoCp7!of*%*^p~);T>Hc@CPPF^%y?4yiJv?F30MXcEW=`JOdT{*swP>@A1nX zH>R=tmIVIJ5;(2^6H~DJ3AFo{^#{PL6WqaN1*3av#JB(~dvNsL;G(ql>sWxFKQ3U& zg>^B6^J2@;8Y@^s2EYOzn>nnA*91K+@xuNYZC=P#UX)d{Xrvi= zqpt}0n{oc~H;cnZf?PWV&0@n5Cho-N-8v8_IxrO#{s@mG0)Q;z`P@{WC+&u#^qdD- zq+0pKktlZ*o)SCjipTqR#hs}4o6W?Cx!9ABp&KiwE3Xv*^^z~j zy$i=@v=4Ln8=urK#ldUP(!ZIW%`&_O*{Wo2d25YzN>0TsTqEsO+D z%;WpGM6nb{*~Ri$vuA=Q?{ykIr$5whCE8c3708*ov}+Zf8Z9JrfIHYJ?UR zA6A8)#;VY>Zp>W30_9XdrM(QW#*W0)>gux22v=P)AP{14g79YU3xn^e zEzp=LGx*kv1%tfICY0$!9@E~v*PwJ9@Z!<)i{hs!pA%q!3FBZd@mE_DG2w@jg&WOM z^c^xhR(1--W^oAnvx%+A<=-v;?`9wIAqCUCj$l7>pDIR_tu4#`&MdLnGYJM@LYMFG zL&*O$V;P`Ft1+2;Ra8{wsRvYfEI|7)=v*@+jfwvd7Ehjy=yKNV@8-?(K1j$UK`23_ z=V7~Ii+9JVvRHry=B;$D;R9I|G;F~v`3^yhj4DZOW2!iwg^K-X^IQPQy{wT^LuEfu zxm;Ee@P_izDbh<@p4tr?9VjyB+S-e0h_L;CL{Tb@1eyWDxl zf=v^ME^Oa8jVszW3DD z5Hs+Z_|ec2ufxpo{73YPO8*_;seeXezj)|nbXH#Af*z(yXwu@Uh6a~9$s-Jj(Y>}| zbB;z{qPPp~VjWsX74+?VMD;L68~sRssr}I2qp%9&ept4+#28mwf7k#9=PyGs43`mH z;3sT>Wl>g|+HtUfDxf#<|rGY6aO&`!!>e4%zO-fY90D~zF+PY%aF0%eZWWC1`S5kL-F`2jerJ}x;O z|DqCrhyIX)F1NVV6I{%amakki8gS+nx}#6Vu*URHZty( zWV$bKp*qlTNMI{e$s>V+2UzE91JD2TAISui*(_a#|&F4imy=qTC@voHu~ zT$TnJRdnp4Keh>xLUc)L=b+|Zmfm#X#`u44%t1p;<9vv>=MpgDUrl)Z$GCIEo|*IR zIleFm7nhL7+nA?Nn+T(2@Ivl#C*jkT8541FZ8-H z*wR2m0cp|o!t@vVdGk~+@eVurLoh;^S-xyhS+F(zs^Eh|eTJmpqB@1;-f2|7JCD8T z%|pUw!4$`z{V8^?#-oSEQESMI8jh>+kgN676s~kstK?r|7yQ0GY0d%|lKOEMR%^BTvybFII-)bT6NPZ?ACo2)pu zV8!b^CI`w6W!7Xv0E{1~>Tq&R&z-kU*1>wd#Vj zF{N8oyZu*KEax&HWT2>l2?IeYFN(^_DvEC|nVBTv_kN)ITk+l!=-9l&lR)Pqo-q(_ z^8@O^m7d`z|Gn}^|Cr2kLaL{tykbTVlOQbe3oF3zf|jIpoLD-n6DF_4@zlt)hNS@j zPU%DABCv7&6s5glSJub>XVcE)kALgVd6>Dm|JQXNCUW~UZz`RQ)rRsKpy50`Gt3}Ibp;; zyn;}8LF5_3W{>Jp9f)@@@o8CQ7b(@s3Ro*0_4y`BXsDyH8~~QrFcf+)T%cmM9F4ly z*G4;%q}LV7J{UaP4Op4z=EcM$02}pw$HVjLjm`4w7nO0DQ&qk(VZ(xu@8^+1v*F*Z z_-LOm8h_yc7TbnB@+|b~w2Gx);QIvXGer-8$LyJ)O9}X@fO)#m_Q4p-!Tch9K34n` zjjVzVpH$_1+^0ZS{mxNEL_}P@W?8nMozY%7`3zuf(PwO!BjP{Wg14xZ$qWQ|!>2q5 z3}|>mUb1*tzSuM*$%Bh-@41fM`uUUmTE!WdV8*v~g-bQS0zdrM_z_?2-q6^K+q7*v zw6?Df49{A1v0PPMhW#rYcs|T3qcR%nLSToiam~q@nG~>BVU!{KF;hy^`ELg>B(lWB zhnj9bw(T>B`-%V}TmWErF3=Ke-`I>Uid}e66_h)`&uz!7JO7$bT2MHafANy3+R8|S z{Psm&+`5Cmow8=nl6aT_Duw%^r?}c)0H5#A6kA@iV#WNB=W=}I8Maj!5}@G{a=0>xx2f^|lW;v6sNVv~b`0SI zU7|1s8~;33|HL<;Y>yk0BEPfk8}{0Hp0Hq#Vj})jBTYE`;JdElDINQ7tK5$7SO<7X z)0H7W#Q{Z~5qWCstZ?q&<@IS$fZ>_qP%|!TfR>P&=lU^%jX`4Pao~~7gAlG`Np@cjvY~p!TSmhEMUg0B>ZJog=@oG?6D)t zv9xDDADr{dwPlF%d8IzJ{8`0W^)y*X1c(GI48*9s;ElX$EGAK!kuxLVQJ>7Lhm8x?>_yAN``*U0x-qPoiQ;XYp7l_Ak0T^DW!rQt|gMV7$+v^`e z`y=miADS)Mp&&3>4iG5HVl^LZ>u_C1#!M4~Gh&>V0Uq4{5_ z0gVO>#F6bkk;M6zkH7Y=ERk)0qhOy`?xexbWR5PGR;{Q-;B_Sta_ftO4$3$+cV?1X z@8y$Wcp^wT4CgpId`&oru9s5>@1l2{ipO&Ya%+NmHo-HnA@zKp93=5w$oK{nkChM4 zz=8B{_@wuYkc9WJR5}g~gz}+_UW=d4d_nwi^~V1MDgA`r(HR*Se&3DqM1fV%TNu#8 zW2i2?ZHs6!XHCh+JBU}HYi-%0Q5dp4vAuHp9F+eq(7Qb&v-Ba$*Nllt82FNoP`QID zy9tXr1qG~low$dXIC0*(hhSOEf+|4=@P}CkEpT*CKCPN?rIj)-r{THW&Sp@T&z>i{Y%CXZiPGClE0 zFGf~?C4qX9fY}@jbaowvUVbNV>!~OVJGSAUgV-QMU!$1WN8;a1q zt6NaiKSe=`&3nB6cRYPJad)U8S8H zUspb`@|QJhe`;#5lfiy7vmz}Cgh2upz=T1FoJG>C@9t4$VJ;d!@Wll#aJZk*5g6ct z-EmNq)VQUiul||^`1vz5>$4t;!?_%o)m8&A;*A8ZJh;o}T5N)N<)_mV0`m2fr4?mK zAS@EF046MAbZ3$@<=YY1moN`QCvE1C4VMTH2pBXA2Nn;TdV(gG3aWiMETJ}R3Jhr(zz`t^DhhM)$ByJza;C>yb1a^MwC<0a1OPBTzi4;d3T2XU zqnv{=DW_Xd^2@95MEifs2sApdFbhOmNa2_tUwU)pM4KTdcDHB)SiXqXv02!1oT>2>IA6=PBw$IPZW1^t0EUYoE$g$J0UYlESTHKm zEER5*aI1w}FW?cxiMdnbp5c5f*OGuGf$&J+qyiW&5?UQno$^$CIw66Dxxj|c$M}*!&9?%V#{D Date: Fri, 11 Feb 2022 13:17:10 +0100 Subject: [PATCH 0270/1287] release: v2.8.1 --- packages/vite/CHANGELOG.md | 10 +++++++ packages/vite/LICENSE.md | 56 ++++++++++++++++++++++++++++++++++++++ packages/vite/package.json | 2 +- 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index f3cf3406306cc8..50925e58baffdb 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,13 @@ +## [2.8.1](https://github.com/vitejs/vite/compare/v2.8.0...v2.8.1) (2022-02-11) + + +### Bug Fixes + +* **deps:** update all non-major dependencies ([#6782](https://github.com/vitejs/vite/issues/6782)) ([e38be3e](https://github.com/vitejs/vite/commit/e38be3e6ca7bf79319d5d7188e1d347b1d6091ef)) +* **scan:** escape for virtual modules ([#6863](https://github.com/vitejs/vite/issues/6863)) ([de20c73](https://github.com/vitejs/vite/commit/de20c73ef37b179c1791c0f96da04d29cfd48840)) + + + # [2.8.0](https://github.com/vitejs/vite/compare/v2.8.0-beta.7...v2.8.0) (2022-02-09) ### Reduced Footprint diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index e7849fe80aa577..e3a445f8cfdbe3 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -264,6 +264,62 @@ Repository: https://github.com/jridgewell/resolve-uri --------------------------------------- +## @jridgewell/sourcemap-codec +License: MIT +By: Rich Harris +Repository: git+https://github.com/jridgewell/sourcemap-codec.git + +> The MIT License +> +> Copyright (c) 2015 Rich Harris +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## @jridgewell/trace-mapping +License: MIT +By: Justin Ridgewell +Repository: git+https://github.com/jridgewell/trace-mapping.git + +> Copyright 2022 Justin Ridgewell +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +--------------------------------------- + ## @nodelib/fs.scandir License: MIT Repository: https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir diff --git a/packages/vite/package.json b/packages/vite/package.json index 494b6aebc54ea2..2f57fb3f59164d 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.8.0", + "version": "2.8.1", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From a23eeb205f10b0c7a26517ed804f85468480892f Mon Sep 17 00:00:00 2001 From: patak Date: Fri, 11 Feb 2022 14:15:02 +0100 Subject: [PATCH 0271/1287] chore: release action (#6669) --- .github/workflows/release.yml | 78 ++++++++++++++++++++ scripts/release.ts | 129 +++++++++++++++++++++++++--------- 2 files changed, 172 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000000..0c3b0c183ef3a1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,78 @@ +name: Release + +on: + workflow_dispatch: + inputs: + branch: + description: "branch" + required: true + type: string + default: "main" + package: + description: "package" + required: true + type: choice + options: + - vite + - plugin-legacy + - plugin-vue + - plugin-vue-jsx + - plugin-react + - create-vite + type: + description: "type" + required: true + type: choice + options: + - next + - stable + - minor-beta + - major-beta + - minor + - major + +jobs: + release: + # prevents this action from running on forks + if: github.repository == 'vitejs/vite' + name: Release + runs-on: ${{ matrix.os }} + environment: Release + strategy: + matrix: + # pseudo-matrix for convenience, NEVER use more than a single combination + node: [16] + os: [ubuntu-latest] + steps: + - name: checkout + uses: actions/checkout@v2 + with: + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits + ref: ${{ github.event.inputs.branch }} + fetch-depth: 0 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + - run: git config user.name vitebot + - run: git config user.email vitejs.bot@gmail.com + - run: npm i -g pnpm@6 + - run: npm i -g yarn # even if the repo is using pnpm, Vite still uses yarn v1 for publishing + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + cache: "pnpm" + cache-dependency-path: "**/pnpm-lock.yaml" + - name: install + run: pnpm install --frozen-lockfile --prefer-offline + - name: Creating .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Release + run: pnpm --dir packages/${{ github.event.inputs.package }} release -- --quiet --type ${{ github.event.inputs.type }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/scripts/release.ts b/scripts/release.ts index 4c3006fe1f0475..e24f539547f014 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -12,6 +12,11 @@ import semver from 'semver' const args = require('minimist')(process.argv.slice(2)) +// For GitHub Actions use +// Regular release : release --type next --quiet +// Start beta : release --type (minor-beta|major-beta) --quiet +// Release from beta : release --type stable --quiet + const pkgDir = process.cwd() const pkgPath = path.resolve(pkgDir, 'package.json') const pkg: { name: string; version: string } = require(pkgPath) @@ -55,27 +60,75 @@ async function main(): Promise { let targetVersion: string | undefined = args._[0] if (!targetVersion) { - // no explicit version, offer suggestions - const { release }: { release: string } = await prompts({ - type: 'select', - name: 'release', - message: 'Select release type', - choices: versionIncrements - .map((i) => `${i} (${inc(i)})`) - .concat(['custom']) - .map((i) => ({ value: i, title: i })) - }) - - if (release === 'custom') { - const res: { version: string } = await prompts({ - type: 'text', - name: 'version', - message: 'Input custom version', - initial: currentVersion - }) - targetVersion = res.version + const type: string | undefined = args.type + if (type) { + const currentBeta = currentVersion.includes('beta') + if (type === 'next') { + targetVersion = inc(currentBeta ? 'prerelease' : 'patch') + } else if (type === 'stable') { + // Out of beta + if (!currentBeta) { + throw new Error( + `Current version: ${currentVersion} isn't a beta, stable can't be used` + ) + } + targetVersion = inc('patch') + } else if (type === 'minor-beta') { + if (currentBeta) { + throw new Error( + `Current version: ${currentVersion} is already a beta, minor-beta can't be used` + ) + } + targetVersion = inc('preminor') + } else if (type === 'major-beta') { + if (currentBeta) { + throw new Error( + `Current version: ${currentVersion} is already a beta, major-beta can't be used` + ) + } + targetVersion = inc('premajor') + } else if (type === 'minor') { + if (currentBeta) { + throw new Error( + `Current version: ${currentVersion} is a beta, use stable to release it first` + ) + } + targetVersion = inc('minor') + } else if (type === 'major') { + if (currentBeta) { + throw new Error( + `Current version: ${currentVersion} is a beta, use stable to release it first` + ) + } + targetVersion = inc('major') + } else { + throw new Error( + `type: ${type} isn't a valid type. Use stable, minor-beta, major-beta, or next` + ) + } } else { - targetVersion = release.match(/\((.*)\)/)![1] + // no explicit version or type, offer suggestions + const { release }: { release: string } = await prompts({ + type: 'select', + name: 'release', + message: 'Select release type', + choices: versionIncrements + .map((i) => `${i} (${inc(i)})`) + .concat(['custom']) + .map((i) => ({ value: i, title: i })) + }) + + if (release === 'custom') { + const res: { version: string } = await prompts({ + type: 'text', + name: 'version', + message: 'Input custom version', + initial: currentVersion + }) + targetVersion = res.version + } else { + targetVersion = release.match(/\((.*)\)/)![1] + } } } @@ -86,24 +139,30 @@ async function main(): Promise { const tag = pkgName === 'vite' ? `v${targetVersion}` : `${pkgName}@${targetVersion}` - if (targetVersion.includes('beta') && !args.tag) { - const { tagBeta }: { tagBeta: boolean } = await prompts({ - type: 'confirm', - name: 'tagBeta', - message: `Publish under dist-tag "beta"?` - }) + if (!args.quiet) { + if (targetVersion.includes('beta') && !args.tag) { + const { tagBeta }: { tagBeta: boolean } = await prompts({ + type: 'confirm', + name: 'tagBeta', + message: `Publish under dist-tag "beta"?` + }) - if (tagBeta) args.tag = 'beta' - } + if (tagBeta) args.tag = 'beta' + } - const { yes }: { yes: boolean } = await prompts({ - type: 'confirm', - name: 'yes', - message: `Releasing ${tag}. Confirm?` - }) + const { yes }: { yes: boolean } = await prompts({ + type: 'confirm', + name: 'yes', + message: `Releasing ${tag}. Confirm?` + }) - if (!yes) { - return + if (!yes) { + return + } + } else { + if (targetVersion.includes('beta') && !args.tag) { + args.tag = 'beta' + } } step('\nUpdating package version...') From 82e5016d1b5c8fceebfc0f9d2246df6be2104eaf Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 11 Feb 2022 08:16:42 -0500 Subject: [PATCH 0272/1287] Update release-tag.yml --- .github/workflows/release-tag.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 5ed9495899340a..f9d5b8de30bec9 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -1,4 +1,4 @@ -name: release +name: Add GitHub Release Tag on: push: From 56e67c214e884fa3dcd168527117a2621c92e8a8 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Fri, 11 Feb 2022 21:31:28 +0100 Subject: [PATCH 0273/1287] chore: config yarn registry in release action --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0c3b0c183ef3a1..b059c0bfa35bc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,6 +57,7 @@ jobs: - run: git config user.email vitejs.bot@gmail.com - run: npm i -g pnpm@6 - run: npm i -g yarn # even if the repo is using pnpm, Vite still uses yarn v1 for publishing + - run: yarn config set registry https://registry.npmjs.org # Yarn's default registry proxy doesn't work in CI - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node }} From 997b8f11cb156cc374ae991875a09534b5489a93 Mon Sep 17 00:00:00 2001 From: Aron Griffis Date: Fri, 11 Feb 2022 15:37:07 -0500 Subject: [PATCH 0274/1287] fix(plugin-legacy): require Vite 2.8.0 (#6272) (#6869) --- packages/plugin-legacy/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index a503421e19e13f..cba6f7466a95a8 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -33,6 +33,6 @@ "systemjs": "^6.12.1" }, "peerDependencies": { - "vite": "^2.7.8" + "vite": "^2.8.0" } } From 19a58dd320e9dd582bb7868e1621d8bde835eda6 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Fri, 11 Feb 2022 22:08:58 +0100 Subject: [PATCH 0275/1287] release: plugin-legacy@1.7.1 --- packages/plugin-legacy/CHANGELOG.md | 8 ++++++++ packages/plugin-legacy/package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/plugin-legacy/CHANGELOG.md b/packages/plugin-legacy/CHANGELOG.md index da053294652427..e92ca1e12357fe 100644 --- a/packages/plugin-legacy/CHANGELOG.md +++ b/packages/plugin-legacy/CHANGELOG.md @@ -1,3 +1,11 @@ +## [1.7.1](https://github.com/vitejs/vite/compare/plugin-legacy@1.7.0...plugin-legacy@1.7.1) (2022-02-11) + +### Bug Fixes + +* require Vite 2.8.0 ([#6272](https://github.com/vitejs/vite/issues/6272)) ([#6869](https://github.com/vitejs/vite/issues/6869)) ([997b8f1](https://github.com/vitejs/vite/commit/997b8f11cb156cc374ae991875a09534b5489a93)) + + + # [1.7.0](https://github.com/vitejs/vite/compare/plugin-legacy@1.6.4...plugin-legacy@1.7.0) (2022-02-09) diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index cba6f7466a95a8..45c09f607fdfab 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-legacy", - "version": "1.7.0", + "version": "1.7.1", "license": "MIT", "author": "Evan You", "files": [ From 6ea6e08d23a967461cdb5a5fc6d48a6625188c2f Mon Sep 17 00:00:00 2001 From: patak-dev Date: Sat, 12 Feb 2022 08:09:45 +0100 Subject: [PATCH 0276/1287] release: plugin-vue-jsx@1.3.5 --- packages/plugin-vue-jsx/CHANGELOG.md | 4 ++++ packages/plugin-vue-jsx/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue-jsx/CHANGELOG.md b/packages/plugin-vue-jsx/CHANGELOG.md index 30618d5b056ef9..594f12c90f0909 100644 --- a/packages/plugin-vue-jsx/CHANGELOG.md +++ b/packages/plugin-vue-jsx/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.3.5](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.3.4...plugin-vue-jsx@1.3.5) (2022-02-12) + + + ## [1.3.4](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.3.3...plugin-vue-jsx@1.3.4) (2022-02-09) diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 3724cd25c7c381..c26a343c9c4227 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue-jsx", - "version": "1.3.4", + "version": "1.3.5", "license": "MIT", "author": "Evan You", "files": [ From fe8ef39eb37df7565dbbfce6a09c2eb7ceeaa56e Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Feb 2022 19:14:31 +0800 Subject: [PATCH 0277/1287] workflow: separate version bumping and publishing on release (#6879) --- .github/workflows/publish.yml | 37 ++++ .github/workflows/release.yml | 79 -------- package.json | 2 + packages/create-vite/package.json | 4 - packages/create-vite/updateVersions.ts | 23 --- packages/plugin-legacy/package.json | 4 - packages/plugin-react/package.json | 3 +- packages/plugin-vue-jsx/package.json | 4 - packages/plugin-vue/package.json | 3 +- packages/vite/package.json | 3 +- scripts/publishCI.ts | 31 +++ scripts/release.ts | 265 +++++++------------------ scripts/releaseUtils.ts | 215 ++++++++++++++++++++ 13 files changed, 361 insertions(+), 312 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/release.yml delete mode 100644 packages/create-vite/updateVersions.ts create mode 100644 scripts/publishCI.ts create mode 100644 scripts/releaseUtils.ts diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000000000..f4df5af00cc23c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +name: Publish Package + +on: + push: + tags: + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 + - "plugin-*" # Push events to matching plugin-*, i.e. plugin-(vue|vue-jsx|react|legacy)@1.0.0 + - "create-vite*" # # Push events to matching create-vite*, i.e. create-vite@1.0.0 + +jobs: + publish: + # prevents this action from running on forks + if: github.repository == 'vitejs/vite' + runs-on: ubuntu-latest + environment: Release + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 6 + + - name: Set node version to 16.x + uses: actions/setup-node@v2 + with: + node-version: 16.x + cache: "pnpm" + + - name: Install deps + run: pnpm install + + - name: Publish package + run: pnpm run ci-publish -- ${{ github.ref_name }} --dry + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index b059c0bfa35bc0..00000000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Release - -on: - workflow_dispatch: - inputs: - branch: - description: "branch" - required: true - type: string - default: "main" - package: - description: "package" - required: true - type: choice - options: - - vite - - plugin-legacy - - plugin-vue - - plugin-vue-jsx - - plugin-react - - create-vite - type: - description: "type" - required: true - type: choice - options: - - next - - stable - - minor-beta - - major-beta - - minor - - major - -jobs: - release: - # prevents this action from running on forks - if: github.repository == 'vitejs/vite' - name: Release - runs-on: ${{ matrix.os }} - environment: Release - strategy: - matrix: - # pseudo-matrix for convenience, NEVER use more than a single combination - node: [16] - os: [ubuntu-latest] - steps: - - name: checkout - uses: actions/checkout@v2 - with: - # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits - ref: ${{ github.event.inputs.branch }} - fetch-depth: 0 - - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - - run: git config user.name vitebot - - run: git config user.email vitejs.bot@gmail.com - - run: npm i -g pnpm@6 - - run: npm i -g yarn # even if the repo is using pnpm, Vite still uses yarn v1 for publishing - - run: yarn config set registry https://registry.npmjs.org # Yarn's default registry proxy doesn't work in CI - - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - cache-dependency-path: "**/pnpm-lock.yaml" - - name: install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Creating .npmrc - run: | - cat << EOF > "$HOME/.npmrc" - //registry.npmjs.org/:_authToken=$NPM_TOKEN - EOF - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Release - run: pnpm --dir packages/${{ github.event.inputs.package }} release -- --quiet --type ${{ github.event.inputs.type }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 63c7e38d0d0652..72b7076ee65d01 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,8 @@ "docs": "vitepress dev docs", "build-docs": "vitepress build docs", "serve-docs": "vitepress serve docs", + "release": "ts-node scripts/release.ts", + "ci-publish": "ts-node scripts/publishCI.ts", "build": "run-s build-vite build-plugin-vue build-plugin-react", "build-vite": "cd packages/vite && npm run build", "build-plugin-vue": "cd packages/plugin-vue && npm run build", diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json index 6ff118b7793840..5d873b83fe515b 100644 --- a/packages/create-vite/package.json +++ b/packages/create-vite/package.json @@ -12,10 +12,6 @@ "template-*" ], "main": "index.js", - "scripts": { - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package create-vite", - "release": "ts-node updateVersions && ts-node ../../scripts/release.ts --skipBuild" - }, "engines": { "node": ">=12.0.0" }, diff --git a/packages/create-vite/updateVersions.ts b/packages/create-vite/updateVersions.ts deleted file mode 100644 index 7125fce9119f07..00000000000000 --- a/packages/create-vite/updateVersions.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { readdirSync, writeFileSync } from 'fs' -import { join } from 'path' - -const latestVersion = require('../vite/package.json').version -const isLatestPreRelease = /beta|alpha|rc/.test(latestVersion) - -;(async () => { - const templates = readdirSync(__dirname).filter((dir) => - dir.startsWith('template-') - ) - for (const template of templates) { - const pkgPath = join(__dirname, template, `package.json`) - const pkg = require(pkgPath) - if (!isLatestPreRelease) { - pkg.devDependencies.vite = `^` + latestVersion - } - if (template.startsWith('template-vue')) { - pkg.devDependencies['@vitejs/plugin-vue'] = - `^` + require('../plugin-vue/package.json').version - } - writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') - } -})() diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index 45c09f607fdfab..e464c18b4dca1d 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -9,10 +9,6 @@ ], "main": "index.js", "types": "index.d.ts", - "scripts": { - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-legacy", - "release": "ts-node ../../scripts/release.ts --skipBuild" - }, "engines": { "node": ">=12.0.0" }, diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 1047a390865f4f..67df1d30b89b0c 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -18,8 +18,7 @@ "build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@babel/* --external:@rollup/* --external:resolve --external:react-refresh/* --outfile=dist/index.js && npm run patch-dist", "patch-dist": "ts-node ../../scripts/patchEsbuildDist.ts dist/index.js viteReact", "build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-react", - "release": "ts-node ../../scripts/release.ts" + "prepublishOnly": "npm run build" }, "engines": { "node": ">=12.0.0" diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index c26a343c9c4227..dff19a227804d1 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -9,10 +9,6 @@ ], "main": "index.js", "types": "index.d.ts", - "scripts": { - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-vue-jsx", - "release": "ts-node ../../scripts/release.ts --skipBuild" - }, "engines": { "node": ">=12.0.0" }, diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index f54042da5bf948..ca8836d8e81d36 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -16,8 +16,7 @@ "build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@vue/compiler-sfc --external:vue/compiler-sfc --external:vite --outfile=dist/index.js & npm run patch-dist", "patch-dist": "ts-node ../../scripts/patchEsbuildDist.ts dist/index.js vuePlugin", "build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-vue", - "release": "ts-node ../../scripts/release.ts" + "prepublishOnly": "npm run build" }, "engines": { "node": ">=12.0.0" diff --git a/packages/vite/package.json b/packages/vite/package.json index 2f57fb3f59164d..9bd14ca89a4d16 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -39,8 +39,7 @@ "roll-types": "api-extractor run && rimraf temp", "lint": "eslint --ext .ts src/**", "format": "prettier --write --parser typescript \"src/**/*.ts\"", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path .", - "release": "ts-node ../../scripts/release.ts" + "prepublishOnly": "npm run build" }, "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!", "dependencies": { diff --git a/scripts/publishCI.ts b/scripts/publishCI.ts new file mode 100644 index 00000000000000..7df0893a15b788 --- /dev/null +++ b/scripts/publishCI.ts @@ -0,0 +1,31 @@ +import { args, getPackageInfo, publishPackage, step } from './releaseUtils' + +async function main() { + const tag = args._[0] + + if (!tag) { + throw new Error('No tag specified') + } + + let pkgName = 'vite' + let version + + if (tag.includes('@')) [pkgName, version] = tag.split('@') + else version = tag + + if (version.startsWith('v')) version = version.slice(1) + + const { currentVersion, pkgDir } = getPackageInfo(pkgName) + if (currentVersion !== version) + throw new Error( + `Package version from tag "${version}" mismatches with current version "${currentVersion}"` + ) + + step('Publishing package...') + await publishPackage(pkgDir, version.includes('beta') ? 'beta' : undefined) +} + +main().catch((err) => { + console.error(err) + process.exit(1) +}) diff --git a/scripts/release.ts b/scripts/release.ts index e24f539547f014..6ec929a1d3a340 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -1,134 +1,54 @@ -/** - * modified from https://github.com/vuejs/core/blob/master/scripts/release.js - */ -import colors from 'picocolors' -import type { ExecaChildProcess, Options as ExecaOptions } from 'execa' -import execa from 'execa' -import { readFileSync, writeFileSync } from 'fs' -import path from 'path' import prompts from 'prompts' -import type { ReleaseType } from 'semver' import semver from 'semver' +import colors from 'picocolors' +import { + args, + getPackageInfo, + getVersionChoices, + isDryRun, + logRecentCommits, + packages, + run, + runIfNotDry, + step, + updateTemplateVersions, + updateVersion +} from './releaseUtils' -const args = require('minimist')(process.argv.slice(2)) - -// For GitHub Actions use -// Regular release : release --type next --quiet -// Start beta : release --type (minor-beta|major-beta) --quiet -// Release from beta : release --type stable --quiet - -const pkgDir = process.cwd() -const pkgPath = path.resolve(pkgDir, 'package.json') -const pkg: { name: string; version: string } = require(pkgPath) -const pkgName = pkg.name.replace(/^@vitejs\//, '') -const currentVersion = pkg.version -const isDryRun: boolean = args.dry -const skipBuild: boolean = args.skipBuild - -const versionIncrements: ReleaseType[] = [ - 'patch', - 'minor', - 'major', - 'prepatch', - 'preminor', - 'premajor', - 'prerelease' -] - -const inc: (i: ReleaseType) => string = (i) => - semver.inc(currentVersion, i, 'beta')! - -type RunFn = ( - bin: string, - args: string[], - opts?: ExecaOptions -) => ExecaChildProcess - -const run: RunFn = (bin, args, opts = {}) => - execa(bin, args, { stdio: 'inherit', ...opts }) - -type DryRunFn = (bin: string, args: string[], opts?: any) => void +async function main(): Promise { + let targetVersion: string | undefined -const dryRun: DryRunFn = (bin, args, opts: any) => - console.log(colors.blue(`[dryrun] ${bin} ${args.join(' ')}`), opts) + const { pkg }: { pkg: string } = await prompts({ + type: 'select', + name: 'pkg', + message: 'Select package', + choices: packages.map((i) => ({ value: i, title: i })) + }) -const runIfNotDry = isDryRun ? dryRun : run + if (!pkg) return -const step: (msg: string) => void = (msg) => console.log(colors.cyan(msg)) + await logRecentCommits(pkg) -async function main(): Promise { - let targetVersion: string | undefined = args._[0] + const { currentVersion, pkgName, pkgPath, pkgDir } = getPackageInfo(pkg) if (!targetVersion) { - const type: string | undefined = args.type - if (type) { - const currentBeta = currentVersion.includes('beta') - if (type === 'next') { - targetVersion = inc(currentBeta ? 'prerelease' : 'patch') - } else if (type === 'stable') { - // Out of beta - if (!currentBeta) { - throw new Error( - `Current version: ${currentVersion} isn't a beta, stable can't be used` - ) - } - targetVersion = inc('patch') - } else if (type === 'minor-beta') { - if (currentBeta) { - throw new Error( - `Current version: ${currentVersion} is already a beta, minor-beta can't be used` - ) - } - targetVersion = inc('preminor') - } else if (type === 'major-beta') { - if (currentBeta) { - throw new Error( - `Current version: ${currentVersion} is already a beta, major-beta can't be used` - ) - } - targetVersion = inc('premajor') - } else if (type === 'minor') { - if (currentBeta) { - throw new Error( - `Current version: ${currentVersion} is a beta, use stable to release it first` - ) - } - targetVersion = inc('minor') - } else if (type === 'major') { - if (currentBeta) { - throw new Error( - `Current version: ${currentVersion} is a beta, use stable to release it first` - ) - } - targetVersion = inc('major') - } else { - throw new Error( - `type: ${type} isn't a valid type. Use stable, minor-beta, major-beta, or next` - ) - } - } else { - // no explicit version or type, offer suggestions - const { release }: { release: string } = await prompts({ - type: 'select', - name: 'release', - message: 'Select release type', - choices: versionIncrements - .map((i) => `${i} (${inc(i)})`) - .concat(['custom']) - .map((i) => ({ value: i, title: i })) - }) + const { release }: { release: string } = await prompts({ + type: 'select', + name: 'release', + message: 'Select release type', + choices: getVersionChoices(currentVersion) + }) - if (release === 'custom') { - const res: { version: string } = await prompts({ - type: 'text', - name: 'version', - message: 'Input custom version', - initial: currentVersion - }) - targetVersion = res.version - } else { - targetVersion = release.match(/\((.*)\)/)![1] - } + if (release === 'custom') { + const res: { version: string } = await prompts({ + type: 'text', + name: 'version', + message: 'Input custom version', + initial: currentVersion + }) + targetVersion = res.version + } else { + targetVersion = release } } @@ -139,44 +59,37 @@ async function main(): Promise { const tag = pkgName === 'vite' ? `v${targetVersion}` : `${pkgName}@${targetVersion}` - if (!args.quiet) { - if (targetVersion.includes('beta') && !args.tag) { - const { tagBeta }: { tagBeta: boolean } = await prompts({ - type: 'confirm', - name: 'tagBeta', - message: `Publish under dist-tag "beta"?` - }) - - if (tagBeta) args.tag = 'beta' - } + if (targetVersion.includes('beta') && !args.tag) { + args.tag = 'beta' + } - const { yes }: { yes: boolean } = await prompts({ - type: 'confirm', - name: 'yes', - message: `Releasing ${tag}. Confirm?` - }) + const { yes }: { yes: boolean } = await prompts({ + type: 'confirm', + name: 'yes', + message: `Releasing ${colors.yellow(tag)} Confirm?` + }) - if (!yes) { - return - } - } else { - if (targetVersion.includes('beta') && !args.tag) { - args.tag = 'beta' - } + if (!yes) { + return } step('\nUpdating package version...') - updateVersion(targetVersion) - - step('\nBuilding package...') - if (!skipBuild && !isDryRun) { - await run('pnpm', ['run', 'build']) - } else { - console.log(`(skipped)`) - } + updateVersion(pkgPath, targetVersion) + if (pkgName === 'create-vite') updateTemplateVersions(targetVersion) step('\nGenerating changelog...') - await run('pnpm', ['run', 'changelog']) + const changelogArgs = [ + 'conventional-changelog', + '-p', + 'angular', + '-i', + 'CHANGELOG.md', + '-s', + '--commit-path', + '.' + ] + if (pkgName !== 'vite') changelogArgs.push('--lerna-package', 'plugin-vue') + await run('npx', changelogArgs, { cwd: pkgDir }) const { stdout } = await run('git', ['diff'], { stdio: 'pipe' }) if (stdout) { @@ -186,59 +99,27 @@ async function main(): Promise { await runIfNotDry('git', ['tag', tag]) } else { console.log('No changes to commit.') + return } - step('\nPublishing package...') - await publishPackage(targetVersion, runIfNotDry) - step('\nPushing to GitHub...') await runIfNotDry('git', ['push', 'origin', `refs/tags/${tag}`]) await runIfNotDry('git', ['push']) if (isDryRun) { console.log(`\nDry run finished - run git diff to see package changes.`) + } else { + console.log( + colors.green( + '\nPushed, publishing should starts shortly on CI.\nhttps://github.com/vitejs/vite/actions/workflows/publish.yml' + ) + ) } console.log() } -function updateVersion(version: string): void { - const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')) - pkg.version = version - writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') -} - -async function publishPackage( - version: string, - runIfNotDry: RunFn | DryRunFn -): Promise { - const publicArgs = [ - 'publish', - '--no-git-tag-version', - '--new-version', - version, - '--access', - 'public' - ] - if (args.tag) { - publicArgs.push(`--tag`, args.tag) - } - try { - // important: we still use Yarn 1 to publish since we rely on its specific - // behavior - await runIfNotDry('yarn', publicArgs, { - stdio: 'pipe' - }) - console.log(colors.green(`Successfully published ${pkgName}@${version}`)) - } catch (e: any) { - if (e.stderr.match(/previously published/)) { - console.log(colors.red(`Skipping already published: ${pkgName}`)) - } else { - throw e - } - } -} - main().catch((err) => { console.error(err) + process.exit(1) }) diff --git a/scripts/releaseUtils.ts b/scripts/releaseUtils.ts new file mode 100644 index 00000000000000..c2626a083552d0 --- /dev/null +++ b/scripts/releaseUtils.ts @@ -0,0 +1,215 @@ +/** + * modified from https://github.com/vuejs/core/blob/master/scripts/release.js + */ +import colors from 'picocolors' +import type { Options as ExecaOptions } from 'execa' +import execa from 'execa' +import { readFileSync, writeFileSync, existsSync, readdirSync } from 'fs' +import path from 'path' +import type { ReleaseType } from 'semver' +import semver from 'semver' + +export const args = require('minimist')(process.argv.slice(2)) + +export const isDryRun = !!args.dry + +if (isDryRun) { + console.log(colors.inverse(colors.yellow(' DRY RUN '))) + console.log() +} + +export const packages = [ + 'vite', + 'create-vite', + 'plugin-legacy', + 'plugin-react', + 'plugin-vue', + 'plugin-vue-jsx' +] + +export const versionIncrements: ReleaseType[] = [ + 'patch', + 'minor', + 'major' + // 'prepatch', + // 'preminor', + // 'premajor', + // 'prerelease' +] + +export function getPackageInfo(pkgName: string) { + const pkgDir = path.resolve(__dirname, '../packages/' + pkgName) + + if (!existsSync(pkgDir)) { + throw new Error(`Package ${pkgName} not found`) + } + + const pkgPath = path.resolve(pkgDir, 'package.json') + const pkg: { + name: string + version: string + private?: boolean + } = require(pkgPath) + const currentVersion = pkg.version + + if (pkg.private) { + throw new Error(`Package ${pkgName} is private`) + } + + return { + pkg, + pkgName, + pkgDir, + pkgPath, + currentVersion + } +} + +export async function run( + bin: string, + args: string[], + opts: ExecaOptions = {} +) { + return execa(bin, args, { stdio: 'inherit', ...opts }) +} + +export async function dryRun( + bin: string, + args: string[], + opts?: ExecaOptions +) { + return console.log( + colors.blue(`[dryrun] ${bin} ${args.join(' ')}`), + opts || '' + ) +} + +export const runIfNotDry = isDryRun ? dryRun : run + +export function step(msg: string) { + return console.log(colors.cyan(msg)) +} + +export function getVersionChoices(currentVersion: string) { + const currentBeta = currentVersion.includes('beta') + + const inc: (i: ReleaseType) => string = (i) => + semver.inc(currentVersion, i, 'beta')! + + const versionChoices = [ + { + title: 'next', + value: inc(currentBeta ? 'prerelease' : 'patch') + }, + ...(currentBeta + ? [ + { + title: 'stable', + value: inc('patch') + } + ] + : [ + { + title: 'beta-minor', + value: inc('preminor') + }, + { + title: 'beta-major', + value: inc('premajor') + }, + { + title: 'minor', + value: inc('minor') + }, + { + title: 'major', + value: inc('major') + } + ]), + { value: 'custom', title: 'custom' } + ].map((i) => { + i.title = `${i.title} (${i.value})` + return i + }) + + return versionChoices +} + +export function updateVersion(pkgPath: string, version: string): void { + const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')) + pkg.version = version + writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') +} + +export async function publishPackage( + pkdDir: string, + tag?: string +): Promise { + const publicArgs = ['publish', '--access', 'public'] + if (tag) { + publicArgs.push(`--tag`, tag) + } + await runIfNotDry('npm', publicArgs, { + stdio: 'pipe', + cwd: pkdDir + }) +} + +export async function getLatestTag(pkgName: string) { + const tags = (await run('git', ['tag'], { stdio: 'pipe' })).stdout + .split(/\n/) + .filter(Boolean) + const prefix = pkgName === 'vite' ? 'v' : `${pkgName}@` + return tags + .filter((tag) => tag.startsWith(prefix)) + .sort() + .reverse()[0] +} + +export async function logRecentCommits(pkgName: string) { + const tag = await getLatestTag(pkgName) + if (!tag) return + const sha = await run('git', ['rev-list', '-n', '1', tag], { + stdio: 'pipe' + }).then((res) => res.stdout.trim()) + console.log( + colors.bold( + `\n${colors.blue(`i`)} Commits of ${colors.green( + pkgName + )} since ${colors.green(tag)} ${colors.gray(`(${sha.slice(0, 5)})`)}` + ) + ) + await run( + 'git', + [ + '--no-pager', + 'log', + `${sha}..HEAD`, + '--oneline', + '--', + `packages/${pkgName}` + ], + { stdio: 'inherit' } + ) + console.log() +} + +export async function updateTemplateVersions(version: string) { + if (/beta|alpha|rc/.test(version)) return + + const dir = path.resolve(__dirname, '../packages/create-vite') + + const templates = readdirSync(dir).filter((dir) => + dir.startsWith('template-') + ) + for (const template of templates) { + const pkgPath = path.join(dir, template, `package.json`) + const pkg = require(pkgPath) + pkg.devDependencies.vite = `^` + version + if (template.startsWith('template-vue')) { + pkg.devDependencies['@vitejs/plugin-vue'] = + `^` + require('../packages/plugin-vue/package.json').version + } + writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') + } +} From 8e923fae96de811ca9c621049c061d0fffcc52d1 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Feb 2022 19:25:35 +0800 Subject: [PATCH 0278/1287] chore(ci): remove dry flag --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f4df5af00cc23c..ffdd5ea6399ad5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -32,6 +32,6 @@ jobs: run: pnpm install - name: Publish package - run: pnpm run ci-publish -- ${{ github.ref_name }} --dry + run: pnpm run ci-publish -- ${{ github.ref_name }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 254cc456c190086b2cba9c9e149720828ca3f00d Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Feb 2022 19:31:21 +0800 Subject: [PATCH 0279/1287] chore: fix create-vite bumping script (#6881) --- scripts/release.ts | 2 +- scripts/releaseUtils.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/release.ts b/scripts/release.ts index 6ec929a1d3a340..d536eca1f70586 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -75,7 +75,7 @@ async function main(): Promise { step('\nUpdating package version...') updateVersion(pkgPath, targetVersion) - if (pkgName === 'create-vite') updateTemplateVersions(targetVersion) + if (pkgName === 'create-vite') updateTemplateVersions() step('\nGenerating changelog...') const changelogArgs = [ diff --git a/scripts/releaseUtils.ts b/scripts/releaseUtils.ts index c2626a083552d0..b444835db7b6d0 100644 --- a/scripts/releaseUtils.ts +++ b/scripts/releaseUtils.ts @@ -194,8 +194,9 @@ export async function logRecentCommits(pkgName: string) { console.log() } -export async function updateTemplateVersions(version: string) { - if (/beta|alpha|rc/.test(version)) return +export async function updateTemplateVersions() { + const viteVersion = require('../packages/vite/package.json').version + if (/beta|alpha|rc/.test(viteVersion)) return const dir = path.resolve(__dirname, '../packages/create-vite') @@ -205,7 +206,7 @@ export async function updateTemplateVersions(version: string) { for (const template of templates) { const pkgPath = path.join(dir, template, `package.json`) const pkg = require(pkgPath) - pkg.devDependencies.vite = `^` + version + pkg.devDependencies.vite = `^` + viteVersion if (template.startsWith('template-vue')) { pkg.devDependencies['@vitejs/plugin-vue'] = `^` + require('../packages/plugin-vue/package.json').version From fcb53a365832449b9c23783781141498a4d0da58 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Feb 2022 19:31:50 +0800 Subject: [PATCH 0280/1287] release: plugin-vue-jsx@1.3.6 --- packages/plugin-vue-jsx/CHANGELOG.md | 9 +++++++++ packages/plugin-vue-jsx/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue-jsx/CHANGELOG.md b/packages/plugin-vue-jsx/CHANGELOG.md index 594f12c90f0909..8473e8f8af24f3 100644 --- a/packages/plugin-vue-jsx/CHANGELOG.md +++ b/packages/plugin-vue-jsx/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.3.6](https://github.com/vitejs/vite/compare/plugin-vue@2.2.0...plugin-vue@1.3.6) (2022-02-12) + + +### Bug Fixes + +* **deps:** update all non-major dependencies ([#6782](https://github.com/vitejs/vite/issues/6782)) ([e38be3e](https://github.com/vitejs/vite/commit/e38be3e6ca7bf79319d5d7188e1d347b1d6091ef)) + + + ## [1.3.5](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.3.4...plugin-vue-jsx@1.3.5) (2022-02-12) diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index dff19a227804d1..027f6d99180163 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue-jsx", - "version": "1.3.5", + "version": "1.3.6", "license": "MIT", "author": "Evan You", "files": [ From 5e26d5f663a9c8888405ea495a64271b51a9046d Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Feb 2022 19:47:58 +0800 Subject: [PATCH 0281/1287] chore: fix releasing token (#6882) --- .github/workflows/publish.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ffdd5ea6399ad5..eb8f4513707872 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,11 +26,20 @@ jobs: uses: actions/setup-node@v2 with: node-version: 16.x + registry-url: https://registry.npmjs.org/ cache: "pnpm" - name: Install deps run: pnpm install + - name: Creating .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Publish package run: pnpm run ci-publish -- ${{ github.ref_name }} env: From 78e84c80c0f49d6f7c8a0e10c4257a477a221280 Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Sat, 12 Feb 2022 20:50:18 +0000 Subject: [PATCH 0282/1287] feat: make `import.meta.glob` and `import.meta.globEager` generic (#5073) --- packages/vite/types/importMeta.d.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/packages/vite/types/importMeta.d.ts b/packages/vite/types/importMeta.d.ts index 625e075333e48d..732310490350eb 100644 --- a/packages/vite/types/importMeta.d.ts +++ b/packages/vite/types/importMeta.d.ts @@ -59,25 +59,15 @@ interface ImportMeta { readonly env: ImportMetaEnv - glob( + glob( pattern: string, options?: AssertOptions - ): Record< - string, - () => Promise<{ - [key: string]: any - }> - > + ): Record Promise> - globEager( + globEager( pattern: string, options?: AssertOptions - ): Record< - string, - { - [key: string]: any - } - > + ): Record } interface ImportMetaEnv { From 62cbe68ab713d5aba626a1e3a4da46e8c2320bf3 Mon Sep 17 00:00:00 2001 From: Ivan Demchuk Date: Sun, 13 Feb 2022 11:58:49 +0200 Subject: [PATCH 0283/1287] perf: improve isFileReadable performance (#6868) --- packages/vite/src/node/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index d723b25a54122d..2b2ba6fb859107 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -422,8 +422,8 @@ export function writeFile( */ export function isFileReadable(filename: string): boolean { try { - fs.accessSync(filename, fs.constants.R_OK) - return true + const stat = fs.statSync(filename, { throwIfNoEntry: false }) + return !!stat } catch { return false } From 2eabcb9a30a413ff540cbdd60a919a0d1f72fb35 Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Sun, 13 Feb 2022 22:24:33 +0630 Subject: [PATCH 0284/1287] perf: lazy import preview function (#6898) --- packages/vite/src/node/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/cli.ts b/packages/vite/src/node/cli.ts index 1b3af6b90e6f65..2a4f3a77918144 100644 --- a/packages/vite/src/node/cli.ts +++ b/packages/vite/src/node/cli.ts @@ -6,7 +6,6 @@ import type { ServerOptions } from './server' import type { LogLevel } from './logger' import { createLogger } from './logger' import { resolveConfig } from '.' -import { preview } from './preview' const cli = cac('vite') @@ -230,6 +229,7 @@ cli strictPort?: boolean } & GlobalCLIOptions ) => { + const { preview } = await import('./preview') try { const server = await preview({ root, From e385346c53b3bb54f2e1abcb7348e33d7e075fd4 Mon Sep 17 00:00:00 2001 From: ygj6 <7699524+ygj6@users.noreply.github.com> Date: Mon, 14 Feb 2022 11:49:36 +0800 Subject: [PATCH 0285/1287] feat: custom manifest file name (#6667) --- docs/config/index.md | 8 ++++---- packages/vite/src/node/build.ts | 4 ++-- packages/vite/src/node/cli.ts | 4 ++-- packages/vite/src/node/plugins/manifest.ts | 5 ++++- packages/vite/src/node/ssr/ssrManifestPlugin.ts | 5 ++++- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index 233e08b8f864e3..ba84c49b2f5820 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -772,19 +772,19 @@ export default defineConfig({ ### build.manifest -- **Type:** `boolean` +- **Type:** `boolean | string` - **Default:** `false` - **Related:** [Backend Integration](/guide/backend-integration) - When set to `true`, the build will also generate a `manifest.json` file that contains a mapping of non-hashed asset filenames to their hashed versions, which can then be used by a server framework to render the correct asset links. + When set to `true`, the build will also generate a `manifest.json` file that contains a mapping of non-hashed asset filenames to their hashed versions, which can then be used by a server framework to render the correct asset links. When the value is a string, it will be used as the manifest file name. ### build.ssrManifest -- **Type:** `boolean` +- **Type:** `boolean | string` - **Default:** `false` - **Related:** [Server-Side Rendering](/guide/ssr) - When set to `true`, the build will also generate a SSR manifest for determining style links and asset preload directives in production. + When set to `true`, the build will also generate a SSR manifest for determining style links and asset preload directives in production. When the value is a string, it will be used as the manifest file name. ### build.ssr diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index b9936f8583b46c..c8a1a0f17fa4a4 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -179,7 +179,7 @@ export interface BuildOptions { * ``` * @default false */ - manifest?: boolean + manifest?: boolean | string /** * Build in library mode. The value should be the global name of the lib in * UMD mode. This will produce esm + cjs + umd bundle formats with default @@ -195,7 +195,7 @@ export interface BuildOptions { * Generate SSR manifest for determining style links and asset preload * directives in production. */ - ssrManifest?: boolean + ssrManifest?: boolean | string /** * Set to false to disable reporting compressed chunk sizes. * Can slightly improve build speed. diff --git a/packages/vite/src/node/cli.ts b/packages/vite/src/node/cli.ts index 2a4f3a77918144..91b3d4e6bee998 100644 --- a/packages/vite/src/node/cli.ts +++ b/packages/vite/src/node/cli.ts @@ -149,8 +149,8 @@ cli `[boolean | "terser" | "esbuild"] enable/disable minification, ` + `or specify minifier to use (default: esbuild)` ) - .option('--manifest', `[boolean] emit build manifest json`) - .option('--ssrManifest', `[boolean] emit ssr manifest json`) + .option('--manifest [name]', `[boolean | string] emit build manifest json`) + .option('--ssrManifest [name]', `[boolean | string] emit ssr manifest json`) .option( '--emptyOutDir', `[boolean] force empty outDir when it's outside of root` diff --git a/packages/vite/src/node/plugins/manifest.ts b/packages/vite/src/node/plugins/manifest.ts index 2ce4869e67d98d..d6dceb507ca946 100644 --- a/packages/vite/src/node/plugins/manifest.ts +++ b/packages/vite/src/node/plugins/manifest.ts @@ -113,7 +113,10 @@ export function manifestPlugin(config: ResolvedConfig): Plugin { const outputLength = Array.isArray(output) ? output.length : 1 if (outputCount >= outputLength) { this.emitFile({ - fileName: `manifest.json`, + fileName: + typeof config.build.manifest === 'string' + ? config.build.manifest + : 'manifest.json', type: 'asset', source: JSON.stringify(manifest, null, 2) }) diff --git a/packages/vite/src/node/ssr/ssrManifestPlugin.ts b/packages/vite/src/node/ssr/ssrManifestPlugin.ts index e6811eae29b210..a92550e39d4ed0 100644 --- a/packages/vite/src/node/ssr/ssrManifestPlugin.ts +++ b/packages/vite/src/node/ssr/ssrManifestPlugin.ts @@ -96,7 +96,10 @@ export function ssrManifestPlugin(config: ResolvedConfig): Plugin { } this.emitFile({ - fileName: 'ssr-manifest.json', + fileName: + typeof config.build.ssrManifest === 'string' + ? config.build.ssrManifest + : 'ssr-manifest.json', type: 'asset', source: JSON.stringify(ssrManifest, null, 2) }) From 55eca7cf2750690d66eff8007bc1d6b5f0edb292 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 14 Feb 2022 11:13:56 +0100 Subject: [PATCH 0286/1287] release: plugin-vue-jsx@1.3.7 --- packages/plugin-vue-jsx/CHANGELOG.md | 9 +++++++++ packages/plugin-vue-jsx/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue-jsx/CHANGELOG.md b/packages/plugin-vue-jsx/CHANGELOG.md index 8473e8f8af24f3..0ad338dbd211eb 100644 --- a/packages/plugin-vue-jsx/CHANGELOG.md +++ b/packages/plugin-vue-jsx/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.3.7](https://github.com/vitejs/vite/compare/plugin-vue@2.2.0...plugin-vue@1.3.7) (2022-02-14) + + +### Bug Fixes + +* **deps:** update all non-major dependencies ([#6782](https://github.com/vitejs/vite/issues/6782)) ([e38be3e](https://github.com/vitejs/vite/commit/e38be3e6ca7bf79319d5d7188e1d347b1d6091ef)) + + + ## [1.3.6](https://github.com/vitejs/vite/compare/plugin-vue@2.2.0...plugin-vue@1.3.6) (2022-02-12) diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 027f6d99180163..f8289b79f4c445 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue-jsx", - "version": "1.3.6", + "version": "1.3.7", "license": "MIT", "author": "Evan You", "files": [ From e8c840abd2767445a5e49bab6540a66b941d7239 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 14 Feb 2022 11:21:37 +0100 Subject: [PATCH 0287/1287] release: v2.8.2 --- packages/vite/CHANGELOG.md | 16 ++++++++++++++++ packages/vite/package.json | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 50925e58baffdb..13226de36642eb 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,19 @@ +## [2.8.2](https://github.com/vitejs/vite/compare/v2.8.1...v2.8.2) (2022-02-14) + + +### Features + +* custom manifest file name ([#6667](https://github.com/vitejs/vite/issues/6667)) ([e385346](https://github.com/vitejs/vite/commit/e385346c53b3bb54f2e1abcb7348e33d7e075fd4)) +* make `import.meta.glob` and `import.meta.globEager` generic ([#5073](https://github.com/vitejs/vite/issues/5073)) ([78e84c8](https://github.com/vitejs/vite/commit/78e84c80c0f49d6f7c8a0e10c4257a477a221280)) + + +### Performance Improvements + +* improve isFileReadable performance ([#6868](https://github.com/vitejs/vite/issues/6868)) ([62cbe68](https://github.com/vitejs/vite/commit/62cbe68ab713d5aba626a1e3a4da46e8c2320bf3)) +* lazy import preview function ([#6898](https://github.com/vitejs/vite/issues/6898)) ([2eabcb9](https://github.com/vitejs/vite/commit/2eabcb9a30a413ff540cbdd60a919a0d1f72fb35)) + + + ## [2.8.1](https://github.com/vitejs/vite/compare/v2.8.0...v2.8.1) (2022-02-11) diff --git a/packages/vite/package.json b/packages/vite/package.json index 9bd14ca89a4d16..94029dc45cc008 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.8.1", + "version": "2.8.2", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From 0e58e72ab3b36156fb32bf983fe56c7621a11106 Mon Sep 17 00:00:00 2001 From: Zheeeng Date: Tue, 15 Feb 2022 15:21:55 +0800 Subject: [PATCH 0288/1287] chore: prefer using nullish-coalescing over or logic operator (#6790) --- packages/playground/testUtils.ts | 4 ++-- packages/vite/src/node/ssr/ssrManifestPlugin.ts | 2 +- packages/vite/src/node/ssr/ssrStacktrace.ts | 2 +- packages/vite/src/node/utils.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/playground/testUtils.ts b/packages/playground/testUtils.ts index 3c6cba769b3ffe..0ae0c6e8766e95 100644 --- a/packages/playground/testUtils.ts +++ b/packages/playground/testUtils.ts @@ -56,7 +56,7 @@ async function toEl(el: string | ElementHandle): Promise { export async function getColor(el: string | ElementHandle): Promise { el = await toEl(el) const rgb = await el.evaluate((el) => getComputedStyle(el as Element).color) - return hexToNameMap[rgbToHex(rgb)] || rgb + return hexToNameMap[rgbToHex(rgb)] ?? rgb } export async function getBg(el: string | ElementHandle): Promise { @@ -119,7 +119,7 @@ export async function untilUpdated( if (isBuild && !runInBuild) return const maxTries = process.env.CI ? 100 : 50 for (let tries = 0; tries < maxTries; tries++) { - const actual = (await poll()) || '' + const actual = (await poll()) ?? '' if (actual.indexOf(expected) > -1 || tries === maxTries - 1) { expect(actual).toMatch(expected) break diff --git a/packages/vite/src/node/ssr/ssrManifestPlugin.ts b/packages/vite/src/node/ssr/ssrManifestPlugin.ts index a92550e39d4ed0..351c91349a3ca3 100644 --- a/packages/vite/src/node/ssr/ssrManifestPlugin.ts +++ b/packages/vite/src/node/ssr/ssrManifestPlugin.ts @@ -29,7 +29,7 @@ export function ssrManifestPlugin(config: ResolvedConfig): Plugin { for (const id in chunk.modules) { const normalizedId = normalizePath(relative(config.root, id)) const mappedChunks = - ssrManifest[normalizedId] || (ssrManifest[normalizedId] = []) + ssrManifest[normalizedId] ?? (ssrManifest[normalizedId] = []) if (!chunk.isEntry) { mappedChunks.push(base + chunk.fileName) } diff --git a/packages/vite/src/node/ssr/ssrStacktrace.ts b/packages/vite/src/node/ssr/ssrStacktrace.ts index 75fcd8d2933c6f..0d847cb7da7041 100644 --- a/packages/vite/src/node/ssr/ssrStacktrace.ts +++ b/packages/vite/src/node/ssr/ssrStacktrace.ts @@ -46,7 +46,7 @@ export function ssrRewriteStacktrace( return input } - const source = `${pos.source}:${pos.line || 0}:${pos.column || 0}` + const source = `${pos.source}:${pos.line ?? 0}:${pos.column ?? 0}` if (!varName || varName === 'eval') { return ` at ${source}` } else { diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 2b2ba6fb859107..3012e6d57e6c65 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -222,7 +222,7 @@ export function injectQuery(url: string, queryToInject: string): string { } pathname = decodeURIComponent(pathname) return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ''}${ - hash || '' + hash ?? '' }` } @@ -518,7 +518,7 @@ export async function processSrcSet( ) return ret.reduce((prev, { url, descriptor }, index) => { - descriptor = descriptor || '' + descriptor ??= '' return (prev += url + ` ${descriptor}${index === ret.length - 1 ? '' : ', '}`) }, '') From 3480f27d4db7f7ebd27164d9185e7b387762274e Mon Sep 17 00:00:00 2001 From: Zheeeng Date: Tue, 15 Feb 2022 15:22:33 +0800 Subject: [PATCH 0289/1287] chore(types): correct typing in jestPerTestSetup (#6786) --- scripts/jestPerTestSetup.ts | 24 +++++++++++++----------- scripts/tsconfig.json | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/scripts/jestPerTestSetup.ts b/scripts/jestPerTestSetup.ts index 89209c3ffcbf69..9c15edf9f059bf 100644 --- a/scripts/jestPerTestSetup.ts +++ b/scripts/jestPerTestSetup.ts @@ -10,8 +10,7 @@ import type { Logger } from 'vite' import { createServer, build } from 'vite' -import type { Page } from 'playwright-chromium' -// eslint-disable-next-line node/no-extraneous-import +import type { Page, ConsoleMessage } from 'playwright-chromium' import type { RollupError, RollupWatcher, RollupWatcherEvent } from 'rollup' const isBuildTest = !!process.env.VITE_TEST_BUILD @@ -45,13 +44,15 @@ let server: ViteDevServer | http.Server let tempDir: string let rootDir: string -const setBeforeAllError = (err) => ((global as any).beforeAllError = err) -const getBeforeAllError = () => (global as any).beforeAllError +const setBeforeAllError = (err: Error | null) => { + global.beforeAllError = err +} +const getBeforeAllError = () => global.beforeAllError //init with null so old errors don't carry over setBeforeAllError(null) -const logs = ((global as any).browserLogs = []) -const onConsole = (msg) => { +const logs: string[] = (global.browserLogs = []) +const onConsole = (msg: ConsoleMessage) => { logs.push(msg.text()) } @@ -145,7 +146,7 @@ beforeAll(async () => { await page.goto(url) } } - } catch (e) { + } catch (e: any) { // jest doesn't exit if our setup has error here // https://github.com/facebook/jest/issues/2713 setBeforeAllError(e) @@ -172,11 +173,12 @@ afterAll(async () => { function startStaticServer(): Promise { // check if the test project has base config const configFile = resolve(rootDir, 'vite.config.js') - let config: UserConfig + let config: UserConfig | undefined try { config = require(configFile) } catch (e) {} - const base = (config?.base || '/') === '/' ? '' : config.base + // fallback internal base to '' + const base = (config?.base ?? '/') === '/' ? '' : config?.base ?? '' // @ts-ignore if (config && config.__test__) { @@ -219,10 +221,10 @@ export async function notifyRebuildComplete( watcher: RollupWatcher ): Promise { let callback: (event: RollupWatcherEvent) => void - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { callback = (event) => { if (event.code === 'END') { - resolve(true) + resolve() } } watcher.on('event', callback) diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 6a32b899cb43ab..5c70fcc7f15823 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -8,6 +8,6 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "types": ["node"] + "types": ["node", "jest"] } } From a9a1ae2db6a81a2fd31db370b58686e442047d9e Mon Sep 17 00:00:00 2001 From: patak Date: Tue, 15 Feb 2022 17:17:28 +0100 Subject: [PATCH 0290/1287] fix: revert update dotenv-expand #6703, fix #6858 (#6934) --- packages/vite/package.json | 2 +- packages/vite/src/node/config.ts | 2 +- pnpm-lock.yaml | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/vite/package.json b/packages/vite/package.json index 94029dc45cc008..728f6e00b84c7f 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -87,7 +87,7 @@ "cross-spawn": "^7.0.3", "debug": "^4.3.3", "dotenv": "^14.3.2", - "dotenv-expand": "^6.0.1", + "dotenv-expand": "^5.1.0", "es-module-lexer": "^0.9.3", "estree-walker": "^2.0.2", "etag": "^1.8.1", diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index f73f4fb8662d6b..2a607dd6ba9948 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -21,7 +21,7 @@ import { resolvePlugins } from './plugins' import colors from 'picocolors' import type { ESBuildOptions } from './plugins/esbuild' import dotenv from 'dotenv' -import { expand as dotenvExpand } from 'dotenv-expand' +import dotenvExpand from 'dotenv-expand' import type { Alias, AliasOptions } from 'types/alias' import { CLIENT_ENTRY, ENV_ENTRY, DEFAULT_ASSETS_RE } from './constants' import type { InternalResolveOptions, ResolveOptions } from './plugins/resolve' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab4083cb6a7635..418cf16f0eb6b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -770,7 +770,7 @@ importers: cross-spawn: ^7.0.3 debug: ^4.3.3 dotenv: ^14.3.2 - dotenv-expand: ^6.0.1 + dotenv-expand: ^5.1.0 es-module-lexer: ^0.9.3 esbuild: ^0.14.14 estree-walker: ^2.0.2 @@ -848,7 +848,7 @@ importers: cross-spawn: 7.0.3 debug: 4.3.3 dotenv: 14.3.2 - dotenv-expand: 6.0.1 + dotenv-expand: 5.1.0 es-module-lexer: 0.9.3 estree-walker: 2.0.2 etag: 1.8.1 @@ -4212,9 +4212,8 @@ packages: is-obj: 2.0.0 dev: true - /dotenv-expand/6.0.1: - resolution: {integrity: sha512-GNHcCOyRKLCXWnH3L/+sJ04PQxxgTOZDCPuQQnqkqPMGIilyoxHZ2JUNmh2VWKCfzVKH/AZsqcbuSYlDDVb/xw==} - engines: {node: '>=12'} + /dotenv-expand/5.1.0: + resolution: {integrity: sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==} dev: true /dotenv/14.3.2: From ac9652b0fc9aa947da4a62ff9553e23aee1dee8f Mon Sep 17 00:00:00 2001 From: patak-dev Date: Tue, 15 Feb 2022 18:07:13 +0100 Subject: [PATCH 0291/1287] release: v2.8.3 --- packages/vite/CHANGELOG.md | 9 +++++++++ packages/vite/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 13226de36642eb..fb262e6e13e783 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,12 @@ +## [2.8.3](https://github.com/vitejs/vite/compare/v2.8.2...v2.8.3) (2022-02-15) + + +### Bug Fixes + +* revert update dotenv-expand [#6703](https://github.com/vitejs/vite/issues/6703), fix [#6858](https://github.com/vitejs/vite/issues/6858) ([#6934](https://github.com/vitejs/vite/issues/6934)) ([a9a1ae2](https://github.com/vitejs/vite/commit/a9a1ae2db6a81a2fd31db370b58686e442047d9e)) + + + ## [2.8.2](https://github.com/vitejs/vite/compare/v2.8.1...v2.8.2) (2022-02-14) diff --git a/packages/vite/package.json b/packages/vite/package.json index 728f6e00b84c7f..0eff7b535822df 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.8.2", + "version": "2.8.3", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From 3f27d58036bfe4149e563a105c08c2d4771db288 Mon Sep 17 00:00:00 2001 From: patak Date: Tue, 15 Feb 2022 22:33:41 +0100 Subject: [PATCH 0292/1287] chore(deps): avoid updating dotenv-expand to v6+ (#6936) --- .github/renovate.json5 | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 763dfcfc467d9d..06fe0e7ea2aaff 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -28,6 +28,7 @@ "react-router", // `react-router:v6.0.0+` has breaking changes "react-router-dom", // `react-router-dom:v6.0.0+` has breaking changes "source-map", // `source-map:v0.7.0+` needs more investigation + "dotenv-expand", // `dotenv-expand:6.0.0+` has breaking changes (#6858) // ESM Only => https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm "node-fetch", From e2349569cf96e506e0d5fff1d043727a77fdad70 Mon Sep 17 00:00:00 2001 From: ocavue Date: Wed, 16 Feb 2022 21:20:45 +0800 Subject: [PATCH 0293/1287] docs: add backticks (#6945) --- docs/config/index.md | 2 +- packages/vite/src/node/config.ts | 2 +- packages/vite/src/node/optimizer/index.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index ba84c49b2f5820..d4ee7a96a6fa67 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -923,7 +923,7 @@ export default defineConfig({ - **Type:** `string | string[]` - By default, Vite will crawl your index.html to detect dependencies that need to be pre-bundled. If build.rollupOptions.input is specified, Vite will crawl those entry points instead. + By default, Vite will crawl your `index.html` to detect dependencies that need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite will crawl those entry points instead. If neither of these fit your needs, you can specify custom entries using this option - the value should be a [fast-glob pattern](https://github.com/mrmlnc/fast-glob#basic-syntax) or array of patterns that are relative from Vite project root. This will overwrite default entries inference. diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 2a607dd6ba9948..fbda8d5166cb1b 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -92,7 +92,7 @@ export interface UserConfig { * the performance. You can use `--force` flag or manually delete the directory * to regenerate the cache files. The value can be either an absolute file * system path or a path relative to . - * Default to `.vite` when no package.json is detected. + * Default to `.vite` when no `package.json` is detected. * @default 'node_modules/.vite' */ cacheDir?: string diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index 6102e832841a89..c13a26c63b3c1c 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -30,8 +30,8 @@ export type ExportsData = ReturnType & { export interface DepOptimizationOptions { /** - * By default, Vite will crawl your index.html to detect dependencies that - * need to be pre-bundled. If build.rollupOptions.input is specified, Vite + * By default, Vite will crawl your `index.html` to detect dependencies that + * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite * will crawl those entry points instead. * * If neither of these fit your needs, you can specify custom entries using From 4120908c518c8a89354aa93ffd6ebf5436123134 Mon Sep 17 00:00:00 2001 From: yoho <907415276@qq.com> Date: Thu, 17 Feb 2022 21:14:06 +0800 Subject: [PATCH 0294/1287] docs: import.meta.glob support ?raw (#6953) Co-authored-by: ygj6 <7699524+ygj6@users.noreply.github.com> --- docs/guide/features.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/guide/features.md b/docs/guide/features.md index da8e3b1de092b2..c7fd2424b53cb1 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -298,6 +298,22 @@ const modules = { } ``` +`import.meta.glob` and `import.meta.globEager` also support importing files as strings, similar to [Importing Asset as String](https://vitejs.dev/guide/assets.html#importing-asset-as-string). Here, we use the [Import Assertions](https://github.com/tc39/proposal-import-assertions#synopsis) syntax to import. + +```js +const modules = import.meta.glob('./dir/*.js', { assert: { type: 'raw' } }) +``` + +The above will be transformed into the following: + +```js +// code produced by vite +const modules = { + './dir/foo.js': '{\n "msg": "foo"\n}\n', + './dir/bar.js': '{\n "msg": "bar"\n}\n' +} +``` + Note that: - This is a Vite-only feature and is not a web or ES standard. From 08cf4e106534481fd8eff2e6e4a986270c28f894 Mon Sep 17 00:00:00 2001 From: Sepush Date: Thu, 17 Feb 2022 21:15:51 +0800 Subject: [PATCH 0295/1287] chore(ci): update issue-helper version (#6955) --- .github/workflows/issue-close-require.yml | 2 +- .github/workflows/issue-labeled.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issue-close-require.yml b/.github/workflows/issue-close-require.yml index 02ac374b06c426..97f9dd3a449c3c 100644 --- a/.github/workflows/issue-close-require.yml +++ b/.github/workflows/issue-close-require.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: need reproduction - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: "close-issues" token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index a63021952fd73d..b6f3919dfa63a2 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -10,7 +10,7 @@ jobs: steps: - name: contribution welcome if: github.event.label.name == 'contribution welcome' || github.event.label.name == 'help wanted' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: "create-comment, remove-labels" token: ${{ secrets.GITHUB_TOKEN }} @@ -21,7 +21,7 @@ jobs: - name: remove pending if: github.event.label.name == 'enhancement' || github.event.label.name == 'bug' || (contains(github.event.label.name, 'pending triage') == false && startsWith(github.event.label.name, 'bug:') == true) - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: "remove-labels" token: ${{ secrets.GITHUB_TOKEN }} @@ -30,7 +30,7 @@ jobs: - name: need reproduction if: github.event.label.name == 'need reproduction' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: "create-comment, remove-labels" token: ${{ secrets.GITHUB_TOKEN }} From 3f3f4737d5242547fb83f8d2522ba91cc1d96fb0 Mon Sep 17 00:00:00 2001 From: Nurettin Kaya Date: Thu, 17 Feb 2022 13:24:44 -0800 Subject: [PATCH 0296/1287] fix: normalize postcss dependency messages (#6959) --- .../tailwind/__test__/tailwind.spec.ts | 22 ++++++++++++++++++- packages/playground/tailwind/src/App.vue | 2 +- .../playground/tailwind/tailwind.config.js | 7 +++++- packages/vite/src/node/plugins/css.ts | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/packages/playground/tailwind/__test__/tailwind.spec.ts b/packages/playground/tailwind/__test__/tailwind.spec.ts index 105eb245bf207e..47f6b7ccf49037 100644 --- a/packages/playground/tailwind/__test__/tailwind.spec.ts +++ b/packages/playground/tailwind/__test__/tailwind.spec.ts @@ -5,7 +5,7 @@ test('should render', async () => { }) if (!isBuild) { - test('regenerate CSS and HMR', async () => { + test('regenerate CSS and HMR (glob pattern)', async () => { browserLogs.length = 0 const el = await page.$('#pagetitle') const el2 = await page.$('#helloroot') @@ -37,4 +37,24 @@ if (!isBuild) { browserLogs.length = 0 }) + + test('regenerate CSS and HMR (relative path)', async () => { + browserLogs.length = 0 + const el = await page.$('h1') + + expect(await getColor(el)).toBe('black') + + editFile('src/App.vue', (code) => + code.replace('text-black', 'text-[rgb(11,22,33)]') + ) + + await untilUpdated(() => getColor(el), 'rgb(11, 22, 33)') + + expect(browserLogs).toMatchObject([ + '[vite] css hot updated: /index.css', + '[vite] hot updated: /src/App.vue' + ]) + + browserLogs.length = 0 + }) } diff --git a/packages/playground/tailwind/src/App.vue b/packages/playground/tailwind/src/App.vue index b032d5e0db77e3..25835fc414a06f 100644 --- a/packages/playground/tailwind/src/App.vue +++ b/packages/playground/tailwind/src/App.vue @@ -1,6 +1,6 @@ diff --git a/packages/playground/vue/workerTest.js b/packages/playground/vue/workerTest.js new file mode 100644 index 00000000000000..fcde5e19b30677 --- /dev/null +++ b/packages/playground/vue/workerTest.js @@ -0,0 +1 @@ +self.postMessage('worker load!') diff --git a/packages/playground/worker/index.html b/packages/playground/worker/index.html index 60289ff84d6a06..fb4b3e9e85bfc8 100644 --- a/packages/playground/worker/index.html +++ b/packages/playground/worker/index.html @@ -1,3 +1,8 @@ +

worker template error match:

+ + const worker = new Worker(new URL('./worker.js', import.meta.url)) + +

format iife:

Expected values:
diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index 6b4d38836b6c51..d898b090fcdf6c 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -19,7 +19,6 @@ import type { } from 'rollup' import type Rollup from 'rollup' import { buildReporterPlugin } from './plugins/reporter' -import { buildHtmlPlugin } from './plugins/html' import { buildEsbuildPlugin } from './plugins/esbuild' import { terserPlugin } from './plugins/terser' import type { Terser } from 'types/terser' @@ -310,7 +309,6 @@ export function resolveBuildPlugins(config: ResolvedConfig): { return { pre: [ watchPackageDataPlugin(config), - buildHtmlPlugin(config), commonjsPlugin(options.commonjsOptions), dataURIPlugin(), dynamicImportVars(options.dynamicImportVarsOptions), diff --git a/packages/vite/src/node/plugins/assetImportMetaUrl.ts b/packages/vite/src/node/plugins/assetImportMetaUrl.ts index b0c59bed808604..a3f8e441b0f933 100644 --- a/packages/vite/src/node/plugins/assetImportMetaUrl.ts +++ b/packages/vite/src/node/plugins/assetImportMetaUrl.ts @@ -3,7 +3,12 @@ import MagicString from 'magic-string' import path from 'path' import { fileToUrl } from './asset' import type { ResolvedConfig } from '../config' -import { multilineCommentsRE, singlelineCommentsRE } from '../utils' +import { + multilineCommentsRE, + singlelineCommentsRE, + stringsRE, + blankReplacer +} from '../utils' /** * Convert `new URL('./foo.png', import.meta.url)` to its resolved built URL @@ -27,12 +32,18 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin { const importMetaUrlRE = /\bnew\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*,?\s*\)/g const noCommentsCode = code - .replace(multilineCommentsRE, (m) => ' '.repeat(m.length)) - .replace(singlelineCommentsRE, (m) => ' '.repeat(m.length)) + .replace(multilineCommentsRE, blankReplacer) + .replace(singlelineCommentsRE, blankReplacer) + .replace(stringsRE, (m) => `'${'\0'.repeat(m.length - 2)}'`) + let s: MagicString | null = null let match: RegExpExecArray | null while ((match = importMetaUrlRE.exec(noCommentsCode))) { - const { 0: exp, 1: rawUrl, index } = match + const { 0: exp, 1: emptyUrl, index } = match + + const urlStart = exp.indexOf(emptyUrl) + index + const urlEnd = urlStart + emptyUrl.length + const rawUrl = code.slice(urlStart, urlEnd) if (!s) s = new MagicString(code) diff --git a/packages/vite/src/node/plugins/index.ts b/packages/vite/src/node/plugins/index.ts index 825798a73c8493..d294233b92ae17 100644 --- a/packages/vite/src/node/plugins/index.ts +++ b/packages/vite/src/node/plugins/index.ts @@ -9,7 +9,7 @@ import { importAnalysisPlugin } from './importAnalysis' import { cssPlugin, cssPostPlugin } from './css' import { assetPlugin } from './asset' import { clientInjectionsPlugin } from './clientInjections' -import { htmlInlineProxyPlugin } from './html' +import { buildHtmlPlugin, htmlInlineProxyPlugin } from './html' import { wasmPlugin } from './wasm' import { modulePreloadPolyfillPlugin } from './modulePreloadPolyfill' import { webWorkerPlugin } from './worker' @@ -61,12 +61,13 @@ export async function resolvePlugins( ), wasmPlugin(config), webWorkerPlugin(config), - workerImportMetaUrlPlugin(config), assetPlugin(config), ...normalPlugins, definePlugin(config), cssPostPlugin(config), config.build.ssr ? ssrRequireHookPlugin(config) : null, + isBuild && buildHtmlPlugin(config), + workerImportMetaUrlPlugin(config), ...buildPlugins.pre, ...postPlugins, ...buildPlugins.post, diff --git a/packages/vite/src/node/plugins/workerImportMetaUrl.ts b/packages/vite/src/node/plugins/workerImportMetaUrl.ts index 233d83d066bcb7..4b5711cf3a6248 100644 --- a/packages/vite/src/node/plugins/workerImportMetaUrl.ts +++ b/packages/vite/src/node/plugins/workerImportMetaUrl.ts @@ -7,7 +7,8 @@ import { cleanUrl, injectQuery, multilineCommentsRE, - singlelineCommentsRE + singlelineCommentsRE, + stringsRE } from '../utils' import path from 'path' import { bundleWorkerEntry } from './worker' @@ -122,12 +123,21 @@ export function workerImportMetaUrlPlugin(config: ResolvedConfig): Plugin { const noCommentsCode = code .replace(multilineCommentsRE, blankReplacer) .replace(singlelineCommentsRE, blankReplacer) + + const noStringCode = noCommentsCode.replace( + stringsRE, + (m) => `'${' '.repeat(m.length - 2)}'` + ) let match: RegExpExecArray | null let s: MagicString | null = null - while ((match = importMetaUrlRE.exec(noCommentsCode))) { - const { 0: allExp, 2: exp, 3: rawUrl, index } = match + while ((match = importMetaUrlRE.exec(noStringCode))) { + const { 0: allExp, 2: exp, 3: emptyUrl, index } = match const urlIndex = allExp.indexOf(exp) + index + const urlStart = allExp.indexOf(emptyUrl) + index + const urlEnd = urlStart + emptyUrl.length + const rawUrl = code.slice(urlStart, urlEnd) + if (options?.ssr) { this.error( `\`new URL(url, import.meta.url)\` is not supported in SSR.`, diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index edb3410751868a..0e3fe49c9cb584 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -732,3 +732,4 @@ export function parseRequest(id: string): Record | null { } export const blankReplacer = (match: string) => ' '.repeat(match.length) +export const stringsRE = /"[^"]*"|'[^']*'|`[^`]*`/g From b16b8964e633cbf1ee2b051044af2660f1636558 Mon Sep 17 00:00:00 2001 From: Dany Castillo <31006608+dcastil@users.noreply.github.com> Date: Tue, 29 Mar 2022 18:05:54 +0200 Subject: [PATCH 0483/1287] docs: add wildcard to suggested .gitignore entry in docs (#7512) --- docs/guide/env-and-mode.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/env-and-mode.md b/docs/guide/env-and-mode.md index a2dee2b0d9d76e..1649feda8c7501 100644 --- a/docs/guide/env-and-mode.md +++ b/docs/guide/env-and-mode.md @@ -57,7 +57,7 @@ If you want to customize env variables prefix, see [envPrefix](/config/index#env :::warning SECURITY NOTES -- `.env.*.local` files are local-only and can contain sensitive variables. You should add `.local` to your `.gitignore` to avoid them being checked into git. +- `.env.*.local` files are local-only and can contain sensitive variables. You should add `*.local` to your `.gitignore` to avoid them being checked into git. - Since any variables exposed to your Vite source code will end up in your client bundle, `VITE_*` variables should _not_ contain any sensitive information. ::: From f05a81387b6901622c86c2833f42420b8e18e95e Mon Sep 17 00:00:00 2001 From: yoho Date: Wed, 30 Mar 2022 00:11:54 +0800 Subject: [PATCH 0484/1287] fix: import url worker two times (#7468) --- .../worker/__tests__/es/es-worker.spec.ts | 4 +- .../worker/emit-chunk-nested-worker.js | 25 +++- .../worker/emit-chunk-sub-worker.js | 14 +- packages/playground/worker/index.html | 10 +- .../playground/worker/module-and-worker.js | 5 + .../worker/worker/main-format-es.js | 20 ++- .../playground/worker/worker/main-module.js | 1 + packages/vite/src/node/plugins/define.ts | 8 +- packages/vite/src/node/plugins/worker.ts | 127 +++++++++++++++--- .../src/node/plugins/workerImportMetaUrl.ts | 17 +-- 10 files changed, 181 insertions(+), 50 deletions(-) create mode 100644 packages/playground/worker/module-and-worker.js diff --git a/packages/playground/worker/__tests__/es/es-worker.spec.ts b/packages/playground/worker/__tests__/es/es-worker.spec.ts index 51497a0f5ebadd..c7fd0d6c19e4bc 100644 --- a/packages/playground/worker/__tests__/es/es-worker.spec.ts +++ b/packages/playground/worker/__tests__/es/es-worker.spec.ts @@ -60,7 +60,7 @@ if (isBuild) { // assert correct files test('inlined code generation', async () => { const files = fs.readdirSync(assetsDir) - expect(files.length).toBe(20) + expect(files.length).toBe(22) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const worker = files.find((f) => f.includes('my-worker')) @@ -94,7 +94,7 @@ test('classic worker', async () => { test('emit chunk', async () => { expect(await page.textContent('.emti-chunk-worker')).toMatch( - '{"msg1":"module1","msg2":"module2","msg3":"module3"}' + '["A string",{"type":"emit-chunk-sub-worker","data":"A string"},{"type":"module-and-worker:worker","data":"A string"},{"type":"module-and-worker:module","data":"module and worker"},{"type":"emit-chunk-sub-worker","data":{"module":"module and worker","msg1":"module1","msg2":"module2","msg3":"module3"}}]' ) expect(await page.textContent('.emti-chunk-dynamic-import-worker')).toMatch( '"A string/es/"' diff --git a/packages/playground/worker/emit-chunk-nested-worker.js b/packages/playground/worker/emit-chunk-nested-worker.js index dff0f5bc64c5ad..6cb72b9488cfaf 100644 --- a/packages/playground/worker/emit-chunk-nested-worker.js +++ b/packages/playground/worker/emit-chunk-nested-worker.js @@ -1,7 +1,28 @@ import SubWorker from './emit-chunk-sub-worker?worker' - const subWorker = new SubWorker() subWorker.onmessage = (event) => { - self.postMessage(event.data) + self.postMessage({ + type: 'emit-chunk-sub-worker', + data: event.data + }) } + +const moduleWorker = new Worker( + new URL('./module-and-worker.js', import.meta.url), + { type: 'module' } +) + +moduleWorker.onmessage = (event) => { + self.postMessage({ + type: 'module-and-worker:worker', + data: event.data + }) +} + +import('./module-and-worker').then((res) => { + self.postMessage({ + type: 'module-and-worker:module', + data: res.module + }) +}) diff --git a/packages/playground/worker/emit-chunk-sub-worker.js b/packages/playground/worker/emit-chunk-sub-worker.js index bd6b1f6e4f7419..5d20becc781dd7 100644 --- a/packages/playground/worker/emit-chunk-sub-worker.js +++ b/packages/playground/worker/emit-chunk-sub-worker.js @@ -1,6 +1,8 @@ -Promise.all([import('./modules/module2'), import('./modules/module3')]).then( - (data) => { - const _data = { ...data[0], ...data[1] } - self.postMessage(_data) - } -) +Promise.all([ + import('./module-and-worker'), + import('./modules/module2'), + import('./modules/module3') +]).then((data) => { + const _data = { ...data[0], ...data[1], ...data[2] } + self.postMessage(_data) +}) diff --git a/packages/playground/worker/index.html b/packages/playground/worker/index.html index fb4b3e9e85bfc8..aec3995b60a06e 100644 --- a/packages/playground/worker/index.html +++ b/packages/playground/worker/index.html @@ -62,7 +62,9 @@

format iife:

- worker emit chunk + worker emit chunk
+ module and worker:worker in worker file
+ module and worker:module in worker file
.emti-chunk-worker

@@ -73,6 +75,12 @@

+

+ module and worker:worker in simple file + .module-and-worker-worker +

+ + @@ -268,6 +272,12 @@

document.querySelector('.import-meta-url-img-comma-nl').src = metaUrlWithCommaNL + import classNames from './css/foo.module.css' + document.querySelector('#foo').className = classNames['foo-module'] + + import someString from './static/foo.txt?raw' + document.querySelector('.raw-query').textContent = someString + const metaUrlNonExistent = new URL('non-existent', import.meta.url).pathname text('.non-existent-import-meta-url', metaUrlNonExistent) diff --git a/packages/playground/assets/static/foo.txt b/packages/playground/assets/static/foo.txt new file mode 100644 index 00000000000000..19102815663d23 --- /dev/null +++ b/packages/playground/assets/static/foo.txt @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index 3541cc377dc411..ff03352a20d7a7 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -39,6 +39,7 @@ import { getDepsCacheDir, findKnownImports } from './optimizer' import { assetImportMetaUrlPlugin } from './plugins/assetImportMetaUrl' import { loadFallbackPlugin } from './plugins/loadFallback' import { watchPackageDataPlugin } from './packages' +import { ensureWatchPlugin } from './plugins/ensureWatch' export interface BuildOptions { /** @@ -308,6 +309,7 @@ export function resolveBuildPlugins(config: ResolvedConfig): { return { pre: [ + ...(options.watch ? [ensureWatchPlugin()] : []), watchPackageDataPlugin(config), commonjsPlugin(options.commonjsOptions), dataURIPlugin(), diff --git a/packages/vite/src/node/plugins/ensureWatch.ts b/packages/vite/src/node/plugins/ensureWatch.ts new file mode 100644 index 00000000000000..30a6fb3d6df819 --- /dev/null +++ b/packages/vite/src/node/plugins/ensureWatch.ts @@ -0,0 +1,17 @@ +import type { Plugin } from '../plugin' +import { cleanUrl, queryRE } from '../utils' + +/** + * plugin to ensure rollup can watch correctly. + */ +export function ensureWatchPlugin(): Plugin { + return { + name: 'vite:ensure-watch', + load(id) { + if (queryRE.test(id)) { + this.addWatchFile(cleanUrl(id)) + } + return null + } + } +} diff --git a/packages/vite/src/node/plugins/index.ts b/packages/vite/src/node/plugins/index.ts index d294233b92ae17..2d34b99aebf1c5 100644 --- a/packages/vite/src/node/plugins/index.ts +++ b/packages/vite/src/node/plugins/index.ts @@ -17,6 +17,7 @@ import { preAliasPlugin } from './preAlias' import { definePlugin } from './define' import { ssrRequireHookPlugin } from './ssrRequireHook' import { workerImportMetaUrlPlugin } from './workerImportMetaUrl' +import { ensureWatchPlugin } from './ensureWatch' import { metadataPlugin } from './metadata' export async function resolvePlugins( @@ -26,12 +27,14 @@ export async function resolvePlugins( postPlugins: Plugin[] ): Promise { const isBuild = config.command === 'build' + const isWatch = isBuild && !!config.build.watch const buildPlugins = isBuild ? (await import('../build')).resolveBuildPlugins(config) : { pre: [], post: [] } return [ + isWatch ? ensureWatchPlugin() : null, isBuild ? metadataPlugin() : null, isBuild ? null : preAliasPlugin(), aliasPlugin({ entries: config.resolve.alias }), diff --git a/scripts/jestPerTestSetup.ts b/scripts/jestPerTestSetup.ts index 150c02eed5b76c..fcdca77ee9a6eb 100644 --- a/scripts/jestPerTestSetup.ts +++ b/scripts/jestPerTestSetup.ts @@ -175,6 +175,7 @@ afterAll(async () => { global.serverLogs = [] await global.page?.close() await server?.close() + global.watcher?.close() const beforeAllErr = getBeforeAllError() if (beforeAllErr) { throw beforeAllErr @@ -200,7 +201,7 @@ function startStaticServer(config?: InlineConfig): Promise { } // start static file server - const serve = sirv(resolve(rootDir, 'dist')) + const serve = sirv(resolve(rootDir, 'dist'), { dev: !!config?.build?.watch }) const httpServer = (server = http.createServer((req, res) => { if (req.url === '/ping') { res.statusCode = 200 From dfce28355c42d38425bc3374ed944ac324f50882 Mon Sep 17 00:00:00 2001 From: yoho Date: Tue, 12 Apr 2022 02:59:02 +0800 Subject: [PATCH 0533/1287] feat: clean string module lex string template (#7667) --- .../src/node/__tests__/cleanString.spec.ts | 52 ++++++++ packages/vite/src/node/cleanString.ts | 113 +++++++++++++++++- 2 files changed, 164 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/__tests__/cleanString.spec.ts b/packages/vite/src/node/__tests__/cleanString.spec.ts index 883dc67abfe2f9..1065a2d4985ceb 100644 --- a/packages/vite/src/node/__tests__/cleanString.spec.ts +++ b/packages/vite/src/node/__tests__/cleanString.spec.ts @@ -106,3 +106,55 @@ test('find empty string flag in raw index', () => { const bStart = clean.indexOf('\0\0\0\0\0', bIndex) expect(str.slice(bStart, bStart + 5)).toMatch('bbbbb') }) + +test('template string nested', () => { + let str = '`aaaa`' + let res = '`\0\0\0\0`' + let clean = emptyString(str) + expect(clean).toMatch(res) + + str = '`aaaa` `aaaa`' + res = '`\0\0\0\0` `\0\0\0\0`' + clean = emptyString(str) + expect(clean).toMatch(res) + + str = '`aa${a}aa`' + res = '`\0\0${a}\0\0`' + clean = emptyString(str) + expect(clean).toMatch(res) + + str = '`aa${a + `a` + a}aa`' + res = '`\0\0${a + `\0` + a}\0\0`' + clean = emptyString(str) + expect(clean).toMatch(res) + + str = '`aa${a + `a` + a}aa` `aa${a + `a` + a}aa`' + res = '`\0\0${a + `\0` + a}\0\0` `\0\0${a + `\0` + a}\0\0`' + clean = emptyString(str) + expect(clean).toMatch(res) + + str = '`aa${a + `aaaa${c + (a = {b: 1}) + d}` + a}aa`' + res = '`\0\0${a + `\0\0\0\0${c + (a = {b: 1}) + d}` + a}\0\0`' + clean = emptyString(str) + expect(clean).toMatch(res) + + str = + '`aa${a + `aaaa${c + (a = {b: 1}) + d}` + a}aa` `aa${a + `aaaa${c + (a = {b: 1}) + d}` + a}aa`' + res = + '`\0\0${a + `\0\0\0\0${c + (a = {b: 1}) + d}` + a}\0\0` `\0\0${a + `\0\0\0\0${c + (a = {b: 1}) + d}` + a}\0\0`' + clean = emptyString(str) + expect(clean).toMatch(res) + + str = '`aaaa' + res = '' + try { + clean = emptyString(str) + } catch {} + expect(clean).toMatch(res) + + str = + "" + res = `` + clean = emptyString(str) + expect(clean).toMatch(res) +}) diff --git a/packages/vite/src/node/cleanString.ts b/packages/vite/src/node/cleanString.ts index d26274397124ff..05163ea055b631 100644 --- a/packages/vite/src/node/cleanString.ts +++ b/packages/vite/src/node/cleanString.ts @@ -1,3 +1,4 @@ +import type { RollupError } from 'rollup' // bank on the non-overlapping nature of regex matches and combine all filters into one giant regex // /`([^`\$\{\}]|\$\{(`|\g<1>)*\})*`/g can match nested string template // but js not support match expression(\g<0>). so clean string template(`...`) in other ways. @@ -8,7 +9,117 @@ const stringBlankReplacer = (s: string) => `${s[0]}${'\0'.repeat(s.length - 2)}${s[0]}` export function emptyString(raw: string): string { - return raw.replace(cleanerRE, (s: string) => + let res = raw.replace(cleanerRE, (s: string) => s[0] === '/' ? blankReplacer(s) : stringBlankReplacer(s) ) + + let lastEnd = 0 + let start = 0 + while ((start = res.indexOf('`', lastEnd)) >= 0) { + let clean + ;[clean, lastEnd] = lexStringTemplateExpression(res, start) + res = replaceAt(res, start, lastEnd, clean) + } + + return res +} + +const enum LexerState { + inTemplateString, + inInterpolationExpression, + inObjectExpression +} + +function replaceAt( + string: string, + start: number, + end: number, + replacement: string +): string { + return string.slice(0, start) + replacement + string.slice(end) +} + +/** + * lex string template and clean it. + */ +function lexStringTemplateExpression( + code: string, + start: number +): [string, number] { + let state = LexerState.inTemplateString as LexerState + let clean = '`' + const opStack: LexerState[] = [state] + + function pushStack(newState: LexerState) { + state = newState + opStack.push(state) + } + + function popStack() { + opStack.pop() + state = opStack[opStack.length - 1] + } + + let i = start + 1 + outer: for (; i < code.length; i++) { + const char = code.charAt(i) + switch (state) { + case LexerState.inTemplateString: + if (char === '$' && code.charAt(i + 1) === '{') { + pushStack(LexerState.inInterpolationExpression) + clean += '${' + i++ // jump next + } else if (char === '`') { + popStack() + clean += char + if (opStack.length === 0) { + break outer + } + } else { + clean += '\0' + } + break + case LexerState.inInterpolationExpression: + if (char === '{') { + pushStack(LexerState.inObjectExpression) + clean += char + } else if (char === '}') { + popStack() + clean += char + } else if (char === '`') { + pushStack(LexerState.inTemplateString) + clean += char + } else { + clean += char + } + break + case LexerState.inObjectExpression: + if (char === '}') { + popStack() + clean += char + } else if (char === '`') { + pushStack(LexerState.inTemplateString) + clean += char + } else { + clean += char + } + break + default: + throw new Error('unknown string template lexer state') + } + } + + if (opStack.length !== 0) { + error(start) + } + + return [clean, i + 1] +} + +function error(pos: number) { + const err = new Error( + `can not match string template expression.` + ) as RollupError + err.pos = pos + throw err } From 66b6dc508086a4ab75af4dacc849c50a58c7aebc Mon Sep 17 00:00:00 2001 From: Rom Date: Tue, 12 Apr 2022 06:40:07 +0200 Subject: [PATCH 0534/1287] fix: `$ vite preview` 404 handling (#7665) --- packages/vite/src/node/preview.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/node/preview.ts b/packages/vite/src/node/preview.ts index c00f62a9cb8f0c..23b905fd01a719 100644 --- a/packages/vite/src/node/preview.ts +++ b/packages/vite/src/node/preview.ts @@ -1,4 +1,5 @@ import path from 'path' +import fs from 'fs' import sirv from 'sirv' import connect from 'connect' import compression from './server/middlewares/compression' @@ -90,11 +91,20 @@ export async function preview( config.base, sirv(distDir, { etag: true, - dev: true, - single: true + dev: true }) ) + app.use(config.base, (_, res, next) => { + const file = path.join(distDir, './404.html') + if (fs.existsSync(file)) { + res.statusCode = 404 + res.end(fs.readFileSync(file)) + } else { + next() + } + }) + const options = config.preview const hostname = resolveHostname(options.host) const port = options.port ?? 4173 From 0c928aa079df5060c5bc7a745a128be62fd86cd2 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 12 Apr 2022 17:29:25 +0800 Subject: [PATCH 0535/1287] refactor: esbuild handles `target` and `useDefineForClassFields` (#7698) --- packages/vite/src/node/plugins/esbuild.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/vite/src/node/plugins/esbuild.ts b/packages/vite/src/node/plugins/esbuild.ts index db216c7d6b0d77..c982b4e61f30c8 100644 --- a/packages/vite/src/node/plugins/esbuild.ts +++ b/packages/vite/src/node/plugins/esbuild.ts @@ -81,6 +81,7 @@ export async function transformWithEsbuild( // these fields would affect the compilation result // https://esbuild.github.io/content-types/#tsconfig-json const meaningfulFields: Array = [ + 'target', 'jsxFactory', 'jsxFragmentFactory', 'useDefineForClassFields', @@ -98,17 +99,9 @@ export async function transformWithEsbuild( compilerOptionsForFile[field] = loadedCompilerOptions[field] } } - - // align with TypeScript 4.3 - // https://github.com/microsoft/TypeScript/pull/42663 - if (loadedCompilerOptions.target?.toLowerCase() === 'esnext') { - compilerOptionsForFile.useDefineForClassFields = - loadedCompilerOptions.useDefineForClassFields ?? true - } } tsconfigRaw = { - ...tsconfigRaw, compilerOptions: { ...compilerOptionsForFile, ...tsconfigRaw?.compilerOptions From 8f28350291dde55e9d20b05f124b53867bcaf8e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Tue, 12 Apr 2022 18:32:02 +0900 Subject: [PATCH 0536/1287] chore(create-vite): add isolatedModules (#7697) --- packages/create-vite/template-lit-ts/tsconfig.json | 1 + packages/create-vite/template-svelte-ts/tsconfig.json | 3 ++- packages/create-vite/template-vanilla-ts/tsconfig.json | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/create-vite/template-lit-ts/tsconfig.json b/packages/create-vite/template-lit-ts/tsconfig.json index 03ecaf410c88be..2ec691c81c2b38 100644 --- a/packages/create-vite/template-lit-ts/tsconfig.json +++ b/packages/create-vite/template-lit-ts/tsconfig.json @@ -11,6 +11,7 @@ "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "moduleResolution": "node", + "isolatedModules": true, "allowSyntheticDefaultImports": true, "experimentalDecorators": true, "forceConsistentCasingInFileNames": true, diff --git a/packages/create-vite/template-svelte-ts/tsconfig.json b/packages/create-vite/template-svelte-ts/tsconfig.json index 4d6c04cf0ab13b..96bfd81aaf1203 100644 --- a/packages/create-vite/template-svelte-ts/tsconfig.json +++ b/packages/create-vite/template-svelte-ts/tsconfig.json @@ -13,7 +13,8 @@ * of JS in `.svelte` files. */ "allowJs": true, - "checkJs": true + "checkJs": true, + "isolatedModules": true }, "include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"], "references": [{ "path": "./tsconfig.node.json" }] diff --git a/packages/create-vite/template-vanilla-ts/tsconfig.json b/packages/create-vite/template-vanilla-ts/tsconfig.json index 1885c8f9b00106..05f80b91398b98 100644 --- a/packages/create-vite/template-vanilla-ts/tsconfig.json +++ b/packages/create-vite/template-vanilla-ts/tsconfig.json @@ -8,6 +8,7 @@ "strict": true, "sourceMap": true, "resolveJsonModule": true, + "isolatedModules": true, "esModuleInterop": true, "noEmit": true, "noUnusedLocals": true, From 7e6a2c8f7d140186576b9492639f462b3eb99e12 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Tue, 12 Apr 2022 14:54:15 +0200 Subject: [PATCH 0537/1287] chore: revert removed line in #7698 --- packages/vite/src/node/plugins/esbuild.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vite/src/node/plugins/esbuild.ts b/packages/vite/src/node/plugins/esbuild.ts index c982b4e61f30c8..9e8bae24424d76 100644 --- a/packages/vite/src/node/plugins/esbuild.ts +++ b/packages/vite/src/node/plugins/esbuild.ts @@ -102,6 +102,7 @@ export async function transformWithEsbuild( } tsconfigRaw = { + ...tsconfigRaw, compilerOptions: { ...compilerOptionsForFile, ...tsconfigRaw?.compilerOptions From 88581807cce75bbb104ef4c1cb3dd483b748d3fd Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Tue, 12 Apr 2022 21:52:50 +0800 Subject: [PATCH 0538/1287] perf(css): hoist at rules with regex (#7691) --- .../src/node/__tests__/plugins/css.spec.ts | 36 +++++++++++++- packages/vite/src/node/plugins/css.ts | 48 ++++++++----------- 2 files changed, 55 insertions(+), 29 deletions(-) diff --git a/packages/vite/src/node/__tests__/plugins/css.spec.ts b/packages/vite/src/node/__tests__/plugins/css.spec.ts index 539ec2f1af1810..9b652a563ccb0a 100644 --- a/packages/vite/src/node/__tests__/plugins/css.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/css.spec.ts @@ -1,4 +1,4 @@ -import { cssUrlRE, cssPlugin } from '../../plugins/css' +import { cssUrlRE, cssPlugin, hoistAtRules } from '../../plugins/css' import { resolveConfig } from '../../config' import fs from 'fs' import path from 'path' @@ -114,3 +114,37 @@ describe('css path resolutions', () => { mockFs.mockReset() }) }) + +describe('hoist @ rules', () => { + test('hoist @import', async () => { + const css = `.foo{color:red;}@import "bla";` + const result = await hoistAtRules(css) + expect(result).toBe(`@import "bla";.foo{color:red;}`) + }) + + test('hoist @import with semicolon in quotes', async () => { + const css = `.foo{color:red;}@import "bla;bar";` + const result = await hoistAtRules(css) + expect(result).toBe(`@import "bla;bar";.foo{color:red;}`) + }) + + test('hoist @charset', async () => { + const css = `.foo{color:red;}@charset "utf-8";` + const result = await hoistAtRules(css) + expect(result).toBe(`@charset "utf-8";.foo{color:red;}`) + }) + + test('hoist one @charset only', async () => { + const css = `.foo{color:red;}@charset "utf-8";@charset "utf-8";` + const result = await hoistAtRules(css) + expect(result).toBe(`@charset "utf-8";.foo{color:red;}`) + }) + + test('hoist @import and @charset', async () => { + const css = `.foo{color:red;}@import "bla";@charset "utf-8";.bar{color:grren;}@import "baz";` + const result = await hoistAtRules(css) + expect(result).toBe( + `@charset "utf-8";@import "bla";@import "baz";.foo{color:red;}.bar{color:grren;}` + ) + }) +}) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index adef254950c5e5..08bdfbeed4e616 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -1106,36 +1106,28 @@ async function minifyCSS(css: string, config: ResolvedConfig) { return code } -// #1845 -// CSS @import can only appear at top of the file. We need to hoist all @import -// to top when multiple files are concatenated. -// #6333 -// CSS @charset must be the top-first in the file, hoist to top too -async function hoistAtRules(css: string) { - const postcss = await import('postcss') - return (await postcss.default([AtRuleHoistPlugin]).process(css)).css -} - -const AtRuleHoistPlugin: PostCSS.PluginCreator = () => { - return { - postcssPlugin: 'vite-hoist-at-rules', - Once(root) { - const imports: PostCSS.AtRule[] = [] - let charset: PostCSS.AtRule | undefined - root.walkAtRules((rule) => { - if (rule.name === 'import') { - // record in reverse so that can simply prepend to preserve order - imports.unshift(rule) - } else if (!charset && rule.name === 'charset') { - charset = rule - } - }) - imports.forEach((i) => root.prepend(i)) - if (charset) root.prepend(charset) +export async function hoistAtRules(css: string) { + const s = new MagicString(css) + // #1845 + // CSS @import can only appear at top of the file. We need to hoist all @import + // to top when multiple files are concatenated. + // match until semicolon that's not in quotes + s.replace(/@import\s*(?:"[^"]*"|'[^']*'|[^;]*).*?;/gm, (match) => { + s.appendLeft(0, match) + return '' + }) + // #6333 + // CSS @charset must be the top-first in the file, hoist the first to top + let foundCharset = false + s.replace(/@charset\s*(?:"[^"]*"|'[^']*'|[^;]*).*?;/gm, (match) => { + if (!foundCharset) { + s.prepend(match) + foundCharset = true } - } + return '' + }) + return s.toString() } -AtRuleHoistPlugin.postcss = true // Preprocessor support. This logic is largely replicated from @vue/compiler-sfc From 23fdef1dec68ff5552f140659e83a18dc8b0b060 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Tue, 12 Apr 2022 23:23:44 +0800 Subject: [PATCH 0539/1287] chore: type unknown env as any (#7702) --- docs/guide/env-and-mode.md | 2 +- packages/vite/types/importMeta.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guide/env-and-mode.md b/docs/guide/env-and-mode.md index 1649feda8c7501..b2b1264e85a8e4 100644 --- a/docs/guide/env-and-mode.md +++ b/docs/guide/env-and-mode.md @@ -42,7 +42,7 @@ In addition, environment variables that already exist when Vite is executed have `.env` files are loaded at the start of Vite. Restart the server after making changes. ::: -Loaded env variables are also exposed to your client source code via `import.meta.env`. +Loaded env variables are also exposed to your client source code via `import.meta.env` as strings. To prevent accidentally leaking env variables to the client, only variables prefixed with `VITE_` are exposed to your Vite-processed code. e.g. the following file: diff --git a/packages/vite/types/importMeta.d.ts b/packages/vite/types/importMeta.d.ts index 9b57fd120a7ba9..900b975d37d6ad 100644 --- a/packages/vite/types/importMeta.d.ts +++ b/packages/vite/types/importMeta.d.ts @@ -36,7 +36,7 @@ interface ImportMeta { } interface ImportMetaEnv { - [key: string]: string | boolean | undefined + [key: string]: any BASE_URL: string MODE: string DEV: boolean From 7ddbf96ae11bf0eeef97ffc00dcf5ac4c561cc20 Mon Sep 17 00:00:00 2001 From: yoho Date: Tue, 12 Apr 2022 23:25:37 +0800 Subject: [PATCH 0540/1287] feat: explicit the word boundary (#6876) --- .../assets/__tests__/assets.spec.ts | 7 +++++++ packages/playground/assets/index.html | 19 +++++++++++++++++ packages/vite/src/node/plugins/html.ts | 21 ++++++++++++------- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/packages/playground/assets/__tests__/assets.spec.ts b/packages/playground/assets/__tests__/assets.spec.ts index e08de24265e24a..75c0e57952db24 100644 --- a/packages/playground/assets/__tests__/assets.spec.ts +++ b/packages/playground/assets/__tests__/assets.spec.ts @@ -307,3 +307,10 @@ if (!isBuild) { await untilUpdated(() => getColor('.import-css'), 'rgb(0, 255, 136)') }) } + +test('html import word boundary', async () => { + expect(await page.textContent('.obj-import-express')).toMatch( + 'ignore object import prop' + ) + expect(await page.textContent('.string-import-express')).toMatch('no load') +}) diff --git a/packages/playground/assets/index.html b/packages/playground/assets/index.html index b0ec76f5483b6f..6678a2da7c2106 100644 --- a/packages/playground/assets/index.html +++ b/packages/playground/assets/index.html @@ -176,9 +176,28 @@

new URL(`non-existent`, import.meta.url)

simple script tag import-expression

+ +

url in style tag

url

diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index 25ad91582140c3..5c86b6c0ac6073 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -35,6 +35,7 @@ import type { TextNode } from '@vue/compiler-dom' import { NodeTypes } from '@vue/compiler-dom' +import { emptyString } from '../cleanString' interface ScriptAssetsUrl { start: number @@ -44,8 +45,9 @@ interface ScriptAssetsUrl { const htmlProxyRE = /\?html-proxy=?[&inline\-css]*&index=(\d+)\.(js|css)$/ const inlineCSSRE = /__VITE_INLINE_CSS__([^_]+_\d+)__/g +// Do not allow preceding '.', but do allow preceding '...' for spread operations +const inlineImportRE = /(? htmlProxyRE.test(id) @@ -303,14 +305,19 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin { } } else if (node.children.length) { const scriptNode = node.children.pop()! as TextNode - const code = scriptNode.content + const cleanCode = emptyString(scriptNode.content) + let match: RegExpExecArray | null - while ((match = inlineImportRE.exec(code))) { - const { 0: full, 1: url, index } = match - const startUrl = full.indexOf(url) - const start = scriptNode.loc.start.offset + index + startUrl + 1 + while ((match = inlineImportRE.exec(cleanCode))) { + const { 1: url, index } = match + const startUrl = cleanCode.indexOf(url, index) + const start = startUrl + 1 const end = start + url.length - 2 - scriptUrls.push({ start, end, url: url.slice(1, -1) }) + scriptUrls.push({ + start: start + scriptNode.loc.start.offset, + end: end + scriptNode.loc.start.offset, + url: scriptNode.content.slice(start, end) + }) } } } From 83d32d965e3abd78fe390e347923e68dfb6de773 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Wed, 13 Apr 2022 02:50:19 +0800 Subject: [PATCH 0541/1287] fix: default value of assetsDir option (#7703) --- packages/vite/src/node/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/cli.ts b/packages/vite/src/node/cli.ts index 9cec6ebd9cfd68..89412a825e9fc1 100644 --- a/packages/vite/src/node/cli.ts +++ b/packages/vite/src/node/cli.ts @@ -130,7 +130,7 @@ cli .option('--outDir ', `[string] output directory (default: dist)`) .option( '--assetsDir ', - `[string] directory under outDir to place assets in (default: _assets)` + `[string] directory under outDir to place assets in (default: assets)` ) .option( '--assetsInlineLimit ', From 48e038cc53d609120ffcb0b04c2a6e24cfdebb7b Mon Sep 17 00:00:00 2001 From: patak Date: Wed, 13 Apr 2022 06:34:32 +0200 Subject: [PATCH 0542/1287] feat: optimizeDeps.disabled (#7646) --- packages/playground/vue-jsx/vite.config.js | 3 ++- packages/vite/src/node/config.ts | 15 ++++++++++----- packages/vite/src/node/optimizer/index.ts | 6 ++++++ packages/vite/src/node/server/index.ts | 10 ++++++++-- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/packages/playground/vue-jsx/vite.config.js b/packages/playground/vue-jsx/vite.config.js index d6eb84e05f4e4a..4c7370a0ce4787 100644 --- a/packages/playground/vue-jsx/vite.config.js +++ b/packages/playground/vue-jsx/vite.config.js @@ -35,5 +35,6 @@ export default defineComponent(() => { build: { // to make tests faster minify: false - } + }, + optimizeDeps: false } diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 9910cbb3a8b004..b02ac6e496593e 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -145,8 +145,10 @@ export interface UserConfig { preview?: PreviewOptions /** * Dep optimization options + * + * false disables optimization completely (experimental) */ - optimizeDeps?: DepOptimizationOptions + optimizeDeps?: DepOptimizationOptions | false /** * SSR specific options * @alpha @@ -463,6 +465,8 @@ export async function resolveConfig( const server = resolveServerOptions(resolvedRoot, config.server) + const optimizeDeps = config.optimizeDeps || {} + const resolved: ResolvedConfig = { ...config, configFile: configFile ? normalizePath(configFile) : undefined, @@ -497,11 +501,12 @@ export async function resolveConfig( packageCache: new Map(), createResolver, optimizeDeps: { - ...config.optimizeDeps, + disabled: config.optimizeDeps === false, + ...optimizeDeps, esbuildOptions: { - keepNames: config.optimizeDeps?.keepNames, + keepNames: optimizeDeps.keepNames, preserveSymlinks: config.resolve?.preserveSymlinks, - ...config.optimizeDeps?.esbuildOptions + ...optimizeDeps.esbuildOptions } }, worker: resolvedWorkerOptions @@ -605,7 +610,7 @@ export async function resolveConfig( } }) - if (config.optimizeDeps?.keepNames) { + if (optimizeDeps.keepNames) { logDeprecationWarning( 'optimizeDeps.keepNames', 'Use "optimizeDeps.esbuildOptions.keepNames" instead.' diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index 88c41801938b98..13c322610cf493 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -101,6 +101,12 @@ export interface DepOptimizationOptions { * @experimental */ extensions?: string[] + /** + * Disables dependencies optimizations + * @default false + * @experimental + */ + disabled?: boolean } export interface DepOptimizationResult { diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index de80ac1147ff0f..bf13ba683a9b93 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -571,6 +571,12 @@ export async function createServer( // error handler middlewares.use(errorMiddleware(server, !!middlewareMode)) + const initOptimizer = () => { + if (!config.optimizeDeps.disabled) { + server._optimizedDeps = createOptimizedDeps(server) + } + } + if (!middlewareMode && httpServer) { let isOptimized = false // overwrite listen to init optimizer before server start @@ -579,7 +585,7 @@ export async function createServer( if (!isOptimized) { try { await container.buildStart({}) - server._optimizedDeps = createOptimizedDeps(server) + initOptimizer() isOptimized = true } catch (e) { httpServer.emit('error', e) @@ -590,7 +596,7 @@ export async function createServer( }) as any } else { await container.buildStart({}) - server._optimizedDeps = createOptimizedDeps(server) + initOptimizer() } return server From d6830e3d70b693945113b7504b25be8a18b27815 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 13 Apr 2022 12:36:35 +0800 Subject: [PATCH 0543/1287] fix(ssr): properly transform export default with expressions (#7705) --- .../node/ssr/__tests__/ssrTransform.spec.ts | 23 +++++++++++++++++++ packages/vite/src/node/ssr/ssrTransform.ts | 7 +++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts index e086365ee25f16..a5f915edea97fd 100644 --- a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts +++ b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts @@ -657,3 +657,26 @@ export function fn1() { " `) }) + +// https://github.com/vitest-dev/vitest/issues/1141 +test('export default expression', async () => { + // esbuild transform result of following TS code + // export default function getRandom() { + // return Math.random() + // } + const code = ` +export default (function getRandom() { + return Math.random(); +}); +`.trim() + + expect((await ssrTransform(code, null, null)).code).toMatchInlineSnapshot(` + "__vite_ssr_exports__.default = (function getRandom() { + return Math.random(); + });" + `) + + expect( + (await ssrTransform(`export default (class A {});`, null, null)).code + ).toMatchInlineSnapshot(`"__vite_ssr_exports__.default = (class A {});"`) +}) diff --git a/packages/vite/src/node/ssr/ssrTransform.ts b/packages/vite/src/node/ssr/ssrTransform.ts index 56b75f8dd14913..79ccd25f9ca8ff 100644 --- a/packages/vite/src/node/ssr/ssrTransform.ts +++ b/packages/vite/src/node/ssr/ssrTransform.ts @@ -143,7 +143,12 @@ export async function ssrTransform( // default export if (node.type === 'ExportDefaultDeclaration') { - if ('id' in node.declaration && node.declaration.id) { + const expressionTypes = ['FunctionExpression', 'ClassExpression'] + if ( + 'id' in node.declaration && + node.declaration.id && + !expressionTypes.includes(node.declaration.type) + ) { // named hoistable/class exports // export default function foo() {} // export default class A {} From ba9a1ffe9ea5414d6e232a7ded9d341014a4e726 Mon Sep 17 00:00:00 2001 From: patak Date: Wed, 13 Apr 2022 15:32:15 +0200 Subject: [PATCH 0544/1287] fix: revert optimizeDeps false, keep optimizedDeps.disabled (#7715) --- packages/playground/vue-jsx/vite.config.js | 4 +++- packages/vite/src/node/config.ts | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/playground/vue-jsx/vite.config.js b/packages/playground/vue-jsx/vite.config.js index 4c7370a0ce4787..2f4ea255c95094 100644 --- a/packages/playground/vue-jsx/vite.config.js +++ b/packages/playground/vue-jsx/vite.config.js @@ -36,5 +36,7 @@ export default defineComponent(() => { // to make tests faster minify: false }, - optimizeDeps: false + optimizeDeps: { + disabled: true + } } diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index b02ac6e496593e..f633d1158bfa95 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -145,10 +145,8 @@ export interface UserConfig { preview?: PreviewOptions /** * Dep optimization options - * - * false disables optimization completely (experimental) */ - optimizeDeps?: DepOptimizationOptions | false + optimizeDeps?: DepOptimizationOptions /** * SSR specific options * @alpha @@ -501,7 +499,6 @@ export async function resolveConfig( packageCache: new Map(), createResolver, optimizeDeps: { - disabled: config.optimizeDeps === false, ...optimizeDeps, esbuildOptions: { keepNames: optimizeDeps.keepNames, From f699afb9531201dc24566821fcab55d3e70a2708 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Wed, 13 Apr 2022 15:47:32 +0200 Subject: [PATCH 0545/1287] release: v2.9.2 --- packages/vite/CHANGELOG.md | 32 ++++++++++++++++++++++++++++++++ packages/vite/package.json | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 0f91a004602caa..b011910c8615cc 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,35 @@ +## 2.9.2 (2022-04-13) + +* fix: `$ vite preview` 404 handling (#7665) ([66b6dc5](https://github.com/vitejs/vite/commit/66b6dc5)), closes [#7665](https://github.com/vitejs/vite/issues/7665) +* fix: build should also respect esbuild=false config (#7602) ([2dc0e80](https://github.com/vitejs/vite/commit/2dc0e80)), closes [#7602](https://github.com/vitejs/vite/issues/7602) +* fix: default value of assetsDir option (#7703) ([83d32d9](https://github.com/vitejs/vite/commit/83d32d9)), closes [#7703](https://github.com/vitejs/vite/issues/7703) +* fix: detect env hmr (#7595) ([212d454](https://github.com/vitejs/vite/commit/212d454)), closes [#7595](https://github.com/vitejs/vite/issues/7595) +* fix: EACCES permission denied due to resolve new paths default (#7612) ([1dd019f](https://github.com/vitejs/vite/commit/1dd019f)), closes [#7612](https://github.com/vitejs/vite/issues/7612) +* fix: fix HMR propagation when imports not analyzed (#7561) ([57e7914](https://github.com/vitejs/vite/commit/57e7914)), closes [#7561](https://github.com/vitejs/vite/issues/7561) +* fix: nested comments and strings, new regexp utils (#7650) ([93900f0](https://github.com/vitejs/vite/commit/93900f0)), closes [#7650](https://github.com/vitejs/vite/issues/7650) +* fix: revert optimizeDeps false, keep optimizedDeps.disabled (#7715) ([ba9a1ff](https://github.com/vitejs/vite/commit/ba9a1ff)), closes [#7715](https://github.com/vitejs/vite/issues/7715) +* fix: update watch mode (#7132) ([9ed1672](https://github.com/vitejs/vite/commit/9ed1672)), closes [#7132](https://github.com/vitejs/vite/issues/7132) +* fix: update ws types (#7605) ([b620587](https://github.com/vitejs/vite/commit/b620587)), closes [#7605](https://github.com/vitejs/vite/issues/7605) +* fix: use correct proxy config in preview (#7604) ([cf59005](https://github.com/vitejs/vite/commit/cf59005)), closes [#7604](https://github.com/vitejs/vite/issues/7604) +* fix(css): hoist charset (#7678) ([29e622c](https://github.com/vitejs/vite/commit/29e622c)), closes [#7678](https://github.com/vitejs/vite/issues/7678) +* fix(css): include inline css module in bundle (#7591) ([45b9273](https://github.com/vitejs/vite/commit/45b9273)), closes [#7591](https://github.com/vitejs/vite/issues/7591) +* fix(deps): update all non-major dependencies (#7668) ([485263c](https://github.com/vitejs/vite/commit/485263c)), closes [#7668](https://github.com/vitejs/vite/issues/7668) +* fix(less): handles rewriting relative paths passed Less's `data-uri` function. (#7400) ([08e39b7](https://github.com/vitejs/vite/commit/08e39b7)), closes [#7400](https://github.com/vitejs/vite/issues/7400) +* fix(resolver): skip known ESM entries when resolving a `require` call (#7582) ([5d6ea8e](https://github.com/vitejs/vite/commit/5d6ea8e)), closes [#7582](https://github.com/vitejs/vite/issues/7582) +* fix(ssr): properly transform export default with expressions (#7705) ([d6830e3](https://github.com/vitejs/vite/commit/d6830e3)), closes [#7705](https://github.com/vitejs/vite/issues/7705) +* feat: clean string module lex string template (#7667) ([dfce283](https://github.com/vitejs/vite/commit/dfce283)), closes [#7667](https://github.com/vitejs/vite/issues/7667) +* feat: explicit the word boundary (#6876) ([7ddbf96](https://github.com/vitejs/vite/commit/7ddbf96)), closes [#6876](https://github.com/vitejs/vite/issues/6876) +* feat: optimizeDeps.disabled (#7646) ([48e038c](https://github.com/vitejs/vite/commit/48e038c)), closes [#7646](https://github.com/vitejs/vite/issues/7646) +* chore: fix term cases (#7553) ([c296130](https://github.com/vitejs/vite/commit/c296130)), closes [#7553](https://github.com/vitejs/vite/issues/7553) +* chore: revert removed line in #7698 ([7e6a2c8](https://github.com/vitejs/vite/commit/7e6a2c8)), closes [#7698](https://github.com/vitejs/vite/issues/7698) +* chore: type unknown env as any (#7702) ([23fdef1](https://github.com/vitejs/vite/commit/23fdef1)), closes [#7702](https://github.com/vitejs/vite/issues/7702) +* chore(deps): update all non-major dependencies (#7603) ([fc51a15](https://github.com/vitejs/vite/commit/fc51a15)), closes [#7603](https://github.com/vitejs/vite/issues/7603) +* perf(css): hoist at rules with regex (#7691) ([8858180](https://github.com/vitejs/vite/commit/8858180)), closes [#7691](https://github.com/vitejs/vite/issues/7691) +* refactor: esbuild handles `target` and `useDefineForClassFields` (#7698) ([0c928aa](https://github.com/vitejs/vite/commit/0c928aa)), closes [#7698](https://github.com/vitejs/vite/issues/7698) +* docs: update release notes (#7563) ([a74bd7b](https://github.com/vitejs/vite/commit/a74bd7b)), closes [#7563](https://github.com/vitejs/vite/issues/7563) + + + ## 2.9.1 (2022-03-31) * fix: allow port 0 to be provided to server (#7530) ([173e4c9](https://github.com/vitejs/vite/commit/173e4c9)), closes [#7530](https://github.com/vitejs/vite/issues/7530) diff --git a/packages/vite/package.json b/packages/vite/package.json index adf73956a5c33a..1a749f662be43a 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.9.1", + "version": "2.9.2", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From 720e73c5f507eb3c142c53e4bc2e3d025e9a9f8a Mon Sep 17 00:00:00 2001 From: patak-dev Date: Wed, 13 Apr 2022 15:49:07 +0200 Subject: [PATCH 0546/1287] release: plugin-vue-jsx@1.3.10 --- packages/plugin-vue-jsx/CHANGELOG.md | 6 ++++++ packages/plugin-vue-jsx/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue-jsx/CHANGELOG.md b/packages/plugin-vue-jsx/CHANGELOG.md index 3a1b9e681b45ea..94effd95f316b6 100644 --- a/packages/plugin-vue-jsx/CHANGELOG.md +++ b/packages/plugin-vue-jsx/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.3.10 (2022-04-13) + +* fix(deps): update all non-major dependencies (#7668) ([485263c](https://github.com/vitejs/vite/commit/485263c)), closes [#7668](https://github.com/vitejs/vite/issues/7668) + + + ## 1.3.9 (2022-03-30) * fix(deps): update all non-major dependencies (#7392) ([b63fc3b](https://github.com/vitejs/vite/commit/b63fc3b)), closes [#7392](https://github.com/vitejs/vite/issues/7392) diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index d8057b91f8ab24..151d0a71ce648c 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue-jsx", - "version": "1.3.9", + "version": "1.3.10", "license": "MIT", "author": "Evan You", "files": [ From 070321bd6d38cee05e9ab4a96fc3a06d07f699ea Mon Sep 17 00:00:00 2001 From: patak-dev Date: Wed, 13 Apr 2022 15:51:10 +0200 Subject: [PATCH 0547/1287] release: plugin-react@1.3.1 --- packages/plugin-react/CHANGELOG.md | 8 ++++++++ packages/plugin-react/package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/plugin-react/CHANGELOG.md b/packages/plugin-react/CHANGELOG.md index c05c0989d6beb4..958c8270b6f221 100644 --- a/packages/plugin-react/CHANGELOG.md +++ b/packages/plugin-react/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.3.1 (2022-04-13) + +* fix(deps): update all non-major dependencies (#7668) ([485263c](https://github.com/vitejs/vite/commit/485263c)), closes [#7668](https://github.com/vitejs/vite/issues/7668) +* chore: fix term cases (#7553) ([c296130](https://github.com/vitejs/vite/commit/c296130)), closes [#7553](https://github.com/vitejs/vite/issues/7553) +* chore(deps): update all non-major dependencies (#7603) ([fc51a15](https://github.com/vitejs/vite/commit/fc51a15)), closes [#7603](https://github.com/vitejs/vite/issues/7603) + + + ## 1.3.0 (2022-03-30) * feat(plugin-react): adding jsxPure option (#7088) ([d451435](https://github.com/vitejs/vite/commit/d451435)), closes [#7088](https://github.com/vitejs/vite/issues/7088) diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index e7fc9544120b11..6608eef784fa22 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-react", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "author": "Evan You", "contributors": [ From e7ea19ad2204a12fadc37f5ecd6ab0eea2d23373 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Wed, 13 Apr 2022 15:52:05 +0200 Subject: [PATCH 0548/1287] release: plugin-legacy@1.8.1 --- packages/plugin-legacy/CHANGELOG.md | 7 +++++++ packages/plugin-legacy/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/plugin-legacy/CHANGELOG.md b/packages/plugin-legacy/CHANGELOG.md index ced87d2efd665c..5c00212554ce8c 100644 --- a/packages/plugin-legacy/CHANGELOG.md +++ b/packages/plugin-legacy/CHANGELOG.md @@ -1,3 +1,10 @@ +## 1.8.1 (2022-04-13) + +* fix(deps): update all non-major dependencies (#7668) ([485263c](https://github.com/vitejs/vite/commit/485263c)), closes [#7668](https://github.com/vitejs/vite/issues/7668) +* docs(legacy): note works in build only (#7596) ([f26b14a](https://github.com/vitejs/vite/commit/f26b14a)), closes [#7596](https://github.com/vitejs/vite/issues/7596) + + + ## 1.8.0 (2022-03-30) * fix(deps): update all non-major dependencies (#6782) ([e38be3e](https://github.com/vitejs/vite/commit/e38be3e)), closes [#6782](https://github.com/vitejs/vite/issues/6782) diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index eb974d790f1e71..4c6783abc04bc8 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-legacy", - "version": "1.8.0", + "version": "1.8.1", "license": "MIT", "author": "Evan You", "files": [ From adacaba1cf03256cf18a3494b4d7b053605d4a46 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Wed, 13 Apr 2022 15:53:05 +0200 Subject: [PATCH 0549/1287] release: create-vite@2.9.1 --- packages/create-vite/CHANGELOG.md | 10 ++++++++++ packages/create-vite/package.json | 2 +- packages/create-vite/template-lit-ts/package.json | 2 +- packages/create-vite/template-lit/package.json | 2 +- packages/create-vite/template-preact-ts/package.json | 2 +- packages/create-vite/template-preact/package.json | 2 +- packages/create-vite/template-react-ts/package.json | 2 +- packages/create-vite/template-react/package.json | 2 +- packages/create-vite/template-svelte-ts/package.json | 2 +- packages/create-vite/template-svelte/package.json | 2 +- packages/create-vite/template-vanilla-ts/package.json | 2 +- packages/create-vite/template-vanilla/package.json | 2 +- packages/create-vite/template-vue-ts/package.json | 4 ++-- packages/create-vite/template-vue/package.json | 4 ++-- 14 files changed, 25 insertions(+), 15 deletions(-) diff --git a/packages/create-vite/CHANGELOG.md b/packages/create-vite/CHANGELOG.md index bf69fae7e535ad..cac7f2664ecaed 100644 --- a/packages/create-vite/CHANGELOG.md +++ b/packages/create-vite/CHANGELOG.md @@ -1,3 +1,13 @@ +## 2.9.1 (2022-04-13) + +* chore: fix term cases (#7553) ([c296130](https://github.com/vitejs/vite/commit/c296130)), closes [#7553](https://github.com/vitejs/vite/issues/7553) +* chore: update @types/react version (#7655) ([eb57627](https://github.com/vitejs/vite/commit/eb57627)), closes [#7655](https://github.com/vitejs/vite/issues/7655) +* chore: update vue template setup api doc url (#7628) ([4433df4](https://github.com/vitejs/vite/commit/4433df4)), closes [#7628](https://github.com/vitejs/vite/issues/7628) +* chore(create-vite-app): upgrade react to 18 (#7597) ([8b21029](https://github.com/vitejs/vite/commit/8b21029)), closes [#7597](https://github.com/vitejs/vite/issues/7597) +* chore(create-vite): add isolatedModules (#7697) ([8f28350](https://github.com/vitejs/vite/commit/8f28350)), closes [#7697](https://github.com/vitejs/vite/issues/7697) + + + ## 2.9.0 (2022-03-30) * chore: add isolatedModules to create-vite > template-vue-ts > tsconfig (#7304) ([21990ea](https://github.com/vitejs/vite/commit/21990ea)), closes [#7304](https://github.com/vitejs/vite/issues/7304) diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json index 72955697360477..dcaf3962c987cf 100644 --- a/packages/create-vite/package.json +++ b/packages/create-vite/package.json @@ -1,6 +1,6 @@ { "name": "create-vite", - "version": "2.9.0", + "version": "2.9.1", "license": "MIT", "author": "Evan You", "bin": { diff --git a/packages/create-vite/template-lit-ts/package.json b/packages/create-vite/template-lit-ts/package.json index 061def321a22e6..6a928d05bb9e84 100644 --- a/packages/create-vite/template-lit-ts/package.json +++ b/packages/create-vite/template-lit-ts/package.json @@ -19,7 +19,7 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.9.0", + "vite": "^2.9.2", "typescript": "^4.5.4" } } diff --git a/packages/create-vite/template-lit/package.json b/packages/create-vite/template-lit/package.json index 89f4fee41576c6..7889bec19759ff 100644 --- a/packages/create-vite/template-lit/package.json +++ b/packages/create-vite/template-lit/package.json @@ -17,6 +17,6 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.9.0" + "vite": "^2.9.2" } } diff --git a/packages/create-vite/template-preact-ts/package.json b/packages/create-vite/template-preact-ts/package.json index dfa6659650c5ae..aaf8aea0372e52 100644 --- a/packages/create-vite/template-preact-ts/package.json +++ b/packages/create-vite/template-preact-ts/package.json @@ -13,6 +13,6 @@ "devDependencies": { "@preact/preset-vite": "^2.1.5", "typescript": "^4.5.4", - "vite": "^2.9.0" + "vite": "^2.9.2" } } diff --git a/packages/create-vite/template-preact/package.json b/packages/create-vite/template-preact/package.json index 02528128f6442e..19198fc9e66d67 100644 --- a/packages/create-vite/template-preact/package.json +++ b/packages/create-vite/template-preact/package.json @@ -12,6 +12,6 @@ }, "devDependencies": { "@preact/preset-vite": "^2.1.5", - "vite": "^2.9.0" + "vite": "^2.9.2" } } diff --git a/packages/create-vite/template-react-ts/package.json b/packages/create-vite/template-react-ts/package.json index 69274929dd903d..ea89f3a68d8c45 100644 --- a/packages/create-vite/template-react-ts/package.json +++ b/packages/create-vite/template-react-ts/package.json @@ -16,6 +16,6 @@ "@types/react-dom": "^18.0.0", "@vitejs/plugin-react": "^1.3.0", "typescript": "^4.6.3", - "vite": "^2.9.1" + "vite": "^2.9.2" } } diff --git a/packages/create-vite/template-react/package.json b/packages/create-vite/template-react/package.json index 4f443aefcb3cdb..f81b751dc8f30c 100644 --- a/packages/create-vite/template-react/package.json +++ b/packages/create-vite/template-react/package.json @@ -15,6 +15,6 @@ "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@vitejs/plugin-react": "^1.3.0", - "vite": "^2.9.1" + "vite": "^2.9.2" } } diff --git a/packages/create-vite/template-svelte-ts/package.json b/packages/create-vite/template-svelte-ts/package.json index 32e080146e0b6e..bed1e3caedeef0 100644 --- a/packages/create-vite/template-svelte-ts/package.json +++ b/packages/create-vite/template-svelte-ts/package.json @@ -17,6 +17,6 @@ "svelte-preprocess": "^4.9.8", "tslib": "^2.3.1", "typescript": "^4.5.4", - "vite": "^2.9.0" + "vite": "^2.9.2" } } diff --git a/packages/create-vite/template-svelte/package.json b/packages/create-vite/template-svelte/package.json index da049c170731b9..661a174421d156 100644 --- a/packages/create-vite/template-svelte/package.json +++ b/packages/create-vite/template-svelte/package.json @@ -11,6 +11,6 @@ "devDependencies": { "@sveltejs/vite-plugin-svelte": "^1.0.0-next.30", "svelte": "^3.44.0", - "vite": "^2.9.0" + "vite": "^2.9.2" } } diff --git a/packages/create-vite/template-vanilla-ts/package.json b/packages/create-vite/template-vanilla-ts/package.json index 8dd7a0bb800909..adedc3d4e83a65 100644 --- a/packages/create-vite/template-vanilla-ts/package.json +++ b/packages/create-vite/template-vanilla-ts/package.json @@ -9,6 +9,6 @@ }, "devDependencies": { "typescript": "^4.5.4", - "vite": "^2.9.0" + "vite": "^2.9.2" } } diff --git a/packages/create-vite/template-vanilla/package.json b/packages/create-vite/template-vanilla/package.json index ff318e00f14fd1..ee68e7cd13e903 100644 --- a/packages/create-vite/template-vanilla/package.json +++ b/packages/create-vite/template-vanilla/package.json @@ -8,6 +8,6 @@ "preview": "vite preview" }, "devDependencies": { - "vite": "^2.9.0" + "vite": "^2.9.2" } } diff --git a/packages/create-vite/template-vue-ts/package.json b/packages/create-vite/template-vue-ts/package.json index 1d8ff2b3e19d56..2ad29ac0b91725 100644 --- a/packages/create-vite/template-vue-ts/package.json +++ b/packages/create-vite/template-vue-ts/package.json @@ -11,9 +11,9 @@ "vue": "^3.2.25" }, "devDependencies": { - "@vitejs/plugin-vue": "^2.3.0", + "@vitejs/plugin-vue": "^2.3.1", "typescript": "^4.5.4", - "vite": "^2.9.0", + "vite": "^2.9.2", "vue-tsc": "^0.29.8" } } diff --git a/packages/create-vite/template-vue/package.json b/packages/create-vite/template-vue/package.json index 707b664d3dfff7..531986717154ee 100644 --- a/packages/create-vite/template-vue/package.json +++ b/packages/create-vite/template-vue/package.json @@ -11,7 +11,7 @@ "vue": "^3.2.25" }, "devDependencies": { - "@vitejs/plugin-vue": "^2.3.0", - "vite": "^2.9.0" + "@vitejs/plugin-vue": "^2.3.1", + "vite": "^2.9.2" } } From 26862c4b7aabd876ece0197ae9f6404fdfcec408 Mon Sep 17 00:00:00 2001 From: patak Date: Wed, 13 Apr 2022 18:24:18 +0200 Subject: [PATCH 0550/1287] fix: revert #7665 (#7716) --- packages/vite/src/node/preview.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/vite/src/node/preview.ts b/packages/vite/src/node/preview.ts index 23b905fd01a719..c00f62a9cb8f0c 100644 --- a/packages/vite/src/node/preview.ts +++ b/packages/vite/src/node/preview.ts @@ -1,5 +1,4 @@ import path from 'path' -import fs from 'fs' import sirv from 'sirv' import connect from 'connect' import compression from './server/middlewares/compression' @@ -91,20 +90,11 @@ export async function preview( config.base, sirv(distDir, { etag: true, - dev: true + dev: true, + single: true }) ) - app.use(config.base, (_, res, next) => { - const file = path.join(distDir, './404.html') - if (fs.existsSync(file)) { - res.statusCode = 404 - res.end(fs.readFileSync(file)) - } else { - next() - } - }) - const options = config.preview const hostname = resolveHostname(options.host) const port = options.port ?? 4173 From cb5c3f99bfe8ea1f4b43a1d81030b95bc704720b Mon Sep 17 00:00:00 2001 From: patak-dev Date: Wed, 13 Apr 2022 18:35:02 +0200 Subject: [PATCH 0551/1287] release: v2.9.3 --- packages/vite/CHANGELOG.md | 6 ++++++ packages/vite/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index b011910c8615cc..822d801d57537e 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.9.3 (2022-04-13) + +* fix: revert #7665 (#7716) ([26862c4](https://github.com/vitejs/vite/commit/26862c4)), closes [#7665](https://github.com/vitejs/vite/issues/7665) [#7716](https://github.com/vitejs/vite/issues/7716) + + + ## 2.9.2 (2022-04-13) * fix: `$ vite preview` 404 handling (#7665) ([66b6dc5](https://github.com/vitejs/vite/commit/66b6dc5)), closes [#7665](https://github.com/vitejs/vite/issues/7665) diff --git a/packages/vite/package.json b/packages/vite/package.json index 1a749f662be43a..eeecf5b2160544 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.9.2", + "version": "2.9.3", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From a5c2a7803eeed55e023bec464f6b193ed5ddac79 Mon Sep 17 00:00:00 2001 From: Hugo ATTAL Date: Wed, 13 Apr 2022 21:39:46 +0200 Subject: [PATCH 0552/1287] fix: handle url imports with semicolon (fix #7717) (#7718) --- .../vite/src/node/__tests__/plugins/css.spec.ts | 14 ++++++++++++++ packages/vite/src/node/plugins/css.ts | 11 +++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/packages/vite/src/node/__tests__/plugins/css.spec.ts b/packages/vite/src/node/__tests__/plugins/css.spec.ts index 9b652a563ccb0a..078cec2e0f3d77 100644 --- a/packages/vite/src/node/__tests__/plugins/css.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/css.spec.ts @@ -122,6 +122,20 @@ describe('hoist @ rules', () => { expect(result).toBe(`@import "bla";.foo{color:red;}`) }) + test('hoist @import url with semicolon', async () => { + const css = `.foo{color:red;}@import url("bla;bla");` + const result = await hoistAtRules(css) + expect(result).toBe(`@import url("bla;bla");.foo{color:red;}`) + }) + + test('hoist @import url data with semicolon', async () => { + const css = `.foo{color:red;}@import url(data:image/png;base64,iRxVB0);` + const result = await hoistAtRules(css) + expect(result).toBe( + `@import url(data:image/png;base64,iRxVB0);.foo{color:red;}` + ) + }) + test('hoist @import with semicolon in quotes', async () => { const css = `.foo{color:red;}@import "bla;bar";` const result = await hoistAtRules(css) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 08bdfbeed4e616..0a14e091c53637 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -1112,10 +1112,13 @@ export async function hoistAtRules(css: string) { // CSS @import can only appear at top of the file. We need to hoist all @import // to top when multiple files are concatenated. // match until semicolon that's not in quotes - s.replace(/@import\s*(?:"[^"]*"|'[^']*'|[^;]*).*?;/gm, (match) => { - s.appendLeft(0, match) - return '' - }) + s.replace( + /@import\s*(?:url\([^\)]*\)|"[^"]*"|'[^']*'|[^;]*).*?;/gm, + (match) => { + s.appendLeft(0, match) + return '' + } + ) // #6333 // CSS @charset must be the top-first in the file, hoist the first to top let foundCharset = false From 6c27f14997db377c7baa5cc6721a9c3f74964a98 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Wed, 13 Apr 2022 21:52:47 +0200 Subject: [PATCH 0553/1287] release: v2.9.4 --- packages/vite/CHANGELOG.md | 6 ++++++ packages/vite/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 822d801d57537e..8ed8c8cf8ba692 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.9.4 (2022-04-13) + +* fix: handle url imports with semicolon (fix #7717) (#7718) ([a5c2a78](https://github.com/vitejs/vite/commit/a5c2a78)), closes [#7717](https://github.com/vitejs/vite/issues/7717) [#7718](https://github.com/vitejs/vite/issues/7718) + + + ## 2.9.3 (2022-04-13) * fix: revert #7665 (#7716) ([26862c4](https://github.com/vitejs/vite/commit/26862c4)), closes [#7665](https://github.com/vitejs/vite/issues/7665) [#7716](https://github.com/vitejs/vite/issues/7716) diff --git a/packages/vite/package.json b/packages/vite/package.json index eeecf5b2160544..1ab75ada9c7cd3 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.9.3", + "version": "2.9.4", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From c4450757d4c87de671a985714139d17349f905d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Thu, 14 Apr 2022 23:16:14 +0900 Subject: [PATCH 0554/1287] chore: format css minify esbuild error (#7731) --- packages/vite/src/node/plugins/css.ts | 31 +++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 0a14e091c53637..2f5ab3df58b46a 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -1092,18 +1092,27 @@ async function doImportCSSReplace( } async function minifyCSS(css: string, config: ResolvedConfig) { - const { code, warnings } = await transform(css, { - loader: 'css', - minify: true, - target: config.build.cssTarget || undefined - }) - if (warnings.length) { - const msgs = await formatMessages(warnings, { kind: 'warning' }) - config.logger.warn( - colors.yellow(`warnings when minifying css:\n${msgs.join('\n')}`) - ) + try { + const { code, warnings } = await transform(css, { + loader: 'css', + minify: true, + target: config.build.cssTarget || undefined + }) + if (warnings.length) { + const msgs = await formatMessages(warnings, { kind: 'warning' }) + config.logger.warn( + colors.yellow(`warnings when minifying css:\n${msgs.join('\n')}`) + ) + } + return code + } catch (e) { + if (e.errors) { + const msgs = await formatMessages(e.errors, { kind: 'error' }) + e.frame = '\n' + msgs.join('\n') + e.loc = e.errors[0].location + } + throw e } - return code } export async function hoistAtRules(css: string) { From fa86d69ca54e9a538302c8fcc300c5bfba0ce59f Mon Sep 17 00:00:00 2001 From: patak Date: Thu, 14 Apr 2022 16:40:53 +0200 Subject: [PATCH 0555/1287] fix: revert #7582, fix #7721 and #7736 (#7737) --- .../resolve/__tests__/resolve.spec.ts | 10 ++------ packages/playground/resolve/index.html | 20 ++++------------ packages/playground/resolve/package.json | 3 +-- .../index.cjs | 8 ------- .../require-pkg-with-esm-entries/index.cjs | 9 ------- .../require-pkg-with-esm-entries/package.json | 9 ------- .../dep.cjs | 0 .../require-pkg-with-module-field/index.cjs | 8 +++++++ .../package.json | 2 +- packages/playground/resolve/vite.config.js | 5 +--- packages/vite/src/node/constants.ts | 15 ------------ packages/vite/src/node/plugins/resolve.ts | 6 ----- pnpm-lock.yaml | 24 +++---------------- 13 files changed, 20 insertions(+), 99 deletions(-) delete mode 100644 packages/playground/resolve/require-pkg-with-browser-and-module-field/index.cjs delete mode 100644 packages/playground/resolve/require-pkg-with-esm-entries/index.cjs delete mode 100644 packages/playground/resolve/require-pkg-with-esm-entries/package.json rename packages/playground/resolve/{require-pkg-with-browser-and-module-field => require-pkg-with-module-field}/dep.cjs (100%) create mode 100644 packages/playground/resolve/require-pkg-with-module-field/index.cjs rename packages/playground/resolve/{require-pkg-with-browser-and-module-field => require-pkg-with-module-field}/package.json (68%) diff --git a/packages/playground/resolve/__tests__/resolve.spec.ts b/packages/playground/resolve/__tests__/resolve.spec.ts index 46f8f6138b39a4..2deb2fab7f8d40 100644 --- a/packages/playground/resolve/__tests__/resolve.spec.ts +++ b/packages/playground/resolve/__tests__/resolve.spec.ts @@ -61,14 +61,8 @@ test('dont add extension to directory name (./dir-with-ext.js/index.js)', async expect(await page.textContent('.dir-with-ext')).toMatch('[success]') }) -test('resolve to the `browser` field instead of `module` when the importer is a `require` call', async () => { - expect( - await page.textContent('.require-pkg-with-browser-and-module-field') - ).toMatch('[success]') -}) - -test('resolve to the `main` field instead of `module` when the importer is a `require` call', async () => { - expect(await page.textContent('.require-pkg-with-esm-entries')).toMatch( +test('do not resolve to the `module` field if the importer is a `require` call', async () => { + expect(await page.textContent('.require-pkg-with-module-field')).toMatch( '[success]' ) }) diff --git a/packages/playground/resolve/index.html b/packages/playground/resolve/index.html index 2478c89b495f49..1920ebb675d24c 100644 --- a/packages/playground/resolve/index.html +++ b/packages/playground/resolve/index.html @@ -58,17 +58,8 @@

Resolve file name containing dot

Browser Field

fail

-

- Resolve to the `browser` field instead of `module` when the importer is a - `require` call -

-

fail

- -

- Resolve to the `main` field instead of `module` when the importer is a - `require` call -

-

fail

+

Don't resolve to the `module` field if the importer is a `require` call

+

fail

CSS Entry

@@ -194,11 +185,8 @@

resolve package that contains # in path

text('.browser', main) } - import { msg as requireBrowserMsg } from 'require-pkg-with-browser-and-module-field' - text('.require-pkg-with-browser-and-module-field', requireBrowserMsg) - - import { msg as requireMainMsg } from 'require-pkg-with-esm-entries' - text('.require-pkg-with-esm-entries', requireMainMsg) + import { msg as requireButWithModuleFieldMsg } from 'require-pkg-with-module-field' + text('.require-pkg-with-module-field', requireButWithModuleFieldMsg) import { msg as customExtMsg } from './custom-ext' text('.custom-ext', customExtMsg) diff --git a/packages/playground/resolve/package.json b/packages/playground/resolve/package.json index 4b8d497b3dbb27..dda4476bc6ae82 100644 --- a/packages/playground/resolve/package.json +++ b/packages/playground/resolve/package.json @@ -12,8 +12,7 @@ "@babel/runtime": "^7.16.0", "es5-ext": "0.10.53", "normalize.css": "^8.0.1", - "require-pkg-with-browser-and-module-field": "link:./require-pkg-with-browser-and-module-field", - "require-pkg-with-esm-entries": "link:./require-pkg-with-esm-entries", + "require-pkg-with-module-field": "link:./require-pkg-with-module-field", "resolve-browser-field": "link:./browser-field", "resolve-custom-condition": "link:./custom-condition", "resolve-custom-main-field": "link:./custom-main-field", diff --git a/packages/playground/resolve/require-pkg-with-browser-and-module-field/index.cjs b/packages/playground/resolve/require-pkg-with-browser-and-module-field/index.cjs deleted file mode 100644 index 86d3360ab38dcb..00000000000000 --- a/packages/playground/resolve/require-pkg-with-browser-and-module-field/index.cjs +++ /dev/null @@ -1,8 +0,0 @@ -const dep = require('./dep.cjs') - -const msg = - dep === '1.111222233334444555566e+21' - ? '[success] require-pkg-with-browser-and-module-field' - : '[failed] require-pkg-with-browser-and-module-field' - -exports.msg = msg diff --git a/packages/playground/resolve/require-pkg-with-esm-entries/index.cjs b/packages/playground/resolve/require-pkg-with-esm-entries/index.cjs deleted file mode 100644 index 55958fbdba26ee..00000000000000 --- a/packages/playground/resolve/require-pkg-with-esm-entries/index.cjs +++ /dev/null @@ -1,9 +0,0 @@ -const fromEvent = require('callbag-from-event') - -const msg = - // should be the exported function instead of the ES Module record (`{ default: ... }`) - typeof fromEvent === 'function' - ? '[success] require-pkg-with-esm-entries' - : '[failed] require-pkg-with-esm-entries' - -exports.msg = msg diff --git a/packages/playground/resolve/require-pkg-with-esm-entries/package.json b/packages/playground/resolve/require-pkg-with-esm-entries/package.json deleted file mode 100644 index b845364bb6f19a..00000000000000 --- a/packages/playground/resolve/require-pkg-with-esm-entries/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "require-pkg-with-esm-entries", - "private": true, - "version": "1.0.0", - "main": "./index.cjs", - "dependencies": { - "callbag-from-event": "1.3.0" - } -} diff --git a/packages/playground/resolve/require-pkg-with-browser-and-module-field/dep.cjs b/packages/playground/resolve/require-pkg-with-module-field/dep.cjs similarity index 100% rename from packages/playground/resolve/require-pkg-with-browser-and-module-field/dep.cjs rename to packages/playground/resolve/require-pkg-with-module-field/dep.cjs diff --git a/packages/playground/resolve/require-pkg-with-module-field/index.cjs b/packages/playground/resolve/require-pkg-with-module-field/index.cjs new file mode 100644 index 00000000000000..da215f306d1ac1 --- /dev/null +++ b/packages/playground/resolve/require-pkg-with-module-field/index.cjs @@ -0,0 +1,8 @@ +const dep = require('./dep.cjs') + +const msg = + dep === '1.111222233334444555566e+21' + ? '[success] require-pkg-with-module-field' + : '[failed] require-pkg-with-module-field' + +exports.msg = msg diff --git a/packages/playground/resolve/require-pkg-with-browser-and-module-field/package.json b/packages/playground/resolve/require-pkg-with-module-field/package.json similarity index 68% rename from packages/playground/resolve/require-pkg-with-browser-and-module-field/package.json rename to packages/playground/resolve/require-pkg-with-module-field/package.json index 2a0419b331c407..e409343a7567d5 100644 --- a/packages/playground/resolve/require-pkg-with-browser-and-module-field/package.json +++ b/packages/playground/resolve/require-pkg-with-module-field/package.json @@ -1,5 +1,5 @@ { - "name": "require-pkg-with-browser-and-module-field", + "name": "require-pkg-with-module-field", "private": true, "version": "1.0.0", "main": "./index.cjs", diff --git a/packages/playground/resolve/vite.config.js b/packages/playground/resolve/vite.config.js index c1282f4ffc789d..0550d1ecf6f044 100644 --- a/packages/playground/resolve/vite.config.js +++ b/packages/playground/resolve/vite.config.js @@ -42,9 +42,6 @@ module.exports = { } ], optimizeDeps: { - include: [ - 'require-pkg-with-browser-and-module-field', - 'require-pkg-with-esm-entries' - ] + include: ['require-pkg-with-module-field'] } } diff --git a/packages/vite/src/node/constants.ts b/packages/vite/src/node/constants.ts index 1741bf2dd7a94b..9612cd8c96460d 100644 --- a/packages/vite/src/node/constants.ts +++ b/packages/vite/src/node/constants.ts @@ -6,21 +6,6 @@ export const DEFAULT_MAIN_FIELDS = [ 'jsnext' ] -/** - * A non-exhaustive list of known-to-be-ES-module entry names. - * From - */ -export const KNOWN_ESM_MAIN_FIELDS = [ - 'module', - 'jsnext:main', - 'jsnext', - 'esnext', - 'es2015', - 'es2020', - 'fesm2015', - 'fesm2020' -] - export const DEFAULT_EXTENSIONS = [ '.mjs', '.js', diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts index 10e2989af1114f..1b59503a9d43ed 100644 --- a/packages/vite/src/node/plugins/resolve.ts +++ b/packages/vite/src/node/plugins/resolve.ts @@ -7,7 +7,6 @@ import { SPECIAL_QUERY_RE, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, - KNOWN_ESM_MAIN_FIELDS, OPTIMIZABLE_ENTRY_RE, DEP_VERSION_RE } from '../constants' @@ -778,11 +777,6 @@ export function resolvePackageEntry( if (!entryPoint || entryPoint.endsWith('.mjs')) { for (const field of options.mainFields || DEFAULT_MAIN_FIELDS) { - // If the initiator is a `require` call, don't use the ESM entries - if (options.isRequire && KNOWN_ESM_MAIN_FIELDS.includes(field)) { - continue - } - if (typeof data[field] === 'string') { entryPoint = data[field] break diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fbc05e51fbfc7a..09d96eb30938d7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -461,8 +461,7 @@ importers: '@babel/runtime': ^7.16.0 es5-ext: 0.10.53 normalize.css: ^8.0.1 - require-pkg-with-browser-and-module-field: link:./require-pkg-with-browser-and-module-field - require-pkg-with-esm-entries: link:./require-pkg-with-esm-entries + require-pkg-with-module-field: link:./require-pkg-with-module-field resolve-browser-field: link:./browser-field resolve-custom-condition: link:./custom-condition resolve-custom-main-field: link:./custom-main-field @@ -473,8 +472,7 @@ importers: '@babel/runtime': 7.16.5 es5-ext: 0.10.53 normalize.css: 8.0.1 - require-pkg-with-browser-and-module-field: link:require-pkg-with-browser-and-module-field - require-pkg-with-esm-entries: link:require-pkg-with-esm-entries + require-pkg-with-module-field: link:require-pkg-with-module-field resolve-browser-field: link:browser-field resolve-custom-condition: link:custom-condition resolve-custom-main-field: link:custom-main-field @@ -506,18 +504,12 @@ importers: packages/playground/resolve/inline-package: specifiers: {} - packages/playground/resolve/require-pkg-with-browser-and-module-field: + packages/playground/resolve/require-pkg-with-module-field: specifiers: bignumber.js: 9.0.2 dependencies: bignumber.js: 9.0.2 - packages/playground/resolve/require-pkg-with-esm-entries: - specifiers: - callbag-from-event: 1.3.0 - dependencies: - callbag-from-event: 1.3.0 - packages/playground/ssr-deps: specifiers: bcrypt: ^5.0.1 @@ -3497,16 +3489,6 @@ packages: get-intrinsic: 1.1.1 dev: true - /callbag-from-event/1.3.0: - resolution: {integrity: sha512-cAu82hKKFmMtKTmd50p/nlMfs1oKz+PGUZmmwhbzPbw4YtjNgTKg6pXjpcQprhBQdrqg/v8pHcAS8Qs6X7r8fw==} - dependencies: - callbag: 1.5.0 - dev: false - - /callbag/1.5.0: - resolution: {integrity: sha512-PH3id0HEb/cNS+BehYlF4Z5wzjKAIUao6ab2hWtMs2bi6aW+0PXl0jymqwnFyT2cQO2h30ggUgpQlmzOpAIKNg==} - dev: false - /callsites/3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} From 5d96dcab9ce207c9fc7f37116b00d45b678fc87c Mon Sep 17 00:00:00 2001 From: patak-dev Date: Thu, 14 Apr 2022 16:43:29 +0200 Subject: [PATCH 0556/1287] release: v2.9.5 --- packages/vite/CHANGELOG.md | 7 +++++++ packages/vite/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 8ed8c8cf8ba692..084a6363109266 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2.9.5 (2022-04-14) + +* fix: revert #7582, fix #7721 and #7736 (#7737) ([fa86d69](https://github.com/vitejs/vite/commit/fa86d69)), closes [#7721](https://github.com/vitejs/vite/issues/7721) [#7736](https://github.com/vitejs/vite/issues/7736) [#7737](https://github.com/vitejs/vite/issues/7737) +* chore: format css minify esbuild error (#7731) ([c445075](https://github.com/vitejs/vite/commit/c445075)), closes [#7731](https://github.com/vitejs/vite/issues/7731) + + + ## 2.9.4 (2022-04-13) * fix: handle url imports with semicolon (fix #7717) (#7718) ([a5c2a78](https://github.com/vitejs/vite/commit/a5c2a78)), closes [#7717](https://github.com/vitejs/vite/issues/7717) [#7718](https://github.com/vitejs/vite/issues/7718) diff --git a/packages/vite/package.json b/packages/vite/package.json index 1ab75ada9c7cd3..e575c5b4f6c907 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.9.4", + "version": "2.9.5", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From 434bb5c05bce8a376bde50100a1466072d5e3624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Fri, 15 Apr 2022 03:47:53 +0900 Subject: [PATCH 0557/1287] docs: mention `process.env` for config env vars (#7744) --- docs/config/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/config/index.md b/docs/config/index.md index d7560e58736a43..346de1a78f7dc9 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -101,7 +101,9 @@ export default defineConfig(async ({ command, mode }) => { ### Environment Variables -Vite doesn't load `.env` files by default as the files to load can only be determined after evaluating the Vite config, for example, the `root` and `envDir` options affects the loading behaviour. However, you can use the exported `loadEnv` helper to load the specific `.env` file if needed. +Environmental Variables can be obtained from `process.env` as usual. + +Note that Vite doesn't load `.env` files by default as the files to load can only be determined after evaluating the Vite config, for example, the `root` and `envDir` options affects the loading behaviour. However, you can use the exported `loadEnv` helper to load the specific `.env` file if needed. ```js import { defineConfig, loadEnv } from 'vite' From 1f2ca536101d54649c6abc34e9665c2163878b56 Mon Sep 17 00:00:00 2001 From: Rom Date: Fri, 15 Apr 2022 07:45:26 +0200 Subject: [PATCH 0558/1287] fix: `apply` condition skipped for nested plugins (#7741) --- packages/vite/src/node/config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index f633d1158bfa95..a30d84465e9990 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -63,7 +63,7 @@ export function defineConfig(config: UserConfigExport): UserConfigExport { return config } -export type PluginOption = Plugin | false | null | undefined +export type PluginOption = Plugin | false | null | undefined | PluginOption[] export interface UserConfig { /** @@ -109,7 +109,7 @@ export interface UserConfig { /** * Array of vite plugins to use. */ - plugins?: (PluginOption | PluginOption[])[] + plugins?: PluginOption[] /** * Configure resolver */ @@ -199,7 +199,7 @@ export interface UserConfig { /** * Vite plugins that apply to worker bundle */ - plugins?: (PluginOption | PluginOption[])[] + plugins?: PluginOption[] /** * Rollup options to build worker bundle */ @@ -322,7 +322,7 @@ export async function resolveConfig( configEnv.mode = mode // resolve plugins - const rawUserPlugins = (config.plugins || []).flat().filter((p) => { + const rawUserPlugins = (config.plugins || []).flat(Infinity).filter((p) => { if (!p) { return false } else if (!p.apply) { From b89974a127c7a986d309db675d95287a9ae75386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Sat, 16 Apr 2022 04:20:36 +0900 Subject: [PATCH 0559/1287] fix(ssr): rewrite dynamic class method name (fix #7751) (#7757) --- .../node/ssr/__tests__/ssrTransform.spec.ts | 39 +++++++++++++++++++ packages/vite/src/node/ssr/ssrTransform.ts | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts index a5f915edea97fd..14481f98a4a87a 100644 --- a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts +++ b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts @@ -545,6 +545,45 @@ class A { `) }) +test('class methods', async () => { + expect( + ( + await ssrTransform( + ` +import foo from 'foo' + +const bar = 'bar' + +class A { + foo() {} + [foo]() {} + [bar]() {} + #foo() {} + bar(foo) {} +} +`, + null, + null + ) + ).code + ).toMatchInlineSnapshot(` + " + const __vite_ssr_import_0__ = await __vite_ssr_import__(\\"foo\\"); + + + const bar = 'bar' + + class A { + foo() {} + [__vite_ssr_import_0__.default]() {} + [bar]() {} + #foo() {} + bar(foo) {} + } + " + `) +}) + test('declare scope', async () => { expect( ( diff --git a/packages/vite/src/node/ssr/ssrTransform.ts b/packages/vite/src/node/ssr/ssrTransform.ts index 79ccd25f9ca8ff..238482a0ceac2f 100644 --- a/packages/vite/src/node/ssr/ssrTransform.ts +++ b/packages/vite/src/node/ssr/ssrTransform.ts @@ -429,7 +429,7 @@ function isRefIdentifier(id: Identifier, parent: _Node, parentStack: _Node[]) { } // class method name - if (parent.type === 'MethodDefinition') { + if (parent.type === 'MethodDefinition' && !parent.computed) { return false } From 12a4e7d8bbf06d35d6fcc0135dcb76fd06a57c22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Sat, 16 Apr 2022 17:32:13 +0900 Subject: [PATCH 0560/1287] refactor(legacy): remove unneeded dynamic import var init code (#7759) --- packages/plugin-legacy/README.md | 1 - packages/plugin-legacy/index.js | 8 -------- 2 files changed, 9 deletions(-) diff --git a/packages/plugin-legacy/README.md b/packages/plugin-legacy/README.md index 36da971c6a17c2..3c9fe67e107f7f 100644 --- a/packages/plugin-legacy/README.md +++ b/packages/plugin-legacy/README.md @@ -163,7 +163,6 @@ The legacy plugin requires inline scripts for [Safari 10.1 `nomodule` fix](https - `sha256-MS6/3FCg4WjP9gwgaBGwLpRCY6fZBgwmhVCdrPrNf3E=` - `sha256-tQjf8gvb2ROOMapIxFvFAYBeUJ0v1HCbOcSmDNXGtDo=` -- `sha256-xYj09txJ9OsgySe5ommpqul6FiaJZRrwe3KTD7wbV6w=` - `sha256-4m6wOIrq/wFDmi9Xh3mFM2mwI4ik9n3TMgHk6xDtLxk=` - `sha256-uS7/g9fhQwNZS1f/MqYqqKv8y9hCu36IfX9XZB5L7YY=` diff --git a/packages/plugin-legacy/index.js b/packages/plugin-legacy/index.js index 41f7157ebfc533..2f1b1991c31c31 100644 --- a/packages/plugin-legacy/index.js +++ b/packages/plugin-legacy/index.js @@ -20,7 +20,6 @@ const legacyEntryId = 'vite-legacy-entry' const systemJSInlineCode = `System.import(document.getElementById('${legacyEntryId}').getAttribute('data-src'))` const detectDynamicImportVarName = '__vite_is_dynamic_import_support' -const detectDynamicImportVarInitCode = `var ${detectDynamicImportVarName}=false;` const detectDynamicImportCode = `try{import("_").catch(()=>1);}catch(e){}window.${detectDynamicImportVarName}=true;` const dynamicFallbackInlineCode = `!function(){if(window.${detectDynamicImportVarName})return;console.warn("vite: loading legacy build because dynamic import is unsupported, syntax error above should be ignored");var e=document.getElementById("${legacyPolyfillId}"),n=document.createElement("script");n.src=e.src,n.onload=function(){${systemJSInlineCode}},document.body.appendChild(n)}();` @@ -437,12 +436,6 @@ function viteLegacyPlugin(options = {}) { // 5. inject dynamic import fallback entry if (genDynamicFallback && legacyPolyfillFilename && legacyEntryFilename) { - tags.push({ - tag: 'script', - attrs: { type: 'module' }, - children: detectDynamicImportVarInitCode, - injectTo: 'head' - }) tags.push({ tag: 'script', attrs: { type: 'module' }, @@ -714,7 +707,6 @@ viteLegacyPlugin.default = viteLegacyPlugin viteLegacyPlugin.cspHashes = [ createHash('sha256').update(safari10NoModuleFix).digest('base64'), createHash('sha256').update(systemJSInlineCode).digest('base64'), - createHash('sha256').update(detectDynamicImportVarInitCode).digest('base64'), createHash('sha256').update(detectDynamicImportCode).digest('base64'), createHash('sha256').update(dynamicFallbackInlineCode).digest('base64') ] From 9a932339aae8bfbb9f3b522706c551a21a1eea3a Mon Sep 17 00:00:00 2001 From: Hydrogen <3038094028@qq.com> Date: Sat, 16 Apr 2022 20:05:49 +0800 Subject: [PATCH 0561/1287] fix(create-vite): bump `vue-tsc` to `0.34.7` (#7760) --- packages/create-vite/template-vue-ts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-vite/template-vue-ts/package.json b/packages/create-vite/template-vue-ts/package.json index 2ad29ac0b91725..a3af0acf1ef7ab 100644 --- a/packages/create-vite/template-vue-ts/package.json +++ b/packages/create-vite/template-vue-ts/package.json @@ -14,6 +14,6 @@ "@vitejs/plugin-vue": "^2.3.1", "typescript": "^4.5.4", "vite": "^2.9.2", - "vue-tsc": "^0.29.8" + "vue-tsc": "^0.34.7" } } From 694c1ce765b80458197e039ce720bb9ce1076667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Mon, 18 Apr 2022 00:28:25 +0900 Subject: [PATCH 0562/1287] test: fix use terser for preload test (#7771) --- packages/playground/preload/vite.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/playground/preload/vite.config.js b/packages/playground/preload/vite.config.js index 96fb82f51ed349..90684f41829953 100644 --- a/packages/playground/preload/vite.config.js +++ b/packages/playground/preload/vite.config.js @@ -3,6 +3,7 @@ const vuePlugin = require('@vitejs/plugin-vue') module.exports = { plugins: [vuePlugin()], build: { + minify: 'terser', terserOptions: { format: { beautify: true From af8ca602031daa99692fc2e29f9d6330409e4bc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E6=A0=91=40=E9=98=BF=E9=87=8C?= Date: Mon, 18 Apr 2022 11:39:25 +0800 Subject: [PATCH 0563/1287] feat: enable optimizeDeps.esbuildOptions.loader (#6840) Co-authored-by: bluwy --- packages/vite/src/node/optimizer/index.ts | 5 +++-- packages/vite/src/node/optimizer/scan.ts | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index 13c322610cf493..3828cb2fbce18b 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -417,11 +417,12 @@ export async function runOptimizeDeps( try { exportsData = parse(entryContent) as ExportsData } catch { + const loader = esbuildOptions.loader?.[path.extname(filePath)] || 'jsx' debug( - `Unable to parse dependency: ${id}. Trying again with a JSX transform.` + `Unable to parse dependency: ${id}. Trying again with a ${loader} transform.` ) const transformed = await transformWithEsbuild(entryContent, filePath, { - loader: 'jsx' + loader }) // Ensure that optimization won't fail by defaulting '.js' to the JSX parser. // This is useful for packages such as Gatsby. diff --git a/packages/vite/src/node/optimizer/scan.ts b/packages/vite/src/node/optimizer/scan.ts index e940617386eb35..ef59a35b1d22d3 100644 --- a/packages/vite/src/node/optimizer/scan.ts +++ b/packages/vite/src/node/optimizer/scan.ts @@ -463,21 +463,26 @@ function esbuildScanPlugin( contents = config.esbuild.jsxInject + `\n` + contents } + const loader = + config.optimizeDeps?.esbuildOptions?.loader?.[`.${ext}`] || + (ext as Loader) + if (contents.includes('import.meta.glob')) { return transformGlob( contents, id, config.root, - ext as Loader, + loader, resolve, config.logger ).then((contents) => ({ - loader: ext as Loader, + loader, contents })) } + return { - loader: ext as Loader, + loader, contents } }) From 54e9cdd9f913ba7b650bce6657b5ff666dd0b5a8 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Mon, 18 Apr 2022 13:25:14 +0800 Subject: [PATCH 0564/1287] fix(create-vite): set skipLibCheck true (#7726) --- packages/create-vite/template-lit-ts/tsconfig.json | 3 ++- packages/create-vite/template-preact-ts/tsconfig.json | 2 +- packages/create-vite/template-react-ts/tsconfig.json | 2 +- packages/create-vite/template-vanilla-ts/tsconfig.json | 3 ++- packages/create-vite/template-vue-ts/tsconfig.json | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/create-vite/template-lit-ts/tsconfig.json b/packages/create-vite/template-lit-ts/tsconfig.json index 2ec691c81c2b38..91a731fd8619d4 100644 --- a/packages/create-vite/template-lit-ts/tsconfig.json +++ b/packages/create-vite/template-lit-ts/tsconfig.json @@ -15,7 +15,8 @@ "allowSyntheticDefaultImports": true, "experimentalDecorators": true, "forceConsistentCasingInFileNames": true, - "useDefineForClassFields": false + "useDefineForClassFields": false, + "skipLibCheck": true }, "include": ["src/**/*.ts"], "references": [{ "path": "./tsconfig.node.json" }] diff --git a/packages/create-vite/template-preact-ts/tsconfig.json b/packages/create-vite/template-preact-ts/tsconfig.json index fda60ae884247a..0a24dec18dd4f8 100644 --- a/packages/create-vite/template-preact-ts/tsconfig.json +++ b/packages/create-vite/template-preact-ts/tsconfig.json @@ -4,7 +4,7 @@ "useDefineForClassFields": true, "lib": ["DOM", "DOM.Iterable", "ESNext"], "allowJs": false, - "skipLibCheck": false, + "skipLibCheck": true, "esModuleInterop": false, "allowSyntheticDefaultImports": true, "strict": true, diff --git a/packages/create-vite/template-react-ts/tsconfig.json b/packages/create-vite/template-react-ts/tsconfig.json index c8bdc64082aa26..3d0a51a86e2024 100644 --- a/packages/create-vite/template-react-ts/tsconfig.json +++ b/packages/create-vite/template-react-ts/tsconfig.json @@ -4,7 +4,7 @@ "useDefineForClassFields": true, "lib": ["DOM", "DOM.Iterable", "ESNext"], "allowJs": false, - "skipLibCheck": false, + "skipLibCheck": true, "esModuleInterop": false, "allowSyntheticDefaultImports": true, "strict": true, diff --git a/packages/create-vite/template-vanilla-ts/tsconfig.json b/packages/create-vite/template-vanilla-ts/tsconfig.json index 05f80b91398b98..fbd022532d3096 100644 --- a/packages/create-vite/template-vanilla-ts/tsconfig.json +++ b/packages/create-vite/template-vanilla-ts/tsconfig.json @@ -13,7 +13,8 @@ "noEmit": true, "noUnusedLocals": true, "noUnusedParameters": true, - "noImplicitReturns": true + "noImplicitReturns": true, + "skipLibCheck": true }, "include": ["src"] } diff --git a/packages/create-vite/template-vue-ts/tsconfig.json b/packages/create-vite/template-vue-ts/tsconfig.json index 52205ea0029c99..bcc4abda4c57f0 100644 --- a/packages/create-vite/template-vue-ts/tsconfig.json +++ b/packages/create-vite/template-vue-ts/tsconfig.json @@ -10,7 +10,8 @@ "resolveJsonModule": true, "isolatedModules": true, "esModuleInterop": true, - "lib": ["esnext", "dom"] + "lib": ["esnext", "dom"], + "skipLibCheck": true }, "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], "references": [{ "path": "./tsconfig.node.json" }] From 788d2ec1dc9853be4ecdef67d1a458a2b46ec9bf Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Mon, 18 Apr 2022 17:07:37 +0800 Subject: [PATCH 0565/1287] docs: explain skipLibCheck (#7785) --- docs/guide/features.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/guide/features.md b/docs/guide/features.md index ebed85cd2d529d..06d282ae94ecd7 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -53,6 +53,8 @@ It is because `esbuild` only performs transpilation without type information, it You must set `"isolatedModules": true` in your `tsconfig.json` under `compilerOptions`, so that TS will warn you against the features that do not work with isolated transpilation. +However, some libraries (e.g. [`vue`](https://github.com/vuejs/core/issues/1228)) don't work well with `"isolatedModules": true`. You can use `"skipLibCheck": true` to temporarily suppress the errors until it is fixed upstream. + #### `useDefineForClassFields` Starting from Vite 2.5.0, the default value will be `true` if the TypeScript target is `ESNext`. It is consistent with the [behavior of `tsc` 4.3.2 and later](https://github.com/microsoft/TypeScript/pull/42663). It is also the standard ECMAScript runtime behavior. From 6198911faeee3b915fc0d4ff24fbb918f3e1d558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Tue, 19 Apr 2022 06:30:13 +0900 Subject: [PATCH 0566/1287] docs: import.meta.url is replaced even if ESM (#7794) --- docs/config/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/config/index.md b/docs/config/index.md index 346de1a78f7dc9..4f1b3efbd16198 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -28,7 +28,7 @@ vite --config my-config.js ``` ::: tip NOTE -Vite will replace `__filename`, `__dirname`, and `import.meta.url` in **CommonJS** and **TypeScript** config files. Using these as variable names will result in an error: +Vite will replace `__filename`, `__dirname`, and `import.meta.url` in config files and its deps. Using these as variable names will result in an error: ```js const __filename = "value" From 12d119434038f75d2017ce0e543b72416f2745f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Tue, 19 Apr 2022 06:31:38 +0900 Subject: [PATCH 0567/1287] fix: replace import.meta.url correctly (#7792) --- packages/vite/src/node/config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index a30d84465e9990..556fcf7cbae77a 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -31,7 +31,7 @@ import { createLogger } from './logger' import type { DepOptimizationOptions } from './optimizer' import { createFilter } from '@rollup/pluginutils' import type { ResolvedBuildOptions } from '.' -import { parse as parseUrl } from 'url' +import { parse as parseUrl, pathToFileURL } from 'url' import type { JsonOptions } from './plugins/json' import type { PluginContainer } from './server/pluginContainer' import { createPluginContainer } from './server/pluginContainer' @@ -1008,7 +1008,7 @@ async function bundleConfigFile( contents: contents .replace( /\bimport\.meta\.url\b/g, - JSON.stringify(`file://${args.path}`) + JSON.stringify(pathToFileURL(args.path).href) ) .replace( /\b__dirname\b/g, From a7fd41660b06d258687a54fe73fef118bd73e1ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Tue, 19 Apr 2022 06:32:24 +0900 Subject: [PATCH 0568/1287] docs: add link to "Using Plugins" from Plugins section (#7793) --- docs/plugins/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/plugins/index.md b/docs/plugins/index.md index 6d81a060cf8883..0a8803ba2d3b9a 100644 --- a/docs/plugins/index.md +++ b/docs/plugins/index.md @@ -4,6 +4,8 @@ Vite aims to provide out-of-the-box support for common web development patterns. Before searching for a Vite or Compatible Rollup plugin, check out the [Features Guide](../guide/features.md). A lot of the cases where a plugin would be needed in a Rollup project are already covered in Vite. ::: +Check out [Using Plugins](../guide/using-plugins) for information on how to use plugins. + ## Official Plugins ### [@vitejs/plugin-vue](https://github.com/vitejs/vite/tree/main/packages/plugin-vue) From e5729bee1e3f0753dc3514757fa15e5533c387fe Mon Sep 17 00:00:00 2001 From: zoomdong <1344492820@qq.com> Date: Tue, 19 Apr 2022 05:35:36 +0800 Subject: [PATCH 0569/1287] chore: remove useless code in preact template (#7789) --- packages/create-vite/template-preact/src/app.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-vite/template-preact/src/app.jsx b/packages/create-vite/template-preact/src/app.jsx index 9d649444f686d9..64fe3eda94c933 100644 --- a/packages/create-vite/template-preact/src/app.jsx +++ b/packages/create-vite/template-preact/src/app.jsx @@ -1,6 +1,6 @@ import { Logo } from './logo' -export function App(props) { +export function App() { return ( <> From 474d5c257b2404b08fabbc8740532a26badfc348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= <2pi_r2@gmx.de> Date: Tue, 19 Apr 2022 10:01:12 +0200 Subject: [PATCH 0570/1287] fix: new SharedWorker syntax (#7800) --- packages/vite/src/node/plugins/workerImportMetaUrl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/plugins/workerImportMetaUrl.ts b/packages/vite/src/node/plugins/workerImportMetaUrl.ts index c8ab20fe21694c..3d8970b746349c 100644 --- a/packages/vite/src/node/plugins/workerImportMetaUrl.ts +++ b/packages/vite/src/node/plugins/workerImportMetaUrl.ts @@ -106,7 +106,7 @@ export function workerImportMetaUrlPlugin(config: ResolvedConfig): Plugin { } let s: MagicString | undefined if ( - (code.includes('new Worker') || code.includes('new ShareWorker')) && + (code.includes('new Worker') || code.includes('new SharedWorker')) && code.includes('new URL') && code.includes(`import.meta.url`) ) { From 5f7fe004f03662e2f586791fe6c9199aa0a8c8fe Mon Sep 17 00:00:00 2001 From: zoomdong <1344492820@qq.com> Date: Tue, 19 Apr 2022 16:08:42 +0800 Subject: [PATCH 0571/1287] chore: code structure (#7790) --- packages/vite/src/node/server/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index bf13ba683a9b93..99aefea6de292a 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -300,8 +300,7 @@ export async function createServer( inlineConfig: InlineConfig = {} ): Promise { const config = await resolveConfig(inlineConfig, 'serve', 'development') - const root = config.root - const serverConfig = config.server + const { root, server: serverConfig } = config const httpsOptions = await resolveHttpsConfig( config.server.https, config.cacheDir From 7f96b2633309d5f02b6f44d7350baad8b7522be7 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Tue, 19 Apr 2022 10:23:47 +0200 Subject: [PATCH 0572/1287] release: create-vite@2.9.2 --- packages/create-vite/CHANGELOG.md | 8 ++++++++ packages/create-vite/package.json | 2 +- packages/create-vite/template-lit-ts/package.json | 2 +- packages/create-vite/template-lit/package.json | 2 +- packages/create-vite/template-preact-ts/package.json | 2 +- packages/create-vite/template-preact/package.json | 2 +- packages/create-vite/template-react-ts/package.json | 2 +- packages/create-vite/template-react/package.json | 2 +- packages/create-vite/template-svelte-ts/package.json | 2 +- packages/create-vite/template-svelte/package.json | 2 +- packages/create-vite/template-vanilla-ts/package.json | 2 +- packages/create-vite/template-vanilla/package.json | 2 +- packages/create-vite/template-vue-ts/package.json | 2 +- packages/create-vite/template-vue/package.json | 2 +- 14 files changed, 21 insertions(+), 13 deletions(-) diff --git a/packages/create-vite/CHANGELOG.md b/packages/create-vite/CHANGELOG.md index cac7f2664ecaed..7379feb81239b8 100644 --- a/packages/create-vite/CHANGELOG.md +++ b/packages/create-vite/CHANGELOG.md @@ -1,3 +1,11 @@ +## 2.9.2 (2022-04-19) + +* chore: remove useless code in preact template (#7789) ([e5729be](https://github.com/vitejs/vite/commit/e5729be)), closes [#7789](https://github.com/vitejs/vite/issues/7789) +* fix(create-vite): bump `vue-tsc` to `0.34.7` (#7760) ([9a93233](https://github.com/vitejs/vite/commit/9a93233)), closes [#7760](https://github.com/vitejs/vite/issues/7760) +* fix(create-vite): set skipLibCheck true (#7726) ([54e9cdd](https://github.com/vitejs/vite/commit/54e9cdd)), closes [#7726](https://github.com/vitejs/vite/issues/7726) + + + ## 2.9.1 (2022-04-13) * chore: fix term cases (#7553) ([c296130](https://github.com/vitejs/vite/commit/c296130)), closes [#7553](https://github.com/vitejs/vite/issues/7553) diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json index dcaf3962c987cf..5a21b499d9b75d 100644 --- a/packages/create-vite/package.json +++ b/packages/create-vite/package.json @@ -1,6 +1,6 @@ { "name": "create-vite", - "version": "2.9.1", + "version": "2.9.2", "license": "MIT", "author": "Evan You", "bin": { diff --git a/packages/create-vite/template-lit-ts/package.json b/packages/create-vite/template-lit-ts/package.json index 6a928d05bb9e84..eb6849d447795c 100644 --- a/packages/create-vite/template-lit-ts/package.json +++ b/packages/create-vite/template-lit-ts/package.json @@ -19,7 +19,7 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.9.2", + "vite": "^2.9.5", "typescript": "^4.5.4" } } diff --git a/packages/create-vite/template-lit/package.json b/packages/create-vite/template-lit/package.json index 7889bec19759ff..6fc110706147f7 100644 --- a/packages/create-vite/template-lit/package.json +++ b/packages/create-vite/template-lit/package.json @@ -17,6 +17,6 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.9.2" + "vite": "^2.9.5" } } diff --git a/packages/create-vite/template-preact-ts/package.json b/packages/create-vite/template-preact-ts/package.json index aaf8aea0372e52..ac90637925896f 100644 --- a/packages/create-vite/template-preact-ts/package.json +++ b/packages/create-vite/template-preact-ts/package.json @@ -13,6 +13,6 @@ "devDependencies": { "@preact/preset-vite": "^2.1.5", "typescript": "^4.5.4", - "vite": "^2.9.2" + "vite": "^2.9.5" } } diff --git a/packages/create-vite/template-preact/package.json b/packages/create-vite/template-preact/package.json index 19198fc9e66d67..f58b6525abaa52 100644 --- a/packages/create-vite/template-preact/package.json +++ b/packages/create-vite/template-preact/package.json @@ -12,6 +12,6 @@ }, "devDependencies": { "@preact/preset-vite": "^2.1.5", - "vite": "^2.9.2" + "vite": "^2.9.5" } } diff --git a/packages/create-vite/template-react-ts/package.json b/packages/create-vite/template-react-ts/package.json index ea89f3a68d8c45..01d981f51c3414 100644 --- a/packages/create-vite/template-react-ts/package.json +++ b/packages/create-vite/template-react-ts/package.json @@ -16,6 +16,6 @@ "@types/react-dom": "^18.0.0", "@vitejs/plugin-react": "^1.3.0", "typescript": "^4.6.3", - "vite": "^2.9.2" + "vite": "^2.9.5" } } diff --git a/packages/create-vite/template-react/package.json b/packages/create-vite/template-react/package.json index f81b751dc8f30c..4215fdea104c30 100644 --- a/packages/create-vite/template-react/package.json +++ b/packages/create-vite/template-react/package.json @@ -15,6 +15,6 @@ "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@vitejs/plugin-react": "^1.3.0", - "vite": "^2.9.2" + "vite": "^2.9.5" } } diff --git a/packages/create-vite/template-svelte-ts/package.json b/packages/create-vite/template-svelte-ts/package.json index bed1e3caedeef0..ae5bf6219d8eee 100644 --- a/packages/create-vite/template-svelte-ts/package.json +++ b/packages/create-vite/template-svelte-ts/package.json @@ -17,6 +17,6 @@ "svelte-preprocess": "^4.9.8", "tslib": "^2.3.1", "typescript": "^4.5.4", - "vite": "^2.9.2" + "vite": "^2.9.5" } } diff --git a/packages/create-vite/template-svelte/package.json b/packages/create-vite/template-svelte/package.json index 661a174421d156..ac224a274d1c10 100644 --- a/packages/create-vite/template-svelte/package.json +++ b/packages/create-vite/template-svelte/package.json @@ -11,6 +11,6 @@ "devDependencies": { "@sveltejs/vite-plugin-svelte": "^1.0.0-next.30", "svelte": "^3.44.0", - "vite": "^2.9.2" + "vite": "^2.9.5" } } diff --git a/packages/create-vite/template-vanilla-ts/package.json b/packages/create-vite/template-vanilla-ts/package.json index adedc3d4e83a65..94a8ccc952012a 100644 --- a/packages/create-vite/template-vanilla-ts/package.json +++ b/packages/create-vite/template-vanilla-ts/package.json @@ -9,6 +9,6 @@ }, "devDependencies": { "typescript": "^4.5.4", - "vite": "^2.9.2" + "vite": "^2.9.5" } } diff --git a/packages/create-vite/template-vanilla/package.json b/packages/create-vite/template-vanilla/package.json index ee68e7cd13e903..ddc9844be1954f 100644 --- a/packages/create-vite/template-vanilla/package.json +++ b/packages/create-vite/template-vanilla/package.json @@ -8,6 +8,6 @@ "preview": "vite preview" }, "devDependencies": { - "vite": "^2.9.2" + "vite": "^2.9.5" } } diff --git a/packages/create-vite/template-vue-ts/package.json b/packages/create-vite/template-vue-ts/package.json index a3af0acf1ef7ab..c7383d48b09e3b 100644 --- a/packages/create-vite/template-vue-ts/package.json +++ b/packages/create-vite/template-vue-ts/package.json @@ -13,7 +13,7 @@ "devDependencies": { "@vitejs/plugin-vue": "^2.3.1", "typescript": "^4.5.4", - "vite": "^2.9.2", + "vite": "^2.9.5", "vue-tsc": "^0.34.7" } } diff --git a/packages/create-vite/template-vue/package.json b/packages/create-vite/template-vue/package.json index 531986717154ee..e7e9b681db608c 100644 --- a/packages/create-vite/template-vue/package.json +++ b/packages/create-vite/template-vue/package.json @@ -12,6 +12,6 @@ }, "devDependencies": { "@vitejs/plugin-vue": "^2.3.1", - "vite": "^2.9.2" + "vite": "^2.9.5" } } From 17f3be7056cc64c660503cdebdc67abd3990d0c2 Mon Sep 17 00:00:00 2001 From: yoho Date: Wed, 20 Apr 2022 00:38:00 +0800 Subject: [PATCH 0573/1287] chore: fix worker sourcemap output style (#7805) --- packages/vite/src/node/plugins/reporter.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/plugins/reporter.ts b/packages/vite/src/node/plugins/reporter.ts index 4e568a756fa0ea..08650a86e2c38c 100644 --- a/packages/vite/src/node/plugins/reporter.ts +++ b/packages/vite/src/node/plugins/reporter.ts @@ -184,10 +184,15 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin { } } else if (chunk.source) { const isCSS = chunk.fileName.endsWith('.css') + const isMap = chunk.fileName.endsWith('.js.map') printFileInfo( chunk.fileName, chunk.source, - isCSS ? WriteType.CSS : WriteType.ASSET, + isCSS + ? WriteType.CSS + : isMap + ? WriteType.SOURCE_MAP + : WriteType.ASSET, longest, isCSS ? await getCompressedSize(chunk.source) : undefined ) From eba9d05d7adbb5d4dd25f14b085b15eb3488dfe4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 19 Apr 2022 22:34:44 +0200 Subject: [PATCH 0574/1287] chore(deps): update all non-major dependencies (#7780) --- package.json | 18 +- packages/plugin-legacy/package.json | 2 +- packages/plugin-react/package.json | 2 +- packages/plugin-vue-jsx/package.json | 2 +- packages/plugin-vue/package.json | 4 +- packages/vite/package.json | 16 +- pnpm-lock.yaml | 468 ++++++++++++++++----------- 7 files changed, 301 insertions(+), 211 deletions(-) diff --git a/package.json b/package.json index de02e27949560c..a90c2c9a43b3fe 100644 --- a/package.json +++ b/package.json @@ -34,14 +34,14 @@ "ci-docs": "run-s build-vite build-plugin-vue build-docs" }, "devDependencies": { - "@microsoft/api-extractor": "^7.21.2", + "@microsoft/api-extractor": "^7.22.2", "@types/fs-extra": "^9.0.13", "@types/jest": "^27.4.1", - "@types/node": "^16.11.26", + "@types/node": "^16.11.27", "@types/prompts": "^2.0.14", "@types/semver": "^7.3.9", - "@typescript-eslint/eslint-plugin": "^5.18.0", - "@typescript-eslint/parser": "^5.18.0", + "@typescript-eslint/eslint-plugin": "^5.20.0", + "@typescript-eslint/parser": "^5.20.0", "conventional-changelog-cli": "^2.2.2", "cross-env": "^7.0.3", "esbuild": "^0.14.27", @@ -49,19 +49,19 @@ "eslint-define-config": "^1.3.0", "eslint-plugin-node": "^11.1.0", "execa": "^5.1.1", - "fs-extra": "^10.0.1", + "fs-extra": "^10.1.0", "jest": "^27.5.1", - "lint-staged": "^12.3.7", + "lint-staged": "^12.3.8", "minimist": "^1.2.6", "node-fetch": "^2.6.6", "npm-run-all": "^4.1.5", "picocolors": "^1.0.0", - "playwright-chromium": "^1.20.2", + "playwright-chromium": "^1.21.1", "prettier": "2.6.2", "prompts": "^2.4.2", "rimraf": "^3.0.2", "rollup": "^2.59.0", - "semver": "^7.3.6", + "semver": "^7.3.7", "simple-git-hooks": "^2.7.0", "sirv": "^2.0.2", "ts-jest": "^27.1.4", @@ -85,7 +85,7 @@ "eslint --ext .ts" ] }, - "packageManager": "pnpm@6.32.6", + "packageManager": "pnpm@6.32.9", "pnpm": { "overrides": { "vite": "workspace:*", diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index 4c6783abc04bc8..3734390a3cdf25 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -23,7 +23,7 @@ "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme", "dependencies": { "@babel/standalone": "^7.17.9", - "core-js": "^3.21.1", + "core-js": "^3.22.0", "magic-string": "^0.26.1", "regenerator-runtime": "^0.13.9", "systemjs": "^6.12.1" diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 6608eef784fa22..8c93db98aac027 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -38,7 +38,7 @@ "@babel/plugin-transform-react-jsx-development": "^7.16.7", "@babel/plugin-transform-react-jsx-self": "^7.16.7", "@babel/plugin-transform-react-jsx-source": "^7.16.7", - "@rollup/pluginutils": "^4.2.0", + "@rollup/pluginutils": "^4.2.1", "react-refresh": "^0.12.0", "resolve": "^1.22.0" } diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 151d0a71ce648c..487d207a0df24d 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -25,7 +25,7 @@ "@babel/core": "^7.17.9", "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-transform-typescript": "^7.16.8", - "@rollup/pluginutils": "^4.2.0", + "@rollup/pluginutils": "^4.2.1", "@vue/babel-plugin-jsx": "^1.1.1", "hash-sum": "^2.0.0" } diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 39b3bc87a8b1df..9f401ac7fa86b1 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -35,13 +35,13 @@ "vue": "^3.2.25" }, "devDependencies": { - "@rollup/pluginutils": "^4.2.0", + "@rollup/pluginutils": "^4.2.1", "@types/hash-sum": "^1.0.0", "debug": "^4.3.4", "hash-sum": "^2.0.0", "rollup": "^2.59.0", "slash": "^4.0.0", "source-map": "^0.6.1", - "vue": "^3.2.31" + "vue": "^3.2.33" } } diff --git a/packages/vite/package.json b/packages/vite/package.json index e575c5b4f6c907..50f8487ad55895 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -57,12 +57,12 @@ "@babel/types": "^7.17.0", "@jridgewell/trace-mapping": "^0.3.4", "@rollup/plugin-alias": "^3.1.9", - "@rollup/plugin-commonjs": "^21.0.3", - "@rollup/plugin-dynamic-import-vars": "^1.4.2", + "@rollup/plugin-commonjs": "^21.1.0", + "@rollup/plugin-dynamic-import-vars": "^1.4.3", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "13.1.3", - "@rollup/plugin-typescript": "^8.3.1", - "@rollup/pluginutils": "^4.2.0", + "@rollup/plugin-node-resolve": "13.2.1", + "@rollup/plugin-typescript": "^8.3.2", + "@rollup/pluginutils": "^4.2.1", "@types/convert-source-map": "^1.5.2", "@types/cross-spawn": "^6.0.2", "@types/debug": "^4.1.7", @@ -71,12 +71,12 @@ "@types/less": "^3.0.3", "@types/micromatch": "^4.0.2", "@types/mime": "^2.0.3", - "@types/node": "^16.11.26", + "@types/node": "^16.11.27", "@types/resolve": "^1.20.1", "@types/sass": "~1.43.1", "@types/stylus": "^0.48.37", "@types/ws": "^8.5.3", - "@vue/compiler-dom": "^3.2.31", + "@vue/compiler-dom": "^3.2.33", "acorn": "^8.7.0", "cac": "6.7.9", "chokidar": "^3.5.3", @@ -107,7 +107,7 @@ "postcss-load-config": "^3.1.4", "postcss-modules": "^4.3.1", "resolve.exports": "^1.1.0", - "rollup-plugin-license": "^2.6.1", + "rollup-plugin-license": "^2.7.0", "sirv": "^2.0.2", "source-map-js": "^1.0.2", "source-map-support": "^0.5.21", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 09d96eb30938d7..235dd8c48a30ca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,14 +10,14 @@ importers: .: specifiers: - '@microsoft/api-extractor': ^7.21.2 + '@microsoft/api-extractor': ^7.22.2 '@types/fs-extra': ^9.0.13 '@types/jest': ^27.4.1 - '@types/node': ^16.11.26 + '@types/node': ^16.11.27 '@types/prompts': ^2.0.14 '@types/semver': ^7.3.9 - '@typescript-eslint/eslint-plugin': ^5.18.0 - '@typescript-eslint/parser': ^5.18.0 + '@typescript-eslint/eslint-plugin': ^5.20.0 + '@typescript-eslint/parser': ^5.20.0 conventional-changelog-cli: ^2.2.2 cross-env: ^7.0.3 esbuild: ^0.14.27 @@ -25,19 +25,19 @@ importers: eslint-define-config: ^1.3.0 eslint-plugin-node: ^11.1.0 execa: ^5.1.1 - fs-extra: ^10.0.1 + fs-extra: ^10.1.0 jest: ^27.5.1 - lint-staged: ^12.3.7 + lint-staged: ^12.3.8 minimist: ^1.2.6 node-fetch: ^2.6.6 npm-run-all: ^4.1.5 picocolors: ^1.0.0 - playwright-chromium: ^1.20.2 + playwright-chromium: ^1.21.1 prettier: 2.6.2 prompts: ^2.4.2 rimraf: ^3.0.2 rollup: ^2.59.0 - semver: ^7.3.6 + semver: ^7.3.7 simple-git-hooks: ^2.7.0 sirv: ^2.0.2 ts-jest: ^27.1.4 @@ -46,14 +46,14 @@ importers: vite: workspace:* vitepress: ^0.22.3 devDependencies: - '@microsoft/api-extractor': 7.21.2 + '@microsoft/api-extractor': 7.22.2 '@types/fs-extra': 9.0.13 '@types/jest': 27.4.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 '@types/prompts': 2.0.14 '@types/semver': 7.3.9 - '@typescript-eslint/eslint-plugin': 5.18.0_423061f51ca07e3dd1eb999a8074f5cd - '@typescript-eslint/parser': 5.18.0_eslint@8.13.0+typescript@4.5.4 + '@typescript-eslint/eslint-plugin': 5.20.0_0df7beb8e4d849cfe6bb8e844ccdebfd + '@typescript-eslint/parser': 5.20.0_eslint@8.13.0+typescript@4.5.4 conventional-changelog-cli: 2.2.2 cross-env: 7.0.3 esbuild: 0.14.27 @@ -61,23 +61,23 @@ importers: eslint-define-config: 1.3.0 eslint-plugin-node: 11.1.0_eslint@8.13.0 execa: 5.1.1 - fs-extra: 10.0.1 + fs-extra: 10.1.0 jest: 27.5.1_ts-node@10.4.0 - lint-staged: 12.3.7 + lint-staged: 12.3.8 minimist: 1.2.6 node-fetch: 2.6.6 npm-run-all: 4.1.5 picocolors: 1.0.0 - playwright-chromium: 1.20.2 + playwright-chromium: 1.21.1 prettier: 2.6.2 prompts: 2.4.2 rimraf: 3.0.2 rollup: 2.62.0 - semver: 7.3.6 + semver: 7.3.7 simple-git-hooks: 2.7.0 sirv: 2.0.2 ts-jest: 27.1.4_4dfe14e0e8266437469ae0475a5c09ac - ts-node: 10.4.0_44ef5af6cbbc24239b4e70b5c7b0d7a6 + ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 typescript: 4.5.4 vite: link:packages/vite vitepress: 0.22.3 @@ -744,13 +744,13 @@ importers: packages/plugin-legacy: specifiers: '@babel/standalone': ^7.17.9 - core-js: ^3.21.1 + core-js: ^3.22.0 magic-string: ^0.26.1 regenerator-runtime: ^0.13.9 systemjs: ^6.12.1 dependencies: '@babel/standalone': 7.17.9 - core-js: 3.21.1 + core-js: 3.22.0 magic-string: 0.26.1 regenerator-runtime: 0.13.9 systemjs: 6.12.1 @@ -762,7 +762,7 @@ importers: '@babel/plugin-transform-react-jsx-development': ^7.16.7 '@babel/plugin-transform-react-jsx-self': ^7.16.7 '@babel/plugin-transform-react-jsx-source': ^7.16.7 - '@rollup/pluginutils': ^4.2.0 + '@rollup/pluginutils': ^4.2.1 react-refresh: ^0.12.0 resolve: ^1.22.0 dependencies: @@ -771,43 +771,43 @@ importers: '@babel/plugin-transform-react-jsx-development': 7.16.7_@babel+core@7.17.9 '@babel/plugin-transform-react-jsx-self': 7.16.7_@babel+core@7.17.9 '@babel/plugin-transform-react-jsx-source': 7.16.7_@babel+core@7.17.9 - '@rollup/pluginutils': 4.2.0 + '@rollup/pluginutils': 4.2.1 react-refresh: 0.12.0 resolve: 1.22.0 packages/plugin-vue: specifiers: - '@rollup/pluginutils': ^4.2.0 + '@rollup/pluginutils': ^4.2.1 '@types/hash-sum': ^1.0.0 debug: ^4.3.4 hash-sum: ^2.0.0 rollup: ^2.59.0 slash: ^4.0.0 source-map: ^0.6.1 - vue: ^3.2.31 + vue: ^3.2.33 devDependencies: - '@rollup/pluginutils': 4.2.0 + '@rollup/pluginutils': 4.2.1 '@types/hash-sum': 1.0.0 debug: 4.3.4 hash-sum: 2.0.0 rollup: 2.62.0 slash: 4.0.0 source-map: 0.6.1 - vue: 3.2.31 + vue: 3.2.33 packages/plugin-vue-jsx: specifiers: '@babel/core': ^7.17.9 '@babel/plugin-syntax-import-meta': ^7.10.4 '@babel/plugin-transform-typescript': ^7.16.8 - '@rollup/pluginutils': ^4.2.0 + '@rollup/pluginutils': ^4.2.1 '@vue/babel-plugin-jsx': ^1.1.1 hash-sum: ^2.0.0 dependencies: '@babel/core': 7.17.9 '@babel/plugin-syntax-import-meta': 7.10.4_@babel+core@7.17.9 '@babel/plugin-transform-typescript': 7.16.8_@babel+core@7.17.9 - '@rollup/pluginutils': 4.2.0 + '@rollup/pluginutils': 4.2.1 '@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.17.9 hash-sum: 2.0.0 @@ -818,12 +818,12 @@ importers: '@babel/types': ^7.17.0 '@jridgewell/trace-mapping': ^0.3.4 '@rollup/plugin-alias': ^3.1.9 - '@rollup/plugin-commonjs': ^21.0.3 - '@rollup/plugin-dynamic-import-vars': ^1.4.2 + '@rollup/plugin-commonjs': ^21.1.0 + '@rollup/plugin-dynamic-import-vars': ^1.4.3 '@rollup/plugin-json': ^4.1.0 - '@rollup/plugin-node-resolve': 13.1.3 - '@rollup/plugin-typescript': ^8.3.1 - '@rollup/pluginutils': ^4.2.0 + '@rollup/plugin-node-resolve': 13.2.1 + '@rollup/plugin-typescript': ^8.3.2 + '@rollup/pluginutils': ^4.2.1 '@types/convert-source-map': ^1.5.2 '@types/cross-spawn': ^6.0.2 '@types/debug': ^4.1.7 @@ -832,12 +832,12 @@ importers: '@types/less': ^3.0.3 '@types/micromatch': ^4.0.2 '@types/mime': ^2.0.3 - '@types/node': ^16.11.26 + '@types/node': ^16.11.27 '@types/resolve': ^1.20.1 '@types/sass': ~1.43.1 '@types/stylus': ^0.48.37 '@types/ws': ^8.5.3 - '@vue/compiler-dom': ^3.2.31 + '@vue/compiler-dom': ^3.2.33 acorn: ^8.7.0 cac: 6.7.9 chokidar: ^3.5.3 @@ -873,7 +873,7 @@ importers: resolve: ^1.22.0 resolve.exports: ^1.1.0 rollup: ^2.59.0 - rollup-plugin-license: ^2.6.1 + rollup-plugin-license: ^2.7.0 sirv: ^2.0.2 source-map-js: ^1.0.2 source-map-support: ^0.5.21 @@ -896,12 +896,12 @@ importers: '@babel/types': 7.17.0 '@jridgewell/trace-mapping': 0.3.4 '@rollup/plugin-alias': 3.1.9_rollup@2.62.0 - '@rollup/plugin-commonjs': 21.0.3_rollup@2.62.0 - '@rollup/plugin-dynamic-import-vars': 1.4.2_rollup@2.62.0 + '@rollup/plugin-commonjs': 21.1.0_rollup@2.62.0 + '@rollup/plugin-dynamic-import-vars': 1.4.3_rollup@2.62.0 '@rollup/plugin-json': 4.1.0_rollup@2.62.0 - '@rollup/plugin-node-resolve': 13.1.3_rollup@2.62.0 - '@rollup/plugin-typescript': 8.3.1_7c5ff569c0887b4f0035eb7cb6988163 - '@rollup/pluginutils': 4.2.0 + '@rollup/plugin-node-resolve': 13.2.1_rollup@2.62.0 + '@rollup/plugin-typescript': 8.3.2_7c5ff569c0887b4f0035eb7cb6988163 + '@rollup/pluginutils': 4.2.1 '@types/convert-source-map': 1.5.2 '@types/cross-spawn': 6.0.2 '@types/debug': 4.1.7 @@ -910,12 +910,12 @@ importers: '@types/less': 3.0.3 '@types/micromatch': 4.0.2 '@types/mime': 2.0.3 - '@types/node': 16.11.26 + '@types/node': 16.11.27 '@types/resolve': 1.20.1 '@types/sass': 1.43.1 '@types/stylus': 0.48.37 '@types/ws': 8.5.3 - '@vue/compiler-dom': 3.2.31 + '@vue/compiler-dom': 3.2.33 acorn: 8.7.0 cac: 6.7.9 chokidar: 3.5.3 @@ -946,7 +946,7 @@ importers: postcss-load-config: 3.1.4_postcss@8.4.12+ts-node@10.4.0 postcss-modules: 4.3.1_postcss@8.4.12 resolve.exports: 1.1.0 - rollup-plugin-license: 2.6.1_rollup@2.62.0 + rollup-plugin-license: 2.7.0_rollup@2.62.0 sirv: 2.0.2 source-map-js: 1.0.2 source-map-support: 0.5.21 @@ -2012,7 +2012,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 chalk: 4.1.2 jest-message-util: 27.5.1 jest-util: 27.5.1 @@ -2033,7 +2033,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.8.1 @@ -2070,7 +2070,7 @@ packages: dependencies: '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 jest-mock: 27.5.1 dev: true @@ -2080,7 +2080,7 @@ packages: dependencies: '@jest/types': 27.5.1 '@sinonjs/fake-timers': 8.1.0 - '@types/node': 16.11.26 + '@types/node': 16.11.27 jest-message-util: 27.5.1 jest-mock: 27.5.1 jest-util: 27.5.1 @@ -2109,7 +2109,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 chalk: 4.1.2 collect-v8-coverage: 1.0.1 exit: 0.1.2 @@ -2178,7 +2178,7 @@ packages: jest-haste-map: 27.5.1 jest-regex-util: 27.5.1 jest-util: 27.5.1 - micromatch: 4.0.4 + micromatch: 4.0.5 pirates: 4.0.4 slash: 3.0.0 source-map: 0.6.1 @@ -2193,7 +2193,7 @@ packages: dependencies: '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 '@types/yargs': 16.0.4 chalk: 4.1.2 dev: true @@ -2228,43 +2228,43 @@ packages: - supports-color dev: false - /@microsoft/api-extractor-model/7.16.1: - resolution: {integrity: sha512-+1mlvy/ji+mUuH7WdVZ6fTo/aCKfS6m37aAFVOFWLfkMvmR+I9SjPfiv9qOg83If7GOrk2HPiHHibv6kA80VTg==} + /@microsoft/api-extractor-model/7.17.1: + resolution: {integrity: sha512-DCDtD8TdEpNk2lW4JvXgwwpxKy70P0JLad55iahwO8A+C63KYsrHIpAzo0FUauh5pwJ0v5QVNIJ+OBgKGteemg==} dependencies: - '@microsoft/tsdoc': 0.13.2 - '@microsoft/tsdoc-config': 0.15.2 - '@rushstack/node-core-library': 3.45.2 + '@microsoft/tsdoc': 0.14.1 + '@microsoft/tsdoc-config': 0.16.1 + '@rushstack/node-core-library': 3.45.3 dev: true - /@microsoft/api-extractor/7.21.2: - resolution: {integrity: sha512-m0+YPaXVou01O/V9swugZG7Gn4mw6HSWY+uisf0j2JPRZcoEDyoYe4hg0ERKXOEf0hByOnMLT28nQ82v8ig9Yw==} + /@microsoft/api-extractor/7.22.2: + resolution: {integrity: sha512-G7vXz6UHz+qoaUGPf2k5Md4bSpHii9nFys3sIe3bmFUbmhAe+HfSB/dCn1PsLhW7tZfEXwMHTj7fbL5vcZkrEw==} hasBin: true dependencies: - '@microsoft/api-extractor-model': 7.16.1 - '@microsoft/tsdoc': 0.13.2 - '@microsoft/tsdoc-config': 0.15.2 - '@rushstack/node-core-library': 3.45.2 - '@rushstack/rig-package': 0.3.9 - '@rushstack/ts-command-line': 4.10.8 + '@microsoft/api-extractor-model': 7.17.1 + '@microsoft/tsdoc': 0.14.1 + '@microsoft/tsdoc-config': 0.16.1 + '@rushstack/node-core-library': 3.45.3 + '@rushstack/rig-package': 0.3.10 + '@rushstack/ts-command-line': 4.10.9 colors: 1.2.5 lodash: 4.17.21 resolve: 1.17.0 - semver: 7.3.6 + semver: 7.3.7 source-map: 0.6.1 typescript: 4.5.4 dev: true - /@microsoft/tsdoc-config/0.15.2: - resolution: {integrity: sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA==} + /@microsoft/tsdoc-config/0.16.1: + resolution: {integrity: sha512-2RqkwiD4uN6MLnHFljqBlZIXlt/SaUT6cuogU1w2ARw4nKuuppSmR0+s+NC+7kXBQykd9zzu0P4HtBpZT5zBpQ==} dependencies: - '@microsoft/tsdoc': 0.13.2 + '@microsoft/tsdoc': 0.14.1 ajv: 6.12.6 jju: 1.4.0 resolve: 1.19.0 dev: true - /@microsoft/tsdoc/0.13.2: - resolution: {integrity: sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg==} + /@microsoft/tsdoc/0.14.1: + resolution: {integrity: sha512-6Wci+Tp3CgPt/B9B0a3J4s3yMgLNSku6w5TV6mN+61C71UqsRBv2FUibBf3tPGlNxebgPHMEUzKpb1ggE8KCKw==} dev: true /@mrbbot/node-fetch/4.6.0: @@ -2336,8 +2336,8 @@ packages: slash: 3.0.0 dev: true - /@rollup/plugin-commonjs/21.0.3_rollup@2.62.0: - resolution: {integrity: sha512-ThGfwyvcLc6cfP/MWxA5ACF+LZCvsuhUq7V5134Az1oQWsiC7lNpLT4mJI86WQunK7BYmpUiHmMk2Op6OAHs0g==} + /@rollup/plugin-commonjs/21.1.0_rollup@2.62.0: + resolution: {integrity: sha512-6ZtHx3VHIp2ReNNDxHjuUml6ur+WcQ28N1yHgCQwsbNkQg2suhxGMDQGJOn/KuDxKtd1xuZP5xSTwBA4GQ8hbA==} engines: {node: '>= 8.0.0'} peerDependencies: rollup: ^2.38.3 @@ -2352,13 +2352,13 @@ packages: rollup: 2.62.0 dev: true - /@rollup/plugin-dynamic-import-vars/1.4.2_rollup@2.62.0: - resolution: {integrity: sha512-SEaS9Pf0RyaZ/oJ1knLZT+Fu0X6DlyTfUcoE7XKkiKJjNaB+8SLoHmDVRhomo5RpWHPyd+B00G/bE5R5+Q+HEg==} + /@rollup/plugin-dynamic-import-vars/1.4.3_rollup@2.62.0: + resolution: {integrity: sha512-VYP9BBVI0pcYpLp/DkFT8YP+EmqmWFMmWXoTObDH6OouERxJyPsIj0tC3HxhjNBOKgcRc7eV75IQItzELt7QSg==} engines: {node: '>= 10.0.0'} peerDependencies: rollup: ^1.20.0||^2.0.0 dependencies: - '@rollup/pluginutils': 4.2.0 + '@rollup/pluginutils': 4.2.1 estree-walker: 2.0.2 fast-glob: 3.2.11 magic-string: 0.25.7 @@ -2374,8 +2374,8 @@ packages: rollup: 2.62.0 dev: true - /@rollup/plugin-node-resolve/13.1.3_rollup@2.62.0: - resolution: {integrity: sha512-BdxNk+LtmElRo5d06MGY4zoepyrXX1tkzX2hrnPEZ53k78GuOMWLqmJDGIIOPwVRIFZrLQOo+Yr6KtCuLIA0AQ==} + /@rollup/plugin-node-resolve/13.2.1_rollup@2.62.0: + resolution: {integrity: sha512-btX7kzGvp1JwShQI9V6IM841YKNPYjKCvUbNrQ2EcVYbULtUd/GH6wZ/qdqH13j9pOHBER+EZXNN2L8RSJhVRA==} engines: {node: '>= 10.0.0'} peerDependencies: rollup: ^2.42.0 @@ -2389,8 +2389,8 @@ packages: rollup: 2.62.0 dev: true - /@rollup/plugin-typescript/8.3.1_7c5ff569c0887b4f0035eb7cb6988163: - resolution: {integrity: sha512-84rExe3ICUBXzqNX48WZV2Jp3OddjTMX97O2Py6D1KJaGSwWp0mDHXj+bCGNJqWHIEKDIT2U0sDjhP4czKi6cA==} + /@rollup/plugin-typescript/8.3.2_7c5ff569c0887b4f0035eb7cb6988163: + resolution: {integrity: sha512-MtgyR5LNHZr3GyN0tM7gNO9D0CS+Y+vflS4v/PHmrX17JCkHUYKvQ5jN5o3cz1YKllM3duXUqu3yOHwMPUxhDg==} engines: {node: '>=8.0.0'} peerDependencies: rollup: ^2.14.0 @@ -2416,15 +2416,15 @@ packages: rollup: 2.62.0 dev: true - /@rollup/pluginutils/4.2.0: - resolution: {integrity: sha512-2WUyJNRkyH5p487pGnn4tWAsxhEFKN/pT8CMgHshd5H+IXkOnKvKZwsz5ZWz+YCXkleZRAU5kwbfgF8CPfDRqA==} + /@rollup/pluginutils/4.2.1: + resolution: {integrity: sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==} engines: {node: '>= 8.0.0'} dependencies: estree-walker: 2.0.2 - picomatch: 2.3.0 + picomatch: 2.3.1 - /@rushstack/node-core-library/3.45.2: - resolution: {integrity: sha512-MJKdB6mxOoIkks3htGVCo7aiTzllm2I6Xua+KbTSb0cp7rBp8gTCOF/4d8R4HFMwpRdEdwzKgqMM6k9rAK73iw==} + /@rushstack/node-core-library/3.45.3: + resolution: {integrity: sha512-Rn0mxqC3MPb+YbvaeFcRWfcYHLwyZ99/ffYA8chpq5OpqoY+Mr1ycTbMvzl5AxWf1pYmi/2+Eo3iTOsQdYR8xw==} dependencies: '@types/node': 12.20.24 colors: 1.2.5 @@ -2432,20 +2432,20 @@ packages: import-lazy: 4.0.0 jju: 1.4.0 resolve: 1.17.0 - semver: 7.3.6 + semver: 7.3.7 timsort: 0.3.0 z-schema: 5.0.2 dev: true - /@rushstack/rig-package/0.3.9: - resolution: {integrity: sha512-z3Oxpfb4n9mGXwseX+ifpkmUf9B8Fy8oieVwg8eFgpCbzllkgOwEiwLKEnRWVQ8owFcd46NCKz+7ICH35CRsAw==} + /@rushstack/rig-package/0.3.10: + resolution: {integrity: sha512-4Z2HhXM4YBWOi4ZYFQNK6Yxz641v+cvc8NKiaNZh+RIdNb3D4Rfpy3XUkggbCozpfDriBfL1+KaXlJtfJfAIXw==} dependencies: resolve: 1.17.0 strip-json-comments: 3.1.1 dev: true - /@rushstack/ts-command-line/4.10.8: - resolution: {integrity: sha512-G7CQYY/m3aZU5fVxbebv35yDeua7sSumrDAB2pJp0d60ZEsxGkUQW8771CeMcGWwSKqT9PxPzKpmIakiWv54sA==} + /@rushstack/ts-command-line/4.10.9: + resolution: {integrity: sha512-TE3eZgHNVHOY3p8lp38FoNEJUr0+swPb24sCcYuwlC+MHgMGXyJNM+p7l3TKSBRiY01XShoL2k601oGwL00KlA==} dependencies: '@types/argparse': 1.0.38 argparse: 1.0.10 @@ -2534,7 +2534,7 @@ packages: /@types/cross-spawn/6.0.2: resolution: {integrity: sha512-KuwNhp3eza+Rhu8IFI5HUXRP0LIhqH5cAjubUvGXXthh4YYBuP2ntwEX+Cz8GJoZUHlKo247wPWOfA9LYEq4cw==} dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 dev: true /@types/debug/4.1.7: @@ -2554,19 +2554,19 @@ packages: /@types/etag/1.8.1: resolution: {integrity: sha512-bsKkeSqN7HYyYntFRAmzcwx/dKW4Wa+KVMTInANlI72PWLQmOpZu96j0OqHZGArW4VQwCmJPteQlXaUDeOB0WQ==} dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 dev: true /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 dev: true /@types/graceful-fs/4.1.5: resolution: {integrity: sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==} dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 dev: true /@types/hash-sum/1.0.0: @@ -2630,8 +2630,8 @@ packages: resolution: {integrity: sha512-qjd88DrCxupx/kJD5yQgZdcYKZKSIGBVDIBE1/LTGcNm3d2Np/jxojkdePDdfnBHJc5W7vSMpbJ1aB7p/Py69A==} dev: true - /@types/node/16.11.26: - resolution: {integrity: sha512-GZ7bu5A6+4DtG7q9GsoHXy3ALcgeIHP4NnL0Vv2wu0uUB/yQex26v0tf6/na1mm0+bS9Uw+0DFex7aaKr2qawQ==} + /@types/node/16.11.27: + resolution: {integrity: sha512-C1pD3kgLoZ56Uuy5lhfOxie4aZlA3UMGLX9rXteq4WitEZH6Rl80mwactt9QG0w0gLFlN/kLBTFnGXtDVWvWQw==} dev: true /@types/normalize-package-data/2.4.1: @@ -2648,13 +2648,13 @@ packages: /@types/prompts/2.0.14: resolution: {integrity: sha512-HZBd99fKxRWpYCErtm2/yxUZv6/PBI9J7N4TNFffl5JbrYMHBwF25DjQGTW3b3jmXq+9P6/8fCIb2ee57BFfYA==} dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 dev: true /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 dev: true /@types/resolve/1.20.1: @@ -2664,7 +2664,7 @@ packages: /@types/sass/1.43.1: resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==} dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 dev: true /@types/semver/7.3.9: @@ -2682,13 +2682,13 @@ packages: /@types/stylus/0.48.37: resolution: {integrity: sha512-IkLnS/GzdDK3rgAmQwLr8LqPvUMa43SHlCnXqsfXNukwaIpiXBNgSHil3ro8aemhF4k4ZiMoa4URE7mwBHPJnQ==} dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 dev: true /@types/ws/8.5.3: resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==} dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 dev: true /@types/yargs-parser/20.2.1: @@ -2705,12 +2705,12 @@ packages: resolution: {integrity: sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==} requiresBuild: true dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 dev: true optional: true - /@typescript-eslint/eslint-plugin/5.18.0_423061f51ca07e3dd1eb999a8074f5cd: - resolution: {integrity: sha512-tzrmdGMJI/uii9/V6lurMo4/o+dMTKDH82LkNjhJ3adCW22YQydoRs5MwTiqxGF9CSYxPxQ7EYb4jLNlIs+E+A==} + /@typescript-eslint/eslint-plugin/5.20.0_0df7beb8e4d849cfe6bb8e844ccdebfd: + resolution: {integrity: sha512-fapGzoxilCn3sBtC6NtXZX6+P/Hef7VDbyfGqTTpzYydwhlkevB+0vE0EnmHPVTVSy68GUncyJ/2PcrFBeCo5Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -2720,24 +2720,24 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.18.0_eslint@8.13.0+typescript@4.5.4 - '@typescript-eslint/scope-manager': 5.18.0 - '@typescript-eslint/type-utils': 5.18.0_eslint@8.13.0+typescript@4.5.4 - '@typescript-eslint/utils': 5.18.0_eslint@8.13.0+typescript@4.5.4 + '@typescript-eslint/parser': 5.20.0_eslint@8.13.0+typescript@4.5.4 + '@typescript-eslint/scope-manager': 5.20.0 + '@typescript-eslint/type-utils': 5.20.0_eslint@8.13.0+typescript@4.5.4 + '@typescript-eslint/utils': 5.20.0_eslint@8.13.0+typescript@4.5.4 debug: 4.3.4 eslint: 8.13.0 functional-red-black-tree: 1.0.1 ignore: 5.2.0 regexpp: 3.2.0 - semver: 7.3.6 + semver: 7.3.7 tsutils: 3.21.0_typescript@4.5.4 typescript: 4.5.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.18.0_eslint@8.13.0+typescript@4.5.4: - resolution: {integrity: sha512-+08nYfurBzSSPndngnHvFw/fniWYJ5ymOrn/63oMIbgomVQOvIDhBoJmYZ9lwQOCnQV9xHGvf88ze3jFGUYooQ==} + /@typescript-eslint/parser/5.20.0_eslint@8.13.0+typescript@4.5.4: + resolution: {integrity: sha512-UWKibrCZQCYvobmu3/N8TWbEeo/EPQbS41Ux1F9XqPzGuV7pfg6n50ZrFo6hryynD8qOTTfLHtHjjdQtxJ0h/w==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -2746,9 +2746,9 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.18.0 - '@typescript-eslint/types': 5.18.0 - '@typescript-eslint/typescript-estree': 5.18.0_typescript@4.5.4 + '@typescript-eslint/scope-manager': 5.20.0 + '@typescript-eslint/types': 5.20.0 + '@typescript-eslint/typescript-estree': 5.20.0_typescript@4.5.4 debug: 4.3.4 eslint: 8.13.0 typescript: 4.5.4 @@ -2756,16 +2756,16 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager/5.18.0: - resolution: {integrity: sha512-C0CZML6NyRDj+ZbMqh9FnPscg2PrzSaVQg3IpTmpe0NURMVBXlghGZgMYqBw07YW73i0MCqSDqv2SbywnCS8jQ==} + /@typescript-eslint/scope-manager/5.20.0: + resolution: {integrity: sha512-h9KtuPZ4D/JuX7rpp1iKg3zOH0WNEa+ZIXwpW/KWmEFDxlA/HSfCMhiyF1HS/drTICjIbpA6OqkAhrP/zkCStg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.18.0 - '@typescript-eslint/visitor-keys': 5.18.0 + '@typescript-eslint/types': 5.20.0 + '@typescript-eslint/visitor-keys': 5.20.0 dev: true - /@typescript-eslint/type-utils/5.18.0_eslint@8.13.0+typescript@4.5.4: - resolution: {integrity: sha512-vcn9/6J5D6jtHxpEJrgK8FhaM8r6J1/ZiNu70ZUJN554Y3D9t3iovi6u7JF8l/e7FcBIxeuTEidZDR70UuCIfA==} + /@typescript-eslint/type-utils/5.20.0_eslint@8.13.0+typescript@4.5.4: + resolution: {integrity: sha512-WxNrCwYB3N/m8ceyoGCgbLmuZwupvzN0rE8NBuwnl7APgjv24ZJIjkNzoFBXPRCGzLNkoU/WfanW0exvp/+3Iw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -2774,7 +2774,7 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.18.0_eslint@8.13.0+typescript@4.5.4 + '@typescript-eslint/utils': 5.20.0_eslint@8.13.0+typescript@4.5.4 debug: 4.3.4 eslint: 8.13.0 tsutils: 3.21.0_typescript@4.5.4 @@ -2783,13 +2783,13 @@ packages: - supports-color dev: true - /@typescript-eslint/types/5.18.0: - resolution: {integrity: sha512-bhV1+XjM+9bHMTmXi46p1Led5NP6iqQcsOxgx7fvk6gGiV48c6IynY0apQb7693twJDsXiVzNXTflhplmaiJaw==} + /@typescript-eslint/types/5.20.0: + resolution: {integrity: sha512-+d8wprF9GyvPwtoB4CxBAR/s0rpP25XKgnOvMf/gMXYDvlUC3rPFHupdTQ/ow9vn7UDe5rX02ovGYQbv/IUCbg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.18.0_typescript@4.5.4: - resolution: {integrity: sha512-wa+2VAhOPpZs1bVij9e5gyVu60ReMi/KuOx4LKjGx2Y3XTNUDJgQ+5f77D49pHtqef/klglf+mibuHs9TrPxdQ==} + /@typescript-eslint/typescript-estree/5.20.0_typescript@4.5.4: + resolution: {integrity: sha512-36xLjP/+bXusLMrT9fMMYy1KJAGgHhlER2TqpUVDYUQg4w0q/NW/sg4UGAgVwAqb8V4zYg43KMUpM8vV2lve6w==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -2797,28 +2797,28 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.18.0 - '@typescript-eslint/visitor-keys': 5.18.0 + '@typescript-eslint/types': 5.20.0 + '@typescript-eslint/visitor-keys': 5.20.0 debug: 4.3.4 globby: 11.0.4 is-glob: 4.0.3 - semver: 7.3.6 + semver: 7.3.7 tsutils: 3.21.0_typescript@4.5.4 typescript: 4.5.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/5.18.0_eslint@8.13.0+typescript@4.5.4: - resolution: {integrity: sha512-+hFGWUMMri7OFY26TsOlGa+zgjEy1ssEipxpLjtl4wSll8zy85x0GrUSju/FHdKfVorZPYJLkF3I4XPtnCTewA==} + /@typescript-eslint/utils/5.20.0_eslint@8.13.0+typescript@4.5.4: + resolution: {integrity: sha512-lHONGJL1LIO12Ujyx8L8xKbwWSkoUKFSO+0wDAqGXiudWB2EO7WEUT+YZLtVbmOmSllAjLb9tpoIPwpRe5Tn6w==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: '@types/json-schema': 7.0.9 - '@typescript-eslint/scope-manager': 5.18.0 - '@typescript-eslint/types': 5.18.0 - '@typescript-eslint/typescript-estree': 5.18.0_typescript@4.5.4 + '@typescript-eslint/scope-manager': 5.20.0 + '@typescript-eslint/types': 5.20.0 + '@typescript-eslint/typescript-estree': 5.20.0_typescript@4.5.4 eslint: 8.13.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.13.0 @@ -2827,11 +2827,11 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys/5.18.0: - resolution: {integrity: sha512-Hf+t+dJsjAKpKSkg3EHvbtEpFFb/1CiOHnvI8bjHgOD4/wAw3gKrA0i94LrbekypiZVanJu3McWJg7rWDMzRTg==} + /@typescript-eslint/visitor-keys/5.20.0: + resolution: {integrity: sha512-1flRpNF+0CAQkMNlTJ6L/Z5jiODG/e5+7mk6XwtPOUS3UrTz3UOiAg9jG2VtKsWI6rZQfy4C6a232QNRZTRGlg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.18.0 + '@typescript-eslint/types': 5.20.0 eslint-visitor-keys: 3.3.0 dev: true @@ -2872,6 +2872,15 @@ packages: estree-walker: 2.0.2 source-map: 0.6.1 + /@vue/compiler-core/3.2.33: + resolution: {integrity: sha512-AAmr52ji3Zhk7IKIuigX2osWWsb2nQE5xsdFYjdnmtQ4gymmqXbjLvkSE174+fF3A3kstYrTgGkqgOEbsdLDpw==} + dependencies: + '@babel/parser': 7.17.9 + '@vue/shared': 3.2.33 + estree-walker: 2.0.2 + source-map: 0.6.1 + dev: true + /@vue/compiler-dom/3.2.26: resolution: {integrity: sha512-smBfaOW6mQDxcT3p9TKT6mE22vjxjJL50GFVJiI0chXYGU/xzC05QRGrW3HHVuJrmLTLx5zBhsZ2dIATERbarg==} dependencies: @@ -2884,6 +2893,13 @@ packages: '@vue/compiler-core': 3.2.31 '@vue/shared': 3.2.31 + /@vue/compiler-dom/3.2.33: + resolution: {integrity: sha512-GhiG1C8X98Xz9QUX/RlA6/kgPBWJkjq0Rq6//5XTAGSYrTMBgcLpP9+CnlUg1TFxnnCVughAG+KZl28XJqw8uQ==} + dependencies: + '@vue/compiler-core': 3.2.33 + '@vue/shared': 3.2.33 + dev: true + /@vue/compiler-sfc/3.2.26: resolution: {integrity: sha512-ePpnfktV90UcLdsDQUh2JdiTuhV0Skv2iYXxfNMOK/F3Q+2BO0AulcVcfoksOpTJGmhhfosWfMyEaEf0UaWpIw==} dependencies: @@ -2912,6 +2928,21 @@ packages: postcss: 8.4.12 source-map: 0.6.1 + /@vue/compiler-sfc/3.2.33: + resolution: {integrity: sha512-H8D0WqagCr295pQjUYyO8P3IejM3vEzeCO1apzByAEaAR/WimhMYczHfZVvlCE/9yBaEu/eu9RdiWr0kF8b71Q==} + dependencies: + '@babel/parser': 7.17.9 + '@vue/compiler-core': 3.2.33 + '@vue/compiler-dom': 3.2.33 + '@vue/compiler-ssr': 3.2.33 + '@vue/reactivity-transform': 3.2.33 + '@vue/shared': 3.2.33 + estree-walker: 2.0.2 + magic-string: 0.25.7 + postcss: 8.4.12 + source-map: 0.6.1 + dev: true + /@vue/compiler-ssr/3.2.26: resolution: {integrity: sha512-2mywLX0ODc4Zn8qBoA2PDCsLEZfpUGZcyoFRLSOjyGGK6wDy2/5kyDOWtf0S0UvtoyVq95OTSGIALjZ4k2q/ag==} dependencies: @@ -2924,6 +2955,13 @@ packages: '@vue/compiler-dom': 3.2.31 '@vue/shared': 3.2.31 + /@vue/compiler-ssr/3.2.33: + resolution: {integrity: sha512-XQh1Xdk3VquDpXsnoCd7JnMoWec9CfAzQDQsaMcSU79OrrO2PNR0ErlIjm/mGq3GmBfkQjzZACV+7GhfRB8xMQ==} + dependencies: + '@vue/compiler-dom': 3.2.33 + '@vue/shared': 3.2.33 + dev: true + /@vue/devtools-api/6.0.0-beta.21.1: resolution: {integrity: sha512-FqC4s3pm35qGVeXRGOjTsRzlkJjrBLriDS9YXbflHLsfA9FrcKzIyWnLXoNm+/7930E8rRakXuAc2QkC50swAw==} dev: false @@ -2946,6 +2984,16 @@ packages: estree-walker: 2.0.2 magic-string: 0.25.7 + /@vue/reactivity-transform/3.2.33: + resolution: {integrity: sha512-4UL5KOIvSQb254aqenW4q34qMXbfZcmEsV/yVidLUgvwYQQ/D21bGX3DlgPUGI3c4C+iOnNmDCkIxkILoX/Pyw==} + dependencies: + '@babel/parser': 7.17.9 + '@vue/compiler-core': 3.2.33 + '@vue/shared': 3.2.33 + estree-walker: 2.0.2 + magic-string: 0.25.7 + dev: true + /@vue/reactivity/3.2.26: resolution: {integrity: sha512-h38bxCZLW6oFJVDlCcAiUKFnXI8xP8d+eO0pcDxx+7dQfSPje2AO6M9S9QO6MrxQB7fGP0DH0dYQ8ksf6hrXKQ==} dependencies: @@ -2956,6 +3004,12 @@ packages: dependencies: '@vue/shared': 3.2.31 + /@vue/reactivity/3.2.33: + resolution: {integrity: sha512-62Sq0mp9/0bLmDuxuLD5CIaMG2susFAGARLuZ/5jkU1FCf9EDbwUuF+BO8Ub3Rbodx0ziIecM/NsmyjardBxfQ==} + dependencies: + '@vue/shared': 3.2.33 + dev: true + /@vue/runtime-core/3.2.26: resolution: {integrity: sha512-BcYi7qZ9Nn+CJDJrHQ6Zsmxei2hDW0L6AB4vPvUQGBm2fZyC0GXd/4nVbyA2ubmuhctD5RbYY8L+5GUJszv9mQ==} dependencies: @@ -2968,6 +3022,13 @@ packages: '@vue/reactivity': 3.2.31 '@vue/shared': 3.2.31 + /@vue/runtime-core/3.2.33: + resolution: {integrity: sha512-N2D2vfaXsBPhzCV3JsXQa2NECjxP3eXgZlFqKh4tgakp3iX6LCGv76DLlc+IfFZq+TW10Y8QUfeihXOupJ1dGw==} + dependencies: + '@vue/reactivity': 3.2.33 + '@vue/shared': 3.2.33 + dev: true + /@vue/runtime-dom/3.2.26: resolution: {integrity: sha512-dY56UIiZI+gjc4e8JQBwAifljyexfVCkIAu/WX8snh8vSOt/gMSEGwPRcl2UpYpBYeyExV8WCbgvwWRNt9cHhQ==} dependencies: @@ -2982,6 +3043,14 @@ packages: '@vue/shared': 3.2.31 csstype: 2.6.19 + /@vue/runtime-dom/3.2.33: + resolution: {integrity: sha512-LSrJ6W7CZTSUygX5s8aFkraDWlO6K4geOwA3quFF2O+hC3QuAMZt/0Xb7JKE3C4JD4pFwCSO7oCrZmZ0BIJUnw==} + dependencies: + '@vue/runtime-core': 3.2.33 + '@vue/shared': 3.2.33 + csstype: 2.6.19 + dev: true + /@vue/server-renderer/3.2.26_vue@3.2.26: resolution: {integrity: sha512-Jp5SggDUvvUYSBIvYEhy76t4nr1vapY/FIFloWmQzn7UxqaHrrBpbxrqPcTrSgGrcaglj0VBp22BKJNre4aA1w==} peerDependencies: @@ -3000,12 +3069,26 @@ packages: '@vue/shared': 3.2.31 vue: 3.2.31 + /@vue/server-renderer/3.2.33_vue@3.2.33: + resolution: {integrity: sha512-4jpJHRD4ORv8PlbYi+/MfP8ec1okz6rybe36MdpkDrGIdEItHEUyaHSKvz+ptNEyQpALmmVfRteHkU9F8vxOew==} + peerDependencies: + vue: 3.2.33 + dependencies: + '@vue/compiler-ssr': 3.2.33 + '@vue/shared': 3.2.33 + vue: 3.2.33 + dev: true + /@vue/shared/3.2.26: resolution: {integrity: sha512-vPV6Cq+NIWbH5pZu+V+2QHE9y1qfuTq49uNWw4f7FDEeZaDU2H2cx5jcUZOAKW7qTrUS4k6qZPbMy1x4N96nbA==} /@vue/shared/3.2.31: resolution: {integrity: sha512-ymN2pj6zEjiKJZbrf98UM2pfDd6F2H7ksKw7NDt/ZZ1fh5Ei39X5tABugtT03ZRlWd9imccoK0hE8hpjpU7irQ==} + /@vue/shared/3.2.33: + resolution: {integrity: sha512-UBc1Pg1T3yZ97vsA2ueER0F6GbJebLHYlEi4ou1H5YL4KWvMOOWwpYo9/QpWq93wxKG6Wo13IY74Hcn/f7c7Bg==} + dev: true + /@wessberg/stringutil/1.0.19: resolution: {integrity: sha512-9AZHVXWlpN8Cn9k5BC/O0Dzb9E9xfEMXzYrNunwvkUTvuK7xgQPVRZpLo+jWCOZ5r8oBa8NIrHuPEu1hzbb6bg==} engines: {node: '>=8.0.0'} @@ -3272,7 +3355,7 @@ packages: /axios/0.24.0: resolution: {integrity: sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==} dependencies: - follow-redirects: 1.14.6 + follow-redirects: 1.14.6_debug@4.3.4 transitivePeerDependencies: - debug dev: false @@ -3998,8 +4081,8 @@ packages: is-what: 3.14.1 dev: true - /core-js/3.21.1: - resolution: {integrity: sha512-FRq5b/VMrWlrmCzwRrpDYNxyHP9BcAZC+xHJaqTgIE5091ZV1NTmyh0sGOg5XqpnHvR0svdy0sv1gWA1zmhxig==} + /core-js/3.22.0: + resolution: {integrity: sha512-8h9jBweRjMiY+ORO7bdWSeWfHhLPO7whobj7Z2Bl0IDo00C228EdGgH7FE4jGumbEjzcFfkfW8bXgdkEDhnwHQ==} requiresBuild: true dev: false @@ -5085,7 +5168,7 @@ packages: resolution: {integrity: sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==} dev: true - /follow-redirects/1.14.6: + /follow-redirects/1.14.6_debug@4.3.4: resolution: {integrity: sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==} engines: {node: '>=4.0'} peerDependencies: @@ -5093,6 +5176,8 @@ packages: peerDependenciesMeta: debug: optional: true + dependencies: + debug: 4.3.4 /form-data/3.0.1: resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==} @@ -5133,8 +5218,8 @@ packages: universalify: 2.0.0 dev: false - /fs-extra/10.0.1: - resolution: {integrity: sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==} + /fs-extra/10.1.0: + resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==} engines: {node: '>=12'} dependencies: graceful-fs: 4.2.9 @@ -5493,7 +5578,7 @@ packages: engines: {node: '>=8.0.0'} dependencies: eventemitter3: 4.0.7 - follow-redirects: 1.14.6 + follow-redirects: 1.14.6_debug@4.3.4 requires-port: 1.0.0 transitivePeerDependencies: - debug @@ -5919,7 +6004,7 @@ packages: '@jest/environment': 27.5.1 '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 chalk: 4.1.2 co: 4.6.0 dedent: 0.7.0 @@ -6002,7 +6087,7 @@ packages: pretty-format: 27.5.1 slash: 3.0.0 strip-json-comments: 3.1.1 - ts-node: 10.4.0_44ef5af6cbbc24239b4e70b5c7b0d7a6 + ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 transitivePeerDependencies: - bufferutil - canvas @@ -6045,7 +6130,7 @@ packages: '@jest/environment': 27.5.1 '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 jest-mock: 27.5.1 jest-util: 27.5.1 jsdom: 16.7.0 @@ -6063,7 +6148,7 @@ packages: '@jest/environment': 27.5.1 '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 jest-mock: 27.5.1 jest-util: 27.5.1 dev: true @@ -6079,7 +6164,7 @@ packages: dependencies: '@jest/types': 27.5.1 '@types/graceful-fs': 4.1.5 - '@types/node': 16.11.26 + '@types/node': 16.11.27 anymatch: 3.1.2 fb-watchman: 2.0.1 graceful-fs: 4.2.9 @@ -6087,7 +6172,7 @@ packages: jest-serializer: 27.5.1 jest-util: 27.5.1 jest-worker: 27.5.1 - micromatch: 4.0.4 + micromatch: 4.0.5 walker: 1.0.8 optionalDependencies: fsevents: 2.3.2 @@ -6101,7 +6186,7 @@ packages: '@jest/source-map': 27.5.1 '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 chalk: 4.1.2 co: 4.6.0 expect: 27.5.1 @@ -6145,7 +6230,7 @@ packages: '@types/stack-utils': 2.0.1 chalk: 4.1.2 graceful-fs: 4.2.9 - micromatch: 4.0.4 + micromatch: 4.0.5 pretty-format: 27.5.1 slash: 3.0.0 stack-utils: 2.0.5 @@ -6156,7 +6241,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 dev: true /jest-pnp-resolver/1.2.2_jest-resolve@27.5.1: @@ -6212,7 +6297,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 chalk: 4.1.2 emittery: 0.8.1 graceful-fs: 4.2.9 @@ -6269,7 +6354,7 @@ packages: resolution: {integrity: sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 graceful-fs: 4.2.9 dev: true @@ -6298,7 +6383,7 @@ packages: jest-util: 27.5.1 natural-compare: 1.4.0 pretty-format: 27.5.1 - semver: 7.3.6 + semver: 7.3.7 transitivePeerDependencies: - supports-color dev: true @@ -6308,7 +6393,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 chalk: 4.1.2 ci-info: 3.3.0 graceful-fs: 4.2.9 @@ -6333,7 +6418,7 @@ packages: dependencies: '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.26 + '@types/node': 16.11.27 ansi-escapes: 4.3.2 chalk: 4.1.2 jest-util: 27.5.1 @@ -6344,7 +6429,7 @@ packages: resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 16.11.26 + '@types/node': 16.11.27 merge-stream: 2.0.0 supports-color: 8.1.1 dev: true @@ -6578,8 +6663,8 @@ packages: /lines-and-columns/1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - /lint-staged/12.3.7: - resolution: {integrity: sha512-/S4D726e2GIsDVWIk1XGvheCaDm1SJRQp8efamZFWJxQMVEbOwSysp7xb49Oo73KYCdy97mIWinhlxcoNqIfIQ==} + /lint-staged/12.3.8: + resolution: {integrity: sha512-0+UpNaqIwKRSGAFOCcpuYNIv/j5QGVC+xUVvmSdxHO+IfIGoHbFLo3XcPmV/LLnsVj5EAncNHVtlITSoY5qWGQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hasBin: true dependencies: @@ -6590,7 +6675,7 @@ packages: execa: 5.1.1 lilconfig: 2.0.4 listr2: 4.0.2 - micromatch: 4.0.4 + micromatch: 4.0.5 normalize-path: 3.0.0 object-inspect: 1.12.0 pidtree: 0.5.0 @@ -6720,11 +6805,6 @@ packages: dependencies: yallist: 4.0.0 - /lru-cache/7.8.1: - resolution: {integrity: sha512-E1v547OCgJvbvevfjgK9sNKIVXO96NnsTsFPBlg4ZxjhsJSODoH9lk8Bm0OxvHNm6Vm5Yqkl/1fErDxhYL8Skg==} - engines: {node: '>=12'} - dev: true - /magic-string/0.25.7: resolution: {integrity: sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==} dependencies: @@ -6979,8 +7059,8 @@ packages: engines: {node: '>=0.10.0'} dev: true - /moment/2.29.1: - resolution: {integrity: sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==} + /moment/2.29.2: + resolution: {integrity: sha512-UgzG4rvxYpN15jgCmVJwac49h9ly9NurikMWGPdVxm8GZD6XjkKPxDTjQQ43gtGgnV3X0cAyWDdP2Wexoquifg==} dev: true /mrmime/1.0.0: @@ -7112,7 +7192,7 @@ packages: dependencies: hosted-git-info: 4.0.2 is-core-module: 2.8.1 - semver: 7.3.6 + semver: 7.3.7 validate-npm-package-license: 3.0.4 dev: true @@ -7310,8 +7390,8 @@ packages: engines: {node: '>=6'} dev: true - /package-name-regex/2.0.5: - resolution: {integrity: sha512-F0lX+FBs/Bo7KWY6EuUXj+oarXU0Og1R2Zdg3F/fVcNw3pPQAKFKxUrugno0Ds5NUztlx/gRLnQW9MF+7VTqAw==} + /package-name-regex/2.0.6: + resolution: {integrity: sha512-gFL35q7kbE/zBaPA3UKhp2vSzcPYx2ecbYuwv1ucE9Il6IIgBDweBlH8D68UFGZic2MkllKa2KHCfC1IQBQUYA==} engines: {node: '>=12'} dev: true @@ -7473,21 +7553,21 @@ packages: find-up: 4.1.0 dev: true - /playwright-chromium/1.20.2: - resolution: {integrity: sha512-KsiPLRC1v56qLWqjzeEoDZNVW/eFrP5ad0PFQAa74u5EwnnId89LgOHEZFy487tt3xJdv3Ayyfdn8zwsUpS3Qg==} + /playwright-chromium/1.21.1: + resolution: {integrity: sha512-bbqFFpcTs+3amiofja/KvTmZ+FZnMNEOuGkRyJk2p6DV9EbgRYVrlzzgLtMnX2DwaX3ZZ23MukGuQ+bVKOdsnw==} engines: {node: '>=12'} hasBin: true requiresBuild: true dependencies: - playwright-core: 1.20.2 + playwright-core: 1.21.1 transitivePeerDependencies: - bufferutil - supports-color - utf-8-validate dev: true - /playwright-core/1.20.2: - resolution: {integrity: sha512-iV6+HftSPalynkq0CYJala1vaTOq7+gU9BRfKCdM9bAxNq/lFLrwbluug2Wt5OoUwbMABcnTThIEm3/qUhCdJQ==} + /playwright-core/1.21.1: + resolution: {integrity: sha512-SbK5dEsai9ZUKlxcinqegorBq4GnftXd4/GfW+pLsdQIQWrLCM/JNh6YQ2Rf2enVykXCejtoXW8L5vJXBBVSJQ==} engines: {node: '>=12'} hasBin: true dependencies: @@ -7567,7 +7647,7 @@ packages: dependencies: import-cwd: 3.0.0 lilconfig: 2.0.4 - ts-node: 10.4.0_44ef5af6cbbc24239b4e70b5c7b0d7a6 + ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 yaml: 1.10.2 dev: false @@ -7583,7 +7663,7 @@ packages: dependencies: lilconfig: 2.0.4 postcss: 8.4.12 - ts-node: 10.4.0_44ef5af6cbbc24239b4e70b5c7b0d7a6 + ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 yaml: 1.10.2 dev: false @@ -7601,7 +7681,7 @@ packages: dependencies: lilconfig: 2.0.5 postcss: 8.4.12 - ts-node: 10.4.0_44ef5af6cbbc24239b4e70b5c7b0d7a6 + ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 yaml: 1.10.2 dev: true @@ -8269,8 +8349,8 @@ packages: dependencies: glob: 7.2.0 - /rollup-plugin-license/2.6.1_rollup@2.62.0: - resolution: {integrity: sha512-JPtlXF0tZKyHztKJsyd3HHmQFSkXei+596Xrb/a/bHIdDhvFuNSKimCKkQpoXyspfeVQk7CNay1MyGpFHAXjvg==} + /rollup-plugin-license/2.7.0_rollup@2.62.0: + resolution: {integrity: sha512-0H1Fbuf85rvpadpmAaairdahzQHY0zHtcXkOFV5EStjX9aMCO2Hz5AQp/zZe+K/PB3o6As7R9uzcb8Pw1K94dg==} engines: {node: '>=10.0.0'} peerDependencies: rollup: ^1.0.0 || ^2.0.0 @@ -8278,10 +8358,10 @@ packages: commenting: 1.1.0 glob: 7.2.0 lodash: 4.17.21 - magic-string: 0.25.7 + magic-string: 0.26.1 mkdirp: 1.0.4 - moment: 2.29.1 - package-name-regex: 2.0.5 + moment: 2.29.2 + package-name-regex: 2.0.6 rollup: 2.62.0 spdx-expression-validate: 2.0.0 spdx-satisfies: 5.0.1 @@ -8381,12 +8461,12 @@ packages: lru-cache: 6.0.0 dev: false - /semver/7.3.6: - resolution: {integrity: sha512-HZWqcgwLsjaX1HBD31msI/rXktuIhS+lWvdE4kN9z+8IVT4Itc7vqU2WvYsyD6/sjYCt4dEKH/m1M3dwI9CC5w==} - engines: {node: ^10.0.0 || ^12.0.0 || ^14.0.0 || >=16.0.0} + /semver/7.3.7: + resolution: {integrity: sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==} + engines: {node: '>=10'} hasBin: true dependencies: - lru-cache: 7.8.1 + lru-cache: 6.0.0 dev: true /send/0.17.2: @@ -9161,12 +9241,12 @@ packages: json5: 2.2.1 lodash.memoize: 4.1.2 make-error: 1.3.6 - semver: 7.3.6 + semver: 7.3.7 typescript: 4.5.4 yargs-parser: 20.2.9 dev: true - /ts-node/10.4.0_44ef5af6cbbc24239b4e70b5c7b0d7a6: + /ts-node/10.4.0_8726306ae516cefbf62490d54d06d905: resolution: {integrity: sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==} hasBin: true peerDependencies: @@ -9185,7 +9265,7 @@ packages: '@tsconfig/node12': 1.0.9 '@tsconfig/node14': 1.0.1 '@tsconfig/node16': 1.0.2 - '@types/node': 16.11.26 + '@types/node': 16.11.27 acorn: 8.7.0 acorn-walk: 8.2.0 arg: 4.1.3 @@ -9463,6 +9543,16 @@ packages: '@vue/server-renderer': 3.2.31_vue@3.2.31 '@vue/shared': 3.2.31 + /vue/3.2.33: + resolution: {integrity: sha512-si1ExAlDUrLSIg/V7D/GgA4twJwfsfgG+t9w10z38HhL/HA07132pUQ2KuwAo8qbCyMJ9e6OqrmWrOCr+jW7ZQ==} + dependencies: + '@vue/compiler-dom': 3.2.33 + '@vue/compiler-sfc': 3.2.33 + '@vue/runtime-dom': 3.2.33 + '@vue/server-renderer': 3.2.33_vue@3.2.33 + '@vue/shared': 3.2.33 + dev: true + /vuex/4.0.2_vue@3.2.26: resolution: {integrity: sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==} peerDependencies: From 9c6501d9c363eaa3c1e7708d531fb2a92b633db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 20 Apr 2022 06:03:19 +0900 Subject: [PATCH 0575/1287] docs: make it clear that array format can only be used for inline postcss config (#7815) --- docs/config/index.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/config/index.md b/docs/config/index.md index 4f1b3efbd16198..bab7df7a144987 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -306,7 +306,11 @@ export default defineConfig(({ command, mode }) => { - **Type:** `string | (postcss.ProcessOptions & { plugins?: postcss.Plugin[] })` - Inline PostCSS config (expects the same format as `postcss.config.js`), or a custom directory to search PostCSS config from (default is project root). The search is done using [postcss-load-config](https://github.com/postcss/postcss-load-config) and only the supported config file names are loaded. + Inline PostCSS config or a custom directory to search PostCSS config from (default is project root). + + For inline PostCSS config, it expects the same format as `postcss.config.js`. But for `plugins` property, only [array format](https://github.com/postcss/postcss-load-config/blob/main/README.md#array) can be used. + + The search is done using [postcss-load-config](https://github.com/postcss/postcss-load-config) and only the supported config file names are loaded. Note if an inline config is provided, Vite will not search for other PostCSS config sources. From f4148482089504516d85e234d9f231fcf41e3d20 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Wed, 20 Apr 2022 16:00:05 +0800 Subject: [PATCH 0576/1287] ci: use action-semantic-pull-request (#7826) --- .github/workflows/semantic-pull-request.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/semantic-pull-request.yml diff --git a/.github/workflows/semantic-pull-request.yml b/.github/workflows/semantic-pull-request.yml new file mode 100644 index 00000000000000..df554b38e75246 --- /dev/null +++ b/.github/workflows/semantic-pull-request.yml @@ -0,0 +1,18 @@ +name: Semantic Pull Request + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + runs-on: ubuntu-latest + name: Semantic Pull Request + steps: + - name: Validate PR title + uses: amannn/action-semantic-pull-request@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 709776f544adfddd7ac8e5b77a821bc3c86357fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 20 Apr 2022 18:12:43 +0900 Subject: [PATCH 0577/1287] fix: modulepreload polyfill only during build (fix #4786) (#7816) --- .../__tests__/backend-integration.spec.ts | 6 ++++++ .../backend-integration/frontend/entrypoints/main.ts | 2 ++ packages/vite/src/node/plugins/modulePreloadPolyfill.ts | 3 ++- scripts/jestPerTestSetup.ts | 8 ++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/playground/backend-integration/__tests__/backend-integration.spec.ts b/packages/playground/backend-integration/__tests__/backend-integration.spec.ts index 3e189972f4baed..7eebc9c27ff05a 100644 --- a/packages/playground/backend-integration/__tests__/backend-integration.spec.ts +++ b/packages/playground/backend-integration/__tests__/backend-integration.spec.ts @@ -32,6 +32,12 @@ if (isBuild) { expect(htmlEntry.assets.length).toEqual(1) }) } else { + test('No ReferenceError', async () => { + browserErrors.forEach((error) => { + expect(error.name).not.toBe('ReferenceError') + }) + }) + describe('CSS HMR', () => { test('preserve the base in CSS HMR', async () => { await untilUpdated(() => getColor('body'), 'black') // sanity check diff --git a/packages/playground/backend-integration/frontend/entrypoints/main.ts b/packages/playground/backend-integration/frontend/entrypoints/main.ts index b95a989ada81c2..f5a332191dd9e4 100644 --- a/packages/playground/backend-integration/frontend/entrypoints/main.ts +++ b/packages/playground/backend-integration/frontend/entrypoints/main.ts @@ -1,3 +1,5 @@ +import 'vite/modulepreload-polyfill' + export const colorClass = 'text-black' export function colorHeading() { diff --git a/packages/vite/src/node/plugins/modulePreloadPolyfill.ts b/packages/vite/src/node/plugins/modulePreloadPolyfill.ts index 0ad1ed2e0d30a4..4f0b3389fcc2c3 100644 --- a/packages/vite/src/node/plugins/modulePreloadPolyfill.ts +++ b/packages/vite/src/node/plugins/modulePreloadPolyfill.ts @@ -5,7 +5,8 @@ import { isModernFlag } from './importAnalysisBuild' export const modulePreloadPolyfillId = 'vite/modulepreload-polyfill' export function modulePreloadPolyfillPlugin(config: ResolvedConfig): Plugin { - const skip = config.build.ssr + // `isModernFlag` is only available during build since it is resolved by `vite:build-import-analysis` + const skip = config.command !== 'build' || config.build.ssr let polyfillString: string | undefined return { diff --git a/scripts/jestPerTestSetup.ts b/scripts/jestPerTestSetup.ts index fcdca77ee9a6eb..43258b3c8b0d6e 100644 --- a/scripts/jestPerTestSetup.ts +++ b/scripts/jestPerTestSetup.ts @@ -24,6 +24,7 @@ declare global { const page: Page | undefined const browserLogs: string[] + const browserErrors: Error[] const serverLogs: string[] const viteTestUrl: string | undefined const watcher: RollupWatcher | undefined @@ -34,6 +35,7 @@ declare const global: { page?: Page browserLogs: string[] + browserErrors: Error[] serverLogs: string[] viteTestUrl?: string watcher?: RollupWatcher @@ -56,6 +58,11 @@ const onConsole = (msg: ConsoleMessage) => { logs.push(msg.text()) } +const errors: Error[] = (global.browserErrors = []) +const onPageError = (error: Error) => { + errors.push(error) +} + beforeAll(async () => { const page = global.page if (!page) { @@ -63,6 +70,7 @@ beforeAll(async () => { } try { page.on('console', onConsole) + page.on('pageerror', onPageError) const testPath = expect.getState().testPath const testName = slash(testPath).match(/playground\/([\w-]+)\//)?.[1] From fde54c9a9c01c114bbac94312666ec3e291edcd3 Mon Sep 17 00:00:00 2001 From: yoho Date: Wed, 20 Apr 2022 23:25:53 +0800 Subject: [PATCH 0578/1287] docs: test env different from production (#7710) Co-authored-by: Bjorn Lu --- CONTRIBUTING.md | 2 ++ scripts/jestPerTestSetup.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f086627de5cfe0..c7020c97a84c80 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -95,6 +95,8 @@ test('should work', async () => { Some common test helpers, e.g. `testDir`, `isBuild` or `editFile` are available in `packages/playground/testUtils.ts`. +Note: The test build environment uses a [different default set of Vite config](https://github.com/vitejs/vite/blob/9c6501d9c363eaa3c1e7708d531fb2a92b633db6/scripts/jestPerTestSetup.ts#L102-L122) to skip transpilation during tests to make it faster. This may produce a different result compared to the default production build. + ### Extending the Test Suite To add new tests, you should find a related playground to the fix or feature (or create a new one). As an example, static assets loading are tested in the [assets playground](https://github.com/vitejs/vite/tree/main/packages/playground/assets). In this Vite App, there is a test for `?raw` imports, with [a section is defined in the `index.html` for it](https://github.com/vitejs/vite/blob/71215533ac60e8ff566dc3467feabfc2c71a01e2/packages/playground/assets/index.html#L121): diff --git a/scripts/jestPerTestSetup.ts b/scripts/jestPerTestSetup.ts index 43258b3c8b0d6e..f4c9db03627c7c 100644 --- a/scripts/jestPerTestSetup.ts +++ b/scripts/jestPerTestSetup.ts @@ -123,6 +123,7 @@ beforeAll(async () => { } }, build: { + // esbuild do not minify ES lib output since that would remove pure annotations and break tree-shaking // skip transpilation during tests to make it faster target: 'esnext' }, From 0b2d307a086d4359822ef1373c884fd2cbdcb953 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Thu, 21 Apr 2022 01:19:11 +0200 Subject: [PATCH 0579/1287] fix: ssr.noExternal with boolean values (#7813) --- packages/playground/ssr-webworker/vite.config.js | 11 ++++++++++- packages/vite/src/node/config.ts | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/playground/ssr-webworker/vite.config.js b/packages/playground/ssr-webworker/vite.config.js index 80cc1784cdc565..91a0571380608e 100644 --- a/packages/playground/ssr-webworker/vite.config.js +++ b/packages/playground/ssr-webworker/vite.config.js @@ -10,9 +10,18 @@ module.exports = { }, ssr: { target: 'webworker', - noExternal: true + noExternal: ['this-should-be-replaced-by-the-boolean'] }, plugins: [ + { + config() { + return { + ssr: { + noExternal: true + } + } + } + }, { config() { return { diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 556fcf7cbae77a..d242ac632c220e 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -745,7 +745,8 @@ function mergeConfigRecursively( } else if (key === 'assetsInclude' && rootPath === '') { merged[key] = [].concat(existing, value) continue - } else if (key === 'noExternal' && existing === true) { + } else if (key === 'noExternal' && (existing === true || value === true)) { + merged[key] = true continue } From 1d468c8e6f02b0d0e362aa2d6542af1e1f55ab45 Mon Sep 17 00:00:00 2001 From: yoho Date: Thu, 21 Apr 2022 07:21:54 +0800 Subject: [PATCH 0580/1287] fix: escape character in string regexp match (#7834) --- .../src/node/__tests__/cleanString.spec.ts | 19 +++++++++++++++++++ packages/vite/src/node/cleanString.ts | 12 ++++++++++-- packages/vite/src/node/plugins/css.ts | 17 ++++++++++------- packages/vite/src/node/plugins/html.ts | 3 ++- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/packages/vite/src/node/__tests__/cleanString.spec.ts b/packages/vite/src/node/__tests__/cleanString.spec.ts index 1065a2d4985ceb..b77f4c0fb5fbad 100644 --- a/packages/vite/src/node/__tests__/cleanString.spec.ts +++ b/packages/vite/src/node/__tests__/cleanString.spec.ts @@ -32,6 +32,25 @@ test('strings', () => { expect(clean).toMatch('const b = "\0\0\0\0"') }) +test('escape character', () => { + const clean = emptyString(` + '1\\'1' + "1\\"1" + "1\\"1\\"1" + "1\\'1'\\"1" + "1'1'" + "1'\\'1\\''\\"1\\"\\"" + '1"\\"1\\""\\"1\\"\\"' + '""1""' + '"""1"""' + '""""1""""' + "''1''" + "'''1'''" + "''''1''''" + `) + expect(clean).not.toMatch('1') +}) + test('strings comment nested', () => { expect( emptyString(` diff --git a/packages/vite/src/node/cleanString.ts b/packages/vite/src/node/cleanString.ts index 05163ea055b631..2b7cba41aef66b 100644 --- a/packages/vite/src/node/cleanString.ts +++ b/packages/vite/src/node/cleanString.ts @@ -2,7 +2,8 @@ import type { RollupError } from 'rollup' // bank on the non-overlapping nature of regex matches and combine all filters into one giant regex // /`([^`\$\{\}]|\$\{(`|\g<1>)*\})*`/g can match nested string template // but js not support match expression(\g<0>). so clean string template(`...`) in other ways. -const cleanerRE = /"[^"]*"|'[^']*'|\/\*(.|[\r\n])*?\*\/|\/\/.*/g +const cleanerRE = + /"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|\/\*(.|[\r\n])*?\*\/|\/\/.*/g const blankReplacer = (s: string) => ' '.repeat(s.length) const stringBlankReplacer = (s: string) => @@ -25,9 +26,16 @@ export function emptyString(raw: string): string { } const enum LexerState { + // template string inTemplateString, inInterpolationExpression, - inObjectExpression + inObjectExpression, + // strings + inSingleQuoteString, + inDoubleQuoteString, + // comments + inMultilineCommentsRE, + inSinglelineCommentsRE } function replaceAt( diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 2f5ab3df58b46a..83e18aabecdb33 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -1122,7 +1122,7 @@ export async function hoistAtRules(css: string) { // to top when multiple files are concatenated. // match until semicolon that's not in quotes s.replace( - /@import\s*(?:url\([^\)]*\)|"[^"]*"|'[^']*'|[^;]*).*?;/gm, + /@import\s*(?:url\([^\)]*\)|"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|[^;]*).*?;/gm, (match) => { s.appendLeft(0, match) return '' @@ -1131,13 +1131,16 @@ export async function hoistAtRules(css: string) { // #6333 // CSS @charset must be the top-first in the file, hoist the first to top let foundCharset = false - s.replace(/@charset\s*(?:"[^"]*"|'[^']*'|[^;]*).*?;/gm, (match) => { - if (!foundCharset) { - s.prepend(match) - foundCharset = true + s.replace( + /@charset\s*(?:"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|[^;]*).*?;/gm, + (match) => { + if (!foundCharset) { + s.prepend(match) + foundCharset = true + } + return '' } - return '' - }) + ) return s.toString() } diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index 5c86b6c0ac6073..e8df0825ddb3fa 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -46,7 +46,8 @@ interface ScriptAssetsUrl { const htmlProxyRE = /\?html-proxy=?[&inline\-css]*&index=(\d+)\.(js|css)$/ const inlineCSSRE = /__VITE_INLINE_CSS__([^_]+_\d+)__/g // Do not allow preceding '.', but do allow preceding '...' for spread operations -const inlineImportRE = /(? htmlProxyRE.test(id) From 72abe488b5ce52d21977c9ba35d6c590e47dbe05 Mon Sep 17 00:00:00 2001 From: chris-zhu <1633711653@qq.com> Date: Thu, 21 Apr 2022 18:49:59 +0800 Subject: [PATCH 0581/1287] docs(api-hmr): update hmr hot type (#7787) --- docs/guide/api-hmr.md | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/docs/guide/api-hmr.md b/docs/guide/api-hmr.md index 46eabab04e8868..1cba492e6613c1 100644 --- a/docs/guide/api-hmr.md +++ b/docs/guide/api-hmr.md @@ -10,21 +10,27 @@ Vite exposes its manual HMR API via the special `import.meta.hot` object: ```ts interface ImportMeta { - readonly hot?: { - readonly data: any + readonly hot?: ViteHotContext +} + +interface ViteHotContext { + readonly data: any - accept(): void - accept(cb: (mod: any) => void): void - accept(dep: string, cb: (mod: any) => void): void - accept(deps: string[], cb: (mods: any[]) => void): void + accept(): void + accept(cb: (mod: any) => void): void + accept(dep: string, cb: (mod: any) => void): void + accept(deps: readonly string[], cb: (mods: any[]) => void): void - prune(cb: () => void): void - dispose(cb: (data: any) => void): void - decline(): void - invalidate(): void + dispose(cb: (data: any) => void): void + decline(): void + invalidate(): void - on(event: string, cb: (...args: any[]) => void): void - } + // `InferCustomEventPayload` provides types for built-in Vite events + on( + event: T, + cb: (payload: InferCustomEventPayload) => void + ): void + send(event: T, data?: InferCustomEventPayload): void } ``` From e29d1d92f7810c5160aac2f1e56f7b03bfa4c933 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 16:32:19 +0200 Subject: [PATCH 0582/1287] chore(deps): update all non-major dependencies (#7847) --- package.json | 4 +-- packages/plugin-legacy/package.json | 2 +- packages/vite/package.json | 2 +- pnpm-lock.yaml | 49 ++++++++++++++++------------- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index a90c2c9a43b3fe..701da1e4ef7887 100644 --- a/package.json +++ b/package.json @@ -46,12 +46,12 @@ "cross-env": "^7.0.3", "esbuild": "^0.14.27", "eslint": "^8.13.0", - "eslint-define-config": "^1.3.0", + "eslint-define-config": "^1.4.0", "eslint-plugin-node": "^11.1.0", "execa": "^5.1.1", "fs-extra": "^10.1.0", "jest": "^27.5.1", - "lint-staged": "^12.3.8", + "lint-staged": "^12.4.0", "minimist": "^1.2.6", "node-fetch": "^2.6.6", "npm-run-all": "^4.1.5", diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index 3734390a3cdf25..adc97e974f2d37 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -23,7 +23,7 @@ "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme", "dependencies": { "@babel/standalone": "^7.17.9", - "core-js": "^3.22.0", + "core-js": "^3.22.2", "magic-string": "^0.26.1", "regenerator-runtime": "^0.13.9", "systemjs": "^6.12.1" diff --git a/packages/vite/package.json b/packages/vite/package.json index 50f8487ad55895..0fd8b867dfe042 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -55,7 +55,7 @@ "@ampproject/remapping": "^2.1.2", "@babel/parser": "^7.17.9", "@babel/types": "^7.17.0", - "@jridgewell/trace-mapping": "^0.3.4", + "@jridgewell/trace-mapping": "^0.3.9", "@rollup/plugin-alias": "^3.1.9", "@rollup/plugin-commonjs": "^21.1.0", "@rollup/plugin-dynamic-import-vars": "^1.4.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 235dd8c48a30ca..140dabd1e04eb5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,12 +22,12 @@ importers: cross-env: ^7.0.3 esbuild: ^0.14.27 eslint: ^8.13.0 - eslint-define-config: ^1.3.0 + eslint-define-config: ^1.4.0 eslint-plugin-node: ^11.1.0 execa: ^5.1.1 fs-extra: ^10.1.0 jest: ^27.5.1 - lint-staged: ^12.3.8 + lint-staged: ^12.4.0 minimist: ^1.2.6 node-fetch: ^2.6.6 npm-run-all: ^4.1.5 @@ -58,12 +58,12 @@ importers: cross-env: 7.0.3 esbuild: 0.14.27 eslint: 8.13.0 - eslint-define-config: 1.3.0 + eslint-define-config: 1.4.0 eslint-plugin-node: 11.1.0_eslint@8.13.0 execa: 5.1.1 fs-extra: 10.1.0 jest: 27.5.1_ts-node@10.4.0 - lint-staged: 12.3.8 + lint-staged: 12.4.0 minimist: 1.2.6 node-fetch: 2.6.6 npm-run-all: 4.1.5 @@ -744,13 +744,13 @@ importers: packages/plugin-legacy: specifiers: '@babel/standalone': ^7.17.9 - core-js: ^3.22.0 + core-js: ^3.22.2 magic-string: ^0.26.1 regenerator-runtime: ^0.13.9 systemjs: ^6.12.1 dependencies: '@babel/standalone': 7.17.9 - core-js: 3.22.0 + core-js: 3.22.2 magic-string: 0.26.1 regenerator-runtime: 0.13.9 systemjs: 6.12.1 @@ -816,7 +816,7 @@ importers: '@ampproject/remapping': ^2.1.2 '@babel/parser': ^7.17.9 '@babel/types': ^7.17.0 - '@jridgewell/trace-mapping': ^0.3.4 + '@jridgewell/trace-mapping': ^0.3.9 '@rollup/plugin-alias': ^3.1.9 '@rollup/plugin-commonjs': ^21.1.0 '@rollup/plugin-dynamic-import-vars': ^1.4.3 @@ -894,7 +894,7 @@ importers: '@ampproject/remapping': 2.1.2 '@babel/parser': 7.17.9 '@babel/types': 7.17.0 - '@jridgewell/trace-mapping': 0.3.4 + '@jridgewell/trace-mapping': 0.3.9 '@rollup/plugin-alias': 3.1.9_rollup@2.62.0 '@rollup/plugin-commonjs': 21.1.0_rollup@2.62.0 '@rollup/plugin-dynamic-import-vars': 1.4.3_rollup@2.62.0 @@ -1080,7 +1080,7 @@ packages: resolution: {integrity: sha512-hoyByceqwKirw7w3Z7gnIIZC3Wx3J484Y3L/cMpXFbr7d9ZQj2mODrirNzcJa+SM3UlpWXYvKV4RlRpFXlWgXg==} engines: {node: '>=6.0.0'} dependencies: - '@jridgewell/trace-mapping': 0.3.4 + '@jridgewell/trace-mapping': 0.3.9 /@babel/code-frame/7.16.0: resolution: {integrity: sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==} @@ -2210,6 +2210,13 @@ packages: dependencies: '@jridgewell/resolve-uri': 3.0.5 '@jridgewell/sourcemap-codec': 1.4.10 + dev: true + + /@jridgewell/trace-mapping/0.3.9: + resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + dependencies: + '@jridgewell/resolve-uri': 3.0.5 + '@jridgewell/sourcemap-codec': 1.4.10 /@mapbox/node-pre-gyp/1.0.8: resolution: {integrity: sha512-CMGKi28CF+qlbXh26hDe6NxCd7amqeAzEqnS6IHeO6LoaKyM/n+Xw3HT1COdq8cuioOdlKdqn/hCmqPUOMOywg==} @@ -3355,7 +3362,7 @@ packages: /axios/0.24.0: resolution: {integrity: sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==} dependencies: - follow-redirects: 1.14.6_debug@4.3.4 + follow-redirects: 1.14.6 transitivePeerDependencies: - debug dev: false @@ -4081,8 +4088,8 @@ packages: is-what: 3.14.1 dev: true - /core-js/3.22.0: - resolution: {integrity: sha512-8h9jBweRjMiY+ORO7bdWSeWfHhLPO7whobj7Z2Bl0IDo00C228EdGgH7FE4jGumbEjzcFfkfW8bXgdkEDhnwHQ==} + /core-js/3.22.2: + resolution: {integrity: sha512-Z5I2vzDnEIqO2YhELVMFcL1An2CIsFe9Q7byZhs8c/QxummxZlAHw33TUHbIte987LkisOgL0LwQ1P9D6VISnA==} requiresBuild: true dev: false @@ -4787,9 +4794,9 @@ packages: source-map: 0.6.1 dev: true - /eslint-define-config/1.3.0: - resolution: {integrity: sha512-sFbHUnaXdJfG74c0EfFjXajjM3ugDVOMteKBnddCHQP5eas6p3nmS7PbSVhyZ8Y9DaNNtFbzlovdGmVdTwrHcw==} - engines: {node: '>= 16.9.0', npm: '>= 7.0.0', pnpm: '>= 6.32.2'} + /eslint-define-config/1.4.0: + resolution: {integrity: sha512-DJGEdzX4fkdkhPSzPgOpBbBjhT+b9DcgbAgxfrEUcipVWlSuesQJriKffHz1JF5mhKFm7PGoiZz4D2nb4GslNA==} + engines: {node: '>= 14.6.0', npm: '>= 6.0.0', pnpm: '>= 6.32.9'} dev: true /eslint-plugin-es/3.0.1_eslint@8.13.0: @@ -5168,7 +5175,7 @@ packages: resolution: {integrity: sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==} dev: true - /follow-redirects/1.14.6_debug@4.3.4: + /follow-redirects/1.14.6: resolution: {integrity: sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==} engines: {node: '>=4.0'} peerDependencies: @@ -5176,8 +5183,6 @@ packages: peerDependenciesMeta: debug: optional: true - dependencies: - debug: 4.3.4 /form-data/3.0.1: resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==} @@ -5578,7 +5583,7 @@ packages: engines: {node: '>=8.0.0'} dependencies: eventemitter3: 4.0.7 - follow-redirects: 1.14.6_debug@4.3.4 + follow-redirects: 1.14.6 requires-port: 1.0.0 transitivePeerDependencies: - debug @@ -6082,7 +6087,7 @@ packages: jest-runner: 27.5.1 jest-util: 27.5.1 jest-validate: 27.5.1 - micromatch: 4.0.4 + micromatch: 4.0.5 parse-json: 5.2.0 pretty-format: 27.5.1 slash: 3.0.0 @@ -6663,8 +6668,8 @@ packages: /lines-and-columns/1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - /lint-staged/12.3.8: - resolution: {integrity: sha512-0+UpNaqIwKRSGAFOCcpuYNIv/j5QGVC+xUVvmSdxHO+IfIGoHbFLo3XcPmV/LLnsVj5EAncNHVtlITSoY5qWGQ==} + /lint-staged/12.4.0: + resolution: {integrity: sha512-3X7MR0h9b7qf4iXf/1n7RlVAx+EzpAZXoCEMhVSpaBlgKDfH2ewf+QUm7BddFyq29v4dgPP+8+uYpWuSWx035A==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hasBin: true dependencies: From d7540c8bd43c889253dc1e8ed040a20f9959e083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Thu, 21 Apr 2022 23:32:45 +0900 Subject: [PATCH 0583/1287] fix: update sourcemap in importAnalysisBuild (#7825) --- .../src/node/plugins/importAnalysisBuild.ts | 61 +++++++++++++++---- packages/vite/src/node/server/sourcemap.ts | 2 +- packages/vite/src/node/utils.ts | 7 ++- 3 files changed, 53 insertions(+), 17 deletions(-) diff --git a/packages/vite/src/node/plugins/importAnalysisBuild.ts b/packages/vite/src/node/plugins/importAnalysisBuild.ts index 91ce663b9f8111..9f4c75025fff27 100644 --- a/packages/vite/src/node/plugins/importAnalysisBuild.ts +++ b/packages/vite/src/node/plugins/importAnalysisBuild.ts @@ -4,10 +4,12 @@ import type { Plugin } from '../plugin' import MagicString from 'magic-string' import type { ImportSpecifier } from 'es-module-lexer' import { init, parse as parseImports } from 'es-module-lexer' -import type { OutputChunk } from 'rollup' +import type { OutputChunk, SourceMap } from 'rollup' import { isCSSRequest, removedPureCssFilesCache } from './css' import { transformImportGlob } from '../importGlob' -import { bareImportRE } from '../utils' +import { bareImportRE, combineSourcemaps } from '../utils' +import type { RawSourceMap } from '@ampproject/remapping' +import { genSourceMapUrl } from '../server/sourcemap' /** * A flag for injected helpers. This flag will be set to `false` if the output @@ -20,7 +22,7 @@ export const preloadMarker = `__VITE_PRELOAD__` export const preloadBaseMarker = `__VITE_PRELOAD_BASE__` const preloadHelperId = 'vite/preload-helper' -const preloadMarkerRE = new RegExp(`"${preloadMarker}"`, 'g') +const preloadMarkerWithQuote = `"${preloadMarker}"` as const /** * Helper for preloading CSS and direct imports of async chunks in parallel to @@ -263,8 +265,10 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin { this.error(e, e.idx) } + const s = new MagicString(code) + const rewroteMarkerStartPos = new Set() // position of the leading double quote + if (imports.length) { - const s = new MagicString(code) for (let index = 0; index < imports.length; index++) { // To handle escape sequences in specifier strings, the .n field will be provided where possible. const { @@ -324,16 +328,16 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin { addDeps(normalizedFile) } - let markPos = code.indexOf(preloadMarker, end) + let markerStartPos = code.indexOf(preloadMarkerWithQuote, end) // fix issue #3051 - if (markPos === -1 && imports.length === 1) { - markPos = code.indexOf(preloadMarker) + if (markerStartPos === -1 && imports.length === 1) { + markerStartPos = code.indexOf(preloadMarkerWithQuote) } - if (markPos > 0) { + if (markerStartPos > 0) { s.overwrite( - markPos - 1, - markPos + preloadMarker.length + 1, + markerStartPos, + markerStartPos + preloadMarkerWithQuote.length, // the dep list includes the main chunk, so only need to // preload when there are actual other deps. deps.size > 1 || @@ -343,15 +347,46 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin { : `[]`, { contentOnly: true } ) + rewroteMarkerStartPos.add(markerStartPos) } } - chunk.code = s.toString() - // TODO source map } // there may still be markers due to inlined dynamic imports, remove // all the markers regardless - chunk.code = chunk.code.replace(preloadMarkerRE, 'void 0') + let markerStartPos = code.indexOf(preloadMarkerWithQuote) + while (markerStartPos >= 0) { + if (!rewroteMarkerStartPos.has(markerStartPos)) { + s.overwrite( + markerStartPos, + markerStartPos + preloadMarkerWithQuote.length, + 'void 0', + { contentOnly: true } + ) + } + + markerStartPos = code.indexOf( + preloadMarkerWithQuote, + markerStartPos + preloadMarkerWithQuote.length + ) + } + + if (s.hasChanged()) { + chunk.code = s.toString() + if (config.build.sourcemap && chunk.map) { + const nextMap = s.generateMap({ + source: chunk.fileName, + hires: true + }) + const map = combineSourcemaps( + chunk.fileName, + [nextMap as RawSourceMap, chunk.map as RawSourceMap], + false + ) as SourceMap + map.toUrl = () => genSourceMapUrl(map) + chunk.map = map + } + } } } } diff --git a/packages/vite/src/node/server/sourcemap.ts b/packages/vite/src/node/server/sourcemap.ts index dc77c4a4714298..0b9bcf9284754b 100644 --- a/packages/vite/src/node/server/sourcemap.ts +++ b/packages/vite/src/node/server/sourcemap.ts @@ -61,7 +61,7 @@ export async function injectSourcesContent( } } -function genSourceMapUrl(map: SourceMap | string | undefined) { +export function genSourceMapUrl(map: SourceMap | string | undefined) { if (typeof map !== 'string') { map = JSON.stringify(map) } diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 16391df8c73df3..e7a20afbdd5ae7 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -605,7 +605,8 @@ const nullSourceMap: RawSourceMap = { } export function combineSourcemaps( filename: string, - sourcemapList: Array + sourcemapList: Array, + excludeContent = true ): RawSourceMap { if ( sourcemapList.length === 0 || @@ -635,7 +636,7 @@ export function combineSourcemaps( const useArrayInterface = sourcemapList.slice(0, -1).find((m) => m.sources.length !== 1) === undefined if (useArrayInterface) { - map = remapping(sourcemapList, () => null, true) + map = remapping(sourcemapList, () => null, excludeContent) } else { map = remapping( sourcemapList[0], @@ -646,7 +647,7 @@ export function combineSourcemaps( return null } }, - true + excludeContent ) } if (!map.file) { From ba43c29a7920ab8356b3fcb16ca3a11dc7e5713e Mon Sep 17 00:00:00 2001 From: yoho Date: Fri, 22 Apr 2022 14:18:07 +0800 Subject: [PATCH 0584/1287] fix: style use string instead of js import (#7786) --- .../playground/worker/__tests__/es/es-worker.spec.ts | 2 +- .../playground/worker/__tests__/iife/worker.spec.ts | 2 +- .../sourcemap-hidden/sourcemap-hidden-worker.spec.ts | 2 +- .../sourcemap-inline/sourcemap-inline-worker.spec.ts | 2 +- .../__tests__/sourcemap/sourcemap-worker.spec.ts | 2 +- packages/vite/src/node/plugins/html.ts | 11 +++++++++-- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/playground/worker/__tests__/es/es-worker.spec.ts b/packages/playground/worker/__tests__/es/es-worker.spec.ts index c7fd0d6c19e4bc..a815596721c268 100644 --- a/packages/playground/worker/__tests__/es/es-worker.spec.ts +++ b/packages/playground/worker/__tests__/es/es-worker.spec.ts @@ -60,7 +60,7 @@ if (isBuild) { // assert correct files test('inlined code generation', async () => { const files = fs.readdirSync(assetsDir) - expect(files.length).toBe(22) + expect(files.length).toBe(21) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const worker = files.find((f) => f.includes('my-worker')) diff --git a/packages/playground/worker/__tests__/iife/worker.spec.ts b/packages/playground/worker/__tests__/iife/worker.spec.ts index fa9f72fe76131c..9be78d57edd702 100644 --- a/packages/playground/worker/__tests__/iife/worker.spec.ts +++ b/packages/playground/worker/__tests__/iife/worker.spec.ts @@ -63,7 +63,7 @@ if (isBuild) { // assert correct files test('inlined code generation', async () => { const files = fs.readdirSync(assetsDir) - expect(files.length).toBe(13) + expect(files.length).toBe(12) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const worker = files.find((f) => f.includes('my-worker')) diff --git a/packages/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts b/packages/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts index d846a5de2311d0..1797ac5269e411 100644 --- a/packages/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts +++ b/packages/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts @@ -9,7 +9,7 @@ if (isBuild) { test('sourcemap generation for web workers', async () => { const files = fs.readdirSync(assetsDir) // should have 2 worker chunk - expect(files.length).toBe(25) + expect(files.length).toBe(24) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const indexSourcemap = getSourceMapUrl(content) diff --git a/packages/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts b/packages/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts index ceda7dae1fec7c..89af0878213ab9 100644 --- a/packages/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts +++ b/packages/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts @@ -9,7 +9,7 @@ if (isBuild) { test('sourcemap generation for web workers', async () => { const files = fs.readdirSync(assetsDir) // should have 2 worker chunk - expect(files.length).toBe(13) + expect(files.length).toBe(12) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const indexSourcemap = getSourceMapUrl(content) diff --git a/packages/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts b/packages/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts index 54e4f1cb9f2d58..24af73d5e3edfa 100644 --- a/packages/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts +++ b/packages/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts @@ -9,7 +9,7 @@ if (isBuild) { test('sourcemap generation for web workers', async () => { const files = fs.readdirSync(assetsDir) // should have 2 worker chunk - expect(files.length).toBe(25) + expect(files.length).toBe(24) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const indexSourcemap = getSourceMapUrl(content) diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index e8df0825ddb3fa..ed4250f1965869 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -391,8 +391,15 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin { addToHTMLProxyCache(config, filePath, inlineModuleIndex, { code: styleNode.content }) - js += `\nimport "${id}?html-proxy&index=${inlineModuleIndex}.css"` - shouldRemove = true + js += `\nimport "${id}?html-proxy&inline-css&index=${inlineModuleIndex}.css"` + + // will transform in `applyHtmlTransforms` + s.overwrite( + styleNode.loc.start.offset, + styleNode.loc.end.offset, + `__VITE_INLINE_CSS__${cleanUrl(id)}_${inlineModuleIndex}__`, + { contentOnly: true } + ) } if (shouldRemove) { From fc89057b406fc85e01a1d4fd08f128e9b6bcba5a Mon Sep 17 00:00:00 2001 From: Shinigami Date: Fri, 22 Apr 2022 21:20:57 +0200 Subject: [PATCH 0585/1287] fix: node v18 support (#7812) --- .github/workflows/ci.yml | 7 ++- package.json | 2 +- packages/vite/package.json | 2 +- packages/vite/src/node/logger.ts | 10 +++- pnpm-lock.yaml | 80 ++++++++++++++++---------------- 5 files changed, 57 insertions(+), 44 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cde7dfb03825ed..2832dab118e279 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,12 +27,17 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node_version: [12, 14, 16, 17] + node_version: [12, 14, 16, 17, 18] include: - os: macos-latest node_version: 16 + - os: macos-latest + node_version: 18 - os: windows-latest node_version: 16 + # Maybe bug with jest on windows and node-v18 + # - os: windows-latest + # node_version: 18 fail-fast: false name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}" diff --git a/package.json b/package.json index 701da1e4ef7887..1bfa2c4e77619c 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@microsoft/api-extractor": "^7.22.2", "@types/fs-extra": "^9.0.13", "@types/jest": "^27.4.1", - "@types/node": "^16.11.27", + "@types/node": "^17.0.25", "@types/prompts": "^2.0.14", "@types/semver": "^7.3.9", "@typescript-eslint/eslint-plugin": "^5.20.0", diff --git a/packages/vite/package.json b/packages/vite/package.json index 0fd8b867dfe042..2d65cc1c330cad 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -71,7 +71,7 @@ "@types/less": "^3.0.3", "@types/micromatch": "^4.0.2", "@types/mime": "^2.0.3", - "@types/node": "^16.11.27", + "@types/node": "^17.0.25", "@types/resolve": "^1.20.1", "@types/sass": "~1.43.1", "@types/stylus": "^0.48.37", diff --git a/packages/vite/src/node/logger.ts b/packages/vite/src/node/logger.ts index b6cf76f2aaa432..8ece2dd8746b7f 100644 --- a/packages/vite/src/node/logger.ts +++ b/packages/vite/src/node/logger.ts @@ -190,7 +190,15 @@ function printServerUrls( } else { Object.values(os.networkInterfaces()) .flatMap((nInterface) => nInterface ?? []) - .filter((detail) => detail && detail.address && detail.family === 'IPv4') + .filter( + (detail) => + detail && + detail.address && + // Node < v18 + ((typeof detail.family === 'string' && detail.family === 'IPv4') || + // Node >= v18 + (typeof detail.family === 'number' && detail.family === 4)) + ) .map((detail) => { const type = detail.address.includes('127.0.0.1') ? 'Local: ' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 140dabd1e04eb5..ad65e136bd1b56 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,7 +13,7 @@ importers: '@microsoft/api-extractor': ^7.22.2 '@types/fs-extra': ^9.0.13 '@types/jest': ^27.4.1 - '@types/node': ^16.11.27 + '@types/node': ^17.0.25 '@types/prompts': ^2.0.14 '@types/semver': ^7.3.9 '@typescript-eslint/eslint-plugin': ^5.20.0 @@ -49,7 +49,7 @@ importers: '@microsoft/api-extractor': 7.22.2 '@types/fs-extra': 9.0.13 '@types/jest': 27.4.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 '@types/prompts': 2.0.14 '@types/semver': 7.3.9 '@typescript-eslint/eslint-plugin': 5.20.0_0df7beb8e4d849cfe6bb8e844ccdebfd @@ -77,7 +77,7 @@ importers: simple-git-hooks: 2.7.0 sirv: 2.0.2 ts-jest: 27.1.4_4dfe14e0e8266437469ae0475a5c09ac - ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 + ts-node: 10.4.0_233d9fcfccc8abc8f146a08357d842da typescript: 4.5.4 vite: link:packages/vite vitepress: 0.22.3 @@ -832,7 +832,7 @@ importers: '@types/less': ^3.0.3 '@types/micromatch': ^4.0.2 '@types/mime': ^2.0.3 - '@types/node': ^16.11.27 + '@types/node': ^17.0.25 '@types/resolve': ^1.20.1 '@types/sass': ~1.43.1 '@types/stylus': ^0.48.37 @@ -910,7 +910,7 @@ importers: '@types/less': 3.0.3 '@types/micromatch': 4.0.2 '@types/mime': 2.0.3 - '@types/node': 16.11.27 + '@types/node': 17.0.25 '@types/resolve': 1.20.1 '@types/sass': 1.43.1 '@types/stylus': 0.48.37 @@ -2012,7 +2012,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 chalk: 4.1.2 jest-message-util: 27.5.1 jest-util: 27.5.1 @@ -2033,7 +2033,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.8.1 @@ -2070,7 +2070,7 @@ packages: dependencies: '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 jest-mock: 27.5.1 dev: true @@ -2080,7 +2080,7 @@ packages: dependencies: '@jest/types': 27.5.1 '@sinonjs/fake-timers': 8.1.0 - '@types/node': 16.11.27 + '@types/node': 17.0.25 jest-message-util: 27.5.1 jest-mock: 27.5.1 jest-util: 27.5.1 @@ -2109,7 +2109,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 chalk: 4.1.2 collect-v8-coverage: 1.0.1 exit: 0.1.2 @@ -2193,7 +2193,7 @@ packages: dependencies: '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 '@types/yargs': 16.0.4 chalk: 4.1.2 dev: true @@ -2541,7 +2541,7 @@ packages: /@types/cross-spawn/6.0.2: resolution: {integrity: sha512-KuwNhp3eza+Rhu8IFI5HUXRP0LIhqH5cAjubUvGXXthh4YYBuP2ntwEX+Cz8GJoZUHlKo247wPWOfA9LYEq4cw==} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true /@types/debug/4.1.7: @@ -2561,19 +2561,19 @@ packages: /@types/etag/1.8.1: resolution: {integrity: sha512-bsKkeSqN7HYyYntFRAmzcwx/dKW4Wa+KVMTInANlI72PWLQmOpZu96j0OqHZGArW4VQwCmJPteQlXaUDeOB0WQ==} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true /@types/graceful-fs/4.1.5: resolution: {integrity: sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true /@types/hash-sum/1.0.0: @@ -2637,8 +2637,8 @@ packages: resolution: {integrity: sha512-qjd88DrCxupx/kJD5yQgZdcYKZKSIGBVDIBE1/LTGcNm3d2Np/jxojkdePDdfnBHJc5W7vSMpbJ1aB7p/Py69A==} dev: true - /@types/node/16.11.27: - resolution: {integrity: sha512-C1pD3kgLoZ56Uuy5lhfOxie4aZlA3UMGLX9rXteq4WitEZH6Rl80mwactt9QG0w0gLFlN/kLBTFnGXtDVWvWQw==} + /@types/node/17.0.25: + resolution: {integrity: sha512-wANk6fBrUwdpY4isjWrKTufkrXdu1D2YHCot2fD/DfWxF5sMrVSA+KN7ydckvaTCh0HiqX9IVl0L5/ZoXg5M7w==} dev: true /@types/normalize-package-data/2.4.1: @@ -2655,13 +2655,13 @@ packages: /@types/prompts/2.0.14: resolution: {integrity: sha512-HZBd99fKxRWpYCErtm2/yxUZv6/PBI9J7N4TNFffl5JbrYMHBwF25DjQGTW3b3jmXq+9P6/8fCIb2ee57BFfYA==} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true /@types/resolve/1.20.1: @@ -2671,7 +2671,7 @@ packages: /@types/sass/1.43.1: resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true /@types/semver/7.3.9: @@ -2689,13 +2689,13 @@ packages: /@types/stylus/0.48.37: resolution: {integrity: sha512-IkLnS/GzdDK3rgAmQwLr8LqPvUMa43SHlCnXqsfXNukwaIpiXBNgSHil3ro8aemhF4k4ZiMoa4URE7mwBHPJnQ==} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true /@types/ws/8.5.3: resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true /@types/yargs-parser/20.2.1: @@ -2712,7 +2712,7 @@ packages: resolution: {integrity: sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==} requiresBuild: true dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true optional: true @@ -6009,7 +6009,7 @@ packages: '@jest/environment': 27.5.1 '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 chalk: 4.1.2 co: 4.6.0 dedent: 0.7.0 @@ -6092,7 +6092,7 @@ packages: pretty-format: 27.5.1 slash: 3.0.0 strip-json-comments: 3.1.1 - ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 + ts-node: 10.4.0_233d9fcfccc8abc8f146a08357d842da transitivePeerDependencies: - bufferutil - canvas @@ -6135,7 +6135,7 @@ packages: '@jest/environment': 27.5.1 '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 jest-mock: 27.5.1 jest-util: 27.5.1 jsdom: 16.7.0 @@ -6153,7 +6153,7 @@ packages: '@jest/environment': 27.5.1 '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 jest-mock: 27.5.1 jest-util: 27.5.1 dev: true @@ -6169,7 +6169,7 @@ packages: dependencies: '@jest/types': 27.5.1 '@types/graceful-fs': 4.1.5 - '@types/node': 16.11.27 + '@types/node': 17.0.25 anymatch: 3.1.2 fb-watchman: 2.0.1 graceful-fs: 4.2.9 @@ -6191,7 +6191,7 @@ packages: '@jest/source-map': 27.5.1 '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 chalk: 4.1.2 co: 4.6.0 expect: 27.5.1 @@ -6246,7 +6246,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true /jest-pnp-resolver/1.2.2_jest-resolve@27.5.1: @@ -6302,7 +6302,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 chalk: 4.1.2 emittery: 0.8.1 graceful-fs: 4.2.9 @@ -6359,7 +6359,7 @@ packages: resolution: {integrity: sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 graceful-fs: 4.2.9 dev: true @@ -6398,7 +6398,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 chalk: 4.1.2 ci-info: 3.3.0 graceful-fs: 4.2.9 @@ -6423,7 +6423,7 @@ packages: dependencies: '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 16.11.27 + '@types/node': 17.0.25 ansi-escapes: 4.3.2 chalk: 4.1.2 jest-util: 27.5.1 @@ -6434,7 +6434,7 @@ packages: resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 merge-stream: 2.0.0 supports-color: 8.1.1 dev: true @@ -7652,7 +7652,7 @@ packages: dependencies: import-cwd: 3.0.0 lilconfig: 2.0.4 - ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 + ts-node: 10.4.0_233d9fcfccc8abc8f146a08357d842da yaml: 1.10.2 dev: false @@ -7668,7 +7668,7 @@ packages: dependencies: lilconfig: 2.0.4 postcss: 8.4.12 - ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 + ts-node: 10.4.0_233d9fcfccc8abc8f146a08357d842da yaml: 1.10.2 dev: false @@ -7686,7 +7686,7 @@ packages: dependencies: lilconfig: 2.0.5 postcss: 8.4.12 - ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 + ts-node: 10.4.0_233d9fcfccc8abc8f146a08357d842da yaml: 1.10.2 dev: true @@ -9251,7 +9251,7 @@ packages: yargs-parser: 20.2.9 dev: true - /ts-node/10.4.0_8726306ae516cefbf62490d54d06d905: + /ts-node/10.4.0_233d9fcfccc8abc8f146a08357d842da: resolution: {integrity: sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==} hasBin: true peerDependencies: @@ -9270,7 +9270,7 @@ packages: '@tsconfig/node12': 1.0.9 '@tsconfig/node14': 1.0.1 '@tsconfig/node16': 1.0.2 - '@types/node': 16.11.27 + '@types/node': 17.0.25 acorn: 8.7.0 acorn-walk: 8.2.0 arg: 4.1.3 From ecc78bca4a15a25764375b2a7166cf06401e9ffd Mon Sep 17 00:00:00 2001 From: yoho <907415276@qq.com> Date: Sun, 24 Apr 2022 16:35:04 +0800 Subject: [PATCH 0586/1287] fix: clean string regexp (#7871) --- packages/vite/src/node/__tests__/cleanString.spec.ts | 11 +++++++++++ packages/vite/src/node/cleanString.ts | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/node/__tests__/cleanString.spec.ts b/packages/vite/src/node/__tests__/cleanString.spec.ts index b77f4c0fb5fbad..f307c4816b7cd3 100644 --- a/packages/vite/src/node/__tests__/cleanString.spec.ts +++ b/packages/vite/src/node/__tests__/cleanString.spec.ts @@ -1,3 +1,4 @@ +import { assetAttrsConfig } from './../plugins/html' import { emptyString } from '../../node/cleanString' test('comments', () => { @@ -51,6 +52,16 @@ test('escape character', () => { expect(clean).not.toMatch('1') }) +test('regexp affect', () => { + const clean = emptyString(` + /'/ + '1' + /"/ + "1" + `) + expect(clean).not.toMatch('1') +}) + test('strings comment nested', () => { expect( emptyString(` diff --git a/packages/vite/src/node/cleanString.ts b/packages/vite/src/node/cleanString.ts index 2b7cba41aef66b..3d623dce79c0d3 100644 --- a/packages/vite/src/node/cleanString.ts +++ b/packages/vite/src/node/cleanString.ts @@ -2,8 +2,9 @@ import type { RollupError } from 'rollup' // bank on the non-overlapping nature of regex matches and combine all filters into one giant regex // /`([^`\$\{\}]|\$\{(`|\g<1>)*\})*`/g can match nested string template // but js not support match expression(\g<0>). so clean string template(`...`) in other ways. -const cleanerRE = - /"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|\/\*(.|[\r\n])*?\*\/|\/\/.*/g +const stringsRE = /"([^"\r\n]|(?<=\\)")*"|'([^'\r\n]|(?<=\\)')*'/.source +const commentsRE = /\/\*(.|[\r\n])*?\*\/|\/\/.*/.source +const cleanerRE = new RegExp(`${stringsRE}|${commentsRE}`, 'g') const blankReplacer = (s: string) => ' '.repeat(s.length) const stringBlankReplacer = (s: string) => From 1f7855c1f691b588854d295d3dbffff759826c51 Mon Sep 17 00:00:00 2001 From: Rom Date: Mon, 25 Apr 2022 11:55:13 +0200 Subject: [PATCH 0587/1287] fix: HMR propagation of HTML changes (fix #7870) (#7895) --- packages/playground/hmr/__tests__/hmr.spec.ts | 18 +++++++++++++++--- .../hmr/{dynamic-import => counter}/dep.ts | 0 .../hmr/{dynamic-import => counter}/index.html | 0 .../hmr/{dynamic-import => counter}/index.ts | 0 packages/vite/src/node/server/moduleGraph.ts | 7 +++++++ 5 files changed, 22 insertions(+), 3 deletions(-) rename packages/playground/hmr/{dynamic-import => counter}/dep.ts (100%) rename packages/playground/hmr/{dynamic-import => counter}/index.html (100%) rename packages/playground/hmr/{dynamic-import => counter}/index.ts (100%) diff --git a/packages/playground/hmr/__tests__/hmr.spec.ts b/packages/playground/hmr/__tests__/hmr.spec.ts index 7325c9fe47943a..40b2bdf31b7956 100644 --- a/packages/playground/hmr/__tests__/hmr.spec.ts +++ b/packages/playground/hmr/__tests__/hmr.spec.ts @@ -162,7 +162,7 @@ if (!isBuild) { }) test('not loaded dynamic import', async () => { - await page.goto(viteTestUrl + '/dynamic-import/index.html') + await page.goto(viteTestUrl + '/counter/index.html') let btn = await page.$('button') expect(await btn.textContent()).toBe('Counter 0') @@ -170,7 +170,7 @@ if (!isBuild) { expect(await btn.textContent()).toBe('Counter 1') // Modifying `index.ts` triggers a page reload, as expected - editFile('dynamic-import/index.ts', (code) => code) + editFile('counter/index.ts', (code) => code) await page.waitForNavigation() btn = await page.$('button') expect(await btn.textContent()).toBe('Counter 0') @@ -184,7 +184,7 @@ if (!isBuild) { // (Note that, a dynamic import that is never loaded and that does not // define `accept.module.hot.accept` may wrongfully trigger a full page // reload, see discussion at #7561.) - editFile('dynamic-import/dep.ts', (code) => code) + editFile('counter/dep.ts', (code) => code) try { await page.waitForNavigation({ timeout: 1000 }) } catch (err) { @@ -194,4 +194,16 @@ if (!isBuild) { btn = await page.$('button') expect(await btn.textContent()).toBe('Counter 1') }) + + test('HTML', async () => { + await page.goto(viteTestUrl + '/counter/index.html') + let btn = await page.$('button') + expect(await btn.textContent()).toBe('Counter 0') + editFile('counter/index.html', (code) => + code.replace('Counter', 'Compteur') + ) + await page.waitForNavigation() + btn = await page.$('button') + expect(await btn.textContent()).toBe('Compteur 0') + }) } diff --git a/packages/playground/hmr/dynamic-import/dep.ts b/packages/playground/hmr/counter/dep.ts similarity index 100% rename from packages/playground/hmr/dynamic-import/dep.ts rename to packages/playground/hmr/counter/dep.ts diff --git a/packages/playground/hmr/dynamic-import/index.html b/packages/playground/hmr/counter/index.html similarity index 100% rename from packages/playground/hmr/dynamic-import/index.html rename to packages/playground/hmr/counter/index.html diff --git a/packages/playground/hmr/dynamic-import/index.ts b/packages/playground/hmr/counter/index.ts similarity index 100% rename from packages/playground/hmr/dynamic-import/index.ts rename to packages/playground/hmr/counter/index.ts diff --git a/packages/vite/src/node/server/moduleGraph.ts b/packages/vite/src/node/server/moduleGraph.ts index e470fafb05d8fd..a6c5bfa0ab121f 100644 --- a/packages/vite/src/node/server/moduleGraph.ts +++ b/packages/vite/src/node/server/moduleGraph.ts @@ -2,6 +2,7 @@ import { extname } from 'path' import type { ModuleInfo, PartialResolvedId } from 'rollup' import { parse as parseUrl } from 'url' import { isDirectCSSRequest } from '../plugins/css' +import { isHTMLRequest } from '../plugins/html' import { cleanUrl, normalizePath, @@ -37,6 +38,12 @@ export class ModuleNode { constructor(url: string) { this.url = url this.type = isDirectCSSRequest(url) ? 'css' : 'js' + // #7870 + // The `isSelfAccepting` value is set by importAnalysis, but HTML + // assets don't go through importAnalysis. + if (isHTMLRequest(url)) { + this.isSelfAccepting = false + } } } From 54728e388dca032903569e6de6dbaa2e6f886279 Mon Sep 17 00:00:00 2001 From: jsyanyang <94437201+jsyanyang@users.noreply.github.com> Date: Mon, 25 Apr 2022 18:43:17 +0800 Subject: [PATCH 0588/1287] fix: spelling mistakes (#7883) --- packages/vite/src/node/server/ws.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/node/server/ws.ts b/packages/vite/src/node/server/ws.ts index 6d4e66ec1a22ae..17187ca6e282ac 100644 --- a/packages/vite/src/node/server/ws.ts +++ b/packages/vite/src/node/server/ws.ts @@ -149,7 +149,7 @@ export function createWebSocketServer( if (!parsed || parsed.type !== 'custom' || !parsed.event) return const listeners = customListeners.get(parsed.event) if (!listeners?.size) return - const client = getSocketClent(socket) + const client = getSocketClient(socket) listeners.forEach((listener) => listener(parsed.data, client)) }) socket.send(JSON.stringify({ type: 'connected' })) @@ -170,7 +170,7 @@ export function createWebSocketServer( // Provide a wrapper to the ws client so we can send messages in JSON format // To be consistent with server.ws.send - function getSocketClent(socket: WebSocketRaw) { + function getSocketClient(socket: WebSocketRaw) { if (!clientsMap.has(socket)) { clientsMap.set(socket, { send: (...args) => { @@ -217,7 +217,7 @@ export function createWebSocketServer( }) as WebSocketServer['off'], get clients() { - return new Set(Array.from(wss.clients).map(getSocketClent)) + return new Set(Array.from(wss.clients).map(getSocketClient)) }, send(...args: any[]) { From 0d2089c6876bcc04a46c3f7947ce4effc91dd9fd Mon Sep 17 00:00:00 2001 From: Rom Date: Mon, 25 Apr 2022 12:47:18 +0200 Subject: [PATCH 0589/1287] fix: set `isSelfAccepting` to `false` for any asset not processed by importAnalysis (#7898) --- packages/vite/src/node/plugins/importAnalysis.ts | 5 +++-- packages/vite/src/node/server/moduleGraph.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/vite/src/node/plugins/importAnalysis.ts b/packages/vite/src/node/plugins/importAnalysis.ts index 31e9cd76faa8a0..d8bf59225fd49a 100644 --- a/packages/vite/src/node/plugins/importAnalysis.ts +++ b/packages/vite/src/node/plugins/importAnalysis.ts @@ -59,7 +59,8 @@ const debug = createDebugger('vite:import-analysis') const clientDir = normalizePath(CLIENT_DIR) const skipRE = /\.(map|json)$/ -const canSkip = (id: string) => skipRE.test(id) || isDirectCSSRequest(id) +export const canSkipImportAnalysis = (id: string) => + skipRE.test(id) || isDirectCSSRequest(id) const optimizedDepChunkRE = /\/chunk-[A-Z0-9]{8}\.js/ const optimizedDepDynamicRE = /-[A-Z0-9]{8}\.js/ @@ -131,7 +132,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin { const ssr = options?.ssr === true const prettyImporter = prettifyUrl(importer, root) - if (canSkip(importer)) { + if (canSkipImportAnalysis(importer)) { isDebug && debug(colors.dim(`[skipped] ${prettyImporter}`)) return null } diff --git a/packages/vite/src/node/server/moduleGraph.ts b/packages/vite/src/node/server/moduleGraph.ts index a6c5bfa0ab121f..9c9f0d84bb738f 100644 --- a/packages/vite/src/node/server/moduleGraph.ts +++ b/packages/vite/src/node/server/moduleGraph.ts @@ -11,6 +11,7 @@ import { } from '../utils' import { FS_PREFIX } from '../constants' import type { TransformResult } from './transformRequest' +import { canSkipImportAnalysis } from '../plugins/importAnalysis' export class ModuleNode { /** @@ -39,9 +40,9 @@ export class ModuleNode { this.url = url this.type = isDirectCSSRequest(url) ? 'css' : 'js' // #7870 - // The `isSelfAccepting` value is set by importAnalysis, but HTML + // The `isSelfAccepting` value is set by importAnalysis, but some // assets don't go through importAnalysis. - if (isHTMLRequest(url)) { + if (isHTMLRequest(url) || canSkipImportAnalysis(url)) { this.isSelfAccepting = false } } From e474381646b1b7c8802787ae3838241a890230a5 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Tue, 26 Apr 2022 02:54:18 +0800 Subject: [PATCH 0590/1287] fix: preview jsdoc params (#7903) --- packages/vite/src/node/preview.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/vite/src/node/preview.ts b/packages/vite/src/node/preview.ts index c00f62a9cb8f0c..c1670c5d7efa72 100644 --- a/packages/vite/src/node/preview.ts +++ b/packages/vite/src/node/preview.ts @@ -55,8 +55,6 @@ export interface PreviewServer { /** * Starts the Vite server in preview mode, to simulate a production deployment - * @param config - the resolved Vite config - * @param serverOptions - what host and port to use * @experimental */ export async function preview( From 3edd1af56e980aef56641a5a51cf2932bb580d41 Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 26 Apr 2022 06:23:34 +0100 Subject: [PATCH 0591/1287] docs: update link to postcss-nesting repo (#7885) --- docs/guide/features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/features.md b/docs/guide/features.md index 06d282ae94ecd7..1a8c03bbd0be22 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -187,7 +187,7 @@ document.getElementById('foo').className = applyColor ### CSS Pre-processors -Because Vite targets modern browsers only, it is recommended to use native CSS variables with PostCSS plugins that implement CSSWG drafts (e.g. [postcss-nesting](https://github.com/jonathantneal/postcss-nesting)) and author plain, future-standards-compliant CSS. +Because Vite targets modern browsers only, it is recommended to use native CSS variables with PostCSS plugins that implement CSSWG drafts (e.g. [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting)) and author plain, future-standards-compliant CSS. That said, Vite does provide built-in support for `.scss`, `.sass`, `.less`, `.styl` and `.stylus` files. There is no need to install Vite-specific plugins for them, but the corresponding pre-processor itself must be installed: From ef903d607c73f0ad003afa7f02613663d9ca7561 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Tue, 26 Apr 2022 17:30:00 +0200 Subject: [PATCH 0592/1287] release: v2.9.6 --- packages/vite/CHANGELOG.md | 25 +++++++++++++++++++++++++ packages/vite/package.json | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 084a6363109266..c2dc1488d84b21 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,28 @@ +## 2.9.6 (2022-04-26) + +* fix: `apply` condition skipped for nested plugins (#7741) ([1f2ca53](https://github.com/vitejs/vite/commit/1f2ca53)), closes [#7741](https://github.com/vitejs/vite/issues/7741) +* fix: clean string regexp (#7871) ([ecc78bc](https://github.com/vitejs/vite/commit/ecc78bc)), closes [#7871](https://github.com/vitejs/vite/issues/7871) +* fix: escape character in string regexp match (#7834) ([1d468c8](https://github.com/vitejs/vite/commit/1d468c8)), closes [#7834](https://github.com/vitejs/vite/issues/7834) +* fix: HMR propagation of HTML changes (fix #7870) (#7895) ([1f7855c](https://github.com/vitejs/vite/commit/1f7855c)), closes [#7870](https://github.com/vitejs/vite/issues/7870) [#7895](https://github.com/vitejs/vite/issues/7895) +* fix: modulepreload polyfill only during build (fix #4786) (#7816) ([709776f](https://github.com/vitejs/vite/commit/709776f)), closes [#4786](https://github.com/vitejs/vite/issues/4786) [#7816](https://github.com/vitejs/vite/issues/7816) +* fix: new SharedWorker syntax (#7800) ([474d5c2](https://github.com/vitejs/vite/commit/474d5c2)), closes [#7800](https://github.com/vitejs/vite/issues/7800) +* fix: node v18 support (#7812) ([fc89057](https://github.com/vitejs/vite/commit/fc89057)), closes [#7812](https://github.com/vitejs/vite/issues/7812) +* fix: preview jsdoc params (#7903) ([e474381](https://github.com/vitejs/vite/commit/e474381)), closes [#7903](https://github.com/vitejs/vite/issues/7903) +* fix: replace import.meta.url correctly (#7792) ([12d1194](https://github.com/vitejs/vite/commit/12d1194)), closes [#7792](https://github.com/vitejs/vite/issues/7792) +* fix: set `isSelfAccepting` to `false` for any asset not processed by importAnalysis (#7898) ([0d2089c](https://github.com/vitejs/vite/commit/0d2089c)), closes [#7898](https://github.com/vitejs/vite/issues/7898) +* fix: spelling mistakes (#7883) ([54728e3](https://github.com/vitejs/vite/commit/54728e3)), closes [#7883](https://github.com/vitejs/vite/issues/7883) +* fix: ssr.noExternal with boolean values (#7813) ([0b2d307](https://github.com/vitejs/vite/commit/0b2d307)), closes [#7813](https://github.com/vitejs/vite/issues/7813) +* fix: style use string instead of js import (#7786) ([ba43c29](https://github.com/vitejs/vite/commit/ba43c29)), closes [#7786](https://github.com/vitejs/vite/issues/7786) +* fix: update sourcemap in importAnalysisBuild (#7825) ([d7540c8](https://github.com/vitejs/vite/commit/d7540c8)), closes [#7825](https://github.com/vitejs/vite/issues/7825) +* fix(ssr): rewrite dynamic class method name (fix #7751) (#7757) ([b89974a](https://github.com/vitejs/vite/commit/b89974a)), closes [#7751](https://github.com/vitejs/vite/issues/7751) [#7757](https://github.com/vitejs/vite/issues/7757) +* chore: code structure (#7790) ([5f7fe00](https://github.com/vitejs/vite/commit/5f7fe00)), closes [#7790](https://github.com/vitejs/vite/issues/7790) +* chore: fix worker sourcemap output style (#7805) ([17f3be7](https://github.com/vitejs/vite/commit/17f3be7)), closes [#7805](https://github.com/vitejs/vite/issues/7805) +* chore(deps): update all non-major dependencies (#7780) ([eba9d05](https://github.com/vitejs/vite/commit/eba9d05)), closes [#7780](https://github.com/vitejs/vite/issues/7780) +* chore(deps): update all non-major dependencies (#7847) ([e29d1d9](https://github.com/vitejs/vite/commit/e29d1d9)), closes [#7847](https://github.com/vitejs/vite/issues/7847) +* feat: enable optimizeDeps.esbuildOptions.loader (#6840) ([af8ca60](https://github.com/vitejs/vite/commit/af8ca60)), closes [#6840](https://github.com/vitejs/vite/issues/6840) + + + ## 2.9.5 (2022-04-14) * fix: revert #7582, fix #7721 and #7736 (#7737) ([fa86d69](https://github.com/vitejs/vite/commit/fa86d69)), closes [#7721](https://github.com/vitejs/vite/issues/7721) [#7736](https://github.com/vitejs/vite/issues/7736) [#7737](https://github.com/vitejs/vite/issues/7737) diff --git a/packages/vite/package.json b/packages/vite/package.json index 2d65cc1c330cad..b2caecf4e228ca 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.9.5", + "version": "2.9.6", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From b092697fd1d91710f16ffe7dcca4001fb794dcec Mon Sep 17 00:00:00 2001 From: yoho <907415276@qq.com> Date: Wed, 27 Apr 2022 03:45:07 +0800 Subject: [PATCH 0593/1287] fix(worker): import.meta.* (#7706) --- .../worker/__tests__/es/es-worker.spec.ts | 27 +++++++++++++++-- .../worker/__tests__/iife/worker.spec.ts | 24 +++++++++++---- .../sourcemap-hidden-worker.spec.ts | 2 +- .../sourcemap-inline-worker.spec.ts | 2 +- .../sourcemap/sourcemap-worker.spec.ts | 2 +- .../worker/classic-shared-worker.js | 3 ++ packages/playground/worker/classic-worker.js | 3 ++ .../emit-chunk-dynamic-import-worker.js | 5 +++- .../worker/emit-chunk-nested-worker.js | 3 ++ .../worker/emit-chunk-sub-worker.js | 3 ++ .../worker/importMetaGlob.worker.js | 8 +++++ .../worker/importMetaGlobEager.worker.js | 8 +++++ packages/playground/worker/index.html | 29 ++++++++++++++++++- .../playground/worker/module-and-worker.js | 5 +++- .../worker/modules/{module.js => module0.js} | 0 packages/playground/worker/modules/module2.js | 2 +- packages/playground/worker/modules/module3.js | 2 +- .../playground/worker/my-shared-worker.ts | 3 ++ packages/playground/worker/my-worker.ts | 3 ++ .../worker/possible-ts-output-worker.mjs | 3 ++ packages/playground/worker/sub-worker.js | 5 +++- .../playground/worker/url-shared-worker.js | 5 +++- packages/playground/worker/url-worker.js | 5 +++- .../playground/worker/worker-nested-worker.js | 22 ++++++++++++-- .../worker/worker/main-format-es.js | 9 ++++++ .../playground/worker/worker/main-module.js | 16 ++++++++++ .../src/node/plugins/importAnalysisBuild.ts | 19 ++++++++---- packages/vite/src/node/plugins/worker.ts | 29 ++++++++++++------- 28 files changed, 209 insertions(+), 38 deletions(-) create mode 100644 packages/playground/worker/importMetaGlob.worker.js create mode 100644 packages/playground/worker/importMetaGlobEager.worker.js rename packages/playground/worker/modules/{module.js => module0.js} (100%) diff --git a/packages/playground/worker/__tests__/es/es-worker.spec.ts b/packages/playground/worker/__tests__/es/es-worker.spec.ts index a815596721c268..27f81b010df74f 100644 --- a/packages/playground/worker/__tests__/es/es-worker.spec.ts +++ b/packages/playground/worker/__tests__/es/es-worker.spec.ts @@ -51,8 +51,12 @@ test.concurrent.each([[true], [false]])('shared worker', async (doTick) => { await waitSharedWorkerTick(page) }) -test('worker emitted', async () => { - await untilUpdated(() => page.textContent('.nested-worker'), 'pong') +test('worker emitted and import.meta.url in nested worker (serve)', async () => { + expect(await page.textContent('.nested-worker')).toMatch('/worker-nested') + expect(await page.textContent('.nested-worker-module')).toMatch('/sub-worker') + expect(await page.textContent('.nested-worker-constructor')).toMatch( + '"type":"constructor"' + ) }) if (isBuild) { @@ -60,7 +64,7 @@ if (isBuild) { // assert correct files test('inlined code generation', async () => { const files = fs.readdirSync(assetsDir) - expect(files.length).toBe(21) + expect(files.length).toBe(26) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const worker = files.find((f) => f.includes('my-worker')) @@ -79,6 +83,15 @@ if (isBuild) { expect(content).toMatch(`(window.URL||window.webkitURL).createObjectURL`) expect(content).toMatch(`window.Blob`) }) + + test('worker emitted and import.meta.url in nested worker (build)', async () => { + expect(await page.textContent('.nested-worker-module')).toMatch( + '"type":"module"' + ) + expect(await page.textContent('.nested-worker-constructor')).toMatch( + '"type":"constructor"' + ) + }) } test('module worker', async () => { @@ -100,3 +113,11 @@ test('emit chunk', async () => { '"A string/es/"' ) }) + +test('import.meta.glob in worker', async () => { + expect(await page.textContent('.importMetaGlob-worker')).toMatch('["') +}) + +test('import.meta.globEager in worker', async () => { + expect(await page.textContent('.importMetaGlobEager-worker')).toMatch('["') +}) diff --git a/packages/playground/worker/__tests__/iife/worker.spec.ts b/packages/playground/worker/__tests__/iife/worker.spec.ts index 9be78d57edd702..16750a893cb073 100644 --- a/packages/playground/worker/__tests__/iife/worker.spec.ts +++ b/packages/playground/worker/__tests__/iife/worker.spec.ts @@ -51,10 +51,11 @@ test.concurrent.each([[true], [false]])('shared worker', async (doTick) => { await waitSharedWorkerTick(page) }) -test('worker emitted and import.meta.url in nested worker', async () => { - await untilUpdated( - () => page.textContent('.nested-worker'), - 'pong http://localhost:3000/iife/sub-worker.js?worker_file' +test('worker emitted and import.meta.url in nested worker (serve)', async () => { + expect(await page.textContent('.nested-worker')).toMatch('/worker-nested') + expect(await page.textContent('.nested-worker-module')).toMatch('/sub-worker') + expect(await page.textContent('.nested-worker-constructor')).toMatch( + '"type":"constructor"' ) }) @@ -63,7 +64,7 @@ if (isBuild) { // assert correct files test('inlined code generation', async () => { const files = fs.readdirSync(assetsDir) - expect(files.length).toBe(12) + expect(files.length).toBe(13) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const worker = files.find((f) => f.includes('my-worker')) @@ -82,6 +83,15 @@ if (isBuild) { expect(content).toMatch(`(window.URL||window.webkitURL).createObjectURL`) expect(content).toMatch(`window.Blob`) }) + + test('worker emitted and import.meta.url in nested worker (build)', async () => { + expect(await page.textContent('.nested-worker-module')).toMatch( + '"type":"module"' + ) + expect(await page.textContent('.nested-worker-constructor')).toMatch( + '"type":"constructor"' + ) + }) } test('module worker', async () => { @@ -94,3 +104,7 @@ test('classic worker', async () => { expect(await page.textContent('.classic-worker')).toMatch('A classic') expect(await page.textContent('.classic-shared-worker')).toMatch('A classic') }) + +test('import.meta.globEager in worker', async () => { + expect(await page.textContent('.importMetaGlobEager-worker')).toMatch('["') +}) diff --git a/packages/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts b/packages/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts index 1797ac5269e411..e4cb3318ebd5f5 100644 --- a/packages/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts +++ b/packages/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts @@ -9,7 +9,7 @@ if (isBuild) { test('sourcemap generation for web workers', async () => { const files = fs.readdirSync(assetsDir) // should have 2 worker chunk - expect(files.length).toBe(24) + expect(files.length).toBe(26) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const indexSourcemap = getSourceMapUrl(content) diff --git a/packages/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts b/packages/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts index 89af0878213ab9..ceda7dae1fec7c 100644 --- a/packages/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts +++ b/packages/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts @@ -9,7 +9,7 @@ if (isBuild) { test('sourcemap generation for web workers', async () => { const files = fs.readdirSync(assetsDir) // should have 2 worker chunk - expect(files.length).toBe(12) + expect(files.length).toBe(13) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const indexSourcemap = getSourceMapUrl(content) diff --git a/packages/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts b/packages/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts index 24af73d5e3edfa..04cc079b4bc289 100644 --- a/packages/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts +++ b/packages/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts @@ -9,7 +9,7 @@ if (isBuild) { test('sourcemap generation for web workers', async () => { const files = fs.readdirSync(assetsDir) // should have 2 worker chunk - expect(files.length).toBe(24) + expect(files.length).toBe(26) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const indexSourcemap = getSourceMapUrl(content) diff --git a/packages/playground/worker/classic-shared-worker.js b/packages/playground/worker/classic-shared-worker.js index 8bd39e194f0618..e629208f05cf0a 100644 --- a/packages/playground/worker/classic-shared-worker.js +++ b/packages/playground/worker/classic-shared-worker.js @@ -4,3 +4,6 @@ self.onconnect = (event) => { const port = event.ports[0] port.postMessage(self.constant) } + +// for sourcemap +console.log('classic-shared-worker.js') diff --git a/packages/playground/worker/classic-worker.js b/packages/playground/worker/classic-worker.js index 0700428ee0c80b..238857acf00a58 100644 --- a/packages/playground/worker/classic-worker.js +++ b/packages/playground/worker/classic-worker.js @@ -3,3 +3,6 @@ importScripts(`/${self.location.pathname.split("/")[1]}/classic.js`) self.addEventListener('message', () => { self.postMessage(self.constant) }) + +// for sourcemap +console.log("classic-worker.js") diff --git a/packages/playground/worker/emit-chunk-dynamic-import-worker.js b/packages/playground/worker/emit-chunk-dynamic-import-worker.js index f96e0b15d26497..9c3ede1faa2ed9 100644 --- a/packages/playground/worker/emit-chunk-dynamic-import-worker.js +++ b/packages/playground/worker/emit-chunk-dynamic-import-worker.js @@ -1,3 +1,6 @@ -import('./modules/module').then((module) => { +import('./modules/module0').then((module) => { self.postMessage(module.default + import.meta.env.BASE_URL) }) + +// for sourcemap +console.log('emit-chunk-dynamic-import-worker.js') diff --git a/packages/playground/worker/emit-chunk-nested-worker.js b/packages/playground/worker/emit-chunk-nested-worker.js index 6cb72b9488cfaf..629322033f3d9b 100644 --- a/packages/playground/worker/emit-chunk-nested-worker.js +++ b/packages/playground/worker/emit-chunk-nested-worker.js @@ -26,3 +26,6 @@ import('./module-and-worker').then((res) => { data: res.module }) }) + +// for sourcemap +console.log('emit-chunk-nested-worker.js') diff --git a/packages/playground/worker/emit-chunk-sub-worker.js b/packages/playground/worker/emit-chunk-sub-worker.js index 5d20becc781dd7..60d302e20bbb8a 100644 --- a/packages/playground/worker/emit-chunk-sub-worker.js +++ b/packages/playground/worker/emit-chunk-sub-worker.js @@ -6,3 +6,6 @@ Promise.all([ const _data = { ...data[0], ...data[1], ...data[2] } self.postMessage(_data) }) + +// for sourcemap +console.log('emit-chunk-sub-worker.js') diff --git a/packages/playground/worker/importMetaGlob.worker.js b/packages/playground/worker/importMetaGlob.worker.js new file mode 100644 index 00000000000000..074a986c9bd808 --- /dev/null +++ b/packages/playground/worker/importMetaGlob.worker.js @@ -0,0 +1,8 @@ +const modules = import.meta.glob('./modules/*js') + +self.onmessage = function (e) { + self.postMessage(Object.keys(modules)) +} + +// for sourcemap +console.log('importMetaGlob.worker.js') diff --git a/packages/playground/worker/importMetaGlobEager.worker.js b/packages/playground/worker/importMetaGlobEager.worker.js new file mode 100644 index 00000000000000..7947f65ab8c7f9 --- /dev/null +++ b/packages/playground/worker/importMetaGlobEager.worker.js @@ -0,0 +1,8 @@ +const modules = import.meta.globEager('./modules/*js') + +self.onmessage = function (e) { + self.postMessage(Object.keys(modules)) +} + +// for sourcemap +console.log('importMetaGlobEager.worker.js') diff --git a/packages/playground/worker/index.html b/packages/playground/worker/index.html index 602aa3d06bfcac..b0c524305fc33e 100644 --- a/packages/playground/worker/index.html +++ b/packages/playground/worker/index.html @@ -40,11 +40,25 @@

format iife:

- import NestedWorker from './worker-nested-worker?worker' - nested worker + import NestedWorker from './worker-nested-worker?worker' - import.meta.url .nested-worker

+

+ import NestedWorker from './worker-nested-worker?worker' - nested module + worker + .nested-worker-module +

+ + +

+ import NestedWorker from './worker-nested-worker?worker' - nested worker + constructor + .nested-worker-constructor +

+ +

new Worker(new URL('./classic-worker.js', import.meta.url)) .classic-worker @@ -58,9 +72,22 @@

format iife:

+

+ use import.meta.globEager in iife worker + .importMetaGlobEager-worker +

+ +
+

+

+ use import.meta.glob in es worker + .importMetaGlob-worker +

+ +

worker emit chunk
module and worker:worker in worker file
diff --git a/packages/playground/worker/module-and-worker.js b/packages/playground/worker/module-and-worker.js index 659e556f08e4a6..036dcdf4edf11d 100644 --- a/packages/playground/worker/module-and-worker.js +++ b/packages/playground/worker/module-and-worker.js @@ -1,5 +1,8 @@ -import constant from './modules/module' +import constant from './modules/module0' self.postMessage(constant) export const module = 'module and worker' + +// for sourcemap +console.log('module-and-worker.js') diff --git a/packages/playground/worker/modules/module.js b/packages/playground/worker/modules/module0.js similarity index 100% rename from packages/playground/worker/modules/module.js rename to packages/playground/worker/modules/module0.js diff --git a/packages/playground/worker/modules/module2.js b/packages/playground/worker/modules/module2.js index 60447933b8b16e..70c0fc94586ffd 100644 --- a/packages/playground/worker/modules/module2.js +++ b/packages/playground/worker/modules/module2.js @@ -1,3 +1,3 @@ -export * from './module' +export * from './module0' export * from './module1' export const msg2 = 'module2' diff --git a/packages/playground/worker/modules/module3.js b/packages/playground/worker/modules/module3.js index 33355423bc030e..65f7e274da3242 100644 --- a/packages/playground/worker/modules/module3.js +++ b/packages/playground/worker/modules/module3.js @@ -1,2 +1,2 @@ -export * from './module' +export * from './module0' export const msg3 = 'module3' diff --git a/packages/playground/worker/my-shared-worker.ts b/packages/playground/worker/my-shared-worker.ts index cd5b24f265b955..caab5257394266 100644 --- a/packages/playground/worker/my-shared-worker.ts +++ b/packages/playground/worker/my-shared-worker.ts @@ -14,3 +14,6 @@ onconnect = (event) => { } } } + +// for sourcemap +console.log('my-shared-worker.js') diff --git a/packages/playground/worker/my-worker.ts b/packages/playground/worker/my-worker.ts index dd6061885128c7..553754f4901030 100644 --- a/packages/playground/worker/my-worker.ts +++ b/packages/playground/worker/my-worker.ts @@ -6,3 +6,6 @@ self.onmessage = (e) => { self.postMessage({ msg, mode, bundleWithPlugin }) } } + +// for sourcemap +console.log('my-worker.js') diff --git a/packages/playground/worker/possible-ts-output-worker.mjs b/packages/playground/worker/possible-ts-output-worker.mjs index 25f1a447617cd9..db76614bc78267 100644 --- a/packages/playground/worker/possible-ts-output-worker.mjs +++ b/packages/playground/worker/possible-ts-output-worker.mjs @@ -5,3 +5,6 @@ self.onmessage = (e) => { self.postMessage({ msg, mode }) } } + +// for sourcemap +console.log('possible-ts-output-worker.mjs') diff --git a/packages/playground/worker/sub-worker.js b/packages/playground/worker/sub-worker.js index eff49dfbb46ba6..37d5d4effabb27 100644 --- a/packages/playground/worker/sub-worker.js +++ b/packages/playground/worker/sub-worker.js @@ -1,5 +1,8 @@ self.onmessage = (event) => { if (event.data === 'ping') { - self.postMessage(`pong ${import.meta.url}`) + self.postMessage(`pong ${self.location.href}`) } } + +// for sourcemap +console.log('sub-worker.js') diff --git a/packages/playground/worker/url-shared-worker.js b/packages/playground/worker/url-shared-worker.js index 3535d5c277ec84..9ef32c58f6c64b 100644 --- a/packages/playground/worker/url-shared-worker.js +++ b/packages/playground/worker/url-shared-worker.js @@ -1,6 +1,9 @@ -import constant from './modules/module' +import constant from './modules/module0' self.onconnect = (event) => { const port = event.ports[0] port.postMessage(constant) } + +// for sourcemap +console.log('url-shared-worker.js') diff --git a/packages/playground/worker/url-worker.js b/packages/playground/worker/url-worker.js index c25cbefdff89ec..1ba50225ee339d 100644 --- a/packages/playground/worker/url-worker.js +++ b/packages/playground/worker/url-worker.js @@ -1 +1,4 @@ -self.postMessage('A string' + import.meta.env.BASE_URL + import.meta.url) +self.postMessage('A string' + import.meta.env.BASE_URL + self.location.url) + +// for sourcemap +console.log('url-worker.js') diff --git a/packages/playground/worker/worker-nested-worker.js b/packages/playground/worker/worker-nested-worker.js index 6d4d1e4969005f..e74d1db760409b 100644 --- a/packages/playground/worker/worker-nested-worker.js +++ b/packages/playground/worker/worker-nested-worker.js @@ -8,6 +8,24 @@ self.onmessage = (event) => { } } -subWorker.onmessage = (event) => { - self.postMessage(event.data) +self.postMessage(self.location.href) + +subWorker.onmessage = (ev) => { + self.postMessage({ + type: 'module', + data: ev.data + }) } + +const classicWorker = new Worker(new URL('./url-worker.js', import.meta.url), { + type: 'module' +}) +classicWorker.addEventListener('message', (ev) => { + self.postMessage({ + type: 'constructor', + data: ev.data + }) +}) + +// for sourcemap +console.log('worker-nested-worker.js') diff --git a/packages/playground/worker/worker/main-format-es.js b/packages/playground/worker/worker/main-format-es.js index 801c13469151a3..e418c82a136927 100644 --- a/packages/playground/worker/worker/main-format-es.js +++ b/packages/playground/worker/worker/main-format-es.js @@ -1,5 +1,6 @@ // run when format es import NestedWorker from '../emit-chunk-nested-worker?worker' +import ImportMetaGlobWorker from '../importMetaGlob.worker?worker' function text(el, text) { document.querySelector(el).textContent = text @@ -39,3 +40,11 @@ const moduleWorker = new Worker( moduleWorker.addEventListener('message', (ev) => { text('.module-and-worker-worker', JSON.stringify(ev.data)) }) + +const importMetaGlobWorker = new ImportMetaGlobWorker() + +importMetaGlobWorker.postMessage('1') + +importMetaGlobWorker.addEventListener('message', (e) => { + text('.importMetaGlob-worker', JSON.stringify(e.data)) +}) diff --git a/packages/playground/worker/worker/main-module.js b/packages/playground/worker/worker/main-module.js index 417cf1728c4b09..6284ca63686e99 100644 --- a/packages/playground/worker/worker/main-module.js +++ b/packages/playground/worker/worker/main-module.js @@ -3,6 +3,7 @@ import InlineWorker from '../my-worker?worker&inline' import mySharedWorker from '../my-shared-worker?sharedworker&name=shared' import TSOutputWorker from '../possible-ts-output-worker?worker' import NestedWorker from '../worker-nested-worker?worker' +import ImportMetaGlobEagerWorker from '../importMetaGlobEager.worker?worker' import { mode } from '../modules/workerImport' function text(el, text) { @@ -56,6 +57,13 @@ const nestedWorker = new NestedWorker() nestedWorker.addEventListener('message', (ev) => { if (typeof ev.data === 'string') { text('.nested-worker', JSON.stringify(ev.data)) + } else if (typeof ev.data === 'object') { + const data = ev.data + if (data.type === 'module') { + text('.nested-worker-module', JSON.stringify(ev.data)) + } else if (data.type === 'constructor') { + text('.nested-worker-constructor', JSON.stringify(ev.data)) + } } }) nestedWorker.postMessage('ping') @@ -83,3 +91,11 @@ w2.port.addEventListener('message', (ev) => { text('.shared-worker-import-meta-url', JSON.stringify(ev.data)) }) w2.port.start() + +const importMetaGlobEagerWorker = new ImportMetaGlobEagerWorker() + +importMetaGlobEagerWorker.postMessage('1') + +importMetaGlobEagerWorker.addEventListener('message', (e) => { + text('.importMetaGlobEager-worker', JSON.stringify(e.data)) +}) diff --git a/packages/vite/src/node/plugins/importAnalysisBuild.ts b/packages/vite/src/node/plugins/importAnalysisBuild.ts index 9f4c75025fff27..ff315d008f57a5 100644 --- a/packages/vite/src/node/plugins/importAnalysisBuild.ts +++ b/packages/vite/src/node/plugins/importAnalysisBuild.ts @@ -87,8 +87,8 @@ function preload(baseModule: () => Promise<{}>, deps?: string[]) { */ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin { const ssr = !!config.build.ssr - const insertPreload = !(ssr || !!config.build.lib) const isWorker = config.isWorker + const insertPreload = !(ssr || !!config.build.lib || isWorker) const scriptRel = config.build.polyfillModulePreload ? `'modulepreload'` @@ -123,11 +123,6 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin { return } - if (isWorker) { - // preload method use `document` and can't run in the worker - return - } - await init let imports: readonly ImportSpecifier[] = [] @@ -159,6 +154,18 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin { source.slice(start, end) === 'import.meta' && source.slice(end, end + 5) === '.glob' ) { + // es worker allow globEager / glob + // iife worker just allow globEager + if ( + isWorker && + config.worker.format === 'iife' && + source.slice(end, end + 10) !== '.globEager' + ) { + this.error( + '`import.meta.glob` is not supported in workers with `iife` format, use `import.meta.globEager` instead.', + end + ) + } const { importsString, exp, endIndex, isEager } = await transformImportGlob( source, diff --git a/packages/vite/src/node/plugins/worker.ts b/packages/vite/src/node/plugins/worker.ts index 4113b7153f9b35..5826980f5b0f72 100644 --- a/packages/vite/src/node/plugins/worker.ts +++ b/packages/vite/src/node/plugins/worker.ts @@ -58,6 +58,14 @@ function emitWorkerAssets( ) } +function emitWorkerSourcemap( + ctx: Rollup.TransformPluginContext, + config: ResolvedConfig, + asset: EmittedFile +) { + return emitWorkerFile(ctx, config, asset, 'assets') +} + function emitWorkerChunks( ctx: Rollup.TransformPluginContext, config: ResolvedConfig, @@ -138,14 +146,11 @@ function emitSourcemapForWorkerEntry( const contentHash = getAssetHash(content) const fileName = `${basename}.${contentHash}.js.map` const filePath = path.posix.join(config.build.assetsDir, fileName) - if (!context.cache.has(contentHash)) { - context.cache.set(contentHash, true) - context.emitFile({ - fileName: filePath, - type: 'asset', - source: data - }) - } + emitWorkerSourcemap(context, config, { + fileName: filePath, + type: 'asset', + source: data + }) // Emit the comment that tells the JS debugger where it can find the // sourcemap file. @@ -154,7 +159,10 @@ function emitSourcemapForWorkerEntry( if (config.build.sourcemap === true) { // inline web workers need to use the full sourcemap path // non-inline web workers can use a relative path - const sourceMapUrl = query?.inline != null ? filePath : fileName + const sourceMapUrl = + query?.inline != null + ? path.posix.join(config.base, filePath) + : fileName code += `//# sourceMappingURL=${sourceMapUrl}` } } @@ -194,7 +202,6 @@ export async function workerFileToUrl( export function webWorkerPlugin(config: ResolvedConfig): Plugin { const isBuild = config.command === 'build' - const isWorker = config.isWorker return { name: 'vite:worker', @@ -279,7 +286,7 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin { }, renderChunk(code) { - if (isWorker && code.includes('import.meta.url')) { + if (config.isWorker && code.includes('import.meta.url')) { return code.replace('import.meta.url', 'self.location.href') } } From 5c1ee5abf987e25bd39d5af8013ed907a33d4d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 27 Apr 2022 17:23:48 +0900 Subject: [PATCH 0594/1287] docs: `server.origin` config trailing slash (fix #6622) (#7865) --- docs/config/index.md | 2 +- packages/vite/src/node/config.ts | 2 +- packages/vite/src/node/server/index.ts | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index bab7df7a144987..aaa5dcd47ad361 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -706,7 +706,7 @@ Defines the origin of the generated asset URLs during development. ```js export default defineConfig({ server: { - origin: 'http://127.0.0.1:8080/' + origin: 'http://127.0.0.1:8080' } }) ``` diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index d242ac632c220e..27a107f3e2098c 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -461,7 +461,7 @@ export async function resolveConfig( ) : '' - const server = resolveServerOptions(resolvedRoot, config.server) + const server = resolveServerOptions(resolvedRoot, config.server, logger) const optimizeDeps = config.optimizeDeps || {} diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index 99aefea6de292a..29f57adeb5c752 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -56,6 +56,7 @@ import type { OptimizedDeps } from '../optimizer' import { resolveHostname } from '../utils' import { searchForWorkspaceRoot } from './searchRoot' import { CLIENT_DIR } from '../constants' +import type { Logger } from '../logger' import { printCommonServerUrls } from '../logger' import { performance } from 'perf_hooks' import { invalidatePackageData } from '../packages' @@ -92,6 +93,8 @@ export interface ServerOptions extends CommonServerOptions { fs?: FileSystemServeOptions /** * Origin for the generated asset URLs. + * + * @example `http://127.0.0.1:8080` */ origin?: string /** @@ -701,7 +704,8 @@ function resolvedAllowDir(root: string, dir: string): string { export function resolveServerOptions( root: string, - raw?: ServerOptions + raw: ServerOptions | undefined, + logger: Logger ): ResolvedServerOptions { const server: ResolvedServerOptions = { preTransformRequests: true, @@ -727,6 +731,18 @@ export function resolveServerOptions( allow: allowDirs, deny } + + if (server.origin?.endsWith('/')) { + server.origin = server.origin.slice(0, -1) + logger.warn( + colors.yellow( + `${colors.bold('(!)')} server.origin should not end with "/". Using "${ + server.origin + }" instead.` + ) + ) + } + return server } From e48827f58bac0af2a564cacd8213195a9015f8a3 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Wed, 27 Apr 2022 20:16:58 +0800 Subject: [PATCH 0595/1287] fix(css): clean comments before hoist at rules (#7924) --- .../src/node/__tests__/plugins/css.spec.ts | 48 ++++++++++++++++++- packages/vite/src/node/cleanString.ts | 14 ++++-- packages/vite/src/node/plugins/css.ts | 37 +++++++------- 3 files changed, 78 insertions(+), 21 deletions(-) diff --git a/packages/vite/src/node/__tests__/plugins/css.spec.ts b/packages/vite/src/node/__tests__/plugins/css.spec.ts index 078cec2e0f3d77..e0d1f04a6510b2 100644 --- a/packages/vite/src/node/__tests__/plugins/css.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/css.spec.ts @@ -155,10 +155,54 @@ describe('hoist @ rules', () => { }) test('hoist @import and @charset', async () => { - const css = `.foo{color:red;}@import "bla";@charset "utf-8";.bar{color:grren;}@import "baz";` + const css = `.foo{color:red;}@import "bla";@charset "utf-8";.bar{color:green;}@import "baz";` const result = await hoistAtRules(css) expect(result).toBe( - `@charset "utf-8";@import "bla";@import "baz";.foo{color:red;}.bar{color:grren;}` + `@charset "utf-8";@import "bla";@import "baz";.foo{color:red;}.bar{color:green;}` + ) + }) + + test('dont hoist @import in comments', async () => { + const css = `.foo{color:red;}/* @import "bla"; */@import "bar";` + const result = await hoistAtRules(css) + expect(result).toBe(`@import "bar";.foo{color:red;}/* @import "bla"; */`) + }) + + test('dont hoist @charset in comments', async () => { + const css = `.foo{color:red;}/* @charset "utf-8"; */@charset "utf-8";` + const result = await hoistAtRules(css) + expect(result).toBe( + `@charset "utf-8";.foo{color:red;}/* @charset "utf-8"; */` + ) + }) + + test('dont hoist @import and @charset in comments', async () => { + const css = ` + .foo{color:red;} + /* + @import "bla"; + */ + @charset "utf-8"; + /* + @charset "utf-8"; + @import "bar"; + */ + @import "baz"; + ` + const result = await hoistAtRules(css) + expect(result).toBe( + `@charset "utf-8";@import "baz"; + .foo{color:red;} + /* + @import "bla"; + */ + + /* + @charset "utf-8"; + @import "bar"; + */ + + ` ) }) }) diff --git a/packages/vite/src/node/cleanString.ts b/packages/vite/src/node/cleanString.ts index 3d623dce79c0d3..9b9ef656f4e017 100644 --- a/packages/vite/src/node/cleanString.ts +++ b/packages/vite/src/node/cleanString.ts @@ -1,10 +1,14 @@ import type { RollupError } from 'rollup' +import { multilineCommentsRE, singlelineCommentsRE } from './utils' + // bank on the non-overlapping nature of regex matches and combine all filters into one giant regex // /`([^`\$\{\}]|\$\{(`|\g<1>)*\})*`/g can match nested string template // but js not support match expression(\g<0>). so clean string template(`...`) in other ways. -const stringsRE = /"([^"\r\n]|(?<=\\)")*"|'([^'\r\n]|(?<=\\)')*'/.source -const commentsRE = /\/\*(.|[\r\n])*?\*\/|\/\/.*/.source -const cleanerRE = new RegExp(`${stringsRE}|${commentsRE}`, 'g') +const stringsRE = /"([^"\r\n]|(?<=\\)")*"|'([^'\r\n]|(?<=\\)')*'/g +const cleanerRE = new RegExp( + `${stringsRE.source}|${multilineCommentsRE.source}|${singlelineCommentsRE.source}`, + 'g' +) const blankReplacer = (s: string) => ' '.repeat(s.length) const stringBlankReplacer = (s: string) => @@ -26,6 +30,10 @@ export function emptyString(raw: string): string { return res } +export function emptyCssComments(raw: string) { + return raw.replace(multilineCommentsRE, blankReplacer) +} + const enum LexerState { // template string inTemplateString, diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 83e18aabecdb33..fef1b6cb7ac515 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -48,6 +48,7 @@ import { transform, formatMessages } from 'esbuild' import { addToHTMLProxyTransformResult } from './html' import { injectSourcesContent, getCodeWithSourcemap } from '../server/sourcemap' import type { RawSourceMap } from '@ampproject/remapping' +import { emptyCssComments } from '../cleanString' // const debug = createDebugger('vite:css') @@ -1117,30 +1118,34 @@ async function minifyCSS(css: string, config: ResolvedConfig) { export async function hoistAtRules(css: string) { const s = new MagicString(css) + const cleanCss = emptyCssComments(css) + let match: RegExpExecArray | null + // #1845 // CSS @import can only appear at top of the file. We need to hoist all @import // to top when multiple files are concatenated. // match until semicolon that's not in quotes - s.replace( - /@import\s*(?:url\([^\)]*\)|"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|[^;]*).*?;/gm, - (match) => { - s.appendLeft(0, match) - return '' - } - ) + const atImportRE = + /@import\s*(?:url\([^\)]*\)|"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|[^;]*).*?;/gm + while ((match = atImportRE.exec(cleanCss))) { + s.remove(match.index, match.index + match[0].length) + // Use `appendLeft` instead of `prepend` to preserve original @import order + s.appendLeft(0, match[0]) + } + // #6333 // CSS @charset must be the top-first in the file, hoist the first to top + const atCharsetRE = + /@charset\s*(?:"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|[^;]*).*?;/gm let foundCharset = false - s.replace( - /@charset\s*(?:"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|[^;]*).*?;/gm, - (match) => { - if (!foundCharset) { - s.prepend(match) - foundCharset = true - } - return '' + while ((match = atCharsetRE.exec(cleanCss))) { + s.remove(match.index, match.index + match[0].length) + if (!foundCharset) { + s.prepend(match[0]) + foundCharset = true } - ) + } + return s.toString() } From 206e1f2cd48b86396f57338ad494da3e1939b647 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Thu, 28 Apr 2022 01:06:06 +0800 Subject: [PATCH 0596/1287] docs: clarify loadEnv (#7872) --- docs/config/index.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index aaa5dcd47ad361..7f051399d1a1e7 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -94,7 +94,7 @@ If the config needs to call async function, it can export a async function inste export default defineConfig(async ({ command, mode }) => { const data = await asyncFunction() return { - // build specific config + // vite config } }) ``` @@ -109,10 +109,14 @@ Note that Vite doesn't load `.env` files by default as the files to load can onl import { defineConfig, loadEnv } from 'vite' export default defineConfig(({ command, mode }) => { - // Load env file based on `mode` in the current working directory - const env = loadEnv(mode, process.cwd()) + // Load env file based on `mode` in the current working directory. + // Set the third parameter to '' to load all env regardless of the `VITE_` prefix. + const env = loadEnv(mode, process.cwd(), '') return { - // build specific config + // vite config + define: { + __APP_ENV__: env.APP_ENV + } } }) ``` From 50672e4f8bc6d23cef735b922e8e0439acb5fe27 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Thu, 28 Apr 2022 01:20:53 +0800 Subject: [PATCH 0597/1287] fix: use NODE_ENV in optimizer (#7673) --- packages/playground/optimize-deps/.env | 1 + .../optimize-deps/__tests__/optimize-deps.spec.ts | 4 ++++ packages/playground/optimize-deps/dep-node-env/index.js | 1 + packages/playground/optimize-deps/dep-node-env/package.json | 5 +++++ packages/playground/optimize-deps/index.html | 6 ++++++ packages/playground/optimize-deps/package.json | 1 + packages/vite/src/node/optimizer/index.ts | 4 ++-- pnpm-lock.yaml | 5 +++++ 8 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 packages/playground/optimize-deps/.env create mode 100644 packages/playground/optimize-deps/dep-node-env/index.js create mode 100644 packages/playground/optimize-deps/dep-node-env/package.json diff --git a/packages/playground/optimize-deps/.env b/packages/playground/optimize-deps/.env new file mode 100644 index 00000000000000..995fca4af2ee24 --- /dev/null +++ b/packages/playground/optimize-deps/.env @@ -0,0 +1 @@ +NODE_ENV=production \ No newline at end of file diff --git a/packages/playground/optimize-deps/__tests__/optimize-deps.spec.ts b/packages/playground/optimize-deps/__tests__/optimize-deps.spec.ts index d95a6d984cd9aa..e832408370969a 100644 --- a/packages/playground/optimize-deps/__tests__/optimize-deps.spec.ts +++ b/packages/playground/optimize-deps/__tests__/optimize-deps.spec.ts @@ -62,6 +62,10 @@ test('import * from optimized dep', async () => { expect(await page.textContent('.import-star')).toMatch(`[success]`) }) +test('import from dep with process.env.NODE_ENV', async () => { + expect(await page.textContent('.node-env')).toMatch(`prod`) +}) + test('import from dep with .notjs files', async () => { expect(await page.textContent('.not-js')).toMatch(`[success]`) }) diff --git a/packages/playground/optimize-deps/dep-node-env/index.js b/packages/playground/optimize-deps/dep-node-env/index.js new file mode 100644 index 00000000000000..8548c37894539f --- /dev/null +++ b/packages/playground/optimize-deps/dep-node-env/index.js @@ -0,0 +1 @@ +export const env = process.env.NODE_ENV === 'production' ? 'prod' : 'dev' diff --git a/packages/playground/optimize-deps/dep-node-env/package.json b/packages/playground/optimize-deps/dep-node-env/package.json new file mode 100644 index 00000000000000..59a00fb153c522 --- /dev/null +++ b/packages/playground/optimize-deps/dep-node-env/package.json @@ -0,0 +1,5 @@ +{ + "name": "dep-node-env", + "private": true, + "version": "1.0.0" +} diff --git a/packages/playground/optimize-deps/index.html b/packages/playground/optimize-deps/index.html index 2be896d00acba9..521d54379863d9 100644 --- a/packages/playground/optimize-deps/index.html +++ b/packages/playground/optimize-deps/index.html @@ -38,6 +38,9 @@

Optimizing force included dep even when it's linked

import * as ...

+

Import from dependency with process.env.NODE_ENV

+
+

Import from dependency with .notjs files

@@ -88,6 +91,9 @@

Reused variable names

text('.import-star', `[success] ${keys.join(', ')}`) } + import { env } from 'dep-node-env' + text('.node-env', env) + import { notjsValue } from 'dep-not-js' text('.not-js', notjsValue) diff --git a/packages/playground/optimize-deps/package.json b/packages/playground/optimize-deps/package.json index 2752e691da6fb2..904db5fc65f0ad 100644 --- a/packages/playground/optimize-deps/package.json +++ b/packages/playground/optimize-deps/package.json @@ -17,6 +17,7 @@ "dep-esbuild-plugin-transform": "file:./dep-esbuild-plugin-transform", "dep-linked": "link:./dep-linked", "dep-linked-include": "link:./dep-linked-include", + "dep-node-env": "file:./dep-node-env", "dep-not-js": "file:./dep-not-js", "dep-with-dynamic-import": "file:./dep-with-dynamic-import", "lodash-es": "^4.17.21", diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index 3828cb2fbce18b..4e4fb5a8c895ae 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -445,7 +445,7 @@ export async function runOptimizeDeps( } const define: Record = { - 'process.env.NODE_ENV': JSON.stringify(config.mode) + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || config.mode) } for (const key in config.define) { const value = config.define[key] @@ -790,7 +790,7 @@ export function getDepHash(config: ResolvedConfig): string { // only a subset of config options that can affect dep optimization content += JSON.stringify( { - mode: config.mode, + mode: process.env.NODE_ENV || config.mode, root: config.root, define: config.define, resolve: config.resolve, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ad65e136bd1b56..a0ee11e84690b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -317,6 +317,7 @@ importers: dep-esbuild-plugin-transform: file:./dep-esbuild-plugin-transform dep-linked: link:./dep-linked dep-linked-include: link:./dep-linked-include + dep-node-env: file:./dep-node-env dep-not-js: file:./dep-not-js dep-with-dynamic-import: file:./dep-with-dynamic-import lodash-es: ^4.17.21 @@ -336,6 +337,7 @@ importers: dep-esbuild-plugin-transform: link:dep-esbuild-plugin-transform dep-linked: link:dep-linked dep-linked-include: link:dep-linked-include + dep-node-env: link:dep-node-env dep-not-js: link:dep-not-js dep-with-dynamic-import: link:dep-with-dynamic-import lodash-es: 4.17.21 @@ -371,6 +373,9 @@ importers: dependencies: react: 17.0.2 + packages/playground/optimize-deps/dep-node-env: + specifiers: {} + packages/playground/optimize-deps/dep-not-js: specifiers: {} From 7f535aca8e8683506b2535c3256292abce7b0615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Thu, 28 Apr 2022 03:43:27 +0900 Subject: [PATCH 0598/1287] chore(css): catch postcss config error (fix #2793) (#7934) --- packages/vite/src/node/plugins/css.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index fef1b6cb7ac515..f310abc9bc7c56 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -942,14 +942,22 @@ async function resolvePostcssConfig( plugins: inlineOptions.plugins || [] } } else { + const searchPath = + typeof inlineOptions === 'string' ? inlineOptions : config.root try { - const searchPath = - typeof inlineOptions === 'string' ? inlineOptions : config.root // @ts-ignore result = await postcssrc({}, searchPath) } catch (e) { if (!/No PostCSS Config found/.test(e.message)) { - throw e + if (e instanceof Error) { + const { name, message, stack } = e + e.name = 'Failed to load PostCSS config' + e.message = `Failed to load PostCSS config (searchPath: ${searchPath}): [${name}] ${message}\n${stack}` + e.stack = '' // add stack to message to retain stack + throw e + } else { + throw new Error(`Failed to load PostCSS config: ${e}`) + } } result = null } From 274c10eb9e9451620981da808e143bc50b8c2a38 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Thu, 28 Apr 2022 13:45:55 +0800 Subject: [PATCH 0599/1287] fix(css): support postcss.config.ts (#7935) --- packages/playground/tailwind/package.json | 3 ++- .../tailwind/{postcss.config.js => postcss.config.ts} | 2 +- packages/vite/rollup.config.js | 5 +++++ pnpm-lock.yaml | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) rename packages/playground/tailwind/{postcss.config.js => postcss.config.ts} (85%) diff --git a/packages/playground/tailwind/package.json b/packages/playground/tailwind/package.json index ff79908d386e96..1feeb8dfb89e31 100644 --- a/packages/playground/tailwind/package.json +++ b/packages/playground/tailwind/package.json @@ -15,6 +15,7 @@ "vue-router": "^4.0.0" }, "devDependencies": { - "@vitejs/plugin-vue": "workspace:*" + "@vitejs/plugin-vue": "workspace:*", + "ts-node": "^10.4.0" } } diff --git a/packages/playground/tailwind/postcss.config.js b/packages/playground/tailwind/postcss.config.ts similarity index 85% rename from packages/playground/tailwind/postcss.config.js rename to packages/playground/tailwind/postcss.config.ts index b73493f7f96fae..381d8cbd107f81 100644 --- a/packages/playground/tailwind/postcss.config.js +++ b/packages/playground/tailwind/postcss.config.ts @@ -1,4 +1,4 @@ -// postcss.config.js +// postcss.config.ts module.exports = { plugins: { tailwindcss: { config: __dirname + '/tailwind.config.js' }, diff --git a/packages/vite/rollup.config.js b/packages/vite/rollup.config.js index 31ab56cd07e02e..93f4f33bdec398 100644 --- a/packages/vite/rollup.config.js +++ b/packages/vite/rollup.config.js @@ -171,6 +171,11 @@ const createNodeConfig = (isProduction) => { 'lilconfig/dist/index.js': { pattern: /: require,/g, replacement: `: eval('require'),` + }, + // postcss-load-config calls require after register ts-node + 'postcss-load-config/src/index.js': { + src: `require(configFile)`, + replacement: `eval('require')(configFile)` } }), commonjs({ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a0ee11e84690b1..0f0711811935b6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -661,6 +661,7 @@ importers: '@vitejs/plugin-vue': workspace:* autoprefixer: ^10.4.0 tailwindcss: ^2.2.19 + ts-node: ^10.4.0 vue: ^3.2.25 vue-router: ^4.0.0 dependencies: @@ -670,6 +671,7 @@ importers: vue-router: 4.0.12_vue@3.2.26 devDependencies: '@vitejs/plugin-vue': link:../../plugin-vue + ts-node: 10.4.0_233d9fcfccc8abc8f146a08357d842da packages/playground/tailwind-sourcemap: specifiers: From 71b1443aa56c1e28959eaa40dc8a5fed652480c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Sat, 30 Apr 2022 03:23:51 +0900 Subject: [PATCH 0600/1287] chore: add core.symlinks description to CONTRIBUTING.md (#7962) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c7020c97a84c80..bed97a0d7d4300 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,7 +69,7 @@ And re-run `pnpm install` to link the package. Each package under `packages/playground/` contains a `__tests__` directory. The tests are run using [Jest](https://jestjs.io/) + [Playwright](https://playwright.dev/) with custom integrations to make writing tests simple. The detailed setup is inside `jest.config.js` and `scripts/jest*` files. -Before running the tests, make sure that [Vite has been built](#repo-setup). On Windows, you may want to [activate Developer Mode](https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) to solve [issues with symlink creation for non-admins](https://github.com/vitejs/vite/issues/7390). +Before running the tests, make sure that [Vite has been built](#repo-setup). On Windows, you may want to [activate Developer Mode](https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) to solve [issues with symlink creation for non-admins](https://github.com/vitejs/vite/issues/7390). Also you may want to [set git `core.symlinks` to `true` to solve issues with symlinks in git](https://github.com/vitejs/vite/issues/5242). Each test can be run under either dev server mode or build mode. From f7d2d713befe916c4d84b5e1705e20386948a61f Mon Sep 17 00:00:00 2001 From: patak Date: Sat, 30 Apr 2022 06:13:30 +0200 Subject: [PATCH 0601/1287] fix: inject esbuild helpers in IIFE and UMD wrappers (#7948) --- packages/playground/lib/__tests__/lib.spec.ts | 12 +++++++++ packages/playground/lib/src/main.js | 3 +++ packages/vite/src/node/plugins/esbuild.ts | 25 +++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/packages/playground/lib/__tests__/lib.spec.ts b/packages/playground/lib/__tests__/lib.spec.ts index 382fb16510ce6f..f1e93e90d8357b 100644 --- a/packages/playground/lib/__tests__/lib.spec.ts +++ b/packages/playground/lib/__tests__/lib.spec.ts @@ -9,10 +9,22 @@ if (isBuild) { test('umd', async () => { expect(await page.textContent('.umd')).toBe('It works') + const code = fs.readFileSync( + path.join(testDir, 'dist/my-lib-custom-filename.umd.js'), + 'utf-8' + ) + // esbuild helpers are injected inside of the UMD wrapper + expect(code).toMatch(/^\(function\(/) }) test('iife', async () => { expect(await page.textContent('.iife')).toBe('It works') + const code = fs.readFileSync( + path.join(testDir, 'dist/my-lib-custom-filename.iife.js'), + 'utf-8' + ) + // esbuild helpers are injected inside of the IIFE wrapper + expect(code).toMatch(/^var MyLib=function\(\){"use strict";/) }) test('Library mode does not include `preload`', async () => { diff --git a/packages/playground/lib/src/main.js b/packages/playground/lib/src/main.js index 2422edf5829a0e..cb2fb3b842dc4f 100644 --- a/packages/playground/lib/src/main.js +++ b/packages/playground/lib/src/main.js @@ -1,3 +1,6 @@ export default function myLib(sel) { + // Force esbuild spread helpers (https://github.com/evanw/esbuild/issues/951) + console.log({ ...'foo' }) + document.querySelector(sel).textContent = 'It works' } diff --git a/packages/vite/src/node/plugins/esbuild.ts b/packages/vite/src/node/plugins/esbuild.ts index 9e8bae24424d76..bc4a1f780a54d5 100644 --- a/packages/vite/src/node/plugins/esbuild.ts +++ b/packages/vite/src/node/plugins/esbuild.ts @@ -26,6 +26,11 @@ import { searchForWorkspaceRoot } from '..' const debug = createDebugger('vite:esbuild') +const INJECT_HELPERS_IIFE_RE = + /(.*)(var [^\s]+=function\(.*\){"use strict";)(.*)/ +const INJECT_HELPERS_UMD_RE = + /(.*)(\(function\(.*\){.+amd.+function\(.*\){"use strict";)(.*)/ + let server: ViteDevServer export interface ESBuildOptions extends TransformOptions { @@ -254,6 +259,26 @@ export const buildEsbuildPlugin = (config: ResolvedConfig): Plugin => { } : undefined) }) + + if (config.build.lib) { + // #7188, esbuild adds helpers out of the UMD and IIFE wrappers, and the + // names are minified potentially causing collision with other globals. + // We use a regex to inject the helpers inside the wrappers. + // We don't need to create a MagicString here because both the helpers and + // the headers don't modify the sourcemap + const injectHelpers = + opts.format === 'umd' + ? INJECT_HELPERS_UMD_RE + : opts.format === 'iife' + ? INJECT_HELPERS_IIFE_RE + : undefined + if (injectHelpers) { + res.code = res.code.replace( + injectHelpers, + (_, helpers, header, rest) => header + helpers + rest + ) + } + } return res } } From 2b4aab0bf45e9fb67aa8f5453a3db6beb7519c9f Mon Sep 17 00:00:00 2001 From: Tedy <1197633750@qq.com> Date: Sat, 30 Apr 2022 12:14:16 +0800 Subject: [PATCH 0602/1287] chore: fix typo (#7967) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bed97a0d7d4300..621f8de145835f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,7 +42,7 @@ Some errors are masked and hidden away because of the layers of abstraction and 1. In the sources panel in the right column, click the play button to resume execution and allow the tests to run which will open a Chromium instance. -1. Focusing the Chomium instance, you can open the browser devtools and inspect the console there to find the underlying problems. +1. Focusing the Chromium instance, you can open the browser devtools and inspect the console there to find the underlying problems. 1. To close everything, just stop the test process back in your terminal. From a9fa60b37e373adbf240b184fa801fa19aacfcf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Sat, 30 Apr 2022 13:15:45 +0900 Subject: [PATCH 0603/1287] chore: bump vue in ssr-vue (#7965) --- packages/playground/ssr-vue/package.json | 2 +- pnpm-lock.yaml | 37 ++++++++++++++---------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/packages/playground/ssr-vue/package.json b/packages/playground/ssr-vue/package.json index 4a385336a97603..02aa3b89bc0dbb 100644 --- a/packages/playground/ssr-vue/package.json +++ b/packages/playground/ssr-vue/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "example-external-component": "file:example-external-component", - "vue": "^3.2.25", + "vue": "^3.2.33", "vue-router": "^4.0.0", "vuex": "^4.0.2" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0f0711811935b6..73be476b1c911b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -622,14 +622,14 @@ importers: example-external-component: file:example-external-component express: ^4.17.1 serve-static: ^1.14.1 - vue: ^3.2.25 + vue: ^3.2.33 vue-router: ^4.0.0 vuex: ^4.0.2 dependencies: example-external-component: link:example-external-component - vue: 3.2.26 - vue-router: 4.0.12_vue@3.2.26 - vuex: 4.0.2_vue@3.2.26 + vue: 3.2.33 + vue-router: 4.0.12_vue@3.2.33 + vuex: 4.0.2_vue@3.2.33 devDependencies: '@vitejs/plugin-vue': link:../../plugin-vue '@vitejs/plugin-vue-jsx': link:../../plugin-vue-jsx @@ -2893,7 +2893,6 @@ packages: '@vue/shared': 3.2.33 estree-walker: 2.0.2 source-map: 0.6.1 - dev: true /@vue/compiler-dom/3.2.26: resolution: {integrity: sha512-smBfaOW6mQDxcT3p9TKT6mE22vjxjJL50GFVJiI0chXYGU/xzC05QRGrW3HHVuJrmLTLx5zBhsZ2dIATERbarg==} @@ -2912,7 +2911,6 @@ packages: dependencies: '@vue/compiler-core': 3.2.33 '@vue/shared': 3.2.33 - dev: true /@vue/compiler-sfc/3.2.26: resolution: {integrity: sha512-ePpnfktV90UcLdsDQUh2JdiTuhV0Skv2iYXxfNMOK/F3Q+2BO0AulcVcfoksOpTJGmhhfosWfMyEaEf0UaWpIw==} @@ -2955,7 +2953,6 @@ packages: magic-string: 0.25.7 postcss: 8.4.12 source-map: 0.6.1 - dev: true /@vue/compiler-ssr/3.2.26: resolution: {integrity: sha512-2mywLX0ODc4Zn8qBoA2PDCsLEZfpUGZcyoFRLSOjyGGK6wDy2/5kyDOWtf0S0UvtoyVq95OTSGIALjZ4k2q/ag==} @@ -2974,7 +2971,6 @@ packages: dependencies: '@vue/compiler-dom': 3.2.33 '@vue/shared': 3.2.33 - dev: true /@vue/devtools-api/6.0.0-beta.21.1: resolution: {integrity: sha512-FqC4s3pm35qGVeXRGOjTsRzlkJjrBLriDS9YXbflHLsfA9FrcKzIyWnLXoNm+/7930E8rRakXuAc2QkC50swAw==} @@ -3006,7 +3002,6 @@ packages: '@vue/shared': 3.2.33 estree-walker: 2.0.2 magic-string: 0.25.7 - dev: true /@vue/reactivity/3.2.26: resolution: {integrity: sha512-h38bxCZLW6oFJVDlCcAiUKFnXI8xP8d+eO0pcDxx+7dQfSPje2AO6M9S9QO6MrxQB7fGP0DH0dYQ8ksf6hrXKQ==} @@ -3022,7 +3017,6 @@ packages: resolution: {integrity: sha512-62Sq0mp9/0bLmDuxuLD5CIaMG2susFAGARLuZ/5jkU1FCf9EDbwUuF+BO8Ub3Rbodx0ziIecM/NsmyjardBxfQ==} dependencies: '@vue/shared': 3.2.33 - dev: true /@vue/runtime-core/3.2.26: resolution: {integrity: sha512-BcYi7qZ9Nn+CJDJrHQ6Zsmxei2hDW0L6AB4vPvUQGBm2fZyC0GXd/4nVbyA2ubmuhctD5RbYY8L+5GUJszv9mQ==} @@ -3041,7 +3035,6 @@ packages: dependencies: '@vue/reactivity': 3.2.33 '@vue/shared': 3.2.33 - dev: true /@vue/runtime-dom/3.2.26: resolution: {integrity: sha512-dY56UIiZI+gjc4e8JQBwAifljyexfVCkIAu/WX8snh8vSOt/gMSEGwPRcl2UpYpBYeyExV8WCbgvwWRNt9cHhQ==} @@ -3063,7 +3056,6 @@ packages: '@vue/runtime-core': 3.2.33 '@vue/shared': 3.2.33 csstype: 2.6.19 - dev: true /@vue/server-renderer/3.2.26_vue@3.2.26: resolution: {integrity: sha512-Jp5SggDUvvUYSBIvYEhy76t4nr1vapY/FIFloWmQzn7UxqaHrrBpbxrqPcTrSgGrcaglj0VBp22BKJNre4aA1w==} @@ -3091,7 +3083,6 @@ packages: '@vue/compiler-ssr': 3.2.33 '@vue/shared': 3.2.33 vue: 3.2.33 - dev: true /@vue/shared/3.2.26: resolution: {integrity: sha512-vPV6Cq+NIWbH5pZu+V+2QHE9y1qfuTq49uNWw4f7FDEeZaDU2H2cx5jcUZOAKW7qTrUS4k6qZPbMy1x4N96nbA==} @@ -3101,7 +3092,6 @@ packages: /@vue/shared/3.2.33: resolution: {integrity: sha512-UBc1Pg1T3yZ97vsA2ueER0F6GbJebLHYlEi4ou1H5YL4KWvMOOWwpYo9/QpWq93wxKG6Wo13IY74Hcn/f7c7Bg==} - dev: true /@wessberg/stringutil/1.0.19: resolution: {integrity: sha512-9AZHVXWlpN8Cn9k5BC/O0Dzb9E9xfEMXzYrNunwvkUTvuK7xgQPVRZpLo+jWCOZ5r8oBa8NIrHuPEu1hzbb6bg==} @@ -9537,6 +9527,15 @@ packages: vue: 3.2.26 dev: false + /vue-router/4.0.12_vue@3.2.33: + resolution: {integrity: sha512-CPXvfqe+mZLB1kBWssssTiWg4EQERyqJZes7USiqfW9B5N2x+nHlnsM1D3b5CaJ6qgCvMmYJnz+G0iWjNCvXrg==} + peerDependencies: + vue: ^3.0.0 + dependencies: + '@vue/devtools-api': 6.0.0-beta.21.1 + vue: 3.2.33 + dev: false + /vue/3.2.26: resolution: {integrity: sha512-KD4lULmskL5cCsEkfhERVRIOEDrfEL9CwAsLYpzptOGjaGFNWo3BQ9g8MAb7RaIO71rmVOziZ/uEN/rHwcUIhg==} dependencies: @@ -9563,7 +9562,6 @@ packages: '@vue/runtime-dom': 3.2.33 '@vue/server-renderer': 3.2.33_vue@3.2.33 '@vue/shared': 3.2.33 - dev: true /vuex/4.0.2_vue@3.2.26: resolution: {integrity: sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==} @@ -9574,6 +9572,15 @@ packages: vue: 3.2.26 dev: false + /vuex/4.0.2_vue@3.2.33: + resolution: {integrity: sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==} + peerDependencies: + vue: ^3.0.2 + dependencies: + '@vue/devtools-api': 6.0.0-beta.21.1 + vue: 3.2.33 + dev: false + /w3c-hr-time/1.0.2: resolution: {integrity: sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==} dependencies: From a30a5489ccac56ec668546af840984367c356a38 Mon Sep 17 00:00:00 2001 From: yoho Date: Sat, 30 Apr 2022 12:19:24 +0800 Subject: [PATCH 0604/1287] fix: inline style hmr, transform style code inplace (#7869) --- .../assets/__tests__/assets.spec.ts | 7 +- packages/playground/assets/index.html | 20 +++++- .../css-sourcemap/__tests__/serve.spec.ts | 62 ------------------ packages/playground/hmr/__tests__/hmr.spec.ts | 12 +++- packages/playground/hmr/icon.png | Bin 0 -> 3395 bytes packages/playground/hmr/index.html | 9 +++ packages/playground/ssr-html/index.html | 5 ++ packages/vite/src/node/plugins/css.ts | 9 ++- .../src/node/server/middlewares/indexHtml.ts | 41 ++++++++++-- 9 files changed, 91 insertions(+), 74 deletions(-) create mode 100644 packages/playground/hmr/icon.png diff --git a/packages/playground/assets/__tests__/assets.spec.ts b/packages/playground/assets/__tests__/assets.spec.ts index 75c0e57952db24..19dd52f71e114a 100644 --- a/packages/playground/assets/__tests__/assets.spec.ts +++ b/packages/playground/assets/__tests__/assets.spec.ts @@ -1,4 +1,3 @@ -import { createHash } from 'crypto' import { findAssetFile, getBg, @@ -296,6 +295,11 @@ describe('css and assets in css in build watch', () => { } }) +test('inline style test', async () => { + expect(await getBg('.inline-style')).toMatch(assetMatch) + expect(await getBg('.style-url-assets')).toMatch(assetMatch) +}) + if (!isBuild) { test('@import in html style tag hmr', async () => { await untilUpdated(() => getColor('.import-css'), 'rgb(0, 136, 255)') @@ -304,6 +308,7 @@ if (!isBuild) { (code) => code.replace('#0088ff', '#00ff88'), true ) + await page.waitForNavigation() await untilUpdated(() => getColor('.import-css'), 'rgb(0, 255, 136)') }) } diff --git a/packages/playground/assets/index.html b/packages/playground/assets/index.html index 6678a2da7c2106..99c2c2fe69ae70 100644 --- a/packages/playground/assets/index.html +++ b/packages/playground/assets/index.html @@ -207,7 +207,10 @@

url

background-size: 10px 10px; } -
+
inline style
use style class
@@ -235,6 +238,21 @@

import module css

+

style in svg

+ + + + + + + + diff --git a/packages/playground/css-sourcemap/__tests__/serve.spec.ts b/packages/playground/css-sourcemap/__tests__/serve.spec.ts index 11e33a78af8424..becd792e82293a 100644 --- a/packages/playground/css-sourcemap/__tests__/serve.spec.ts +++ b/packages/playground/css-sourcemap/__tests__/serve.spec.ts @@ -17,68 +17,6 @@ if (!isBuild) { throw new Error('Not found') } - test('inline css', async () => { - const css = await getStyleTagContentIncluding('.inline ') - const map = extractSourcemap(css) - expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { - "mappings": "AAGO;AACP,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACX,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACf,CAAC,CAAC,CAAC;", - "sources": Array [ - "/root/index.html", - ], - "sourcesContent": Array [ - " - - - - -
-

CSS Sourcemap

- -

<inline>

- -

<linked>: no import

-

<linked>: with import

- -

<imported>: no import

-

<imported>: with import

- -

<imported sass>

-

<imported sass> with module

- -

<imported less> with string additionalData

- -

<imported stylus>

-
- - - - - ", - ], - "version": 3, - } - `) - }) - test('linked css', async () => { const res = await page.request.get( new URL('./linked.css', page.url()).href, diff --git a/packages/playground/hmr/__tests__/hmr.spec.ts b/packages/playground/hmr/__tests__/hmr.spec.ts index 40b2bdf31b7956..34612ee1e7d3d5 100644 --- a/packages/playground/hmr/__tests__/hmr.spec.ts +++ b/packages/playground/hmr/__tests__/hmr.spec.ts @@ -1,4 +1,4 @@ -import { isBuild, editFile, untilUpdated } from '../../testUtils' +import { isBuild, editFile, untilUpdated, getBg } from '../../testUtils' test('should render', async () => { expect(await page.textContent('.app')).toBe('1') @@ -195,6 +195,16 @@ if (!isBuild) { expect(await btn.textContent()).toBe('Counter 1') }) + test('css in html hmr', async () => { + await page.goto(viteTestUrl) + expect(await getBg('.import-image')).toMatch('icon') + await page.goto(viteTestUrl + '/foo/') + expect(await getBg('.import-image')).toMatch('icon') + editFile('index.html', (code) => code.replace('url("./icon.png")', '')) + await page.waitForNavigation() + expect(await getBg('.import-image')).toMatch('') + }) + test('HTML', async () => { await page.goto(viteTestUrl + '/counter/index.html') let btn = await page.$('button') diff --git a/packages/playground/hmr/icon.png b/packages/playground/hmr/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..4388bfdca3d4d778d2f25a5861599f8f19a1177c GIT binary patch literal 3395 zcmaJ^dpy(o8y`aCQb$M{Gf69KbDPa&mJzw-a@=pT&3zZ!m|LaXQi-Stqav};(cC3M zM}?d^vCOT0I;N7*N=fvaPM!1nKF&@kJcVR{+lVnpAW=nV5g|H(io-_}8K6*NcqG{pEa>P0gCYr*U~dy=m^0Oe z7!hfoL?e16xp?A}qVY%q7;OczNI;1QNJIt>lt79h(@_bQ;BUMr(S5@W1%tkYFrqEN ze~R*PJ`A#<(1;)t15+!P8!LgB{xFgOZ^M8V*o?+;j% zjYbGVxnu3V=Mq_#;0OkTih@F!Or`4OCV95o&O>x)4w-L)G}xSjtYevz@Q}3MqS^c z=?r(`-!lF&n(moMB|_babV?izFPcY~_7AYAcmJMfBT%FUg{9!*NJKKj0c!~sc?<}V z1e6KP(DZx{!kk~eI~MsL4MCDJ0}i3B?ug#`N698}~# z2*4l^2$-pjof!hNA>QZ!0*1A7WRL!P>~qu#$^9z(m!0H z_1U=owYMVUugxctMe9xz?e+DZ*aiSVrr80D@l4=N_`ae9j3}c&b|M6c^Scw&#v42` zs@=W24^$JB&ZnFHq$6hgI?L<)7qPYdpMFDMm5r*2NZZ#;hNLU%;UMB}lBX&zgLa?a z^q;(Rv!#SE3*p7_>9&tfp}FA;>iv!v_p|!wd;>mn_^936qi>ng*>kFww|a^}qJTRK znA`1@E!Y|;+Yc3d2h!d=ZZPN&V<0ppw;;&qMLk zs8GnX$?aj;YSC%6t7ryd|Y^9Qc9F|ZTi%4o)Pe;3_TsRPSb<*4*B>QW0CG(vI z>y^yW0M4}!mMf3!4z1fO+L~w1pRfz#LUd11)b_hvE5tyLhoKw+{E?+obcpiN*0LU8 z+U$wi{2kPnH5r4PMp&T>SNDmqNn*??;K@i|?J!$E9U15d+24QdeF^V4qsj`m?4KR1 zo+530cOpA+R_oI`YVpGHn|g}#XF^ggiIq#Q$r!(y$dA${=6vmyc6@muL~LaHK9;_U zM6ianv&69LoqCIN7iY5Nk~w}(YQ_@J^_HeBva+0R_9?+f_e~4spT$RYhq*aCNMrO$ zANmbE3u(ID)?XQ7A$ZW2RXgnhnaPNg>o$T&swba`imtoDTfX-ox*^fNY~&|)r*EP9 zDjZoQYgH3!&1P!g6r^)r`PMo_8VTHjZZPV`=6oa69GQI3%5zMi(iWaa;uA~o4%J^) zTvx7E_z4|v`9%k4yvRr!>a=q&CRMXs)EtsGU0BaC=tm1rZCwe$9zABiZcVuVM#f_O zEcY-xE#-a$$qK0SptY*~;s&%&{MxjMyzUJK)Ro2HOShN#i zdmd(sJrh3Lv2smAU0Uf)tzU1B4BTO~oK-hJav|YH;*QbtQMXN4?1g)YYj*9zWn;WS zf1=g6CNYN>p%StDbcLOA=ocrq)8-NU#|p81bRF3}y8w-f<_em-45$3L1@~e-{F^+_ zxkl==Ne8Vus0W)|3%}tC9-OE+5bT+_6f|Q*jZeS-JXh8E3%`TziByq04bJ6a1d7>H z;RYj*F8l4WsVGR4UERkbN(jGxSrPD|EDl*hJV;*`c%6d`F)1W~@pz_2+lh zX8Y6jap-cIJ8qTxvL@N3GJ-7LiuUjog<%wMNATus+JP&V$uD}fv7BWwUYMmGCIMGj z{8~4f?dWx0LX>Y-qi=!s6hE7+ubMW78h!`|R=KV%8FK zd9Sek(lv`S^5+9xYR`{X>yATq2OfeBt(}qyYA3{aLq|2d#^vB$R4#D)8lf9t!Y;+P z_6W7^{$}!gg?;4KjI39niyeEj#~ble%M>uw{nu#b`CHdh{gg9q+d8BrP^@~lDBI@d z7PMHwiV3pH(=wk3x<4;S!E(K=DJ>2!RAm*jrN_O@8jfGh%FKDK2Jufl-PsHs+4lH9 zDVKmh4;9;;mTf^PV;hRc zGZ1`0sMNGF2Q#}5#R#bM)tW_A=dSME$5(a2i}Ihk4u>_zBv%vI*myG)hHABMyPQj@ zM)WDfPOZ2LDPxwQFP3s9qT2x$(n(71$z;Qxd;tB$vX<;ZX<>Nsq(dQ>mhaX*MIFCf zb0p{bXj}2S`bD#rpHdTdNv!#{OR);Jsq8JJ*l1;(96~iudG#aZgj0Qo3WuL}YVZek z(SM)#(x7!4_(saUC6(W&b$isUNe3O4T~w_02Y#{Bs)T0h-r|>RiXN`FZb$o39EXiL z*RJ#X)VH`&nA(%q0JE_w3>ZQUex|DOv-oSu#vm zNS0_maoG$tauoZ;v)jT-lc=;EaufphG>)@S1@N~a5rr)*{bw*r-?o*rX6>8&zHcc*`CR~1#1jSw~d|R zwXi;)w4*Di+agG^bKz87RbPQwK!stmYMB_=wK@dlhtu9wFD@&T*Rq=*u7gj@78PR;rI9VW}r3UUH0!vA30jS z9UC??hXtMukpyu2>X*~v8;@W;`1_RbZHs(`$_8)1P;u9mwi4Rc0`sT=V!Y1o!I{Qq zTuHw3d^RR%uB5r{Ro1<>F8RPbj_b`$75gQNggjNu*H}~8;-HRVpN?w*H+KzOf}(^U z)d8)S!qI%E&Bf@3i1yh^Px1-jguC#MCUGbC&Rv0bg=h2Ms1B6?sLoFXEM>DdK;(^h zBZ=9iZF8CfgvLGLDUDAC>!hByzwDss&zxy_dFFE+ps2snc=RE+p+zrQ*E_9YM0{{Y z!fhZyCOLFWcsB~(RGiu+Zuz#hisxiIQ_CT@V-K)JH skXH~y@{pZ%H2RLzTI|$xG-@5%4N!D?9MV?={PtVpVC#adKM-=_zfn5szW@LL literal 0 HcmV?d00001 diff --git a/packages/playground/hmr/index.html b/packages/playground/hmr/index.html index 0add7c26011a01..65a2ed381b027a 100644 --- a/packages/playground/hmr/index.html +++ b/packages/playground/hmr/index.html @@ -1,5 +1,13 @@ +
@@ -8,3 +16,4 @@
+
diff --git a/packages/playground/ssr-html/index.html b/packages/playground/ssr-html/index.html index c37dcc7e366ae8..995c828caae1a8 100644 --- a/packages/playground/ssr-html/index.html +++ b/packages/playground/ssr-html/index.html @@ -4,6 +4,11 @@ SSR HTML +

SSR Dynamic HTML

diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index f310abc9bc7c56..8b01d48c696465 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -301,6 +301,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { const inlined = inlineRE.test(id) const modules = cssModulesCache.get(config)!.get(id) + const isHTMLProxy = htmlProxyRE.test(id) const modulesCode = modules && dataToEsm(modules, { namedExports: true, preferConst: true }) @@ -323,6 +324,10 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { cssContent = getCodeWithSourcemap('css', css, sourcemap) } + if (isHTMLProxy) { + return cssContent + } + return [ `import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify( path.posix.join(config.base, CLIENT_PUBLIC_PATH) @@ -347,7 +352,6 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { // and then use the cache replace inline-style-flag when `generateBundle` in vite:build-html plugin const inlineCSS = inlineCSSRE.test(id) const query = parseRequest(id) - const isHTMLProxy = htmlProxyRE.test(id) if (inlineCSS && isHTMLProxy) { addToHTMLProxyTransformResult( `${cleanUrl(id)}_${Number.parseInt(query!.index)}`, @@ -718,12 +722,11 @@ async function compileCSS( postcssConfig && postcssConfig.plugins ? postcssConfig.plugins.slice() : [] if (needInlineImport) { - const isHTMLProxy = htmlProxyRE.test(id) postcssPlugins.unshift( (await import('postcss-import')).default({ async resolve(id, basedir) { const publicFile = checkPublicFile(id, config) - if (isHTMLProxy && publicFile) { + if (publicFile) { return publicFile } diff --git a/packages/vite/src/node/server/middlewares/indexHtml.ts b/packages/vite/src/node/server/middlewares/indexHtml.ts index ca2538bd9507ed..8638492b1c2001 100644 --- a/packages/vite/src/node/server/middlewares/indexHtml.ts +++ b/packages/vite/src/node/server/middlewares/indexHtml.ts @@ -16,14 +16,25 @@ import { import type { ResolvedConfig, ViteDevServer } from '../..' import { send } from '../send' import { CLIENT_PUBLIC_PATH, FS_PREFIX } from '../../constants' -import { cleanUrl, fsPathFromId, normalizePath, injectQuery } from '../../utils' +import { + cleanUrl, + fsPathFromId, + normalizePath, + injectQuery, + ensureWatchedFile +} from '../../utils' import type { ModuleGraph } from '../moduleGraph' +interface AssetNode { + start: number + end: number + code: string +} + export function createDevHtmlTransformFn( server: ViteDevServer ): (url: string, html: string, originalUrl: string) => Promise { const [preHooks, postHooks] = resolveHtmlTransforms(server.config.plugins) - return (url: string, html: string, originalUrl: string): Promise => { return applyHtmlTransforms(html, [...preHooks, devHtmlHook, ...postHooks], { path: url, @@ -94,14 +105,15 @@ const devHtmlHook: IndexHtmlTransformHook = async ( html, { path: htmlPath, filename, server, originalUrl } ) => { - const { config, moduleGraph } = server! + const { config, moduleGraph, watcher } = server! const base = config.base || '/' const s = new MagicString(html) let inlineModuleIndex = -1 const filePath = cleanUrl(htmlPath) + const styleUrl: AssetNode[] = [] - const addInlineModule = (node: ElementNode, ext: 'js' | 'css') => { + const addInlineModule = (node: ElementNode, ext: 'js') => { inlineModuleIndex++ const url = filePath.replace(normalizePath(config.root), '') @@ -128,7 +140,6 @@ const devHtmlHook: IndexHtmlTransformHook = async ( if (module) { server?.moduleGraph.invalidateModule(module) } - s.overwrite( node.loc.start.offset, node.loc.end.offset, @@ -154,7 +165,12 @@ const devHtmlHook: IndexHtmlTransformHook = async ( } if (node.tag === 'style' && node.children.length) { - addInlineModule(node, 'css') + const children = node.children[0] as TextNode + styleUrl.push({ + start: children.loc.start.offset, + end: children.loc.end.offset, + code: children.content + }) } // elements with [href/src] attrs @@ -172,6 +188,19 @@ const devHtmlHook: IndexHtmlTransformHook = async ( } }) + await Promise.all( + styleUrl.map(async ({ start, end, code }, index) => { + const url = filename + `?html-proxy&${index}.css` + + // ensure module in graph after successful load + const mod = await moduleGraph.ensureEntryFromUrl(url, false) + ensureWatchedFile(watcher, mod.file, config.root) + + const result = await server!.pluginContainer.transform(code, url) + s.overwrite(start, end, result?.code || '') + }) + ) + html = s.toString() return { From aebaf66cdb5bd9c39225462621e6f55275790463 Mon Sep 17 00:00:00 2001 From: Anthony Campolo <12433465+ajcwebdev@users.noreply.github.com> Date: Sat, 30 Apr 2022 13:20:23 -0500 Subject: [PATCH 0605/1287] docs: grammar fix in getting started guide (#7972) --- docs/guide/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/index.md b/docs/guide/index.md index ff0d3f21b90e65..5af7c29c17ac3c 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -113,7 +113,7 @@ Running `vite` starts the dev server using the current working directory as root ## Command Line Interface -In a project where Vite is installed, you can use the `vite` binary in your npm scripts, or run it directly with `npx vite`. Here is the default npm scripts in a scaffolded Vite project: +In a project where Vite is installed, you can use the `vite` binary in your npm scripts, or run it directly with `npx vite`. Here are the default npm scripts in a scaffolded Vite project: ```json5 From 891e7fc4fa3e047be43df5c1a4703cda4a4a1f54 Mon Sep 17 00:00:00 2001 From: TrickyPi <33021497+TrickyPi@users.noreply.github.com> Date: Sun, 1 May 2022 03:11:37 +0800 Subject: [PATCH 0606/1287] fix(ssr): failed ssrLoadModule call throws same error (#7177) Co-authored-by: Rich Harris --- packages/vite/src/node/server/moduleGraph.ts | 1 + .../__tests__/fixtures/ssrModuleLoader-bad.js | 2 ++ .../ssr/__tests__/ssrModuleLoader.spec.ts | 29 +++++++++++++++++++ packages/vite/src/node/ssr/ssrModuleLoader.ts | 5 ++++ 4 files changed, 37 insertions(+) create mode 100644 packages/vite/src/node/ssr/__tests__/fixtures/ssrModuleLoader-bad.js create mode 100644 packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts diff --git a/packages/vite/src/node/server/moduleGraph.ts b/packages/vite/src/node/server/moduleGraph.ts index 9c9f0d84bb738f..1d7ae407f110c5 100644 --- a/packages/vite/src/node/server/moduleGraph.ts +++ b/packages/vite/src/node/server/moduleGraph.ts @@ -33,6 +33,7 @@ export class ModuleNode { transformResult: TransformResult | null = null ssrTransformResult: TransformResult | null = null ssrModule: Record | null = null + ssrError: Error | null = null lastHMRTimestamp = 0 lastInvalidationTimestamp = 0 diff --git a/packages/vite/src/node/ssr/__tests__/fixtures/ssrModuleLoader-bad.js b/packages/vite/src/node/ssr/__tests__/fixtures/ssrModuleLoader-bad.js new file mode 100644 index 00000000000000..a51a0519d34003 --- /dev/null +++ b/packages/vite/src/node/ssr/__tests__/fixtures/ssrModuleLoader-bad.js @@ -0,0 +1,2 @@ +export const bad = 1 +throw new Error('it is an expected error') diff --git a/packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts new file mode 100644 index 00000000000000..6a45a2b70509d0 --- /dev/null +++ b/packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts @@ -0,0 +1,29 @@ +import { resolve } from 'path' +import { createServer } from '../../index' + +const badjs = resolve(__dirname, './fixtures/ssrModuleLoader-bad.js') +const THROW_MESSAGE = 'it is an expected error' + +test('always throw error when evaluating an wrong SSR module', async () => { + const viteServer = await createServer() + const spy = jest.spyOn(console, 'error').mockImplementation(() => {}) + const expectedErrors = [] + for (const i of [0, 1]) { + try { + await viteServer.ssrLoadModule(badjs) + } catch (e) { + expectedErrors.push(e) + } + } + await viteServer.close() + expect(expectedErrors).toHaveLength(2) + expect(expectedErrors[0]).toBe(expectedErrors[1]) + expectedErrors.forEach((error) => { + expect(error?.message).toContain(THROW_MESSAGE) + }) + expect(spy).toBeCalledTimes(1) + const [firstParameter] = spy.mock.calls[0] + expect(firstParameter).toContain('Error when evaluating SSR module') + expect(firstParameter).toContain(THROW_MESSAGE) + spy.mockClear() +}) diff --git a/packages/vite/src/node/ssr/ssrModuleLoader.ts b/packages/vite/src/node/ssr/ssrModuleLoader.ts index de31c6a20266c5..8b3a423f58aeab 100644 --- a/packages/vite/src/node/ssr/ssrModuleLoader.ts +++ b/packages/vite/src/node/ssr/ssrModuleLoader.ts @@ -77,6 +77,10 @@ async function instantiateModule( const { moduleGraph } = server const mod = await moduleGraph.ensureEntryFromUrl(url, true) + if (mod.ssrError) { + throw mod.ssrError + } + if (mod.ssrModule) { return mod.ssrModule } @@ -202,6 +206,7 @@ async function instantiateModule( ssrExportAll ) } catch (e) { + mod.ssrError = e if (e.stack && fixStacktrace !== false) { const stacktrace = ssrRewriteStacktrace(e.stack, moduleGraph) rebindErrorStacktrace(e, stacktrace) From a5bdb9fa706850c45134c25b77aea2dee1ea03d4 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Sun, 1 May 2022 03:28:39 +0800 Subject: [PATCH 0607/1287] feat(create-vite): scaffold directory with only .git (#7971) --- packages/create-vite/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/create-vite/index.js b/packages/create-vite/index.js index cc0a78639755bb..fceef9d9885a05 100755 --- a/packages/create-vite/index.js +++ b/packages/create-vite/index.js @@ -313,7 +313,8 @@ function copyDir(srcDir, destDir) { } function isEmpty(path) { - return fs.readdirSync(path).length === 0 + const files = fs.readdirSync(path) + return files.length === 0 || (files.length === 1 && files[0] === '.git') } function emptyDir(dir) { From f6ae60db74e0fcdb8ecf47df5c8b6df86d2c3ad6 Mon Sep 17 00:00:00 2001 From: yoho Date: Sun, 1 May 2022 14:47:34 +0800 Subject: [PATCH 0608/1287] fix: inline css hash (#7974) --- packages/playground/html/inline/shared_a.html | 1 + packages/playground/html/vite.config.js | 1 + packages/vite/src/node/plugins/asset.ts | 2 +- packages/vite/src/node/plugins/css.ts | 5 +++-- packages/vite/src/node/plugins/html.ts | 17 +++++++++-------- 5 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 packages/playground/html/inline/shared_a.html diff --git a/packages/playground/html/inline/shared_a.html b/packages/playground/html/inline/shared_a.html new file mode 100644 index 00000000000000..31fbd8fcc34bdf --- /dev/null +++ b/packages/playground/html/inline/shared_a.html @@ -0,0 +1 @@ +

inline a

diff --git a/packages/playground/html/vite.config.js b/packages/playground/html/vite.config.js index 1703e02cc05366..bfe48675cbc18f 100644 --- a/packages/playground/html/vite.config.js +++ b/packages/playground/html/vite.config.js @@ -17,6 +17,7 @@ module.exports = { zeroJS: resolve(__dirname, 'zeroJS.html'), noHead: resolve(__dirname, 'noHead.html'), noBody: resolve(__dirname, 'noBody.html'), + inlinea: resolve(__dirname, 'inline/shared_a.html'), inline1: resolve(__dirname, 'inline/shared-1.html'), inline2: resolve(__dirname, 'inline/shared-2.html'), inline3: resolve(__dirname, 'inline/unique.html'), diff --git a/packages/vite/src/node/plugins/asset.ts b/packages/vite/src/node/plugins/asset.ts index 633438cf3cb0d4..f2eed2bc28bc5a 100644 --- a/packages/vite/src/node/plugins/asset.ts +++ b/packages/vite/src/node/plugins/asset.ts @@ -337,7 +337,7 @@ async function fileToBuiltUrl( return url } -export function getAssetHash(content: Buffer): string { +export function getAssetHash(content: Buffer | string): string { return createHash('sha256').update(content).digest('hex').slice(0, 8) } diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 8b01d48c696465..cff7eaaf3e4c52 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -33,7 +33,8 @@ import { getAssetFilename, assetUrlRE, fileToUrl, - checkPublicFile + checkPublicFile, + getAssetHash } from './asset' import MagicString from 'magic-string' import type * as PostCSS from 'postcss' @@ -354,7 +355,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { const query = parseRequest(id) if (inlineCSS && isHTMLProxy) { addToHTMLProxyTransformResult( - `${cleanUrl(id)}_${Number.parseInt(query!.index)}`, + `${getAssetHash(cleanUrl(id))}_${Number.parseInt(query!.index)}`, css ) return `export default ''` diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index ed4250f1965869..c33811008ccb17 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -23,7 +23,8 @@ import { checkPublicFile, assetUrlRE, urlToBuiltUrl, - getAssetFilename + getAssetFilename, + getAssetHash } from './asset' import { isCSSRequest } from './css' import { modulePreloadPolyfillId } from './modulePreloadPolyfill' @@ -44,7 +45,7 @@ interface ScriptAssetsUrl { } const htmlProxyRE = /\?html-proxy=?[&inline\-css]*&index=(\d+)\.(js|css)$/ -const inlineCSSRE = /__VITE_INLINE_CSS__([^_]+_\d+)__/g +const inlineCSSRE = /__VITE_INLINE_CSS__([a-z\d]{8}_\d+)__/g // Do not allow preceding '.', but do allow preceding '...' for spread operations const inlineImportRE = /(?() // HTML Proxy Transform result are stored by config -// `${importer}_${query.index}` -> transformed css code -// PS: key like `/vite/packages/playground/assets/index.html_1` +// `${hash(importer)}_${query.index}` -> transformed css code +// PS: key like `hash(/vite/packages/playground/assets/index.html)_1`) export const htmlProxyResult = new Map() export function htmlInlineProxyPlugin(config: ResolvedConfig): Plugin { @@ -373,12 +374,12 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin { addToHTMLProxyCache(config, filePath, inlineModuleIndex, { code }) // will transform with css plugin and cache result with css-post plugin js += `\nimport "${id}?html-proxy&inline-css&index=${inlineModuleIndex}.css"` - + const hash = getAssetHash(cleanUrl(id)) // will transform in `applyHtmlTransforms` s.overwrite( styleNode.loc.start.offset, styleNode.loc.end.offset, - `"__VITE_INLINE_CSS__${cleanUrl(id)}_${inlineModuleIndex}__"`, + `"__VITE_INLINE_CSS__${hash}_${inlineModuleIndex}__"`, { contentOnly: true } ) } @@ -392,12 +393,12 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin { code: styleNode.content }) js += `\nimport "${id}?html-proxy&inline-css&index=${inlineModuleIndex}.css"` - + const hash = getAssetHash(cleanUrl(id)) // will transform in `applyHtmlTransforms` s.overwrite( styleNode.loc.start.offset, styleNode.loc.end.offset, - `__VITE_INLINE_CSS__${cleanUrl(id)}_${inlineModuleIndex}__`, + `__VITE_INLINE_CSS__${hash}_${inlineModuleIndex}__`, { contentOnly: true } ) } From 7f9f8f1f84b6fcf3cee45208f929050a842bd535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Mon, 2 May 2022 03:51:18 +0900 Subject: [PATCH 0609/1287] fix(css): sourcemap crash with postcss (#7982) --- packages/playground/vue-sourcemap/Css.vue | 11 ++++++ .../vue-sourcemap/__tests__/serve.spec.ts | 39 +++++++++++++++++-- .../playground/vue-sourcemap/package.json | 3 +- .../vue-sourcemap/postcss.config.js | 3 ++ packages/vite/src/node/plugins/css.ts | 19 +++------ pnpm-lock.yaml | 2 + 6 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 packages/playground/vue-sourcemap/postcss.config.js diff --git a/packages/playground/vue-sourcemap/Css.vue b/packages/playground/vue-sourcemap/Css.vue index 19668de8d33965..4f677c7b84dfbd 100644 --- a/packages/playground/vue-sourcemap/Css.vue +++ b/packages/playground/vue-sourcemap/Css.vue @@ -2,6 +2,7 @@

<css>

<css> module

<css> scoped

+

<css> scoped with nested

+ + diff --git a/packages/playground/vue-sourcemap/__tests__/serve.spec.ts b/packages/playground/vue-sourcemap/__tests__/serve.spec.ts index 08b4c04face111..7dfa271deea322 100644 --- a/packages/playground/vue-sourcemap/__tests__/serve.spec.ts +++ b/packages/playground/vue-sourcemap/__tests__/serve.spec.ts @@ -80,7 +80,7 @@ if (!isBuild) { const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` Object { - "mappings": ";AAOA;EACE,UAAU;AACZ", + "mappings": ";AAQA;EACE,UAAU;AACZ", "sources": Array [ "/root/Css.vue", ], @@ -89,6 +89,7 @@ if (!isBuild) {

<css>

<css> module

<css> scoped

+

<css> scoped with nested

+ + ", ], "version": 3, @@ -120,7 +131,7 @@ if (!isBuild) { const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` Object { - "mappings": ";AAaA;EACE,UAAU;AACZ", + "mappings": ";AAcA;EACE,UAAU;AACZ", "sources": Array [ "/root/Css.vue", ], @@ -129,6 +140,7 @@ if (!isBuild) {

<css>

<css> module

<css> scoped

+

<css> scoped with nested

+ + ", ], "version": 3, @@ -160,7 +182,7 @@ if (!isBuild) { const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` Object { - "mappings": ";AAmBA;EACE,UAAU;AACZ", + "mappings": ";AAoBA;EACE,UAAU;AACZ", "sources": Array [ "/root/Css.vue", ], @@ -169,6 +191,7 @@ if (!isBuild) {

<css>

<css> module

<css> scoped

+

<css> scoped with nested

+ + ", ], "version": 3, diff --git a/packages/playground/vue-sourcemap/package.json b/packages/playground/vue-sourcemap/package.json index 286940b01efa58..25bd2b725b7e65 100644 --- a/packages/playground/vue-sourcemap/package.json +++ b/packages/playground/vue-sourcemap/package.json @@ -11,7 +11,8 @@ "devDependencies": { "@vitejs/plugin-vue": "workspace:*", "less": "^4.1.2", - "sass": "^1.43.4" + "sass": "^1.43.4", + "postcss-nested": "^5.0.6" }, "dependencies": { "vue": "^3.2.31" diff --git a/packages/playground/vue-sourcemap/postcss.config.js b/packages/playground/vue-sourcemap/postcss.config.js new file mode 100644 index 00000000000000..9ea26b495d91b5 --- /dev/null +++ b/packages/playground/vue-sourcemap/postcss.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: [require('postcss-nested')] +} diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index cff7eaaf3e4c52..b3ea3338cecc04 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -877,32 +877,23 @@ export function formatPostcssSourceMap( ): ExistingRawSourceMap { const inputFileDir = path.dirname(file) - const sources: string[] = [] - const sourcesContent: string[] = [] - for (const [i, source] of rawMap.sources.entries()) { - // remove from sources, to prevent source map to be combined incorrectly - if (source === '') continue - + const sources = rawMap.sources.map((source) => { const cleanSource = cleanUrl(decodeURIComponent(source)) // postcss returns virtual files if (/^<.+>$/.test(cleanSource)) { - sources.push(`\0${cleanSource}`) - } else { - sources.push(normalizePath(path.resolve(inputFileDir, cleanSource))) + return `\0${cleanSource}` } - if (rawMap.sourcesContent) { - sourcesContent.push(rawMap.sourcesContent[i]) - } - } + return normalizePath(path.resolve(inputFileDir, cleanSource)) + }) return { file, mappings: rawMap.mappings, names: rawMap.names, sources, - sourcesContent, + sourcesContent: rawMap.sourcesContent, version: rawMap.version } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 73be476b1c911b..7c177126794187 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -730,6 +730,7 @@ importers: specifiers: '@vitejs/plugin-vue': workspace:* less: ^4.1.2 + postcss-nested: ^5.0.6 sass: ^1.43.4 vue: ^3.2.31 dependencies: @@ -737,6 +738,7 @@ importers: devDependencies: '@vitejs/plugin-vue': link:../../plugin-vue less: 4.1.2 + postcss-nested: 5.0.6 sass: 1.45.1 packages/playground/wasm: From 025eebf7e634e2fdc40fde02b5f82278d5ef05c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Mon, 2 May 2022 04:50:25 +0900 Subject: [PATCH 0610/1287] fix(css): dynamic import css in package fetches removed js (fixes #7955, #6823) (#7969) --- .../dynamic-import/__tests__/dynamic-import.spec.ts | 7 ++++++- packages/playground/dynamic-import/index.html | 1 + packages/playground/dynamic-import/nested/deps.js | 3 +++ packages/playground/dynamic-import/nested/index.js | 5 +++++ packages/playground/dynamic-import/package.json | 6 +++++- packages/playground/dynamic-import/pkg/index.js | 1 + packages/playground/dynamic-import/pkg/package.json | 7 +++++++ packages/playground/dynamic-import/pkg/pkg.css | 3 +++ packages/vite/src/node/plugins/importAnalysisBuild.ts | 5 ++++- pnpm-lock.yaml | 6 ++++++ 10 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 packages/playground/dynamic-import/nested/deps.js create mode 100644 packages/playground/dynamic-import/pkg/index.js create mode 100644 packages/playground/dynamic-import/pkg/package.json create mode 100644 packages/playground/dynamic-import/pkg/pkg.css diff --git a/packages/playground/dynamic-import/__tests__/dynamic-import.spec.ts b/packages/playground/dynamic-import/__tests__/dynamic-import.spec.ts index c7157ef4652ec6..4730b5e990a1c3 100644 --- a/packages/playground/dynamic-import/__tests__/dynamic-import.spec.ts +++ b/packages/playground/dynamic-import/__tests__/dynamic-import.spec.ts @@ -1,4 +1,4 @@ -import { isBuild, untilUpdated } from '../../testUtils' +import { getColor, isBuild, untilUpdated } from '../../testUtils' test('should load literal dynamic import', async () => { await page.click('.baz') @@ -59,3 +59,8 @@ test('should load dynamic import with css', async () => { true ) }) + +test('should load dynamic import with css in package', async () => { + await page.click('.pkg-css') + await untilUpdated(() => getColor('.pkg-css'), 'blue', true) +}) diff --git a/packages/playground/dynamic-import/index.html b/packages/playground/dynamic-import/index.html index c87ef2a17f48d5..8e18204a7e4296 100644 --- a/packages/playground/dynamic-import/index.html +++ b/packages/playground/dynamic-import/index.html @@ -8,6 +8,7 @@ +
diff --git a/packages/playground/dynamic-import/nested/deps.js b/packages/playground/dynamic-import/nested/deps.js new file mode 100644 index 00000000000000..88fd4787941fd0 --- /dev/null +++ b/packages/playground/dynamic-import/nested/deps.js @@ -0,0 +1,3 @@ +/* don't include dynamic import inside this file */ + +import 'pkg' diff --git a/packages/playground/dynamic-import/nested/index.js b/packages/playground/dynamic-import/nested/index.js index 5518c56a35a2cc..f84ec00380d604 100644 --- a/packages/playground/dynamic-import/nested/index.js +++ b/packages/playground/dynamic-import/nested/index.js @@ -70,6 +70,11 @@ document.querySelector('.css').addEventListener('click', async () => { text('.view', 'dynamic import css') }) +document.querySelector('.pkg-css').addEventListener('click', async () => { + await import('./deps') + text('.view', 'dynamic import css in package') +}) + function text(el, text) { document.querySelector(el).textContent = text } diff --git a/packages/playground/dynamic-import/package.json b/packages/playground/dynamic-import/package.json index a6b6d5f863f1b8..3aac1090af5be4 100644 --- a/packages/playground/dynamic-import/package.json +++ b/packages/playground/dynamic-import/package.json @@ -6,6 +6,10 @@ "dev": "vite", "build": "vite build", "debug": "node --inspect-brk ../../vite/bin/vite", - "preview": "vite preview" + "preview": "vite preview", + "postinstall": "ts-node ../../../scripts/patchFileDeps.ts" + }, + "dependencies": { + "pkg": "file:./pkg" } } diff --git a/packages/playground/dynamic-import/pkg/index.js b/packages/playground/dynamic-import/pkg/index.js new file mode 100644 index 00000000000000..20f705c0b4a8c9 --- /dev/null +++ b/packages/playground/dynamic-import/pkg/index.js @@ -0,0 +1 @@ +import('./pkg.css') diff --git a/packages/playground/dynamic-import/pkg/package.json b/packages/playground/dynamic-import/pkg/package.json new file mode 100644 index 00000000000000..1eab564572e245 --- /dev/null +++ b/packages/playground/dynamic-import/pkg/package.json @@ -0,0 +1,7 @@ +{ + "name": "pkg", + "type": "module", + "private": true, + "version": "1.0.0", + "main": "index.js" +} diff --git a/packages/playground/dynamic-import/pkg/pkg.css b/packages/playground/dynamic-import/pkg/pkg.css new file mode 100644 index 00000000000000..349d669b6829bf --- /dev/null +++ b/packages/playground/dynamic-import/pkg/pkg.css @@ -0,0 +1,3 @@ +.pkg-css { + color: blue; +} diff --git a/packages/vite/src/node/plugins/importAnalysisBuild.ts b/packages/vite/src/node/plugins/importAnalysisBuild.ts index ff315d008f57a5..7e684db2b4cc6b 100644 --- a/packages/vite/src/node/plugins/importAnalysisBuild.ts +++ b/packages/vite/src/node/plugins/importAnalysisBuild.ts @@ -24,6 +24,8 @@ export const preloadBaseMarker = `__VITE_PRELOAD_BASE__` const preloadHelperId = 'vite/preload-helper' const preloadMarkerWithQuote = `"${preloadMarker}"` as const +const dynamicImportPrefixRE = /import\s*\(/ + /** * Helper for preloading CSS and direct imports of async chunks in parallel to * the async chunk itself. @@ -118,7 +120,8 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin { async transform(source, importer) { if ( importer.includes('node_modules') && - !source.includes('import.meta.glob') + !source.includes('import.meta.glob') && + !dynamicImportPrefixRE.test(source) ) { return } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7c177126794187..43c9d6d049d250 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -185,6 +185,12 @@ importers: specifiers: {} packages/playground/dynamic-import: + specifiers: + pkg: file:./pkg + dependencies: + pkg: link:pkg + + packages/playground/dynamic-import/pkg: specifiers: {} packages/playground/env: From b877d30a05691bb6ea2da4e67b931a5a3d32809f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 May 2022 09:35:14 +0200 Subject: [PATCH 0611/1287] chore(deps): update all non-major dependencies (#7949) --- package.json | 12 +- packages/plugin-legacy/package.json | 4 +- packages/plugin-react/package.json | 4 +- packages/plugin-vue-jsx/package.json | 2 +- packages/vite/package.json | 18 +- pnpm-lock.yaml | 606 ++++++++++++++++----------- 6 files changed, 381 insertions(+), 265 deletions(-) diff --git a/package.json b/package.json index 1bfa2c4e77619c..cf18c4ee36e894 100644 --- a/package.json +++ b/package.json @@ -34,24 +34,24 @@ "ci-docs": "run-s build-vite build-plugin-vue build-docs" }, "devDependencies": { - "@microsoft/api-extractor": "^7.22.2", + "@microsoft/api-extractor": "^7.23.0", "@types/fs-extra": "^9.0.13", "@types/jest": "^27.4.1", "@types/node": "^17.0.25", "@types/prompts": "^2.0.14", "@types/semver": "^7.3.9", - "@typescript-eslint/eslint-plugin": "^5.20.0", - "@typescript-eslint/parser": "^5.20.0", + "@typescript-eslint/eslint-plugin": "^5.21.0", + "@typescript-eslint/parser": "^5.21.0", "conventional-changelog-cli": "^2.2.2", "cross-env": "^7.0.3", "esbuild": "^0.14.27", - "eslint": "^8.13.0", + "eslint": "^8.14.0", "eslint-define-config": "^1.4.0", "eslint-plugin-node": "^11.1.0", "execa": "^5.1.1", "fs-extra": "^10.1.0", "jest": "^27.5.1", - "lint-staged": "^12.4.0", + "lint-staged": "^12.4.1", "minimist": "^1.2.6", "node-fetch": "^2.6.6", "npm-run-all": "^4.1.5", @@ -85,7 +85,7 @@ "eslint --ext .ts" ] }, - "packageManager": "pnpm@6.32.9", + "packageManager": "pnpm@6.32.11", "pnpm": { "overrides": { "vite": "workspace:*", diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index adc97e974f2d37..1ba92ee5fd8565 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -22,8 +22,8 @@ }, "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme", "dependencies": { - "@babel/standalone": "^7.17.9", - "core-js": "^3.22.2", + "@babel/standalone": "^7.17.11", + "core-js": "^3.22.3", "magic-string": "^0.26.1", "regenerator-runtime": "^0.13.9", "systemjs": "^6.12.1" diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 8c93db98aac027..5698472c9dc113 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -33,13 +33,13 @@ }, "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-react#readme", "dependencies": { - "@babel/core": "^7.17.9", + "@babel/core": "^7.17.10", "@babel/plugin-transform-react-jsx": "^7.17.3", "@babel/plugin-transform-react-jsx-development": "^7.16.7", "@babel/plugin-transform-react-jsx-self": "^7.16.7", "@babel/plugin-transform-react-jsx-source": "^7.16.7", "@rollup/pluginutils": "^4.2.1", - "react-refresh": "^0.12.0", + "react-refresh": "^0.13.0", "resolve": "^1.22.0" } } diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 487d207a0df24d..32f346f6ea0024 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-vue-jsx#readme", "dependencies": { - "@babel/core": "^7.17.9", + "@babel/core": "^7.17.10", "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-transform-typescript": "^7.16.8", "@rollup/pluginutils": "^4.2.1", diff --git a/packages/vite/package.json b/packages/vite/package.json index b2caecf4e228ca..39b95bbab97769 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -44,7 +44,7 @@ "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!", "dependencies": { "esbuild": "^0.14.27", - "postcss": "^8.4.12", + "postcss": "^8.4.13", "resolve": "^1.22.0", "rollup": "^2.59.0" }, @@ -52,9 +52,9 @@ "fsevents": "~2.3.2" }, "devDependencies": { - "@ampproject/remapping": "^2.1.2", - "@babel/parser": "^7.17.9", - "@babel/types": "^7.17.0", + "@ampproject/remapping": "^2.2.0", + "@babel/parser": "^7.17.10", + "@babel/types": "^7.17.10", "@jridgewell/trace-mapping": "^0.3.9", "@rollup/plugin-alias": "^3.1.9", "@rollup/plugin-commonjs": "^21.1.0", @@ -72,12 +72,12 @@ "@types/micromatch": "^4.0.2", "@types/mime": "^2.0.3", "@types/node": "^17.0.25", - "@types/resolve": "^1.20.1", + "@types/resolve": "^1.20.2", "@types/sass": "~1.43.1", "@types/stylus": "^0.48.37", "@types/ws": "^8.5.3", "@vue/compiler-dom": "^3.2.33", - "acorn": "^8.7.0", + "acorn": "^8.7.1", "cac": "6.7.9", "chokidar": "^3.5.3", "connect": "^3.7.0", @@ -112,11 +112,11 @@ "source-map-js": "^1.0.2", "source-map-support": "^0.5.21", "strip-ansi": "^6.0.1", - "terser": "^5.12.1", + "terser": "^5.13.1", "tsconfck": "^1.2.2", - "tslib": "^2.3.1", + "tslib": "^2.4.0", "types": "link:./types", - "ws": "^8.5.0" + "ws": "^8.6.0" }, "peerDependencies": { "less": "*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 43c9d6d049d250..57fa85d5aaacf7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,24 +10,24 @@ importers: .: specifiers: - '@microsoft/api-extractor': ^7.22.2 + '@microsoft/api-extractor': ^7.23.0 '@types/fs-extra': ^9.0.13 '@types/jest': ^27.4.1 '@types/node': ^17.0.25 '@types/prompts': ^2.0.14 '@types/semver': ^7.3.9 - '@typescript-eslint/eslint-plugin': ^5.20.0 - '@typescript-eslint/parser': ^5.20.0 + '@typescript-eslint/eslint-plugin': ^5.21.0 + '@typescript-eslint/parser': ^5.21.0 conventional-changelog-cli: ^2.2.2 cross-env: ^7.0.3 esbuild: ^0.14.27 - eslint: ^8.13.0 + eslint: ^8.14.0 eslint-define-config: ^1.4.0 eslint-plugin-node: ^11.1.0 execa: ^5.1.1 fs-extra: ^10.1.0 jest: ^27.5.1 - lint-staged: ^12.4.0 + lint-staged: ^12.4.1 minimist: ^1.2.6 node-fetch: ^2.6.6 npm-run-all: ^4.1.5 @@ -46,24 +46,24 @@ importers: vite: workspace:* vitepress: ^0.22.3 devDependencies: - '@microsoft/api-extractor': 7.22.2 + '@microsoft/api-extractor': 7.23.0 '@types/fs-extra': 9.0.13 '@types/jest': 27.4.1 '@types/node': 17.0.25 '@types/prompts': 2.0.14 '@types/semver': 7.3.9 - '@typescript-eslint/eslint-plugin': 5.20.0_0df7beb8e4d849cfe6bb8e844ccdebfd - '@typescript-eslint/parser': 5.20.0_eslint@8.13.0+typescript@4.5.4 + '@typescript-eslint/eslint-plugin': 5.21.0_85142f655c5c9420758b0f4908692036 + '@typescript-eslint/parser': 5.21.0_eslint@8.14.0+typescript@4.5.4 conventional-changelog-cli: 2.2.2 cross-env: 7.0.3 esbuild: 0.14.27 - eslint: 8.13.0 + eslint: 8.14.0 eslint-define-config: 1.4.0 - eslint-plugin-node: 11.1.0_eslint@8.13.0 + eslint-plugin-node: 11.1.0_eslint@8.14.0 execa: 5.1.1 fs-extra: 10.1.0 jest: 27.5.1_ts-node@10.4.0 - lint-staged: 12.4.0 + lint-staged: 12.4.1 minimist: 1.2.6 node-fetch: 2.6.6 npm-run-all: 4.1.5 @@ -758,36 +758,36 @@ importers: packages/plugin-legacy: specifiers: - '@babel/standalone': ^7.17.9 - core-js: ^3.22.2 + '@babel/standalone': ^7.17.11 + core-js: ^3.22.3 magic-string: ^0.26.1 regenerator-runtime: ^0.13.9 systemjs: ^6.12.1 dependencies: - '@babel/standalone': 7.17.9 - core-js: 3.22.2 + '@babel/standalone': 7.17.11 + core-js: 3.22.3 magic-string: 0.26.1 regenerator-runtime: 0.13.9 systemjs: 6.12.1 packages/plugin-react: specifiers: - '@babel/core': ^7.17.9 + '@babel/core': ^7.17.10 '@babel/plugin-transform-react-jsx': ^7.17.3 '@babel/plugin-transform-react-jsx-development': ^7.16.7 '@babel/plugin-transform-react-jsx-self': ^7.16.7 '@babel/plugin-transform-react-jsx-source': ^7.16.7 '@rollup/pluginutils': ^4.2.1 - react-refresh: ^0.12.0 + react-refresh: ^0.13.0 resolve: ^1.22.0 dependencies: - '@babel/core': 7.17.9 - '@babel/plugin-transform-react-jsx': 7.17.3_@babel+core@7.17.9 - '@babel/plugin-transform-react-jsx-development': 7.16.7_@babel+core@7.17.9 - '@babel/plugin-transform-react-jsx-self': 7.16.7_@babel+core@7.17.9 - '@babel/plugin-transform-react-jsx-source': 7.16.7_@babel+core@7.17.9 + '@babel/core': 7.17.10 + '@babel/plugin-transform-react-jsx': 7.17.3_@babel+core@7.17.10 + '@babel/plugin-transform-react-jsx-development': 7.16.7_@babel+core@7.17.10 + '@babel/plugin-transform-react-jsx-self': 7.16.7_@babel+core@7.17.10 + '@babel/plugin-transform-react-jsx-source': 7.16.7_@babel+core@7.17.10 '@rollup/pluginutils': 4.2.1 - react-refresh: 0.12.0 + react-refresh: 0.13.0 resolve: 1.22.0 packages/plugin-vue: @@ -812,25 +812,25 @@ importers: packages/plugin-vue-jsx: specifiers: - '@babel/core': ^7.17.9 + '@babel/core': ^7.17.10 '@babel/plugin-syntax-import-meta': ^7.10.4 '@babel/plugin-transform-typescript': ^7.16.8 '@rollup/pluginutils': ^4.2.1 '@vue/babel-plugin-jsx': ^1.1.1 hash-sum: ^2.0.0 dependencies: - '@babel/core': 7.17.9 - '@babel/plugin-syntax-import-meta': 7.10.4_@babel+core@7.17.9 - '@babel/plugin-transform-typescript': 7.16.8_@babel+core@7.17.9 + '@babel/core': 7.17.10 + '@babel/plugin-syntax-import-meta': 7.10.4_@babel+core@7.17.10 + '@babel/plugin-transform-typescript': 7.16.8_@babel+core@7.17.10 '@rollup/pluginutils': 4.2.1 - '@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.17.9 + '@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.17.10 hash-sum: 2.0.0 packages/vite: specifiers: - '@ampproject/remapping': ^2.1.2 - '@babel/parser': ^7.17.9 - '@babel/types': ^7.17.0 + '@ampproject/remapping': ^2.2.0 + '@babel/parser': ^7.17.10 + '@babel/types': ^7.17.10 '@jridgewell/trace-mapping': ^0.3.9 '@rollup/plugin-alias': ^3.1.9 '@rollup/plugin-commonjs': ^21.1.0 @@ -848,12 +848,12 @@ importers: '@types/micromatch': ^4.0.2 '@types/mime': ^2.0.3 '@types/node': ^17.0.25 - '@types/resolve': ^1.20.1 + '@types/resolve': ^1.20.2 '@types/sass': ~1.43.1 '@types/stylus': ^0.48.37 '@types/ws': ^8.5.3 '@vue/compiler-dom': ^3.2.33 - acorn: ^8.7.0 + acorn: ^8.7.1 cac: 6.7.9 chokidar: ^3.5.3 connect: ^3.7.0 @@ -881,7 +881,7 @@ importers: open: ^8.4.0 periscopic: ^2.0.3 picocolors: ^1.0.0 - postcss: ^8.4.12 + postcss: ^8.4.13 postcss-import: ^14.1.0 postcss-load-config: ^3.1.4 postcss-modules: ^4.3.1 @@ -893,29 +893,29 @@ importers: source-map-js: ^1.0.2 source-map-support: ^0.5.21 strip-ansi: ^6.0.1 - terser: ^5.12.1 + terser: ^5.13.1 tsconfck: ^1.2.2 - tslib: ^2.3.1 + tslib: ^2.4.0 types: link:./types - ws: ^8.5.0 + ws: ^8.6.0 dependencies: esbuild: 0.14.27 - postcss: 8.4.12 + postcss: 8.4.13 resolve: 1.22.0 rollup: 2.62.0 optionalDependencies: fsevents: 2.3.2 devDependencies: - '@ampproject/remapping': 2.1.2 - '@babel/parser': 7.17.9 - '@babel/types': 7.17.0 + '@ampproject/remapping': 2.2.0 + '@babel/parser': 7.17.10 + '@babel/types': 7.17.10 '@jridgewell/trace-mapping': 0.3.9 '@rollup/plugin-alias': 3.1.9_rollup@2.62.0 '@rollup/plugin-commonjs': 21.1.0_rollup@2.62.0 '@rollup/plugin-dynamic-import-vars': 1.4.3_rollup@2.62.0 '@rollup/plugin-json': 4.1.0_rollup@2.62.0 '@rollup/plugin-node-resolve': 13.2.1_rollup@2.62.0 - '@rollup/plugin-typescript': 8.3.2_7c5ff569c0887b4f0035eb7cb6988163 + '@rollup/plugin-typescript': 8.3.2_83df2083f1d8ae39f870809a13a7071e '@rollup/pluginutils': 4.2.1 '@types/convert-source-map': 1.5.2 '@types/cross-spawn': 6.0.2 @@ -926,12 +926,12 @@ importers: '@types/micromatch': 4.0.2 '@types/mime': 2.0.3 '@types/node': 17.0.25 - '@types/resolve': 1.20.1 + '@types/resolve': 1.20.2 '@types/sass': 1.43.1 '@types/stylus': 0.48.37 '@types/ws': 8.5.3 '@vue/compiler-dom': 3.2.33 - acorn: 8.7.0 + acorn: 8.7.1 cac: 6.7.9 chokidar: 3.5.3 connect: 3.7.0 @@ -957,20 +957,20 @@ importers: open: 8.4.0 periscopic: 2.0.3 picocolors: 1.0.0 - postcss-import: 14.1.0_postcss@8.4.12 - postcss-load-config: 3.1.4_postcss@8.4.12+ts-node@10.4.0 - postcss-modules: 4.3.1_postcss@8.4.12 + postcss-import: 14.1.0_postcss@8.4.13 + postcss-load-config: 3.1.4_postcss@8.4.13+ts-node@10.4.0 + postcss-modules: 4.3.1_postcss@8.4.13 resolve.exports: 1.1.0 rollup-plugin-license: 2.7.0_rollup@2.62.0 sirv: 2.0.2 source-map-js: 1.0.2 source-map-support: 0.5.21 strip-ansi: 6.0.1 - terser: 5.12.1 + terser: 5.13.1 tsconfck: 1.2.2_typescript@4.5.4 - tslib: 2.3.1 + tslib: 2.4.0 types: link:types - ws: 8.5.0 + ws: 8.6.0 packages: @@ -1096,6 +1096,15 @@ packages: engines: {node: '>=6.0.0'} dependencies: '@jridgewell/trace-mapping': 0.3.9 + dev: false + + /@ampproject/remapping/2.2.0: + resolution: {integrity: sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/gen-mapping': 0.1.1 + '@jridgewell/trace-mapping': 0.3.9 + dev: true /@babel/code-frame/7.16.0: resolution: {integrity: sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==} @@ -1114,25 +1123,25 @@ packages: engines: {node: '>=6.9.0'} dev: true - /@babel/compat-data/7.17.7: - resolution: {integrity: sha512-p8pdE6j0a29TNGebNm7NzYZWB3xVZJBZ7XGs42uAKzQo8VQ3F0By/cQCtUEABwIqw5zo6WA4NbmxsfzADzMKnQ==} + /@babel/compat-data/7.17.10: + resolution: {integrity: sha512-GZt/TCsG70Ms19gfZO1tM4CVnXsPgEPBCpJu+Qz3L0LUDsY5nZqFZglIoPC1kIYOtNBZlrnFT+klg12vFGZXrw==} engines: {node: '>=6.9.0'} dev: false - /@babel/core/7.17.2: - resolution: {integrity: sha512-R3VH5G42VSDolRHyUO4V2cfag8WHcZyxdq5Z/m8Xyb92lW/Erm/6kM+XtRFGf3Mulre3mveni2NHfEUws8wSvw==} + /@babel/core/7.17.10: + resolution: {integrity: sha512-liKoppandF3ZcBnIYFjfSDHZLKdLHGJRkoWtG8zQyGJBQfIYobpnVGI5+pLBNtS6psFLDzyq8+h5HiVljW9PNA==} engines: {node: '>=6.9.0'} dependencies: - '@ampproject/remapping': 2.1.0 + '@ampproject/remapping': 2.1.2 '@babel/code-frame': 7.16.7 - '@babel/generator': 7.17.0 - '@babel/helper-compilation-targets': 7.16.7_@babel+core@7.17.2 - '@babel/helper-module-transforms': 7.16.7 - '@babel/helpers': 7.17.2 - '@babel/parser': 7.17.0 + '@babel/generator': 7.17.10 + '@babel/helper-compilation-targets': 7.17.10_@babel+core@7.17.10 + '@babel/helper-module-transforms': 7.17.7 + '@babel/helpers': 7.17.9 + '@babel/parser': 7.17.10 '@babel/template': 7.16.7 - '@babel/traverse': 7.17.0 - '@babel/types': 7.17.0 + '@babel/traverse': 7.17.10 + '@babel/types': 7.17.10 convert-source-map: 1.8.0 debug: 4.3.4 gensync: 1.0.0-beta.2 @@ -1140,21 +1149,21 @@ packages: semver: 6.3.0 transitivePeerDependencies: - supports-color - dev: true + dev: false - /@babel/core/7.17.9: - resolution: {integrity: sha512-5ug+SfZCpDAkVp9SFIZAzlW18rlzsOcJGaetCjkySnrXXDUw9AR8cDUm1iByTmdWM6yxX6/zycaV76w3YTF2gw==} + /@babel/core/7.17.2: + resolution: {integrity: sha512-R3VH5G42VSDolRHyUO4V2cfag8WHcZyxdq5Z/m8Xyb92lW/Erm/6kM+XtRFGf3Mulre3mveni2NHfEUws8wSvw==} engines: {node: '>=6.9.0'} dependencies: - '@ampproject/remapping': 2.1.2 + '@ampproject/remapping': 2.1.0 '@babel/code-frame': 7.16.7 - '@babel/generator': 7.17.9 - '@babel/helper-compilation-targets': 7.17.7_@babel+core@7.17.9 - '@babel/helper-module-transforms': 7.17.7 - '@babel/helpers': 7.17.9 - '@babel/parser': 7.17.9 + '@babel/generator': 7.17.0 + '@babel/helper-compilation-targets': 7.16.7_@babel+core@7.17.2 + '@babel/helper-module-transforms': 7.16.7 + '@babel/helpers': 7.17.2 + '@babel/parser': 7.17.0 '@babel/template': 7.16.7 - '@babel/traverse': 7.17.9 + '@babel/traverse': 7.17.0 '@babel/types': 7.17.0 convert-source-map: 1.8.0 debug: 4.3.4 @@ -1163,7 +1172,7 @@ packages: semver: 6.3.0 transitivePeerDependencies: - supports-color - dev: false + dev: true /@babel/generator/7.16.5: resolution: {integrity: sha512-kIvCdjZqcdKqoDbVVdt5R99icaRtrtYhYK/xux5qiWCBmfdvEYMFZ68QCrpE5cbFM1JsuArUNs1ZkuKtTtUcZA==} @@ -1192,13 +1201,13 @@ packages: source-map: 0.5.7 dev: true - /@babel/generator/7.17.9: - resolution: {integrity: sha512-rAdDousTwxbIxbz5I7GEQ3lUip+xVCXooZNbsydCWs3xA7ZsYOv+CFRdzGxRX78BmQHu9B1Eso59AOZQOJDEdQ==} + /@babel/generator/7.17.10: + resolution: {integrity: sha512-46MJZZo9y3o4kmhBVc7zW7i8dtR1oIK/sdO5NcfcZRhTGYi+KKJRtHNgsU6c4VUcJmUNV/LQdebD/9Dlv4K+Tg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.17.0 + '@babel/types': 7.17.10 + '@jridgewell/gen-mapping': 0.1.1 jsesc: 2.5.2 - source-map: 0.5.7 dev: false /@babel/helper-annotate-as-pure/7.16.7: @@ -1221,26 +1230,26 @@ packages: semver: 6.3.0 dev: true - /@babel/helper-compilation-targets/7.17.7_@babel+core@7.17.9: - resolution: {integrity: sha512-UFzlz2jjd8kroj0hmCFV5zr+tQPi1dpC2cRsDV/3IEW8bJfCPrPpmcSN6ZS8RqIq4LXcmpipCQFPddyFA5Yc7w==} + /@babel/helper-compilation-targets/7.17.10_@babel+core@7.17.10: + resolution: {integrity: sha512-gh3RxjWbauw/dFiU/7whjd0qN9K6nPJMqe6+Er7rOavFh0CQUSwhAE3IcTho2rywPJFxej6TUUHDkWcYI6gGqQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/compat-data': 7.17.7 - '@babel/core': 7.17.9 + '@babel/compat-data': 7.17.10 + '@babel/core': 7.17.10 '@babel/helper-validator-option': 7.16.7 - browserslist: 4.19.1 + browserslist: 4.20.3 semver: 6.3.0 dev: false - /@babel/helper-create-class-features-plugin/7.16.10_@babel+core@7.17.9: + /@babel/helper-create-class-features-plugin/7.16.10_@babel+core@7.17.10: resolution: {integrity: sha512-wDeej0pu3WN/ffTxMNCPW5UCiOav8IcLRxSIyp/9+IF2xJUM9h/OYjg0IJLHaL6F8oU8kqMz9nc1vryXhMsgXg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.17.9 + '@babel/core': 7.17.10 '@babel/helper-annotate-as-pure': 7.16.7 '@babel/helper-environment-visitor': 7.16.7 '@babel/helper-function-name': 7.16.7 @@ -1256,7 +1265,7 @@ packages: resolution: {integrity: sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.17.0 + '@babel/types': 7.17.10 /@babel/helper-function-name/7.16.7: resolution: {integrity: sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA==} @@ -1271,7 +1280,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.16.7 - '@babel/types': 7.17.0 + '@babel/types': 7.17.10 dev: false /@babel/helper-get-function-arity/7.16.7: @@ -1291,7 +1300,7 @@ packages: resolution: {integrity: sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.17.0 + '@babel/types': 7.17.10 /@babel/helper-member-expression-to-functions/7.16.7: resolution: {integrity: sha512-VtJ/65tYiU/6AbMTDwyoXGPKHgTsfRarivm+YbB5uAzKUyuPjgZSgAFeG87FCigc7KNHu2Pegh1XIT3lXjvz3Q==} @@ -1338,8 +1347,8 @@ packages: '@babel/helper-split-export-declaration': 7.16.7 '@babel/helper-validator-identifier': 7.16.7 '@babel/template': 7.16.7 - '@babel/traverse': 7.17.9 - '@babel/types': 7.17.0 + '@babel/traverse': 7.17.10 + '@babel/types': 7.17.10 transitivePeerDependencies: - supports-color dev: false @@ -1383,14 +1392,14 @@ packages: resolution: {integrity: sha512-txyMCGroZ96i+Pxr3Je3lzEJjqwaRC9buMUgtomcrLe5Nd0+fk1h0LLA+ixUF5OW7AhHuQ7Es1WcQJZmZsz2XA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.17.0 + '@babel/types': 7.17.10 dev: false /@babel/helper-split-export-declaration/7.16.7: resolution: {integrity: sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.17.0 + '@babel/types': 7.17.10 /@babel/helper-validator-identifier/7.15.7: resolution: {integrity: sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==} @@ -1420,8 +1429,8 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.16.7 - '@babel/traverse': 7.17.9 - '@babel/types': 7.17.0 + '@babel/traverse': 7.17.10 + '@babel/types': 7.17.10 transitivePeerDependencies: - supports-color dev: false @@ -1459,6 +1468,11 @@ packages: hasBin: true dev: true + /@babel/parser/7.17.10: + resolution: {integrity: sha512-n2Q6i+fnJqzOaq2VkdXxy2TCPCWQZHiCo0XqmrCvDWcZQKRyZzYi4Z0yxlBuN0w+r2ZHmre+Q087DSrw3pbJDQ==} + engines: {node: '>=6.0.0'} + hasBin: true + /@babel/parser/7.17.8: resolution: {integrity: sha512-BoHhDJrJXqcg+ZL16Xv39H9n+AqJ4pcDrQBGZN+wHxIysrLZ3/ECwCBUch/1zUNhnsXULcONU3Ei5Hmkfk6kiQ==} engines: {node: '>=6.0.0'} @@ -1506,23 +1520,23 @@ packages: '@babel/helper-plugin-utils': 7.16.7 dev: true - /@babel/plugin-syntax-import-meta/7.10.4_@babel+core@7.17.2: + /@babel/plugin-syntax-import-meta/7.10.4_@babel+core@7.17.10: resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.17.2 + '@babel/core': 7.17.10 '@babel/helper-plugin-utils': 7.16.5 - dev: true + dev: false - /@babel/plugin-syntax-import-meta/7.10.4_@babel+core@7.17.9: + /@babel/plugin-syntax-import-meta/7.10.4_@babel+core@7.17.2: resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.17.9 + '@babel/core': 7.17.2 '@babel/helper-plugin-utils': 7.16.5 - dev: false + dev: true /@babel/plugin-syntax-json-strings/7.8.3_@babel+core@7.17.2: resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} @@ -1542,23 +1556,23 @@ packages: '@babel/helper-plugin-utils': 7.16.7 dev: true - /@babel/plugin-syntax-jsx/7.16.5_@babel+core@7.17.9: + /@babel/plugin-syntax-jsx/7.16.5_@babel+core@7.17.10: resolution: {integrity: sha512-42OGssv9NPk4QHKVgIHlzeLgPOW5rGgfV5jzG90AhcXXIv6hu/eqj63w4VgvRxdvZY3AlYeDgPiSJ3BqAd1Y6Q==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.17.9 + '@babel/core': 7.17.10 '@babel/helper-plugin-utils': 7.16.7 dev: false - /@babel/plugin-syntax-jsx/7.16.7_@babel+core@7.17.9: + /@babel/plugin-syntax-jsx/7.16.7_@babel+core@7.17.10: resolution: {integrity: sha512-Esxmk7YjA8QysKeT3VhTXvF6y77f/a91SIs4pWb4H2eWGQkCKFgQaG6hdoEVZtGsrAcb2K5BW66XsOErD4WU3Q==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.17.9 + '@babel/core': 7.17.10 '@babel/helper-plugin-utils': 7.16.7 dev: false @@ -1635,80 +1649,80 @@ packages: '@babel/helper-plugin-utils': 7.16.7 dev: true - /@babel/plugin-syntax-typescript/7.16.7_@babel+core@7.17.2: + /@babel/plugin-syntax-typescript/7.16.7_@babel+core@7.17.10: resolution: {integrity: sha512-YhUIJHHGkqPgEcMYkPCKTyGUdoGKWtopIycQyjJH8OjvRgOYsXsaKehLVPScKJWAULPxMa4N1vCe6szREFlZ7A==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.17.2 + '@babel/core': 7.17.10 '@babel/helper-plugin-utils': 7.16.7 - dev: true + dev: false - /@babel/plugin-syntax-typescript/7.16.7_@babel+core@7.17.9: + /@babel/plugin-syntax-typescript/7.16.7_@babel+core@7.17.2: resolution: {integrity: sha512-YhUIJHHGkqPgEcMYkPCKTyGUdoGKWtopIycQyjJH8OjvRgOYsXsaKehLVPScKJWAULPxMa4N1vCe6szREFlZ7A==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.17.9 + '@babel/core': 7.17.2 '@babel/helper-plugin-utils': 7.16.7 - dev: false + dev: true - /@babel/plugin-transform-react-jsx-development/7.16.7_@babel+core@7.17.9: + /@babel/plugin-transform-react-jsx-development/7.16.7_@babel+core@7.17.10: resolution: {integrity: sha512-RMvQWvpla+xy6MlBpPlrKZCMRs2AGiHOGHY3xRwl0pEeim348dDyxeH4xBsMPbIMhujeq7ihE702eM2Ew0Wo+A==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.17.9 - '@babel/plugin-transform-react-jsx': 7.17.3_@babel+core@7.17.9 + '@babel/core': 7.17.10 + '@babel/plugin-transform-react-jsx': 7.17.3_@babel+core@7.17.10 dev: false - /@babel/plugin-transform-react-jsx-self/7.16.7_@babel+core@7.17.9: + /@babel/plugin-transform-react-jsx-self/7.16.7_@babel+core@7.17.10: resolution: {integrity: sha512-oe5VuWs7J9ilH3BCCApGoYjHoSO48vkjX2CbA5bFVhIuO2HKxA3vyF7rleA4o6/4rTDbk6r8hBW7Ul8E+UZrpA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.17.9 + '@babel/core': 7.17.10 '@babel/helper-plugin-utils': 7.16.7 dev: false - /@babel/plugin-transform-react-jsx-source/7.16.7_@babel+core@7.17.9: + /@babel/plugin-transform-react-jsx-source/7.16.7_@babel+core@7.17.10: resolution: {integrity: sha512-rONFiQz9vgbsnaMtQlZCjIRwhJvlrPET8TabIUK2hzlXw9B9s2Ieaxte1SCOOXMbWRHodbKixNf3BLcWVOQ8Bw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.17.9 + '@babel/core': 7.17.10 '@babel/helper-plugin-utils': 7.16.7 dev: false - /@babel/plugin-transform-react-jsx/7.17.3_@babel+core@7.17.9: + /@babel/plugin-transform-react-jsx/7.17.3_@babel+core@7.17.10: resolution: {integrity: sha512-9tjBm4O07f7mzKSIlEmPdiE6ub7kfIe6Cd+w+oQebpATfTQMAgW+YOuWxogbKVTulA+MEO7byMeIUtQ1z+z+ZQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.17.9 + '@babel/core': 7.17.10 '@babel/helper-annotate-as-pure': 7.16.7 '@babel/helper-module-imports': 7.16.7 '@babel/helper-plugin-utils': 7.16.7 - '@babel/plugin-syntax-jsx': 7.16.7_@babel+core@7.17.9 + '@babel/plugin-syntax-jsx': 7.16.7_@babel+core@7.17.10 '@babel/types': 7.17.0 dev: false - /@babel/plugin-transform-typescript/7.16.8_@babel+core@7.17.9: + /@babel/plugin-transform-typescript/7.16.8_@babel+core@7.17.10: resolution: {integrity: sha512-bHdQ9k7YpBDO2d0NVfkj51DpQcvwIzIusJ7mEUaMlbZq3Kt/U47j24inXZHQ5MDiYpCs+oZiwnXyKedE8+q7AQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.17.9 - '@babel/helper-create-class-features-plugin': 7.16.10_@babel+core@7.17.9 + '@babel/core': 7.17.10 + '@babel/helper-create-class-features-plugin': 7.16.10_@babel+core@7.17.10 '@babel/helper-plugin-utils': 7.16.7 - '@babel/plugin-syntax-typescript': 7.16.7_@babel+core@7.17.9 + '@babel/plugin-syntax-typescript': 7.16.7_@babel+core@7.17.10 transitivePeerDependencies: - supports-color dev: false @@ -1719,8 +1733,8 @@ packages: dependencies: regenerator-runtime: 0.13.9 - /@babel/standalone/7.17.9: - resolution: {integrity: sha512-9wL9AtDlga8avxUrBvQJmhUtJWrelsUL0uV+TcP+49Sb6Pj8/bNIzQzU4dDp0NAPOvnZR/7msFIKsKoCl/W1/w==} + /@babel/standalone/7.17.11: + resolution: {integrity: sha512-47wVYBeTktYHwtzlFuK7qqV/H5X6mU4MUNqpQ9iiJOqnP8rWL0eX0GWLKRsv8D8suYzhuS1K/dtwgGr+26U7Gg==} engines: {node: '>=6.9.0'} dev: false @@ -1738,8 +1752,8 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.16.7 - '@babel/parser': 7.17.8 - '@babel/types': 7.17.0 + '@babel/parser': 7.17.10 + '@babel/types': 7.17.10 /@babel/traverse/7.16.10: resolution: {integrity: sha512-yzuaYXoRJBGMlBhsMJoUW7G1UmSb/eXr/JHYM/MsOJgavJibLwASijW7oXBdw3NQ6T0bW7Ty5P/VarOs9cHmqw==} @@ -1795,18 +1809,18 @@ packages: - supports-color dev: true - /@babel/traverse/7.17.9: - resolution: {integrity: sha512-PQO8sDIJ8SIwipTPiR71kJQCKQYB5NGImbOviK8K+kg5xkNSYXLBupuX9QhatFowrsvo9Hj8WgArg3W7ijNAQw==} + /@babel/traverse/7.17.10: + resolution: {integrity: sha512-VmbrTHQteIdUUQNTb+zE12SHS/xQVIShmBPhlNP12hD5poF2pbITW1Z4172d03HegaQWhLffdkRJYtAzp0AGcw==} engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.16.7 - '@babel/generator': 7.17.9 + '@babel/generator': 7.17.10 '@babel/helper-environment-visitor': 7.16.7 '@babel/helper-function-name': 7.17.9 '@babel/helper-hoist-variables': 7.16.7 '@babel/helper-split-export-declaration': 7.16.7 - '@babel/parser': 7.17.9 - '@babel/types': 7.17.0 + '@babel/parser': 7.17.10 + '@babel/types': 7.17.10 debug: 4.3.4 globals: 11.12.0 transitivePeerDependencies: @@ -1834,6 +1848,13 @@ packages: '@babel/helper-validator-identifier': 7.16.7 to-fast-properties: 2.0.0 + /@babel/types/7.17.10: + resolution: {integrity: sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-validator-identifier': 7.16.7 + to-fast-properties: 2.0.0 + /@bcoe/v8-coverage/0.2.3: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true @@ -1965,8 +1986,8 @@ packages: resolution: {integrity: sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==} dev: false - /@eslint/eslintrc/1.2.1: - resolution: {integrity: sha512-bxvbYnBPN1Gibwyp6NrpnFzA3YtRL3BBAyEAFVIpNTm2Rn4Vy87GA5M4aSn3InRrlsbX5N0GW7XIx+U4SAEKdQ==} + /@eslint/eslintrc/1.2.2: + resolution: {integrity: sha512-lTVWHs7O2hjBFZunXTZYnYqtB9GakA1lnxIf+gKq2nY5gxkkNi/lQvveW6t8gFdOHTg6nG50Xs95PrLqVpcaLg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 @@ -2213,10 +2234,21 @@ packages: chalk: 4.1.2 dev: true + /@jridgewell/gen-mapping/0.1.1: + resolution: {integrity: sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/set-array': 1.1.0 + '@jridgewell/sourcemap-codec': 1.4.10 + /@jridgewell/resolve-uri/3.0.5: resolution: {integrity: sha512-VPeQ7+wH0itvQxnG+lIzWgkysKIr3L9sslimFW55rHMdGu/qCQ5z5h9zq4gI8uBtqkpHhsF4Z/OwExufUCThew==} engines: {node: '>=6.0.0'} + /@jridgewell/set-array/1.1.0: + resolution: {integrity: sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==} + engines: {node: '>=6.0.0'} + /@jridgewell/sourcemap-codec/1.4.10: resolution: {integrity: sha512-Ht8wIW5v165atIX1p+JvKR5ONzUyF4Ac8DZIQ5kZs9zrb6M8SJNXpx1zn04rn65VjBMygRoMXcyYwNK0fT7bEg==} @@ -2250,30 +2282,30 @@ packages: - supports-color dev: false - /@microsoft/api-extractor-model/7.17.1: - resolution: {integrity: sha512-DCDtD8TdEpNk2lW4JvXgwwpxKy70P0JLad55iahwO8A+C63KYsrHIpAzo0FUauh5pwJ0v5QVNIJ+OBgKGteemg==} + /@microsoft/api-extractor-model/7.17.2: + resolution: {integrity: sha512-fYfCeBeLm7jnZligC64qHiH4/vzswFLDfyPpX+uKO36OI2kIeMHrYG0zaezmuinKvE4vg1dAz38zZeDbPvBKGg==} dependencies: '@microsoft/tsdoc': 0.14.1 '@microsoft/tsdoc-config': 0.16.1 - '@rushstack/node-core-library': 3.45.3 + '@rushstack/node-core-library': 3.45.4 dev: true - /@microsoft/api-extractor/7.22.2: - resolution: {integrity: sha512-G7vXz6UHz+qoaUGPf2k5Md4bSpHii9nFys3sIe3bmFUbmhAe+HfSB/dCn1PsLhW7tZfEXwMHTj7fbL5vcZkrEw==} + /@microsoft/api-extractor/7.23.0: + resolution: {integrity: sha512-fbdX05RVE1EMA7nvyRHuS9nx1pryhjgURDx6pQlE/9yOXQ5PO7MpYdfWGaRsQwyYuU3+tPxgro819c0R3AK6KA==} hasBin: true dependencies: - '@microsoft/api-extractor-model': 7.17.1 + '@microsoft/api-extractor-model': 7.17.2 '@microsoft/tsdoc': 0.14.1 '@microsoft/tsdoc-config': 0.16.1 - '@rushstack/node-core-library': 3.45.3 - '@rushstack/rig-package': 0.3.10 - '@rushstack/ts-command-line': 4.10.9 + '@rushstack/node-core-library': 3.45.4 + '@rushstack/rig-package': 0.3.11 + '@rushstack/ts-command-line': 4.10.10 colors: 1.2.5 lodash: 4.17.21 resolve: 1.17.0 semver: 7.3.7 source-map: 0.6.1 - typescript: 4.5.4 + typescript: 4.6.4 dev: true /@microsoft/tsdoc-config/0.16.1: @@ -2411,7 +2443,7 @@ packages: rollup: 2.62.0 dev: true - /@rollup/plugin-typescript/8.3.2_7c5ff569c0887b4f0035eb7cb6988163: + /@rollup/plugin-typescript/8.3.2_83df2083f1d8ae39f870809a13a7071e: resolution: {integrity: sha512-MtgyR5LNHZr3GyN0tM7gNO9D0CS+Y+vflS4v/PHmrX17JCkHUYKvQ5jN5o3cz1YKllM3duXUqu3yOHwMPUxhDg==} engines: {node: '>=8.0.0'} peerDependencies: @@ -2422,7 +2454,7 @@ packages: '@rollup/pluginutils': 3.1.0_rollup@2.62.0 resolve: 1.22.0 rollup: 2.62.0 - tslib: 2.3.1 + tslib: 2.4.0 typescript: 4.5.4 dev: true @@ -2445,8 +2477,8 @@ packages: estree-walker: 2.0.2 picomatch: 2.3.1 - /@rushstack/node-core-library/3.45.3: - resolution: {integrity: sha512-Rn0mxqC3MPb+YbvaeFcRWfcYHLwyZ99/ffYA8chpq5OpqoY+Mr1ycTbMvzl5AxWf1pYmi/2+Eo3iTOsQdYR8xw==} + /@rushstack/node-core-library/3.45.4: + resolution: {integrity: sha512-FMoEQWjK7nWAO2uFgV1eVpVhY9ZDGOdIIomi9zTej64cKJ+8/Nvu+ny0xKaUDEjw/ALftN2D2ml7L0RDpW/Z9g==} dependencies: '@types/node': 12.20.24 colors: 1.2.5 @@ -2459,15 +2491,15 @@ packages: z-schema: 5.0.2 dev: true - /@rushstack/rig-package/0.3.10: - resolution: {integrity: sha512-4Z2HhXM4YBWOi4ZYFQNK6Yxz641v+cvc8NKiaNZh+RIdNb3D4Rfpy3XUkggbCozpfDriBfL1+KaXlJtfJfAIXw==} + /@rushstack/rig-package/0.3.11: + resolution: {integrity: sha512-uI1/g5oQPtyrT9nStoyX/xgZSLa2b+srRFaDk3r1eqC7zA5th4/bvTGl2QfV3C9NcP+coSqmk5mFJkUfH6i3Lw==} dependencies: resolve: 1.17.0 strip-json-comments: 3.1.1 dev: true - /@rushstack/ts-command-line/4.10.9: - resolution: {integrity: sha512-TE3eZgHNVHOY3p8lp38FoNEJUr0+swPb24sCcYuwlC+MHgMGXyJNM+p7l3TKSBRiY01XShoL2k601oGwL00KlA==} + /@rushstack/ts-command-line/4.10.10: + resolution: {integrity: sha512-F+MH7InPDXqX40qvvcEsnvPpmg566SBpfFqj2fcCh8RjM6AyOoWlXc8zx7giBD3ZN85NVAEjZAgrcLU0z+R2yg==} dependencies: '@types/argparse': 1.0.38 argparse: 1.0.10 @@ -2679,8 +2711,8 @@ packages: '@types/node': 17.0.25 dev: true - /@types/resolve/1.20.1: - resolution: {integrity: sha512-Ku5+GPFa12S3W26Uwtw+xyrtIpaZsGYHH6zxNbZlstmlvMYSZRzOwzwsXbxlVUbHyUucctSyuFtu6bNxwYomIw==} + /@types/resolve/1.20.2: + resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} dev: true /@types/sass/1.43.1: @@ -2731,8 +2763,8 @@ packages: dev: true optional: true - /@typescript-eslint/eslint-plugin/5.20.0_0df7beb8e4d849cfe6bb8e844ccdebfd: - resolution: {integrity: sha512-fapGzoxilCn3sBtC6NtXZX6+P/Hef7VDbyfGqTTpzYydwhlkevB+0vE0EnmHPVTVSy68GUncyJ/2PcrFBeCo5Q==} + /@typescript-eslint/eslint-plugin/5.21.0_85142f655c5c9420758b0f4908692036: + resolution: {integrity: sha512-fTU85q8v5ZLpoZEyn/u1S2qrFOhi33Edo2CZ0+q1gDaWWm0JuPh3bgOyU8lM0edIEYgKLDkPFiZX2MOupgjlyg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -2742,12 +2774,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.20.0_eslint@8.13.0+typescript@4.5.4 - '@typescript-eslint/scope-manager': 5.20.0 - '@typescript-eslint/type-utils': 5.20.0_eslint@8.13.0+typescript@4.5.4 - '@typescript-eslint/utils': 5.20.0_eslint@8.13.0+typescript@4.5.4 + '@typescript-eslint/parser': 5.21.0_eslint@8.14.0+typescript@4.5.4 + '@typescript-eslint/scope-manager': 5.21.0 + '@typescript-eslint/type-utils': 5.21.0_eslint@8.14.0+typescript@4.5.4 + '@typescript-eslint/utils': 5.21.0_eslint@8.14.0+typescript@4.5.4 debug: 4.3.4 - eslint: 8.13.0 + eslint: 8.14.0 functional-red-black-tree: 1.0.1 ignore: 5.2.0 regexpp: 3.2.0 @@ -2758,8 +2790,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.20.0_eslint@8.13.0+typescript@4.5.4: - resolution: {integrity: sha512-UWKibrCZQCYvobmu3/N8TWbEeo/EPQbS41Ux1F9XqPzGuV7pfg6n50ZrFo6hryynD8qOTTfLHtHjjdQtxJ0h/w==} + /@typescript-eslint/parser/5.21.0_eslint@8.14.0+typescript@4.5.4: + resolution: {integrity: sha512-8RUwTO77hstXUr3pZoWZbRQUxXcSXafZ8/5gpnQCfXvgmP9gpNlRGlWzvfbEQ14TLjmtU8eGnONkff8U2ui2Eg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -2768,26 +2800,26 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.20.0 - '@typescript-eslint/types': 5.20.0 - '@typescript-eslint/typescript-estree': 5.20.0_typescript@4.5.4 + '@typescript-eslint/scope-manager': 5.21.0 + '@typescript-eslint/types': 5.21.0 + '@typescript-eslint/typescript-estree': 5.21.0_typescript@4.5.4 debug: 4.3.4 - eslint: 8.13.0 + eslint: 8.14.0 typescript: 4.5.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager/5.20.0: - resolution: {integrity: sha512-h9KtuPZ4D/JuX7rpp1iKg3zOH0WNEa+ZIXwpW/KWmEFDxlA/HSfCMhiyF1HS/drTICjIbpA6OqkAhrP/zkCStg==} + /@typescript-eslint/scope-manager/5.21.0: + resolution: {integrity: sha512-XTX0g0IhvzcH/e3393SvjRCfYQxgxtYzL3UREteUneo72EFlt7UNoiYnikUtmGVobTbhUDByhJ4xRBNe+34kOQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.20.0 - '@typescript-eslint/visitor-keys': 5.20.0 + '@typescript-eslint/types': 5.21.0 + '@typescript-eslint/visitor-keys': 5.21.0 dev: true - /@typescript-eslint/type-utils/5.20.0_eslint@8.13.0+typescript@4.5.4: - resolution: {integrity: sha512-WxNrCwYB3N/m8ceyoGCgbLmuZwupvzN0rE8NBuwnl7APgjv24ZJIjkNzoFBXPRCGzLNkoU/WfanW0exvp/+3Iw==} + /@typescript-eslint/type-utils/5.21.0_eslint@8.14.0+typescript@4.5.4: + resolution: {integrity: sha512-MxmLZj0tkGlkcZCSE17ORaHl8Th3JQwBzyXL/uvC6sNmu128LsgjTX0NIzy+wdH2J7Pd02GN8FaoudJntFvSOw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -2796,22 +2828,22 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.20.0_eslint@8.13.0+typescript@4.5.4 + '@typescript-eslint/utils': 5.21.0_eslint@8.14.0+typescript@4.5.4 debug: 4.3.4 - eslint: 8.13.0 + eslint: 8.14.0 tsutils: 3.21.0_typescript@4.5.4 typescript: 4.5.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types/5.20.0: - resolution: {integrity: sha512-+d8wprF9GyvPwtoB4CxBAR/s0rpP25XKgnOvMf/gMXYDvlUC3rPFHupdTQ/ow9vn7UDe5rX02ovGYQbv/IUCbg==} + /@typescript-eslint/types/5.21.0: + resolution: {integrity: sha512-XnOOo5Wc2cBlq8Lh5WNvAgHzpjnEzxn4CJBwGkcau7b/tZ556qrWXQz4DJyChYg8JZAD06kczrdgFPpEQZfDsA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.20.0_typescript@4.5.4: - resolution: {integrity: sha512-36xLjP/+bXusLMrT9fMMYy1KJAGgHhlER2TqpUVDYUQg4w0q/NW/sg4UGAgVwAqb8V4zYg43KMUpM8vV2lve6w==} + /@typescript-eslint/typescript-estree/5.21.0_typescript@4.5.4: + resolution: {integrity: sha512-Y8Y2T2FNvm08qlcoSMoNchh9y2Uj3QmjtwNMdRQkcFG7Muz//wfJBGBxh8R7HAGQFpgYpdHqUpEoPQk+q9Kjfg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -2819,8 +2851,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.20.0 - '@typescript-eslint/visitor-keys': 5.20.0 + '@typescript-eslint/types': 5.21.0 + '@typescript-eslint/visitor-keys': 5.21.0 debug: 4.3.4 globby: 11.0.4 is-glob: 4.0.3 @@ -2831,29 +2863,29 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.20.0_eslint@8.13.0+typescript@4.5.4: - resolution: {integrity: sha512-lHONGJL1LIO12Ujyx8L8xKbwWSkoUKFSO+0wDAqGXiudWB2EO7WEUT+YZLtVbmOmSllAjLb9tpoIPwpRe5Tn6w==} + /@typescript-eslint/utils/5.21.0_eslint@8.14.0+typescript@4.5.4: + resolution: {integrity: sha512-q/emogbND9wry7zxy7VYri+7ydawo2HDZhRZ5k6yggIvXa7PvBbAAZ4PFH/oZLem72ezC4Pr63rJvDK/sTlL8Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: '@types/json-schema': 7.0.9 - '@typescript-eslint/scope-manager': 5.20.0 - '@typescript-eslint/types': 5.20.0 - '@typescript-eslint/typescript-estree': 5.20.0_typescript@4.5.4 - eslint: 8.13.0 + '@typescript-eslint/scope-manager': 5.21.0 + '@typescript-eslint/types': 5.21.0 + '@typescript-eslint/typescript-estree': 5.21.0_typescript@4.5.4 + eslint: 8.14.0 eslint-scope: 5.1.1 - eslint-utils: 3.0.0_eslint@8.13.0 + eslint-utils: 3.0.0_eslint@8.14.0 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/visitor-keys/5.20.0: - resolution: {integrity: sha512-1flRpNF+0CAQkMNlTJ6L/Z5jiODG/e5+7mk6XwtPOUS3UrTz3UOiAg9jG2VtKsWI6rZQfy4C6a232QNRZTRGlg==} + /@typescript-eslint/visitor-keys/5.21.0: + resolution: {integrity: sha512-SX8jNN+iHqAF0riZQMkm7e8+POXa/fXw5cxL+gjpyP+FI+JVNhii53EmQgDAfDcBpFekYSlO0fGytMQwRiMQCA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.20.0 + '@typescript-eslint/types': 5.21.0 eslint-visitor-keys: 3.3.0 dev: true @@ -2861,11 +2893,11 @@ packages: resolution: {integrity: sha512-hz4R8tS5jMn8lDq6iD+yWL6XNB699pGIVLk7WSJnn1dbpjaazsjZQkieJoRX6gW5zpYSCFqQ7jUquPNY65tQYA==} dev: false - /@vue/babel-plugin-jsx/1.1.1_@babel+core@7.17.9: + /@vue/babel-plugin-jsx/1.1.1_@babel+core@7.17.10: resolution: {integrity: sha512-j2uVfZjnB5+zkcbc/zsOc0fSNGCMMjaEXP52wdwdIfn0qjFfEYpYZBFKFg+HHnQeJCVrjOeO0YxgaL7DMrym9w==} dependencies: '@babel/helper-module-imports': 7.16.0 - '@babel/plugin-syntax-jsx': 7.16.5_@babel+core@7.17.9 + '@babel/plugin-syntax-jsx': 7.16.5_@babel+core@7.17.10 '@babel/template': 7.16.0 '@babel/traverse': 7.16.5 '@babel/types': 7.16.0 @@ -2897,7 +2929,7 @@ packages: /@vue/compiler-core/3.2.33: resolution: {integrity: sha512-AAmr52ji3Zhk7IKIuigX2osWWsb2nQE5xsdFYjdnmtQ4gymmqXbjLvkSE174+fF3A3kstYrTgGkqgOEbsdLDpw==} dependencies: - '@babel/parser': 7.17.9 + '@babel/parser': 7.17.10 '@vue/shared': 3.2.33 estree-walker: 2.0.2 source-map: 0.6.1 @@ -3137,12 +3169,12 @@ packages: acorn-walk: 7.2.0 dev: true - /acorn-jsx/5.3.2_acorn@8.7.0: + /acorn-jsx/5.3.2_acorn@8.7.1: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.7.0 + acorn: 8.7.1 dev: true /acorn-node/1.8.2: @@ -3173,6 +3205,12 @@ packages: hasBin: true dev: true + /acorn/8.7.1: + resolution: {integrity: sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true + /add-stream/1.0.0: resolution: {integrity: sha1-anmQQ3ynNtXhKI25K9MmbV9csqo=} dev: true @@ -3530,6 +3568,18 @@ packages: node-releases: 2.0.1 picocolors: 1.0.0 + /browserslist/4.20.3: + resolution: {integrity: sha512-NBhymBQl1zM0Y5dQT/O+xiLP9/rzOIQdKM/eMJBAq7yBgaB6krIYLGejrwVYnSHZdqjscB1SPuAjHwxjvN6Wdg==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + dependencies: + caniuse-lite: 1.0.30001334 + electron-to-chromium: 1.4.129 + escalade: 3.1.1 + node-releases: 2.0.4 + picocolors: 1.0.0 + dev: false + /bs-logger/0.2.6: resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==} engines: {node: '>= 6'} @@ -3614,6 +3664,10 @@ packages: /caniuse-lite/1.0.30001294: resolution: {integrity: sha512-LiMlrs1nSKZ8qkNhpUf5KD0Al1KCBE3zaT7OLOwEkagXMEDij98SiOovn9wxVGQpklk9vVC/pUSqgYmkmKOS8g==} + /caniuse-lite/1.0.30001334: + resolution: {integrity: sha512-kbaCEBRRVSoeNs74sCuq92MJyGrMtjWVfhltoHUCW4t4pXFvGjUBrfo47weBRViHkiV3eBYyIsfl956NtHGazw==} + dev: false + /chalk/2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} @@ -4093,8 +4147,8 @@ packages: is-what: 3.14.1 dev: true - /core-js/3.22.2: - resolution: {integrity: sha512-Z5I2vzDnEIqO2YhELVMFcL1An2CIsFe9Q7byZhs8c/QxummxZlAHw33TUHbIte987LkisOgL0LwQ1P9D6VISnA==} + /core-js/3.22.3: + resolution: {integrity: sha512-1t+2a/d2lppW1gkLXx3pKPVGbBdxXAkqztvWb1EJ8oF8O2gIGiytzflNiFEehYwVK/t2ryUsGBoOFFvNx95mbg==} requiresBuild: true dev: false @@ -4470,6 +4524,10 @@ packages: resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=} dev: true + /electron-to-chromium/1.4.129: + resolution: {integrity: sha512-GgtN6bsDtHdtXJtlMYZWGB/uOyjZWjmRDumXTas7dGBaB9zUyCjzHet1DY2KhyHN8R0GLbzZWqm4efeddqqyRQ==} + dev: false + /electron-to-chromium/1.4.29: resolution: {integrity: sha512-N2Jbwxo5Rum8G2YXeUxycs1sv4Qme/ry71HG73bv8BvZl+I/4JtRgK/En+ST/Wh/yF1fqvVCY4jZBgMxnhjtBA==} @@ -4804,25 +4862,25 @@ packages: engines: {node: '>= 14.6.0', npm: '>= 6.0.0', pnpm: '>= 6.32.9'} dev: true - /eslint-plugin-es/3.0.1_eslint@8.13.0: + /eslint-plugin-es/3.0.1_eslint@8.14.0: resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==} engines: {node: '>=8.10.0'} peerDependencies: eslint: '>=4.19.1' dependencies: - eslint: 8.13.0 + eslint: 8.14.0 eslint-utils: 2.1.0 regexpp: 3.2.0 dev: true - /eslint-plugin-node/11.1.0_eslint@8.13.0: + /eslint-plugin-node/11.1.0_eslint@8.14.0: resolution: {integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==} engines: {node: '>=8.10.0'} peerDependencies: eslint: '>=5.16.0' dependencies: - eslint: 8.13.0 - eslint-plugin-es: 3.0.1_eslint@8.13.0 + eslint: 8.14.0 + eslint-plugin-es: 3.0.1_eslint@8.14.0 eslint-utils: 2.1.0 ignore: 5.2.0 minimatch: 3.0.4 @@ -4853,13 +4911,13 @@ packages: eslint-visitor-keys: 1.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.13.0: + /eslint-utils/3.0.0_eslint@8.14.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.13.0 + eslint: 8.14.0 eslint-visitor-keys: 2.1.0 dev: true @@ -4878,12 +4936,12 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.13.0: - resolution: {integrity: sha512-D+Xei61eInqauAyTJ6C0q6x9mx7kTUC1KZ0m0LSEexR0V+e94K12LmWX076ZIsldwfQ2RONdaJe0re0TRGQbRQ==} + /eslint/8.14.0: + resolution: {integrity: sha512-3/CE4aJX7LNEiE3i6FeodHmI/38GZtWCsAtsymScmzYapx8q1nVVb+eLcLSzATmCPXw5pT4TqVs1E0OmxAd9tw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint/eslintrc': 1.2.1 + '@eslint/eslintrc': 1.2.2 '@humanwhocodes/config-array': 0.9.2 ajv: 6.12.6 chalk: 4.1.2 @@ -4892,7 +4950,7 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.13.0 + eslint-utils: 3.0.0_eslint@8.14.0 eslint-visitor-keys: 3.3.0 espree: 9.3.1 esquery: 1.4.0 @@ -4926,8 +4984,8 @@ packages: resolution: {integrity: sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.7.0 - acorn-jsx: 5.3.2_acorn@8.7.0 + acorn: 8.7.1 + acorn-jsx: 5.3.2_acorn@8.7.1 eslint-visitor-keys: 3.3.0 dev: true @@ -5619,13 +5677,13 @@ packages: resolution: {integrity: sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=} dev: true - /icss-utils/5.1.0_postcss@8.4.12: + /icss-utils/5.1.0_postcss@8.4.13: resolution: {integrity: sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - postcss: 8.4.12 + postcss: 8.4.13 dev: true /ignore/5.2.0: @@ -6505,7 +6563,7 @@ packages: optional: true dependencies: abab: 2.0.5 - acorn: 8.7.0 + acorn: 8.7.1 acorn-globals: 6.0.0 cssom: 0.4.4 cssstyle: 2.3.0 @@ -6673,8 +6731,8 @@ packages: /lines-and-columns/1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - /lint-staged/12.4.0: - resolution: {integrity: sha512-3X7MR0h9b7qf4iXf/1n7RlVAx+EzpAZXoCEMhVSpaBlgKDfH2ewf+QUm7BddFyq29v4dgPP+8+uYpWuSWx035A==} + /lint-staged/12.4.1: + resolution: {integrity: sha512-PTXgzpflrQ+pODQTG116QNB+Q6uUTDg5B5HqGvNhoQSGt8Qy+MA/6zSnR8n38+sxP5TapzeQGTvoKni0KRS8Vg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hasBin: true dependencies: @@ -6785,6 +6843,10 @@ packages: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} dev: true + /lodash.sortby/4.7.0: + resolution: {integrity: sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=} + dev: true + /lodash.topath/4.5.2: resolution: {integrity: sha1-NhY1Hzu6YZlKCTGYlmC9AyVP0Ak=} dev: false @@ -7104,6 +7166,12 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + /nanoid/3.3.3: + resolution: {integrity: sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: false + /natural-compare/1.4.0: resolution: {integrity: sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=} dev: true @@ -7179,6 +7247,10 @@ packages: /node-releases/2.0.1: resolution: {integrity: sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==} + /node-releases/2.0.4: + resolution: {integrity: sha512-gbMzqQtTtDz/00jQzZ21PQzdI9PyLYqUSvD0p3naOhX4odFji0ZxYdnVwPTxmSwkmxhcFImpozceidSG+AgoPQ==} + dev: false + /nopt/5.0.0: resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} engines: {node: '>=6'} @@ -7615,13 +7687,13 @@ packages: engines: {node: '>=12.13.0'} dev: true - /postcss-import/14.1.0_postcss@8.4.12: + /postcss-import/14.1.0_postcss@8.4.13: resolution: {integrity: sha512-flwI+Vgm4SElObFVPpTIT7SU7R3qk2L7PyduMcokiaVKuWv9d/U+Gm/QAd8NDLuykTWTkcrjOeD2Pp1rMeBTGw==} engines: {node: '>=10.0.0'} peerDependencies: postcss: ^8.0.0 dependencies: - postcss: 8.4.12 + postcss: 8.4.13 postcss-value-parser: 4.2.0 read-cache: 1.0.0 resolve: 1.22.0 @@ -7677,7 +7749,7 @@ packages: yaml: 1.10.2 dev: false - /postcss-load-config/3.1.4_postcss@8.4.12+ts-node@10.4.0: + /postcss-load-config/3.1.4_postcss@8.4.13+ts-node@10.4.0: resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==} engines: {node: '>= 10'} peerDependencies: @@ -7690,53 +7762,53 @@ packages: optional: true dependencies: lilconfig: 2.0.5 - postcss: 8.4.12 + postcss: 8.4.13 ts-node: 10.4.0_233d9fcfccc8abc8f146a08357d842da yaml: 1.10.2 dev: true - /postcss-modules-extract-imports/3.0.0_postcss@8.4.12: + /postcss-modules-extract-imports/3.0.0_postcss@8.4.13: resolution: {integrity: sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - postcss: 8.4.12 + postcss: 8.4.13 dev: true - /postcss-modules-local-by-default/4.0.0_postcss@8.4.12: + /postcss-modules-local-by-default/4.0.0_postcss@8.4.13: resolution: {integrity: sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - icss-utils: 5.1.0_postcss@8.4.12 - postcss: 8.4.12 + icss-utils: 5.1.0_postcss@8.4.13 + postcss: 8.4.13 postcss-selector-parser: 6.0.8 postcss-value-parser: 4.2.0 dev: true - /postcss-modules-scope/3.0.0_postcss@8.4.12: + /postcss-modules-scope/3.0.0_postcss@8.4.13: resolution: {integrity: sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - postcss: 8.4.12 + postcss: 8.4.13 postcss-selector-parser: 6.0.8 dev: true - /postcss-modules-values/4.0.0_postcss@8.4.12: + /postcss-modules-values/4.0.0_postcss@8.4.13: resolution: {integrity: sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - icss-utils: 5.1.0_postcss@8.4.12 - postcss: 8.4.12 + icss-utils: 5.1.0_postcss@8.4.13 + postcss: 8.4.13 dev: true - /postcss-modules/4.3.1_postcss@8.4.12: + /postcss-modules/4.3.1_postcss@8.4.13: resolution: {integrity: sha512-ItUhSUxBBdNamkT3KzIZwYNNRFKmkJrofvC2nWab3CPKhYBQ1f27XXh1PAPE27Psx58jeelPsxWB/+og+KEH0Q==} peerDependencies: postcss: ^8.0.0 @@ -7744,11 +7816,11 @@ packages: generic-names: 4.0.0 icss-replace-symbols: 1.1.0 lodash.camelcase: 4.3.0 - postcss: 8.4.12 - postcss-modules-extract-imports: 3.0.0_postcss@8.4.12 - postcss-modules-local-by-default: 4.0.0_postcss@8.4.12 - postcss-modules-scope: 3.0.0_postcss@8.4.12 - postcss-modules-values: 4.0.0_postcss@8.4.12 + postcss: 8.4.13 + postcss-modules-extract-imports: 3.0.0_postcss@8.4.13 + postcss-modules-local-by-default: 4.0.0_postcss@8.4.13 + postcss-modules-scope: 3.0.0_postcss@8.4.13 + postcss-modules-values: 4.0.0_postcss@8.4.13 string-hash: 1.1.3 dev: true @@ -7800,6 +7872,15 @@ packages: picocolors: 1.0.0 source-map-js: 1.0.2 + /postcss/8.4.13: + resolution: {integrity: sha512-jtL6eTBrza5MPzy8oJLFuUscHDXTV5KcLlqAWHl5q5WYRfnNRGSmOZmOZ1T6Gy7A99mOZfqungmZMpMmCVJ8ZA==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.3 + picocolors: 1.0.0 + source-map-js: 1.0.2 + dev: false + /postcss/8.4.5: resolution: {integrity: sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==} engines: {node: ^10 || ^12 || >=14} @@ -8096,8 +8177,8 @@ packages: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} dev: true - /react-refresh/0.12.0: - resolution: {integrity: sha512-suLIhrU2IHKL5JEKR/fAwJv7bbeq4kJ+pJopf77jHwuR+HmJS/HbrPIGsTBUVfw7tXPOmYv7UJ7PCaN49e8x4A==} + /react-refresh/0.13.0: + resolution: {integrity: sha512-XP8A9BT0CpRBD+NYLLeIhld/RqG9+gktUjW1FkE+Vm7OCinbG1SshcK5tb9ls4kzvjZr9mOQc7HYgBngEyPAXg==} engines: {node: '>=0.10.0'} dev: false @@ -8392,7 +8473,7 @@ packages: /rxjs/7.5.2: resolution: {integrity: sha512-PwDt186XaL3QN5qXj/H9DGyHhP3/RYYgZZwqBv9Tv8rsAaiwFH1IsJJlcgD37J7UW5a6O67qX0KWKS3/pu0m4w==} dependencies: - tslib: 2.3.1 + tslib: 2.4.0 dev: true /safe-buffer/5.1.2: @@ -8671,6 +8752,13 @@ packages: engines: {node: '>= 8'} dev: true + /source-map/0.8.0-beta.0: + resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} + engines: {node: '>= 8'} + dependencies: + whatwg-url: 7.1.0 + dev: true + /sourcemap-codec/1.4.8: resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==} @@ -9090,14 +9178,14 @@ packages: supports-hyperlinks: 2.2.0 dev: true - /terser/5.12.1: - resolution: {integrity: sha512-NXbs+7nisos5E+yXwAD+y7zrcTkMqb0dEJxIGtSKPdCBzopf7ni4odPul2aechpV7EXNvOudYOX2bb5tln1jbQ==} + /terser/5.13.1: + resolution: {integrity: sha512-hn4WKOfwnwbYfe48NgrQjqNOH9jzLqRcIfbYytOXCOv46LBfWr9bDS17MQqOi+BWGD0sJK3Sj5NC/gJjiojaoA==} engines: {node: '>=10'} hasBin: true dependencies: - acorn: 8.7.0 + acorn: 8.7.1 commander: 2.20.3 - source-map: 0.7.3 + source-map: 0.8.0-beta.0 source-map-support: 0.5.21 dev: true @@ -9203,6 +9291,12 @@ packages: /tr46/0.0.3: resolution: {integrity: sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=} + /tr46/1.0.1: + resolution: {integrity: sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=} + dependencies: + punycode: 2.1.1 + dev: true + /tr46/2.1.0: resolution: {integrity: sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==} engines: {node: '>=8'} @@ -9307,6 +9401,10 @@ packages: resolution: {integrity: sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==} dev: true + /tslib/2.4.0: + resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} + dev: true + /tsutils/3.21.0_typescript@4.5.4: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} @@ -9389,6 +9487,12 @@ packages: hasBin: true dev: true + /typescript/4.6.4: + resolution: {integrity: sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==} + engines: {node: '>=4.2.0'} + hasBin: true + dev: true + /typeson-registry/1.0.0-alpha.39: resolution: {integrity: sha512-NeGDEquhw+yfwNhguLPcZ9Oj0fzbADiX4R0WxvoY8nGhy98IbzQy1sezjoEFWOywOboj/DWehI+/aUlRVrJnnw==} engines: {node: '>=10.0.0'} @@ -9626,6 +9730,10 @@ packages: /webidl-conversions/3.0.1: resolution: {integrity: sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=} + /webidl-conversions/4.0.2: + resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} + dev: true + /webidl-conversions/5.0.0: resolution: {integrity: sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==} engines: {node: '>=8'} @@ -9652,6 +9760,14 @@ packages: tr46: 0.0.3 webidl-conversions: 3.0.1 + /whatwg-url/7.1.0: + resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} + dependencies: + lodash.sortby: 4.7.0 + tr46: 1.0.1 + webidl-conversions: 4.0.2 + dev: true + /whatwg-url/8.7.0: resolution: {integrity: sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==} engines: {node: '>=10'} @@ -9767,8 +9883,8 @@ packages: optional: true dev: true - /ws/8.5.0: - resolution: {integrity: sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==} + /ws/8.6.0: + resolution: {integrity: sha512-AzmM3aH3gk0aX7/rZLYvjdvZooofDu3fFOzGqcSnQ1tOcTWwhM/o+q++E8mAyVVIyUdajrkzWUGftaVSDLn1bw==} engines: {node: '>=10.0.0'} peerDependencies: bufferutil: ^4.0.1 From cf8a48a6c8b3b1f9ef2a2cf41765d456f85c6cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Mon, 2 May 2022 16:41:05 +0900 Subject: [PATCH 0612/1287] fix(css): inline css module when ssr, minify issue (fix #5471) (#7807) --- packages/playground/css/__tests__/css.spec.ts | 10 ++++++++- packages/vite/src/node/plugins/css.ts | 22 +++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/packages/playground/css/__tests__/css.spec.ts b/packages/playground/css/__tests__/css.spec.ts index 6ca00e760349b1..9869bb34d2c690 100644 --- a/packages/playground/css/__tests__/css.spec.ts +++ b/packages/playground/css/__tests__/css.spec.ts @@ -15,7 +15,11 @@ import { // in later assertions to ensure CSS HMR doesn't reload the page test('imported css', async () => { const css = await page.textContent('.imported-css') - expect(css).toContain('.imported {') + expect(css).toMatch(/\.imported ?{/) + if (isBuild) { + expect(css.trim()).not.toContain('\n') // check minified + } + const glob = await page.textContent('.imported-css-glob') expect(glob).toContain('.dir-import') const globEager = await page.textContent('.imported-css-globEager') @@ -372,6 +376,10 @@ test('inlined-code', async () => { // should resolve assets expect(code).toContain('background:') expect(code).not.toContain('__VITE_ASSET__') + + if (isBuild) { + expect(code.trim()).not.toContain('\n') // check minified + } }) test('minify css', async () => { diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index b3ea3338cecc04..9ead17822d23a9 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -300,11 +300,17 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { return } + const isHTMLProxy = htmlProxyRE.test(id) const inlined = inlineRE.test(id) const modules = cssModulesCache.get(config)!.get(id) - const isHTMLProxy = htmlProxyRE.test(id) + + // #6984, #7552 + // `foo.module.css` => modulesCode + // `foo.module.css?inline` => cssContent const modulesCode = - modules && dataToEsm(modules, { namedExports: true, preferConst: true }) + modules && + !inlined && + dataToEsm(modules, { namedExports: true, preferConst: true }) if (config.command === 'serve') { if (isDirectCSSRequest(id)) { @@ -366,12 +372,14 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { let code: string if (usedRE.test(id)) { - if (inlined) { - code = `export default ${JSON.stringify( - await minifyCSS(css, config) - )}` + if (modulesCode) { + code = modulesCode } else { - code = modulesCode || `export default ${JSON.stringify(css)}` + let content = css + if (config.build.minify) { + content = await minifyCSS(content, config) + } + code = `export default ${JSON.stringify(content)}` } } else { code = `export default ''` From bf40e5c88db4281b035f67d1789cccf66333ce23 Mon Sep 17 00:00:00 2001 From: xyl66 <492113976@qq.com> Date: Mon, 2 May 2022 17:25:24 +0800 Subject: [PATCH 0613/1287] fix(plugin-react): React is not defined when component name is lowercase (#6838) --- .../src/jsx-runtime/restore-jsx.spec.ts | 55 +++++++++++++++++++ .../src/jsx-runtime/restore-jsx.ts | 42 ++++++++------ 2 files changed, 81 insertions(+), 16 deletions(-) create mode 100644 packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts diff --git a/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts b/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts new file mode 100644 index 00000000000000..adbd7a60599c25 --- /dev/null +++ b/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts @@ -0,0 +1,55 @@ +import { restoreJSX } from './restore-jsx' +import * as babel from '@babel/core' + +async function jsx(sourceCode: string) { + const [ast] = await restoreJSX(babel, sourceCode, 'test.js') + if (ast === null) { + return ast + } + const { code } = await babel.transformFromAstAsync(ast, null, { + configFile: false + }) + return code +} +// jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react'; +// React__default.createElement(Foo)`) +// Tests adapted from: https://github.com/flying-sheep/babel-plugin-transform-react-createelement-to-jsx/blob/63137b6/test/index.js +describe('restore-jsx', () => { + it('should trans to ', async () => { + expect( + await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react'; + React__default.createElement(foo)`) + ).toBeNull() + expect( + await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react'; + React__default.createElement("h1")`) + ).toMatch(`

;`) + expect( + await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react'; + React__default.createElement(Foo)`) + ).toMatch(`;`) + expect( + await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react'; + React__default.createElement(Foo.Bar)`) + ).toMatch(`;`) + expect( + await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react'; + React__default.createElement(Foo.Bar.Baz)`) + ).toMatch(`;`) + }) + + it('should handle props', async () => { + expect( + await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react'; + React__default.createElement(foo, {hi: there})`) + ).toBeNull() + expect( + await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react'; + React__default.createElement("h1", {hi: there})`) + ).toMatch(`

;`) + expect( + await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react'; + React__default.createElement(Foo, {hi: there})`) + ).toMatch(`;`) + }) +}) diff --git a/packages/plugin-react/src/jsx-runtime/restore-jsx.ts b/packages/plugin-react/src/jsx-runtime/restore-jsx.ts index 268153f4ba5d45..dbc2218d2343ff 100644 --- a/packages/plugin-react/src/jsx-runtime/restore-jsx.ts +++ b/packages/plugin-react/src/jsx-runtime/restore-jsx.ts @@ -20,32 +20,42 @@ export async function restoreJSX( } const [reactAlias, isCommonJS] = parseReactAlias(code) + if (!reactAlias) { return jsxNotFound } - const reactJsxRE = new RegExp( - '\\b' + reactAlias + '\\.(createElement|Fragment)\\b', - 'g' - ) - let hasCompiledJsx = false - code = code.replace(reactJsxRE, (_, prop) => { - hasCompiledJsx = true - // Replace with "React" so JSX can be reverse compiled. - return 'React.' + prop - }) + + const fragmentPattern = `\\b${reactAlias}\\.Fragment\\b` + const createElementPattern = `\\b${reactAlias}\\.createElement\\(\\s*([A-Z"'][\\w$.]*["']?)` + + // Replace the alias with "React" so JSX can be reverse compiled. + code = code + .replace(new RegExp(fragmentPattern, 'g'), () => { + hasCompiledJsx = true + return 'React.Fragment' + }) + .replace(new RegExp(createElementPattern, 'g'), (original, component) => { + if (/^[a-z][\w$]*$/.test(component)) { + // Take care not to replace the alias for `createElement` calls whose + // component is a lowercased variable, since the `restoreJSX` Babel + // plugin leaves them untouched. + return original + } + hasCompiledJsx = true + return ( + 'React.createElement(' + + // Assume `Fragment` is equivalent to `React.Fragment` so modules + // that use `import {Fragment} from 'react'` are reverse compiled. + (component === 'Fragment' ? 'React.Fragment' : component) + ) + }) if (!hasCompiledJsx) { return jsxNotFound } - // Support modules that use `import {Fragment} from 'react'` - code = code.replace( - /createElement\(Fragment,/g, - 'createElement(React.Fragment,' - ) - babelRestoreJSX ||= import('./babel-restore-jsx') const result = await babel.transformAsync(code, { From d58c03088c2eed33417866b46238070fbaffa0f2 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 2 May 2022 15:49:50 +0200 Subject: [PATCH 0614/1287] chore: update license --- packages/vite/LICENSE.md | 56 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index ccff3f1508a73b..30803708e30a76 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -237,6 +237,33 @@ Repository: git+https://github.com/ampproject/remapping.git --------------------------------------- +## @jridgewell/gen-mapping +License: MIT +By: Justin Ridgewell +Repository: https://github.com/jridgewell/gen-mapping + +> Copyright 2022 Justin Ridgewell +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +--------------------------------------- + ## @jridgewell/resolve-uri License: MIT By: Justin Ridgewell @@ -264,6 +291,33 @@ Repository: https://github.com/jridgewell/resolve-uri --------------------------------------- +## @jridgewell/set-array +License: MIT +By: Justin Ridgewell +Repository: https://github.com/jridgewell/set-array + +> Copyright 2022 Justin Ridgewell +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +--------------------------------------- + ## @jridgewell/sourcemap-codec License: MIT By: Rich Harris @@ -577,7 +631,7 @@ Repository: https://github.com/acornjs/acorn.git > MIT License > -> Copyright (C) 2012-2020 by various contributors (see AUTHORS) +> Copyright (C) 2012-2022 by various contributors (see AUTHORS) > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal From dde774f0e42dc24ccec7a4710cc842a12f0d785d Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 2 May 2022 15:51:28 +0200 Subject: [PATCH 0615/1287] release: v2.9.7 --- packages/vite/CHANGELOG.md | 20 ++++++++++++++++++++ packages/vite/package.json | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index c2dc1488d84b21..db8bf085dc04f6 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,23 @@ +## 2.9.7 (2022-05-02) + +* chore: update license ([d58c030](https://github.com/vitejs/vite/commit/d58c030)) +* chore(css): catch postcss config error (fix #2793) (#7934) ([7f535ac](https://github.com/vitejs/vite/commit/7f535ac)), closes [#2793](https://github.com/vitejs/vite/issues/2793) [#7934](https://github.com/vitejs/vite/issues/7934) +* chore(deps): update all non-major dependencies (#7949) ([b877d30](https://github.com/vitejs/vite/commit/b877d30)), closes [#7949](https://github.com/vitejs/vite/issues/7949) +* fix: inject esbuild helpers in IIFE and UMD wrappers (#7948) ([f7d2d71](https://github.com/vitejs/vite/commit/f7d2d71)), closes [#7948](https://github.com/vitejs/vite/issues/7948) +* fix: inline css hash (#7974) ([f6ae60d](https://github.com/vitejs/vite/commit/f6ae60d)), closes [#7974](https://github.com/vitejs/vite/issues/7974) +* fix: inline style hmr, transform style code inplace (#7869) ([a30a548](https://github.com/vitejs/vite/commit/a30a548)), closes [#7869](https://github.com/vitejs/vite/issues/7869) +* fix: use NODE_ENV in optimizer (#7673) ([50672e4](https://github.com/vitejs/vite/commit/50672e4)), closes [#7673](https://github.com/vitejs/vite/issues/7673) +* fix(css): clean comments before hoist at rules (#7924) ([e48827f](https://github.com/vitejs/vite/commit/e48827f)), closes [#7924](https://github.com/vitejs/vite/issues/7924) +* fix(css): dynamic import css in package fetches removed js (fixes #7955, #6823) (#7969) ([025eebf](https://github.com/vitejs/vite/commit/025eebf)), closes [#7955](https://github.com/vitejs/vite/issues/7955) [#6823](https://github.com/vitejs/vite/issues/6823) [#7969](https://github.com/vitejs/vite/issues/7969) +* fix(css): inline css module when ssr, minify issue (fix #5471) (#7807) ([cf8a48a](https://github.com/vitejs/vite/commit/cf8a48a)), closes [#5471](https://github.com/vitejs/vite/issues/5471) [#7807](https://github.com/vitejs/vite/issues/7807) +* fix(css): sourcemap crash with postcss (#7982) ([7f9f8f1](https://github.com/vitejs/vite/commit/7f9f8f1)), closes [#7982](https://github.com/vitejs/vite/issues/7982) +* fix(css): support postcss.config.ts (#7935) ([274c10e](https://github.com/vitejs/vite/commit/274c10e)), closes [#7935](https://github.com/vitejs/vite/issues/7935) +* fix(ssr): failed ssrLoadModule call throws same error (#7177) ([891e7fc](https://github.com/vitejs/vite/commit/891e7fc)), closes [#7177](https://github.com/vitejs/vite/issues/7177) +* fix(worker): import.meta.* (#7706) ([b092697](https://github.com/vitejs/vite/commit/b092697)), closes [#7706](https://github.com/vitejs/vite/issues/7706) +* docs: `server.origin` config trailing slash (fix #6622) (#7865) ([5c1ee5a](https://github.com/vitejs/vite/commit/5c1ee5a)), closes [#6622](https://github.com/vitejs/vite/issues/6622) [#7865](https://github.com/vitejs/vite/issues/7865) + + + ## 2.9.6 (2022-04-26) * fix: `apply` condition skipped for nested plugins (#7741) ([1f2ca53](https://github.com/vitejs/vite/commit/1f2ca53)), closes [#7741](https://github.com/vitejs/vite/issues/7741) diff --git a/packages/vite/package.json b/packages/vite/package.json index 39b95bbab97769..3720837d3a5afc 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.9.6", + "version": "2.9.7", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From f8930432134b8ac556d088b92b812e79c7258940 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 2 May 2022 15:52:58 +0200 Subject: [PATCH 0616/1287] release: plugin-legacy@1.8.2 --- packages/plugin-legacy/CHANGELOG.md | 9 +++++++++ packages/plugin-legacy/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/plugin-legacy/CHANGELOG.md b/packages/plugin-legacy/CHANGELOG.md index 5c00212554ce8c..035460b5816cb5 100644 --- a/packages/plugin-legacy/CHANGELOG.md +++ b/packages/plugin-legacy/CHANGELOG.md @@ -1,3 +1,12 @@ +## 1.8.2 (2022-05-02) + +* chore(deps): update all non-major dependencies (#7780) ([eba9d05](https://github.com/vitejs/vite/commit/eba9d05)), closes [#7780](https://github.com/vitejs/vite/issues/7780) +* chore(deps): update all non-major dependencies (#7847) ([e29d1d9](https://github.com/vitejs/vite/commit/e29d1d9)), closes [#7847](https://github.com/vitejs/vite/issues/7847) +* chore(deps): update all non-major dependencies (#7949) ([b877d30](https://github.com/vitejs/vite/commit/b877d30)), closes [#7949](https://github.com/vitejs/vite/issues/7949) +* refactor(legacy): remove unneeded dynamic import var init code (#7759) ([12a4e7d](https://github.com/vitejs/vite/commit/12a4e7d)), closes [#7759](https://github.com/vitejs/vite/issues/7759) + + + ## 1.8.1 (2022-04-13) * fix(deps): update all non-major dependencies (#7668) ([485263c](https://github.com/vitejs/vite/commit/485263c)), closes [#7668](https://github.com/vitejs/vite/issues/7668) diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index 1ba92ee5fd8565..948bbb152ce56f 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-legacy", - "version": "1.8.1", + "version": "1.8.2", "license": "MIT", "author": "Evan You", "files": [ From 968ff695d8ddc7e31285699cf4526a324417ef17 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 2 May 2022 15:54:00 +0200 Subject: [PATCH 0617/1287] release: plugin-react@1.3.2 --- packages/plugin-react/CHANGELOG.md | 8 ++++++++ packages/plugin-react/package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/plugin-react/CHANGELOG.md b/packages/plugin-react/CHANGELOG.md index 958c8270b6f221..01dfee3feb7ffb 100644 --- a/packages/plugin-react/CHANGELOG.md +++ b/packages/plugin-react/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.3.2 (2022-05-02) + +* fix(plugin-react): React is not defined when component name is lowercase (#6838) ([bf40e5c](https://github.com/vitejs/vite/commit/bf40e5c)), closes [#6838](https://github.com/vitejs/vite/issues/6838) +* chore(deps): update all non-major dependencies (#7780) ([eba9d05](https://github.com/vitejs/vite/commit/eba9d05)), closes [#7780](https://github.com/vitejs/vite/issues/7780) +* chore(deps): update all non-major dependencies (#7949) ([b877d30](https://github.com/vitejs/vite/commit/b877d30)), closes [#7949](https://github.com/vitejs/vite/issues/7949) + + + ## 1.3.1 (2022-04-13) * fix(deps): update all non-major dependencies (#7668) ([485263c](https://github.com/vitejs/vite/commit/485263c)), closes [#7668](https://github.com/vitejs/vite/issues/7668) diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 5698472c9dc113..4c8280a3a5ff9a 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-react", - "version": "1.3.1", + "version": "1.3.2", "license": "MIT", "author": "Evan You", "contributors": [ From 2b6d8fec25961b34e2bfcf776be0fb4e499b4cf9 Mon Sep 17 00:00:00 2001 From: Nicolas Hedger <649677+nhedger@users.noreply.github.com> Date: Mon, 2 May 2022 20:36:19 +0200 Subject: [PATCH 0618/1287] chore(create-vite): update reference to volar vscode extension (#7994) --- packages/create-vite/template-vue-ts/.vscode/extensions.json | 2 +- packages/create-vite/template-vue-ts/README.md | 2 +- packages/create-vite/template-vue/.vscode/extensions.json | 2 +- packages/create-vite/template-vue/README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/create-vite/template-vue-ts/.vscode/extensions.json b/packages/create-vite/template-vue-ts/.vscode/extensions.json index 3dc5b08bcdc96b..a7cea0b0678120 100644 --- a/packages/create-vite/template-vue-ts/.vscode/extensions.json +++ b/packages/create-vite/template-vue-ts/.vscode/extensions.json @@ -1,3 +1,3 @@ { - "recommendations": ["johnsoncodehk.volar"] + "recommendations": ["Vue.volar"] } diff --git a/packages/create-vite/template-vue-ts/README.md b/packages/create-vite/template-vue-ts/README.md index e432516724c1a7..30b15e215a24b7 100644 --- a/packages/create-vite/template-vue-ts/README.md +++ b/packages/create-vite/template-vue-ts/README.md @@ -4,7 +4,7 @@ This template should help get you started developing with Vue 3 and TypeScript i ## Recommended IDE Setup -- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) +- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) ## Type Support For `.vue` Imports in TS diff --git a/packages/create-vite/template-vue/.vscode/extensions.json b/packages/create-vite/template-vue/.vscode/extensions.json index 3dc5b08bcdc96b..a7cea0b0678120 100644 --- a/packages/create-vite/template-vue/.vscode/extensions.json +++ b/packages/create-vite/template-vue/.vscode/extensions.json @@ -1,3 +1,3 @@ { - "recommendations": ["johnsoncodehk.volar"] + "recommendations": ["Vue.volar"] } diff --git a/packages/create-vite/template-vue/README.md b/packages/create-vite/template-vue/README.md index eea15cef41ea60..02124a7a0a92bc 100644 --- a/packages/create-vite/template-vue/README.md +++ b/packages/create-vite/template-vue/README.md @@ -4,4 +4,4 @@ This template should help get you started developing with Vue 3 in Vite. The tem ## Recommended IDE Setup -- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) +- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) From 1db7c4939a4c589854bb7a3a85002a8f3c42a50c Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 2 May 2022 21:30:44 +0200 Subject: [PATCH 0619/1287] release: create-vite@2.9.3 --- packages/create-vite/CHANGELOG.md | 7 +++++++ packages/create-vite/package.json | 2 +- packages/create-vite/template-lit-ts/package.json | 2 +- packages/create-vite/template-lit/package.json | 2 +- packages/create-vite/template-preact-ts/package.json | 2 +- packages/create-vite/template-preact/package.json | 2 +- packages/create-vite/template-react-ts/package.json | 2 +- packages/create-vite/template-react/package.json | 2 +- packages/create-vite/template-svelte-ts/package.json | 2 +- packages/create-vite/template-svelte/package.json | 2 +- packages/create-vite/template-vanilla-ts/package.json | 2 +- packages/create-vite/template-vanilla/package.json | 2 +- packages/create-vite/template-vue-ts/package.json | 2 +- packages/create-vite/template-vue/package.json | 2 +- 14 files changed, 20 insertions(+), 13 deletions(-) diff --git a/packages/create-vite/CHANGELOG.md b/packages/create-vite/CHANGELOG.md index 7379feb81239b8..d8759a4e269c97 100644 --- a/packages/create-vite/CHANGELOG.md +++ b/packages/create-vite/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2.9.3 (2022-05-02) + +* chore(create-vite): update reference to volar vscode extension (#7994) ([2b6d8fe](https://github.com/vitejs/vite/commit/2b6d8fe)), closes [#7994](https://github.com/vitejs/vite/issues/7994) +* feat(create-vite): scaffold directory with only .git (#7971) ([a5bdb9f](https://github.com/vitejs/vite/commit/a5bdb9f)), closes [#7971](https://github.com/vitejs/vite/issues/7971) + + + ## 2.9.2 (2022-04-19) * chore: remove useless code in preact template (#7789) ([e5729be](https://github.com/vitejs/vite/commit/e5729be)), closes [#7789](https://github.com/vitejs/vite/issues/7789) diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json index 5a21b499d9b75d..b78537705cc14d 100644 --- a/packages/create-vite/package.json +++ b/packages/create-vite/package.json @@ -1,6 +1,6 @@ { "name": "create-vite", - "version": "2.9.2", + "version": "2.9.3", "license": "MIT", "author": "Evan You", "bin": { diff --git a/packages/create-vite/template-lit-ts/package.json b/packages/create-vite/template-lit-ts/package.json index eb6849d447795c..640e57b3f46089 100644 --- a/packages/create-vite/template-lit-ts/package.json +++ b/packages/create-vite/template-lit-ts/package.json @@ -19,7 +19,7 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.9.5", + "vite": "^2.9.7", "typescript": "^4.5.4" } } diff --git a/packages/create-vite/template-lit/package.json b/packages/create-vite/template-lit/package.json index 6fc110706147f7..2b413a7effa6be 100644 --- a/packages/create-vite/template-lit/package.json +++ b/packages/create-vite/template-lit/package.json @@ -17,6 +17,6 @@ "lit": "^2.0.2" }, "devDependencies": { - "vite": "^2.9.5" + "vite": "^2.9.7" } } diff --git a/packages/create-vite/template-preact-ts/package.json b/packages/create-vite/template-preact-ts/package.json index ac90637925896f..36c4e2ae644331 100644 --- a/packages/create-vite/template-preact-ts/package.json +++ b/packages/create-vite/template-preact-ts/package.json @@ -13,6 +13,6 @@ "devDependencies": { "@preact/preset-vite": "^2.1.5", "typescript": "^4.5.4", - "vite": "^2.9.5" + "vite": "^2.9.7" } } diff --git a/packages/create-vite/template-preact/package.json b/packages/create-vite/template-preact/package.json index f58b6525abaa52..655779377aba28 100644 --- a/packages/create-vite/template-preact/package.json +++ b/packages/create-vite/template-preact/package.json @@ -12,6 +12,6 @@ }, "devDependencies": { "@preact/preset-vite": "^2.1.5", - "vite": "^2.9.5" + "vite": "^2.9.7" } } diff --git a/packages/create-vite/template-react-ts/package.json b/packages/create-vite/template-react-ts/package.json index 01d981f51c3414..76d8f3d637fabd 100644 --- a/packages/create-vite/template-react-ts/package.json +++ b/packages/create-vite/template-react-ts/package.json @@ -16,6 +16,6 @@ "@types/react-dom": "^18.0.0", "@vitejs/plugin-react": "^1.3.0", "typescript": "^4.6.3", - "vite": "^2.9.5" + "vite": "^2.9.7" } } diff --git a/packages/create-vite/template-react/package.json b/packages/create-vite/template-react/package.json index 4215fdea104c30..ee8097d84cd7d9 100644 --- a/packages/create-vite/template-react/package.json +++ b/packages/create-vite/template-react/package.json @@ -15,6 +15,6 @@ "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@vitejs/plugin-react": "^1.3.0", - "vite": "^2.9.5" + "vite": "^2.9.7" } } diff --git a/packages/create-vite/template-svelte-ts/package.json b/packages/create-vite/template-svelte-ts/package.json index ae5bf6219d8eee..f415446fa1a2a0 100644 --- a/packages/create-vite/template-svelte-ts/package.json +++ b/packages/create-vite/template-svelte-ts/package.json @@ -17,6 +17,6 @@ "svelte-preprocess": "^4.9.8", "tslib": "^2.3.1", "typescript": "^4.5.4", - "vite": "^2.9.5" + "vite": "^2.9.7" } } diff --git a/packages/create-vite/template-svelte/package.json b/packages/create-vite/template-svelte/package.json index ac224a274d1c10..f64e5f186ac840 100644 --- a/packages/create-vite/template-svelte/package.json +++ b/packages/create-vite/template-svelte/package.json @@ -11,6 +11,6 @@ "devDependencies": { "@sveltejs/vite-plugin-svelte": "^1.0.0-next.30", "svelte": "^3.44.0", - "vite": "^2.9.5" + "vite": "^2.9.7" } } diff --git a/packages/create-vite/template-vanilla-ts/package.json b/packages/create-vite/template-vanilla-ts/package.json index 94a8ccc952012a..09d074177c401c 100644 --- a/packages/create-vite/template-vanilla-ts/package.json +++ b/packages/create-vite/template-vanilla-ts/package.json @@ -9,6 +9,6 @@ }, "devDependencies": { "typescript": "^4.5.4", - "vite": "^2.9.5" + "vite": "^2.9.7" } } diff --git a/packages/create-vite/template-vanilla/package.json b/packages/create-vite/template-vanilla/package.json index ddc9844be1954f..e5eb1951cb04be 100644 --- a/packages/create-vite/template-vanilla/package.json +++ b/packages/create-vite/template-vanilla/package.json @@ -8,6 +8,6 @@ "preview": "vite preview" }, "devDependencies": { - "vite": "^2.9.5" + "vite": "^2.9.7" } } diff --git a/packages/create-vite/template-vue-ts/package.json b/packages/create-vite/template-vue-ts/package.json index c7383d48b09e3b..5072c666e52172 100644 --- a/packages/create-vite/template-vue-ts/package.json +++ b/packages/create-vite/template-vue-ts/package.json @@ -13,7 +13,7 @@ "devDependencies": { "@vitejs/plugin-vue": "^2.3.1", "typescript": "^4.5.4", - "vite": "^2.9.5", + "vite": "^2.9.7", "vue-tsc": "^0.34.7" } } diff --git a/packages/create-vite/template-vue/package.json b/packages/create-vite/template-vue/package.json index e7e9b681db608c..fe24b608b6c401 100644 --- a/packages/create-vite/template-vue/package.json +++ b/packages/create-vite/template-vue/package.json @@ -12,6 +12,6 @@ }, "devDependencies": { "@vitejs/plugin-vue": "^2.3.1", - "vite": "^2.9.5" + "vite": "^2.9.7" } } From e96b90887d4709ed1c968b658e22fbdfdb996cbb Mon Sep 17 00:00:00 2001 From: fishDog <40156382+Bigfish8@users.noreply.github.com> Date: Tue, 3 May 2022 13:44:28 +0800 Subject: [PATCH 0620/1287] fix(css): var in image-set (#7921) --- .../assets/__tests__/assets.spec.ts | 23 +++++++++++++++ packages/playground/assets/css/css-url.css | 23 +++++++++++++++ packages/playground/assets/index.html | 28 ++++++++++++++++++ packages/vite/src/node/plugins/css.ts | 29 ++++++++++++++----- packages/vite/src/node/utils.ts | 13 +++++---- 5 files changed, 103 insertions(+), 13 deletions(-) diff --git a/packages/playground/assets/__tests__/assets.spec.ts b/packages/playground/assets/__tests__/assets.spec.ts index 19dd52f71e114a..f1075f6fe1cb39 100644 --- a/packages/playground/assets/__tests__/assets.spec.ts +++ b/packages/playground/assets/__tests__/assets.spec.ts @@ -104,6 +104,29 @@ describe('css url() references', () => { }) }) + test('image-set with var', async () => { + const imageSet = await getBg('.css-image-set-with-var') + imageSet.split(', ').forEach((s) => { + expect(s).toMatch(assetMatch) + }) + }) + + test('image-set with mix', async () => { + const imageSet = await getBg('.css-image-set-mix-url-var') + imageSet.split(', ').forEach((s) => { + expect(s).toMatch(assetMatch) + }) + }) + + // not supported in browser now + // https://drafts.csswg.org/css-images-4/#image-set-notation + // test('image-set with multiple descriptor', async () => { + // const imageSet = await getBg('.css-image-set-multiple-descriptor') + // imageSet.split(', ').forEach((s) => { + // expect(s).toMatch(assetMatch) + // }) + // }) + test('relative in @import', async () => { expect(await getBg('.css-url-relative-at-imported')).toMatch(assetMatch) }) diff --git a/packages/playground/assets/css/css-url.css b/packages/playground/assets/css/css-url.css index 8a3f00dee17bd9..9047cd384e7d38 100644 --- a/packages/playground/assets/css/css-url.css +++ b/packages/playground/assets/css/css-url.css @@ -26,6 +26,29 @@ background-size: 10px; } +.css-image-set-with-var { + --bg-img: url('../nested/asset.png'); + background-image: -webkit-image-set(var(--bg-img) 1x, var(--bg-img) 2x); + background-size: 10px; +} + +.css-image-set-mix-url-var { + --bg-img: url('../nested/asset.png'); + background-image: -webkit-image-set( + var(--bg-img) 1x, + url('../nested/asset.png') 2x + ); + background-size: 10px; +} + +.css-image-set-multiple-descriptor { + background-image: -webkit-image-set( + '../nested/asset.png' type('image/png') 1x, + '../nested/asset.png' type('image/png') 2x + ); + background-size: 10px; +} + .css-url-public { background: url('/icon.png'); background-size: 10px; diff --git a/packages/playground/assets/index.html b/packages/playground/assets/index.html index 99c2c2fe69ae70..43eed55236abd3 100644 --- a/packages/playground/assets/index.html +++ b/packages/playground/assets/index.html @@ -46,6 +46,34 @@

CSS url references

>CSS background with image-set() (relative)

+
+ + CSS background image-set() (relative in var) + +
+
+ + CSS background image-set() (mix var and url) + +
+
+ + CSS background image-set() (with multiple descriptor) + +
+
+ + CSS background image-set() (with multiple descriptor) + +
CSS background (relative from @imported file in different dir) { @@ -1054,11 +1057,15 @@ function rewriteCssImageSet( replacer: CssUrlReplacer ): Promise { return asyncReplace(css, cssImageSetRE, async (match) => { - const [matched, rawUrl] = match - const url = await processSrcSet(rawUrl, ({ url }) => - doUrlReplace(url, matched, replacer) - ) - return `image-set(${url})` + const [, rawUrl] = match + const url = await processSrcSet(rawUrl, async ({ url }) => { + // the url maybe url(...) + if (cssUrlRE.test(url)) { + return await rewriteCssUrls(url, replacer) + } + return await doUrlReplace(url, url, replacer) + }) + return url }) } async function doUrlReplace( @@ -1073,7 +1080,13 @@ async function doUrlReplace( wrap = first rawUrl = rawUrl.slice(1, -1) } - if (isExternalUrl(rawUrl) || isDataUrl(rawUrl) || rawUrl.startsWith('#')) { + + if ( + isExternalUrl(rawUrl) || + isDataUrl(rawUrl) || + rawUrl.startsWith('#') || + varRE.test(rawUrl) + ) { return matched } diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index e7a20afbdd5ae7..32b783974dacaf 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -545,6 +545,7 @@ interface ImageCandidate { descriptor: string } const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g +const imageSetUrlRE = /^(?:[\w\-]+\(.*?\)|'.*?'|".*?"|\S*)/ export async function processSrcSet( srcs: string, replacer: (arg: ImageCandidate) => Promise @@ -552,11 +553,13 @@ export async function processSrcSet( const imageCandidates: ImageCandidate[] = srcs .split(',') .map((s) => { - const [url, descriptor] = s - .replace(escapedSpaceCharacters, ' ') - .trim() - .split(' ', 2) - return { url, descriptor } + const src = s.replace(escapedSpaceCharacters, ' ').trim() + const [url] = imageSetUrlRE.exec(src) || [] + + return { + url, + descriptor: src?.slice(url.length).trim() + } }) .filter(({ url }) => !!url) From 749e96f0dcf171795c62eb612b2ad6db5606363c Mon Sep 17 00:00:00 2001 From: Zheeeng Date: Tue, 3 May 2022 15:55:03 +0800 Subject: [PATCH 0621/1287] chore: fix ts checking on used-before-assigned (#6939) --- scripts/jestPerTestSetup.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/jestPerTestSetup.ts b/scripts/jestPerTestSetup.ts index f4c9db03627c7c..098784ae76c2af 100644 --- a/scripts/jestPerTestSetup.ts +++ b/scripts/jestPerTestSetup.ts @@ -243,14 +243,15 @@ function startStaticServer(config?: InlineConfig): Promise { export async function notifyRebuildComplete( watcher: RollupWatcher ): Promise { - let callback: (event: RollupWatcherEvent) => void - await new Promise((resolve, reject) => { - callback = (event) => { - if (event.code === 'END') { - resolve() - } + let resolveFn: undefined | (() => void) + const callback = (event: RollupWatcherEvent): void => { + if (event.code === 'END') { + resolveFn?.() } - watcher.on('event', callback) + } + watcher.on('event', callback) + await new Promise((resolve) => { + resolveFn = resolve }) return watcher.removeListener('event', callback) } From f1af9416a1123c617675ca0165ac401486b636dc Mon Sep 17 00:00:00 2001 From: yoho Date: Wed, 4 May 2022 02:43:32 +0800 Subject: [PATCH 0622/1287] chore: restore-jsx.spec.ts lint (#8004) --- packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts b/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts index adbd7a60599c25..c216e99bc3480d 100644 --- a/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts +++ b/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts @@ -3,7 +3,7 @@ import * as babel from '@babel/core' async function jsx(sourceCode: string) { const [ast] = await restoreJSX(babel, sourceCode, 'test.js') - if (ast === null) { + if (ast == null) { return ast } const { code } = await babel.transformFromAstAsync(ast, null, { From 642d65ba6190a87a2f4d534f545672a1a0f10f1c Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Wed, 4 May 2022 02:46:10 +0800 Subject: [PATCH 0623/1287] fix: only handle merge ssr.noExternal (#8003) --- .../vite/src/node/__tests__/config.spec.ts | 24 +++++++++++++++++++ packages/vite/src/node/config.ts | 6 ++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/__tests__/config.spec.ts b/packages/vite/src/node/__tests__/config.spec.ts index dd427c19433475..ca7a2e76122cd0 100644 --- a/packages/vite/src/node/__tests__/config.spec.ts +++ b/packages/vite/src/node/__tests__/config.spec.ts @@ -157,6 +157,30 @@ describe('mergeConfig', () => { expect(mergeConfig(baseConfig, newConfig)).toEqual(mergedConfig) }) + + test('handles ssr.noExternal', () => { + const baseConfig = { + ssr: { + noExternal: true + } + } + + const newConfig = { + ssr: { + noExternal: ['foo'] + } + } + + const mergedConfig = { + ssr: { + noExternal: true + } + } + + // merging either ways, `ssr.noExternal: true` should take highest priority + expect(mergeConfig(baseConfig, newConfig)).toEqual(mergedConfig) + expect(mergeConfig(newConfig, baseConfig)).toEqual(mergedConfig) + }) }) describe('resolveConfig', () => { diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 27a107f3e2098c..531fe169f72de0 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -745,7 +745,11 @@ function mergeConfigRecursively( } else if (key === 'assetsInclude' && rootPath === '') { merged[key] = [].concat(existing, value) continue - } else if (key === 'noExternal' && (existing === true || value === true)) { + } else if ( + key === 'noExternal' && + rootPath === 'ssr' && + (existing === true || value === true) + ) { merged[key] = true continue } From f3d15f106f378c3850b62fbebd69fc8f7c7f944b Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Wed, 4 May 2022 02:48:11 +0800 Subject: [PATCH 0624/1287] refactor(plugin-vue): remove querystring import (#7997) --- packages/plugin-vue/src/main.ts | 5 ++--- packages/plugin-vue/src/utils/query.ts | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index 44b1de74721efd..d4417548e2e40c 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -1,4 +1,3 @@ -import qs from 'querystring' import path from 'path' import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc' import type { ResolvedOptions } from '.' @@ -426,8 +425,8 @@ function attrsToQuery( for (const name in attrs) { const value = attrs[name] if (!ignoreList.includes(name)) { - query += `&${qs.escape(name)}${ - value ? `=${qs.escape(String(value))}` : `` + query += `&${encodeURIComponent(name)}${ + value ? `=${encodeURIComponent(value)}` : `` }` } } diff --git a/packages/plugin-vue/src/utils/query.ts b/packages/plugin-vue/src/utils/query.ts index d41cb1be2cf536..060b5f28987bfa 100644 --- a/packages/plugin-vue/src/utils/query.ts +++ b/packages/plugin-vue/src/utils/query.ts @@ -1,5 +1,3 @@ -import qs from 'querystring' - export interface VueQuery { vue?: boolean src?: string @@ -14,7 +12,7 @@ export function parseVueRequest(id: string): { query: VueQuery } { const [filename, rawQuery] = id.split(`?`, 2) - const query = qs.parse(rawQuery) as VueQuery + const query = Object.fromEntries(new URLSearchParams(rawQuery)) as VueQuery if (query.vue != null) { query.vue = true } From d49e3fbfc0227e2e00ffc4a8d4152135c5cd6bb8 Mon Sep 17 00:00:00 2001 From: Saurabh Daware Date: Wed, 4 May 2022 10:32:09 +0530 Subject: [PATCH 0625/1287] fix: inline js and css paths for virtual html (#7993) Co-authored-by: yoho Co-authored-by: patak-dev --- packages/playground/ssr-html/server.js | 31 ++++++++-- .../src/node/server/middlewares/indexHtml.ts | 57 ++++++++++++++----- 2 files changed, 69 insertions(+), 19 deletions(-) diff --git a/packages/playground/ssr-html/server.js b/packages/playground/ssr-html/server.js index ad115f1be01163..1f2cd5331c0157 100644 --- a/packages/playground/ssr-html/server.js +++ b/packages/playground/ssr-html/server.js @@ -14,6 +14,14 @@ const DYNAMIC_SCRIPTS = ` ` +const DYNAMIC_STYLES = ` + +` + async function createServer( root = process.cwd(), isProd = process.env.NODE_ENV === 'production' @@ -42,15 +50,30 @@ async function createServer( // use vite's connect instance as middleware app.use(vite.middlewares) - app.use('*', async (req, res) => { + app.use('*', async (req, res, next) => { try { let [url] = req.originalUrl.split('?') if (url.endsWith('/')) url += 'index.html' + if (url.startsWith('/favicon.ico')) { + return res.status(404).end('404') + } + if (url.startsWith('/@id/__x00__')) { + return next() + } + const htmlLoc = resolve(`.${url}`) - let html = fs.readFileSync(htmlLoc, 'utf8') - html = html.replace('', `${DYNAMIC_SCRIPTS}`) - html = await vite.transformIndexHtml(url, html) + let template = fs.readFileSync(htmlLoc, 'utf-8') + + template = template.replace( + '', + `${DYNAMIC_SCRIPTS}${DYNAMIC_STYLES}` + ) + + // Force calling transformIndexHtml with url === '/', to simulate + // usage by ecosystem that was recommended in the SSR documentation + // as `const url = req.originalUrl` + const html = await vite.transformIndexHtml('/', template) res.status(200).set({ 'Content-Type': 'text/html' }).end(html) } catch (e) { diff --git a/packages/vite/src/node/server/middlewares/indexHtml.ts b/packages/vite/src/node/server/middlewares/indexHtml.ts index 8638492b1c2001..955ee6b708f54d 100644 --- a/packages/vite/src/node/server/middlewares/indexHtml.ts +++ b/packages/vite/src/node/server/middlewares/indexHtml.ts @@ -1,6 +1,7 @@ import fs from 'fs' import path from 'path' import MagicString from 'magic-string' +import type { SourceMapInput } from 'rollup' import type { AttributeNode, ElementNode, TextNode } from '@vue/compiler-dom' import { NodeTypes } from '@vue/compiler-dom' import type { Connect } from 'types/connect' @@ -15,7 +16,12 @@ import { } from '../../plugins/html' import type { ResolvedConfig, ViteDevServer } from '../..' import { send } from '../send' -import { CLIENT_PUBLIC_PATH, FS_PREFIX } from '../../constants' +import { + CLIENT_PUBLIC_PATH, + FS_PREFIX, + VALID_ID_PREFIX, + NULL_BYTE_PLACEHOLDER +} from '../../constants' import { cleanUrl, fsPathFromId, @@ -108,32 +114,53 @@ const devHtmlHook: IndexHtmlTransformHook = async ( const { config, moduleGraph, watcher } = server! const base = config.base || '/' + let proxyModulePath: string + let proxyModuleUrl: string + + const trailingSlash = htmlPath.endsWith('/') + if (!trailingSlash && fs.existsSync(filename)) { + proxyModulePath = htmlPath + proxyModuleUrl = base + htmlPath.slice(1) + } else { + // There are users of vite.transformIndexHtml calling it with url '/' + // for SSR integrations #7993, filename is root for this case + // A user may also use a valid name for a virtual html file + // Mark the path as virtual in both cases so sourcemaps aren't processed + // and ids are properly handled + const validPath = `${htmlPath}${trailingSlash ? 'index.html' : ''}` + proxyModulePath = `\0${validPath}` + proxyModuleUrl = `${VALID_ID_PREFIX}${NULL_BYTE_PLACEHOLDER}${validPath}` + } + const s = new MagicString(html) let inlineModuleIndex = -1 - const filePath = cleanUrl(htmlPath) + const proxyCacheUrl = cleanUrl(proxyModulePath).replace( + normalizePath(config.root), + '' + ) const styleUrl: AssetNode[] = [] const addInlineModule = (node: ElementNode, ext: 'js') => { inlineModuleIndex++ - const url = filePath.replace(normalizePath(config.root), '') - const contentNode = node.children[0] as TextNode const code = contentNode.content - const map = new MagicString(html) - .snip(contentNode.loc.start.offset, contentNode.loc.end.offset) - .generateMap({ hires: true }) - map.sources = [filename] - map.file = filename + + let map: SourceMapInput | undefined + if (!proxyModulePath.startsWith('\0')) { + map = new MagicString(html) + .snip(contentNode.loc.start.offset, contentNode.loc.end.offset) + .generateMap({ hires: true }) + map.sources = [filename] + map.file = filename + } // add HTML Proxy to Map - addToHTMLProxyCache(config, url, inlineModuleIndex, { code, map }) + addToHTMLProxyCache(config, proxyCacheUrl, inlineModuleIndex, { code, map }) // inline js module. convert to src="proxy" - const modulePath = `${ - config.base + htmlPath.slice(1) - }?html-proxy&index=${inlineModuleIndex}.${ext}` + const modulePath = `${proxyModuleUrl}?html-proxy&index=${inlineModuleIndex}.${ext}` // invalidate the module so the newly cached contents will be served const module = server?.moduleGraph.getModuleById(modulePath) @@ -190,13 +217,13 @@ const devHtmlHook: IndexHtmlTransformHook = async ( await Promise.all( styleUrl.map(async ({ start, end, code }, index) => { - const url = filename + `?html-proxy&${index}.css` + const url = `${proxyModulePath}?html-proxy&index=${index}.css` // ensure module in graph after successful load const mod = await moduleGraph.ensureEntryFromUrl(url, false) ensureWatchedFile(watcher, mod.file, config.root) - const result = await server!.pluginContainer.transform(code, url) + const result = await server!.pluginContainer.transform(code, mod.id!) s.overwrite(start, end, result?.code || '') }) ) From 72f17f89296d6b2373fb05edcc01959f30c551d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 4 May 2022 17:50:44 +0900 Subject: [PATCH 0626/1287] fix(css): do not clean id when passing to postcss (fix #7822) (#7827) --- packages/playground/css/__tests__/css.spec.ts | 10 ++++++++++ packages/playground/css/index.html | 3 +++ packages/playground/css/main.js | 3 +++ packages/playground/css/postcss-source-input.css | 1 + packages/playground/css/postcss.config.js | 15 ++++++++++++++- packages/vite/src/node/plugins/css.ts | 4 ++-- 6 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 packages/playground/css/postcss-source-input.css diff --git a/packages/playground/css/__tests__/css.spec.ts b/packages/playground/css/__tests__/css.spec.ts index 9869bb34d2c690..e666ca40517d57 100644 --- a/packages/playground/css/__tests__/css.spec.ts +++ b/packages/playground/css/__tests__/css.spec.ts @@ -413,3 +413,13 @@ test("relative path rewritten in Less's data-uri", async () => { /^url\("data:image\/svg\+xml,%3Csvg/ ) }) + +test('PostCSS source.input.from includes query', async () => { + const code = await page.textContent('.postcss-source-input') + // should resolve assets + expect(code).toContain( + isBuild + ? '/postcss-source-input.css?used&query=foo' + : '/postcss-source-input.css?query=foo' + ) +}) diff --git a/packages/playground/css/index.html b/packages/playground/css/index.html index fef6a0be393748..15e81192cec7f1 100644 --- a/packages/playground/css/index.html +++ b/packages/playground/css/index.html @@ -135,6 +135,9 @@

CSS

Raw Support


+
+  

PostCSS source.input.from. Should include query

+

 
diff --git a/packages/playground/css/main.js b/packages/playground/css/main.js index 0d03aafbf0ec7f..f728b0251066d1 100644 --- a/packages/playground/css/main.js +++ b/packages/playground/css/main.js @@ -87,3 +87,6 @@ Promise.all(Object.keys(glob).map((key) => glob[key]())).then((res) => { // globEager const globEager = import.meta.globEager('./glob-import/*.css') text('.imported-css-globEager', JSON.stringify(globEager, null, 2)) + +import postcssSourceInput from './postcss-source-input.css?query=foo' +text('.postcss-source-input', postcssSourceInput) diff --git a/packages/playground/css/postcss-source-input.css b/packages/playground/css/postcss-source-input.css new file mode 100644 index 00000000000000..c6c3cb0c16dece --- /dev/null +++ b/packages/playground/css/postcss-source-input.css @@ -0,0 +1 @@ +@source-input; diff --git a/packages/playground/css/postcss.config.js b/packages/playground/css/postcss.config.js index f3d6ac9548b6a9..e90b4f9c987820 100644 --- a/packages/playground/css/postcss.config.js +++ b/packages/playground/css/postcss.config.js @@ -1,5 +1,5 @@ module.exports = { - plugins: [require('postcss-nested'), testDirDep] + plugins: [require('postcss-nested'), testDirDep, testSourceInput] } const fs = require('fs') @@ -35,3 +35,16 @@ function testDirDep() { } } testDirDep.postcss = true + +function testSourceInput() { + return { + postcssPlugin: 'source-input', + AtRule(atRule) { + if (atRule.name === 'source-input') { + atRule.after(`/* ${atRule.source.input.from} */`) + atRule.remove() + } + } + } +} +testSourceInput.postcss = true diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 04c4ebeea95332..cd57acd1690902 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -799,8 +799,8 @@ async function compileCSS( .default(postcssPlugins) .process(code, { ...postcssOptions, - to: cleanUrl(id), - from: cleanUrl(id), + to: id, + from: id, map: { inline: false, annotation: false, From 6420ba0d7d3823aeb6c46c1136e740b6d15f18a3 Mon Sep 17 00:00:00 2001 From: Yoshi Togami <62130798+togami2864@users.noreply.github.com> Date: Wed, 4 May 2022 17:51:27 +0900 Subject: [PATCH 0627/1287] fix(ssr): allow ssrTransform to parse hashbang (#8005) --- .../node/ssr/__tests__/ssrTransform.spec.ts | 21 +++++++++++++++++-- packages/vite/src/node/ssr/ssrTransform.ts | 3 ++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts index 14481f98a4a87a..0e9181214c2b82 100644 --- a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts +++ b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts @@ -370,7 +370,7 @@ test('overwrite bindings', async () => { `const a = { inject }\n` + `const b = { test: inject }\n` + `function c() { const { test: inject } = { test: true }; console.log(inject) }\n` + - `const d = inject \n` + + `const d = inject\n` + `function f() { console.log(inject) }\n` + `function e() { const { inject } = { inject: true } }\n` + `function g() { const f = () => { const inject = true }; console.log(inject) }\n`, @@ -383,7 +383,7 @@ test('overwrite bindings', async () => { const a = { inject: __vite_ssr_import_0__.inject } const b = { test: __vite_ssr_import_0__.inject } function c() { const { test: inject } = { test: true }; console.log(inject) } - const d = __vite_ssr_import_0__.inject + const d = __vite_ssr_import_0__.inject function f() { console.log(__vite_ssr_import_0__.inject) } function e() { const { inject } = { inject: true } } function g() { const f = () => { const inject = true }; console.log(__vite_ssr_import_0__.inject) } @@ -719,3 +719,20 @@ export default (function getRandom() { (await ssrTransform(`export default (class A {});`, null, null)).code ).toMatchInlineSnapshot(`"__vite_ssr_exports__.default = (class A {});"`) }) + +// #8002 +test('with hashbang', async () => { + expect( + ( + await ssrTransform( + `#!/usr/bin/env node +console.log("it can parse the hashbang")`, + null, + null + ) + ).code + ).toMatchInlineSnapshot(` + "#!/usr/bin/env node + console.log(\\"it can parse the hashbang\\")" + `) +}) diff --git a/packages/vite/src/node/ssr/ssrTransform.ts b/packages/vite/src/node/ssr/ssrTransform.ts index 238482a0ceac2f..c1aa572864776a 100644 --- a/packages/vite/src/node/ssr/ssrTransform.ts +++ b/packages/vite/src/node/ssr/ssrTransform.ts @@ -37,7 +37,8 @@ export async function ssrTransform( ast = parser.parse(code, { sourceType: 'module', ecmaVersion: 'latest', - locations: true + locations: true, + allowHashBang: true }) } catch (err) { if (!err.loc || !err.loc.line) throw err From e85164ecb07e32bf3bc49ae33c7bd9ba3065482d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 4 May 2022 18:05:18 +0900 Subject: [PATCH 0628/1287] chore: remove maybeVirtualHtmlSet (#8010) --- packages/vite/src/node/plugins/html.ts | 4 ---- packages/vite/src/node/server/sourcemap.ts | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index c33811008ccb17..bf3d662066630b 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -722,8 +722,6 @@ export function resolveHtmlTransforms( return [preHooks, postHooks] } -export const maybeVirtualHtmlSet = new Set() - export async function applyHtmlTransforms( html: string, hooks: IndexHtmlTransformHook[], @@ -734,8 +732,6 @@ export async function applyHtmlTransforms( const bodyTags: HtmlTagDescriptor[] = [] const bodyPrependTags: HtmlTagDescriptor[] = [] - maybeVirtualHtmlSet.add(ctx.filename) - for (const hook of hooks) { const res = await hook(html, ctx) if (!res) { diff --git a/packages/vite/src/node/server/sourcemap.ts b/packages/vite/src/node/server/sourcemap.ts index 0b9bcf9284754b..88cbafc344c739 100644 --- a/packages/vite/src/node/server/sourcemap.ts +++ b/packages/vite/src/node/server/sourcemap.ts @@ -1,9 +1,8 @@ import path from 'path' import { promises as fs } from 'fs' import type { Logger } from '../logger' -import { createDebugger, normalizePath } from '../utils' +import { createDebugger } from '../utils' import type { SourceMap } from 'rollup' -import { maybeVirtualHtmlSet } from '../plugins/html' const isDebug = !!process.env.DEBUG const debug = createDebugger('vite:sourcemap', { @@ -43,7 +42,6 @@ export async function injectSourcesContent( sourcePath = path.resolve(sourceRoot, sourcePath) } return fs.readFile(sourcePath, 'utf-8').catch(() => { - if (maybeVirtualHtmlSet.has(normalizePath(sourcePath))) return null missingSources.push(sourcePath) return null }) From 67c86dee44f18425bff6c1b1d36ab7f7d56f758b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 4 May 2022 18:30:46 +0900 Subject: [PATCH 0629/1287] test(css): fix postcss cleanid test (#8013) --- packages/playground/css/postcss.config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/playground/css/postcss.config.js b/packages/playground/css/postcss.config.js index e90b4f9c987820..33058023541515 100644 --- a/packages/playground/css/postcss.config.js +++ b/packages/playground/css/postcss.config.js @@ -41,7 +41,11 @@ function testSourceInput() { postcssPlugin: 'source-input', AtRule(atRule) { if (atRule.name === 'source-input') { - atRule.after(`/* ${atRule.source.input.from} */`) + atRule.after( + `.source-input::before { content: ${JSON.stringify( + atRule.source.input.from + )}; }` + ) atRule.remove() } } From 0861adec967b692e41ae19dd09a264cf582f3a5e Mon Sep 17 00:00:00 2001 From: patak Date: Wed, 4 May 2022 12:05:56 +0200 Subject: [PATCH 0630/1287] chore: use pnpm@6 in netlify (#8011) --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index ba9d1c55f567c5..ba62bdbe4d6be1 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,4 +3,4 @@ NPM_FLAGS = "--version" # prevent Netlify npm install [build] publish = "docs/.vitepress/dist" - command = "npx pnpm i --store=node_modules/.pnpm-store && npm run ci-docs" \ No newline at end of file + command = "npx pnpm@6 i --store=node_modules/.pnpm-store --frozen-lockfile && npx pnpm@6 run ci-docs" \ No newline at end of file From 99740949b77509c442a27fb0e017fcbe376f3391 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Wed, 4 May 2022 22:32:06 +0800 Subject: [PATCH 0631/1287] feat: import ts with .js in vue (#7998) --- packages/playground/vue-jsx/TsImport.vue | 8 ++++++++ packages/playground/vue-jsx/TsImportFile.ts | 1 + packages/playground/vue-jsx/__tests__/vue-jsx.spec.ts | 1 + packages/playground/vue-jsx/main.jsx | 2 ++ packages/playground/vue/Main.vue | 2 ++ packages/playground/vue/TsImport.vue | 8 ++++++++ packages/playground/vue/TsImportFile.ts | 1 + packages/playground/vue/__tests__/vue.spec.ts | 4 ++++ packages/plugin-vue/src/main.ts | 5 +++++ packages/vite/src/node/plugins/resolve.ts | 11 +++++++++-- packages/vite/src/node/utils.ts | 2 +- 11 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 packages/playground/vue-jsx/TsImport.vue create mode 100644 packages/playground/vue-jsx/TsImportFile.ts create mode 100644 packages/playground/vue/TsImport.vue create mode 100644 packages/playground/vue/TsImportFile.ts diff --git a/packages/playground/vue-jsx/TsImport.vue b/packages/playground/vue-jsx/TsImport.vue new file mode 100644 index 00000000000000..c63923d51947fa --- /dev/null +++ b/packages/playground/vue-jsx/TsImport.vue @@ -0,0 +1,8 @@ + + + diff --git a/packages/playground/vue-jsx/TsImportFile.ts b/packages/playground/vue-jsx/TsImportFile.ts new file mode 100644 index 00000000000000..62761d5733b432 --- /dev/null +++ b/packages/playground/vue-jsx/TsImportFile.ts @@ -0,0 +1 @@ +export const foo = 'success' diff --git a/packages/playground/vue-jsx/__tests__/vue-jsx.spec.ts b/packages/playground/vue-jsx/__tests__/vue-jsx.spec.ts index 999fdc19af51ec..275c918684119d 100644 --- a/packages/playground/vue-jsx/__tests__/vue-jsx.spec.ts +++ b/packages/playground/vue-jsx/__tests__/vue-jsx.spec.ts @@ -9,6 +9,7 @@ test('should render', async () => { expect(await page.textContent('.src-import')).toMatch('5') expect(await page.textContent('.jsx-with-query')).toMatch('6') expect(await page.textContent('.other-ext')).toMatch('Other Ext') + expect(await page.textContent('.ts-import')).toMatch('success') }) test('should update', async () => { diff --git a/packages/playground/vue-jsx/main.jsx b/packages/playground/vue-jsx/main.jsx index e304e7788e49e7..f13e60c45367c0 100644 --- a/packages/playground/vue-jsx/main.jsx +++ b/packages/playground/vue-jsx/main.jsx @@ -7,6 +7,7 @@ import JsxSrcImport from './SrcImport.vue' import JsxSetupSyntax from './setup-syntax-jsx.vue' // eslint-disable-next-line import JsxWithQuery from './Query.jsx?query=true' +import TsImport from './TsImport.vue' function App() { return ( @@ -20,6 +21,7 @@ function App() { + ) } diff --git a/packages/playground/vue/Main.vue b/packages/playground/vue/Main.vue index 87319acdf6f736..c5f3d27402fda7 100644 --- a/packages/playground/vue/Main.vue +++ b/packages/playground/vue/Main.vue @@ -15,6 +15,7 @@
this should be red
+ @@ -33,6 +34,7 @@ import CustomBlock from './CustomBlock.vue' import SrcImport from './src-import/SrcImport.vue' import Slotted from './Slotted.vue' import ScanDep from './ScanDep.vue' +import TsImport from './TsImport.vue' import AsyncComponent from './AsyncComponent.vue' import ReactivityTransform from './ReactivityTransform.vue' import SetupImportTemplate from './setup-import-template/SetupImportTemplate.vue' diff --git a/packages/playground/vue/TsImport.vue b/packages/playground/vue/TsImport.vue new file mode 100644 index 00000000000000..986c383b2b9f4b --- /dev/null +++ b/packages/playground/vue/TsImport.vue @@ -0,0 +1,8 @@ + + + diff --git a/packages/playground/vue/TsImportFile.ts b/packages/playground/vue/TsImportFile.ts new file mode 100644 index 00000000000000..62761d5733b432 --- /dev/null +++ b/packages/playground/vue/TsImportFile.ts @@ -0,0 +1 @@ +export const foo = 'success' diff --git a/packages/playground/vue/__tests__/vue.spec.ts b/packages/playground/vue/__tests__/vue.spec.ts index 025c05f53e8688..0bce5d1e1a03f5 100644 --- a/packages/playground/vue/__tests__/vue.spec.ts +++ b/packages/playground/vue/__tests__/vue.spec.ts @@ -14,6 +14,10 @@ test('template/script latest syntax support', async () => { expect(await page.textContent('.syntax')).toBe('baz') }) +test('import ts with .js extension with lang="ts"', async () => { + expect(await page.textContent('.ts-import')).toBe('success') +}) + test('should remove comments in prod', async () => { expect(await page.innerHTML('.comments')).toBe(isBuild ? `` : ``) }) diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index d4417548e2e40c..1b24856be1ecab 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -211,6 +211,11 @@ export async function transformMain( code: resolvedCode, map: resolvedMap || { mappings: '' + }, + meta: { + vite: { + lang: descriptor.script?.lang || descriptor.scriptSetup?.lang || 'js' + } } } } diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts index 1b59503a9d43ed..98a2cd8a9f776e 100644 --- a/packages/vite/src/node/plugins/resolve.ts +++ b/packages/vite/src/node/plugins/resolve.ts @@ -128,12 +128,19 @@ export function resolvePlugin(baseOptions: InternalResolveOptions): Plugin { const options: InternalResolveOptions = { isRequire, - ...baseOptions, - isFromTsImporter: isTsRequest(importer ?? ''), scan: resolveOpts?.scan ?? baseOptions.scan } + if (importer) { + if (isTsRequest(importer)) { + options.isFromTsImporter = true + } else { + const moduleLang = this.getModuleInfo(importer)?.meta?.vite?.lang + options.isFromTsImporter = moduleLang && isTsRequest(`.${moduleLang}`) + } + } + let res: string | PartialResolvedId | undefined // resolve pre-bundled deps requests, these could be resolved by diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 32b783974dacaf..688e4c0f9cd44d 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -228,7 +228,7 @@ export const isJSRequest = (url: string): boolean => { const knownTsRE = /\.(ts|mts|cts|tsx)$/ const knownTsOutputRE = /\.(js|mjs|cjs|jsx)$/ -export const isTsRequest = (url: string) => knownTsRE.test(cleanUrl(url)) +export const isTsRequest = (url: string) => knownTsRE.test(url) export const isPossibleTsOutput = (url: string) => knownTsOutputRE.test(cleanUrl(url)) export function getPotentialTsSrcPaths(filePath: string) { From e5fe1c65203a3509e096baeed1ef176d21f93851 Mon Sep 17 00:00:00 2001 From: patak Date: Wed, 4 May 2022 18:35:58 +0200 Subject: [PATCH 0632/1287] fix: optimized processing folder renaming in win (fix #7939) (#8019) --- packages/vite/src/node/optimizer/index.ts | 23 ++++----- .../src/node/optimizer/registerMissing.ts | 8 ++-- packages/vite/src/node/utils.ts | 48 +++++++++++++++++++ 3 files changed, 61 insertions(+), 18 deletions(-) diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index 4e4fb5a8c895ae..03df61ae3e3ac2 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -13,7 +13,9 @@ import { normalizePath, writeFile, flattenId, - normalizeId + normalizeId, + removeDirSync, + renameDir } from '../utils' import { esbuildDepPlugin } from './esbuildDepPlugin' import { init, parse } from 'es-module-lexer' @@ -116,7 +118,7 @@ export interface DepOptimizationResult { * the page reload will be delayed until the next rerun so we need * to be able to discard the result */ - commit: () => void + commit: () => Promise cancel: () => void } @@ -194,7 +196,7 @@ export async function optimizeDeps( const result = await runOptimizeDeps(config, depsInfo) - result.commit() + await result.commit() return result.metadata } @@ -376,7 +378,7 @@ export async function runOptimizeDeps( metadata, commit() { // Write metadata file, delete `deps` folder and rename the `processing` folder to `deps` - commitProcessingDepsCacheSync() + return commitProcessingDepsCacheSync() }, cancel } @@ -529,16 +531,16 @@ export async function runOptimizeDeps( metadata, commit() { // Write metadata file, delete `deps` folder and rename the new `processing` folder to `deps` in sync - commitProcessingDepsCacheSync() + return commitProcessingDepsCacheSync() }, cancel } - function commitProcessingDepsCacheSync() { + async function commitProcessingDepsCacheSync() { // Processing is done, we can now replace the depsCacheDir with processingCacheDir // Rewire the file paths from the temporal processing dir to the final deps cache dir removeDirSync(depsCacheDir) - fs.renameSync(processingCacheDir, depsCacheDir) + await renameDir(processingCacheDir, depsCacheDir) } function cancel() { @@ -546,13 +548,6 @@ export async function runOptimizeDeps( } } -function removeDirSync(dir: string) { - if (fs.existsSync(dir)) { - const rmSync = fs.rmSync ?? fs.rmdirSync // TODO: Remove after support for Node 12 is dropped - rmSync(dir, { recursive: true }) - } -} - export async function findKnownImports( config: ResolvedConfig ): Promise { diff --git a/packages/vite/src/node/optimizer/registerMissing.ts b/packages/vite/src/node/optimizer/registerMissing.ts index ee4824389c202b..2262c7be96bb0a 100644 --- a/packages/vite/src/node/optimizer/registerMissing.ts +++ b/packages/vite/src/node/optimizer/registerMissing.ts @@ -189,8 +189,8 @@ export function createOptimizedDeps(server: ViteDevServer): OptimizedDeps { ) }) - const commitProcessing = () => { - processingResult.commit() + const commitProcessing = async () => { + await processingResult.commit() // While optimizeDeps is running, new missing deps may be discovered, // in which case they will keep being added to metadata.discovered @@ -240,7 +240,7 @@ export function createOptimizedDeps(server: ViteDevServer): OptimizedDeps { } if (!needsReload) { - commitProcessing() + await commitProcessing() if (!isDebugEnabled) { if (newDepsToLogHandle) clearTimeout(newDepsToLogHandle) @@ -270,7 +270,7 @@ export function createOptimizedDeps(server: ViteDevServer): OptimizedDeps { } ) } else { - commitProcessing() + await commitProcessing() if (!isDebugEnabled) { if (newDepsToLogHandle) clearTimeout(newDepsToLogHandle) diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 688e4c0f9cd44d..d41dd6850ebb56 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -3,6 +3,7 @@ import colors from 'picocolors' import fs from 'fs' import os from 'os' import path from 'path' +import { promisify } from 'util' import { pathToFileURL, URL } from 'url' import { FS_PREFIX, @@ -522,6 +523,15 @@ export function copyDir(srcDir: string, destDir: string): void { } } +export function removeDirSync(dir: string) { + if (fs.existsSync(dir)) { + const rmSync = fs.rmSync ?? fs.rmdirSync // TODO: Remove after support for Node 12 is dropped + rmSync(dir, { recursive: true }) + } +} + +export const renameDir = isWindows ? promisify(gracefulRename) : fs.renameSync + export function ensureWatchedFile( watcher: FSWatcher, file: string | null, @@ -737,3 +747,41 @@ export function parseRequest(id: string): Record | null { } export const blankReplacer = (match: string) => ' '.repeat(match.length) + +// Based on node-graceful-fs + +// The ISC License +// Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors +// https://github.com/isaacs/node-graceful-fs/blob/main/LICENSE + +// On Windows, A/V software can lock the directory, causing this +// to fail with an EACCES or EPERM if the directory contains newly +// created files. The original tried for up to 60 seconds, we only +// wait for 5 seconds, as a longer time would be seen as an error + +const GRACEFUL_RENAME_TIMEOUT = 5000 +function gracefulRename( + from: string, + to: string, + cb: (error: NodeJS.ErrnoException | null) => void +) { + const start = Date.now() + let backoff = 0 + fs.rename(from, to, function CB(er) { + if ( + er && + (er.code === 'EACCES' || er.code === 'EPERM') && + Date.now() - start < GRACEFUL_RENAME_TIMEOUT + ) { + setTimeout(function () { + fs.stat(to, function (stater, st) { + if (stater && stater.code === 'ENOENT') gracefulRename(from, to, CB) + else cb(er) + }) + }, backoff) + if (backoff < 100) backoff += 10 + return + } + if (cb) cb(er) + }) +} From 77865b44b2f69642ca106716f6208a812cab9c24 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Wed, 4 May 2022 19:28:34 +0200 Subject: [PATCH 0633/1287] release: v2.9.8 --- packages/vite/CHANGELOG.md | 13 +++++++++++++ packages/vite/package.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index db8bf085dc04f6..3c967f289c1f34 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,16 @@ +## 2.9.8 (2022-05-04) + +* fix: inline js and css paths for virtual html (#7993) ([d49e3fb](https://github.com/vitejs/vite/commit/d49e3fb)), closes [#7993](https://github.com/vitejs/vite/issues/7993) +* fix: only handle merge ssr.noExternal (#8003) ([642d65b](https://github.com/vitejs/vite/commit/642d65b)), closes [#8003](https://github.com/vitejs/vite/issues/8003) +* fix: optimized processing folder renaming in win (fix #7939) (#8019) ([e5fe1c6](https://github.com/vitejs/vite/commit/e5fe1c6)), closes [#7939](https://github.com/vitejs/vite/issues/7939) [#8019](https://github.com/vitejs/vite/issues/8019) +* fix(css): do not clean id when passing to postcss (fix #7822) (#7827) ([72f17f8](https://github.com/vitejs/vite/commit/72f17f8)), closes [#7822](https://github.com/vitejs/vite/issues/7822) [#7827](https://github.com/vitejs/vite/issues/7827) +* fix(css): var in image-set (#7921) ([e96b908](https://github.com/vitejs/vite/commit/e96b908)), closes [#7921](https://github.com/vitejs/vite/issues/7921) +* fix(ssr): allow ssrTransform to parse hashbang (#8005) ([6420ba0](https://github.com/vitejs/vite/commit/6420ba0)), closes [#8005](https://github.com/vitejs/vite/issues/8005) +* feat: import ts with .js in vue (#7998) ([9974094](https://github.com/vitejs/vite/commit/9974094)), closes [#7998](https://github.com/vitejs/vite/issues/7998) +* chore: remove maybeVirtualHtmlSet (#8010) ([e85164e](https://github.com/vitejs/vite/commit/e85164e)), closes [#8010](https://github.com/vitejs/vite/issues/8010) + + + ## 2.9.7 (2022-05-02) * chore: update license ([d58c030](https://github.com/vitejs/vite/commit/d58c030)) diff --git a/packages/vite/package.json b/packages/vite/package.json index 3720837d3a5afc..07d0025c449e75 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.9.7", + "version": "2.9.8", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From b0e9234251b723a3cfe37d9187dfd71c1a654e77 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Wed, 4 May 2022 19:31:32 +0200 Subject: [PATCH 0634/1287] release: plugin-vue@2.3.2 --- packages/plugin-vue/CHANGELOG.md | 8 ++++++++ packages/plugin-vue/package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue/CHANGELOG.md b/packages/plugin-vue/CHANGELOG.md index 135daffbfaaa67..4990d5fc10bd50 100644 --- a/packages/plugin-vue/CHANGELOG.md +++ b/packages/plugin-vue/CHANGELOG.md @@ -1,3 +1,11 @@ +## 2.3.2 (2022-05-04) + +* feat: import ts with .js in vue (#7998) ([9974094](https://github.com/vitejs/vite/commit/9974094)), closes [#7998](https://github.com/vitejs/vite/issues/7998) +* refactor(plugin-vue): remove querystring import (#7997) ([f3d15f1](https://github.com/vitejs/vite/commit/f3d15f1)), closes [#7997](https://github.com/vitejs/vite/issues/7997) +* chore(deps): update all non-major dependencies (#7780) ([eba9d05](https://github.com/vitejs/vite/commit/eba9d05)), closes [#7780](https://github.com/vitejs/vite/issues/7780) + + + ## 2.3.1 (2022-03-30) * chore(plugin-vue): revert #7527, lower vite peer dep ([447bbeb](https://github.com/vitejs/vite/commit/447bbeb)), closes [#7527](https://github.com/vitejs/vite/issues/7527) diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 9f401ac7fa86b1..d9e1e0cc9c4ba1 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue", - "version": "2.3.1", + "version": "2.3.2", "license": "MIT", "author": "Evan You", "files": [ From ba95a2a03ceeb68fe674082677f656ce50fe94d0 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Thu, 5 May 2022 02:24:21 +0800 Subject: [PATCH 0635/1287] fix: handle optimize failure (#8006) --- packages/vite/src/node/optimizer/registerMissing.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/vite/src/node/optimizer/registerMissing.ts b/packages/vite/src/node/optimizer/registerMissing.ts index 2262c7be96bb0a..53cd7e981b1b61 100644 --- a/packages/vite/src/node/optimizer/registerMissing.ts +++ b/packages/vite/src/node/optimizer/registerMissing.ts @@ -296,7 +296,6 @@ export function createOptimizedDeps(server: ViteDevServer): OptimizedDeps { // Reset missing deps, let the server rediscover the dependencies metadata.discovered = {} - fullReload() } currentlyProcessing = false From 2b58cb3faaa8f0da983888d0bd1f0f2a3a34de56 Mon Sep 17 00:00:00 2001 From: yoho Date: Thu, 5 May 2022 02:45:48 +0800 Subject: [PATCH 0636/1287] fix: warn for unresolved css in html (#7911) --- packages/playground/html/index.html | 3 +++ packages/vite/src/node/plugins/html.ts | 29 ++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/packages/playground/html/index.html b/packages/playground/html/index.html index 7320ff2b097db0..783cad93172f7a 100644 --- a/packages/playground/html/index.html +++ b/packages/playground/html/index.html @@ -5,3 +5,6 @@

Hello

+ + + diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index bf3d662066630b..0223c351af6071 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -247,6 +247,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin { const s = new MagicString(html) const assetUrls: AttributeNode[] = [] const scriptUrls: ScriptAssetsUrl[] = [] + const styleUrls: ScriptAssetsUrl[] = [] let inlineModuleIndex = -1 let everyScriptIsAsync = true @@ -339,8 +340,13 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin { if (!isExcludedUrl(url)) { if (node.tag === 'link' && isCSSRequest(url)) { // CSS references, convert to import - js += `\nimport ${JSON.stringify(url)}` - shouldRemove = true + const importExpression = `\nimport ${JSON.stringify(url)}` + styleUrls.push({ + url, + start: node.loc.start.offset, + end: node.loc.end.offset + }) + js += importExpression } else { assetUrls.push(p) } @@ -470,6 +476,25 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin { } } + // ignore if its url can't be resolved + const resolvedStyleUrls = await Promise.all( + styleUrls.map(async (styleUrl) => ({ + ...styleUrl, + resolved: await this.resolve(styleUrl.url, id) + })) + ) + for (const { start, end, url, resolved } of resolvedStyleUrls) { + if (resolved == null) { + config.logger.warnOnce( + `\n${url} doesn't exist at build time, it will remain unchanged to be resolved at runtime` + ) + const importExpression = `\nimport ${JSON.stringify(url)}` + js = js.replace(importExpression, '') + } else { + s.remove(start, end) + } + } + processedHtml.set(id, s.toString()) // inject module preload polyfill only when configured and needed From 70f032f0d84df995a600f0a282ee736f8edef26e Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Wed, 4 May 2022 13:08:27 -0700 Subject: [PATCH 0637/1287] docs: clarify code comments in `optimize-missing-deps` (#7332) --- packages/playground/optimize-missing-deps/server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/playground/optimize-missing-deps/server.js b/packages/playground/optimize-missing-deps/server.js index b9422feb622584..65675fe0feb589 100644 --- a/packages/playground/optimize-missing-deps/server.js +++ b/packages/playground/optimize-missing-deps/server.js @@ -25,10 +25,11 @@ async function createServer(root = process.cwd()) { let template = fs.readFileSync(resolve('index.html'), 'utf-8') template = await vite.transformIndexHtml(req.originalUrl, template) - // this will import missing deps nest built-in deps that should not be optimized + // `main.js` imports dependencies that are yet to be discovered and optimized, aka "missing" deps. + // Loading `main.js` in SSR should not trigger optimizing the "missing" deps const { name } = await vite.ssrLoadModule('./main.js') - // this will import missing deps that should be optimized correctly + // Loading `main.js` in the client should trigger optimizing the "missing" deps const appHtml = `
${name}
diff --git a/packages/playground/lib/vite.config.js b/packages/playground/lib/vite.config.js index 50cd188b1a40cc..72c040d38d6dcf 100644 --- a/packages/playground/lib/vite.config.js +++ b/packages/playground/lib/vite.config.js @@ -10,7 +10,7 @@ module.exports = { entry: path.resolve(__dirname, 'src/main.js'), name: 'MyLib', formats: ['es', 'umd', 'iife'], - fileName: (format) => `my-lib-custom-filename.${format}.js` + fileName: 'my-lib-custom-filename' } }, plugins: [ diff --git a/packages/playground/resolve-config/__tests__/resolve-config.spec.ts b/packages/playground/resolve-config/__tests__/resolve-config.spec.ts index 13ea5ea6f59a4f..cde329afde2f50 100644 --- a/packages/playground/resolve-config/__tests__/resolve-config.spec.ts +++ b/packages/playground/resolve-config/__tests__/resolve-config.spec.ts @@ -10,42 +10,45 @@ const fromTestDir = (...p: string[]) => path.resolve(testDir, ...p) const build = (configName: string) => { commandSync(`${viteBin} build`, { cwd: fromTestDir(configName) }) } -const getDistFile = (configName: string) => { - return fs.readFileSync(fromTestDir(`${configName}/dist/index.es.js`), 'utf8') +const getDistFile = (configName: string, extension: string) => { + return fs.readFileSync( + fromTestDir(`${configName}/dist/index.es.${extension}`), + 'utf8' + ) } if (isBuild) { it('loads vite.config.js', () => { build('js') - expect(getDistFile('js')).toContain('console.log(true)') + expect(getDistFile('js', 'mjs')).toContain('console.log(true)') }) it('loads vite.config.js with package#type module', () => { build('js-module') - expect(getDistFile('js-module')).toContain('console.log(true)') + expect(getDistFile('js-module', 'js')).toContain('console.log(true)') }) it('loads vite.config.cjs', () => { build('cjs') - expect(getDistFile('cjs')).toContain('console.log(true)') + expect(getDistFile('cjs', 'mjs')).toContain('console.log(true)') }) it('loads vite.config.cjs with package#type module', () => { build('cjs-module') - expect(getDistFile('cjs-module')).toContain('console.log(true)') + expect(getDistFile('cjs-module', 'js')).toContain('console.log(true)') }) it('loads vite.config.mjs', () => { build('mjs') - expect(getDistFile('mjs')).toContain('console.log(true)') + expect(getDistFile('mjs', 'mjs')).toContain('console.log(true)') }) it('loads vite.config.mjs with package#type module', () => { build('mjs-module') - expect(getDistFile('mjs-module')).toContain('console.log(true)') + expect(getDistFile('mjs-module', 'js')).toContain('console.log(true)') }) it('loads vite.config.ts', () => { build('ts') - expect(getDistFile('ts')).toContain('console.log(true)') + expect(getDistFile('ts', 'mjs')).toContain('console.log(true)') }) it('loads vite.config.ts with package#type module', () => { build('ts-module') - expect(getDistFile('ts-module')).toContain('console.log(true)') + expect(getDistFile('ts-module', 'js')).toContain('console.log(true)') }) } else { // this test doesn't support serve mode diff --git a/packages/playground/vue-lib/vite.config.lib.ts b/packages/playground/vue-lib/vite.config.lib.ts index a888382d008a8c..0cc082c7ceea85 100644 --- a/packages/playground/vue-lib/vite.config.lib.ts +++ b/packages/playground/vue-lib/vite.config.lib.ts @@ -10,7 +10,7 @@ export default defineConfig({ entry: path.resolve(__dirname, 'src-lib/index.ts'), name: 'MyVueLib', formats: ['es'], - fileName: (format) => `my-vue-lib.${format}.js` + fileName: 'my-vue-lib' }, rollupOptions: { external: ['vue'], diff --git a/packages/vite/src/node/__tests__/build.spec.ts b/packages/vite/src/node/__tests__/build.spec.ts index b3ef37e64fd28e..578e3a4c68ff8d 100644 --- a/packages/vite/src/node/__tests__/build.spec.ts +++ b/packages/vite/src/node/__tests__/build.spec.ts @@ -1,6 +1,13 @@ +import type { LibraryFormats, LibraryOptions } from '../build' import { resolveLibFilename } from '../build' import { resolve } from 'path' +type FormatsToFileNames = [LibraryFormats, string][] +const baseLibOptions: LibraryOptions = { + fileName: 'my-lib', + entry: 'mylib.js' +} + describe('resolveLibFilename', () => { test('custom filename function', () => { const filename = resolveLibFilename( @@ -25,7 +32,7 @@ describe('resolveLibFilename', () => { resolve(__dirname, 'packages/name') ) - expect(filename).toBe('custom-filename.es.js') + expect(filename).toBe('custom-filename.es.mjs') }) test('package name as filename', () => { @@ -37,7 +44,7 @@ describe('resolveLibFilename', () => { resolve(__dirname, 'packages/name') ) - expect(filename).toBe('mylib.es.js') + expect(filename).toBe('mylib.es.mjs') }) test('custom filename and no package name', () => { @@ -50,7 +57,7 @@ describe('resolveLibFilename', () => { resolve(__dirname, 'packages/noname') ) - expect(filename).toBe('custom-filename.es.js') + expect(filename).toBe('custom-filename.es.mjs') }) test('missing filename', () => { @@ -64,4 +71,42 @@ describe('resolveLibFilename', () => { ) }).toThrow() }) + + test('commonjs package extensions', () => { + const formatsToFilenames: FormatsToFileNames = [ + ['es', 'my-lib.es.mjs'], + ['umd', 'my-lib.umd.js'], + ['cjs', 'my-lib.cjs.js'], + ['iife', 'my-lib.iife.js'] + ] + + for (const [format, expectedFilename] of formatsToFilenames) { + const filename = resolveLibFilename( + baseLibOptions, + format, + resolve(__dirname, 'packages/noname') + ) + + expect(filename).toBe(expectedFilename) + } + }) + + test('module package extensions', () => { + const formatsToFilenames: FormatsToFileNames = [ + ['es', 'my-lib.es.js'], + ['umd', 'my-lib.umd.cjs'], + ['cjs', 'my-lib.cjs.cjs'], + ['iife', 'my-lib.iife.js'] + ] + + for (const [format, expectedFilename] of formatsToFilenames) { + const filename = resolveLibFilename( + baseLibOptions, + format, + resolve(__dirname, 'packages/module') + ) + + expect(filename).toBe(expectedFilename) + } + }) }) diff --git a/packages/vite/src/node/__tests__/packages/module/package.json b/packages/vite/src/node/__tests__/packages/module/package.json new file mode 100644 index 00000000000000..3dbc1ca591c055 --- /dev/null +++ b/packages/vite/src/node/__tests__/packages/module/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index f584f007f2df5e..d4d4085bb829ed 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -38,6 +38,7 @@ import type { DepOptimizationMetadata } from './optimizer' import { getDepsCacheDir, findKnownImports } from './optimizer' import { assetImportMetaUrlPlugin } from './plugins/assetImportMetaUrl' import { loadFallbackPlugin } from './plugins/loadFallback' +import type { PackageData } from './packages' import { watchPackageDataPlugin } from './packages' import { ensureWatchPlugin } from './plugins/ensureWatch' @@ -563,9 +564,11 @@ function prepareOutDir( } } -function getPkgName(root: string) { - const { name } = JSON.parse(lookupFile(root, ['package.json']) || `{}`) +function getPkgJson(root: string): PackageData['data'] { + return JSON.parse(lookupFile(root, ['package.json']) || `{}`) +} +function getPkgName(name: string) { return name?.startsWith('@') ? name.split('/')[1] : name } @@ -578,14 +581,23 @@ export function resolveLibFilename( return libOptions.fileName(format) } - const name = libOptions.fileName || getPkgName(root) + const packageJson = getPkgJson(root) + const name = libOptions.fileName || getPkgName(packageJson.name) if (!name) throw new Error( 'Name in package.json is required if option "build.lib.fileName" is not provided.' ) - return `${name}.${format}.js` + let extension: string + + if (packageJson?.type === 'module') { + extension = format === 'cjs' || format === 'umd' ? 'cjs' : 'js' + } else { + extension = format === 'es' ? 'mjs' : 'js' + } + + return `${name}.${format}.${extension}` } function resolveBuildOutputs( diff --git a/packages/vite/src/node/packages.ts b/packages/vite/src/node/packages.ts index 1424977164de85..1fb2e7b4a21c06 100644 --- a/packages/vite/src/node/packages.ts +++ b/packages/vite/src/node/packages.ts @@ -22,6 +22,8 @@ export interface PackageData { getResolvedCache: (key: string, targetWeb: boolean) => string | undefined data: { [field: string]: any + name: string + type: string version: string main: string module: string From 0e67fe8ae23d4e21db578d9a18a63861e1cdade0 Mon Sep 17 00:00:00 2001 From: yoho Date: Fri, 6 May 2022 04:27:05 +0800 Subject: [PATCH 0644/1287] fix: vite client types (#7877) Co-authored-by: Bjorn Lu --- docs/guide/env-and-mode.md | 8 ++++++++ packages/vite/client.d.ts | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/guide/env-and-mode.md b/docs/guide/env-and-mode.md index b2b1264e85a8e4..d5f45ea1158808 100644 --- a/docs/guide/env-and-mode.md +++ b/docs/guide/env-and-mode.md @@ -81,6 +81,14 @@ interface ImportMeta { } ``` +If your code relies on types from browser environments such as [DOM](https://github.com/microsoft/TypeScript/blob/main/lib/lib.dom.d.ts) and [WebWorker](https://github.com/microsoft/TypeScript/blob/main/lib/lib.webworker.d.ts), you can update the [lib](https://www.typescriptlang.org/tsconfig#lib) field in `tsconfig.json`. + +```json +{ + "lib": ["WebWorker"] +} +``` + ## Modes By default, the dev server (`dev` command) runs in `development` mode and the `build` command run in `production` mode. diff --git a/packages/vite/client.d.ts b/packages/vite/client.d.ts index aaac1ea986251d..af8e6a6f9d1494 100644 --- a/packages/vite/client.d.ts +++ b/packages/vite/client.d.ts @@ -1,4 +1,3 @@ -/// /// // CSS modules From 95eb45b15fa66b8e9707adfbed315d4a57d5c5ed Mon Sep 17 00:00:00 2001 From: Jonas <30421456+jonaskuske@users.noreply.github.com> Date: Thu, 5 May 2022 22:29:14 +0200 Subject: [PATCH 0645/1287] feat: allow any JS identifier in define, not ASCII-only (#5972) --- docs/config/index.md | 2 +- packages/playground/define/__tests__/define.spec.ts | 8 ++++++++ packages/playground/define/index.html | 13 +++++++++++++ packages/playground/define/vite.config.js | 6 ++++-- packages/vite/src/node/plugins/define.ts | 12 +++++++----- 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index db2dc932efbf30..5862419405aa89 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -164,7 +164,7 @@ export default defineConfig(({ command, mode }) => { - To be consistent with [esbuild behavior](https://esbuild.github.io/api/#define), expressions must either be a JSON object (null, boolean, number, string, array, or object) or a single identifier. - - Replacements are performed only when the match is surrounded by word boundaries (`\b`). + - Replacements are performed only when the match isn't surrounded by other letters, numbers, `_` or `$`. ::: warning Because it's implemented as straightforward text replacements without any syntax analysis, we recommend using `define` for CONSTANTS only. diff --git a/packages/playground/define/__tests__/define.spec.ts b/packages/playground/define/__tests__/define.spec.ts index 709f7a935dc8c1..5d9707e70b47ba 100644 --- a/packages/playground/define/__tests__/define.spec.ts +++ b/packages/playground/define/__tests__/define.spec.ts @@ -20,6 +20,14 @@ test('string', async () => { expect(await page.textContent('.spread-array')).toBe( JSON.stringify([...defines.__STRING__]) ) + expect(await page.textContent('.dollar-identifier')).toBe( + String(defines.$DOLLAR) + ) + expect(await page.textContent('.unicode-identifier')).toBe( + String(defines.ÖUNICODE_LETTERɵ) + ) + expect(await page.textContent('.no-identifier-substring')).toBe(String(true)) + expect(await page.textContent('.no-property')).toBe(String(true)) // html would't need to define replacement expect(await page.textContent('.exp-define')).toBe('__EXP__') expect(await page.textContent('.import-json')).toBe('__EXP__') diff --git a/packages/playground/define/index.html b/packages/playground/define/index.html index da78d192216b11..c89a3fe02218ff 100644 --- a/packages/playground/define/index.html +++ b/packages/playground/define/index.html @@ -9,6 +9,10 @@

Define

process as property:

spread object:

spread array:

+

dollar identifier:

+

unicode identifier:

+

no property:

+

no identifier substring:

define variable in html: __EXP__

import json:

@@ -28,6 +32,15 @@

Define

}) ) text('.spread-array', JSON.stringify([...`"${__STRING__}"`])) + text('.dollar-identifier', $DOLLAR) + text('.unicode-identifier', ÖUNICODE_LETTERɵ) + + // make sure these kinds of use are NOT replaced: + const obj = { [`${'_'}_EXP__`]: true } + text('.no-property', obj.__EXP__) + + window[`${'_'}_EXP__SUBSTR__`] = true + text('.no-identifier-substring', __EXP__SUBSTR__) import dataJson from './data.json' text('.import-json', dataJson.foo) diff --git a/packages/playground/define/vite.config.js b/packages/playground/define/vite.config.js index 848abd09322df6..88173fe654b58d 100644 --- a/packages/playground/define/vite.config.js +++ b/packages/playground/define/vite.config.js @@ -15,7 +15,9 @@ module.exports = { } } }, - __VAR_NAME__: false, - 'process.env.SOMEVAR': '"SOMEVAR"' + 'process.env.SOMEVAR': '"SOMEVAR"', + $DOLLAR: 456, + ÖUNICODE_LETTERɵ: 789, + __VAR_NAME__: false } } diff --git a/packages/vite/src/node/plugins/define.ts b/packages/vite/src/node/plugins/define.ts index 19ca28b34433a0..ca0f446cc1f58e 100644 --- a/packages/vite/src/node/plugins/define.ts +++ b/packages/vite/src/node/plugins/define.ts @@ -68,16 +68,18 @@ export function definePlugin(config: ResolvedConfig): Plugin { const replacementsKeys = Object.keys(replacements) const pattern = replacementsKeys.length ? new RegExp( - // Do not allow preceding '.', but do allow preceding '...' for spread operations - '(? { return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&') }) .join('|') + - // prevent trailing assignments - ')\\b(?!\\s*?=[^=])', - 'g' + // Mustn't be followed by a char that can be part of an identifier + // or an assignment (but allow equality operators) + ')(?![\\p{L}\\p{N}_$]|\\s*?=[^=])', + 'gu' ) : null From c7eeb8d69253d16dc9413d59cc13e45977a8c105 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 6 May 2022 14:07:41 +0800 Subject: [PATCH 0646/1287] chore: remove redundant pnpm version in ci (#8039) --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4818124be2430f..9768ca4ebc3df2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,8 +47,6 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v2 - with: - version: 6 - name: Set node version to ${{ matrix.node_version }} uses: actions/setup-node@v3 @@ -85,8 +83,6 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v2 - with: - version: 6 - name: Set node version to 16 uses: actions/setup-node@v3 From 63cd53d2480e40db717aff78966240eb6482aba4 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 6 May 2022 16:00:31 +0800 Subject: [PATCH 0647/1287] fix: use Vitest for unit testing, clean regex bug (#8040) --- .eslintrc.cjs | 4 +- .github/workflows/ci.yml | 3 + CONTRIBUTING.md | 14 ++- jest.config.ts | 4 +- package.json | 8 +- packages/create-vite/__tests__/cli.spec.ts | 1 + .../src/jsx-runtime/babel-restore-jsx.spec.ts | 1 + .../src/jsx-runtime/restore-jsx.spec.ts | 1 + .../vite/src/node/__tests__/asset.spec.ts | 1 + .../vite/src/node/__tests__/build.spec.ts | 1 + .../src/node/__tests__/cleanString.spec.ts | Bin 4284 -> 4756 bytes .../vite/src/node/__tests__/config.spec.ts | 1 + packages/vite/src/node/__tests__/dev.spec.ts | 1 + .../src/node/__tests__/plugins/css.spec.ts | 3 +- .../src/node/__tests__/plugins/define.spec.ts | 1 + .../src/node/__tests__/plugins/import.spec.ts | 1 + packages/vite/src/node/__tests__/scan.spec.ts | 1 + .../vite/src/node/__tests__/utils.spec.ts | 1 + packages/vite/src/node/cleanString.ts | 9 +- .../server/__tests__/pluginContainer.spec.ts | 1 + .../node/server/__tests__/search-root.spec.ts | 1 + .../node/ssr/__tests__/ssrExternal.spec.ts | 1 + .../ssr/__tests__/ssrModuleLoader.spec.ts | 3 +- .../node/ssr/__tests__/ssrTransform.spec.ts | 1 + pnpm-lock.yaml | 97 ++++++++++++++++++ vitest.config.ts | 15 +++ 26 files changed, 160 insertions(+), 15 deletions(-) create mode 100644 vitest.config.ts diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 48a0bd7773b0d7..5e00df0d89e1e0 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -63,7 +63,7 @@ module.exports = defineConfig({ 'node/no-extraneous-import': [ 'error', { - allowModules: ['vite', 'less', 'sass'] + allowModules: ['vite', 'less', 'sass', 'vitest'] } ], 'node/no-extraneous-require': [ @@ -103,7 +103,7 @@ module.exports = defineConfig({ } }, { - files: ['packages/vite/types/**'], + files: ['packages/vite/types/**', '*.spec.ts'], rules: { 'node/no-extraneous-import': 'off' } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9768ca4ebc3df2..5173da859417be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,9 @@ jobs: - name: Build plugin-react run: pnpm run build-plugin-react + - name: Test unit + run: pnpm run test-unit + - name: Test serve run: pnpm run test-serve -- --runInBand diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 621f8de145835f..40d2bb28605167 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,13 +67,15 @@ And re-run `pnpm install` to link the package. ## Running Tests +### Integration Tests + Each package under `packages/playground/` contains a `__tests__` directory. The tests are run using [Jest](https://jestjs.io/) + [Playwright](https://playwright.dev/) with custom integrations to make writing tests simple. The detailed setup is inside `jest.config.js` and `scripts/jest*` files. Before running the tests, make sure that [Vite has been built](#repo-setup). On Windows, you may want to [activate Developer Mode](https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) to solve [issues with symlink creation for non-admins](https://github.com/vitejs/vite/issues/7390). Also you may want to [set git `core.symlinks` to `true` to solve issues with symlinks in git](https://github.com/vitejs/vite/issues/5242). -Each test can be run under either dev server mode or build mode. +Each integration test can be run under either dev server mode or build mode. -- `pnpm test` by default runs every test in both serve and build mode. +- `pnpm test` by default runs every integration test in both serve and build mode, and also unit tests. - `pnpm run test-serve` runs tests only under serve mode. This is just calling `jest` so you can pass any Jest flags to this command. Since Jest will attempt to run tests in parallel, if your machine has many cores this may cause flaky test failures with multiple Playwright instances running at the same time. You can force the tests to run in series with `pnpm run test-serve -- --runInBand`. @@ -83,6 +85,14 @@ Each test can be run under either dev server mode or build mode. Note package matching is not available for the `pnpm test` script, which always runs all tests. +### Unit Tests + +Other than tests under `packages/playground/` for integration tests, packages might contains unit tests under their `__tests__` directory. Unit tests are powered by [Vitest](https://vitest.dev/). The detailed config is inside `vitest.config.ts` files. + +- `pnpm run test-unit` runs unit tests under each package. + +- You can also use `pnpm run test-unit -- [match]` to run related tests. + ### Test Env and Helpers Inside playground tests, a global `page` object is automatically available, which is a Playwright [`Page`](https://playwright.dev/docs/api/class-page) instance that has already navigated to the served page of the current playground. So writing a test is as simple as: diff --git a/jest.config.ts b/jest.config.ts index 11663af4e08107..941fccbae2af36 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -3,9 +3,7 @@ import type { Config } from '@jest/types' const config: Config.InitialOptions = { preset: 'ts-jest', - testMatch: process.env.VITE_TEST_BUILD - ? ['**/playground/**/*.spec.[jt]s?(x)'] - : ['**/*.spec.[jt]s?(x)'], + testMatch: ['**/playground/**/*.spec.[jt]s?(x)'], testTimeout: process.env.CI ? 50000 : 20000, globalSetup: './scripts/jestGlobalSetup.cjs', globalTeardown: './scripts/jestGlobalTeardown.cjs', diff --git a/package.json b/package.json index 269f1bb99cb826..843b6a4e030e39 100644 --- a/package.json +++ b/package.json @@ -16,10 +16,11 @@ "preinstall": "npx only-allow pnpm", "format": "prettier --write .", "lint": "eslint packages/*/{src,types}/**", - "test": "run-s test-serve test-build", + "test": "run-s test-serve test-build test-unit", "test-serve": "jest", - "debug-serve": "cross-env VITE_DEBUG_SERVE=1 node --inspect-brk ./node_modules/.bin/jest", "test-build": "cross-env VITE_TEST_BUILD=1 jest", + "test-unit": "vitest run", + "debug-serve": "cross-env VITE_DEBUG_SERVE=1 node --inspect-brk ./node_modules/.bin/jest", "debug-build": "cross-env VITE_TEST_BUILD=1 VITE_PRESERVE_BUILD_ARTIFACTS=1 node --inspect-brk ./node_modules/.bin/jest", "docs": "vitepress dev docs", "build-docs": "vitepress build docs", @@ -68,7 +69,8 @@ "ts-node": "^10.4.0", "typescript": "~4.5.4", "vite": "workspace:*", - "vitepress": "^0.22.3" + "vitepress": "^0.22.3", + "vitest": "^0.10.4" }, "simple-git-hooks": { "pre-commit": "pnpm exec lint-staged --concurrent false", diff --git a/packages/create-vite/__tests__/cli.spec.ts b/packages/create-vite/__tests__/cli.spec.ts index c52998172149e6..fbfb606f486885 100644 --- a/packages/create-vite/__tests__/cli.spec.ts +++ b/packages/create-vite/__tests__/cli.spec.ts @@ -3,6 +3,7 @@ import type { ExecaSyncReturnValue, SyncOptions } from 'execa' import { commandSync } from 'execa' import { mkdirpSync, readdirSync, remove, writeFileSync } from 'fs-extra' import { join } from 'path' +import { test, expect, beforeAll, afterEach } from 'vitest' const CLI_PATH = join(__dirname, '..') diff --git a/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts b/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts index 59d6661bedd11b..391007f68c1329 100644 --- a/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts +++ b/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts @@ -1,5 +1,6 @@ import babelRestoreJSX from './babel-restore-jsx' import * as babel from '@babel/core' +import { describe, it, expect } from 'vitest' function jsx(code: string) { return babel.transform(code, { diff --git a/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts b/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts index c216e99bc3480d..4f6a34ee60d915 100644 --- a/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts +++ b/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts @@ -1,5 +1,6 @@ import { restoreJSX } from './restore-jsx' import * as babel from '@babel/core' +import { describe, it, expect } from 'vitest' async function jsx(sourceCode: string) { const [ast] = await restoreJSX(babel, sourceCode, 'test.js') diff --git a/packages/vite/src/node/__tests__/asset.spec.ts b/packages/vite/src/node/__tests__/asset.spec.ts index 6e6b969bcbd38c..8727aa6485eb26 100644 --- a/packages/vite/src/node/__tests__/asset.spec.ts +++ b/packages/vite/src/node/__tests__/asset.spec.ts @@ -1,3 +1,4 @@ +import { describe, test, expect } from 'vitest' import { assetFileNamesToFileName, getAssetHash } from '../plugins/asset' describe('getAssetHash', () => { diff --git a/packages/vite/src/node/__tests__/build.spec.ts b/packages/vite/src/node/__tests__/build.spec.ts index 578e3a4c68ff8d..b49847f1d955a4 100644 --- a/packages/vite/src/node/__tests__/build.spec.ts +++ b/packages/vite/src/node/__tests__/build.spec.ts @@ -1,6 +1,7 @@ import type { LibraryFormats, LibraryOptions } from '../build' import { resolveLibFilename } from '../build' import { resolve } from 'path' +import { describe, test, expect } from 'vitest' type FormatsToFileNames = [LibraryFormats, string][] const baseLibOptions: LibraryOptions = { diff --git a/packages/vite/src/node/__tests__/cleanString.spec.ts b/packages/vite/src/node/__tests__/cleanString.spec.ts index f307c4816b7cd31bdd579b94fab09618e0af1bdb..99ecbcaad444023d10ed467f6cd9b2794fa935bd 100644 GIT binary patch delta 402 zcmdm^I7M|rmP%%BL4Hw*LbXCkYH^8fINqMQ|F)_v38sYgx*{MY}!5N7~sVNYS zCQw2vCPo89X+YJ52KgY1sz=AE$7-wBC`HF9#cC_n#3V$=#U#XP$0UF?>wwfk+#3_4 zmz!FW2&75{igF-kXlm-Gb15h!Og_&fJNX{BOuc7bPG(+ea9(0TaYlZLMgmY$K|u*j if>_DXKy6@v-#~q+LqHBn(B!Js { test('handles configs with different alias schemas', () => { diff --git a/packages/vite/src/node/__tests__/dev.spec.ts b/packages/vite/src/node/__tests__/dev.spec.ts index 3eefd7b4b903c1..cdb0fc123f4b4f 100644 --- a/packages/vite/src/node/__tests__/dev.spec.ts +++ b/packages/vite/src/node/__tests__/dev.spec.ts @@ -1,4 +1,5 @@ import { resolveConfig } from '..' +import { describe, test, expect } from 'vitest' describe('resolveBuildOptions in dev', () => { test('build.rollupOptions should not have input in lib', async () => { diff --git a/packages/vite/src/node/__tests__/plugins/css.spec.ts b/packages/vite/src/node/__tests__/plugins/css.spec.ts index e0d1f04a6510b2..eeacaf482b0c31 100644 --- a/packages/vite/src/node/__tests__/plugins/css.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/css.spec.ts @@ -2,6 +2,7 @@ import { cssUrlRE, cssPlugin, hoistAtRules } from '../../plugins/css' import { resolveConfig } from '../../config' import fs from 'fs' import path from 'path' +import { describe, vi, test, expect } from 'vitest' describe('search css url function', () => { test('some spaces before it', () => { @@ -69,7 +70,7 @@ describe('css path resolutions', () => { await buildStart.call({}) - const mockFs = jest + const mockFs = vi .spyOn(fs, 'readFile') // @ts-ignore jest.spyOn not recognize overrided `fs.readFile` definition. .mockImplementationOnce((p, encoding, callback) => { diff --git a/packages/vite/src/node/__tests__/plugins/define.spec.ts b/packages/vite/src/node/__tests__/plugins/define.spec.ts index 9a65f8f3a51cea..b9acc81cb790d5 100644 --- a/packages/vite/src/node/__tests__/plugins/define.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/define.spec.ts @@ -1,3 +1,4 @@ +import { describe, test, expect } from 'vitest' import { definePlugin } from '../../plugins/define' import { resolveConfig } from '../../config' diff --git a/packages/vite/src/node/__tests__/plugins/import.spec.ts b/packages/vite/src/node/__tests__/plugins/import.spec.ts index f0341e81b50f3c..e232702d57d354 100644 --- a/packages/vite/src/node/__tests__/plugins/import.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/import.spec.ts @@ -1,3 +1,4 @@ +import { describe, test, expect } from 'vitest' import { transformCjsImport } from '../../plugins/importAnalysis' describe('transformCjsImport', () => { diff --git a/packages/vite/src/node/__tests__/scan.spec.ts b/packages/vite/src/node/__tests__/scan.spec.ts index db11bcc45b284c..8d5a275fca0292 100644 --- a/packages/vite/src/node/__tests__/scan.spec.ts +++ b/packages/vite/src/node/__tests__/scan.spec.ts @@ -1,5 +1,6 @@ import { scriptRE, commentRE, importsRE } from '../optimizer/scan' import { multilineCommentsRE, singlelineCommentsRE } from '../utils' +import { describe, test, expect } from 'vitest' describe('optimizer-scan:script-test', () => { const scriptContent = `import { defineComponent } from 'vue' diff --git a/packages/vite/src/node/__tests__/utils.spec.ts b/packages/vite/src/node/__tests__/utils.spec.ts index 1162105c3f19c7..29fd53f3c9a32e 100644 --- a/packages/vite/src/node/__tests__/utils.spec.ts +++ b/packages/vite/src/node/__tests__/utils.spec.ts @@ -4,6 +4,7 @@ import { isWindows, resolveHostname } from '../utils' +import { describe, test, expect } from 'vitest' describe('injectQuery', () => { if (isWindows) { diff --git a/packages/vite/src/node/cleanString.ts b/packages/vite/src/node/cleanString.ts index 9b9ef656f4e017..d990ab75f15d7c 100644 --- a/packages/vite/src/node/cleanString.ts +++ b/packages/vite/src/node/cleanString.ts @@ -5,6 +5,7 @@ import { multilineCommentsRE, singlelineCommentsRE } from './utils' // /`([^`\$\{\}]|\$\{(`|\g<1>)*\})*`/g can match nested string template // but js not support match expression(\g<0>). so clean string template(`...`) in other ways. const stringsRE = /"([^"\r\n]|(?<=\\)")*"|'([^'\r\n]|(?<=\\)')*'/g +const regexRE = /\/.*?(? `${s[0]}${'\0'.repeat(s.length - 2)}${s[0]}` export function emptyString(raw: string): string { - let res = raw.replace(cleanerRE, (s: string) => - s[0] === '/' ? blankReplacer(s) : stringBlankReplacer(s) - ) + let res = raw + .replace(cleanerRE, (s: string) => + s[0] === '/' ? blankReplacer(s) : stringBlankReplacer(s) + ) + .replace(regexRE, (s) => stringBlankReplacer(s)) let lastEnd = 0 let start = 0 diff --git a/packages/vite/src/node/server/__tests__/pluginContainer.spec.ts b/packages/vite/src/node/server/__tests__/pluginContainer.spec.ts index 9fbd07e90aa089..ab0555ae7982e9 100644 --- a/packages/vite/src/node/server/__tests__/pluginContainer.spec.ts +++ b/packages/vite/src/node/server/__tests__/pluginContainer.spec.ts @@ -4,6 +4,7 @@ import type { Plugin } from '../../plugin' import { ModuleGraph } from '../moduleGraph' import type { PluginContainer } from '../pluginContainer' import { createPluginContainer } from '../pluginContainer' +import { describe, it, expect, beforeEach } from 'vitest' let resolveId: (id: string) => any let moduleGraph: ModuleGraph diff --git a/packages/vite/src/node/server/__tests__/search-root.spec.ts b/packages/vite/src/node/server/__tests__/search-root.spec.ts index 7322768286809e..ff9366e8791534 100644 --- a/packages/vite/src/node/server/__tests__/search-root.spec.ts +++ b/packages/vite/src/node/server/__tests__/search-root.spec.ts @@ -1,5 +1,6 @@ import { searchForWorkspaceRoot } from '../searchRoot' import { resolve } from 'path' +import { describe, test, expect } from 'vitest' describe('searchForWorkspaceRoot', () => { test('lerna', () => { diff --git a/packages/vite/src/node/ssr/__tests__/ssrExternal.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrExternal.spec.ts index ad16534b088e2b..5fb51093405250 100644 --- a/packages/vite/src/node/ssr/__tests__/ssrExternal.spec.ts +++ b/packages/vite/src/node/ssr/__tests__/ssrExternal.spec.ts @@ -1,4 +1,5 @@ import { stripNesting } from '../ssrExternal' +import { test, expect } from 'vitest' test('stripNesting', async () => { expect(stripNesting(['c', 'p1>c1', 'p2 > c2'])).toEqual(['c', 'c1', 'c2']) diff --git a/packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts index 6a45a2b70509d0..93a04734840d31 100644 --- a/packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts +++ b/packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts @@ -1,12 +1,13 @@ import { resolve } from 'path' import { createServer } from '../../index' +import { test, vi, expect } from 'vitest' const badjs = resolve(__dirname, './fixtures/ssrModuleLoader-bad.js') const THROW_MESSAGE = 'it is an expected error' test('always throw error when evaluating an wrong SSR module', async () => { const viteServer = await createServer() - const spy = jest.spyOn(console, 'error').mockImplementation(() => {}) + const spy = vi.spyOn(console, 'error').mockImplementation(() => {}) const expectedErrors = [] for (const i of [0, 1]) { try { diff --git a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts index 0e9181214c2b82..9c1fdea5939793 100644 --- a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts +++ b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts @@ -1,6 +1,7 @@ import { transformWithEsbuild } from '../../plugins/esbuild' import { traverseHtml } from '../../plugins/html' import { ssrTransform } from '../ssrTransform' +import { test, expect } from 'vitest' test('default import', async () => { expect( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d3aea697843c5b..3f15dbb27aae88 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,6 +45,7 @@ importers: typescript: ~4.5.4 vite: workspace:* vitepress: ^0.22.3 + vitest: ^0.10.4 devDependencies: '@microsoft/api-extractor': 7.23.0 '@types/fs-extra': 9.0.13 @@ -81,6 +82,7 @@ importers: typescript: 4.5.4 vite: link:packages/vite vitepress: 0.22.3 + vitest: 0.10.4 packages/create-vite: specifiers: @@ -2579,6 +2581,16 @@ packages: resolution: {integrity: sha512-+euflG6ygo4bn0JHtn4pYqcXwRtLvElQ7/nnjDu7iYG56H0+OhCd7d6Ug0IE3WcFpZozBKW2+80FUbv5QGk5AQ==} dev: true + /@types/chai-subset/1.3.3: + resolution: {integrity: sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==} + dependencies: + '@types/chai': 4.3.1 + dev: true + + /@types/chai/4.3.1: + resolution: {integrity: sha512-/zPMqDkzSZ8t3VtxOa4KPq7uzzW978M9Tvh+j7GHKuo6k6GTLxPJ4J5gE5cjfJ26pnXst0N5Hax8Sr0T2Mi9zQ==} + dev: true + /@types/convert-source-map/1.5.2: resolution: {integrity: sha512-tHs++ZeXer40kCF2JpE51Hg7t4HPa18B1b1Dzy96S0eCw8QKECNMYMfwa1edK/x8yCN0r4e6ewvLcc5CsVGkdg==} dev: true @@ -3370,6 +3382,10 @@ packages: resolution: {integrity: sha512-TaTivMB6pYI1kXwrFlEhLeGfOqoDNdTxjCdwRfFFkEA30Eu+k48W34nlok2EYWJfFFzqaEmichdNM7th6M5HNw==} dev: true + /assertion-error/1.1.0: + resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + dev: true + /astral-regex/2.0.0: resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==} engines: {node: '>=8'} @@ -3666,6 +3682,19 @@ packages: resolution: {integrity: sha512-kbaCEBRRVSoeNs74sCuq92MJyGrMtjWVfhltoHUCW4t4pXFvGjUBrfo47weBRViHkiV3eBYyIsfl956NtHGazw==} dev: false + /chai/4.3.6: + resolution: {integrity: sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==} + engines: {node: '>=4'} + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.2 + deep-eql: 3.0.1 + get-func-name: 2.0.0 + loupe: 2.3.4 + pathval: 1.1.1 + type-detect: 4.0.8 + dev: true + /chalk/2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} @@ -3692,6 +3721,10 @@ packages: is-regex: 1.1.4 dev: true + /check-error/1.0.2: + resolution: {integrity: sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=} + dev: true + /chokidar/3.5.2: resolution: {integrity: sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==} engines: {node: '>= 8.10.0'} @@ -4374,6 +4407,13 @@ packages: resolution: {integrity: sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=} dev: true + /deep-eql/3.0.1: + resolution: {integrity: sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==} + engines: {node: '>=0.12'} + dependencies: + type-detect: 4.0.8 + dev: true + /deep-is/0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} dev: true @@ -5356,6 +5396,10 @@ packages: engines: {node: 6.* || 8.* || >= 10.*} dev: true + /get-func-name/2.0.0: + resolution: {integrity: sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=} + dev: true + /get-intrinsic/1.1.1: resolution: {integrity: sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==} dependencies: @@ -6786,6 +6830,11 @@ packages: engines: {node: '>= 12.13.0'} dev: true + /local-pkg/0.4.1: + resolution: {integrity: sha512-lL87ytIGP2FU5PWwNDo0w3WhIo2gopIAxPg9RxDYF7m4rr5ahuZxP22xnJHIvaLTe4Z9P6uKKY2UHiwyB4pcrw==} + engines: {node: '>=14'} + dev: true + /locate-path/2.0.0: resolution: {integrity: sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=} engines: {node: '>=4'} @@ -6869,6 +6918,12 @@ packages: js-tokens: 4.0.0 dev: false + /loupe/2.3.4: + resolution: {integrity: sha512-OvKfgCC2Ndby6aSTREl5aCCPTNIzlDfQZvZxNUrBrihDhL3xcrYegTblhmEiCrg2kKQz4XsFIaemE5BF4ybSaQ==} + dependencies: + get-func-name: 2.0.0 + dev: true + /lru-cache/6.0.0: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} engines: {node: '>=10'} @@ -7560,6 +7615,10 @@ packages: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} + /pathval/1.1.1: + resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + dev: true + /pend/1.2.0: resolution: {integrity: sha1-elfrVQpng/kRUzH89GY9XI4AelA=} dev: true @@ -9242,6 +9301,16 @@ packages: resolution: {integrity: sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==} dev: false + /tinypool/0.1.3: + resolution: {integrity: sha512-2IfcQh7CP46XGWGGbdyO4pjcKqsmVqFAPcXfPxcPXmOWt9cYkTP9HcDmGgsfijYoAEc4z9qcpM/BaBz46Y9/CQ==} + engines: {node: '>=14.0.0'} + dev: true + + /tinyspy/0.3.2: + resolution: {integrity: sha512-2+40EP4D3sFYy42UkgkFFB+kiX2Tg3URG/lVvAZFfLxgGpnWl5qQJuBw1gaLttq8UOS+2p3C0WrhJnQigLTT2Q==} + engines: {node: '>=14.0.0'} + dev: true + /tmp/0.2.1: resolution: {integrity: sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==} engines: {node: '>=8.17.0'} @@ -9623,6 +9692,34 @@ packages: - react-dom dev: true + /vitest/0.10.4: + resolution: {integrity: sha512-FJ2av2PVozmyz9nqHRoC3H8j2z0OQXj8P8jS5oyMY9mfPWB06GS5k/1Ot++TkVBLQRHZCcVzjbK4BO7zqAJZGQ==} + engines: {node: '>=v14.16.0'} + hasBin: true + peerDependencies: + '@vitest/ui': '*' + c8: '*' + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@vitest/ui': + optional: true + c8: + optional: true + happy-dom: + optional: true + jsdom: + optional: true + dependencies: + '@types/chai': 4.3.1 + '@types/chai-subset': 1.3.3 + chai: 4.3.6 + local-pkg: 0.4.1 + tinypool: 0.1.3 + tinyspy: 0.3.2 + vite: link:packages/vite + dev: true + /void-elements/3.1.0: resolution: {integrity: sha1-YU9/v42AHwu18GYfWy9XhXUOTwk=} engines: {node: '>=0.10.0'} diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 00000000000000..78e54e98cc02d9 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,15 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + exclude: [ + '**/node_modules/**', + '**/dist/**', + './packages/playground/**/*.*', + './packages/temp/**/*.*' + ] + }, + esbuild: { + target: 'node14' + } +}) From 5280908972219392a0d8daa2a33553868ca7072b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Fri, 6 May 2022 18:26:47 +0900 Subject: [PATCH 0648/1287] fix(css): hoist external @import for non-split css (#8022) --- packages/playground/lib/__tests__/lib.spec.ts | 7 +++++ packages/playground/lib/__tests__/serve.js | 14 +++++++++- packages/playground/lib/src/dynamic.css | 4 +++ packages/playground/lib/src/index.css | 3 ++ packages/playground/lib/src/main2.js | 5 ++++ .../playground/lib/vite.dyimport.config.js | 1 - packages/vite/src/node/plugins/css.ts | 28 +++++++++++-------- 7 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 packages/playground/lib/src/dynamic.css create mode 100644 packages/playground/lib/src/index.css diff --git a/packages/playground/lib/__tests__/lib.spec.ts b/packages/playground/lib/__tests__/lib.spec.ts index f1e93e90d8357b..cc5887c2777fcb 100644 --- a/packages/playground/lib/__tests__/lib.spec.ts +++ b/packages/playground/lib/__tests__/lib.spec.ts @@ -35,6 +35,13 @@ if (isBuild) { ) expect(code).not.toMatch('__vitePreload') }) + + test('@import hoist', async () => { + serverLogs.forEach((log) => { + // no warning from esbuild css minifier + expect(log).not.toMatch('All "@import" rules must come first') + }) + }) } else { test('dev', async () => { expect(await page.textContent('.demo')).toBe('It works') diff --git a/packages/playground/lib/__tests__/serve.js b/packages/playground/lib/__tests__/serve.js index eac6980286af52..2534545de5c221 100644 --- a/packages/playground/lib/__tests__/serve.js +++ b/packages/playground/lib/__tests__/serve.js @@ -9,6 +9,8 @@ const { ports } = require('../../testUtils') const port = (exports.port = ports.lib) +global.serverLogs = [] + /** * @param {string} root * @param {boolean} isBuildTest @@ -16,6 +18,8 @@ const port = (exports.port = ports.lib) exports.serve = async function serve(root, isBuildTest) { // build first + setupConsoleWarnCollector() + if (!isBuildTest) { const { createServer } = require('vite') process.env.VITE_INLINE = 'inline-serve' @@ -55,7 +59,7 @@ exports.serve = async function serve(root, isBuildTest) { await build({ root, - logLevel: 'silent', + logLevel: 'warn', // output esbuild warns configFile: path.resolve(__dirname, '../vite.dyimport.config.js') }) @@ -89,3 +93,11 @@ exports.serve = async function serve(root, isBuildTest) { }) } } + +function setupConsoleWarnCollector() { + const warn = console.warn + console.warn = (...args) => { + global.serverLogs.push(args.join(' ')) + return warn.call(console, ...args) + } +} diff --git a/packages/playground/lib/src/dynamic.css b/packages/playground/lib/src/dynamic.css new file mode 100644 index 00000000000000..4378c8d328cfbe --- /dev/null +++ b/packages/playground/lib/src/dynamic.css @@ -0,0 +1,4 @@ +@import 'https://cdn.jsdelivr.net/npm/@mdi/font@5.9.55/css/materialdesignicons.min.css'; +.dynamic { + color: red; +} diff --git a/packages/playground/lib/src/index.css b/packages/playground/lib/src/index.css new file mode 100644 index 00000000000000..b0bd670bd9ecad --- /dev/null +++ b/packages/playground/lib/src/index.css @@ -0,0 +1,3 @@ +.index { + color: blue; +} diff --git a/packages/playground/lib/src/main2.js b/packages/playground/lib/src/main2.js index 0c729fad8d165c..f19a16bb128949 100644 --- a/packages/playground/lib/src/main2.js +++ b/packages/playground/lib/src/main2.js @@ -1,4 +1,9 @@ +import './index.css' + export default async function message(sel) { const message = await import('./message.js') + + await import('./dynamic.css') + document.querySelector(sel).textContent = message.default } diff --git a/packages/playground/lib/vite.dyimport.config.js b/packages/playground/lib/vite.dyimport.config.js index 76311f4b8ba138..d738503f0c9d09 100644 --- a/packages/playground/lib/vite.dyimport.config.js +++ b/packages/playground/lib/vite.dyimport.config.js @@ -6,7 +6,6 @@ const path = require('path') */ module.exports = { build: { - minify: false, lib: { entry: path.resolve(__dirname, 'src/main2.js'), formats: ['es'], diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index cd57acd1690902..c61e059867080b 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -443,13 +443,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { } }) // only external @imports and @charset should exist at this point - // hoist them to the top of the CSS chunk per spec (#1845 and #6333) - if (css.includes('@import') || css.includes('@charset')) { - css = await hoistAtRules(css) - } - if (minify && config.build.minify) { - css = await minifyCSS(css, config) - } + css = await finalizeCss(css, minify, config) return css } @@ -559,10 +553,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { let extractedCss = outputToExtractedCSSMap.get(opts) if (extractedCss && !hasEmitted) { hasEmitted = true - // minify css - if (config.build.minify) { - extractedCss = await minifyCSS(extractedCss, config) - } + extractedCss = await finalizeCss(extractedCss, true, config) this.emitFile({ name: 'style.css', type: 'asset', @@ -922,6 +913,21 @@ function combineSourcemapsIfExists( : map1 } +async function finalizeCss( + css: string, + minify: boolean, + config: ResolvedConfig +) { + // hoist external @imports and @charset to the top of the CSS chunk per spec (#1845 and #6333) + if (css.includes('@import') || css.includes('@charset')) { + css = await hoistAtRules(css) + } + if (minify && config.build.minify) { + css = await minifyCSS(css, config) + } + return css +} + interface PostCSSConfigResult { options: PostCSS.ProcessOptions plugins: PostCSS.Plugin[] From e0fe2008b248aec4813efba34db9e644b851943a Mon Sep 17 00:00:00 2001 From: Enzo Innocenzi Date: Fri, 6 May 2022 14:24:40 +0200 Subject: [PATCH 0649/1287] fix(plugin-vue): allow overwriting template.transformAssetUrls.includeAbsolute (fix #4836) (#6779) --- packages/plugin-vue/src/template.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-vue/src/template.ts b/packages/plugin-vue/src/template.ts index 72e9588967556e..c7eed9015d6339 100644 --- a/packages/plugin-vue/src/template.ts +++ b/packages/plugin-vue/src/template.ts @@ -139,7 +139,7 @@ export function resolveTemplateCompilerOptions( tags: transformAssetUrls as any } } else { - transformAssetUrls = { ...transformAssetUrls, ...assetUrlOptions } + transformAssetUrls = { ...assetUrlOptions, ...transformAssetUrls } } } else { transformAssetUrls = assetUrlOptions From c7356e0f8e7a8f7476db90204638d9834cb58101 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Fri, 6 May 2022 16:42:51 -0400 Subject: [PATCH 0650/1287] fix: invalidate ssrError when HMR update occurs (#8052) --- packages/vite/src/node/server/hmr.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vite/src/node/server/hmr.ts b/packages/vite/src/node/server/hmr.ts index 8d33554706dee2..8eca99268e93d7 100644 --- a/packages/vite/src/node/server/hmr.ts +++ b/packages/vite/src/node/server/hmr.ts @@ -294,6 +294,7 @@ function invalidate(mod: ModuleNode, timestamp: number, seen: Set) { mod.lastHMRTimestamp = timestamp mod.transformResult = null mod.ssrModule = null + mod.ssrError = null mod.ssrTransformResult = null mod.importers.forEach((importer) => { if (!importer.acceptedHmrDeps.has(mod)) { From 8897da18a084d138dd32a5b4734220520e08e5a4 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 7 May 2022 11:07:05 +0800 Subject: [PATCH 0651/1287] chore: update workspace setup --- package.json | 2 +- pnpm-lock.yaml | 23 ----------------------- pnpm-workspace.yaml | 2 ++ 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 843b6a4e030e39..eae96bb7fa8dd1 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "preinstall": "npx only-allow pnpm", "format": "prettier --write .", "lint": "eslint packages/*/{src,types}/**", - "test": "run-s test-serve test-build test-unit", + "test": "run-s test-unit test-serve test-build", "test-serve": "jest", "test-build": "cross-env VITE_TEST_BUILD=1 jest", "test-unit": "vitest run", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3f15dbb27aae88..d1d5b496892229 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -280,32 +280,9 @@ importers: test-package-d: link:test-package-d test-package-e: link:test-package-e - packages/playground/nested-deps/test-package-a: - specifiers: {} - - packages/playground/nested-deps/test-package-b: - specifiers: {} - - packages/playground/nested-deps/test-package-c: - specifiers: {} - - packages/playground/nested-deps/test-package-d: - specifiers: - test-package-d-nested: link:./test-package-d-nested - dependencies: - test-package-d-nested: link:test-package-d-nested - packages/playground/nested-deps/test-package-d/test-package-d-nested: specifiers: {} - packages/playground/nested-deps/test-package-e: - specifiers: - test-package-e-excluded: link:./test-package-e-excluded - test-package-e-included: link:./test-package-e-included - dependencies: - test-package-e-excluded: link:test-package-e-excluded - test-package-e-included: link:test-package-e-included - packages/playground/nested-deps/test-package-e/test-package-e-excluded: specifiers: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index f8a7dd53d45fb0..a4e6b07cfdf222 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,5 @@ packages: - 'packages/*' - 'packages/playground/**' + - '!packages/temp' + - '!packages/playground/nested-deps/test-package-*' From b44d745360435d9eb607eaca239cc396ae41c1c0 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 7 May 2022 11:32:35 +0800 Subject: [PATCH 0652/1287] chore: revert workspace change --- pnpm-workspace.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index a4e6b07cfdf222..f8a7dd53d45fb0 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,5 +1,3 @@ packages: - 'packages/*' - 'packages/playground/**' - - '!packages/temp' - - '!packages/playground/nested-deps/test-package-*' From dc323a0a230f57de0d102782dd4e673fb6b2d06c Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 7 May 2022 11:32:52 +0800 Subject: [PATCH 0653/1287] chore: update lock --- pnpm-lock.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d1d5b496892229..3f15dbb27aae88 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -280,9 +280,32 @@ importers: test-package-d: link:test-package-d test-package-e: link:test-package-e + packages/playground/nested-deps/test-package-a: + specifiers: {} + + packages/playground/nested-deps/test-package-b: + specifiers: {} + + packages/playground/nested-deps/test-package-c: + specifiers: {} + + packages/playground/nested-deps/test-package-d: + specifiers: + test-package-d-nested: link:./test-package-d-nested + dependencies: + test-package-d-nested: link:test-package-d-nested + packages/playground/nested-deps/test-package-d/test-package-d-nested: specifiers: {} + packages/playground/nested-deps/test-package-e: + specifiers: + test-package-e-excluded: link:./test-package-e-excluded + test-package-e-included: link:./test-package-e-included + dependencies: + test-package-e-excluded: link:test-package-e-excluded + test-package-e-included: link:test-package-e-included + packages/playground/nested-deps/test-package-e/test-package-e-excluded: specifiers: {} From fe704f1ff7a5532d9efd9999d9fc8793884e9fe8 Mon Sep 17 00:00:00 2001 From: patak Date: Sat, 7 May 2022 07:20:00 +0200 Subject: [PATCH 0654/1287] fix: graceful rename in windows (#8036) --- packages/vite/src/node/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index d41dd6850ebb56..29741989ea2326 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -775,8 +775,8 @@ function gracefulRename( ) { setTimeout(function () { fs.stat(to, function (stater, st) { - if (stater && stater.code === 'ENOENT') gracefulRename(from, to, CB) - else cb(er) + if (stater && stater.code === 'ENOENT') fs.rename(from, to, CB) + else CB(er) }) }, backoff) if (backoff < 100) backoff += 10 From 1ffc0107e81d9196284a42dd450b8ff9d038b245 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 7 May 2022 13:30:08 +0800 Subject: [PATCH 0655/1287] fix: use `strip-literal` to strip string lterals (#8054) --- packages/vite/LICENSE.md | 29 ++++ packages/vite/package.json | 1 + .../src/node/__tests__/cleanString.spec.ts | Bin 4756 -> 0 bytes packages/vite/src/node/cleanString.ts | 145 ------------------ .../src/node/plugins/assetImportMetaUrl.ts | 4 +- packages/vite/src/node/plugins/css.ts | 2 +- packages/vite/src/node/plugins/html.ts | 4 +- .../src/node/plugins/workerImportMetaUrl.ts | 4 +- packages/vite/src/node/utils.ts | 4 + pnpm-lock.yaml | 8 + 10 files changed, 49 insertions(+), 152 deletions(-) delete mode 100644 packages/vite/src/node/__tests__/cleanString.spec.ts delete mode 100644 packages/vite/src/node/cleanString.ts diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index 30803708e30a76..80feb7f95c6941 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -3465,6 +3465,35 @@ Repository: chalk/strip-ansi --------------------------------------- +## strip-literal +License: MIT +By: Anthony Fu +Repository: git+https://github.com/antfu/strip-literal.git + +> MIT License +> +> Copyright (c) 2022 Anthony Fu +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +--------------------------------------- + ## to-regex-range License: MIT By: Jon Schlinkert, Rouven Weßling diff --git a/packages/vite/package.json b/packages/vite/package.json index 55c86878622111..b508842619033e 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -112,6 +112,7 @@ "source-map-js": "^1.0.2", "source-map-support": "^0.5.21", "strip-ansi": "^6.0.1", + "strip-literal": "^0.2.0", "terser": "^5.13.1", "tsconfck": "^1.2.2", "tslib": "^2.4.0", diff --git a/packages/vite/src/node/__tests__/cleanString.spec.ts b/packages/vite/src/node/__tests__/cleanString.spec.ts deleted file mode 100644 index 99ecbcaad444023d10ed467f6cd9b2794fa935bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4756 zcmc&&TW{h<6z(&>;>e0LHbgjVyDwE)sqNEBttvID`Vc4bULVgdHr(Vhw5>j>q99dtRn_6|U?$ zQ-ic-GV6`~a&OBt@6aXe3caIwaIOz zZov;=`T@2Ba4bIdu-|I-W1a~^a9k5;`>&T|JS0+-{|<(so8bl=CoX->6U}mGq2=jM z9@YxqK*%adC%hK{aWF>U)_#DBuv`3Ke5HcHE~qi67}q`oNs(6;7+07c2Z8MudX2P7 z<45tN*wS@h$Yx09&G6$nGH%Ypq}hZ6KBGw4d7qsi$A8u~S@~Ya)aXwBlt zDA?wj-s|CKszh%LBr9F&#G0}fOTv8^NHvKfH4(f#?0XXdMf&|Q(sd_rSkvM>3*vR8 z!GBp&6Y7)Py2Y+&Qy%JS`!wi`c<9ESLRGac#e>d>)?_t)i(+2b26-gxhFxivh&brQ z0`v1M%t9r}gaRdiJQ)ji=UL%`zfNh$@mMhPo;fZqSk)<)8)u%zly$M* z#_hWfHQU_AsEavDC$AfGZIGU5j5^C0M|~}0qWCOpYVu2&vv)sevdGLhE0%IH;D8T< z>u4QH6dcqF7>CViGefwD{wk&@IL{QJzltfi(dXIX7)~^%Ep&@CpGz$RNqbmidI@O` zrT&D?+YekgtBs~f z75jD>H84WYV*Ea&kO)vCQ(RRyA&d^5Z;-(6Sg&a+hTF|HK?8lt=k4rUnCt=^&UgO| zphU<~_6wnl`2d_8HJB%u-NpU{a>_Z5OQ(x0Z}30W(^uPeDjVs(KQ$Jo_0m*f zR_HlCzw36qOc!|m%L{$HHdc?H%PbhLO0(ES9_Y+YmHI#hQrw6eJh!}8*8~} z({BlwK;4@@p0%9{!u#8nGKRFhWc>MD;7<#Dsh|hWNf!!!3Zc$0ie|V2QB;lm-;44O zQ@-5etJ2J65a7ZvihOE(M~9o$omCG{>T#rAyoV?6apb*3@xxOTKaQf9nQw_!_AH8c z*Ra8T6A?iWE^)v9{nh1To~60D&-JES71sS;B6lQ8dnwzEvtRwUA9*7J-!<{-h&%Q- DgfAcj diff --git a/packages/vite/src/node/cleanString.ts b/packages/vite/src/node/cleanString.ts deleted file mode 100644 index d990ab75f15d7c..00000000000000 --- a/packages/vite/src/node/cleanString.ts +++ /dev/null @@ -1,145 +0,0 @@ -import type { RollupError } from 'rollup' -import { multilineCommentsRE, singlelineCommentsRE } from './utils' - -// bank on the non-overlapping nature of regex matches and combine all filters into one giant regex -// /`([^`\$\{\}]|\$\{(`|\g<1>)*\})*`/g can match nested string template -// but js not support match expression(\g<0>). so clean string template(`...`) in other ways. -const stringsRE = /"([^"\r\n]|(?<=\\)")*"|'([^'\r\n]|(?<=\\)')*'/g -const regexRE = /\/.*?(? ' '.repeat(s.length) -const stringBlankReplacer = (s: string) => - `${s[0]}${'\0'.repeat(s.length - 2)}${s[0]}` - -export function emptyString(raw: string): string { - let res = raw - .replace(cleanerRE, (s: string) => - s[0] === '/' ? blankReplacer(s) : stringBlankReplacer(s) - ) - .replace(regexRE, (s) => stringBlankReplacer(s)) - - let lastEnd = 0 - let start = 0 - while ((start = res.indexOf('`', lastEnd)) >= 0) { - let clean - ;[clean, lastEnd] = lexStringTemplateExpression(res, start) - res = replaceAt(res, start, lastEnd, clean) - } - - return res -} - -export function emptyCssComments(raw: string) { - return raw.replace(multilineCommentsRE, blankReplacer) -} - -const enum LexerState { - // template string - inTemplateString, - inInterpolationExpression, - inObjectExpression, - // strings - inSingleQuoteString, - inDoubleQuoteString, - // comments - inMultilineCommentsRE, - inSinglelineCommentsRE -} - -function replaceAt( - string: string, - start: number, - end: number, - replacement: string -): string { - return string.slice(0, start) + replacement + string.slice(end) -} - -/** - * lex string template and clean it. - */ -function lexStringTemplateExpression( - code: string, - start: number -): [string, number] { - let state = LexerState.inTemplateString as LexerState - let clean = '`' - const opStack: LexerState[] = [state] - - function pushStack(newState: LexerState) { - state = newState - opStack.push(state) - } - - function popStack() { - opStack.pop() - state = opStack[opStack.length - 1] - } - - let i = start + 1 - outer: for (; i < code.length; i++) { - const char = code.charAt(i) - switch (state) { - case LexerState.inTemplateString: - if (char === '$' && code.charAt(i + 1) === '{') { - pushStack(LexerState.inInterpolationExpression) - clean += '${' - i++ // jump next - } else if (char === '`') { - popStack() - clean += char - if (opStack.length === 0) { - break outer - } - } else { - clean += '\0' - } - break - case LexerState.inInterpolationExpression: - if (char === '{') { - pushStack(LexerState.inObjectExpression) - clean += char - } else if (char === '}') { - popStack() - clean += char - } else if (char === '`') { - pushStack(LexerState.inTemplateString) - clean += char - } else { - clean += char - } - break - case LexerState.inObjectExpression: - if (char === '}') { - popStack() - clean += char - } else if (char === '`') { - pushStack(LexerState.inTemplateString) - clean += char - } else { - clean += char - } - break - default: - throw new Error('unknown string template lexer state') - } - } - - if (opStack.length !== 0) { - error(start) - } - - return [clean, i + 1] -} - -function error(pos: number) { - const err = new Error( - `can not match string template expression.` - ) as RollupError - err.pos = pos - throw err -} diff --git a/packages/vite/src/node/plugins/assetImportMetaUrl.ts b/packages/vite/src/node/plugins/assetImportMetaUrl.ts index b8c16f76d2b93f..217b0d3fee1564 100644 --- a/packages/vite/src/node/plugins/assetImportMetaUrl.ts +++ b/packages/vite/src/node/plugins/assetImportMetaUrl.ts @@ -3,7 +3,7 @@ import MagicString from 'magic-string' import path from 'path' import { fileToUrl } from './asset' import type { ResolvedConfig } from '../config' -import { emptyString } from '../cleanString' +import { stripLiteral } from 'strip-literal' /** * Convert `new URL('./foo.png', import.meta.url)` to its resolved built URL @@ -27,7 +27,7 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin { let s: MagicString | undefined const assetImportMetaUrlRE = /\bnew\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*,?\s*\)/g - const cleanString = emptyString(code) + const cleanString = stripLiteral(code) let match: RegExpExecArray | null while ((match = assetImportMetaUrlRE.exec(cleanString))) { diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index c61e059867080b..22dfc33f67a509 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -49,7 +49,7 @@ import { transform, formatMessages } from 'esbuild' import { addToHTMLProxyTransformResult } from './html' import { injectSourcesContent, getCodeWithSourcemap } from '../server/sourcemap' import type { RawSourceMap } from '@ampproject/remapping' -import { emptyCssComments } from '../cleanString' +import { emptyCssComments } from '../utils' // const debug = createDebugger('vite:css') diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index 0223c351af6071..6d793c416ce60a 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -36,7 +36,7 @@ import type { TextNode } from '@vue/compiler-dom' import { NodeTypes } from '@vue/compiler-dom' -import { emptyString } from '../cleanString' +import { stripLiteral } from 'strip-literal' interface ScriptAssetsUrl { start: number @@ -308,7 +308,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin { } } else if (node.children.length) { const scriptNode = node.children.pop()! as TextNode - const cleanCode = emptyString(scriptNode.content) + const cleanCode = stripLiteral(scriptNode.content) let match: RegExpExecArray | null while ((match = inlineImportRE.exec(cleanCode))) { diff --git a/packages/vite/src/node/plugins/workerImportMetaUrl.ts b/packages/vite/src/node/plugins/workerImportMetaUrl.ts index 3d8970b746349c..bfd8c22dcad372 100644 --- a/packages/vite/src/node/plugins/workerImportMetaUrl.ts +++ b/packages/vite/src/node/plugins/workerImportMetaUrl.ts @@ -10,7 +10,7 @@ import { ENV_ENTRY, ENV_PUBLIC_PATH } from '../constants' import MagicString from 'magic-string' import type { ViteDevServer } from '..' import type { RollupError } from 'rollup' -import { emptyString } from '../cleanString' +import { stripLiteral } from 'strip-literal' type WorkerType = 'classic' | 'module' | 'ignore' const ignoreFlagRE = /\/\*\s*@vite-ignore\s*\*\// @@ -110,7 +110,7 @@ export function workerImportMetaUrlPlugin(config: ResolvedConfig): Plugin { code.includes('new URL') && code.includes(`import.meta.url`) ) { - const cleanString = emptyString(code) + const cleanString = stripLiteral(code) const workerImportMetaUrlRE = /\bnew\s+(Worker|SharedWorker)\s*\(\s*(new\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*\))/g diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 29741989ea2326..ddcaced9832bc1 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -785,3 +785,7 @@ function gracefulRename( if (cb) cb(er) }) } + +export function emptyCssComments(raw: string) { + return raw.replace(multilineCommentsRE, (s) => ' '.repeat(s.length)) +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3f15dbb27aae88..a20eb4e3bb7d1f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -893,6 +893,7 @@ importers: source-map-js: ^1.0.2 source-map-support: ^0.5.21 strip-ansi: ^6.0.1 + strip-literal: ^0.2.0 terser: ^5.13.1 tsconfck: ^1.2.2 tslib: ^2.4.0 @@ -966,6 +967,7 @@ importers: source-map-js: 1.0.2 source-map-support: 0.5.21 strip-ansi: 6.0.1 + strip-literal: 0.2.0 terser: 5.13.1 tsconfck: 1.2.2_typescript@4.5.4 tslib: 2.4.0 @@ -9016,6 +9018,12 @@ packages: engines: {node: '>=8'} dev: true + /strip-literal/0.2.0: + resolution: {integrity: sha512-pqhiiFRDifA2CRVH0Gmv6MDbd2b27MS0oIqqy7JCqfL5m2sh68223lmEK2eoBXp4vNaq8G1Wzwd9dfQcWszUlg==} + dependencies: + acorn: 8.7.1 + dev: true + /stylis/4.0.13: resolution: {integrity: sha512-xGPXiFVl4YED9Jh7Euv2V220mriG9u4B2TA6Ybjc1catrstKD2PpIdU3U0RKpkVBC2EhmL/F0sPCr9vrFTNRag==} From 20ea9999765ea372c20acc39e05cd81b98c9f6fe Mon Sep 17 00:00:00 2001 From: Rom Date: Sat, 7 May 2022 21:23:54 +0200 Subject: [PATCH 0656/1287] feat: new hook `configurePreviewServer` (#7658) --- docs/guide/api-plugin.md | 22 ++++++++++++++++++++++ packages/vite/src/node/index.ts | 1 + packages/vite/src/node/plugin.ts | 10 ++++++++++ packages/vite/src/node/preview.ts | 20 ++++++++++++++++++++ 4 files changed, 53 insertions(+) diff --git a/docs/guide/api-plugin.md b/docs/guide/api-plugin.md index 50353765261e34..76b9984a069828 100644 --- a/docs/guide/api-plugin.md +++ b/docs/guide/api-plugin.md @@ -305,6 +305,28 @@ Vite plugins can also provide hooks that serve Vite-specific purposes. These hoo Note `configureServer` is not called when running the production build so your other hooks need to guard against its absence. +### `configurePreviewServer` + +- **Type:** `(server: { middlewares: Connect.Server, httpServer: http.Server }) => (() => void) | void | Promise<(() => void) | void>` +- **Kind:** `async`, `sequential` + + Same as [`configureServer`](/guide/api-plugin.html#configureserver) but for the preview server. It provides the [connect](https://github.com/senchalabs/connect) server and its underlying [http server](https://nodejs.org/api/http.html). Similarly to `configureServer`, the `configurePreviewServer` hook is called before other middlewares are installed. If you want to inject a middleware **after** other middlewares, you can return a function from `configurePreviewServer`, which will be called after internal middlewares are installed: + + ```js + const myPlugin = () => ({ + name: 'configure-preview-server', + configurePreviewServer(server) { + // return a post hook that is called after other middlewares are + // installed + return () => { + server.middlewares.use((req, res, next) => { + // custom handle request... + }) + } + } + }) + ``` + ### `transformIndexHtml` - **Type:** `IndexHtmlTransformHook | { enforce?: 'pre' | 'post', transform: IndexHtmlTransformHook }` diff --git a/packages/vite/src/node/index.ts b/packages/vite/src/node/index.ts index c15359f45b69de..e56f4c6e765756 100644 --- a/packages/vite/src/node/index.ts +++ b/packages/vite/src/node/index.ts @@ -33,6 +33,7 @@ export type { export type { PreviewOptions, PreviewServer, + PreviewServerHook, ResolvedPreviewOptions } from './preview' export type { diff --git a/packages/vite/src/node/plugin.ts b/packages/vite/src/node/plugin.ts index 354b246dd9f182..3bfe789a299987 100644 --- a/packages/vite/src/node/plugin.ts +++ b/packages/vite/src/node/plugin.ts @@ -13,6 +13,7 @@ import type { IndexHtmlTransform } from './plugins/html' import type { ModuleNode } from './server/moduleGraph' import type { ConfigEnv, ResolvedConfig } from './' import type { HmrContext } from './server/hmr' +import type { PreviewServerHook } from './preview' /** * Vite plugins extends the Rollup plugin interface with a few extra @@ -79,6 +80,15 @@ export interface Plugin extends RollupPlugin { * are applied. Hook can be async functions and will be called in series. */ configureServer?: ServerHook + /** + * Configure the preview server. The hook receives the connect server and + * its underlying http server. + * + * The hooks are called before other middlewares are applied. A hook can + * return a post hook that will be called after other middlewares are + * applied. Hooks can be async functions and will be called in series. + */ + configurePreviewServer?: PreviewServerHook /** * Transform index.html. * The hook receives the following arguments: diff --git a/packages/vite/src/node/preview.ts b/packages/vite/src/node/preview.ts index c1670c5d7efa72..e48f2e6231933f 100644 --- a/packages/vite/src/node/preview.ts +++ b/packages/vite/src/node/preview.ts @@ -14,6 +14,7 @@ import corsMiddleware from 'cors' import { proxyMiddleware } from './server/middlewares/proxy' import { resolveHostname } from './utils' import { printCommonServerUrls } from './logger' +import type * as http from 'http' export interface PreviewOptions extends CommonServerOptions {} @@ -53,6 +54,11 @@ export interface PreviewServer { printUrls: () => void } +export type PreviewServerHook = (server: { + middlewares: Connect.Server + httpServer: http.Server +}) => (() => void) | void | Promise<(() => void) | void> + /** * Starts the Vite server in preview mode, to simulate a production deployment * @experimental @@ -69,6 +75,16 @@ export async function preview( await resolveHttpsConfig(config.preview?.https, config.cacheDir) ) + // apply server hooks from plugins + const postHooks: ((() => void) | void)[] = [] + for (const plugin of config.plugins) { + if (plugin.configurePreviewServer) { + postHooks.push( + await plugin.configurePreviewServer({ middlewares: app, httpServer }) + ) + } + } + // cors const { cors } = config.preview if (cors !== false) { @@ -83,6 +99,7 @@ export async function preview( app.use(compression()) + // static assets const distDir = path.resolve(config.root, config.build.outDir) app.use( config.base, @@ -93,6 +110,9 @@ export async function preview( }) ) + // apply post server hooks from plugins + postHooks.forEach((fn) => fn && fn()) + const options = config.preview const hostname = resolveHostname(options.host) const port = options.port ?? 4173 From 9f8381eb70375d460f8b410f44e0b758eb714234 Mon Sep 17 00:00:00 2001 From: "Jeff Yang (Nay Thu Ya Aung)" <32727188+ydcjeff@users.noreply.github.com> Date: Sun, 8 May 2022 01:57:44 +0630 Subject: [PATCH 0657/1287] refactor: use optional chaining in config `define` of vue-jsx (#8046) --- packages/plugin-vue-jsx/index.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/plugin-vue-jsx/index.js b/packages/plugin-vue-jsx/index.js index 248270765d19a1..929f4fb44cd434 100644 --- a/packages/plugin-vue-jsx/index.js +++ b/packages/plugin-vue-jsx/index.js @@ -48,12 +48,6 @@ function vueJsxPlugin(options = {}) { name: 'vite:vue-jsx', config(config) { - const optionsApi = config.define - ? config.define.__VUE_OPTIONS_API__ - : undefined - const devTools = config.define - ? config.define.__VUE_PROD_DEVTOOLS__ - : undefined return { // only apply esbuild to ts files // since we are handling jsx and tsx now @@ -61,8 +55,8 @@ function vueJsxPlugin(options = {}) { include: /\.ts$/ }, define: { - __VUE_OPTIONS_API__: optionsApi != null ? optionsApi : true, - __VUE_PROD_DEVTOOLS__: devTools != null ? devTools : false + __VUE_OPTIONS_API__: config.define?.__VUE_OPTIONS_API__ ?? true, + __VUE_PROD_DEVTOOLS__: config.define?.__VUE_PROD_DEVTOOLS__ ?? false } } }, From 939848866d365908749ed257706abd47f60493a5 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sun, 8 May 2022 13:13:40 +0800 Subject: [PATCH 0658/1287] chore: enable ci for v1 and v2 branch --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5173da859417be..b1c663db40e80f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ on: - feat/* - fix/* - perf/* + - v1 + - v2 pull_request: workflow_dispatch: From cc3129e4336e7c09cc3e4beee0f4f5f964bb8b0f Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sun, 8 May 2022 13:28:32 +0800 Subject: [PATCH 0659/1287] chore: ignore empty chunk test warning (#8063) --- scripts/jestEnv.cjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/jestEnv.cjs b/scripts/jestEnv.cjs index 255b83063efc5a..b576155644a27f 100644 --- a/scripts/jestEnv.cjs +++ b/scripts/jestEnv.cjs @@ -29,13 +29,13 @@ module.exports = class PlaywrightEnvironment extends NodeEnvironment { })) this.global.page = await browser.newPage() - // suppress @vue/ref-transform warning const console = this.global.console const warn = console.warn console.warn = (msg, ...args) => { - if (!msg.includes('@vue/ref-transform')) { - warn.call(console, msg, ...args) - } + // suppress @vue/ref-transform warning + if (msg.includes('@vue/ref-transform')) return + if (msg.includes('Generated an empty chunk')) return + warn.call(console, msg, ...args) } } From ed4c7598d4c1715a8306190f6e8e2aa8d851b95b Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sun, 8 May 2022 13:52:45 +0800 Subject: [PATCH 0660/1287] docs: version selector (#8065) --- docs/.vitepress/{config.js => config.ts} | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) rename docs/.vitepress/{config.js => config.ts} (94%) diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.ts similarity index 94% rename from docs/.vitepress/config.js rename to docs/.vitepress/config.ts index ee76a29986d3fb..4659ea5ab7ae4f 100644 --- a/docs/.vitepress/config.js +++ b/docs/.vitepress/config.ts @@ -1,9 +1,6 @@ -// @ts-check +import { defineConfig } from 'vitepress' -/** - * @type {import('vitepress').UserConfig} - */ -module.exports = { +export default defineConfig({ title: 'Vite', description: 'Next Generation Frontend Tooling', head: [['link', { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }]], @@ -64,6 +61,15 @@ module.exports = { } ] }, + { + text: 'v3 (next)', + items: [ + { + text: 'v2.x (stable)', + link: 'https://v2.vitejs.dev' + } + ] + }, { text: 'Languages', items: [ @@ -169,4 +175,4 @@ module.exports = { ] } } -} +}) From b215493b6c01d9d299094e27a0f6bae694b71eff Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sun, 8 May 2022 15:19:01 +0800 Subject: [PATCH 0661/1287] docs: note about v3.0 branch (#8064) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 546014a12c7116..e07879c7ece2a6 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ In addition, Vite is highly extensible via its [Plugin API](https://vitejs.dev/g ## Packages +> This branch is for upcoming v3.0, if you are looking for current stable releases, check the [`2.x` branch](https://github.com/vitejs/vite/tree/2.x) instead. + | Package | Version (click for changelogs) | | ------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------- | | [vite](packages/vite) | [![vite version](https://img.shields.io/npm/v/vite.svg?label=%20)](packages/vite/CHANGELOG.md) | From 330e0a90988509454e31067984bf0cdbe2465325 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sun, 8 May 2022 16:16:44 +0800 Subject: [PATCH 0662/1287] feat!: rework `import.meta.glob` (#7537) --- docs/guide/features.md | 115 ++++- .../assets/__tests__/assets.spec.ts | 4 +- packages/playground/css/main.js | 4 +- .../glob-import/__tests__/glob-import.spec.ts | 4 +- packages/vite/LICENSE.md | 28 ++ packages/vite/package.json | 3 +- .../__snapshots__/fixture.test.ts.snap | 154 ++++++ .../plugins/importGlob/fixture-a/.gitignore | 1 + .../plugins/importGlob/fixture-a/index.ts | 64 +++ .../plugins/importGlob/fixture-a/modules/a.ts | 1 + .../plugins/importGlob/fixture-a/modules/b.ts | 1 + .../importGlob/fixture-a/modules/index.ts | 6 + .../framework/pages/hello.page.js | 4 + .../plugins/importGlob/fixture-a/sibling.ts | 1 + .../plugins/importGlob/fixture-b/a.ts | 1 + .../plugins/importGlob/fixture-b/b.ts | 1 + .../plugins/importGlob/fixture-b/index.ts | 2 + .../plugins/importGlob/fixture.test.ts | 59 +++ .../plugins/importGlob/parse.test.ts | 202 ++++++++ .../plugins/importGlob/utils.test.ts | 31 ++ packages/vite/src/node/config.ts | 18 + packages/vite/src/node/importGlob.ts | 246 --------- packages/vite/src/node/index.ts | 13 +- packages/vite/src/node/optimizer/scan.ts | 78 +-- .../src/node/plugins/assetImportMetaUrl.ts | 6 +- packages/vite/src/node/plugins/css.ts | 13 - .../vite/src/node/plugins/importAnalysis.ts | 44 -- .../src/node/plugins/importAnalysisBuild.ts | 46 +- .../vite/src/node/plugins/importMetaGlob.ts | 465 ++++++++++++++++++ packages/vite/src/node/plugins/index.ts | 2 + packages/vite/src/node/plugins/worker.ts | 4 +- packages/vite/src/node/server/hmr.ts | 37 +- packages/vite/src/node/server/index.ts | 21 +- packages/vite/types/chokidar.d.ts | 6 +- packages/vite/types/importGlob.d.ts | 89 ++++ packages/vite/types/importMeta.d.ts | 14 +- packages/vite/types/shims.d.ts | 8 - pnpm-lock.yaml | 14 +- 38 files changed, 1308 insertions(+), 502 deletions(-) create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/__snapshots__/fixture.test.ts.snap create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/.gitignore create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/index.ts create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/a.ts create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/b.ts create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/index.ts create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/node_modules/framework/pages/hello.page.js create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/sibling.ts create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/a.ts create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/b.ts create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/index.ts create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/fixture.test.ts create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/parse.test.ts create mode 100644 packages/vite/src/node/__tests__/plugins/importGlob/utils.test.ts delete mode 100644 packages/vite/src/node/importGlob.ts create mode 100644 packages/vite/src/node/plugins/importMetaGlob.ts create mode 100644 packages/vite/types/importGlob.d.ts diff --git a/docs/guide/features.md b/docs/guide/features.md index 1a8c03bbd0be22..01798ad0d4ea56 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -282,10 +282,10 @@ for (const path in modules) { } ``` -Matched files are by default lazy loaded via dynamic import and will be split into separate chunks during build. If you'd rather import all the modules directly (e.g. relying on side-effects in these modules to be applied first), you can use `import.meta.globEager` instead: +Matched files are by default lazy-loaded via dynamic import and will be split into separate chunks during build. If you'd rather import all the modules directly (e.g. relying on side-effects in these modules to be applied first), you can pass `{ eager: true }` as the second argument: ```js -const modules = import.meta.globEager('./dir/*.js') +const modules = import.meta.glob('./dir/*.js', { eager: true }) ``` The above will be transformed into the following: @@ -300,7 +300,9 @@ const modules = { } ``` -`import.meta.glob` and `import.meta.globEager` also support importing files as strings (similar to [Importing Asset as String](https://vitejs.dev/guide/assets.html#importing-asset-as-string)) with the [Import Reflection](https://github.com/tc39/proposal-import-reflection) syntax: +### Glob Import As + +`import.meta.glob` also supports importing files as strings (similar to [Importing Asset as String](https://vitejs.dev/guide/assets.html#importing-asset-as-string)) with the [Import Reflection](https://github.com/tc39/proposal-import-reflection) syntax: ```js const modules = import.meta.glob('./dir/*.js', { as: 'raw' }) @@ -311,18 +313,115 @@ The above will be transformed into the following: ```js // code produced by vite const modules = { - './dir/foo.js': '{\n "msg": "foo"\n}\n', - './dir/bar.js': '{\n "msg": "bar"\n}\n' + './dir/foo.js': 'export default "foo"\n', + './dir/bar.js': 'export default "bar"\n' +} +``` + +`{ as: 'url' }` is also supported for loading assets as URLs. + +### Multiple Patterns + +The first argument can be an array of globs, for example + +```js +const modules = import.meta.glob(['./dir/*.js', './another/*.js']) +``` + +### Negative Patterns + +Negative glob patterns are also supported (prefixed with `!`). To ignore some files from the result, you can add exclude glob patterns to the first argument: + +```js +const modules = import.meta.glob(['./dir/*.js', '!**/bar.js']) +``` + +```js +// code produced by vite +const modules = { + './dir/foo.js': () => import('./dir/foo.js') +} +``` + +#### Named Imports + +It's possible to only import parts of the modules with the `import` options. + +```ts +const modules = import.meta.glob('./dir/*.js', { import: 'setup' }) +``` + +```ts +// code produced by vite +const modules = { + './dir/foo.js': () => import('./dir/foo.js').then((m) => m.setup), + './dir/bar.js': () => import('./dir/bar.js').then((m) => m.setup) +} +``` + +When combined with `eager` it's even possible to have tree-shaking enabled for those modules. + +```ts +const modules = import.meta.glob('./dir/*.js', { import: 'setup', eager: true }) +``` + +```ts +// code produced by vite: +import { setup as __glob__0_0 } from './dir/foo.js' +import { setup as __glob__0_1 } from './dir/bar.js' +const modules = { + './dir/foo.js': __glob__0_0, + './dir/bar.js': __glob__0_1 +} +``` + +Set `import` to `default` to import the default export. + +```ts +const modules = import.meta.glob('./dir/*.js', { + import: 'default', + eager: true +}) +``` + +```ts +// code produced by vite: +import __glob__0_0 from './dir/foo.js' +import __glob__0_1 from './dir/bar.js' +const modules = { + './dir/foo.js': __glob__0_0, + './dir/bar.js': __glob__0_1 +} +``` + +#### Custom Queries + +You can also use the `query` option to provide custom queries to imports for other plugins to consume. + +```ts +const modules = import.meta.glob('./dir/*.js', { + query: { foo: 'bar', bar: true } +}) +``` + +```ts +// code produced by vite: +const modules = { + './dir/foo.js': () => + import('./dir/foo.js?foo=bar&bar=true').then((m) => m.setup), + './dir/bar.js': () => + import('./dir/bar.js?foo=bar&bar=true').then((m) => m.setup) } ``` +### Glob Import Caveats + Note that: - This is a Vite-only feature and is not a web or ES standard. - The glob patterns are treated like import specifiers: they must be either relative (start with `./`) or absolute (start with `/`, resolved relative to project root) or an alias path (see [`resolve.alias` option](/config/#resolve-alias)). -- The glob matching is done via `fast-glob` - check out its documentation for [supported glob patterns](https://github.com/mrmlnc/fast-glob#pattern-syntax). -- You should also be aware that glob imports do not accept variables, you need to directly pass the string pattern. -- The glob patterns cannot contain the same quote string (i.e. `'`, `"`, `` ` ``) as outer quotes, e.g. `'/Tom\'s files/**'`, use `"/Tom's files/**"` instead. +- The glob matching is done via [`fast-glob`](https://github.com/mrmlnc/fast-glob) - check out its documentation for [supported glob patterns](https://github.com/mrmlnc/fast-glob#pattern-syntax). +- You should also be aware that all the arguments in the `import.meta.glob` must be **passed as literals**. You can NOT use variables or expressions in them. ## WebAssembly diff --git a/packages/playground/assets/__tests__/assets.spec.ts b/packages/playground/assets/__tests__/assets.spec.ts index f1075f6fe1cb39..c63ffc7cc1c0c2 100644 --- a/packages/playground/assets/__tests__/assets.spec.ts +++ b/packages/playground/assets/__tests__/assets.spec.ts @@ -145,8 +145,8 @@ describe('css url() references', () => { expect(await getBg('.css-url-quotes-base64-inline')).toMatch(match) const icoMatch = isBuild ? `data:image/x-icon;base64` : `favicon.ico` const el = await page.$(`link.ico`) - const herf = await el.getAttribute('href') - expect(herf).toMatch(icoMatch) + const href = await el.getAttribute('href') + expect(href).toMatch(icoMatch) }) test('multiple urls on the same line', async () => { diff --git a/packages/playground/css/main.js b/packages/playground/css/main.js index f728b0251066d1..f6072ae751df76 100644 --- a/packages/playground/css/main.js +++ b/packages/playground/css/main.js @@ -80,7 +80,9 @@ text('.inlined-code', inlined) // glob const glob = import.meta.glob('./glob-import/*.css') -Promise.all(Object.keys(glob).map((key) => glob[key]())).then((res) => { +Promise.all( + Object.keys(glob).map((key) => glob[key]().then((i) => i.default)) +).then((res) => { text('.imported-css-glob', JSON.stringify(res, null, 2)) }) diff --git a/packages/playground/glob-import/__tests__/glob-import.spec.ts b/packages/playground/glob-import/__tests__/glob-import.spec.ts index ebdf6c0ab29193..d738ccec1d4c97 100644 --- a/packages/playground/glob-import/__tests__/glob-import.spec.ts +++ b/packages/playground/glob-import/__tests__/glob-import.spec.ts @@ -42,7 +42,7 @@ const allResult = { }, '/dir/index.js': { globWithAlias: { - './alias.js': { + '/dir/alias.js': { default: 'hi' } }, @@ -67,7 +67,7 @@ const rawResult = { } const relativeRawResult = { - '../glob-import/dir/baz.json': { + './dir/baz.json': { msg: 'baz' } } diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index 80feb7f95c6941..2b43883f1b2b67 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -3606,6 +3606,34 @@ Repository: git+https://github.com/dominikg/tsconfck.git --------------------------------------- +## ufo +License: MIT +Repository: unjs/ufo + +> MIT License +> +> Copyright (c) 2020 Nuxt Contrib +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +--------------------------------------- + ## unpipe License: MIT By: Douglas Christopher Wilson diff --git a/packages/vite/package.json b/packages/vite/package.json index b508842619033e..2e930f0f1f6741 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -112,11 +112,12 @@ "source-map-js": "^1.0.2", "source-map-support": "^0.5.21", "strip-ansi": "^6.0.1", - "strip-literal": "^0.2.0", + "strip-literal": "^0.3.0", "terser": "^5.13.1", "tsconfck": "^1.2.2", "tslib": "^2.4.0", "types": "link:./types", + "ufo": "^0.8.4", "ws": "^8.6.0" }, "peerDependencies": { diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/__snapshots__/fixture.test.ts.snap b/packages/vite/src/node/__tests__/plugins/importGlob/__snapshots__/fixture.test.ts.snap new file mode 100644 index 00000000000000..3b611c60c9cedc --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/__snapshots__/fixture.test.ts.snap @@ -0,0 +1,154 @@ +// Vitest Snapshot v1 + +exports[`fixture > transform 1`] = ` +"import * as __vite_glob_1_0 from \\"./modules/a.ts\\" +import * as __vite_glob_1_1 from \\"./modules/b.ts\\" +import * as __vite_glob_1_2 from \\"./modules/index.ts\\" +import { name as __vite_glob_3_0 } from \\"./modules/a.ts\\" +import { name as __vite_glob_3_1 } from \\"./modules/b.ts\\" +import { name as __vite_glob_3_2 } from \\"./modules/index.ts\\" +import { default as __vite_glob_5_0 } from \\"./modules/a.ts?raw\\" +import { default as __vite_glob_5_1 } from \\"./modules/b.ts?raw\\" +import \\"../../../../../../types/importMeta\\"; +export const basic = { +\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), +\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), +\\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\") +}; +export const basicEager = { +\\"./modules/a.ts\\": __vite_glob_1_0, +\\"./modules/b.ts\\": __vite_glob_1_1, +\\"./modules/index.ts\\": __vite_glob_1_2 +}; +export const ignore = { +\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), +\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\") +}; +export const namedEager = { +\\"./modules/a.ts\\": __vite_glob_3_0, +\\"./modules/b.ts\\": __vite_glob_3_1, +\\"./modules/index.ts\\": __vite_glob_3_2 +}; +export const namedDefault = { +\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\").then(m => m[\\"default\\"]), +\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\").then(m => m[\\"default\\"]), +\\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\").then(m => m[\\"default\\"]) +}; +export const eagerAs = { +\\"./modules/a.ts\\": __vite_glob_5_0, +\\"./modules/b.ts\\": __vite_glob_5_1 +}; +export const excludeSelf = { +\\"./sibling.ts\\": () => import(\\"./sibling.ts\\") +}; +export const customQueryString = { +\\"./sibling.ts\\": () => import(\\"./sibling.ts?custom\\") +}; +export const customQueryObject = { +\\"./sibling.ts\\": () => import(\\"./sibling.ts?foo=bar&raw=true\\") +}; +export const parent = { + +}; +export const rootMixedRelative = { +\\"/css.spec.ts\\": () => import(\\"../../css.spec.ts?url\\").then(m => m[\\"default\\"]), +\\"/define.spec.ts\\": () => import(\\"../../define.spec.ts?url\\").then(m => m[\\"default\\"]), +\\"/import.spec.ts\\": () => import(\\"../../import.spec.ts?url\\").then(m => m[\\"default\\"]), +\\"/importGlob/fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts?url\\").then(m => m[\\"default\\"]), +\\"/importGlob/fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts?url\\").then(m => m[\\"default\\"]), +\\"/importGlob/fixture-b/index.ts\\": () => import(\\"../fixture-b/index.ts?url\\").then(m => m[\\"default\\"]) +}; +export const cleverCwd1 = { +\\"./node_modules/framework/pages/hello.page.js\\": () => import(\\"./node_modules/framework/pages/hello.page.js\\") +}; +export const cleverCwd2 = { +\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), +\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), +\\"../fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts\\"), +\\"../fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts\\") +}; +" +`; + +exports[`fixture > transform with restoreQueryExtension 1`] = ` +"import * as __vite_glob_1_0 from \\"./modules/a.ts\\" +import * as __vite_glob_1_1 from \\"./modules/b.ts\\" +import * as __vite_glob_1_2 from \\"./modules/index.ts\\" +import { name as __vite_glob_3_0 } from \\"./modules/a.ts\\" +import { name as __vite_glob_3_1 } from \\"./modules/b.ts\\" +import { name as __vite_glob_3_2 } from \\"./modules/index.ts\\" +import { default as __vite_glob_5_0 } from \\"./modules/a.ts?raw\\" +import { default as __vite_glob_5_1 } from \\"./modules/b.ts?raw\\" +import \\"../../../../../../types/importMeta\\"; +export const basic = { +\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), +\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), +\\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\") +}; +export const basicEager = { +\\"./modules/a.ts\\": __vite_glob_1_0, +\\"./modules/b.ts\\": __vite_glob_1_1, +\\"./modules/index.ts\\": __vite_glob_1_2 +}; +export const ignore = { +\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), +\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\") +}; +export const namedEager = { +\\"./modules/a.ts\\": __vite_glob_3_0, +\\"./modules/b.ts\\": __vite_glob_3_1, +\\"./modules/index.ts\\": __vite_glob_3_2 +}; +export const namedDefault = { +\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\").then(m => m[\\"default\\"]), +\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\").then(m => m[\\"default\\"]), +\\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\").then(m => m[\\"default\\"]) +}; +export const eagerAs = { +\\"./modules/a.ts\\": __vite_glob_5_0, +\\"./modules/b.ts\\": __vite_glob_5_1 +}; +export const excludeSelf = { +\\"./sibling.ts\\": () => import(\\"./sibling.ts\\") +}; +export const customQueryString = { +\\"./sibling.ts\\": () => import(\\"./sibling.ts?custom&lang.ts\\") +}; +export const customQueryObject = { +\\"./sibling.ts\\": () => import(\\"./sibling.ts?foo=bar&raw=true&lang.ts\\") +}; +export const parent = { + +}; +export const rootMixedRelative = { +\\"/css.spec.ts\\": () => import(\\"../../css.spec.ts?url&lang.ts\\").then(m => m[\\"default\\"]), +\\"/define.spec.ts\\": () => import(\\"../../define.spec.ts?url&lang.ts\\").then(m => m[\\"default\\"]), +\\"/import.spec.ts\\": () => import(\\"../../import.spec.ts?url&lang.ts\\").then(m => m[\\"default\\"]), +\\"/importGlob/fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts?url&lang.ts\\").then(m => m[\\"default\\"]), +\\"/importGlob/fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts?url&lang.ts\\").then(m => m[\\"default\\"]), +\\"/importGlob/fixture-b/index.ts\\": () => import(\\"../fixture-b/index.ts?url&lang.ts\\").then(m => m[\\"default\\"]) +}; +export const cleverCwd1 = { +\\"./node_modules/framework/pages/hello.page.js\\": () => import(\\"./node_modules/framework/pages/hello.page.js\\") +}; +export const cleverCwd2 = { +\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), +\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), +\\"../fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts\\"), +\\"../fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts\\") +}; +" +`; + +exports[`fixture > virtual modules 1`] = ` +"{ +\\"/modules/a.ts\\": () => import(\\"/modules/a.ts\\"), +\\"/modules/b.ts\\": () => import(\\"/modules/b.ts\\"), +\\"/modules/index.ts\\": () => import(\\"/modules/index.ts\\") +} +{ +\\"/../fixture-b/a.ts\\": () => import(\\"/../fixture-b/a.ts\\"), +\\"/../fixture-b/b.ts\\": () => import(\\"/../fixture-b/b.ts\\"), +\\"/../fixture-b/index.ts\\": () => import(\\"/../fixture-b/index.ts\\") +}" +`; diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/.gitignore b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/.gitignore new file mode 100644 index 00000000000000..2b9b8877da603f --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/.gitignore @@ -0,0 +1 @@ +!/node_modules/ diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/index.ts b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/index.ts new file mode 100644 index 00000000000000..c5b806da06a4b4 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/index.ts @@ -0,0 +1,64 @@ +import '../../../../../../types/importMeta' + +/* eslint-disable @typescript-eslint/comma-dangle */ +export interface ModuleType { + name: string +} + +export const basic = import.meta.glob('./modules/*.ts') + +export const basicEager = import.meta.glob('./modules/*.ts', { + eager: true +}) + +export const ignore = import.meta.glob(['./modules/*.ts', '!**/index.ts']) + +export const namedEager = import.meta.glob('./modules/*.ts', { + eager: true, + import: 'name' +}) + +export const namedDefault = import.meta.glob('./modules/*.ts', { + import: 'default' +}) + +export const eagerAs = import.meta.glob( + ['./modules/*.ts', '!**/index.ts'], + { eager: true, as: 'raw' } +) + +export const excludeSelf = import.meta.glob( + './*.ts' + // for test: annotation contain ")" + /* + * for test: annotation contain ")" + * */ +) + +export const customQueryString = import.meta.glob('./*.ts', { query: 'custom' }) + +export const customQueryObject = import.meta.glob('./*.ts', { + query: { + foo: 'bar', + raw: true + } +}) + +export const parent = import.meta.glob('../../playground/src/*.ts', { + as: 'url' +}) + +export const rootMixedRelative = import.meta.glob( + ['/*.ts', '../fixture-b/*.ts'], + { as: 'url' } +) + +export const cleverCwd1 = import.meta.glob( + './node_modules/framework/**/*.page.js' +) + +export const cleverCwd2 = import.meta.glob([ + './modules/*.ts', + '../fixture-b/*.ts', + '!**/index.ts' +]) diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/a.ts b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/a.ts new file mode 100644 index 00000000000000..facd48a0875e65 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/a.ts @@ -0,0 +1 @@ +export const name = 'a' diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/b.ts b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/b.ts new file mode 100644 index 00000000000000..0b1eb38d9087a2 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/b.ts @@ -0,0 +1 @@ +export const name = 'b' diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/index.ts b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/index.ts new file mode 100644 index 00000000000000..25b59ae7d30714 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/modules/index.ts @@ -0,0 +1,6 @@ +export { name as a } from './a' +export { name as b } from './b' + +export const name = 'index' + +export default 'indexDefault' diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/node_modules/framework/pages/hello.page.js b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/node_modules/framework/pages/hello.page.js new file mode 100644 index 00000000000000..cbe518a8e79477 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/node_modules/framework/pages/hello.page.js @@ -0,0 +1,4 @@ +// A fake Page file. (This technique of globbing into `node_modules/` +// is used by vite-plugin-ssr frameworks and Hydrogen.) + +export const a = 1 diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/sibling.ts b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/sibling.ts new file mode 100644 index 00000000000000..b286816bf5d63a --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/sibling.ts @@ -0,0 +1 @@ +export const name = 'I am your sibling!' diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/a.ts b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/a.ts new file mode 100644 index 00000000000000..facd48a0875e65 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/a.ts @@ -0,0 +1 @@ +export const name = 'a' diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/b.ts b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/b.ts new file mode 100644 index 00000000000000..0b1eb38d9087a2 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/b.ts @@ -0,0 +1 @@ +export const name = 'b' diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/index.ts b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/index.ts new file mode 100644 index 00000000000000..39bdbfd1a8befb --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/fixture-b/index.ts @@ -0,0 +1,2 @@ +export { name as a } from './a' +export { name as b } from './b' diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/fixture.test.ts b/packages/vite/src/node/__tests__/plugins/importGlob/fixture.test.ts new file mode 100644 index 00000000000000..985263d91db85a --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/fixture.test.ts @@ -0,0 +1,59 @@ +import { resolve } from 'path' +import { promises as fs } from 'fs' +import { describe, expect, it } from 'vitest' +import { transformGlobImport } from '../../../plugins/importMetaGlob' +import { transformWithEsbuild } from '../../../plugins/esbuild' + +describe('fixture', async () => { + const resolveId = (id: string) => id + const root = resolve(__dirname, '..') + + it('transform', async () => { + const id = resolve(__dirname, './fixture-a/index.ts') + const code = ( + await transformWithEsbuild(await fs.readFile(id, 'utf-8'), id) + ).code + + expect( + (await transformGlobImport(code, id, root, resolveId))?.s.toString() + ).toMatchSnapshot() + }) + + it('virtual modules', async () => { + const root = resolve(__dirname, './fixture-a') + const code = [ + "import.meta.glob('/modules/*.ts')", + "import.meta.glob(['/../fixture-b/*.ts'])" + ].join('\n') + expect( + ( + await transformGlobImport(code, 'virtual:module', root, resolveId) + )?.s.toString() + ).toMatchSnapshot() + + try { + await transformGlobImport( + "import.meta.glob('./modules/*.ts')", + 'virtual:module', + root, + resolveId + ) + expect('no error').toBe('should throw an error') + } catch (err) { + expect(err).toMatchInlineSnapshot( + "[Error: In virtual modules, all globs must start with '/']" + ) + } + }) + + it('transform with restoreQueryExtension', async () => { + const id = resolve(__dirname, './fixture-a/index.ts') + const code = ( + await transformWithEsbuild(await fs.readFile(id, 'utf-8'), id) + ).code + + expect( + (await transformGlobImport(code, id, root, resolveId, true))?.s.toString() + ).toMatchSnapshot() + }) +}) diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/parse.test.ts b/packages/vite/src/node/__tests__/plugins/importGlob/parse.test.ts new file mode 100644 index 00000000000000..df1e0d758e8849 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/parse.test.ts @@ -0,0 +1,202 @@ +import { describe, expect, it } from 'vitest' +import { parseImportGlob } from '../../../plugins/importMetaGlob' + +async function run(input: string) { + const items = await parseImportGlob( + input, + process.cwd(), + process.cwd(), + (id) => id + ) + return items.map((i) => ({ globs: i.globs, options: i.options })) +} + +async function runError(input: string) { + try { + await run(input) + } catch (e) { + return e + } +} + +describe('parse positives', async () => { + it('basic', async () => { + expect( + await run(` + import.meta.importGlob(\'./modules/*.ts\') + `) + ).toMatchInlineSnapshot('[]') + }) + + it('array', async () => { + expect( + await run(` + import.meta.importGlob([\'./modules/*.ts\', './dir/*.{js,ts}\']) + `) + ).toMatchInlineSnapshot('[]') + }) + + it('options with multilines', async () => { + expect( + await run(` + import.meta.importGlob([ + \'./modules/*.ts\', + "!./dir/*.{js,ts}" + ], { + eager: true, + import: 'named' + }) + `) + ).toMatchInlineSnapshot('[]') + }) + + it('options with multilines', async () => { + expect( + await run(` + const modules = import.meta.glob( + '/dir/**' + // for test: annotation contain ")" + /* + * for test: annotation contain ")" + * */ + ) + `) + ).toMatchInlineSnapshot(` + [ + { + "globs": [ + "/dir/**", + ], + "options": {}, + }, + ] + `) + }) + + it('options query', async () => { + expect( + await run(` + const modules = import.meta.glob( + '/dir/**', + { + query: { + foo: 'bar', + raw: true, + } + } + ) + `) + ).toMatchInlineSnapshot(` + [ + { + "globs": [ + "/dir/**", + ], + "options": { + "query": { + "foo": "bar", + "raw": true, + }, + }, + }, + ] + `) + }) +}) + +describe('parse negatives', async () => { + it('syntax error', async () => { + expect(await runError('import.meta.importGlob(')).toMatchInlineSnapshot( + 'undefined' + ) + }) + + it('empty', async () => { + expect(await runError('import.meta.importGlob()')).toMatchInlineSnapshot( + 'undefined' + ) + }) + + it('3 args', async () => { + expect( + await runError('import.meta.importGlob("", {}, {})') + ).toMatchInlineSnapshot('undefined') + }) + + it('in string', async () => { + expect(await runError('"import.meta.importGlob()"')).toBeUndefined() + }) + + it('variable', async () => { + expect(await runError('import.meta.importGlob(hey)')).toMatchInlineSnapshot( + 'undefined' + ) + }) + + it('template', async () => { + // eslint-disable-next-line no-template-curly-in-string + expect( + await runError('import.meta.importGlob(`hi ${hey}`)') + ).toMatchInlineSnapshot('undefined') + }) + + it('be string', async () => { + expect(await runError('import.meta.importGlob(1)')).toMatchInlineSnapshot( + 'undefined' + ) + }) + + it('be array variable', async () => { + expect( + await runError('import.meta.importGlob([hey])') + ).toMatchInlineSnapshot('undefined') + expect( + await runError('import.meta.importGlob(["1", hey])') + ).toMatchInlineSnapshot('undefined') + }) + + it('options', async () => { + expect( + await runError('import.meta.importGlob("hey", hey)') + ).toMatchInlineSnapshot('undefined') + expect( + await runError('import.meta.importGlob("hey", [])') + ).toMatchInlineSnapshot('undefined') + }) + + it('options props', async () => { + expect( + await runError('import.meta.importGlob("hey", { hey: 1 })') + ).toMatchInlineSnapshot('undefined') + expect( + await runError('import.meta.importGlob("hey", { import: hey })') + ).toMatchInlineSnapshot('undefined') + expect( + await runError('import.meta.importGlob("hey", { eager: 123 })') + ).toMatchInlineSnapshot('undefined') + }) + + it('options query', async () => { + expect( + await runError( + 'import.meta.importGlob("./*.js", { as: "raw", query: "hi" })' + ) + ).toMatchInlineSnapshot('undefined') + expect( + await runError('import.meta.importGlob("./*.js", { query: 123 })') + ).toMatchInlineSnapshot('undefined') + expect( + await runError('import.meta.importGlob("./*.js", { query: { foo: {} } })') + ).toMatchInlineSnapshot('undefined') + expect( + await runError( + 'import.meta.importGlob("./*.js", { query: { foo: hey } })' + ) + ).toMatchInlineSnapshot('undefined') + expect( + await runError( + 'import.meta.importGlob("./*.js", { query: { foo: 123, ...a } })' + ) + ).toMatchInlineSnapshot('undefined') + }) +}) diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/utils.test.ts b/packages/vite/src/node/__tests__/plugins/importGlob/utils.test.ts new file mode 100644 index 00000000000000..302df97ec92ede --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/importGlob/utils.test.ts @@ -0,0 +1,31 @@ +import { describe, expect, it } from 'vitest' +import { getCommonBase } from '../../../plugins/importMetaGlob' + +describe('getCommonBase()', async () => { + it('basic', () => { + expect(getCommonBase(['/a/b/*.js', '/a/c/*.js'])).toBe('/a') + }) + it('common base', () => { + expect(getCommonBase(['/a/b/**/*.vue', '/a/b/**/*.jsx'])).toBe('/a/b') + }) + it('static file', () => { + expect( + getCommonBase(['/a/b/**/*.vue', '/a/b/**/*.jsx', '/a/b/foo.js']) + ).toBe('/a/b') + expect(getCommonBase(['/a/b/**/*.vue', '/a/b/**/*.jsx', '/a/foo.js'])).toBe( + '/a' + ) + }) + it('correct `scan()`', () => { + expect(getCommonBase(['/a/*.vue'])).toBe('/a') + expect(getCommonBase(['/a/some.vue'])).toBe('/a') + expect(getCommonBase(['/a/b/**/c/foo.vue', '/a/b/c/**/*.jsx'])).toBe('/a/b') + }) + it('single', () => { + expect(getCommonBase(['/a/b/c/*.vue'])).toBe('/a/b/c') + expect(getCommonBase(['/a/b/c/foo.vue'])).toBe('/a/b/c') + }) + it('no common base', () => { + expect(getCommonBase(['/a/b/*.js', '/c/a/b/*.js'])).toBe('/') + }) +}) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 29dc3fe2045a5a..e7fcaefeb2a799 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -152,6 +152,14 @@ export interface UserConfig { * @alpha */ ssr?: SSROptions + /** + * Experimental features + * + * Features under this field are addressed to be changed that might NOT follow semver. + * Please be careful and always pin Vite's version when using them. + * @experimental + */ + experimental?: ExperimentalOptions /** * Log level. * Default: 'info' @@ -199,6 +207,16 @@ export interface UserConfig { } } +export interface ExperimentalOptions { + /** + * Append fake `&lang.(ext)` when queries are specified, to preseve the file extension for following plugins to process. + * + * @experimental + * @default false + */ + importGlobRestoreExtension?: boolean +} + export type SSRTarget = 'node' | 'webworker' export interface SSROptions { diff --git a/packages/vite/src/node/importGlob.ts b/packages/vite/src/node/importGlob.ts deleted file mode 100644 index ab425bb596c68a..00000000000000 --- a/packages/vite/src/node/importGlob.ts +++ /dev/null @@ -1,246 +0,0 @@ -import path from 'path' -import { promises as fsp } from 'fs' -import glob from 'fast-glob' -import JSON5 from 'json5' -import { - isModernFlag, - preloadMethod, - preloadMarker -} from './plugins/importAnalysisBuild' -import { isCSSRequest } from './plugins/css' -import { - cleanUrl, - singlelineCommentsRE, - multilineCommentsRE, - blankReplacer, - normalizePath -} from './utils' -import type { RollupError } from 'rollup' -import type { Logger } from '.' - -interface GlobParams { - base: string - pattern: string - parentDepth: number - isAbsolute: boolean -} - -interface GlobOptions { - as?: string -} - -function formatGlobRelativePattern(base: string, pattern: string): GlobParams { - let parentDepth = 0 - while (pattern.startsWith('../')) { - pattern = pattern.slice(3) - base = path.resolve(base, '../') - parentDepth++ - } - if (pattern.startsWith('./')) { - pattern = pattern.slice(2) - } - - return { base, pattern, parentDepth, isAbsolute: false } -} - -export async function transformImportGlob( - source: string, - pos: number, - importer: string, - importIndex: number, - root: string, - logger: Logger, - normalizeUrl?: (url: string, pos: number) => Promise<[string, string]>, - resolve?: (url: string, importer?: string) => Promise, - preload = true -): Promise<{ - importsString: string - imports: string[] - exp: string - endIndex: number - isEager: boolean - pattern: string - base: string -}> { - const isEager = source.slice(pos, pos + 21) === 'import.meta.globEager' - const isEagerDefault = - isEager && source.slice(pos + 21, pos + 28) === 'Default' - - const err = (msg: string) => { - const e = new Error(`Invalid glob import syntax: ${msg}`) - ;(e as any).pos = pos - return e - } - - importer = cleanUrl(importer) - const importerBasename = path.basename(importer) - - const [userPattern, options, endIndex] = lexGlobPattern(source, pos) - - let globParams: GlobParams | null = null - if (userPattern.startsWith('/')) { - globParams = { - isAbsolute: true, - base: path.resolve(root), - pattern: userPattern.slice(1), - parentDepth: 0 - } - } else if (userPattern.startsWith('.')) { - globParams = formatGlobRelativePattern(path.dirname(importer), userPattern) - } else if (resolve) { - const resolvedId = await resolve(userPattern, importer) - if (resolvedId) { - const importerDirname = path.dirname(importer) - globParams = formatGlobRelativePattern( - importerDirname, - normalizePath(path.relative(importerDirname, resolvedId)) - ) - } - } - - if (!globParams) { - throw err( - `pattern must start with "." or "/" (relative to project root) or alias path` - ) - } - const { base, parentDepth, isAbsolute, pattern } = globParams - - const files = glob.sync(pattern, { - cwd: base, - // Ignore node_modules by default unless explicitly indicated in the pattern - ignore: /(^|\/)node_modules\//.test(pattern) ? [] : ['**/node_modules/**'] - }) - const imports: string[] = [] - let importsString = `` - let entries = `` - for (let i = 0; i < files.length; i++) { - // skip importer itself - if (files[i] === importerBasename) continue - const file = isAbsolute - ? `/${files[i]}` - : parentDepth - ? `${'../'.repeat(parentDepth)}${files[i]}` - : `./${files[i]}` - let importee = file - if (normalizeUrl) { - ;[importee] = await normalizeUrl(file, pos) - } - imports.push(importee) - - const isRawType = options?.as === 'raw' - if (isRawType) { - entries += ` ${JSON.stringify(file)}: ${JSON.stringify( - await fsp.readFile(path.join(base, files[i]), 'utf-8') - )},` - } else { - const importeeUrl = isCSSRequest(importee) ? `${importee}?used` : importee - if (isEager) { - const identifier = `__glob_${importIndex}_${i}` - // css imports injecting a ?used query to export the css string - importsString += `import ${ - isEagerDefault ? `` : `* as ` - }${identifier} from ${JSON.stringify(importeeUrl)};` - entries += ` ${JSON.stringify(file)}: ${identifier},` - } else { - let imp = `import(${JSON.stringify(importeeUrl)})` - if (!normalizeUrl && preload) { - imp = - `(${isModernFlag}` + - `? ${preloadMethod}(()=>${imp},"${preloadMarker}")` + - `: ${imp})` - } - entries += ` ${JSON.stringify(file)}: () => ${imp},` - } - } - } - - return { - imports, - importsString, - exp: `{${entries}}`, - endIndex, - isEager, - pattern, - base - } -} - -const enum LexerState { - inCall, - inSingleQuoteString, - inDoubleQuoteString, - inTemplateString -} - -function lexGlobPattern( - code: string, - pos: number -): [string, GlobOptions, number] { - let state = LexerState.inCall - let pattern = '' - - let i = code.indexOf(`(`, pos) + 1 - outer: for (; i < code.length; i++) { - const char = code.charAt(i) - switch (state) { - case LexerState.inCall: - if (char === `'`) { - state = LexerState.inSingleQuoteString - } else if (char === `"`) { - state = LexerState.inDoubleQuoteString - } else if (char === '`') { - state = LexerState.inTemplateString - } else if (/\s/.test(char)) { - continue - } else { - error(i) - } - break - case LexerState.inSingleQuoteString: - if (char === `'`) { - break outer - } else { - pattern += char - } - break - case LexerState.inDoubleQuoteString: - if (char === `"`) { - break outer - } else { - pattern += char - } - break - case LexerState.inTemplateString: - if (char === '`') { - break outer - } else { - pattern += char - } - break - default: - throw new Error('unknown import.meta.glob lexer state') - } - } - const noCommentCode = code - .slice(i + 1) - .replace(singlelineCommentsRE, blankReplacer) - .replace(multilineCommentsRE, blankReplacer) - - const endIndex = noCommentCode.indexOf(')') - const optionString = noCommentCode.substring(0, endIndex) - const commaIndex = optionString.indexOf(',') - - let options = {} - if (commaIndex > -1) { - options = JSON5.parse(optionString.substring(commaIndex + 1)) - } - return [pattern, options, endIndex + i + 2] -} - -function error(pos: number) { - const err = new Error( - `import.meta.glob() can only accept string literals.` - ) as RollupError - err.pos = pos - throw err -} diff --git a/packages/vite/src/node/index.ts b/packages/vite/src/node/index.ts index e56f4c6e765756..0d401363b8a3b6 100644 --- a/packages/vite/src/node/index.ts +++ b/packages/vite/src/node/index.ts @@ -74,6 +74,9 @@ export type { TransformOptions as EsbuildTransformOptions } from 'esbuild' export type { ESBuildOptions, ESBuildTransformResult } from './plugins/esbuild' export type { Manifest, ManifestChunk } from './plugins/manifest' export type { ResolveOptions, InternalResolveOptions } from './plugins/resolve' +export type { SplitVendorChunkCache } from './plugins/splitVendorChunk' +import type { ChunkMetadata } from './plugins/metadata' + export type { WebSocketServer, WebSocketClient, @@ -88,6 +91,7 @@ export type { TransformResult } from './server/transformRequest' export type { HmrOptions, HmrContext } from './server/hmr' + export type { HMRPayload, ConnectedPayload, @@ -111,9 +115,12 @@ export type { RollupCommonJSOptions } from 'types/commonjs' export type { RollupDynamicImportVarsOptions } from 'types/dynamicImportVars' export type { CustomEventMap, InferCustomEventPayload } from 'types/customEvent' export type { Matcher, AnymatchPattern, AnymatchFn } from 'types/anymatch' -export type { SplitVendorChunkCache } from './plugins/splitVendorChunk' - -import type { ChunkMetadata } from './plugins/metadata' +export type { + ImportGlobFunction, + ImportGlobEagerFunction, + ImportGlobOptions, + KnownAsTypeMap +} from 'types/importGlob' declare module 'rollup' { export interface RenderedChunk { diff --git a/packages/vite/src/node/optimizer/scan.ts b/packages/vite/src/node/optimizer/scan.ts index ef59a35b1d22d3..111aefc40dea15 100644 --- a/packages/vite/src/node/optimizer/scan.ts +++ b/packages/vite/src/node/optimizer/scan.ts @@ -1,9 +1,9 @@ import fs from 'fs' import path from 'path' import glob from 'fast-glob' -import type { ResolvedConfig, Logger } from '..' +import type { ResolvedConfig } from '..' import type { Loader, Plugin, OnLoadResult } from 'esbuild' -import { build, transform } from 'esbuild' +import { build } from 'esbuild' import { KNOWN_ASSET_TYPES, JS_TYPES_RE, @@ -25,11 +25,9 @@ import { } from '../utils' import type { PluginContainer } from '../server/pluginContainer' import { createPluginContainer } from '../server/pluginContainer' -import { init, parse } from 'es-module-lexer' -import MagicString from 'magic-string' -import { transformImportGlob } from '../importGlob' import { performance } from 'perf_hooks' import colors from 'picocolors' +import { transformGlobImport } from '../plugins/importMetaGlob' const debug = createDebugger('vite:deps') @@ -300,19 +298,18 @@ function esbuildScanPlugin( (loader.startsWith('ts') ? extractImportPaths(content) : '') const key = `${path}?id=${scriptId++}` - if (contents.includes('import.meta.glob')) { scripts[key] = { - // transformGlob already transforms to js loader: 'js', - contents: await transformGlob( - contents, - path, - config.root, - loader, - resolve, - config.logger - ) + contents: + ( + await transformGlobImport( + contents, + path, + config.root, + resolve + ) + )?.s.toString() || contents } } else { scripts[key] = { @@ -467,20 +464,6 @@ function esbuildScanPlugin( config.optimizeDeps?.esbuildOptions?.loader?.[`.${ext}`] || (ext as Loader) - if (contents.includes('import.meta.glob')) { - return transformGlob( - contents, - id, - config.root, - loader, - resolve, - config.logger - ).then((contents) => ({ - loader, - contents - })) - } - return { loader, contents @@ -490,43 +473,6 @@ function esbuildScanPlugin( } } -async function transformGlob( - source: string, - importer: string, - root: string, - loader: Loader, - resolve: (url: string, importer?: string) => Promise, - logger: Logger -) { - // transform the content first since es-module-lexer can't handle non-js - if (loader !== 'js') { - source = (await transform(source, { loader })).code - } - - await init - const imports = parse(source)[0] - const s = new MagicString(source) - for (let index = 0; index < imports.length; index++) { - const { s: start, e: end, ss: expStart } = imports[index] - const url = source.slice(start, end) - if (url !== 'import.meta') continue - if (source.slice(end, end + 5) !== '.glob') continue - const { importsString, exp, endIndex } = await transformImportGlob( - source, - start, - normalizePath(importer), - index, - root, - logger, - undefined, - resolve - ) - s.prepend(importsString) - s.overwrite(expStart, endIndex, exp, { contentOnly: true }) - } - return s.toString() -} - /** * when using TS + (Vue + `
diff --git a/playground/css-codesplit/inline.css b/playground/css-codesplit/inline.css new file mode 100644 index 00000000000000..b2a2b5f1ead51f --- /dev/null +++ b/playground/css-codesplit/inline.css @@ -0,0 +1,3 @@ +.inline { + color: yellow; +} diff --git a/playground/css-codesplit/main.js b/playground/css-codesplit/main.js index 8c80df2c181511..eb6e703f79e718 100644 --- a/playground/css-codesplit/main.js +++ b/playground/css-codesplit/main.js @@ -1,6 +1,15 @@ import './style.css' import './main.css' -document.getElementById( - 'app' -).innerHTML = `

This should be red

This should be blue

` +import('./async.css') + +import('./inline.css?inline').then((css) => { + document.querySelector('.dynamic-inline').textContent = css.default +}) + +import('./mod.module.css').then((css) => { + document.querySelector('.dynamic-module').textContent = JSON.stringify( + css.default + ) + document.querySelector('.mod').classList.add(css.default.mod) +}) diff --git a/playground/css-codesplit/mod.module.css b/playground/css-codesplit/mod.module.css new file mode 100644 index 00000000000000..7f84410485a32c --- /dev/null +++ b/playground/css-codesplit/mod.module.css @@ -0,0 +1,3 @@ +.mod { + color: yellow; +} From 2d978f7b10fe626ad77cd07b9d1a434af89f8c9a Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Tue, 10 May 2022 02:22:50 +0800 Subject: [PATCH 0670/1287] chore(plugin-react): add vite peer dep (#8083) --- packages/plugin-react/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 813db5ecf23aed..ca8b1d78752b69 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -41,5 +41,8 @@ "@rollup/pluginutils": "^4.2.1", "react-refresh": "^0.13.0", "resolve": "^1.22.0" + }, + "peerDependencies": { + "vite": "^2.0.0" } } From f895f94b49fcab278d303ef9ecf7b6a28e7fc24a Mon Sep 17 00:00:00 2001 From: David Jackson <1735971+davidwallacejackson@users.noreply.github.com> Date: Mon, 9 May 2022 11:48:57 -0700 Subject: [PATCH 0671/1287] fix: increase default HTTPS dev server session memory limit (#6207) --- packages/vite/src/node/http.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/vite/src/node/http.ts b/packages/vite/src/node/http.ts index bfc2ddbe32a302..18140b031937a9 100644 --- a/packages/vite/src/node/http.ts +++ b/packages/vite/src/node/http.ts @@ -104,6 +104,9 @@ export async function resolveHttpServer( } else { return require('http2').createSecureServer( { + // Manually increase the session memory to prevent 502 ENHANCE_YOUR_CALM + // errors on large numbers of requests + maxSessionMemory: 1000, ...httpsOptions, allowHTTP1: true }, From e56d79e17d64abf383bc2c30a5a2f1da6494f1fa Mon Sep 17 00:00:00 2001 From: patak Date: Mon, 9 May 2022 20:49:38 +0200 Subject: [PATCH 0672/1287] chore: bump Vitest timeout (#8084) --- vitest.config.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vitest.config.ts b/vitest.config.ts index 4026b98c30d640..0a8f8c2ff22648 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -7,7 +7,8 @@ export default defineConfig({ '**/dist/**', './playground/**/*.*', './playground-temp/**/*.*' - ] + ], + testTimeout: 20000 }, esbuild: { target: 'node14' From d7c04e8a0106de857b4e13d35631699d1393f804 Mon Sep 17 00:00:00 2001 From: Jeudi Prando Araujo Date: Mon, 9 May 2022 15:56:14 -0300 Subject: [PATCH 0673/1287] docs(config-file): update tip note about string replace (#7846) --- docs/config/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/config/index.md b/docs/config/index.md index 5862419405aa89..6e74e7d3b01d5e 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -28,12 +28,14 @@ vite --config my-config.js ``` ::: tip NOTE -Vite will replace `__filename`, `__dirname`, and `import.meta.url` in config files and its deps. Using these as variable names will result in an error: +Vite will replace `__filename`, `__dirname`, and `import.meta.url` in config files and its deps. Using these as variable names or passing as a parameter to a function with string double quote (example `console.log`) will result in an error: ```js const __filename = "value" // will be transformed to const "path/vite.config.js" = "value" + +console.log("import.meta.url") // break error on build ``` ::: From 8167db32ec44047b006a93a7969028101f5d9276 Mon Sep 17 00:00:00 2001 From: Olyno Date: Mon, 9 May 2022 23:03:35 +0200 Subject: [PATCH 0674/1287] fix(create-vite): allow slash at the end of project path (#6897) --- packages/create-vite/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/create-vite/index.js b/packages/create-vite/index.js index fceef9d9885a05..8310b8c0bddba2 100755 --- a/packages/create-vite/index.js +++ b/packages/create-vite/index.js @@ -132,7 +132,9 @@ async function init() { let targetDir = argv._[0] let template = argv.template || argv.t - const defaultProjectName = !targetDir ? 'vite-project' : targetDir + const defaultProjectName = !targetDir + ? 'vite-project' + : targetDir.trim().replace(/\/+$/g, '') let result = {} @@ -145,7 +147,8 @@ async function init() { message: reset('Project name:'), initial: defaultProjectName, onState: (state) => - (targetDir = state.value.trim() || defaultProjectName) + (targetDir = + state.value.trim().replace(/\/+$/g, '') || defaultProjectName) }, { type: () => From 2b2858c27e58f995494f7a132dfe64cbb0d1f518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Tue, 10 May 2022 10:48:45 +0900 Subject: [PATCH 0675/1287] test: suppress @vue/reactivity-transform warning (#8087) --- scripts/jestEnv.cjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/jestEnv.cjs b/scripts/jestEnv.cjs index b576155644a27f..a053faef1a69a5 100644 --- a/scripts/jestEnv.cjs +++ b/scripts/jestEnv.cjs @@ -32,8 +32,8 @@ module.exports = class PlaywrightEnvironment extends NodeEnvironment { const console = this.global.console const warn = console.warn console.warn = (msg, ...args) => { - // suppress @vue/ref-transform warning - if (msg.includes('@vue/ref-transform')) return + // suppress @vue/reactivity-transform warning + if (msg.includes('@vue/reactivity-transform')) return if (msg.includes('Generated an empty chunk')) return warn.call(console, msg, ...args) } From 095543fcc5fd978e8b56fd68a7bc1785db339ee7 Mon Sep 17 00:00:00 2001 From: ygj6 <7699524+ygj6@users.noreply.github.com> Date: Tue, 10 May 2022 13:19:12 +0800 Subject: [PATCH 0676/1287] docs: note for inconsistency between dev and build (#6674) --- docs/config/index.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/config/index.md b/docs/config/index.md index 6e74e7d3b01d5e..666f5f39a5511c 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -186,6 +186,20 @@ export default defineConfig(({ command, mode }) => { ::: + ::: tip NOTE + Since dev and build implement `define` differently, we should avoid some use cases to avoid inconsistency. + + Example: + + ```js + const obj = { + __NAME__, // Don't define object shorthand property names + __KEY__: value // Don't define object key + } + ``` + + ::: + ### plugins - **Type:** `(Plugin | Plugin[])[]` From 7b48e2292e6ae833726a18b16961c9ed3173e33f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Tue, 10 May 2022 14:21:24 +0900 Subject: [PATCH 0677/1287] chore(plugin-vue-jsx): add peer deps (#8086) --- packages/plugin-vue-jsx/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 91ef19c2049850..11e83bac3321b6 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -28,5 +28,9 @@ "@rollup/pluginutils": "^4.2.1", "@vue/babel-plugin-jsx": "^1.1.1", "hash-sum": "^2.0.0" + }, + "peerDependencies": { + "vite": "^2.0.0", + "vue": "^3.0.0" } } From e10c0c1e28d944a425b954aa71cbf1c8698125b7 Mon Sep 17 00:00:00 2001 From: patak Date: Tue, 10 May 2022 08:00:21 +0200 Subject: [PATCH 0678/1287] fix: image-set with base64 images (fix #8028) (#8035) --- packages/vite/src/node/plugins/css.ts | 14 +++++++++++--- packages/vite/src/node/utils.ts | 22 ++++++++++++++++++++-- playground/assets/__tests__/assets.spec.ts | 17 ++++++++++++++++- playground/assets/css/css-url.css | 19 +++++++++++++++++++ playground/assets/index.html | 10 ++++++++++ 5 files changed, 76 insertions(+), 6 deletions(-) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 3ffd93bb9f9910..c13a4c83052639 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -1045,18 +1045,26 @@ function rewriteImportCss( }) } -function rewriteCssImageSet( +// TODO: image and cross-fade could contain a "url" that needs to be processed +// https://drafts.csswg.org/css-images-4/#image-notation +// https://drafts.csswg.org/css-images-4/#cross-fade-function +const cssNotProcessedRE = /(gradient|element|cross-fade|image)\(/ + +async function rewriteCssImageSet( css: string, replacer: CssUrlReplacer ): Promise { - return asyncReplace(css, cssImageSetRE, async (match) => { + return await asyncReplace(css, cssImageSetRE, async (match) => { const [, rawUrl] = match const url = await processSrcSet(rawUrl, async ({ url }) => { // the url maybe url(...) if (cssUrlRE.test(url)) { return await rewriteCssUrls(url, replacer) } - return await doUrlReplace(url, url, replacer) + if (!cssNotProcessedRE.test(url)) { + return await doUrlReplace(url, url, replacer) + } + return url }) return url }) diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index ddcaced9832bc1..0c25b4592adf6d 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -560,8 +560,7 @@ export async function processSrcSet( srcs: string, replacer: (arg: ImageCandidate) => Promise ): Promise { - const imageCandidates: ImageCandidate[] = srcs - .split(',') + const imageCandidates: ImageCandidate[] = splitSrcSet(srcs) .map((s) => { const src = s.replace(escapedSpaceCharacters, ' ').trim() const [url] = imageSetUrlRE.exec(src) || [] @@ -589,6 +588,25 @@ export async function processSrcSet( }, '') } +function splitSrcSet(srcs: string) { + const parts: string[] = [] + // There could be a ',' inside of url(data:...), linear-gradient(...) or "data:..." + const cleanedSrcs = srcs.replace( + /(?:url|image|gradient|cross-fade)\([^\)]*\)|"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'/g, + blankReplacer + ) + let startIndex = 0 + let splitIndex: number + do { + splitIndex = cleanedSrcs.indexOf(',', startIndex) + parts.push( + srcs.slice(startIndex, splitIndex !== -1 ? splitIndex : undefined) + ) + startIndex = splitIndex + 1 + } while (splitIndex !== -1) + return parts +} + function escapeToLinuxLikePath(path: string) { if (/^[A-Z]:/.test(path)) { return path.replace(/^([A-Z]):\//, '/windows/$1/') diff --git a/playground/assets/__tests__/assets.spec.ts b/playground/assets/__tests__/assets.spec.ts index c63ffc7cc1c0c2..d9f1c8ed761773 100644 --- a/playground/assets/__tests__/assets.spec.ts +++ b/playground/assets/__tests__/assets.spec.ts @@ -118,8 +118,23 @@ describe('css url() references', () => { }) }) - // not supported in browser now + test('image-set with base64', async () => { + const imageSet = await getBg('.css-image-set-base64') + expect(imageSet).toMatch( + `-webkit-image-set(url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA0AgMAAACrwbOMAAADI2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0LCAyMDE2LzA5LzE0LTAxOjA5OjAxICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo1MDI2QjVGQTg3RUIxMUVBQUFDMkQ3NTM0MUZGNzU3RSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo1MDI2QjVGOTg3RUIxMUVBQUFDMkQ3NTM0MUZGNzU3RSIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBNzc3MDZDRjg3QUIxMUUzQjcwREVFMDM3NzA2QzEyMyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBNzc3MDZEMDg3QUIxMUUzQjcwREVFMDM3NzA2QzEyMyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PqfCcbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAADFBMVEVBuoQ0R10/qn8/qX7FyuqbAAAABHRSTlP9/QGEiU0+GwAAAPtJREFUGBkFwbFNXEEUBdDD/QSWmE7YYAogWNeAaMfaEuiD5HfAk9yIAwqYwIGRRvt8zkNdvckrzzcfjqDccdPIYnH1AJ4ywLs7m53Fhkcw0+DLDxZn0PCHQrrg2xWOCpS7m6bFAj/ZDLFY/AJbDDZ/WUzR4B84BRoURBeAo4Si0CBMFvBEGMBmExYbi0loACcBjQKhC3AUQVGaRjBhMxAsFlwQDLYFBA04EaAVEHSBoxAoPmkITBYDAovNhsAAEwINTggAINCFoyCg0CBgYoCAjQsIACCgcYKABhCgHAUClAYCTAMIsF2AAAACtBMIQAEB+jcggE9AAC+A/zyyZDSXstCbAAAAAElFTkSuQmCC") 1x, url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA0CAYAAADWr1sfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NTAyNkI1RkE4N0VCMTFFQUFBQzJENzUzNDFGRjc1N0UiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NTAyNkI1Rjk4N0VCMTFFQUFBQzJENzUzNDFGRjc1N0UiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTc3NzA2Q0Y4N0FCMTFFM0I3MERFRTAzNzcwNkMxMjMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTc3NzA2RDA4N0FCMTFFM0I3MERFRTAzNzcwNkMxMjMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6nwnGxAAAJtklEQVR42txZ6W9c1RU/970373nsJHgZ27FThahSV8BCqGQTlIQ2EiUBReqHVpT8Af0r+NA/ogpqqWiDKrZuKYQPLGEpAlEFiqOgICSUBOKQhDjxeGY885bb37n3TGKPZ+4bx0uWK53Ec+cu53fPfkbtfu13B4noF6AQVAEpah0ak3cUSBU8qh46RfWj50ltKJDXXyBKdMtibI+TXlLqm2C87y/+eO/vlVIVnWbUcShFyld8T19ypvLbZKpyALOjVPCqrUcT1mWXYtIzMUV7Rqn315tJJyk+J51OZwb7QA3QkQD/fAL6JWiIXKMOhkOPwp1DFE/OkJ6NAQxn+fhuPhaFOc8DE9loern+hD9SfJVCdaLdOy5gif9rpHfyHp3pCX5cs6X1PfnORkr+SA9FO4bsgkZm1ykngm8ZK06ll0EvgWY6SwDn1fGKcykVfriewh2D5oKskhhw5KmFzLO0MJdO1yfS87UD2Uxc0tXErM+qLYQ5XUspK8el9JvagXSmPmH2W4lfG3wHNMHciXnmIfj+OvCVga8sD+yMYHyZAZ8H/Qk06dySaiNljf/DB0vklWAB1RQqnS0WA18eQE0Dz0++rjyRluOJDHuzWkwZNAPgLPHfPIeHTK/EEzHWKt/zDdh2asBmUUnJg3TDB0rQIuYptby5x6RgPO/JxIes304p44V1DMAzKQUbe4xqa62h2vbFyWuxeUie1RKqvVmXG/sxOaYKPqliQKp3HmEOB43pWaxJaTPvUV6rdK3Z6FloGUt35yD54EGXEwvaU3nSPSIYF7D5T/mio1rzS7Jaa1we4YWDzb1GUpptqJ1OGUl7BJX+jS7HP/OKEPlgRH5/SP5AZMjrCTz+jtdQQckxauEZ/IZ4bKyhYEsv7h6GpmGuhnsznafORwQbtQKGY6F/gy64pMxPnF2JSQ33UM/ecWNX/PJG3RbYsn15qCiYTQdhr49j9m4jQd8zXlkFZv3d/B087SBM4OodC+5kJYIX5r09+8ZIDYYAn4gqOdFeEEwn2gFmMb0BesEpZeOxARAOJ4SXjLbDlljKcbaQ0ebwrRNLy409oH1Xz1H2xrRc3wfaYx1dm/sgQTyYMZ1wZ4nC+4es76gnC3lqP14QTFk7wDymQH8DnXKCZibKiQHY89gY+aUeGwcT66xaw40JMUnWn52t7NWVeKt5GNaUarw1naruxXn9Rrrz9jRjLsd5PtsfZY3aaBZo9tT5qnxKsExRizto59EOccRzJQomHAC0DzsOHxwy3lvXk8VxU1u1VJFPaSW5B177SRtfNaVnq08izNyjQl9UefFe4zNwdoTI4I8XTfznu3NUORYMiyKP10HvD4neZy7VzqBaHEOjnw5TsKnXfgaDRjKqxWuzzRKtTy/Wt2W1ZAukuyX9tr4Ns+vZpheAVfKoOCuDKrNzDB8Ysp9Znd2qnAnvh9r5I8+hDs86HRhfCIlyQqGgbuHDI0Sz9gHaZj0sQXhhpJhbktOVp5Kvak/x31Sg9rarRXVxXvjwKJxk0Z7N/sOjPEf1bCez7LS1Ji/0iduBAUAD6JDpRFsHqfDjDZRdTqyU26gn2ykkXUovzf2KCV66ZGxXL9YeVtsMMb9w1x0U/WTAADWqnGO4wvMhwdA14PmqfbLjClZdTkaqCFPrAor2byIvUsZrd5Syp4BaFYW8RUmDeG8+wwsVRY+Pk7c+MJpkChXfCfhkJ1XuBjCPV0Bvt0nhFwoPiQfbVjixgaKHho3qGSlbgIu9ti/VEdHifJkdVc2aRoizwnv7kT+nNuy5hxZeX3EtygM8DfoX6FPnCcxL1Yap6NGNCCFFk5x0ETra2i7v9TcWqbh3zIbASmzvcHP7qfA6vRzAJIH7JWeYktRPz2a2bHuoZKpEdjgWdBeoWboMTpwea4o3GiF1lXzZPWLh8Y3ca7oAPAd6E/RubjLCkgBz4fYhCu6cl2d73UmX13KSUcDecNugqX2Np9a5mvKu8Di3EoB5HAP9WboGnZMRFiiXb0MhhYjNOrbeVsc5DPPexEqXz+C9HufLHHPT3PyxIbwd6wZIt4DnxCG81lG1JT9miZiaGeVj8L0+m3I2UrdaezY/z65Auj9ab0vPNLOlp+fEGwtPb3cj3aUA5nEWdDA3GTGMpqT6AupFmLLpYWaL9Hag2XZZdVHqcR1cfGzchDhdyWwFpnKTjIPCG600YFad96S+rHeOzZ5tB7Et3jeItLNk8+Fa2j6jYnU2YSyhaNcwFe4dMHv5DD7L1WUTXt5zmtoyADe7Bwfn15cdHZix3cxIzB+ObC+q2Z1Q6pq0E6gynF0A715ErasbqQWbH9JOCC8zSwGwVMA8Phb3X3a2g5BnZ5cRT78Dj7trxMRR7liY+lhdu5ntVnFDFLm4N1a0nr2e5rVtysLDx0tl/noAc9X7TLNH5KxZuC1Tg6puH0SYKtoaumFrYWPbsS0xg+/2UbjVVkNXW67u8aHwkKwFYB6fgQ47nYXXBBSbEBPtGjUtnWy6YcEm/F1q5sLdkO5AQTonuap8Vu7+7HoYv17APF4Fve6KrabEkzhcuH+AAuTFGmmjkeScbdsU7hswxGtMkqJzM7PX5W5aa8BfSDdwyt30I9Nw44qn+MgYef1IKC42SLN9D4TU8+iYCWGmKSfdEceYkju/uBGAebwvDW53KcOeFxlYcBeqqd3DBiznyCHCUPCDdUTsweM0765M7np/OQwvF/A5aYOedDcKmo23zP5qsalovTfny9wL4xQyP18+KXedu5GAmx0G9pizrsrAJCOQsuovUPTIKIU/HzG/SPKczks97dnPODswXY5gBQDXxK72g3a0fURT5yoTY7nw5w6ksVcAzZq/C7mbcv+TO2rLZXYlJMzjtNjXBedN7IlBXuibtq3ph8W5vw1dkLNPrwSjKwWY89oXQf9xNgqaXruaWLulXK8cy5kvOvP3GwC4mWc/50wImj+xaLrmpFRugvPcUvPltQJMUr0cXcHzjpLrF82bAHBN1O+dFTjrHTmrdjMD5vER6B/LZLQmZ3y00sytBuC65LtvLeOMt+SM+q0AmMekNNbK17G3LHsnV4Ox1QLM4wNRy3gJe2LZ88FqMbWagL8CPe2sptpXQ0/L3lsOMGcW3Cv+O+hyF+svy9pjsveWA9z0tn8Afd7F2s9lbW01GVptwJxTHZfE3/Uj17SsOU7ddLRuYsDN8decDOyorFn1sVaAvyT7k8iZNt+dke++vJ0A8+CfMw+3mT8s39HtBviSgDs+b+64zF26HQHz+C/o+Xmfn5c5ul0BXyT7w/U5oTdlbs1GQGs/vgb9cd7fazr+L8AAD0zRYMSYHQAAAAAASUVORK5CYII=") 2x)` + ) + }) + + // TODO: not supported in chrome // https://drafts.csswg.org/css-images-4/#image-set-notation + // + // test('image-set with multiple descriptor', async () => { + // const imageSet = await getBg('.css-image-set-gradient') + // expect(imageSet).toMatch( + // `-webkit-image-set(url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA0AgMAAACrwbOMAAADI2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0LCAyMDE2LzA5LzE0LTAxOjA5OjAxICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo1MDI2QjVGQTg3RUIxMUVBQUFDMkQ3NTM0MUZGNzU3RSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo1MDI2QjVGOTg3RUIxMUVBQUFDMkQ3NTM0MUZGNzU3RSIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBNzc3MDZDRjg3QUIxMUUzQjcwREVFMDM3NzA2QzEyMyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBNzc3MDZEMDg3QUIxMUUzQjcwREVFMDM3NzA2QzEyMyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PqfCcbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAADFBMVEVBuoQ0R10/qn8/qX7FyuqbAAAABHRSTlP9/QGEiU0+GwAAAPtJREFUGBkFwbFNXEEUBdDD/QSWmE7YYAogWNeAaMfaEuiD5HfAk9yIAwqYwIGRRvt8zkNdvckrzzcfjqDccdPIYnH1AJ4ywLs7m53Fhkcw0+DLDxZn0PCHQrrg2xWOCpS7m6bFAj/ZDLFY/AJbDDZ/WUzR4B84BRoURBeAo4Si0CBMFvBEGMBmExYbi0loACcBjQKhC3AUQVGaRjBhMxAsFlwQDLYFBA04EaAVEHSBoxAoPmkITBYDAovNhsAAEwINTggAINCFoyCg0CBgYoCAjQsIACCgcYKABhCgHAUClAYCTAMIsF2AAAACtBMIQAEB+jcggE9AAC+A/zyyZDSXstCbAAAAAElFTkSuQmCC") 1x, linear-gradient(#e66465, #9198e5) 2x)` + // ) + // }) + // // test('image-set with multiple descriptor', async () => { // const imageSet = await getBg('.css-image-set-multiple-descriptor') // imageSet.split(', ').forEach((s) => { diff --git a/playground/assets/css/css-url.css b/playground/assets/css/css-url.css index 9047cd384e7d38..1446f19afa662e 100644 --- a/playground/assets/css/css-url.css +++ b/playground/assets/css/css-url.css @@ -41,6 +41,25 @@ background-size: 10px; } +.css-image-set-base64 { + background-image: -webkit-image-set( + url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA0AgMAAACrwbOMAAADI2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0LCAyMDE2LzA5LzE0LTAxOjA5OjAxICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo1MDI2QjVGQTg3RUIxMUVBQUFDMkQ3NTM0MUZGNzU3RSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo1MDI2QjVGOTg3RUIxMUVBQUFDMkQ3NTM0MUZGNzU3RSIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBNzc3MDZDRjg3QUIxMUUzQjcwREVFMDM3NzA2QzEyMyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBNzc3MDZEMDg3QUIxMUUzQjcwREVFMDM3NzA2QzEyMyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PqfCcbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAADFBMVEVBuoQ0R10/qn8/qX7FyuqbAAAABHRSTlP9/QGEiU0+GwAAAPtJREFUGBkFwbFNXEEUBdDD/QSWmE7YYAogWNeAaMfaEuiD5HfAk9yIAwqYwIGRRvt8zkNdvckrzzcfjqDccdPIYnH1AJ4ywLs7m53Fhkcw0+DLDxZn0PCHQrrg2xWOCpS7m6bFAj/ZDLFY/AJbDDZ/WUzR4B84BRoURBeAo4Si0CBMFvBEGMBmExYbi0loACcBjQKhC3AUQVGaRjBhMxAsFlwQDLYFBA04EaAVEHSBoxAoPmkITBYDAovNhsAAEwINTggAINCFoyCg0CBgYoCAjQsIACCgcYKABhCgHAUClAYCTAMIsF2AAAACtBMIQAEB+jcggE9AAC+A/zyyZDSXstCbAAAAAElFTkSuQmCC) + 1x, + url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA0CAYAAADWr1sfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NTAyNkI1RkE4N0VCMTFFQUFBQzJENzUzNDFGRjc1N0UiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NTAyNkI1Rjk4N0VCMTFFQUFBQzJENzUzNDFGRjc1N0UiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTc3NzA2Q0Y4N0FCMTFFM0I3MERFRTAzNzcwNkMxMjMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTc3NzA2RDA4N0FCMTFFM0I3MERFRTAzNzcwNkMxMjMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6nwnGxAAAJtklEQVR42txZ6W9c1RU/970373nsJHgZ27FThahSV8BCqGQTlIQ2EiUBReqHVpT8Af0r+NA/ogpqqWiDKrZuKYQPLGEpAlEFiqOgICSUBOKQhDjxeGY885bb37n3TGKPZ+4bx0uWK53Ec+cu53fPfkbtfu13B4noF6AQVAEpah0ak3cUSBU8qh46RfWj50ltKJDXXyBKdMtibI+TXlLqm2C87y/+eO/vlVIVnWbUcShFyld8T19ypvLbZKpyALOjVPCqrUcT1mWXYtIzMUV7Rqn315tJJyk+J51OZwb7QA3QkQD/fAL6JWiIXKMOhkOPwp1DFE/OkJ6NAQxn+fhuPhaFOc8DE9loern+hD9SfJVCdaLdOy5gif9rpHfyHp3pCX5cs6X1PfnORkr+SA9FO4bsgkZm1ykngm8ZK06ll0EvgWY6SwDn1fGKcykVfriewh2D5oKskhhw5KmFzLO0MJdO1yfS87UD2Uxc0tXErM+qLYQ5XUspK8el9JvagXSmPmH2W4lfG3wHNMHciXnmIfj+OvCVga8sD+yMYHyZAZ8H/Qk06dySaiNljf/DB0vklWAB1RQqnS0WA18eQE0Dz0++rjyRluOJDHuzWkwZNAPgLPHfPIeHTK/EEzHWKt/zDdh2asBmUUnJg3TDB0rQIuYptby5x6RgPO/JxIes304p44V1DMAzKQUbe4xqa62h2vbFyWuxeUie1RKqvVmXG/sxOaYKPqliQKp3HmEOB43pWaxJaTPvUV6rdK3Z6FloGUt35yD54EGXEwvaU3nSPSIYF7D5T/mio1rzS7Jaa1we4YWDzb1GUpptqJ1OGUl7BJX+jS7HP/OKEPlgRH5/SP5AZMjrCTz+jtdQQckxauEZ/IZ4bKyhYEsv7h6GpmGuhnsznafORwQbtQKGY6F/gy64pMxPnF2JSQ33UM/ecWNX/PJG3RbYsn15qCiYTQdhr49j9m4jQd8zXlkFZv3d/B087SBM4OodC+5kJYIX5r09+8ZIDYYAn4gqOdFeEEwn2gFmMb0BesEpZeOxARAOJ4SXjLbDlljKcbaQ0ebwrRNLy409oH1Xz1H2xrRc3wfaYx1dm/sgQTyYMZ1wZ4nC+4es76gnC3lqP14QTFk7wDymQH8DnXKCZibKiQHY89gY+aUeGwcT66xaw40JMUnWn52t7NWVeKt5GNaUarw1naruxXn9Rrrz9jRjLsd5PtsfZY3aaBZo9tT5qnxKsExRizto59EOccRzJQomHAC0DzsOHxwy3lvXk8VxU1u1VJFPaSW5B177SRtfNaVnq08izNyjQl9UefFe4zNwdoTI4I8XTfznu3NUORYMiyKP10HvD4neZy7VzqBaHEOjnw5TsKnXfgaDRjKqxWuzzRKtTy/Wt2W1ZAukuyX9tr4Ns+vZpheAVfKoOCuDKrNzDB8Ysp9Znd2qnAnvh9r5I8+hDs86HRhfCIlyQqGgbuHDI0Sz9gHaZj0sQXhhpJhbktOVp5Kvak/x31Sg9rarRXVxXvjwKJxk0Z7N/sOjPEf1bCez7LS1Ji/0iduBAUAD6JDpRFsHqfDjDZRdTqyU26gn2ykkXUovzf2KCV66ZGxXL9YeVtsMMb9w1x0U/WTAADWqnGO4wvMhwdA14PmqfbLjClZdTkaqCFPrAor2byIvUsZrd5Syp4BaFYW8RUmDeG8+wwsVRY+Pk7c+MJpkChXfCfhkJ1XuBjCPV0Bvt0nhFwoPiQfbVjixgaKHho3qGSlbgIu9ti/VEdHifJkdVc2aRoizwnv7kT+nNuy5hxZeX3EtygM8DfoX6FPnCcxL1Yap6NGNCCFFk5x0ETra2i7v9TcWqbh3zIbASmzvcHP7qfA6vRzAJIH7JWeYktRPz2a2bHuoZKpEdjgWdBeoWboMTpwea4o3GiF1lXzZPWLh8Y3ca7oAPAd6E/RubjLCkgBz4fYhCu6cl2d73UmX13KSUcDecNugqX2Np9a5mvKu8Di3EoB5HAP9WboGnZMRFiiXb0MhhYjNOrbeVsc5DPPexEqXz+C9HufLHHPT3PyxIbwd6wZIt4DnxCG81lG1JT9miZiaGeVj8L0+m3I2UrdaezY/z65Auj9ab0vPNLOlp+fEGwtPb3cj3aUA5nEWdDA3GTGMpqT6AupFmLLpYWaL9Hag2XZZdVHqcR1cfGzchDhdyWwFpnKTjIPCG600YFad96S+rHeOzZ5tB7Et3jeItLNk8+Fa2j6jYnU2YSyhaNcwFe4dMHv5DD7L1WUTXt5zmtoyADe7Bwfn15cdHZix3cxIzB+ObC+q2Z1Q6pq0E6gynF0A715ErasbqQWbH9JOCC8zSwGwVMA8Phb3X3a2g5BnZ5cRT78Dj7trxMRR7liY+lhdu5ntVnFDFLm4N1a0nr2e5rVtysLDx0tl/noAc9X7TLNH5KxZuC1Tg6puH0SYKtoaumFrYWPbsS0xg+/2UbjVVkNXW67u8aHwkKwFYB6fgQ47nYXXBBSbEBPtGjUtnWy6YcEm/F1q5sLdkO5AQTonuap8Vu7+7HoYv17APF4Fve6KrabEkzhcuH+AAuTFGmmjkeScbdsU7hswxGtMkqJzM7PX5W5aa8BfSDdwyt30I9Nw44qn+MgYef1IKC42SLN9D4TU8+iYCWGmKSfdEceYkju/uBGAebwvDW53KcOeFxlYcBeqqd3DBiznyCHCUPCDdUTsweM0765M7np/OQwvF/A5aYOedDcKmo23zP5qsalovTfny9wL4xQyP18+KXedu5GAmx0G9pizrsrAJCOQsuovUPTIKIU/HzG/SPKczks97dnPODswXY5gBQDXxK72g3a0fURT5yoTY7nw5w6ksVcAzZq/C7mbcv+TO2rLZXYlJMzjtNjXBedN7IlBXuibtq3ph8W5vw1dkLNPrwSjKwWY89oXQf9xNgqaXruaWLulXK8cy5kvOvP3GwC4mWc/50wImj+xaLrmpFRugvPcUvPltQJMUr0cXcHzjpLrF82bAHBN1O+dFTjrHTmrdjMD5vER6B/LZLQmZ3y00sytBuC65LtvLeOMt+SM+q0AmMekNNbK17G3LHsnV4Ox1QLM4wNRy3gJe2LZ88FqMbWagL8CPe2sptpXQ0/L3lsOMGcW3Cv+O+hyF+svy9pjsveWA9z0tn8Afd7F2s9lbW01GVptwJxTHZfE3/Uj17SsOU7ddLRuYsDN8decDOyorFn1sVaAvyT7k8iZNt+dke++vJ0A8+CfMw+3mT8s39HtBviSgDs+b+64zF26HQHz+C/o+Xmfn5c5ul0BXyT7w/U5oTdlbs1GQGs/vgb9cd7fazr+L8AAD0zRYMSYHQAAAAAASUVORK5CYII=) + 2x + ); + background-size: 10px; +} + +.css-image-set-gradient { + background-image: -webkit-image-set( + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA0AgMAAACrwbOMAAADI2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0LCAyMDE2LzA5LzE0LTAxOjA5OjAxICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo1MDI2QjVGQTg3RUIxMUVBQUFDMkQ3NTM0MUZGNzU3RSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo1MDI2QjVGOTg3RUIxMUVBQUFDMkQ3NTM0MUZGNzU3RSIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBNzc3MDZDRjg3QUIxMUUzQjcwREVFMDM3NzA2QzEyMyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBNzc3MDZEMDg3QUIxMUUzQjcwREVFMDM3NzA2QzEyMyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PqfCcbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAADFBMVEVBuoQ0R10/qn8/qX7FyuqbAAAABHRSTlP9/QGEiU0+GwAAAPtJREFUGBkFwbFNXEEUBdDD/QSWmE7YYAogWNeAaMfaEuiD5HfAk9yIAwqYwIGRRvt8zkNdvckrzzcfjqDccdPIYnH1AJ4ywLs7m53Fhkcw0+DLDxZn0PCHQrrg2xWOCpS7m6bFAj/ZDLFY/AJbDDZ/WUzR4B84BRoURBeAo4Si0CBMFvBEGMBmExYbi0loACcBjQKhC3AUQVGaRjBhMxAsFlwQDLYFBA04EaAVEHSBoxAoPmkITBYDAovNhsAAEwINTggAINCFoyCg0CBgYoCAjQsIACCgcYKABhCgHAUClAYCTAMIsF2AAAACtBMIQAEB+jcggE9AAC+A/zyyZDSXstCbAAAAAElFTkSuQmCC' + 1x, + linear-gradient(#e66465, #9198e5) 2x + ); + background-size: 10px; +} + .css-image-set-multiple-descriptor { background-image: -webkit-image-set( '../nested/asset.png' type('image/png') 1x, diff --git a/playground/assets/index.html b/playground/assets/index.html index 43eed55236abd3..fcf0e4ce1e81d7 100644 --- a/playground/assets/index.html +++ b/playground/assets/index.html @@ -56,6 +56,16 @@

CSS url references

CSS background image-set() (mix var and url) +
+ + CSS background image-set() (with base64) + +
+
+ + CSS background image-set() (with gradient) + +
CSS background image-set() (with multiple descriptor) From 85cab7054f5b7774fb796d86329226870fd23cdc Mon Sep 17 00:00:00 2001 From: TMQ <5112895@qq.com> Date: Tue, 10 May 2022 14:11:50 +0800 Subject: [PATCH 0679/1287] fix(build): use crossorigin for module preloaded --- packages/vite/src/node/plugins/html.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index 40883a86c9af2a..2f1e3af34babb4 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -546,6 +546,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin { tag: 'link', attrs: { rel: 'modulepreload', + crossorigin: true, href: toPublicPath(chunk.fileName, config) } }) From 80d113b1d6df6c97ad2a3dcd27be8a7e27103141 Mon Sep 17 00:00:00 2001 From: yoho Date: Tue, 10 May 2022 17:42:29 +0800 Subject: [PATCH 0680/1287] feat: rework `dynamic-import-vars` (#7756) Co-authored-by: Anthony Fu Co-authored-by: Bjorn Lu --- .../__snapshots__/parse.test.ts.snap | 13 ++ .../plugins/dynamicImportVar/mods/hello.js | 3 + .../plugins/dynamicImportVar/mods/hi.js | 3 + .../plugins/dynamicImportVar/parse.test.ts | 38 +++ packages/vite/src/node/build.ts | 2 - .../src/node/plugins/dynamicImportVars.ts | 217 ++++++++++++++++++ .../vite/src/node/plugins/importAnalysis.ts | 23 +- .../vite/src/node/plugins/importMetaGlob.ts | 22 +- packages/vite/src/node/plugins/index.ts | 2 + packages/vite/src/node/utils.ts | 7 +- packages/vite/types/shims.d.ts | 5 + .../__tests__/dynamic-import.spec.ts | 24 ++ playground/dynamic-import/alias/hello.js | 3 + playground/dynamic-import/alias/hi.js | 3 + playground/dynamic-import/index.html | 14 ++ playground/dynamic-import/nested/hello.js | 3 + playground/dynamic-import/nested/index.js | 14 ++ playground/dynamic-import/vite.config.js | 12 +- 18 files changed, 372 insertions(+), 36 deletions(-) create mode 100644 packages/vite/src/node/__tests__/plugins/dynamicImportVar/__snapshots__/parse.test.ts.snap create mode 100644 packages/vite/src/node/__tests__/plugins/dynamicImportVar/mods/hello.js create mode 100644 packages/vite/src/node/__tests__/plugins/dynamicImportVar/mods/hi.js create mode 100644 packages/vite/src/node/__tests__/plugins/dynamicImportVar/parse.test.ts create mode 100644 packages/vite/src/node/plugins/dynamicImportVars.ts create mode 100644 playground/dynamic-import/alias/hello.js create mode 100644 playground/dynamic-import/alias/hi.js create mode 100644 playground/dynamic-import/nested/hello.js diff --git a/packages/vite/src/node/__tests__/plugins/dynamicImportVar/__snapshots__/parse.test.ts.snap b/packages/vite/src/node/__tests__/plugins/dynamicImportVar/__snapshots__/parse.test.ts.snap new file mode 100644 index 00000000000000..be73ec998bc834 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/dynamicImportVar/__snapshots__/parse.test.ts.snap @@ -0,0 +1,13 @@ +// Vitest Snapshot v1 + +exports[`parse positives > ? in url 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mo?ds/*.js\\", {\\"as\\":\\"raw\\",\\"import\\":\\"*\\"})), \`./mo?ds/\${base ?? foo}.js\`)"`; + +exports[`parse positives > ? in variables 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mods/*.js\\", {\\"as\\":\\"raw\\",\\"import\\":\\"*\\"})), \`./mods/\${base ?? foo}.js\`)"`; + +exports[`parse positives > alias path 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mods/*.js\\")), \`./mods/\${base}.js\`)"`; + +exports[`parse positives > basic 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mods/*.js\\")), \`./mods/\${base}.js\`)"`; + +exports[`parse positives > with query raw 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mods/*.js\\", {\\"as\\":\\"raw\\",\\"import\\":\\"*\\"})), \`./mods/\${base}.js\`)"`; + +exports[`parse positives > with query url 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mods/*.js\\")), \`./mods/\${base}.js\`)"`; diff --git a/packages/vite/src/node/__tests__/plugins/dynamicImportVar/mods/hello.js b/packages/vite/src/node/__tests__/plugins/dynamicImportVar/mods/hello.js new file mode 100644 index 00000000000000..67900ef0999962 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/dynamicImportVar/mods/hello.js @@ -0,0 +1,3 @@ +export function hello() { + return 'hello' +} diff --git a/packages/vite/src/node/__tests__/plugins/dynamicImportVar/mods/hi.js b/packages/vite/src/node/__tests__/plugins/dynamicImportVar/mods/hi.js new file mode 100644 index 00000000000000..45d3506803b2b6 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/dynamicImportVar/mods/hi.js @@ -0,0 +1,3 @@ +export function hi() { + return 'hi' +} diff --git a/packages/vite/src/node/__tests__/plugins/dynamicImportVar/parse.test.ts b/packages/vite/src/node/__tests__/plugins/dynamicImportVar/parse.test.ts new file mode 100644 index 00000000000000..ef1dcb2238a5b0 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/dynamicImportVar/parse.test.ts @@ -0,0 +1,38 @@ +import { describe, expect, it } from 'vitest' +import { transformDynamicImport } from '../../../plugins/dynamicImportVars' +import { resolve } from 'path' + +async function run(input: string) { + const { glob, rawPattern } = await transformDynamicImport( + input, + resolve(__dirname, 'index.js'), + (id) => id.replace('@', resolve(__dirname, './mods/')) + ) + return `__variableDynamicImportRuntimeHelper(${glob}, \`${rawPattern}\`)` +} + +describe('parse positives', () => { + it('basic', async () => { + expect(await run('`./mods/${base}.js`')).toMatchSnapshot() + }) + + it('alias path', async () => { + expect(await run('`@/${base}.js`')).toMatchSnapshot() + }) + + it('with query raw', async () => { + expect(await run('`./mods/${base}.js?raw`')).toMatchSnapshot() + }) + + it('with query url', async () => { + expect(await run('`./mods/${base}.js?url`')).toMatchSnapshot() + }) + + it('? in variables', async () => { + expect(await run('`./mods/${base ?? foo}.js?raw`')).toMatchSnapshot() + }) + + it('? in url', async () => { + expect(await run('`./mo?ds/${base ?? foo}.js?raw`')).toMatchSnapshot() + }) +}) diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index d4d4085bb829ed..1bdfa5a35077e6 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -26,7 +26,6 @@ import { copyDir, emptyDir, lookupFile, normalizePath } from './utils' import { manifestPlugin } from './plugins/manifest' import commonjsPlugin from '@rollup/plugin-commonjs' import type { RollupCommonJSOptions } from 'types/commonjs' -import dynamicImportVars from '@rollup/plugin-dynamic-import-vars' import type { RollupDynamicImportVarsOptions } from 'types/dynamicImportVars' import type { Logger } from './logger' import type { TransformOptions } from 'esbuild' @@ -285,7 +284,6 @@ export function resolveBuildPlugins(config: ResolvedConfig): { watchPackageDataPlugin(config), commonjsPlugin(options.commonjsOptions), dataURIPlugin(), - dynamicImportVars(options.dynamicImportVarsOptions), assetImportMetaUrlPlugin(config), ...(options.rollupOptions.plugins ? (options.rollupOptions.plugins.filter(Boolean) as Plugin[]) diff --git a/packages/vite/src/node/plugins/dynamicImportVars.ts b/packages/vite/src/node/plugins/dynamicImportVars.ts new file mode 100644 index 00000000000000..c33590cf0343f4 --- /dev/null +++ b/packages/vite/src/node/plugins/dynamicImportVars.ts @@ -0,0 +1,217 @@ +import { posix } from 'path' +import MagicString from 'magic-string' +import { init, parse as parseImports } from 'es-module-lexer' +import type { ImportSpecifier } from 'es-module-lexer' +import type { Plugin } from '../plugin' +import type { ResolvedConfig } from '../config' +import { normalizePath, parseRequest, requestQuerySplitRE } from '../utils' +import { parse as parseJS } from 'acorn' +import { createFilter } from '@rollup/pluginutils' +import { dynamicImportToGlob } from '@rollup/plugin-dynamic-import-vars' + +export const dynamicImportHelperId = '/@vite/dynamic-import-helper' + +interface DynamicImportRequest { + as?: 'raw' +} + +interface DynamicImportPattern { + globParams: DynamicImportRequest | null + userPattern: string + rawPattern: string +} + +const dynamicImportHelper = (glob: Record, path: string) => { + const v = glob[path] + if (v) { + return typeof v === 'function' ? v() : Promise.resolve(v) + } + return new Promise((_, reject) => { + ;(typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)( + reject.bind(null, new Error('Unknown variable dynamic import: ' + path)) + ) + }) +} + +function parseDynamicImportPattern( + strings: string +): DynamicImportPattern | null { + const filename = strings.slice(1, -1) + const rawQuery = parseRequest(filename) + let globParams: DynamicImportRequest | null = null + const ast = ( + parseJS(strings, { + ecmaVersion: 'latest', + sourceType: 'module' + }) as any + ).body[0].expression + + const userPatternQuery = dynamicImportToGlob(ast, filename) + if (!userPatternQuery) { + return null + } + + const [userPattern] = userPatternQuery.split(requestQuerySplitRE, 2) + const [rawPattern] = filename.split(requestQuerySplitRE, 2) + + if (rawQuery?.raw !== undefined) { + globParams = { as: 'raw' } + } + + return { + globParams, + userPattern, + rawPattern + } +} + +export async function transformDynamicImport( + importSource: string, + importer: string, + resolve: ( + url: string, + importer?: string + ) => Promise | string | undefined +): Promise<{ + glob: string + pattern: string + rawPattern: string +} | null> { + if (importSource[1] !== '.' && importSource[1] !== '/') { + const resolvedFileName = await resolve(importSource.slice(1, -1), importer) + if (!resolvedFileName) { + return null + } + const relativeFileName = posix.relative( + posix.dirname(normalizePath(importer)), + normalizePath(resolvedFileName) + ) + importSource = normalizePath( + '`' + (relativeFileName[0] === '.' ? '' : './') + relativeFileName + '`' + ) + } + + const dynamicImportPattern = parseDynamicImportPattern(importSource) + if (!dynamicImportPattern) { + return null + } + const { globParams, rawPattern, userPattern } = dynamicImportPattern + const params = globParams + ? `, ${JSON.stringify({ ...globParams, import: '*' })}` + : '' + const exp = `(import.meta.glob(${JSON.stringify(userPattern)}${params}))` + + return { + rawPattern, + pattern: userPattern, + glob: exp + } +} + +export function dynamicImportVarsPlugin(config: ResolvedConfig): Plugin { + const resolve = config.createResolver({ + preferRelative: true, + tryIndex: false, + extensions: [] + }) + const { include, exclude, warnOnError } = + config.build.dynamicImportVarsOptions + const filter = createFilter(include, exclude) + const isBuild = config.command === 'build' + return { + name: 'vite:dynamic-import-vars', + + resolveId(id) { + if (id === dynamicImportHelperId) { + return id + } + }, + + load(id) { + if (id === dynamicImportHelperId) { + return 'export default ' + dynamicImportHelper.toString() + } + }, + + async transform(source, importer) { + if (!filter(importer)) { + return + } + + await init + + let imports: readonly ImportSpecifier[] = [] + try { + imports = parseImports(source)[0] + } catch (e: any) { + // ignore as it might not be a JS file, the subsequent plugins will catch the error + return null + } + + if (!imports.length) { + return null + } + + let s: MagicString | undefined + let needDynamicImportHelper = false + + for (let index = 0; index < imports.length; index++) { + const { + s: start, + e: end, + ss: expStart, + se: expEnd, + d: dynamicIndex + } = imports[index] + + if (dynamicIndex === -1 || source[start] !== '`') { + continue + } + + s ||= new MagicString(source) + let result + try { + result = await transformDynamicImport( + source.slice(start, end), + importer, + resolve + ) + } catch (error) { + if (warnOnError) { + this.warn(error) + } else { + this.error(error) + } + } + + if (!result) { + continue + } + + const { rawPattern, glob } = result + + needDynamicImportHelper = true + s.overwrite( + expStart, + expEnd, + `__variableDynamicImportRuntimeHelper(${glob}, \`${rawPattern}\`)` + ) + } + + if (s) { + if (needDynamicImportHelper) { + s.prepend( + `import __variableDynamicImportRuntimeHelper from "${dynamicImportHelperId}";` + ) + } + return { + code: s.toString(), + map: + !isBuild || config.build.sourcemap + ? s.generateMap({ hires: true }) + : null + } + } + } + } +} diff --git a/packages/vite/src/node/plugins/importAnalysis.ts b/packages/vite/src/node/plugins/importAnalysis.ts index ed4a2bc934ab5a..f12426aa923cfe 100644 --- a/packages/vite/src/node/plugins/importAnalysis.ts +++ b/packages/vite/src/node/plugins/importAnalysis.ts @@ -490,7 +490,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin { const url = rawUrl .replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '') .trim() - if (!hasViteIgnore && !isSupportedDynamicImport(url)) { + if (!hasViteIgnore) { this.warn( `\n` + colors.cyan(importerModule.file) + @@ -651,27 +651,6 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin { } } -/** - * https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations - * This is probably less accurate but is much cheaper than a full AST parse. - */ -function isSupportedDynamicImport(url: string) { - url = url.trim().slice(1, -1) - // must be relative - if (!url.startsWith('./') && !url.startsWith('../')) { - return false - } - // must have extension - if (!path.extname(url)) { - return false - } - // must be more specific if importing from same dir - if (url.startsWith('./${') && url.indexOf('/') === url.lastIndexOf('/')) { - return false - } - return true -} - type ImportNameSpecifier = { importedName: string; localName: string } /** diff --git a/packages/vite/src/node/plugins/importMetaGlob.ts b/packages/vite/src/node/plugins/importMetaGlob.ts index 5bf4d14a4dc9f0..ed46e35bea8ecf 100644 --- a/packages/vite/src/node/plugins/importMetaGlob.ts +++ b/packages/vite/src/node/plugins/importMetaGlob.ts @@ -11,7 +11,7 @@ import type { ViteDevServer } from '../server' import type { ModuleNode } from '../server/moduleGraph' import type { ResolvedConfig } from '../config' import { isCSSRequest } from './css' -import type { GeneralImportGlobOptions } from '../../../types/importGlob' +import type { GeneralImportGlobOptions } from 'types/importGlob' import { normalizePath, slash } from '../utils' export interface ParsedImportGlob { @@ -168,12 +168,13 @@ export async function parseImportGlob( for (const property of arg2.properties) { if ( property.type === 'SpreadElement' || - property.key.type !== 'Identifier' + (property.key.type !== 'Identifier' && + property.key.type !== 'Literal') ) throw err('Could only use literals') - const name = property.key.name as keyof GeneralImportGlobOptions - + const name = ((property.key as any).name || + (property.key as any).value) as keyof GeneralImportGlobOptions if (name === 'query') { if (property.value.type === 'ObjectExpression') { const data: Record = {} @@ -260,13 +261,22 @@ const importPrefix = '__vite_glob_' const { basename, dirname, relative, join } = posix +export interface TransformGlobImportResult { + s: MagicString + matches: ParsedImportGlob[] + files: Set +} + +/** + * @param optimizeExport for dynamicImportVar plugin don't need to optimize export. + */ export async function transformGlobImport( code: string, id: string, root: string, resolveId: IdResolver, restoreQueryExtension = false -) { +): Promise { id = slash(id) root = slash(root) const isVirtual = isVirtualModule(id) @@ -288,7 +298,7 @@ export async function transformGlobImport( } }) - if (!matches.length) return + if (!matches.length) return null const s = new MagicString(code) diff --git a/packages/vite/src/node/plugins/index.ts b/packages/vite/src/node/plugins/index.ts index 26d777cf919292..3fd283b07b4e47 100644 --- a/packages/vite/src/node/plugins/index.ts +++ b/packages/vite/src/node/plugins/index.ts @@ -19,6 +19,7 @@ import { ssrRequireHookPlugin } from './ssrRequireHook' import { workerImportMetaUrlPlugin } from './workerImportMetaUrl' import { ensureWatchPlugin } from './ensureWatch' import { metadataPlugin } from './metadata' +import { dynamicImportVarsPlugin } from './dynamicImportVars' import { importGlobPlugin } from './importMetaGlob' export async function resolvePlugins( @@ -73,6 +74,7 @@ export async function resolvePlugins( isBuild && buildHtmlPlugin(config), workerImportMetaUrlPlugin(config), ...buildPlugins.pre, + dynamicImportVarsPlugin(config), importGlobPlugin(config), ...postPlugins, ...buildPlugins.post, diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 0c25b4592adf6d..d84b474b87c33f 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -19,7 +19,7 @@ import type { FSWatcher } from 'chokidar' import remapping from '@ampproject/remapping' import type { DecodedSourceMap, RawSourceMap } from '@ampproject/remapping' import { performance } from 'perf_hooks' -import { parse as parseUrl, URLSearchParams } from 'url' +import { URLSearchParams } from 'url' export function slash(p: string): string { return p.replace(/\\/g, '/') @@ -741,6 +741,7 @@ export function toUpperCaseDriveLetter(pathName: string): string { export const multilineCommentsRE = /\/\*(.|[\r\n])*?\*\//gm export const singlelineCommentsRE = /\/\/.*/g +export const requestQuerySplitRE = /\?(?!.*[\/|\}])/ export const usingDynamicImport = typeof jest === 'undefined' /** @@ -757,11 +758,11 @@ export const dynamicImport = usingDynamicImport : require export function parseRequest(id: string): Record | null { - const { search } = parseUrl(id) + const [_, search] = id.split(requestQuerySplitRE, 2) if (!search) { return null } - return Object.fromEntries(new URLSearchParams(search.slice(1))) + return Object.fromEntries(new URLSearchParams(search)) } export const blankReplacer = (match: string) => ' '.repeat(match.length) diff --git a/packages/vite/types/shims.d.ts b/packages/vite/types/shims.d.ts index 0f49e9c2181e98..587b3344e6ce39 100644 --- a/packages/vite/types/shims.d.ts +++ b/packages/vite/types/shims.d.ts @@ -59,6 +59,7 @@ declare module 'postcss-modules' { declare module '@rollup/plugin-dynamic-import-vars' { import type { Plugin } from 'rollup' + import type { BaseNode } from 'estree' interface Options { include?: string | RegExp | (string | RegExp)[] @@ -68,6 +69,10 @@ declare module '@rollup/plugin-dynamic-import-vars' { const p: (o?: Options) => Plugin export default p + export function dynamicImportToGlob( + ast: BaseNode, + source: string + ): null | string } declare module 'rollup-plugin-web-worker-loader' { diff --git a/playground/dynamic-import/__tests__/dynamic-import.spec.ts b/playground/dynamic-import/__tests__/dynamic-import.spec.ts index 4730b5e990a1c3..95101a039e50f8 100644 --- a/playground/dynamic-import/__tests__/dynamic-import.spec.ts +++ b/playground/dynamic-import/__tests__/dynamic-import.spec.ts @@ -60,6 +60,30 @@ test('should load dynamic import with css', async () => { ) }) +test('should load dynamic import with vars', async () => { + await untilUpdated( + () => page.textContent('.dynamic-import-with-vars'), + 'hello', + true + ) +}) + +test('should load dynamic import with vars alias', async () => { + await untilUpdated( + () => page.textContent('.dynamic-import-with-vars-alias'), + 'hello', + true + ) +}) + +test('should load dynamic import with vars raw', async () => { + await untilUpdated( + () => page.textContent('.dynamic-import-with-vars-raw'), + 'export function hello()', + true + ) +}) + test('should load dynamic import with css in package', async () => { await page.click('.pkg-css') await untilUpdated(() => getColor('.pkg-css'), 'blue', true) diff --git a/playground/dynamic-import/alias/hello.js b/playground/dynamic-import/alias/hello.js new file mode 100644 index 00000000000000..67900ef0999962 --- /dev/null +++ b/playground/dynamic-import/alias/hello.js @@ -0,0 +1,3 @@ +export function hello() { + return 'hello' +} diff --git a/playground/dynamic-import/alias/hi.js b/playground/dynamic-import/alias/hi.js new file mode 100644 index 00000000000000..45d3506803b2b6 --- /dev/null +++ b/playground/dynamic-import/alias/hi.js @@ -0,0 +1,3 @@ +export function hi() { + return 'hi' +} diff --git a/playground/dynamic-import/index.html b/playground/dynamic-import/index.html index 8e18204a7e4296..997ad059ad6821 100644 --- a/playground/dynamic-import/index.html +++ b/playground/dynamic-import/index.html @@ -10,6 +10,20 @@ +

dynamic-import-with-vars

+
todo
+ +

dynamic-import-with-vars-alias

+
todo
+ +

dynamic-import-with-vars-raw

+
todo
+
+ diff --git a/playground/dynamic-import/nested/hello.js b/playground/dynamic-import/nested/hello.js new file mode 100644 index 00000000000000..67900ef0999962 --- /dev/null +++ b/playground/dynamic-import/nested/hello.js @@ -0,0 +1,3 @@ +export function hello() { + return 'hello' +} diff --git a/playground/dynamic-import/nested/index.js b/playground/dynamic-import/nested/index.js index f84ec00380d604..61f817ce7dd7bc 100644 --- a/playground/dynamic-import/nested/index.js +++ b/playground/dynamic-import/nested/index.js @@ -78,3 +78,17 @@ document.querySelector('.pkg-css').addEventListener('click', async () => { function text(el, text) { document.querySelector(el).textContent = text } + +const base = 'hello' + +import(`../alias/${base}.js`).then((mod) => { + text('.dynamic-import-with-vars', mod.hello()) +}) + +import(`@/${base}.js`).then((mod) => { + text('.dynamic-import-with-vars-alias', mod.hello()) +}) + +import(`../alias/${base}.js?raw`).then((mod) => { + text('.dynamic-import-with-vars-raw', JSON.stringify(mod)) +}) diff --git a/playground/dynamic-import/vite.config.js b/playground/dynamic-import/vite.config.js index 010e47d6308d30..50b90639fddd7f 100644 --- a/playground/dynamic-import/vite.config.js +++ b/playground/dynamic-import/vite.config.js @@ -1,7 +1,8 @@ const fs = require('fs') const path = require('path') +const vite = require('vite') -module.exports = { +module.exports = vite.defineConfig({ plugins: [ { name: 'copy', @@ -20,5 +21,10 @@ module.exports = { ) } } - ] -} + ], + resolve: { + alias: { + '@': path.resolve(__dirname, 'alias') + } + } +}) From 780b4f5cdf02adb4ce42c283b60a4d4bb06b8440 Mon Sep 17 00:00:00 2001 From: shir0u <85612853+shir0u@users.noreply.github.com> Date: Tue, 10 May 2022 20:06:29 +1000 Subject: [PATCH 0681/1287] fix: allow css to be written for systemjs output (#5902) Co-authored-by: patak-dev --- packages/vite/src/node/plugins/css.ts | 8 +++- playground/legacy/__tests__/legacy.spec.ts | 11 ++++++ playground/legacy/dynamic.css | 3 ++ playground/legacy/index.html | 2 + playground/legacy/main.js | 8 ++++ playground/legacy/package.json | 1 + playground/legacy/vite.config-dynamic-css.js | 39 ++++++++++++++++++++ 7 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 playground/legacy/dynamic.css create mode 100644 playground/legacy/vite.config-dynamic-css.js diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index c13a4c83052639..1e1bcef686ea42 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -452,7 +452,11 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { // this is a shared CSS-only chunk that is empty. pureCssChunks.add(chunk.fileName) } - if (opts.format === 'es' || opts.format === 'cjs') { + if ( + opts.format === 'es' || + opts.format === 'cjs' || + opts.format === 'system' + ) { chunkCSS = await processChunkCSS(chunkCSS, { inlined: false, minify: true @@ -513,7 +517,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { .join('|') .replace(/\./g, '\\.') const emptyChunkRE = new RegExp( - opts.format === 'es' + opts.format === 'es' || opts.format === 'system' ? `\\bimport\\s*"[^"]*(?:${emptyChunkFiles})";\n?` : `\\brequire\\(\\s*"[^"]*(?:${emptyChunkFiles})"\\);\n?`, 'g' diff --git a/playground/legacy/__tests__/legacy.spec.ts b/playground/legacy/__tests__/legacy.spec.ts index 89cbadcacb2fd8..9fd3419337568d 100644 --- a/playground/legacy/__tests__/legacy.spec.ts +++ b/playground/legacy/__tests__/legacy.spec.ts @@ -56,6 +56,17 @@ test('correctly emits styles', async () => { expect(await getColor('#app')).toBe('red') }) +// dynamic import css +test('should load dynamic import with css', async () => { + await page.click('#dynamic-css-button') + await untilUpdated( + () => + page.$eval('#dynamic-css', (node) => window.getComputedStyle(node).color), + 'rgb(255, 0, 0)', + true + ) +}) + if (isBuild) { test('should generate correct manifest', async () => { const manifest = readManifest() diff --git a/playground/legacy/dynamic.css b/playground/legacy/dynamic.css new file mode 100644 index 00000000000000..160ee45a8a850a --- /dev/null +++ b/playground/legacy/dynamic.css @@ -0,0 +1,3 @@ +#dynamic-css { + color: red; +} diff --git a/playground/legacy/index.html b/playground/legacy/index.html index d481766463cd4f..cbf6242fad756b 100644 --- a/playground/legacy/index.html +++ b/playground/legacy/index.html @@ -4,4 +4,6 @@

+ +
diff --git a/playground/legacy/main.js b/playground/legacy/main.js index 31579b4717810d..157b6c8448e9c3 100644 --- a/playground/legacy/main.js +++ b/playground/legacy/main.js @@ -42,6 +42,14 @@ import('./immutable-chunk.js') text('#assets', assets.join('\n')) }) +// dynamic css +document + .querySelector('#dynamic-css-button') + .addEventListener('click', async () => { + await import('./dynamic.css') + text('#dynamic-css', 'dynamic import css') + }) + function text(el, text) { document.querySelector(el).textContent = text } diff --git a/playground/legacy/package.json b/playground/legacy/package.json index f8803564f93f12..4f11c234573f40 100644 --- a/playground/legacy/package.json +++ b/playground/legacy/package.json @@ -6,6 +6,7 @@ "dev": "vite", "build": "vite build --debug legacy", "build:custom-filename": "vite --config ./vite.config-custom-filename.js build --debug legacy", + "build:dynamic-css": "vite --config ./vite.config-dynamic-css.js build --debug legacy", "debug": "node --inspect-brk ../../packages/vite/bin/vite", "preview": "vite preview" }, diff --git a/playground/legacy/vite.config-dynamic-css.js b/playground/legacy/vite.config-dynamic-css.js new file mode 100644 index 00000000000000..10565768ac4d49 --- /dev/null +++ b/playground/legacy/vite.config-dynamic-css.js @@ -0,0 +1,39 @@ +const fs = require('fs') +const path = require('path') +const legacy = require('@vitejs/plugin-legacy').default + +module.exports = { + plugins: [ + legacy({ + targets: 'IE 11' + }) + ], + + build: { + cssCodeSplit: true, + manifest: true, + rollupOptions: { + output: { + chunkFileNames(chunkInfo) { + if (chunkInfo.name === 'immutable-chunk') { + return `assets/${chunkInfo.name}.js` + } + + return `assets/chunk-[name].[hash].js` + } + } + } + }, + + // special test only hook + // for tests, remove ` diff --git a/packages/playground/json/server.js b/packages/playground/json/server.js new file mode 100644 index 00000000000000..d7803b94f4b81a --- /dev/null +++ b/packages/playground/json/server.js @@ -0,0 +1,88 @@ +// @ts-check +const fs = require('fs') +const path = require('path') +const express = require('express') + +const isTest = process.env.NODE_ENV === 'test' || !!process.env.VITE_TEST_BUILD + +async function createServer( + root = process.cwd(), + isProd = process.env.NODE_ENV === 'production' +) { + const resolve = (p) => path.resolve(__dirname, p) + const app = express() + + /** + * @type {import('vite').ViteDevServer} + */ + let vite + vite = await require('vite').createServer({ + root, + logLevel: isTest ? 'error' : 'info', + server: { + middlewareMode: 'ssr', + watch: { + // During tests we edit the files too fast and sometimes chokidar + // misses change events, so enforce polling for consistency + usePolling: true, + interval: 100 + } + }, + json: { + stringify: true + } + }) + // use vite's connect instance as middleware + app.use(vite.middlewares) + + app.use('*', async (req, res) => { + try { + let [url] = req.originalUrl.split('?') + if (url.endsWith('/')) url += 'index.ssr.html' + + if (url === '/json-module') { + console.time('load module') + const json = JSON.stringify(await vite.ssrLoadModule('/test.json')) + console.timeEnd('load module') + res.status(200).end('' + json.length) + return + } + + if (url === '/json-fs') { + console.time('transform module') + const source = fs.readFileSync('./test.json', { encoding: 'utf-8' }) + const json = await vite.ssrTransform( + `export default ${source}`, + null, + './output.json' + ) + console.timeEnd('transform module') + res.status(200).end(String(json.code.length)) + return + } + + const htmlLoc = resolve(`.${url}`) + let html = fs.readFileSync(htmlLoc, 'utf8') + html = await vite.transformIndexHtml(url, html) + + res.status(200).set({ 'Content-Type': 'text/html' }).end(html) + } catch (e) { + vite && vite.ssrFixStacktrace(e) + console.log(e.stack) + res.status(500).end(e.stack) + } + }) + + return { app, vite } +} + +if (!isTest) { + createServer().then(({ app }) => + app.listen(3000, () => { + console.log('http://localhost:3000') + }) + ) +} + +// for test use +exports.createServer = createServer diff --git a/packages/vite/src/node/plugins/json.ts b/packages/vite/src/node/plugins/json.ts index f8419c40f36174..9c142501ff651e 100644 --- a/packages/vite/src/node/plugins/json.ts +++ b/packages/vite/src/node/plugins/json.ts @@ -7,8 +7,8 @@ */ import { dataToEsm } from '@rollup/pluginutils' -import type { Plugin } from 'rollup' import { SPECIAL_QUERY_RE } from '../constants' +import type { Plugin } from '../plugin' export interface JsonOptions { /** @@ -27,6 +27,11 @@ export interface JsonOptions { // Custom json filter for vite const jsonExtRE = /\.json($|\?)(?!commonjs-(proxy|external))/ +const jsonLangs = `\\.(json|json5)($|\\?)` +const jsonLangRE = new RegExp(jsonLangs) +export const isJSONRequest = (request: string): boolean => + jsonLangRE.test(request) + export function jsonPlugin( options: JsonOptions = {}, isBuild: boolean diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index 0b499b42c2d457..50ca05e17a748e 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -321,7 +321,11 @@ export async function createServer( pluginContainer: container, ws, moduleGraph, - ssrTransform, + ssrTransform(code: string, inMap: SourceMap | null, url: string) { + return ssrTransform(code, inMap, url, { + json: { stringify: server.config.json?.stringify } + }) + }, transformRequest(url, options) { return transformRequest(url, server, options) }, diff --git a/packages/vite/src/node/server/transformRequest.ts b/packages/vite/src/node/server/transformRequest.ts index baafe95e8416f3..f877925f491479 100644 --- a/packages/vite/src/node/server/transformRequest.ts +++ b/packages/vite/src/node/server/transformRequest.ts @@ -238,7 +238,9 @@ async function doTransform( } const result = ssr - ? await ssrTransform(code, map as SourceMap, url) + ? await ssrTransform(code, map as SourceMap, url, { + json: { stringify: !!server.config.json?.stringify } + }) : ({ code, map, diff --git a/packages/vite/src/node/ssr/ssrModuleLoader.ts b/packages/vite/src/node/ssr/ssrModuleLoader.ts index 8b3a423f58aeab..9f75641c84e513 100644 --- a/packages/vite/src/node/ssr/ssrModuleLoader.ts +++ b/packages/vite/src/node/ssr/ssrModuleLoader.ts @@ -84,7 +84,6 @@ async function instantiateModule( if (mod.ssrModule) { return mod.ssrModule } - const result = mod.ssrTransformResult || (await transformRequest(url, server, { ssr: true })) diff --git a/packages/vite/src/node/ssr/ssrTransform.ts b/packages/vite/src/node/ssr/ssrTransform.ts index c1aa572864776a..4eeb34ad7e102c 100644 --- a/packages/vite/src/node/ssr/ssrTransform.ts +++ b/packages/vite/src/node/ssr/ssrTransform.ts @@ -12,6 +12,7 @@ import type { import { extract_names as extractNames } from 'periscopic' import { walk as eswalk } from 'estree-walker' import { combineSourcemaps } from '../utils' +import { isJSONRequest } from '../plugins/json' import type { RawSourceMap } from '@ampproject/remapping' type Node = _Node & { @@ -19,6 +20,12 @@ type Node = _Node & { end: number } +interface TransformOptions { + json?: { + stringify?: boolean + } +} + export const ssrModuleExportsKey = `__vite_ssr_exports__` export const ssrImportKey = `__vite_ssr_import__` export const ssrDynamicImportKey = `__vite_ssr_dynamic_import__` @@ -26,6 +33,30 @@ export const ssrExportAllKey = `__vite_ssr_exportAll__` export const ssrImportMetaKey = `__vite_ssr_import_meta__` export async function ssrTransform( + code: string, + inMap: SourceMap | null, + url: string, + options?: TransformOptions +): Promise { + if (options?.json?.stringify && isJSONRequest(url)) { + return ssrTransformJSON(code, inMap) + } + return ssrTransformScript(code, inMap, url) +} + +async function ssrTransformJSON( + code: string, + inMap: SourceMap | null +): Promise { + return { + code: code.replace('export default', `${ssrModuleExportsKey}.default =`), + map: inMap, + deps: [], + dynamicDeps: [] + } +} + +async function ssrTransformScript( code: string, inMap: SourceMap | null, url: string diff --git a/playground/json/package.json b/playground/json/package.json index a32140c1220d1a..b919c42eb6ef5d 100644 --- a/playground/json/package.json +++ b/playground/json/package.json @@ -6,9 +6,14 @@ "dev": "vite", "build": "vite build", "debug": "node --inspect-brk ../../packages/vite/bin/vite", - "preview": "vite preview" + "preview": "vite preview", + "dev:ssr": "node server", + "serve:ssr": "cross-env NODE_ENV=production node server", + "debug:ssr": "node --inspect-brk server" }, "devDependencies": { + "cross-env": "^7.0.3", + "express": "^4.17.1", "json-module": "file:./json-module", "vue": "^3.2.33" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 655b3273279f9e..1a06a82b104080 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -458,9 +458,13 @@ importers: playground/json: specifiers: + cross-env: ^7.0.3 + express: ^4.17.1 json-module: file:./json-module vue: ^3.2.33 devDependencies: + cross-env: 7.0.3 + express: 4.18.1 json-module: link:json-module vue: 3.2.33 From 4abfee61e9e93a7af908adad87cd0cb9d15938ad Mon Sep 17 00:00:00 2001 From: zz <2418184580@qq.com> Date: Tue, 10 May 2022 22:23:20 +0800 Subject: [PATCH 0687/1287] ci: remove unnecessary actions (#7799) --- .github/workflows/publish.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c58c28adac7b40..72a6ffde2cb62c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -32,14 +32,6 @@ jobs: - name: Install deps run: pnpm install - - name: Creating .npmrc - run: | - cat << EOF > "$HOME/.npmrc" - //registry.npmjs.org/:_authToken=$NPM_TOKEN - EOF - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Publish package run: pnpm run ci-publish -- ${{ github.ref_name }} env: From ae56e4778f4d5adc29341d93557aa02e40e70a89 Mon Sep 17 00:00:00 2001 From: Nick Santos Date: Tue, 10 May 2022 10:51:21 -0400 Subject: [PATCH 0688/1287] fix(client): wait on the socket host, not the ping host (#6819) --- packages/vite/src/client/client.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/vite/src/client/client.ts b/packages/vite/src/client/client.ts index 48917204d8c291..6a7f9b27c3a700 100644 --- a/packages/vite/src/client/client.ts +++ b/packages/vite/src/client/client.ts @@ -201,12 +201,10 @@ async function waitForSuccessfulPing(ms = 1000) { // eslint-disable-next-line no-constant-condition while (true) { try { - const pingResponse = await fetch(`${base}__vite_ping`) - - // success - 2xx status code - if (pingResponse.ok) break - // failure - non-2xx status code - else throw new Error() + // A fetch on a websocket URL will return a successful promise with status 400, + // but will reject a networking error. + await fetch(`${location.protocol}//${socketHost}`) + break } catch (e) { // wait ms before attempting to ping again await new Promise((resolve) => setTimeout(resolve, ms)) From b2c029a086de135bbb04bbe0e35c0a3b4526900e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Livora?= Date: Tue, 10 May 2022 17:04:09 +0200 Subject: [PATCH 0689/1287] docs: mention middlewares in server.proxy config (#5188) --- docs/config/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/config/index.md b/docs/config/index.md index 666f5f39a5511c..8fc772f345e0ea 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -519,6 +519,8 @@ export default defineConfig(({ command, mode }) => { Uses [`http-proxy`](https://github.com/http-party/node-http-proxy). Full options [here](https://github.com/http-party/node-http-proxy#options). + In some cases, you might also want to configure the underlying dev server (e.g. to add custom middlewares to the internal [connect](https://github.com/senchalabs/connect) app). In order to do that, you need to write your own [plugin](/guide/using-plugins.html) and use [configureServer](/guide/api-plugin.html#configureserver) function. + **Example:** ```js From 1be4646ac1a3912c4e4b90c04176ee613e48ede8 Mon Sep 17 00:00:00 2001 From: Zehua Chen Date: Tue, 10 May 2022 12:45:55 -0400 Subject: [PATCH 0690/1287] docs: improve instruction for backend integration, close #7778 (#8103) Co-authored-by: Enzo Innocenzi --- docs/guide/backend-integration.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/guide/backend-integration.md b/docs/guide/backend-integration.md index 55a4b87f1ac481..17387bb7819ec0 100644 --- a/docs/guide/backend-integration.md +++ b/docs/guide/backend-integration.md @@ -36,7 +36,12 @@ If you need a custom integration, you can follow the steps in this guide to conf ``` - Also make sure the server is configured to serve static assets in the Vite working directory, otherwise assets such as images won't be loaded properly. + In order to properly serve assets, you have two options: + + - Make sure the server is configured to proxy static assets requests to the Vite server + - Set [`server.origin`](https://vitejs.dev/config/#server-origin) so that generated asset URLs will be resolved using the back-end server URL instead of a relative path + + This is needed for assets such as images to load properly. Note if you are using React with `@vitejs/plugin-react`, you'll also need to add this before the above scripts, since the plugin is not able to modify the HTML you are serving: From 5484c8ce02cc8847ff9e85ba60b482ca170ae867 Mon Sep 17 00:00:00 2001 From: ZxBing0066 Date: Wed, 11 May 2022 00:53:17 +0800 Subject: [PATCH 0691/1287] chore: remove noop watch close (#6294) --- packages/vite/src/node/build.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index 1bdfa5a35077e6..cc254521b8d2aa 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -499,9 +499,6 @@ async function doBuild( } }) - // stop watching - watcher.close() - return watcher } From bb603d3d66506deb353e4d6346d5e8361fdb9e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Mel=C3=A9n?= Date: Wed, 11 May 2022 01:26:46 +0200 Subject: [PATCH 0692/1287] fix(glob): wrap glob compile output in function invocation (#3682) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tobias Melén Co-authored-by: patak-dev --- .../glob-import/side-effect/writetodom.js | 4 + .../__snapshots__/fixture.test.ts.snap | 120 +++++++++--------- .../vite/src/node/plugins/importMetaGlob.ts | 2 +- .../glob-import/__tests__/glob-import.spec.ts | 27 +++- playground/glob-import/index.html | 9 ++ .../glob-import/side-effect/writedom.js | 4 + 6 files changed, 98 insertions(+), 68 deletions(-) create mode 100644 packages/playground/glob-import/side-effect/writetodom.js create mode 100644 playground/glob-import/side-effect/writedom.js diff --git a/packages/playground/glob-import/side-effect/writetodom.js b/packages/playground/glob-import/side-effect/writetodom.js new file mode 100644 index 00000000000000..e2ab04ba7f5cbe --- /dev/null +++ b/packages/playground/glob-import/side-effect/writetodom.js @@ -0,0 +1,4 @@ +/* global document */ +document && + (document.querySelector('.side-effect-result').textContent = + 'Hello from side effect') diff --git a/packages/vite/src/node/__tests__/plugins/importGlob/__snapshots__/fixture.test.ts.snap b/packages/vite/src/node/__tests__/plugins/importGlob/__snapshots__/fixture.test.ts.snap index 23e511a50545f7..61ff6eeb4d2fc7 100644 --- a/packages/vite/src/node/__tests__/plugins/importGlob/__snapshots__/fixture.test.ts.snap +++ b/packages/vite/src/node/__tests__/plugins/importGlob/__snapshots__/fixture.test.ts.snap @@ -10,67 +10,67 @@ import { name as __vite_glob_3_2 } from \\"./modules/index.ts\\" import { default as __vite_glob_5_0 } from \\"./modules/a.ts?raw\\" import { default as __vite_glob_5_1 } from \\"./modules/b.ts?raw\\" import \\"../../../../../../types/importMeta\\"; -export const basic = { +export const basic = Object.assign({ \\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), \\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), \\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\") -}; -export const basicEager = { +}); +export const basicEager = Object.assign({ \\"./modules/a.ts\\": __vite_glob_1_0, \\"./modules/b.ts\\": __vite_glob_1_1, \\"./modules/index.ts\\": __vite_glob_1_2 -}; -export const ignore = { +}); +export const ignore = Object.assign({ \\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), \\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\") -}; -export const namedEager = { +}); +export const namedEager = Object.assign({ \\"./modules/a.ts\\": __vite_glob_3_0, \\"./modules/b.ts\\": __vite_glob_3_1, \\"./modules/index.ts\\": __vite_glob_3_2 -}; -export const namedDefault = { +}); +export const namedDefault = Object.assign({ \\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\").then(m => m[\\"default\\"]), \\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\").then(m => m[\\"default\\"]), \\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\").then(m => m[\\"default\\"]) -}; -export const eagerAs = { +}); +export const eagerAs = Object.assign({ \\"./modules/a.ts\\": __vite_glob_5_0, \\"./modules/b.ts\\": __vite_glob_5_1 -}; -export const rawImportModule = { +}); +export const rawImportModule = Object.assign({ \\"./modules/a.ts\\": () => import(\\"./modules/a.ts?raw\\"), \\"./modules/b.ts\\": () => import(\\"./modules/b.ts?raw\\") -}; -export const excludeSelf = { +}); +export const excludeSelf = Object.assign({ \\"./sibling.ts\\": () => import(\\"./sibling.ts\\") -}; -export const customQueryString = { +}); +export const customQueryString = Object.assign({ \\"./sibling.ts\\": () => import(\\"./sibling.ts?custom\\") -}; -export const customQueryObject = { +}); +export const customQueryObject = Object.assign({ \\"./sibling.ts\\": () => import(\\"./sibling.ts?foo=bar&raw=true\\") -}; -export const parent = { +}); +export const parent = Object.assign({ -}; -export const rootMixedRelative = { +}); +export const rootMixedRelative = Object.assign({ \\"/css.spec.ts\\": () => import(\\"../../css.spec.ts?url\\").then(m => m[\\"default\\"]), \\"/define.spec.ts\\": () => import(\\"../../define.spec.ts?url\\").then(m => m[\\"default\\"]), \\"/import.spec.ts\\": () => import(\\"../../import.spec.ts?url\\").then(m => m[\\"default\\"]), \\"/importGlob/fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts?url\\").then(m => m[\\"default\\"]), \\"/importGlob/fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts?url\\").then(m => m[\\"default\\"]), \\"/importGlob/fixture-b/index.ts\\": () => import(\\"../fixture-b/index.ts?url\\").then(m => m[\\"default\\"]) -}; -export const cleverCwd1 = { +}); +export const cleverCwd1 = Object.assign({ \\"./node_modules/framework/pages/hello.page.js\\": () => import(\\"./node_modules/framework/pages/hello.page.js\\") -}; -export const cleverCwd2 = { +}); +export const cleverCwd2 = Object.assign({ \\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), \\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), \\"../fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts\\"), \\"../fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts\\") -}; +}); " `; @@ -84,79 +84,79 @@ import { name as __vite_glob_3_2 } from \\"./modules/index.ts\\" import { default as __vite_glob_5_0 } from \\"./modules/a.ts?raw\\" import { default as __vite_glob_5_1 } from \\"./modules/b.ts?raw\\" import \\"../../../../../../types/importMeta\\"; -export const basic = { +export const basic = Object.assign({ \\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), \\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), \\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\") -}; -export const basicEager = { +}); +export const basicEager = Object.assign({ \\"./modules/a.ts\\": __vite_glob_1_0, \\"./modules/b.ts\\": __vite_glob_1_1, \\"./modules/index.ts\\": __vite_glob_1_2 -}; -export const ignore = { +}); +export const ignore = Object.assign({ \\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), \\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\") -}; -export const namedEager = { +}); +export const namedEager = Object.assign({ \\"./modules/a.ts\\": __vite_glob_3_0, \\"./modules/b.ts\\": __vite_glob_3_1, \\"./modules/index.ts\\": __vite_glob_3_2 -}; -export const namedDefault = { +}); +export const namedDefault = Object.assign({ \\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\").then(m => m[\\"default\\"]), \\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\").then(m => m[\\"default\\"]), \\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\").then(m => m[\\"default\\"]) -}; -export const eagerAs = { +}); +export const eagerAs = Object.assign({ \\"./modules/a.ts\\": __vite_glob_5_0, \\"./modules/b.ts\\": __vite_glob_5_1 -}; -export const rawImportModule = { +}); +export const rawImportModule = Object.assign({ \\"./modules/a.ts\\": () => import(\\"./modules/a.ts?raw\\"), \\"./modules/b.ts\\": () => import(\\"./modules/b.ts?raw\\") -}; -export const excludeSelf = { +}); +export const excludeSelf = Object.assign({ \\"./sibling.ts\\": () => import(\\"./sibling.ts\\") -}; -export const customQueryString = { +}); +export const customQueryString = Object.assign({ \\"./sibling.ts\\": () => import(\\"./sibling.ts?custom&lang.ts\\") -}; -export const customQueryObject = { +}); +export const customQueryObject = Object.assign({ \\"./sibling.ts\\": () => import(\\"./sibling.ts?foo=bar&raw=true&lang.ts\\") -}; -export const parent = { +}); +export const parent = Object.assign({ -}; -export const rootMixedRelative = { +}); +export const rootMixedRelative = Object.assign({ \\"/css.spec.ts\\": () => import(\\"../../css.spec.ts?url&lang.ts\\").then(m => m[\\"default\\"]), \\"/define.spec.ts\\": () => import(\\"../../define.spec.ts?url&lang.ts\\").then(m => m[\\"default\\"]), \\"/import.spec.ts\\": () => import(\\"../../import.spec.ts?url&lang.ts\\").then(m => m[\\"default\\"]), \\"/importGlob/fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts?url&lang.ts\\").then(m => m[\\"default\\"]), \\"/importGlob/fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts?url&lang.ts\\").then(m => m[\\"default\\"]), \\"/importGlob/fixture-b/index.ts\\": () => import(\\"../fixture-b/index.ts?url&lang.ts\\").then(m => m[\\"default\\"]) -}; -export const cleverCwd1 = { +}); +export const cleverCwd1 = Object.assign({ \\"./node_modules/framework/pages/hello.page.js\\": () => import(\\"./node_modules/framework/pages/hello.page.js\\") -}; -export const cleverCwd2 = { +}); +export const cleverCwd2 = Object.assign({ \\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), \\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), \\"../fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts\\"), \\"../fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts\\") -}; +}); " `; exports[`fixture > virtual modules 1`] = ` -"{ +"Object.assign({ \\"/modules/a.ts\\": () => import(\\"/modules/a.ts\\"), \\"/modules/b.ts\\": () => import(\\"/modules/b.ts\\"), \\"/modules/index.ts\\": () => import(\\"/modules/index.ts\\") -} -{ +}) +Object.assign({ \\"/../fixture-b/a.ts\\": () => import(\\"/../fixture-b/a.ts\\"), \\"/../fixture-b/b.ts\\": () => import(\\"/../fixture-b/b.ts\\"), \\"/../fixture-b/index.ts\\": () => import(\\"/../fixture-b/index.ts\\") -}" +})" `; diff --git a/packages/vite/src/node/plugins/importMetaGlob.ts b/packages/vite/src/node/plugins/importMetaGlob.ts index ed46e35bea8ecf..140eb6ca6d1273 100644 --- a/packages/vite/src/node/plugins/importMetaGlob.ts +++ b/packages/vite/src/node/plugins/importMetaGlob.ts @@ -398,7 +398,7 @@ export async function transformGlobImport( files.forEach((i) => matchedFiles.add(i)) - const replacement = `{\n${objectProps.join(',\n')}\n}` + const replacement = `Object.assign({\n${objectProps.join(',\n')}\n})` s.overwrite(start, end, replacement) return staticImports diff --git a/playground/glob-import/__tests__/glob-import.spec.ts b/playground/glob-import/__tests__/glob-import.spec.ts index d738ccec1d4c97..8cc5c61d172236 100644 --- a/playground/glob-import/__tests__/glob-import.spec.ts +++ b/playground/glob-import/__tests__/glob-import.spec.ts @@ -31,6 +31,12 @@ const json = isBuild msg: 'baz' } +const globWithAlias = { + '/dir/alias.js': { + default: 'hi' + } +} + const allResult = { // JSON file should be properly transformed '/dir/alias.js': { @@ -40,14 +46,15 @@ const allResult = { '/dir/foo.js': { msg: 'foo' }, - '/dir/index.js': { - globWithAlias: { - '/dir/alias.js': { - default: 'hi' + '/dir/index.js': isBuild + ? { + modules: filteredResult, + globWithAlias } - }, - modules: filteredResult - }, + : { + globWithAlias, + modules: filteredResult + }, '/dir/nested/bar.js': { modules: { '../baz.json': json @@ -93,6 +100,12 @@ test('import relative glob raw', async () => { ) }) +test('unassigned import processes', async () => { + expect(await page.textContent('.side-effect-result')).toBe( + 'Hello from side effect' + ) +}) + if (!isBuild) { test('hmr for adding/removing files', async () => { addFile('dir/a.js', '') diff --git a/playground/glob-import/index.html b/playground/glob-import/index.html index 8466a6d0495881..6cff2aa0965c59 100644 --- a/playground/glob-import/index.html +++ b/playground/glob-import/index.html @@ -2,6 +2,7 @@

 

 

+

 
 
 
+
+
diff --git a/playground/glob-import/side-effect/writedom.js b/playground/glob-import/side-effect/writedom.js
new file mode 100644
index 00000000000000..e2ab04ba7f5cbe
--- /dev/null
+++ b/playground/glob-import/side-effect/writedom.js
@@ -0,0 +1,4 @@
+/* global document */
+document &&
+  (document.querySelector('.side-effect-result').textContent =
+    'Hello from side effect')

From 8148f67f4a78265ca666737b15709c3c7578e370 Mon Sep 17 00:00:00 2001
From: Anthony Fu 
Date: Wed, 11 May 2022 14:33:20 +0800
Subject: [PATCH 0693/1287] test: migrate to vitest (#8076)

---
 .eslintrc.cjs                                 |    9 +-
 .github/workflows/ci.yml                      |    4 +-
 CONTRIBUTING.md                               |   12 +-
 jest.config.ts                                |   24 -
 package.json                                  |   15 +-
 .../src/node/__tests__/plugins/css.spec.ts    |   38 +-
 packages/vite/src/node/server/index.ts        |    2 +-
 packages/vite/src/node/ssr/ssrModuleLoader.ts |    1 +
 packages/vite/src/node/utils.ts               |    2 +
 playground/assets/__tests__/assets.spec.ts    |  100 +-
 .../__tests__/backend-integration.spec.ts     |   47 +-
 .../__tests__/{serve.js => serve.ts}          |   23 +-
 .../cli/__tests__/{serve.js => serve.ts}      |   21 +-
 .../__tests__/css-codesplit.spec.ts           |    4 +-
 .../__tests__/css-codesplit.spec.ts           |    4 +-
 .../css-sourcemap/__tests__/build.spec.ts     |   16 +-
 .../css-sourcemap/__tests__/serve.spec.ts     |   54 +-
 playground/css/__tests__/css.spec.ts          |   12 +-
 .../data-uri/__tests__/data-uri.spec.ts       |   10 +-
 playground/define/__tests__/define.spec.ts    |    1 +
 .../env-nested/__tests__/env-nested.spec.ts   |    2 +-
 playground/env/__tests__/env.spec.ts          |    2 +-
 .../__tests__/file-delete-restore.spec.ts     |   17 +-
 .../fs-serve/__tests__/fs-serve.spec.ts       |  102 +-
 playground/hmr/tsconfig.json                  |    2 +-
 playground/html/__tests__/html.spec.ts        |   56 +-
 .../js-sourcemap/__tests__/build.spec.ts      |   16 +-
 .../js-sourcemap/__tests__/serve.spec.ts      |    8 +-
 playground/legacy/__tests__/legacy.spec.ts    |    4 +-
 .../legacy/__tests__/ssr/legacy-ssr.spec.ts   |    8 +-
 .../__tests__/ssr/{serve.js => serve.ts}      |   15 +-
 playground/lib/__tests__/lib.spec.ts          |   20 +-
 .../lib/__tests__/{serve.js => serve.ts}      |   28 +-
 .../__test__/optimize-missing-deps.spec.ts    |    8 +-
 .../__test__/serve.ts}                        |   15 +-
 playground/preload/__tests__/preload.spec.ts  |    4 +-
 .../{vite.config.js => vite.config.ts}        |    7 +-
 playground/react/__tests__/react.spec.ts      |   41 +-
 .../__tests__/resolve-config.spec.ts          |   10 +-
 .../__tests__/{serve.js => serve.ts}          |   15 +-
 .../ssr-deps/__tests__/{serve.js => serve.ts} |   15 +-
 .../ssr-html/__tests__/{serve.js => serve.ts} |   15 +-
 .../serve.js => ssr-pug/__tests__/serve.ts}   |   15 +-
 .../__tests__/{serve.js => serve.ts}          |   15 +-
 .../ssr-vue/__tests__/{serve.js => serve.ts}  |   15 +-
 playground/ssr-vue/__tests__/ssr-vue.spec.ts  |   30 +-
 .../__tests__/{serve.js => serve.ts}          |   15 +-
 playground/ssr-webworker/worker.js            |    8 +-
 .../__tests__/build.spec.ts                   |   16 +-
 .../__tests__/serve.spec.ts                   |   16 +-
 playground/testUtils.ts                       |   34 +-
 .../tsconfig-json-load-error.spec.ts          |   16 +-
 playground/tsconfig.json                      |    2 +-
 playground/vue-jsx/__tests__/vue-jsx.spec.ts  |    6 +-
 playground/vue-lib/__tests__/serve.js         |    7 -
 playground/vue-lib/__tests__/serve.ts         |    6 +
 .../vue-sourcemap/__tests__/build.spec.ts     |   16 +-
 .../vue-sourcemap/__tests__/serve.spec.ts     |   78 +-
 .../{vite.config.js => vite.config.ts}        |   10 +-
 playground/vue/__tests__/vue.spec.ts          |    8 +-
 .../worker/__tests__/es/es-worker.spec.ts     |    8 +-
 .../worker/__tests__/iife/worker.spec.ts      |    9 +-
 .../sourcemap-hidden-worker.spec.ts           |   19 +-
 .../sourcemap-inline-worker.spec.ts           |   19 +-
 .../sourcemap/sourcemap-worker.spec.ts        |   15 +-
 pnpm-lock.yaml                                | 1653 +----------------
 scripts/jestEnv.cjs                           |   48 -
 scripts/jestGlobalTeardown.cjs                |    9 -
 scripts/tsconfig.json                         |    2 +-
 ...stGlobalSetup.cjs => vitestGlobalSetup.ts} |   30 +-
 .../{jestPerTestSetup.ts => vitestSetup.ts}   |   82 +-
 vitest.config.e2e.ts                          |   21 +
 72 files changed, 714 insertions(+), 2323 deletions(-)
 delete mode 100644 jest.config.ts
 rename playground/cli-module/__tests__/{serve.js => serve.ts} (90%)
 rename playground/cli/__tests__/{serve.js => serve.ts} (91%)
 rename playground/legacy/__tests__/ssr/{serve.js => serve.ts} (72%)
 rename playground/lib/__tests__/{serve.js => serve.ts} (81%)
 rename playground/{ssr-pug/__tests__/serve.js => optimize-missing-deps/__test__/serve.ts} (64%)
 rename playground/preload/{vite.config.js => vite.config.ts} (62%)
 rename playground/resolve-config/__tests__/{serve.js => serve.ts} (71%)
 rename playground/ssr-deps/__tests__/{serve.js => serve.ts} (64%)
 rename playground/ssr-html/__tests__/{serve.js => serve.ts} (64%)
 rename playground/{optimize-missing-deps/__test__/serve.js => ssr-pug/__tests__/serve.ts} (63%)
 rename playground/ssr-react/__tests__/{serve.js => serve.ts} (77%)
 rename playground/ssr-vue/__tests__/{serve.js => serve.ts} (77%)
 rename playground/ssr-webworker/__tests__/{serve.js => serve.ts} (72%)
 delete mode 100644 playground/vue-lib/__tests__/serve.js
 create mode 100644 playground/vue-lib/__tests__/serve.ts
 rename playground/vue-sourcemap/{vite.config.js => vite.config.ts} (62%)
 delete mode 100644 scripts/jestEnv.cjs
 delete mode 100644 scripts/jestGlobalTeardown.cjs
 rename scripts/{jestGlobalSetup.cjs => vitestGlobalSetup.ts} (62%)
 rename scripts/{jestPerTestSetup.ts => vitestSetup.ts} (80%)
 create mode 100644 vitest.config.e2e.ts

diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index beab59a2df5ac9..63a8d282ba9b25 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -29,14 +29,7 @@ module.exports = defineConfig({
     'node/no-missing-import': [
       'error',
       {
-        allowModules: [
-          'types',
-          'estree',
-          'testUtils',
-          'less',
-          'sass',
-          'stylus'
-        ],
+        allowModules: ['types', 'estree', 'less', 'sass', 'stylus'],
         tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts']
       }
     ],
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b1c663db40e80f..ce695749544b39 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -72,10 +72,10 @@ jobs:
         run: pnpm run test-unit
 
       - name: Test serve
-        run: pnpm run test-serve -- --runInBand
+        run: pnpm run test-serve
 
       - name: Test build
-        run: pnpm run test-build -- --runInBand
+        run: pnpm run test-build
 
   lint:
     timeout-minutes: 10
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e620377c75408f..334d3cb8b79e8c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -30,11 +30,11 @@ If you want to use break point and explore code execution you can use the ["Run
 
 5. The execution will stop and you'll use the [Debug toolbar](https://code.visualstudio.com/docs/editor/debugging#_debug-actions) to continue, step over, restart the process...
 
-### Debugging errors in Jest tests using Playwright (Chromium)
+### Debugging errors in Vitest tests using Playwright (Chromium)
 
-Some errors are masked and hidden away because of the layers of abstraction and sandboxed nature added by Jest, Playwright, and Chromium. In order to see what's actually going wrong and the contents of the devtools console in those instances, follow this setup:
+Some errors are masked and hidden away because of the layers of abstraction and sandboxed nature added by Vitest, Playwright, and Chromium. In order to see what's actually going wrong and the contents of the devtools console in those instances, follow this setup:
 
-1. Add a `debugger` statement to the `scripts/jestPerTestSetup.ts` -> `afterAll` hook. This will pause execution before the tests quit and the Playwright browser instance exits.
+1. Add a `debugger` statement to the `scripts/vitestSetup.ts` -> `afterAll` hook. This will pause execution before the tests quit and the Playwright browser instance exits.
 
 1. Run the tests with the `debug-serve` script command which will enable remote debugging: `pnpm run debug-serve -- --runInBand resolve`.
 
@@ -69,7 +69,7 @@ And re-run `pnpm install` to link the package.
 
 ### Integration Tests
 
-Each package under `playground/` contains a `__tests__` directory. The tests are run using [Jest](https://jestjs.io/) + [Playwright](https://playwright.dev/) with custom integrations to make writing tests simple. The detailed setup is inside `jest.config.js` and `scripts/jest*` files.
+Each package under `playground/` contains a `__tests__` directory. The tests are run using [Vitest](https://vitest.dev/) + [Playwright](https://playwright.dev/) with custom integrations to make writing tests simple. The detailed setup is inside `vitest.config.e2e.js` and `scripts/vitest*` files.
 
 Before running the tests, make sure that [Vite has been built](#repo-setup). On Windows, you may want to [activate Developer Mode](https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) to solve [issues with symlink creation for non-admins](https://github.com/vitejs/vite/issues/7390). Also you may want to [set git `core.symlinks` to `true` to solve issues with symlinks in git](https://github.com/vitejs/vite/issues/5242).
 
@@ -77,7 +77,7 @@ Each integration test can be run under either dev server mode or build mode.
 
 - `pnpm test` by default runs every integration test in both serve and build mode, and also unit tests.
 
-- `pnpm run test-serve` runs tests only under serve mode. This is just calling `jest` so you can pass any Jest flags to this command. Since Jest will attempt to run tests in parallel, if your machine has many cores this may cause flaky test failures with multiple Playwright instances running at the same time. You can force the tests to run in series with `pnpm run test-serve -- --runInBand`.
+- `pnpm run test-serve` runs tests only under serve mode.
 
 - `pnpm run test-build` runs tests only under build mode.
 
@@ -105,7 +105,7 @@ test('should work', async () => {
 
 Some common test helpers, e.g. `testDir`, `isBuild` or `editFile` are available in `playground/testUtils.ts`.
 
-Note: The test build environment uses a [different default set of Vite config](https://github.com/vitejs/vite/blob/9c6501d9c363eaa3c1e7708d531fb2a92b633db6/scripts/jestPerTestSetup.ts#L102-L122) to skip transpilation during tests to make it faster. This may produce a different result compared to the default production build.
+Note: The test build environment uses a [different default set of Vite config](https://github.com/vitejs/vite/blob/9c6501d9c363eaa3c1e7708d531fb2a92b633db6/scripts/vitestSetup.ts#L102-L122) to skip transpilation during tests to make it faster. This may produce a different result compared to the default production build.
 
 ### Extending the Test Suite
 
diff --git a/jest.config.ts b/jest.config.ts
deleted file mode 100644
index 719d67f39b8bce..00000000000000
--- a/jest.config.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-// eslint-disable-next-line node/no-extraneous-import
-import type { Config } from '@jest/types'
-
-const config: Config.InitialOptions = {
-  preset: 'ts-jest',
-  testMatch: ['**/playground/**/*.spec.[jt]s?(x)'],
-  testTimeout: process.env.CI ? 50000 : 20000,
-  globalSetup: './scripts/jestGlobalSetup.cjs',
-  globalTeardown: './scripts/jestGlobalTeardown.cjs',
-  testEnvironment: './scripts/jestEnv.cjs',
-  setupFilesAfterEnv: ['./scripts/jestPerTestSetup.ts'],
-  watchPathIgnorePatterns: ['/playground-temp'],
-  modulePathIgnorePatterns: ['/playground-temp'],
-  moduleNameMapper: {
-    testUtils: '/playground/testUtils.ts'
-  },
-  globals: {
-    'ts-jest': {
-      tsconfig: './playground/tsconfig.json'
-    }
-  }
-}
-
-export default config
diff --git a/package.json b/package.json
index 1ba4ca2cec68dc..62a66770cb750a 100644
--- a/package.json
+++ b/package.json
@@ -17,11 +17,11 @@
     "format": "prettier --write .",
     "lint": "eslint packages/*/{src,types}/**",
     "test": "run-s test-unit test-serve test-build",
-    "test-serve": "jest",
-    "test-build": "cross-env VITE_TEST_BUILD=1 jest",
+    "test-serve": "vitest run -c vitest.config.e2e.ts",
+    "test-build": "cross-env VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts",
     "test-unit": "vitest run",
-    "debug-serve": "cross-env VITE_DEBUG_SERVE=1 node --inspect-brk ./node_modules/.bin/jest",
-    "debug-build": "cross-env VITE_TEST_BUILD=1 VITE_PRESERVE_BUILD_ARTIFACTS=1 node --inspect-brk ./node_modules/.bin/jest",
+    "debug-serve": "cross-env VITE_DEBUG_SERVE=1 vitest run -c vitest.config.e2e.ts",
+    "debug-build": "cross-env VITE_TEST_BUILD=1 VITE_PRESERVE_BUILD_ARTIFACTS=1 vitest run -c vitest.config.e2e.ts",
     "docs": "vitepress dev docs",
     "build-docs": "vitepress build docs",
     "serve-docs": "vitepress serve docs",
@@ -36,8 +36,8 @@
   },
   "devDependencies": {
     "@microsoft/api-extractor": "^7.23.1",
+    "@types/babel__core": "^7.1.19",
     "@types/fs-extra": "^9.0.13",
-    "@types/jest": "^27.5.0",
     "@types/node": "^17.0.31",
     "@types/prompts": "^2.4.0",
     "@types/semver": "^7.3.9",
@@ -51,7 +51,7 @@
     "eslint-plugin-node": "^11.1.0",
     "execa": "^5.1.1",
     "fs-extra": "^10.1.0",
-    "jest": "^27.5.1",
+    "kill-port": "^1.6.1",
     "lint-staged": "^12.4.1",
     "minimist": "^1.2.6",
     "node-fetch": "^2.6.7",
@@ -65,12 +65,11 @@
     "semver": "^7.3.7",
     "simple-git-hooks": "^2.7.0",
     "sirv": "^2.0.2",
-    "ts-jest": "^27.1.4",
     "ts-node": "^10.7.0",
     "typescript": "^4.6.4",
     "vite": "workspace:*",
     "vitepress": "^0.22.4",
-    "vitest": "^0.10.5"
+    "vitest": "^0.12.4"
   },
   "simple-git-hooks": {
     "pre-commit": "pnpm exec lint-staged --concurrent false",
diff --git a/packages/vite/src/node/__tests__/plugins/css.spec.ts b/packages/vite/src/node/__tests__/plugins/css.spec.ts
index eeacaf482b0c31..70ddb640b13218 100644
--- a/packages/vite/src/node/__tests__/plugins/css.spec.ts
+++ b/packages/vite/src/node/__tests__/plugins/css.spec.ts
@@ -179,31 +179,29 @@ describe('hoist @ rules', () => {
 
   test('dont hoist @import and @charset in comments', async () => {
     const css = `
-      .foo{color:red;}
-      /*
-        @import "bla";
-      */
-      @charset "utf-8";
-      /*
-        @charset "utf-8";
-        @import "bar";
-      */
-      @import "baz";
-    `
+.foo{color:red;}
+/*
+  @import "bla";
+*/
+@charset "utf-8";
+/*
+  @charset "utf-8";
+  @import "bar";
+*/
+@import "baz";`
     const result = await hoistAtRules(css)
-    expect(result).toBe(
-      `@charset "utf-8";@import "baz";
+    expect(result).toMatchInlineSnapshot(`
+      "@charset \\"utf-8\\";@import \\"baz\\";
       .foo{color:red;}
       /*
-        @import "bla";
+        @import \\"bla\\";
       */
-      
+
       /*
-        @charset "utf-8";
-        @import "bar";
+        @charset \\"utf-8\\";
+        @import \\"bar\\";
       */
-      
-    `
-    )
+      "
+    `)
   })
 })
diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts
index 50ca05e17a748e..021fd8c25901b5 100644
--- a/packages/vite/src/node/server/index.ts
+++ b/packages/vite/src/node/server/index.ts
@@ -409,7 +409,7 @@ export async function createServer(
     try {
       await server.close()
     } finally {
-      process.exit(0)
+      process.exit()
     }
   }
 
diff --git a/packages/vite/src/node/ssr/ssrModuleLoader.ts b/packages/vite/src/node/ssr/ssrModuleLoader.ts
index 9f75641c84e513..ba9589d8bbbf1f 100644
--- a/packages/vite/src/node/ssr/ssrModuleLoader.ts
+++ b/packages/vite/src/node/ssr/ssrModuleLoader.ts
@@ -286,6 +286,7 @@ async function nodeImport(
       importer,
       // Non-external modules can import ESM-only modules, but only outside
       // of test runs, because we use Node `require` in Jest to avoid segfault.
+      // @ts-expect-error
       typeof jest === 'undefined'
         ? { ...resolveOptions, tryEsmOnly: true }
         : resolveOptions
diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts
index d84b474b87c33f..41b1073bb5b991 100644
--- a/packages/vite/src/node/utils.ts
+++ b/packages/vite/src/node/utils.ts
@@ -743,7 +743,9 @@ export const multilineCommentsRE = /\/\*(.|[\r\n])*?\*\//gm
 export const singlelineCommentsRE = /\/\/.*/g
 export const requestQuerySplitRE = /\?(?!.*[\/|\}])/
 
+// @ts-expect-error
 export const usingDynamicImport = typeof jest === 'undefined'
+
 /**
  * Dynamically import files. It will make sure it's not being compiled away by TS/Rollup.
  *
diff --git a/playground/assets/__tests__/assets.spec.ts b/playground/assets/__tests__/assets.spec.ts
index d9f1c8ed761773..96b4b4e1e434cf 100644
--- a/playground/assets/__tests__/assets.spec.ts
+++ b/playground/assets/__tests__/assets.spec.ts
@@ -175,11 +175,9 @@ describe('css url() references', () => {
     expect(bg).toMatch(assetMatch)
   })
 
-  if (isBuild) {
-    test('preserve postfix query/hash', () => {
-      expect(findAssetFile(/\.css$/, 'foo')).toMatch(`woff2?#iefix`)
-    })
-  }
+  test.runIf(isBuild)('preserve postfix query/hash', () => {
+    expect(findAssetFile(/\.css$/, 'foo')).toMatch(`woff2?#iefix`)
+  })
 })
 
 describe('image', () => {
@@ -254,17 +252,13 @@ describe('unicode url', () => {
   })
 })
 
-describe('encodeURI', () => {
-  if (isBuild) {
-    test('img src with encodeURI', async () => {
-      const img = await page.$('.encodeURI')
-      expect(
-        await (
-          await img.getAttribute('src')
-        ).startsWith('data:image/png;base64')
-      ).toBe(true)
-    })
-  }
+describe.runIf(isBuild)('encodeURI', () => {
+  test('img src with encodeURI', async () => {
+    const img = await page.$('.encodeURI')
+    expect(
+      await (await img.getAttribute('src')).startsWith('data:image/png;base64')
+    ).toBe(true)
+  })
 })
 
 test('new URL(..., import.meta.url)', async () => {
@@ -286,51 +280,43 @@ test('new URL(`non-existent`, import.meta.url)', async () => {
   )
 })
 
-if (isBuild) {
-  test('manifest', async () => {
-    const manifest = readManifest('foo')
-    const entry = manifest['index.html']
-
-    for (const file of listAssets('foo')) {
-      if (file.endsWith('.css')) {
-        expect(entry.css).toContain(`assets/${file}`)
-      } else if (!file.endsWith('.js')) {
-        expect(entry.assets).toContain(`assets/${file}`)
-      }
+test.runIf(isBuild)('manifest', async () => {
+  const manifest = readManifest('foo')
+  const entry = manifest['index.html']
+
+  for (const file of listAssets('foo')) {
+    if (file.endsWith('.css')) {
+      expect(entry.css).toContain(`assets/${file}`)
+    } else if (!file.endsWith('.js')) {
+      expect(entry.assets).toContain(`assets/${file}`)
     }
-  })
-}
+  }
+})
 
-describe('css and assets in css in build watch', () => {
-  if (isBuild) {
-    test('css will not be lost and css does not contain undefined', async () => {
-      editFile('index.html', (code) => code.replace('Assets', 'assets'), true)
-      await notifyRebuildComplete(watcher)
-      const cssFile = findAssetFile(/index\.\w+\.css$/, 'foo')
-      expect(cssFile).not.toBe('')
-      expect(cssFile).not.toMatch(/undefined/)
-    })
+describe.runIf(isBuild)('css and assets in css in build watch', () => {
+  test('css will not be lost and css does not contain undefined', async () => {
+    editFile('index.html', (code) => code.replace('Assets', 'assets'), true)
+    await notifyRebuildComplete(watcher)
+    const cssFile = findAssetFile(/index\.\w+\.css$/, 'foo')
+    expect(cssFile).not.toBe('')
+    expect(cssFile).not.toMatch(/undefined/)
+  })
 
-    test('import module.css', async () => {
-      expect(await getColor('#foo')).toBe('red')
-      editFile(
-        'css/foo.module.css',
-        (code) => code.replace('red', 'blue'),
-        true
-      )
-      await notifyRebuildComplete(watcher)
-      await page.reload()
-      expect(await getColor('#foo')).toBe('blue')
-    })
+  test('import module.css', async () => {
+    expect(await getColor('#foo')).toBe('red')
+    editFile('css/foo.module.css', (code) => code.replace('red', 'blue'), true)
+    await notifyRebuildComplete(watcher)
+    await page.reload()
+    expect(await getColor('#foo')).toBe('blue')
+  })
 
-    test('import with raw query', async () => {
-      expect(await page.textContent('.raw-query')).toBe('foo')
-      editFile('static/foo.txt', (code) => code.replace('foo', 'zoo'), true)
-      await notifyRebuildComplete(watcher)
-      await page.reload()
-      expect(await page.textContent('.raw-query')).toBe('zoo')
-    })
-  }
+  test('import with raw query', async () => {
+    expect(await page.textContent('.raw-query')).toBe('foo')
+    editFile('static/foo.txt', (code) => code.replace('foo', 'zoo'), true)
+    await notifyRebuildComplete(watcher)
+    await page.reload()
+    expect(await page.textContent('.raw-query')).toBe('zoo')
+  })
 })
 
 test('inline style test', async () => {
diff --git a/playground/backend-integration/__tests__/backend-integration.spec.ts b/playground/backend-integration/__tests__/backend-integration.spec.ts
index 7eebc9c27ff05a..4677700f6e8c12 100644
--- a/playground/backend-integration/__tests__/backend-integration.spec.ts
+++ b/playground/backend-integration/__tests__/backend-integration.spec.ts
@@ -2,6 +2,7 @@ import {
   editFile,
   getColor,
   isBuild,
+  isServe,
   readManifest,
   untilUpdated
 } from '../../testUtils'
@@ -24,42 +25,42 @@ describe('asset imports from js', () => {
   })
 })
 
-if (isBuild) {
+describe.runIf(isBuild)('build', () => {
   test('manifest', async () => {
     const manifest = readManifest('dev')
     const htmlEntry = manifest['index.html']
     expect(htmlEntry.css.length).toEqual(1)
     expect(htmlEntry.assets.length).toEqual(1)
   })
-} else {
+})
+
+describe.runIf(isServe)('serve', () => {
   test('No ReferenceError', async () => {
     browserErrors.forEach((error) => {
       expect(error.name).not.toBe('ReferenceError')
     })
   })
 
-  describe('CSS HMR', () => {
-    test('preserve the base in CSS HMR', async () => {
-      await untilUpdated(() => getColor('body'), 'black') // sanity check
-      editFile('frontend/entrypoints/global.css', (code) =>
-        code.replace('black', 'red')
-      )
-      await untilUpdated(() => getColor('body'), 'red') // successful HMR
+  test('preserve the base in CSS HMR', async () => {
+    await untilUpdated(() => getColor('body'), 'black') // sanity check
+    editFile('frontend/entrypoints/global.css', (code) =>
+      code.replace('black', 'red')
+    )
+    await untilUpdated(() => getColor('body'), 'red') // successful HMR
 
-      // Verify that the base (/dev/) was added during the css-update
-      const link = await page.$('link[rel="stylesheet"]')
-      expect(await link.getAttribute('href')).toContain('/dev/global.css?t=')
-    })
+    // Verify that the base (/dev/) was added during the css-update
+    const link = await page.$('link[rel="stylesheet"]')
+    expect(await link.getAttribute('href')).toContain('/dev/global.css?t=')
+  })
 
-    test('CSS dependencies are tracked for HMR', async () => {
-      const el = await page.$('h1')
-      browserLogs.length = 0
+  test('CSS dependencies are tracked for HMR', async () => {
+    const el = await page.$('h1')
+    browserLogs.length = 0
 
-      editFile('frontend/entrypoints/main.ts', (code) =>
-        code.replace('text-black', 'text-[rgb(204,0,0)]')
-      )
-      await untilUpdated(() => getColor(el), 'rgb(204, 0, 0)')
-      expect(browserLogs).toContain('[vite] css hot updated: /global.css')
-    })
+    editFile('frontend/entrypoints/main.ts', (code) =>
+      code.replace('text-black', 'text-[rgb(204,0,0)]')
+    )
+    await untilUpdated(() => getColor(el), 'rgb(204, 0, 0)')
+    expect(browserLogs).toContain('[vite] css hot updated: /global.css')
   })
-}
+})
diff --git a/playground/cli-module/__tests__/serve.js b/playground/cli-module/__tests__/serve.ts
similarity index 90%
rename from playground/cli-module/__tests__/serve.js
rename to playground/cli-module/__tests__/serve.ts
index cf873fd481830b..874c81715021d1 100644
--- a/playground/cli-module/__tests__/serve.js
+++ b/playground/cli-module/__tests__/serve.ts
@@ -1,21 +1,16 @@
-// @ts-check
-// this is automtically detected by scripts/jestPerTestSetup.ts and will replace
+// this is automatically detected by scripts/vitestSetup.ts and will replace
 // the default e2e test serve behavior
 
-const path = require('path')
-// eslint-disable-next-line node/no-restricted-require
-const execa = require('execa')
-const { workspaceRoot, ports } = require('../../testUtils')
+import path from 'path'
+import execa from 'execa'
+import { workspaceRoot, ports } from '../../testUtils'
+import kill from 'kill-port'
 
 const isWindows = process.platform === 'win32'
-const port = (exports.port = ports['cli-module'])
+export const port = ports['cli-module']
 const viteBin = path.join(workspaceRoot, 'packages', 'vite', 'bin', 'vite.js')
 
-/**
- * @param {string} root
- * @param {boolean} isProd
- */
-exports.serve = async function serve(root, isProd) {
+export async function serve(root: string, isProd: boolean) {
   // collect stdout and stderr streams from child processes here to avoid interfering with regular jest output
   const streams = {
     build: { out: [], err: [] },
@@ -60,6 +55,8 @@ exports.serve = async function serve(root, isProd) {
     }
   }
 
+  await kill(port)
+
   // run `vite --port x` or `vite preview --port x` to start server
   const viteServerArgs = ['--port', `${port}`, '--strict-port']
   if (isProd) {
@@ -113,7 +110,7 @@ exports.serve = async function serve(root, isProd) {
 // helper to validate that server was started on the correct port
 async function startedOnPort(serverProcess, port, timeout) {
   let checkPort
-  const startedPromise = new Promise((resolve, reject) => {
+  const startedPromise = new Promise((resolve, reject) => {
     checkPort = (data) => {
       const str = data.toString()
       // hack, console output may contain color code gibberish
diff --git a/playground/cli/__tests__/serve.js b/playground/cli/__tests__/serve.ts
similarity index 91%
rename from playground/cli/__tests__/serve.js
rename to playground/cli/__tests__/serve.ts
index 3ad375d9d1f543..913a4d5b565c73 100644
--- a/playground/cli/__tests__/serve.js
+++ b/playground/cli/__tests__/serve.ts
@@ -1,21 +1,16 @@
-// @ts-check
-// this is automtically detected by scripts/jestPerTestSetup.ts and will replace
+// this is automatically detected by scripts/vitestSetup.ts and will replace
 // the default e2e test serve behavior
 
-const path = require('path')
-// eslint-disable-next-line node/no-restricted-require
-const execa = require('execa')
-const { workspaceRoot, ports } = require('../../testUtils')
+import path from 'path'
+import execa from 'execa'
+import { workspaceRoot, ports } from '../../testUtils'
+import kill from 'kill-port'
 
 const isWindows = process.platform === 'win32'
 const port = (exports.port = ports.cli)
 const viteBin = path.join(workspaceRoot, 'packages', 'vite', 'bin', 'vite.js')
 
-/**
- * @param {string} root
- * @param {boolean} isProd
- */
-exports.serve = async function serve(root, isProd) {
+export async function serve(root: string, isProd: boolean) {
   // collect stdout and stderr streams from child processes here to avoid interfering with regular jest output
   const streams = {
     build: { out: [], err: [] },
@@ -60,6 +55,8 @@ exports.serve = async function serve(root, isProd) {
     }
   }
 
+  await kill(port)
+
   // run `vite --port x` or `vite preview --port x` to start server
   const viteServerArgs = ['--port', `${port}`, '--strict-port']
   if (isProd) {
@@ -113,7 +110,7 @@ exports.serve = async function serve(root, isProd) {
 // helper to validate that server was started on the correct port
 async function startedOnPort(serverProcess, port, timeout) {
   let checkPort
-  const startedPromise = new Promise((resolve, reject) => {
+  const startedPromise = new Promise((resolve, reject) => {
     checkPort = (data) => {
       const str = data.toString()
       // hack, console output may contain color code gibberish
diff --git a/playground/css-codesplit-cjs/__tests__/css-codesplit.spec.ts b/playground/css-codesplit-cjs/__tests__/css-codesplit.spec.ts
index 95fe97a1b953ba..dae8d5f4b4ca5e 100644
--- a/playground/css-codesplit-cjs/__tests__/css-codesplit.spec.ts
+++ b/playground/css-codesplit-cjs/__tests__/css-codesplit.spec.ts
@@ -5,7 +5,7 @@ test('should load both stylesheets', async () => {
   expect(await getColor('h2')).toBe('blue')
 })
 
-if (isBuild) {
+describe.runIf(isBuild)('build', () => {
   test('should remove empty chunk', async () => {
     expect(findAssetFile(/style.*\.js$/)).toBe('')
     expect(findAssetFile('main.*.js$')).toMatch(`/* empty css`)
@@ -17,4 +17,4 @@ if (isBuild) {
     expect(manifest['index.html'].css.length).toBe(2)
     expect(manifest['other.js'].css.length).toBe(1)
   })
-}
+})
diff --git a/playground/css-codesplit/__tests__/css-codesplit.spec.ts b/playground/css-codesplit/__tests__/css-codesplit.spec.ts
index 789adba23ae021..820222e9a964d2 100644
--- a/playground/css-codesplit/__tests__/css-codesplit.spec.ts
+++ b/playground/css-codesplit/__tests__/css-codesplit.spec.ts
@@ -20,7 +20,7 @@ test('should load dynamic import with module', async () => {
   expect(await getColor('.mod')).toBe('yellow')
 })
 
-if (isBuild) {
+describe.runIf(isBuild)('build', () => {
   test('should remove empty chunk', async () => {
     expect(findAssetFile(/style.*\.js$/)).toBe('')
     expect(findAssetFile('main.*.js$')).toMatch(`/* empty css`)
@@ -33,4 +33,4 @@ if (isBuild) {
     expect(manifest['index.html'].css.length).toBe(2)
     expect(manifest['other.js'].css.length).toBe(1)
   })
-}
+})
diff --git a/playground/css-sourcemap/__tests__/build.spec.ts b/playground/css-sourcemap/__tests__/build.spec.ts
index e36c1f52d2c1f8..50b8814aed9c4e 100644
--- a/playground/css-sourcemap/__tests__/build.spec.ts
+++ b/playground/css-sourcemap/__tests__/build.spec.ts
@@ -1,13 +1,7 @@
-import { isBuild } from 'testUtils'
+import { isBuild } from '../../testUtils'
 
-if (isBuild) {
-  test('should not output sourcemap warning (#4939)', () => {
-    serverLogs.forEach((log) => {
-      expect(log).not.toMatch('Sourcemap is likely to be incorrect')
-    })
+test.runIf(isBuild)('should not output sourcemap warning (#4939)', () => {
+  serverLogs.forEach((log) => {
+    expect(log).not.toMatch('Sourcemap is likely to be incorrect')
   })
-} else {
-  test('this file only includes test for build', () => {
-    expect(true).toBe(true)
-  })
-}
+})
diff --git a/playground/css-sourcemap/__tests__/serve.spec.ts b/playground/css-sourcemap/__tests__/serve.spec.ts
index becd792e82293a..34a627b68df736 100644
--- a/playground/css-sourcemap/__tests__/serve.spec.ts
+++ b/playground/css-sourcemap/__tests__/serve.spec.ts
@@ -2,10 +2,10 @@ import { URL } from 'url'
 import {
   extractSourcemap,
   formatSourcemapForSnapshot,
-  isBuild
-} from 'testUtils'
+  isServe
+} from '../../testUtils'
 
-if (!isBuild) {
+describe.runIf(isServe)('serve', () => {
   const getStyleTagContentIncluding = async (content: string) => {
     const styles = await page.$$('style')
     for (const style of styles) {
@@ -43,13 +43,13 @@ if (!isBuild) {
     const css = await res.text()
     const map = extractSourcemap(css)
     expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(`
-      Object {
+      {
         "mappings": "AAAA;EACE,UAAU;AACZ;;ACAA;EACE,UAAU;AACZ",
-        "sources": Array [
+        "sources": [
           "/root/be-imported.css",
           "/root/linked-with-import.css",
         ],
-        "sourcesContent": Array [
+        "sourcesContent": [
           ".be-imported {
         color: red;
       }
@@ -70,12 +70,12 @@ if (!isBuild) {
     const css = await getStyleTagContentIncluding('.imported ')
     const map = extractSourcemap(css)
     expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(`
-      Object {
+      {
         "mappings": "AAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACX,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACb,CAAC;",
-        "sources": Array [
+        "sources": [
           "/root/imported.css",
         ],
-        "sourcesContent": Array [
+        "sourcesContent": [
           ".imported {
         color: red;
       }
@@ -90,13 +90,13 @@ if (!isBuild) {
     const css = await getStyleTagContentIncluding('.imported-with-import ')
     const map = extractSourcemap(css)
     expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(`
-      Object {
+      {
         "mappings": "AAAA;EACE,UAAU;AACZ;;ACAA;EACE,UAAU;AACZ",
-        "sources": Array [
+        "sources": [
           "/root/be-imported.css",
           "/root/imported-with-import.css",
         ],
-        "sourcesContent": Array [
+        "sourcesContent": [
           ".be-imported {
         color: red;
       }
@@ -117,12 +117,12 @@ if (!isBuild) {
     const css = await getStyleTagContentIncluding('.imported-sass ')
     const map = extractSourcemap(css)
     expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(`
-      Object {
+      {
         "mappings": "AACE;EACE",
-        "sources": Array [
+        "sources": [
           "/root/imported.sass",
         ],
-        "sourcesContent": Array [
+        "sourcesContent": [
           ".imported
         &-sass
           color: red
@@ -137,12 +137,12 @@ if (!isBuild) {
     const css = await getStyleTagContentIncluding('._imported-sass-module_')
     const map = extractSourcemap(css)
     expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(`
-      Object {
+      {
         "mappings": "AACE;EACE",
-        "sources": Array [
+        "sources": [
           "/root/imported.module.sass",
         ],
-        "sourcesContent": Array [
+        "sourcesContent": [
           ".imported
         &-sass-module
           color: red
@@ -157,12 +157,12 @@ if (!isBuild) {
     const css = await getStyleTagContentIncluding('.imported-less ')
     const map = extractSourcemap(css)
     expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(`
-      Object {
+      {
         "mappings": "AACE;EACE",
-        "sources": Array [
+        "sources": [
           "/root/imported.less",
         ],
-        "sourcesContent": Array [
+        "sourcesContent": [
           ".imported {
         &-less {
           color: @color;
@@ -179,12 +179,12 @@ if (!isBuild) {
     const css = await getStyleTagContentIncluding('.imported-stylus ')
     const map = extractSourcemap(css)
     expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(`
-      Object {
+      {
         "mappings": "AACE;EACE,cAAM",
-        "sources": Array [
+        "sources": [
           "/root/imported.styl",
         ],
-        "sourcesContent": Array [
+        "sourcesContent": [
           ".imported
         &-stylus
           color blue-red-mixed
@@ -200,8 +200,4 @@ if (!isBuild) {
       expect(log).not.toMatch(/Sourcemap for .+ points to missing source files/)
     })
   })
-} else {
-  test('this file only includes test for serve', () => {
-    expect(true).toBe(true)
-  })
-}
+})
diff --git a/playground/css/__tests__/css.spec.ts b/playground/css/__tests__/css.spec.ts
index e666ca40517d57..3443597816f2d1 100644
--- a/playground/css/__tests__/css.spec.ts
+++ b/playground/css/__tests__/css.spec.ts
@@ -251,14 +251,12 @@ test('inline css modules', async () => {
   expect(css).toMatch(/\.inline-module__apply-color-inline___[\w-]{5}/)
 })
 
-if (isBuild) {
-  test('@charset hoist', async () => {
-    serverLogs.forEach((log) => {
-      // no warning from esbuild css minifier
-      expect(log).not.toMatch('"@charset" must be the first rule in the file')
-    })
+test.runIf(isBuild)('@charset hoist', async () => {
+  serverLogs.forEach((log) => {
+    // no warning from esbuild css minifier
+    expect(log).not.toMatch('"@charset" must be the first rule in the file')
   })
-}
+})
 
 test('@import dependency w/ style entry', async () => {
   expect(await getColor('.css-dep')).toBe('purple')
diff --git a/playground/data-uri/__tests__/data-uri.spec.ts b/playground/data-uri/__tests__/data-uri.spec.ts
index e1d488c931e7c1..bf9d595c813322 100644
--- a/playground/data-uri/__tests__/data-uri.spec.ts
+++ b/playground/data-uri/__tests__/data-uri.spec.ts
@@ -8,9 +8,7 @@ test('base64', async () => {
   expect(await page.textContent('.base64')).toBe('hi')
 })
 
-if (isBuild) {
-  test('should compile away the import for build', async () => {
-    const file = findAssetFile('index')
-    expect(file).not.toMatch('import')
-  })
-}
+test.runIf(isBuild)('should compile away the import for build', async () => {
+  const file = findAssetFile('index')
+  expect(file).not.toMatch('import')
+})
diff --git a/playground/define/__tests__/define.spec.ts b/playground/define/__tests__/define.spec.ts
index 3a4f34c5bbe7ff..a7a45dcea1b701 100644
--- a/playground/define/__tests__/define.spec.ts
+++ b/playground/define/__tests__/define.spec.ts
@@ -7,6 +7,7 @@ test('string', async () => {
   expect(await page.textContent('.string')).toBe(JSON.parse(defines.__STRING__))
   expect(await page.textContent('.number')).toBe(String(defines.__NUMBER__))
   expect(await page.textContent('.boolean')).toBe(String(defines.__BOOLEAN__))
+
   expect(await page.textContent('.object')).toBe(
     JSON.stringify(defines.__OBJ__, null, 2)
   )
diff --git a/playground/env-nested/__tests__/env-nested.spec.ts b/playground/env-nested/__tests__/env-nested.spec.ts
index 1ceebde7a044b7..ed107acb233e02 100644
--- a/playground/env-nested/__tests__/env-nested.spec.ts
+++ b/playground/env-nested/__tests__/env-nested.spec.ts
@@ -1,4 +1,4 @@
-import { isBuild } from 'testUtils'
+import { isBuild } from '../../testUtils'
 
 const mode = isBuild ? `production` : `development`
 
diff --git a/playground/env/__tests__/env.spec.ts b/playground/env/__tests__/env.spec.ts
index 907cebc8037ce9..cbc0aad524001c 100644
--- a/playground/env/__tests__/env.spec.ts
+++ b/playground/env/__tests__/env.spec.ts
@@ -1,4 +1,4 @@
-import { isBuild } from 'testUtils'
+import { isBuild } from '../../testUtils'
 
 const mode = isBuild ? `production` : `development`
 
diff --git a/playground/file-delete-restore/__tests__/file-delete-restore.spec.ts b/playground/file-delete-restore/__tests__/file-delete-restore.spec.ts
index 24f1237efedeec..04ce2e71b00cd8 100644
--- a/playground/file-delete-restore/__tests__/file-delete-restore.spec.ts
+++ b/playground/file-delete-restore/__tests__/file-delete-restore.spec.ts
@@ -6,8 +6,9 @@ import {
   isBuild
 } from '../../testUtils'
 
-if (!isBuild) {
-  test('should hmr when file is deleted and restored', async () => {
+test.runIf(isBuild)(
+  'should hmr when file is deleted and restored',
+  async () => {
     await untilUpdated(() => page.textContent('p'), 'Child state 1')
 
     editFile('Child.jsx', (code) =>
@@ -39,7 +40,7 @@ if (!isBuild) {
       (code) =>
         `import { useState } from 'react'
       import Child from './Child'
-      
+
       function App() {
         return (
           
@@ -47,15 +48,11 @@ if (!isBuild) {
) } - + export default App ` ) await untilUpdated(() => page.textContent('p'), 'Child state 1') - }) -} else { - test('dummy test to make jest happy', async () => { - // Your test suite must contain at least one test. - }) -} + } +) diff --git a/playground/fs-serve/__tests__/fs-serve.spec.ts b/playground/fs-serve/__tests__/fs-serve.spec.ts index eba1e441881710..75c3fc6edfee04 100644 --- a/playground/fs-serve/__tests__/fs-serve.spec.ts +++ b/playground/fs-serve/__tests__/fs-serve.spec.ts @@ -1,73 +1,67 @@ -import { isBuild } from '../../testUtils' +import { isServe } from '../../testUtils' const json = require('../safe.json') const stringified = JSON.stringify(json) -describe('main', () => { +describe.runIf(isServe)('main', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/jestPerTestSetup.ts + // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/src/') }) - if (!isBuild) { - test('default import', async () => { - expect(await page.textContent('.full')).toBe(stringified) - }) + test('default import', async () => { + expect(await page.textContent('.full')).toBe(stringified) + }) - test('named import', async () => { - expect(await page.textContent('.named')).toBe(json.msg) - }) + test('named import', async () => { + expect(await page.textContent('.named')).toBe(json.msg) + }) - test('safe fetch', async () => { - expect(await page.textContent('.safe-fetch')).toMatch('KEY=safe') - expect(await page.textContent('.safe-fetch-status')).toBe('200') - }) + test('safe fetch', async () => { + expect(await page.textContent('.safe-fetch')).toMatch('KEY=safe') + expect(await page.textContent('.safe-fetch-status')).toBe('200') + }) - test('safe fetch with special characters', async () => { - expect( - await page.textContent('.safe-fetch-subdir-special-characters') - ).toMatch('KEY=safe') - expect( - await page.textContent('.safe-fetch-subdir-special-characters-status') - ).toBe('200') - }) + test('safe fetch with special characters', async () => { + expect( + await page.textContent('.safe-fetch-subdir-special-characters') + ).toMatch('KEY=safe') + expect( + await page.textContent('.safe-fetch-subdir-special-characters-status') + ).toBe('200') + }) - test('unsafe fetch', async () => { - expect(await page.textContent('.unsafe-fetch')).toMatch('403 Restricted') - expect(await page.textContent('.unsafe-fetch-status')).toBe('403') - }) + test('unsafe fetch', async () => { + expect(await page.textContent('.unsafe-fetch')).toMatch('403 Restricted') + expect(await page.textContent('.unsafe-fetch-status')).toBe('403') + }) - test('safe fs fetch', async () => { - expect(await page.textContent('.safe-fs-fetch')).toBe(stringified) - expect(await page.textContent('.safe-fs-fetch-status')).toBe('200') - }) + test('safe fs fetch', async () => { + expect(await page.textContent('.safe-fs-fetch')).toBe(stringified) + expect(await page.textContent('.safe-fs-fetch-status')).toBe('200') + }) - test('safe fs fetch with special characters', async () => { - expect(await page.textContent('.safe-fs-fetch-special-characters')).toBe( - stringified - ) - expect(await page.textContent('.safe-fs-fetch-status')).toBe('200') - }) + test('safe fs fetch with special characters', async () => { + expect(await page.textContent('.safe-fs-fetch-special-characters')).toBe( + stringified + ) + expect(await page.textContent('.safe-fs-fetch-status')).toBe('200') + }) - test('unsafe fs fetch', async () => { - expect(await page.textContent('.unsafe-fs-fetch')).toBe('') - expect(await page.textContent('.unsafe-fs-fetch-status')).toBe('403') - }) + test('unsafe fs fetch', async () => { + expect(await page.textContent('.unsafe-fs-fetch')).toBe('') + expect(await page.textContent('.unsafe-fs-fetch-status')).toBe('403') + }) - test('nested entry', async () => { - expect(await page.textContent('.nested-entry')).toBe('foobar') - }) + test('nested entry', async () => { + expect(await page.textContent('.nested-entry')).toBe('foobar') + }) - test('nested entry', async () => { - expect(await page.textContent('.nested-entry')).toBe('foobar') - }) + test('nested entry', async () => { + expect(await page.textContent('.nested-entry')).toBe('foobar') + }) - test('denied', async () => { - expect(await page.textContent('.unsafe-dotenv')).toBe('404') - }) - } else { - test('dummy test to make jest happy', async () => { - // Your test suite must contain at least one test. - }) - } + test('denied', async () => { + expect(await page.textContent('.unsafe-dotenv')).toBe('404') + }) }) diff --git a/playground/hmr/tsconfig.json b/playground/hmr/tsconfig.json index 41b16fdc65ec8c..9da745ba51a3e9 100644 --- a/playground/hmr/tsconfig.json +++ b/playground/hmr/tsconfig.json @@ -10,6 +10,6 @@ "moduleResolution": "node", "baseUrl": ".", "jsx": "preserve", - "types": ["vite/client", "jest", "node"] + "types": ["vite/client", "node"] } } diff --git a/playground/html/__tests__/html.spec.ts b/playground/html/__tests__/html.spec.ts index 834db1f6126cad..3041247bc776d4 100644 --- a/playground/html/__tests__/html.spec.ts +++ b/playground/html/__tests__/html.spec.ts @@ -1,4 +1,4 @@ -import { getColor, isBuild, editFile } from '../../testUtils' +import { getColor, isBuild, editFile, isServe } from '../../testUtils' function testPage(isNested: boolean) { test('pre transform', async () => { @@ -79,7 +79,7 @@ describe('main', () => { describe('nested', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/jestPerTestSetup.ts + // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/nested/') }) @@ -88,17 +88,17 @@ describe('nested', () => { describe('nested w/ query', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/jestPerTestSetup.ts + // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/nested/index.html?v=1') }) testPage(true) }) -if (isBuild) { +describe.runIf(isBuild)('build', () => { describe('scriptAsync', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/jestPerTestSetup.ts + // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/scriptAsync.html') }) @@ -110,7 +110,7 @@ if (isBuild) { describe('scriptMixed', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/jestPerTestSetup.ts + // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/scriptMixed.html') }) @@ -124,7 +124,7 @@ if (isBuild) { // Ensure that the modulePreload polyfill is discarded in this case beforeAll(async () => { - // viteTestUrl is globally injected in scripts/jestPerTestSetup.ts + // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/zeroJS.html') }) @@ -164,11 +164,11 @@ if (isBuild) { ) }) }) -} +}) describe('noHead', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/jestPerTestSetup.ts + // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/noHead.html') }) @@ -183,7 +183,7 @@ describe('noHead', () => { describe('noBody', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/jestPerTestSetup.ts + // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/noBody.html') }) @@ -211,28 +211,26 @@ describe('unicode path', () => { }) }) -if (!isBuild) { - describe('invalid', () => { - test('should be 500 with overlay', async () => { - const response = await page.goto(viteTestUrl + '/invalid.html') - expect(response.status()).toBe(500) +describe.runIf(isServe)('invalid', () => { + test('should be 500 with overlay', async () => { + const response = await page.goto(viteTestUrl + '/invalid.html') + expect(response.status()).toBe(500) - const errorOverlay = await page.waitForSelector('vite-error-overlay') - expect(errorOverlay).toBeTruthy() + const errorOverlay = await page.waitForSelector('vite-error-overlay') + expect(errorOverlay).toBeTruthy() - const message = await errorOverlay.$$eval('.message-body', (m) => { - return m[0].innerHTML - }) - expect(message).toMatch(/^Unable to parse HTML/) + const message = await errorOverlay.$$eval('.message-body', (m) => { + return m[0].innerHTML }) + expect(message).toMatch(/^Unable to parse HTML/) + }) - test('should reload when fixed', async () => { - const response = await page.goto(viteTestUrl + '/invalid.html') - await editFile('invalid.html', (content) => { - return content.replace('
Good') - }) - const content = await page.waitForSelector('text=Good HTML') - expect(content).toBeTruthy() + test('should reload when fixed', async () => { + const response = await page.goto(viteTestUrl + '/invalid.html') + await editFile('invalid.html', (content) => { + return content.replace('
Good') }) + const content = await page.waitForSelector('text=Good HTML') + expect(content).toBeTruthy() }) -} +}) diff --git a/playground/js-sourcemap/__tests__/build.spec.ts b/playground/js-sourcemap/__tests__/build.spec.ts index e36c1f52d2c1f8..50b8814aed9c4e 100644 --- a/playground/js-sourcemap/__tests__/build.spec.ts +++ b/playground/js-sourcemap/__tests__/build.spec.ts @@ -1,13 +1,7 @@ -import { isBuild } from 'testUtils' +import { isBuild } from '../../testUtils' -if (isBuild) { - test('should not output sourcemap warning (#4939)', () => { - serverLogs.forEach((log) => { - expect(log).not.toMatch('Sourcemap is likely to be incorrect') - }) +test.runIf(isBuild)('should not output sourcemap warning (#4939)', () => { + serverLogs.forEach((log) => { + expect(log).not.toMatch('Sourcemap is likely to be incorrect') }) -} else { - test('this file only includes test for build', () => { - expect(true).toBe(true) - }) -} +}) diff --git a/playground/js-sourcemap/__tests__/serve.spec.ts b/playground/js-sourcemap/__tests__/serve.spec.ts index a1ffdddc37ecd5..b3946461dde197 100644 --- a/playground/js-sourcemap/__tests__/serve.spec.ts +++ b/playground/js-sourcemap/__tests__/serve.spec.ts @@ -3,7 +3,7 @@ import { extractSourcemap, formatSourcemapForSnapshot, isBuild -} from 'testUtils' +} from '../../testUtils' if (!isBuild) { test('js', async () => { @@ -18,12 +18,12 @@ if (!isBuild) { const js = await res.text() const map = extractSourcemap(js) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": "AAAO,aAAM,MAAM;", - "sources": Array [ + "sources": [ "/root/bar.ts", ], - "sourcesContent": Array [ + "sourcesContent": [ "export const bar = 'bar' ", ], diff --git a/playground/legacy/__tests__/legacy.spec.ts b/playground/legacy/__tests__/legacy.spec.ts index 9fd3419337568d..c0eaa81fbc31d8 100644 --- a/playground/legacy/__tests__/legacy.spec.ts +++ b/playground/legacy/__tests__/legacy.spec.ts @@ -67,7 +67,7 @@ test('should load dynamic import with css', async () => { ) }) -if (isBuild) { +describe.runIf(isBuild)('build', () => { test('should generate correct manifest', async () => { const manifest = readManifest() expect(manifest['../../vite/legacy-polyfills']).toBeDefined() @@ -98,4 +98,4 @@ if (isBuild) { test('includes structuredClone polyfill which is supported after core-js v3', () => { expect(findAssetFile(/polyfills-legacy/)).toMatch('"structuredClone"') }) -} +}) diff --git a/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts b/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts index dad9b94d83509e..bc232e8af129c6 100644 --- a/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts +++ b/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts @@ -3,7 +3,7 @@ import { port } from './serve' const url = `http://localhost:${port}` -if (isBuild) { +describe.runIf(isBuild)('legacy-ssr', () => { test('should work', async () => { await page.goto(url) expect(await page.textContent('#app')).toMatch('Hello') @@ -13,8 +13,4 @@ if (isBuild) { // SSR build is always modern expect(await page.textContent('#env')).toMatch('false') }) -} else { - // this test doesn't support serve mode - // must contain at least one test - test('should work', () => void 0) -} +}) diff --git a/playground/legacy/__tests__/ssr/serve.js b/playground/legacy/__tests__/ssr/serve.ts similarity index 72% rename from playground/legacy/__tests__/ssr/serve.js rename to playground/legacy/__tests__/ssr/serve.ts index c7ef2ed3520e53..597320c9a58c0f 100644 --- a/playground/legacy/__tests__/ssr/serve.js +++ b/playground/legacy/__tests__/ssr/serve.ts @@ -1,16 +1,11 @@ -// @ts-check -// this is automtically detected by scripts/jestPerTestSetup.ts and will replace +// this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -const path = require('path') -const { ports } = require('../../../testUtils') +import path from 'path' +import { ports } from '../../../testUtils' -const port = (exports.port = ports['legacy/ssr']) +export const port = ports['legacy/ssr'] -/** - * @param {string} root - * @param {boolean} _isProd - */ -exports.serve = async function serve(root, _isProd) { +export async function serve(root: string, _isProd: boolean) { const { build } = require('vite') await build({ root, diff --git a/playground/lib/__tests__/lib.spec.ts b/playground/lib/__tests__/lib.spec.ts index cc5887c2777fcb..6d7ca7c5670ea0 100644 --- a/playground/lib/__tests__/lib.spec.ts +++ b/playground/lib/__tests__/lib.spec.ts @@ -1,8 +1,8 @@ -import { isBuild, findAssetFile, testDir } from 'testUtils' +import { isBuild, testDir, isServe } from '../../testUtils' import path from 'path' import fs from 'fs' -if (isBuild) { +describe.runIf(isBuild)('build', () => { test('es', async () => { expect(await page.textContent('.es')).toBe('It works') }) @@ -10,7 +10,7 @@ if (isBuild) { test('umd', async () => { expect(await page.textContent('.umd')).toBe('It works') const code = fs.readFileSync( - path.join(testDir, 'dist/my-lib-custom-filename.umd.js'), + path.join(testDir(), 'dist/my-lib-custom-filename.umd.js'), 'utf-8' ) // esbuild helpers are injected inside of the UMD wrapper @@ -20,7 +20,7 @@ if (isBuild) { test('iife', async () => { expect(await page.textContent('.iife')).toBe('It works') const code = fs.readFileSync( - path.join(testDir, 'dist/my-lib-custom-filename.iife.js'), + path.join(testDir(), 'dist/my-lib-custom-filename.iife.js'), 'utf-8' ) // esbuild helpers are injected inside of the IIFE wrapper @@ -30,7 +30,7 @@ if (isBuild) { test('Library mode does not include `preload`', async () => { expect(await page.textContent('.dynamic-import-message')).toBe('hello vite') const code = fs.readFileSync( - path.join(testDir, 'dist/lib/dynamic-import-message.js'), + path.join(testDir(), 'dist/lib/dynamic-import-message.js'), 'utf-8' ) expect(code).not.toMatch('__vitePreload') @@ -42,8 +42,8 @@ if (isBuild) { expect(log).not.toMatch('All "@import" rules must come first') }) }) -} else { - test('dev', async () => { - expect(await page.textContent('.demo')).toBe('It works') - }) -} +}) + +test.runIf(isServe)('dev', async () => { + expect(await page.textContent('.demo')).toBe('It works') +}) diff --git a/playground/lib/__tests__/serve.js b/playground/lib/__tests__/serve.ts similarity index 81% rename from playground/lib/__tests__/serve.js rename to playground/lib/__tests__/serve.ts index 2534545de5c221..3bde3d35a78dc1 100644 --- a/playground/lib/__tests__/serve.js +++ b/playground/lib/__tests__/serve.ts @@ -1,29 +1,23 @@ -// @ts-check -// this is automtically detected by scripts/jestPerTestSetup.ts and will replace +// this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -const path = require('path') -const http = require('http') -const sirv = require('sirv') -const { ports } = require('../../testUtils') +import path from 'path' +import http from 'http' +import sirv from 'sirv' +import { ports } from '../../testUtils' -const port = (exports.port = ports.lib) +export const port = ports.lib -global.serverLogs = [] - -/** - * @param {string} root - * @param {boolean} isBuildTest - */ -exports.serve = async function serve(root, isBuildTest) { - // build first +export async function serve(root, isBuildTest) { + // @ts-expect-error + global.serverLogs = [] setupConsoleWarnCollector() if (!isBuildTest) { const { createServer } = require('vite') process.env.VITE_INLINE = 'inline-serve' - let viteServer = await ( + const viteServer = await ( await createServer({ root: root, logLevel: 'silent', @@ -45,6 +39,7 @@ exports.serve = async function serve(root, isBuildTest) { // use resolved port/base from server const base = viteServer.config.base === '/' ? '' : viteServer.config.base const url = + // @ts-expect-error (global.viteTestUrl = `http://localhost:${viteServer.config.server.port}${base}`) await page.goto(url) @@ -97,6 +92,7 @@ exports.serve = async function serve(root, isBuildTest) { function setupConsoleWarnCollector() { const warn = console.warn console.warn = (...args) => { + // @ts-expect-error global.serverLogs.push(args.join(' ')) return warn.call(console, ...args) } diff --git a/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts b/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts index dd776daeceadbf..9f6934dd25ace8 100644 --- a/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts +++ b/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts @@ -1,10 +1,12 @@ import { port } from './serve' import fetch from 'node-fetch' import { untilUpdated } from '../../testUtils' +import { platform } from 'os' -const url = `http://localhost:${port}` +const url = `http://localhost:${port}/` -test('*', async () => { +// TODO: on macOS this test causing the process exists for some reason +test.skipIf(platform() === 'darwin')('optimize', async () => { await page.goto(url) // reload page to get optimized missing deps await page.reload() @@ -12,5 +14,5 @@ test('*', async () => { // raw http request const aboutHtml = await (await fetch(url)).text() - expect(aboutHtml).toMatch('Server') + expect(aboutHtml).toContain('Server') }) diff --git a/playground/ssr-pug/__tests__/serve.js b/playground/optimize-missing-deps/__test__/serve.ts similarity index 64% rename from playground/ssr-pug/__tests__/serve.js rename to playground/optimize-missing-deps/__test__/serve.ts index 392aa831ebb82d..3b60850905e389 100644 --- a/playground/ssr-pug/__tests__/serve.js +++ b/playground/optimize-missing-deps/__test__/serve.ts @@ -1,17 +1,12 @@ -// @ts-check -// this is automtically detected by scripts/jestPerTestSetup.ts and will replace +// this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -const path = require('path') -const { ports } = require('../../testUtils') +import path from 'path' +import { ports } from '../../testUtils' -const port = (exports.port = ports['ssr-pug']) +export const port = ports['optimize-missing-deps'] -/** - * @param {string} root - * @param {boolean} isProd - */ -exports.serve = async function serve(root, isProd) { +export async function serve(root: string, isProd: boolean) { const { createServer } = require(path.resolve(root, 'server.js')) const { app, vite } = await createServer(root, isProd) diff --git a/playground/preload/__tests__/preload.spec.ts b/playground/preload/__tests__/preload.spec.ts index 27a64930487797..b0ffb58a291bac 100644 --- a/playground/preload/__tests__/preload.spec.ts +++ b/playground/preload/__tests__/preload.spec.ts @@ -6,7 +6,7 @@ test('should have no 404s', () => { }) }) -if (isBuild) { +describe.runIf(isBuild)('build', () => { test('dynamic import', async () => { const appHtml = await page.content() expect(appHtml).toMatch('This is home page.') @@ -22,4 +22,4 @@ if (isBuild) { /link rel="stylesheet".*?href="\/assets\/Hello\.\w{8}\.css"/ ) }) -} +}) diff --git a/playground/preload/vite.config.js b/playground/preload/vite.config.ts similarity index 62% rename from playground/preload/vite.config.js rename to playground/preload/vite.config.ts index 90684f41829953..7fa1eb189818b3 100644 --- a/playground/preload/vite.config.js +++ b/playground/preload/vite.config.ts @@ -1,6 +1,7 @@ -const vuePlugin = require('@vitejs/plugin-vue') +import vuePlugin from '@vitejs/plugin-vue' +import { defineConfig } from 'vite' -module.exports = { +export default defineConfig({ plugins: [vuePlugin()], build: { minify: 'terser', @@ -13,4 +14,4 @@ module.exports = { } } } -} +}) diff --git a/playground/react/__tests__/react.spec.ts b/playground/react/__tests__/react.spec.ts index 46eb752924f801..4b39a304733318 100644 --- a/playground/react/__tests__/react.spec.ts +++ b/playground/react/__tests__/react.spec.ts @@ -1,4 +1,4 @@ -import { editFile, untilUpdated, isBuild } from '../../testUtils' +import { editFile, untilUpdated, isServe } from '../../testUtils' test('should render', async () => { expect(await page.textContent('h1')).toMatch('Hello Vite + React') @@ -17,23 +17,22 @@ test('should hmr', async () => { expect(await page.textContent('button')).toMatch('count is: 1') }) -test('should have annotated jsx with file location metadata', async () => { - // we're not annotating in prod, - // so we skip this test when isBuild is true - if (isBuild) return - - const meta = await page.evaluate(() => { - const button = document.querySelector('button') - const key = Object.keys(button).find( - (key) => key.indexOf('__reactFiber') === 0 - ) - return button[key]._debugSource - }) - // If the evaluate call doesn't crash, and the returned metadata has - // the expected fields, we're good. - expect(Object.keys(meta).sort()).toEqual([ - 'columnNumber', - 'fileName', - 'lineNumber' - ]) -}) +test.runIf(isServe)( + 'should have annotated jsx with file location metadata', + async () => { + const meta = await page.evaluate(() => { + const button = document.querySelector('button') + const key = Object.keys(button).find( + (key) => key.indexOf('__reactFiber') === 0 + ) + return button[key]._debugSource + }) + // If the evaluate call doesn't crash, and the returned metadata has + // the expected fields, we're good. + expect(Object.keys(meta).sort()).toEqual([ + 'columnNumber', + 'fileName', + 'lineNumber' + ]) + } +) diff --git a/playground/resolve-config/__tests__/resolve-config.spec.ts b/playground/resolve-config/__tests__/resolve-config.spec.ts index cde329afde2f50..bd45ad6c95012d 100644 --- a/playground/resolve-config/__tests__/resolve-config.spec.ts +++ b/playground/resolve-config/__tests__/resolve-config.spec.ts @@ -5,7 +5,7 @@ import { isBuild, testDir, workspaceRoot } from '../../testUtils' const viteBin = path.join(workspaceRoot, 'packages', 'vite', 'bin', 'vite.js') -const fromTestDir = (...p: string[]) => path.resolve(testDir, ...p) +const fromTestDir = (...p: string[]) => path.resolve(testDir(), ...p) const build = (configName: string) => { commandSync(`${viteBin} build`, { cwd: fromTestDir(configName) }) @@ -17,7 +17,7 @@ const getDistFile = (configName: string, extension: string) => { ) } -if (isBuild) { +describe.runIf(isBuild)('build', () => { it('loads vite.config.js', () => { build('js') expect(getDistFile('js', 'mjs')).toContain('console.log(true)') @@ -50,8 +50,4 @@ if (isBuild) { build('ts-module') expect(getDistFile('ts-module', 'js')).toContain('console.log(true)') }) -} else { - // this test doesn't support serve mode - // must contain at least one test - test('should work', () => void 0) -} +}) diff --git a/playground/resolve-config/__tests__/serve.js b/playground/resolve-config/__tests__/serve.ts similarity index 71% rename from playground/resolve-config/__tests__/serve.js rename to playground/resolve-config/__tests__/serve.ts index bd451d4cf6f6bc..4c1561264113e8 100644 --- a/playground/resolve-config/__tests__/serve.js +++ b/playground/resolve-config/__tests__/serve.ts @@ -1,19 +1,16 @@ -// @ts-check -// this is automtically detected by scripts/jestPerTestSetup.ts and will replace +// this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -const path = require('path') -const fs = require('fs-extra') -const { testDir } = require('../../testUtils') - -const fromTestDir = (/** @type{string[]} */ ...p) => path.resolve(testDir, ...p) +import path from 'path' +import fs from 'fs-extra' const configNames = ['js', 'cjs', 'mjs', 'ts'] -/** @param {string} root @param {boolean} isProd */ -exports.serve = async function serve(root, isProd) { +export async function serve(root: string, isProd: boolean) { if (!isProd) return + const fromTestDir = (...p: string[]) => path.resolve(root, '..', ...p) + // create separate directories for all config types: // ./{js,cjs,mjs,ts} and ./{js,cjs,mjs,ts}-module (with package#type) for (const configName of configNames) { diff --git a/playground/ssr-deps/__tests__/serve.js b/playground/ssr-deps/__tests__/serve.ts similarity index 64% rename from playground/ssr-deps/__tests__/serve.js rename to playground/ssr-deps/__tests__/serve.ts index 6c2584601c9331..92c73fc50a8629 100644 --- a/playground/ssr-deps/__tests__/serve.js +++ b/playground/ssr-deps/__tests__/serve.ts @@ -1,17 +1,12 @@ -// @ts-check -// this is automtically detected by scripts/jestPerTestSetup.ts and will replace +// this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -const path = require('path') -const { ports } = require('../../testUtils') +import path from 'path' +import { ports } from '../../testUtils' -const port = (exports.port = ports['ssr-deps']) +export const port = ports['ssr-deps'] -/** - * @param {string} root - * @param {boolean} isProd - */ -exports.serve = async function serve(root, isProd) { +export async function serve(root, isProd) { const { createServer } = require(path.resolve(root, 'server.js')) const { app, vite } = await createServer(root, isProd) diff --git a/playground/ssr-html/__tests__/serve.js b/playground/ssr-html/__tests__/serve.ts similarity index 64% rename from playground/ssr-html/__tests__/serve.js rename to playground/ssr-html/__tests__/serve.ts index d119397700cf75..804009e92e86d6 100644 --- a/playground/ssr-html/__tests__/serve.js +++ b/playground/ssr-html/__tests__/serve.ts @@ -1,17 +1,12 @@ -// @ts-check -// this is automtically detected by scripts/jestPerTestSetup.ts and will replace +// this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -const path = require('path') -const { ports } = require('../../testUtils') +import path from 'path' +import { ports } from '../../testUtils' -const port = (exports.port = ports['ssr-html']) +export const port = ports['ssr-html'] -/** - * @param {string} root - * @param {boolean} isProd - */ -exports.serve = async function serve(root, isProd) { +export async function serve(root, isProd) { const { createServer } = require(path.resolve(root, 'server.js')) const { app, vite } = await createServer(root, isProd) diff --git a/playground/optimize-missing-deps/__test__/serve.js b/playground/ssr-pug/__tests__/serve.ts similarity index 63% rename from playground/optimize-missing-deps/__test__/serve.js rename to playground/ssr-pug/__tests__/serve.ts index 89a6ce3593cd0e..2d687a5a685664 100644 --- a/playground/optimize-missing-deps/__test__/serve.js +++ b/playground/ssr-pug/__tests__/serve.ts @@ -1,17 +1,12 @@ -// @ts-check -// this is automtically detected by scripts/jestPerTestSetup.ts and will replace +// this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -const path = require('path') -const { ports } = require('../../testUtils') +import path from 'path' +import { ports } from '../../testUtils' -const port = (exports.port = ports['optimize-missing-deps']) +export const port = ports['ssr-pug'] -/** - * @param {string} root - * @param {boolean} isProd - */ -exports.serve = async function serve(root, isProd) { +export async function serve(root, isProd) { const { createServer } = require(path.resolve(root, 'server.js')) const { app, vite } = await createServer(root, isProd) diff --git a/playground/ssr-react/__tests__/serve.js b/playground/ssr-react/__tests__/serve.ts similarity index 77% rename from playground/ssr-react/__tests__/serve.js rename to playground/ssr-react/__tests__/serve.ts index 07476e0726e268..2f8479a7463bd7 100644 --- a/playground/ssr-react/__tests__/serve.js +++ b/playground/ssr-react/__tests__/serve.ts @@ -1,17 +1,12 @@ -// @ts-check -// this is automtically detected by scripts/jestPerTestSetup.ts and will replace +// this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -const path = require('path') -const { ports } = require('../../testUtils') +import path from 'path' +import { ports } from '../../testUtils' -const port = (exports.port = ports['ssr-react']) +export const port = ports['ssr-react'] -/** - * @param {string} root - * @param {boolean} isProd - */ -exports.serve = async function serve(root, isProd) { +export async function serve(root: string, isProd: boolean) { if (isProd) { // build first const { build } = require('vite') diff --git a/playground/ssr-vue/__tests__/serve.js b/playground/ssr-vue/__tests__/serve.ts similarity index 77% rename from playground/ssr-vue/__tests__/serve.js rename to playground/ssr-vue/__tests__/serve.ts index 5bcd5a4639877a..138729bfdaa01e 100644 --- a/playground/ssr-vue/__tests__/serve.js +++ b/playground/ssr-vue/__tests__/serve.ts @@ -1,17 +1,12 @@ -// @ts-check -// this is automtically detected by scripts/jestPerTestSetup.ts and will replace +// this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -const path = require('path') -const { ports } = require('../../testUtils') +import path from 'path' +import { ports } from '../../testUtils' -const port = (exports.port = ports['ssr-vue']) +export const port = ports['ssr-vue'] -/** - * @param {string} root - * @param {boolean} isProd - */ -exports.serve = async function serve(root, isProd) { +export async function serve(root, isProd) { if (isProd) { // build first const { build } = require('vite') diff --git a/playground/ssr-vue/__tests__/ssr-vue.spec.ts b/playground/ssr-vue/__tests__/ssr-vue.spec.ts index baa7b79dd74252..193c95b1f4a1c1 100644 --- a/playground/ssr-vue/__tests__/ssr-vue.spec.ts +++ b/playground/ssr-vue/__tests__/ssr-vue.spec.ts @@ -110,6 +110,7 @@ test('css', async () => { } else { // During dev, the CSS is loaded from async chunk and we may have to wait // when the test runs concurrently. + await page.waitForLoadState('networkidle') await untilUpdated(() => getColor('h1'), 'green') await untilUpdated(() => getColor('.jsx'), 'blue') } @@ -141,11 +142,13 @@ test('nested virtual module', async () => { test('hydration', async () => { expect(await page.textContent('button')).toMatch('0') await page.click('button') + await page.waitForLoadState('networkidle') expect(await page.textContent('button')).toMatch('1') }) test('hmr', async () => { editFile('src/pages/Home.vue', (code) => code.replace('Home', 'changed')) + await page.waitForLoadState('networkidle') await untilUpdated(() => page.textContent('h1'), 'changed') }) @@ -154,6 +157,7 @@ test('client navigation', async () => { await page.click('a[href="/about"]') await untilUpdated(() => page.textContent('h1'), 'About') editFile('src/pages/About.vue', (code) => code.replace('About', 'changed')) + await page.waitForLoadState('networkidle') await untilUpdated(() => page.textContent('h1'), 'changed') await page.click('a[href="/"]') await untilUpdated(() => page.textContent('a[href="/"]'), 'Home') @@ -164,19 +168,17 @@ test('import.meta.url', async () => { expect(await page.textContent('.protocol')).toEqual('file:') }) -test('dynamic css file should be preloaded', async () => { - if (isBuild) { - await page.goto(url) - const homeHtml = await (await fetch(url)).text() - const re = /link rel="modulepreload".*?href="\/assets\/(Home\.\w{8}\.js)"/ - const filename = re.exec(homeHtml)[1] - const manifest = require(resolve( - process.cwd(), - './playground-temp/ssr-vue/dist/client/ssr-manifest.json' - )) - const depFile = manifest[filename] - for (const file of depFile) { - expect(homeHtml).toMatch(file) - } +test.runIf(isBuild)('dynamic css file should be preloaded', async () => { + await page.goto(url) + const homeHtml = await (await fetch(url)).text() + const re = /link rel="modulepreload".*?href="\/assets\/(Home\.\w{8}\.js)"/ + const filename = re.exec(homeHtml)[1] + const manifest = require(resolve( + process.cwd(), + './playground-temp/ssr-vue/dist/client/ssr-manifest.json' + )) + const depFile = manifest[filename] + for (const file of depFile) { + expect(homeHtml).toMatch(file) } }) diff --git a/playground/ssr-webworker/__tests__/serve.js b/playground/ssr-webworker/__tests__/serve.ts similarity index 72% rename from playground/ssr-webworker/__tests__/serve.js rename to playground/ssr-webworker/__tests__/serve.ts index 38a957b0a333ea..382208b3b06d2e 100644 --- a/playground/ssr-webworker/__tests__/serve.js +++ b/playground/ssr-webworker/__tests__/serve.ts @@ -1,17 +1,12 @@ -// @ts-check -// this is automtically detected by scripts/jestPerTestSetup.ts and will replace +// this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -const path = require('path') -const { ports } = require('../../testUtils') +import path from 'path' +import { ports } from '../../testUtils' -const port = (exports.port = ports['ssr-webworker']) +export const port = ports['ssr-webworker'] -/** - * @param {string} root - * @param {boolean} isProd - */ -exports.serve = async function serve(root, isProd) { +export async function serve(root: string, isProd: boolean) { // we build first, regardless of whether it's prod/build mode // because Vite doesn't support the concept of a "webworker server" const { build } = require('vite') diff --git a/playground/ssr-webworker/worker.js b/playground/ssr-webworker/worker.js index 09725aaa9d71bb..e9a51e320c9899 100644 --- a/playground/ssr-webworker/worker.js +++ b/playground/ssr-webworker/worker.js @@ -2,11 +2,11 @@ const path = require('path') const { Miniflare } = require('miniflare') -const isDev = process.env.DEV +const isTest = !!process.env.TEST -async function createServer(root = process.cwd()) { +async function createServer() { const mf = new Miniflare({ - scriptPath: path.resolve(root, 'dist/worker/entry-worker.js') + scriptPath: path.resolve(__dirname, 'dist/worker/entry-worker.js') }) const app = mf.createServer() @@ -14,7 +14,7 @@ async function createServer(root = process.cwd()) { return { app } } -if (isDev) { +if (!isTest) { createServer().then(({ app }) => app.listen(3000, () => { console.log('http://localhost:3000') diff --git a/playground/tailwind-sourcemap/__tests__/build.spec.ts b/playground/tailwind-sourcemap/__tests__/build.spec.ts index e36c1f52d2c1f8..50b8814aed9c4e 100644 --- a/playground/tailwind-sourcemap/__tests__/build.spec.ts +++ b/playground/tailwind-sourcemap/__tests__/build.spec.ts @@ -1,13 +1,7 @@ -import { isBuild } from 'testUtils' +import { isBuild } from '../../testUtils' -if (isBuild) { - test('should not output sourcemap warning (#4939)', () => { - serverLogs.forEach((log) => { - expect(log).not.toMatch('Sourcemap is likely to be incorrect') - }) +test.runIf(isBuild)('should not output sourcemap warning (#4939)', () => { + serverLogs.forEach((log) => { + expect(log).not.toMatch('Sourcemap is likely to be incorrect') }) -} else { - test('this file only includes test for build', () => { - expect(true).toBe(true) - }) -} +}) diff --git a/playground/tailwind-sourcemap/__tests__/serve.spec.ts b/playground/tailwind-sourcemap/__tests__/serve.spec.ts index d961f75e4536e5..8d4613190f02a2 100644 --- a/playground/tailwind-sourcemap/__tests__/serve.spec.ts +++ b/playground/tailwind-sourcemap/__tests__/serve.spec.ts @@ -1,13 +1,7 @@ -import { isBuild } from 'testUtils' +import { isBuild } from '../../testUtils' -if (!isBuild) { - test('should not output missing source file warning', () => { - serverLogs.forEach((log) => { - expect(log).not.toMatch(/Sourcemap for .+ points to missing source files/) - }) +test.runIf(isBuild)('should not output missing source file warning', () => { + serverLogs.forEach((log) => { + expect(log).not.toMatch(/Sourcemap for .+ points to missing source files/) }) -} else { - test('this file only includes test for serve', () => { - expect(true).toBe(true) - }) -} +}) diff --git a/playground/testUtils.ts b/playground/testUtils.ts index 7abf09eaada081..d423ba942923cb 100644 --- a/playground/testUtils.ts +++ b/playground/testUtils.ts @@ -1,6 +1,5 @@ // test utils used in e2e tests for playgrounds. -// this can be directly imported in any playground tests as 'testUtils', e.g. -// `import { getColor } from 'testUtils'` +// `import { getColor } from '../../testUtils'` import fs from 'fs' import path from 'path' @@ -9,6 +8,7 @@ import type { ElementHandle } from 'playwright-chromium' import type { Manifest } from 'vite' import { normalizePath } from 'vite' import { fromComment } from 'convert-source-map' +import { expect } from 'vitest' // make sure these ports are unique export const ports = { @@ -32,10 +32,13 @@ export function slash(p: string): string { } export const isBuild = !!process.env.VITE_TEST_BUILD +export const isServe = !isBuild -const testPath = expect.getState().testPath -const testName = slash(testPath).match(/playground\/([\w-]+)\//)?.[1] -export const testDir = path.resolve(__dirname, '../playground-temp', testName) +export const testDir = () => { + const testPath = expect.getState().testPath + const testName = slash(testPath).match(/playground\/([\w-]+)\//)?.[1] + return path.resolve(__dirname, '../playground-temp', testName) +} export const workspaceRoot = path.resolve(__dirname, '../') const hexToNameMap: Record = {} @@ -89,7 +92,7 @@ export async function getBgColor(el: string | ElementHandle): Promise { } export function readFile(filename: string): string { - return fs.readFileSync(path.resolve(testDir, filename), 'utf-8') + return fs.readFileSync(path.resolve(testDir(), filename), 'utf-8') } export function editFile( @@ -98,27 +101,27 @@ export function editFile( runInBuild: boolean = false ): void { if (isBuild && !runInBuild) return - filename = path.resolve(testDir, filename) + filename = path.resolve(testDir(), filename) const content = fs.readFileSync(filename, 'utf-8') const modified = replacer(content) fs.writeFileSync(filename, modified) } export function addFile(filename: string, content: string): void { - fs.writeFileSync(path.resolve(testDir, filename), content) + fs.writeFileSync(path.resolve(testDir(), filename), content) } export function removeFile(filename: string): void { - fs.unlinkSync(path.resolve(testDir, filename)) + fs.unlinkSync(path.resolve(testDir(), filename)) } export function listAssets(base = ''): string[] { - const assetsDir = path.join(testDir, 'dist', base, 'assets') + const assetsDir = path.join(testDir(), 'dist', base, 'assets') return fs.readdirSync(assetsDir) } export function findAssetFile(match: string | RegExp, base = ''): string { - const assetsDir = path.join(testDir, 'dist', base, 'assets') + const assetsDir = path.join(testDir(), 'dist', base, 'assets') const files = fs.readdirSync(assetsDir) const file = files.find((file) => { return file.match(match) @@ -128,7 +131,10 @@ export function findAssetFile(match: string | RegExp, base = ''): string { export function readManifest(base = ''): Manifest { return JSON.parse( - fs.readFileSync(path.join(testDir, 'dist', base, 'manifest.json'), 'utf-8') + fs.readFileSync( + path.join(testDir(), 'dist', base, 'manifest.json'), + 'utf-8' + ) ) } @@ -156,7 +162,7 @@ export async function untilUpdated( /** * Send the rebuild complete message in build watch */ -export { notifyRebuildComplete } from '../scripts/jestPerTestSetup' +export { notifyRebuildComplete } from '../scripts/vitestSetup' export const extractSourcemap = (content: string) => { const lines = content.trim().split('\n') @@ -164,7 +170,7 @@ export const extractSourcemap = (content: string) => { } export const formatSourcemapForSnapshot = (map: any) => { - const root = normalizePath(testDir) + const root = normalizePath(testDir()) const m = { ...map } delete m.file delete m.names diff --git a/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts b/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts index 699f658da6a255..30485918ea6e2d 100644 --- a/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts +++ b/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts @@ -1,6 +1,12 @@ -import { editFile, isBuild, readFile, untilUpdated } from '../../testUtils' +import { + editFile, + isBuild, + isServe, + readFile, + untilUpdated +} from '../../testUtils' -if (isBuild) { +describe.runIf(isBuild)('build', () => { test('should throw an error on build', () => { const buildError = beforeAllError expect(buildError).toBeTruthy() @@ -20,7 +26,9 @@ if (isBuild) { expect(err).toBeTruthy() expect(err.code).toBe('ENOENT') }) -} else { +}) + +describe.runIf(isServe)('server', () => { test('should log 500 error in browser for malformed tsconfig', () => { // don't test for actual complete message as this might be locale dependant. chrome does log 500 consistently though expect(browserLogs.find((x) => x.includes('500'))).toBeTruthy() @@ -47,4 +55,4 @@ if (isBuild) { return browserLogs.find((x) => x === 'tsconfig error fixed, file loaded') }, 'tsconfig error fixed, file loaded') }) -} +}) diff --git a/playground/tsconfig.json b/playground/tsconfig.json index d60edb9f78c801..06bea8c1328d7f 100644 --- a/playground/tsconfig.json +++ b/playground/tsconfig.json @@ -9,6 +9,6 @@ "moduleResolution": "node", "baseUrl": ".", "jsx": "preserve", - "types": ["vite/client", "jest", "node"] + "types": ["vite/client", "vitest/globals", "node"] } } diff --git a/playground/vue-jsx/__tests__/vue-jsx.spec.ts b/playground/vue-jsx/__tests__/vue-jsx.spec.ts index 275c918684119d..94c4eb147a0b84 100644 --- a/playground/vue-jsx/__tests__/vue-jsx.spec.ts +++ b/playground/vue-jsx/__tests__/vue-jsx.spec.ts @@ -1,4 +1,4 @@ -import { editFile, isBuild, untilUpdated } from 'testUtils' +import { editFile, isServe, untilUpdated } from '../../testUtils' test('should render', async () => { expect(await page.textContent('.named')).toMatch('0') @@ -29,7 +29,7 @@ test('should update', async () => { expect(await page.textContent('.jsx-with-query')).toMatch('7') }) -if (!isBuild) { +describe.runIf(isServe)('vue-jsx server', () => { test('hmr: named export', async () => { editFile('Comps.jsx', (code) => code.replace('named {count', 'named updated {count') @@ -113,4 +113,4 @@ if (!isBuild) { ) await untilUpdated(() => page.textContent('.setup-jsx'), '1000') }) -} +}) diff --git a/playground/vue-lib/__tests__/serve.js b/playground/vue-lib/__tests__/serve.js deleted file mode 100644 index 73f89eee44ea3e..00000000000000 --- a/playground/vue-lib/__tests__/serve.js +++ /dev/null @@ -1,7 +0,0 @@ -// @ts-check -// this is automtically detected by scripts/jestPerTestSetup.ts and will replace -// the default e2e test serve behavior - -exports.serve = async function serve() { - // do nothing, skip default behavior -} diff --git a/playground/vue-lib/__tests__/serve.ts b/playground/vue-lib/__tests__/serve.ts new file mode 100644 index 00000000000000..47c122339205eb --- /dev/null +++ b/playground/vue-lib/__tests__/serve.ts @@ -0,0 +1,6 @@ +// this is automatically detected by scripts/vitestSetup.ts and will replace +// the default e2e test serve behavior + +export async function serve() { + // do nothing, skip default behavior +} diff --git a/playground/vue-sourcemap/__tests__/build.spec.ts b/playground/vue-sourcemap/__tests__/build.spec.ts index e36c1f52d2c1f8..50b8814aed9c4e 100644 --- a/playground/vue-sourcemap/__tests__/build.spec.ts +++ b/playground/vue-sourcemap/__tests__/build.spec.ts @@ -1,13 +1,7 @@ -import { isBuild } from 'testUtils' +import { isBuild } from '../../testUtils' -if (isBuild) { - test('should not output sourcemap warning (#4939)', () => { - serverLogs.forEach((log) => { - expect(log).not.toMatch('Sourcemap is likely to be incorrect') - }) +test.runIf(isBuild)('should not output sourcemap warning (#4939)', () => { + serverLogs.forEach((log) => { + expect(log).not.toMatch('Sourcemap is likely to be incorrect') }) -} else { - test('this file only includes test for build', () => { - expect(true).toBe(true) - }) -} +}) diff --git a/playground/vue-sourcemap/__tests__/serve.spec.ts b/playground/vue-sourcemap/__tests__/serve.spec.ts index 7dfa271deea322..09ba69c03abfa4 100644 --- a/playground/vue-sourcemap/__tests__/serve.spec.ts +++ b/playground/vue-sourcemap/__tests__/serve.spec.ts @@ -1,11 +1,11 @@ import { extractSourcemap, formatSourcemapForSnapshot, - isBuild -} from 'testUtils' + isServe +} from '../../testUtils' import { URL } from 'url' -if (!isBuild) { +describe.runIf(isServe)('serve:vue-sourcemap', () => { const getStyleTagContentIncluding = async (content: string) => { const styles = await page.$$('style') for (const style of styles) { @@ -22,12 +22,12 @@ if (!isBuild) { const js = await res.text() const map = extractSourcemap(js) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": "AAKA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;AAGP;AACd,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;wBARlB,oBAAiB,WAAd,MAAU", - "sources": Array [ + "sources": [ "/root/Js.vue", ], - "sourcesContent": Array [ + "sourcesContent": [ " @@ -51,12 +51,12 @@ if (!isBuild) { const js = await res.text() const map = extractSourcemap(js) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": ";AAKA,QAAQ,IAAI,WAAW;;;;AAIvB,YAAQ,IAAI,UAAU;;;;;;;;uBARpB,oBAAiB,WAAd,MAAU", - "sources": Array [ + "sources": [ "/root/Ts.vue", ], - "sourcesContent": Array [ + "sourcesContent": [ " @@ -79,15 +79,15 @@ if (!isBuild) { const css = await getStyleTagContentIncluding('.css ') const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": ";AAQA;EACE,UAAU;AACZ", - "sources": Array [ + "sources": [ "/root/Css.vue", ], - "sourcesContent": Array [ + "sourcesContent": [ " @@ -130,15 +130,15 @@ if (!isBuild) { const css = await getStyleTagContentIncluding('._css-module_') const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": ";AAcA;EACE,UAAU;AACZ", - "sources": Array [ + "sources": [ "/root/Css.vue", ], - "sourcesContent": Array [ + "sourcesContent": [ " @@ -181,15 +181,15 @@ if (!isBuild) { const css = await getStyleTagContentIncluding('.css-scoped[data-v-') const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": ";AAoBA;EACE,UAAU;AACZ", - "sources": Array [ + "sources": [ "/root/Css.vue", ], - "sourcesContent": Array [ + "sourcesContent": [ " @@ -232,12 +232,12 @@ if (!isBuild) { const css = await getStyleTagContentIncluding('.sass ') const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": "AAKA;EACE", - "sources": Array [ + "sources": [ "/root/Sass.vue", ], - "sourcesContent": Array [ + "sourcesContent": [ " @@ -257,13 +257,13 @@ if (!isBuild) { const css = await getStyleTagContentIncluding('.sass-with-import ') const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": "AAAA;EACE;;ACOF;EACE", - "sources": Array [ + "sources": [ "/root/sassWithImportImported.sass", "/root/SassWithImport.vue", ], - "sourcesContent": Array [ + "sourcesContent": [ ".sass-with-import-imported color: red ", @@ -289,12 +289,12 @@ if (!isBuild) { const css = await getStyleTagContentIncluding('.less ') const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": "AAKA;EACE", - "sources": Array [ + "sources": [ "/root/Less.vue", ], - "sourcesContent": Array [ + "sourcesContent": [ " @@ -315,12 +315,12 @@ if (!isBuild) { const css = await getStyleTagContentIncluding('.src-import[data-v-') const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": "AAAA;EACE,UAAU;AACZ", - "sources": Array [ + "sources": [ "/root/src-import/src-import.css", ], - "sourcesContent": Array [ + "sourcesContent": [ ".src-import { color: red; } @@ -335,13 +335,13 @@ if (!isBuild) { const css = await getStyleTagContentIncluding('.src-import-sass[data-v-') const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": "AAAA;EACE;;ACCF;EACE", - "sources": Array [ + "sources": [ "/root/src-import/src-import-imported.sass", "/root/src-import/src-import.sass", ], - "sourcesContent": Array [ + "sourcesContent": [ ".src-import-sass-imported color: red ", @@ -355,8 +355,4 @@ if (!isBuild) { } `) }) -} else { - test('this file only includes test for serve', () => { - expect(true).toBe(true) - }) -} +}) diff --git a/playground/vue-sourcemap/vite.config.js b/playground/vue-sourcemap/vite.config.ts similarity index 62% rename from playground/vue-sourcemap/vite.config.js rename to playground/vue-sourcemap/vite.config.ts index 2a48cad3cb00d4..dbfa81dbeb1144 100644 --- a/playground/vue-sourcemap/vite.config.js +++ b/playground/vue-sourcemap/vite.config.ts @@ -1,9 +1,7 @@ -const vuePlugin = require('@vitejs/plugin-vue') +import vuePlugin from '@vitejs/plugin-vue' +import { defineConfig } from 'vite' -/** - * @type {import('vite').UserConfig} - */ -module.exports = { +export default defineConfig({ css: { devSourcemap: true, preprocessorOptions: { @@ -16,4 +14,4 @@ module.exports = { build: { sourcemap: true } -} +}) diff --git a/playground/vue/__tests__/vue.spec.ts b/playground/vue/__tests__/vue.spec.ts index 0bce5d1e1a03f5..f790bd612bfa9e 100644 --- a/playground/vue/__tests__/vue.spec.ts +++ b/playground/vue/__tests__/vue.spec.ts @@ -1,4 +1,10 @@ -import { editFile, getBg, getColor, isBuild, untilUpdated } from 'testUtils' +import { + editFile, + getBg, + getColor, + isBuild, + untilUpdated +} from '../../testUtils' test('should render', async () => { expect(await page.textContent('h1')).toMatch('Vue SFCs') diff --git a/playground/worker/__tests__/es/es-worker.spec.ts b/playground/worker/__tests__/es/es-worker.spec.ts index 61215f931c77dc..b836b081357e2e 100644 --- a/playground/worker/__tests__/es/es-worker.spec.ts +++ b/playground/worker/__tests__/es/es-worker.spec.ts @@ -44,7 +44,7 @@ const waitSharedWorkerTick = ( } )(0) -test.concurrent.each([[true], [false]])('shared worker', async (doTick) => { +test.each([[true], [false]])('shared worker', async (doTick) => { if (doTick) { await page.click('.tick-shared') } @@ -59,10 +59,10 @@ test('worker emitted and import.meta.url in nested worker (serve)', async () => ) }) -if (isBuild) { - const assetsDir = path.resolve(testDir, 'dist/es/assets') +describe.runIf(isBuild)('build', () => { // assert correct files test('inlined code generation', async () => { + const assetsDir = path.resolve(testDir(), 'dist/es/assets') const files = fs.readdirSync(assetsDir) expect(files.length).toBe(26) const index = files.find((f) => f.includes('main-module')) @@ -92,7 +92,7 @@ if (isBuild) { '"type":"constructor"' ) }) -} +}) test('module worker', async () => { expect(await page.textContent('.shared-worker-import-meta-url')).toMatch( diff --git a/playground/worker/__tests__/iife/worker.spec.ts b/playground/worker/__tests__/iife/worker.spec.ts index f49666e4918a25..cfa7dfe2e4537b 100644 --- a/playground/worker/__tests__/iife/worker.spec.ts +++ b/playground/worker/__tests__/iife/worker.spec.ts @@ -2,6 +2,7 @@ import fs from 'fs' import path from 'path' import { untilUpdated, isBuild, testDir } from '../../../testUtils' import type { Page } from 'playwright-chromium' +import { test } from 'vitest' test('normal', async () => { await page.click('.ping') @@ -44,7 +45,7 @@ const waitSharedWorkerTick = ( } )(0) -test.concurrent.each([[true], [false]])('shared worker', async (doTick) => { +test.each([[true], [false]])('shared worker', async (doTick) => { if (doTick) { await page.click('.tick-shared') } @@ -59,10 +60,10 @@ test('worker emitted and import.meta.url in nested worker (serve)', async () => ) }) -if (isBuild) { - const assetsDir = path.resolve(testDir, 'dist/iife/assets') +describe.runIf(isBuild)('build', () => { // assert correct files test('inlined code generation', async () => { + const assetsDir = path.resolve(testDir(), 'dist/iife/assets') const files = fs.readdirSync(assetsDir) expect(files.length).toBe(13) const index = files.find((f) => f.includes('main-module')) @@ -92,7 +93,7 @@ if (isBuild) { '"type":"constructor"' ) }) -} +}) test('module worker', async () => { expect(await page.textContent('.shared-worker-import-meta-url')).toMatch( diff --git a/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts b/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts index e4cb3318ebd5f5..ce2c52b5c98840 100644 --- a/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts +++ b/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts @@ -1,12 +1,15 @@ import fs from 'fs' import path from 'path' -import { untilUpdated, isBuild, testDir } from '../../../testUtils' -import { Page } from 'playwright-chromium' +import { isBuild, testDir } from '../../../testUtils' -if (isBuild) { - const assetsDir = path.resolve(testDir, 'dist/iife-sourcemap-hidden/assets') +describe.runIf(isBuild)('build', () => { // assert correct files test('sourcemap generation for web workers', async () => { + const assetsDir = path.resolve( + testDir(), + 'dist/iife-sourcemap-hidden/assets' + ) + const files = fs.readdirSync(assetsDir) // should have 2 worker chunk expect(files.length).toBe(26) @@ -110,13 +113,7 @@ if (isBuild) { `new Worker("/iife-sourcemap-hidden/assets/sub-worker` ) }) -} else { - // Workaround so that testing serve does not emit - // "Your test suite must contain at least one test" - test('true', () => { - expect(true).toBe(true) - }) -} +}) function getSourceMapUrl(code: string): string { const regex = /\/\/[#@]\s(?:source(?:Mapping)?URL)=\s*(\S+)/g diff --git a/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts b/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts index ceda7dae1fec7c..0fe97386f178df 100644 --- a/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts +++ b/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts @@ -1,12 +1,15 @@ import fs from 'fs' import path from 'path' -import { untilUpdated, isBuild, testDir } from '../../../testUtils' -import { Page } from 'playwright-chromium' +import { isBuild, testDir } from '../../../testUtils' -if (isBuild) { - const assetsDir = path.resolve(testDir, 'dist/iife-sourcemap-inline/assets') +describe.runIf(isBuild)('build', () => { // assert correct files test('sourcemap generation for web workers', async () => { + const assetsDir = path.resolve( + testDir(), + 'dist/iife-sourcemap-inline/assets' + ) + const files = fs.readdirSync(assetsDir) // should have 2 worker chunk expect(files.length).toBe(13) @@ -93,13 +96,7 @@ if (isBuild) { `new Worker("/iife-sourcemap-inline/assets/sub-worker` ) }) -} else { - // Workaround so that testing serve does not emit - // "Your test suite must contain at least one test" - test('true', () => { - expect(true).toBe(true) - }) -} +}) function getSourceMapUrl(code: string): string { const regex = /\/\/[#@]\s(?:source(?:Mapping)?URL)=\s*(\S+)/g diff --git a/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts b/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts index 04cc079b4bc289..3b074f24990f4b 100644 --- a/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts +++ b/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts @@ -1,12 +1,11 @@ import fs from 'fs' import path from 'path' -import { untilUpdated, isBuild, testDir } from '../../../testUtils' -import { Page } from 'playwright-chromium' +import { isBuild, testDir } from '../../../testUtils' -if (isBuild) { - const assetsDir = path.resolve(testDir, 'dist/iife-sourcemap/assets') +describe.runIf(isBuild)('build', () => { // assert correct files test('sourcemap generation for web workers', async () => { + const assetsDir = path.resolve(testDir(), 'dist/iife-sourcemap/assets') const files = fs.readdirSync(assetsDir) // should have 2 worker chunk expect(files.length).toBe(26) @@ -112,13 +111,7 @@ if (isBuild) { `new Worker("/iife-sourcemap/assets/sub-worker` ) }) -} else { - // Workaround so that testing serve does not emit - // "Your test suite must contain at least one test" - test('true', () => { - expect(true).toBe(true) - }) -} +}) function getSourceMapUrl(code: string): string { const regex = /\/\/[#@]\s(?:source(?:Mapping)?URL)=\s*(\S+)/g diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1a06a82b104080..18dbe1e00545ac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,8 +11,8 @@ importers: .: specifiers: '@microsoft/api-extractor': ^7.23.1 + '@types/babel__core': ^7.1.19 '@types/fs-extra': ^9.0.13 - '@types/jest': ^27.5.0 '@types/node': ^17.0.31 '@types/prompts': ^2.4.0 '@types/semver': ^7.3.9 @@ -26,7 +26,7 @@ importers: eslint-plugin-node: ^11.1.0 execa: ^5.1.1 fs-extra: ^10.1.0 - jest: ^27.5.1 + kill-port: ^1.6.1 lint-staged: ^12.4.1 minimist: ^1.2.6 node-fetch: ^2.6.7 @@ -40,16 +40,15 @@ importers: semver: ^7.3.7 simple-git-hooks: ^2.7.0 sirv: ^2.0.2 - ts-jest: ^27.1.4 ts-node: ^10.7.0 typescript: ^4.6.4 vite: workspace:* vitepress: ^0.22.4 - vitest: ^0.10.5 + vitest: ^0.12.4 devDependencies: '@microsoft/api-extractor': 7.23.1 + '@types/babel__core': 7.1.19 '@types/fs-extra': 9.0.13 - '@types/jest': 27.5.0 '@types/node': 17.0.31 '@types/prompts': 2.4.0 '@types/semver': 7.3.9 @@ -63,7 +62,7 @@ importers: eslint-plugin-node: 11.1.0_eslint@8.15.0 execa: 5.1.1 fs-extra: 10.1.0 - jest: 27.5.1_ts-node@10.7.0 + kill-port: 1.6.1 lint-staged: 12.4.1 minimist: 1.2.6 node-fetch: 2.6.7 @@ -77,12 +76,11 @@ importers: semver: 7.3.7 simple-git-hooks: 2.7.0 sirv: 2.0.2 - ts-jest: 27.1.4_edb1f862ecf73b6f0cc1f906c6266936 ts-node: 10.7.0_5f3e12794cebfbf3197131903b74d233 typescript: 4.6.4 vite: link:packages/vite vitepress: 0.22.4 - vitest: 0.10.5 + vitest: 0.12.4 packages/create-vite: specifiers: @@ -1108,6 +1106,7 @@ packages: /@babel/compat-data/7.17.10: resolution: {integrity: sha512-GZt/TCsG70Ms19gfZO1tM4CVnXsPgEPBCpJu+Qz3L0LUDsY5nZqFZglIoPC1kIYOtNBZlrnFT+klg12vFGZXrw==} engines: {node: '>=6.9.0'} + dev: false /@babel/core/7.17.10: resolution: {integrity: sha512-liKoppandF3ZcBnIYFjfSDHZLKdLHGJRkoWtG8zQyGJBQfIYobpnVGI5+pLBNtS6psFLDzyq8+h5HiVljW9PNA==} @@ -1130,6 +1129,7 @@ packages: semver: 6.3.0 transitivePeerDependencies: - supports-color + dev: false /@babel/generator/7.17.10: resolution: {integrity: sha512-46MJZZo9y3o4kmhBVc7zW7i8dtR1oIK/sdO5NcfcZRhTGYi+KKJRtHNgsU6c4VUcJmUNV/LQdebD/9Dlv4K+Tg==} @@ -1138,6 +1138,7 @@ packages: '@babel/types': 7.17.10 '@jridgewell/gen-mapping': 0.1.1 jsesc: 2.5.2 + dev: false /@babel/helper-annotate-as-pure/7.16.7: resolution: {integrity: sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw==} @@ -1157,6 +1158,7 @@ packages: '@babel/helper-validator-option': 7.16.7 browserslist: 4.20.3 semver: 6.3.0 + dev: false /@babel/helper-create-class-features-plugin/7.17.9_@babel+core@7.17.10: resolution: {integrity: sha512-kUjip3gruz6AJKOq5i3nC6CoCEEF/oHH3cp6tOZhB+IyyyPyW0g1Gfsxn3mkk6S08pIA2y8GQh609v9G/5sHVQ==} @@ -1181,6 +1183,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.17.10 + dev: false /@babel/helper-function-name/7.17.9: resolution: {integrity: sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg==} @@ -1188,12 +1191,14 @@ packages: dependencies: '@babel/template': 7.16.7 '@babel/types': 7.17.10 + dev: false /@babel/helper-hoist-variables/7.16.7: resolution: {integrity: sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==} engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.17.10 + dev: false /@babel/helper-member-expression-to-functions/7.17.7: resolution: {integrity: sha512-thxXgnQ8qQ11W2wVUObIqDL4p148VMxkt5T/qpN5k2fboRyzFGFmKsTGViquyM5QHKUy48OZoca8kw4ajaDPyw==} @@ -1222,6 +1227,7 @@ packages: '@babel/types': 7.17.10 transitivePeerDependencies: - supports-color + dev: false /@babel/helper-optimise-call-expression/7.16.7: resolution: {integrity: sha512-EtgBhg7rd/JcnpZFXpBy0ze1YRfdm7BnBX4uKMBd3ixa3RGAE002JZB66FJyNH7g0F38U05pXmA5P8cBh7z+1w==} @@ -1252,12 +1258,14 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.17.10 + dev: false /@babel/helper-split-export-declaration/7.16.7: resolution: {integrity: sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==} engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.17.10 + dev: false /@babel/helper-validator-identifier/7.16.7: resolution: {integrity: sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==} @@ -1266,6 +1274,7 @@ packages: /@babel/helper-validator-option/7.16.7: resolution: {integrity: sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==} engines: {node: '>=6.9.0'} + dev: false /@babel/helpers/7.17.9: resolution: {integrity: sha512-cPCt915ShDWUEzEp3+UNRktO2n6v49l5RSnG9M5pS24hA+2FAc5si+Pn1i4VVbQQ+jh+bIZhPFQOJOzbrOYY1Q==} @@ -1276,6 +1285,7 @@ packages: '@babel/types': 7.17.10 transitivePeerDependencies: - supports-color + dev: false /@babel/highlight/7.17.9: resolution: {integrity: sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==} @@ -1300,33 +1310,6 @@ packages: '@babel/plugin-syntax-pipeline-operator': 7.17.0 dev: true - /@babel/plugin-syntax-async-generators/7.8.4_@babel+core@7.17.10: - resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.17.10 - '@babel/helper-plugin-utils': 7.16.7 - dev: true - - /@babel/plugin-syntax-bigint/7.8.3_@babel+core@7.17.10: - resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.17.10 - '@babel/helper-plugin-utils': 7.16.7 - dev: true - - /@babel/plugin-syntax-class-properties/7.12.13_@babel+core@7.17.10: - resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.17.10 - '@babel/helper-plugin-utils': 7.16.7 - dev: true - /@babel/plugin-syntax-import-meta/7.10.4_@babel+core@7.17.10: resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} peerDependencies: @@ -1334,15 +1317,7 @@ packages: dependencies: '@babel/core': 7.17.10 '@babel/helper-plugin-utils': 7.16.7 - - /@babel/plugin-syntax-json-strings/7.8.3_@babel+core@7.17.10: - resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.17.10 - '@babel/helper-plugin-utils': 7.16.7 - dev: true + dev: false /@babel/plugin-syntax-jsx/7.16.7: resolution: {integrity: sha512-Esxmk7YjA8QysKeT3VhTXvF6y77f/a91SIs4pWb4H2eWGQkCKFgQaG6hdoEVZtGsrAcb2K5BW66XsOErD4WU3Q==} @@ -1362,60 +1337,6 @@ packages: '@babel/helper-plugin-utils': 7.16.7 dev: false - /@babel/plugin-syntax-logical-assignment-operators/7.10.4_@babel+core@7.17.10: - resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.17.10 - '@babel/helper-plugin-utils': 7.16.7 - dev: true - - /@babel/plugin-syntax-nullish-coalescing-operator/7.8.3_@babel+core@7.17.10: - resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.17.10 - '@babel/helper-plugin-utils': 7.16.7 - dev: true - - /@babel/plugin-syntax-numeric-separator/7.10.4_@babel+core@7.17.10: - resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.17.10 - '@babel/helper-plugin-utils': 7.16.7 - dev: true - - /@babel/plugin-syntax-object-rest-spread/7.8.3_@babel+core@7.17.10: - resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.17.10 - '@babel/helper-plugin-utils': 7.16.7 - dev: true - - /@babel/plugin-syntax-optional-catch-binding/7.8.3_@babel+core@7.17.10: - resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.17.10 - '@babel/helper-plugin-utils': 7.16.7 - dev: true - - /@babel/plugin-syntax-optional-chaining/7.8.3_@babel+core@7.17.10: - resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.17.10 - '@babel/helper-plugin-utils': 7.16.7 - dev: true - /@babel/plugin-syntax-pipeline-operator/7.17.0: resolution: {integrity: sha512-vNE+4pNAOk2Q0BkyTf+XMwZ53vMDJ7Ic/Z85sruaJfJJ+4O5k/61z2a4Xj3CSl9kKRlXOALbsxWca0vZz7ENbw==} engines: {node: '>=6.9.0'} @@ -1425,16 +1346,6 @@ packages: '@babel/helper-plugin-utils': 7.16.7 dev: true - /@babel/plugin-syntax-top-level-await/7.14.5_@babel+core@7.17.10: - resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.17.10 - '@babel/helper-plugin-utils': 7.16.7 - dev: true - /@babel/plugin-syntax-typescript/7.17.10_@babel+core@7.17.10: resolution: {integrity: sha512-xJefea1DWXW09pW4Tm9bjwVlPDyYA2it3fWlmEjpYz6alPvTUjL0EOzNzI/FEOyI3r4/J7uVH5UqKgl1TQ5hqQ==} engines: {node: '>=6.9.0'} @@ -1443,6 +1354,7 @@ packages: dependencies: '@babel/core': 7.17.10 '@babel/helper-plugin-utils': 7.16.7 + dev: false /@babel/plugin-transform-react-jsx-development/7.16.7_@babel+core@7.17.10: resolution: {integrity: sha512-RMvQWvpla+xy6MlBpPlrKZCMRs2AGiHOGHY3xRwl0pEeim348dDyxeH4xBsMPbIMhujeq7ihE702eM2Ew0Wo+A==} @@ -1520,6 +1432,7 @@ packages: '@babel/code-frame': 7.16.7 '@babel/parser': 7.17.10 '@babel/types': 7.17.10 + dev: false /@babel/traverse/7.17.10: resolution: {integrity: sha512-VmbrTHQteIdUUQNTb+zE12SHS/xQVIShmBPhlNP12hD5poF2pbITW1Z4172d03HegaQWhLffdkRJYtAzp0AGcw==} @@ -1537,6 +1450,7 @@ packages: globals: 11.12.0 transitivePeerDependencies: - supports-color + dev: false /@babel/types/7.17.10: resolution: {integrity: sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A==} @@ -1545,10 +1459,6 @@ packages: '@babel/helper-validator-identifier': 7.16.7 to-fast-properties: 2.0.0 - /@bcoe/v8-coverage/0.2.3: - resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} - dev: true - /@cloudflare/workers-types/2.2.2: resolution: {integrity: sha512-kaMn2rueJ0PL1TYVGknTCh0X0x0d9G+FNXAFep7/4uqecEZoQb/63o6rOmMuiqI09zLuHV6xhKRXinokV/MY9A==} dev: true @@ -1716,213 +1626,6 @@ packages: resolution: {integrity: sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==} dev: true - /@istanbuljs/load-nyc-config/1.1.0: - resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} - engines: {node: '>=8'} - dependencies: - camelcase: 5.3.1 - find-up: 4.1.0 - get-package-type: 0.1.0 - js-yaml: 3.14.1 - resolve-from: 5.0.0 - dev: true - - /@istanbuljs/schema/0.1.3: - resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} - engines: {node: '>=8'} - dev: true - - /@jest/console/27.5.1: - resolution: {integrity: sha512-kZ/tNpS3NXn0mlXXXPNuDZnb4c0oZ20r4K5eemM2k30ZC3G0T02nXUvyhf5YdbXWHPEJLc9qGLxEZ216MdL+Zg==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - chalk: 4.1.2 - jest-message-util: 27.5.1 - jest-util: 27.5.1 - slash: 3.0.0 - dev: true - - /@jest/core/27.5.1_ts-node@10.7.0: - resolution: {integrity: sha512-AK6/UTrvQD0Cd24NSqmIA6rKsu0tKIxfiCducZvqxYdmMisOYAsdItspT+fQDQYARPf8XgjAFZi0ogW2agH5nQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - dependencies: - '@jest/console': 27.5.1 - '@jest/reporters': 27.5.1 - '@jest/test-result': 27.5.1 - '@jest/transform': 27.5.1 - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - ansi-escapes: 4.3.2 - chalk: 4.1.2 - emittery: 0.8.1 - exit: 0.1.2 - graceful-fs: 4.2.10 - jest-changed-files: 27.5.1 - jest-config: 27.5.1_ts-node@10.7.0 - jest-haste-map: 27.5.1 - jest-message-util: 27.5.1 - jest-regex-util: 27.5.1 - jest-resolve: 27.5.1 - jest-resolve-dependencies: 27.5.1 - jest-runner: 27.5.1 - jest-runtime: 27.5.1 - jest-snapshot: 27.5.1 - jest-util: 27.5.1 - jest-validate: 27.5.1 - jest-watcher: 27.5.1 - micromatch: 4.0.5 - rimraf: 3.0.2 - slash: 3.0.0 - strip-ansi: 6.0.1 - transitivePeerDependencies: - - bufferutil - - canvas - - supports-color - - ts-node - - utf-8-validate - dev: true - - /@jest/environment/27.5.1: - resolution: {integrity: sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/fake-timers': 27.5.1 - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - jest-mock: 27.5.1 - dev: true - - /@jest/fake-timers/27.5.1: - resolution: {integrity: sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.5.1 - '@sinonjs/fake-timers': 8.1.0 - '@types/node': 17.0.31 - jest-message-util: 27.5.1 - jest-mock: 27.5.1 - jest-util: 27.5.1 - dev: true - - /@jest/globals/27.5.1: - resolution: {integrity: sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/environment': 27.5.1 - '@jest/types': 27.5.1 - expect: 27.5.1 - dev: true - - /@jest/reporters/27.5.1: - resolution: {integrity: sha512-cPXh9hWIlVJMQkVk84aIvXuBB4uQQmFqZiacloFuGiP3ah1sbCxCosidXFDfqG8+6fO1oR2dTJTlsOy4VFmUfw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - dependencies: - '@bcoe/v8-coverage': 0.2.3 - '@jest/console': 27.5.1 - '@jest/test-result': 27.5.1 - '@jest/transform': 27.5.1 - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - chalk: 4.1.2 - collect-v8-coverage: 1.0.1 - exit: 0.1.2 - glob: 7.2.0 - graceful-fs: 4.2.10 - istanbul-lib-coverage: 3.2.0 - istanbul-lib-instrument: 5.2.0 - istanbul-lib-report: 3.0.0 - istanbul-lib-source-maps: 4.0.1 - istanbul-reports: 3.1.4 - jest-haste-map: 27.5.1 - jest-resolve: 27.5.1 - jest-util: 27.5.1 - jest-worker: 27.5.1 - slash: 3.0.0 - source-map: 0.6.1 - string-length: 4.0.2 - terminal-link: 2.1.1 - v8-to-istanbul: 8.1.1 - transitivePeerDependencies: - - supports-color - dev: true - - /@jest/source-map/27.5.1: - resolution: {integrity: sha512-y9NIHUYF3PJRlHk98NdC/N1gl88BL08aQQgu4k4ZopQkCw9t9cV8mtl3TV8b/YCB8XaVTFrmUTAJvjsntDireg==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - callsites: 3.1.0 - graceful-fs: 4.2.10 - source-map: 0.6.1 - dev: true - - /@jest/test-result/27.5.1: - resolution: {integrity: sha512-EW35l2RYFUcUQxFJz5Cv5MTOxlJIQs4I7gxzi2zVU7PJhOwfYq1MdC5nhSmYjX1gmMmLPvB3sIaC+BkcHRBfag==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/console': 27.5.1 - '@jest/types': 27.5.1 - '@types/istanbul-lib-coverage': 2.0.4 - collect-v8-coverage: 1.0.1 - dev: true - - /@jest/test-sequencer/27.5.1: - resolution: {integrity: sha512-LCheJF7WB2+9JuCS7VB/EmGIdQuhtqjRNI9A43idHv3E4KltCTsPsLxvdaubFHSYwY/fNjMWjl6vNRhDiN7vpQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/test-result': 27.5.1 - graceful-fs: 4.2.10 - jest-haste-map: 27.5.1 - jest-runtime: 27.5.1 - transitivePeerDependencies: - - supports-color - dev: true - - /@jest/transform/27.5.1: - resolution: {integrity: sha512-ipON6WtYgl/1329g5AIJVbUuEh0wZVbdpGwC99Jw4LwuoBNS95MVphU6zOeD9pDkon+LLbFL7lOQRapbB8SCHw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@babel/core': 7.17.10 - '@jest/types': 27.5.1 - babel-plugin-istanbul: 6.1.1 - chalk: 4.1.2 - convert-source-map: 1.8.0 - fast-json-stable-stringify: 2.1.0 - graceful-fs: 4.2.10 - jest-haste-map: 27.5.1 - jest-regex-util: 27.5.1 - jest-util: 27.5.1 - micromatch: 4.0.5 - pirates: 4.0.5 - slash: 3.0.0 - source-map: 0.6.1 - write-file-atomic: 3.0.3 - transitivePeerDependencies: - - supports-color - dev: true - - /@jest/types/27.5.1: - resolution: {integrity: sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@types/istanbul-lib-coverage': 2.0.4 - '@types/istanbul-reports': 3.0.1 - '@types/node': 17.0.31 - '@types/yargs': 16.0.4 - chalk: 4.1.2 - dev: true - /@jridgewell/gen-mapping/0.1.1: resolution: {integrity: sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==} engines: {node: '>=6.0.0'} @@ -2190,23 +1893,6 @@ packages: string-argv: 0.3.1 dev: true - /@sinonjs/commons/1.8.3: - resolution: {integrity: sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==} - dependencies: - type-detect: 4.0.8 - dev: true - - /@sinonjs/fake-timers/8.1.0: - resolution: {integrity: sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg==} - dependencies: - '@sinonjs/commons': 1.8.3 - dev: true - - /@tootallnate/once/1.1.2: - resolution: {integrity: sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==} - engines: {node: '>= 6'} - dev: true - /@tsconfig/node10/1.0.8: resolution: {integrity: sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==} dev: true @@ -2310,39 +1996,10 @@ packages: '@types/node': 17.0.31 dev: true - /@types/graceful-fs/4.1.5: - resolution: {integrity: sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==} - dependencies: - '@types/node': 17.0.31 - dev: true - /@types/hash-sum/1.0.0: resolution: {integrity: sha512-FdLBT93h3kcZ586Aee66HPCVJ6qvxVjBlDWNmxSGSbCZe9hTsjRKdSsl4y1T+3zfujxo9auykQMnFsfyHWD7wg==} dev: true - /@types/istanbul-lib-coverage/2.0.4: - resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==} - dev: true - - /@types/istanbul-lib-report/3.0.0: - resolution: {integrity: sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==} - dependencies: - '@types/istanbul-lib-coverage': 2.0.4 - dev: true - - /@types/istanbul-reports/3.0.1: - resolution: {integrity: sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==} - dependencies: - '@types/istanbul-lib-report': 3.0.0 - dev: true - - /@types/jest/27.5.0: - resolution: {integrity: sha512-9RBFx7r4k+msyj/arpfaa0WOOEcaAZNmN+j80KFbFCoSqCJGHTz7YMAMGQW9Xmqm5w6l5c25vbSjMwlikJi5+g==} - dependencies: - jest-matcher-utils: 27.5.1 - pretty-format: 27.5.1 - dev: true - /@types/json-schema/7.0.11: resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} dev: true @@ -2388,10 +2045,6 @@ packages: /@types/parse-json/4.0.0: resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} - /@types/prettier/2.6.0: - resolution: {integrity: sha512-G/AdOadiZhnJp0jXCaBQU449W2h716OW/EoXeYkCytxKL06X1WCXB4DZpp8TpZ8eyIJVS1cw4lrlkkSYU21cDw==} - dev: true - /@types/prompts/2.4.0: resolution: {integrity: sha512-7th8Opn+0XlN0O6qzO7dXOPwL6rigq/EwRS2DntaTHwSw8cLaYKeAPt5dWEKHSL+ffVSUl1itTPUC06+FlsV4Q==} dev: true @@ -2420,10 +2073,6 @@ packages: resolution: {integrity: sha512-TgfOX+mGY/NyNxJLIbDWrO9DjGoVSW9+aB8H2yy1fy32jsvxijhmyJI9fDFgvz3YP4lvJaq9DzdR/M1bOgVc9g==} dev: true - /@types/stack-utils/2.0.1: - resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==} - dev: true - /@types/stylus/0.48.37: resolution: {integrity: sha512-IkLnS/GzdDK3rgAmQwLr8LqPvUMa43SHlCnXqsfXNukwaIpiXBNgSHil3ro8aemhF4k4ZiMoa4URE7mwBHPJnQ==} dependencies: @@ -2436,16 +2085,6 @@ packages: '@types/node': 17.0.31 dev: true - /@types/yargs-parser/21.0.0: - resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==} - dev: true - - /@types/yargs/16.0.4: - resolution: {integrity: sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==} - dependencies: - '@types/yargs-parser': 21.0.0 - dev: true - /@types/yauzl/2.10.0: resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} requiresBuild: true @@ -2691,10 +2330,6 @@ packages: through: 2.3.8 dev: true - /abab/2.0.6: - resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} - dev: true - /abbrev/1.1.1: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} dev: false @@ -2707,13 +2342,6 @@ packages: negotiator: 0.6.3 dev: true - /acorn-globals/6.0.0: - resolution: {integrity: sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==} - dependencies: - acorn: 7.4.1 - acorn-walk: 7.2.0 - dev: true - /acorn-jsx/5.3.2_acorn@8.7.1: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -2733,6 +2361,7 @@ packages: /acorn-walk/7.2.0: resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==} engines: {node: '>=0.4.0'} + dev: false /acorn-walk/8.2.0: resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} @@ -2826,11 +2455,6 @@ packages: dependencies: color-convert: 2.0.1 - /ansi-styles/5.2.0: - resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} - engines: {node: '>=10'} - dev: true - /ansi-styles/6.1.0: resolution: {integrity: sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==} engines: {node: '>=12'} @@ -2920,10 +2544,6 @@ packages: engines: {node: '>=8'} dev: true - /asynckit/0.4.0: - resolution: {integrity: sha1-x57Zf380y48robyXkLzDZkdLS3k=} - dev: true - /atob/2.1.2: resolution: {integrity: sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==} engines: {node: '>= 4.5.0'} @@ -2953,89 +2573,16 @@ packages: - debug dev: false - /babel-jest/27.5.1_@babel+core@7.17.10: - resolution: {integrity: sha512-cdQ5dXjGRd0IBRATiQ4mZGlGlRE8kJpjPOixdNRdT+m3UcNqmYWN6rK6nvtXYfY3D76cb8s/O1Ss8ea24PIwcg==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - peerDependencies: - '@babel/core': ^7.8.0 + /babel-plugin-macros/2.8.0: + resolution: {integrity: sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==} dependencies: - '@babel/core': 7.17.10 - '@jest/transform': 27.5.1 - '@jest/types': 27.5.1 - '@types/babel__core': 7.1.19 - babel-plugin-istanbul: 6.1.1 - babel-preset-jest: 27.5.1_@babel+core@7.17.10 - chalk: 4.1.2 - graceful-fs: 4.2.10 - slash: 3.0.0 - transitivePeerDependencies: - - supports-color - dev: true + '@babel/runtime': 7.17.9 + cosmiconfig: 6.0.0 + resolve: 1.22.0 - /babel-plugin-istanbul/6.1.1: - resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==} - engines: {node: '>=8'} - dependencies: - '@babel/helper-plugin-utils': 7.16.7 - '@istanbuljs/load-nyc-config': 1.1.0 - '@istanbuljs/schema': 0.1.3 - istanbul-lib-instrument: 5.2.0 - test-exclude: 6.0.0 - transitivePeerDependencies: - - supports-color - dev: true - - /babel-plugin-jest-hoist/27.5.1: - resolution: {integrity: sha512-50wCwD5EMNW4aRpOwtqzyZHIewTYNxLA4nhB+09d8BIssfNfzBRhkBIHiaPv1Si226TQSvp8gxAJm2iY2qs2hQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@babel/template': 7.16.7 - '@babel/types': 7.17.10 - '@types/babel__core': 7.1.19 - '@types/babel__traverse': 7.17.1 - dev: true - - /babel-plugin-macros/2.8.0: - resolution: {integrity: sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==} - dependencies: - '@babel/runtime': 7.17.9 - cosmiconfig: 6.0.0 - resolve: 1.22.0 - - /babel-preset-current-node-syntax/1.0.1_@babel+core@7.17.10: - resolution: {integrity: sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==} - peerDependencies: - '@babel/core': ^7.0.0 - dependencies: - '@babel/core': 7.17.10 - '@babel/plugin-syntax-async-generators': 7.8.4_@babel+core@7.17.10 - '@babel/plugin-syntax-bigint': 7.8.3_@babel+core@7.17.10 - '@babel/plugin-syntax-class-properties': 7.12.13_@babel+core@7.17.10 - '@babel/plugin-syntax-import-meta': 7.10.4_@babel+core@7.17.10 - '@babel/plugin-syntax-json-strings': 7.8.3_@babel+core@7.17.10 - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4_@babel+core@7.17.10 - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3_@babel+core@7.17.10 - '@babel/plugin-syntax-numeric-separator': 7.10.4_@babel+core@7.17.10 - '@babel/plugin-syntax-object-rest-spread': 7.8.3_@babel+core@7.17.10 - '@babel/plugin-syntax-optional-catch-binding': 7.8.3_@babel+core@7.17.10 - '@babel/plugin-syntax-optional-chaining': 7.8.3_@babel+core@7.17.10 - '@babel/plugin-syntax-top-level-await': 7.14.5_@babel+core@7.17.10 - dev: true - - /babel-preset-jest/27.5.1_@babel+core@7.17.10: - resolution: {integrity: sha512-Nptf2FzlPCWYuJg41HBqXVT8ym6bXOevuCTbhxlUpjwtysGaIWFvDEjp4y+G7fl13FgOdjs7P/DmErqH7da0Ag==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - peerDependencies: - '@babel/core': ^7.0.0 - dependencies: - '@babel/core': 7.17.10 - babel-plugin-jest-hoist: 27.5.1 - babel-preset-current-node-syntax: 1.0.1_@babel+core@7.17.10 - dev: true - - /babel-walk/3.0.0-canary-5: - resolution: {integrity: sha512-GAwkz0AihzY5bkwIY5QDR+LvsRQgB/B+1foMPvi0FZPMl5fjD7ICiznUiBdLYMH1QYe6vqu4gWYytZOccLouFw==} - engines: {node: '>= 10.0.0'} + /babel-walk/3.0.0-canary-5: + resolution: {integrity: sha512-GAwkz0AihzY5bkwIY5QDR+LvsRQgB/B+1foMPvi0FZPMl5fjD7ICiznUiBdLYMH1QYe6vqu4gWYytZOccLouFw==} + engines: {node: '>= 10.0.0'} dependencies: '@babel/types': 7.17.10 dev: true @@ -3098,10 +2645,6 @@ packages: dependencies: fill-range: 7.0.1 - /browser-process-hrtime/1.0.0: - resolution: {integrity: sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==} - dev: true - /browserslist/4.20.3: resolution: {integrity: sha512-NBhymBQl1zM0Y5dQT/O+xiLP9/rzOIQdKM/eMJBAq7yBgaB6krIYLGejrwVYnSHZdqjscB1SPuAjHwxjvN6Wdg==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -3112,19 +2655,7 @@ packages: escalade: 3.1.1 node-releases: 2.0.4 picocolors: 1.0.0 - - /bs-logger/0.2.6: - resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==} - engines: {node: '>= 6'} - dependencies: - fast-json-stable-stringify: 2.1.0 - dev: true - - /bser/2.1.1: - resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} - dependencies: - node-int64: 0.4.0 - dev: true + dev: false /buffer-crc32/0.2.13: resolution: {integrity: sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=} @@ -3193,9 +2724,11 @@ packages: /camelcase/6.3.0: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} + dev: false /caniuse-lite/1.0.30001338: resolution: {integrity: sha512-1gLHWyfVoRDsHieO+CaeYe7jSo/MT7D7lhaXUiwwbuR5BwQxORs0f1tAwUSQr3YbxRXJvxHM/PA5FfPQRnsPeQ==} + dev: false /chai/4.3.6: resolution: {integrity: sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==} @@ -3225,11 +2758,6 @@ packages: ansi-styles: 4.3.0 supports-color: 7.2.0 - /char-regex/1.0.2: - resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} - engines: {node: '>=10'} - dev: true - /character-parser/2.2.0: resolution: {integrity: sha1-x84o821LzZdE5f/CxfzeHHMmH8A=} dependencies: @@ -3259,14 +2787,6 @@ packages: engines: {node: '>=10'} dev: false - /ci-info/3.3.0: - resolution: {integrity: sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==} - dev: true - - /cjs-module-lexer/1.2.2: - resolution: {integrity: sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==} - dev: true - /cjstoesm/1.1.4_typescript@4.6.4: resolution: {integrity: sha512-cixLJwK2HS8R8J1jJcYwlrLxWUbdNms5EmVQuvP3O0CGvHNv2WVd2gnqTP/tbTEYzbgWiSYQBZDoAakqsSl94Q==} engines: {node: '>=10.0.0'} @@ -3335,15 +2855,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /co/4.6.0: - resolution: {integrity: sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=} - engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} - dev: true - - /collect-v8-coverage/1.0.1: - resolution: {integrity: sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==} - dev: true - /color-convert/1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: @@ -3395,13 +2906,6 @@ packages: engines: {node: '>=0.1.90'} dev: true - /combined-stream/1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} - dependencies: - delayed-stream: 1.0.0 - dev: true - /commander/2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} dev: true @@ -3786,21 +3290,6 @@ packages: engines: {node: '>=4'} hasBin: true - /cssom/0.3.8: - resolution: {integrity: sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==} - dev: true - - /cssom/0.4.4: - resolution: {integrity: sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==} - dev: true - - /cssstyle/2.3.0: - resolution: {integrity: sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==} - engines: {node: '>=8'} - dependencies: - cssom: 0.3.8 - dev: true - /csstype/2.6.20: resolution: {integrity: sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==} @@ -3819,15 +3308,6 @@ packages: engines: {node: '>=8'} dev: true - /data-urls/2.0.0: - resolution: {integrity: sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ==} - engines: {node: '>=10'} - dependencies: - abab: 2.0.6 - whatwg-mimetype: 2.3.0 - whatwg-url: 8.7.0 - dev: true - /dateformat/3.0.3: resolution: {integrity: sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==} dev: true @@ -3900,19 +3380,11 @@ packages: engines: {node: '>=0.10.0'} dev: true - /decimal.js/10.3.1: - resolution: {integrity: sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==} - dev: true - /decode-uri-component/0.2.0: resolution: {integrity: sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=} engines: {node: '>=0.10'} dev: true - /dedent/0.7.0: - resolution: {integrity: sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=} - dev: true - /deep-eql/3.0.1: resolution: {integrity: sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==} engines: {node: '>=0.12'} @@ -3946,11 +3418,6 @@ packages: resolution: {integrity: sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=} dev: false - /delayed-stream/1.0.0: - resolution: {integrity: sha1-3zrhmayt+31ECqrgsp4icrJOxhk=} - engines: {node: '>=0.4.0'} - dev: true - /delegate/3.2.0: resolution: {integrity: sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==} dev: false @@ -3979,11 +3446,6 @@ packages: engines: {node: '>=8'} dev: false - /detect-newline/3.1.0: - resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} - engines: {node: '>=8'} - dev: true - /detective/5.2.0: resolution: {integrity: sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg==} engines: {node: '>=0.8.0'} @@ -4005,11 +3467,6 @@ packages: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} dev: false - /diff-sequences/27.5.1: - resolution: {integrity: sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dev: true - /diff/4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} @@ -4037,13 +3494,6 @@ packages: resolution: {integrity: sha1-6oCxBqh1OHdOijpKWv4pPeSJ4Kk=} dev: true - /domexception/2.0.1: - resolution: {integrity: sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg==} - engines: {node: '>=8'} - dependencies: - webidl-conversions: 5.0.0 - dev: true - /dot-prop/5.3.0: resolution: {integrity: sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==} engines: {node: '>=8'} @@ -4075,11 +3525,7 @@ packages: /electron-to-chromium/1.4.137: resolution: {integrity: sha512-0Rcpald12O11BUogJagX3HsCN3FE83DSqWjgXoHo5a72KUKMSfI39XBgJpgNNxS9fuGzytaFjE06kZkiVFy2qA==} - - /emittery/0.8.1: - resolution: {integrity: sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg==} - engines: {node: '>=10'} - dev: true + dev: false /emoji-regex/8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -4391,19 +3837,6 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - /escodegen/2.0.0: - resolution: {integrity: sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==} - engines: {node: '>=6.0'} - hasBin: true - dependencies: - esprima: 4.0.1 - estraverse: 5.3.0 - esutils: 2.0.3 - optionator: 0.8.3 - optionalDependencies: - source-map: 0.6.1 - dev: true - /eslint-define-config/1.4.0: resolution: {integrity: sha512-DJGEdzX4fkdkhPSzPgOpBbBjhT+b9DcgbAgxfrEUcipVWlSuesQJriKffHz1JF5mhKFm7PGoiZz4D2nb4GslNA==} engines: {node: '>= 14.6.0', npm: '>= 6.0.0', pnpm: '>= 6.32.9'} @@ -4536,12 +3969,6 @@ packages: eslint-visitor-keys: 3.3.0 dev: true - /esprima/4.0.1: - resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} - engines: {node: '>=4'} - hasBin: true - dev: true - /esquery/1.4.0: resolution: {integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==} engines: {node: '>=0.10'} @@ -4607,21 +4034,6 @@ packages: strip-final-newline: 2.0.0 dev: true - /exit/0.1.2: - resolution: {integrity: sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=} - engines: {node: '>= 0.8.0'} - dev: true - - /expect/27.5.1: - resolution: {integrity: sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.5.1 - jest-get-type: 27.5.1 - jest-matcher-utils: 27.5.1 - jest-message-util: 27.5.1 - dev: true - /express/4.18.1: resolution: {integrity: sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==} engines: {node: '>= 0.10.0'} @@ -4706,12 +4118,6 @@ packages: dependencies: reusify: 1.0.4 - /fb-watchman/2.0.1: - resolution: {integrity: sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==} - dependencies: - bser: 2.1.1 - dev: true - /fd-slicer/1.1.0: resolution: {integrity: sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=} dependencies: @@ -4796,15 +4202,6 @@ packages: debug: optional: true - /form-data/3.0.1: - resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==} - engines: {node: '>= 6'} - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - dev: true - /formdata-node/2.5.0: resolution: {integrity: sha512-JFSNLq34u2Tqc6F034x5aaK3ksIfrDBMPie8b4KYx2/pVDLxWFXDly52dsvHjZ+A0LGHTZb/w4HBZVdgN74RTw==} engines: {node: '>= 10.17'} @@ -4905,6 +4302,7 @@ packages: /gensync/1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} + dev: false /get-caller-file/2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} @@ -4923,11 +4321,6 @@ packages: has-symbols: 1.0.3 dev: true - /get-package-type/0.1.0: - resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} - engines: {node: '>=8.0.0'} - dev: true - /get-pkg-repo/4.2.1: resolution: {integrity: sha512-2+QbHjFRfGB74v/pYWjd5OhU3TDIC2Gv/YKUTk/tCvAz0pkn/Mz6P3uByuBimLOcPvN2jYdScl3xGFSrx0jEcA==} engines: {node: '>=6.9.0'} @@ -4959,6 +4352,10 @@ packages: get-intrinsic: 1.1.1 dev: true + /get-them-args/1.3.2: + resolution: {integrity: sha1-dKILqKSr7OWuGZrQPyvMaP38m6U=} + dev: true + /git-raw-commits/2.0.11: resolution: {integrity: sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A==} engines: {node: '>=10'} @@ -5019,6 +4416,7 @@ packages: /globals/11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} + dev: false /globals/13.14.0: resolution: {integrity: sha512-ERO68sOYwm5UuLvSJTY7w7NP2c8S4UcXs3X1GBX8cwOr+ShOcDBbCY5mH4zxz0jsYCdJ8ve8Mv9n2YGJMB1aeg==} @@ -5154,17 +4552,6 @@ packages: resolution: {integrity: sha1-wc56MWjIxmFAM6S194d/OyJfnDg=} dev: false - /html-encoding-sniffer/2.0.1: - resolution: {integrity: sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ==} - engines: {node: '>=10'} - dependencies: - whatwg-encoding: 1.0.5 - dev: true - - /html-escaper/2.0.2: - resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} - dev: true - /html-rewriter-wasm/0.3.2: resolution: {integrity: sha512-b+pOh+bs00uRVNIZoTgGBREjUKN47pchTNwkxKuP4ecQTFcOA6KJIW+jjvjjXrkSRURZsideLxFKqX7hnxdegQ==} dev: true @@ -5189,17 +4576,6 @@ packages: toidentifier: 1.0.1 dev: true - /http-proxy-agent/4.0.1: - resolution: {integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==} - engines: {node: '>= 6'} - dependencies: - '@tootallnate/once': 1.1.2 - agent-base: 6.0.2 - debug: 4.3.4 - transitivePeerDependencies: - - supports-color - dev: true - /http-proxy/1.18.1_debug@4.3.4: resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==} engines: {node: '>=8.0.0'} @@ -5229,6 +4605,7 @@ packages: debug: 4.3.4 transitivePeerDependencies: - supports-color + dev: false /human-signals/2.1.0: resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} @@ -5284,15 +4661,6 @@ packages: engines: {node: '>=8'} dev: true - /import-local/3.1.0: - resolution: {integrity: sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==} - engines: {node: '>=8'} - hasBin: true - dependencies: - pkg-dir: 4.2.0 - resolve-cwd: 3.0.0 - dev: true - /imurmurhash/0.1.4: resolution: {integrity: sha1-khi5srkoojixPcT7a21XbyMUU+o=} engines: {node: '>=0.8.19'} @@ -5434,11 +4802,6 @@ packages: engines: {node: '>=12'} dev: true - /is-generator-fn/2.1.0: - resolution: {integrity: sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==} - engines: {node: '>=6'} - dev: true - /is-glob/4.0.3: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} @@ -5475,10 +4838,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /is-potential-custom-element-name/1.0.1: - resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} - dev: true - /is-promise/2.2.2: resolution: {integrity: sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==} dev: true @@ -5503,576 +4862,59 @@ packages: call-bind: 1.0.2 dev: true - /is-stream/2.0.1: - resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} - engines: {node: '>=8'} - dev: true - - /is-string/1.0.7: - resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} - engines: {node: '>= 0.4'} - dependencies: - has-tostringtag: 1.0.0 - dev: true - - /is-symbol/1.0.4: - resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} - engines: {node: '>= 0.4'} - dependencies: - has-symbols: 1.0.3 - dev: true - - /is-text-path/1.0.1: - resolution: {integrity: sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4=} - engines: {node: '>=0.10.0'} - dependencies: - text-extensions: 1.9.0 - dev: true - - /is-typedarray/1.0.0: - resolution: {integrity: sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=} - dev: true - - /is-weakref/1.0.2: - resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} - dependencies: - call-bind: 1.0.2 - dev: true - - /is-what/3.14.1: - resolution: {integrity: sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==} - dev: true - - /is-wsl/2.2.0: - resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} - engines: {node: '>=8'} - dependencies: - is-docker: 2.2.1 - dev: true - - /isarray/0.0.1: - resolution: {integrity: sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=} - dev: false - - /isarray/1.0.0: - resolution: {integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=} - dev: true - - /isexe/2.0.0: - resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=} - dev: true - - /istanbul-lib-coverage/3.2.0: - resolution: {integrity: sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==} - engines: {node: '>=8'} - dev: true - - /istanbul-lib-instrument/5.2.0: - resolution: {integrity: sha512-6Lthe1hqXHBNsqvgDzGO6l03XNeu3CrG4RqQ1KM9+l5+jNGpEJfIELx1NS3SEHmJQA8np/u+E4EPRKRiu6m19A==} - engines: {node: '>=8'} - dependencies: - '@babel/core': 7.17.10 - '@babel/parser': 7.17.10 - '@istanbuljs/schema': 0.1.3 - istanbul-lib-coverage: 3.2.0 - semver: 6.3.0 - transitivePeerDependencies: - - supports-color - dev: true - - /istanbul-lib-report/3.0.0: - resolution: {integrity: sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==} - engines: {node: '>=8'} - dependencies: - istanbul-lib-coverage: 3.2.0 - make-dir: 3.1.0 - supports-color: 7.2.0 - dev: true - - /istanbul-lib-source-maps/4.0.1: - resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} - engines: {node: '>=10'} - dependencies: - debug: 4.3.4 - istanbul-lib-coverage: 3.2.0 - source-map: 0.6.1 - transitivePeerDependencies: - - supports-color - dev: true - - /istanbul-reports/3.1.4: - resolution: {integrity: sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw==} - engines: {node: '>=8'} - dependencies: - html-escaper: 2.0.2 - istanbul-lib-report: 3.0.0 - dev: true - - /jest-changed-files/27.5.1: - resolution: {integrity: sha512-buBLMiByfWGCoMsLLzGUUSpAmIAGnbR2KJoMN10ziLhOLvP4e0SlypHnAel8iqQXTrcbmfEY9sSqae5sgUsTvw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.5.1 - execa: 5.1.1 - throat: 6.0.1 - dev: true - - /jest-circus/27.5.1: - resolution: {integrity: sha512-D95R7x5UtlMA5iBYsOHFFbMD/GVA4R/Kdq15f7xYWUfWHBto9NYRsOvnSauTgdF+ogCpJ4tyKOXhUifxS65gdw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/environment': 27.5.1 - '@jest/test-result': 27.5.1 - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - chalk: 4.1.2 - co: 4.6.0 - dedent: 0.7.0 - expect: 27.5.1 - is-generator-fn: 2.1.0 - jest-each: 27.5.1 - jest-matcher-utils: 27.5.1 - jest-message-util: 27.5.1 - jest-runtime: 27.5.1 - jest-snapshot: 27.5.1 - jest-util: 27.5.1 - pretty-format: 27.5.1 - slash: 3.0.0 - stack-utils: 2.0.5 - throat: 6.0.1 - transitivePeerDependencies: - - supports-color - dev: true - - /jest-cli/27.5.1_ts-node@10.7.0: - resolution: {integrity: sha512-Hc6HOOwYq4/74/c62dEE3r5elx8wjYqxY0r0G/nFrLDPMFRu6RA/u8qINOIkvhxG7mMQ5EJsOGfRpI8L6eFUVw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - hasBin: true - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - dependencies: - '@jest/core': 27.5.1_ts-node@10.7.0 - '@jest/test-result': 27.5.1 - '@jest/types': 27.5.1 - chalk: 4.1.2 - exit: 0.1.2 - graceful-fs: 4.2.10 - import-local: 3.1.0 - jest-config: 27.5.1_ts-node@10.7.0 - jest-util: 27.5.1 - jest-validate: 27.5.1 - prompts: 2.4.2 - yargs: 16.2.0 - transitivePeerDependencies: - - bufferutil - - canvas - - supports-color - - ts-node - - utf-8-validate - dev: true - - /jest-config/27.5.1_ts-node@10.7.0: - resolution: {integrity: sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - peerDependencies: - ts-node: '>=9.0.0' - peerDependenciesMeta: - ts-node: - optional: true - dependencies: - '@babel/core': 7.17.10 - '@jest/test-sequencer': 27.5.1 - '@jest/types': 27.5.1 - babel-jest: 27.5.1_@babel+core@7.17.10 - chalk: 4.1.2 - ci-info: 3.3.0 - deepmerge: 4.2.2 - glob: 7.2.0 - graceful-fs: 4.2.10 - jest-circus: 27.5.1 - jest-environment-jsdom: 27.5.1 - jest-environment-node: 27.5.1 - jest-get-type: 27.5.1 - jest-jasmine2: 27.5.1 - jest-regex-util: 27.5.1 - jest-resolve: 27.5.1 - jest-runner: 27.5.1 - jest-util: 27.5.1 - jest-validate: 27.5.1 - micromatch: 4.0.5 - parse-json: 5.2.0 - pretty-format: 27.5.1 - slash: 3.0.0 - strip-json-comments: 3.1.1 - ts-node: 10.7.0_5f3e12794cebfbf3197131903b74d233 - transitivePeerDependencies: - - bufferutil - - canvas - - supports-color - - utf-8-validate - dev: true - - /jest-diff/27.5.1: - resolution: {integrity: sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - chalk: 4.1.2 - diff-sequences: 27.5.1 - jest-get-type: 27.5.1 - pretty-format: 27.5.1 - dev: true - - /jest-docblock/27.5.1: - resolution: {integrity: sha512-rl7hlABeTsRYxKiUfpHrQrG4e2obOiTQWfMEH3PxPjOtdsfLQO4ReWSZaQ7DETm4xu07rl4q/h4zcKXyU0/OzQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - detect-newline: 3.1.0 - dev: true - - /jest-each/27.5.1: - resolution: {integrity: sha512-1Ff6p+FbhT/bXQnEouYy00bkNSY7OUpfIcmdl8vZ31A1UUaurOLPA8a8BbJOF2RDUElwJhmeaV7LnagI+5UwNQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.5.1 - chalk: 4.1.2 - jest-get-type: 27.5.1 - jest-util: 27.5.1 - pretty-format: 27.5.1 - dev: true - - /jest-environment-jsdom/27.5.1: - resolution: {integrity: sha512-TFBvkTC1Hnnnrka/fUb56atfDtJ9VMZ94JkjTbggl1PEpwrYtUBKMezB3inLmWqQsXYLcMwNoDQwoBTAvFfsfw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/environment': 27.5.1 - '@jest/fake-timers': 27.5.1 - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - jest-mock: 27.5.1 - jest-util: 27.5.1 - jsdom: 16.7.0 - transitivePeerDependencies: - - bufferutil - - canvas - - supports-color - - utf-8-validate - dev: true - - /jest-environment-node/27.5.1: - resolution: {integrity: sha512-Jt4ZUnxdOsTGwSRAfKEnE6BcwsSPNOijjwifq5sDFSA2kesnXTvNqKHYgM0hDq3549Uf/KzdXNYn4wMZJPlFLw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/environment': 27.5.1 - '@jest/fake-timers': 27.5.1 - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - jest-mock: 27.5.1 - jest-util: 27.5.1 - dev: true - - /jest-get-type/27.5.1: - resolution: {integrity: sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dev: true - - /jest-haste-map/27.5.1: - resolution: {integrity: sha512-7GgkZ4Fw4NFbMSDSpZwXeBiIbx+t/46nJ2QitkOjvwPYyZmqttu2TDSimMHP1EkPOi4xUZAN1doE5Vd25H4Jng==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.5.1 - '@types/graceful-fs': 4.1.5 - '@types/node': 17.0.31 - anymatch: 3.1.2 - fb-watchman: 2.0.1 - graceful-fs: 4.2.10 - jest-regex-util: 27.5.1 - jest-serializer: 27.5.1 - jest-util: 27.5.1 - jest-worker: 27.5.1 - micromatch: 4.0.5 - walker: 1.0.8 - optionalDependencies: - fsevents: 2.3.2 - dev: true - - /jest-jasmine2/27.5.1: - resolution: {integrity: sha512-jtq7VVyG8SqAorDpApwiJJImd0V2wv1xzdheGHRGyuT7gZm6gG47QEskOlzsN1PG/6WNaCo5pmwMHDf3AkG2pQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/environment': 27.5.1 - '@jest/source-map': 27.5.1 - '@jest/test-result': 27.5.1 - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - chalk: 4.1.2 - co: 4.6.0 - expect: 27.5.1 - is-generator-fn: 2.1.0 - jest-each: 27.5.1 - jest-matcher-utils: 27.5.1 - jest-message-util: 27.5.1 - jest-runtime: 27.5.1 - jest-snapshot: 27.5.1 - jest-util: 27.5.1 - pretty-format: 27.5.1 - throat: 6.0.1 - transitivePeerDependencies: - - supports-color - dev: true - - /jest-leak-detector/27.5.1: - resolution: {integrity: sha512-POXfWAMvfU6WMUXftV4HolnJfnPOGEu10fscNCA76KBpRRhcMN2c8d3iT2pxQS3HLbA+5X4sOUPzYO2NUyIlHQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - jest-get-type: 27.5.1 - pretty-format: 27.5.1 - dev: true - - /jest-matcher-utils/27.5.1: - resolution: {integrity: sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - chalk: 4.1.2 - jest-diff: 27.5.1 - jest-get-type: 27.5.1 - pretty-format: 27.5.1 - dev: true - - /jest-message-util/27.5.1: - resolution: {integrity: sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@babel/code-frame': 7.16.7 - '@jest/types': 27.5.1 - '@types/stack-utils': 2.0.1 - chalk: 4.1.2 - graceful-fs: 4.2.10 - micromatch: 4.0.5 - pretty-format: 27.5.1 - slash: 3.0.0 - stack-utils: 2.0.5 - dev: true - - /jest-mock/27.5.1: - resolution: {integrity: sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - dev: true - - /jest-pnp-resolver/1.2.2_jest-resolve@27.5.1: - resolution: {integrity: sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==} - engines: {node: '>=6'} - peerDependencies: - jest-resolve: '*' - peerDependenciesMeta: - jest-resolve: - optional: true - dependencies: - jest-resolve: 27.5.1 - dev: true - - /jest-regex-util/27.5.1: - resolution: {integrity: sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dev: true - - /jest-resolve-dependencies/27.5.1: - resolution: {integrity: sha512-QQOOdY4PE39iawDn5rzbIePNigfe5B9Z91GDD1ae/xNDlu9kaat8QQ5EKnNmVWPV54hUdxCVwwj6YMgR2O7IOg==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.5.1 - jest-regex-util: 27.5.1 - jest-snapshot: 27.5.1 - transitivePeerDependencies: - - supports-color - dev: true - - /jest-resolve/27.5.1: - resolution: {integrity: sha512-FFDy8/9E6CV83IMbDpcjOhumAQPDyETnU2KZ1O98DwTnz8AOBsW/Xv3GySr1mOZdItLR+zDZ7I/UdTFbgSOVCw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/types': 27.5.1 - chalk: 4.1.2 - graceful-fs: 4.2.10 - jest-haste-map: 27.5.1 - jest-pnp-resolver: 1.2.2_jest-resolve@27.5.1 - jest-util: 27.5.1 - jest-validate: 27.5.1 - resolve: 1.22.0 - resolve.exports: 1.1.0 - slash: 3.0.0 - dev: true - - /jest-runner/27.5.1: - resolution: {integrity: sha512-g4NPsM4mFCOwFKXO4p/H/kWGdJp9V8kURY2lX8Me2drgXqG7rrZAx5kv+5H7wtt/cdFIjhqYx1HrlqWHaOvDaQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/console': 27.5.1 - '@jest/environment': 27.5.1 - '@jest/test-result': 27.5.1 - '@jest/transform': 27.5.1 - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - chalk: 4.1.2 - emittery: 0.8.1 - graceful-fs: 4.2.10 - jest-docblock: 27.5.1 - jest-environment-jsdom: 27.5.1 - jest-environment-node: 27.5.1 - jest-haste-map: 27.5.1 - jest-leak-detector: 27.5.1 - jest-message-util: 27.5.1 - jest-resolve: 27.5.1 - jest-runtime: 27.5.1 - jest-util: 27.5.1 - jest-worker: 27.5.1 - source-map-support: 0.5.21 - throat: 6.0.1 - transitivePeerDependencies: - - bufferutil - - canvas - - supports-color - - utf-8-validate - dev: true - - /jest-runtime/27.5.1: - resolution: {integrity: sha512-o7gxw3Gf+H2IGt8fv0RiyE1+r83FJBRruoA+FXrlHw6xEyBsU8ugA6IPfTdVyA0w8HClpbK+DGJxH59UrNMx8A==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/environment': 27.5.1 - '@jest/fake-timers': 27.5.1 - '@jest/globals': 27.5.1 - '@jest/source-map': 27.5.1 - '@jest/test-result': 27.5.1 - '@jest/transform': 27.5.1 - '@jest/types': 27.5.1 - chalk: 4.1.2 - cjs-module-lexer: 1.2.2 - collect-v8-coverage: 1.0.1 - execa: 5.1.1 - glob: 7.2.0 - graceful-fs: 4.2.10 - jest-haste-map: 27.5.1 - jest-message-util: 27.5.1 - jest-mock: 27.5.1 - jest-regex-util: 27.5.1 - jest-resolve: 27.5.1 - jest-snapshot: 27.5.1 - jest-util: 27.5.1 - slash: 3.0.0 - strip-bom: 4.0.0 - transitivePeerDependencies: - - supports-color + /is-stream/2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} dev: true - /jest-serializer/27.5.1: - resolution: {integrity: sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + /is-string/1.0.7: + resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} + engines: {node: '>= 0.4'} dependencies: - '@types/node': 17.0.31 - graceful-fs: 4.2.10 + has-tostringtag: 1.0.0 dev: true - /jest-snapshot/27.5.1: - resolution: {integrity: sha512-yYykXI5a0I31xX67mgeLw1DZ0bJB+gpq5IpSuCAoyDi0+BhgU/RIrL+RTzDmkNTchvDFWKP8lp+w/42Z3us5sA==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + /is-symbol/1.0.4: + resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} + engines: {node: '>= 0.4'} dependencies: - '@babel/core': 7.17.10 - '@babel/generator': 7.17.10 - '@babel/plugin-syntax-typescript': 7.17.10_@babel+core@7.17.10 - '@babel/traverse': 7.17.10 - '@babel/types': 7.17.10 - '@jest/transform': 27.5.1 - '@jest/types': 27.5.1 - '@types/babel__traverse': 7.17.1 - '@types/prettier': 2.6.0 - babel-preset-current-node-syntax: 1.0.1_@babel+core@7.17.10 - chalk: 4.1.2 - expect: 27.5.1 - graceful-fs: 4.2.10 - jest-diff: 27.5.1 - jest-get-type: 27.5.1 - jest-haste-map: 27.5.1 - jest-matcher-utils: 27.5.1 - jest-message-util: 27.5.1 - jest-util: 27.5.1 - natural-compare: 1.4.0 - pretty-format: 27.5.1 - semver: 7.3.7 - transitivePeerDependencies: - - supports-color + has-symbols: 1.0.3 dev: true - /jest-util/27.5.1: - resolution: {integrity: sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + /is-text-path/1.0.1: + resolution: {integrity: sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4=} + engines: {node: '>=0.10.0'} dependencies: - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - chalk: 4.1.2 - ci-info: 3.3.0 - graceful-fs: 4.2.10 - picomatch: 2.3.1 + text-extensions: 1.9.0 dev: true - /jest-validate/27.5.1: - resolution: {integrity: sha512-thkNli0LYTmOI1tDB3FI1S1RTp/Bqyd9pTarJwL87OIBFuqEb5Apv5EaApEudYg4g86e3CT6kM0RowkhtEnCBQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + /is-weakref/1.0.2: + resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} dependencies: - '@jest/types': 27.5.1 - camelcase: 6.3.0 - chalk: 4.1.2 - jest-get-type: 27.5.1 - leven: 3.1.0 - pretty-format: 27.5.1 + call-bind: 1.0.2 dev: true - /jest-watcher/27.5.1: - resolution: {integrity: sha512-z676SuD6Z8o8qbmEGhoEUFOM1+jfEiL3DXHK/xgEiG2EyNYfFG60jluWcupY6dATjfEsKQuibReS1djInQnoVw==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - '@jest/test-result': 27.5.1 - '@jest/types': 27.5.1 - '@types/node': 17.0.31 - ansi-escapes: 4.3.2 - chalk: 4.1.2 - jest-util: 27.5.1 - string-length: 4.0.2 + /is-what/3.14.1: + resolution: {integrity: sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==} dev: true - /jest-worker/27.5.1: - resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} - engines: {node: '>= 10.13.0'} + /is-wsl/2.2.0: + resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} + engines: {node: '>=8'} dependencies: - '@types/node': 17.0.31 - merge-stream: 2.0.0 - supports-color: 8.1.1 + is-docker: 2.2.1 dev: true - /jest/27.5.1_ts-node@10.7.0: - resolution: {integrity: sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - hasBin: true - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - dependencies: - '@jest/core': 27.5.1_ts-node@10.7.0 - import-local: 3.1.0 - jest-cli: 27.5.1_ts-node@10.7.0 - transitivePeerDependencies: - - bufferutil - - canvas - - supports-color - - ts-node - - utf-8-validate + /isarray/0.0.1: + resolution: {integrity: sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=} + dev: false + + /isarray/1.0.0: + resolution: {integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=} + dev: true + + /isexe/2.0.0: + resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=} dev: true /jju/1.4.0: @@ -6090,14 +4932,6 @@ packages: /js-tokens/4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - /js-yaml/3.14.1: - resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} - hasBin: true - dependencies: - argparse: 1.0.10 - esprima: 4.0.1 - dev: true - /js-yaml/4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true @@ -6105,52 +4939,11 @@ packages: argparse: 2.0.1 dev: true - /jsdom/16.7.0: - resolution: {integrity: sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw==} - engines: {node: '>=10'} - peerDependencies: - canvas: ^2.5.0 - peerDependenciesMeta: - canvas: - optional: true - dependencies: - abab: 2.0.6 - acorn: 8.7.1 - acorn-globals: 6.0.0 - cssom: 0.4.4 - cssstyle: 2.3.0 - data-urls: 2.0.0 - decimal.js: 10.3.1 - domexception: 2.0.1 - escodegen: 2.0.0 - form-data: 3.0.1 - html-encoding-sniffer: 2.0.1 - http-proxy-agent: 4.0.1 - https-proxy-agent: 5.0.1 - is-potential-custom-element-name: 1.0.1 - nwsapi: 2.2.0 - parse5: 6.0.1 - saxes: 5.0.1 - symbol-tree: 3.2.4 - tough-cookie: 4.0.0 - w3c-hr-time: 1.0.2 - w3c-xmlserializer: 2.0.0 - webidl-conversions: 6.1.0 - whatwg-encoding: 1.0.5 - whatwg-mimetype: 2.3.0 - whatwg-url: 8.7.0 - ws: 7.5.7 - xml-name-validator: 3.0.0 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: true - /jsesc/2.5.2: resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} engines: {node: '>=4'} hasBin: true + dev: false /json-parse-better-errors/1.0.2: resolution: {integrity: sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==} @@ -6201,6 +4994,14 @@ packages: promise: 7.3.1 dev: true + /kill-port/1.6.1: + resolution: {integrity: sha512-un0Y55cOM7JKGaLnGja28T38tDDop0AQ8N0KlAdyh+B1nmMoX8AnNmqPNZbS3mUMgiST51DCVqmbFT1gNJpVNw==} + hasBin: true + dependencies: + get-them-args: 1.3.2 + shell-exec: 1.0.2 + dev: true + /kind-of/6.0.3: resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} engines: {node: '>=0.10.0'} @@ -6250,19 +5051,6 @@ packages: source-map: 0.6.1 dev: true - /leven/3.1.0: - resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} - engines: {node: '>=6'} - dev: true - - /levn/0.3.0: - resolution: {integrity: sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=} - engines: {node: '>= 0.8.0'} - dependencies: - prelude-ls: 1.1.2 - type-check: 0.3.2 - dev: true - /levn/0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} @@ -6392,10 +5180,6 @@ packages: resolution: {integrity: sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc=} dev: true - /lodash.memoize/4.1.2: - resolution: {integrity: sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=} - dev: true - /lodash.merge/4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} dev: true @@ -6466,17 +5250,12 @@ packages: engines: {node: '>=8'} dependencies: semver: 6.3.0 + dev: false /make-error/1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} dev: true - /makeerror/1.0.12: - resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} - dependencies: - tmpl: 1.0.5 - dev: true - /map-obj/1.0.1: resolution: {integrity: sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=} engines: {node: '>=0.10.0'} @@ -6784,12 +5563,9 @@ packages: engines: {node: '>= 6.13.0'} dev: true - /node-int64/0.4.0: - resolution: {integrity: sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=} - dev: true - /node-releases/2.0.4: resolution: {integrity: sha512-gbMzqQtTtDz/00jQzZ21PQzdI9PyLYqUSvD0p3naOhX4odFji0ZxYdnVwPTxmSwkmxhcFImpozceidSG+AgoPQ==} + dev: false /nopt/5.0.0: resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} @@ -6863,10 +5639,6 @@ packages: set-blocking: 2.0.0 dev: false - /nwsapi/2.2.0: - resolution: {integrity: sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==} - dev: true - /object-assign/4.1.1: resolution: {integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=} engines: {node: '>=0.10.0'} @@ -6950,18 +5722,6 @@ packages: hasBin: true dev: true - /optionator/0.8.3: - resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==} - engines: {node: '>= 0.8.0'} - dependencies: - deep-is: 0.1.4 - fast-levenshtein: 2.0.6 - levn: 0.3.0 - prelude-ls: 1.1.2 - type-check: 0.3.2 - word-wrap: 1.2.3 - dev: true - /optionator/0.9.1: resolution: {integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==} engines: {node: '>= 0.8.0'} @@ -7057,10 +5817,6 @@ packages: engines: {node: '>= 0.10'} dev: true - /parse5/6.0.1: - resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} - dev: true - /parseurl/1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} engines: {node: '>= 0.8'} @@ -7168,11 +5924,6 @@ packages: dev: true optional: true - /pirates/4.0.5: - resolution: {integrity: sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==} - engines: {node: '>= 6'} - dev: true - /pixelmatch/5.2.1: resolution: {integrity: sha512-WjcAdYSnKrrdDdqTcVEY7aB7UhhwjYQKYhHiBXdJef0MOaQeYpUdQ+iVyBLa5YBKS8MPVPPMX7rpOByISLpeEQ==} hasBin: true @@ -7180,13 +5931,6 @@ packages: pngjs: 4.0.1 dev: true - /pkg-dir/4.2.0: - resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} - engines: {node: '>=8'} - dependencies: - find-up: 4.1.0 - dev: true - /playwright-chromium/1.21.1: resolution: {integrity: sha512-bbqFFpcTs+3amiofja/KvTmZ+FZnMNEOuGkRyJk2p6DV9EbgRYVrlzzgLtMnX2DwaX3ZZ23MukGuQ+bVKOdsnw==} engines: {node: '>=12'} @@ -7404,11 +6148,6 @@ packages: resolution: {integrity: sha512-GLjn0I3r6ka+NvxJUppsVFqb4V0qDTEHT/QxHlidPuClGaxF/4AI2Qti4a0cv3XMh5n1+D3hLScW10LRIm5msQ==} dev: true - /prelude-ls/1.1.2: - resolution: {integrity: sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=} - engines: {node: '>= 0.8.0'} - dev: true - /prelude-ls/1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -7420,15 +6159,6 @@ packages: hasBin: true dev: true - /pretty-format/27.5.1: - resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - dependencies: - ansi-regex: 5.0.1 - ansi-styles: 5.2.0 - react-is: 17.0.2 - dev: true - /pretty-hrtime/1.0.3: resolution: {integrity: sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=} engines: {node: '>= 0.8'} @@ -7494,10 +6224,6 @@ packages: dev: true optional: true - /psl/1.8.0: - resolution: {integrity: sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==} - dev: true - /pug-attrs/3.0.0: resolution: {integrity: sha512-azINV9dUtzPMFQktvTXciNAfAuVh/L/JCl0vtPCwvOA21uZrC08K/UnmrL+SXGEVc1FwzjW62+xw5S/uaLj6cA==} dependencies: @@ -7687,10 +6413,6 @@ packages: resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} dev: false - /react-is/17.0.2: - resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} - dev: true - /react-refresh/0.13.0: resolution: {integrity: sha512-XP8A9BT0CpRBD+NYLLeIhld/RqG9+gktUjW1FkE+Vm7OCinbG1SshcK5tb9ls4kzvjZr9mOQc7HYgBngEyPAXg==} engines: {node: '>=0.10.0'} @@ -7877,22 +6599,10 @@ packages: resolution: {integrity: sha1-AKCUD5jNUBrqqsMWQR2a3FKzGrE=} dev: true - /resolve-cwd/3.0.0: - resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} - engines: {node: '>=8'} - dependencies: - resolve-from: 5.0.0 - dev: true - /resolve-from/4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} - /resolve-from/5.0.0: - resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} - engines: {node: '>=8'} - dev: true - /resolve-pathname/3.0.0: resolution: {integrity: sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==} dev: false @@ -8024,13 +6734,6 @@ packages: resolution: {integrity: sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==} dev: true - /saxes/5.0.1: - resolution: {integrity: sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==} - engines: {node: '>=10'} - dependencies: - xmlchars: 2.2.0 - dev: true - /scheduler/0.20.2: resolution: {integrity: sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==} dependencies: @@ -8130,6 +6833,10 @@ packages: engines: {node: '>=8'} dev: true + /shell-exec/1.0.2: + resolution: {integrity: sha512-jyVd+kU2X+mWKMmGhx4fpWbPsjvD53k9ivqetutVW/BQ+WIZoDoP4d8vUMGezV6saZsiNoW2f9GIhg9Dondohg==} + dev: true + /shell-quote/1.7.3: resolution: {integrity: sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==} dev: true @@ -8374,14 +7081,6 @@ packages: resolution: {integrity: sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs=} dev: true - /string-length/4.0.2: - resolution: {integrity: sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==} - engines: {node: '>=10'} - dependencies: - char-regex: 1.0.2 - strip-ansi: 6.0.1 - dev: true - /string-width/4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -8453,11 +7152,6 @@ packages: engines: {node: '>=4'} dev: true - /strip-bom/4.0.0: - resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} - engines: {node: '>=8'} - dev: true - /strip-final-newline/2.0.0: resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} engines: {node: '>=6'} @@ -8510,26 +7204,11 @@ packages: dependencies: has-flag: 4.0.0 - /supports-color/8.1.1: - resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} - engines: {node: '>=10'} - dependencies: - has-flag: 4.0.0 - dev: true - /supports-color/9.2.2: resolution: {integrity: sha512-XC6g/Kgux+rJXmwokjm9ECpD6k/smUoS5LKlUCcsYr4IY3rW0XyAympon2RmxGrlnZURMpg5T18gWDP9CsHXFA==} engines: {node: '>=12'} dev: true - /supports-hyperlinks/2.2.0: - resolution: {integrity: sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ==} - engines: {node: '>=8'} - dependencies: - has-flag: 4.0.0 - supports-color: 7.2.0 - dev: true - /supports-preserve-symlinks-flag/1.0.0: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} @@ -8538,10 +7217,6 @@ packages: resolution: {integrity: sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q=} dev: false - /symbol-tree/3.2.4: - resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} - dev: true - /systemjs/6.12.1: resolution: {integrity: sha512-hqTN6kW+pN6/qro6G9OZ7ceDQOcYno020zBQKpZQLsJhYTDMCMNfXi/Y8duF5iW+4WWZr42ry0MMkcRGpbwG2A==} dev: false @@ -8690,14 +7365,6 @@ packages: uuid: 3.4.0 dev: true - /terminal-link/2.1.1: - resolution: {integrity: sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==} - engines: {node: '>=8'} - dependencies: - ansi-escapes: 4.3.2 - supports-hyperlinks: 2.2.0 - dev: true - /terser/5.13.1: resolution: {integrity: sha512-hn4WKOfwnwbYfe48NgrQjqNOH9jzLqRcIfbYytOXCOv46LBfWr9bDS17MQqOi+BWGD0sJK3Sj5NC/gJjiojaoA==} engines: {node: '>=10'} @@ -8709,15 +7376,6 @@ packages: source-map-support: 0.5.21 dev: true - /test-exclude/6.0.0: - resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} - engines: {node: '>=8'} - dependencies: - '@istanbuljs/schema': 0.1.3 - glob: 7.2.0 - minimatch: 3.1.2 - dev: true - /text-extensions/1.9.0: resolution: {integrity: sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==} engines: {node: '>=0.10'} @@ -8727,10 +7385,6 @@ packages: resolution: {integrity: sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=} dev: true - /throat/6.0.1: - resolution: {integrity: sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w==} - dev: true - /through/2.3.8: resolution: {integrity: sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=} dev: true @@ -8781,10 +7435,6 @@ packages: rimraf: 3.0.2 dev: false - /tmpl/1.0.5: - resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==} - dev: true - /to-fast-properties/2.0.0: resolution: {integrity: sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=} engines: {node: '>=4'} @@ -8809,15 +7459,6 @@ packages: engines: {node: '>=6'} dev: true - /tough-cookie/4.0.0: - resolution: {integrity: sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==} - engines: {node: '>=6'} - dependencies: - psl: 1.8.0 - punycode: 2.1.1 - universalify: 0.1.2 - dev: true - /tr46/0.0.3: resolution: {integrity: sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=} @@ -8845,41 +7486,6 @@ packages: utf8-byte-length: 1.0.4 dev: true - /ts-jest/27.1.4_edb1f862ecf73b6f0cc1f906c6266936: - resolution: {integrity: sha512-qjkZlVPWVctAezwsOD1OPzbZ+k7zA5z3oxII4dGdZo5ggX/PL7kvwTM0pXTr10fAtbiVpJaL3bWd502zAhpgSQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - hasBin: true - peerDependencies: - '@babel/core': '>=7.0.0-beta.0 <8' - '@types/jest': ^27.0.0 - babel-jest: '>=27.0.0 <28' - esbuild: '*' - jest: ^27.0.0 - typescript: '>=3.8 <5.0' - peerDependenciesMeta: - '@babel/core': - optional: true - '@types/jest': - optional: true - babel-jest: - optional: true - esbuild: - optional: true - dependencies: - '@types/jest': 27.5.0 - bs-logger: 0.2.6 - esbuild: 0.14.38 - fast-json-stable-stringify: 2.1.0 - jest: 27.5.1_ts-node@10.7.0 - jest-util: 27.5.1 - json5: 2.2.1 - lodash.memoize: 4.1.2 - make-error: 1.3.6 - semver: 7.3.7 - typescript: 4.6.4 - yargs-parser: 20.2.9 - dev: true - /ts-node/10.7.0_5f3e12794cebfbf3197131903b74d233: resolution: {integrity: sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==} hasBin: true @@ -8942,13 +7548,6 @@ packages: typescript: 4.6.4 dev: true - /type-check/0.3.2: - resolution: {integrity: sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=} - engines: {node: '>= 0.8.0'} - dependencies: - prelude-ls: 1.1.2 - dev: true - /type-check/0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -9002,12 +7601,6 @@ packages: resolution: {integrity: sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ==} dev: false - /typedarray-to-buffer/3.1.5: - resolution: {integrity: sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==} - dependencies: - is-typedarray: 1.0.0 - dev: true - /typescript/4.6.4: resolution: {integrity: sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==} engines: {node: '>=4.2.0'} @@ -9106,15 +7699,6 @@ packages: resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==} dev: true - /v8-to-istanbul/8.1.1: - resolution: {integrity: sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==} - engines: {node: '>=10.12.0'} - dependencies: - '@types/istanbul-lib-coverage': 2.0.4 - convert-source-map: 1.8.0 - source-map: 0.7.3 - dev: true - /validate-npm-package-license/3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} dependencies: @@ -9154,8 +7738,8 @@ packages: - react-dom dev: true - /vitest/0.10.5: - resolution: {integrity: sha512-4qXdNbHwAd9YcsztJoVMWUQGcMATVlY9Xd95I3KQ2JJwDLTL97f/jgfGRotqptvNxdlmme5TBY0Gv+l6+JSYvA==} + /vitest/0.12.4: + resolution: {integrity: sha512-EDxdhlAt6vcu6y4VouAI60z78iCAVFnfBL4VlSQVQnGmOk5altOtIKvp3xfZ+cfo4iVHgqq1QNyf5qOFiL4leg==} engines: {node: '>=v14.16.0'} hasBin: true peerDependencies: @@ -9214,25 +7798,6 @@ packages: vue: 3.2.33 dev: false - /w3c-hr-time/1.0.2: - resolution: {integrity: sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==} - dependencies: - browser-process-hrtime: 1.0.0 - dev: true - - /w3c-xmlserializer/2.0.0: - resolution: {integrity: sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA==} - engines: {node: '>=10'} - dependencies: - xml-name-validator: 3.0.0 - dev: true - - /walker/1.0.8: - resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} - dependencies: - makeerror: 1.0.12 - dev: true - /web-streams-polyfill/3.2.1: resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==} engines: {node: '>= 8'} @@ -9255,26 +7820,11 @@ packages: resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} dev: true - /webidl-conversions/5.0.0: - resolution: {integrity: sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==} - engines: {node: '>=8'} - dev: true - /webidl-conversions/6.1.0: resolution: {integrity: sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==} engines: {node: '>=10.4'} dev: true - /whatwg-encoding/1.0.5: - resolution: {integrity: sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==} - dependencies: - iconv-lite: 0.4.24 - dev: true - - /whatwg-mimetype/2.3.0: - resolution: {integrity: sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==} - dev: true - /whatwg-url/5.0.0: resolution: {integrity: sha1-lmRU6HZUYuN2RNNib2dCzotwll0=} dependencies: @@ -9369,15 +7919,6 @@ packages: /wrappy/1.0.2: resolution: {integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=} - /write-file-atomic/3.0.3: - resolution: {integrity: sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==} - dependencies: - imurmurhash: 0.1.4 - is-typedarray: 1.0.0 - signal-exit: 3.0.7 - typedarray-to-buffer: 3.1.5 - dev: true - /ws/7.5.7: resolution: {integrity: sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==} engines: {node: '>=8.3.0'} @@ -9417,14 +7958,6 @@ packages: optional: true dev: true - /xml-name-validator/3.0.0: - resolution: {integrity: sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==} - dev: true - - /xmlchars/2.2.0: - resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} - dev: true - /xtend/4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} diff --git a/scripts/jestEnv.cjs b/scripts/jestEnv.cjs deleted file mode 100644 index a053faef1a69a5..00000000000000 --- a/scripts/jestEnv.cjs +++ /dev/null @@ -1,48 +0,0 @@ -const os = require('os') -const fs = require('fs') -const path = require('path') -const NodeEnvironment = require('jest-environment-node') -const { chromium } = require('playwright-chromium') - -const DIR = path.join(os.tmpdir(), 'jest_playwright_global_setup') - -module.exports = class PlaywrightEnvironment extends NodeEnvironment { - constructor(config, context) { - super(config) - this.testPath = context.testPath - } - - async setup() { - await super.setup() - const wsEndpoint = fs.readFileSync(path.join(DIR, 'wsEndpoint'), 'utf-8') - if (!wsEndpoint) { - throw new Error('wsEndpoint not found') - } - - // skip browser setup for non-playground tests - if (!this.testPath.includes('playground')) { - return - } - - const browser = (this.browser = await chromium.connect({ - wsEndpoint - })) - this.global.page = await browser.newPage() - - const console = this.global.console - const warn = console.warn - console.warn = (msg, ...args) => { - // suppress @vue/reactivity-transform warning - if (msg.includes('@vue/reactivity-transform')) return - if (msg.includes('Generated an empty chunk')) return - warn.call(console, msg, ...args) - } - } - - async teardown() { - if (this.browser) { - await this.browser.close() - } - await super.teardown() - } -} diff --git a/scripts/jestGlobalTeardown.cjs b/scripts/jestGlobalTeardown.cjs deleted file mode 100644 index 786b7b95724fa3..00000000000000 --- a/scripts/jestGlobalTeardown.cjs +++ /dev/null @@ -1,9 +0,0 @@ -const fs = require('fs-extra') -const path = require('path') - -module.exports = async () => { - await global.__BROWSER_SERVER__.close() - if (!process.env.VITE_PRESERVE_BUILD_ARTIFACTS) { - fs.removeSync(path.resolve(__dirname, '../playground-temp')) - } -} diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 5c70fcc7f15823..bb673b6c8e21fb 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -8,6 +8,6 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "types": ["node", "jest"] + "types": ["node", "vitest/globals"] } } diff --git a/scripts/jestGlobalSetup.cjs b/scripts/vitestGlobalSetup.ts similarity index 62% rename from scripts/jestGlobalSetup.cjs rename to scripts/vitestGlobalSetup.ts index b4098ba3f6f2c1..8a0b7ffad6c6b2 100644 --- a/scripts/jestGlobalSetup.cjs +++ b/scripts/vitestGlobalSetup.ts @@ -1,26 +1,27 @@ -// @ts-check -const os = require('os') -const fs = require('fs-extra') -const path = require('path') -const { chromium } = require('playwright-chromium') +import os from 'os' +import fs from 'fs-extra' +import path from 'path' +import type { BrowserServer } from 'playwright-chromium' +import { chromium } from 'playwright-chromium' -const DIR = path.join(os.tmpdir(), 'jest_playwright_global_setup') +const DIR = path.join(os.tmpdir(), 'vitest_playwright_global_setup') -module.exports = async () => { - const browserServer = await chromium.launchServer({ +let browserServer: BrowserServer | undefined + +export async function setup() { + browserServer = await chromium.launchServer({ headless: !process.env.VITE_DEBUG_SERVE, args: process.env.CI ? ['--no-sandbox', '--disable-setuid-sandbox'] : undefined }) - global.__BROWSER_SERVER__ = browserServer - await fs.mkdirp(DIR) await fs.writeFile(path.join(DIR, 'wsEndpoint'), browserServer.wsEndpoint()) const tempDir = path.resolve(__dirname, '../playground-temp') - await fs.remove(tempDir) + await fs.ensureDir(tempDir) + await fs.emptyDir(tempDir) await fs .copy(path.resolve(__dirname, '../playground'), tempDir, { dereference: false, @@ -39,3 +40,10 @@ module.exports = async () => { } }) } + +export async function teardown() { + browserServer?.close() + if (!process.env.VITE_PRESERVE_BUILD_ARTIFACTS) { + fs.removeSync(path.resolve(__dirname, '../playground-temp')) + } +} diff --git a/scripts/jestPerTestSetup.ts b/scripts/vitestSetup.ts similarity index 80% rename from scripts/jestPerTestSetup.ts rename to scripts/vitestSetup.ts index 8160a04d9df4a9..4275d9d80864a5 100644 --- a/scripts/jestPerTestSetup.ts +++ b/scripts/vitestSetup.ts @@ -2,6 +2,9 @@ import fs from 'fs-extra' import * as http from 'http' import { resolve, dirname } from 'path' import sirv from 'sirv' +import os from 'os' +import path from 'path' +import { chromium } from 'playwright-chromium' import type { ViteDevServer, InlineConfig, @@ -12,6 +15,8 @@ import type { import { createServer, build, mergeConfig } from 'vite' import type { Page, ConsoleMessage } from 'playwright-chromium' import type { RollupError, RollupWatcher, RollupWatcherEvent } from 'rollup' +import type { File } from 'vitest' +import { beforeAll } from 'vitest' const isBuildTest = !!process.env.VITE_TEST_BUILD @@ -26,7 +31,7 @@ declare global { const browserLogs: string[] const browserErrors: Error[] const serverLogs: string[] - const viteTestUrl: string | undefined + let viteTestUrl: string | undefined const watcher: RollupWatcher | undefined let beforeAllError: Error | null // error caught in beforeAll, useful if you want to test error scenarios on build } @@ -63,32 +68,60 @@ const onPageError = (error: Error) => { errors.push(error) } -beforeAll(async () => { - const page = global.page - if (!page) { +const DIR = path.join(os.tmpdir(), 'vitest_playwright_global_setup') + +beforeAll(async (s) => { + const suite = s as File + const wsEndpoint = fs.readFileSync(path.join(DIR, 'wsEndpoint'), 'utf-8') + if (!wsEndpoint) { + throw new Error('wsEndpoint not found') + } + + // skip browser setup for non-playground tests + if (!suite.filepath.includes('playground')) { return } + + const browser = await chromium.connect(wsEndpoint) + const page = await browser.newPage() + // @ts-expect-error + globalThis.page = page + + const globalConsole = globalThis.console + const warn = globalConsole.warn + globalConsole.warn = (msg, ...args) => { + // suppress @vue/reactivity-transform warning + if (msg.includes('@vue/reactivity-transform')) return + if (msg.includes('Generated an empty chunk')) return + warn.call(globalConsole, msg, ...args) + } + try { page.on('console', onConsole) page.on('pageerror', onPageError) - const testPath = expect.getState().testPath + const testPath = suite.filepath! const testName = slash(testPath).match(/playground\/([\w-]+)\//)?.[1] // if this is a test placed under playground/xxx/__tests__ // start a vite server in that directory. if (testName) { - const playgroundRoot = resolve(__dirname, '../playground') tempDir = resolve(__dirname, '../playground-temp/', testName) // when `root` dir is present, use it as vite's root const testCustomRoot = resolve(tempDir, 'root') rootDir = fs.existsSync(testCustomRoot) ? testCustomRoot : tempDir - const testCustomServe = resolve(dirname(testPath), 'serve.js') - if (fs.existsSync(testCustomServe)) { + const testCustomServe = [ + resolve(dirname(testPath), 'serve.ts'), + resolve(dirname(testPath), 'serve.cjs'), + resolve(dirname(testPath), 'serve.js') + ].find((i) => fs.existsSync(i)) + if (testCustomServe) { // test has custom server configuration. - const { serve, preServe } = require(testCustomServe) + const mod = await import(testCustomServe) + const serve = mod.serve || mod.default?.serve + const preServe = mod.preServe || mod.default?.preServe if (preServe) { await preServe(rootDir, isBuildTest) } @@ -167,29 +200,30 @@ beforeAll(async () => { } } } catch (e: any) { - // jest doesn't exit if our setup has error here - // https://github.com/facebook/jest/issues/2713 - setBeforeAllError(e) - // Closing the page since an error in the setup, for example a runtime error // when building the playground should skip further tests. // If the page remains open, a command like `await page.click(...)` produces // a timeout with an exception that hides the real error in the console. await page.close() + + beforeAllError = e } -}, 30000) -afterAll(async () => { - global.page?.off('console', onConsole) - global.serverLogs = [] - await global.page?.close() - await server?.close() - global.watcher?.close() - const beforeAllErr = getBeforeAllError() - if (beforeAllErr) { - throw beforeAllErr + return async () => { + page?.off('console', onConsole) + global.serverLogs = [] + await page?.close() + await server?.close() + global.watcher?.close() + const beforeAllErr = getBeforeAllError() + if (browser) { + await browser.close() + } + if (beforeAllErr) { + throw beforeAllErr + } } -}) +}, 30000) function startStaticServer(config?: InlineConfig): Promise { if (!config) { diff --git a/vitest.config.e2e.ts b/vitest.config.e2e.ts new file mode 100644 index 00000000000000..a23378c97465b3 --- /dev/null +++ b/vitest.config.e2e.ts @@ -0,0 +1,21 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + include: ['./playground/**/*.spec.[tj]s'], + setupFiles: ['./scripts/vitestSetup.ts'], + globalSetup: ['./scripts/vitestGlobalSetup.ts'], + testTimeout: process.env.CI ? 50000 : 20000, + globals: true, + reporters: 'dot', + onConsoleLog(log) { + if (log.match(/experimental|jit engine|emitted file|tailwind/i)) + return false + }, + maxThreads: process.env.CI ? 1 : undefined, + minThreads: process.env.CI ? 1 : undefined + }, + esbuild: { + target: 'node14' + } +}) From b993c5f940b0cb69f34bff4c4b4cd6e546575ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 11 May 2022 15:53:46 +0900 Subject: [PATCH 0694/1287] perf(lib): reduce backtrack when injecting esbuild helpers (#8110) --- packages/vite/src/node/plugins/esbuild.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/node/plugins/esbuild.ts b/packages/vite/src/node/plugins/esbuild.ts index bc4a1f780a54d5..6fdf74ee05c4ad 100644 --- a/packages/vite/src/node/plugins/esbuild.ts +++ b/packages/vite/src/node/plugins/esbuild.ts @@ -27,9 +27,9 @@ import { searchForWorkspaceRoot } from '..' const debug = createDebugger('vite:esbuild') const INJECT_HELPERS_IIFE_RE = - /(.*)(var [^\s]+=function\(.*\){"use strict";)(.*)/ + /(.*)(var [^\s]+=function\([^)]*?\){"use strict";)(.*)/ const INJECT_HELPERS_UMD_RE = - /(.*)(\(function\(.*\){.+amd.+function\(.*\){"use strict";)(.*)/ + /(.*)(\(function\([^)]*?\){.+amd.+function\([^)]*?\){"use strict";)(.*)/ let server: ViteDevServer From 6d84baafc184808a266875793a765b69423c0d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 11 May 2022 16:06:53 +0900 Subject: [PATCH 0695/1287] test: fix flaky lib test (#8108) Co-authored-by: Anthony Fu --- playground/lib/__tests__/lib.spec.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/playground/lib/__tests__/lib.spec.ts b/playground/lib/__tests__/lib.spec.ts index 6d7ca7c5670ea0..ab3314ffe3a546 100644 --- a/playground/lib/__tests__/lib.spec.ts +++ b/playground/lib/__tests__/lib.spec.ts @@ -1,4 +1,4 @@ -import { isBuild, testDir, isServe } from '../../testUtils' +import { isBuild, isServe, testDir, untilUpdated } from '../../testUtils' import path from 'path' import fs from 'fs' @@ -28,7 +28,10 @@ describe.runIf(isBuild)('build', () => { }) test('Library mode does not include `preload`', async () => { - expect(await page.textContent('.dynamic-import-message')).toBe('hello vite') + await untilUpdated( + () => page.textContent('.dynamic-import-message'), + 'hello vite' + ) const code = fs.readFileSync( path.join(testDir(), 'dist/lib/dynamic-import-message.js'), 'utf-8' From 54a941a1ad4089502ccda063a917623a87b6d6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 11 May 2022 16:37:16 +0900 Subject: [PATCH 0696/1287] fix: add direct query to html-proxy css (fixes #8091) (#8094) --- packages/vite/src/node/plugins/css.ts | 65 +++++++++---------- .../src/node/server/middlewares/indexHtml.ts | 2 +- .../css-sourcemap/__tests__/serve.spec.ts | 18 ++++- 3 files changed, 49 insertions(+), 36 deletions(-) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 1e1bcef686ea42..8c2575c970d359 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -223,7 +223,8 @@ export function cssPlugin(config: ResolvedConfig): Plugin { const thisModule = moduleGraph.getModuleById(id) if (thisModule) { // CSS modules cannot self-accept since it exports values - const isSelfAccepting = !modules && !inlineRE.test(id) + const isSelfAccepting = + !modules && !inlineRE.test(id) && !htmlProxyRE.test(id) if (deps) { // record deps in the module graph so edits to @import css can trigger // main import to hot update @@ -301,7 +302,6 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { return } - const isHTMLProxy = htmlProxyRE.test(id) const inlined = inlineRE.test(id) const modules = cssModulesCache.get(config)!.get(id) @@ -314,43 +314,41 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { dataToEsm(modules, { namedExports: true, preferConst: true }) if (config.command === 'serve') { - if (isDirectCSSRequest(id)) { - return css - } else { - // server only - if (options?.ssr) { - return modulesCode || `export default ${JSON.stringify(css)}` - } - if (inlined) { - return `export default ${JSON.stringify(css)}` - } - - let cssContent = css + const getContentWithSourcemap = async (content: string) => { if (config.css?.devSourcemap) { const sourcemap = this.getCombinedSourcemap() await injectSourcesContent(sourcemap, cleanUrl(id), config.logger) - cssContent = getCodeWithSourcemap('css', css, sourcemap) - } - - if (isHTMLProxy) { - return cssContent + return getCodeWithSourcemap('css', content, sourcemap) } + return content + } - return [ - `import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify( - path.posix.join(config.base, CLIENT_PUBLIC_PATH) - )}`, - `const __vite__id = ${JSON.stringify(id)}`, - `const __vite__css = ${JSON.stringify(cssContent)}`, - `__vite__updateStyle(__vite__id, __vite__css)`, - // css modules exports change on edit so it can't self accept - `${ - modulesCode || - `import.meta.hot.accept()\nexport default __vite__css` - }`, - `import.meta.hot.prune(() => __vite__removeStyle(__vite__id))` - ].join('\n') + if (isDirectCSSRequest(id)) { + return await getContentWithSourcemap(css) + } + // server only + if (options?.ssr) { + return modulesCode || `export default ${JSON.stringify(css)}` } + if (inlined) { + return `export default ${JSON.stringify(css)}` + } + + const cssContent = await getContentWithSourcemap(css) + return [ + `import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify( + path.posix.join(config.base, CLIENT_PUBLIC_PATH) + )}`, + `const __vite__id = ${JSON.stringify(id)}`, + `const __vite__css = ${JSON.stringify(cssContent)}`, + `__vite__updateStyle(__vite__id, __vite__css)`, + // css modules exports change on edit so it can't self accept + `${ + modulesCode || + `import.meta.hot.accept()\nexport default __vite__css` + }`, + `import.meta.hot.prune(() => __vite__removeStyle(__vite__id))` + ].join('\n') } // build CSS handling ---------------------------------------------------- @@ -359,6 +357,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { // cache css compile result to map // and then use the cache replace inline-style-flag when `generateBundle` in vite:build-html plugin const inlineCSS = inlineCSSRE.test(id) + const isHTMLProxy = htmlProxyRE.test(id) const query = parseRequest(id) if (inlineCSS && isHTMLProxy) { addToHTMLProxyTransformResult( diff --git a/packages/vite/src/node/server/middlewares/indexHtml.ts b/packages/vite/src/node/server/middlewares/indexHtml.ts index 955ee6b708f54d..7b43ac0c67d428 100644 --- a/packages/vite/src/node/server/middlewares/indexHtml.ts +++ b/packages/vite/src/node/server/middlewares/indexHtml.ts @@ -217,7 +217,7 @@ const devHtmlHook: IndexHtmlTransformHook = async ( await Promise.all( styleUrl.map(async ({ start, end, code }, index) => { - const url = `${proxyModulePath}?html-proxy&index=${index}.css` + const url = `${proxyModulePath}?html-proxy&direct&index=${index}.css` // ensure module in graph after successful load const mod = await moduleGraph.ensureEntryFromUrl(url, false) diff --git a/playground/css-sourcemap/__tests__/serve.spec.ts b/playground/css-sourcemap/__tests__/serve.spec.ts index 34a627b68df736..2791300056074c 100644 --- a/playground/css-sourcemap/__tests__/serve.spec.ts +++ b/playground/css-sourcemap/__tests__/serve.spec.ts @@ -27,8 +27,22 @@ describe.runIf(isServe)('serve', () => { } ) const css = await res.text() - const lines = css.split('\n') - expect(lines[lines.length - 1].includes('/*')).toBe(false) // expect no sourcemap + const map = extractSourcemap(css) + expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` + Object { + "mappings": "AAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACT,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACb,CAAC;", + "sources": Array [ + "/root/linked.css", + ], + "sourcesContent": Array [ + ".linked { + color: red; + } + ", + ], + "version": 3, + } + `) }) test('linked css with import', async () => { From edf6fe0381e11e4f1f4f9dba85c340d2421a87bf Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 11 May 2022 15:57:50 +0800 Subject: [PATCH 0697/1287] chore: update snapshot --- playground/css-sourcemap/__tests__/serve.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playground/css-sourcemap/__tests__/serve.spec.ts b/playground/css-sourcemap/__tests__/serve.spec.ts index 2791300056074c..d42f93e84d4007 100644 --- a/playground/css-sourcemap/__tests__/serve.spec.ts +++ b/playground/css-sourcemap/__tests__/serve.spec.ts @@ -29,12 +29,12 @@ describe.runIf(isServe)('serve', () => { const css = await res.text() const map = extractSourcemap(css) expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(` - Object { + { "mappings": "AAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACT,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACb,CAAC;", - "sources": Array [ + "sources": [ "/root/linked.css", ], - "sourcesContent": Array [ + "sourcesContent": [ ".linked { color: red; } From 43a58ddcd6fcf7bdaea6db6463bac2a6932cd248 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 11 May 2022 16:44:14 +0800 Subject: [PATCH 0698/1287] chore(lint): sort for imports (#8113) --- .eslintrc.cjs | 13 +++ package.json | 10 +- packages/plugin-react/src/fast-refresh.ts | 2 +- .../jsx-runtime/babel-import-to-require.ts | 2 +- .../src/jsx-runtime/babel-restore-jsx.spec.ts | 4 +- .../src/jsx-runtime/restore-jsx.spec.ts | 4 +- packages/plugin-vue/src/handleHotUpdate.ts | 2 +- packages/plugin-vue/src/main.ts | 16 +-- packages/plugin-vue/src/script.ts | 2 +- packages/plugin-vue/src/style.ts | 2 +- packages/plugin-vue/src/template.ts | 6 +- .../vite/src/node/__tests__/asset.spec.ts | 2 +- .../vite/src/node/__tests__/build.spec.ts | 4 +- .../vite/src/node/__tests__/config.spec.ts | 4 +- packages/vite/src/node/__tests__/dev.spec.ts | 2 +- .../src/node/__tests__/plugins/css.spec.ts | 6 +- .../src/node/__tests__/plugins/define.spec.ts | 2 +- .../plugins/dynamicImportVar/parse.test.ts | 2 +- .../src/node/__tests__/plugins/import.spec.ts | 2 +- packages/vite/src/node/__tests__/scan.spec.ts | 4 +- .../vite/src/node/__tests__/utils.spec.ts | 2 +- packages/vite/src/node/build.ts | 30 ++--- packages/vite/src/node/cli.ts | 2 +- packages/vite/src/node/config.ts | 32 +++--- packages/vite/src/node/http.ts | 6 +- packages/vite/src/node/logger.ts | 4 +- .../src/node/optimizer/esbuildDepPlugin.ts | 8 +- packages/vite/src/node/optimizer/index.ts | 16 +-- .../src/node/optimizer/registerMissing.ts | 20 ++-- packages/vite/src/node/optimizer/scan.ts | 26 ++--- packages/vite/src/node/plugin.ts | 6 +- packages/vite/src/node/plugins/asset.ts | 6 +- .../src/node/plugins/assetImportMetaUrl.ts | 8 +- .../vite/src/node/plugins/clientInjections.ts | 2 +- packages/vite/src/node/plugins/css.ts | 55 +++++----- packages/vite/src/node/plugins/dataUri.ts | 2 +- .../src/node/plugins/dynamicImportVars.ts | 6 +- packages/vite/src/node/plugins/esbuild.ts | 18 +-- packages/vite/src/node/plugins/html.ts | 30 ++--- .../vite/src/node/plugins/importAnalysis.ts | 60 +++++----- .../src/node/plugins/importAnalysisBuild.ts | 8 +- .../vite/src/node/plugins/importMetaGlob.ts | 4 +- packages/vite/src/node/plugins/index.ts | 2 +- .../vite/src/node/plugins/optimizedDeps.ts | 2 +- packages/vite/src/node/plugins/reporter.ts | 2 +- packages/vite/src/node/plugins/resolve.ts | 36 +++--- .../vite/src/node/plugins/splitVendorChunk.ts | 8 +- packages/vite/src/node/plugins/terser.ts | 2 +- packages/vite/src/node/plugins/worker.ts | 8 +- .../src/node/plugins/workerImportMetaUrl.ts | 12 +- packages/vite/src/node/preview.ts | 14 +-- .../server/__tests__/pluginContainer.spec.ts | 2 +- .../node/server/__tests__/search-root.spec.ts | 4 +- packages/vite/src/node/server/hmr.ts | 10 +- packages/vite/src/node/server/index.ts | 48 ++++---- .../vite/src/node/server/middlewares/base.ts | 2 +- .../vite/src/node/server/middlewares/error.ts | 4 +- .../src/node/server/middlewares/indexHtml.ts | 8 +- .../vite/src/node/server/middlewares/proxy.ts | 4 +- .../node/server/middlewares/spaFallback.ts | 2 +- .../src/node/server/middlewares/static.ts | 8 +- .../src/node/server/middlewares/transform.ts | 14 +-- packages/vite/src/node/server/moduleGraph.ts | 4 +- packages/vite/src/node/server/openBrowser.ts | 2 +- .../vite/src/node/server/pluginContainer.ts | 22 ++-- packages/vite/src/node/server/sourcemap.ts | 2 +- .../vite/src/node/server/transformRequest.ts | 12 +- packages/vite/src/node/server/ws.ts | 4 +- .../node/ssr/__tests__/ssrExternal.spec.ts | 2 +- .../ssr/__tests__/ssrModuleLoader.spec.ts | 2 +- .../node/ssr/__tests__/ssrTransform.spec.ts | 2 +- packages/vite/src/node/ssr/ssrExternal.ts | 2 +- .../vite/src/node/ssr/ssrManifestPlugin.ts | 2 +- packages/vite/src/node/ssr/ssrModuleLoader.ts | 16 +-- packages/vite/src/node/ssr/ssrTransform.ts | 12 +- packages/vite/src/node/utils.ts | 28 ++--- packages/vite/types/shims.d.ts | 2 +- packages/vite/types/ws.d.ts | 4 +- .../worker/__tests__/es/es-worker.spec.ts | 2 +- .../worker/__tests__/iife/worker.spec.ts | 2 +- pnpm-lock.yaml | 103 +++++++++++++++++- 81 files changed, 488 insertions(+), 371 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 63a8d282ba9b25..e75311e00ed7a2 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -8,6 +8,7 @@ module.exports = defineConfig({ 'plugin:node/recommended', 'plugin:@typescript-eslint/recommended' ], + plugins: ['import'], parser: '@typescript-eslint/parser', parserOptions: { sourceType: 'module', @@ -86,6 +87,18 @@ module.exports = defineConfig({ '@typescript-eslint/consistent-type-imports': [ 'error', { prefer: 'type-imports' } + ], + + 'import/order': 'error', + 'sort-imports': [ + 'error', + { + ignoreCase: false, + ignoreDeclarationSort: true, + ignoreMemberSort: false, + memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], + allowSeparatedGroups: false + } ] }, overrides: [ diff --git a/package.json b/package.json index 62a66770cb750a..9904f281fbc4f1 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "scripts": { "preinstall": "npx only-allow pnpm", "format": "prettier --write .", - "lint": "eslint packages/*/{src,types}/**", + "lint": "eslint packages/*/{src,types}/** playground/**/__tests__/**/*.*", "test": "run-s test-unit test-serve test-build", "test-serve": "vitest run -c vitest.config.e2e.ts", "test-build": "cross-env VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts", @@ -48,6 +48,7 @@ "esbuild": "^0.14.38", "eslint": "^8.15.0", "eslint-define-config": "^1.4.0", + "eslint-plugin-import": "^2.26.0", "eslint-plugin-node": "^11.1.0", "execa": "^5.1.1", "fs-extra": "^10.1.0", @@ -80,10 +81,13 @@ "prettier --write --ignore-unknown" ], "packages/*/{src,types}/**/*.ts": [ - "eslint --ext .ts" + "eslint --fix" ], "packages/**/*.d.ts": [ - "eslint --ext .ts" + "eslint --fix" + ], + "playground/**/__tests__/**/*.ts": [ + "eslint --fix" ] }, "packageManager": "pnpm@6.32.11", diff --git a/packages/plugin-react/src/fast-refresh.ts b/packages/plugin-react/src/fast-refresh.ts index 4672e26f6264e3..6bff7d94fa023b 100644 --- a/packages/plugin-react/src/fast-refresh.ts +++ b/packages/plugin-react/src/fast-refresh.ts @@ -1,6 +1,6 @@ -import type { types as t } from '@babel/core' import fs from 'fs' import path from 'path' +import type { types as t } from '@babel/core' export const runtimePublicPath = '/@react-refresh' diff --git a/packages/plugin-react/src/jsx-runtime/babel-import-to-require.ts b/packages/plugin-react/src/jsx-runtime/babel-import-to-require.ts index dc7129862fd976..01e4cc4c37d478 100644 --- a/packages/plugin-react/src/jsx-runtime/babel-import-to-require.ts +++ b/packages/plugin-react/src/jsx-runtime/babel-import-to-require.ts @@ -1,5 +1,5 @@ import type * as babelCore from '@babel/core' -import type { types as t, Visitor } from '@babel/core' +import type { Visitor, types as t } from '@babel/core' /** * Replace this: diff --git a/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts b/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts index 391007f68c1329..b37ef698e5f215 100644 --- a/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts +++ b/packages/plugin-react/src/jsx-runtime/babel-restore-jsx.spec.ts @@ -1,6 +1,6 @@ -import babelRestoreJSX from './babel-restore-jsx' import * as babel from '@babel/core' -import { describe, it, expect } from 'vitest' +import { describe, expect, it } from 'vitest' +import babelRestoreJSX from './babel-restore-jsx' function jsx(code: string) { return babel.transform(code, { diff --git a/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts b/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts index 4f6a34ee60d915..fcad0f78c3373b 100644 --- a/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts +++ b/packages/plugin-react/src/jsx-runtime/restore-jsx.spec.ts @@ -1,6 +1,6 @@ -import { restoreJSX } from './restore-jsx' import * as babel from '@babel/core' -import { describe, it, expect } from 'vitest' +import { describe, expect, it } from 'vitest' +import { restoreJSX } from './restore-jsx' async function jsx(sourceCode: string) { const [ast] = await restoreJSX(babel, sourceCode, 'test.js') diff --git a/packages/plugin-vue/src/handleHotUpdate.ts b/packages/plugin-vue/src/handleHotUpdate.ts index 7c2a7ef7ee2f1f..fbf7d2c1f5d490 100644 --- a/packages/plugin-vue/src/handleHotUpdate.ts +++ b/packages/plugin-vue/src/handleHotUpdate.ts @@ -1,12 +1,12 @@ import _debug from 'debug' import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc' +import type { HmrContext, ModuleNode } from 'vite' import { createDescriptor, getDescriptor, setPrevDescriptor } from './utils/descriptorCache' import { getResolvedScript, setResolvedScript } from './script' -import type { ModuleNode, HmrContext } from 'vite' import type { ResolvedOptions } from '.' const debug = _debug('vite:hmr') diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index ccc700f184d0e4..8fa01e494f58e2 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -1,21 +1,21 @@ import path from 'path' import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc' -import type { ResolvedOptions } from '.' +import type { PluginContext, SourceMap, TransformPluginContext } from 'rollup' +import { normalizePath } from '@rollup/pluginutils' +import type { RawSourceMap } from 'source-map' +import { SourceMapConsumer, SourceMapGenerator } from 'source-map' +import { transformWithEsbuild } from 'vite' import { createDescriptor, getPrevDescriptor, setSrcDescriptor } from './utils/descriptorCache' -import type { PluginContext, SourceMap, TransformPluginContext } from 'rollup' -import { normalizePath } from '@rollup/pluginutils' -import { resolveScript, isUseInlineTemplate } from './script' +import { isUseInlineTemplate, resolveScript } from './script' import { transformTemplateInMain } from './template' -import { isOnlyTemplateChanged, isEqualBlock } from './handleHotUpdate' -import type { RawSourceMap } from 'source-map' -import { SourceMapConsumer, SourceMapGenerator } from 'source-map' +import { isEqualBlock, isOnlyTemplateChanged } from './handleHotUpdate' import { createRollupError } from './utils/error' -import { transformWithEsbuild } from 'vite' import { EXPORT_HELPER_ID } from './helper' +import type { ResolvedOptions } from '.' // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export async function transformMain( diff --git a/packages/plugin-vue/src/script.ts b/packages/plugin-vue/src/script.ts index 93610dcf7f6a36..f5d488c22c279a 100644 --- a/packages/plugin-vue/src/script.ts +++ b/packages/plugin-vue/src/script.ts @@ -1,6 +1,6 @@ import type { SFCDescriptor, SFCScriptBlock } from 'vue/compiler-sfc' -import type { ResolvedOptions } from '.' import { resolveTemplateCompilerOptions } from './template' +import type { ResolvedOptions } from '.' // ssr and non ssr builds would output different script content const clientCache = new WeakMap() diff --git a/packages/plugin-vue/src/style.ts b/packages/plugin-vue/src/style.ts index cab75791bd54ec..aa124de17b8894 100644 --- a/packages/plugin-vue/src/style.ts +++ b/packages/plugin-vue/src/style.ts @@ -1,8 +1,8 @@ import type { SFCDescriptor } from 'vue/compiler-sfc' import type { ExistingRawSourceMap, TransformPluginContext } from 'rollup' -import type { ResolvedOptions } from '.' import type { RawSourceMap } from 'source-map' import { formatPostcssSourceMap } from 'vite' +import type { ResolvedOptions } from '.' // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export async function transformStyle( diff --git a/packages/plugin-vue/src/template.ts b/packages/plugin-vue/src/template.ts index c7eed9015d6339..c44da9e67228b0 100644 --- a/packages/plugin-vue/src/template.ts +++ b/packages/plugin-vue/src/template.ts @@ -1,15 +1,15 @@ import path from 'path' import slash from 'slash' import type { + CompilerOptions, SFCDescriptor, SFCTemplateCompileOptions, - SFCTemplateCompileResults, - CompilerOptions + SFCTemplateCompileResults } from 'vue/compiler-sfc' import type { PluginContext, TransformPluginContext } from 'rollup' -import type { ResolvedOptions } from '.' import { getResolvedScript } from './script' import { createRollupError } from './utils/error' +import type { ResolvedOptions } from '.' // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export async function transformTemplateAsModule( diff --git a/packages/vite/src/node/__tests__/asset.spec.ts b/packages/vite/src/node/__tests__/asset.spec.ts index 8727aa6485eb26..a756cb12652739 100644 --- a/packages/vite/src/node/__tests__/asset.spec.ts +++ b/packages/vite/src/node/__tests__/asset.spec.ts @@ -1,4 +1,4 @@ -import { describe, test, expect } from 'vitest' +import { describe, expect, test } from 'vitest' import { assetFileNamesToFileName, getAssetHash } from '../plugins/asset' describe('getAssetHash', () => { diff --git a/packages/vite/src/node/__tests__/build.spec.ts b/packages/vite/src/node/__tests__/build.spec.ts index b49847f1d955a4..3b34851203e149 100644 --- a/packages/vite/src/node/__tests__/build.spec.ts +++ b/packages/vite/src/node/__tests__/build.spec.ts @@ -1,7 +1,7 @@ +import { resolve } from 'path' +import { describe, expect, test } from 'vitest' import type { LibraryFormats, LibraryOptions } from '../build' import { resolveLibFilename } from '../build' -import { resolve } from 'path' -import { describe, test, expect } from 'vitest' type FormatsToFileNames = [LibraryFormats, string][] const baseLibOptions: LibraryOptions = { diff --git a/packages/vite/src/node/__tests__/config.spec.ts b/packages/vite/src/node/__tests__/config.spec.ts index 83995ab28adcbd..4eaeae2822a1e3 100644 --- a/packages/vite/src/node/__tests__/config.spec.ts +++ b/packages/vite/src/node/__tests__/config.spec.ts @@ -1,7 +1,7 @@ +import { describe, expect, test } from 'vitest' import type { InlineConfig } from '..' -import type { UserConfigExport, UserConfig } from '../config' +import type { UserConfig, UserConfigExport } from '../config' import { mergeConfig, resolveConfig, resolveEnvPrefix } from '../config' -import { describe, test, expect } from 'vitest' describe('mergeConfig', () => { test('handles configs with different alias schemas', () => { diff --git a/packages/vite/src/node/__tests__/dev.spec.ts b/packages/vite/src/node/__tests__/dev.spec.ts index cdb0fc123f4b4f..3b3b3d14553da4 100644 --- a/packages/vite/src/node/__tests__/dev.spec.ts +++ b/packages/vite/src/node/__tests__/dev.spec.ts @@ -1,5 +1,5 @@ +import { describe, expect, test } from 'vitest' import { resolveConfig } from '..' -import { describe, test, expect } from 'vitest' describe('resolveBuildOptions in dev', () => { test('build.rollupOptions should not have input in lib', async () => { diff --git a/packages/vite/src/node/__tests__/plugins/css.spec.ts b/packages/vite/src/node/__tests__/plugins/css.spec.ts index 70ddb640b13218..e6b919a0094aa6 100644 --- a/packages/vite/src/node/__tests__/plugins/css.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/css.spec.ts @@ -1,8 +1,8 @@ -import { cssUrlRE, cssPlugin, hoistAtRules } from '../../plugins/css' -import { resolveConfig } from '../../config' import fs from 'fs' import path from 'path' -import { describe, vi, test, expect } from 'vitest' +import { describe, expect, test, vi } from 'vitest' +import { resolveConfig } from '../../config' +import { cssPlugin, cssUrlRE, hoistAtRules } from '../../plugins/css' describe('search css url function', () => { test('some spaces before it', () => { diff --git a/packages/vite/src/node/__tests__/plugins/define.spec.ts b/packages/vite/src/node/__tests__/plugins/define.spec.ts index b9acc81cb790d5..932560a749f24d 100644 --- a/packages/vite/src/node/__tests__/plugins/define.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/define.spec.ts @@ -1,4 +1,4 @@ -import { describe, test, expect } from 'vitest' +import { describe, expect, test } from 'vitest' import { definePlugin } from '../../plugins/define' import { resolveConfig } from '../../config' diff --git a/packages/vite/src/node/__tests__/plugins/dynamicImportVar/parse.test.ts b/packages/vite/src/node/__tests__/plugins/dynamicImportVar/parse.test.ts index ef1dcb2238a5b0..a0017d50ae6cd2 100644 --- a/packages/vite/src/node/__tests__/plugins/dynamicImportVar/parse.test.ts +++ b/packages/vite/src/node/__tests__/plugins/dynamicImportVar/parse.test.ts @@ -1,6 +1,6 @@ +import { resolve } from 'path' import { describe, expect, it } from 'vitest' import { transformDynamicImport } from '../../../plugins/dynamicImportVars' -import { resolve } from 'path' async function run(input: string) { const { glob, rawPattern } = await transformDynamicImport( diff --git a/packages/vite/src/node/__tests__/plugins/import.spec.ts b/packages/vite/src/node/__tests__/plugins/import.spec.ts index e232702d57d354..661f35902ab580 100644 --- a/packages/vite/src/node/__tests__/plugins/import.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/import.spec.ts @@ -1,4 +1,4 @@ -import { describe, test, expect } from 'vitest' +import { describe, expect, test } from 'vitest' import { transformCjsImport } from '../../plugins/importAnalysis' describe('transformCjsImport', () => { diff --git a/packages/vite/src/node/__tests__/scan.spec.ts b/packages/vite/src/node/__tests__/scan.spec.ts index 8d5a275fca0292..0f9475562365d5 100644 --- a/packages/vite/src/node/__tests__/scan.spec.ts +++ b/packages/vite/src/node/__tests__/scan.spec.ts @@ -1,6 +1,6 @@ -import { scriptRE, commentRE, importsRE } from '../optimizer/scan' +import { describe, expect, test } from 'vitest' +import { commentRE, importsRE, scriptRE } from '../optimizer/scan' import { multilineCommentsRE, singlelineCommentsRE } from '../utils' -import { describe, test, expect } from 'vitest' describe('optimizer-scan:script-test', () => { const scriptContent = `import { defineComponent } from 'vue' diff --git a/packages/vite/src/node/__tests__/utils.spec.ts b/packages/vite/src/node/__tests__/utils.spec.ts index 29fd53f3c9a32e..56b5db32c2caf4 100644 --- a/packages/vite/src/node/__tests__/utils.spec.ts +++ b/packages/vite/src/node/__tests__/utils.spec.ts @@ -1,10 +1,10 @@ +import { describe, expect, test } from 'vitest' import { getPotentialTsSrcPaths, injectQuery, isWindows, resolveHostname } from '../utils' -import { describe, test, expect } from 'vitest' describe('injectQuery', () => { if (isWindows) { diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index cc254521b8d2aa..73db49c1c2b7ae 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -1,40 +1,40 @@ import fs from 'fs' import path from 'path' import colors from 'picocolors' -import type { InlineConfig, ResolvedConfig } from './config' -import { resolveConfig } from './config' import type { + ExternalOption, + ModuleFormat, + OutputOptions, Plugin, RollupBuild, + RollupError, RollupOptions, - RollupWarning, - WarningHandler, - OutputOptions, RollupOutput, - ExternalOption, - WatcherOptions, + RollupWarning, RollupWatcher, - RollupError, - ModuleFormat + WarningHandler, + WatcherOptions } from 'rollup' import type Rollup from 'rollup' +import type { Terser } from 'types/terser' +import commonjsPlugin from '@rollup/plugin-commonjs' +import type { RollupCommonJSOptions } from 'types/commonjs' +import type { RollupDynamicImportVarsOptions } from 'types/dynamicImportVars' +import type { TransformOptions } from 'esbuild' +import type { InlineConfig, ResolvedConfig } from './config' +import { resolveConfig } from './config' import { buildReporterPlugin } from './plugins/reporter' import { buildEsbuildPlugin } from './plugins/esbuild' import { terserPlugin } from './plugins/terser' -import type { Terser } from 'types/terser' import { copyDir, emptyDir, lookupFile, normalizePath } from './utils' import { manifestPlugin } from './plugins/manifest' -import commonjsPlugin from '@rollup/plugin-commonjs' -import type { RollupCommonJSOptions } from 'types/commonjs' -import type { RollupDynamicImportVarsOptions } from 'types/dynamicImportVars' import type { Logger } from './logger' -import type { TransformOptions } from 'esbuild' import { dataURIPlugin } from './plugins/dataUri' import { buildImportAnalysisPlugin } from './plugins/importAnalysisBuild' import { resolveSSRExternal, shouldExternalizeForSSR } from './ssr/ssrExternal' import { ssrManifestPlugin } from './ssr/ssrManifestPlugin' import type { DepOptimizationMetadata } from './optimizer' -import { getDepsCacheDir, findKnownImports } from './optimizer' +import { findKnownImports, getDepsCacheDir } from './optimizer' import { assetImportMetaUrlPlugin } from './plugins/assetImportMetaUrl' import { loadFallbackPlugin } from './plugins/loadFallback' import type { PackageData } from './packages' diff --git a/packages/vite/src/node/cli.ts b/packages/vite/src/node/cli.ts index 89412a825e9fc1..9ee807f505e016 100644 --- a/packages/vite/src/node/cli.ts +++ b/packages/vite/src/node/cli.ts @@ -1,6 +1,6 @@ +import { performance } from 'perf_hooks' import { cac } from 'cac' import colors from 'picocolors' -import { performance } from 'perf_hooks' import type { BuildOptions } from './build' import type { ServerOptions } from './server' import type { LogLevel } from './logger' diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index e7fcaefeb2a799..138514579f3ee0 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -1,45 +1,45 @@ import fs from 'fs' import path from 'path' +import { parse as parseUrl, pathToFileURL } from 'url' +import { performance } from 'perf_hooks' +import colors from 'picocolors' +import dotenv from 'dotenv' +import dotenvExpand from 'dotenv-expand' +import type { Alias, AliasOptions } from 'types/alias' +import { createFilter } from '@rollup/pluginutils' +import aliasPlugin from '@rollup/plugin-alias' +import { build } from 'esbuild' +import type { RollupOptions } from 'rollup' import type { Plugin } from './plugin' import type { BuildOptions } from './build' import { resolveBuildOptions } from './build' import type { ResolvedServerOptions, ServerOptions } from './server' import { resolveServerOptions } from './server' -import type { ResolvedPreviewOptions, PreviewOptions } from './preview' +import type { PreviewOptions, ResolvedPreviewOptions } from './preview' import { resolvePreviewOptions } from './preview' import type { CSSOptions } from './plugins/css' import { arraify, createDebugger, + dynamicImport, isExternalUrl, isObject, lookupFile, - normalizePath, - dynamicImport + normalizePath } from './utils' import { resolvePlugins } from './plugins' -import colors from 'picocolors' import type { ESBuildOptions } from './plugins/esbuild' -import dotenv from 'dotenv' -import dotenvExpand from 'dotenv-expand' -import type { Alias, AliasOptions } from 'types/alias' -import { CLIENT_ENTRY, ENV_ENTRY, DEFAULT_ASSETS_RE } from './constants' +import { CLIENT_ENTRY, DEFAULT_ASSETS_RE, ENV_ENTRY } from './constants' import type { InternalResolveOptions, ResolveOptions } from './plugins/resolve' import { resolvePlugin } from './plugins/resolve' -import type { Logger, LogLevel } from './logger' +import type { LogLevel, Logger } from './logger' import { createLogger } from './logger' import type { DepOptimizationOptions } from './optimizer' -import { createFilter } from '@rollup/pluginutils' -import type { ResolvedBuildOptions } from '.' -import { parse as parseUrl, pathToFileURL } from 'url' import type { JsonOptions } from './plugins/json' import type { PluginContainer } from './server/pluginContainer' import { createPluginContainer } from './server/pluginContainer' -import aliasPlugin from '@rollup/plugin-alias' -import { build } from 'esbuild' -import { performance } from 'perf_hooks' import type { PackageCache } from './packages' -import type { RollupOptions } from 'rollup' +import type { ResolvedBuildOptions } from '.' const debug = createDebugger('vite:config') diff --git a/packages/vite/src/node/http.ts b/packages/vite/src/node/http.ts index 18140b031937a9..1aa924282483b8 100644 --- a/packages/vite/src/node/http.ts +++ b/packages/vite/src/node/http.ts @@ -1,13 +1,13 @@ import fs, { promises as fsp } from 'fs' import path from 'path' import type { - OutgoingHttpHeaders as HttpServerHeaders, - Server as HttpServer + Server as HttpServer, + OutgoingHttpHeaders as HttpServerHeaders } from 'http' import type { ServerOptions as HttpsServerOptions } from 'https' +import type { Connect } from 'types/connect' import { isObject } from './utils' import type { ProxyOptions } from './server/middlewares/proxy' -import type { Connect } from 'types/connect' import type { Logger } from './logger' export interface CommonServerOptions { diff --git a/packages/vite/src/node/logger.ts b/packages/vite/src/node/logger.ts index 4f5784aeb527ff..c0f316ffed2698 100644 --- a/packages/vite/src/node/logger.ts +++ b/packages/vite/src/node/logger.ts @@ -1,14 +1,14 @@ /* eslint no-console: 0 */ -import colors from 'picocolors' import type { AddressInfo, Server } from 'net' import os from 'os' import readline from 'readline' +import colors from 'picocolors' import type { RollupError } from 'rollup' -import type { ResolvedConfig } from '.' import type { CommonServerOptions } from './http' import type { Hostname } from './utils' import { resolveHostname } from './utils' +import type { ResolvedConfig } from '.' export type LogType = 'error' | 'warn' | 'info' export type LogLevel = LogType | 'silent' diff --git a/packages/vite/src/node/optimizer/esbuildDepPlugin.ts b/packages/vite/src/node/optimizer/esbuildDepPlugin.ts index 4303be0ec876e7..9fcc649ef394e3 100644 --- a/packages/vite/src/node/optimizer/esbuildDepPlugin.ts +++ b/packages/vite/src/node/optimizer/esbuildDepPlugin.ts @@ -1,13 +1,13 @@ import path from 'path' -import type { Plugin, ImportKind } from 'esbuild' +import type { ImportKind, Plugin } from 'esbuild' import { KNOWN_ASSET_TYPES } from '../constants' import type { ResolvedConfig } from '..' import { - isRunningWithYarnPnp, flattenId, - normalizePath, isExternalUrl, - moduleListContains + isRunningWithYarnPnp, + moduleListContains, + normalizePath } from '../utils' import { browserExternalId } from '../plugins/resolve' import type { ExportsData } from '.' diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index 33419e0d186487..53bffb13e604d0 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -1,27 +1,27 @@ import fs from 'fs' import path from 'path' +import { createHash } from 'crypto' +import { performance } from 'perf_hooks' import _debug from 'debug' import colors from 'picocolors' -import { createHash } from 'crypto' import type { BuildOptions as EsbuildBuildOptions } from 'esbuild' import { build } from 'esbuild' +import { init, parse } from 'es-module-lexer' import type { ResolvedConfig } from '../config' import { createDebugger, emptyDir, - lookupFile, - normalizePath, - writeFile, flattenId, + lookupFile, normalizeId, + normalizePath, removeDirSync, - renameDir + renameDir, + writeFile } from '../utils' +import { transformWithEsbuild } from '../plugins/esbuild' import { esbuildDepPlugin } from './esbuildDepPlugin' -import { init, parse } from 'es-module-lexer' import { scanImports } from './scan' -import { transformWithEsbuild } from '../plugins/esbuild' -import { performance } from 'perf_hooks' export const debuggerViteDeps = createDebugger('vite:deps') const debug = debuggerViteDeps diff --git a/packages/vite/src/node/optimizer/registerMissing.ts b/packages/vite/src/node/optimizer/registerMissing.ts index 53cd7e981b1b61..1efb9e02261ae7 100644 --- a/packages/vite/src/node/optimizer/registerMissing.ts +++ b/packages/vite/src/node/optimizer/registerMissing.ts @@ -1,24 +1,24 @@ import colors from 'picocolors' import _debug from 'debug' +import type { ViteDevServer } from '..' import { - runOptimizeDeps, - getOptimizedDepPath, - getHash, - depsFromOptimizedDepInfo, - newDepOptimizationProcessing, - loadCachedDepOptimizationMetadata, - createOptimizedDepsMetadata, addOptimizedDepInfo, - discoverProjectDependencies, + createOptimizedDepsMetadata, + debuggerViteDeps as debug, + depsFromOptimizedDepInfo, depsLogString, - debuggerViteDeps as debug + discoverProjectDependencies, + getHash, + getOptimizedDepPath, + loadCachedDepOptimizationMetadata, + newDepOptimizationProcessing, + runOptimizeDeps } from '.' import type { DepOptimizationProcessing, OptimizedDepInfo, OptimizedDeps } from '.' -import type { ViteDevServer } from '..' const isDebugEnabled = _debug('vite:deps').enabled diff --git a/packages/vite/src/node/optimizer/scan.ts b/packages/vite/src/node/optimizer/scan.ts index 8dfac45c4e6612..157c8d28db1083 100644 --- a/packages/vite/src/node/optimizer/scan.ts +++ b/packages/vite/src/node/optimizer/scan.ts @@ -1,32 +1,32 @@ import fs from 'fs' import path from 'path' +import { performance } from 'perf_hooks' import glob from 'fast-glob' -import type { ResolvedConfig } from '..' -import type { Loader, Plugin, OnLoadResult } from 'esbuild' +import type { Loader, OnLoadResult, Plugin } from 'esbuild' import { build } from 'esbuild' +import colors from 'picocolors' +import type { ResolvedConfig } from '..' import { - KNOWN_ASSET_TYPES, JS_TYPES_RE, - SPECIAL_QUERY_RE, - OPTIMIZABLE_ENTRY_RE + KNOWN_ASSET_TYPES, + OPTIMIZABLE_ENTRY_RE, + SPECIAL_QUERY_RE } from '../constants' import { + cleanUrl, createDebugger, - normalizePath, + dataUrlRE, + externalRE, isObject, - cleanUrl, moduleListContains, - externalRE, - dataUrlRE, multilineCommentsRE, + normalizePath, singlelineCommentsRE, - virtualModuleRE, - virtualModulePrefix + virtualModulePrefix, + virtualModuleRE } from '../utils' import type { PluginContainer } from '../server/pluginContainer' import { createPluginContainer } from '../server/pluginContainer' -import { performance } from 'perf_hooks' -import colors from 'picocolors' import { transformGlobImport } from '../plugins/importMetaGlob' const debug = createDebugger('vite:deps') diff --git a/packages/vite/src/node/plugin.ts b/packages/vite/src/node/plugin.ts index 3bfe789a299987..adf647d6d5500f 100644 --- a/packages/vite/src/node/plugin.ts +++ b/packages/vite/src/node/plugin.ts @@ -1,19 +1,19 @@ -import type { UserConfig } from './config' import type { CustomPluginOptions, LoadResult, - Plugin as RollupPlugin, PluginContext, ResolveIdResult, + Plugin as RollupPlugin, TransformPluginContext, TransformResult } from 'rollup' +import type { UserConfig } from './config' import type { ServerHook } from './server' import type { IndexHtmlTransform } from './plugins/html' import type { ModuleNode } from './server/moduleGraph' -import type { ConfigEnv, ResolvedConfig } from './' import type { HmrContext } from './server/hmr' import type { PreviewServerHook } from './preview' +import type { ConfigEnv, ResolvedConfig } from './' /** * Vite plugins extends the Rollup plugin interface with a few extra diff --git a/packages/vite/src/node/plugins/asset.ts b/packages/vite/src/node/plugins/asset.ts index f2eed2bc28bc5a..db62325509f308 100644 --- a/packages/vite/src/node/plugins/asset.ts +++ b/packages/vite/src/node/plugins/asset.ts @@ -1,14 +1,14 @@ import path from 'path' import { parse as parseUrl } from 'url' import fs, { promises as fsp } from 'fs' +import { createHash } from 'crypto' import * as mrmime from 'mrmime' +import type { OutputOptions, PluginContext } from 'rollup' +import MagicString from 'magic-string' import type { Plugin } from '../plugin' import type { ResolvedConfig } from '../config' import { cleanUrl } from '../utils' import { FS_PREFIX } from '../constants' -import type { OutputOptions, PluginContext } from 'rollup' -import MagicString from 'magic-string' -import { createHash } from 'crypto' import { normalizePath } from '../utils' export const assetUrlRE = /__VITE_ASSET__([a-z\d]{8})__(?:\$_(.*?)__)?/g diff --git a/packages/vite/src/node/plugins/assetImportMetaUrl.ts b/packages/vite/src/node/plugins/assetImportMetaUrl.ts index 73932bfb29a411..2bff4f5e7b682e 100644 --- a/packages/vite/src/node/plugins/assetImportMetaUrl.ts +++ b/packages/vite/src/node/plugins/assetImportMetaUrl.ts @@ -1,9 +1,9 @@ -import type { Plugin } from '../plugin' -import MagicString from 'magic-string' import path from 'path' -import { fileToUrl } from './asset' -import type { ResolvedConfig } from '../config' +import MagicString from 'magic-string' import { stripLiteral } from 'strip-literal' +import type { Plugin } from '../plugin' +import type { ResolvedConfig } from '../config' +import { fileToUrl } from './asset' /** * Convert `new URL('./foo.png', import.meta.url)` to its resolved built URL diff --git a/packages/vite/src/node/plugins/clientInjections.ts b/packages/vite/src/node/plugins/clientInjections.ts index 1c9a0d393327c7..eb5c7183c2ac59 100644 --- a/packages/vite/src/node/plugins/clientInjections.ts +++ b/packages/vite/src/node/plugins/clientInjections.ts @@ -2,7 +2,7 @@ import path from 'path' import type { Plugin } from '../plugin' import type { ResolvedConfig } from '../config' import { CLIENT_ENTRY, ENV_ENTRY } from '../constants' -import { normalizePath, isObject } from '../utils' +import { isObject, normalizePath } from '../utils' // ids in transform are normalized to unix style const normalizedClientEntry = normalizePath(CLIENT_ENTRY) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 8c2575c970d359..bee3e37d4cbe38 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -1,21 +1,6 @@ import fs from 'fs' import path from 'path' import glob from 'fast-glob' -import { - // createDebugger, - isExternalUrl, - asyncReplace, - cleanUrl, - generateCodeFrame, - isDataUrl, - isObject, - normalizePath, - processSrcSet, - parseRequest, - combineSourcemaps -} from '../utils' -import type { Plugin } from '../plugin' -import type { ResolvedConfig } from '../config' import postcssrc from 'postcss-load-config' import type { ExistingRawSourceMap, @@ -27,15 +12,6 @@ import type { } from 'rollup' import { dataToEsm } from '@rollup/pluginutils' import colors from 'picocolors' -import { CLIENT_PUBLIC_PATH, SPECIAL_QUERY_RE } from '../constants' -import type { ResolveFn, ViteDevServer } from '../' -import { - getAssetFilename, - assetUrlRE, - fileToUrl, - checkPublicFile, - getAssetHash -} from './asset' import MagicString from 'magic-string' import type * as PostCSS from 'postcss' import type Sass from 'sass' @@ -44,12 +20,35 @@ import type Sass from 'sass' import type Stylus from 'stylus' // eslint-disable-line node/no-extraneous-import import type Less from 'less' import type { Alias } from 'types/alias' -import type { ModuleNode } from '../server/moduleGraph' -import { transform, formatMessages } from 'esbuild' -import { addToHTMLProxyTransformResult } from './html' -import { injectSourcesContent, getCodeWithSourcemap } from '../server/sourcemap' +import { formatMessages, transform } from 'esbuild' import type { RawSourceMap } from '@ampproject/remapping' +import { getCodeWithSourcemap, injectSourcesContent } from '../server/sourcemap' +import type { ModuleNode } from '../server/moduleGraph' +import type { ResolveFn, ViteDevServer } from '../' +import { CLIENT_PUBLIC_PATH, SPECIAL_QUERY_RE } from '../constants' +import type { ResolvedConfig } from '../config' +import type { Plugin } from '../plugin' +import { + asyncReplace, + cleanUrl, + combineSourcemaps, + generateCodeFrame, + isDataUrl, + isExternalUrl, + isObject, + normalizePath, + parseRequest, + processSrcSet +} from '../utils' import { emptyCssComments } from '../utils' +import { addToHTMLProxyTransformResult } from './html' +import { + assetUrlRE, + checkPublicFile, + fileToUrl, + getAssetFilename, + getAssetHash +} from './asset' // const debug = createDebugger('vite:css') diff --git a/packages/vite/src/node/plugins/dataUri.ts b/packages/vite/src/node/plugins/dataUri.ts index 5f5f40146097df..84999d586c4f34 100644 --- a/packages/vite/src/node/plugins/dataUri.ts +++ b/packages/vite/src/node/plugins/dataUri.ts @@ -1,8 +1,8 @@ // This is based on @rollup/plugin-data-uri // MIT Licensed https://github.com/rollup/plugins/blob/master/LICENSE // ref https://github.com/vitejs/vite/issues/1428#issuecomment-757033808 -import type { Plugin } from '../plugin' import { URL } from 'url' +import type { Plugin } from '../plugin' const dataUriRE = /^([^/]+\/[^;,]+)(;base64)?,([\s\S]*)$/ diff --git a/packages/vite/src/node/plugins/dynamicImportVars.ts b/packages/vite/src/node/plugins/dynamicImportVars.ts index c33590cf0343f4..7559d637ce648e 100644 --- a/packages/vite/src/node/plugins/dynamicImportVars.ts +++ b/packages/vite/src/node/plugins/dynamicImportVars.ts @@ -2,12 +2,12 @@ import { posix } from 'path' import MagicString from 'magic-string' import { init, parse as parseImports } from 'es-module-lexer' import type { ImportSpecifier } from 'es-module-lexer' -import type { Plugin } from '../plugin' -import type { ResolvedConfig } from '../config' -import { normalizePath, parseRequest, requestQuerySplitRE } from '../utils' import { parse as parseJS } from 'acorn' import { createFilter } from '@rollup/pluginutils' import { dynamicImportToGlob } from '@rollup/plugin-dynamic-import-vars' +import type { Plugin } from '../plugin' +import type { ResolvedConfig } from '../config' +import { normalizePath, parseRequest, requestQuerySplitRE } from '../utils' export const dynamicImportHelperId = '/@vite/dynamic-import-helper' diff --git a/packages/vite/src/node/plugins/esbuild.ts b/packages/vite/src/node/plugins/esbuild.ts index 6fdf74ee05c4ad..5250f4baf7687b 100644 --- a/packages/vite/src/node/plugins/esbuild.ts +++ b/packages/vite/src/node/plugins/esbuild.ts @@ -1,13 +1,19 @@ import path from 'path' import colors from 'picocolors' -import type { Plugin } from '../plugin' import type { - Message, Loader, + Message, TransformOptions, TransformResult } from 'esbuild' import { transform } from 'esbuild' +import type { RawSourceMap } from '@ampproject/remapping' +import type { SourceMap } from 'rollup' +import { createFilter } from '@rollup/pluginutils' +import type { TSConfckParseOptions, TSConfckParseResult } from 'tsconfck' +import { TSConfckParseError, findAll, parse } from 'tsconfck' +import { combineSourcemaps } from '../utils' +import type { ResolvedConfig, ViteDevServer } from '..' import { cleanUrl, createDebugger, @@ -15,13 +21,7 @@ import { generateCodeFrame, toUpperCaseDriveLetter } from '../utils' -import type { RawSourceMap } from '@ampproject/remapping' -import type { SourceMap } from 'rollup' -import type { ResolvedConfig, ViteDevServer } from '..' -import { createFilter } from '@rollup/pluginutils' -import { combineSourcemaps } from '../utils' -import type { TSConfckParseOptions, TSConfckParseResult } from 'tsconfck' -import { parse, findAll, TSConfckParseError } from 'tsconfck' +import type { Plugin } from '../plugin' import { searchForWorkspaceRoot } from '..' const debug = createDebugger('vite:esbuild') diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index 2f1e3af34babb4..ea178287f672a1 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -1,6 +1,4 @@ import path from 'path' -import type { Plugin } from '../plugin' -import type { ViteDevServer } from '../server' import type { OutputAsset, OutputBundle, @@ -8,6 +6,18 @@ import type { RollupError, SourceMapInput } from 'rollup' +import MagicString from 'magic-string' +import type { + AttributeNode, + CompilerError, + ElementNode, + NodeTransform, + TextNode +} from '@vue/compiler-dom' +import { NodeTypes } from '@vue/compiler-dom' +import { stripLiteral } from 'strip-literal' +import type { Plugin } from '../plugin' +import type { ViteDevServer } from '../server' import { cleanUrl, generateCodeFrame, @@ -18,25 +28,15 @@ import { slash } from '../utils' import type { ResolvedConfig } from '../config' -import MagicString from 'magic-string' import { - checkPublicFile, assetUrlRE, - urlToBuiltUrl, + checkPublicFile, getAssetFilename, - getAssetHash + getAssetHash, + urlToBuiltUrl } from './asset' import { isCSSRequest } from './css' import { modulePreloadPolyfillId } from './modulePreloadPolyfill' -import type { - AttributeNode, - NodeTransform, - ElementNode, - CompilerError, - TextNode -} from '@vue/compiler-dom' -import { NodeTypes } from '@vue/compiler-dom' -import { stripLiteral } from 'strip-literal' interface ScriptAssetsUrl { start: number diff --git a/packages/vite/src/node/plugins/importAnalysis.ts b/packages/vite/src/node/plugins/importAnalysis.ts index f12426aa923cfe..d33235805aa5ee 100644 --- a/packages/vite/src/node/plugins/importAnalysis.ts +++ b/packages/vite/src/node/plugins/importAnalysis.ts @@ -1,56 +1,56 @@ import fs from 'fs' import path from 'path' -import type { Plugin } from '../plugin' -import type { ResolvedConfig } from '../config' +import { performance } from 'perf_hooks' import colors from 'picocolors' import MagicString from 'magic-string' import type { ImportSpecifier } from 'es-module-lexer' import { init, parse as parseImports } from 'es-module-lexer' -import { isCSSRequest, isDirectCSSRequest } from './css' +import { parse as parseJS } from 'acorn' +import type { Node } from 'estree' +import { makeLegalIdentifier } from '@rollup/pluginutils' +import type { ViteDevServer } from '..' +import { + CLIENT_DIR, + CLIENT_PUBLIC_PATH, + DEP_VERSION_RE, + FS_PREFIX, + NULL_BYTE_PLACEHOLDER, + VALID_ID_PREFIX +} from '../constants' +import { + debugHmr, + handlePrunedModules, + lexAcceptedHmrDeps +} from '../server/hmr' import { - isBuiltin, cleanUrl, createDebugger, + fsPathFromUrl, generateCodeFrame, injectQuery, + isBuiltin, isDataUrl, isExternalUrl, isJSRequest, - prettifyUrl, - timeFrom, + moduleListContains, normalizePath, + prettifyUrl, removeImportQuery, - unwrapId, - moduleListContains, - fsPathFromUrl + timeFrom, + unwrapId } from '../utils' -import { - debugHmr, - handlePrunedModules, - lexAcceptedHmrDeps -} from '../server/hmr' -import { - FS_PREFIX, - CLIENT_DIR, - CLIENT_PUBLIC_PATH, - DEP_VERSION_RE, - VALID_ID_PREFIX, - NULL_BYTE_PLACEHOLDER -} from '../constants' -import { ERR_OUTDATED_OPTIMIZED_DEP } from './optimizedDeps' -import type { ViteDevServer } from '..' -import { checkPublicFile } from './asset' -import { parse as parseJS } from 'acorn' -import type { Node } from 'estree' -import { makeLegalIdentifier } from '@rollup/pluginutils' +import type { ResolvedConfig } from '../config' +import type { Plugin } from '../plugin' import { shouldExternalizeForSSR } from '../ssr/ssrExternal' -import { performance } from 'perf_hooks' import { transformRequest } from '../server/transformRequest' import { - isOptimizedDepFile, getDepsCacheDir, + isOptimizedDepFile, optimizedDepNeedsInterop } from '../optimizer' +import { checkPublicFile } from './asset' +import { ERR_OUTDATED_OPTIMIZED_DEP } from './optimizedDeps' +import { isCSSRequest, isDirectCSSRequest } from './css' const isDebug = !!process.env.DEBUG const debug = createDebugger('vite:import-analysis') diff --git a/packages/vite/src/node/plugins/importAnalysisBuild.ts b/packages/vite/src/node/plugins/importAnalysisBuild.ts index 5b7d738c2da264..36696986a4aacf 100644 --- a/packages/vite/src/node/plugins/importAnalysisBuild.ts +++ b/packages/vite/src/node/plugins/importAnalysisBuild.ts @@ -1,14 +1,14 @@ import path from 'path' -import type { ResolvedConfig } from '../config' -import type { Plugin } from '../plugin' import MagicString from 'magic-string' import type { ImportSpecifier } from 'es-module-lexer' import { init, parse as parseImports } from 'es-module-lexer' import type { OutputChunk, SourceMap } from 'rollup' -import { isCSSRequest, removedPureCssFilesCache } from './css' -import { bareImportRE, combineSourcemaps } from '../utils' import type { RawSourceMap } from '@ampproject/remapping' +import { bareImportRE, combineSourcemaps } from '../utils' +import type { Plugin } from '../plugin' +import type { ResolvedConfig } from '../config' import { genSourceMapUrl } from '../server/sourcemap' +import { isCSSRequest, removedPureCssFilesCache } from './css' /** * A flag for injected helpers. This flag will be set to `false` if the output diff --git a/packages/vite/src/node/plugins/importMetaGlob.ts b/packages/vite/src/node/plugins/importMetaGlob.ts index 140eb6ca6d1273..3282014d2ffca3 100644 --- a/packages/vite/src/node/plugins/importMetaGlob.ts +++ b/packages/vite/src/node/plugins/importMetaGlob.ts @@ -6,13 +6,13 @@ import { parseExpressionAt } from 'acorn' import MagicString from 'magic-string' import fg from 'fast-glob' import { stringifyQuery } from 'ufo' +import type { GeneralImportGlobOptions } from 'types/importGlob' import type { Plugin } from '../plugin' import type { ViteDevServer } from '../server' import type { ModuleNode } from '../server/moduleGraph' import type { ResolvedConfig } from '../config' -import { isCSSRequest } from './css' -import type { GeneralImportGlobOptions } from 'types/importGlob' import { normalizePath, slash } from '../utils' +import { isCSSRequest } from './css' export interface ParsedImportGlob { match: RegExpMatchArray diff --git a/packages/vite/src/node/plugins/index.ts b/packages/vite/src/node/plugins/index.ts index 3fd283b07b4e47..b4a298bc334d41 100644 --- a/packages/vite/src/node/plugins/index.ts +++ b/packages/vite/src/node/plugins/index.ts @@ -1,6 +1,6 @@ +import aliasPlugin from '@rollup/plugin-alias' import type { ResolvedConfig } from '../config' import type { Plugin } from '../plugin' -import aliasPlugin from '@rollup/plugin-alias' import { jsonPlugin } from './json' import { resolvePlugin } from './resolve' import { optimizedDepsPlugin } from './optimizedDeps' diff --git a/packages/vite/src/node/plugins/optimizedDeps.ts b/packages/vite/src/node/plugins/optimizedDeps.ts index adab1bd9756251..8d4e98b865bf28 100644 --- a/packages/vite/src/node/plugins/optimizedDeps.ts +++ b/packages/vite/src/node/plugins/optimizedDeps.ts @@ -1,6 +1,6 @@ import { promises as fs } from 'fs' -import type { Plugin } from '../plugin' import colors from 'picocolors' +import type { Plugin } from '../plugin' import { DEP_VERSION_RE } from '../constants' import { cleanUrl, createDebugger } from '../utils' import { isOptimizedDepFile, optimizedDepInfoFromFile } from '../optimizer' diff --git a/packages/vite/src/node/plugins/reporter.ts b/packages/vite/src/node/plugins/reporter.ts index 808e8040cba9f7..da6da4b8a349e3 100644 --- a/packages/vite/src/node/plugins/reporter.ts +++ b/packages/vite/src/node/plugins/reporter.ts @@ -1,7 +1,7 @@ import path from 'path' -import colors from 'picocolors' import { gzip } from 'zlib' import { promisify } from 'util' +import colors from 'picocolors' import type { Plugin } from 'rollup' import type { ResolvedConfig } from '../config' import { normalizePath } from '../utils' diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts index 98a2cd8a9f776e..e50cd68ace76b0 100644 --- a/packages/vite/src/node/plugins/resolve.ts +++ b/packages/vite/src/node/plugins/resolve.ts @@ -1,34 +1,36 @@ import fs from 'fs' import path from 'path' -import type { Plugin } from '../plugin' import colors from 'picocolors' +import type { PartialResolvedId } from 'rollup' +import { resolve as _resolveExports } from 'resolve.exports' +import type { Plugin } from '../plugin' import { - FS_PREFIX, - SPECIAL_QUERY_RE, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, + DEP_VERSION_RE, + FS_PREFIX, OPTIMIZABLE_ENTRY_RE, - DEP_VERSION_RE + SPECIAL_QUERY_RE } from '../constants' import { - isBuiltin, bareImportRE, + cleanUrl, createDebugger, + ensureVolumeInPath, + fsPathFromId, + getPotentialTsSrcPaths, injectQuery, + isBuiltin, + isDataUrl, isExternalUrl, + isFileReadable, isObject, + isPossibleTsOutput, + isTsRequest, + nestedResolveFrom, normalizePath, - fsPathFromId, - ensureVolumeInPath, resolveFrom, - isDataUrl, - cleanUrl, - slash, - nestedResolveFrom, - isFileReadable, - isTsRequest, - isPossibleTsOutput, - getPotentialTsSrcPaths + slash } from '../utils' import { createIsOptimizedDepUrl, @@ -37,9 +39,7 @@ import { optimizedDepInfoFromId } from '../optimizer' import type { OptimizedDepInfo } from '../optimizer' -import type { ViteDevServer, SSROptions } from '..' -import type { PartialResolvedId } from 'rollup' -import { resolve as _resolveExports } from 'resolve.exports' +import type { SSROptions, ViteDevServer } from '..' import type { PackageCache, PackageData } from '../packages' import { loadPackageData, resolvePackageData } from '../packages' diff --git a/packages/vite/src/node/plugins/splitVendorChunk.ts b/packages/vite/src/node/plugins/splitVendorChunk.ts index 3f7c16067a5f8e..7aa389da8377e2 100644 --- a/packages/vite/src/node/plugins/splitVendorChunk.ts +++ b/packages/vite/src/node/plugins/splitVendorChunk.ts @@ -1,11 +1,11 @@ -import type { UserConfig } from '../../node' -import type { Plugin } from '../plugin' import type { - OutputOptions, GetManualChunk, GetManualChunkApi, - GetModuleInfo + GetModuleInfo, + OutputOptions } from 'rollup' +import type { UserConfig } from '../../node' +import type { Plugin } from '../plugin' import { isCSSRequest } from './css' // Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7 diff --git a/packages/vite/src/node/plugins/terser.ts b/packages/vite/src/node/plugins/terser.ts index 29f4d5c172ce67..5ec3e86b57f96d 100644 --- a/packages/vite/src/node/plugins/terser.ts +++ b/packages/vite/src/node/plugins/terser.ts @@ -1,6 +1,6 @@ -import type { Plugin } from '../plugin' import { Worker } from 'okie' import type { Terser } from 'types/terser' +import type { Plugin } from '../plugin' import type { ResolvedConfig } from '..' export function terserPlugin(config: ResolvedConfig): Plugin { diff --git a/packages/vite/src/node/plugins/worker.ts b/packages/vite/src/node/plugins/worker.ts index f0850242de9a90..b5b33e27bc860b 100644 --- a/packages/vite/src/node/plugins/worker.ts +++ b/packages/vite/src/node/plugins/worker.ts @@ -1,12 +1,12 @@ +import path from 'path' +import type Rollup from 'rollup' +import type { EmittedFile, TransformPluginContext } from 'rollup' import type { ResolvedConfig } from '../config' import type { Plugin } from '../plugin' -import { fileToUrl, getAssetHash } from './asset' import { cleanUrl, injectQuery, parseRequest } from '../utils' -import type Rollup from 'rollup' import { ENV_PUBLIC_PATH } from '../constants' -import path from 'path' import { onRollupWarning } from '../build' -import type { TransformPluginContext, EmittedFile } from 'rollup' +import { fileToUrl, getAssetHash } from './asset' interface WorkerCache { // save worker bundle emitted files avoid overwrites the same file. diff --git a/packages/vite/src/node/plugins/workerImportMetaUrl.ts b/packages/vite/src/node/plugins/workerImportMetaUrl.ts index bfd8c22dcad372..48d38dd0a1359e 100644 --- a/packages/vite/src/node/plugins/workerImportMetaUrl.ts +++ b/packages/vite/src/node/plugins/workerImportMetaUrl.ts @@ -1,16 +1,16 @@ +import path from 'path' import JSON5 from 'json5' +import MagicString from 'magic-string' +import type { RollupError } from 'rollup' +import { stripLiteral } from 'strip-literal' import type { ResolvedConfig } from '../config' import type { Plugin } from '../plugin' -import { fileToUrl } from './asset' import { cleanUrl, injectQuery } from '../utils' -import path from 'path' -import { workerFileToUrl } from './worker' import { parseRequest } from '../utils' import { ENV_ENTRY, ENV_PUBLIC_PATH } from '../constants' -import MagicString from 'magic-string' import type { ViteDevServer } from '..' -import type { RollupError } from 'rollup' -import { stripLiteral } from 'strip-literal' +import { workerFileToUrl } from './worker' +import { fileToUrl } from './asset' type WorkerType = 'classic' | 'module' | 'ignore' const ignoreFlagRE = /\/\*\s*@vite-ignore\s*\*\// diff --git a/packages/vite/src/node/preview.ts b/packages/vite/src/node/preview.ts index e48f2e6231933f..33825200bc1823 100644 --- a/packages/vite/src/node/preview.ts +++ b/packages/vite/src/node/preview.ts @@ -1,20 +1,20 @@ import path from 'path' +import type { Server } from 'http' +import type * as http from 'http' import sirv from 'sirv' import connect from 'connect' -import compression from './server/middlewares/compression' -import type { Server } from 'http' -import type { InlineConfig, ResolvedConfig } from '.' -import { resolveConfig } from '.' import type { Connect } from 'types/connect' +import corsMiddleware from 'cors' import type { ResolvedServerOptions } from './server' import type { CommonServerOptions } from './http' -import { resolveHttpsConfig, resolveHttpServer, httpServerStart } from './http' +import { httpServerStart, resolveHttpServer, resolveHttpsConfig } from './http' import { openBrowser } from './server/openBrowser' -import corsMiddleware from 'cors' +import compression from './server/middlewares/compression' import { proxyMiddleware } from './server/middlewares/proxy' import { resolveHostname } from './utils' import { printCommonServerUrls } from './logger' -import type * as http from 'http' +import { resolveConfig } from '.' +import type { InlineConfig, ResolvedConfig } from '.' export interface PreviewOptions extends CommonServerOptions {} diff --git a/packages/vite/src/node/server/__tests__/pluginContainer.spec.ts b/packages/vite/src/node/server/__tests__/pluginContainer.spec.ts index ab0555ae7982e9..c6f81e9107ef0b 100644 --- a/packages/vite/src/node/server/__tests__/pluginContainer.spec.ts +++ b/packages/vite/src/node/server/__tests__/pluginContainer.spec.ts @@ -1,10 +1,10 @@ +import { beforeEach, describe, expect, it } from 'vitest' import type { UserConfig } from '../../config' import { resolveConfig } from '../../config' import type { Plugin } from '../../plugin' import { ModuleGraph } from '../moduleGraph' import type { PluginContainer } from '../pluginContainer' import { createPluginContainer } from '../pluginContainer' -import { describe, it, expect, beforeEach } from 'vitest' let resolveId: (id: string) => any let moduleGraph: ModuleGraph diff --git a/packages/vite/src/node/server/__tests__/search-root.spec.ts b/packages/vite/src/node/server/__tests__/search-root.spec.ts index ff9366e8791534..066b64917a8b92 100644 --- a/packages/vite/src/node/server/__tests__/search-root.spec.ts +++ b/packages/vite/src/node/server/__tests__/search-root.spec.ts @@ -1,6 +1,6 @@ -import { searchForWorkspaceRoot } from '../searchRoot' import { resolve } from 'path' -import { describe, test, expect } from 'vitest' +import { describe, expect, test } from 'vitest' +import { searchForWorkspaceRoot } from '../searchRoot' describe('searchForWorkspaceRoot', () => { test('lerna', () => { diff --git a/packages/vite/src/node/server/hmr.ts b/packages/vite/src/node/server/hmr.ts index da2ba9f99bd753..23ed627a79f3e6 100644 --- a/packages/vite/src/node/server/hmr.ts +++ b/packages/vite/src/node/server/hmr.ts @@ -1,15 +1,15 @@ import fs from 'fs' import path from 'path' +import type { Server } from 'http' import colors from 'picocolors' -import type { ViteDevServer } from '..' -import { createDebugger, normalizePath, unique } from '../utils' -import type { ModuleNode } from './moduleGraph' import type { Update } from 'types/hmrPayload' -import { CLIENT_DIR } from '../constants' import type { RollupError } from 'rollup' -import type { Server } from 'http' +import { CLIENT_DIR } from '../constants' +import { createDebugger, normalizePath, unique } from '../utils' +import type { ViteDevServer } from '..' import { isCSSRequest } from '../plugins/css' import { getAffectedGlobModules } from '../plugins/importMetaGlob' +import type { ModuleNode } from './moduleGraph' export const debugHmr = createDebugger('vite:hmr') diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index 021fd8c25901b5..aaf0533337c700 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -2,18 +2,37 @@ import fs from 'fs' import path from 'path' import type * as net from 'net' import type * as http from 'http' +import type { AddressInfo } from 'net' +import { performance } from 'perf_hooks' import connect from 'connect' import corsMiddleware from 'cors' import colors from 'picocolors' -import type { AddressInfo } from 'net' import chokidar from 'chokidar' +import type { FSWatcher, WatchOptions } from 'types/chokidar' +import type { Connect } from 'types/connect' +import launchEditorMiddleware from 'launch-editor-middleware' +import type { SourceMap } from 'rollup' import type { CommonServerOptions } from '../http' -import { resolveHttpsConfig, resolveHttpServer, httpServerStart } from '../http' +import { httpServerStart, resolveHttpServer, resolveHttpsConfig } from '../http' import type { InlineConfig, ResolvedConfig } from '../config' import { mergeConfig, resolveConfig } from '../config' +import { isParentDirectory, normalizePath } from '../utils' +import { ssrLoadModule } from '../ssr/ssrModuleLoader' +import { resolveSSRExternal } from '../ssr/ssrExternal' +import { + rebindErrorStacktrace, + ssrRewriteStacktrace +} from '../ssr/ssrStacktrace' +import { ssrTransform } from '../ssr/ssrTransform' +import { createOptimizedDeps } from '../optimizer/registerMissing' +import type { OptimizedDeps } from '../optimizer' +import { resolveHostname } from '../utils' +import { CLIENT_DIR } from '../constants' +import type { Logger } from '../logger' +import { printCommonServerUrls } from '../logger' +import { invalidatePackageData } from '../packages' import type { PluginContainer } from './pluginContainer' import { createPluginContainer } from './pluginContainer' -import type { FSWatcher, WatchOptions } from 'types/chokidar' import type { WebSocketServer } from './ws' import { createWebSocketServer } from './ws' import { baseMiddleware } from './middlewares/base' @@ -25,38 +44,19 @@ import { indexHtmlMiddleware } from './middlewares/indexHtml' import { - serveRawFsMiddleware, servePublicMiddleware, + serveRawFsMiddleware, serveStaticMiddleware } from './middlewares/static' import { timeMiddleware } from './middlewares/time' import { ModuleGraph } from './moduleGraph' -import type { Connect } from 'types/connect' -import { isParentDirectory, normalizePath } from '../utils' import { errorMiddleware, prepareError } from './middlewares/error' import type { HmrOptions } from './hmr' -import { handleHMRUpdate, handleFileAddUnlink } from './hmr' +import { handleFileAddUnlink, handleHMRUpdate } from './hmr' import { openBrowser } from './openBrowser' -import launchEditorMiddleware from 'launch-editor-middleware' import type { TransformOptions, TransformResult } from './transformRequest' import { transformRequest } from './transformRequest' -import { ssrLoadModule } from '../ssr/ssrModuleLoader' -import { resolveSSRExternal } from '../ssr/ssrExternal' -import { - rebindErrorStacktrace, - ssrRewriteStacktrace -} from '../ssr/ssrStacktrace' -import { ssrTransform } from '../ssr/ssrTransform' -import { createOptimizedDeps } from '../optimizer/registerMissing' -import type { OptimizedDeps } from '../optimizer' -import { resolveHostname } from '../utils' import { searchForWorkspaceRoot } from './searchRoot' -import { CLIENT_DIR } from '../constants' -import type { Logger } from '../logger' -import { printCommonServerUrls } from '../logger' -import { performance } from 'perf_hooks' -import { invalidatePackageData } from '../packages' -import type { SourceMap } from 'rollup' export { searchForWorkspaceRoot } from './searchRoot' diff --git a/packages/vite/src/node/server/middlewares/base.ts b/packages/vite/src/node/server/middlewares/base.ts index b72f0fd7949f0b..7aa93f3faeae1e 100644 --- a/packages/vite/src/node/server/middlewares/base.ts +++ b/packages/vite/src/node/server/middlewares/base.ts @@ -1,6 +1,6 @@ import { parse as parseUrl } from 'url' -import type { ViteDevServer } from '..' import type { Connect } from 'types/connect' +import type { ViteDevServer } from '..' // this middleware is only active when (config.base !== '/') diff --git a/packages/vite/src/node/server/middlewares/error.ts b/packages/vite/src/node/server/middlewares/error.ts index 62f86313690f0e..c43901a5b0a265 100644 --- a/packages/vite/src/node/server/middlewares/error.ts +++ b/packages/vite/src/node/server/middlewares/error.ts @@ -1,10 +1,10 @@ import colors from 'picocolors' import type { RollupError } from 'rollup' -import type { ViteDevServer } from '../..' import type { Connect } from 'types/connect' -import { pad } from '../../utils' import strip from 'strip-ansi' import type { ErrorPayload } from 'types/hmrPayload' +import { pad } from '../../utils' +import type { ViteDevServer } from '../..' export function prepareError(err: Error | RollupError): ErrorPayload['err'] { // only copy the information we need and avoid serializing unnecessary diff --git a/packages/vite/src/node/server/middlewares/indexHtml.ts b/packages/vite/src/node/server/middlewares/indexHtml.ts index 7b43ac0c67d428..80afe7f79a3535 100644 --- a/packages/vite/src/node/server/middlewares/indexHtml.ts +++ b/packages/vite/src/node/server/middlewares/indexHtml.ts @@ -19,15 +19,15 @@ import { send } from '../send' import { CLIENT_PUBLIC_PATH, FS_PREFIX, - VALID_ID_PREFIX, - NULL_BYTE_PLACEHOLDER + NULL_BYTE_PLACEHOLDER, + VALID_ID_PREFIX } from '../../constants' import { cleanUrl, + ensureWatchedFile, fsPathFromId, - normalizePath, injectQuery, - ensureWatchedFile + normalizePath } from '../../utils' import type { ModuleGraph } from '../moduleGraph' diff --git a/packages/vite/src/node/server/middlewares/proxy.ts b/packages/vite/src/node/server/middlewares/proxy.ts index 97de98a8331a7a..5c447435911ecd 100644 --- a/packages/vite/src/node/server/middlewares/proxy.ts +++ b/packages/vite/src/node/server/middlewares/proxy.ts @@ -1,10 +1,10 @@ import type * as http from 'http' -import { createDebugger, isObject } from '../../utils' import httpProxy from 'http-proxy' -import { HMR_HEADER } from '../ws' import type { Connect } from 'types/connect' import type { HttpProxy } from 'types/http-proxy' import colors from 'picocolors' +import { HMR_HEADER } from '../ws' +import { createDebugger, isObject } from '../../utils' import type { CommonServerOptions, ResolvedConfig } from '../..' const debug = createDebugger('vite:proxy') diff --git a/packages/vite/src/node/server/middlewares/spaFallback.ts b/packages/vite/src/node/server/middlewares/spaFallback.ts index 1aade764d6993a..450d188651b6e8 100644 --- a/packages/vite/src/node/server/middlewares/spaFallback.ts +++ b/packages/vite/src/node/server/middlewares/spaFallback.ts @@ -1,6 +1,6 @@ import fs from 'fs' -import history from 'connect-history-api-fallback' import path from 'path' +import history from 'connect-history-api-fallback' import type { Connect } from 'types/connect' import { createDebugger } from '../../utils' diff --git a/packages/vite/src/node/server/middlewares/static.ts b/packages/vite/src/node/server/middlewares/static.ts index 5fb4f7fad2e055..f2508032ddb565 100644 --- a/packages/vite/src/node/server/middlewares/static.ts +++ b/packages/vite/src/node/server/middlewares/static.ts @@ -3,20 +3,20 @@ import type { ServerResponse } from 'http' import type { Options } from 'sirv' import sirv from 'sirv' import type { Connect } from 'types/connect' +import { isMatch } from 'micromatch' import type { ViteDevServer } from '../..' import { FS_PREFIX } from '../../constants' import { cleanUrl, fsPathFromId, fsPathFromUrl, + isFileReadable, isImportRequest, isInternalRequest, + isParentDirectory, isWindows, - slash, - isFileReadable, - isParentDirectory + slash } from '../../utils' -import { isMatch } from 'micromatch' const sirvOptions: Options = { dev: true, diff --git a/packages/vite/src/node/server/middlewares/transform.ts b/packages/vite/src/node/server/middlewares/transform.ts index f5ae0e97b065bd..89022bf93bb4b2 100644 --- a/packages/vite/src/node/server/middlewares/transform.ts +++ b/packages/vite/src/node/server/middlewares/transform.ts @@ -1,10 +1,13 @@ import { promises as fs } from 'fs' import path from 'path' -import type { ViteDevServer } from '..' import type { Connect } from 'types/connect' +import colors from 'picocolors' +import type { ViteDevServer } from '..' import { cleanUrl, createDebugger, + ensureVolumeInPath, + fsPathFromId, injectQuery, isImportRequest, isJSRequest, @@ -12,18 +15,15 @@ import { prettifyUrl, removeImportQuery, removeTimestampQuery, - unwrapId, - fsPathFromId, - ensureVolumeInPath + unwrapId } from '../../utils' import { send } from '../send' import { transformRequest } from '../transformRequest' import { isHTMLProxy } from '../../plugins/html' -import colors from 'picocolors' import { DEP_VERSION_RE, - NULL_BYTE_PLACEHOLDER, - FS_PREFIX + FS_PREFIX, + NULL_BYTE_PLACEHOLDER } from '../../constants' import { isCSSRequest, diff --git a/packages/vite/src/node/server/moduleGraph.ts b/packages/vite/src/node/server/moduleGraph.ts index 1d7ae407f110c5..5730f4be324744 100644 --- a/packages/vite/src/node/server/moduleGraph.ts +++ b/packages/vite/src/node/server/moduleGraph.ts @@ -1,6 +1,6 @@ import { extname } from 'path' -import type { ModuleInfo, PartialResolvedId } from 'rollup' import { parse as parseUrl } from 'url' +import type { ModuleInfo, PartialResolvedId } from 'rollup' import { isDirectCSSRequest } from '../plugins/css' import { isHTMLRequest } from '../plugins/html' import { @@ -10,8 +10,8 @@ import { removeTimestampQuery } from '../utils' import { FS_PREFIX } from '../constants' -import type { TransformResult } from './transformRequest' import { canSkipImportAnalysis } from '../plugins/importAnalysis' +import type { TransformResult } from './transformRequest' export class ModuleNode { /** diff --git a/packages/vite/src/node/server/openBrowser.ts b/packages/vite/src/node/server/openBrowser.ts index 5eeb7554e606bb..bacb4006ea08ea 100644 --- a/packages/vite/src/node/server/openBrowser.ts +++ b/packages/vite/src/node/server/openBrowser.ts @@ -9,10 +9,10 @@ */ import path from 'path' +import { execSync } from 'child_process' import open from 'open' import spawn from 'cross-spawn' import colors from 'picocolors' -import { execSync } from 'child_process' import type { Logger } from '../logger' // https://github.com/sindresorhus/open#app diff --git a/packages/vite/src/node/server/pluginContainer.ts b/packages/vite/src/node/server/pluginContainer.ts index 5efc2670c0f81a..4016f6a0b71741 100644 --- a/packages/vite/src/node/server/pluginContainer.ts +++ b/packages/vite/src/node/server/pluginContainer.ts @@ -30,48 +30,48 @@ SOFTWARE. */ import fs from 'fs' -import { resolve, join } from 'path' -import type { Plugin } from '../plugin' +import { join, resolve } from 'path' +import { performance } from 'perf_hooks' import type { + EmittedFile, InputOptions, + LoadResult, MinimalPluginContext, - OutputOptions, ModuleInfo, NormalizedInputOptions, + OutputOptions, PartialResolvedId, ResolvedId, + RollupError, PluginContext as RollupPluginContext, - LoadResult, SourceDescription, - EmittedFile, SourceMap, - RollupError, TransformResult } from 'rollup' import * as acorn from 'acorn' import type { RawSourceMap } from '@ampproject/remapping' import { TraceMap, originalPositionFor } from '@jridgewell/trace-mapping' -import { cleanUrl, combineSourcemaps } from '../utils' import MagicString from 'magic-string' import type { FSWatcher } from 'chokidar' +import colors from 'picocolors' +import type * as postcss from 'postcss' +import type { Plugin } from '../plugin' +import { cleanUrl, combineSourcemaps } from '../utils' import { createDebugger, ensureWatchedFile, generateCodeFrame, - isObject, isExternalUrl, + isObject, normalizePath, numberToPos, prettifyUrl, timeFrom } from '../utils' import { FS_PREFIX } from '../constants' -import colors from 'picocolors' import type { ResolvedConfig } from '../config' import { buildErrorMessage } from './middlewares/error' import type { ModuleGraph } from './moduleGraph' -import { performance } from 'perf_hooks' -import type * as postcss from 'postcss' export interface PluginContainerOptions { cwd?: string diff --git a/packages/vite/src/node/server/sourcemap.ts b/packages/vite/src/node/server/sourcemap.ts index 88cbafc344c739..97ee26668d741c 100644 --- a/packages/vite/src/node/server/sourcemap.ts +++ b/packages/vite/src/node/server/sourcemap.ts @@ -1,8 +1,8 @@ import path from 'path' import { promises as fs } from 'fs' +import type { SourceMap } from 'rollup' import type { Logger } from '../logger' import { createDebugger } from '../utils' -import type { SourceMap } from 'rollup' const isDebug = !!process.env.DEBUG const debug = createDebugger('vite:sourcemap', { diff --git a/packages/vite/src/node/server/transformRequest.ts b/packages/vite/src/node/server/transformRequest.ts index f877925f491479..5402bb21093d59 100644 --- a/packages/vite/src/node/server/transformRequest.ts +++ b/packages/vite/src/node/server/transformRequest.ts @@ -1,24 +1,24 @@ import { promises as fs } from 'fs' import path from 'path' +import { performance } from 'perf_hooks' import getEtag from 'etag' import * as convertSourceMap from 'convert-source-map' import type { SourceDescription, SourceMap } from 'rollup' -import type { ViteDevServer } from '..' import colors from 'picocolors' +import type { ViteDevServer } from '..' import { - createDebugger, cleanUrl, + createDebugger, + ensureWatchedFile, + isObject, prettifyUrl, removeTimestampQuery, - timeFrom, - ensureWatchedFile, - isObject + timeFrom } from '../utils' import { checkPublicFile } from '../plugins/asset' import { ssrTransform } from '../ssr/ssrTransform' import { injectSourcesContent } from './sourcemap' import { isFileServingAllowed } from './middlewares/static' -import { performance } from 'perf_hooks' const debugLoad = createDebugger('vite:load') const debugTransform = createDebugger('vite:transform') diff --git a/packages/vite/src/node/server/ws.ts b/packages/vite/src/node/server/ws.ts index 17187ca6e282ac..af6b20b0434241 100644 --- a/packages/vite/src/node/server/ws.ts +++ b/packages/vite/src/node/server/ws.ts @@ -1,8 +1,9 @@ -import colors from 'picocolors' import type { Server } from 'http' import { STATUS_CODES } from 'http' import type { ServerOptions as HttpsServerOptions } from 'https' import { createServer as createHttpsServer } from 'https' +import type { Socket } from 'net' +import colors from 'picocolors' import type { ServerOptions, WebSocket as WebSocketRaw } from 'ws' import { WebSocketServer as WebSocketServerRaw } from 'ws' import type { WebSocket as WebSocketTypes } from 'types/ws' @@ -10,7 +11,6 @@ import type { CustomPayload, ErrorPayload, HMRPayload } from 'types/hmrPayload' import type { InferCustomEventPayload } from 'types/customEvent' import type { ResolvedConfig } from '..' import { isObject } from '../utils' -import type { Socket } from 'net' export const HMR_HEADER = 'vite-hmr' diff --git a/packages/vite/src/node/ssr/__tests__/ssrExternal.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrExternal.spec.ts index 5fb51093405250..579ba997da5272 100644 --- a/packages/vite/src/node/ssr/__tests__/ssrExternal.spec.ts +++ b/packages/vite/src/node/ssr/__tests__/ssrExternal.spec.ts @@ -1,5 +1,5 @@ +import { expect, test } from 'vitest' import { stripNesting } from '../ssrExternal' -import { test, expect } from 'vitest' test('stripNesting', async () => { expect(stripNesting(['c', 'p1>c1', 'p2 > c2'])).toEqual(['c', 'c1', 'c2']) diff --git a/packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts index 93a04734840d31..4b494524d45c72 100644 --- a/packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts +++ b/packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts @@ -1,6 +1,6 @@ import { resolve } from 'path' +import { expect, test, vi } from 'vitest' import { createServer } from '../../index' -import { test, vi, expect } from 'vitest' const badjs = resolve(__dirname, './fixtures/ssrModuleLoader-bad.js') const THROW_MESSAGE = 'it is an expected error' diff --git a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts index 9c1fdea5939793..f759a51e60ff58 100644 --- a/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts +++ b/packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts @@ -1,7 +1,7 @@ +import { expect, test } from 'vitest' import { transformWithEsbuild } from '../../plugins/esbuild' import { traverseHtml } from '../../plugins/html' import { ssrTransform } from '../ssrTransform' -import { test, expect } from 'vitest' test('default import', async () => { expect( diff --git a/packages/vite/src/node/ssr/ssrExternal.ts b/packages/vite/src/node/ssr/ssrExternal.ts index 800a2307dabae6..24a12cb7386ff3 100644 --- a/packages/vite/src/node/ssr/ssrExternal.ts +++ b/packages/vite/src/node/ssr/ssrExternal.ts @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' +import { createFilter } from '@rollup/pluginutils' import type { InternalResolveOptions } from '../plugins/resolve' import { tryNodeResolve } from '../plugins/resolve' import { @@ -10,7 +11,6 @@ import { resolveFrom } from '../utils' import type { Logger, ResolvedConfig } from '..' -import { createFilter } from '@rollup/pluginutils' const debug = createDebugger('vite:ssr-external') diff --git a/packages/vite/src/node/ssr/ssrManifestPlugin.ts b/packages/vite/src/node/ssr/ssrManifestPlugin.ts index 69184150bb97b7..993fae1632ed5d 100644 --- a/packages/vite/src/node/ssr/ssrManifestPlugin.ts +++ b/packages/vite/src/node/ssr/ssrManifestPlugin.ts @@ -1,4 +1,4 @@ -import { relative, basename, join, dirname } from 'path' +import { basename, dirname, join, relative } from 'path' import { parse as parseImports } from 'es-module-lexer' import type { ImportSpecifier } from 'es-module-lexer' import type { OutputChunk } from 'rollup' diff --git a/packages/vite/src/node/ssr/ssrModuleLoader.ts b/packages/vite/src/node/ssr/ssrModuleLoader.ts index ba9589d8bbbf1f..c552d5431881eb 100644 --- a/packages/vite/src/node/ssr/ssrModuleLoader.ts +++ b/packages/vite/src/node/ssr/ssrModuleLoader.ts @@ -8,19 +8,19 @@ import { unwrapId, usingDynamicImport } from '../utils' -import { rebindErrorStacktrace, ssrRewriteStacktrace } from './ssrStacktrace' -import { - ssrExportAllKey, - ssrModuleExportsKey, - ssrImportKey, - ssrImportMetaKey, - ssrDynamicImportKey -} from './ssrTransform' import { transformRequest } from '../server/transformRequest' import type { InternalResolveOptions } from '../plugins/resolve' import { tryNodeResolve } from '../plugins/resolve' import { hookNodeResolve } from '../plugins/ssrRequireHook' import { NULL_BYTE_PLACEHOLDER } from '../constants' +import { + ssrDynamicImportKey, + ssrExportAllKey, + ssrImportKey, + ssrImportMetaKey, + ssrModuleExportsKey +} from './ssrTransform' +import { rebindErrorStacktrace, ssrRewriteStacktrace } from './ssrStacktrace' interface SSRContext { global: typeof globalThis diff --git a/packages/vite/src/node/ssr/ssrTransform.ts b/packages/vite/src/node/ssr/ssrTransform.ts index 4eeb34ad7e102c..d7dc610cb82f47 100644 --- a/packages/vite/src/node/ssr/ssrTransform.ts +++ b/packages/vite/src/node/ssr/ssrTransform.ts @@ -1,19 +1,19 @@ import MagicString from 'magic-string' import type { SourceMap } from 'rollup' -import type { TransformResult } from '../server/transformRequest' -import { parser } from '../server/pluginContainer' import type { + Function as FunctionNode, Identifier, - Node as _Node, + Pattern, Property, - Function as FunctionNode, - Pattern + Node as _Node } from 'estree' import { extract_names as extractNames } from 'periscopic' import { walk as eswalk } from 'estree-walker' +import type { RawSourceMap } from '@ampproject/remapping' +import type { TransformResult } from '../server/transformRequest' +import { parser } from '../server/pluginContainer' import { combineSourcemaps } from '../utils' import { isJSONRequest } from '../plugins/json' -import type { RawSourceMap } from '@ampproject/remapping' type Node = _Node & { start: number diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 41b1073bb5b991..1e9e23c483d1ef 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -1,25 +1,25 @@ -import debug from 'debug' -import colors from 'picocolors' import fs from 'fs' import os from 'os' import path from 'path' import { promisify } from 'util' -import { pathToFileURL, URL } from 'url' -import { - FS_PREFIX, - DEFAULT_EXTENSIONS, - VALID_ID_PREFIX, - CLIENT_PUBLIC_PATH, - ENV_PUBLIC_PATH, - CLIENT_ENTRY -} from './constants' -import resolve from 'resolve' +import { URL, pathToFileURL } from 'url' import { builtinModules } from 'module' +import { performance } from 'perf_hooks' +import { URLSearchParams } from 'url' +import resolve from 'resolve' import type { FSWatcher } from 'chokidar' import remapping from '@ampproject/remapping' import type { DecodedSourceMap, RawSourceMap } from '@ampproject/remapping' -import { performance } from 'perf_hooks' -import { URLSearchParams } from 'url' +import colors from 'picocolors' +import debug from 'debug' +import { + CLIENT_ENTRY, + CLIENT_PUBLIC_PATH, + DEFAULT_EXTENSIONS, + ENV_PUBLIC_PATH, + FS_PREFIX, + VALID_ID_PREFIX +} from './constants' export function slash(p: string): string { return p.replace(/\\/g, '/') diff --git a/packages/vite/types/shims.d.ts b/packages/vite/types/shims.d.ts index 587b3344e6ce39..d90f0bf42c7057 100644 --- a/packages/vite/types/shims.d.ts +++ b/packages/vite/types/shims.d.ts @@ -28,7 +28,7 @@ declare module 'launch-editor-middleware' { } declare module 'postcss-load-config' { - import type { ProcessOptions, Plugin } from 'postcss' + import type { Plugin, ProcessOptions } from 'postcss' function load( inline: any, root: string diff --git a/packages/vite/types/ws.d.ts b/packages/vite/types/ws.d.ts index 29732ebf3e0d8a..a7620ad5470a1d 100644 --- a/packages/vite/types/ws.d.ts +++ b/packages/vite/types/ws.d.ts @@ -20,9 +20,9 @@ import type { Agent, ClientRequest, ClientRequestArgs, + Server as HTTPServer, IncomingMessage, - OutgoingHttpHeaders, - Server as HTTPServer + OutgoingHttpHeaders } from 'http' import type { Server as HTTPSServer } from 'https' import type { Duplex, DuplexOptions } from 'stream' diff --git a/playground/worker/__tests__/es/es-worker.spec.ts b/playground/worker/__tests__/es/es-worker.spec.ts index b836b081357e2e..4096aa4ec995e7 100644 --- a/playground/worker/__tests__/es/es-worker.spec.ts +++ b/playground/worker/__tests__/es/es-worker.spec.ts @@ -1,7 +1,7 @@ import fs from 'fs' import path from 'path' -import { untilUpdated, isBuild, testDir } from '../../../testUtils' import type { Page } from 'playwright-chromium' +import { isBuild, testDir, untilUpdated } from '../../../testUtils' test('normal', async () => { await page.click('.ping') diff --git a/playground/worker/__tests__/iife/worker.spec.ts b/playground/worker/__tests__/iife/worker.spec.ts index cfa7dfe2e4537b..37cc8675dc357b 100644 --- a/playground/worker/__tests__/iife/worker.spec.ts +++ b/playground/worker/__tests__/iife/worker.spec.ts @@ -1,8 +1,8 @@ import fs from 'fs' import path from 'path' -import { untilUpdated, isBuild, testDir } from '../../../testUtils' import type { Page } from 'playwright-chromium' import { test } from 'vitest' +import { isBuild, testDir, untilUpdated } from '../../../testUtils' test('normal', async () => { await page.click('.ping') diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 18dbe1e00545ac..2777cf17d91d04 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,7 @@ importers: esbuild: ^0.14.38 eslint: ^8.15.0 eslint-define-config: ^1.4.0 + eslint-plugin-import: ^2.26.0 eslint-plugin-node: ^11.1.0 execa: ^5.1.1 fs-extra: ^10.1.0 @@ -59,6 +60,7 @@ importers: esbuild: 0.14.38 eslint: 8.15.0 eslint-define-config: 1.4.0 + eslint-plugin-import: 2.26.0_eslint@8.15.0 eslint-plugin-node: 11.1.0_eslint@8.15.0 execa: 5.1.1 fs-extra: 10.1.0 @@ -2004,6 +2006,10 @@ packages: resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} dev: true + /@types/json5/0.0.29: + resolution: {integrity: sha1-7ihweulOEdK4J7y+UnC86n8+ce4=} + dev: true + /@types/less/3.0.3: resolution: {integrity: sha512-1YXyYH83h6We1djyoUEqTlVyQtCfJAFXELSKW2ZRtjHD4hQ82CC4lvrv5D0l0FLcKBaiPbXyi3MpMsI9ZRgKsw==} dev: true @@ -2510,11 +2516,32 @@ packages: resolution: {integrity: sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=} dev: true + /array-includes/3.1.5: + resolution: {integrity: sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + define-properties: 1.1.4 + es-abstract: 1.20.0 + get-intrinsic: 1.1.1 + is-string: 1.0.7 + dev: true + /array-union/2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} dev: true + /array.prototype.flat/1.3.0: + resolution: {integrity: sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + define-properties: 1.1.4 + es-abstract: 1.20.0 + es-shim-unscopables: 1.0.0 + dev: true + /arrify/1.0.1: resolution: {integrity: sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=} engines: {node: '>=0.10.0'} @@ -3329,7 +3356,6 @@ packages: dependencies: ms: 2.1.3 dev: true - optional: true /debug/4.3.3: resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} @@ -3483,6 +3509,13 @@ packages: resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} dev: false + /doctrine/2.1.0: + resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} + engines: {node: '>=0.10.0'} + dependencies: + esutils: 2.0.3 + dev: true + /doctrine/3.0.0: resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} engines: {node: '>=6.0.0'} @@ -3597,6 +3630,12 @@ packages: resolution: {integrity: sha512-+7IwY/kiGAacQfY+YBhKMvEmyAJnw5grTUgjG85Pe7vcUI/6b7pZjZG8nQ7+48YhzEAEqrEgD2dCz/JIK+AYvw==} dev: true + /es-shim-unscopables/1.0.0: + resolution: {integrity: sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==} + dependencies: + has: 1.0.3 + dev: true + /es-to-primitive/1.2.1: resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} engines: {node: '>= 0.4'} @@ -3842,6 +3881,21 @@ packages: engines: {node: '>= 14.6.0', npm: '>= 6.0.0', pnpm: '>= 6.32.9'} dev: true + /eslint-import-resolver-node/0.3.6: + resolution: {integrity: sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==} + dependencies: + debug: 3.2.7 + resolve: 1.22.0 + dev: true + + /eslint-module-utils/2.7.3: + resolution: {integrity: sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==} + engines: {node: '>=4'} + dependencies: + debug: 3.2.7 + find-up: 2.1.0 + dev: true + /eslint-plugin-es/3.0.1_eslint@8.15.0: resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==} engines: {node: '>=8.10.0'} @@ -3853,6 +3907,28 @@ packages: regexpp: 3.2.0 dev: true + /eslint-plugin-import/2.26.0_eslint@8.15.0: + resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==} + engines: {node: '>=4'} + peerDependencies: + eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 + dependencies: + array-includes: 3.1.5 + array.prototype.flat: 1.3.0 + debug: 2.6.9 + doctrine: 2.1.0 + eslint: 8.15.0 + eslint-import-resolver-node: 0.3.6 + eslint-module-utils: 2.7.3 + has: 1.0.3 + is-core-module: 2.9.0 + is-glob: 4.0.3 + minimatch: 3.1.2 + object.values: 1.1.5 + resolve: 1.22.0 + tsconfig-paths: 3.14.1 + dev: true + /eslint-plugin-node/11.1.0_eslint@8.15.0: resolution: {integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==} engines: {node: '>=8.10.0'} @@ -4964,6 +5040,13 @@ packages: resolution: {integrity: sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=} dev: true + /json5/1.0.1: + resolution: {integrity: sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==} + hasBin: true + dependencies: + minimist: 1.2.6 + dev: true + /json5/2.2.1: resolution: {integrity: sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==} engines: {node: '>=6'} @@ -5672,6 +5755,15 @@ packages: object-keys: 1.1.1 dev: true + /object.values/1.1.5: + resolution: {integrity: sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + define-properties: 1.1.4 + es-abstract: 1.20.0 + dev: true + /okie/1.0.1: resolution: {integrity: sha512-JQh5TdSYhzXSuKN3zzX8Rw9Q/Tec1fm0jwP/k9+cBDk6tyLjlARVu936MLY//2NZp76UGHH+5gXPzRejU1bTjQ==} engines: {node: '>=12.0.0'} @@ -7530,6 +7622,15 @@ packages: typescript: 4.6.4 dev: true + /tsconfig-paths/3.14.1: + resolution: {integrity: sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==} + dependencies: + '@types/json5': 0.0.29 + json5: 1.0.1 + minimist: 1.2.6 + strip-bom: 3.0.0 + dev: true + /tslib/1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: true From d2874827f7ed6b1d4ccd49dfefdeec9cefc837ba Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 11 May 2022 17:03:19 +0800 Subject: [PATCH 0699/1287] test: improve dx for tests (#8112) --- .eslintrc.cjs | 3 +- .prettierignore | 1 + CONTRIBUTING.md | 6 +- package.json | 2 +- playground/alias/__tests__/alias.spec.ts | 3 +- playground/assets/__tests__/assets.spec.ts | 14 ++- .../__tests__/backend-integration.spec.ts | 5 +- .../cli-module/__tests__/cli-module.spec.ts | 1 + playground/cli-module/__tests__/serve.ts | 9 +- playground/cli/__tests__/cli.spec.ts | 1 + playground/cli/__tests__/serve.ts | 11 +- .../__tests__/css-codesplit.spec.ts | 2 +- .../__tests__/css-codesplit.spec.ts | 2 +- .../css-sourcemap/__tests__/build.spec.ts | 2 +- .../css-sourcemap/__tests__/serve.spec.ts | 6 +- playground/css/__tests__/css.spec.ts | 7 +- .../postcss-plugins-different-dir.spec.ts | 4 +- playground/css/postcss-caching/css.spec.ts | 2 +- .../data-uri/__tests__/data-uri.spec.ts | 2 +- playground/define/__tests__/define.spec.ts | 5 +- .../__tests__/dynamic-import.spec.ts | 2 +- .../env-nested/__tests__/env-nested.spec.ts | 2 +- playground/env/__tests__/env.spec.ts | 2 +- .../extensions/__tests__/extensions.spec.ts | 2 + .../__tests__/file-delete-restore.spec.ts | 9 +- .../fs-serve/__tests__/fs-serve.spec.ts | 3 +- .../glob-import/__tests__/glob-import.spec.ts | 3 +- playground/hmr/__tests__/hmr.spec.ts | 10 +- playground/hmr/tsconfig.json | 3 +- playground/html/__tests__/html.spec.ts | 10 +- .../js-sourcemap/__tests__/build.spec.ts | 2 +- .../js-sourcemap/__tests__/serve.spec.ts | 6 +- playground/json/__tests__/json.spec.ts | 4 +- playground/legacy/__tests__/legacy.spec.ts | 9 +- .../legacy/__tests__/ssr/legacy-ssr.spec.ts | 2 +- playground/legacy/__tests__/ssr/serve.ts | 2 +- playground/lib/__tests__/lib.spec.ts | 9 +- playground/lib/__tests__/serve.ts | 14 +-- .../__tests__/multiple-entrypoints.spec.ts | 2 +- .../nested-deps/__tests__/nested-deps.spec.ts | 2 + .../__tests__/optimize-deps.spec.ts | 2 +- .../__test__/optimize-missing-deps.spec.ts | 2 +- .../optimize-missing-deps/__test__/serve.ts | 2 +- playground/preload/__tests__/preload.spec.ts | 2 +- .../__tests__/preserve-symlinks.spec.ts | 2 + .../react-emotion/__tests__/react.spec.ts | 2 +- playground/react/__tests__/react.spec.ts | 2 +- .../__tests__/resolve-config.spec.ts | 7 +- playground/resolve/__tests__/resolve.spec.ts | 2 +- playground/ssr-deps/__tests__/serve.ts | 2 +- .../ssr-deps/__tests__/ssr-deps.spec.ts | 1 + playground/ssr-html/__tests__/serve.ts | 2 +- .../ssr-html/__tests__/ssr-html.spec.ts | 3 +- playground/ssr-pug/__tests__/serve.ts | 2 +- playground/ssr-pug/__tests__/ssr-pug.spec.ts | 3 +- playground/ssr-react/__tests__/serve.ts | 2 +- .../ssr-react/__tests__/ssr-react.spec.ts | 4 +- playground/ssr-vue/__tests__/serve.ts | 2 +- playground/ssr-vue/__tests__/ssr-vue.spec.ts | 13 +- playground/ssr-webworker/__tests__/serve.ts | 2 +- .../__tests__/ssr-webworker.spec.ts | 1 + .../__tests__/build.spec.ts | 2 +- .../__tests__/serve.spec.ts | 2 +- playground/tailwind/__test__/tailwind.spec.ts | 9 +- playground/{testUtils.ts => test-utils.ts} | 31 +++-- .../tsconfig-json-load-error.spec.ts | 8 +- .../__tests__/tsconfig-json.spec.ts | 1 + playground/tsconfig.json | 6 +- playground/vue-jsx/__tests__/vue-jsx.spec.ts | 2 +- playground/vue-lib/__tests__/vue-lib.spec.ts | 2 +- playground/vue-lib/src-consumer/index.ts | 2 +- .../vue-sourcemap/__tests__/build.spec.ts | 2 +- .../vue-sourcemap/__tests__/serve.spec.ts | 7 +- playground/vue/__tests__/vue.spec.ts | 5 +- playground/wasm/__tests__/wasm.spec.ts | 2 +- .../worker/__tests__/es/es-worker.spec.ts | 2 +- .../worker/__tests__/iife/worker.spec.ts | 2 +- .../sourcemap-hidden-worker.spec.ts | 2 +- .../sourcemap-inline-worker.spec.ts | 2 +- .../sourcemap/sourcemap-worker.spec.ts | 2 +- scripts/patchEsbuildDist.ts | 2 +- scripts/patchFileDeps.ts | 2 +- scripts/releaseUtils.ts | 4 +- scripts/verifyCommit.ts | 2 +- scripts/vitestGlobalSetup.ts | 2 +- scripts/vitestSetup.ts | 113 +++++++----------- vitest.config.e2e.ts | 6 + 87 files changed, 259 insertions(+), 209 deletions(-) rename playground/{testUtils.ts => test-utils.ts} (93%) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index e75311e00ed7a2..1c80ee1df739c8 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -118,7 +118,8 @@ module.exports = defineConfig({ files: ['playground/**'], rules: { 'node/no-extraneous-import': 'off', - 'node/no-extraneous-require': 'off' + 'node/no-extraneous-require': 'off', + 'node/no-missing-import': 'off' } }, { diff --git a/.prettierignore b/.prettierignore index ad4762a457c436..a2c1f98cf5cc02 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,6 +4,7 @@ packages/vite/temp/ packages/plugin-react/dist/ packages/plugin-vue/dist/ packages/*/CHANGELOG.md +playground-temp/ LICENSE.md .prettierignore pnpm-lock.yaml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 334d3cb8b79e8c..a6b0b84a83b5a3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -95,15 +95,17 @@ Other than tests under `playground/` for integration tests, packages might conta ### Test Env and Helpers -Inside playground tests, a global `page` object is automatically available, which is a Playwright [`Page`](https://playwright.dev/docs/api/class-page) instance that has already navigated to the served page of the current playground. So writing a test is as simple as: +Inside playground tests, you can import the `page` object from `~utils`, which is a Playwright [`Page`](https://playwright.dev/docs/api/class-page) instance that has already navigated to the served page of the current playground. So writing a test is as simple as: ```js +import { page } from '~utils' + test('should work', async () => { expect(await page.textContent('.foo')).toMatch('foo') }) ``` -Some common test helpers, e.g. `testDir`, `isBuild` or `editFile` are available in `playground/testUtils.ts`. +Some common test helpers, e.g. `testDir`, `isBuild` or `editFile` are also available in the utils. Source code is located at `playground/test-utils.ts`. Note: The test build environment uses a [different default set of Vite config](https://github.com/vitejs/vite/blob/9c6501d9c363eaa3c1e7708d531fb2a92b633db6/scripts/vitestSetup.ts#L102-L122) to skip transpilation during tests to make it faster. This may produce a different result compared to the default production build. diff --git a/package.json b/package.json index 9904f281fbc4f1..8fffa3f6e045f6 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "scripts": { "preinstall": "npx only-allow pnpm", "format": "prettier --write .", - "lint": "eslint packages/*/{src,types}/** playground/**/__tests__/**/*.*", + "lint": "eslint packages/*/{src,types}/** playground/**/__tests__/** scripts/**", "test": "run-s test-unit test-serve test-build", "test-serve": "vitest run -c vitest.config.e2e.ts", "test-build": "cross-env VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts", diff --git a/playground/alias/__tests__/alias.spec.ts b/playground/alias/__tests__/alias.spec.ts index 835dd37521bc77..cef34c07c51004 100644 --- a/playground/alias/__tests__/alias.spec.ts +++ b/playground/alias/__tests__/alias.spec.ts @@ -1,4 +1,5 @@ -import { editFile, getColor, untilUpdated } from '../../testUtils' +import { expect, test } from 'vitest' +import { editFile, getColor, page, untilUpdated } from '~utils' test('fs', async () => { expect(await page.textContent('.fs')).toMatch('[success] alias to fs path') diff --git a/playground/assets/__tests__/assets.spec.ts b/playground/assets/__tests__/assets.spec.ts index 96b4b4e1e434cf..f31b52e6ac9ea2 100644 --- a/playground/assets/__tests__/assets.spec.ts +++ b/playground/assets/__tests__/assets.spec.ts @@ -1,15 +1,19 @@ +import { describe, expect, test } from 'vitest' import { + browserLogs, + editFile, findAssetFile, getBg, getColor, isBuild, listAssets, - readManifest, - readFile, - editFile, notifyRebuildComplete, - untilUpdated -} from '../../testUtils' + page, + readFile, + readManifest, + untilUpdated, + watcher +} from '~utils' const assetMatch = isBuild ? /\/foo\/assets\/asset\.\w{8}\.png/ diff --git a/playground/backend-integration/__tests__/backend-integration.spec.ts b/playground/backend-integration/__tests__/backend-integration.spec.ts index 4677700f6e8c12..e8059c7d20f13c 100644 --- a/playground/backend-integration/__tests__/backend-integration.spec.ts +++ b/playground/backend-integration/__tests__/backend-integration.spec.ts @@ -1,11 +1,14 @@ import { + browserErrors, + browserLogs, editFile, getColor, isBuild, isServe, + page, readManifest, untilUpdated -} from '../../testUtils' +} from '~utils' const outerAssetMatch = isBuild ? /\/dev\/assets\/logo\.\w{8}\.png/ diff --git a/playground/cli-module/__tests__/cli-module.spec.ts b/playground/cli-module/__tests__/cli-module.spec.ts index e761343298910b..a443a66c9810dc 100644 --- a/playground/cli-module/__tests__/cli-module.spec.ts +++ b/playground/cli-module/__tests__/cli-module.spec.ts @@ -1,4 +1,5 @@ import { port } from './serve' +import { page } from '~utils' test('cli should work in "type":"module" package', async () => { // this test uses a custom serve implementation, so regular helpers for browserLogs and goto don't work diff --git a/playground/cli-module/__tests__/serve.ts b/playground/cli-module/__tests__/serve.ts index 874c81715021d1..6d5ad2d512089a 100644 --- a/playground/cli-module/__tests__/serve.ts +++ b/playground/cli-module/__tests__/serve.ts @@ -1,14 +1,11 @@ // this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -import path from 'path' import execa from 'execa' -import { workspaceRoot, ports } from '../../testUtils' import kill from 'kill-port' +import { isWindows, ports, viteBinPath } from '~utils' -const isWindows = process.platform === 'win32' export const port = ports['cli-module'] -const viteBin = path.join(workspaceRoot, 'packages', 'vite', 'bin', 'vite.js') export async function serve(root: string, isProd: boolean) { // collect stdout and stderr streams from child processes here to avoid interfering with regular jest output @@ -39,7 +36,7 @@ export async function serve(root: string, isProd: boolean) { // only run `vite build` when needed if (isProd) { - const buildCommand = `${viteBin} build` + const buildCommand = `${viteBinPath} build` try { const buildProcess = execa.command(buildCommand, { cwd: root, @@ -62,7 +59,7 @@ export async function serve(root: string, isProd: boolean) { if (isProd) { viteServerArgs.unshift('preview') } - const serverCommand = `${viteBin} ${viteServerArgs.join(' ')}` + const serverCommand = `${viteBinPath} ${viteServerArgs.join(' ')}` const serverProcess = execa.command(serverCommand, { cwd: root, stdio: 'pipe' diff --git a/playground/cli/__tests__/cli.spec.ts b/playground/cli/__tests__/cli.spec.ts index 3b735faef95ddf..676d076a1aaeed 100644 --- a/playground/cli/__tests__/cli.spec.ts +++ b/playground/cli/__tests__/cli.spec.ts @@ -1,4 +1,5 @@ import { port } from './serve' +import { page } from '~utils' test('cli should work', async () => { // this test uses a custom serve implementation, so regular helpers for browserLogs and goto don't work diff --git a/playground/cli/__tests__/serve.ts b/playground/cli/__tests__/serve.ts index 913a4d5b565c73..8c5717f4031e4a 100644 --- a/playground/cli/__tests__/serve.ts +++ b/playground/cli/__tests__/serve.ts @@ -1,14 +1,11 @@ // this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior -import path from 'path' import execa from 'execa' -import { workspaceRoot, ports } from '../../testUtils' import kill from 'kill-port' +import { isWindows, ports, viteBinPath } from '~utils' -const isWindows = process.platform === 'win32' -const port = (exports.port = ports.cli) -const viteBin = path.join(workspaceRoot, 'packages', 'vite', 'bin', 'vite.js') +export const port = ports.cli export async function serve(root: string, isProd: boolean) { // collect stdout and stderr streams from child processes here to avoid interfering with regular jest output @@ -39,7 +36,7 @@ export async function serve(root: string, isProd: boolean) { // only run `vite build` when needed if (isProd) { - const buildCommand = `${viteBin} build` + const buildCommand = `${viteBinPath} build` try { const buildProcess = execa.command(buildCommand, { cwd: root, @@ -62,7 +59,7 @@ export async function serve(root: string, isProd: boolean) { if (isProd) { viteServerArgs.unshift('preview') } - const serverCommand = `${viteBin} ${viteServerArgs.join(' ')}` + const serverCommand = `${viteBinPath} ${viteServerArgs.join(' ')}` const serverProcess = execa.command(serverCommand, { cwd: root, stdio: 'pipe' diff --git a/playground/css-codesplit-cjs/__tests__/css-codesplit.spec.ts b/playground/css-codesplit-cjs/__tests__/css-codesplit.spec.ts index dae8d5f4b4ca5e..dc51f0a2e473c1 100644 --- a/playground/css-codesplit-cjs/__tests__/css-codesplit.spec.ts +++ b/playground/css-codesplit-cjs/__tests__/css-codesplit.spec.ts @@ -1,4 +1,4 @@ -import { findAssetFile, getColor, isBuild, readManifest } from '../../testUtils' +import { findAssetFile, getColor, isBuild, readManifest } from '~utils' test('should load both stylesheets', async () => { expect(await getColor('h1')).toBe('red') diff --git a/playground/css-codesplit/__tests__/css-codesplit.spec.ts b/playground/css-codesplit/__tests__/css-codesplit.spec.ts index 820222e9a964d2..f00dfed1d92453 100644 --- a/playground/css-codesplit/__tests__/css-codesplit.spec.ts +++ b/playground/css-codesplit/__tests__/css-codesplit.spec.ts @@ -1,4 +1,4 @@ -import { findAssetFile, getColor, isBuild, readManifest } from '../../testUtils' +import { findAssetFile, getColor, isBuild, page, readManifest } from '~utils' test('should load all stylesheets', async () => { expect(await getColor('h1')).toBe('red') diff --git a/playground/css-sourcemap/__tests__/build.spec.ts b/playground/css-sourcemap/__tests__/build.spec.ts index 50b8814aed9c4e..b30284731a76d9 100644 --- a/playground/css-sourcemap/__tests__/build.spec.ts +++ b/playground/css-sourcemap/__tests__/build.spec.ts @@ -1,4 +1,4 @@ -import { isBuild } from '../../testUtils' +import { isBuild, serverLogs } from '~utils' test.runIf(isBuild)('should not output sourcemap warning (#4939)', () => { serverLogs.forEach((log) => { diff --git a/playground/css-sourcemap/__tests__/serve.spec.ts b/playground/css-sourcemap/__tests__/serve.spec.ts index d42f93e84d4007..730866d86ef03b 100644 --- a/playground/css-sourcemap/__tests__/serve.spec.ts +++ b/playground/css-sourcemap/__tests__/serve.spec.ts @@ -2,8 +2,10 @@ import { URL } from 'url' import { extractSourcemap, formatSourcemapForSnapshot, - isServe -} from '../../testUtils' + isServe, + page, + serverLogs +} from '~utils' describe.runIf(isServe)('serve', () => { const getStyleTagContentIncluding = async (content: string) => { diff --git a/playground/css/__tests__/css.spec.ts b/playground/css/__tests__/css.spec.ts index 3443597816f2d1..5341522900ddb1 100644 --- a/playground/css/__tests__/css.spec.ts +++ b/playground/css/__tests__/css.spec.ts @@ -1,15 +1,14 @@ -import fs from 'fs' -import path from 'path' import { editFile, findAssetFile, getBg, getColor, isBuild, + page, removeFile, - testDir, + serverLogs, untilUpdated -} from '../../testUtils' +} from '~utils' // note: tests should retrieve the element at the beginning of test and reuse it // in later assertions to ensure CSS HMR doesn't reload the page diff --git a/playground/css/__tests__/postcss-plugins-different-dir.spec.ts b/playground/css/__tests__/postcss-plugins-different-dir.spec.ts index 8bedc26ee354c8..55a6d8fe8dd130 100644 --- a/playground/css/__tests__/postcss-plugins-different-dir.spec.ts +++ b/playground/css/__tests__/postcss-plugins-different-dir.spec.ts @@ -1,6 +1,6 @@ -import { getColor, getBgColor, ports } from '../../testUtils' -import { createServer } from 'vite' import path from 'path' +import { createServer } from 'vite' +import { getBgColor, getColor, page, ports } from '~utils' // Regression test for https://github.com/vitejs/vite/issues/4000 test('postcss plugins in different dir', async () => { diff --git a/playground/css/postcss-caching/css.spec.ts b/playground/css/postcss-caching/css.spec.ts index e8ba73154b6bc8..bbffdb618280e4 100644 --- a/playground/css/postcss-caching/css.spec.ts +++ b/playground/css/postcss-caching/css.spec.ts @@ -1,4 +1,4 @@ -import { getColor, ports } from '../../testUtils' +import { getColor, page, ports } from '~utils' import { createServer } from 'vite' import path from 'path' diff --git a/playground/data-uri/__tests__/data-uri.spec.ts b/playground/data-uri/__tests__/data-uri.spec.ts index bf9d595c813322..4b7f3d6e1e471b 100644 --- a/playground/data-uri/__tests__/data-uri.spec.ts +++ b/playground/data-uri/__tests__/data-uri.spec.ts @@ -1,4 +1,4 @@ -import { isBuild, findAssetFile } from '../../testUtils' +import { findAssetFile, isBuild, page } from '~utils' test('plain', async () => { expect(await page.textContent('.plain')).toBe('hi') diff --git a/playground/define/__tests__/define.spec.ts b/playground/define/__tests__/define.spec.ts index a7a45dcea1b701..b2eb571734cc54 100644 --- a/playground/define/__tests__/define.spec.ts +++ b/playground/define/__tests__/define.spec.ts @@ -1,5 +1,8 @@ +import viteConfig from '../vite.config' +import { page } from '~utils' + test('string', async () => { - const defines = require('../vite.config.js').define + const defines = viteConfig.define expect(await page.textContent('.exp')).toBe( String(typeof eval(defines.__EXP__)) diff --git a/playground/dynamic-import/__tests__/dynamic-import.spec.ts b/playground/dynamic-import/__tests__/dynamic-import.spec.ts index 95101a039e50f8..5c434bac47527b 100644 --- a/playground/dynamic-import/__tests__/dynamic-import.spec.ts +++ b/playground/dynamic-import/__tests__/dynamic-import.spec.ts @@ -1,4 +1,4 @@ -import { getColor, isBuild, untilUpdated } from '../../testUtils' +import { getColor, page, serverLogs, untilUpdated } from '~utils' test('should load literal dynamic import', async () => { await page.click('.baz') diff --git a/playground/env-nested/__tests__/env-nested.spec.ts b/playground/env-nested/__tests__/env-nested.spec.ts index ed107acb233e02..2ae9ab64023896 100644 --- a/playground/env-nested/__tests__/env-nested.spec.ts +++ b/playground/env-nested/__tests__/env-nested.spec.ts @@ -1,4 +1,4 @@ -import { isBuild } from '../../testUtils' +import { isBuild, page } from '~utils' const mode = isBuild ? `production` : `development` diff --git a/playground/env/__tests__/env.spec.ts b/playground/env/__tests__/env.spec.ts index cbc0aad524001c..373e051a22a66e 100644 --- a/playground/env/__tests__/env.spec.ts +++ b/playground/env/__tests__/env.spec.ts @@ -1,4 +1,4 @@ -import { isBuild } from '../../testUtils' +import { isBuild, page } from '~utils' const mode = isBuild ? `production` : `development` diff --git a/playground/extensions/__tests__/extensions.spec.ts b/playground/extensions/__tests__/extensions.spec.ts index 718cb40e790537..eb497a280e711a 100644 --- a/playground/extensions/__tests__/extensions.spec.ts +++ b/playground/extensions/__tests__/extensions.spec.ts @@ -1,3 +1,5 @@ +import { browserLogs, page } from '~utils' + test('should have no 404s', () => { browserLogs.forEach((msg) => { expect(msg).not.toMatch('404') diff --git a/playground/file-delete-restore/__tests__/file-delete-restore.spec.ts b/playground/file-delete-restore/__tests__/file-delete-restore.spec.ts index 04ce2e71b00cd8..a54f4b8da8e77e 100644 --- a/playground/file-delete-restore/__tests__/file-delete-restore.spec.ts +++ b/playground/file-delete-restore/__tests__/file-delete-restore.spec.ts @@ -1,10 +1,11 @@ import { + addFile, editFile, - untilUpdated, + isBuild, + page, removeFile, - addFile, - isBuild -} from '../../testUtils' + untilUpdated +} from '~utils' test.runIf(isBuild)( 'should hmr when file is deleted and restored', diff --git a/playground/fs-serve/__tests__/fs-serve.spec.ts b/playground/fs-serve/__tests__/fs-serve.spec.ts index 75c3fc6edfee04..6a21a35404ebb7 100644 --- a/playground/fs-serve/__tests__/fs-serve.spec.ts +++ b/playground/fs-serve/__tests__/fs-serve.spec.ts @@ -1,11 +1,10 @@ -import { isServe } from '../../testUtils' +import { isServe, page, viteTestUrl } from '~utils' const json = require('../safe.json') const stringified = JSON.stringify(json) describe.runIf(isServe)('main', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/src/') }) diff --git a/playground/glob-import/__tests__/glob-import.spec.ts b/playground/glob-import/__tests__/glob-import.spec.ts index 8cc5c61d172236..70f7ec252280a9 100644 --- a/playground/glob-import/__tests__/glob-import.spec.ts +++ b/playground/glob-import/__tests__/glob-import.spec.ts @@ -2,9 +2,10 @@ import { addFile, editFile, isBuild, + page, removeFile, untilUpdated -} from '../../testUtils' +} from '~utils' const filteredResult = { './alias.js': { diff --git a/playground/hmr/__tests__/hmr.spec.ts b/playground/hmr/__tests__/hmr.spec.ts index 34612ee1e7d3d5..d06fee31f110ea 100644 --- a/playground/hmr/__tests__/hmr.spec.ts +++ b/playground/hmr/__tests__/hmr.spec.ts @@ -1,4 +1,12 @@ -import { isBuild, editFile, untilUpdated, getBg } from '../../testUtils' +import { + browserLogs, + editFile, + getBg, + isBuild, + page, + untilUpdated, + viteTestUrl +} from '~utils' test('should render', async () => { expect(await page.textContent('.app')).toBe('1') diff --git a/playground/hmr/tsconfig.json b/playground/hmr/tsconfig.json index 9da745ba51a3e9..e920e674091b5e 100644 --- a/playground/hmr/tsconfig.json +++ b/playground/hmr/tsconfig.json @@ -1,6 +1,7 @@ { + "extends": "../tsconfig.json", "include": ["."], - "exclude": ["**/dist/**"], + "exclude": ["**/dist/**", "**/__tests__/**"], "compilerOptions": { "target": "es2019", "module": "esnext", diff --git a/playground/html/__tests__/html.spec.ts b/playground/html/__tests__/html.spec.ts index 3041247bc776d4..3e7c3d0166f75a 100644 --- a/playground/html/__tests__/html.spec.ts +++ b/playground/html/__tests__/html.spec.ts @@ -1,4 +1,5 @@ -import { getColor, isBuild, editFile, isServe } from '../../testUtils' +import { beforeAll, describe, expect, test } from 'vitest' +import { editFile, getColor, isBuild, isServe, page, viteTestUrl } from '~utils' function testPage(isNested: boolean) { test('pre transform', async () => { @@ -79,7 +80,6 @@ describe('main', () => { describe('nested', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/nested/') }) @@ -88,7 +88,6 @@ describe('nested', () => { describe('nested w/ query', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/nested/index.html?v=1') }) @@ -98,7 +97,6 @@ describe('nested w/ query', () => { describe.runIf(isBuild)('build', () => { describe('scriptAsync', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/scriptAsync.html') }) @@ -110,7 +108,6 @@ describe.runIf(isBuild)('build', () => { describe('scriptMixed', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/scriptMixed.html') }) @@ -124,7 +121,6 @@ describe.runIf(isBuild)('build', () => { // Ensure that the modulePreload polyfill is discarded in this case beforeAll(async () => { - // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/zeroJS.html') }) @@ -168,7 +164,6 @@ describe.runIf(isBuild)('build', () => { describe('noHead', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/noHead.html') }) @@ -183,7 +178,6 @@ describe('noHead', () => { describe('noBody', () => { beforeAll(async () => { - // viteTestUrl is globally injected in scripts/vitestSetup.ts await page.goto(viteTestUrl + '/noBody.html') }) diff --git a/playground/js-sourcemap/__tests__/build.spec.ts b/playground/js-sourcemap/__tests__/build.spec.ts index 50b8814aed9c4e..b30284731a76d9 100644 --- a/playground/js-sourcemap/__tests__/build.spec.ts +++ b/playground/js-sourcemap/__tests__/build.spec.ts @@ -1,4 +1,4 @@ -import { isBuild } from '../../testUtils' +import { isBuild, serverLogs } from '~utils' test.runIf(isBuild)('should not output sourcemap warning (#4939)', () => { serverLogs.forEach((log) => { diff --git a/playground/js-sourcemap/__tests__/serve.spec.ts b/playground/js-sourcemap/__tests__/serve.spec.ts index b3946461dde197..8f36f5f6f832f1 100644 --- a/playground/js-sourcemap/__tests__/serve.spec.ts +++ b/playground/js-sourcemap/__tests__/serve.spec.ts @@ -2,8 +2,10 @@ import { URL } from 'url' import { extractSourcemap, formatSourcemapForSnapshot, - isBuild -} from '../../testUtils' + isBuild, + page, + serverLogs +} from '~utils' if (!isBuild) { test('js', async () => { diff --git a/playground/json/__tests__/json.spec.ts b/playground/json/__tests__/json.spec.ts index 2897ee22332e44..8c64d619361bfb 100644 --- a/playground/json/__tests__/json.spec.ts +++ b/playground/json/__tests__/json.spec.ts @@ -1,7 +1,7 @@ -import { isBuild } from '../../testUtils' +import { isBuild, page } from '~utils' -const json = require('../test.json') const deepJson = require('vue/package.json') +const json = require('../test.json') const stringified = JSON.stringify(json) const deepStringified = JSON.stringify(deepJson) diff --git a/playground/legacy/__tests__/legacy.spec.ts b/playground/legacy/__tests__/legacy.spec.ts index c0eaa81fbc31d8..b21f42afcbd7ed 100644 --- a/playground/legacy/__tests__/legacy.spec.ts +++ b/playground/legacy/__tests__/legacy.spec.ts @@ -1,11 +1,12 @@ import { - listAssets, findAssetFile, + getColor, isBuild, + listAssets, + page, readManifest, - untilUpdated, - getColor -} from '../../testUtils' + untilUpdated +} from '~utils' test('should work', async () => { expect(await page.textContent('#app')).toMatch('Hello') diff --git a/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts b/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts index bc232e8af129c6..b5cfe82cd93910 100644 --- a/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts +++ b/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts @@ -1,5 +1,5 @@ -import { isBuild } from '../../../testUtils' import { port } from './serve' +import { isBuild, page } from '~utils' const url = `http://localhost:${port}` diff --git a/playground/legacy/__tests__/ssr/serve.ts b/playground/legacy/__tests__/ssr/serve.ts index 597320c9a58c0f..930f11f3bb8dfb 100644 --- a/playground/legacy/__tests__/ssr/serve.ts +++ b/playground/legacy/__tests__/ssr/serve.ts @@ -1,7 +1,7 @@ // this is automatically detected by scripts/vitestSetup.ts and will replace // the default e2e test serve behavior import path from 'path' -import { ports } from '../../../testUtils' +import { ports } from '~utils' export const port = ports['legacy/ssr'] diff --git a/playground/lib/__tests__/lib.spec.ts b/playground/lib/__tests__/lib.spec.ts index ab3314ffe3a546..de1af1519624d1 100644 --- a/playground/lib/__tests__/lib.spec.ts +++ b/playground/lib/__tests__/lib.spec.ts @@ -1,6 +1,13 @@ -import { isBuild, isServe, testDir, untilUpdated } from '../../testUtils' import path from 'path' import fs from 'fs' +import { + isBuild, + isServe, + page, + serverLogs, + testDir, + untilUpdated +} from '~utils' describe.runIf(isBuild)('build', () => { test('es', async () => { diff --git a/playground/lib/__tests__/serve.ts b/playground/lib/__tests__/serve.ts index 3bde3d35a78dc1..c536ad231bc3a5 100644 --- a/playground/lib/__tests__/serve.ts +++ b/playground/lib/__tests__/serve.ts @@ -4,14 +4,11 @@ import path from 'path' import http from 'http' import sirv from 'sirv' -import { ports } from '../../testUtils' +import { page, ports, serverLogs, setViteUrl, viteTestUrl } from '~utils' export const port = ports.lib export async function serve(root, isBuildTest) { - // @ts-expect-error - global.serverLogs = [] - setupConsoleWarnCollector() if (!isBuildTest) { @@ -38,10 +35,8 @@ export async function serve(root, isBuildTest) { ).listen() // use resolved port/base from server const base = viteServer.config.base === '/' ? '' : viteServer.config.base - const url = - // @ts-expect-error - (global.viteTestUrl = `http://localhost:${viteServer.config.server.port}${base}`) - await page.goto(url) + setViteUrl(`http://localhost:${viteServer.config.server.port}${base}`) + await page.goto(viteTestUrl) return viteServer } else { @@ -92,8 +87,7 @@ export async function serve(root, isBuildTest) { function setupConsoleWarnCollector() { const warn = console.warn console.warn = (...args) => { - // @ts-expect-error - global.serverLogs.push(args.join(' ')) + serverLogs.push(args.join(' ')) return warn.call(console, ...args) } } diff --git a/playground/multiple-entrypoints/__tests__/multiple-entrypoints.spec.ts b/playground/multiple-entrypoints/__tests__/multiple-entrypoints.spec.ts index 56c0b46c8a3e6f..e61c2187556f08 100644 --- a/playground/multiple-entrypoints/__tests__/multiple-entrypoints.spec.ts +++ b/playground/multiple-entrypoints/__tests__/multiple-entrypoints.spec.ts @@ -1,4 +1,4 @@ -import { getColor, untilUpdated } from '../../testUtils' +import { getColor, page, untilUpdated } from '~utils' test('should have css applied on second dynamic import', async () => { await untilUpdated(() => page.textContent('.content'), 'Initial', true) diff --git a/playground/nested-deps/__tests__/nested-deps.spec.ts b/playground/nested-deps/__tests__/nested-deps.spec.ts index 2ef0e191da7b50..e4adb68792d116 100644 --- a/playground/nested-deps/__tests__/nested-deps.spec.ts +++ b/playground/nested-deps/__tests__/nested-deps.spec.ts @@ -1,3 +1,5 @@ +import { page } from '~utils' + test('handle nested package', async () => { expect(await page.textContent('.a')).toBe('A@2.0.0') expect(await page.textContent('.b')).toBe('B@1.0.0') diff --git a/playground/optimize-deps/__tests__/optimize-deps.spec.ts b/playground/optimize-deps/__tests__/optimize-deps.spec.ts index e832408370969a..898d75f6bf9f0d 100644 --- a/playground/optimize-deps/__tests__/optimize-deps.spec.ts +++ b/playground/optimize-deps/__tests__/optimize-deps.spec.ts @@ -1,4 +1,4 @@ -import { getColor, isBuild } from '../../testUtils' +import { getColor, isBuild, page } from '~utils' test('default + named imports from cjs dep (react)', async () => { expect(await page.textContent('.cjs button')).toBe('count is 0') diff --git a/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts b/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts index 9f6934dd25ace8..d6e2403761268a 100644 --- a/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts +++ b/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts @@ -1,6 +1,6 @@ import { port } from './serve' import fetch from 'node-fetch' -import { untilUpdated } from '../../testUtils' +import { page, untilUpdated } from '~utils' import { platform } from 'os' const url = `http://localhost:${port}/` diff --git a/playground/optimize-missing-deps/__test__/serve.ts b/playground/optimize-missing-deps/__test__/serve.ts index 3b60850905e389..81c58b296837e1 100644 --- a/playground/optimize-missing-deps/__test__/serve.ts +++ b/playground/optimize-missing-deps/__test__/serve.ts @@ -2,7 +2,7 @@ // the default e2e test serve behavior import path from 'path' -import { ports } from '../../testUtils' +import { ports } from '~utils' export const port = ports['optimize-missing-deps'] diff --git a/playground/preload/__tests__/preload.spec.ts b/playground/preload/__tests__/preload.spec.ts index b0ffb58a291bac..cb1d3557499946 100644 --- a/playground/preload/__tests__/preload.spec.ts +++ b/playground/preload/__tests__/preload.spec.ts @@ -1,4 +1,4 @@ -import { isBuild } from '../../testUtils' +import { browserLogs, isBuild, page, viteTestUrl } from '~utils' test('should have no 404s', () => { browserLogs.forEach((msg) => { diff --git a/playground/preserve-symlinks/__tests__/preserve-symlinks.spec.ts b/playground/preserve-symlinks/__tests__/preserve-symlinks.spec.ts index 7e0b546d7dbdbb..c33069fbc48cc9 100644 --- a/playground/preserve-symlinks/__tests__/preserve-symlinks.spec.ts +++ b/playground/preserve-symlinks/__tests__/preserve-symlinks.spec.ts @@ -1,3 +1,5 @@ +import { browserLogs, page } from '~utils' + test('should have no 404s', () => { browserLogs.forEach((msg) => { expect(msg).not.toMatch('404') diff --git a/playground/react-emotion/__tests__/react.spec.ts b/playground/react-emotion/__tests__/react.spec.ts index 49a66b9e103374..86b572be1ff403 100644 --- a/playground/react-emotion/__tests__/react.spec.ts +++ b/playground/react-emotion/__tests__/react.spec.ts @@ -1,4 +1,4 @@ -import { editFile, untilUpdated } from '../../testUtils' +import { editFile, page, untilUpdated } from '~utils' test('should render', async () => { expect(await page.textContent('h1')).toMatch( diff --git a/playground/react/__tests__/react.spec.ts b/playground/react/__tests__/react.spec.ts index 4b39a304733318..8381992d59df3d 100644 --- a/playground/react/__tests__/react.spec.ts +++ b/playground/react/__tests__/react.spec.ts @@ -1,4 +1,4 @@ -import { editFile, untilUpdated, isServe } from '../../testUtils' +import { editFile, isServe, page, untilUpdated } from '~utils' test('should render', async () => { expect(await page.textContent('h1')).toMatch('Hello Vite + React') diff --git a/playground/resolve-config/__tests__/resolve-config.spec.ts b/playground/resolve-config/__tests__/resolve-config.spec.ts index bd45ad6c95012d..9b3588cafcc47d 100644 --- a/playground/resolve-config/__tests__/resolve-config.spec.ts +++ b/playground/resolve-config/__tests__/resolve-config.spec.ts @@ -1,15 +1,14 @@ import fs from 'fs' import path from 'path' import { commandSync } from 'execa' -import { isBuild, testDir, workspaceRoot } from '../../testUtils' - -const viteBin = path.join(workspaceRoot, 'packages', 'vite', 'bin', 'vite.js') +import { isBuild, testDir, viteBinPath } from '~utils' const fromTestDir = (...p: string[]) => path.resolve(testDir(), ...p) const build = (configName: string) => { - commandSync(`${viteBin} build`, { cwd: fromTestDir(configName) }) + commandSync(`${viteBinPath} build`, { cwd: fromTestDir(configName) }) } + const getDistFile = (configName: string, extension: string) => { return fs.readFileSync( fromTestDir(`${configName}/dist/index.es.${extension}`), diff --git a/playground/resolve/__tests__/resolve.spec.ts b/playground/resolve/__tests__/resolve.spec.ts index 2deb2fab7f8d40..79ab9dce6409c3 100644 --- a/playground/resolve/__tests__/resolve.spec.ts +++ b/playground/resolve/__tests__/resolve.spec.ts @@ -1,4 +1,4 @@ -import { isBuild } from '../../testUtils' +import { isBuild, page } from '~utils' test('bom import', async () => { expect(await page.textContent('.utf8-bom')).toMatch('[success]') diff --git a/playground/ssr-deps/__tests__/serve.ts b/playground/ssr-deps/__tests__/serve.ts index 92c73fc50a8629..1d5ef5f3039c4e 100644 --- a/playground/ssr-deps/__tests__/serve.ts +++ b/playground/ssr-deps/__tests__/serve.ts @@ -2,7 +2,7 @@ // the default e2e test serve behavior import path from 'path' -import { ports } from '../../testUtils' +import { ports } from '~utils' export const port = ports['ssr-deps'] diff --git a/playground/ssr-deps/__tests__/ssr-deps.spec.ts b/playground/ssr-deps/__tests__/ssr-deps.spec.ts index 8a201c9eb87455..75903a1c39c943 100644 --- a/playground/ssr-deps/__tests__/ssr-deps.spec.ts +++ b/playground/ssr-deps/__tests__/ssr-deps.spec.ts @@ -1,4 +1,5 @@ import { port } from './serve' +import { page } from '~utils' const url = `http://localhost:${port}` diff --git a/playground/ssr-html/__tests__/serve.ts b/playground/ssr-html/__tests__/serve.ts index 804009e92e86d6..c46d8f5a0574fd 100644 --- a/playground/ssr-html/__tests__/serve.ts +++ b/playground/ssr-html/__tests__/serve.ts @@ -2,7 +2,7 @@ // the default e2e test serve behavior import path from 'path' -import { ports } from '../../testUtils' +import { ports } from '~utils' export const port = ports['ssr-html'] diff --git a/playground/ssr-html/__tests__/ssr-html.spec.ts b/playground/ssr-html/__tests__/ssr-html.spec.ts index e34b8a91fc3421..bcf66c8f5ad128 100644 --- a/playground/ssr-html/__tests__/ssr-html.spec.ts +++ b/playground/ssr-html/__tests__/ssr-html.spec.ts @@ -1,5 +1,6 @@ -import { port } from './serve' import fetch from 'node-fetch' +import { port } from './serve' +import { page } from '~utils' const url = `http://localhost:${port}` diff --git a/playground/ssr-pug/__tests__/serve.ts b/playground/ssr-pug/__tests__/serve.ts index 2d687a5a685664..094dc20ab7e121 100644 --- a/playground/ssr-pug/__tests__/serve.ts +++ b/playground/ssr-pug/__tests__/serve.ts @@ -2,7 +2,7 @@ // the default e2e test serve behavior import path from 'path' -import { ports } from '../../testUtils' +import { ports } from '~utils' export const port = ports['ssr-pug'] diff --git a/playground/ssr-pug/__tests__/ssr-pug.spec.ts b/playground/ssr-pug/__tests__/ssr-pug.spec.ts index e34b8a91fc3421..bcf66c8f5ad128 100644 --- a/playground/ssr-pug/__tests__/ssr-pug.spec.ts +++ b/playground/ssr-pug/__tests__/ssr-pug.spec.ts @@ -1,5 +1,6 @@ -import { port } from './serve' import fetch from 'node-fetch' +import { port } from './serve' +import { page } from '~utils' const url = `http://localhost:${port}` diff --git a/playground/ssr-react/__tests__/serve.ts b/playground/ssr-react/__tests__/serve.ts index 2f8479a7463bd7..033d3565b89279 100644 --- a/playground/ssr-react/__tests__/serve.ts +++ b/playground/ssr-react/__tests__/serve.ts @@ -2,7 +2,7 @@ // the default e2e test serve behavior import path from 'path' -import { ports } from '../../testUtils' +import { ports } from '~utils' export const port = ports['ssr-react'] diff --git a/playground/ssr-react/__tests__/ssr-react.spec.ts b/playground/ssr-react/__tests__/ssr-react.spec.ts index 2235d4ae4d0edf..e560d0311b0caf 100644 --- a/playground/ssr-react/__tests__/ssr-react.spec.ts +++ b/playground/ssr-react/__tests__/ssr-react.spec.ts @@ -1,6 +1,6 @@ -import { editFile, untilUpdated } from '../../testUtils' -import { port } from './serve' import fetch from 'node-fetch' +import { port } from './serve' +import { browserLogs, editFile, page, untilUpdated } from '~utils' const url = `http://localhost:${port}` diff --git a/playground/ssr-vue/__tests__/serve.ts b/playground/ssr-vue/__tests__/serve.ts index 138729bfdaa01e..fd126c5482312d 100644 --- a/playground/ssr-vue/__tests__/serve.ts +++ b/playground/ssr-vue/__tests__/serve.ts @@ -2,7 +2,7 @@ // the default e2e test serve behavior import path from 'path' -import { ports } from '../../testUtils' +import { ports } from '~utils' export const port = ports['ssr-vue'] diff --git a/playground/ssr-vue/__tests__/ssr-vue.spec.ts b/playground/ssr-vue/__tests__/ssr-vue.spec.ts index 193c95b1f4a1c1..c58cea4cd13e59 100644 --- a/playground/ssr-vue/__tests__/ssr-vue.spec.ts +++ b/playground/ssr-vue/__tests__/ssr-vue.spec.ts @@ -1,7 +1,14 @@ -import { editFile, getColor, isBuild, untilUpdated } from '../../testUtils' -import { port } from './serve' -import fetch from 'node-fetch' import { resolve } from 'path' +import fetch from 'node-fetch' +import { port } from './serve' +import { + browserLogs, + editFile, + getColor, + isBuild, + page, + untilUpdated +} from '~utils' const url = `http://localhost:${port}` diff --git a/playground/ssr-webworker/__tests__/serve.ts b/playground/ssr-webworker/__tests__/serve.ts index 382208b3b06d2e..97d16cd3a97e3b 100644 --- a/playground/ssr-webworker/__tests__/serve.ts +++ b/playground/ssr-webworker/__tests__/serve.ts @@ -2,7 +2,7 @@ // the default e2e test serve behavior import path from 'path' -import { ports } from '../../testUtils' +import { ports } from '~utils' export const port = ports['ssr-webworker'] diff --git a/playground/ssr-webworker/__tests__/ssr-webworker.spec.ts b/playground/ssr-webworker/__tests__/ssr-webworker.spec.ts index 30d2bb93e495b1..7a5c1bdad2880e 100644 --- a/playground/ssr-webworker/__tests__/ssr-webworker.spec.ts +++ b/playground/ssr-webworker/__tests__/ssr-webworker.spec.ts @@ -1,4 +1,5 @@ import { port } from './serve' +import { page } from '~utils' const url = `http://localhost:${port}` diff --git a/playground/tailwind-sourcemap/__tests__/build.spec.ts b/playground/tailwind-sourcemap/__tests__/build.spec.ts index 50b8814aed9c4e..b30284731a76d9 100644 --- a/playground/tailwind-sourcemap/__tests__/build.spec.ts +++ b/playground/tailwind-sourcemap/__tests__/build.spec.ts @@ -1,4 +1,4 @@ -import { isBuild } from '../../testUtils' +import { isBuild, serverLogs } from '~utils' test.runIf(isBuild)('should not output sourcemap warning (#4939)', () => { serverLogs.forEach((log) => { diff --git a/playground/tailwind-sourcemap/__tests__/serve.spec.ts b/playground/tailwind-sourcemap/__tests__/serve.spec.ts index 8d4613190f02a2..62e46cc7781482 100644 --- a/playground/tailwind-sourcemap/__tests__/serve.spec.ts +++ b/playground/tailwind-sourcemap/__tests__/serve.spec.ts @@ -1,4 +1,4 @@ -import { isBuild } from '../../testUtils' +import { isBuild, serverLogs } from '~utils' test.runIf(isBuild)('should not output missing source file warning', () => { serverLogs.forEach((log) => { diff --git a/playground/tailwind/__test__/tailwind.spec.ts b/playground/tailwind/__test__/tailwind.spec.ts index 47f6b7ccf49037..ee596a17999a6e 100644 --- a/playground/tailwind/__test__/tailwind.spec.ts +++ b/playground/tailwind/__test__/tailwind.spec.ts @@ -1,4 +1,11 @@ -import { isBuild, editFile, untilUpdated, getColor } from '../../testUtils' +import { + isBuild, + editFile, + untilUpdated, + getColor, + browserLogs, + page +} from '~utils' test('should render', async () => { expect(await page.textContent('#pagetitle')).toBe('|Page title|') diff --git a/playground/testUtils.ts b/playground/test-utils.ts similarity index 93% rename from playground/testUtils.ts rename to playground/test-utils.ts index d423ba942923cb..00bfced5cb1006 100644 --- a/playground/testUtils.ts +++ b/playground/test-utils.ts @@ -1,5 +1,5 @@ // test utils used in e2e tests for playgrounds. -// `import { getColor } from '../../testUtils'` +// `import { getColor } from '~utils'` import fs from 'fs' import path from 'path' @@ -9,6 +9,26 @@ import type { Manifest } from 'vite' import { normalizePath } from 'vite' import { fromComment } from 'convert-source-map' import { expect } from 'vitest' +import { page } from '../scripts/vitestSetup' + +// TODO: explicitly import APIs and remove this +import 'vitest/globals' + +export * from '../scripts/vitestSetup' + +export const workspaceRoot = path.resolve(__dirname, '../') + +export const isBuild = !!process.env.VITE_TEST_BUILD +export const isServe = !isBuild + +export const isWindows = process.platform === 'win32' +export const viteBinPath = path.join( + workspaceRoot, + 'packages', + 'vite', + 'bin', + 'vite.js' +) // make sure these ports are unique export const ports = { @@ -31,15 +51,11 @@ export function slash(p: string): string { return p.replace(/\\/g, '/') } -export const isBuild = !!process.env.VITE_TEST_BUILD -export const isServe = !isBuild - export const testDir = () => { const testPath = expect.getState().testPath const testName = slash(testPath).match(/playground\/([\w-]+)\//)?.[1] return path.resolve(__dirname, '../playground-temp', testName) } -export const workspaceRoot = path.resolve(__dirname, '../') const hexToNameMap: Record = {} Object.keys(colors).forEach((color) => { @@ -159,11 +175,6 @@ export async function untilUpdated( } } -/** - * Send the rebuild complete message in build watch - */ -export { notifyRebuildComplete } from '../scripts/vitestSetup' - export const extractSourcemap = (content: string) => { const lines = content.trim().split('\n') return fromComment(lines[lines.length - 1]).toObject() diff --git a/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts b/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts index 30485918ea6e2d..52a02683b79c00 100644 --- a/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts +++ b/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts @@ -1,10 +1,14 @@ import { + beforeAllError, + browserLogs, + clearBeforeAllError, editFile, isBuild, isServe, + page, readFile, untilUpdated -} from '../../testUtils' +} from '~utils' describe.runIf(isBuild)('build', () => { test('should throw an error on build', () => { @@ -13,7 +17,7 @@ describe.runIf(isBuild)('build', () => { expect(buildError.message).toMatch( /^parsing .* failed: SyntaxError: Unexpected token } in JSON at position \d+$/ ) - beforeAllError = null // got expected error, null it here so testsuite does not fail from rethrow in afterAll + clearBeforeAllError() // got expected error, null it here so testsuite does not fail from rethrow in afterAll }) test('should not output files to dist', () => { diff --git a/playground/tsconfig-json/__tests__/tsconfig-json.spec.ts b/playground/tsconfig-json/__tests__/tsconfig-json.spec.ts index 0cd6af909f045b..aec0c42b3a3a77 100644 --- a/playground/tsconfig-json/__tests__/tsconfig-json.spec.ts +++ b/playground/tsconfig-json/__tests__/tsconfig-json.spec.ts @@ -1,6 +1,7 @@ import path from 'path' import fs from 'fs' import { transformWithEsbuild } from 'vite' +import { browserLogs } from '~utils' test('should respected each `tsconfig.json`s compilerOptions', () => { // main side effect should be called (because of `"importsNotUsedAsValues": "preserve"`) diff --git a/playground/tsconfig.json b/playground/tsconfig.json index 06bea8c1328d7f..55ffe0cc6b1ba2 100644 --- a/playground/tsconfig.json +++ b/playground/tsconfig.json @@ -7,8 +7,12 @@ "allowJs": true, "esModuleInterop": true, "moduleResolution": "node", + "resolveJsonModule": true, "baseUrl": ".", "jsx": "preserve", - "types": ["vite/client", "vitest/globals", "node"] + "types": ["vite/client", "vitest/globals", "node"], + "paths": { + "~utils": ["./test-utils.ts"] + } } } diff --git a/playground/vue-jsx/__tests__/vue-jsx.spec.ts b/playground/vue-jsx/__tests__/vue-jsx.spec.ts index 94c4eb147a0b84..2e6858dacce3c4 100644 --- a/playground/vue-jsx/__tests__/vue-jsx.spec.ts +++ b/playground/vue-jsx/__tests__/vue-jsx.spec.ts @@ -1,4 +1,4 @@ -import { editFile, isServe, untilUpdated } from '../../testUtils' +import { editFile, isServe, page, untilUpdated } from '~utils' test('should render', async () => { expect(await page.textContent('.named')).toMatch('0') diff --git a/playground/vue-lib/__tests__/vue-lib.spec.ts b/playground/vue-lib/__tests__/vue-lib.spec.ts index 0504160f17d2f0..5766b0c0c5643a 100644 --- a/playground/vue-lib/__tests__/vue-lib.spec.ts +++ b/playground/vue-lib/__tests__/vue-lib.spec.ts @@ -1,5 +1,5 @@ -import { build } from 'vite' import path from 'path' +import { build } from 'vite' import type { OutputChunk, RollupOutput } from 'rollup' describe('vue component library', () => { diff --git a/playground/vue-lib/src-consumer/index.ts b/playground/vue-lib/src-consumer/index.ts index ac0f65e2a3ed9d..ee20f81d75a7ca 100644 --- a/playground/vue-lib/src-consumer/index.ts +++ b/playground/vue-lib/src-consumer/index.ts @@ -1,5 +1,5 @@ -// @ts-ignore /* eslint-disable node/no-missing-import */ +// @ts-ignore import { CompA } from '../dist/lib/my-vue-lib.es' import '../dist/lib/style.css' import { createApp } from 'vue' diff --git a/playground/vue-sourcemap/__tests__/build.spec.ts b/playground/vue-sourcemap/__tests__/build.spec.ts index 50b8814aed9c4e..b30284731a76d9 100644 --- a/playground/vue-sourcemap/__tests__/build.spec.ts +++ b/playground/vue-sourcemap/__tests__/build.spec.ts @@ -1,4 +1,4 @@ -import { isBuild } from '../../testUtils' +import { isBuild, serverLogs } from '~utils' test.runIf(isBuild)('should not output sourcemap warning (#4939)', () => { serverLogs.forEach((log) => { diff --git a/playground/vue-sourcemap/__tests__/serve.spec.ts b/playground/vue-sourcemap/__tests__/serve.spec.ts index 09ba69c03abfa4..278b04bef1e6f5 100644 --- a/playground/vue-sourcemap/__tests__/serve.spec.ts +++ b/playground/vue-sourcemap/__tests__/serve.spec.ts @@ -1,9 +1,10 @@ +import { URL } from 'url' import { extractSourcemap, formatSourcemapForSnapshot, - isServe -} from '../../testUtils' -import { URL } from 'url' + isServe, + page +} from '~utils' describe.runIf(isServe)('serve:vue-sourcemap', () => { const getStyleTagContentIncluding = async (content: string) => { diff --git a/playground/vue/__tests__/vue.spec.ts b/playground/vue/__tests__/vue.spec.ts index f790bd612bfa9e..3b6e2cc15555b1 100644 --- a/playground/vue/__tests__/vue.spec.ts +++ b/playground/vue/__tests__/vue.spec.ts @@ -1,10 +1,13 @@ import { + browserLogs, editFile, getBg, getColor, isBuild, + page, + serverLogs, untilUpdated -} from '../../testUtils' +} from '~utils' test('should render', async () => { expect(await page.textContent('h1')).toMatch('Vue SFCs') diff --git a/playground/wasm/__tests__/wasm.spec.ts b/playground/wasm/__tests__/wasm.spec.ts index 112617212251fa..9a23378ecbf8dc 100644 --- a/playground/wasm/__tests__/wasm.spec.ts +++ b/playground/wasm/__tests__/wasm.spec.ts @@ -1,4 +1,4 @@ -import { untilUpdated } from '../../testUtils' +import { page, untilUpdated } from '~utils' test('should work when inlined', async () => { await page.click('.inline-wasm .run') diff --git a/playground/worker/__tests__/es/es-worker.spec.ts b/playground/worker/__tests__/es/es-worker.spec.ts index 4096aa4ec995e7..6d8cdaf9767d11 100644 --- a/playground/worker/__tests__/es/es-worker.spec.ts +++ b/playground/worker/__tests__/es/es-worker.spec.ts @@ -1,7 +1,7 @@ import fs from 'fs' import path from 'path' import type { Page } from 'playwright-chromium' -import { isBuild, testDir, untilUpdated } from '../../../testUtils' +import { isBuild, page, testDir, untilUpdated } from '~utils' test('normal', async () => { await page.click('.ping') diff --git a/playground/worker/__tests__/iife/worker.spec.ts b/playground/worker/__tests__/iife/worker.spec.ts index 37cc8675dc357b..0842d42e3562cc 100644 --- a/playground/worker/__tests__/iife/worker.spec.ts +++ b/playground/worker/__tests__/iife/worker.spec.ts @@ -2,7 +2,7 @@ import fs from 'fs' import path from 'path' import type { Page } from 'playwright-chromium' import { test } from 'vitest' -import { isBuild, testDir, untilUpdated } from '../../../testUtils' +import { isBuild, page, testDir, untilUpdated } from '~utils' test('normal', async () => { await page.click('.ping') diff --git a/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts b/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts index ce2c52b5c98840..3b1f153ef1f19a 100644 --- a/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts +++ b/playground/worker/__tests__/sourcemap-hidden/sourcemap-hidden-worker.spec.ts @@ -1,6 +1,6 @@ import fs from 'fs' import path from 'path' -import { isBuild, testDir } from '../../../testUtils' +import { isBuild, testDir } from '~utils' describe.runIf(isBuild)('build', () => { // assert correct files diff --git a/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts b/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts index 0fe97386f178df..eaf62b25dde214 100644 --- a/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts +++ b/playground/worker/__tests__/sourcemap-inline/sourcemap-inline-worker.spec.ts @@ -1,6 +1,6 @@ import fs from 'fs' import path from 'path' -import { isBuild, testDir } from '../../../testUtils' +import { isBuild, testDir } from '~utils' describe.runIf(isBuild)('build', () => { // assert correct files diff --git a/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts b/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts index 3b074f24990f4b..10dcfcb5fba048 100644 --- a/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts +++ b/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts @@ -1,6 +1,6 @@ import fs from 'fs' import path from 'path' -import { isBuild, testDir } from '../../../testUtils' +import { isBuild, testDir } from '~utils' describe.runIf(isBuild)('build', () => { // assert correct files diff --git a/scripts/patchEsbuildDist.ts b/scripts/patchEsbuildDist.ts index 70ef846af1bcbb..6ad2803c741346 100644 --- a/scripts/patchEsbuildDist.ts +++ b/scripts/patchEsbuildDist.ts @@ -3,8 +3,8 @@ // and plugin-react. For the moment, we can remove the extra exports code added in 0.14.4 to // continue using it. -import { bold, red } from 'picocolors' import { readFileSync, writeFileSync } from 'fs' +import { bold, red } from 'picocolors' const indexPath = process.argv[2] const varName = process.argv[3] diff --git a/scripts/patchFileDeps.ts b/scripts/patchFileDeps.ts index 0e90bbe8adece2..e5d15baecc7029 100644 --- a/scripts/patchFileDeps.ts +++ b/scripts/patchFileDeps.ts @@ -3,8 +3,8 @@ // This script is called from postinstall hooks in playground packages that // uses the file: protocol, and copies the file: deps into node_modules. -import { copySync, removeSync } from 'fs-extra' import { join, resolve } from 'path' +import { copySync, removeSync } from 'fs-extra' const root = process.cwd() const pkg = require(join(root, 'package.json')) diff --git a/scripts/releaseUtils.ts b/scripts/releaseUtils.ts index b444835db7b6d0..9fff2679b868b0 100644 --- a/scripts/releaseUtils.ts +++ b/scripts/releaseUtils.ts @@ -1,11 +1,11 @@ /** * modified from https://github.com/vuejs/core/blob/master/scripts/release.js */ +import { existsSync, readFileSync, readdirSync, writeFileSync } from 'fs' +import path from 'path' import colors from 'picocolors' import type { Options as ExecaOptions } from 'execa' import execa from 'execa' -import { readFileSync, writeFileSync, existsSync, readdirSync } from 'fs' -import path from 'path' import type { ReleaseType } from 'semver' import semver from 'semver' diff --git a/scripts/verifyCommit.ts b/scripts/verifyCommit.ts index e433e3aa1aa3e5..226b514437d555 100644 --- a/scripts/verifyCommit.ts +++ b/scripts/verifyCommit.ts @@ -1,7 +1,7 @@ // Invoked on the commit-msg git hook by simple-git-hooks. -import colors from 'picocolors' import { readFileSync } from 'fs' +import colors from 'picocolors' // get $1 from commit-msg script const msgPath = process.argv[2] diff --git a/scripts/vitestGlobalSetup.ts b/scripts/vitestGlobalSetup.ts index 8a0b7ffad6c6b2..52b49d01f38fda 100644 --- a/scripts/vitestGlobalSetup.ts +++ b/scripts/vitestGlobalSetup.ts @@ -1,6 +1,6 @@ import os from 'os' -import fs from 'fs-extra' import path from 'path' +import fs from 'fs-extra' import type { BrowserServer } from 'playwright-chromium' import { chromium } from 'playwright-chromium' diff --git a/scripts/vitestSetup.ts b/scripts/vitestSetup.ts index 4275d9d80864a5..84cc8107952ecb 100644 --- a/scripts/vitestSetup.ts +++ b/scripts/vitestSetup.ts @@ -1,71 +1,53 @@ -import fs from 'fs-extra' import * as http from 'http' -import { resolve, dirname } from 'path' -import sirv from 'sirv' +import { dirname, resolve } from 'path' import os from 'os' import path from 'path' +import sirv from 'sirv' +import fs from 'fs-extra' import { chromium } from 'playwright-chromium' import type { - ViteDevServer, InlineConfig, + Logger, PluginOption, ResolvedConfig, - Logger + ViteDevServer } from 'vite' -import { createServer, build, mergeConfig } from 'vite' -import type { Page, ConsoleMessage } from 'playwright-chromium' +import { build, createServer, mergeConfig } from 'vite' +import type { Browser, ConsoleMessage, Page } from 'playwright-chromium' import type { RollupError, RollupWatcher, RollupWatcherEvent } from 'rollup' import type { File } from 'vitest' import { beforeAll } from 'vitest' const isBuildTest = !!process.env.VITE_TEST_BUILD -export function slash(p: string): string { - return p.replace(/\\/g, '/') -} - -// injected by the test env -declare global { - const page: Page | undefined - - const browserLogs: string[] - const browserErrors: Error[] - const serverLogs: string[] - let viteTestUrl: string | undefined - const watcher: RollupWatcher | undefined - let beforeAllError: Error | null // error caught in beforeAll, useful if you want to test error scenarios on build -} - -declare const global: { - page?: Page - - browserLogs: string[] - browserErrors: Error[] - serverLogs: string[] - viteTestUrl?: string - watcher?: RollupWatcher - beforeAllError: Error | null -} - let server: ViteDevServer | http.Server let tempDir: string let rootDir: string -const setBeforeAllError = (err: Error | null) => { - global.beforeAllError = err +export const serverLogs: string[] = [] +export const browserLogs: string[] = [] +export const browserErrors: Error[] = [] + +/** + * Error caught in beforeAll, useful if you want to test error scenarios on build + */ +export let beforeAllError: Error | null = null + +export let page: Page = undefined! +export let browser: Browser = undefined! +export let viteTestUrl: string = '' +export let watcher: RollupWatcher | undefined = undefined + +export function clearBeforeAllError() { + beforeAllError = null } -const getBeforeAllError = () => global.beforeAllError -//init with null so old errors don't carry over -setBeforeAllError(null) -const logs: string[] = (global.browserLogs = []) -const onConsole = (msg: ConsoleMessage) => { - logs.push(msg.text()) +export function setViteUrl(url: string) { + viteTestUrl = url } -const errors: Error[] = (global.browserErrors = []) -const onPageError = (error: Error) => { - errors.push(error) +export function slash(p: string): string { + return p.replace(/\\/g, '/') } const DIR = path.join(os.tmpdir(), 'vitest_playwright_global_setup') @@ -82,10 +64,8 @@ beforeAll(async (s) => { return } - const browser = await chromium.connect(wsEndpoint) - const page = await browser.newPage() - // @ts-expect-error - globalThis.page = page + browser = await chromium.connect(wsEndpoint) + page = await browser.newPage() const globalConsole = globalThis.console const warn = globalConsole.warn @@ -97,8 +77,12 @@ beforeAll(async (s) => { } try { - page.on('console', onConsole) - page.on('pageerror', onPageError) + page.on('console', (msg) => { + browserLogs.push(msg.text()) + }) + page.on('pageerror', (error) => { + browserErrors.push(error) + }) const testPath = suite.filepath! const testName = slash(testPath).match(/playground\/([\w-]+)\//)?.[1] @@ -138,8 +122,6 @@ beforeAll(async (s) => { config = require(testCustomConfig) } - const serverLogs: string[] = [] - const options: InlineConfig = { root: rootDir, logLevel: 'silent', @@ -165,8 +147,6 @@ beforeAll(async (s) => { setupConsoleWarnCollector(serverLogs) - global.serverLogs = serverLogs - if (!isBuildTest) { process.env.VITE_INLINE = 'inline-serve' server = await ( @@ -174,9 +154,8 @@ beforeAll(async (s) => { ).listen() // use resolved port/base from server const base = server.config.base === '/' ? '' : server.config.base - const url = - (global.viteTestUrl = `http://localhost:${server.config.server.port}${base}`) - await page.goto(url) + viteTestUrl = `http://localhost:${server.config.server.port}${base}` + await page.goto(viteTestUrl) } else { process.env.VITE_INLINE = 'inline-build' // determine build watch @@ -192,11 +171,11 @@ beforeAll(async (s) => { const isWatch = !!resolvedConfig!.build.watch // in build watch,call startStaticServer after the build is complete if (isWatch) { - global.watcher = rollupOutput as RollupWatcher - await notifyRebuildComplete(global.watcher) + watcher = rollupOutput as RollupWatcher + await notifyRebuildComplete(watcher) } - const url = (global.viteTestUrl = await startStaticServer(config)) - await page.goto(url) + viteTestUrl = await startStaticServer(config) + await page.goto(viteTestUrl) } } } catch (e: any) { @@ -210,17 +189,15 @@ beforeAll(async (s) => { } return async () => { - page?.off('console', onConsole) - global.serverLogs = [] + serverLogs.length = 0 await page?.close() await server?.close() - global.watcher?.close() - const beforeAllErr = getBeforeAllError() + watcher?.close() if (browser) { await browser.close() } - if (beforeAllErr) { - throw beforeAllErr + if (beforeAllError) { + throw beforeAllError } } }, 30000) diff --git a/vitest.config.e2e.ts b/vitest.config.e2e.ts index a23378c97465b3..241910ff7382c3 100644 --- a/vitest.config.e2e.ts +++ b/vitest.config.e2e.ts @@ -1,6 +1,12 @@ +import { resolve } from 'path' import { defineConfig } from 'vitest/config' export default defineConfig({ + resolve: { + alias: { + '~utils': resolve(__dirname, './playground/test-utils') + } + }, test: { include: ['./playground/**/*.spec.[tj]s'], setupFiles: ['./scripts/vitestSetup.ts'], From b99cdc8fc51d43e4d92df6e5be1ef6146e05a7c7 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 11 May 2022 17:20:50 +0800 Subject: [PATCH 0700/1287] chore: fix test --- playground/test-utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playground/test-utils.ts b/playground/test-utils.ts index 00bfced5cb1006..60a159f701fa1f 100644 --- a/playground/test-utils.ts +++ b/playground/test-utils.ts @@ -1,6 +1,9 @@ // test utils used in e2e tests for playgrounds. // `import { getColor } from '~utils'` +// TODO: explicitly import APIs and remove this +/// + import fs from 'fs' import path from 'path' import colors from 'css-color-names' @@ -11,9 +14,6 @@ import { fromComment } from 'convert-source-map' import { expect } from 'vitest' import { page } from '../scripts/vitestSetup' -// TODO: explicitly import APIs and remove this -import 'vitest/globals' - export * from '../scripts/vitestSetup' export const workspaceRoot = path.resolve(__dirname, '../') From 79ef186b40c98d1988576e21610fe78e1aa3a93c Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 11 May 2022 18:09:52 +0800 Subject: [PATCH 0701/1287] chore: enable typecheck for tests and scripts (#8114) --- .eslintrc.cjs | 3 ++- .github/workflows/ci.yml | 4 ++++ CONTRIBUTING.md | 8 ++++---- package.json | 1 + playground/cli-module/__tests__/serve.ts | 2 +- playground/cli/__tests__/serve.ts | 2 +- playground/html/__tests__/html.spec.ts | 2 +- playground/legacy/__tests__/ssr/serve.ts | 2 +- playground/lib/__tests__/serve.ts | 2 +- playground/optimize-missing-deps/__test__/serve.ts | 2 +- playground/react-emotion/__tests__/react.spec.ts | 2 +- playground/resolve-config/__tests__/serve.ts | 2 +- playground/ssr-deps/__tests__/serve.ts | 2 +- playground/ssr-html/__tests__/serve.ts | 2 +- playground/ssr-pug/__tests__/serve.ts | 2 +- playground/ssr-react/__tests__/serve.ts | 2 +- playground/ssr-react/server.js | 1 + playground/ssr-vue/__tests__/serve.ts | 2 +- playground/ssr-vue/server.js | 1 + playground/ssr-webworker/__tests__/serve.ts | 2 +- playground/test-utils.ts | 5 +++-- playground/tsconfig.json | 7 +++++-- {scripts => playground}/vitestGlobalSetup.ts | 0 {scripts => playground}/vitestSetup.ts | 2 +- playground/vue-lib/__tests__/serve.ts | 2 +- playground/worker/my-shared-worker.ts | 5 ++++- playground/worker/my-worker.ts | 2 +- scripts/tsconfig.json | 7 ++++--- vitest.config.e2e.ts | 4 ++-- 29 files changed, 48 insertions(+), 32 deletions(-) rename {scripts => playground}/vitestGlobalSetup.ts (100%) rename {scripts => playground}/vitestSetup.ts (99%) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 1c80ee1df739c8..9f6bf0deb86303 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -119,7 +119,8 @@ module.exports = defineConfig({ rules: { 'node/no-extraneous-import': 'off', 'node/no-extraneous-require': 'off', - 'node/no-missing-import': 'off' + 'node/no-missing-import': 'off', + 'node/no-missing-require': 'off' } }, { diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce695749544b39..6260aa327e7c86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,9 +102,13 @@ jobs: run: | pnpm run ci-build-vite pnpm run build-plugin-vue + pnpm run build-plugin-react - name: Lint run: pnpm run lint - name: Check formatting run: pnpm prettier --check . + + - name: Typecheck + run: pnpm run typecheck diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a6b0b84a83b5a3..daa79cc1222c80 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,7 +34,7 @@ If you want to use break point and explore code execution you can use the ["Run Some errors are masked and hidden away because of the layers of abstraction and sandboxed nature added by Vitest, Playwright, and Chromium. In order to see what's actually going wrong and the contents of the devtools console in those instances, follow this setup: -1. Add a `debugger` statement to the `scripts/vitestSetup.ts` -> `afterAll` hook. This will pause execution before the tests quit and the Playwright browser instance exits. +1. Add a `debugger` statement to the `playground/vitestSetup.ts` -> `afterAll` hook. This will pause execution before the tests quit and the Playwright browser instance exits. 1. Run the tests with the `debug-serve` script command which will enable remote debugging: `pnpm run debug-serve -- --runInBand resolve`. @@ -69,7 +69,7 @@ And re-run `pnpm install` to link the package. ### Integration Tests -Each package under `playground/` contains a `__tests__` directory. The tests are run using [Vitest](https://vitest.dev/) + [Playwright](https://playwright.dev/) with custom integrations to make writing tests simple. The detailed setup is inside `vitest.config.e2e.js` and `scripts/vitest*` files. +Each package under `playground/` contains a `__tests__` directory. The tests are run using [Vitest](https://vitest.dev/) + [Playwright](https://playwright.dev/) with custom integrations to make writing tests simple. The detailed setup is inside `vitest.config.e2e.js` and `playground/vitest*` files. Before running the tests, make sure that [Vite has been built](#repo-setup). On Windows, you may want to [activate Developer Mode](https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) to solve [issues with symlink creation for non-admins](https://github.com/vitejs/vite/issues/7390). Also you may want to [set git `core.symlinks` to `true` to solve issues with symlinks in git](https://github.com/vitejs/vite/issues/5242). @@ -107,11 +107,11 @@ test('should work', async () => { Some common test helpers, e.g. `testDir`, `isBuild` or `editFile` are also available in the utils. Source code is located at `playground/test-utils.ts`. -Note: The test build environment uses a [different default set of Vite config](https://github.com/vitejs/vite/blob/9c6501d9c363eaa3c1e7708d531fb2a92b633db6/scripts/vitestSetup.ts#L102-L122) to skip transpilation during tests to make it faster. This may produce a different result compared to the default production build. +Note: The test build environment uses a [different default set of Vite config](https://github.com/vitejs/vite/blob/main/playground/vitestSetup.ts#L102-L122) to skip transpilation during tests to make it faster. This may produce a different result compared to the default production build. ### Extending the Test Suite -To add new tests, you should find a related playground to the fix or feature (or create a new one). As an example, static assets loading are tested in the [assets playground](https://github.com/vitejs/vite/tree/main/playground/assets). In this Vite App, there is a test for `?raw` imports, with [a section is defined in the `index.html` for it](https://github.com/vitejs/vite/blob/71215533ac60e8ff566dc3467feabfc2c71a01e2/playground/assets/index.html#L121): +To add new tests, you should find a related playground to the fix or feature (or create a new one). As an example, static assets loading are tested in the [assets playground](https://github.com/vitejs/vite/tree/main/playground/assets). In this Vite App, there is a test for `?raw` imports, with [a section is defined in the `index.html` for it](https://github.com/vitejs/vite/blob/main/playground/assets/index.html#L121): ```html

?raw import

diff --git a/package.json b/package.json index 8fffa3f6e045f6..ef29b398dde809 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "serve-docs": "vitepress serve docs", "release": "ts-node scripts/release.ts", "ci-publish": "ts-node scripts/publishCI.ts", + "typecheck": "tsc -p scripts --noEmit && tsc -p playground --noEmit", "build": "run-s build-vite build-plugin-vue build-plugin-react", "build-vite": "cd packages/vite && npm run build", "build-plugin-vue": "cd packages/plugin-vue && npm run build", diff --git a/playground/cli-module/__tests__/serve.ts b/playground/cli-module/__tests__/serve.ts index 6d5ad2d512089a..e4a011b2258c58 100644 --- a/playground/cli-module/__tests__/serve.ts +++ b/playground/cli-module/__tests__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import execa from 'execa' diff --git a/playground/cli/__tests__/serve.ts b/playground/cli/__tests__/serve.ts index 8c5717f4031e4a..9515b74af6a217 100644 --- a/playground/cli/__tests__/serve.ts +++ b/playground/cli/__tests__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import execa from 'execa' diff --git a/playground/html/__tests__/html.spec.ts b/playground/html/__tests__/html.spec.ts index 3e7c3d0166f75a..44372b324d5771 100644 --- a/playground/html/__tests__/html.spec.ts +++ b/playground/html/__tests__/html.spec.ts @@ -220,7 +220,7 @@ describe.runIf(isServe)('invalid', () => { }) test('should reload when fixed', async () => { - const response = await page.goto(viteTestUrl + '/invalid.html') + await page.goto(viteTestUrl + '/invalid.html') await editFile('invalid.html', (content) => { return content.replace('
Good') }) diff --git a/playground/legacy/__tests__/ssr/serve.ts b/playground/legacy/__tests__/ssr/serve.ts index 930f11f3bb8dfb..ec16b39e550965 100644 --- a/playground/legacy/__tests__/ssr/serve.ts +++ b/playground/legacy/__tests__/ssr/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import path from 'path' import { ports } from '~utils' diff --git a/playground/lib/__tests__/serve.ts b/playground/lib/__tests__/serve.ts index c536ad231bc3a5..a03bb185875b20 100644 --- a/playground/lib/__tests__/serve.ts +++ b/playground/lib/__tests__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import path from 'path' diff --git a/playground/optimize-missing-deps/__test__/serve.ts b/playground/optimize-missing-deps/__test__/serve.ts index 81c58b296837e1..7ceddad85dd19e 100644 --- a/playground/optimize-missing-deps/__test__/serve.ts +++ b/playground/optimize-missing-deps/__test__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import path from 'path' diff --git a/playground/react-emotion/__tests__/react.spec.ts b/playground/react-emotion/__tests__/react.spec.ts index 86b572be1ff403..ceb594ee259e1c 100644 --- a/playground/react-emotion/__tests__/react.spec.ts +++ b/playground/react-emotion/__tests__/react.spec.ts @@ -28,7 +28,7 @@ test('should update button style', async () => { }) } - const styles = await page.evaluate(() => { + await page.evaluate(() => { return document.querySelector('button').style }) diff --git a/playground/resolve-config/__tests__/serve.ts b/playground/resolve-config/__tests__/serve.ts index 4c1561264113e8..97d68d8f7fb54f 100644 --- a/playground/resolve-config/__tests__/serve.ts +++ b/playground/resolve-config/__tests__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import path from 'path' diff --git a/playground/ssr-deps/__tests__/serve.ts b/playground/ssr-deps/__tests__/serve.ts index 1d5ef5f3039c4e..4856ec936194e9 100644 --- a/playground/ssr-deps/__tests__/serve.ts +++ b/playground/ssr-deps/__tests__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import path from 'path' diff --git a/playground/ssr-html/__tests__/serve.ts b/playground/ssr-html/__tests__/serve.ts index c46d8f5a0574fd..9d1af30e706310 100644 --- a/playground/ssr-html/__tests__/serve.ts +++ b/playground/ssr-html/__tests__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import path from 'path' diff --git a/playground/ssr-pug/__tests__/serve.ts b/playground/ssr-pug/__tests__/serve.ts index 094dc20ab7e121..05d037d085c3b5 100644 --- a/playground/ssr-pug/__tests__/serve.ts +++ b/playground/ssr-pug/__tests__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import path from 'path' diff --git a/playground/ssr-react/__tests__/serve.ts b/playground/ssr-react/__tests__/serve.ts index 033d3565b89279..d6261ea9f55125 100644 --- a/playground/ssr-react/__tests__/serve.ts +++ b/playground/ssr-react/__tests__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import path from 'path' diff --git a/playground/ssr-react/server.js b/playground/ssr-react/server.js index 1876439c18fa88..bac272a95a2900 100644 --- a/playground/ssr-react/server.js +++ b/playground/ssr-react/server.js @@ -60,6 +60,7 @@ async function createServer( render = (await vite.ssrLoadModule('/src/entry-server.jsx')).render } else { template = indexProd + // @ts-ignore render = require('./dist/server/entry-server.js').render } diff --git a/playground/ssr-vue/__tests__/serve.ts b/playground/ssr-vue/__tests__/serve.ts index fd126c5482312d..1842659ec2019f 100644 --- a/playground/ssr-vue/__tests__/serve.ts +++ b/playground/ssr-vue/__tests__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import path from 'path' diff --git a/playground/ssr-vue/server.js b/playground/ssr-vue/server.js index 642f274647294f..c98d2984f82e5c 100644 --- a/playground/ssr-vue/server.js +++ b/playground/ssr-vue/server.js @@ -63,6 +63,7 @@ async function createServer( render = (await vite.ssrLoadModule('/src/entry-server.js')).render } else { template = indexProd + // @ts-ignore render = require('./dist/server/entry-server.js').render } diff --git a/playground/ssr-webworker/__tests__/serve.ts b/playground/ssr-webworker/__tests__/serve.ts index 97d16cd3a97e3b..4c4f1e3216e98f 100644 --- a/playground/ssr-webworker/__tests__/serve.ts +++ b/playground/ssr-webworker/__tests__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior import path from 'path' diff --git a/playground/test-utils.ts b/playground/test-utils.ts index 60a159f701fa1f..47bab08b698336 100644 --- a/playground/test-utils.ts +++ b/playground/test-utils.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/triple-slash-reference */ // test utils used in e2e tests for playgrounds. // `import { getColor } from '~utils'` @@ -12,9 +13,9 @@ import type { Manifest } from 'vite' import { normalizePath } from 'vite' import { fromComment } from 'convert-source-map' import { expect } from 'vitest' -import { page } from '../scripts/vitestSetup' +import { page } from './vitestSetup' -export * from '../scripts/vitestSetup' +export * from './vitestSetup' export const workspaceRoot = path.resolve(__dirname, '../') diff --git a/playground/tsconfig.json b/playground/tsconfig.json index 55ffe0cc6b1ba2..ada2a60bff6cff 100644 --- a/playground/tsconfig.json +++ b/playground/tsconfig.json @@ -3,12 +3,15 @@ "exclude": ["**/dist/**"], "compilerOptions": { "target": "es2019", + "module": "esnext", "outDir": "dist", + "baseUrl": ".", "allowJs": true, "esModuleInterop": true, - "moduleResolution": "node", "resolveJsonModule": true, - "baseUrl": ".", + "moduleResolution": "node", + "skipLibCheck": true, + "noUnusedLocals": true, "jsx": "preserve", "types": ["vite/client", "vitest/globals", "node"], "paths": { diff --git a/scripts/vitestGlobalSetup.ts b/playground/vitestGlobalSetup.ts similarity index 100% rename from scripts/vitestGlobalSetup.ts rename to playground/vitestGlobalSetup.ts diff --git a/scripts/vitestSetup.ts b/playground/vitestSetup.ts similarity index 99% rename from scripts/vitestSetup.ts rename to playground/vitestSetup.ts index 84cc8107952ecb..15c1192b7c7159 100644 --- a/scripts/vitestSetup.ts +++ b/playground/vitestSetup.ts @@ -13,7 +13,7 @@ import type { ViteDevServer } from 'vite' import { build, createServer, mergeConfig } from 'vite' -import type { Browser, ConsoleMessage, Page } from 'playwright-chromium' +import type { Browser, Page } from 'playwright-chromium' import type { RollupError, RollupWatcher, RollupWatcherEvent } from 'rollup' import type { File } from 'vitest' import { beforeAll } from 'vitest' diff --git a/playground/vue-lib/__tests__/serve.ts b/playground/vue-lib/__tests__/serve.ts index 47c122339205eb..70d30af178f50e 100644 --- a/playground/vue-lib/__tests__/serve.ts +++ b/playground/vue-lib/__tests__/serve.ts @@ -1,4 +1,4 @@ -// this is automatically detected by scripts/vitestSetup.ts and will replace +// this is automatically detected by playground/vitestSetup.ts and will replace // the default e2e test serve behavior export async function serve() { diff --git a/playground/worker/my-shared-worker.ts b/playground/worker/my-shared-worker.ts index caab5257394266..8d2099a7636459 100644 --- a/playground/worker/my-shared-worker.ts +++ b/playground/worker/my-shared-worker.ts @@ -1,6 +1,7 @@ let count = 0 const ports = new Set() +// @ts-expect-error onconnect = (event) => { const port = event.ports[0] ports.add(port) @@ -8,7 +9,7 @@ onconnect = (event) => { port.onmessage = (message) => { if (message.data === 'tick') { count++ - ports.forEach((p) => { + ports.forEach((p: any) => { p.postMessage(count) }) } @@ -17,3 +18,5 @@ onconnect = (event) => { // for sourcemap console.log('my-shared-worker.js') + +export {} diff --git a/playground/worker/my-worker.ts b/playground/worker/my-worker.ts index 553754f4901030..cfaaeeb4b788d3 100644 --- a/playground/worker/my-worker.ts +++ b/playground/worker/my-worker.ts @@ -1,4 +1,4 @@ -import { msg, mode } from './modules/workerImport' +import { mode, msg } from './modules/workerImport' import { bundleWithPlugin } from './modules/test-plugin' self.onmessage = (e) => { diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index bb673b6c8e21fb..92cbe98fb03740 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -1,13 +1,14 @@ { "$schema": "https://json.schemastore.org/tsconfig", + "include": ["."], "compilerOptions": { "module": "commonjs", - "moduleResolution": "node", "target": "es2019", + "moduleResolution": "node", "strict": true, "esModuleInterop": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "types": ["node", "vitest/globals"] + "noUnusedLocals": true, + "forceConsistentCasingInFileNames": true } } diff --git a/vitest.config.e2e.ts b/vitest.config.e2e.ts index 241910ff7382c3..05388353994f61 100644 --- a/vitest.config.e2e.ts +++ b/vitest.config.e2e.ts @@ -9,8 +9,8 @@ export default defineConfig({ }, test: { include: ['./playground/**/*.spec.[tj]s'], - setupFiles: ['./scripts/vitestSetup.ts'], - globalSetup: ['./scripts/vitestGlobalSetup.ts'], + setupFiles: ['./playground/vitestSetup.ts'], + globalSetup: ['./playground/vitestGlobalSetup.ts'], testTimeout: process.env.CI ? 50000 : 20000, globals: true, reporters: 'dot', From 4c54800d6be6611399be01cf830ed0f743e47d11 Mon Sep 17 00:00:00 2001 From: yoho Date: Wed, 11 May 2022 18:37:29 +0800 Subject: [PATCH 0702/1287] fix(vue): same src file request same key (#8059) --- packages/plugin-vue/src/main.ts | 43 ++++++++++++++----- .../plugin-vue/src/utils/descriptorCache.ts | 21 ++++++--- packages/plugin-vue/src/utils/query.ts | 4 ++ playground/vue/src-import/css.module.css | 7 +++ playground/vue/src-import/script.ts | 6 ++- .../vue/src-import/srcImportModuleStyle.vue | 4 ++ .../vue/src-import/srcImportModuleStyle2.vue | 4 ++ playground/vue/src-import/template.html | 2 + 8 files changed, 74 insertions(+), 17 deletions(-) create mode 100644 playground/vue/src-import/css.module.css create mode 100644 playground/vue/src-import/srcImportModuleStyle.vue create mode 100644 playground/vue/src-import/srcImportModuleStyle2.vue diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index 8fa01e494f58e2..6df6901a2bab40 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -227,6 +227,7 @@ async function genTemplateCode( ssr: boolean ) { const template = descriptor.template! + const hasScoped = descriptor.styles.some((style) => style.scoped) // If the template is not using pre-processor AND is not using external src, // compile and inline it directly in the main module. When served in vite this @@ -241,12 +242,22 @@ async function genTemplateCode( ) } else { if (template.src) { - await linkSrcToDescriptor(template.src, descriptor, pluginContext) + await linkSrcToDescriptor( + template.src, + descriptor, + pluginContext, + hasScoped + ) } const src = template.src || descriptor.filename - const srcQuery = template.src ? `&src=${descriptor.id}` : `` + const srcQuery = template.src + ? hasScoped + ? `&src=${descriptor.id}` + : '&src=true' + : '' + const scopedQuery = hasScoped ? `&scoped=true` : `` const attrsQuery = attrsToQuery(template.attrs, 'js', true) - const query = `?vue&type=template${srcQuery}${attrsQuery}` + const query = `?vue&type=template${srcQuery}${scopedQuery}${attrsQuery}` const request = JSON.stringify(src + query) const renderFnName = ssr ? 'ssrRender' : 'render' return { @@ -284,12 +295,12 @@ async function genScriptCode( map = script.map } else { if (script.src) { - await linkSrcToDescriptor(script.src, descriptor, pluginContext) + await linkSrcToDescriptor(script.src, descriptor, pluginContext, false) } const src = script.src || descriptor.filename const langFallback = (script.src && path.extname(src).slice(1)) || 'js' const attrsQuery = attrsToQuery(script.attrs, langFallback) - const srcQuery = script.src ? `&src=${descriptor.id}` : `` + const srcQuery = script.src ? `&src=true` : `` const query = `?vue&type=script${srcQuery}${attrsQuery}` const request = JSON.stringify(src + query) scriptCode = @@ -314,13 +325,22 @@ async function genStyleCode( for (let i = 0; i < descriptor.styles.length; i++) { const style = descriptor.styles[i] if (style.src) { - await linkSrcToDescriptor(style.src, descriptor, pluginContext) + await linkSrcToDescriptor( + style.src, + descriptor, + pluginContext, + style.scoped + ) } const src = style.src || descriptor.filename // do not include module in default query, since we use it to indicate // that the module needs to export the modules json const attrsQuery = attrsToQuery(style.attrs, 'css') - const srcQuery = style.src ? `&src=${descriptor.id}` : `` + const srcQuery = style.src + ? style.scoped + ? `&src=${descriptor.id}` + : '&src=true' + : '' const directQuery = asCustomElement ? `&inline` : `` const query = `?vue&type=style&index=${i}${srcQuery}${directQuery}` const styleRequest = src + query + attrsQuery @@ -390,11 +410,11 @@ async function genCustomBlockCode( for (let index = 0; index < descriptor.customBlocks.length; index++) { const block = descriptor.customBlocks[index] if (block.src) { - await linkSrcToDescriptor(block.src, descriptor, pluginContext) + await linkSrcToDescriptor(block.src, descriptor, pluginContext, false) } const src = block.src || descriptor.filename const attrsQuery = attrsToQuery(block.attrs, block.type) - const srcQuery = block.src ? `&src` : `` + const srcQuery = block.src ? `&src=true` : `` const query = `?vue&type=${block.type}&index=${index}${srcQuery}${attrsQuery}` const request = JSON.stringify(src + query) code += `import block${index} from ${request}\n` @@ -411,13 +431,14 @@ async function genCustomBlockCode( async function linkSrcToDescriptor( src: string, descriptor: SFCDescriptor, - pluginContext: PluginContext + pluginContext: PluginContext, + scoped?: boolean ) { const srcFile = (await pluginContext.resolve(src, descriptor.filename))?.id || src // #1812 if the src points to a dep file, the resolved id may contain a // version query. - setSrcDescriptor(srcFile.replace(/\?.*$/, ''), descriptor) + setSrcDescriptor(srcFile.replace(/\?.*$/, ''), descriptor, scoped) } // these are built-in query parameters so should be ignored diff --git a/packages/plugin-vue/src/utils/descriptorCache.ts b/packages/plugin-vue/src/utils/descriptorCache.ts index c0b77e72d3e613..5143a6131d5ddc 100644 --- a/packages/plugin-vue/src/utils/descriptorCache.ts +++ b/packages/plugin-vue/src/utils/descriptorCache.ts @@ -69,11 +69,22 @@ export function getSrcDescriptor( filename: string, query: VueQuery ): SFCDescriptor { - return cache.get(`${filename}?src=${query.src}`)! + if (query.scoped) { + return cache.get(`${filename}?src=${query.src}`)! + } + return cache.get(filename)! } -export function setSrcDescriptor(filename: string, entry: SFCDescriptor): void { - // if multiple Vue files use the same src file, they will be overwritten - // should use other key - cache.set(`${filename}?src=${entry.id}`, entry) +export function setSrcDescriptor( + filename: string, + entry: SFCDescriptor, + scoped?: boolean +): void { + if (scoped) { + // if multiple Vue files use the same src file, they will be overwritten + // should use other key + cache.set(`${filename}?src=${entry.id}`, entry) + return + } + cache.set(filename, entry) } diff --git a/packages/plugin-vue/src/utils/query.ts b/packages/plugin-vue/src/utils/query.ts index 060b5f28987bfa..f579067e52f8d8 100644 --- a/packages/plugin-vue/src/utils/query.ts +++ b/packages/plugin-vue/src/utils/query.ts @@ -5,6 +5,7 @@ export interface VueQuery { index?: number lang?: string raw?: boolean + scoped?: boolean } export function parseVueRequest(id: string): { @@ -22,6 +23,9 @@ export function parseVueRequest(id: string): { if (query.raw != null) { query.raw = true } + if (query.scoped != null) { + query.scoped = true + } return { filename, query diff --git a/playground/vue/src-import/css.module.css b/playground/vue/src-import/css.module.css new file mode 100644 index 00000000000000..09b5c09fb637e2 --- /dev/null +++ b/playground/vue/src-import/css.module.css @@ -0,0 +1,7 @@ +.one { + background: yellow; +} + +.two { + border: solid 1px red; +} diff --git a/playground/vue/src-import/script.ts b/playground/vue/src-import/script.ts index 54e6e35db41f46..d20c098a7af289 100644 --- a/playground/vue/src-import/script.ts +++ b/playground/vue/src-import/script.ts @@ -1,11 +1,15 @@ import { defineComponent } from 'vue' import SrcImportStyle from './srcImportStyle.vue' import SrcImportStyle2 from './srcImportStyle2.vue' +import SrcImportModuleStyle from './srcImportModuleStyle.vue' +import SrcImportModuleStyle2 from './srcImportModuleStyle2.vue' export default defineComponent({ components: { SrcImportStyle, - SrcImportStyle2 + SrcImportStyle2, + SrcImportModuleStyle, + SrcImportModuleStyle2 }, setup() { return { diff --git a/playground/vue/src-import/srcImportModuleStyle.vue b/playground/vue/src-import/srcImportModuleStyle.vue new file mode 100644 index 00000000000000..f1e85abb6d2b12 --- /dev/null +++ b/playground/vue/src-import/srcImportModuleStyle.vue @@ -0,0 +1,4 @@ + + diff --git a/playground/html/__tests__/html.spec.ts b/playground/html/__tests__/html.spec.ts index 2fd7ab6ffba6c8..b1c67a9b410994 100644 --- a/playground/html/__tests__/html.spec.ts +++ b/playground/html/__tests__/html.spec.ts @@ -66,6 +66,13 @@ function testPage(isNested: boolean) { expect(await getColor('h1')).toBe(isNested ? 'red' : 'blue') expect(await getColor('p')).toBe('grey') }) + + if (isNested) { + test('relative path in html asset', async () => { + expect(await page.textContent('.relative-js')).toMatch('hello') + expect(await getColor('.relative-css')).toMatch('red') + }) + } } describe('main', () => { diff --git a/playground/html/nested/asset/main.js b/playground/html/nested/asset/main.js new file mode 100644 index 00000000000000..e889874ff000d2 --- /dev/null +++ b/playground/html/nested/asset/main.js @@ -0,0 +1,4 @@ +function text(el, text) { + document.querySelector(el).textContent = text +} +text('.relative-js', 'hello') diff --git a/playground/html/nested/asset/style.css b/playground/html/nested/asset/style.css new file mode 100644 index 00000000000000..bafc1d8f12badb --- /dev/null +++ b/playground/html/nested/asset/style.css @@ -0,0 +1,3 @@ +.relative-css { + color: red; +} diff --git a/playground/html/nested/index.html b/playground/html/nested/index.html index 4fb855b783c890..2103a4b3bed77f 100644 --- a/playground/html/nested/index.html +++ b/playground/html/nested/index.html @@ -1,3 +1,9 @@

Nested

+ +

no base path nested

+ +
link style
+
+ From 04c2edd80f654a9e3c23e59d8b9060caa28e459e Mon Sep 17 00:00:00 2001 From: yoho Date: Fri, 13 May 2022 03:23:47 +0800 Subject: [PATCH 0728/1287] feat: worker emit fileName with config (#7804) --- packages/vite/src/node/config.ts | 9 +- packages/vite/src/node/plugins/worker.ts | 189 ++++++++---------- .../worker/__tests__/es/es-worker.spec.ts | 8 +- playground/worker/vite.config-es.js | 18 +- 4 files changed, 108 insertions(+), 116 deletions(-) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 21fe3b72915bd1..18c12568a260ca 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -252,6 +252,8 @@ export type ResolvedConfig = Readonly< command: 'build' | 'serve' mode: string isWorker: boolean + /** @internal */ + mainConfig: ResolvedConfig | null isProduction: boolean env: Record resolve: ResolveOptions & { @@ -482,6 +484,7 @@ export async function resolveConfig( command, mode, isWorker: false, + mainConfig: null, isProduction, plugins: userPlugins, server, @@ -513,7 +516,11 @@ export async function resolveConfig( // flat config.worker.plugin const [workerPrePlugins, workerNormalPlugins, workerPostPlugins] = sortUserPlugins(config.worker?.plugins as Plugin[]) - const workerResolved: ResolvedConfig = { ...resolved, isWorker: true } + const workerResolved: ResolvedConfig = { + ...resolved, + isWorker: true, + mainConfig: resolved + } resolved.worker.plugins = await resolvePlugins( workerResolved, workerPrePlugins, diff --git a/packages/vite/src/node/plugins/worker.ts b/packages/vite/src/node/plugins/worker.ts index 3e2bc5f1bb1088..72f492ecfb9d19 100644 --- a/packages/vite/src/node/plugins/worker.ts +++ b/packages/vite/src/node/plugins/worker.ts @@ -1,85 +1,40 @@ import path from 'path' -import type Rollup from 'rollup' -import type { EmittedFile, TransformPluginContext } from 'rollup' +import type { EmittedAsset, OutputChunk, TransformPluginContext } from 'rollup' import type { ResolvedConfig } from '../config' import type { Plugin } from '../plugin' -import { cleanUrl, getHash, injectQuery, parseRequest } from '../utils' +import { cleanUrl, injectQuery, parseRequest } from '../utils' import { ENV_PUBLIC_PATH } from '../constants' import { onRollupWarning } from '../build' import { fileToUrl } from './asset' interface WorkerCache { - // save worker bundle emitted files avoid overwrites the same file. - // - assets: Map - chunks: Map + // save worker all emit chunk avoid rollup make the same asset unique. + assets: Map + // worker bundle don't deps on any more worker runtime info an id only had an result. // save worker bundled file id to avoid repeated execution of bundles - // + // bundle: Map - // nested worker bundle context don't had file what emitted by outside bundle - // save the hash to id to rewrite truth id. - // - emitted: Map } const WorkerFileId = 'worker_file' const workerCache = new WeakMap() -function emitWorkerFile( - ctx: Rollup.TransformPluginContext, +function saveEmitWorkerAsset( config: ResolvedConfig, - asset: EmittedFile, - type: 'assets' | 'chunks' -): string { + asset: EmittedAsset +): void { const fileName = asset.fileName! - const workerMap = workerCache.get(config)! - - if (workerMap[type].has(fileName)) { - return workerMap[type].get(fileName)! - } - const hash = ctx.emitFile(asset) - workerMap[type].set(fileName, hash) - workerMap.emitted.set(hash, fileName) - return hash -} - -function emitWorkerAssets( - ctx: Rollup.TransformPluginContext, - config: ResolvedConfig, - asset: EmittedFile -) { - const { format } = config.worker - return emitWorkerFile( - ctx, - config, - asset, - format === 'es' ? 'chunks' : 'assets' - ) -} - -function emitWorkerSourcemap( - ctx: Rollup.TransformPluginContext, - config: ResolvedConfig, - asset: EmittedFile -) { - return emitWorkerFile(ctx, config, asset, 'assets') -} - -function emitWorkerChunks( - ctx: Rollup.TransformPluginContext, - config: ResolvedConfig, - asset: EmittedFile -) { - return emitWorkerFile(ctx, config, asset, 'chunks') + const workerMap = workerCache.get(config.mainConfig || config)! + workerMap.assets.set(fileName, asset) } export async function bundleWorkerEntry( - ctx: Rollup.TransformPluginContext, + ctx: TransformPluginContext, config: ResolvedConfig, id: string, query: Record | null -): Promise { +): Promise { // bundle the file as entry to support imports const { rollup } = await import('rollup') const { plugins, rollupOptions, format } = config.worker @@ -92,24 +47,40 @@ export async function bundleWorkerEntry( }, preserveEntrySignatures: false }) - let chunk: Rollup.OutputChunk + let chunk: OutputChunk try { + const workerOutputConfig = config.worker.rollupOptions.output + const workerConfig = workerOutputConfig + ? Array.isArray(workerOutputConfig) + ? workerOutputConfig[0] || {} + : workerOutputConfig + : {} const { output: [outputChunk, ...outputChunks] } = await bundle.generate({ + entryFileNames: path.posix.join( + config.build.assetsDir, + '[name].[hash].js' + ), + chunkFileNames: path.posix.join( + config.build.assetsDir, + '[name].[hash].js' + ), + assetFileNames: path.posix.join( + config.build.assetsDir, + '[name].[hash].[ext]' + ), + ...workerConfig, format, sourcemap: config.build.sourcemap }) chunk = outputChunk outputChunks.forEach((outputChunk) => { if (outputChunk.type === 'asset') { - emitWorkerAssets(ctx, config, outputChunk) + saveEmitWorkerAsset(config, outputChunk) } else if (outputChunk.type === 'chunk') { - emitWorkerChunks(ctx, config, { - fileName: path.posix.join( - config.build.assetsDir, - outputChunk.fileName - ), + saveEmitWorkerAsset(config, { + fileName: outputChunk.fileName, source: outputChunk.code, type: 'asset' }) @@ -118,36 +89,32 @@ export async function bundleWorkerEntry( } finally { await bundle.close() } - return emitSourcemapForWorkerEntry(ctx, config, id, query, chunk) + return emitSourcemapForWorkerEntry(ctx, config, query, chunk) } function emitSourcemapForWorkerEntry( - context: TransformPluginContext, + ctx: TransformPluginContext, config: ResolvedConfig, - id: string, query: Record | null, - chunk: Rollup.OutputChunk -): Buffer { - let { code, map: sourcemap } = chunk + chunk: OutputChunk +): OutputChunk { + const { map: sourcemap } = chunk + if (sourcemap) { if (config.build.sourcemap === 'inline') { // Manually add the sourcemap to the code if configured for inline sourcemaps. // TODO: Remove when https://github.com/rollup/rollup/issues/3913 is resolved // Currently seems that it won't be resolved until Rollup 3 const dataUrl = sourcemap.toUrl() - code += `//# sourceMappingURL=${dataUrl}` + chunk.code += `//# sourceMappingURL=${dataUrl}` } else if ( config.build.sourcemap === 'hidden' || config.build.sourcemap === true ) { - const basename = path.parse(cleanUrl(id)).name const data = sourcemap.toString() - const content = Buffer.from(data) - const contentHash = getHash(content) - const fileName = `${basename}.${contentHash}.js.map` - const filePath = path.posix.join(config.build.assetsDir, fileName) - emitWorkerSourcemap(context, config, { - fileName: filePath, + const mapFileName = chunk.fileName + '.map' + saveEmitWorkerAsset(config, { + fileName: mapFileName, type: 'asset', source: data }) @@ -161,57 +128,50 @@ function emitSourcemapForWorkerEntry( // non-inline web workers can use a relative path const sourceMapUrl = query?.inline != null - ? path.posix.join(config.base, filePath) - : fileName - code += `//# sourceMappingURL=${sourceMapUrl}` + ? mapFileName + : path.relative(config.build.assetsDir, mapFileName) + chunk.code += `//# sourceMappingURL=${sourceMapUrl}` } } } - return Buffer.from(code) + return chunk } export async function workerFileToUrl( - ctx: Rollup.TransformPluginContext, + ctx: TransformPluginContext, config: ResolvedConfig, id: string, query: Record | null ): Promise { - const workerMap = workerCache.get(config)! - - let hash = workerMap.bundle.get(id) - if (hash) { - // rewrite truth id, no need to replace by asset plugin - return config.base + workerMap.emitted.get(hash)! + const workerMap = workerCache.get(config.mainConfig || config)! + let fileName = workerMap.bundle.get(id) + if (!fileName) { + const outputChunk = await bundleWorkerEntry(ctx, config, id, query) + fileName = outputChunk.fileName + saveEmitWorkerAsset(config, { + fileName, + source: outputChunk.code, + type: 'asset' + }) + workerMap.bundle.set(id, fileName) } - const code = await bundleWorkerEntry(ctx, config, id, query) - const basename = path.parse(cleanUrl(id)).name - const contentHash = getHash(code) - const fileName = path.posix.join( - config.build.assetsDir, - `${basename}.${contentHash}.js` - ) - hash = emitWorkerAssets(ctx, config, { - fileName, - type: 'asset', - source: code - }) - workerMap.bundle.set(id, hash) - return `__VITE_ASSET__${hash}__` + return config.base + fileName } export function webWorkerPlugin(config: ResolvedConfig): Plugin { const isBuild = config.command === 'build' - + const isWorker = config.isWorker return { name: 'vite:worker', buildStart() { + if (isWorker) { + return + } workerCache.set(config, { assets: new Map(), - chunks: new Map(), - bundle: new Map(), - emitted: new Map() + bundle: new Map() }) }, @@ -244,12 +204,14 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin { let url: string if (isBuild) { if (query.inline != null) { - const code = await bundleWorkerEntry(this, config, id, query) + const chunk = await bundleWorkerEntry(this, config, id, query) const { format } = config.worker const workerOptions = format === 'es' ? '{type: "module"}' : '{}' // inline as blob data url return { - code: `const encodedJs = "${code.toString('base64')}"; + code: `const encodedJs = "${Buffer.from(chunk.code).toString( + 'base64' + )}"; const blob = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs)], { type: "text/javascript;charset=utf-8" }); export default function WorkerWrapper() { const objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob); @@ -289,6 +251,13 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin { if (config.isWorker && code.includes('import.meta.url')) { return code.replace('import.meta.url', 'self.location.href') } + if (!isWorker) { + const workerMap = workerCache.get(config)! + workerMap.assets.forEach((asset) => { + this.emitFile(asset) + workerMap.assets.delete(asset.fileName!) + }) + } } } } diff --git a/playground/worker/__tests__/es/es-worker.spec.ts b/playground/worker/__tests__/es/es-worker.spec.ts index 3ca94faac2e7d0..767fd386606afc 100644 --- a/playground/worker/__tests__/es/es-worker.spec.ts +++ b/playground/worker/__tests__/es/es-worker.spec.ts @@ -52,8 +52,10 @@ test.each([[true], [false]])('shared worker', async (doTick) => { }) test('worker emitted and import.meta.url in nested worker (serve)', async () => { - expect(await page.textContent('.nested-worker')).toMatch('/worker-nested') - expect(await page.textContent('.nested-worker-module')).toMatch('/sub-worker') + expect(await page.textContent('.nested-worker')).toMatch( + 'worker-nested-worker' + ) + expect(await page.textContent('.nested-worker-module')).toMatch('sub-worker') expect(await page.textContent('.nested-worker-constructor')).toMatch( '"type":"constructor"' ) @@ -64,7 +66,7 @@ describe.runIf(isBuild)('build', () => { test('inlined code generation', async () => { const assetsDir = path.resolve(testDir, 'dist/es/assets') const files = fs.readdirSync(assetsDir) - expect(files.length).toBe(26) + expect(files.length).toBe(25) const index = files.find((f) => f.includes('main-module')) const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8') const worker = files.find((f) => f.includes('my-worker')) diff --git a/playground/worker/vite.config-es.js b/playground/worker/vite.config-es.js index a65dece2d0db21..899ce6d0825a8b 100644 --- a/playground/worker/vite.config-es.js +++ b/playground/worker/vite.config-es.js @@ -7,10 +7,24 @@ module.exports = vite.defineConfig({ enforce: 'pre', worker: { format: 'es', - plugins: [vueJsx()] + plugins: [vueJsx()], + rollupOptions: { + output: { + assetFileNames: 'assets/worker_asset.[name].[ext]', + chunkFileNames: 'assets/worker_chunk.[name].js', + entryFileNames: 'assets/worker_entry.[name].js' + } + } }, build: { - outDir: 'dist/es' + outDir: 'dist/es', + rollupOptions: { + output: { + assetFileNames: 'assets/[name].[ext]', + chunkFileNames: 'assets/[name].js', + entryFileNames: 'assets/[name].js' + } + } }, plugins: [ { From 638b1686288ad685243d34cd9f1db3814f4db1c0 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 13 May 2022 11:00:54 +0800 Subject: [PATCH 0729/1287] chore: use `unbuild` to bundle plugins (#8139) --- .eslintignore | 4 + .eslintrc.cjs | 2 +- .github/workflows/ci.yml | 17 +- .prettierignore | 8 +- package.json | 17 +- packages/plugin-legacy/build.config.ts | 10 + packages/plugin-legacy/package.json | 25 +- .../plugin-legacy/{index.js => src/index.ts} | 209 +++++----- .../{index.d.ts => src/types.ts} | 8 - packages/plugin-legacy/tsconfig.json | 19 + packages/plugin-react/api-extractor.json | 53 --- packages/plugin-react/build.config.ts | 12 + packages/plugin-react/package.json | 25 +- packages/plugin-react/src/index.ts | 11 +- .../src/jsx-runtime/restore-jsx.ts | 17 +- packages/plugin-react/tsconfig.json | 6 +- packages/plugin-vue-jsx/build.config.ts | 10 + packages/plugin-vue-jsx/index.d.ts | 14 - packages/plugin-vue-jsx/package.json | 24 +- .../plugin-vue-jsx/{index.js => src/index.ts} | 84 ++-- packages/plugin-vue-jsx/src/types.ts | 10 + packages/plugin-vue-jsx/tsconfig.json | 19 + packages/plugin-vue/api-extractor.json | 53 --- packages/plugin-vue/build.config.ts | 12 + packages/plugin-vue/package.json | 27 +- packages/plugin-vue/src/index.ts | 10 +- packages/plugin-vue/tsconfig.json | 5 +- packages/vite/package.json | 3 +- playground/react-emotion/vite.config.ts | 8 +- pnpm-lock.yaml | 391 +++++++++++++++++- scripts/patchCJS.ts | 57 +++ scripts/patchEsbuildDist.ts | 31 -- 32 files changed, 766 insertions(+), 435 deletions(-) create mode 100644 .eslintignore create mode 100644 packages/plugin-legacy/build.config.ts rename packages/plugin-legacy/{index.js => src/index.ts} (83%) rename packages/plugin-legacy/{index.d.ts => src/types.ts} (75%) create mode 100644 packages/plugin-legacy/tsconfig.json delete mode 100644 packages/plugin-react/api-extractor.json create mode 100644 packages/plugin-react/build.config.ts create mode 100644 packages/plugin-vue-jsx/build.config.ts delete mode 100644 packages/plugin-vue-jsx/index.d.ts rename packages/plugin-vue-jsx/{index.js => src/index.ts} (81%) create mode 100644 packages/plugin-vue-jsx/src/types.ts create mode 100644 packages/plugin-vue-jsx/tsconfig.json delete mode 100644 packages/plugin-vue/api-extractor.json create mode 100644 packages/plugin-vue/build.config.ts create mode 100644 scripts/patchCJS.ts delete mode 100644 scripts/patchEsbuildDist.ts diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000000000..3e795e7a98280b --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +dist +playground-temp +temp + diff --git a/.eslintrc.cjs b/.eslintrc.cjs index d5050bd4853167..bb48bf9c307fd6 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -125,7 +125,7 @@ module.exports = defineConfig({ } }, { - files: ['packages/create-vite/template-*/**'], + files: ['packages/create-vite/template-*/**', '**/build.config.ts'], rules: { 'node/no-missing-import': 'off' } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05813fbd73e244..7a329e3c26c257 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,14 +66,8 @@ jobs: - name: Install Playwright run: pnpm playwright install - - name: Build vite - run: pnpm run ci-build-vite - - - name: Build plugin-vue - run: pnpm run build-plugin-vue - - - name: Build plugin-react - run: pnpm run build-plugin-react + - name: Build + run: pnpm run build - name: Test unit run: pnpm run test-unit @@ -107,11 +101,8 @@ jobs: env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" - - name: Prepare - run: | - pnpm run ci-build-vite - pnpm run build-plugin-vue - pnpm run build-plugin-react + - name: Build + run: pnpm run build - name: Lint run: pnpm run lint diff --git a/.prettierignore b/.prettierignore index a2c1f98cf5cc02..0d5487354a8c98 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,12 +1,8 @@ -docs/.vitepress/dist/ -packages/vite/dist/ -packages/vite/temp/ -packages/plugin-react/dist/ -packages/plugin-vue/dist/ packages/*/CHANGELOG.md playground-temp/ +dist/ +temp/ LICENSE.md -.prettierignore pnpm-lock.yaml pnpm-workspace.yaml playground/tsconfig-json-load-error/has-error/tsconfig.json diff --git a/package.json b/package.json index 92a5fd2ee871b5..dd19523dfdc497 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "preinstall": "npx only-allow pnpm", "format": "prettier --write .", "lint": "eslint packages/*/{src,types}/** playground/**/__tests__/** scripts/**", + "typecheck": "tsc -p scripts --noEmit && tsc -p playground --noEmit", "test": "run-s test-unit test-serve test-build", "test-serve": "vitest run -c vitest.config.e2e.ts", "test-build": "cross-env VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts", @@ -23,21 +24,18 @@ "debug-serve": "cross-env VITE_DEBUG_SERVE=1 vitest run -c vitest.config.e2e.ts", "debug-build": "cross-env VITE_TEST_BUILD=1 VITE_PRESERVE_BUILD_ARTIFACTS=1 vitest run -c vitest.config.e2e.ts", "docs": "vitepress dev docs", - "build-docs": "vitepress build docs", - "serve-docs": "vitepress serve docs", + "docs-build": "vitepress build docs", + "docs-serve": "vitepress serve docs", + "build": "pnpm -r --filter=./packages/* run build", + "dev": "pnpm -r --parallel --filter=./packages/* run dev", "release": "ts-node scripts/release.ts", "ci-publish": "ts-node scripts/publishCI.ts", - "typecheck": "tsc -p scripts --noEmit && tsc -p playground --noEmit", - "build": "run-s build-vite build-plugin-vue build-plugin-react", - "build-vite": "cd packages/vite && npm run build", - "build-plugin-vue": "cd packages/plugin-vue && npm run build", - "build-plugin-react": "cd packages/plugin-react && npm run build", - "ci-build-vite": "cd packages/vite && npm run ci-build", - "ci-docs": "run-s build-vite build-plugin-vue build-docs" + "ci-docs": "run-s build docs-build" }, "devDependencies": { "@microsoft/api-extractor": "^7.23.1", "@types/babel__core": "^7.1.19", + "@types/babel__standalone": "^7.1.4", "@types/convert-source-map": "^1.5.2", "@types/cross-spawn": "^6.0.2", "@types/debug": "^4.1.7", @@ -83,6 +81,7 @@ "sirv": "^2.0.2", "ts-node": "^10.7.0", "typescript": "^4.6.4", + "unbuild": "^0.7.4", "vite": "workspace:*", "vitepress": "^0.22.4", "vitest": "^0.12.4", diff --git a/packages/plugin-legacy/build.config.ts b/packages/plugin-legacy/build.config.ts new file mode 100644 index 00000000000000..6dcf1a5a2dc0b3 --- /dev/null +++ b/packages/plugin-legacy/build.config.ts @@ -0,0 +1,10 @@ +import { defineBuildConfig } from 'unbuild' + +export default defineBuildConfig({ + entries: ['src/index'], + clean: true, + declaration: true, + rollup: { + emitCJS: true + } +}) diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index 296c994165747b..828b31d57ddfe2 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -4,11 +4,24 @@ "license": "MIT", "author": "Evan You", "files": [ - "index.js", - "index.d.ts" + "dist" ], - "main": "index.js", - "types": "index.d.ts", + "main": "./dist/index.cjs", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" + } + }, + "scripts": { + "dev": "unbuild --stub", + "build": "unbuild && pnpm run patch-cjs", + "patch-cjs": "ts-node ../../scripts/patchCJS.ts", + "prepublishOnly": "npm run build" + }, "engines": { "node": ">=14.6.0" }, @@ -30,5 +43,9 @@ }, "peerDependencies": { "vite": "^2.8.0" + }, + "devDependencies": { + "vite": "workspace:*", + "@babel/core": "^7.17.10" } } diff --git a/packages/plugin-legacy/index.js b/packages/plugin-legacy/src/index.ts similarity index 83% rename from packages/plugin-legacy/index.js rename to packages/plugin-legacy/src/index.ts index 2f1b1991c31c31..5fedb716f04f86 100644 --- a/packages/plugin-legacy/index.js +++ b/packages/plugin-legacy/src/index.ts @@ -1,15 +1,33 @@ -// @ts-check -const path = require('path') -const { createHash } = require('crypto') -const { build } = require('vite') -const MagicString = require('magic-string').default +/* eslint-disable node/no-extraneous-import */ +import path from 'path' +import { createHash } from 'crypto' +import { build } from 'vite' +import MagicString from 'magic-string' +import type { + BuildOptions, + HtmlTagDescriptor, + Plugin, + ResolvedConfig +} from 'vite' +import type { + NormalizedOutputOptions, + OutputBundle, + OutputOptions, + PreRenderedChunk, + RenderedChunk +} from 'rollup' +import type { PluginItem as BabelPlugin } from '@babel/core' +import type { Options } from './types' // lazy load babel since it's not used during dev -let babel -/** - * @return {import('@babel/standalone')} - */ -const loadBabel = () => babel || (babel = require('@babel/standalone')) +// eslint-disable-next-line @typescript-eslint/consistent-type-imports +let babel: typeof import('@babel/standalone') | undefined +async function loadBabel() { + if (!babel) { + babel = await import('@babel/standalone') + } + return babel +} // https://gist.github.com/samthor/64b114e4a4f539915a95b91ffd340acc // DO NOT ALTER THIS CONTENT @@ -27,15 +45,8 @@ const forceDynamicImportUsage = `export function __vite_legacy_guard(){import('d const legacyEnvVarMarker = `__VITE_IS_LEGACY__` -/** - * @param {import('.').Options} options - * @returns {import('vite').Plugin[]} - */ -function viteLegacyPlugin(options = {}) { - /** - * @type {import('vite').ResolvedConfig} - */ - let config +function viteLegacyPlugin(options: Options = {}): Plugin[] { + let config: ResolvedConfig const targets = options.targets || 'defaults' const genLegacy = options.renderLegacyChunks !== false const genDynamicFallback = genLegacy @@ -47,7 +58,7 @@ function viteLegacyPlugin(options = {}) { const facadeToLegacyChunkMap = new Map() const facadeToLegacyPolyfillMap = new Map() const facadeToModernPolyfillMap = new Map() - const modernPolyfills = new Set() + const modernPolyfills = new Set() // System JS relies on the Promise interface. It needs to be polyfilled for IE 11. (array.iterator is mandatory for supporting Promise.all) const DEFAULT_LEGACY_POLYFILL = [ 'core-js/modules/es.promise', @@ -79,10 +90,7 @@ function viteLegacyPlugin(options = {}) { }) } - /** - * @type {import('vite').Plugin} - */ - const legacyConfigPlugin = { + const legacyConfigPlugin: Plugin = { name: 'vite:legacy-config', apply: 'build', @@ -96,16 +104,13 @@ function viteLegacyPlugin(options = {}) { // Full CSS compat table available at https://github.com/evanw/esbuild/blob/78e04680228cf989bdd7d471e02bbc2c8d345dc9/internal/compat/css_table.go // But note that only the `HexRGBA` feature affects the minify outcome. // HSL & rebeccapurple values will be minified away regardless the target. - // So targeting `chrome61` suffices to fix the compatiblity issue. + // So targeting `chrome61` suffices to fix the compatibility issue. config.build.cssTarget = 'chrome61' } } } - /** - * @type {import('vite').Plugin} - */ - const legacyGenerateBundlePlugin = { + const legacyGenerateBundlePlugin: Plugin = { name: 'vite:legacy-generate-polyfill-chunk', apply: 'build', @@ -143,7 +148,7 @@ function viteLegacyPlugin(options = {}) { if (!legacyPolyfills.has('es.promise')) { // check if the target needs Promise polyfill because SystemJS relies // on it - detectPolyfills(`Promise.resolve()`, targets, legacyPolyfills) + await detectPolyfills(`Promise.resolve()`, targets, legacyPolyfills) } isDebug && @@ -166,10 +171,7 @@ function viteLegacyPlugin(options = {}) { } } - /** - * @type {import('vite').Plugin} - */ - const legacyPostPlugin = { + const legacyPostPlugin: Plugin = { name: 'vite:legacy-post-process', enforce: 'post', apply: 'build', @@ -184,15 +186,13 @@ function viteLegacyPlugin(options = {}) { return } - /** - * @param {string | ((chunkInfo: import('rollup').PreRenderedChunk) => string)} fileNames - * @param {string?} defaultFileName - * @returns {string | ((chunkInfo: import('rollup').PreRenderedChunk) => string)} - */ const getLegacyOutputFileName = ( - fileNames, + fileNames: + | string + | ((chunkInfo: PreRenderedChunk) => string) + | undefined, defaultFileName = '[name]-legacy.[hash].js' - ) => { + ): string | ((chunkInfo: PreRenderedChunk) => string) => { if (!fileNames) { return path.posix.join(config.build.assetsDir, defaultFileName) } @@ -213,11 +213,9 @@ function viteLegacyPlugin(options = {}) { } } - /** - * @param {import('rollup').OutputOptions} options - * @returns {import('rollup').OutputOptions} - */ - const createLegacyOutput = (options = {}) => { + const createLegacyOutput = ( + options: OutputOptions = {} + ): OutputOptions => { return { ...options, format: 'system', @@ -235,9 +233,9 @@ function viteLegacyPlugin(options = {}) { } }, - renderChunk(raw, chunk, opts) { + async renderChunk(raw, chunk, opts) { if (config.build.ssr) { - return + return null } if (!isLegacyChunk(chunk, opts)) { @@ -246,7 +244,7 @@ function viteLegacyPlugin(options = {}) { !Array.isArray(options.modernPolyfills) ) { // analyze and record modern polyfills - detectPolyfills(raw, { esmodules: true }, modernPolyfills) + await detectPolyfills(raw, { esmodules: true }, modernPolyfills) } const ms = new MagicString(raw) @@ -273,11 +271,13 @@ function viteLegacyPlugin(options = {}) { map: ms.generateMap({ hires: true }) } } - return ms.toString() + return { + code: ms.toString() + } } if (!genLegacy) { - return + return null } // @ts-ignore avoid esbuild transform on legacy chunks since it produces @@ -302,12 +302,13 @@ function viteLegacyPlugin(options = {}) { // transform the legacy chunk with @babel/preset-env const sourceMaps = !!config.build.sourcemap - const { code, map } = loadBabel().transform(raw, { + const babel = await loadBabel() + const { code, map } = babel.transform(raw, { babelrc: false, configFile: false, compact: true, sourceMaps, - inputSourceMap: sourceMaps && chunk.map, + inputSourceMap: sourceMaps ? chunk.map : undefined, presets: [ // forcing our plugin to run before preset-env by wrapping it in a // preset so we can catch the injected import statements... @@ -341,7 +342,8 @@ function viteLegacyPlugin(options = {}) { ] }) - return { code, map } + if (code) return { code, map } + return null }, transformIndexHtml(html, { chunk }) { @@ -354,11 +356,8 @@ function viteLegacyPlugin(options = {}) { return } - /** - * @type {import('vite').HtmlTagDescriptor[]} - */ - const tags = [] - const htmlFilename = chunk.facadeModuleId.replace(/\?.*$/, '') + const tags: HtmlTagDescriptor[] = [] + const htmlFilename = chunk.facadeModuleId?.replace(/\?.*$/, '') // 1. inject modern polyfills const modernPolyfillFilename = facadeToModernPolyfillMap.get( @@ -473,10 +472,7 @@ function viteLegacyPlugin(options = {}) { } let envInjectionFailed = false - /** - * @type {import('vite').Plugin} - */ - const legacyEnvPlugin = { + const legacyEnvPlugin: Plugin = { name: 'vite:legacy-env', config(config, env) { @@ -484,7 +480,7 @@ function viteLegacyPlugin(options = {}) { return { define: { 'import.meta.env.LEGACY': - env.command === 'serve' || config.build.ssr + env.command === 'serve' || config.build?.ssr ? false : legacyEnvVarMarker } @@ -512,13 +508,13 @@ function viteLegacyPlugin(options = {}) { ] } -/** - * @param {string} code - * @param {any} targets - * @param {Set} list - */ -function detectPolyfills(code, targets, list) { - const { ast } = loadBabel().transform(code, { +export async function detectPolyfills( + code: string, + targets: any, + list: Set +) { + const babel = await loadBabel() + const { ast } = babel.transform(code, { ast: true, babelrc: false, configFile: false, @@ -536,7 +532,7 @@ function detectPolyfills(code, targets, list) { ] ] }) - for (const node of ast.program.body) { + for (const node of ast!.program.body) { if (node.type === 'ImportDeclaration') { const source = node.source.value if ( @@ -549,20 +545,13 @@ function detectPolyfills(code, targets, list) { } } -/** - * @param {string} name - * @param {Set} imports - * @param {import('rollup').OutputBundle} bundle - * @param {Map} facadeToChunkMap - * @param {import('vite').BuildOptions} buildOptions - */ async function buildPolyfillChunk( - name, - imports, - bundle, - facadeToChunkMap, - buildOptions, - externalSystemJS + name: string, + imports: Set, + bundle: OutputBundle, + facadeToChunkMap: Map, + buildOptions: BuildOptions, + externalSystemJS?: boolean ) { let { minify, assetsDir } = buildOptions minify = minify ? 'terser' : false @@ -607,11 +596,10 @@ async function buildPolyfillChunk( const polyfillId = '\0vite/legacy-polyfills' -/** - * @param {Set} imports - * @return {import('rollup').Plugin} - */ -function polyfillsPlugin(imports, externalSystemJS) { +function polyfillsPlugin( + imports: Set, + externalSystemJS?: boolean +): Plugin { return { name: 'vite:legacy-polyfills', resolveId(id) { @@ -630,19 +618,14 @@ function polyfillsPlugin(imports, externalSystemJS) { } } -/** - * @param {import('rollup').RenderedChunk} chunk - * @param {import('rollup').NormalizedOutputOptions} options - */ -function isLegacyChunk(chunk, options) { +function isLegacyChunk(chunk: RenderedChunk, options: NormalizedOutputOptions) { return options.format === 'system' && chunk.fileName.includes('-legacy') } -/** - * @param {import('rollup').OutputBundle} bundle - * @param {import('rollup').NormalizedOutputOptions} options - */ -function isLegacyBundle(bundle, options) { +function isLegacyBundle( + bundle: OutputBundle, + options: NormalizedOutputOptions +) { if (options.format === 'system') { const entryChunk = Object.values(bundle).find( (output) => output.type === 'chunk' && output.isEntry @@ -654,15 +637,15 @@ function isLegacyBundle(bundle, options) { return false } -/** - * @param {Set} polyfills - */ -function recordAndRemovePolyfillBabelPlugin(polyfills) { - return ({ types: t }) => ({ +function recordAndRemovePolyfillBabelPlugin( + polyfills: Set +): BabelPlugin { + return ({ types: t }): BabelPlugin => ({ name: 'vite-remove-polyfill-import', post({ path }) { path.get('body').forEach((p) => { if (t.isImportDeclaration(p)) { + // @ts-expect-error polyfills.add(p.node.source.value) p.remove() } @@ -671,8 +654,8 @@ function recordAndRemovePolyfillBabelPlugin(polyfills) { }) } -function replaceLegacyEnvBabelPlugin() { - return ({ types: t }) => ({ +function replaceLegacyEnvBabelPlugin(): BabelPlugin { + return ({ types: t }): BabelPlugin => ({ name: 'vite-replace-env-legacy', visitor: { Identifier(path) { @@ -684,8 +667,8 @@ function replaceLegacyEnvBabelPlugin() { }) } -function wrapIIFEBabelPlugin() { - return ({ types: t, template }) => { +function wrapIIFEBabelPlugin(): BabelPlugin { + return ({ types: t, template }): BabelPlugin => { const buildIIFE = template(';(function(){%%body%%})();') return { @@ -700,13 +683,11 @@ function wrapIIFEBabelPlugin() { } } -module.exports = viteLegacyPlugin - -viteLegacyPlugin.default = viteLegacyPlugin - -viteLegacyPlugin.cspHashes = [ +export const cspHashes = [ createHash('sha256').update(safari10NoModuleFix).digest('base64'), createHash('sha256').update(systemJSInlineCode).digest('base64'), createHash('sha256').update(detectDynamicImportCode).digest('base64'), createHash('sha256').update(dynamicFallbackInlineCode).digest('base64') ] + +export default viteLegacyPlugin diff --git a/packages/plugin-legacy/index.d.ts b/packages/plugin-legacy/src/types.ts similarity index 75% rename from packages/plugin-legacy/index.d.ts rename to packages/plugin-legacy/src/types.ts index 8f340f11cba074..3ac7c1b6ea8660 100644 --- a/packages/plugin-legacy/index.d.ts +++ b/packages/plugin-legacy/src/types.ts @@ -1,5 +1,3 @@ -import type { Plugin } from 'vite' - export interface Options { /** * default: 'defaults' @@ -27,9 +25,3 @@ export interface Options { */ externalSystemJS?: boolean } - -declare function createPlugin(options?: Options): Plugin - -export default createPlugin - -export const cspHashes: string[] diff --git a/packages/plugin-legacy/tsconfig.json b/packages/plugin-legacy/tsconfig.json new file mode 100644 index 00000000000000..c20adf0da4b86f --- /dev/null +++ b/packages/plugin-legacy/tsconfig.json @@ -0,0 +1,19 @@ +{ + "include": ["src"], + "exclude": ["**/*.spec.ts"], + "compilerOptions": { + "outDir": "dist", + "target": "ES2018", + "module": "CommonJS", + "moduleResolution": "Node", + "strict": true, + "declaration": true, + "sourceMap": true, + "noUnusedLocals": true, + "esModuleInterop": true, + "paths": { + "types/*": ["../vite/types/*"], + "vite": ["../vite/src/node/index.js"] + } + } +} diff --git a/packages/plugin-react/api-extractor.json b/packages/plugin-react/api-extractor.json deleted file mode 100644 index df6d6f9a492430..00000000000000 --- a/packages/plugin-react/api-extractor.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - - "projectFolder": ".", - - "mainEntryPointFilePath": "./temp/index.d.ts", - - "dtsRollup": { - "enabled": true, - "untrimmedFilePath": "./dist/index.d.ts" - }, - - "apiReport": { - "enabled": false - }, - - "docModel": { - "enabled": false - }, - - "tsdocMetadata": { - "enabled": false - }, - - "messages": { - "compilerMessageReporting": { - "default": { - "logLevel": "warning" - } - }, - - "extractorMessageReporting": { - "default": { - "logLevel": "warning", - "addToApiReportFile": true - }, - - "ae-missing-release-tag": { - "logLevel": "none" - } - }, - - "tsdocMessageReporting": { - "default": { - "logLevel": "warning" - }, - - "tsdoc-undefined-tag": { - "logLevel": "none" - } - } - } -} diff --git a/packages/plugin-react/build.config.ts b/packages/plugin-react/build.config.ts new file mode 100644 index 00000000000000..61165722c633a6 --- /dev/null +++ b/packages/plugin-react/build.config.ts @@ -0,0 +1,12 @@ +import { defineBuildConfig } from 'unbuild' + +export default defineBuildConfig({ + entries: ['src/index'], + externals: ['vite'], + clean: true, + declaration: true, + rollup: { + emitCJS: true, + inlineDependencies: true + } +}) diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index ca8b1d78752b69..deed747475b175 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -10,15 +10,21 @@ "dist", "src" ], - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "./dist/index.cjs", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" + } + }, "scripts": { - "dev": "tsc -p . -w --incremental", - "build": "rimraf dist && run-s build-bundle build-types", - "build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@babel/* --external:@rollup/* --external:resolve --external:react-refresh/* --outfile=dist/index.js && npm run patch-dist", - "patch-dist": "ts-node ../../scripts/patchEsbuildDist.ts dist/index.js viteReact", - "build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp", - "prepublishOnly": "(cd ../vite && npm run build) && npm run build" + "dev": "unbuild --stub", + "build": "unbuild && pnpm run patch-cjs", + "patch-cjs": "ts-node ../../scripts/patchCJS.ts", + "prepublishOnly": "npm run build" }, "engines": { "node": ">=14.6.0" @@ -44,5 +50,8 @@ }, "peerDependencies": { "vite": "^2.0.0" + }, + "devDependencies": { + "vite": "workspace:*" } } diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index 4ca3e0d371f6c9..df97899522605f 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -2,7 +2,7 @@ import type { ParserOptions, TransformOptions, types as t } from '@babel/core' import * as babel from '@babel/core' import { createFilter } from '@rollup/pluginutils' import resolve from 'resolve' -import type { Plugin, PluginOption } from 'vite' +import type { Plugin, PluginOption, ResolvedConfig } from 'vite' import { addRefreshWrapper, isRefreshBoundary, @@ -149,7 +149,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] { }, async transform(code, id, options) { const ssr = typeof options === 'boolean' ? options : options?.ssr === true - // File extension could be mocked/overriden in querystring. + // File extension could be mocked/overridden in querystring. const [filepath, querystring = ''] = id.split('?') const [extension = ''] = querystring.match(fileExtensionRE) || @@ -368,10 +368,3 @@ viteReact.preambleCode = preambleCode function loadPlugin(path: string): Promise { return import(path).then((module) => module.default || module) } - -// overwrite for cjs require('...')() usage -// The following lines are inserted by scripts/patchEsbuildDist.ts, -// this doesn't bundle correctly after esbuild 0.14.4 -// -// module.exports = viteReact -// viteReact['default'] = viteReact diff --git a/packages/plugin-react/src/jsx-runtime/restore-jsx.ts b/packages/plugin-react/src/jsx-runtime/restore-jsx.ts index dbc2218d2343ff..2c49f508c8b5be 100644 --- a/packages/plugin-react/src/jsx-runtime/restore-jsx.ts +++ b/packages/plugin-react/src/jsx-runtime/restore-jsx.ts @@ -7,6 +7,18 @@ let babelRestoreJSX: Promise | undefined const jsxNotFound: RestoredJSX = [null, false] +async function getBabelRestoreJSX() { + if (!babelRestoreJSX) + babelRestoreJSX = import('./babel-restore-jsx').then((r) => { + const fn = r.default + if ('default' in fn) + // @ts-expect-error + return fn.default + return fn + }) + return babelRestoreJSX +} + /** Restore JSX from `React.createElement` calls */ export async function restoreJSX( babel: typeof babelCore, @@ -56,8 +68,6 @@ export async function restoreJSX( return jsxNotFound } - babelRestoreJSX ||= import('./babel-restore-jsx') - const result = await babel.transformAsync(code, { babelrc: false, configFile: false, @@ -67,8 +77,7 @@ export async function restoreJSX( parserOpts: { plugins: ['jsx'] }, - // @ts-ignore - plugins: [(await babelRestoreJSX).default] + plugins: [await getBabelRestoreJSX()] }) return [result?.ast, isCommonJS] diff --git a/packages/plugin-react/tsconfig.json b/packages/plugin-react/tsconfig.json index f025178f8cb4a4..c20adf0da4b86f 100644 --- a/packages/plugin-react/tsconfig.json +++ b/packages/plugin-react/tsconfig.json @@ -10,6 +10,10 @@ "declaration": true, "sourceMap": true, "noUnusedLocals": true, - "esModuleInterop": true + "esModuleInterop": true, + "paths": { + "types/*": ["../vite/types/*"], + "vite": ["../vite/src/node/index.js"] + } } } diff --git a/packages/plugin-vue-jsx/build.config.ts b/packages/plugin-vue-jsx/build.config.ts new file mode 100644 index 00000000000000..6dcf1a5a2dc0b3 --- /dev/null +++ b/packages/plugin-vue-jsx/build.config.ts @@ -0,0 +1,10 @@ +import { defineBuildConfig } from 'unbuild' + +export default defineBuildConfig({ + entries: ['src/index'], + clean: true, + declaration: true, + rollup: { + emitCJS: true + } +}) diff --git a/packages/plugin-vue-jsx/index.d.ts b/packages/plugin-vue-jsx/index.d.ts deleted file mode 100644 index a702c09baa8417..00000000000000 --- a/packages/plugin-vue-jsx/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Plugin } from 'vite' -import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx' -import type { FilterPattern } from '@rollup/pluginutils' - -declare interface FilterOptions { - include?: FilterPattern - exclude?: FilterPattern -} - -declare function createPlugin( - options?: VueJSXPluginOptions & FilterOptions & { babelPlugins?: any[] } -): Plugin - -export default createPlugin diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index f62a6cd98a67ee..6dbd11389eab5b 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -4,11 +4,24 @@ "license": "MIT", "author": "Evan You", "files": [ - "index.js", - "index.d.ts" + "dist" ], - "main": "index.js", - "types": "index.d.ts", + "main": "./dist/index.cjs", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" + } + }, + "scripts": { + "dev": "unbuild --stub", + "build": "unbuild && pnpm run patch-cjs", + "patch-cjs": "ts-node ../../scripts/patchCJS.ts", + "prepublishOnly": "npm run build" + }, "engines": { "node": ">=14.6.0" }, @@ -28,6 +41,9 @@ "@rollup/pluginutils": "^4.2.1", "@vue/babel-plugin-jsx": "^1.1.1" }, + "devDependencies": { + "vite": "workspace:*" + }, "peerDependencies": { "vite": "^2.0.0", "vue": "^3.0.0" diff --git a/packages/plugin-vue-jsx/index.js b/packages/plugin-vue-jsx/src/index.ts similarity index 81% rename from packages/plugin-vue-jsx/index.js rename to packages/plugin-vue-jsx/src/index.ts index 41fcb911c461b1..e23f0031b69bd1 100644 --- a/packages/plugin-vue-jsx/index.js +++ b/packages/plugin-vue-jsx/src/index.ts @@ -1,10 +1,16 @@ -// @ts-check -const babel = require('@babel/core') -const jsx = require('@vue/babel-plugin-jsx') -const importMeta = require('@babel/plugin-syntax-import-meta') -const { createFilter, normalizePath } = require('@rollup/pluginutils') -const { createHash } = require('crypto') -const path = require('path') +import { createHash } from 'crypto' +import path from 'path' +import type { types } from '@babel/core' +import babel from '@babel/core' +import jsx from '@vue/babel-plugin-jsx' +// @ts-expect-error missing type +import importMeta from '@babel/plugin-syntax-import-meta' +import { createFilter, normalizePath } from '@rollup/pluginutils' +import type { ComponentOptions } from 'vue' +import type { Plugin } from 'vite' +import type { Options } from './types' + +export * from './types' const ssrRegisterHelperId = '/__vue-jsx-ssr-register-helper' const ssrRegisterHelperCode = @@ -14,10 +20,8 @@ const ssrRegisterHelperCode = /** * This function is serialized with toString() and evaluated as a virtual * module during SSR - * @param {import('vue').ComponentOptions} comp - * @param {string} filename */ -function ssrRegisterHelper(comp, filename) { +function ssrRegisterHelper(comp: ComponentOptions, filename: string) { const setup = comp.setup comp.setup = (props, ctx) => { // @ts-ignore @@ -29,17 +33,7 @@ function ssrRegisterHelper(comp, filename) { } } -/** - * @typedef { import('@rollup/pluginutils').FilterPattern} FilterPattern - * @typedef { { include?: FilterPattern, exclude?: FilterPattern, babelPlugins?: any[] } } CommonOptions - */ - -/** - * - * @param {import('@vue/babel-plugin-jsx').VueJSXPluginOptions & CommonOptions} options - * @returns {import('vite').Plugin} - */ -function vueJsxPlugin(options = {}) { +function vueJsxPlugin(options: Options = {}): Plugin { let root = '' let needHmr = false let needSourceMap = true @@ -110,31 +104,28 @@ function vueJsxPlugin(options = {}) { sourceMaps: needSourceMap, sourceFileName: id, configFile: false - }) + })! if (!ssr && !needHmr) { + if (!result.code) return return { code: result.code, map: result.map } } + interface HotComponent { + local: string + exported: string + id: string + } + // check for hmr injection - /** - * @type {{ name: string }[]} - */ - const declaredComponents = [] - /** - * @type {{ - * local: string, - * exported: string, - * id: string, - * }[]} - */ - const hotComponents = [] + const declaredComponents: { name: string }[] = [] + const hotComponents: HotComponent[] = [] let hasDefault = false - for (const node of result.ast.program.body) { + for (const node of result.ast!.program.body) { if (node.type === 'VariableDeclaration') { const names = parseComponentDecls(node, code) if (names.length) { @@ -204,7 +195,7 @@ function vueJsxPlugin(options = {}) { if (hotComponents.length) { if (hasDefault && (needHmr || ssr)) { result.code = - result.code.replace( + result.code!.replace( /export default defineComponent/g, `const __default__ = defineComponent` ) + `\nexport default __default__` @@ -239,6 +230,7 @@ function vueJsxPlugin(options = {}) { } } + if (!result.code) return return { code: result.code, map: result.map @@ -248,11 +240,7 @@ function vueJsxPlugin(options = {}) { } } -/** - * @param {import('@babel/core').types.VariableDeclaration} node - * @param {string} source - */ -function parseComponentDecls(node, source) { +function parseComponentDecls(node: types.VariableDeclaration, source: string) { const names = [] for (const decl of node.declarations) { if (decl.id.type === 'Identifier' && isDefineComponentCall(decl.init)) { @@ -264,10 +252,7 @@ function parseComponentDecls(node, source) { return names } -/** - * @param {import('@babel/core').types.Node} node - */ -function isDefineComponentCall(node) { +function isDefineComponentCall(node?: types.Node | null) { return ( node && node.type === 'CallExpression' && @@ -276,13 +261,8 @@ function isDefineComponentCall(node) { ) } -/** - * @param {string} text - * @returns {string} - */ -function getHash(text) { +function getHash(text: string) { return createHash('sha256').update(text).digest('hex').substring(0, 8) } -module.exports = vueJsxPlugin -vueJsxPlugin.default = vueJsxPlugin +export default vueJsxPlugin diff --git a/packages/plugin-vue-jsx/src/types.ts b/packages/plugin-vue-jsx/src/types.ts new file mode 100644 index 00000000000000..aa30b7435329f4 --- /dev/null +++ b/packages/plugin-vue-jsx/src/types.ts @@ -0,0 +1,10 @@ +import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx' +import type { FilterPattern } from '@rollup/pluginutils' + +export interface FilterOptions { + include?: FilterPattern + exclude?: FilterPattern +} + +export type Options = VueJSXPluginOptions & + FilterOptions & { babelPlugins?: any[] } diff --git a/packages/plugin-vue-jsx/tsconfig.json b/packages/plugin-vue-jsx/tsconfig.json new file mode 100644 index 00000000000000..c20adf0da4b86f --- /dev/null +++ b/packages/plugin-vue-jsx/tsconfig.json @@ -0,0 +1,19 @@ +{ + "include": ["src"], + "exclude": ["**/*.spec.ts"], + "compilerOptions": { + "outDir": "dist", + "target": "ES2018", + "module": "CommonJS", + "moduleResolution": "Node", + "strict": true, + "declaration": true, + "sourceMap": true, + "noUnusedLocals": true, + "esModuleInterop": true, + "paths": { + "types/*": ["../vite/types/*"], + "vite": ["../vite/src/node/index.js"] + } + } +} diff --git a/packages/plugin-vue/api-extractor.json b/packages/plugin-vue/api-extractor.json deleted file mode 100644 index df6d6f9a492430..00000000000000 --- a/packages/plugin-vue/api-extractor.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - - "projectFolder": ".", - - "mainEntryPointFilePath": "./temp/index.d.ts", - - "dtsRollup": { - "enabled": true, - "untrimmedFilePath": "./dist/index.d.ts" - }, - - "apiReport": { - "enabled": false - }, - - "docModel": { - "enabled": false - }, - - "tsdocMetadata": { - "enabled": false - }, - - "messages": { - "compilerMessageReporting": { - "default": { - "logLevel": "warning" - } - }, - - "extractorMessageReporting": { - "default": { - "logLevel": "warning", - "addToApiReportFile": true - }, - - "ae-missing-release-tag": { - "logLevel": "none" - } - }, - - "tsdocMessageReporting": { - "default": { - "logLevel": "warning" - }, - - "tsdoc-undefined-tag": { - "logLevel": "none" - } - } - } -} diff --git a/packages/plugin-vue/build.config.ts b/packages/plugin-vue/build.config.ts new file mode 100644 index 00000000000000..4f9d811af8436a --- /dev/null +++ b/packages/plugin-vue/build.config.ts @@ -0,0 +1,12 @@ +import { defineBuildConfig } from 'unbuild' + +export default defineBuildConfig({ + entries: ['src/index'], + externals: ['vite', 'vue/compiler-sfc', '@vue/compiler-sfc'], + clean: true, + declaration: true, + rollup: { + emitCJS: true, + inlineDependencies: true + } +}) diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 22ce5ad55ab68b..6a08c1dff70bdc 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -6,17 +6,21 @@ "files": [ "dist" ], - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "./dist/index.cjs", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" + } + }, "scripts": { - "dev": "rimraf dist && run-p dev-types dev-watch", - "dev-types": "tsc -p . -w --incremental --emitDeclarationOnly", - "dev-watch": "esbuild src/index.ts --watch --bundle --platform=node --target=node12 --external:@vue/compiler-sfc --external:vue/compiler-sfc --external:vite --outfile=dist/index.js", - "build": "rimraf dist && run-s build-bundle build-types", - "build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@vue/compiler-sfc --external:vue/compiler-sfc --external:vite --outfile=dist/index.js & npm run patch-dist", - "patch-dist": "ts-node ../../scripts/patchEsbuildDist.ts dist/index.js vuePlugin", - "build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp", - "prepublishOnly": "(cd ../vite && npm run build) && npm run build" + "dev": "unbuild --stub", + "build": "unbuild && pnpm run patch-cjs", + "patch-cjs": "ts-node ../../scripts/patchCJS.ts", + "prepublishOnly": "npm run build" }, "engines": { "node": ">=14.6.0" @@ -40,6 +44,7 @@ "rollup": "^2.72.1", "slash": "^4.0.0", "source-map": "^0.6.1", - "vue": "^3.2.33" + "vue": "^3.2.33", + "vite": "workspace:*" } } diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index 7bdf63b700fa15..6526f941319849 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -18,7 +18,8 @@ import { transformTemplateAsModule } from './template' import { transformStyle } from './style' import { EXPORT_HELPER_ID, helperCode } from './helper' -export { parseVueRequest, VueQuery } from './utils/query' +export { parseVueRequest } from './utils/query' +export type { VueQuery } from './utils/query' export interface Options { include?: string | RegExp | (string | RegExp)[] @@ -250,10 +251,3 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { } } } - -// overwrite for cjs require('...')() usage -// The following lines are inserted by scripts/patchEsbuildDist.ts, -// this doesn't bundle correctly after esbuild 0.14.4 -// -// module.exports = vuePlugin -// vuePlugin['default'] = vuePlugin diff --git a/packages/plugin-vue/tsconfig.json b/packages/plugin-vue/tsconfig.json index fa388fd0d9888f..6165780e190e25 100644 --- a/packages/plugin-vue/tsconfig.json +++ b/packages/plugin-vue/tsconfig.json @@ -14,9 +14,8 @@ "esModuleInterop": true, "baseUrl": ".", "paths": { - // vite typings uses custom paths that is patched into relative paths during build - // this is a shim that makes even dev-time vite typings work for plugin-vue - "types/*": ["../vite/types/*"] + "types/*": ["../vite/types/*"], + "vite": ["../vite/src/node/index.js"] } } } diff --git a/packages/vite/package.json b/packages/vite/package.json index b4a9147951bf7a..7fa8f652b56729 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -30,11 +30,10 @@ "homepage": "https://github.com/vitejs/vite/tree/main/#readme", "scripts": { "dev": "rimraf dist && rollup -c -w", - "build": "rimraf dist && npm run lint && run-s build-bundle build-types", + "build": "rimraf dist && run-s build-bundle build-types", "build-bundle": "rollup -c", "build-types": "run-s build-temp-types patch-types roll-types", "build-temp-types": "tsc --emitDeclarationOnly --outDir temp/node -p src/node", - "ci-build": "rimraf dist && run-s build-bundle build-types", "patch-types": "ts-node scripts/patchTypes.ts", "roll-types": "api-extractor run && rimraf temp", "lint": "eslint --ext .ts src/**", diff --git a/playground/react-emotion/vite.config.ts b/playground/react-emotion/vite.config.ts index 9364c8f616c2f5..197e04f870d835 100644 --- a/playground/react-emotion/vite.config.ts +++ b/playground/react-emotion/vite.config.ts @@ -1,7 +1,7 @@ import react from '@vitejs/plugin-react' -import type { UserConfig } from 'vite' +import { defineConfig } from 'vite' -const config: UserConfig = { +export default defineConfig({ plugins: [ react({ jsxImportSource: '@emotion/react', @@ -15,6 +15,4 @@ const config: UserConfig = { // to make tests faster minify: false } -} - -export default config +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 56e40b2c545599..b7c68fc69d5fda 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,6 +12,7 @@ importers: specifiers: '@microsoft/api-extractor': ^7.23.1 '@types/babel__core': ^7.1.19 + '@types/babel__standalone': ^7.1.4 '@types/convert-source-map': ^1.5.2 '@types/cross-spawn': ^6.0.2 '@types/debug': ^4.1.7 @@ -57,6 +58,7 @@ importers: sirv: ^2.0.2 ts-node: ^10.7.0 typescript: ^4.6.4 + unbuild: ^0.7.4 vite: workspace:* vitepress: ^0.22.4 vitest: ^0.12.4 @@ -64,6 +66,7 @@ importers: devDependencies: '@microsoft/api-extractor': 7.23.2 '@types/babel__core': 7.1.19 + '@types/babel__standalone': 7.1.4 '@types/convert-source-map': 1.5.2 '@types/cross-spawn': 6.0.2 '@types/debug': 4.1.7 @@ -109,6 +112,7 @@ importers: sirv: 2.0.2 ts-node: 10.7.0_sm5zkxj4s52nbddwl76qwfh6ya typescript: 4.6.4 + unbuild: 0.7.4 vite: link:packages/vite vitepress: 0.22.4 vitest: 0.12.4 @@ -126,17 +130,22 @@ importers: packages/plugin-legacy: specifiers: + '@babel/core': ^7.17.10 '@babel/standalone': ^7.17.11 core-js: ^3.22.4 magic-string: ^0.26.1 regenerator-runtime: ^0.13.9 systemjs: ^6.12.1 + vite: workspace:* dependencies: '@babel/standalone': 7.17.11 core-js: 3.22.5 magic-string: 0.26.1 regenerator-runtime: 0.13.9 systemjs: 6.12.1 + devDependencies: + '@babel/core': 7.17.10 + vite: link:../vite packages/plugin-react: specifiers: @@ -148,6 +157,7 @@ importers: '@rollup/pluginutils': ^4.2.1 react-refresh: ^0.13.0 resolve: ^1.22.0 + vite: workspace:* dependencies: '@babel/core': 7.17.10 '@babel/plugin-transform-react-jsx': 7.17.3_@babel+core@7.17.10 @@ -157,6 +167,8 @@ importers: '@rollup/pluginutils': 4.2.1 react-refresh: 0.13.0 resolve: 1.22.0 + devDependencies: + vite: link:../vite packages/plugin-vue: specifiers: @@ -165,6 +177,7 @@ importers: rollup: ^2.72.1 slash: ^4.0.0 source-map: ^0.6.1 + vite: workspace:* vue: ^3.2.33 devDependencies: '@rollup/pluginutils': 4.2.1 @@ -172,6 +185,7 @@ importers: rollup: 2.72.1 slash: 4.0.0 source-map: 0.6.1 + vite: link:../vite vue: 3.2.33 packages/plugin-vue-jsx: @@ -181,12 +195,15 @@ importers: '@babel/plugin-transform-typescript': ^7.16.8 '@rollup/pluginutils': ^4.2.1 '@vue/babel-plugin-jsx': ^1.1.1 + vite: workspace:* dependencies: '@babel/core': 7.17.10 '@babel/plugin-syntax-import-meta': 7.10.4_@babel+core@7.17.10 '@babel/plugin-transform-typescript': 7.16.8_@babel+core@7.17.10 '@rollup/pluginutils': 4.2.1 '@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.17.10 + devDependencies: + vite: link:../vite packages/vite: specifiers: @@ -1109,7 +1126,6 @@ packages: /@babel/compat-data/7.17.10: resolution: {integrity: sha512-GZt/TCsG70Ms19gfZO1tM4CVnXsPgEPBCpJu+Qz3L0LUDsY5nZqFZglIoPC1kIYOtNBZlrnFT+klg12vFGZXrw==} engines: {node: '>=6.9.0'} - dev: false /@babel/core/7.17.10: resolution: {integrity: sha512-liKoppandF3ZcBnIYFjfSDHZLKdLHGJRkoWtG8zQyGJBQfIYobpnVGI5+pLBNtS6psFLDzyq8+h5HiVljW9PNA==} @@ -1132,7 +1148,6 @@ packages: semver: 6.3.0 transitivePeerDependencies: - supports-color - dev: false /@babel/generator/7.17.10: resolution: {integrity: sha512-46MJZZo9y3o4kmhBVc7zW7i8dtR1oIK/sdO5NcfcZRhTGYi+KKJRtHNgsU6c4VUcJmUNV/LQdebD/9Dlv4K+Tg==} @@ -1141,7 +1156,6 @@ packages: '@babel/types': 7.17.10 '@jridgewell/gen-mapping': 0.1.1 jsesc: 2.5.2 - dev: false /@babel/helper-annotate-as-pure/7.16.7: resolution: {integrity: sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw==} @@ -1161,7 +1175,6 @@ packages: '@babel/helper-validator-option': 7.16.7 browserslist: 4.20.3 semver: 6.3.0 - dev: false /@babel/helper-create-class-features-plugin/7.17.9_@babel+core@7.17.10: resolution: {integrity: sha512-kUjip3gruz6AJKOq5i3nC6CoCEEF/oHH3cp6tOZhB+IyyyPyW0g1Gfsxn3mkk6S08pIA2y8GQh609v9G/5sHVQ==} @@ -1186,7 +1199,6 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.17.10 - dev: false /@babel/helper-function-name/7.17.9: resolution: {integrity: sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg==} @@ -1194,14 +1206,12 @@ packages: dependencies: '@babel/template': 7.16.7 '@babel/types': 7.17.10 - dev: false /@babel/helper-hoist-variables/7.16.7: resolution: {integrity: sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==} engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.17.10 - dev: false /@babel/helper-member-expression-to-functions/7.17.7: resolution: {integrity: sha512-thxXgnQ8qQ11W2wVUObIqDL4p148VMxkt5T/qpN5k2fboRyzFGFmKsTGViquyM5QHKUy48OZoca8kw4ajaDPyw==} @@ -1230,7 +1240,6 @@ packages: '@babel/types': 7.17.10 transitivePeerDependencies: - supports-color - dev: false /@babel/helper-optimise-call-expression/7.16.7: resolution: {integrity: sha512-EtgBhg7rd/JcnpZFXpBy0ze1YRfdm7BnBX4uKMBd3ixa3RGAE002JZB66FJyNH7g0F38U05pXmA5P8cBh7z+1w==} @@ -1261,14 +1270,12 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.17.10 - dev: false /@babel/helper-split-export-declaration/7.16.7: resolution: {integrity: sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==} engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.17.10 - dev: false /@babel/helper-validator-identifier/7.16.7: resolution: {integrity: sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==} @@ -1277,7 +1284,6 @@ packages: /@babel/helper-validator-option/7.16.7: resolution: {integrity: sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==} engines: {node: '>=6.9.0'} - dev: false /@babel/helpers/7.17.9: resolution: {integrity: sha512-cPCt915ShDWUEzEp3+UNRktO2n6v49l5RSnG9M5pS24hA+2FAc5si+Pn1i4VVbQQ+jh+bIZhPFQOJOzbrOYY1Q==} @@ -1288,7 +1294,6 @@ packages: '@babel/types': 7.17.10 transitivePeerDependencies: - supports-color - dev: false /@babel/highlight/7.17.9: resolution: {integrity: sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==} @@ -1428,7 +1433,6 @@ packages: /@babel/standalone/7.17.11: resolution: {integrity: sha512-47wVYBeTktYHwtzlFuK7qqV/H5X6mU4MUNqpQ9iiJOqnP8rWL0eX0GWLKRsv8D8suYzhuS1K/dtwgGr+26U7Gg==} engines: {node: '>=6.9.0'} - dev: false /@babel/template/7.16.7: resolution: {integrity: sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==} @@ -1437,7 +1441,6 @@ packages: '@babel/code-frame': 7.16.7 '@babel/parser': 7.17.10 '@babel/types': 7.17.10 - dev: false /@babel/traverse/7.17.10: resolution: {integrity: sha512-VmbrTHQteIdUUQNTb+zE12SHS/xQVIShmBPhlNP12hD5poF2pbITW1Z4172d03HegaQWhLffdkRJYtAzp0AGcw==} @@ -1455,7 +1458,6 @@ packages: globals: 11.12.0 transitivePeerDependencies: - supports-color - dev: false /@babel/types/7.17.10: resolution: {integrity: sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A==} @@ -1834,6 +1836,16 @@ packages: rollup: 2.72.1 dev: true + /@rollup/plugin-replace/4.0.0_rollup@2.72.1: + resolution: {integrity: sha512-+rumQFiaNac9y64OHtkHGmdjm7us9bo1PlbgQfdihQtuNxzjpaB064HbRnewUOggLQxVCCyINfStkgmBeQpv1g==} + peerDependencies: + rollup: ^1.20.0 || ^2.0.0 + dependencies: + '@rollup/pluginutils': 3.1.0_rollup@2.72.1 + magic-string: 0.25.9 + rollup: 2.72.1 + dev: true + /@rollup/plugin-typescript/8.3.2_rollup@2.72.1+tslib@2.4.0: resolution: {integrity: sha512-MtgyR5LNHZr3GyN0tM7gNO9D0CS+Y+vflS4v/PHmrX17JCkHUYKvQ5jN5o3cz1YKllM3duXUqu3yOHwMPUxhDg==} engines: {node: '>=8.0.0'} @@ -1937,6 +1949,14 @@ packages: '@babel/types': 7.17.10 dev: true + /@types/babel__standalone/7.1.4: + resolution: {integrity: sha512-HijIDmcNl3Wmo0guqjYkQvMzyRCM6zMCkYcdG8f+2X7mPBNa9ikSeaQlWs2Yg18KN1klOJzyupX5BPOf+7ahaw==} + dependencies: + '@babel/core': 7.17.10 + transitivePeerDependencies: + - supports-color + dev: true + /@types/babel__template/7.4.1: resolution: {integrity: sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==} dependencies: @@ -2686,7 +2706,6 @@ packages: escalade: 3.1.1 node-releases: 2.0.4 picocolors: 1.0.0 - dev: false /buffer-crc32/0.2.13: resolution: {integrity: sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=} @@ -2759,7 +2778,6 @@ packages: /caniuse-lite/1.0.30001339: resolution: {integrity: sha512-Es8PiVqCe+uXdms0Gu5xP5PF2bxLR7OBp3wUzUnuO7OHzhOfCyg3hdiGWVPVxhiuniOzng+hTc1u3fEQ0TlkSQ==} - dev: false /chai/4.3.6: resolution: {integrity: sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==} @@ -2789,6 +2807,11 @@ packages: ansi-styles: 4.3.0 supports-color: 7.2.0 + /chalk/5.0.1: + resolution: {integrity: sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + dev: true + /character-parser/2.2.0: resolution: {integrity: sha1-x84o821LzZdE5f/CxfzeHHMmH8A=} dependencies: @@ -2939,6 +2962,7 @@ packages: /commander/2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + requiresBuild: true dev: true /commander/7.2.0: @@ -3017,6 +3041,10 @@ packages: - supports-color dev: true + /consola/2.15.3: + resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==} + dev: true + /console-control-strings/1.1.0: resolution: {integrity: sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=} dev: false @@ -3467,6 +3495,14 @@ packages: resolution: {integrity: sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=} dev: false + /defu/5.0.1: + resolution: {integrity: sha512-EPS1carKg+dkEVy3qNTqIdp2qV7mUP08nIsupfwQpz++slCVRw7qbQyWvSTig+kFPwz2XXp5/kIIkH+CwrJKkQ==} + dev: true + + /defu/6.0.0: + resolution: {integrity: sha512-t2MZGLf1V2rV4VBZbWIaXKdX/mUcYW0n2znQZoADBkGGxYL8EWqCuCZBmJPJ/Yy9fofJkyuuSuo5GSwo0XdEgw==} + dev: true + /delegate/3.2.0: resolution: {integrity: sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==} dev: false @@ -3581,7 +3617,6 @@ packages: /electron-to-chromium/1.4.137: resolution: {integrity: sha512-0Rcpald12O11BUogJagX3HsCN3FE83DSqWjgXoHo5a72KUKMSfI39XBgJpgNNxS9fuGzytaFjE06kZkiVFy2qA==} - dev: false /emoji-regex/8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -3653,6 +3688,10 @@ packages: resolution: {integrity: sha512-+7IwY/kiGAacQfY+YBhKMvEmyAJnw5grTUgjG85Pe7vcUI/6b7pZjZG8nQ7+48YhzEAEqrEgD2dCz/JIK+AYvw==} dev: true + /es-module-lexer/0.9.3: + resolution: {integrity: sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==} + dev: true + /es-shim-unscopables/1.0.0: resolution: {integrity: sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==} dependencies: @@ -3699,6 +3738,14 @@ packages: requiresBuild: true optional: true + /esbuild-android-arm64/0.13.15: + resolution: {integrity: sha512-m602nft/XXeO8YQPUDVoHfjyRVPdPgjyyXOxZ44MK/agewFFkPa8tUo6lAzSWh5Ui5PB4KR9UIFTSBKh/RrCmg==} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /esbuild-android-arm64/0.14.38: resolution: {integrity: sha512-L2NgQRWuHFI89IIZIlpAcINy9FvBk6xFVZ7xGdOwIm8VyhX1vNCEqUJO3DPSSy945Gzdg98cxtNt8Grv1CsyhA==} engines: {node: '>=12'} @@ -3707,6 +3754,14 @@ packages: requiresBuild: true optional: true + /esbuild-darwin-64/0.13.15: + resolution: {integrity: sha512-ihOQRGs2yyp7t5bArCwnvn2Atr6X4axqPpEdCFPVp7iUj4cVSdisgvEKdNR7yH3JDjW6aQDw40iQFoTqejqxvQ==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /esbuild-darwin-64/0.14.38: resolution: {integrity: sha512-5JJvgXkX87Pd1Og0u/NJuO7TSqAikAcQQ74gyJ87bqWRVeouky84ICoV4sN6VV53aTW+NE87qLdGY4QA2S7KNA==} engines: {node: '>=12'} @@ -3715,6 +3770,14 @@ packages: requiresBuild: true optional: true + /esbuild-darwin-arm64/0.13.15: + resolution: {integrity: sha512-i1FZssTVxUqNlJ6cBTj5YQj4imWy3m49RZRnHhLpefFIh0To05ow9DTrXROTE1urGTQCloFUXTX8QfGJy1P8dQ==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /esbuild-darwin-arm64/0.14.38: resolution: {integrity: sha512-eqF+OejMI3mC5Dlo9Kdq/Ilbki9sQBw3QlHW3wjLmsLh+quNfHmGMp3Ly1eWm981iGBMdbtSS9+LRvR2T8B3eQ==} engines: {node: '>=12'} @@ -3723,6 +3786,14 @@ packages: requiresBuild: true optional: true + /esbuild-freebsd-64/0.13.15: + resolution: {integrity: sha512-G3dLBXUI6lC6Z09/x+WtXBXbOYQZ0E8TDBqvn7aMaOCzryJs8LyVXKY4CPnHFXZAbSwkCbqiPuSQ1+HhrNk7EA==} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /esbuild-freebsd-64/0.14.38: resolution: {integrity: sha512-epnPbhZUt93xV5cgeY36ZxPXDsQeO55DppzsIgWM8vgiG/Rz+qYDLmh5ts3e+Ln1wA9dQ+nZmVHw+RjaW3I5Ig==} engines: {node: '>=12'} @@ -3731,6 +3802,14 @@ packages: requiresBuild: true optional: true + /esbuild-freebsd-arm64/0.13.15: + resolution: {integrity: sha512-KJx0fzEDf1uhNOZQStV4ujg30WlnwqUASaGSFPhznLM/bbheu9HhqZ6mJJZM32lkyfGJikw0jg7v3S0oAvtvQQ==} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /esbuild-freebsd-arm64/0.14.38: resolution: {integrity: sha512-/9icXUYJWherhk+y5fjPI5yNUdFPtXHQlwP7/K/zg8t8lQdHVj20SqU9/udQmeUo5pDFHMYzcEFfJqgOVeKNNQ==} engines: {node: '>=12'} @@ -3739,6 +3818,14 @@ packages: requiresBuild: true optional: true + /esbuild-linux-32/0.13.15: + resolution: {integrity: sha512-ZvTBPk0YWCLMCXiFmD5EUtB30zIPvC5Itxz0mdTu/xZBbbHJftQgLWY49wEPSn2T/TxahYCRDWun5smRa0Tu+g==} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-32/0.14.38: resolution: {integrity: sha512-QfgfeNHRFvr2XeHFzP8kOZVnal3QvST3A0cgq32ZrHjSMFTdgXhMhmWdKzRXP/PKcfv3e2OW9tT9PpcjNvaq6g==} engines: {node: '>=12'} @@ -3747,6 +3834,14 @@ packages: requiresBuild: true optional: true + /esbuild-linux-64/0.13.15: + resolution: {integrity: sha512-eCKzkNSLywNeQTRBxJRQ0jxRCl2YWdMB3+PkWFo2BBQYC5mISLIVIjThNtn6HUNqua1pnvgP5xX0nHbZbPj5oA==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-64/0.14.38: resolution: {integrity: sha512-uuZHNmqcs+Bj1qiW9k/HZU3FtIHmYiuxZ/6Aa+/KHb/pFKr7R3aVqvxlAudYI9Fw3St0VCPfv7QBpUITSmBR1Q==} engines: {node: '>=12'} @@ -3755,6 +3850,14 @@ packages: requiresBuild: true optional: true + /esbuild-linux-arm/0.13.15: + resolution: {integrity: sha512-wUHttDi/ol0tD8ZgUMDH8Ef7IbDX+/UsWJOXaAyTdkT7Yy9ZBqPg8bgB/Dn3CZ9SBpNieozrPRHm0BGww7W/jA==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-arm/0.14.38: resolution: {integrity: sha512-FiFvQe8J3VKTDXG01JbvoVRXQ0x6UZwyrU4IaLBZeq39Bsbatd94Fuc3F1RGqPF5RbIWW7RvkVQjn79ejzysnA==} engines: {node: '>=12'} @@ -3763,6 +3866,14 @@ packages: requiresBuild: true optional: true + /esbuild-linux-arm64/0.13.15: + resolution: {integrity: sha512-bYpuUlN6qYU9slzr/ltyLTR9YTBS7qUDymO8SV7kjeNext61OdmqFAzuVZom+OLW1HPHseBfJ/JfdSlx8oTUoA==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-arm64/0.14.38: resolution: {integrity: sha512-HlMGZTEsBrXrivr64eZ/EO0NQM8H8DuSENRok9d+Jtvq8hOLzrxfsAT9U94K3KOGk2XgCmkaI2KD8hX7F97lvA==} engines: {node: '>=12'} @@ -3771,6 +3882,14 @@ packages: requiresBuild: true optional: true + /esbuild-linux-mips64le/0.13.15: + resolution: {integrity: sha512-KlVjIG828uFPyJkO/8gKwy9RbXhCEUeFsCGOJBepUlpa7G8/SeZgncUEz/tOOUJTcWMTmFMtdd3GElGyAtbSWg==} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-mips64le/0.14.38: resolution: {integrity: sha512-qd1dLf2v7QBiI5wwfil9j0HG/5YMFBAmMVmdeokbNAMbcg49p25t6IlJFXAeLzogv1AvgaXRXvgFNhScYEUXGQ==} engines: {node: '>=12'} @@ -3779,6 +3898,14 @@ packages: requiresBuild: true optional: true + /esbuild-linux-ppc64le/0.13.15: + resolution: {integrity: sha512-h6gYF+OsaqEuBjeesTBtUPw0bmiDu7eAeuc2OEH9S6mV9/jPhPdhOWzdeshb0BskRZxPhxPOjqZ+/OqLcxQwEQ==} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-ppc64le/0.14.38: resolution: {integrity: sha512-mnbEm7o69gTl60jSuK+nn+pRsRHGtDPfzhrqEUXyCl7CTOCLtWN2bhK8bgsdp6J/2NyS/wHBjs1x8aBWwP2X9Q==} engines: {node: '>=12'} @@ -3803,6 +3930,14 @@ packages: requiresBuild: true optional: true + /esbuild-netbsd-64/0.13.15: + resolution: {integrity: sha512-3+yE9emwoevLMyvu+iR3rsa+Xwhie7ZEHMGDQ6dkqP/ndFzRHkobHUKTe+NCApSqG5ce2z4rFu+NX/UHnxlh3w==} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + /esbuild-netbsd-64/0.14.38: resolution: {integrity: sha512-cljBAApVwkpnJZfnRVThpRBGzCi+a+V9Ofb1fVkKhtrPLDYlHLrSYGtmnoTVWDQdU516qYI8+wOgcGZ4XIZh0Q==} engines: {node: '>=12'} @@ -3811,6 +3946,14 @@ packages: requiresBuild: true optional: true + /esbuild-openbsd-64/0.13.15: + resolution: {integrity: sha512-wTfvtwYJYAFL1fSs8yHIdf5GEE4NkbtbXtjLWjM3Cw8mmQKqsg8kTiqJ9NJQe5NX/5Qlo7Xd9r1yKMMkHllp5g==} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /esbuild-openbsd-64/0.14.38: resolution: {integrity: sha512-CDswYr2PWPGEPpLDUO50mL3WO/07EMjnZDNKpmaxUPsrW+kVM3LoAqr/CE8UbzugpEiflYqJsGPLirThRB18IQ==} engines: {node: '>=12'} @@ -3819,6 +3962,14 @@ packages: requiresBuild: true optional: true + /esbuild-sunos-64/0.13.15: + resolution: {integrity: sha512-lbivT9Bx3t1iWWrSnGyBP9ODriEvWDRiweAs69vI+miJoeKwHWOComSRukttbuzjZ8r1q0mQJ8Z7yUsDJ3hKdw==} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + /esbuild-sunos-64/0.14.38: resolution: {integrity: sha512-2mfIoYW58gKcC3bck0j7lD3RZkqYA7MmujFYmSn9l6TiIcAMpuEvqksO+ntBgbLep/eyjpgdplF7b+4T9VJGOA==} engines: {node: '>=12'} @@ -3827,6 +3978,14 @@ packages: requiresBuild: true optional: true + /esbuild-windows-32/0.13.15: + resolution: {integrity: sha512-fDMEf2g3SsJ599MBr50cY5ve5lP1wyVwTe6aLJsM01KtxyKkB4UT+fc5MXQFn3RLrAIAZOG+tHC+yXObpSn7Nw==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /esbuild-windows-32/0.14.38: resolution: {integrity: sha512-L2BmEeFZATAvU+FJzJiRLFUP+d9RHN+QXpgaOrs2klshoAm1AE6Us4X6fS9k33Uy5SzScn2TpcgecbqJza1Hjw==} engines: {node: '>=12'} @@ -3835,6 +3994,14 @@ packages: requiresBuild: true optional: true + /esbuild-windows-64/0.13.15: + resolution: {integrity: sha512-9aMsPRGDWCd3bGjUIKG/ZOJPKsiztlxl/Q3C1XDswO6eNX/Jtwu4M+jb6YDH9hRSUflQWX0XKAfWzgy5Wk54JQ==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /esbuild-windows-64/0.14.38: resolution: {integrity: sha512-Khy4wVmebnzue8aeSXLC+6clo/hRYeNIm0DyikoEqX+3w3rcvrhzpoix0S+MF9vzh6JFskkIGD7Zx47ODJNyCw==} engines: {node: '>=12'} @@ -3843,6 +4010,14 @@ packages: requiresBuild: true optional: true + /esbuild-windows-arm64/0.13.15: + resolution: {integrity: sha512-zzvyCVVpbwQQATaf3IG8mu1IwGEiDxKkYUdA4FpoCHi1KtPa13jeScYDjlW0Qh+ebWzpKfR2ZwvqAQkSWNcKjA==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /esbuild-windows-arm64/0.14.38: resolution: {integrity: sha512-k3FGCNmHBkqdJXuJszdWciAH77PukEyDsdIryEHn9cKLQFxzhT39dSumeTuggaQcXY57UlmLGIkklWZo2qzHpw==} engines: {node: '>=12'} @@ -3851,6 +4026,30 @@ packages: requiresBuild: true optional: true + /esbuild/0.13.15: + resolution: {integrity: sha512-raCxt02HBKv8RJxE8vkTSCXGIyKHdEdGfUmiYb8wnabnaEmHzyW7DCHb5tEN0xU8ryqg5xw54mcwnYkC4x3AIw==} + hasBin: true + requiresBuild: true + optionalDependencies: + esbuild-android-arm64: 0.13.15 + esbuild-darwin-64: 0.13.15 + esbuild-darwin-arm64: 0.13.15 + esbuild-freebsd-64: 0.13.15 + esbuild-freebsd-arm64: 0.13.15 + esbuild-linux-32: 0.13.15 + esbuild-linux-64: 0.13.15 + esbuild-linux-arm: 0.13.15 + esbuild-linux-arm64: 0.13.15 + esbuild-linux-mips64le: 0.13.15 + esbuild-linux-ppc64le: 0.13.15 + esbuild-netbsd-64: 0.13.15 + esbuild-openbsd-64: 0.13.15 + esbuild-sunos-64: 0.13.15 + esbuild-windows-32: 0.13.15 + esbuild-windows-64: 0.13.15 + esbuild-windows-arm64: 0.13.15 + dev: true + /esbuild/0.14.38: resolution: {integrity: sha512-12fzJ0fsm7gVZX1YQ1InkOE5f9Tl7cgf6JPYXRJtPIoE0zkWAbHdPHVPPaLi9tYAcEBqheGzqLn/3RdTOyBfcA==} engines: {node: '>=12'} @@ -4436,7 +4635,6 @@ packages: /gensync/1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} - dev: false /get-caller-file/2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} @@ -4550,7 +4748,6 @@ packages: /globals/11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} - dev: false /globals/13.14.0: resolution: {integrity: sha512-ERO68sOYwm5UuLvSJTY7w7NP2c8S4UcXs3X1GBX8cwOr+ShOcDBbCY5mH4zxz0jsYCdJ8ve8Mv9n2YGJMB1aeg==} @@ -4664,6 +4861,10 @@ packages: react-is: 16.13.1 dev: false + /hookable/5.1.1: + resolution: {integrity: sha512-7qam9XBFb+DijNBthaL1k/7lHU2TEMZkWSyuqmU3sCQze1wFm5w9AlEx30PD7a+QVAjOy6Ec2goFwe1YVyk2uA==} + dev: true + /hosted-git-info/2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} dev: true @@ -5048,10 +5249,20 @@ packages: resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=} dev: true + /jiti/1.13.0: + resolution: {integrity: sha512-/n9mNxZj/HDSrincJ6RP+L+yXbpnB8FybySBa+IjIaoH9FIxBbrbRT5XUbe8R7zuVM2AQqNMNDDqz0bzx3znOQ==} + hasBin: true + dev: true + /jju/1.4.0: resolution: {integrity: sha1-o6vicYryQaKykE+EpiWXDzia4yo=} dev: true + /joycon/3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + dev: true + /jpeg-js/0.4.3: resolution: {integrity: sha512-ru1HWKek8octvUHFHvE5ZzQ1yAsJmIvRdGWvSoKV52XKyuyYA437QWDttXT8eZXDSbuMpHlLzPDZUPd6idIz+Q==} dev: true @@ -5074,7 +5285,6 @@ packages: resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} engines: {node: '>=4'} hasBin: true - dev: false /json-parse-better-errors/1.0.2: resolution: {integrity: sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==} @@ -5107,6 +5317,10 @@ packages: engines: {node: '>=6'} hasBin: true + /jsonc-parser/3.0.0: + resolution: {integrity: sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==} + dev: true + /jsonfile/4.0.0: resolution: {integrity: sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=} optionalDependencies: @@ -5590,6 +5804,36 @@ packages: engines: {node: '>=10'} hasBin: true + /mkdist/0.3.10_typescript@4.6.4: + resolution: {integrity: sha512-Aoc6hjILr2JPUJU2OUvBiD5sZ/CG1FeiXwk6KKPqE0iSTjBCrjrVK/fP5ig+TB3AKHvh2aA2QXXGeXVCJBdSwg==} + hasBin: true + peerDependencies: + typescript: '>=3.7' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + defu: 5.0.1 + esbuild: 0.13.15 + fs-extra: 10.1.0 + globby: 11.1.0 + jiti: 1.13.0 + mri: 1.2.0 + pathe: 0.2.0 + typescript: 4.6.4 + dev: true + + /mlly/0.3.19: + resolution: {integrity: sha512-zMq5n3cOf4fOzA4WoeulxagbAgMChdev3MgP6K51k7M0u2whTXxupfIY4VVzws4vxkiWhwH1rVQcsw7zDGfRhA==} + dev: true + + /mlly/0.5.2: + resolution: {integrity: sha512-4GTELSSErv6ZZJYU98fZNuIBJcXSz+ktHdRrCYEqU1m6ZlebOCG0jwZ+IEd9vOrbpYsVBBMC5OTrEyLnKRcauQ==} + dependencies: + pathe: 0.2.0 + pkg-types: 0.3.2 + dev: true + /modern-normalize/1.1.0: resolution: {integrity: sha512-2lMlY1Yc1+CUy0gw4H95uNN7vjbpoED7NNRSBHE25nWfLBdmMzFCsPshlzbxHz+gYMcBEUN8V4pU16prcdPSgA==} engines: {node: '>=6'} @@ -5604,6 +5848,11 @@ packages: resolution: {integrity: sha512-UgzG4rvxYpN15jgCmVJwac49h9ly9NurikMWGPdVxm8GZD6XjkKPxDTjQQ43gtGgnV3X0cAyWDdP2Wexoquifg==} dev: true + /mri/1.2.0: + resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} + engines: {node: '>=4'} + dev: true + /mrmime/1.0.0: resolution: {integrity: sha512-a70zx7zFfVO7XpnQ2IX1Myh9yY4UYvfld/dikWRnsXxbyvMcfz+u6UfgNAtH+k2QqtJuzVpv6eLTx1G2+WKZbQ==} engines: {node: '>=10'} @@ -5707,7 +5956,6 @@ packages: /node-releases/2.0.4: resolution: {integrity: sha512-gbMzqQtTtDz/00jQzZ21PQzdI9PyLYqUSvD0p3naOhX4odFji0ZxYdnVwPTxmSwkmxhcFImpozceidSG+AgoPQ==} - dev: false /nopt/5.0.0: resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} @@ -6021,6 +6269,10 @@ packages: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} + /pathe/0.2.0: + resolution: {integrity: sha512-sTitTPYnn23esFR3RlqYBWn4c45WGeLcsKzQiUpXJAyfcWkolvlYpV8FLo7JishK946oQwMFUCHXQ9AjGPKExw==} + dev: true + /pathval/1.1.1: resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} dev: true @@ -6082,6 +6334,14 @@ packages: pngjs: 4.0.1 dev: true + /pkg-types/0.3.2: + resolution: {integrity: sha512-eBYzX/7NYsQEOR2alWY4rnQB49G62oHzFpoi9Som56aUr8vB8UGcmcIia9v8fpBeuhH3Ltentuk2OGpp4IQV3Q==} + dependencies: + jsonc-parser: 3.0.0 + mlly: 0.3.19 + pathe: 0.2.0 + dev: true + /playwright-chromium/1.21.1: resolution: {integrity: sha512-bbqFFpcTs+3amiofja/KvTmZ+FZnMNEOuGkRyJk2p6DV9EbgRYVrlzzgLtMnX2DwaX3ZZ23MukGuQ+bVKOdsnw==} engines: {node: '>=12'} @@ -6325,6 +6585,11 @@ packages: hasBin: true dev: true + /pretty-bytes/6.0.0: + resolution: {integrity: sha512-6UqkYefdogmzqAZWzJ7laYeJnaXDy2/J+ZqiiMtS7t7OfpXWTlaeGMwX8U6EFvPV/YWWEKRkS8hKS4k60WHTOg==} + engines: {node: ^14.13.1 || >=16.0.0} + dev: true + /pretty-hrtime/1.0.3: resolution: {integrity: sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=} engines: {node: '>= 0.8'} @@ -6834,6 +7099,38 @@ packages: dependencies: glob: 7.2.0 + /rollup-plugin-dts/4.2.1_pz6niy2zrvqhgxfup3pdyir4yu: + resolution: {integrity: sha512-eaxQZNUJ5iQcxNGlpJ1CUgG4OSVqWjDZ3nNSWBIoGrpcote2aNphSe1RJOaSYkb8dwn3o+rYm1vvld/5z3EGSQ==} + engines: {node: '>=v12.22.11'} + peerDependencies: + rollup: ^2.70 + typescript: ^4.6 + dependencies: + magic-string: 0.26.1 + rollup: 2.72.1 + typescript: 4.6.4 + optionalDependencies: + '@babel/code-frame': 7.16.7 + dev: true + + /rollup-plugin-esbuild/4.9.1_pnyrwy4zazm4ltxxkdqkpc4vuy: + resolution: {integrity: sha512-qn/x7Wz9p3Xnva99qcb+nopH0d2VJwVnsxJTGEg+Sh2Z3tqQl33MhOwzekVo1YTKgv+yAmosjcBRJygMfGrtLw==} + engines: {node: '>=12'} + peerDependencies: + esbuild: '>=0.10.1' + rollup: ^1.20.0 || ^2.0.0 + dependencies: + '@rollup/pluginutils': 4.2.1 + debug: 4.3.4 + es-module-lexer: 0.9.3 + esbuild: 0.14.38 + joycon: 3.1.1 + jsonc-parser: 3.0.0 + rollup: 2.72.1 + transitivePeerDependencies: + - supports-color + dev: true + /rollup-plugin-license/2.7.0_rollup@2.72.1: resolution: {integrity: sha512-0H1Fbuf85rvpadpmAaairdahzQHY0zHtcXkOFV5EStjX9aMCO2Hz5AQp/zZe+K/PB3o6As7R9uzcb8Pw1K94dg==} engines: {node: '>=10.0.0'} @@ -6907,6 +7204,10 @@ packages: object-assign: 4.1.1 dev: false + /scule/0.2.1: + resolution: {integrity: sha512-M9gnWtn3J0W+UhJOHmBxBTwv8mZCan5i1Himp60t6vvZcor0wr+IM0URKmIglsWJ7bRujNAVVN77fp+uZaWoKg==} + dev: true + /select/1.1.2: resolution: {integrity: sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=} dev: false @@ -7854,6 +8155,41 @@ packages: which-boxed-primitive: 1.0.2 dev: true + /unbuild/0.7.4: + resolution: {integrity: sha512-gJvfMw4h5Q7xieMCeW/d3wtNKZDpFyDR9651s8kL+AGp95sMNhAFRLxy24AUKC3b5EQbB74vaDoU5R+XwsZC6A==} + hasBin: true + dependencies: + '@rollup/plugin-alias': 3.1.9_rollup@2.72.1 + '@rollup/plugin-commonjs': 21.1.0_rollup@2.72.1 + '@rollup/plugin-json': 4.1.0_rollup@2.72.1 + '@rollup/plugin-node-resolve': 13.2.1_rollup@2.72.1 + '@rollup/plugin-replace': 4.0.0_rollup@2.72.1 + '@rollup/pluginutils': 4.2.1 + chalk: 5.0.1 + consola: 2.15.3 + defu: 6.0.0 + esbuild: 0.14.38 + hookable: 5.1.1 + jiti: 1.13.0 + magic-string: 0.26.1 + mkdirp: 1.0.4 + mkdist: 0.3.10_typescript@4.6.4 + mlly: 0.5.2 + mri: 1.2.0 + pathe: 0.2.0 + pkg-types: 0.3.2 + pretty-bytes: 6.0.0 + rimraf: 3.0.2 + rollup: 2.72.1 + rollup-plugin-dts: 4.2.1_pz6niy2zrvqhgxfup3pdyir4yu + rollup-plugin-esbuild: 4.9.1_pnyrwy4zazm4ltxxkdqkpc4vuy + scule: 0.2.1 + typescript: 4.6.4 + untyped: 0.4.4 + transitivePeerDependencies: + - supports-color + dev: true + /universalify/0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} @@ -7868,6 +8204,17 @@ packages: engines: {node: '>= 0.8'} dev: true + /untyped/0.4.4: + resolution: {integrity: sha512-sY6u8RedwfLfBis0copfU/fzROieyAndqPs8Kn2PfyzTjtA88vCk81J1b5z+8/VJc+cwfGy23/AqOCpvAbkNVw==} + dependencies: + '@babel/core': 7.17.10 + '@babel/standalone': 7.17.11 + '@babel/types': 7.17.10 + scule: 0.2.1 + transitivePeerDependencies: + - supports-color + dev: true + /uri-js/4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: diff --git a/scripts/patchCJS.ts b/scripts/patchCJS.ts new file mode 100644 index 00000000000000..76edf3fcfa6da5 --- /dev/null +++ b/scripts/patchCJS.ts @@ -0,0 +1,57 @@ +/** + +It converts + +```ts +exports["default"] = vuePlugin; +exports.parseVueRequest = parseVueRequest; +``` + +to + +```ts +module.exports = vuePlugin; +module.exports["default"] = vuePlugin; +module.exports.parseVueRequest = parseVueRequest; +``` +*/ + +import { readFileSync, writeFileSync } from 'fs' +import { bold, red } from 'picocolors' + +const indexPath = 'dist/index.cjs' +let code = readFileSync(indexPath, 'utf-8') + +const matchMixed = code.match(/\nexports\["default"\] = (\w+);/) +if (matchMixed) { + const name = matchMixed[1] + + const lines = code.trimEnd().split('\n') + + // search from the end to prepend `modules.` to `export[xxx]` + for (let i = lines.length - 1; i > 0; i--) { + if (lines[i].startsWith('exports')) lines[i] = 'module.' + lines[i] + else { + // at the beginning of exports, export the default function + lines[i] += `\nmodule.exports = ${name};` + break + } + } + + writeFileSync(indexPath, lines.join('\n')) + + console.log(bold(`${indexPath} CJS patched`)) + process.exit() +} + +const matchDefault = code.match(/\nmodule.exports = (\w+);/) + +if (matchDefault) { + code += `module.exports["default"] = ${matchDefault[1]};\n` + writeFileSync(indexPath, code) + console.log(bold(`${indexPath} CJS patched`)) + process.exit() +} + +console.error(red(`${indexPath} CJS patch failed`)) +process.exit(1) diff --git a/scripts/patchEsbuildDist.ts b/scripts/patchEsbuildDist.ts deleted file mode 100644 index 6ad2803c741346..00000000000000 --- a/scripts/patchEsbuildDist.ts +++ /dev/null @@ -1,31 +0,0 @@ -// esbuild 0.14.4 https://github.com/evanw/esbuild/blob/master/CHANGELOG.md#0144 introduced a -// change that breaks the "overwrite for cjs require('...')() usage" hack used in plugin-vue -// and plugin-react. For the moment, we can remove the extra exports code added in 0.14.4 to -// continue using it. - -import { readFileSync, writeFileSync } from 'fs' -import { bold, red } from 'picocolors' - -const indexPath = process.argv[2] -const varName = process.argv[3] - -let code = readFileSync(indexPath, 'utf-8') - -const moduleExportsLine = `module.exports = __toCommonJS(src_exports);` - -if (code.includes(moduleExportsLine)) { - // overwrite for cjs require('...')() usage - code = code.replace( - moduleExportsLine, - `module.exports = ${varName}; -${varName}['default'] = ${varName};` - ) - - writeFileSync(indexPath, code) - - console.log( - bold(`${indexPath} patched with overwrite for cjs require('...')()`) - ) -} else { - console.error(red(`${indexPath} post-esbuild bundling patch failed`)) -} From 2289d04af5398791c3a01c9e597dc976e593c852 Mon Sep 17 00:00:00 2001 From: Nurettin Kaya Date: Thu, 12 May 2022 20:57:41 -0700 Subject: [PATCH 0730/1287] fix(plugin-vue): trigger css hmr on custom template languages (#6987) Co-authored-by: patak --- packages/plugin-vue/src/handleHotUpdate.ts | 5 +++++ playground/tailwind/__test__/tailwind.spec.ts | 21 +++++++++++++++++++ .../tailwind/src/components/PugTemplate.vue | 3 +++ playground/tailwind/src/views/Page.vue | 4 +++- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 playground/tailwind/src/components/PugTemplate.vue diff --git a/packages/plugin-vue/src/handleHotUpdate.ts b/packages/plugin-vue/src/handleHotUpdate.ts index fbf7d2c1f5d490..0db6b23f936280 100644 --- a/packages/plugin-vue/src/handleHotUpdate.ts +++ b/packages/plugin-vue/src/handleHotUpdate.ts @@ -146,6 +146,11 @@ export async function handleHotUpdate( // template is inlined into main, add main module instead if (!templateModule) { affectedModules.add(mainModule) + } else if (mainModule && !affectedModules.has(mainModule)) { + const styleImporters = [...mainModule.importers].filter((m) => + /\.css($|\?)/.test(m.url) + ) + styleImporters.forEach((m) => affectedModules.add(m)) } } if (didUpdateStyle) { diff --git a/playground/tailwind/__test__/tailwind.spec.ts b/playground/tailwind/__test__/tailwind.spec.ts index ee596a17999a6e..4483aabf6f6597 100644 --- a/playground/tailwind/__test__/tailwind.spec.ts +++ b/playground/tailwind/__test__/tailwind.spec.ts @@ -3,6 +3,7 @@ import { editFile, untilUpdated, getColor, + getBgColor, browserLogs, page } from '~utils' @@ -64,4 +65,24 @@ if (!isBuild) { browserLogs.length = 0 }) + + test('regenerate CSS and HMR (pug template)', async () => { + browserLogs.length = 0 + const el = await page.$('.pug') + + expect(await getBgColor(el)).toBe('rgb(248, 113, 113)') + + editFile('src/components/PugTemplate.vue', (code) => + code.replace('bg-red-400', 'bg-red-600') + ) + + await untilUpdated(() => getBgColor(el), 'rgb(220, 38, 38)') + + expect(browserLogs).toMatchObject([ + '[vite] css hot updated: /index.css', + '[vite] hot updated: /src/components/PugTemplate.vue?vue&type=template&lang.js' + ]) + + browserLogs.length = 0 + }) } diff --git a/playground/tailwind/src/components/PugTemplate.vue b/playground/tailwind/src/components/PugTemplate.vue new file mode 100644 index 00000000000000..4169b534dee4ef --- /dev/null +++ b/playground/tailwind/src/components/PugTemplate.vue @@ -0,0 +1,3 @@ + diff --git a/playground/tailwind/src/views/Page.vue b/playground/tailwind/src/views/Page.vue index 764a2a18e54fdb..84d4af06bb1c18 100644 --- a/playground/tailwind/src/views/Page.vue +++ b/playground/tailwind/src/views/Page.vue @@ -8,15 +8,17 @@ Tailwind style
+
diff --git a/playground/optimize-deps/index.html b/playground/optimize-deps/index.html index d11383bfcb3e04..3cd619f9ce9236 100644 --- a/playground/optimize-deps/index.html +++ b/playground/optimize-deps/index.html @@ -119,6 +119,8 @@

Reused variable names

import { parse } from 'node:url' text('.url', parse('https://vitejs.dev').hostname) + + import './index.astro' + + diff --git a/playground/vue-server-origin/__tests__/vue-server-origin.spec.ts b/playground/vue-server-origin/__tests__/vue-server-origin.spec.ts new file mode 100644 index 00000000000000..56c5f276490c6b --- /dev/null +++ b/playground/vue-server-origin/__tests__/vue-server-origin.spec.ts @@ -0,0 +1,10 @@ +import { isBuild } from 'testUtils' + +test('should render', async () => { + const expected = isBuild + ? /assets\/asset\.[0-9a-f]+\.png/ + : /https:\/\/vue-server-origin\.test\/assets\/asset\.png/ + + expect(await page.getAttribute('img', 'src')).toMatch(expected) + expect(await page.getAttribute('img:nth-child(2)', 'src')).toMatch(expected) +}) diff --git a/playground/vue-server-origin/assets/asset.png b/playground/vue-server-origin/assets/asset.png new file mode 100644 index 0000000000000000000000000000000000000000..1b3356a746b8bb5510aaee51f7df5aea4378ee8d GIT binary patch literal 12772 zcmch82T)Ym)-H$&N*olL90vnANET3%3IdXIY@%ek$x$T;2*MyJ*+y~(p$Scr3=&#V zauARp&>%U(zmMb0?|pUet@~cpyH;6pHhZnL_ln2ZQ@20&bcI#; zRb1q(Z0+v)xLIlXsA|D|?BU{;Y%QIg6L0gA+o+ON#9WUkUItw9LoG z@?#6qUW)C{L+PnJV3BinvtkkE73P8S3*2B473UQY7PuiMz|A7aFCfInFT^Jx#3LXm z!7nZ$Ak6af4;zr?W@#;0kvqd6ZB>4C|Jw16ng?OFaZ1@Dk#l`vf1^EO8 zdB6@HgtrsY+>6Hv!TuKqc`F3m&CUgB=j_A+aWuDZc1KFFfs_7u1xFVZmA@G~A$}?f zsEp6c+=Wkom!Hqk5xUop-3X+H)&CyjpYBFzdAnHgX;>kg-QD289@gxC5d+=*dqL1f za2g4DXSlngl@s!wyc8Q);kC50l(;P_D#|Y+&o3r=TUJ0oK}c4VUtU3hUkF;26A%>o zi}s!q0%`69xB83L?r&N-#eYjHA?Idgj&yd@a&~t3%X$xNosrH6TW1#*IXRYVD&}xI zC+PV)q}!iIwQ{rbu(DKib9Q9;p&SXje{uj3VUgPcf}-N0BI1J3;l%~S#Kq*r`DGQw z

g*im?5pwfrX+|4DoMU()h{!|*|t{l(IMEdlp|e*D{S!NcF4Z{-Bs-3|CP!Zr*9 z8L#d=`P*7vqbn1>&n!RtU;S=qT#~jM$vQmzE;@a9c-rnezm%%pNUCL4Z?Ol5^T|`4 zavjWJM`*UqD*=L#ruSwfkpg`dg+WwAgBG)AJMJnzGINiKeO4G0eE->l82+&`B7#WJ+>uienjpS%Cf@_)wnS8@Lt-(ODwuJ9`ZNaR1c#{VzAzli%c zdieFczi910Q_uf9Ump#H3qJ49?XDdJEVgU0^-nuX>)vnly30Cxol4=jV*B(2W#5Q= zZoyqw)~|Z99vkShEvcZ%Gul9NJXmfqlB33(l=X+jS8v;gb!7^)K4G4vKK&sm{RpAY zXa|RLM59D+?B_$C1m;mhzR|W9s)a8;N9a~BS?g4pNK%w~aZQtaEyGUaQzjA|;I=b% zPAV^cc(RIern)a4 zhI(|wR30|9!CyKW7Euzj4~l&9N>-|XEj&zlYZ+NWMQTM+Dn>Sa|7#Z3UzI};wxS)M z5iocG$XR&=j~^L|KB-jVe&BB^c~JCVHeabiS7tMKFok0*ep-0e3Ze}V4cW;Q{F;|i zS$nM{@47r;N7}?`S6OPDO>XN^gfMC4@e4?t?VN*ih6ihdqMrioS?+n3lvoDhiA<%h z#p78S=zV$jMN1#_jm?eU)+~D8>Zr&$YG>4s?$aA0;vM3?Ri43*6b~&tl=Uo8va~MT z<>ks>Gs>e#6&&0ooD@PIXPo9!ZnA&c5Gu>&{9rQ2$Q7}1n7}39u$DbUbe3Dtk+hdq zDSK)7{F|d{*}-@89lT@N8WW)f4_Y3)=PQt3&`leqPLEq@F54On3Q{O`3Ek*NVbnPU z3HRC!)K5#DyF3No?si6u5Okc#a@1b3r+N6zae!OadVQefsha>mB{P0x2xXtyPVg#Sd}jsP;8~gz zYK^AUM8?3mAz{VD%2h0EqGie+}5cS z>3_AuW9^jOkayxhI^GLWCW2BtRp*eX>kO{Zk+g}I{px$AXrD-ryTauP;u;cGAfLT- zSD?0wa8lBaDV0a%bnCmP)=Y2PXe(WwysvAq@G|dvY)E8FQlK92Q))iT3C3DNZ8pT0 z^xBNvl&{jZjB>4M1k9s#@C})~){+R}@JjXYof(EmM3e)0b|n*jq=LwAqt8G<_*=l$ zy-rc})-+~(40YP90onyuio3BUUB~A!jMgE_o8VAUF4miGu-@zM8IP`hju<5zye^-k zeG=bdFRG?$R6^-YRJk`*b_GQE*?9u{$k?j=qd=I`1^c7fZWgmLBpnK;9ohqXv^hkb zm1KwQ+FCun1mc|jpv1JDF4(}xQXT}J7S8V~pYc=sgE@#MxS6((3x$#85G*RZy#4l= z_D$T#lY#h=bjIUB>=5fGmcizywk5(jI-HuY;=A^eXQ-7|3Q$rg5^qkMVqV3;15L#r z`WA&tUhStHJSIO3&?$Tri=9^B=*bex>D-yE$OcCG)STFdTs#_K)2-3^B#Lp6yEE{% zttT?<)JM-#X610Il@4oS&l~UWn@J4I5@y7YWV)bF9=ysF-`S(Lrmv$F=$j>r?AAMV z`~IQ~2Rq(1A6u*LH=mlaIty;}AVt{{bG2}8N)veY{ON#G| zpCH<$CHM1gPc&9Ln={MI->rfzD5VHlM%r%=#e?)i9xR0NdRcKHzH@*(KBAU<*+aze z@&F$b-7qY4u%U)i?v875tGFCGyuzB@?88-7t~9C%6lLP2+0-`*xO)4`8BY>llBHIA zFSj;Le1vbJ!xhIx?^M@|-I+0B9W%|Uq{EMtz9bVlw|0=2pF9N1%D?`xYb%W)s_Z?Q zw5Muirs2MfXOsUIiKmDb;NInp-@WzmBTp{(Jxk;B6XG~MXQ`5vo8EAnRpQlzXQ9a9 z!3Rk~>%iuQR)06kG5g-AN+{?GTIg`}Q)j6CSCmmTXr=6K@q)-$Z4-Hk!~l=eM*6Xu zZMowHW>@B!2C)oA6S3x$r-&yGYB`m(_>loreKFC&PRUA^`O%lRRiq;Z?rjb`*v;pJ zt*!1J6CHjRbv0%9u(Ombf}TG=g3g9$q{;QCE~FkBT5$%tc&mFKUJO|@JJ=^+9tWYV zcHn;4f)12eX~~PW^mXNZA!93zoPJb#1>;;8)P`4cE$uaz+&t~!@CAiw|EQfL^B}3f zF9jg>mND)ePKe>1#%q514fPsH#9t%qzh?rglEk>QZ_Q#S3MmsyxInBQwrxZ*1USKb)hd<8YTnSfa_5l-8xQ*+|7iP4f1;m58I6Nje@ z!&YMl^N!J_Ma#1yl5UKug3ZIv5kU?mnZh*qk+(1PrR;?b)S+&<0enT%apJ5 zFK^?Xjd`uq9H+aqjz+>8{MtD~I$=ZOhM?wI1ceCYe#08)QhFz`XJtsE)mbGH?Wl$L z7*BNiovp{)?b03AGKJ^gH_UwqA#NF6R#rSiEk{w#L^3hK87po#Sznl&R;~ej;^gI% zH3rOHhRpJ3T;v#a)rZ)Je9_xt^IaaE28iEEX(-3!BnwHr9~!E08R{0!6!W&V+>ZAmd&NGX)_GdboJJOVB122jrQcpF>VkQf(3Jxylq^JlpORzG5QuFIt@&2KB@ zJ(O@4thYJs1F_F@pwK#lXkYL+E0Mw-EWpqqII@#fdHF2&Bt>7f3CV;uXY77+MXkoC zK4krCRqI{Gg1!citzw11$)V@~A?Yf1tjX~+(xS5a=+pQ?4T{n|DpNAtb>N9o_U`H? zxTM>u_tz#*!{9HSq#VoA_@s5c`eZcrcV>o*QtAy@H`*#U`{VKPBc~|(>Y_uP3Y5NH zDU8hsXm~Gz{CHEuFv&vli0+?0^Lwi4IRkjY%4SG~_2VD~-|71+UD%0CN^hmBgAt=) zewPa366^2i2$M4ymby|i9rn*6a*<(|9%~L&wsVi1s2K>|ZknlXU8bsse4g3V@Y%E4 z-n$)|rxS!HW5DlKQ`S17p3^cN2Ijhi!Gib|3z7kDXm~kbaN!Jf$JLbBV{RlV09AEH zpZeBqUaDG?tGu)^O+6*A>*#p)yr`K`_3R9daq)d)+u+I#VXIqB7R3$JqwwyS9Jhn~ zjJipxGN|G_+U(#>92Ycw4rAt$&hAFTI;o$leDtaOy+aI?|P%Z*CS zB}?tO5t#@h?;VSBwK0+Kv+=t>TF_A@KC?t+T+I*B#8Q)2uX(Ju zt7e{|IKArp0#W`xSZCnr$%P-R9p{qyFtO4Awwo4xEpA4X3lN zdb=ZLd;C%Vb7M5mp|;G4lOIX^%4^CgeRsng-quQ&FhLfx50x(2I}VG*n&CIIwm)Z_ z{KjXS+EW*Rtf*NVcC2Y+4iuFRRRUMCV2HEC@D_!GEAbVRI#z+In~JHW(Vtc*ii7vB z9&RNlS2fraH^KrICe}T*OIsc@x0^9UT8^a-%2JfRVxE4+)47e_ps(nN0;Xw4GM-Vei=p_ z%18j{E+aje{#=GW@Xj2_v?UwnyIm{Ia;!!ZStJ1XV@j)A*BVUqF0Za86rimDv`o*c z=dZOk5!-v&aX4F)F3dK@RWGoU#PNhLPzyaMO;M^>8bifb>{*~>sajn%6ghf0#3@fW zAR|>5usIlRFL7*il(_enbC7j7OaRuwG~%RU&kP`G?t3|e@6-FAH;1UQlJbTGEOFAM zjw|Jk&immjd(P`NTKV;2gEOz#$L#HT2>^(v>icTKIsWCw={aX@P~+za)>3?Yt&%`Flm`>GwnnfRwZA4mCH0QH?>inQ6e#or?<}UtLS9g z!{aKumsX3J!tLGNpF+AS1|J2rW&F}I^6>p1Eo1-D(P_si<7sktg|2r;#2^j(SiN1; z6YebQf!*XT&v(a|N#@$Xi@i4Hf;|m>6=Hk6r?8VSg9_3&%S(iuYX+YW42QOa4o%WW zd|S_@N~B2eo%ZKkW~V=u~H>S$Fw2t>iEi6CblqEt7CkUl4B`YEIKDFpY zz#|;^vV=*`awq7B4fskysB)m(Ok(uAjb}2vG9t7M?nf|A%)Dr ztE%yxDbI4AQGcFtRlmE@T6U>}Vr2EcJq?hM$%taq3ca~qwymHpz?1lf-`W5kW<)qJ zdJeF^o`S!6VL}-6w~m!GQWL}+2$FfImGkKIP%*%OK}C+gK!pvcv~zI#h}d`&Zt*^a zo6q7$#S1R8nHm)o>w?JlF%i3T^KxyZHk+nZ35dFhK?GYXt%U*MI9MfAAF%{E35Z zX5|IIU{qJmR~C#2`izX96>jISe9T~Mmu0wQ>C0Ah52UQA=END~BCkgH{W%Twsg-il zI+QSVcf&Dcj4QyMZv__;%6dNkF#+M`%5SXKU=1~5AaLc5!KIZ_`>WAXl+xTVl#|RS z@t)D$P@b%zF<2kQ{Mq_|G01skF@&E4QZ!e7o_Hnnp}J(RXh*1sSs0wT18>CXt~~|7 zsG0p?JCC7R4hDUV2VwXEMLab9O1Gu#>KL&d4qWlw|>3KC=>ab>^T*Vw@5Dvyf*0YD0(l5oL(wz-)k2H=yMsg79uKt zwHCpIPUd7CH<%2|rBVl}0Tb0}lFhq|=sajhpgx7nkRW+=kR4S7S4KP9IRXWs$bR$; zPyV-OprKgTOORRg@|b>9ksTCt?wtav7j%jTP-l>QbX@WxnxkfhPB0JnX-u$CA9L8M zHGp5n(s??c)V8DEHjsBu)3n3yp_2y;&YYn>`h!c>R~z_+uY5hVRtPw2Q#Yw8C%p#%icDkL6PMXS?@wH)LTUh(4_hS`{p- zr4&sq1`Itk8h!QErL3}Kx5B*&X9U>CChU5_q&T`|2TKMlF`96xj{PHfvp{}S&4fCP zET{6!S#B|=>1SJ4QHL2yU#}OHP`_c;FQKSs3T_eLbac@VJp?a<|;Qqe0 zjJ@bL7PH%-&cQpSkh7vQuB9&$e5%i`bJbrSj=@b=hyX)~H`6|R>or?Ws`B|2=5Lr> zpLw}4xU|gOp_6_Pb*yhdf2-*+uk0W@3ZudyXxgt<46EEdC{!zX+L3WY277{Qb~IP< z(gOZv7GOj-Dh;(_bq&|FRdzYZG1D}y@Y`sAJ075tc{wq-zW`Dfz#HPjB_(yqf$f9@ z0|?uKEd?J9@Xk>8yx|Mmc>&!Snv{C8W4bko+HwqBAxIDz0>qmV_j~_$_8E}&tTorqq&Q*YYqIn zYYq2|tXxpHW^=%fKq(ItBYoLoZ}+V;`T zC-{zURz5G`QB<7Bwt5E}elWX~?S3(quWy|T#9`V3o^m-(6#>S6 zi|3}FiJs`2W0bzy4Zc@6zWLH|QK!(nkOP3Y8j>^ATQPg)yO8w#ig<;&s)XzE*?Jf~ zxpJw?&7Y0Cf%8dS;qL3j8q*kP3U7QuJ8)l2_e{rVk$V&FHBD>YcfWgWJcHD$rbNk3$AQj`y23cVG zWrV2Hc@k*X^!t7)5c71@_|4TMD4bq#nVd0QPmceU-5e}}= z0SdsCU#kTR&A?H~TH)hgA8^K{ zup*pP0%LUpfHCXsqM;qO_O^X7LfW%Z+l7?QwQhsxy%YmjUCXnebI05%tfz=YC#~?F za~ANT+(55-*`p-AI6eCE37YwNO-Mb*j=HuDSugSq)+^gObH^HwmNRG{{$?+We)%!w zEI#ppzL;jfKLDJ-V(mz)Gd3`fY;n-zkOch$uwguqXr*g4h{46)fC1&+rs#WRL%b`o zY>{>C2db%j$Ujp~V*KhZ;v^eB$%!VoxS7)!J*Z4U9e%@HzN?F6v;-$rdL$ zQhX0V4w##nlHh1TlGqG6{n-(N=^BOVCkDG&D?C~^_zGv9#?f6b3F;!!AEmgXs!|!eW&kmK)gabz4456L! zwqX99vlAYrAkeAHeXVB7?4|Wb2IyD!#NM8$FFI+5_q5Gs8mJ#O)xIN*F`oi3#`E>& z#2@njvhfH1IW?wmgJ2AOoz?HFn&YD7ZQ|}VP~gT~v>7f5UcCs~$8wEN{Y-T-Zz^}L zuh5Sa-$f9E3tE_x;x7D{6uAqOd$^pupx)(Jy)=?`7Xcs=jrH_>UkM}(lux(3TxX_~ z_aYTLSt|igAl-xCgYm;Z4tcGn*6xglRr7&yZcop!bOR9AG{v~GgcpFf4!Sd_T$#&Dw*QoqaeotqG2jp+=t)vim+_bDcQPGES4UZ5Bzk_Esy>HLT<&-M#?VfembeX2e*SJT z4^`E5C;E{zRRjTGu-Z&}5Q}xx48Q+5HlrbLmv;<1nw>vaLOk|y9K6r%{1dtqK+r`2 zj5{OJM$)QzT$4L@ZY5m;$1}!UtAJdWSrT>4XIhCUtAgii1j0;%7Wkz1Z+*jo47JJN zwbW3G7S~b^@3H^IS&>#p*0EkYUZ}Pu|BYK*G)-&AKC~`GkKID+4ln@8uVkis{GERk z422pRDc^4=H-~&ysa8dYLllz;fauNDK`fIlNLNC-RCDgzU^=vyvR>0g-EqXz4VZI3 zbvZA?SWB$UriRGW`qV*vT28tyK8uLMHS_QIcM*V^hmF}bTU^x%?@?HocptHJoePHh zG4=T!AeJ5iz@i$5VuaFt8L5K0NwDXOW<*6=q*2&_9wDIintpcj6R|kvQUS!WN6*u- z@U&k6z5M5f8$-e9JJ1_dL(LZneB-?dv+#}u7DI+H09AnI)kB01e;NHvHv4~(lJ7A zSr%KD=ofaSL#E4S;O!k()=GnSZ0sDMYv_0S{En>3lecF2F~5@xOplLvPQ@JOP!%F@ zoGS=)S^wpiN!{qN+ht~UX=*T(D}##SRx|BsBnqR%A^7A204XwW4wtptI-WjP01!nF zV24H8pW`=iUod`44eZU|!>kK*?r71qK&;tQ_L)g1bmBX;7_ToaESREE+Zb(S1K5=T z8i=?iW_toVkwckC{PFN5EIw`_z&m75avi*vHl@MrazZgOuy!_Bq=>|O$x!vxSoe)T z0>X?2?0Nw3-73yoZ;wM^?tyx(T1d66Im8&qLJWo>VGg2M0>prHvzP>D1>vuXVj5bU zUvl!E(7H|6jvHM8bTsFOb?XLyW0HaW{(z!%{Z){8Y%|L)0&3A;CtN2*C7n#CJSQY0 zOv>=fpdbd`j}o<(6Gc(h6lmtj*lKtm|ibroh%QL_Ev>4=NQL-!n@YWXFnB7j_AG#{>=QMhW zdA|*W&uR2&l*7=U8+LykKB+ra?lpFyC8HDo;}cQg$)|w{BgH@F%IY#}!8(zr$qr)! zdS|Ki@F&DfOBrNc>fDY3IalT{22uDc)){or1ZJpGbExdW6#KGe`Vc|)yJeMcN)cx^xJrGGfNNBMK zM$rOD;KKY!l$`@aP-KkSPk?RCW!=bzwhw*sn%&0Yz=p2AKUXGkD5(q*sP!ucps3V{^8cW7WfI#v`F+z_MpS<8|i^b{}<`S*bHs(-P zteX+(HkOcJeSr$=xlGXJinLzDLLth&Kz>gzI4~F$C~$ZYS7i#EA<}DNFlHJxvHCK! zq5=m=IH)Fx&bf}VmP_lgDMEpc9?)1GJhWB2M$mQ1?moz6F+e8*#(Vrijr_6gXIaef zjYA99Lcohp8lTQ0DCHLZK&}9QuE%0ZjtlGNzY*{%S{#TVwt86i+ZuMYoU{eb z#)trlq877k^Auiv5dO&Xj>I5f!u`jde&KO9f9VcP+L`bSb!j#5*!5&9-GbJpS_wut zL^JYI7U7urZWAeihA7ZL?2mHu=q(SU;cK<{Bo$NDM*+~}>_i%wt`+|1`z<2fbdB?i z&XeyRzvHI`FU7a&6Or7|2_I_CM*V1o7kx!@;2=b9J+Ee~(2Ykq*C$1TMi#%`0(>wd z3dY!rhEYfoK(Z)M6}(d|xRu&5PzEyo>mi_*nXpVgt?&kfxr7He(Uxte4?ohgKz^!P zl2Hhp*k}Alo7yj#5={lMbOP=ehczytlv+DL76R{ByktrQy3nmcsc$sEJF$G=(uA^A zavVN`(a2}e2B9e;oVnGaIC&17faIE}Zzw)=zrKqTGVS}tbW*ImwF}@JOxhP|jKC%F zUz&6}Ylf$}CcA+77e5Uzsbjhzca8ryJz#n48sN?sy2=@^=cbzl#|Nek+HwY#Ij|6{;EtnMn>5~^3_?j|usez*SXjmlq*%sG1+l z-hh_67df3O2b|)a2nb$5q-b7iM$Prl3}6M{)5?~QtL3q;_-8uscpKyqFCL&!J(nmg zdmt^ebx79tJ}q?*Jg*&Sk0cV<(_!(7mc_gKnRKAm@LRGjAEGeI9P<;#d630P^1!f9 zBh(vl?K8-kLFQ1p5J3**wbs?}{#ar4bhO39qwF!7JiuTy9>B(XHbpqj50$vQgr*n- zpX?V?W0%w7y>}}D@tqqFh;$8K;6DXnc2rI*hZq$0?A4M4O5f84gkG*ahT0Z=PAZj9 zREa{FYR&D)L|OR9BXk##sb*@b1wWI3yNn(v*{Xqe+-lhdK(Dua0fQg?P4pGbA`nDh zz-K@HD2y)0fV@Y!^WgU4D#Hxr zc;Z7muz&O69b3XMmqzkze*iOs_JQh#K^qb3GE{Q!kPK`fo;kp#(PkX`U%?3h2Hekp zF{ZJ`H{~&YuA??VvpNq&lJoI;MxYPT!m!7aL2L6*SdESw-jMdhdzJ1*Qn#{!s9)h~as!ad0K%@fDpf90I<4(3eq`@}GcpOMwk}t)^u{)$dg$b=- zI%yHKvk+dP2C=vSSPZn8`P2BZ;UIX(ZP$5VvbahcWL$FDIzR z8<0Yy1G!mmU4gIHr4rRKBA`tFIc3!LOl4M@>ezYkcns2?>+i@hAD01imLq{41sL(a zvEi|en^K}cQ6veV@*c(PhbVvl z1j}B4%FrVcee%%NRRzCp%m4zaBDcnvMyD0L(ptXNKrBmvLj_RQF2kntiq-nh0iJTx z#3-D8Q^!>V2NiTdD;@jyvx%_*|kRtWKpG%IZ+;g${P-g=xg>)s zMpIibKaDC@dJf4y3xHuBZ@_8Z77eh}ts9_>($#kHGFb>pop1VMlSlS-ju8m$M&b$P zp7o(s;^`%FZSqB`$#-XbR6wTkA(N3YM(*~(AbmiU13*1HvPL(}14f|H*HK(@zWZVU zt8-g#A?}jEq(ibpV$sZwnd#@iC!WzQAXgRkHp(OfoCmiTV*(q%0I6a>HhfD6P&6^f z4(`f%4kaHA7=N1r8Vn+ll$G34K0SSK;0$q$1|q>UX!YgEfcv*bkR$Mnt3@g%@{9`@ zZj~Sk7+&*1r&sF;0Iu@#A)vr(idnxZ`=5Lk`(OBc6{zU{@~dH>r2pV+-dUp^217t6nVH5`QcetM1u@7n`oi#fYSDd_)Q+*44MFP1fX{69{$*5UvF literal 0 HcmV?d00001 diff --git a/playground/vue-server-origin/env.d.ts b/playground/vue-server-origin/env.d.ts new file mode 100644 index 00000000000000..31dca6bb40c906 --- /dev/null +++ b/playground/vue-server-origin/env.d.ts @@ -0,0 +1 @@ +declare module '*.png' diff --git a/playground/vue-server-origin/index.html b/playground/vue-server-origin/index.html new file mode 100644 index 00000000000000..13de0b72c23782 --- /dev/null +++ b/playground/vue-server-origin/index.html @@ -0,0 +1,7 @@ +

+ diff --git a/playground/vue-server-origin/package.json b/playground/vue-server-origin/package.json new file mode 100644 index 00000000000000..869de55c22ee3d --- /dev/null +++ b/playground/vue-server-origin/package.json @@ -0,0 +1,17 @@ +{ + "name": "test-vue-server-origin", + "private": true, + "version": "0.0.0", + "scripts": { + "dev": "vite", + "build": "vite build", + "debug": "node --inspect-brk ../../packages/vite/bin/vite", + "preview": "vite preview" + }, + "dependencies": { + "vue": "^3.2.25" + }, + "devDependencies": { + "@vitejs/plugin-vue": "workspace:*" + } +} diff --git a/playground/vue-server-origin/vite.config.ts b/playground/vue-server-origin/vite.config.ts new file mode 100644 index 00000000000000..46c00e4c5c16a8 --- /dev/null +++ b/playground/vue-server-origin/vite.config.ts @@ -0,0 +1,19 @@ +import { defineConfig } from 'vite' +import vuePlugin from '@vitejs/plugin-vue' + +export default defineConfig({ + base: '', + resolve: { + alias: { + '@': __dirname + } + }, + plugins: [vuePlugin()], + server: { + origin: 'https://vue-server-origin.test' + }, + build: { + // to make tests faster + minify: false + } +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4c9e2f58cd9789..953a97be252b82 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -979,6 +979,15 @@ importers: devDependencies: '@vitejs/plugin-vue': link:../../packages/plugin-vue + playground/vue-server-origin: + specifiers: + '@vitejs/plugin-vue': workspace:* + vue: ^3.2.25 + dependencies: + vue: 3.2.33 + devDependencies: + '@vitejs/plugin-vue': link:../../packages/plugin-vue + playground/vue-sourcemap: specifiers: '@vitejs/plugin-vue': workspace:* From 3eb6f317368b9151d6c737154523bbaf6d182717 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Mon, 16 May 2022 00:39:18 +0800 Subject: [PATCH 0752/1287] chore: fix incorrect test (#8185) --- .../vue-server-origin/__tests__/vue-server-origin.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playground/vue-server-origin/__tests__/vue-server-origin.spec.ts b/playground/vue-server-origin/__tests__/vue-server-origin.spec.ts index 56c5f276490c6b..042105721f2615 100644 --- a/playground/vue-server-origin/__tests__/vue-server-origin.spec.ts +++ b/playground/vue-server-origin/__tests__/vue-server-origin.spec.ts @@ -1,4 +1,4 @@ -import { isBuild } from 'testUtils' +import { isBuild, page } from '~utils' test('should render', async () => { const expected = isBuild From 32c75e26d6f792a7fb31ba198c0b384efd8ffb66 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Mon, 16 May 2022 00:59:08 +0800 Subject: [PATCH 0753/1287] docs(plugin-vue): clarify asset url handling (#8184) --- packages/plugin-vue/README.md | 43 ++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/packages/plugin-vue/README.md b/packages/plugin-vue/README.md index a232982e8aed59..ae848051cecd10 100644 --- a/packages/plugin-vue/README.md +++ b/packages/plugin-vue/README.md @@ -51,6 +51,40 @@ export interface Options { } ``` +## Asset URL handling + +When `@vitejs/plugin-vue` compiles the `