From 5d97de1548af17869ae7027094e76bf3f1ace64e Mon Sep 17 00:00:00 2001 From: Niputi <7137178+Niputi@users.noreply.github.com> Date: Tue, 18 Jan 2022 17:39:20 +0100 Subject: [PATCH 001/309] chore(deps): update postcss config loader (#6532) --- packages/vite/package.json | 2 +- packages/vite/rollup.config.js | 4 ---- pnpm-lock.yaml | 21 +++++++++++++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/packages/vite/package.json b/packages/vite/package.json index 7fe458f4b33b51..62fa3d3b88d5e8 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -105,7 +105,7 @@ "periscopic": "^2.0.3", "picocolors": "^1.0.0", "postcss-import": "^14.0.2", - "postcss-load-config": "^3.1.0", + "postcss-load-config": "^3.1.1", "postcss-modules": "^4.3.0", "resolve.exports": "^1.1.0", "rollup-plugin-license": "^2.6.0", diff --git a/packages/vite/rollup.config.js b/packages/vite/rollup.config.js index 9677697ec20e7a..31ab56cd07e02e 100644 --- a/packages/vite/rollup.config.js +++ b/packages/vite/rollup.config.js @@ -168,10 +168,6 @@ const createNodeConfig = (isProduction) => { src: 'require("sugarss")', replacement: `eval('require')('sugarss')` }, - 'import-from/index.js': { - pattern: /require\(resolveFrom/g, - replacement: `eval('require')(resolveFrom` - }, 'lilconfig/dist/index.js': { pattern: /: require,/g, replacement: `: eval('require'),` diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 129a4927d966d6..0cbdc75dcc4abc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -789,7 +789,7 @@ importers: picocolors: ^1.0.0 postcss: ^8.4.5 postcss-import: ^14.0.2 - postcss-load-config: ^3.1.0 + postcss-load-config: ^3.1.1 postcss-modules: ^4.3.0 resolve: ^1.20.0 resolve.exports: ^1.1.0 @@ -864,7 +864,7 @@ importers: periscopic: 2.0.3 picocolors: 1.0.0 postcss-import: 14.0.2_postcss@8.4.5 - postcss-load-config: 3.1.0_ts-node@10.4.0 + postcss-load-config: 3.1.1_ts-node@10.4.0 postcss-modules: 4.3.0_postcss@8.4.5 resolve.exports: 1.1.0 rollup-plugin-license: 2.6.0_rollup@2.62.0 @@ -5022,6 +5022,7 @@ packages: engines: {node: '>=8'} dependencies: import-from: 3.0.0 + dev: false /import-fresh/3.3.0: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} @@ -5035,6 +5036,7 @@ packages: engines: {node: '>=8'} dependencies: resolve-from: 5.0.0 + dev: false /import-lazy/4.0.0: resolution: {integrity: sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==} @@ -6979,6 +6981,21 @@ packages: lilconfig: 2.0.4 ts-node: 10.4.0_00264fd83560919cd06c986889baae0a yaml: 1.10.2 + dev: false + + /postcss-load-config/3.1.1_ts-node@10.4.0: + resolution: {integrity: sha512-c/9XYboIbSEUZpiD1UQD0IKiUe8n9WHYV7YFe7X7J+ZwCsEKkUJSFWjS9hBU1RR9THR7jMXst8sxiqP0jjo2mg==} + engines: {node: '>= 10'} + peerDependencies: + ts-node: '>=9.0.0' + peerDependenciesMeta: + ts-node: + optional: true + dependencies: + lilconfig: 2.0.4 + ts-node: 10.4.0_00264fd83560919cd06c986889baae0a + yaml: 1.10.2 + dev: true /postcss-modules-extract-imports/3.0.0_postcss@8.4.5: resolution: {integrity: sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==} From e6b06e535fb26e064f5c341703df4bcb30aa6432 Mon Sep 17 00:00:00 2001 From: mori yuta <59682979+utamori@users.noreply.github.com> Date: Wed, 19 Jan 2022 02:09:11 +0900 Subject: [PATCH 002/309] docs: align npm commands to other pms (create and add) (#6550) --- docs/guide/features.md | 6 +++--- docs/guide/index.md | 6 +++--- docs/guide/using-plugins.md | 2 +- packages/create-vite/README.md | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/guide/features.md b/docs/guide/features.md index 2053a087517eac..da8e3b1de092b2 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -191,13 +191,13 @@ That said, Vite does provide built-in support for `.scss`, `.sass`, `.less`, `.s ```bash # .scss and .sass -npm install -D sass +npm add -D sass # .less -npm install -D less +npm add -D less # .styl and .stylus -npm install -D stylus +npm add -D stylus ``` If using Vue single file components, this also automatically enables ` diff --git a/packages/playground/vue-lib/src-lib/CompB.vue b/packages/playground/vue-lib/src-lib/CompB.vue new file mode 100644 index 00000000000000..cca30168fb6753 --- /dev/null +++ b/packages/playground/vue-lib/src-lib/CompB.vue @@ -0,0 +1,8 @@ + + diff --git a/packages/playground/vue-lib/src-lib/index.ts b/packages/playground/vue-lib/src-lib/index.ts new file mode 100644 index 00000000000000..f83abd4ec72118 --- /dev/null +++ b/packages/playground/vue-lib/src-lib/index.ts @@ -0,0 +1,2 @@ +export { default as CompA } from './CompA.vue' +export { default as CompB } from './CompB.vue' diff --git a/packages/playground/vue-lib/vite.config.consumer.ts b/packages/playground/vue-lib/vite.config.consumer.ts new file mode 100644 index 00000000000000..9e75b5cfbeabcb --- /dev/null +++ b/packages/playground/vue-lib/vite.config.consumer.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' + +export default defineConfig({ + root: __dirname, + build: { + outDir: 'dist/consumer' + }, + plugins: [vue()] +}) diff --git a/packages/playground/vue-lib/vite.config.lib.ts b/packages/playground/vue-lib/vite.config.lib.ts new file mode 100644 index 00000000000000..a888382d008a8c --- /dev/null +++ b/packages/playground/vue-lib/vite.config.lib.ts @@ -0,0 +1,23 @@ +import path from 'path' +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' + +export default defineConfig({ + root: __dirname, + build: { + outDir: 'dist/lib', + lib: { + entry: path.resolve(__dirname, 'src-lib/index.ts'), + name: 'MyVueLib', + formats: ['es'], + fileName: (format) => `my-vue-lib.${format}.js` + }, + rollupOptions: { + external: ['vue'], + output: { + globals: { vue: 'Vue' } + } + } + }, + plugins: [vue()] +}) diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index 29c5cffa4cfa81..3df0e664748dd5 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -299,7 +299,7 @@ async function genStyleCode( attachedProps: [string, string][] ) { let stylesCode = `` - let hasCSSModules = false + let cssModulesMap: Record | undefined if (descriptor.styles.length) { for (let i = 0; i < descriptor.styles.length; i++) { const style = descriptor.styles[i] @@ -320,12 +320,13 @@ async function genStyleCode( ` diff --git a/packages/playground/vue/Main.vue b/packages/playground/vue/Main.vue index ea14dc8f481b86..d10ae401f7aa8e 100644 --- a/packages/playground/vue/Main.vue +++ b/packages/playground/vue/Main.vue @@ -20,7 +20,6 @@ - + + + + + + diff --git a/docs/.vitepress/theme/SponsorsSidebar.vue b/docs/.vitepress/theme/SponsorsSidebar.vue new file mode 100644 index 00000000000000..bb27c8b5ee157d --- /dev/null +++ b/docs/.vitepress/theme/SponsorsSidebar.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/docs/.vitepress/theme/index.js b/docs/.vitepress/theme/index.js index 5d0a1b7a652039..babdc165f30ed8 100644 --- a/docs/.vitepress/theme/index.js +++ b/docs/.vitepress/theme/index.js @@ -1,7 +1,6 @@ import Theme from 'vitepress/theme' import { h } from 'vue' -import sponsors from './sponsors.json' -import './sponsors.css' +import SponsorsSidebar from './SponsorsSidebar.vue' import './custom.css' export default { @@ -9,29 +8,7 @@ export default { Layout() { return h(Theme.Layout, null, { 'sidebar-bottom': () => - h('div', { class: 'sponsors sidebar' }, [ - h( - 'a', - { - href: 'https://github.com/sponsors/yyx990803', - target: '_blank', - rel: 'noopener' - }, - [h('span', 'Sponsors')] - ), - ...sponsors.map(({ href, src, name, id }) => - h( - 'a', - { - href, - target: '_blank', - rel: 'noopener', - 'aria-label': 'sponsor-img' - }, - [h('img', { src, alt: name, id: `sponsor-${id}` })] - ) - ) - ]) + h('div', { class: 'sponsors sidebar' }, [h(SponsorsSidebar)]) }) } } diff --git a/docs/.vitepress/theme/sponsors.css b/docs/.vitepress/theme/sponsors.css deleted file mode 100644 index 904b4945ed57d6..00000000000000 --- a/docs/.vitepress/theme/sponsors.css +++ /dev/null @@ -1,56 +0,0 @@ -.sponsors { - padding: 0 1.5rem 2rem; - font-size: 0.8rem; -} - -.sponsors a { - color: #999; - margin: 1em 2em; - display: block; -} - -.sponsors img { - max-width: 160px; - max-height: 40px; -} - -.sponsors.frontpage { - text-align: center; -} - -.sponsors.frontpage img { - display: inline-block; - vertical-align: middle; -} - -.sponsors.frontpage h2 { - color: #999; - font-size: 1.2rem; - border: none; -} - -.sponsors.sidebar a img { - max-height: 36px; -} - -.platinum-sponsors { - margin-bottom: 1.5em; -} - -.platinum-sponsors a img { - max-width: 240px; - max-height: 60px; -} - -.gold-sponsors { - display: flex; - flex-wrap: wrap; - justify-content: center; - align-items: center; -} - -/* special cases */ -#sponsor-mux { - padding: 5px 0; - min-height: 36px; -} diff --git a/docs/.vitepress/theme/sponsors.json b/docs/.vitepress/theme/sponsors.json deleted file mode 100644 index 6d788ac4b84808..00000000000000 --- a/docs/.vitepress/theme/sponsors.json +++ /dev/null @@ -1,45 +0,0 @@ -[ - { - "id": "stackblitz", - "name": "StackBlitz", - "href": "https://stackblitz.com/", - "src": "/stackblitz.svg", - "tier": "platinum" - }, - { - "id": "cypress", - "name": "Cypress.io", - "href": "https://cypress.io", - "src": "/cypress.svg" - }, - { - "id": "tailwind", - "name": "Tailwind Labs", - "href": "https://tailwindcss.com", - "src": "/tailwind-labs.svg" - }, - { - "id": "vuejobs", - "name": "Vue Jobs", - "href": "https://vuejobs.com/?ref=vuejs", - "src": "/vuejobs.png" - }, - { - "id": "mux", - "name": "Mux", - "href": "https://mux.com", - "src": "/mux.svg" - }, - { - "id": "plaid", - "name": "Plaid Inc.", - "href": "https://plaid.co.jp/", - "src": "/plaid.svg" - }, - { - "id": "divriots", - "name": "divriots", - "href": "https://divriots.com/", - "src": "/divriots.png" - } -] diff --git a/docs/index.md b/docs/index.md index 81b0eb027e8f05..ce1678de00404e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -23,21 +23,16 @@ features: footer: MIT Licensed | Copyright © 2019-present Evan You & Vite Contributors --- -
-

Sponsors

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

Sponsors

+ + + + + +

+ Become a sponsor on GitHub +

From 7a2ddb43fbe2b777129818d88792db6e848ce2f6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 10:10:35 +0100 Subject: [PATCH 063/309] chore(deps): update dependency @ampproject/remapping to v2 (#6690) --- packages/vite/package.json | 2 +- pnpm-lock.yaml | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/packages/vite/package.json b/packages/vite/package.json index 21b83d49e50622..494b6aebc54ea2 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -53,7 +53,7 @@ "fsevents": "~2.3.2" }, "devDependencies": { - "@ampproject/remapping": "^1.1.1", + "@ampproject/remapping": "^2.1.0", "@babel/parser": "^7.17.0", "@babel/types": "^7.17.0", "@rollup/plugin-alias": "^3.1.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b40b226c292e61..ab4083cb6a7635 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -735,7 +735,7 @@ importers: packages/vite: specifiers: - '@ampproject/remapping': ^1.1.1 + '@ampproject/remapping': ^2.1.0 '@babel/parser': ^7.17.0 '@babel/types': ^7.17.0 '@rollup/plugin-alias': ^3.1.9 @@ -813,7 +813,7 @@ importers: optionalDependencies: fsevents: 2.3.2 devDependencies: - '@ampproject/remapping': 1.1.1 + '@ampproject/remapping': 2.1.0 '@babel/parser': 7.17.0 '@babel/types': 7.17.0 '@rollup/plugin-alias': 3.1.9_rollup@2.62.0 @@ -991,14 +991,6 @@ packages: '@algolia/requester-common': 4.11.0 dev: true - /@ampproject/remapping/1.1.1: - resolution: {integrity: sha512-YVAcA4DKLOj296CF5SrQ8cYiMRiUGc2sqFpLxsDGWE34suHqhGP/5yMsDHKsrh8hs8I5TiRVXNwKPWQpX3iGjw==} - engines: {node: '>=6.0.0'} - dependencies: - '@jridgewell/resolve-uri': 3.0.3 - sourcemap-codec: 1.4.8 - dev: true - /@ampproject/remapping/2.1.0: resolution: {integrity: sha512-d5RysTlJ7hmw5Tw4UxgxcY3lkMe92n8sXCcuLPAyIAHK6j8DefDwtGnVVDgOnv+RnEosulDJ9NPKQL27bDId0g==} engines: {node: '>=6.0.0'} @@ -5157,7 +5149,6 @@ packages: /graceful-fs/4.2.9: resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==} - dev: true /handlebars/4.7.7: resolution: {integrity: sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==} @@ -6333,7 +6324,7 @@ packages: dependencies: universalify: 2.0.0 optionalDependencies: - graceful-fs: 4.2.8 + graceful-fs: 4.2.9 /jsonparse/1.3.1: resolution: {integrity: sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=} @@ -6388,7 +6379,7 @@ packages: tslib: 2.3.1 optionalDependencies: errno: 0.1.8 - graceful-fs: 4.2.8 + graceful-fs: 4.2.9 image-size: 0.5.5 make-dir: 2.1.0 mime: 1.6.0 From 2c02ce7061f9d4a9a8e70a96d89e930b4e6ed448 Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 11 Feb 2022 10:12:03 +0100 Subject: [PATCH 064/309] docs: change worker config to object instead of array (#6844) --- packages/vite/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index f436a99d9175e2..f3cf3406306cc8 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -46,10 +46,10 @@ The worker plugins pipeline isn't shared with the main Vite pipeline, there may import PluginX from 'vite-plugin-x' export default { plugins: [ PluginX() ] - worker: [ + worker: { format: 'es', plugins: [ PluginX() ] - ] + } } ``` From f63a72e77214ea31884680a3c5facf4fcee5d226 Mon Sep 17 00:00:00 2001 From: reid j sherman Date: Fri, 11 Feb 2022 01:29:14 -0800 Subject: [PATCH 065/309] docs: rename empty git repo from master to main (#6857) --- docs/guide/static-deploy.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/guide/static-deploy.md b/docs/guide/static-deploy.md index 574ceda541da15..43b047dd7f53eb 100644 --- a/docs/guide/static-deploy.md +++ b/docs/guide/static-deploy.md @@ -80,6 +80,7 @@ Now the `preview` method will launch the server at `http://localhost:8080`. # echo 'www.example.com' > CNAME git init + git checkout -b main git add -A git commit -m 'deploy' From 0941620705eea1a08509a4f5a28dd3099a711e58 Mon Sep 17 00:00:00 2001 From: Zheeeng Date: Fri, 11 Feb 2022 19:49:13 +0800 Subject: [PATCH 066/309] chore: build signatures (#6841) --- packages/vite/src/node/build.ts | 39 ++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index 7c7d1d18037174..b9936f8583b46c 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -769,7 +769,7 @@ function resolveExternal( ssrExternals: string[], user: ExternalOption | undefined ): ExternalOption { - return ((id, parentId, isResolved) => { + return (id, parentId, isResolved) => { if (shouldExternalizeForSSR(id, ssrExternals)) { return true } @@ -782,7 +782,7 @@ function resolveExternal( return isExternal(id, user) } } - }) as ExternalOption + } } function isExternal(id: string, test: string | RegExp) { @@ -793,39 +793,48 @@ function isExternal(id: string, test: string | RegExp) { } } -function injectSsrFlagToHooks(p: Plugin): Plugin { - const { resolveId, load, transform } = p +function injectSsrFlagToHooks(plugin: Plugin): Plugin { + const { resolveId, load, transform } = plugin return { - ...p, + ...plugin, resolveId: wrapSsrResolveId(resolveId), load: wrapSsrLoad(load), transform: wrapSsrTransform(transform) } } -function wrapSsrResolveId(fn: Function | undefined) { +function wrapSsrResolveId( + fn?: Rollup.ResolveIdHook +): Rollup.ResolveIdHook | undefined { if (!fn) return - return function (this: any, id: any, importer: any, options: any) { + + return function (id, importer, options) { return fn.call(this, id, importer, injectSsrFlag(options)) } } -function wrapSsrLoad(fn: Function | undefined) { +function wrapSsrLoad(fn?: Rollup.LoadHook): Rollup.LoadHook | undefined { if (!fn) return - // Receiving options param to be future-proof if Rollup adds it - return function (this: any, id: any, ...args: any[]) { + + return function (id, ...args) { + // @ts-expect-error: Receiving options param to be future-proof if Rollup adds it return fn.call(this, id, injectSsrFlag(args[0])) } } -function wrapSsrTransform(fn: Function | undefined) { +function wrapSsrTransform( + fn?: Rollup.TransformHook +): Rollup.TransformHook | undefined { if (!fn) return - // Receiving options param to be future-proof if Rollup adds it - return function (this: any, code: any, importer: any, ...args: any[]) { + + return function (code, importer, ...args) { + // @ts-expect-error: Receiving options param to be future-proof if Rollup adds it return fn.call(this, code, importer, injectSsrFlag(args[0])) } } -function injectSsrFlag(options: any = {}) { - return { ...options, ssr: true } +function injectSsrFlag>( + options?: T +): T & { ssr: boolean } { + return { ...(options ?? {}), ssr: true } as T & { ssr: boolean } } From de20c73ef37b179c1791c0f96da04d29cfd48840 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Fri, 11 Feb 2022 19:51:32 +0800 Subject: [PATCH 067/309] fix(scan): escape for virtual modules (#6863) --- packages/vite/src/node/optimizer/scan.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/optimizer/scan.ts b/packages/vite/src/node/optimizer/scan.ts index 9ba65d23684305..280776b2e7d38d 100644 --- a/packages/vite/src/node/optimizer/scan.ts +++ b/packages/vite/src/node/optimizer/scan.ts @@ -284,7 +284,7 @@ function esbuildScanPlugin( loader, contents: localContent } - js += `import '${virtualModulePrefix}${path}';\n` + js += `import ${JSON.stringify(virtualModulePrefix + path)}\n` } else { js += content + '\n' } From a3a9941be7017a21c875786683c7b0225e3fdee5 Mon Sep 17 00:00:00 2001 From: Zheeeng Date: Fri, 11 Feb 2022 19:55:29 +0800 Subject: [PATCH 068/309] chore(types): remove unnecessary type assertion (#6784) --- packages/vite/src/node/http.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/http.ts b/packages/vite/src/node/http.ts index fd45907ce0b723..f1266ddb93ba12 100644 --- a/packages/vite/src/node/http.ts +++ b/packages/vite/src/node/http.ts @@ -144,7 +144,7 @@ export async function resolveHttpsConfig( function readFileIfExists(value?: string | Buffer | any[]) { if (typeof value === 'string') { try { - return fs.readFileSync(path.resolve(value as string)) + return fs.readFileSync(path.resolve(value)) } catch (e) { return value } From 0282e7a523d1cccdc490c1df20b3013d5144ea19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Cotiniaux?= Date: Fri, 11 Feb 2022 12:56:07 +0100 Subject: [PATCH 069/309] chore: remove cancelled sponsor img (#6781) --- docs/public/finclip.png | Bin 13876 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 docs/public/finclip.png diff --git a/docs/public/finclip.png b/docs/public/finclip.png deleted file mode 100644 index 9110e6d56c164d598209d4b26ed019360efa181f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13876 zcmV-4Hp|J0P)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR927@z|H1ONa40RR91Q~&?~0FY#M1ONavo=HSORCodHT?b$k#rog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/vite/package.json | 2 +- 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index f3cf3406306cc8..50925e58baffdb 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,13 @@ +## [2.8.1](https://github.com/vitejs/vite/compare/v2.8.0...v2.8.1) (2022-02-11) + + +### Bug Fixes + +* **deps:** update all non-major dependencies ([#6782](https://github.com/vitejs/vite/issues/6782)) ([e38be3e](https://github.com/vitejs/vite/commit/e38be3e6ca7bf79319d5d7188e1d347b1d6091ef)) +* **scan:** escape for virtual modules ([#6863](https://github.com/vitejs/vite/issues/6863)) ([de20c73](https://github.com/vitejs/vite/commit/de20c73ef37b179c1791c0f96da04d29cfd48840)) + + + # [2.8.0](https://github.com/vitejs/vite/compare/v2.8.0-beta.7...v2.8.0) (2022-02-09) ### Reduced Footprint diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index e7849fe80aa577..e3a445f8cfdbe3 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -264,6 +264,62 @@ Repository: https://github.com/jridgewell/resolve-uri --------------------------------------- +## @jridgewell/sourcemap-codec +License: MIT +By: Rich Harris +Repository: git+https://github.com/jridgewell/sourcemap-codec.git + +> The MIT License +> +> Copyright (c) 2015 Rich Harris +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## @jridgewell/trace-mapping +License: MIT +By: Justin Ridgewell +Repository: git+https://github.com/jridgewell/trace-mapping.git + +> Copyright 2022 Justin Ridgewell +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +--------------------------------------- + ## @nodelib/fs.scandir License: MIT Repository: https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir diff --git a/packages/vite/package.json b/packages/vite/package.json index 494b6aebc54ea2..2f57fb3f59164d 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.8.0", + "version": "2.8.1", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From a23eeb205f10b0c7a26517ed804f85468480892f Mon Sep 17 00:00:00 2001 From: patak Date: Fri, 11 Feb 2022 14:15:02 +0100 Subject: [PATCH 071/309] chore: release action (#6669) --- .github/workflows/release.yml | 78 ++++++++++++++++++++ scripts/release.ts | 129 +++++++++++++++++++++++++--------- 2 files changed, 172 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000000..0c3b0c183ef3a1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,78 @@ +name: Release + +on: + workflow_dispatch: + inputs: + branch: + description: "branch" + required: true + type: string + default: "main" + package: + description: "package" + required: true + type: choice + options: + - vite + - plugin-legacy + - plugin-vue + - plugin-vue-jsx + - plugin-react + - create-vite + type: + description: "type" + required: true + type: choice + options: + - next + - stable + - minor-beta + - major-beta + - minor + - major + +jobs: + release: + # prevents this action from running on forks + if: github.repository == 'vitejs/vite' + name: Release + runs-on: ${{ matrix.os }} + environment: Release + strategy: + matrix: + # pseudo-matrix for convenience, NEVER use more than a single combination + node: [16] + os: [ubuntu-latest] + steps: + - name: checkout + uses: actions/checkout@v2 + with: + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits + ref: ${{ github.event.inputs.branch }} + fetch-depth: 0 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + - run: git config user.name vitebot + - run: git config user.email vitejs.bot@gmail.com + - run: npm i -g pnpm@6 + - run: npm i -g yarn # even if the repo is using pnpm, Vite still uses yarn v1 for publishing + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + cache: "pnpm" + cache-dependency-path: "**/pnpm-lock.yaml" + - name: install + run: pnpm install --frozen-lockfile --prefer-offline + - name: Creating .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Release + run: pnpm --dir packages/${{ github.event.inputs.package }} release -- --quiet --type ${{ github.event.inputs.type }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/scripts/release.ts b/scripts/release.ts index 4c3006fe1f0475..e24f539547f014 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -12,6 +12,11 @@ import semver from 'semver' const args = require('minimist')(process.argv.slice(2)) +// For GitHub Actions use +// Regular release : release --type next --quiet +// Start beta : release --type (minor-beta|major-beta) --quiet +// Release from beta : release --type stable --quiet + const pkgDir = process.cwd() const pkgPath = path.resolve(pkgDir, 'package.json') const pkg: { name: string; version: string } = require(pkgPath) @@ -55,27 +60,75 @@ async function main(): Promise { let targetVersion: string | undefined = args._[0] if (!targetVersion) { - // no explicit version, offer suggestions - const { release }: { release: string } = await prompts({ - type: 'select', - name: 'release', - message: 'Select release type', - choices: versionIncrements - .map((i) => `${i} (${inc(i)})`) - .concat(['custom']) - .map((i) => ({ value: i, title: i })) - }) - - if (release === 'custom') { - const res: { version: string } = await prompts({ - type: 'text', - name: 'version', - message: 'Input custom version', - initial: currentVersion - }) - targetVersion = res.version + const type: string | undefined = args.type + if (type) { + const currentBeta = currentVersion.includes('beta') + if (type === 'next') { + targetVersion = inc(currentBeta ? 'prerelease' : 'patch') + } else if (type === 'stable') { + // Out of beta + if (!currentBeta) { + throw new Error( + `Current version: ${currentVersion} isn't a beta, stable can't be used` + ) + } + targetVersion = inc('patch') + } else if (type === 'minor-beta') { + if (currentBeta) { + throw new Error( + `Current version: ${currentVersion} is already a beta, minor-beta can't be used` + ) + } + targetVersion = inc('preminor') + } else if (type === 'major-beta') { + if (currentBeta) { + throw new Error( + `Current version: ${currentVersion} is already a beta, major-beta can't be used` + ) + } + targetVersion = inc('premajor') + } else if (type === 'minor') { + if (currentBeta) { + throw new Error( + `Current version: ${currentVersion} is a beta, use stable to release it first` + ) + } + targetVersion = inc('minor') + } else if (type === 'major') { + if (currentBeta) { + throw new Error( + `Current version: ${currentVersion} is a beta, use stable to release it first` + ) + } + targetVersion = inc('major') + } else { + throw new Error( + `type: ${type} isn't a valid type. Use stable, minor-beta, major-beta, or next` + ) + } } else { - targetVersion = release.match(/\((.*)\)/)![1] + // no explicit version or type, offer suggestions + const { release }: { release: string } = await prompts({ + type: 'select', + name: 'release', + message: 'Select release type', + choices: versionIncrements + .map((i) => `${i} (${inc(i)})`) + .concat(['custom']) + .map((i) => ({ value: i, title: i })) + }) + + if (release === 'custom') { + const res: { version: string } = await prompts({ + type: 'text', + name: 'version', + message: 'Input custom version', + initial: currentVersion + }) + targetVersion = res.version + } else { + targetVersion = release.match(/\((.*)\)/)![1] + } } } @@ -86,24 +139,30 @@ async function main(): Promise { const tag = pkgName === 'vite' ? `v${targetVersion}` : `${pkgName}@${targetVersion}` - if (targetVersion.includes('beta') && !args.tag) { - const { tagBeta }: { tagBeta: boolean } = await prompts({ - type: 'confirm', - name: 'tagBeta', - message: `Publish under dist-tag "beta"?` - }) + if (!args.quiet) { + if (targetVersion.includes('beta') && !args.tag) { + const { tagBeta }: { tagBeta: boolean } = await prompts({ + type: 'confirm', + name: 'tagBeta', + message: `Publish under dist-tag "beta"?` + }) - if (tagBeta) args.tag = 'beta' - } + if (tagBeta) args.tag = 'beta' + } - const { yes }: { yes: boolean } = await prompts({ - type: 'confirm', - name: 'yes', - message: `Releasing ${tag}. Confirm?` - }) + const { yes }: { yes: boolean } = await prompts({ + type: 'confirm', + name: 'yes', + message: `Releasing ${tag}. Confirm?` + }) - if (!yes) { - return + if (!yes) { + return + } + } else { + if (targetVersion.includes('beta') && !args.tag) { + args.tag = 'beta' + } } step('\nUpdating package version...') From 82e5016d1b5c8fceebfc0f9d2246df6be2104eaf Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 11 Feb 2022 08:16:42 -0500 Subject: [PATCH 072/309] Update release-tag.yml --- .github/workflows/release-tag.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 5ed9495899340a..f9d5b8de30bec9 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -1,4 +1,4 @@ -name: release +name: Add GitHub Release Tag on: push: From 56e67c214e884fa3dcd168527117a2621c92e8a8 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Fri, 11 Feb 2022 21:31:28 +0100 Subject: [PATCH 073/309] chore: config yarn registry in release action --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0c3b0c183ef3a1..b059c0bfa35bc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,6 +57,7 @@ jobs: - run: git config user.email vitejs.bot@gmail.com - run: npm i -g pnpm@6 - run: npm i -g yarn # even if the repo is using pnpm, Vite still uses yarn v1 for publishing + - run: yarn config set registry https://registry.npmjs.org # Yarn's default registry proxy doesn't work in CI - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node }} From 997b8f11cb156cc374ae991875a09534b5489a93 Mon Sep 17 00:00:00 2001 From: Aron Griffis Date: Fri, 11 Feb 2022 15:37:07 -0500 Subject: [PATCH 074/309] fix(plugin-legacy): require Vite 2.8.0 (#6272) (#6869) --- packages/plugin-legacy/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index a503421e19e13f..cba6f7466a95a8 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -33,6 +33,6 @@ "systemjs": "^6.12.1" }, "peerDependencies": { - "vite": "^2.7.8" + "vite": "^2.8.0" } } From 19a58dd320e9dd582bb7868e1621d8bde835eda6 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Fri, 11 Feb 2022 22:08:58 +0100 Subject: [PATCH 075/309] release: plugin-legacy@1.7.1 --- packages/plugin-legacy/CHANGELOG.md | 8 ++++++++ packages/plugin-legacy/package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/plugin-legacy/CHANGELOG.md b/packages/plugin-legacy/CHANGELOG.md index da053294652427..e92ca1e12357fe 100644 --- a/packages/plugin-legacy/CHANGELOG.md +++ b/packages/plugin-legacy/CHANGELOG.md @@ -1,3 +1,11 @@ +## [1.7.1](https://github.com/vitejs/vite/compare/plugin-legacy@1.7.0...plugin-legacy@1.7.1) (2022-02-11) + +### Bug Fixes + +* require Vite 2.8.0 ([#6272](https://github.com/vitejs/vite/issues/6272)) ([#6869](https://github.com/vitejs/vite/issues/6869)) ([997b8f1](https://github.com/vitejs/vite/commit/997b8f11cb156cc374ae991875a09534b5489a93)) + + + # [1.7.0](https://github.com/vitejs/vite/compare/plugin-legacy@1.6.4...plugin-legacy@1.7.0) (2022-02-09) diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index cba6f7466a95a8..45c09f607fdfab 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-legacy", - "version": "1.7.0", + "version": "1.7.1", "license": "MIT", "author": "Evan You", "files": [ From 6ea6e08d23a967461cdb5a5fc6d48a6625188c2f Mon Sep 17 00:00:00 2001 From: patak-dev Date: Sat, 12 Feb 2022 08:09:45 +0100 Subject: [PATCH 076/309] release: plugin-vue-jsx@1.3.5 --- packages/plugin-vue-jsx/CHANGELOG.md | 4 ++++ packages/plugin-vue-jsx/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue-jsx/CHANGELOG.md b/packages/plugin-vue-jsx/CHANGELOG.md index 30618d5b056ef9..594f12c90f0909 100644 --- a/packages/plugin-vue-jsx/CHANGELOG.md +++ b/packages/plugin-vue-jsx/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.3.5](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.3.4...plugin-vue-jsx@1.3.5) (2022-02-12) + + + ## [1.3.4](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.3.3...plugin-vue-jsx@1.3.4) (2022-02-09) diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 3724cd25c7c381..c26a343c9c4227 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue-jsx", - "version": "1.3.4", + "version": "1.3.5", "license": "MIT", "author": "Evan You", "files": [ From fe8ef39eb37df7565dbbfce6a09c2eb7ceeaa56e Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Feb 2022 19:14:31 +0800 Subject: [PATCH 077/309] workflow: separate version bumping and publishing on release (#6879) --- .github/workflows/publish.yml | 37 ++++ .github/workflows/release.yml | 79 -------- package.json | 2 + packages/create-vite/package.json | 4 - packages/create-vite/updateVersions.ts | 23 --- packages/plugin-legacy/package.json | 4 - packages/plugin-react/package.json | 3 +- packages/plugin-vue-jsx/package.json | 4 - packages/plugin-vue/package.json | 3 +- packages/vite/package.json | 3 +- scripts/publishCI.ts | 31 +++ scripts/release.ts | 265 +++++++------------------ scripts/releaseUtils.ts | 215 ++++++++++++++++++++ 13 files changed, 361 insertions(+), 312 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/release.yml delete mode 100644 packages/create-vite/updateVersions.ts create mode 100644 scripts/publishCI.ts create mode 100644 scripts/releaseUtils.ts diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000000000..f4df5af00cc23c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +name: Publish Package + +on: + push: + tags: + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 + - "plugin-*" # Push events to matching plugin-*, i.e. plugin-(vue|vue-jsx|react|legacy)@1.0.0 + - "create-vite*" # # Push events to matching create-vite*, i.e. create-vite@1.0.0 + +jobs: + publish: + # prevents this action from running on forks + if: github.repository == 'vitejs/vite' + runs-on: ubuntu-latest + environment: Release + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 6 + + - name: Set node version to 16.x + uses: actions/setup-node@v2 + with: + node-version: 16.x + cache: "pnpm" + + - name: Install deps + run: pnpm install + + - name: Publish package + run: pnpm run ci-publish -- ${{ github.ref_name }} --dry + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index b059c0bfa35bc0..00000000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Release - -on: - workflow_dispatch: - inputs: - branch: - description: "branch" - required: true - type: string - default: "main" - package: - description: "package" - required: true - type: choice - options: - - vite - - plugin-legacy - - plugin-vue - - plugin-vue-jsx - - plugin-react - - create-vite - type: - description: "type" - required: true - type: choice - options: - - next - - stable - - minor-beta - - major-beta - - minor - - major - -jobs: - release: - # prevents this action from running on forks - if: github.repository == 'vitejs/vite' - name: Release - runs-on: ${{ matrix.os }} - environment: Release - strategy: - matrix: - # pseudo-matrix for convenience, NEVER use more than a single combination - node: [16] - os: [ubuntu-latest] - steps: - - name: checkout - uses: actions/checkout@v2 - with: - # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits - ref: ${{ github.event.inputs.branch }} - fetch-depth: 0 - - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - - run: git config user.name vitebot - - run: git config user.email vitejs.bot@gmail.com - - run: npm i -g pnpm@6 - - run: npm i -g yarn # even if the repo is using pnpm, Vite still uses yarn v1 for publishing - - run: yarn config set registry https://registry.npmjs.org # Yarn's default registry proxy doesn't work in CI - - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - cache-dependency-path: "**/pnpm-lock.yaml" - - name: install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Creating .npmrc - run: | - cat << EOF > "$HOME/.npmrc" - //registry.npmjs.org/:_authToken=$NPM_TOKEN - EOF - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Release - run: pnpm --dir packages/${{ github.event.inputs.package }} release -- --quiet --type ${{ github.event.inputs.type }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 63c7e38d0d0652..72b7076ee65d01 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,8 @@ "docs": "vitepress dev docs", "build-docs": "vitepress build docs", "serve-docs": "vitepress serve docs", + "release": "ts-node scripts/release.ts", + "ci-publish": "ts-node scripts/publishCI.ts", "build": "run-s build-vite build-plugin-vue build-plugin-react", "build-vite": "cd packages/vite && npm run build", "build-plugin-vue": "cd packages/plugin-vue && npm run build", diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json index 6ff118b7793840..5d873b83fe515b 100644 --- a/packages/create-vite/package.json +++ b/packages/create-vite/package.json @@ -12,10 +12,6 @@ "template-*" ], "main": "index.js", - "scripts": { - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package create-vite", - "release": "ts-node updateVersions && ts-node ../../scripts/release.ts --skipBuild" - }, "engines": { "node": ">=12.0.0" }, diff --git a/packages/create-vite/updateVersions.ts b/packages/create-vite/updateVersions.ts deleted file mode 100644 index 7125fce9119f07..00000000000000 --- a/packages/create-vite/updateVersions.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { readdirSync, writeFileSync } from 'fs' -import { join } from 'path' - -const latestVersion = require('../vite/package.json').version -const isLatestPreRelease = /beta|alpha|rc/.test(latestVersion) - -;(async () => { - const templates = readdirSync(__dirname).filter((dir) => - dir.startsWith('template-') - ) - for (const template of templates) { - const pkgPath = join(__dirname, template, `package.json`) - const pkg = require(pkgPath) - if (!isLatestPreRelease) { - pkg.devDependencies.vite = `^` + latestVersion - } - if (template.startsWith('template-vue')) { - pkg.devDependencies['@vitejs/plugin-vue'] = - `^` + require('../plugin-vue/package.json').version - } - writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') - } -})() diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index 45c09f607fdfab..e464c18b4dca1d 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -9,10 +9,6 @@ ], "main": "index.js", "types": "index.d.ts", - "scripts": { - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-legacy", - "release": "ts-node ../../scripts/release.ts --skipBuild" - }, "engines": { "node": ">=12.0.0" }, diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 1047a390865f4f..67df1d30b89b0c 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -18,8 +18,7 @@ "build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@babel/* --external:@rollup/* --external:resolve --external:react-refresh/* --outfile=dist/index.js && npm run patch-dist", "patch-dist": "ts-node ../../scripts/patchEsbuildDist.ts dist/index.js viteReact", "build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-react", - "release": "ts-node ../../scripts/release.ts" + "prepublishOnly": "npm run build" }, "engines": { "node": ">=12.0.0" diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index c26a343c9c4227..dff19a227804d1 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -9,10 +9,6 @@ ], "main": "index.js", "types": "index.d.ts", - "scripts": { - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-vue-jsx", - "release": "ts-node ../../scripts/release.ts --skipBuild" - }, "engines": { "node": ">=12.0.0" }, diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index f54042da5bf948..ca8836d8e81d36 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -16,8 +16,7 @@ "build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@vue/compiler-sfc --external:vue/compiler-sfc --external:vite --outfile=dist/index.js & npm run patch-dist", "patch-dist": "ts-node ../../scripts/patchEsbuildDist.ts dist/index.js vuePlugin", "build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-vue", - "release": "ts-node ../../scripts/release.ts" + "prepublishOnly": "npm run build" }, "engines": { "node": ">=12.0.0" diff --git a/packages/vite/package.json b/packages/vite/package.json index 2f57fb3f59164d..9bd14ca89a4d16 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -39,8 +39,7 @@ "roll-types": "api-extractor run && rimraf temp", "lint": "eslint --ext .ts src/**", "format": "prettier --write --parser typescript \"src/**/*.ts\"", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path .", - "release": "ts-node ../../scripts/release.ts" + "prepublishOnly": "npm run build" }, "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!", "dependencies": { diff --git a/scripts/publishCI.ts b/scripts/publishCI.ts new file mode 100644 index 00000000000000..7df0893a15b788 --- /dev/null +++ b/scripts/publishCI.ts @@ -0,0 +1,31 @@ +import { args, getPackageInfo, publishPackage, step } from './releaseUtils' + +async function main() { + const tag = args._[0] + + if (!tag) { + throw new Error('No tag specified') + } + + let pkgName = 'vite' + let version + + if (tag.includes('@')) [pkgName, version] = tag.split('@') + else version = tag + + if (version.startsWith('v')) version = version.slice(1) + + const { currentVersion, pkgDir } = getPackageInfo(pkgName) + if (currentVersion !== version) + throw new Error( + `Package version from tag "${version}" mismatches with current version "${currentVersion}"` + ) + + step('Publishing package...') + await publishPackage(pkgDir, version.includes('beta') ? 'beta' : undefined) +} + +main().catch((err) => { + console.error(err) + process.exit(1) +}) diff --git a/scripts/release.ts b/scripts/release.ts index e24f539547f014..6ec929a1d3a340 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -1,134 +1,54 @@ -/** - * modified from https://github.com/vuejs/core/blob/master/scripts/release.js - */ -import colors from 'picocolors' -import type { ExecaChildProcess, Options as ExecaOptions } from 'execa' -import execa from 'execa' -import { readFileSync, writeFileSync } from 'fs' -import path from 'path' import prompts from 'prompts' -import type { ReleaseType } from 'semver' import semver from 'semver' +import colors from 'picocolors' +import { + args, + getPackageInfo, + getVersionChoices, + isDryRun, + logRecentCommits, + packages, + run, + runIfNotDry, + step, + updateTemplateVersions, + updateVersion +} from './releaseUtils' -const args = require('minimist')(process.argv.slice(2)) - -// For GitHub Actions use -// Regular release : release --type next --quiet -// Start beta : release --type (minor-beta|major-beta) --quiet -// Release from beta : release --type stable --quiet - -const pkgDir = process.cwd() -const pkgPath = path.resolve(pkgDir, 'package.json') -const pkg: { name: string; version: string } = require(pkgPath) -const pkgName = pkg.name.replace(/^@vitejs\//, '') -const currentVersion = pkg.version -const isDryRun: boolean = args.dry -const skipBuild: boolean = args.skipBuild - -const versionIncrements: ReleaseType[] = [ - 'patch', - 'minor', - 'major', - 'prepatch', - 'preminor', - 'premajor', - 'prerelease' -] - -const inc: (i: ReleaseType) => string = (i) => - semver.inc(currentVersion, i, 'beta')! - -type RunFn = ( - bin: string, - args: string[], - opts?: ExecaOptions -) => ExecaChildProcess - -const run: RunFn = (bin, args, opts = {}) => - execa(bin, args, { stdio: 'inherit', ...opts }) - -type DryRunFn = (bin: string, args: string[], opts?: any) => void +async function main(): Promise { + let targetVersion: string | undefined -const dryRun: DryRunFn = (bin, args, opts: any) => - console.log(colors.blue(`[dryrun] ${bin} ${args.join(' ')}`), opts) + const { pkg }: { pkg: string } = await prompts({ + type: 'select', + name: 'pkg', + message: 'Select package', + choices: packages.map((i) => ({ value: i, title: i })) + }) -const runIfNotDry = isDryRun ? dryRun : run + if (!pkg) return -const step: (msg: string) => void = (msg) => console.log(colors.cyan(msg)) + await logRecentCommits(pkg) -async function main(): Promise { - let targetVersion: string | undefined = args._[0] + const { currentVersion, pkgName, pkgPath, pkgDir } = getPackageInfo(pkg) if (!targetVersion) { - const type: string | undefined = args.type - if (type) { - const currentBeta = currentVersion.includes('beta') - if (type === 'next') { - targetVersion = inc(currentBeta ? 'prerelease' : 'patch') - } else if (type === 'stable') { - // Out of beta - if (!currentBeta) { - throw new Error( - `Current version: ${currentVersion} isn't a beta, stable can't be used` - ) - } - targetVersion = inc('patch') - } else if (type === 'minor-beta') { - if (currentBeta) { - throw new Error( - `Current version: ${currentVersion} is already a beta, minor-beta can't be used` - ) - } - targetVersion = inc('preminor') - } else if (type === 'major-beta') { - if (currentBeta) { - throw new Error( - `Current version: ${currentVersion} is already a beta, major-beta can't be used` - ) - } - targetVersion = inc('premajor') - } else if (type === 'minor') { - if (currentBeta) { - throw new Error( - `Current version: ${currentVersion} is a beta, use stable to release it first` - ) - } - targetVersion = inc('minor') - } else if (type === 'major') { - if (currentBeta) { - throw new Error( - `Current version: ${currentVersion} is a beta, use stable to release it first` - ) - } - targetVersion = inc('major') - } else { - throw new Error( - `type: ${type} isn't a valid type. Use stable, minor-beta, major-beta, or next` - ) - } - } else { - // no explicit version or type, offer suggestions - const { release }: { release: string } = await prompts({ - type: 'select', - name: 'release', - message: 'Select release type', - choices: versionIncrements - .map((i) => `${i} (${inc(i)})`) - .concat(['custom']) - .map((i) => ({ value: i, title: i })) - }) + const { release }: { release: string } = await prompts({ + type: 'select', + name: 'release', + message: 'Select release type', + choices: getVersionChoices(currentVersion) + }) - if (release === 'custom') { - const res: { version: string } = await prompts({ - type: 'text', - name: 'version', - message: 'Input custom version', - initial: currentVersion - }) - targetVersion = res.version - } else { - targetVersion = release.match(/\((.*)\)/)![1] - } + if (release === 'custom') { + const res: { version: string } = await prompts({ + type: 'text', + name: 'version', + message: 'Input custom version', + initial: currentVersion + }) + targetVersion = res.version + } else { + targetVersion = release } } @@ -139,44 +59,37 @@ async function main(): Promise { const tag = pkgName === 'vite' ? `v${targetVersion}` : `${pkgName}@${targetVersion}` - if (!args.quiet) { - if (targetVersion.includes('beta') && !args.tag) { - const { tagBeta }: { tagBeta: boolean } = await prompts({ - type: 'confirm', - name: 'tagBeta', - message: `Publish under dist-tag "beta"?` - }) - - if (tagBeta) args.tag = 'beta' - } + if (targetVersion.includes('beta') && !args.tag) { + args.tag = 'beta' + } - const { yes }: { yes: boolean } = await prompts({ - type: 'confirm', - name: 'yes', - message: `Releasing ${tag}. Confirm?` - }) + const { yes }: { yes: boolean } = await prompts({ + type: 'confirm', + name: 'yes', + message: `Releasing ${colors.yellow(tag)} Confirm?` + }) - if (!yes) { - return - } - } else { - if (targetVersion.includes('beta') && !args.tag) { - args.tag = 'beta' - } + if (!yes) { + return } step('\nUpdating package version...') - updateVersion(targetVersion) - - step('\nBuilding package...') - if (!skipBuild && !isDryRun) { - await run('pnpm', ['run', 'build']) - } else { - console.log(`(skipped)`) - } + updateVersion(pkgPath, targetVersion) + if (pkgName === 'create-vite') updateTemplateVersions(targetVersion) step('\nGenerating changelog...') - await run('pnpm', ['run', 'changelog']) + const changelogArgs = [ + 'conventional-changelog', + '-p', + 'angular', + '-i', + 'CHANGELOG.md', + '-s', + '--commit-path', + '.' + ] + if (pkgName !== 'vite') changelogArgs.push('--lerna-package', 'plugin-vue') + await run('npx', changelogArgs, { cwd: pkgDir }) const { stdout } = await run('git', ['diff'], { stdio: 'pipe' }) if (stdout) { @@ -186,59 +99,27 @@ async function main(): Promise { await runIfNotDry('git', ['tag', tag]) } else { console.log('No changes to commit.') + return } - step('\nPublishing package...') - await publishPackage(targetVersion, runIfNotDry) - step('\nPushing to GitHub...') await runIfNotDry('git', ['push', 'origin', `refs/tags/${tag}`]) await runIfNotDry('git', ['push']) if (isDryRun) { console.log(`\nDry run finished - run git diff to see package changes.`) + } else { + console.log( + colors.green( + '\nPushed, publishing should starts shortly on CI.\nhttps://github.com/vitejs/vite/actions/workflows/publish.yml' + ) + ) } console.log() } -function updateVersion(version: string): void { - const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')) - pkg.version = version - writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') -} - -async function publishPackage( - version: string, - runIfNotDry: RunFn | DryRunFn -): Promise { - const publicArgs = [ - 'publish', - '--no-git-tag-version', - '--new-version', - version, - '--access', - 'public' - ] - if (args.tag) { - publicArgs.push(`--tag`, args.tag) - } - try { - // important: we still use Yarn 1 to publish since we rely on its specific - // behavior - await runIfNotDry('yarn', publicArgs, { - stdio: 'pipe' - }) - console.log(colors.green(`Successfully published ${pkgName}@${version}`)) - } catch (e: any) { - if (e.stderr.match(/previously published/)) { - console.log(colors.red(`Skipping already published: ${pkgName}`)) - } else { - throw e - } - } -} - main().catch((err) => { console.error(err) + process.exit(1) }) diff --git a/scripts/releaseUtils.ts b/scripts/releaseUtils.ts new file mode 100644 index 00000000000000..c2626a083552d0 --- /dev/null +++ b/scripts/releaseUtils.ts @@ -0,0 +1,215 @@ +/** + * modified from https://github.com/vuejs/core/blob/master/scripts/release.js + */ +import colors from 'picocolors' +import type { Options as ExecaOptions } from 'execa' +import execa from 'execa' +import { readFileSync, writeFileSync, existsSync, readdirSync } from 'fs' +import path from 'path' +import type { ReleaseType } from 'semver' +import semver from 'semver' + +export const args = require('minimist')(process.argv.slice(2)) + +export const isDryRun = !!args.dry + +if (isDryRun) { + console.log(colors.inverse(colors.yellow(' DRY RUN '))) + console.log() +} + +export const packages = [ + 'vite', + 'create-vite', + 'plugin-legacy', + 'plugin-react', + 'plugin-vue', + 'plugin-vue-jsx' +] + +export const versionIncrements: ReleaseType[] = [ + 'patch', + 'minor', + 'major' + // 'prepatch', + // 'preminor', + // 'premajor', + // 'prerelease' +] + +export function getPackageInfo(pkgName: string) { + const pkgDir = path.resolve(__dirname, '../packages/' + pkgName) + + if (!existsSync(pkgDir)) { + throw new Error(`Package ${pkgName} not found`) + } + + const pkgPath = path.resolve(pkgDir, 'package.json') + const pkg: { + name: string + version: string + private?: boolean + } = require(pkgPath) + const currentVersion = pkg.version + + if (pkg.private) { + throw new Error(`Package ${pkgName} is private`) + } + + return { + pkg, + pkgName, + pkgDir, + pkgPath, + currentVersion + } +} + +export async function run( + bin: string, + args: string[], + opts: ExecaOptions = {} +) { + return execa(bin, args, { stdio: 'inherit', ...opts }) +} + +export async function dryRun( + bin: string, + args: string[], + opts?: ExecaOptions +) { + return console.log( + colors.blue(`[dryrun] ${bin} ${args.join(' ')}`), + opts || '' + ) +} + +export const runIfNotDry = isDryRun ? dryRun : run + +export function step(msg: string) { + return console.log(colors.cyan(msg)) +} + +export function getVersionChoices(currentVersion: string) { + const currentBeta = currentVersion.includes('beta') + + const inc: (i: ReleaseType) => string = (i) => + semver.inc(currentVersion, i, 'beta')! + + const versionChoices = [ + { + title: 'next', + value: inc(currentBeta ? 'prerelease' : 'patch') + }, + ...(currentBeta + ? [ + { + title: 'stable', + value: inc('patch') + } + ] + : [ + { + title: 'beta-minor', + value: inc('preminor') + }, + { + title: 'beta-major', + value: inc('premajor') + }, + { + title: 'minor', + value: inc('minor') + }, + { + title: 'major', + value: inc('major') + } + ]), + { value: 'custom', title: 'custom' } + ].map((i) => { + i.title = `${i.title} (${i.value})` + return i + }) + + return versionChoices +} + +export function updateVersion(pkgPath: string, version: string): void { + const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')) + pkg.version = version + writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') +} + +export async function publishPackage( + pkdDir: string, + tag?: string +): Promise { + const publicArgs = ['publish', '--access', 'public'] + if (tag) { + publicArgs.push(`--tag`, tag) + } + await runIfNotDry('npm', publicArgs, { + stdio: 'pipe', + cwd: pkdDir + }) +} + +export async function getLatestTag(pkgName: string) { + const tags = (await run('git', ['tag'], { stdio: 'pipe' })).stdout + .split(/\n/) + .filter(Boolean) + const prefix = pkgName === 'vite' ? 'v' : `${pkgName}@` + return tags + .filter((tag) => tag.startsWith(prefix)) + .sort() + .reverse()[0] +} + +export async function logRecentCommits(pkgName: string) { + const tag = await getLatestTag(pkgName) + if (!tag) return + const sha = await run('git', ['rev-list', '-n', '1', tag], { + stdio: 'pipe' + }).then((res) => res.stdout.trim()) + console.log( + colors.bold( + `\n${colors.blue(`i`)} Commits of ${colors.green( + pkgName + )} since ${colors.green(tag)} ${colors.gray(`(${sha.slice(0, 5)})`)}` + ) + ) + await run( + 'git', + [ + '--no-pager', + 'log', + `${sha}..HEAD`, + '--oneline', + '--', + `packages/${pkgName}` + ], + { stdio: 'inherit' } + ) + console.log() +} + +export async function updateTemplateVersions(version: string) { + if (/beta|alpha|rc/.test(version)) return + + const dir = path.resolve(__dirname, '../packages/create-vite') + + const templates = readdirSync(dir).filter((dir) => + dir.startsWith('template-') + ) + for (const template of templates) { + const pkgPath = path.join(dir, template, `package.json`) + const pkg = require(pkgPath) + pkg.devDependencies.vite = `^` + version + if (template.startsWith('template-vue')) { + pkg.devDependencies['@vitejs/plugin-vue'] = + `^` + require('../packages/plugin-vue/package.json').version + } + writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') + } +} From 8e923fae96de811ca9c621049c061d0fffcc52d1 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Feb 2022 19:25:35 +0800 Subject: [PATCH 078/309] chore(ci): remove dry flag --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f4df5af00cc23c..ffdd5ea6399ad5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -32,6 +32,6 @@ jobs: run: pnpm install - name: Publish package - run: pnpm run ci-publish -- ${{ github.ref_name }} --dry + run: pnpm run ci-publish -- ${{ github.ref_name }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 254cc456c190086b2cba9c9e149720828ca3f00d Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Feb 2022 19:31:21 +0800 Subject: [PATCH 079/309] chore: fix create-vite bumping script (#6881) --- scripts/release.ts | 2 +- scripts/releaseUtils.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/release.ts b/scripts/release.ts index 6ec929a1d3a340..d536eca1f70586 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -75,7 +75,7 @@ async function main(): Promise { step('\nUpdating package version...') updateVersion(pkgPath, targetVersion) - if (pkgName === 'create-vite') updateTemplateVersions(targetVersion) + if (pkgName === 'create-vite') updateTemplateVersions() step('\nGenerating changelog...') const changelogArgs = [ diff --git a/scripts/releaseUtils.ts b/scripts/releaseUtils.ts index c2626a083552d0..b444835db7b6d0 100644 --- a/scripts/releaseUtils.ts +++ b/scripts/releaseUtils.ts @@ -194,8 +194,9 @@ export async function logRecentCommits(pkgName: string) { console.log() } -export async function updateTemplateVersions(version: string) { - if (/beta|alpha|rc/.test(version)) return +export async function updateTemplateVersions() { + const viteVersion = require('../packages/vite/package.json').version + if (/beta|alpha|rc/.test(viteVersion)) return const dir = path.resolve(__dirname, '../packages/create-vite') @@ -205,7 +206,7 @@ export async function updateTemplateVersions(version: string) { for (const template of templates) { const pkgPath = path.join(dir, template, `package.json`) const pkg = require(pkgPath) - pkg.devDependencies.vite = `^` + version + pkg.devDependencies.vite = `^` + viteVersion if (template.startsWith('template-vue')) { pkg.devDependencies['@vitejs/plugin-vue'] = `^` + require('../packages/plugin-vue/package.json').version From fcb53a365832449b9c23783781141498a4d0da58 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Feb 2022 19:31:50 +0800 Subject: [PATCH 080/309] release: plugin-vue-jsx@1.3.6 --- packages/plugin-vue-jsx/CHANGELOG.md | 9 +++++++++ packages/plugin-vue-jsx/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue-jsx/CHANGELOG.md b/packages/plugin-vue-jsx/CHANGELOG.md index 594f12c90f0909..8473e8f8af24f3 100644 --- a/packages/plugin-vue-jsx/CHANGELOG.md +++ b/packages/plugin-vue-jsx/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.3.6](https://github.com/vitejs/vite/compare/plugin-vue@2.2.0...plugin-vue@1.3.6) (2022-02-12) + + +### Bug Fixes + +* **deps:** update all non-major dependencies ([#6782](https://github.com/vitejs/vite/issues/6782)) ([e38be3e](https://github.com/vitejs/vite/commit/e38be3e6ca7bf79319d5d7188e1d347b1d6091ef)) + + + ## [1.3.5](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.3.4...plugin-vue-jsx@1.3.5) (2022-02-12) diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index dff19a227804d1..027f6d99180163 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue-jsx", - "version": "1.3.5", + "version": "1.3.6", "license": "MIT", "author": "Evan You", "files": [ From 5e26d5f663a9c8888405ea495a64271b51a9046d Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Feb 2022 19:47:58 +0800 Subject: [PATCH 081/309] chore: fix releasing token (#6882) --- .github/workflows/publish.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ffdd5ea6399ad5..eb8f4513707872 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,11 +26,20 @@ jobs: uses: actions/setup-node@v2 with: node-version: 16.x + registry-url: https://registry.npmjs.org/ cache: "pnpm" - name: Install deps run: pnpm install + - name: Creating .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Publish package run: pnpm run ci-publish -- ${{ github.ref_name }} env: From 78e84c80c0f49d6f7c8a0e10c4257a477a221280 Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Sat, 12 Feb 2022 20:50:18 +0000 Subject: [PATCH 082/309] feat: make `import.meta.glob` and `import.meta.globEager` generic (#5073) --- packages/vite/types/importMeta.d.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/packages/vite/types/importMeta.d.ts b/packages/vite/types/importMeta.d.ts index 625e075333e48d..732310490350eb 100644 --- a/packages/vite/types/importMeta.d.ts +++ b/packages/vite/types/importMeta.d.ts @@ -59,25 +59,15 @@ interface ImportMeta { readonly env: ImportMetaEnv - glob( + glob( pattern: string, options?: AssertOptions - ): Record< - string, - () => Promise<{ - [key: string]: any - }> - > + ): Record Promise> - globEager( + globEager( pattern: string, options?: AssertOptions - ): Record< - string, - { - [key: string]: any - } - > + ): Record } interface ImportMetaEnv { From 62cbe68ab713d5aba626a1e3a4da46e8c2320bf3 Mon Sep 17 00:00:00 2001 From: Ivan Demchuk Date: Sun, 13 Feb 2022 11:58:49 +0200 Subject: [PATCH 083/309] perf: improve isFileReadable performance (#6868) --- packages/vite/src/node/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index d723b25a54122d..2b2ba6fb859107 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -422,8 +422,8 @@ export function writeFile( */ export function isFileReadable(filename: string): boolean { try { - fs.accessSync(filename, fs.constants.R_OK) - return true + const stat = fs.statSync(filename, { throwIfNoEntry: false }) + return !!stat } catch { return false } From 2eabcb9a30a413ff540cbdd60a919a0d1f72fb35 Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Sun, 13 Feb 2022 22:24:33 +0630 Subject: [PATCH 084/309] perf: lazy import preview function (#6898) --- packages/vite/src/node/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/cli.ts b/packages/vite/src/node/cli.ts index 1b3af6b90e6f65..2a4f3a77918144 100644 --- a/packages/vite/src/node/cli.ts +++ b/packages/vite/src/node/cli.ts @@ -6,7 +6,6 @@ import type { ServerOptions } from './server' import type { LogLevel } from './logger' import { createLogger } from './logger' import { resolveConfig } from '.' -import { preview } from './preview' const cli = cac('vite') @@ -230,6 +229,7 @@ cli strictPort?: boolean } & GlobalCLIOptions ) => { + const { preview } = await import('./preview') try { const server = await preview({ root, From e385346c53b3bb54f2e1abcb7348e33d7e075fd4 Mon Sep 17 00:00:00 2001 From: ygj6 <7699524+ygj6@users.noreply.github.com> Date: Mon, 14 Feb 2022 11:49:36 +0800 Subject: [PATCH 085/309] feat: custom manifest file name (#6667) --- docs/config/index.md | 8 ++++---- packages/vite/src/node/build.ts | 4 ++-- packages/vite/src/node/cli.ts | 4 ++-- packages/vite/src/node/plugins/manifest.ts | 5 ++++- packages/vite/src/node/ssr/ssrManifestPlugin.ts | 5 ++++- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index 233e08b8f864e3..ba84c49b2f5820 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -772,19 +772,19 @@ export default defineConfig({ ### build.manifest -- **Type:** `boolean` +- **Type:** `boolean | string` - **Default:** `false` - **Related:** [Backend Integration](/guide/backend-integration) - When set to `true`, the build will also generate a `manifest.json` file that contains a mapping of non-hashed asset filenames to their hashed versions, which can then be used by a server framework to render the correct asset links. + When set to `true`, the build will also generate a `manifest.json` file that contains a mapping of non-hashed asset filenames to their hashed versions, which can then be used by a server framework to render the correct asset links. When the value is a string, it will be used as the manifest file name. ### build.ssrManifest -- **Type:** `boolean` +- **Type:** `boolean | string` - **Default:** `false` - **Related:** [Server-Side Rendering](/guide/ssr) - When set to `true`, the build will also generate a SSR manifest for determining style links and asset preload directives in production. + When set to `true`, the build will also generate a SSR manifest for determining style links and asset preload directives in production. When the value is a string, it will be used as the manifest file name. ### build.ssr diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index b9936f8583b46c..c8a1a0f17fa4a4 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -179,7 +179,7 @@ export interface BuildOptions { * ``` * @default false */ - manifest?: boolean + manifest?: boolean | string /** * Build in library mode. The value should be the global name of the lib in * UMD mode. This will produce esm + cjs + umd bundle formats with default @@ -195,7 +195,7 @@ export interface BuildOptions { * Generate SSR manifest for determining style links and asset preload * directives in production. */ - ssrManifest?: boolean + ssrManifest?: boolean | string /** * Set to false to disable reporting compressed chunk sizes. * Can slightly improve build speed. diff --git a/packages/vite/src/node/cli.ts b/packages/vite/src/node/cli.ts index 2a4f3a77918144..91b3d4e6bee998 100644 --- a/packages/vite/src/node/cli.ts +++ b/packages/vite/src/node/cli.ts @@ -149,8 +149,8 @@ cli `[boolean | "terser" | "esbuild"] enable/disable minification, ` + `or specify minifier to use (default: esbuild)` ) - .option('--manifest', `[boolean] emit build manifest json`) - .option('--ssrManifest', `[boolean] emit ssr manifest json`) + .option('--manifest [name]', `[boolean | string] emit build manifest json`) + .option('--ssrManifest [name]', `[boolean | string] emit ssr manifest json`) .option( '--emptyOutDir', `[boolean] force empty outDir when it's outside of root` diff --git a/packages/vite/src/node/plugins/manifest.ts b/packages/vite/src/node/plugins/manifest.ts index 2ce4869e67d98d..d6dceb507ca946 100644 --- a/packages/vite/src/node/plugins/manifest.ts +++ b/packages/vite/src/node/plugins/manifest.ts @@ -113,7 +113,10 @@ export function manifestPlugin(config: ResolvedConfig): Plugin { const outputLength = Array.isArray(output) ? output.length : 1 if (outputCount >= outputLength) { this.emitFile({ - fileName: `manifest.json`, + fileName: + typeof config.build.manifest === 'string' + ? config.build.manifest + : 'manifest.json', type: 'asset', source: JSON.stringify(manifest, null, 2) }) diff --git a/packages/vite/src/node/ssr/ssrManifestPlugin.ts b/packages/vite/src/node/ssr/ssrManifestPlugin.ts index e6811eae29b210..a92550e39d4ed0 100644 --- a/packages/vite/src/node/ssr/ssrManifestPlugin.ts +++ b/packages/vite/src/node/ssr/ssrManifestPlugin.ts @@ -96,7 +96,10 @@ export function ssrManifestPlugin(config: ResolvedConfig): Plugin { } this.emitFile({ - fileName: 'ssr-manifest.json', + fileName: + typeof config.build.ssrManifest === 'string' + ? config.build.ssrManifest + : 'ssr-manifest.json', type: 'asset', source: JSON.stringify(ssrManifest, null, 2) }) From 55eca7cf2750690d66eff8007bc1d6b5f0edb292 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 14 Feb 2022 11:13:56 +0100 Subject: [PATCH 086/309] release: plugin-vue-jsx@1.3.7 --- packages/plugin-vue-jsx/CHANGELOG.md | 9 +++++++++ packages/plugin-vue-jsx/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue-jsx/CHANGELOG.md b/packages/plugin-vue-jsx/CHANGELOG.md index 8473e8f8af24f3..0ad338dbd211eb 100644 --- a/packages/plugin-vue-jsx/CHANGELOG.md +++ b/packages/plugin-vue-jsx/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.3.7](https://github.com/vitejs/vite/compare/plugin-vue@2.2.0...plugin-vue@1.3.7) (2022-02-14) + + +### Bug Fixes + +* **deps:** update all non-major dependencies ([#6782](https://github.com/vitejs/vite/issues/6782)) ([e38be3e](https://github.com/vitejs/vite/commit/e38be3e6ca7bf79319d5d7188e1d347b1d6091ef)) + + + ## [1.3.6](https://github.com/vitejs/vite/compare/plugin-vue@2.2.0...plugin-vue@1.3.6) (2022-02-12) diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 027f6d99180163..f8289b79f4c445 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@vitejs/plugin-vue-jsx", - "version": "1.3.6", + "version": "1.3.7", "license": "MIT", "author": "Evan You", "files": [ From e8c840abd2767445a5e49bab6540a66b941d7239 Mon Sep 17 00:00:00 2001 From: patak-dev Date: Mon, 14 Feb 2022 11:21:37 +0100 Subject: [PATCH 087/309] release: v2.8.2 --- packages/vite/CHANGELOG.md | 16 ++++++++++++++++ packages/vite/package.json | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 50925e58baffdb..13226de36642eb 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,19 @@ +## [2.8.2](https://github.com/vitejs/vite/compare/v2.8.1...v2.8.2) (2022-02-14) + + +### Features + +* custom manifest file name ([#6667](https://github.com/vitejs/vite/issues/6667)) ([e385346](https://github.com/vitejs/vite/commit/e385346c53b3bb54f2e1abcb7348e33d7e075fd4)) +* make `import.meta.glob` and `import.meta.globEager` generic ([#5073](https://github.com/vitejs/vite/issues/5073)) ([78e84c8](https://github.com/vitejs/vite/commit/78e84c80c0f49d6f7c8a0e10c4257a477a221280)) + + +### Performance Improvements + +* improve isFileReadable performance ([#6868](https://github.com/vitejs/vite/issues/6868)) ([62cbe68](https://github.com/vitejs/vite/commit/62cbe68ab713d5aba626a1e3a4da46e8c2320bf3)) +* lazy import preview function ([#6898](https://github.com/vitejs/vite/issues/6898)) ([2eabcb9](https://github.com/vitejs/vite/commit/2eabcb9a30a413ff540cbdd60a919a0d1f72fb35)) + + + ## [2.8.1](https://github.com/vitejs/vite/compare/v2.8.0...v2.8.1) (2022-02-11) diff --git a/packages/vite/package.json b/packages/vite/package.json index 9bd14ca89a4d16..94029dc45cc008 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.8.1", + "version": "2.8.2", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From 0e58e72ab3b36156fb32bf983fe56c7621a11106 Mon Sep 17 00:00:00 2001 From: Zheeeng Date: Tue, 15 Feb 2022 15:21:55 +0800 Subject: [PATCH 088/309] chore: prefer using nullish-coalescing over or logic operator (#6790) --- packages/playground/testUtils.ts | 4 ++-- packages/vite/src/node/ssr/ssrManifestPlugin.ts | 2 +- packages/vite/src/node/ssr/ssrStacktrace.ts | 2 +- packages/vite/src/node/utils.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/playground/testUtils.ts b/packages/playground/testUtils.ts index 3c6cba769b3ffe..0ae0c6e8766e95 100644 --- a/packages/playground/testUtils.ts +++ b/packages/playground/testUtils.ts @@ -56,7 +56,7 @@ async function toEl(el: string | ElementHandle): Promise { export async function getColor(el: string | ElementHandle): Promise { el = await toEl(el) const rgb = await el.evaluate((el) => getComputedStyle(el as Element).color) - return hexToNameMap[rgbToHex(rgb)] || rgb + return hexToNameMap[rgbToHex(rgb)] ?? rgb } export async function getBg(el: string | ElementHandle): Promise { @@ -119,7 +119,7 @@ export async function untilUpdated( if (isBuild && !runInBuild) return const maxTries = process.env.CI ? 100 : 50 for (let tries = 0; tries < maxTries; tries++) { - const actual = (await poll()) || '' + const actual = (await poll()) ?? '' if (actual.indexOf(expected) > -1 || tries === maxTries - 1) { expect(actual).toMatch(expected) break diff --git a/packages/vite/src/node/ssr/ssrManifestPlugin.ts b/packages/vite/src/node/ssr/ssrManifestPlugin.ts index a92550e39d4ed0..351c91349a3ca3 100644 --- a/packages/vite/src/node/ssr/ssrManifestPlugin.ts +++ b/packages/vite/src/node/ssr/ssrManifestPlugin.ts @@ -29,7 +29,7 @@ export function ssrManifestPlugin(config: ResolvedConfig): Plugin { for (const id in chunk.modules) { const normalizedId = normalizePath(relative(config.root, id)) const mappedChunks = - ssrManifest[normalizedId] || (ssrManifest[normalizedId] = []) + ssrManifest[normalizedId] ?? (ssrManifest[normalizedId] = []) if (!chunk.isEntry) { mappedChunks.push(base + chunk.fileName) } diff --git a/packages/vite/src/node/ssr/ssrStacktrace.ts b/packages/vite/src/node/ssr/ssrStacktrace.ts index 75fcd8d2933c6f..0d847cb7da7041 100644 --- a/packages/vite/src/node/ssr/ssrStacktrace.ts +++ b/packages/vite/src/node/ssr/ssrStacktrace.ts @@ -46,7 +46,7 @@ export function ssrRewriteStacktrace( return input } - const source = `${pos.source}:${pos.line || 0}:${pos.column || 0}` + const source = `${pos.source}:${pos.line ?? 0}:${pos.column ?? 0}` if (!varName || varName === 'eval') { return ` at ${source}` } else { diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 2b2ba6fb859107..3012e6d57e6c65 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -222,7 +222,7 @@ export function injectQuery(url: string, queryToInject: string): string { } pathname = decodeURIComponent(pathname) return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ''}${ - hash || '' + hash ?? '' }` } @@ -518,7 +518,7 @@ export async function processSrcSet( ) return ret.reduce((prev, { url, descriptor }, index) => { - descriptor = descriptor || '' + descriptor ??= '' return (prev += url + ` ${descriptor}${index === ret.length - 1 ? '' : ', '}`) }, '') From 3480f27d4db7f7ebd27164d9185e7b387762274e Mon Sep 17 00:00:00 2001 From: Zheeeng Date: Tue, 15 Feb 2022 15:22:33 +0800 Subject: [PATCH 089/309] chore(types): correct typing in jestPerTestSetup (#6786) --- scripts/jestPerTestSetup.ts | 24 +++++++++++++----------- scripts/tsconfig.json | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/scripts/jestPerTestSetup.ts b/scripts/jestPerTestSetup.ts index 89209c3ffcbf69..9c15edf9f059bf 100644 --- a/scripts/jestPerTestSetup.ts +++ b/scripts/jestPerTestSetup.ts @@ -10,8 +10,7 @@ import type { Logger } from 'vite' import { createServer, build } from 'vite' -import type { Page } from 'playwright-chromium' -// eslint-disable-next-line node/no-extraneous-import +import type { Page, ConsoleMessage } from 'playwright-chromium' import type { RollupError, RollupWatcher, RollupWatcherEvent } from 'rollup' const isBuildTest = !!process.env.VITE_TEST_BUILD @@ -45,13 +44,15 @@ let server: ViteDevServer | http.Server let tempDir: string let rootDir: string -const setBeforeAllError = (err) => ((global as any).beforeAllError = err) -const getBeforeAllError = () => (global as any).beforeAllError +const setBeforeAllError = (err: Error | null) => { + global.beforeAllError = err +} +const getBeforeAllError = () => global.beforeAllError //init with null so old errors don't carry over setBeforeAllError(null) -const logs = ((global as any).browserLogs = []) -const onConsole = (msg) => { +const logs: string[] = (global.browserLogs = []) +const onConsole = (msg: ConsoleMessage) => { logs.push(msg.text()) } @@ -145,7 +146,7 @@ beforeAll(async () => { await page.goto(url) } } - } catch (e) { + } catch (e: any) { // jest doesn't exit if our setup has error here // https://github.com/facebook/jest/issues/2713 setBeforeAllError(e) @@ -172,11 +173,12 @@ afterAll(async () => { function startStaticServer(): Promise { // check if the test project has base config const configFile = resolve(rootDir, 'vite.config.js') - let config: UserConfig + let config: UserConfig | undefined try { config = require(configFile) } catch (e) {} - const base = (config?.base || '/') === '/' ? '' : config.base + // fallback internal base to '' + const base = (config?.base ?? '/') === '/' ? '' : config?.base ?? '' // @ts-ignore if (config && config.__test__) { @@ -219,10 +221,10 @@ export async function notifyRebuildComplete( watcher: RollupWatcher ): Promise { let callback: (event: RollupWatcherEvent) => void - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { callback = (event) => { if (event.code === 'END') { - resolve(true) + resolve() } } watcher.on('event', callback) diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 6a32b899cb43ab..5c70fcc7f15823 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -8,6 +8,6 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "types": ["node"] + "types": ["node", "jest"] } } From a9a1ae2db6a81a2fd31db370b58686e442047d9e Mon Sep 17 00:00:00 2001 From: patak Date: Tue, 15 Feb 2022 17:17:28 +0100 Subject: [PATCH 090/309] fix: revert update dotenv-expand #6703, fix #6858 (#6934) --- packages/vite/package.json | 2 +- packages/vite/src/node/config.ts | 2 +- pnpm-lock.yaml | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/vite/package.json b/packages/vite/package.json index 94029dc45cc008..728f6e00b84c7f 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -87,7 +87,7 @@ "cross-spawn": "^7.0.3", "debug": "^4.3.3", "dotenv": "^14.3.2", - "dotenv-expand": "^6.0.1", + "dotenv-expand": "^5.1.0", "es-module-lexer": "^0.9.3", "estree-walker": "^2.0.2", "etag": "^1.8.1", diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index f73f4fb8662d6b..2a607dd6ba9948 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -21,7 +21,7 @@ import { resolvePlugins } from './plugins' import colors from 'picocolors' import type { ESBuildOptions } from './plugins/esbuild' import dotenv from 'dotenv' -import { expand as dotenvExpand } from 'dotenv-expand' +import dotenvExpand from 'dotenv-expand' import type { Alias, AliasOptions } from 'types/alias' import { CLIENT_ENTRY, ENV_ENTRY, DEFAULT_ASSETS_RE } from './constants' import type { InternalResolveOptions, ResolveOptions } from './plugins/resolve' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab4083cb6a7635..418cf16f0eb6b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -770,7 +770,7 @@ importers: cross-spawn: ^7.0.3 debug: ^4.3.3 dotenv: ^14.3.2 - dotenv-expand: ^6.0.1 + dotenv-expand: ^5.1.0 es-module-lexer: ^0.9.3 esbuild: ^0.14.14 estree-walker: ^2.0.2 @@ -848,7 +848,7 @@ importers: cross-spawn: 7.0.3 debug: 4.3.3 dotenv: 14.3.2 - dotenv-expand: 6.0.1 + dotenv-expand: 5.1.0 es-module-lexer: 0.9.3 estree-walker: 2.0.2 etag: 1.8.1 @@ -4212,9 +4212,8 @@ packages: is-obj: 2.0.0 dev: true - /dotenv-expand/6.0.1: - resolution: {integrity: sha512-GNHcCOyRKLCXWnH3L/+sJ04PQxxgTOZDCPuQQnqkqPMGIilyoxHZ2JUNmh2VWKCfzVKH/AZsqcbuSYlDDVb/xw==} - engines: {node: '>=12'} + /dotenv-expand/5.1.0: + resolution: {integrity: sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==} dev: true /dotenv/14.3.2: From ac9652b0fc9aa947da4a62ff9553e23aee1dee8f Mon Sep 17 00:00:00 2001 From: patak-dev Date: Tue, 15 Feb 2022 18:07:13 +0100 Subject: [PATCH 091/309] release: v2.8.3 --- packages/vite/CHANGELOG.md | 9 +++++++++ packages/vite/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 13226de36642eb..fb262e6e13e783 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,3 +1,12 @@ +## [2.8.3](https://github.com/vitejs/vite/compare/v2.8.2...v2.8.3) (2022-02-15) + + +### Bug Fixes + +* revert update dotenv-expand [#6703](https://github.com/vitejs/vite/issues/6703), fix [#6858](https://github.com/vitejs/vite/issues/6858) ([#6934](https://github.com/vitejs/vite/issues/6934)) ([a9a1ae2](https://github.com/vitejs/vite/commit/a9a1ae2db6a81a2fd31db370b58686e442047d9e)) + + + ## [2.8.2](https://github.com/vitejs/vite/compare/v2.8.1...v2.8.2) (2022-02-14) diff --git a/packages/vite/package.json b/packages/vite/package.json index 728f6e00b84c7f..0eff7b535822df 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "vite", - "version": "2.8.2", + "version": "2.8.3", "license": "MIT", "author": "Evan You", "description": "Native-ESM powered web dev build tool", From 3f27d58036bfe4149e563a105c08c2d4771db288 Mon Sep 17 00:00:00 2001 From: patak Date: Tue, 15 Feb 2022 22:33:41 +0100 Subject: [PATCH 092/309] chore(deps): avoid updating dotenv-expand to v6+ (#6936) --- .github/renovate.json5 | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 763dfcfc467d9d..06fe0e7ea2aaff 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -28,6 +28,7 @@ "react-router", // `react-router:v6.0.0+` has breaking changes "react-router-dom", // `react-router-dom:v6.0.0+` has breaking changes "source-map", // `source-map:v0.7.0+` needs more investigation + "dotenv-expand", // `dotenv-expand:6.0.0+` has breaking changes (#6858) // ESM Only => https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm "node-fetch", From e2349569cf96e506e0d5fff1d043727a77fdad70 Mon Sep 17 00:00:00 2001 From: ocavue Date: Wed, 16 Feb 2022 21:20:45 +0800 Subject: [PATCH 093/309] docs: add backticks (#6945) --- docs/config/index.md | 2 +- packages/vite/src/node/config.ts | 2 +- packages/vite/src/node/optimizer/index.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index ba84c49b2f5820..d4ee7a96a6fa67 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -923,7 +923,7 @@ export default defineConfig({ - **Type:** `string | string[]` - By default, Vite will crawl your index.html to detect dependencies that need to be pre-bundled. If build.rollupOptions.input is specified, Vite will crawl those entry points instead. + By default, Vite will crawl your `index.html` to detect dependencies that need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite will crawl those entry points instead. If neither of these fit your needs, you can specify custom entries using this option - the value should be a [fast-glob pattern](https://github.com/mrmlnc/fast-glob#basic-syntax) or array of patterns that are relative from Vite project root. This will overwrite default entries inference. diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 2a607dd6ba9948..fbda8d5166cb1b 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -92,7 +92,7 @@ export interface UserConfig { * the performance. You can use `--force` flag or manually delete the directory * to regenerate the cache files. The value can be either an absolute file * system path or a path relative to . - * Default to `.vite` when no package.json is detected. + * Default to `.vite` when no `package.json` is detected. * @default 'node_modules/.vite' */ cacheDir?: string diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index 6102e832841a89..c13a26c63b3c1c 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -30,8 +30,8 @@ export type ExportsData = ReturnType & { export interface DepOptimizationOptions { /** - * By default, Vite will crawl your index.html to detect dependencies that - * need to be pre-bundled. If build.rollupOptions.input is specified, Vite + * By default, Vite will crawl your `index.html` to detect dependencies that + * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite * will crawl those entry points instead. * * If neither of these fit your needs, you can specify custom entries using From 4120908c518c8a89354aa93ffd6ebf5436123134 Mon Sep 17 00:00:00 2001 From: yoho <907415276@qq.com> Date: Thu, 17 Feb 2022 21:14:06 +0800 Subject: [PATCH 094/309] docs: import.meta.glob support ?raw (#6953) Co-authored-by: ygj6 <7699524+ygj6@users.noreply.github.com> --- docs/guide/features.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/guide/features.md b/docs/guide/features.md index da8e3b1de092b2..c7fd2424b53cb1 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -298,6 +298,22 @@ const modules = { } ``` +`import.meta.glob` and `import.meta.globEager` also support importing files as strings, similar to [Importing Asset as String](https://vitejs.dev/guide/assets.html#importing-asset-as-string). Here, we use the [Import Assertions](https://github.com/tc39/proposal-import-assertions#synopsis) syntax to import. + +```js +const modules = import.meta.glob('./dir/*.js', { assert: { type: 'raw' } }) +``` + +The above will be transformed into the following: + +```js +// code produced by vite +const modules = { + './dir/foo.js': '{\n "msg": "foo"\n}\n', + './dir/bar.js': '{\n "msg": "bar"\n}\n' +} +``` + Note that: - This is a Vite-only feature and is not a web or ES standard. From 08cf4e106534481fd8eff2e6e4a986270c28f894 Mon Sep 17 00:00:00 2001 From: Sepush Date: Thu, 17 Feb 2022 21:15:51 +0800 Subject: [PATCH 095/309] chore(ci): update issue-helper version (#6955) --- .github/workflows/issue-close-require.yml | 2 +- .github/workflows/issue-labeled.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issue-close-require.yml b/.github/workflows/issue-close-require.yml index 02ac374b06c426..97f9dd3a449c3c 100644 --- a/.github/workflows/issue-close-require.yml +++ b/.github/workflows/issue-close-require.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: need reproduction - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: "close-issues" token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index a63021952fd73d..b6f3919dfa63a2 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -10,7 +10,7 @@ jobs: steps: - name: contribution welcome if: github.event.label.name == 'contribution welcome' || github.event.label.name == 'help wanted' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: "create-comment, remove-labels" token: ${{ secrets.GITHUB_TOKEN }} @@ -21,7 +21,7 @@ jobs: - name: remove pending if: github.event.label.name == 'enhancement' || github.event.label.name == 'bug' || (contains(github.event.label.name, 'pending triage') == false && startsWith(github.event.label.name, 'bug:') == true) - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: "remove-labels" token: ${{ secrets.GITHUB_TOKEN }} @@ -30,7 +30,7 @@ jobs: - name: need reproduction if: github.event.label.name == 'need reproduction' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: "create-comment, remove-labels" token: ${{ secrets.GITHUB_TOKEN }} From 3f3f4737d5242547fb83f8d2522ba91cc1d96fb0 Mon Sep 17 00:00:00 2001 From: Nurettin Kaya Date: Thu, 17 Feb 2022 13:24:44 -0800 Subject: [PATCH 096/309] fix: normalize postcss dependency messages (#6959) --- .../tailwind/__test__/tailwind.spec.ts | 22 ++++++++++++++++++- packages/playground/tailwind/src/App.vue | 2 +- .../playground/tailwind/tailwind.config.js | 7 +++++- packages/vite/src/node/plugins/css.ts | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/packages/playground/tailwind/__test__/tailwind.spec.ts b/packages/playground/tailwind/__test__/tailwind.spec.ts index 105eb245bf207e..47f6b7ccf49037 100644 --- a/packages/playground/tailwind/__test__/tailwind.spec.ts +++ b/packages/playground/tailwind/__test__/tailwind.spec.ts @@ -5,7 +5,7 @@ test('should render', async () => { }) if (!isBuild) { - test('regenerate CSS and HMR', async () => { + test('regenerate CSS and HMR (glob pattern)', async () => { browserLogs.length = 0 const el = await page.$('#pagetitle') const el2 = await page.$('#helloroot') @@ -37,4 +37,24 @@ if (!isBuild) { browserLogs.length = 0 }) + + test('regenerate CSS and HMR (relative path)', async () => { + browserLogs.length = 0 + const el = await page.$('h1') + + expect(await getColor(el)).toBe('black') + + editFile('src/App.vue', (code) => + code.replace('text-black', 'text-[rgb(11,22,33)]') + ) + + await untilUpdated(() => getColor(el), 'rgb(11, 22, 33)') + + expect(browserLogs).toMatchObject([ + '[vite] css hot updated: /index.css', + '[vite] hot updated: /src/App.vue' + ]) + + browserLogs.length = 0 + }) } diff --git a/packages/playground/tailwind/src/App.vue b/packages/playground/tailwind/src/App.vue index b032d5e0db77e3..25835fc414a06f 100644 --- a/packages/playground/tailwind/src/App.vue +++ b/packages/playground/tailwind/src/App.vue @@ -1,6 +1,6 @@ diff --git a/packages/playground/vue/workerTest.js b/packages/playground/vue/workerTest.js new file mode 100644 index 00000000000000..fcde5e19b30677 --- /dev/null +++ b/packages/playground/vue/workerTest.js @@ -0,0 +1 @@ +self.postMessage('worker load!') diff --git a/packages/playground/worker/index.html b/packages/playground/worker/index.html index 60289ff84d6a06..fb4b3e9e85bfc8 100644 --- a/packages/playground/worker/index.html +++ b/packages/playground/worker/index.html @@ -1,3 +1,8 @@ +

worker template error match:

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

format iife:

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

format iife:

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

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

+

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

+ +