diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 622a8e48c3a52e..f72157534cfc20 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -3,6 +3,11 @@ name: Prepare Release on: workflow_dispatch: inputs: + target_branch: + description: Release target branch + required: true + default: main + type: string package: description: Package to release required: true @@ -31,7 +36,7 @@ on: type: string concurrency: - group: ${{ github.workflow }}-${{ inputs.package }}-${{ inputs.version || inputs.release }} + group: ${{ github.workflow }}-${{ inputs.target_branch }}-${{ inputs.package }}-${{ inputs.version || inputs.release }} cancel-in-progress: false permissions: {} @@ -45,10 +50,19 @@ jobs: contents: write pull-requests: write steps: + - name: Validate target branch + env: + TARGET_BRANCH: ${{ inputs.target_branch }} + run: | + if [[ "$TARGET_BRANCH" != "main" && ! "$TARGET_BRANCH" =~ ^v[0-9]+(\.[0-9]+)?$ ]]; then + echo "Target branch must be main or a v* release branch (for example, v8 or v8.0)" + exit 1 + fi + - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: - ref: main + ref: ${{ inputs.target_branch }} fetch-depth: 0 persist-credentials: false @@ -82,4 +96,5 @@ jobs: package-path: packages/${{ inputs.package }} pr-body: ${{ steps.prepare.outputs.pr_body }} tag: ${{ steps.prepare.outputs.tag }} + target-branch: ${{ inputs.target_branch }} version: ${{ steps.prepare.outputs.version }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5ea200675430ec..0772404103c64a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - "v[0-9]*" permissions: {} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a943153950d0b8..45aa095ce78006 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -352,14 +352,15 @@ All publishable packages in this repository use a pull-request-driven release fl #### Prepare a Release 1. Run the [Prepare Release](.github/workflows/prepare-release.yml) workflow from the `main` branch. -2. Select `vite`, `create-vite`, or `plugin-legacy`. -3. Select a `release` type. The default `next` creates the next patch for a stable version or advances an existing prerelease. Alternatively, select another supported release type or enter an exact `version`, which takes precedence over `release`. -4. Wait for the action to open the release PR. The PR contains the selected package's version bump and changelog entry. A `create-vite` release also updates template Vite dependency versions when appropriate. +2. Enter the target branch. Use `main` for the current release line or a `v*` release branch (for example, `v8` or `v8.0`) for a patch release. +3. Select `vite`, `create-vite`, or `plugin-legacy`. +4. Select a `release` type. The default `next` creates the next patch for a stable version or advances an existing prerelease. Alternatively, select another supported release type or enter an exact `version`, which takes precedence over `release`. +5. Wait for the action to open a release PR against the target branch. The PR contains the selected package's version bump and changelog entry. A `create-vite` release also updates template Vite dependency versions when appropriate. #### Review and Publish 1. Review the generated version and changelog, and wait for the release PR checks to pass. -2. Merge the PR while retaining its `release: ` commit subject. Vite uses `release: v`; other packages use `release: @`. A matching commit at the tip of `main` triggers the publish job. +2. Merge the PR while retaining its `release: ` commit subject. Vite uses `release: v`; other packages use `release: @`. A matching commit at the tip of `main` or a `v*` release branch triggers the publish job. 3. Open the [Publish Package](.github/workflows/publish.yml) run and approve its `Release` environment deployment. 4. Wait for the workflow to publish the package, create its tag, and create the corresponding GitHub release. 5. Verify the new version on npm. @@ -368,7 +369,7 @@ All publishable packages in this repository use a pull-request-driven release fl The release flow depends on configuration outside this repository: -- The `Release` environment must require maintainer approval before publishing. +- The `Release` environment must require maintainer approval before publishing and allow deployments from `main` and supported `v*` release branches. - The npm trusted publishers for `vite`, `create-vite`, and `@vitejs/plugin-legacy` must be restricted to `vitejs/vite`, `.github/workflows/publish.yml`, and the `Release` environment. #### Recovery diff --git a/package.json b/package.json index a7703937969831..ea55d9251fafac 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "eslint --cache --fix --concurrency auto" ] }, - "packageManager": "pnpm@10.34.5", + "packageManager": "pnpm@12.2.1", "stackblitz": { "startCommand": "pnpm --filter='./packages/vite' run dev" } diff --git a/packages/vite/src/node/plugins/esbuild.ts b/packages/vite/src/node/plugins/esbuild.ts index 0c73f20130c202..d6b3dc39215f4e 100644 --- a/packages/vite/src/node/plugins/esbuild.ts +++ b/packages/vite/src/node/plugins/esbuild.ts @@ -18,7 +18,6 @@ import type { ViteDevServer } from '../server' import { combineSourcemaps, createDebugger, - createFilter, ensureWatchedFile, generateCodeFrame, } from '../utils' @@ -31,7 +30,6 @@ const IIFE_BEGIN_RE = /(?:const|var)\s+\S+\s*=\s*\(?function\([^()]*\)\s*\{\s*"use strict";/ const validExtensionRE = /\.\w+$/ -const jsxExtensionsRE = /\.(?:j|t)sx\b/ // the final build should always support dynamic import and import.meta. // if they need to be polyfilled, plugin-legacy should be used. @@ -275,67 +273,6 @@ export async function transformWithEsbuild( } } -export function esbuildPlugin(config: ResolvedConfig): Plugin { - const options = config.esbuild as ESBuildOptions - const { jsxInject, include, exclude, ...esbuildTransformOptions } = options - - const filter = createFilter(include || /\.(m?ts|[jt]sx)$/, exclude || /\.js$/) - - // Remove optimization options for dev as we only need to transpile them, - // and for build as the final optimization is in `buildEsbuildPlugin` - const transformOptions: EsbuildTransformOptions = { - target: 'esnext', - ...esbuildTransformOptions, - minify: false, - minifyIdentifiers: false, - minifySyntax: false, - minifyWhitespace: false, - treeShaking: false, - // keepNames is not needed when minify is disabled. - // Also transforming multiple times with keepNames enabled breaks - // tree-shaking. (#9164) - keepNames: false, - supported: { - ...defaultEsbuildSupported, - ...esbuildTransformOptions.supported, - }, - } - - let server: ViteDevServer | undefined - - return { - name: 'vite:esbuild', - configureServer(_server) { - server = _server - }, - async transform(code, id) { - if (filter(id) || filter(cleanUrl(id))) { - const result = await transformWithEsbuild( - code, - id, - transformOptions, - undefined, - config, - server?.watcher, - ) - if (result.warnings.length) { - result.warnings.forEach((m) => { - this.warn(prettifyMessage(m, code)) - }) - } - if (jsxInject && jsxExtensionsRE.test(id)) { - result.code = jsxInject + ';' + result.code - } - return { - code: result.code, - map: result.map, - moduleType: 'js', - } - } - }, - } -} - const rollupToEsbuildFormatMap: Record< string, EsbuildTransformOptions['format'] | undefined diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd24274e6e2d2f..5f876604b497ff 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,3 +1,104 @@ +--- +lockfileVersion: '9.0' + +importers: + + .: + configDependencies: {} + packageManagerDependencies: + pnpm: + specifier: 12.2.1 + version: 12.2.1 + +packages: + + '@pnpm/exe.darwin-arm64@12.2.1': + resolution: {integrity: sha512-efC1yfz2xbyHiMLrQAYtnoo5XP20LeAiYYcyL1962qQagZrMXIB0BoQYeZoPTLggLh0Q4MD7jpZUInU5fWxCgQ==} + cpu: [arm64] + os: [darwin] + + '@pnpm/exe.darwin-x64@12.2.1': + resolution: {integrity: sha512-0bloFmxrvYY5LYex5V6SZySwg+egBk0pOW+YUeOm9fiG2U1wv+qRVLBOUvIzLAeJE7vBlAzxUwXkQAYtr12n+Q==} + cpu: [x64] + os: [darwin] + + '@pnpm/exe.linux-arm64-musl@12.2.1': + resolution: {integrity: sha512-AZl7apVZC4TV1/vTp/bS16XUsHeqx9AHsU4V55joiGR+iR6vl+WF0WlGvGCTjqjICS4q/kThpgNrtG8aqQ9seQ==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@pnpm/exe.linux-arm64@12.2.1': + resolution: {integrity: sha512-S36+tMEGrPz3nwtfFU9kYxbHoi8sV7WJfMO9njEL4jRaShTNaLRERMAqyI2DUCiA5QCr6/a50lt4+pKCV2mCvw==} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@pnpm/exe.linux-x64-musl@12.2.1': + resolution: {integrity: sha512-4MQClkAk1em55LFZJpeIqb7j+gEqCgX8yC42j9DFWL42q1uMX1e1tvTy2Dtd4NoWQqgdkLxOStZ+D9CYC+28ow==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@pnpm/exe.linux-x64@12.2.1': + resolution: {integrity: sha512-A/AlR71Leph7qgB3ThSU9yU/vLfre4HmP6nbt3/qt51fzAjQ0xuq7j+cw0f1yDskzOsGzmo5uD6ruefCwLK5uQ==} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@pnpm/exe.win32-arm64@12.2.1': + resolution: {integrity: sha512-TEGUmroT6NGfo2O2+tHK9Zr1lhP1zLzpwx+QAQV19l8V4ljUoMfz8Os5V9zzNCtIpzyKcK7SuG7fkVbxFgRMzg==} + cpu: [arm64] + os: [win32] + + '@pnpm/exe.win32-x64@12.2.1': + resolution: {integrity: sha512-V2Q+AF8fCsw8/CC3bWF8kopOmH0aAjgk9m7H7uAQNulOYIJs9YJBiAlgByswmt+igV9axc4dBI//ZlK2NKpDcw==} + cpu: [x64] + os: [win32] + + pnpm@12.2.1: + resolution: {integrity: sha512-9Vymiqy561q2nGb4KKmK+JoyKGcDrvH42hMcp+q01nfzS/qF4YZGepGcB5nfi29KokD33CkZszsycxkBBBYmFg==} + engines: {node: '>=18.*'} + hasBin: true + +snapshots: + + '@pnpm/exe.darwin-arm64@12.2.1': + optional: true + + '@pnpm/exe.darwin-x64@12.2.1': + optional: true + + '@pnpm/exe.linux-arm64-musl@12.2.1': + optional: true + + '@pnpm/exe.linux-arm64@12.2.1': + optional: true + + '@pnpm/exe.linux-x64-musl@12.2.1': + optional: true + + '@pnpm/exe.linux-x64@12.2.1': + optional: true + + '@pnpm/exe.win32-arm64@12.2.1': + optional: true + + '@pnpm/exe.win32-x64@12.2.1': + optional: true + + pnpm@12.2.1: + optionalDependencies: + '@pnpm/exe.darwin-arm64': 12.2.1 + '@pnpm/exe.darwin-x64': 12.2.1 + '@pnpm/exe.linux-arm64': 12.2.1 + '@pnpm/exe.linux-arm64-musl': 12.2.1 + '@pnpm/exe.linux-x64': 12.2.1 + '@pnpm/exe.linux-x64-musl': 12.2.1 + '@pnpm/exe.win32-arm64': 12.2.1 + '@pnpm/exe.win32-x64': 12.2.1 + +--- lockfileVersion: '9.0' settings: @@ -6,22 +107,15 @@ settings: excludeLinksFromLockfile: false overrides: - rolldown: ~1.2.6 vite: workspace:* debug: npm:obug@^1.0.2 packageExtensionsChecksum: sha256-TN34VxQ4aEf/0bmMCAf/tyq2fur66+GWTFoIOcaYREE= patchedDependencies: - chokidar@3.6.0: - hash: e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f - path: patches/chokidar@3.6.0.patch - dotenv-expand@13.0.0: - hash: 49330a663821151418e003e822a82a6a61d2f0f8a6e3cab00c1c94815a112889 - path: patches/dotenv-expand@13.0.0.patch - sirv@3.0.2: - hash: c07c56eb72faea34341d465cde2314e89db472106ed378181e3447893af6bf95 - path: patches/sirv@3.0.2.patch + chokidar@3.6.0: e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f + dotenv-expand@13.0.0: 49330a663821151418e003e822a82a6a61d2f0f8a6e3cab00c1c94815a112889 + sirv@3.0.2: c07c56eb72faea34341d465cde2314e89db472106ed378181e3447893af6bf95 importers: @@ -4671,12 +4765,22 @@ packages: '@volar/language-service@2.4.28': resolution: {integrity: sha512-Rh/wYCZJrI5vCwMk9xyw/Z+MsWxlJY1rmMZPsxUoJKfzIRjS/NF1NmnuEcrMbEVGja00aVpCsInJfixQTMdvLw==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true '@volar/source-map@2.4.28': resolution: {integrity: sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ==} '@volar/typescript@2.4.28': resolution: {integrity: sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true '@vue/compiler-core@3.4.38': resolution: {integrity: sha512-8IQOTCWnLFqfHzOGm9+P8OPSEDukgg3Huc92qSG49if/xI2SAwLHQO2qaPQbjCWPBcQoO1WYfXfTACUrWV3c5A==} @@ -7199,7 +7303,7 @@ packages: peerDependencies: '@typescript/native-preview': '*' '@volar/typescript': ~2.4.0 - rolldown: ~1.2.6 + rolldown: ^1.0.0 typescript: ^5.0.0 || ^6.0.0 || ~7.0.0 vue-tsc: ~3.2.0 || ~3.3.0 peerDependenciesMeta: @@ -7218,7 +7322,7 @@ packages: peerDependencies: '@typescript/native-preview': '*' '@volar/typescript': ~2.4.0 - rolldown: ~1.2.6 + rolldown: ^1.2.0 typescript: ^5.0.0 || ^6.0.0 || ~7.0.0 vue-tsc: ~3.2.0 || ~3.3.0 peerDependenciesMeta: @@ -10703,21 +10807,25 @@ snapshots: dependencies: '@volar/source-map': 2.4.28 - '@volar/language-service@2.4.28': + '@volar/language-service@2.4.28(typescript@6.0.3)': dependencies: '@volar/language-core': 2.4.28 vscode-languageserver-protocol: 3.18.2 vscode-languageserver-textdocument: 1.0.12 vscode-uri: 3.1.0 + optionalDependencies: + typescript: 6.0.3 '@volar/source-map@2.4.28': {} - '@volar/typescript@2.4.28': + '@volar/typescript@2.4.28(typescript@6.0.3)': dependencies: '@volar/language-core': 2.4.28 - '@volar/language-service': 2.4.28 + '@volar/language-service': 2.4.28(typescript@6.0.3) path-browserify: 1.0.1 vscode-uri: 3.1.0 + optionalDependencies: + typescript: 6.0.3 '@vue/compiler-core@3.4.38': dependencies: @@ -13285,7 +13393,7 @@ snapshots: yuku-codegen: 0.8.7 yuku-parser: 0.8.7 optionalDependencies: - '@volar/typescript': 2.4.28 + '@volar/typescript': 2.4.28(typescript@6.0.3) typescript: 6.0.3 vue-tsc: 3.3.11(typescript@6.0.3) transitivePeerDependencies: @@ -13301,7 +13409,7 @@ snapshots: yuku-codegen: 0.9.3 yuku-parser: 0.9.3 optionalDependencies: - '@volar/typescript': 2.4.28 + '@volar/typescript': 2.4.28(typescript@6.0.3) typescript: 6.0.3 vue-tsc: 3.3.11(typescript@6.0.3) transitivePeerDependencies: @@ -14202,7 +14310,7 @@ snapshots: vue-tsc@3.3.11(typescript@6.0.3): dependencies: - '@volar/typescript': 2.4.28 + '@volar/typescript': 2.4.28(typescript@6.0.3) '@vue/language-core': 3.3.11 typescript: 6.0.3 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 6e187c9af807df..40eb988dbf9c74 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -12,7 +12,6 @@ shellEmulator: true autoInstallPeers: false dedupeInjectedDeps: false overrides: - rolldown: $rolldown vite: 'workspace:*' debug: 'npm:obug@^1.0.2' patchedDependencies: @@ -47,13 +46,12 @@ allowBuilds: unrs-resolver: true workerd: true -minimumReleaseAge: 1440 minimumReleaseAgeExclude: - rolldown - '@rolldown/binding-*' -blockExoticSubdeps: true trustPolicy: no-downgrade trustPolicyExclude: + - '@vercel/detect-agent@1.2.5' # https://github.com/vercel/vercel/issues/17408 - chokidar@4.0.3 # https://github.com/paulmillr/chokidar/issues/1440 - semver@5.7.2 || 6.3.1 - tailwindcss@3.4.18