diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cde7dfb03825ed..4818124be2430f 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: [14, 16, 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/.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 }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f086627de5cfe0..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. @@ -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. @@ -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/docs/config/index.md b/docs/config/index.md index bab7df7a144987..5862419405aa89 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 + } } }) ``` @@ -160,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. @@ -237,7 +241,7 @@ export default defineConfig(({ command, mode }) => { { "exports": { ".": { - "import": "./index.esm.js", + "import": "./index.esm.mjs", "require": "./index.cjs.js" } } @@ -706,7 +710,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' } }) ``` @@ -1018,7 +1022,6 @@ export default defineConfig({ - `external` is also omitted, use Vite's `optimizeDeps.exclude` option - `plugins` are merged with Vite's dep plugin - - `keepNames` takes precedence over the deprecated `optimizeDeps.keepNames` ## SSR Options 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 } ``` diff --git a/docs/guide/build.md b/docs/guide/build.md index 8216bcbfbac060..358745d02f2cf1 100644 --- a/docs/guide/build.md +++ b/docs/guide/build.md @@ -127,7 +127,8 @@ module.exports = defineConfig({ lib: { entry: path.resolve(__dirname, 'lib/main.js'), name: 'MyLib', - fileName: (format) => `my-lib.${format}.js` + // the proper extensions will be added + fileName: 'my-lib' }, rollupOptions: { // make sure to externalize deps that shouldn't be bundled @@ -159,7 +160,7 @@ Running `vite build` with this config uses a Rollup preset that is oriented towa ``` $ vite build building for production... -[write] my-lib.es.js 0.08kb, brotli: 0.07kb +[write] my-lib.es.mjs 0.08kb, brotli: 0.07kb [write] my-lib.umd.js 0.30kb, brotli: 0.16kb ``` @@ -170,10 +171,10 @@ Recommended `package.json` for your lib: "name": "my-lib", "files": ["dist"], "main": "./dist/my-lib.umd.js", - "module": "./dist/my-lib.es.js", + "module": "./dist/my-lib.es.mjs", "exports": { ".": { - "import": "./dist/my-lib.es.js", + "import": "./dist/my-lib.es.mjs", "require": "./dist/my-lib.umd.js" } } 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/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: diff --git a/docs/guide/index.md b/docs/guide/index.md index ff0d3f21b90e65..338bd42a565aa3 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.2.0. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it. +Vite requires [Node.js](https://nodejs.org/en/) version >=14.6.0. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it. ::: With NPM: @@ -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 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 diff --git a/package.json b/package.json index a90c2c9a43b3fe..269f1bb99cb826 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vite-monorepo", "private": true, "engines": { - "node": ">=12.2.0" + "node": ">=14.6.0" }, "homepage": "https://vitejs.dev/", "keywords": [ @@ -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": "^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", - "@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-define-config": "^1.3.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.3.8", + "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/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/README.md b/packages/create-vite/README.md index 79d5ae12d93597..e22c268ab99f9c 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.2.0. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it. +> Vite requires [Node.js](https://nodejs.org/en/) version >=14.6.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/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) { diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json index 5a21b499d9b75d..38ffa81a2768ee 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": { @@ -13,7 +13,7 @@ ], "main": "index.js", "engines": { - "node": ">=12.0.0" + "node": ">=14.6.0" }, "repository": { "type": "git", diff --git a/packages/create-vite/template-lit-ts/package.json b/packages/create-vite/template-lit-ts/package.json index eb6849d447795c..8ebcabf492eb44 100644 --- a/packages/create-vite/template-lit-ts/package.json +++ b/packages/create-vite/template-lit-ts/package.json @@ -2,9 +2,9 @@ "name": "vite-lit-ts-starter", "private": true, "version": "0.0.0", - "main": "dist/my-element.es.js", + "main": "dist/my-element.es.mjs", "exports": { - ".": "./dist/my-element.es.js" + ".": "./dist/my-element.es.mjs" }, "types": "types/my-element.d.ts", "files": [ @@ -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..ad5627580c9920 100644 --- a/packages/create-vite/template-lit/package.json +++ b/packages/create-vite/template-lit/package.json @@ -2,9 +2,9 @@ "name": "vite-lit-starter", "private": true, "version": "0.0.0", - "main": "dist/my-element.es.js", + "main": "dist/my-element.es.mjs", "exports": { - ".": "./dist/my-element.es.js" + ".": "./dist/my-element.es.mjs" }, "files": [ "dist" @@ -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/.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-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/.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) 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" } } diff --git a/packages/playground/assets/__tests__/assets.spec.ts b/packages/playground/assets/__tests__/assets.spec.ts index 75c0e57952db24..f1075f6fe1cb39 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, @@ -105,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) }) @@ -296,6 +318,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 +331,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/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 6678a2da7c2106..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)url background-size: 10px 10px; } -
+
inline style
use style class
@@ -235,6 +266,21 @@

import module css

+

style in svg

+ + + + + + + + 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/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/css/__tests__/css.spec.ts b/packages/playground/css/__tests__/css.spec.ts index 6ca00e760349b1..e666ca40517d57 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 () => { @@ -405,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..33058023541515 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,20 @@ function testDirDep() { } } testDirDep.postcss = true + +function testSourceInput() { + return { + postcssPlugin: 'source-input', + AtRule(atRule) { + if (atRule.name === 'source-input') { + atRule.after( + `.source-input::before { content: ${JSON.stringify( + atRule.source.input.from + )}; }` + ) + atRule.remove() + } + } + } +} +testSourceInput.postcss = true 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/playground/dynamic-import/__tests__/dynamic-import.spec.ts b/packages/playground/dynamic-import/__tests__/dynamic-import.spec.ts index 46af79300c7004..95101a039e50f8 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') @@ -83,3 +83,8 @@ test('should load dynamic import with vars raw', 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 5fd05298314946..997ad059ad6821 100644 --- a/packages/playground/dynamic-import/index.html +++ b/packages/playground/dynamic-import/index.html @@ -8,6 +8,7 @@ +

dynamic-import-with-vars

todo
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 206012b44b29c0..61f817ce7dd7bc 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/playground/hmr/__tests__/hmr.spec.ts b/packages/playground/hmr/__tests__/hmr.spec.ts index 7325c9fe47943a..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') @@ -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,26 @@ if (!isBuild) { btn = await page.$('button') 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') + 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/playground/hmr/icon.png b/packages/playground/hmr/icon.png new file mode 100644 index 00000000000000..4388bfdca3d4d7 Binary files /dev/null and b/packages/playground/hmr/icon.png differ 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/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/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/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/index.dist.html b/packages/playground/lib/index.dist.html index d6273923370aeb..9e0fac1f6b5730 100644 --- a/packages/playground/lib/index.dist.html +++ b/packages/playground/lib/index.dist.html @@ -5,7 +5,7 @@
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/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/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/playground/optimize-missing-deps/missing-dep/index.js b/packages/playground/optimize-missing-deps/missing-dep/index.js index f5d61c545d080a..63531f70e55ed0 100644 --- a/packages/playground/optimize-missing-deps/missing-dep/index.js +++ b/packages/playground/optimize-missing-deps/missing-dep/index.js @@ -1,5 +1,5 @@ -import { name } from 'multi-entry-dep' +const { name } = require('multi-entry-dep') -export function sayName() { +exports.sayName = () => { return name } diff --git a/packages/playground/optimize-missing-deps/package.json b/packages/playground/optimize-missing-deps/package.json index 431cf3b33c3847..8281a68664b03a 100644 --- a/packages/playground/optimize-missing-deps/package.json +++ b/packages/playground/optimize-missing-deps/package.json @@ -7,8 +7,7 @@ "postinstall": "ts-node ../../../scripts/patchFileDeps.ts" }, "dependencies": { - "missing-dep": "file:./missing-dep", - "multi-entry-dep": "file:./multi-entry-dep" + "missing-dep": "file:./missing-dep" }, "devDependencies": { "express": "^4.17.1" 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}
` +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/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/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/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/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-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/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/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/playground/worker/__tests__/es/es-worker.spec.ts b/packages/playground/worker/__tests__/es/es-worker.spec.ts index c7fd0d6c19e4bc..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(22) + 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 fa9f72fe76131c..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"' ) }) @@ -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 d846a5de2311d0..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(25) + 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/sourcemap-worker.spec.ts b/packages/playground/worker/__tests__/sourcemap/sourcemap-worker.spec.ts index 54e4f1cb9f2d58..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(25) + 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/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/README.md b/packages/plugin-legacy/README.md index 3c9fe67e107f7f..fc4167f4f1010f 100644 --- a/packages/plugin-legacy/README.md +++ b/packages/plugin-legacy/README.md @@ -27,22 +27,6 @@ export default { } ``` -When targeting IE11, you also need `regenerator-runtime`: - -```js -// vite.config.js -import legacy from '@vitejs/plugin-legacy' - -export default { - plugins: [ - legacy({ - targets: ['ie >= 11'], - additionalLegacyPolyfills: ['regenerator-runtime/runtime'] - }) - ] -} -``` - ## Options ### `targets` diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index 3734390a3cdf25..057cf6513bc11a 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": [ @@ -10,7 +10,7 @@ "main": "index.js", "types": "index.d.ts", "engines": { - "node": ">=12.0.0" + "node": ">=14.6.0" }, "repository": { "type": "git", @@ -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.0", + "@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/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 8c93db98aac027..813db5ecf23aed 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": [ @@ -21,7 +21,7 @@ "prepublishOnly": "(cd ../vite && npm run build) && npm run build" }, "engines": { - "node": ">=12.0.0" + "node": ">=14.6.0" }, "repository": { "type": "git", @@ -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-react/src/index.ts b/packages/plugin-react/src/index.ts index cefab59d94fe53..4ca3e0d371f6c9 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -38,15 +38,10 @@ export interface Options { * @default true */ jsxPure?: boolean - /** * Babel configuration applied in both dev and prod. */ babel?: BabelOptions - /** - * @deprecated Use `babel.parserOpts.plugins` instead - */ - parserPlugins?: ParserOptions['plugins'] } export type BabelOptions = Omit< @@ -104,7 +99,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] { babelOptions.presets ||= [] babelOptions.overrides ||= [] babelOptions.parserOpts ||= {} as any - babelOptions.parserOpts.plugins ||= opts.parserPlugins || [] + babelOptions.parserOpts.plugins ||= [] // Support patterns like: // - import * as React from 'react'; 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..c216e99bc3480d --- /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, { diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 487d207a0df24d..91ef19c2049850 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -10,7 +10,7 @@ "main": "index.js", "types": "index.d.ts", "engines": { - "node": ">=12.0.0" + "node": ">=14.6.0" }, "repository": { "type": "git", @@ -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/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..ef775fb0b1d15f 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": [ @@ -19,7 +19,7 @@ "prepublishOnly": "(cd ../vite && npm run build) && npm run build" }, "engines": { - "node": ">=12.0.0" + "node": ">=14.6.0" }, "repository": { "type": "git", diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index 44b1de74721efd..1b24856be1ecab 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 '.' @@ -212,6 +211,11 @@ export async function transformMain( code: resolvedCode, map: resolvedMap || { mappings: '' + }, + meta: { + vite: { + lang: descriptor.script?.lang || descriptor.scriptSetup?.lang || 'js' + } } } } @@ -426,8 +430,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 } diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 084a6363109266..3c967f289c1f34 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,61 @@ +## 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)) +* 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) +* 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/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 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 diff --git a/packages/vite/package.json b/packages/vite/package.json index 50f8487ad55895..55c86878622111 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.9.5", + "version": "2.9.8", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", @@ -17,7 +17,7 @@ "types" ], "engines": { - "node": ">=12.2.0" + "node": ">=14.6.0" }, "repository": { "type": "git", @@ -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,10 +52,10 @@ "fsevents": "~2.3.2" }, "devDependencies": { - "@ampproject/remapping": "^2.1.2", - "@babel/parser": "^7.17.9", - "@babel/types": "^7.17.0", - "@jridgewell/trace-mapping": "^0.3.4", + "@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", "@rollup/plugin-dynamic-import-vars": "^1.4.3", @@ -71,13 +71,13 @@ "@types/less": "^3.0.3", "@types/micromatch": "^4.0.2", "@types/mime": "^2.0.3", - "@types/node": "^16.11.27", - "@types/resolve": "^1.20.1", + "@types/node": "^17.0.25", + "@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/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/packages/vite/src/client/client.ts b/packages/vite/src/client/client.ts index 420d084ef9a981..48917204d8c291 100644 --- a/packages/vite/src/client/client.ts +++ b/packages/vite/src/client/client.ts @@ -106,6 +106,7 @@ async function handleMessage(payload: HMRPayload) { const payloadPath = base + payload.path.slice(1) if ( pagePath === payloadPath || + payload.path === '/index.html' || (pagePath.endsWith('/') && pagePath + 'index.html' === payloadPath) ) { location.reload() @@ -432,13 +433,6 @@ export function createHotContext(ownerPath: string): ViteHotContext { } }, - acceptDeps() { - throw new Error( - `hot.acceptDeps() is deprecated. ` + - `Use hot.accept() with the same signature instead.` - ) - }, - dispose(cb) { disposeMap.set(ownerPath, cb) }, 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__/cleanString.spec.ts b/packages/vite/src/node/__tests__/cleanString.spec.ts index 1065a2d4985ceb..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', () => { @@ -32,6 +33,35 @@ 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('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/__tests__/config.spec.ts b/packages/vite/src/node/__tests__/config.spec.ts index dd427c19433475..d5e6514392b852 100644 --- a/packages/vite/src/node/__tests__/config.spec.ts +++ b/packages/vite/src/node/__tests__/config.spec.ts @@ -157,51 +157,29 @@ describe('mergeConfig', () => { expect(mergeConfig(baseConfig, newConfig)).toEqual(mergedConfig) }) -}) - -describe('resolveConfig', () => { - beforeAll(() => { - // silence deprecation warning - jest.spyOn(console, 'warn').mockImplementation(() => {}) - }) - afterAll(() => { - jest.clearAllMocks() - }) - - test('copies optimizeDeps.keepNames to esbuildOptions.keepNames', async () => { - const config: InlineConfig = { - optimizeDeps: { - keepNames: false + test('handles ssr.noExternal', () => { + const baseConfig = { + ssr: { + noExternal: true } } - expect(await resolveConfig(config, 'serve')).toMatchObject({ - optimizeDeps: { - esbuildOptions: { - keepNames: false - } + const newConfig = { + ssr: { + noExternal: ['foo'] } - }) - }) + } - test('uses esbuildOptions.keepNames if set', async () => { - const config: InlineConfig = { - optimizeDeps: { - keepNames: true, - esbuildOptions: { - keepNames: false - } + const mergedConfig = { + ssr: { + noExternal: true } } - expect(await resolveConfig(config, 'serve')).toMatchObject({ - optimizeDeps: { - esbuildOptions: { - keepNames: false - } - } - }) + // merging either ways, `ssr.noExternal: true` should take highest priority + expect(mergeConfig(baseConfig, newConfig)).toEqual(mergedConfig) + expect(mergeConfig(newConfig, baseConfig)).toEqual(mergedConfig) }) }) 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/__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/build.ts b/packages/vite/src/node/build.ts index 31e88e7055baea..f926bcc47f0f41 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -38,15 +38,11 @@ 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' export interface BuildOptions { - /** - * Base public path when served in production. - * @deprecated `base` is now a root-level config option. - */ - base?: string /** * Compatibility transform target. The transform is performed with esbuild * and the lowest supported target is es2015/es6. Note this only handles @@ -70,13 +66,6 @@ export interface BuildOptions { * @default true */ polyfillModulePreload?: boolean - /** - * whether to inject dynamic import polyfill. - * Note: does not apply to library mode. - * @default false - * @deprecated use plugin-legacy for browsers that don't support dynamic import - */ - polyfillDynamicImport?: boolean /** * Directory relative from `root` where build output will be placed. If the * directory exists, it will be removed before the build. @@ -130,10 +119,6 @@ export interface BuildOptions { * https://terser.org/docs/api-reference#minify-options */ terserOptions?: Terser.MinifyOptions - /** - * @deprecated Vite now uses esbuild for CSS minification. - */ - cleanCssOptions?: any /** * Will be merged with internal rollup options. * https://rollupjs.org/guide/en/#big-list-of-options @@ -198,12 +183,6 @@ export interface BuildOptions { * Can slightly improve build speed. */ reportCompressedSize?: boolean - /** - * Set to false to disable brotli compressed size reporting for build. - * Can slightly improve build speed. - * @deprecated use `build.reportCompressedSize` instead. - */ - brotliSize?: boolean /** * Adjust chunk size warning limit (in kbs). * @default 500 @@ -225,13 +204,7 @@ export interface LibraryOptions { export type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife' -export type ResolvedBuildOptions = Required< - Omit< - BuildOptions, - // make deprecated options optional - 'base' | 'cleanCssOptions' | 'polyfillDynamicImport' | 'brotliSize' - > -> +export type ResolvedBuildOptions = Required export function resolveBuildOptions(raw?: BuildOptions): ResolvedBuildOptions { const resolved: ResolvedBuildOptions = { @@ -253,7 +226,6 @@ export function resolveBuildOptions(raw?: BuildOptions): ResolvedBuildOptions { ssr: false, ssrManifest: false, reportCompressedSize: true, - // brotliSize: true, chunkSizeWarningLimit: 500, watch: null, ...raw, @@ -451,15 +423,6 @@ async function doBuild( try { const buildOutputOptions = (output: OutputOptions = {}): OutputOptions => { - // @ts-ignore - if (output.output) { - config.logger.warn( - `You've set "rollupOptions.output.output" in your config. ` + - `This is deprecated and will override all Vite.js default output options. ` + - `Please use "rollupOptions.output" instead.` - ) - } - return { dir: outDir, format: ssr ? 'cjs' : 'es', @@ -601,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 } @@ -616,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/cleanString.ts b/packages/vite/src/node/cleanString.ts index 05163ea055b631..9b9ef656f4e017 100644 --- a/packages/vite/src/node/cleanString.ts +++ b/packages/vite/src/node/cleanString.ts @@ -1,8 +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 cleanerRE = /"[^"]*"|'[^']*'|\/\*(.|[\r\n])*?\*\/|\/\/.*/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) => @@ -24,10 +30,21 @@ export function emptyString(raw: string): string { return res } +export function emptyCssComments(raw: string) { + return raw.replace(multilineCommentsRE, blankReplacer) +} + const enum LexerState { + // template string inTemplateString, inInterpolationExpression, - inObjectExpression + inObjectExpression, + // strings + inSingleQuoteString, + inDoubleQuoteString, + // comments + inMultilineCommentsRE, + inSinglelineCommentsRE } function replaceAt( diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 556fcf7cbae77a..29dc3fe2045a5a 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -176,17 +176,6 @@ export interface UserConfig { * @default 'VITE_' */ envPrefix?: string | string[] - /** - * Import aliases - * @deprecated use `resolve.alias` instead - */ - alias?: AliasOptions - /** - * Force Vite to always resolve listed dependencies to the same copy (from - * project root). - * @deprecated use `resolve.dedupe` instead - */ - dedupe?: string[] /** * Worker bundle options */ @@ -235,10 +224,7 @@ export interface InlineConfig extends UserConfig { } export type ResolvedConfig = Readonly< - Omit< - UserConfig, - 'plugins' | 'alias' | 'dedupe' | 'assetsInclude' | 'optimizeDeps' | 'worker' - > & { + Omit & { configFile: string | undefined configFileDependencies: string[] inlineConfig: InlineConfig @@ -261,7 +247,7 @@ export type ResolvedConfig = Readonly< assetsInclude: (file: string) => boolean logger: Logger createResolver: (options?: Partial) => ResolveFn - optimizeDeps: Omit + optimizeDeps: DepOptimizationOptions /** @internal */ packageCache: PackageCache worker: ResolveWorkerOptions @@ -370,12 +356,11 @@ export async function resolveConfig( // @ts-ignore because @rollup/plugin-alias' type doesn't allow function // replacement, but its implementation does work with function values. clientAlias, - config.resolve?.alias || config.alias || [] + config.resolve?.alias || [] ) ) const resolveOptions: ResolvedConfig['resolve'] = { - dedupe: config.dedupe, ...config.resolve, alias: resolvedAlias } @@ -461,7 +446,7 @@ export async function resolveConfig( ) : '' - const server = resolveServerOptions(resolvedRoot, config.server) + const server = resolveServerOptions(resolvedRoot, config.server, logger) const optimizeDeps = config.optimizeDeps || {} @@ -501,7 +486,6 @@ export async function resolveConfig( optimizeDeps: { ...optimizeDeps, esbuildOptions: { - keepNames: optimizeDeps.keepNames, preserveSymlinks: config.resolve?.preserveSymlinks, ...optimizeDeps.esbuildOptions } @@ -540,117 +524,6 @@ export async function resolveConfig( }) } - // TODO Deprecation warnings - remove when out of beta - - const logDeprecationWarning = ( - deprecatedOption: string, - hint: string, - error?: Error - ) => { - logger.warn( - colors.yellow( - colors.bold( - `(!) "${deprecatedOption}" option is deprecated. ${hint}${ - error ? `\n${error.stack}` : '' - }` - ) - ) - ) - } - - if (config.build?.base) { - logDeprecationWarning( - 'build.base', - '"base" is now a root-level config option.' - ) - config.base = config.build.base - } - Object.defineProperty(resolvedBuildOptions, 'base', { - enumerable: false, - get() { - logDeprecationWarning( - 'build.base', - '"base" is now a root-level config option.', - new Error() - ) - return resolved.base - } - }) - - if (config.alias) { - logDeprecationWarning('alias', 'Use "resolve.alias" instead.') - } - Object.defineProperty(resolved, 'alias', { - enumerable: false, - get() { - logDeprecationWarning( - 'alias', - 'Use "resolve.alias" instead.', - new Error() - ) - return resolved.resolve.alias - } - }) - - if (config.dedupe) { - logDeprecationWarning('dedupe', 'Use "resolve.dedupe" instead.') - } - Object.defineProperty(resolved, 'dedupe', { - enumerable: false, - get() { - logDeprecationWarning( - 'dedupe', - 'Use "resolve.dedupe" instead.', - new Error() - ) - return resolved.resolve.dedupe - } - }) - - if (optimizeDeps.keepNames) { - logDeprecationWarning( - 'optimizeDeps.keepNames', - 'Use "optimizeDeps.esbuildOptions.keepNames" instead.' - ) - } - Object.defineProperty(resolved.optimizeDeps, 'keepNames', { - enumerable: false, - get() { - logDeprecationWarning( - 'optimizeDeps.keepNames', - 'Use "optimizeDeps.esbuildOptions.keepNames" instead.', - new Error() - ) - return resolved.optimizeDeps.esbuildOptions?.keepNames - } - }) - - if (config.build?.polyfillDynamicImport) { - logDeprecationWarning( - 'build.polyfillDynamicImport', - '"polyfillDynamicImport" has been removed. Please use @vitejs/plugin-legacy if your target browsers do not support dynamic imports.' - ) - } - - Object.defineProperty(resolvedBuildOptions, 'polyfillDynamicImport', { - enumerable: false, - get() { - logDeprecationWarning( - 'build.polyfillDynamicImport', - '"polyfillDynamicImport" has been removed. Please use @vitejs/plugin-legacy if your target browsers do not support dynamic imports.', - new Error() - ) - return false - } - }) - - if (config.build?.cleanCssOptions) { - logDeprecationWarning( - 'build.cleanCssOptions', - 'Vite now uses esbuild for CSS minification.' - ) - } - if (config.build?.terserOptions && config.build.minify !== 'terser') { logger.warn( colors.yellow( @@ -745,7 +618,12 @@ function mergeConfigRecursively( } else if (key === 'assetsInclude' && rootPath === '') { merged[key] = [].concat(existing, value) continue - } else if (key === 'noExternal' && existing === true) { + } else if ( + key === 'noExternal' && + rootPath === 'ssr' && + (existing === true || value === true) + ) { + merged[key] = true continue } diff --git a/packages/vite/src/node/importGlob.ts b/packages/vite/src/node/importGlob.ts index c8f86491ffbc1f..7e7144a3ace7e0 100644 --- a/packages/vite/src/node/importGlob.ts +++ b/packages/vite/src/node/importGlob.ts @@ -31,12 +31,6 @@ interface GlobParams { interface GlobOptions { as?: string - /** - * @deprecated - */ - assert?: { - type: string - } } interface DynamicImportRequest { @@ -234,19 +228,8 @@ export async function transformImportGlob( const [userPattern, options, endIndex] = lexGlobPattern(source, pos) const query: DynamicImportRequest = {} - // TODO remove assert syntax for the Vite 3.0 release. - const isRawAssert = options?.assert?.type === 'raw' const isRawType = options?.as === 'raw' - if (isRawType || isRawAssert) { - if (isRawAssert) { - logger.warn( - colors.yellow( - colors.bold( - "(!) import.meta.glob('...', { assert: { type: 'raw' }}) is deprecated. Use import.meta.glob('...', { as: 'raw' }) instead." - ) - ) - ) - } + if (isRawType) { query.raw = true } try { diff --git a/packages/vite/src/node/index.ts b/packages/vite/src/node/index.ts index 2e849d846527ca..c15359f45b69de 100644 --- a/packages/vite/src/node/index.ts +++ b/packages/vite/src/node/index.ts @@ -4,7 +4,7 @@ export { preview } from './preview' export { build } from './build' export { optimizeDeps } from './optimizer' export { send } from './server/send' -export { createLogger, printHttpServerUrls } from './logger' +export { createLogger } from './logger' export { formatPostcssSourceMap } from './plugins/css' export { transformWithEsbuild } from './plugins/esbuild' export { resolvePackageEntry } from './plugins/resolve' diff --git a/packages/vite/src/node/logger.ts b/packages/vite/src/node/logger.ts index b6cf76f2aaa432..4f5784aeb527ff 100644 --- a/packages/vite/src/node/logger.ts +++ b/packages/vite/src/node/logger.ts @@ -144,16 +144,6 @@ export function createLogger( return logger } -/** - * @deprecated Use `server.printUrls()` instead - */ -export function printHttpServerUrls( - server: Server, - config: ResolvedConfig -): void { - printCommonServerUrls(server, config.server, config) -} - export function printCommonServerUrls( server: Server, options: CommonServerOptions, @@ -190,7 +180,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/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index 3828cb2fbce18b..33419e0d186487 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' @@ -70,7 +72,6 @@ export interface DepOptimizationOptions { * * - `external` is also omitted, use Vite's `optimizeDeps.exclude` option * - `plugins` are merged with Vite's dep plugin - * - `keepNames` takes precedence over the deprecated `optimizeDeps.keepNames` * * https://esbuild.github.io/api */ @@ -87,10 +88,6 @@ export interface DepOptimizationOptions { | 'outExtension' | 'metafile' > - /** - * @deprecated use `esbuildOptions.keepNames` - */ - keepNames?: boolean /** * List of file extensions that can be optimized. A corresponding esbuild * plugin must exist to handle the specific extension. @@ -116,7 +113,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 +191,7 @@ export async function optimizeDeps( const result = await runOptimizeDeps(config, depsInfo) - result.commit() + await result.commit() return result.metadata } @@ -376,7 +373,7 @@ export async function runOptimizeDeps( metadata, commit() { // Write metadata file, delete `deps` folder and rename the `processing` folder to `deps` - commitProcessingDepsCacheSync() + return commitProcessingDepsCacheSync() }, cancel } @@ -445,7 +442,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] @@ -529,16 +526,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 +543,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 { @@ -790,7 +780,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/packages/vite/src/node/optimizer/registerMissing.ts b/packages/vite/src/node/optimizer/registerMissing.ts index ee4824389c202b..53cd7e981b1b61 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) @@ -296,7 +296,6 @@ export function createOptimizedDeps(server: ViteDevServer): OptimizedDeps { // Reset missing deps, let the server rediscover the dependencies metadata.discovered = {} - fullReload() } currentlyProcessing = false 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 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 2f5ab3df58b46a..cd57acd1690902 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' @@ -48,6 +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' // const debug = createDebugger('vite:css') @@ -102,6 +104,7 @@ const commonjsProxyRE = /\?commonjs-proxy/ const inlineRE = /(\?|&)inline\b/ const inlineCSSRE = /(\?|&)inline-css\b/ const usedRE = /(\?|&)used\b/ +const varRE = /^var\(/i const enum PreprocessLang { less = 'less', @@ -298,10 +301,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) + + // #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)) { @@ -322,6 +332,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) @@ -346,10 +360,9 @@ 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)}`, + `${getAssetHash(cleanUrl(id))}_${Number.parseInt(query!.index)}`, css ) return `export default ''` @@ -360,12 +373,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 ''` @@ -717,12 +732,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 } @@ -785,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, @@ -872,32 +886,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 } } @@ -941,14 +946,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 } @@ -968,7 +981,7 @@ export const cssUrlRE = export const cssDataUriRE = /(?<=^|[^\w\-\u0080-\uffff])data-uri\(\s*('[^']+'|"[^"]+"|[^'")]+)\s*\)/ export const importCssRE = /@import ('[^']+\.css'|"[^"]+\.css"|[^'")]+\.css)/ -const cssImageSetRE = /image-set\(([^)]+)\)/ +const cssImageSetRE = /(?<=image-set\()((?:[\w\-]+\([^\)]*\)|[^)])*)(?=\))/ const UrlRewritePostcssPlugin: PostCSS.PluginCreator<{ replacer: CssUrlReplacer @@ -989,7 +1002,9 @@ const UrlRewritePostcssPlugin: PostCSS.PluginCreator<{ const importer = declaration.source?.input.file return opts.replacer(rawUrl, importer) } - const rewriterToUse = isCssUrl ? rewriteCssUrls : rewriteCssImageSet + const rewriterToUse = isCssImageSet + ? rewriteCssImageSet + : rewriteCssUrls promises.push( rewriterToUse(declaration.value, replacerForDeclaration).then( (url) => { @@ -1042,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( @@ -1061,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 } @@ -1117,27 +1142,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) => { + while ((match = atCharsetRE.exec(cleanCss))) { + s.remove(match.index, match.index + match[0].length) if (!foundCharset) { - s.prepend(match) + s.prepend(match[0]) foundCharset = true } - return '' - }) + } + return s.toString() } 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 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 } } diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index 5c86b6c0ac6073..0223c351af6071 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,9 +45,10 @@ 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 = /(? htmlProxyRE.test(id) @@ -61,8 +63,8 @@ export const htmlProxyMap = new WeakMap< >() // 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 { @@ -245,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 @@ -337,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) } @@ -372,12 +380,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 } ) } @@ -390,8 +398,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"` + const hash = getAssetHash(cleanUrl(id)) + // will transform in `applyHtmlTransforms` + s.overwrite( + styleNode.loc.start.offset, + styleNode.loc.end.offset, + `__VITE_INLINE_CSS__${hash}_${inlineModuleIndex}__`, + { contentOnly: true } + ) } if (shouldRemove) { @@ -461,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 @@ -713,8 +747,6 @@ export function resolveHtmlTransforms( return [preHooks, postHooks] } -export const maybeVirtualHtmlSet = new Set() - export async function applyHtmlTransforms( html: string, hooks: IndexHtmlTransformHook[], @@ -725,8 +757,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/plugins/importAnalysis.ts b/packages/vite/src/node/plugins/importAnalysis.ts index 6ab463a20b4819..a416b6adddc1b9 100644 --- a/packages/vite/src/node/plugins/importAnalysis.ts +++ b/packages/vite/src/node/plugins/importAnalysis.ts @@ -60,7 +60,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/ @@ -132,7 +133,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/plugins/importAnalysisBuild.ts b/packages/vite/src/node/plugins/importAnalysisBuild.ts index 91ce663b9f8111..7e684db2b4cc6b 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,9 @@ 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 + +const dynamicImportPrefixRE = /import\s*\(/ /** * Helper for preloading CSS and direct imports of async chunks in parallel to @@ -85,8 +89,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'` @@ -116,16 +120,12 @@ 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 } - if (isWorker) { - // preload method use `document` and can't run in the worker - return - } - await init let imports: readonly ImportSpecifier[] = [] @@ -157,6 +157,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, @@ -263,8 +275,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 +338,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 +357,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/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/packages/vite/src/node/plugins/reporter.ts b/packages/vite/src/node/plugins/reporter.ts index 08650a86e2c38c..808e8040cba9f7 100644 --- a/packages/vite/src/node/plugins/reporter.ts +++ b/packages/vite/src/node/plugins/reporter.ts @@ -33,11 +33,7 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin { } async function getCompressedSize(code: string | Uint8Array): Promise { - if ( - config.build.ssr || - !config.build.reportCompressedSize || - config.build.brotliSize === false - ) { + if (config.build.ssr || !config.build.reportCompressedSize) { return '' } return ` / gzip: ${( 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/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') } } 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( diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index 99aefea6de292a..b8f1c3330a9b48 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -41,9 +41,6 @@ import { openBrowser } from './openBrowser' import launchEditorMiddleware from 'launch-editor-middleware' import type { TransformOptions, TransformResult } from './transformRequest' import { transformRequest } from './transformRequest' -import type { ESBuildTransformResult } from '../plugins/esbuild' -import { transformWithEsbuild } from '../plugins/esbuild' -import type { TransformOptions as EsbuildTransformOptions } from 'esbuild' import { ssrLoadModule } from '../ssr/ssrModuleLoader' import { resolveSSRExternal } from '../ssr/ssrExternal' import { @@ -56,6 +53,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 +90,8 @@ export interface ServerOptions extends CommonServerOptions { fs?: FileSystemServeOptions /** * Origin for the generated asset URLs. + * + * @example `http://127.0.0.1:8080` */ origin?: string /** @@ -156,10 +156,6 @@ export interface ViteDevServer { * https://github.com/senchalabs/connect#use-middleware */ middlewares: Connect.Server - /** - * @deprecated use `server.middlewares` instead - */ - app: Connect.Server /** * native Node http server instance * will be null in middleware mode @@ -199,18 +195,6 @@ export interface ViteDevServer { html: string, originalUrl?: string ): Promise - /** - * Util for transforming a file with esbuild. - * Can be useful for certain plugins. - * - * @deprecated import `transformWithEsbuild` from `vite` instead - */ - transformWithEsbuild( - code: string, - filename: string, - options?: EsbuildTransformOptions, - inMap?: object - ): Promise /** * Transform module code into SSR format. * @experimental @@ -342,19 +326,12 @@ export async function createServer( const server: ViteDevServer = { config, middlewares, - get app() { - config.logger.warn( - `ViteDevServer.app is deprecated. Use ViteDevServer.middlewares instead.` - ) - return middlewares - }, httpServer, watcher, pluginContainer: container, ws, moduleGraph, ssrTransform, - transformWithEsbuild, transformRequest(url, options) { return transformRequest(url, server, options) }, @@ -701,7 +678,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 +705,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 } diff --git a/packages/vite/src/node/server/middlewares/indexHtml.ts b/packages/vite/src/node/server/middlewares/indexHtml.ts index ca2538bd9507ed..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,15 +16,31 @@ import { } from '../../plugins/html' 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 { + CLIENT_PUBLIC_PATH, + FS_PREFIX, + VALID_ID_PREFIX, + NULL_BYTE_PLACEHOLDER +} from '../../constants' +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,41 +111,62 @@ const devHtmlHook: IndexHtmlTransformHook = async ( html, { path: htmlPath, filename, server, originalUrl } ) => { - const { config, moduleGraph } = server! + 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' | 'css') => { + 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) if (module) { server?.moduleGraph.invalidateModule(module) } - s.overwrite( node.loc.start.offset, node.loc.end.offset, @@ -154,7 +192,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 +215,19 @@ const devHtmlHook: IndexHtmlTransformHook = async ( } }) + await Promise.all( + styleUrl.map(async ({ start, end, code }, index) => { + 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, mod.id!) + s.overwrite(start, end, result?.code || '') + }) + ) + html = s.toString() return { diff --git a/packages/vite/src/node/server/moduleGraph.ts b/packages/vite/src/node/server/moduleGraph.ts index e470fafb05d8fd..1d7ae407f110c5 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, @@ -10,6 +11,7 @@ import { } from '../utils' import { FS_PREFIX } from '../constants' import type { TransformResult } from './transformRequest' +import { canSkipImportAnalysis } from '../plugins/importAnalysis' export class ModuleNode { /** @@ -31,12 +33,19 @@ export class ModuleNode { transformResult: TransformResult | null = null ssrTransformResult: TransformResult | null = null ssrModule: Record | null = null + ssrError: Error | null = null lastHMRTimestamp = 0 lastInvalidationTimestamp = 0 constructor(url: string) { this.url = url this.type = isDirectCSSRequest(url) ? 'css' : 'js' + // #7870 + // The `isSelfAccepting` value is set by importAnalysis, but some + // assets don't go through importAnalysis. + if (isHTMLRequest(url) || canSkipImportAnalysis(url)) { + this.isSelfAccepting = false + } } } diff --git a/packages/vite/src/node/server/sourcemap.ts b/packages/vite/src/node/server/sourcemap.ts index dc77c4a4714298..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 }) @@ -61,7 +59,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/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[]) { 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/__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/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) 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 diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 16391df8c73df3..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, @@ -228,7 +229,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) { @@ -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, @@ -545,6 +555,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 +563,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) @@ -605,7 +618,8 @@ const nullSourceMap: RawSourceMap = { } export function combineSourcemaps( filename: string, - sourcemapList: Array + sourcemapList: Array, + excludeContent = true ): RawSourceMap { if ( sourcemapList.length === 0 || @@ -635,7 +649,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 +660,7 @@ export function combineSourcemaps( return null } }, - true + excludeContent ) } if (!map.file) { @@ -733,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) + }) +} diff --git a/packages/vite/types/hot.d.ts b/packages/vite/types/hot.d.ts index f06846ff59d530..daaf44e1efdc74 100644 --- a/packages/vite/types/hot.d.ts +++ b/packages/vite/types/hot.d.ts @@ -7,12 +7,6 @@ export interface ViteHotContext { accept(cb: (mod: any) => void): void accept(dep: string, cb: (mod: any) => void): void accept(deps: readonly string[], cb: (mods: any[]) => void): void - - /** - * @deprecated - */ - acceptDeps(): never - dispose(cb: (data: any) => void): void decline(): void invalidate(): void diff --git a/packages/vite/types/importMeta.d.ts b/packages/vite/types/importMeta.d.ts index 900b975d37d6ad..06dcb52b9ad954 100644 --- a/packages/vite/types/importMeta.d.ts +++ b/packages/vite/types/importMeta.d.ts @@ -9,12 +9,6 @@ // in vite/client.d.ts and in production src/node/importGlob.ts doesn't exist. interface GlobOptions { as?: string - /** - * @deprecated - */ - assert?: { - type: string - } } interface ImportMeta { diff --git a/packages/vite/types/terser.d.ts b/packages/vite/types/terser.d.ts index 44c7398d508259..5c24660eb98781 100644 --- a/packages/vite/types/terser.d.ts +++ b/packages/vite/types/terser.d.ts @@ -185,8 +185,6 @@ export namespace Terser { module?: boolean nameCache?: object format?: FormatOptions - /** @deprecated use format instead */ - output?: FormatOptions parse?: ParseOptions safari10?: boolean sourceMap?: boolean | SourceMapOptions diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 235dd8c48a30ca..d3aea697843c5b 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': ^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 - '@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-define-config: ^1.3.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.3.8 + 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': 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 - '@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-define-config: 1.3.0 - eslint-plugin-node: 11.1.0_eslint@8.13.0 + eslint: 8.14.0 + eslint-define-config: 1.4.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.3.8 + lint-staged: 12.4.1 minimist: 1.2.6 node-fetch: 2.6.6 npm-run-all: 4.1.5 @@ -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 @@ -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: @@ -317,6 +323,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 +343,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 +379,9 @@ importers: dependencies: react: 17.0.2 + packages/playground/optimize-deps/dep-node-env: + specifiers: {} + packages/playground/optimize-deps/dep-not-js: specifiers: {} @@ -390,10 +401,8 @@ importers: specifiers: express: ^4.17.1 missing-dep: file:./missing-dep - multi-entry-dep: file:./multi-entry-dep dependencies: missing-dep: link:missing-dep - multi-entry-dep: link:multi-entry-dep devDependencies: express: 4.17.2 @@ -617,14 +626,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 @@ -656,6 +665,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: @@ -665,6 +675,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: @@ -723,6 +734,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: @@ -730,6 +742,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: @@ -743,36 +756,36 @@ importers: packages/plugin-legacy: specifiers: - '@babel/standalone': ^7.17.9 - core-js: ^3.22.0 + '@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.0 + '@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: @@ -797,26 +810,26 @@ 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 - '@jridgewell/trace-mapping': ^0.3.4 + '@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 '@rollup/plugin-dynamic-import-vars': ^1.4.3 @@ -832,13 +845,13 @@ importers: '@types/less': ^3.0.3 '@types/micromatch': ^4.0.2 '@types/mime': ^2.0.3 - '@types/node': ^16.11.27 - '@types/resolve': ^1.20.1 + '@types/node': ^17.0.25 + '@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 @@ -866,7 +879,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 @@ -878,29 +891,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 - '@jridgewell/trace-mapping': 0.3.4 + '@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 @@ -910,13 +923,13 @@ importers: '@types/less': 3.0.3 '@types/micromatch': 4.0.2 '@types/mime': 2.0.3 - '@types/node': 16.11.27 - '@types/resolve': 1.20.1 + '@types/node': 17.0.25 + '@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 @@ -942,20 +955,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: @@ -1080,7 +1093,16 @@ 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 + 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==} @@ -1099,25 +1121,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 @@ -1125,21 +1147,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 @@ -1148,7 +1170,7 @@ packages: semver: 6.3.0 transitivePeerDependencies: - supports-color - dev: false + dev: true /@babel/generator/7.16.5: resolution: {integrity: sha512-kIvCdjZqcdKqoDbVVdt5R99icaRtrtYhYK/xux5qiWCBmfdvEYMFZ68QCrpE5cbFM1JsuArUNs1ZkuKtTtUcZA==} @@ -1177,13 +1199,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: @@ -1206,26 +1228,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 @@ -1241,7 +1263,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==} @@ -1256,7 +1278,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: @@ -1276,7 +1298,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==} @@ -1323,8 +1345,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 @@ -1368,14 +1390,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==} @@ -1405,8 +1427,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 @@ -1444,6 +1466,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'} @@ -1491,23 +1518,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==} @@ -1527,23 +1554,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 @@ -1620,80 +1647,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 @@ -1704,8 +1731,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 @@ -1723,8 +1750,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==} @@ -1780,18 +1807,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: @@ -1819,6 +1846,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 @@ -1950,8 +1984,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 @@ -2012,7 +2046,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 +2067,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 +2104,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 +2114,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 +2143,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,15 +2227,26 @@ 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 + /@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==} @@ -2210,6 +2255,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==} @@ -2228,30 +2280,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: @@ -2389,7 +2441,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: @@ -2400,7 +2452,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 @@ -2423,8 +2475,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 @@ -2437,15 +2489,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 @@ -2534,7 +2586,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: @@ -2554,19 +2606,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: @@ -2630,8 +2682,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: @@ -2648,23 +2700,23 @@ 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: - 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: resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==} dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 dev: true /@types/semver/7.3.9: @@ -2682,13 +2734,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: @@ -2705,12 +2757,12 @@ packages: resolution: {integrity: sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==} requiresBuild: true dependencies: - '@types/node': 16.11.27 + '@types/node': 17.0.25 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 @@ -2720,12 +2772,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 @@ -2736,8 +2788,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 @@ -2746,26 +2798,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: '*' @@ -2774,22 +2826,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: '*' @@ -2797,8 +2849,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 @@ -2809,29 +2861,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 @@ -2839,11 +2891,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 @@ -2875,11 +2927,10 @@ 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 - dev: true /@vue/compiler-dom/3.2.26: resolution: {integrity: sha512-smBfaOW6mQDxcT3p9TKT6mE22vjxjJL50GFVJiI0chXYGU/xzC05QRGrW3HHVuJrmLTLx5zBhsZ2dIATERbarg==} @@ -2898,7 +2949,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==} @@ -2941,7 +2991,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==} @@ -2960,7 +3009,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==} @@ -2992,7 +3040,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==} @@ -3008,7 +3055,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==} @@ -3027,7 +3073,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==} @@ -3049,7 +3094,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==} @@ -3077,7 +3121,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==} @@ -3087,7 +3130,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==} @@ -3125,12 +3167,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: @@ -3161,6 +3203,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 @@ -3355,7 +3403,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 @@ -3518,6 +3566,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'} @@ -3602,6 +3662,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'} @@ -4081,8 +4145,8 @@ packages: is-what: 3.14.1 dev: true - /core-js/3.22.0: - resolution: {integrity: sha512-8h9jBweRjMiY+ORO7bdWSeWfHhLPO7whobj7Z2Bl0IDo00C228EdGgH7FE4jGumbEjzcFfkfW8bXgdkEDhnwHQ==} + /core-js/3.22.3: + resolution: {integrity: sha512-1t+2a/d2lppW1gkLXx3pKPVGbBdxXAkqztvWb1EJ8oF8O2gIGiytzflNiFEehYwVK/t2ryUsGBoOFFvNx95mbg==} requiresBuild: true dev: false @@ -4458,6 +4522,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==} @@ -4787,30 +4855,30 @@ 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: + /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 @@ -4841,13 +4909,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 @@ -4866,12 +4934,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 @@ -4880,7 +4948,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 @@ -4914,8 +4982,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 @@ -5168,7 +5236,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 +5244,6 @@ packages: peerDependenciesMeta: debug: optional: true - dependencies: - debug: 4.3.4 /form-data/3.0.1: resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==} @@ -5578,7 +5644,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 @@ -5609,13 +5675,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: @@ -6004,7 +6070,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 @@ -6082,12 +6148,12 @@ 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 strip-json-comments: 3.1.1 - ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 + ts-node: 10.4.0_233d9fcfccc8abc8f146a08357d842da transitivePeerDependencies: - bufferutil - canvas @@ -6130,7 +6196,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 @@ -6148,7 +6214,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 @@ -6164,7 +6230,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 @@ -6186,7 +6252,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 @@ -6241,7 +6307,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: @@ -6297,7 +6363,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 @@ -6354,7 +6420,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 @@ -6393,7 +6459,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 @@ -6418,7 +6484,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 @@ -6429,7 +6495,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 @@ -6495,7 +6561,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 @@ -6663,8 +6729,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.1: + resolution: {integrity: sha512-PTXgzpflrQ+pODQTG116QNB+Q6uUTDg5B5HqGvNhoQSGt8Qy+MA/6zSnR8n38+sxP5TapzeQGTvoKni0KRS8Vg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hasBin: true dependencies: @@ -6775,6 +6841,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 @@ -7094,6 +7164,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 @@ -7169,6 +7245,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'} @@ -7605,13 +7685,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 @@ -7647,7 +7727,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 @@ -7663,11 +7743,11 @@ 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 - /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: @@ -7680,53 +7760,53 @@ packages: optional: true dependencies: lilconfig: 2.0.5 - postcss: 8.4.12 - ts-node: 10.4.0_8726306ae516cefbf62490d54d06d905 + 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 @@ -7734,11 +7814,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 @@ -7790,6 +7870,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} @@ -8086,8 +8175,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 @@ -8382,7 +8471,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: @@ -8661,6 +8750,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==} @@ -9080,14 +9176,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 @@ -9193,6 +9289,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'} @@ -9246,7 +9348,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: @@ -9265,7 +9367,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 @@ -9297,6 +9399,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'} @@ -9379,6 +9485,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'} @@ -9525,6 +9637,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: @@ -9551,7 +9672,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==} @@ -9562,6 +9682,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: @@ -9599,6 +9728,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'} @@ -9625,6 +9758,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'} @@ -9740,8 +9881,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 diff --git a/scripts/jestPerTestSetup.ts b/scripts/jestPerTestSetup.ts index fcdca77ee9a6eb..098784ae76c2af 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] @@ -115,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' }, @@ -234,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) }