diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 4e09ca1dd13b0e..778fa0bd7df5e0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,5 +1,5 @@ -name: "\U0001F41E Bug report" -description: Report an issue with Vite +name: "\U0001F41E General Bug report" +description: Report an issue with `rolldown-vite` labels: [pending triage] type: Bug body: @@ -19,7 +19,7 @@ body: id: reproduction attributes: label: Reproduction - description: Please provide a link via [vite.new](https://vite.new/) or a link to a repo that can reproduce the problem you ran into. `npm create vite@latest` and `npm create vite-extra@latest` (for SSR or library repros) can be used as a starter template. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is required ([Why?](https://antfu.me/posts/why-reproductions-are-required)). If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "needs reproduction" label. If no reproduction is provided after 3 days, it will be auto-closed. + description: Please provide a link via [StackBlitz](https://stackblitz.com/fork/github/vitejs/rolldown-vite/tree/rolldown-vite/packages/create-vite/template-vanilla) or a link to a repo that can reproduce the problem you ran into. `npm create vite@latest` and `npm create vite-extra@latest` (for SSR or library repros) can be used as a starter template (don't forget to alias `vite` to `rolldown-vite`). A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is required ([Why?](https://antfu.me/posts/why-reproductions-are-required)). If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "needs reproduction" label. If no reproduction is provided after 3 days, it will be auto-closed. placeholder: Reproduction URL validations: required: true @@ -33,7 +33,7 @@ body: id: system-info attributes: label: System Info - description: Output of `npx envinfo --system --npmPackages '{vite,@vitejs/*,rollup}' --binaries --browsers` + description: Output of `npx envinfo --system --npmPackages '{vite,rolldown-vite,@vitejs/*,rollup,rolldown}' --binaries --browsers` render: shell placeholder: System, Binaries, Browsers validations: @@ -75,17 +75,15 @@ body: label: Validations description: Before submitting the issue, please make sure you do the following options: - - label: Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md) + - label: Follow our [Code of Conduct](https://github.com/vitejs/rolldown-vite/blob/main/CODE_OF_CONDUCT.md) required: true - - label: Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md). + - label: Read the [Contributing Guidelines](https://github.com/vitejs/rolldown-vite/blob/main/CONTRIBUTING.md). required: true - - label: Read the [docs](https://vite.dev/guide). + - label: Read the [docs](https://vite.dev/guide) and the [Rolldown-related guide](https://main.vite.dev/guide/rolldown.html). required: true - - label: Check that there isn't [already an issue](https://github.com/vitejs/vite/issues) that reports the same bug to avoid creating a duplicate. + - label: Check that there isn't [already an issue](https://github.com/vitejs/rolldown-vite/issues) that reports the same bug to avoid creating a duplicate. required: true - - label: Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to [vuejs/core](https://github.com/vuejs/core) instead. - required: true - - label: Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vite.dev/). + - label: Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/rolldown-vite/discussions) or join our [Discord Chat Server](https://chat.vite.dev/). required: true - label: The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index e36d5d53edcd7f..22db5717f32282 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,14 +1,11 @@ blank_issues_enabled: false contact_links: - - name: Vite Plugin React Issues - url: https://github.com/vitejs/vite-plugin-react/issues/new/choose - about: React related issues should be reported on the vite-plugin-react repository. - - name: Vite Plugin Vue Issues - url: https://github.com/vitejs/vite-plugin-vue/issues/new/choose - about: Vue related issues should be reported on the vite-plugin-vue repository. - - name: Discord Chat - url: https://chat.vite.dev - about: Ask questions and discuss with other Vite users in real time. + - name: Vite Discord + url: https://chat.vite.dev/ + about: Do you have questions around Vite? Then join the Discord to discuss them with other Vite users. + - name: Rolldown Discord + url: https://chat.rolldown.rs/ + about: Ask questions and discuss with other Rolldown users in real time. - name: Questions & Discussions - url: https://github.com/vitejs/vite/discussions + url: https://github.com/vitejs/rolldown-vite/discussions about: Use GitHub discussions for message-board style questions and discussions. diff --git a/.github/ISSUE_TEMPLATE/docs.yml b/.github/ISSUE_TEMPLATE/docs.yml deleted file mode 100644 index ef629b96596663..00000000000000 --- a/.github/ISSUE_TEMPLATE/docs.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: "\U0001F4DA Documentation" -description: Suggest a change or new page to be added to vite.dev -labels: [documentation] -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out this issue! - - type: checkboxes - id: documentation_is - attributes: - label: Documentation is - options: - - label: Missing - - label: Outdated - - label: Confusing - - label: Not sure? - - type: textarea - id: description - attributes: - label: Explain in Detail - description: A clear and concise description of your suggestion. If you intend to submit a PR for this issue, tell us in the description. Thanks! - placeholder: The description of ... page is not clear. I thought it meant ... but it wasn't. - validations: - required: true - - type: textarea - id: suggestion - attributes: - label: Your Suggestion for Changes - validations: - required: true - - type: input - id: reproduction - attributes: - label: Reproduction - description: If you have a reproduction, please provide a link via [vite.new](https://vite.new/) or a link to a repo that can reproduce the problem you ran into. `npm create vite@latest` and `npm create vite-extra@latest` (for SSR or library repros) can be used as a starter template. - placeholder: Reproduction URL - - type: textarea - id: reproduction-steps - attributes: - label: Steps to reproduce - description: Please provide any reproduction steps that may need to be described. E.g. if it happens only when running the dev or build script make sure it's clear which one to use. - placeholder: Run `npm install` followed by `npm run dev` diff --git a/.github/ISSUE_TEMPLATE/feature-regression.yml b/.github/ISSUE_TEMPLATE/feature-regression.yml new file mode 100644 index 00000000000000..36258724728547 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-regression.yml @@ -0,0 +1,105 @@ +name: "\U0001F4A5 Feature Regression" +description: Report a feature regression issue with `rolldown-vite` +labels: ["c: regression", pending triage] +type: Bug +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to report a feature regression. A regression is when a feature that works as expected when using `vite` no longer behaves correctly. + - type: textarea + id: regression-description + attributes: + label: Describe the regression + description: A clear and concise description of the regression. If you intend to submit a PR for this issue, let us know in the description. Thanks! + placeholder: The feature used to work like ... Now it behaves like ... + validations: + required: true + - type: input + id: reproduction + attributes: + label: Reproduction + description: Please provide a link via [StackBlitz](https://stackblitz.com/fork/github/vitejs/rolldown-vite/tree/rolldown-vite/packages/create-vite/template-vanilla) or a link to a repo that can reproduce the regression issue. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is required ([Why?](https://antfu.me/posts/why-reproductions-are-required)). If no reproduction is provided after 3 days, the issue may be auto-closed. + placeholder: Reproduction URL + validations: + required: true + - type: textarea + id: expected-behavior + attributes: + label: Expected Behavior + description: Describe what you expected to happen when using the feature. + placeholder: I expected the feature to ... + validations: + required: true + - type: textarea + id: actual-behavior + attributes: + label: Actual Behavior + description: Describe what actually happens when using the feature. + placeholder: The feature currently behaves like ... + validations: + required: true + - type: textarea + id: reproduction-steps + attributes: + label: Steps to Reproduce + description: Please provide any reproduction steps that may need to be described. E.g., if it happens only when running the dev or build script, make sure it's clear which one to use. + placeholder: Run `npm install` followed by `npm run dev` + - type: textarea + id: system-info + attributes: + label: System Info + description: Output of `npx envinfo --system --npmPackages '{vite,rolldown-vite,@vitejs/*,rollup,rolldown}' --binaries --browsers` + render: shell + placeholder: System, Binaries, Browsers + validations: + required: true + - type: dropdown + id: package-manager + attributes: + label: Used Package Manager + description: Select the used package manager + options: + - npm + - yarn + - pnpm + - bun + validations: + required: true + - type: textarea + id: logs + attributes: + label: Logs + description: | + Optional if provided reproduction. Please try not to insert an image but copy paste the log text. + + 1. Run `vite` or `vite build` with the `--debug` flag. + 2. Provide the error log here in the format below. + + ```` +
+ Click to expand! + + ```shell + // paste the log text here + ``` +
+ ```` + - type: checkboxes + id: checkboxes + attributes: + label: Validations + description: Before submitting the issue, please make sure you do the following + options: + - label: Follow our [Code of Conduct](https://github.com/vitejs/rolldown-vite/blob/main/CODE_OF_CONDUCT.md) + required: true + - label: Read the [Contributing Guidelines](https://github.com/vitejs/rolldown-vite/blob/main/CONTRIBUTING.md). + required: true + - label: Read the [docs](https://vite.dev/guide) and the [Rolldown-related guide](https://main.vite.dev/guide/rolldown.html). + required: true + - label: Check that there isn't [already an issue](https://github.com/vitejs/rolldown-vite/issues) that reports the same regression to avoid creating a duplicate. + required: true + - label: Check that this is a concrete regression. For Q&A open a [GitHub Discussion](https://github.com/vitejs/rolldown-vite/discussions) or join our [Discord Chat Server](https://chat.vite.dev/). + required: true + - label: The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the regression. + required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index 0563374253b6f3..00000000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: "\U0001F680 New feature proposal" -description: Propose a new feature to be added to Vite -labels: ["pending triage"] -type: Feature -body: - - type: markdown - attributes: - value: | - Thanks for your interest in the project and taking the time to fill out this feature report! - - type: textarea - id: feature-description - attributes: - label: Description - description: "Clear and concise description of the problem. Please make the reason and usecases as detailed as possible. If you intend to submit a PR for this issue, tell us in the description. Thanks!" - placeholder: As a developer using Vite I want [goal / wish] so that [benefit]. - validations: - required: true - - type: textarea - id: suggested-solution - attributes: - label: Suggested solution - description: "In module [xy] we could provide following implementation..." - validations: - required: true - - type: textarea - id: alternative - attributes: - label: Alternative - description: Clear and concise description of any alternative solutions or features you've considered. - - type: textarea - id: additional-context - attributes: - label: Additional context - description: Any other context or screenshots about the feature request here. - - type: checkboxes - id: checkboxes - attributes: - label: Validations - description: Before submitting the issue, please make sure you do the following - options: - - label: Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md) - required: true - - label: Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md). - required: true - - label: Read the [docs](https://vite.dev/guide). - required: true - - label: Check that there isn't already an issue that request the same feature to avoid creating a duplicate. - required: true diff --git a/.github/ISSUE_TEMPLATE/performance.yml b/.github/ISSUE_TEMPLATE/performance.yml new file mode 100644 index 00000000000000..dfc279adb10b37 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/performance.yml @@ -0,0 +1,97 @@ +name: "\U0001F3C3 Performance Degradation" +description: Report a performance issue with `rolldown-vite` +labels: ["c: performance", pending triage] +type: Bug +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to report a performance issue, such as a slow build or a slow dev server compared to using the main `vite` package. + - type: textarea + id: performance-description + attributes: + label: Describe the performance issue + description: A clear and concise description of the performance issue. If you intend to submit a PR for this issue, let us know in the description. Thanks! + placeholder: I am doing ... What I expect is ... What actually happening is ... + validations: + required: true + - type: input + id: reproduction + attributes: + label: Reproduction + description: Please provide a link via [StackBlitz](https://stackblitz.com/fork/github/vitejs/rolldown-vite/tree/rolldown-vite/packages/create-vite/template-vanilla) or a link to a repo that can reproduce the performance issue. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is required ([Why?](https://antfu.me/posts/why-reproductions-are-required)). If no reproduction is provided after 3 days, the issue may be auto-closed. + placeholder: Reproduction URL + validations: + required: true + - type: textarea + id: performance-metrics + attributes: + label: Performance Metrics + description: Provide any relevant performance metrics (e.g., build time, memory usage, CPU usage). Include before/after comparisons if applicable. + placeholder: "Build time with `rolldown-vite`: X seconds, build time with plain `vite`: X seconds, etc." + validations: + required: true + - type: textarea + id: reproduction-steps + attributes: + label: Steps to reproduce + description: Please provide any reproduction steps that may need to be described. E.g., if it happens only when running the dev or build script, make sure it's clear which one to use. + placeholder: Run `npm install` followed by `npm run dev` + - type: textarea + id: system-info + attributes: + label: System Info + description: Output of `npx envinfo --system --npmPackages '{vite,rolldown-vite,@vitejs/*,rollup,rolldown}' --binaries --browsers` + render: shell + placeholder: System, Binaries, Browsers + validations: + required: true + - type: dropdown + id: package-manager + attributes: + label: Used Package Manager + description: Select the used package manager + options: + - npm + - yarn + - pnpm + - bun + validations: + required: true + - type: textarea + id: logs + attributes: + label: Logs + description: | + Optional if provided reproduction. Please try not to insert an image but copy paste the log text. + + 1. Run `vite` or `vite build` with the `--debug` flag. + 2. Provide the error log here in the format below. + + ```` +
+ Click to expand! + + ```shell + // paste the log text here + ``` +
+ ```` + - type: checkboxes + id: checkboxes + attributes: + label: Validations + description: Before submitting the issue, please make sure you do the following + options: + - label: Follow our [Code of Conduct](https://github.com/vitejs/rolldown-vite/blob/main/CODE_OF_CONDUCT.md) + required: true + - label: Read the [Contributing Guidelines](https://github.com/vitejs/rolldown-vite/blob/main/CONTRIBUTING.md). + required: true + - label: Read the [docs](https://vite.dev/guide) and the [Rolldown-related guide](https://main.vite.dev/guide/rolldown.html). + required: true + - label: Check that there isn't [already an issue](https://github.com/vitejs/rolldown-vite/issues) that reports the same bug to avoid creating a duplicate. + required: true + - label: Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/rolldown-vite/discussions) or join our [Discord Chat Server](https://chat.vite.dev/). + required: true + - label: The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. + required: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa23a3598ff9ce..2033c036c12707 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,6 +143,78 @@ jobs: steps: - run: echo "Build & Test Failed" + test-js-plugins: + needs: changed + if: needs.changed.outputs.should_skip != 'true' + timeout-minutes: 20 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + node_version: [22] + fail-fast: false + + name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }} (js plugins)" + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node_version }} + cache: "pnpm" + + - name: Install deps + run: pnpm install + + # Install playwright's binary under custom directory to cache + - name: (non-windows) Set Playwright path and Get playwright version + if: runner.os != 'Windows' + run: | + echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV + PLAYWRIGHT_VERSION="$(pnpm ls --depth 0 --json -w playwright-chromium | jq --raw-output '.[0].devDependencies["playwright-chromium"].version')" + echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV + - name: (windows) Set Playwright path and Get playwright version + if: runner.os == 'Windows' + run: | + echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV + $env:PLAYWRIGHT_VERSION="$(pnpm ls --depth 0 --json -w playwright-chromium | jq --raw-output '.[0].devDependencies["playwright-chromium"].version')" + echo "PLAYWRIGHT_VERSION=$env:PLAYWRIGHT_VERSION" >> $env:GITHUB_ENV + + - name: Cache Playwright's binary + uses: actions/cache@v4 + with: + key: ${{ runner.os }}-playwright-bin-v1-${{ env.PLAYWRIGHT_VERSION }} + path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} + restore-keys: | + ${{ runner.os }}-playwright-bin-v1- + + - name: Install Playwright + # does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved + run: pnpm playwright install chromium + + - name: Build + run: pnpm run build + + - name: Test unit + run: pnpm run test-unit + env: + _VITE_TEST_JS_PLUGIN: 1 + + - name: Test serve + run: pnpm run test-serve + env: + _VITE_TEST_JS_PLUGIN: 1 + + - name: Test build + run: pnpm run test-build + env: + _VITE_TEST_JS_PLUGIN: 1 + lint: timeout-minutes: 10 runs-on: ubuntu-latest diff --git a/.github/workflows/issue-close-require.yml b/.github/workflows/issue-close-require.yml index d79dc859dbfe0e..8215e8320609dc 100644 --- a/.github/workflows/issue-close-require.yml +++ b/.github/workflows/issue-close-require.yml @@ -6,7 +6,7 @@ on: jobs: close-issues: - if: github.repository == 'vitejs/vite' + if: github.repository == 'vitejs/rolldown-vite' runs-on: ubuntu-latest permissions: issues: write # for actions-cool/issues-helper to update issues diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index 31065607c70cf5..06b1c9fba63bf4 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -6,7 +6,7 @@ on: jobs: reply-labeled: - if: github.repository == 'vitejs/vite' + if: github.repository == 'vitejs/rolldown-vite' runs-on: ubuntu-latest permissions: issues: write # for actions-cool/issues-helper to update issues @@ -38,5 +38,5 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} body: | - Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository or [StackBlitz](https://vite.new). Issues marked with `needs reproduction` will be closed if they have no activity within 3 days. + Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository or [StackBlitz](https://stackblitz.com/fork/github/vitejs/rolldown-vite/tree/rolldown-vite/packages/create-vite/template-vanilla). Issues marked with `needs reproduction` will be closed if they have no activity within 3 days. labels: "pending triage" diff --git a/.github/workflows/preview-release.yml b/.github/workflows/preview-release.yml index 6e233d4930e9f7..0b18399c7469bc 100644 --- a/.github/workflows/preview-release.yml +++ b/.github/workflows/preview-release.yml @@ -10,14 +10,14 @@ permissions: on: push: branches: - - main + - rolldown-vite pull_request: types: [opened, synchronize, labeled] jobs: preview: if: > - github.repository == 'vitejs/vite' && + github.repository == 'vitejs/rolldown-vite' && (github.event_name == 'push' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'trigger: preview'))) runs-on: ubuntu-latest @@ -44,8 +44,12 @@ jobs: env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" - - name: Build + - name: Build Vite core working-directory: ./packages/vite run: pnpm build - - run: pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm ./packages/vite + - name: Build plugin-legacy + working-directory: ./packages/plugin-legacy + run: pnpm build + + - run: pnpm dlx pkg-pr-new@0.0 publish --pnpm './packages/vite' './packages/plugin-legacy' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a7b091bfac0a5f..b434a4a184c342 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ on: jobs: publish: # prevents this action from running on forks - if: github.repository == 'vitejs/vite' + if: github.repository == 'vitejs/rolldown-vite' runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index bf6ab65aff7ea7..0a60db247f56d9 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -11,7 +11,7 @@ on: jobs: release: - if: github.repository == 'vitejs/vite' + if: github.repository == 'vitejs/rolldown-vite' runs-on: ubuntu-latest permissions: contents: write # for yyx990803/release-tag to create a release tag @@ -47,4 +47,4 @@ jobs: with: tag_name: ${{ github.ref }} body: | - Please refer to [CHANGELOG.md](https://github.com/vitejs/vite/blob/${{ github.ref_name }}/packages/${{ steps.tag.outputs.pkgName }}/CHANGELOG.md) for details. + Please refer to [CHANGELOG.md](https://github.com/vitejs/rolldown-vite/blob/${{ github.ref_name }}/packages/${{ steps.tag.outputs.pkgName }}/CHANGELOG.md) for details. diff --git a/.github/workflows/semantic-pull-request.yml b/.github/workflows/semantic-pull-request.yml index 5e629577aa8739..8a05b82587577b 100644 --- a/.github/workflows/semantic-pull-request.yml +++ b/.github/workflows/semantic-pull-request.yml @@ -9,7 +9,7 @@ on: jobs: main: - if: github.repository == 'vitejs/vite' + if: github.repository == 'vitejs/rolldown-vite' runs-on: ubuntu-latest name: Semantic Pull Request permissions: diff --git a/README.md b/README.md index 1b673c2592ed68..a2d972df4d6b52 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,27 @@

- + Vite logo + Rolldown logo


- npm package - node compatibility - build status + npm package + node compatibility + build status discord chat


-# Vite ⚡ +# rolldown-vite ⚡ -> Next Generation Frontend Tooling +> Vite with Rolldown as bundler. Temporary package. -- 💡 Instant Server Start -- ⚡️ Lightning Fast HMR -- 🛠️ Rich Features -- 📦 Optimized Build -- 🔩 Universal Plugin Interface -- 🔑 Fully Typed APIs +`rolldown-vite` is a fork of Vite that uses [Rolldown](https://github.com/rolldown-rs/rolldown) instead of Rollup & esbuild. Rolldown is a Rust-based JavaScript bundler designed for maximum performance. -Vite (French word for "quick", pronounced [`/vit/`](https://cdn.jsdelivr.net/gh/vitejs/vite@main/docs/public/vite.mp3), like "veet") is a new breed of frontend build tooling that significantly improves the frontend development experience. It consists of two major parts: +It can be used as a drop-in replacement to test out Rolldown with Vite. Eventually, this package is not needed anymore as all changes will be merged into the main Vite repository. -- A dev server that serves your source files over [native ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), with [rich built-in features](https://vite.dev/guide/features.html) and astonishingly fast [Hot Module Replacement (HMR)](https://vite.dev/guide/features.html#hot-module-replacement). - -- A [build command](https://vite.dev/guide/build.html) that bundles your code with [Rollup](https://rollupjs.org), pre-configured to output highly optimized static assets for production. - -In addition, Vite is highly extensible via its [Plugin API](https://vite.dev/guide/api-plugin.html) and [JavaScript API](https://vite.dev/guide/api-javascript.html) with full typing support. - -[Read the Docs to Learn More](https://vite.dev). - -## Packages - -| Package | Version (click for changelogs) | -| ----------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------- | -| [vite](packages/vite) | [![vite version](https://img.shields.io/npm/v/vite.svg?label=%20)](packages/vite/CHANGELOG.md) | -| [@vitejs/plugin-legacy](packages/plugin-legacy) | [![plugin-legacy version](https://img.shields.io/npm/v/@vitejs/plugin-legacy.svg?label=%20)](packages/plugin-legacy/CHANGELOG.md) | -| [create-vite](packages/create-vite) | [![create-vite version](https://img.shields.io/npm/v/create-vite.svg?label=%20)](packages/create-vite/CHANGELOG.md) | - -## Contribution - -See [Contributing Guide](CONTRIBUTING.md). +[Read the Docs to Learn More](https://vite.dev/guide/rolldown.html). ## License diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 0b73017a9ad0a1..2190c3874bbec6 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -301,10 +301,6 @@ export default defineConfig({ text: 'Performance', link: '/guide/performance', }, - { - text: 'Rolldown', - link: '/guide/rolldown', - }, { text: `Migration from v${viteMajorVersion - 1}`, link: '/guide/migration', diff --git a/docs/config/build-options.md b/docs/config/build-options.md index 12ebd75bc976dc..4d620a91b2ede0 100644 --- a/docs/config/build-options.md +++ b/docs/config/build-options.md @@ -12,9 +12,9 @@ Browser compatibility target for the final bundle. The default value is a Vite s Another special value is `'esnext'` - which assumes native dynamic imports support and will only perform minimal transpiling. -The transform is performed with esbuild and the value should be a valid [esbuild target option](https://esbuild.github.io/api/#target). Custom targets can either be an ES version (e.g. `es2015`), a browser with version (e.g. `chrome58`), or an array of multiple target strings. +The transform is performed with Oxc Transformer and the value should be a valid [Oxc Transformer target option](https://oxc.rs/docs/guide/usage/transformer/lowering#target). Custom targets can either be an ES version (e.g. `es2015`), a browser with version (e.g. `chrome58`), or an array of multiple target strings. -Note the build will fail if the code contains features that cannot be safely transpiled by esbuild. See [esbuild docs](https://esbuild.github.io/content-types/#javascript) for more details. +Note the build will output a warning if the code contains features that cannot be safely transpiled by Oxc. See [Oxc docs](https://oxc.rs/docs/guide/usage/transformer/lowering#warnings) for more details. ## build.modulePreload @@ -129,10 +129,16 @@ In this case, you need to set `build.cssTarget` to `chrome61` to prevent vite fr ## build.cssMinify -- **Type:** `boolean | 'esbuild' | 'lightningcss'` -- **Default:** the same as [`build.minify`](#build-minify) for client, `'esbuild'` for SSR +- **Type:** `boolean | 'lightningcss' | 'esbuild'` +- **Default:** the same as [`build.minify`](#build-minify) for client, `'lightningcss'` for SSR -This option allows users to override CSS minification specifically instead of defaulting to `build.minify`, so you can configure minification for JS and CSS separately. Vite uses `esbuild` by default to minify CSS. Set the option to `'lightningcss'` to use [Lightning CSS](https://lightningcss.dev/minification.html) instead. If selected, it can be configured using [`css.lightningcss`](./shared-options.md#css-lightningcss). +This option allows users to override CSS minification specifically instead of defaulting to `build.minify`, so you can configure minification for JS and CSS separately. Vite uses [Lightning CSS](https://lightningcss.dev/minification.html) by default to minify CSS. It can be configured using [`css.lightningcss`](./shared-options.md#css-lightningcss). Set the option to `'esbuild'` to use esbuild instead. + +esbuild must be installed when it is set to `'esbuild'`. + +```sh +npm add -D esbuild +``` ## build.sourcemap @@ -141,17 +147,20 @@ This option allows users to override CSS minification specifically instead of de Generate production source maps. If `true`, a separate sourcemap file will be created. If `'inline'`, the sourcemap will be appended to the resulting output file as a data URI. `'hidden'` works like `true` except that the corresponding sourcemap comments in the bundled files are suppressed. -## build.rollupOptions +## build.rolldownOptions -- **Type:** [`RollupOptions`](https://rollupjs.org/configuration-options/) +- **Type:** [`RolldownOptions`](https://rollupjs.org/configuration-options/) -Directly customize the underlying Rollup bundle. This is the same as options that can be exported from a Rollup config file and will be merged with Vite's internal Rollup options. See [Rollup options docs](https://rollupjs.org/configuration-options/) for more details. + -## build.commonjsOptions +Directly customize the underlying Rolldown bundle. This is the same as options that can be exported from a Rolldown config file and will be merged with Vite's internal Rolldown options. See [Rolldown options docs](https://rollupjs.org/configuration-options/) for more details. -- **Type:** [`RollupCommonJSOptions`](https://github.com/rollup/plugins/tree/master/packages/commonjs#options) +## build.rollupOptions + +- **Type:** `RolldownOptions` +- **Deprecated** -Options to pass on to [@rollup/plugin-commonjs](https://github.com/rollup/plugins/tree/master/packages/commonjs). +This option is an alias of `build.rolldownOptions` option. Use `build.rolldownOptions` option instead. ## build.dynamicImportVarsOptions @@ -160,6 +169,8 @@ Options to pass on to [@rollup/plugin-commonjs](https://github.com/rollup/plugin Options to pass on to [@rollup/plugin-dynamic-import-vars](https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars). + + ## build.lib - **Type:** `{ entry: string | string[] | { [entryAlias: string]: string }, name?: string, formats?: ('es' | 'cjs' | 'umd' | 'iife')[], fileName?: string | ((format: ModuleFormat, entryName: string) => string), cssFileName?: string }` @@ -256,16 +267,19 @@ During the SSR build, static assets aren't emitted as it is assumed they would b ## build.minify -- **Type:** `boolean | 'terser' | 'esbuild'` -- **Default:** `'esbuild'` for client build, `false` for SSR build +- **Type:** `boolean | 'oxc' | 'terser' | 'esbuild'` +- **Default:** `'oxc'` for client build, `false` for SSR build -Set to `false` to disable minification, or specify the minifier to use. The default is [esbuild](https://github.com/evanw/esbuild) which is 20 ~ 40x faster than terser and only 1 ~ 2% worse compression. [Benchmarks](https://github.com/privatenumber/minification-benchmarks) +Set to `false` to disable minification, or specify the minifier to use. The default is [Oxc Minifier](https://oxc.rs/docs/guide/usage/minifier) which is 30 ~ 90x faster than terser and only 0.5 ~ 2% worse compression. [Benchmarks](https://github.com/privatenumber/minification-benchmarks) + +`build.minify: 'esbuild'` is deprecated and will be removed in the future. Note the `build.minify` option does not minify whitespaces when using the `'es'` format in lib mode, as it removes pure annotations and breaks tree-shaking. -Terser must be installed when it is set to `'terser'`. +esbuild or Terser must be installed when it is set to `'esbuild'` or `'terser'` respectively. ```sh +npm add -D esbuild npm add -D terser ``` @@ -314,6 +328,8 @@ Limit for chunk size warnings (in kB). It is compared against the uncompressed c ## build.watch + + - **Type:** [`WatcherOptions`](https://rollupjs.org/configuration-options/#watch)`| null` - **Default:** `null` diff --git a/docs/config/dep-optimization-options.md b/docs/config/dep-optimization-options.md index deddba9e57bf5b..b22795f06c3c53 100644 --- a/docs/config/dep-optimization-options.md +++ b/docs/config/dep-optimization-options.md @@ -51,6 +51,23 @@ export default defineConfig({ }) ``` +## optimizeDeps.rolldownOptions + +- **Type:** [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)`<``RolldownOptions`, `'input' | 'logLevel' | 'output'> & { + output?: [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)`<` + `RolldownOutputOptions`, + `'format' | 'sourcemap' | 'dir' | 'banner'>` +`}` + + + + +Options to pass to Rolldown during the dep scanning and optimization. + +Certain options are omitted since changing them would not be compatible with Vite's dep optimization. + +- `plugins` are merged with Vite's dep plugin + ## optimizeDeps.esbuildOptions - **Type:** [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)`<`[`EsbuildBuildOptions`](https://esbuild.github.io/api/#general-options)`, @@ -64,13 +81,9 @@ export default defineConfig({ | 'outbase' | 'outExtension' | 'metafile'>` +- **Deprecated** -Options to pass to esbuild during the dep scanning and optimization. - -Certain options are omitted since changing them would not be compatible with Vite's dep optimization. - -- `external` is also omitted, use Vite's `optimizeDeps.exclude` option -- `plugins` are merged with Vite's dep plugin +This option is converted to `optimizeDeps.rolldownOptions` internally. Use `optimizeDeps.rolldownOptions` instead. ## optimizeDeps.force diff --git a/docs/config/index.md b/docs/config/index.md index 71f7bdbd04f04f..1732131654b683 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -23,7 +23,7 @@ vite --config my-config.js ``` ::: tip CONFIG LOADING -By default, Vite uses `esbuild` to bundle the config into a temporary file and load it. This may cause issues when importing TypeScript files in a monorepo. If you encounter any issues with this approach, you can specify `--configLoader runner` to use the [module runner](/guide/api-environment-runtimes.html#modulerunner) instead, which will not create a temporary config and will transform any files on the fly. Note that module runner doesn't support CJS in config files, but external CJS packages should work as usual. +By default, Vite uses [Rolldown](https://rolldown.rs/) to bundle the config into a temporary file and load it. This may cause issues when importing TypeScript files in a monorepo. If you encounter any issues with this approach, you can specify `--configLoader runner` to use the [module runner](/guide/api-environment-runtimes.html#modulerunner) instead, which will not create a temporary config and will transform any files on the fly. Note that module runner doesn't support CJS in config files, but external CJS packages should work as usual. Alternatively, if you're using an environment that supports TypeScript (e.g. `node --experimental-strip-types`), or if you're only writing plain JavaScript, you can specify `--configLoader native` to use the environment's native runtime to load the config file. Note that updates to modules imported by the config file are not detected and hence would not auto-restart the Vite server. ::: diff --git a/docs/config/shared-options.md b/docs/config/shared-options.md index b2da75237150e8..23e0808fc3b62c 100644 --- a/docs/config/shared-options.md +++ b/docs/config/shared-options.md @@ -40,7 +40,7 @@ See [Env Variables and Modes](/guide/env-and-mode) for more details. Define global constant replacements. Entries will be defined as globals during dev and statically replaced during build. -Vite uses [esbuild defines](https://esbuild.github.io/api/#define) to perform replacements, so value expressions must be a string that contains a JSON-serializable value (null, boolean, number, string, array, or object) or a single identifier. For non-string values, Vite will automatically convert it to a string with `JSON.stringify`. +Vite uses [Oxc's define feature](https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define) to perform replacements, so value expressions must be a string that contains a JSON-serializable value (null, boolean, number, string, array, or object) or a single identifier. For non-string values, Vite will automatically convert it to a string with `JSON.stringify`. **Example:** @@ -96,6 +96,8 @@ Directory to save cache files. Files in this directory are pre-bundled deps or s Will be passed to `@rollup/plugin-alias` as its [entries option](https://github.com/rollup/plugins/tree/master/packages/alias#entries). Can either be an object, or an array of `{ find, replacement, customResolver }` pairs. + + When aliasing to file system paths, always use absolute paths. Relative alias values will be used as-is and will not be resolved into file system paths. More advanced custom resolution can be achieved through [plugins](/guide/api-plugin). @@ -353,36 +355,44 @@ If set to `true`, imported JSON will be transformed into `export default JSON.pa If set to `'auto'`, the data will be stringified only if [the data is bigger than 10kB](https://v8.dev/blog/cost-of-javascript-2019#json:~:text=A%20good%20rule%20of%20thumb%20is%20to%20apply%20this%20technique%20for%20objects%20of%2010%20kB%20or%20larger). -## esbuild +## oxc -- **Type:** `ESBuildOptions | false` +- **Type:** `OxcOptions | false` -`ESBuildOptions` extends [esbuild's own transform options](https://esbuild.github.io/api/#transform). The most common use case is customizing JSX: +`OxcOptions` extends [Oxc Transformer's options](https://oxc.rs/docs/guide/usage/transformer). The most common use case is customizing JSX: ```js export default defineConfig({ - esbuild: { - jsxFactory: 'h', - jsxFragment: 'Fragment', + oxc: { + jsx: { + runtime: 'classic', + pragma: 'h', + pragmaFrag: 'Fragment', + }, }, }) ``` -By default, esbuild is applied to `ts`, `jsx` and `tsx` files. You can customize this with `esbuild.include` and `esbuild.exclude`, which can be a regex, a [picomatch](https://github.com/micromatch/picomatch#globbing-features) pattern, or an array of either. +By default, transformation by Oxc is applied to `ts`, `jsx` and `tsx` files. You can customize this with `oxc.include` and `oxc.exclude`, which can be a regex, a [picomatch](https://github.com/micromatch/picomatch#globbing-features) pattern, or an array of either. -In addition, you can also use `esbuild.jsxInject` to automatically inject JSX helper imports for every file transformed by esbuild: +In addition, you can also use `oxc.jsxInject` to automatically inject JSX helper imports for every file transformed by Oxc: ```js export default defineConfig({ - esbuild: { + oxc: { jsxInject: `import React from 'react'`, }, }) ``` -When [`build.minify`](./build-options.md#build-minify) is `true`, all minify optimizations are applied by default. To disable [certain aspects](https://esbuild.github.io/api/#minify) of it, set any of `esbuild.minifyIdentifiers`, `esbuild.minifySyntax`, or `esbuild.minifyWhitespace` options to `false`. Note the `esbuild.minify` option can't be used to override `build.minify`. +Set to `false` to disable transformation by Oxc. + +## esbuild + +- **Type:** `ESBuildOptions | false` +- **Deprecated** -Set to `false` to disable esbuild transforms. +This option is converted to `oxc` option internally. Use `oxc` option instead. ## assetsInclude diff --git a/docs/config/worker-options.md b/docs/config/worker-options.md index 91edfe173a2e60..dc257c2b7913e3 100644 --- a/docs/config/worker-options.md +++ b/docs/config/worker-options.md @@ -18,6 +18,15 @@ The function should return new plugin instances as they are used in parallel rol ## worker.rollupOptions -- **Type:** [`RollupOptions`](https://rollupjs.org/configuration-options/) + + +- **Type:** [`RolldownOptions`](https://rollupjs.org/configuration-options/) Rollup options to build worker bundle. + +## worker.rollupOptions + +- **Type:** `RolldownOptions` +- **Deprecated** + +This option is an alias of `worker.rolldownOptions` option. Use `build.rolldownOptions` option instead. diff --git a/docs/guide/api-javascript.md b/docs/guide/api-javascript.md index 3816a30727c4cb..a3a87f9e3dd26f 100644 --- a/docs/guide/api-javascript.md +++ b/docs/guide/api-javascript.md @@ -389,6 +389,21 @@ function normalizePath(id: string): string Normalizes a path to interoperate between Vite plugins. +## `transformWithOxc` + +**Type Signature:** + +```ts +async function transformWithOxc( + code: string, + filename: string, + options?: OxcTransformOptions, + inMap?: object, +): Promise & { warnings: string[] }> +``` + +Transform JavaScript or TypeScript with [Oxc Transformer](https://oxc.rs/docs/guide/usage/transformer). Useful for plugins that prefer matching Vite's internal Oxc Transformer transform. + ## `transformWithEsbuild` **Type Signature:** @@ -402,6 +417,8 @@ async function transformWithEsbuild( ): Promise ``` +**Deprecated:** Use `transformWithOxc` instead. + Transform JavaScript or TypeScript with esbuild. Useful for plugins that prefer matching Vite's internal esbuild transform. ## `loadConfigFromFile` diff --git a/docs/guide/api-plugin.md b/docs/guide/api-plugin.md index d6f797034cd556..e3715749188854 100644 --- a/docs/guide/api-plugin.md +++ b/docs/guide/api-plugin.md @@ -4,6 +4,8 @@ Vite plugins extends Rollup's well-designed plugin interface with a few extra Vi **It is recommended to go through [Rollup's plugin documentation](https://rollupjs.org/plugin-development/) first before reading the sections below.** + + ## Authoring a Plugin Vite strives to offer established patterns out of the box, so before creating a new plugin make sure that you check the [Features guide](/guide/features) to see if your need is covered. Also review available community plugins, both in the form of a [compatible Rollup plugin](https://github.com/rollup/awesome) and [Vite Specific plugins](https://github.com/vitejs/awesome-vite#plugins) diff --git a/docs/guide/build.md b/docs/guide/build.md index 03fbf6494c0fef..a71ee013680613 100644 --- a/docs/guide/build.md +++ b/docs/guide/build.md @@ -50,23 +50,25 @@ If you don't know the base path in advance, you may set a relative base path wit ## Customizing the Build -The build can be customized via various [build config options](/config/build-options.md). Specifically, you can directly adjust the underlying [Rollup options](https://rollupjs.org/configuration-options/) via `build.rollupOptions`: +The build can be customized via various [build config options](/config/build-options.md). Specifically, you can directly adjust the underlying [Rolldown options](https://rollupjs.org/configuration-options/) via `build.rolldownOptions`: + + ```js [vite.config.js] export default defineConfig({ build: { - rollupOptions: { + rolldownOptions: { // https://rollupjs.org/configuration-options/ }, }, }) ``` -For example, you can specify multiple Rollup outputs with plugins that are only applied during build. +For example, you can specify multiple Rolldown outputs with plugins that are only applied during build. ## Chunking Strategy -You can configure how chunks are split using `build.rollupOptions.output.manualChunks` (see [Rollup docs](https://rollupjs.org/configuration-options/#output-manualchunks)). If you use a framework, refer to their documentation for configuring how chunks are split. +You can configure how chunks are split using `build.rolldownOptions.output.advancedChunks` (see [Rolldown docs](https://rolldown.rs/in-depth/advanced-chunks)). If you use a framework, refer to their documentation for configuring how chunks are split. ## Load Error Handling @@ -84,6 +86,8 @@ When a new deployment occurs, the hosting service may delete the assets from pre You can enable rollup watcher with `vite build --watch`. Or, you can directly adjust the underlying [`WatcherOptions`](https://rollupjs.org/configuration-options/#watch) via `build.watch`: + + ```js [vite.config.js] export default defineConfig({ build: { @@ -123,7 +127,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url)) export default defineConfig({ build: { - rollupOptions: { + rolldownOptions: { input: { main: resolve(__dirname, 'index.html'), nested: resolve(__dirname, 'nested/index.html'), @@ -135,7 +139,7 @@ export default defineConfig({ If you specify a different root, remember that `__dirname` will still be the folder of your vite.config.js file when resolving the input paths. Therefore, you will need to add your `root` entry to the arguments for `resolve`. -Note that for HTML files, Vite ignores the name given to the entry in the `rollupOptions.input` object and instead respects the resolved id of the file when generating the HTML asset in the dist folder. This ensures a consistent structure with the way the dev server works. +Note that for HTML files, Vite ignores the name given to the entry in the `rolldownOptions.input` object and instead respects the resolved id of the file when generating the HTML asset in the dist folder. This ensures a consistent structure with the way the dev server works. ## Library Mode @@ -160,7 +164,7 @@ export default defineConfig({ // the proper extensions will be added fileName: 'my-lib', }, - rollupOptions: { + rolldownOptions: { // make sure to externalize deps that shouldn't be bundled // into your library external: ['vue'], @@ -306,7 +310,7 @@ In library mode, all [`import.meta.env.*`](./env-and-mode.md) usage are statical ::: ::: warning Advanced Usage -Library mode includes a simple and opinionated configuration for browser-oriented and JS framework libraries. If you are building non-browser libraries, or require advanced build flows, you can use [Rollup](https://rollupjs.org) or [esbuild](https://esbuild.github.io) directly. +Library mode includes a simple and opinionated configuration for browser-oriented and JS framework libraries. If you are building non-browser libraries, or require advanced build flows, you can use [tsdown](https://tsdown.dev/) or [Rolldown](https://rolldown.rs/) directly. ::: ## Advanced Base Options diff --git a/docs/guide/cli.md b/docs/guide/cli.md index a65b672fb4050e..7b6a2eefc6b7a3 100644 --- a/docs/guide/cli.md +++ b/docs/guide/cli.md @@ -14,25 +14,25 @@ vite [root] #### Options -| Options | | -| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `--host [host]` | Specify hostname (`string`) | -| `--port ` | Specify port (`number`) | -| `--open [path]` | Open browser on startup (`boolean \| string`) | -| `--cors` | Enable CORS (`boolean`) | -| `--strictPort` | Exit if specified port is already in use (`boolean`) | -| `--force` | Force the optimizer to ignore the cache and re-bundle (`boolean`) | -| `-c, --config ` | Use specified config file (`string`) | -| `--base ` | Public base path (default: `/`) (`string`) | -| `-l, --logLevel ` | info \| warn \| error \| silent (`string`) | -| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) | -| `--configLoader ` | Use `bundle` to bundle the config with esbuild, or `runner` (experimental) to process it on the fly, or `native` (experimental) to load using the native runtime (default: `bundle`) | -| `--profile` | Start built-in Node.js inspector (check [Performance bottlenecks](/guide/troubleshooting#performance-bottlenecks)) | -| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) | -| `-f, --filter ` | Filter debug logs (`string`) | -| `-m, --mode ` | Set env mode (`string`) | -| `-h, --help` | Display available CLI options | -| `-v, --version` | Display version number | +| Options | | +| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--host [host]` | Specify hostname (`string`) | +| `--port ` | Specify port (`number`) | +| `--open [path]` | Open browser on startup (`boolean \| string`) | +| `--cors` | Enable CORS (`boolean`) | +| `--strictPort` | Exit if specified port is already in use (`boolean`) | +| `--force` | Force the optimizer to ignore the cache and re-bundle (`boolean`) | +| `-c, --config ` | Use specified config file (`string`) | +| `--base ` | Public base path (default: `/`) (`string`) | +| `-l, --logLevel ` | info \| warn \| error \| silent (`string`) | +| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) | +| `--configLoader ` | Use `bundle` to bundle the config with Rolldown, or `runner` (experimental) to process it on the fly, or `native` (experimental) to load using the native runtime (default: `bundle`) | +| `--profile` | Start built-in Node.js inspector (check [Performance bottlenecks](/guide/troubleshooting#performance-bottlenecks)) | +| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) | +| `-f, --filter ` | Filter debug logs (`string`) | +| `-m, --mode ` | Set env mode (`string`) | +| `-h, --help` | Display available CLI options | +| `-v, --version` | Display version number | ## Build @@ -48,30 +48,30 @@ vite build [root] #### Options -| Options | | -| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | -| `--target ` | Transpile target (default: `"modules"`) (`string`) | -| `--outDir ` | Output directory (default: `dist`) (`string`) | -| `--assetsDir ` | Directory under outDir to place assets in (default: `"assets"`) (`string`) | -| `--assetsInlineLimit ` | Static asset base64 inline threshold in bytes (default: `4096`) (`number`) | -| `--ssr [entry]` | Build specified entry for server-side rendering (`string`) | -| `--sourcemap [output]` | Output source maps for build (default: `false`) (`boolean \| "inline" \| "hidden"`) | -| `--minify [minifier]` | Enable/disable minification, or specify minifier to use (default: `"esbuild"`) (`boolean \| "terser" \| "esbuild"`) | -| `--manifest [name]` | Emit build manifest json (`boolean \| string`) | -| `--ssrManifest [name]` | Emit ssr manifest json (`boolean \| string`) | -| `--emptyOutDir` | Force empty outDir when it's outside of root (`boolean`) | -| `-w, --watch` | Rebuilds when modules have changed on disk (`boolean`) | -| `-c, --config ` | Use specified config file (`string`) | -| `--base ` | Public base path (default: `/`) (`string`) | -| `-l, --logLevel ` | Info \| warn \| error \| silent (`string`) | -| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) | -| `--configLoader ` | Use `bundle` to bundle the config with esbuild or `runner` (experimental) to process it on the fly (default: `bundle`) | -| `--profile` | Start built-in Node.js inspector (check [Performance bottlenecks](/guide/troubleshooting#performance-bottlenecks)) | -| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) | -| `-f, --filter ` | Filter debug logs (`string`) | -| `-m, --mode ` | Set env mode (`string`) | -| `-h, --help` | Display available CLI options | -| `--app` | Build all environments, same as `builder: {}` (`boolean`, experimental) | +| Options | | +| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------- | +| `--target ` | Transpile target (default: `"modules"`) (`string`) | +| `--outDir ` | Output directory (default: `dist`) (`string`) | +| `--assetsDir ` | Directory under outDir to place assets in (default: `"assets"`) (`string`) | +| `--assetsInlineLimit ` | Static asset base64 inline threshold in bytes (default: `4096`) (`number`) | +| `--ssr [entry]` | Build specified entry for server-side rendering (`string`) | +| `--sourcemap [output]` | Output source maps for build (default: `false`) (`boolean \| "inline" \| "hidden"`) | +| `--minify [minifier]` | Enable/disable minification, or specify minifier to use (default: `"esbuild"`) (`boolean \| "terser" \| "esbuild"`) | +| `--manifest [name]` | Emit build manifest json (`boolean \| string`) | +| `--ssrManifest [name]` | Emit ssr manifest json (`boolean \| string`) | +| `--emptyOutDir` | Force empty outDir when it's outside of root (`boolean`) | +| `-w, --watch` | Rebuilds when modules have changed on disk (`boolean`) | +| `-c, --config ` | Use specified config file (`string`) | +| `--base ` | Public base path (default: `/`) (`string`) | +| `-l, --logLevel ` | Info \| warn \| error \| silent (`string`) | +| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) | +| `--configLoader ` | Use `bundle` to bundle the config with Rolldown or `runner` (experimental) to process it on the fly (default: `bundle`) | +| `--profile` | Start built-in Node.js inspector (check [Performance bottlenecks](/guide/troubleshooting#performance-bottlenecks)) | +| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) | +| `-f, --filter ` | Filter debug logs (`string`) | +| `-m, --mode ` | Set env mode (`string`) | +| `-h, --help` | Display available CLI options | +| `--app` | Build all environments, same as `builder: {}` (`boolean`, experimental) | ## Others @@ -89,18 +89,18 @@ vite optimize [root] #### Options -| Options | | -| ------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| `--force` | Force the optimizer to ignore the cache and re-bundle (`boolean`) | -| `-c, --config ` | Use specified config file (`string`) | -| `--base ` | Public base path (default: `/`) (`string`) | -| `-l, --logLevel ` | Info \| warn \| error \| silent (`string`) | -| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) | -| `--configLoader ` | Use `bundle` to bundle the config with esbuild or `runner` (experimental) to process it on the fly (default: `bundle`) | -| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) | -| `-f, --filter ` | Filter debug logs (`string`) | -| `-m, --mode ` | Set env mode (`string`) | -| `-h, --help` | Display available CLI options | +| Options | | +| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `--force` | Force the optimizer to ignore the cache and re-bundle (`boolean`) | +| `-c, --config ` | Use specified config file (`string`) | +| `--base ` | Public base path (default: `/`) (`string`) | +| `-l, --logLevel ` | Info \| warn \| error \| silent (`string`) | +| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) | +| `--configLoader ` | Use `bundle` to bundle the config with Rolldown or `runner` (experimental) to process it on the fly (default: `bundle`) | +| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) | +| `-f, --filter ` | Filter debug logs (`string`) | +| `-m, --mode ` | Set env mode (`string`) | +| `-h, --help` | Display available CLI options | ### `vite preview` @@ -116,19 +116,19 @@ vite preview [root] #### Options -| Options | | -| ------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| `--host [host]` | Specify hostname (`string`) | -| `--port ` | Specify port (`number`) | -| `--strictPort` | Exit if specified port is already in use (`boolean`) | -| `--open [path]` | Open browser on startup (`boolean \| string`) | -| `--outDir ` | Output directory (default: `dist`)(`string`) | -| `-c, --config ` | Use specified config file (`string`) | -| `--base ` | Public base path (default: `/`) (`string`) | -| `-l, --logLevel ` | Info \| warn \| error \| silent (`string`) | -| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) | -| `--configLoader ` | Use `bundle` to bundle the config with esbuild or `runner` (experimental) to process it on the fly (default: `bundle`) | -| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) | -| `-f, --filter ` | Filter debug logs (`string`) | -| `-m, --mode ` | Set env mode (`string`) | -| `-h, --help` | Display available CLI options | +| Options | | +| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `--host [host]` | Specify hostname (`string`) | +| `--port ` | Specify port (`number`) | +| `--strictPort` | Exit if specified port is already in use (`boolean`) | +| `--open [path]` | Open browser on startup (`boolean \| string`) | +| `--outDir ` | Output directory (default: `dist`)(`string`) | +| `-c, --config ` | Use specified config file (`string`) | +| `--base ` | Public base path (default: `/`) (`string`) | +| `-l, --logLevel ` | Info \| warn \| error \| silent (`string`) | +| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) | +| `--configLoader ` | Use `bundle` to bundle the config with Rolldown or `runner` (experimental) to process it on the fly (default: `bundle`) | +| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) | +| `-f, --filter ` | Filter debug logs (`string`) | +| `-m, --mode ` | Set env mode (`string`) | +| `-h, --help` | Display available CLI options | diff --git a/docs/guide/dep-pre-bundling.md b/docs/guide/dep-pre-bundling.md index 4a76d2a70402e6..ce5dac206125d6 100644 --- a/docs/guide/dep-pre-bundling.md +++ b/docs/guide/dep-pre-bundling.md @@ -22,12 +22,12 @@ This is Vite performing what we call "dependency pre-bundling". This process ser By pre-bundling `lodash-es` into a single module, we now only need one HTTP request instead! ::: tip NOTE -Dependency pre-bundling only applies in development mode, and uses `esbuild` to convert dependencies to ESM. In production builds, `@rollup/plugin-commonjs` is used instead. +Dependency pre-bundling only applies in development mode. ::: ## Automatic Dependency Discovery -If an existing cache is not found, Vite will crawl your source code and automatically discover dependency imports (i.e. "bare imports" that expect to be resolved from `node_modules`) and use these found imports as entry points for the pre-bundle. The pre-bundling is performed with `esbuild` so it's typically very fast. +If an existing cache is not found, Vite will crawl your source code and automatically discover dependency imports (i.e. "bare imports" that expect to be resolved from `node_modules`) and use these found imports as entry points for the pre-bundle. The pre-bundling is performed with [Rolldown](https://rolldown.rs/) so it's typically very fast. After the server has already started, if a new dependency import is encountered that isn't already in the cache, Vite will re-run the dep bundling process and reload the page if needed. @@ -35,7 +35,7 @@ After the server has already started, if a new dependency import is encountered In a monorepo setup, a dependency may be a linked package from the same repo. Vite automatically detects dependencies that are not resolved from `node_modules` and treats the linked dep as source code. It will not attempt to bundle the linked dep, and will analyze the linked dep's dependency list instead. -However, this requires the linked dep to be exported as ESM. If not, you can add the dependency to [`optimizeDeps.include`](/config/dep-optimization-options.md#optimizedeps-include) and [`build.commonjsOptions.include`](/config/build-options.md#build-commonjsoptions) in your config. +However, this requires the linked dep to be exported as ESM. If not, you can add the dependency to [`optimizeDeps.include`](/config/dep-optimization-options.md#optimizedeps-include) in your config. ```js twoslash [vite.config.js] import { defineConfig } from 'vite' @@ -44,11 +44,6 @@ export default defineConfig({ optimizeDeps: { include: ['linked-dep'], }, - build: { - commonjsOptions: { - include: [/linked-dep/, /node_modules/], - }, - }, }) ``` @@ -62,7 +57,9 @@ A typical use case for `optimizeDeps.include` or `optimizeDeps.exclude` is when Both `include` and `exclude` can be used to deal with this. If the dependency is large (with many internal modules) or is CommonJS, then you should include it; If the dependency is small and is already valid ESM, you can exclude it and let the browser load it directly. -You can further customize esbuild too with the [`optimizeDeps.esbuildOptions` option](/config/dep-optimization-options.md#optimizedeps-esbuildoptions). For example, adding an esbuild plugin to handle special files in dependencies or changing the [build `target`](https://esbuild.github.io/api/#target). +You can further customize esbuild too with the [`optimizeDeps.rolldownOptions` option](/config/dep-optimization-options.md#optimizedeps-rolldownoptions). For example, adding an Rolldown plugin to handle special files in dependencies or changing the [build `target`](https://esbuild.github.io/api/#target). + + ## Caching diff --git a/docs/guide/features.md b/docs/guide/features.md index b8bb9c17ab2698..fe6539ef3b7f15 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -98,6 +98,14 @@ If `target` in `tsconfig.json` is not `ESNext` or `ES2022` or newer, or if there As such, it is recommended to set `target` to `ESNext` or `ES2022` or newer, or set `useDefineForClassFields` to `true` explicitly when configuring `tsconfig.json`. ::: +#### `paths` + +- [TypeScript documentation](https://www.typescriptlang.org/tsconfig/#paths) + +`resolve.tsconfigPaths: true` can be specified to tell Vite to use the `paths` option in `tsconfig.json` to resolve imports. + +Note that this feature has a performance cost and is [discouraged by the TypeScript team to use this option to change the behavior of the external tools](https://www.typescriptlang.org/tsconfig/#paths:~:text=Note%20that%20this%20feature%20does%20not%20change%20how%20import%20paths%20are%20emitted%20by%20tsc%2C%20so%20paths%20should%20only%20be%20used%20to%20inform%20TypeScript%20that%20another%20tool%20has%20this%20mapping%20and%20will%20use%20it%20at%20runtime%20or%20when%20bundling.). + #### Other Compiler Options Affecting the Build Result - [`extends`](https://www.typescriptlang.org/tsconfig#extends) diff --git a/docs/guide/migration.md b/docs/guide/migration.md index 42daebc41cb25e..c0cbc5733c974e 100644 --- a/docs/guide/migration.md +++ b/docs/guide/migration.md @@ -1,58 +1,397 @@ -# Migration from v6 +# Migration from v7 -## Node.js Support +## New Features -Vite no longer supports Node.js 18, which reached its EOL. Node.js 20.19+ / 22.12+ is now required. +::: tip Temporary section + +This section will be moved to the release post before the stable release. + +::: + +### Built-in tsconfig `paths` Support + +Vite 8 now has built-in support for TypeScript's `paths` option, based on [Oxc Resolver](https://oxc.rs/docs/guide/usage/resolver). This feature has a small performance cost and is [discouraged by the TypeScript team](https://www.typescriptlang.org/tsconfig/#paths:~:text=Note%20that%20this%20feature%20does%20not%20change%20how%20import%20paths%20are%20emitted%20by%20tsc%2C%20so%20paths%20should%20only%20be%20used%20to%20inform%20TypeScript%20that%20another%20tool%20has%20this%20mapping%20and%20will%20use%20it%20at%20runtime%20or%20when%20bundling.), so it is not enabled by default. You can enable it by setting `resolve.tsconfigPaths` to `true`. + +The `tsconfig.json` in the closest parent directory will be used. For more details about resolving `tsconfig.json`, see [the Features page](/guide/features#typescript-compiler-options). + +### `emitDecoratorMetadata` Support + +Vite 8 now has built-in support for TypeScript's [`emitDecoratorMetadata` option](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata), based on [Oxc Transformer](https://oxc.rs/docs/guide/usage/transformer). This feature will be enabled automatically if you have `emitDecoratorMetadata` set to `true` in your `tsconfig.json`. + +This transform has some limitations. Full support for decorator metadata requires type inference by the TypeScript compiler, which is not supported. See [Oxc Transformer's documentation](https://oxc.rs/docs/guide/usage/transformer/typescript#decorators) for details. ## Default Browser Target change -The default browser value of `build.target` is updated to a newer browser. +The default browser value of `build.target` and `'baseline-widely-available'`, is updated to newer browser version: -- Chrome 87 → 107 -- Edge 88 → 107 -- Firefox 78 → 104 -- Safari 14.0 → 16.0 +- Chrome 107 → 111 +- Edge 107 → 111 +- Firefox 104 → 114 +- Safari 16.0 → 16.4 -These browser versions align with [Baseline](https://web-platform-dx.github.io/web-features/) Widely Available feature sets as of 2025-05-01. In other words, they were all released before 2022-11-01. +These browser versions align with [Baseline Widely Available](https://web-platform-dx.github.io/web-features/) feature sets as of 2026-01-01. In other words, they were all released about two and a half years ago. -In Vite 5, the default target was named `'modules'`, but this is no longer available. Instead, a new default target `'baseline-widely-available'` is introduced. +## Rolldown -## General Changes +Vite 8 uses Rolldown and Oxc based tools instead of esbuild and Rollup. + +### Gradual Migration + +The `rolldown-vite` package implements Vite 7 with Rolldown, without other Vite 8 changes. This can be used as a intermediate step to migrate to Vite 8. See [the Rolldown Integration guide](https://v7.vite.dev/guide/rolldown) in the Vite 7 docs to switch to `rolldown-vite` from Vite 7. + +For users migrating from `rolldown-vite` to Vite 8, you can undo the dependency changes in `package.json` and update to Vite 8: + +```json +{ + "dependencies": { + "vite": "npm:rolldown-vite@7.2.2" // [!code --] + "vite": "^8.0.0" // [!code ++] + } +} +``` + +### Dependency Optimizer now uses Rolldown + +Rolldown is now used for dependency optimization instead of esbuild. Vite still supports [`optimizeDeps.esbuildOptions`](/config/dep-optimization-options#optimizedeps-esbuildoptions) for backward compatibility by converting it to [`optimizeDeps.rolldownOptions`](/config/dep-optimization-options#optimizedeps-rolldownoptions) automatically. `optimizeDeps.esbuildOptions` is now deprecated and will be removed in the future and we encourage you to migrate to `optimizeDeps.rolldownOptions`. + +The following options are converted automatically: + +- [`esbuildOptions.minify`](https://esbuild.github.io/api/#minify) -> `rolldownOptions.output.minify` +- [`esbuildOptions.treeShaking`](https://esbuild.github.io/api/#tree-shaking) -> `rolldownOptions.treeshake` +- [`esbuildOptions.define`](https://esbuild.github.io/api/#define) -> `rolldownOptions.transform.define` +- [`esbuildOptions.loader`](https://esbuild.github.io/api/#loader) -> `rolldownOptions.moduleTypes` +- [`esbuildOptions.preserveSymlinks`](https://esbuild.github.io/api/#preserve-symlinks) -> `!rolldownOptions.resolve.symlinks` +- [`esbuildOptions.resolveExtensions`](https://esbuild.github.io/api/#resolve-extensions) -> `rolldownOptions.resolve.extensions` +- [`esbuildOptions.mainFields`](https://esbuild.github.io/api/#main-fields) -> `rolldownOptions.resolve.mainFields` +- [`esbuildOptions.conditions`](https://esbuild.github.io/api/#conditions) -> `rolldownOptions.resolve.conditionNames` +- [`esbuildOptions.keepNames`](https://esbuild.github.io/api/#keep-names) -> `rolldownOptions.output.keepNames` +- [`esbuildOptions.platform`](https://esbuild.github.io/api/#platform) -> `rolldownOptions.platform` +- [`esbuildOptions.plugins`](https://esbuild.github.io/plugins/) -> `rolldownOptions.plugins` (partial support) + + + +You can get the options set by the compatibility layer from the `configResolved` hook: + +```js +const plugin = { + name: 'log-config', + configResolved(config) { + console.log('options', config.optimizeDeps.rolldownOptions) + }, +}, +``` + +### JavaScript Transforms by Oxc + +Oxc is now used for JavaScript transformation instead of esbuild. Vite still supports the [`esbuild`](/config/shared-options#esbuild) option for backward compatibility by converting it to [`oxc`](/config/shared-options#oxc) automatically. `esbuild` is now deprecated and will be removed in the future and we encourage you to migrate to `oxc`. + +The following options are converted automatically: + +- `esbuild.jsxInject` -> `oxc.jsxInject` +- `esbuild.include` -> `oxc.include` +- `esbuild.exclude` -> `oxc.exclude` +- [`esbuild.jsx`](https://esbuild.github.io/api/#jsx) -> [`oxc.jsx`](https://oxc.rs/docs/guide/usage/transformer/jsx) + - `esbuild.jsx: 'preserve'` -> `oxc.jsx: 'preserve'` + - `esbuild.jsx: 'automatic'` -> `oxc.jsx: { runtime: 'automatic' }` + - [`esbuild.jsxImportSource`](https://esbuild.github.io/api/#jsx-import-source) -> `oxc.jsx.importSource` + - `esbuild.jsx: 'transform'` -> `oxc.jsx: { runtime: 'classic' }` + - [`esbuild.jsxFactory`](https://esbuild.github.io/api/#jsx-factory) -> `oxc.jsx.pragma` + - [`esbuild.jsxFragment`](https://esbuild.github.io/api/#jsx-fragment) -> `oxc.jsx.pragmaFrag` + - [`esbuild.jsxDev`](https://esbuild.github.io/api/#jsx-dev) -> `oxc.jsx.development` + - [`esbuild.jsxSideEffects`](https://esbuild.github.io/api/#jsx-side-effects) -> `oxc.jsx.pure` +- [`esbuild.define`](https://esbuild.github.io/api/#define) -> [`oxc.define`](https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define) +- [`esbuild.banner`](https://esbuild.github.io/api/#banner) -> custom plugin using transform hook +- [`esbuild.footer`](https://esbuild.github.io/api/#footer) -> custom plugin using transform hook + +The [`esbuild.supported`](https://esbuild.github.io/api/#supported) option is not supported by Oxc. If you need this option, please see [oxc-project/oxc#15373](https://github.com/oxc-project/oxc/issues/15373). + +You can get the options set by the compatibility layer from the `configResolved` hook: + +```js +const plugin = { + name: 'log-config', + configResolved(config) { + console.log('options', config.oxc) + }, +}, +``` + + + +Currently, the Oxc transformer does not support lowering native decorators as we are waiting for the specification to progress, see ([oxc-project/oxc#9170](https://github.com/oxc-project/oxc/issues/9170)). + +:::: details Workaround for lowering native decorators + +You can use [Babel](https://babeljs.io/) or [SWC](https://swc.rs/) to lower native decorators for the time being. While SWC is faster than Babel, it does **not support the latest decorator spec** that esbuild supports. + +The decorator spec has been updated multiple times since it reached stage 3. The versions supported by each tool are: + +- `"2023-11"` (esbuild, TypeScript 5.4+ and Babel support this version) +- `"2023-05"` (TypeScript 5.2+ supports this version) +- `"2023-01"` (TypeScript 5.0+ supports this version) +- `"2022-03"` (SWC supports this version) + +See the [Babel decorators versions guide](https://babeljs.io/docs/babel-plugin-proposal-decorators#version) for differences between each version. + +**Using Babel:** + +::: code-group + +```bash [npm] +$ npm install -D @rollup/plugin-babel @babel/plugin-proposal-decorators +``` + +```bash [Yarn] +$ yarn add -D @rollup/plugin-babel @babel/plugin-proposal-decorators +``` + +```bash [pnpm] +$ pnpm add -D @rollup/plugin-babel @babel/plugin-proposal-decorators +``` + +```bash [Bun] +$ bun add -D @rollup/plugin-babel @babel/plugin-proposal-decorators +``` + +```bash [Deno] +$ deno add -D npm:@rollup/plugin-babel npm:@babel/plugin-proposal-decorators +``` + +::: + +```ts [vite.config.ts] +import { defineConfig, withFilter } from 'vite' +import { babel } from '@rollup/plugin-babel' + +export default defineConfig({ + plugins: [ + withFilter( + babel({ + configFile: false, + plugins: [ + ['@babel/plugin-proposal-decorators', { version: '2023-11' }], + ], + }), + // Only run this transform if the file contains a decorator. + { transform: { code: '@' } }, + ), + ], +}) +``` + +**Using SWC:** + +::: code-group + +```bash [npm] +$ npm install -D @rollup/plugin-swc @swc/core +``` + +```bash [Yarn] +$ yarn add -D @rollup/plugin-swc @swc/core +``` + +```bash [pnpm] +$ pnpm add -D @rollup/plugin-swc @swc/core +``` + +```bash [Bun] +$ bun add -D @rollup/plugin-swc @swc/core +``` + +```bash [Deno] +$ deno add -D npm:@rollup/plugin-swc npm:@swc/core +``` + +::: + +```js +import { defineConfig, withFilter } from 'vite' -### Removed Sass legacy API support +export default defineConfig({ + // ... + plugins: [ + withFilter( + swc({ + swc: { + jsc: { + parser: { decorators: true, decoratorsBeforeExport: true }, + // NOTE: SWC doesn't support the '2023-11' version yet. + transform: { decoratorVersion: '2022-03' }, + }, + }, + }), + // Only run this transform if the file contains a decorator. + { transform: { code: '@' } }, + ), + ], +}) +``` -As planned, support for the Sass legacy API is removed. Vite now only supports the modern API. You can remove the `css.preprocessorOptions.sass.api` / `css.preprocessorOptions.scss.api` option. +:::: + +#### esbuild Fallbacks + +`esbuild` is no longer directly used by Vite and is now an optional dependency. If you are using a plugin that uses the `transformWithEsbuild` function, you need to install `esbuild` as a `devDependency`. The `transformWithEsbuild` function is deprecated and will be removed in the future. We recommend migrating to the new `transformWithOxc` function instead. + +### JavaScript Minification by Oxc + +The Oxc Minifier is now used for JavaScript minification instead of esbuild. You can use the deprecated [`build.minify: 'esbuild'`](/config/build-options#minify) option to switch back to esbuild. This configuration option will be removed in the future and you need install `esbuild` as a `devDependency` as Vite no longer relies on esbuild directly. + +If you were using the `esbuild.minify*` options to control minification behavior, you can now use `build.rolldownOptions.output.minify` instead. If you were using the `esbuild.drop` option, you can now use [`build.rolldownOptions.output.minify.compress.drop*` options](https://oxc.rs/docs/guide/usage/minifier/dead-code-elimination). + +Property mangling and its related options ([`mangleProps`, `reserveProps`, `mangleQuoted`, `mangleCache`](https://esbuild.github.io/api/#mangle-props)) are not supported by Oxc. If you need these options, please see [oxc-project/oxc#15375](https://github.com/oxc-project/oxc/issues/15375). + +esbuild and Oxc Minifier make slightly different assumptions about source code. In case you suspect the minifier is causing breakage in your code, you can compare these assumptions here: + +- [esbuild minify assumptions](https://esbuild.github.io/api/#minify-considerations) +- [Oxc Minifier assumptions](https://oxc.rs/docs/guide/usage/minifier.html#assumptions) + +Please report any issues you find related to minification in your JavaScript apps. + +### CSS Minification by Lightning CSS + +[Lightning CSS](https://lightningcss.dev/) is now used for CSS minification by default. You can use the [`build.cssMinify: 'esbuild'`](/config/build-options#cssminify) option to switch back to esbuild. Note that you need to install `esbuild` as a `devDependency`. + +Lightning CSS supports better syntax lowering and your CSS bundle size might increase slightly. + +### Consistent CommonJS Interop + +The `default` import from a CommonJS (CJS) module is now handled in a consistent way. + +If it matches one of the following conditions, the `default` import is the `module.exports` value of the importee CJS module. Otherwise, the `default` import is the `module.exports.default` value of the importee CJS module: + +- The importer is `.mjs` or `.mts`. +- The closest `package.json` for the importer has a `type` field set to `module`. +- The `module.exports.__esModule` value of the importee CJS module is not set to true. + +::: details The previous behavior + +In development, if it matches one of the following conditions, the `default` import is the `module.exports` value of the importee CJS module. Otherwise, the `default` import is the `module.exports.default` value of the importee CJS module: + +- _The importer is included in the dependency optimization_ and `.mjs` or `.mts`. +- _The importer is included in the dependency optimization_ and the closest `package.json` for the importer has a `type` field set to `module`. +- The `module.exports.__esModule` value of the importee CJS module is not set to true. + +In build, the conditions were: + +- The `module.exports.__esModule` value of the importee CJS module is not set to true. +- _`default` property of `module.exports` does not exist_. + +(assuming [`build.commonjsOptions.defaultIsModuleExports`](https://github.com/rollup/plugins/tree/master/packages/commonjs#defaultismoduleexports) is not changed from the default `'auto'`) + +::: + +See Rolldown's docs about this problem for more details: [Ambiguous `default` import from CJS modules - Bundling CJS | Rolldown](https://rolldown.rs/in-depth/bundling-cjs#ambiguous-default-import-from-cjs-modules). + +This change may break some existing code importing CJS modules. You can use the deprecated `legacy.inconsistentCjsInterop: true` option to temporarily restore the previous behavior. If you find a package that is affected by this change, please report it to the package author or send them a pull request. Make sure to link to the Rolldown document above so that the author can understand the context. + +### Removed Module Resolution Using Format Sniffing + +When both `browser` and `module` fields are present in `package.json`, Vite used to resolve the field based on the content of the file and it used to pick the ESM file for browsers. This was introduced because some packages were using the `module` field to point to ESM files for Node.js and some other packages were using the `browser` field to point to UMD files for browsers. Given that the modern `exports` field solved this problem and is now adopted by many packages, Vite no longer uses this heuristic and always respects the order of the [`resolve.mainFields`](/config/shared-options#resolve-mainfields) option. If you were relying on this behavior, you can use the [`resolve.alias`](/config/shared-options#resolve-alias) option to map the field to the desired file or apply a patch with your package manager (e.g. `patch-package`, `pnpm patch`). + +### Require Calls For Externalized Modules + +`require` calls for externalized modules are now preserved as `require` calls and not converted to `import` statements. This is to preserve the semantics of `require` calls. If you want to convert them to `import` statements, you can use Rolldown's built-in `esmExternalRequirePlugin`, which is re-exported from `vite`. + +```js +import { defineConfig, esmExternalRequirePlugin } from 'vite' + +export default defineConfig({ + // ... + plugins: [ + esmExternalRequirePlugin({ + external: ['react', 'vue', /^node:/], + }), + ], +}) +``` + +See Rolldown's docs for more details: [`require` external modules - Bundling CJS | Rolldown](https://rolldown.rs/in-depth/bundling-cjs#require-external-modules). + +### `import.meta.url` in UMD / IIFE + +`import.meta.url` is no longer polyfilled in UMD / IIFE output formats. It will be replaced with `undefined` by default. If you prefer the previous behavior, you can use the `define` option with `build.rolldownOptions.output.intro` option. See Rolldown's docs for more details: [Well-known `import.meta` properties - Non ESM Output Formats | Rolldown](https://rolldown.rs/in-depth/non-esm-output-formats#well-known-import-meta-properties). + +### Removed `build.rollupOptions.watch.chokidar` option + +The `build.rollupOptions.watch.chokidar` option was removed. Please migrate to the `build.rolldownOptions.watch.notify` option. + + + +### Deprecate `build.rollupOptions.output.manualChunks` + +The `output.manualChunks` option is deprecated. Rolldown has the more flexible `advancedChunks` option. See Rolldown's docs for more details about `advancedChunks`: [Advanced Chunks - Rolldown](https://rolldown.rs/in-depth/advanced-chunks). + + + +### Module Type Support and Auto Detection + +_This change only affects plugin authors._ + +Rolldown has experimental support for [Module types](https://rolldown.rs/guide/notable-features#module-types), similar to [esbuild's `loader` option](https://esbuild.github.io/api/#loader). Due to this, Rolldown automatically sets a module type based on the extension of the resolved id. If you are converting content from other module types to JavaScript in `load` or `transform` hooks, you may need to add `moduleType: 'js'` to the returned value: + +```js +const plugin = { + name: 'txt-loader', + load(id) { + if (id.endsWith('.txt')) { + const content = fs.readFile(id, 'utf-8') + return { + code: `export default ${JSON.stringify(content)}`, + moduleType: 'js', // [!code ++] + } + } + }, +} +``` + +### Other Related Deprecations + +The following options are deprecated and will be removed in the future: + +- `build.rollupOptions`: renamed to `build.rolldownOptions` +- `worker.rollupOptions`: renamed to `worker.rolldownOptions` +- `build.commonjsOptions`: it is now no-op + +## General Changes ## Removed deprecated features -- `splitVendorChunkPlugin` (deprecated in v5.2.7) - - This plugin was originally provided to ease migration to Vite v2.9. - - The `build.rollupOptions.output.manualChunks` option can be used to control the chunking behavior if needed. -- Hook-level `enforce` / `transform` for `transformIndexHtml` (deprecated in v4.0.0) - - It was changed to align the interface with [Rollup's object hooks](https://rollupjs.org/plugin-development/#build-hooks:~:text=Instead%20of%20a%20function%2C%20hooks%20can%20also%20be%20objects.). - - `order` should be used instead of `enforce`, and `handler` should be used instead of `transform`. +**_TODO: This change is not implemented yet, but will be implemented before stable release._** ## Advanced -There are other breaking changes which only affect few users. - -- [[#19979] chore: declare version range for peer dependencies](https://github.com/vitejs/vite/pull/19979) - - Specified the peer dependencies version range for CSS preprocessors. -- [[#20013] refactor: remove no-op `legacy.proxySsrExternalModules`](https://github.com/vitejs/vite/pull/20013) - - `legacy.proxySsrExternalModules` property had no effect since Vite 6. It is now removed. -- [[#19985] refactor!: remove deprecated no-op type only properties](https://github.com/vitejs/vite/pull/19985) - - The following unused properties are now removed: `ModuleRunnerOptions.root`, `ViteDevServer._importGlobMap`, `ResolvePluginOptions.isFromTsImporter`, `ResolvePluginOptions.getDepsOptimizer`, `ResolvePluginOptions.shouldExternalize`, `ResolvePluginOptions.ssrConfig` -- [[#19986] refactor: remove deprecated env api properties](https://github.com/vitejs/vite/pull/19986) - - These properties were deprecated from the beginning. It is now removed. -- [[#19987] refactor!: remove deprecated `HotBroadcaster` related types](https://github.com/vitejs/vite/pull/19987) - - These types were introduced as part of the now-deprecated Runtime API. It is now removed: `HMRBroadcaster`, `HMRBroadcasterClient`, `ServerHMRChannel`, `HMRChannel` -- [[#19996] fix(ssr)!: don't access `Object` variable in ssr transformed code](https://github.com/vitejs/vite/pull/19996) - - `__vite_ssr_exportName__` is now required for the module runner runtime context. -- [[#20045] fix: treat all `optimizeDeps.entries` values as globs](https://github.com/vitejs/vite/pull/20045) - - `optimizeDeps.entries` now does not receive literal string paths. Instead, it always receives globs. -- [[#20222] feat: apply some middlewares before `configureServer` hook](https://github.com/vitejs/vite/pull/20222), [[#20224] feat: apply some middlewares before `configurePreviewServer` hook](https://github.com/vitejs/vite/pull/20224) - - Some middlewares are now applied before the `configureServer` / `configurePreviewServer` hook. Note that if you don't expect a certain route to apply the [`server.cors`](../config/server-options.md#server-cors) / [`preview.cors`](../config/preview-options.md#preview-cors) option, make sure to remove the related headers from the response. - -## Migration from v5 - -Check the [Migration from v5 Guide](https://v6.vite.dev/guide/migration.html) in the Vite v6 docs first to see the needed changes to port your app to Vite 6, and then proceed with the changes on this page. +These breaking changes are expected to only affect a minority of use cases: + +- **[TODO: this will be fixed before stable release]** https://github.com/rolldown/rolldown/issues/5726 (affects nuxt, qwik) +- **[TODO: this will be fixed before stable release]** https://github.com/rolldown/rolldown/issues/3403 (affects sveltekit) +- **[TODO: this will be fixed before stable release]** Legacy chunks are emitted as an asset file instead of a chunk file due to the lack of prebuilt chunk emit feature ([rolldown#4304](https://github.com/rolldown/rolldown/issues/4034)). This means the chunk related options does not apply to legacy chunks and the manifest file will not include legacy chunks as a chunk file. +- **[TODO: this will be fixed before stable release]** resolver cache breaks minor cases in Vitest ([rolldown-vite#466](https://github.com/vitejs/rolldown-vite/issues/466), [vitest#8754](https://github.com/vitest-dev/vitest/issues/8754#issuecomment-3441115032)) +- **[TODO: this will be fixed before stable release]** The resolver does not work with yarn pnp ([rolldown-vite#324](https://github.com/vitejs/rolldown-vite/issues/324), [rolldown-vite#392](https://github.com/vitejs/rolldown-vite/issues/392)) +- **[TODO: this will be fixed before stable release]** native plugin ordering issue ([rolldown-vite#373](https://github.com/vitejs/rolldown-vite/issues/373)) +- **[TODO: this will be fixed before stable release]** `@vite-ignore` comment edge case ([rolldown-vite#426](https://github.com/vitejs/rolldown-vite/issues/426)) +- **[TODO: this will be fixed before stable release]** https://github.com/rolldown/rolldown/issues/3403 +- [Extglobs](https://github.com/micromatch/picomatch/blob/master/README.md#extglobs) are not supported yet ([rolldown-vite#365](https://github.com/vitejs/rolldown-vite/issues/365)) +- `define` does not share reference for objects: When you pass an object as a value to `define`, each variable will have a separate copy of the object. See [Oxc Transformer document](https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define) for more details. +- `bundle` object changes (`bundle` is an object passed in `generateBundle` / `writeBundle` hooks, returned by `build` function): + - Assigning to `bundle[foo]` is not supported. This is discouraged by Rollup as well. Please use `this.emitFile()` instead. + - the reference is not shared across the hooks ([rolldown-vite#410](https://github.com/vitejs/rolldown-vite/issues/410)) + - `structuredClone(bundle)` errors with `DataCloneError: # could not be cloned`. This is not supported anymore. Please clone it with `structuredClone({ ...bundle })`. ([rolldown-vite#128](https://github.com/vitejs/rolldown-vite/issues/128)) +- All parallel hooks in Rollup works as sequential hooks. See [Rolldown's documentation](https://rolldown.rs/apis/plugin-api#sequential-hook-execution) for more details. +- `"use strict";` is not injected sometimes. See [Rolldown's documentation](https://rolldown.rs/in-depth/directives) for more details. +- Transforming to lower than ES5 with plugin-legacy is not supported ([rolldown-vite#452](https://github.com/vitejs/rolldown-vite/issues/452)) +- Passing the same browser with multiple versions of it to `build.target` option now errors: esbuild selects the latest version of it, which was probably not what you intended. +- Missing support by Rolldown: The following features are not supported by Rolldown and is no longer supported by Vite. + - `build.rollupOptions.output.format: 'system'` ([rolldown#2387](https://github.com/rolldown/rolldown/issues/2387)) + - `build.rollupOptions.output.format: 'amd'` ([rolldown#2387](https://github.com/rolldown/rolldown/issues/2528)) + - Complete support for TypeScript legacy namespace ([oxc-project/oxc#14227](https://github.com/oxc-project/oxc/issues/14227)) + - `shouldTransformCachedModule` hook ([rolldown#4389](https://github.com/rolldown/rolldown/issues/4389)) + - `resolveImportMeta` hook ([rolldown#1010](https://github.com/rolldown/rolldown/issues/1010)) + - `renderDynamicImport` hook ([rolldown#4532](https://github.com/rolldown/rolldown/issues/4532)) + - `resolveFileUrl` hook +- `parseAst` / `parseAstAsync` functions are now deprecated in favor of `parse` / `parseAsync` functions which has more features. + +## Migration from v6 + +Check the [Migration from v6 Guide](https://v7.vite.dev/guide/migration) in the Vite v7 docs first to see the needed changes to port your app to Vite 7, and then proceed with the changes on this page. diff --git a/docs/guide/performance.md b/docs/guide/performance.md index 702e10fd3b997d..790658f83998b8 100644 --- a/docs/guide/performance.md +++ b/docs/guide/performance.md @@ -122,6 +122,5 @@ Examples of using native tooling: Using native tooling often brings larger installation size and as so is not the default when starting a new Vite project. But it may be worth the cost for larger applications. -- Use [Rolldown instead of Rollup and esbuild](./rolldown) for faster builds and a more aligned experience between dev and build. - Try out the experimental support for [LightningCSS](https://github.com/vitejs/vite/discussions/13835) - Use [`@vitejs/plugin-react-swc`](https://github.com/vitejs/vite-plugin-react-swc) in place of `@vitejs/plugin-react`. diff --git a/docs/guide/philosophy.md b/docs/guide/philosophy.md index fd2b8668c37661..15b091c75baccf 100644 --- a/docs/guide/philosophy.md +++ b/docs/guide/philosophy.md @@ -16,7 +16,7 @@ When adding new features, these patterns are followed to create a future-proof A ## A Pragmatic Approach to Performance -Vite has been focused on performance since its [origins](./why.md). Its dev server architecture allows HMR that stays fast as projects scale. Vite uses native tools like [esbuild](https://esbuild.github.io/) and [SWC](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc) to implement intensive tasks but keeps the rest of the code in JS to balance speed with flexibility. When needed, framework plugins will tap into [Babel](https://babeljs.io/) to compile user code. And during build time Vite currently uses [Rollup](https://rollupjs.org/) where bundling size and having access to a wide ecosystem of plugins are more important than raw speed. Vite will continue to evolve internally, using new libraries as they appear to improve DX while keeping its API stable. +Vite has been focused on performance since its [origins](./why.md). Its dev server architecture allows HMR that stays fast as projects scale. Vite is based on native tools that includes [Oxc toolchain](https://oxc.rs/) and [Rolldown](https://rolldown.rs/) to implement intensive tasks but keeps the rest of the code in JS to balance speed with flexibility. When needed, framework plugins will tap into [Babel](https://babeljs.io/) to compile user code. Thanks to Rolldown's Rollup plugin compatibility, Vite has access to a wide ecosystem of plugins. ## Building Frameworks on Top of Vite diff --git a/docs/guide/rolldown.md b/docs/guide/rolldown.md deleted file mode 100644 index 7413c19ee94888..00000000000000 --- a/docs/guide/rolldown.md +++ /dev/null @@ -1,348 +0,0 @@ -# Rolldown Integration - -Vite is planning to integrate [Rolldown](https://rolldown.rs), a Rust-powered JavaScript bundler, to improve build performance and capabilities. - - - -## What is Rolldown? - -Rolldown is a modern, high-performance JavaScript bundler written in Rust. It's designed as a drop-in replacement for Rollup, aiming to provide significant performance improvements while maintaining compatibility with the existing ecosystem. - -Rolldown focuses on three key principles: - -- **Speed**: Built with Rust for maximum performance -- **Compatibility**: Works with existing Rollup plugins -- **Optimization**: Comes with features that go beyond what esbuild and Rollup implement - -## Why Vite is Migrating to Rolldown - -1. **Unification**: Vite currently uses esbuild for dependency pre-bundling and Rollup for production builds. Rolldown aims to unify these into a single, high-performance bundler that can be used for both purposes, reducing complexity. - -2. **Performance**: Rolldown's Rust-based implementation offers significant performance improvements over JavaScript-based bundlers. While specific benchmarks may vary by project size and complexity, early tests show promising speed increases compared to Rollup. - -3. **Additional Features**: Rolldown introduces features that are not available in Rollup or esbuild, such as advanced chunk splitting control, built-in HMR, and Module Federation. - -For additional insights on the motivations behind Rolldown, see the [reasons why Rolldown is being built](https://rolldown.rs/guide/introduction#why-rolldown). - -## Benefits of Trying `rolldown-vite` - -- Experience significantly faster build times, especially for larger projects -- Provide valuable feedback to help shape the future of Vite's bundling experience -- Prepare your projects for the eventual official Rolldown integration - -## How to Try Rolldown - -The rolldown-powered version of Vite is currently available as a separate package called `rolldown-vite`. If you have `vite` as a direct dependency, you can alias the `vite` package to `rolldown-vite` in your project's `package.json`, which should result in a drop-in replacement. - -```json -{ - "devDependencies": { - "vite": "^7.0.0" // [!code --] - "vite": "npm:rolldown-vite@latest" // [!code ++] - } -} -``` - -::: tip Please pin the version! - -While these examples use `@latest`, we recommend using a specific version number to avoid unexpected breaking changes as [`rolldown-vite` is considered experimental](#versioning-policy). - -::: - -If you use a Vitepress or a meta framework that has Vite as peer dependency, you have to override the `vite` dependency in your `package.json`, which works slightly different depending on your package manager: - -:::code-group - -```json [npm] -{ - "overrides": { - "vite": "npm:rolldown-vite@latest" - } -} -``` - -```json [Yarn] -{ - "resolutions": { - "vite": "npm:rolldown-vite@latest" - } -} -``` - -```json [pnpm] -{ - "pnpm": { - "overrides": { - "vite": "npm:rolldown-vite@latest" - } - } -} -``` - -```json [Bun] -{ - "overrides": { - "vite": "npm:rolldown-vite@latest" - } -} -``` - -::: - -After adding these overrides, reinstall your dependencies and start your development server or build your project as usual. No further configuration changes are required. - -If you are starting a new project, you can use `create-vite` as normal for rolldown-vite, too. The latest version will ask you whether to use `rolldown-vite` or not. - -## Known Limitations - -While Rolldown aims to be a drop-in replacement for Rollup, there are features that are still being implemented and minor intentional behavior differences. For a comprehensive list, please refer to [this GitHub PR](https://github.com/vitejs/rolldown-vite/pull/84#issue-2903144667) which is regularly updated. - -### Option Validation Warnings - -Rolldown outputs an warning when unknown or invalid options are passed. Because some options available in Rollup are not supported by Rolldown, you may encounter warnings based on the options you or the meta framework you use set. Below, you can find an example of such an warning message: - -> Warning validate output options. -> -> - For the "generatedCode". Invalid key: Expected never but received "generatedCode". - -If you don't pass the option in yourself, this must be fixed by the utilized framework. - -### API Differences - -#### `manualChunks` to `advancedChunks` - -While Rolldown has support for the `manualChunks` option that is also exposed by Rollup, it is marked deprecated. Instead of it, Rolldown offers a more fine-grained setting via the [`advancedChunks` option](https://rolldown.rs/in-depth/advanced-chunks), which is more similar to webpack's `splitChunk`: - -```js -// Old configuration (Rollup) -export default { - build: { - rollupOptions: { - output: { - manualChunks(id) { - if (/\/react(?:-dom)?/.test(id)) { - return 'vendor' - } - } - } - } - } -} - -// New configuration (Rolldown) -export default { - build: { - rollupOptions: { - output: { - advancedChunks: { - groups: [{ name: 'vendor', test: /\/react(?:-dom)?/ }] - } - } - } - } -} -``` - -## Performance - -`rolldown-vite` is focused on ensuring compatibility with the existing ecosystem, so defaults are geared towards a smooth transition. You can get further performance gains by switching over to faster Rust-based internal plugins and other customizations. - -### Enabling Native Plugins - -Thanks to Rolldown and Oxc, various internal Vite plugins, such as the alias or resolve plugin, have been converted to Rust. Native plugins are now enabled by default, with the default value set to `'v1'`. - -If you encounter any issues, you can change the `experimental.enableNativePlugin` option in your Vite config to `'resolver'` or `false` as a workaround. Note that this option will be removed in the future. - -### Utilizing Oxc's React refresh transform - -`@vitejs/plugin-react` v5.0.0+ uses Oxc's React refresh transform. If you are not using any Babel plugins (including the React compiler), the full transform would now be done by Oxc and will improve the build performance without any changes other than updating `@vitejs/plugin-react`. - -If you are using `@vitejs/plugin-react-swc` without SWC plugins and custom SWC options, you can switch to the `@vitejs/plugin-react` plugin to utilize Oxc. - -::: details `@vitejs/plugin-react-oxc` plugin is deprecated - -Previously, we recommended using `@vitejs/plugin-react-oxc` to utilize Oxc's React refresh transform. However, we have merged the implementation into `@vitejs/plugin-react` so that it is easier to switch to `rolldown-vite`. `@vitejs/plugin-react-oxc` is now deprecated and will no longer be updated. - -::: - -### `withFilter` Wrapper - -Plugin authors have the option to use the [hook filter feature](#hook-filter-feature) to reduce the communication overhead between the Rust and JavaScript runtimes. -But in case some of the used plugins are not using this feature (yet) but you still want to benefit from it, you can use the `withFilter` wrapper to wrap the plugin with a filter yourself. - -```js -// In your vite.config.ts -import { withFilter, defineConfig } from 'vite' -import svgr from 'vite-plugin-svgr' - -export default defineConfig({ - plugins: [ - // Load the `svgr` plugin only for files which end in `.svg?react` - withFilter( - svgr({ - /*...*/ - }), - { load: { id: /\.svg\?react$/ } }, - ), - ], -}) -``` - -## Reporting Issues - -Since this is an experimental integration, you may encounter issues. If you do, please report them in the [`vitejs/rolldown-vite`](https://github.com/vitejs/rolldown-vite) repository, **not the main Vite repository**. - -When [reporting issues](https://github.com/vitejs/rolldown-vite/issues/new), please follow the appropriate issue template and provide what is requested there, commonly including: - -- A minimal reproduction of the issue -- Your environment details (OS, Node version, package manager) -- Any relevant error messages or logs - -For real-time discussions and troubleshooting, make sure to join the [Rolldown Discord](https://chat.rolldown.rs/). - -## Versioning Policy - -The versioning policy for `rolldown-vite` aligns its major and minor versions with those of the normal Vite package. This synchronization ensures that features present in a specific normal Vite minor release are also included in the corresponding `rolldown-vite` minor release. However, it's important to note that patch versions are not synchronized between the two projects. If you're wondering whether a specific change from normal Vite has been included in `rolldown-vite`, you can always check [`rolldown-vite`'s separate changelog](https://github.com/vitejs/rolldown-vite/blob/rolldown-vite/packages/vite/CHANGELOG.md) for confirmation. - -Furthermore, please be aware that `rolldown-vite` itself is considered experimental. Due to its experimental nature, breaking changes might be introduced even within its patch versions. Additionally, please note that `rolldown-vite` only receives updates for its most recent minor version. Even for important security or bug fixes, patches are not created for older major or minor versions. - -## Future Plans - -The `rolldown-vite` package is a temporary solution to gather feedback and stabilize the Rolldown integration. In the future, this functionality will be merged back into the main Vite repository. - -We encourage you to try out `rolldown-vite` and contribute to its development through feedback and issue reports. - -In the future, we will also introduce a "Full Bundle Mode" for Vite, which will serve bundled files in production _and development mode_. - -### Why introducing a Full Bundle Mode? - -Vite is known for its unbundled dev server approach, which is a main reason for Vite's speed and popularity when it was first introduced. This approach was initially an experiment to see just how far we could push the boundaries of development server performance without traditional bundling. - -However, as projects scale in size and complexity, two main challenges have emerged: - -1. **Development/Production inconsistency**: The unbundled JavaScript served in development versus the bundled production build creates different runtime behaviors. This can lead to issues that only manifest in production, making debugging more difficult. - -2. **Performance degradation during development**: The unbundled approach results in each module being fetched separately, which creates a large number of network requests. While this has _no impact in production_, it causes significant overhead during dev server startup and when refreshing the page in development. The impact is especially noticeable in large applications where hundreds or even thousands of separate requests must be processed. These bottlenecks become even more severe when developers use network proxy, resulting in slower refresh times and degraded developer experience. - -With the Rolldown integration, we have an opportunity to unify the development and production experiences while maintaining Vite's signature performance. A Full Bundle Mode would allow serving bundled files not only in production but also during development, combining the best of both worlds: - -- Fast startup times even for large applications -- Consistent behavior between development and production -- Reduced network overhead on page refreshes -- Maintained efficient HMR on top of ESM output - -When the Full Bundle Mode is introduced, it will be an opt-in feature at first. Similar to the Rolldown integration, we are aiming to make it the default after gathering feedback and ensuring stability. - -## Plugin / Framework Authors Guide - -::: tip -This section is mostly relevant for plugin and framework authors. If you are a user, you can skip this section. -::: - -### Overview of Major Changes - -- Rolldown is used for build (Rollup was used before) -- Rolldown is used for the optimizer (esbuild was used before) -- CommonJS support is handled by Rolldown (@rollup/plugin-commonjs was used before) -- Oxc is used for syntax lowering (esbuild was used before) -- Lightning CSS is used for CSS minification by default (esbuild was used before) -- Oxc minifier is used for JS minification by default (esbuild was used before) -- Rolldown is used for bundling the config (esbuild was used before) - -### Detecting `rolldown-vite` - -::: warning -In most cases, you don't need to detect whether your plugin runs with `rolldown-vite` or `vite` and you should aim for consistent behavior across both, without conditional branching. -::: - -In case you need different behavior with `rolldown-vite`, you have two ways to detect if `rolldown-vite` is used: - -Checking the existence of `this.meta.rolldownVersion`: - -```js -const plugin = { - resolveId() { - if (this.meta.rolldownVersion) { - // logic for rolldown-vite - } else { - // logic for rollup-vite - } - }, -} -``` - -::: tip - -Since Vite 7.0.0, `this.meta` is available in all hooks. In previous versions, `this.meta` was not available in Vite-specific hooks, such as the `config` hook. - -::: - -
- -Checking the existence of the `rolldownVersion` export: - -```js -import * as vite from 'vite' - -if (vite.rolldownVersion) { - // logic for rolldown-vite -} else { - // logic for rollup-vite -} -``` - -If you have `vite` as a dependency (not a peer dependency), the `rolldownVersion` export is useful as it can be used from anywhere in your code. - -### Ignoring option validation in Rolldown - -As [mentioned above](#option-validation-errors), Rolldown outputs a warning when unknown or invalid options are passed. - -This can be fixed by conditionally passing the option by checking whether it's running with `rolldown-vite` as [shown above](#detecting-rolldown-vite). - -### `transformWithEsbuild` requires `esbuild` to be installed separately - -Since Vite itself does not use `esbuild` any more, `esbuild` is now an optional peer dependency. If your plugin uses `transformWithEsbuild`, the plugin needs to add `esbuild` to its dependencies or the user needs to install it manually. - -The recommended migration is to use the newly exported `transformWithOxc` function, which utilizes Oxc instead of `esbuild`. - -### Compatibility layer for `esbuild` options - -Rolldown-Vite has a compatibility layer to convert options for `esbuild` to the respective Oxc or `rolldown` ones. As tested in [the ecosystem-ci](https://github.com/vitejs/vite-ecosystem-ci/blob/rolldown-vite/README-temp.md), this works in many cases, including simple `esbuild` plugins. -That said, **we'll be removing the `esbuild` options support in the future** and encourage you to try the corresponding Oxc or `rolldown` options. -You can get the options set by the compatibility layer from the `configResolved` hook. - -```js -const plugin = { - name: 'log-config', - configResolved(config) { - console.log('options', config.optimizeDeps, config.oxc) - }, -}, -``` - -### Hook filter feature - -Rolldown introduced a [hook filter feature](https://rolldown.rs/apis/plugin-hook-filters) to reduce the communication overhead between the Rust and JavaScript runtimes. This feature allows plugins to specify patterns that determine when hooks should be called, improving performance by avoiding unnecessary hook invocations. - -See the [Hook Filters guide](/guide/api-plugin#hook-filters) for more information. - -### Converting content to JavaScript in `load` or `transform` hooks - -If you are converting the content to JavaScript from other types in `load` or `transform` hooks, you may need to add `moduleType: 'js'` to the returned value. - -```js -const plugin = { - name: 'txt-loader', - load(id) { - if (id.endsWith('.txt')) { - const content = fs.readFile(id, 'utf-8') - return { - code: `export default ${JSON.stringify(content)}`, - moduleType: 'js', // [!code ++] - } - } - }, -} -``` - -This is because [Rolldown supports non-JavaScript modules](https://rolldown.rs/in-depth/module-types) and infers the module type from extensions unless specified. diff --git a/docs/guide/troubleshooting.md b/docs/guide/troubleshooting.md index d8fc7c27645ada..d83b2f514609c2 100644 --- a/docs/guide/troubleshooting.md +++ b/docs/guide/troubleshooting.md @@ -187,7 +187,7 @@ Note that you cannot retry the dynamic import due to browser limitations ([whatw The error may also occur if the browser extensions (like ad-blockers) are blocking that request. -It might be possible to work around by selecting a different chunk name by [`build.rollupOptions.output.chunkFileNames`](../config/build-options.md#build-rollupoptions), as these extensions often block requests based on file names (e.g. names containing `ad`, `track`). +It might be possible to work around by selecting a different chunk name by [`build.rolldownOptions.output.chunkFileNames`](../config/build-options.md#build-rolldownoptions), as these extensions often block requests based on file names (e.g. names containing `ad`, `track`). ## Optimized Dependencies diff --git a/docs/package.json b/docs/package.json index f345417c23d3f3..da7be657d2fdb4 100644 --- a/docs/package.json +++ b/docs/package.json @@ -14,6 +14,7 @@ "feed": "^5.1.0", "gsap": "^3.13.0", "markdown-it-image-size": "^15.0.1", + "oxc-minify": "^0.101.0", "vitepress": "^2.0.0-alpha.15", "vitepress-plugin-group-icons": "^1.6.5", "vitepress-plugin-llms": "^1.9.3", diff --git a/docs/plugins/index.md b/docs/plugins/index.md index 041e91db2a68d7..36f25c00e33e3f 100644 --- a/docs/plugins/index.md +++ b/docs/plugins/index.md @@ -18,11 +18,11 @@ Provides Vue 3 JSX support (via [dedicated Babel transform](https://github.com/v ### [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react) -Uses esbuild and Babel, achieving fast HMR with a small package footprint and the flexibility of being able to use the Babel transform pipeline. Without additional Babel plugins, only esbuild is used during builds. +Uses [Oxc Transformer](https://oxc.rs/docs/guide/usage/transformer) and [Babel](https://babeljs.io/), achieving fast HMR with a small package footprint and the flexibility of being able to use the Babel transform pipeline. Without additional Babel plugins, only Oxc Transformer is used. ### [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc) -Replaces Babel with SWC during development. During production builds, SWC+esbuild are used when using plugins, and esbuild only otherwise. For big projects that don't require non-standard React extensions, cold start and Hot Module Replacement (HMR) can be significantly faster. +Replaces Babel with [SWC](https://swc.rs/) during development. During production builds, SWC+Oxc Transformer are used when using plugins, and Oxc Transformer only otherwise. For big projects that requires custom plugins, cold start and Hot Module Replacement (HMR) can be significantly faster, if the plugin is also available for SWC. ### [@vitejs/plugin-rsc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-rsc) @@ -42,6 +42,12 @@ Provides legacy browsers support for the production build. Check out [awesome-vite](https://github.com/vitejs/awesome-vite#plugins) - you can also submit a PR to list your plugins there. +## Rolldown Builtin Plugins + +Vite uses [Rolldown](https://rolldown.rs/) under the hood and it provides a few builtin plugins for common use cases. + +Read the [Rolldown Builtin Plugins section](https://rolldown.rs/builtin-plugins/) for more information. + ## Rollup Plugins [Vite plugins](../guide/api-plugin) are an extension of Rollup's plugin interface. Check out the [Rollup Plugin Compatibility section](../guide/api-plugin#rollup-plugin-compatibility) for more information. diff --git a/docs/public/_redirects b/docs/public/_redirects index da5acd461fa5a9..1c62c409870b05 100644 --- a/docs/public/_redirects +++ b/docs/public/_redirects @@ -7,6 +7,8 @@ https://vitejs.dev/* https://vite.dev/:splat 301! /guide/api-vite-environment.html /guide/api-environment 301 /guide/comparisons /guide/why#how-vite-relates-to-other-unbundled-build-tools 301 /guide/comparisons.html /guide/why#how-vite-relates-to-other-unbundled-build-tools 301 +/guide/rolldown https://v7.vite.dev/guide/rolldown 301 +/guide/rolldown.html https://v7.vite.dev/guide/rolldown 301 # llms.txt /*.txt /:splat.md 301 diff --git a/docs/releases.md b/docs/releases.md index 83271f97f3f7d1..4491eeaccd1c63 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -43,10 +43,6 @@ We may ship incompatible changes to TypeScript definitions between minor version - Occasionally we may need to adopt features that are only available in a newer version of TypeScript, raising the minimum required version of TypeScript. - If you are using TypeScript, you can use a semver range that locks the current minor and manually upgrade when a new minor version of Vite is released. -### esbuild - -[esbuild](https://esbuild.github.io/) is pre-1.0.0 and sometimes it has a breaking change we may need to include to have access to newer features and performance improvements. We may bump the esbuild's version in a Vite Minor. - ### Node.js non-LTS versions Non-LTS Node.js versions (odd-numbered) are not tested as part of Vite's CI, but they should still work before their [EOL](https://endoflife.date/nodejs). diff --git a/eslint.config.js b/eslint.config.js index d6408e3a4540e4..02b8b07da93455 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -99,6 +99,8 @@ export default defineConfig( { allowModules: [ 'vite', + 'esbuild', + 'rolldown', 'less', 'sass', 'sass-embedded', diff --git a/package.json b/package.json index 0e7784d4e2c907..41617de11afb44 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "picocolors": "^1.1.1", "playwright-chromium": "^1.57.0", "prettier": "3.7.3", - "rolldown": "^1.0.0-beta.52", + "rolldown": "1.0.0-beta.53", "rollup": "^4.43.0", "simple-git-hooks": "^2.13.1", "tsx": "^4.21.0", diff --git a/packages/create-vite/template-lit-ts/package.json b/packages/create-vite/template-lit-ts/package.json index 43ffc5003125fa..7fabcd9e274a12 100644 --- a/packages/create-vite/template-lit-ts/package.json +++ b/packages/create-vite/template-lit-ts/package.json @@ -13,6 +13,6 @@ }, "devDependencies": { "typescript": "~5.9.3", - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" } } diff --git a/packages/create-vite/template-lit/package.json b/packages/create-vite/template-lit/package.json index 737bea1160ef20..cd40fb2a16b2d6 100644 --- a/packages/create-vite/template-lit/package.json +++ b/packages/create-vite/template-lit/package.json @@ -12,6 +12,6 @@ "lit": "^3.3.1" }, "devDependencies": { - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" } } diff --git a/packages/create-vite/template-preact-ts/package.json b/packages/create-vite/template-preact-ts/package.json index 5a6675d9cd3832..92762566abb1b3 100644 --- a/packages/create-vite/template-preact-ts/package.json +++ b/packages/create-vite/template-preact-ts/package.json @@ -15,6 +15,6 @@ "@preact/preset-vite": "^2.10.2", "@types/node": "^24.10.1", "typescript": "~5.9.3", - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" } } diff --git a/packages/create-vite/template-preact/package.json b/packages/create-vite/template-preact/package.json index 990170d0c5854e..fbdec6b0f72e3d 100644 --- a/packages/create-vite/template-preact/package.json +++ b/packages/create-vite/template-preact/package.json @@ -13,6 +13,6 @@ }, "devDependencies": { "@preact/preset-vite": "^2.10.2", - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" } } diff --git a/packages/create-vite/template-qwik-ts/package.json b/packages/create-vite/template-qwik-ts/package.json index 213ef41fd79c85..e47646c107479f 100644 --- a/packages/create-vite/template-qwik-ts/package.json +++ b/packages/create-vite/template-qwik-ts/package.json @@ -12,7 +12,7 @@ "@types/node": "^24.10.1", "serve": "^14.2.5", "typescript": "~5.9.3", - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" }, "dependencies": { "@builder.io/qwik": "^1.17.2" diff --git a/packages/create-vite/template-qwik/package.json b/packages/create-vite/template-qwik/package.json index 3ed246b425d186..c77a43f9b12ded 100644 --- a/packages/create-vite/template-qwik/package.json +++ b/packages/create-vite/template-qwik/package.json @@ -10,7 +10,7 @@ }, "devDependencies": { "serve": "^14.2.5", - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" }, "dependencies": { "@builder.io/qwik": "^1.17.2" diff --git a/packages/create-vite/template-react-ts/package.json b/packages/create-vite/template-react-ts/package.json index a791b67032f72b..09ac3008c7dc78 100644 --- a/packages/create-vite/template-react-ts/package.json +++ b/packages/create-vite/template-react-ts/package.json @@ -25,6 +25,6 @@ "globals": "^16.5.0", "typescript": "~5.9.3", "typescript-eslint": "^8.48.0", - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" } } diff --git a/packages/create-vite/template-react/package.json b/packages/create-vite/template-react/package.json index 13c98cff65ff0e..1a39671a8b7780 100644 --- a/packages/create-vite/template-react/package.json +++ b/packages/create-vite/template-react/package.json @@ -22,6 +22,6 @@ "eslint-plugin-react-hooks": "^7.0.1", "eslint-plugin-react-refresh": "^0.4.24", "globals": "^16.5.0", - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" } } diff --git a/packages/create-vite/template-solid-ts/package.json b/packages/create-vite/template-solid-ts/package.json index 01ec3a86a70440..c7ed0f86792e19 100644 --- a/packages/create-vite/template-solid-ts/package.json +++ b/packages/create-vite/template-solid-ts/package.json @@ -14,7 +14,7 @@ "devDependencies": { "@types/node": "^24.10.1", "typescript": "~5.9.3", - "vite": "^7.2.4", + "vite": "npm:rolldown-vite@^7.2.10", "vite-plugin-solid": "^2.11.10" } } diff --git a/packages/create-vite/template-solid/package.json b/packages/create-vite/template-solid/package.json index 728d8a50948e43..9aa04badce9f87 100644 --- a/packages/create-vite/template-solid/package.json +++ b/packages/create-vite/template-solid/package.json @@ -12,7 +12,7 @@ "solid-js": "^1.9.10" }, "devDependencies": { - "vite": "^7.2.4", + "vite": "npm:rolldown-vite@^7.2.10", "vite-plugin-solid": "^2.11.10" } } diff --git a/packages/create-vite/template-svelte-ts/package.json b/packages/create-vite/template-svelte-ts/package.json index 23fb16a2b66540..b7f6482fe7ddaa 100644 --- a/packages/create-vite/template-svelte-ts/package.json +++ b/packages/create-vite/template-svelte-ts/package.json @@ -16,6 +16,6 @@ "svelte": "^5.45.2", "svelte-check": "^4.3.4", "typescript": "~5.9.3", - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" } } diff --git a/packages/create-vite/template-svelte/package.json b/packages/create-vite/template-svelte/package.json index eca27396fe0c3f..a3e199a26c0f35 100644 --- a/packages/create-vite/template-svelte/package.json +++ b/packages/create-vite/template-svelte/package.json @@ -11,6 +11,6 @@ "devDependencies": { "@sveltejs/vite-plugin-svelte": "^6.2.1", "svelte": "^5.45.2", - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" } } diff --git a/packages/create-vite/template-vanilla-ts/package.json b/packages/create-vite/template-vanilla-ts/package.json index bfec297f1c27fe..58617d40022e95 100644 --- a/packages/create-vite/template-vanilla-ts/package.json +++ b/packages/create-vite/template-vanilla-ts/package.json @@ -10,6 +10,6 @@ }, "devDependencies": { "typescript": "~5.9.3", - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" } } diff --git a/packages/create-vite/template-vanilla/package.json b/packages/create-vite/template-vanilla/package.json index 4dbbd9b42cb57d..b3feba182c68d0 100644 --- a/packages/create-vite/template-vanilla/package.json +++ b/packages/create-vite/template-vanilla/package.json @@ -9,6 +9,6 @@ "preview": "vite preview" }, "devDependencies": { - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" } } diff --git a/packages/create-vite/template-vue-ts/package.json b/packages/create-vite/template-vue-ts/package.json index 543e64bc8aed97..15be1c128a9753 100644 --- a/packages/create-vite/template-vue-ts/package.json +++ b/packages/create-vite/template-vue-ts/package.json @@ -16,7 +16,7 @@ "@vitejs/plugin-vue": "^6.0.2", "@vue/tsconfig": "^0.8.1", "typescript": "~5.9.3", - "vite": "^7.2.4", + "vite": "npm:rolldown-vite@^7.2.10", "vue-tsc": "^3.1.5" } } diff --git a/packages/create-vite/template-vue/package.json b/packages/create-vite/template-vue/package.json index caffe14c053213..1c2663da966bdb 100644 --- a/packages/create-vite/template-vue/package.json +++ b/packages/create-vite/template-vue/package.json @@ -13,6 +13,6 @@ }, "devDependencies": { "@vitejs/plugin-vue": "^6.0.2", - "vite": "^7.2.4" + "vite": "npm:rolldown-vite@^7.2.10" } } diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index 5f6e8fe1df3539..3555d6448cf888 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -3,7 +3,6 @@ import crypto from 'node:crypto' import { createRequire } from 'node:module' import { fileURLToPath } from 'node:url' import { build, normalizePath } from 'vite' -import * as vite from 'vite' import MagicString from 'magic-string' import type { BuildOptions, @@ -139,14 +138,10 @@ const modernTargetsEsbuild = [ const modernTargetsBabel = 'edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12' -function viteLegacyPlugin(options: Options = {}): Plugin[] { - if ('rolldownVersion' in vite) { - const { default: viteLegacyPluginForRolldownVite } = _require( - '#legacy-for-rolldown-vite', - ) - return viteLegacyPluginForRolldownVite(options) - } +const outputOptionsForLegacyChunks = + new WeakSet() +function viteLegacyPlugin(options: Options = {}): Plugin[] { let config: ResolvedConfig let targets: Options['targets'] const modernTargets: Options['modernTargets'] = @@ -305,7 +300,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { ) } - if (!isLegacyBundle(bundle, opts)) { + if (!isLegacyBundle(bundle)) { // Merge discovered modern polyfills to `modernPolyfills` for (const { modern } of chunkFileNameToPolyfills.values()) { modern.forEach((p) => modernPolyfills.add(p)) @@ -320,6 +315,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { ) } await buildPolyfillChunk( + this, config.mode, modernPolyfills, bundle, @@ -363,6 +359,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { } await buildPolyfillChunk( + this, config.mode, legacyPolyfills, bundle, @@ -449,9 +446,10 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { ): Rollup.OutputOptions => { return { ...options, - format: 'system', + format: 'esm', entryFileNames: getLegacyOutputFileName(options.entryFileNames), chunkFileNames: getLegacyOutputFileName(options.chunkFileNames), + minify: false, // minify with terser instead } } @@ -468,6 +466,11 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { ...(genModern ? [output || {}] : []), ] } + + // @ts-expect-error is readonly but should be injected here + _config.isOutputOptionsForLegacyChunks = ( + opts: Rollup.NormalizedOutputOptions, + ): boolean => outputOptionsForLegacyChunks.has(opts) }, async renderChunk(raw, chunk, opts, { chunks }) { @@ -494,7 +497,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { ) } - if (!isLegacyChunk(chunk, opts)) { + if (!isLegacyChunk(chunk)) { if ( options.modernPolyfills && !Array.isArray(options.modernPolyfills) && @@ -543,20 +546,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { return null } - // @ts-expect-error avoid esbuild transform on legacy chunks since it produces - // legacy-unsafe code - e.g. rewriting object properties into shorthands - opts.__vite_skip_esbuild__ = true - - // @ts-expect-error force terser for legacy chunks. This only takes effect if - // minification isn't disabled, because that leaves out the terser plugin - // entirely. - opts.__vite_force_terser__ = true - - // @ts-expect-error In the `generateBundle` hook, - // we'll delete the assets from the legacy bundle to avoid emitting duplicate assets. - // But that's still a waste of computing resource. - // So we add this flag to avoid emitting the asset in the first place whenever possible. - opts.__vite_skip_asset_emit__ = true + outputOptionsForLegacyChunks.add(opts) // avoid emitting assets for legacy bundle const needPolyfills = @@ -565,9 +555,27 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { // transform the legacy chunk with @babel/preset-env const sourceMaps = !!config.build.sourcemap const babel = await loadBabel() - const result = babel.transform(raw, { + + // need to transform into systemjs separately from other plugins + // for preset-env polyfill detection and removal + const resultSystem = babel.transform(raw, { babelrc: false, configFile: false, + ast: true, + code: false, + sourceMaps, + plugins: [ + // @ts-expect-error -- not typed + (await import('@babel/plugin-transform-dynamic-import')).default, + // @ts-expect-error -- not typed + (await import('@babel/plugin-transform-modules-systemjs')).default, + ], + }) + + const babelTransformOptions: babel.TransformOptions = { + babelrc: false, + configFile: false, + cloneInputAst: false, compact: !!config.build.minify, sourceMaps, inputSourceMap: undefined, @@ -602,8 +610,17 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { }, ], ], - }) - + } + let result: babel.BabelFileResult | null + if (resultSystem) { + result = babel.transformFromAstSync( + resultSystem.ast!, + undefined, + babelTransformOptions, + ) + } else { + result = babel.transform(raw, babelTransformOptions) + } if (result) return { code: result.code!, map: result.map } return null }, @@ -743,15 +760,19 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { } }, - generateBundle(opts, bundle) { + generateBundle(_opts, bundle) { if (config.build.ssr) { return } - if (isLegacyBundle(bundle, opts) && genModern) { + if (isLegacyBundle(bundle) && genModern) { // avoid emitting duplicate assets for (const name in bundle) { - if (bundle[name].type === 'asset' && !name.endsWith('.map')) { + if ( + bundle[name].type === 'asset' && + !name.endsWith('.map') && + !name.includes('-legacy') // legacy chunks + ) { delete bundle[name] } } @@ -809,6 +830,7 @@ export async function detectPolyfills( } async function buildPolyfillChunk( + ctx: Rollup.PluginContext, mode: string, imports: Set, bundle: Rollup.OutputBundle, @@ -877,7 +899,11 @@ async function buildPolyfillChunk( } // add the chunk to the bundle - bundle[polyfillChunk.fileName] = polyfillChunk + ctx.emitFile({ + type: 'asset', + fileName: polyfillChunk.fileName, + source: polyfillChunk.code, + }) if (polyfillChunk.sourcemapFileName) { const polyfillChunkMapAsset = _polyfillChunk.output.find( (chunk) => @@ -885,7 +911,11 @@ async function buildPolyfillChunk( chunk.fileName === polyfillChunk.sourcemapFileName, ) as Rollup.OutputAsset | undefined if (polyfillChunkMapAsset) { - bundle[polyfillChunk.sourcemapFileName] = polyfillChunkMapAsset + ctx.emitFile({ + type: 'asset', + fileName: polyfillChunkMapAsset.fileName, + source: polyfillChunkMapAsset.source, + }) } } } @@ -936,26 +966,16 @@ function prependModenChunkLegacyGuardPlugin(): Plugin { } } -function isLegacyChunk( - chunk: Rollup.RenderedChunk, - options: Rollup.NormalizedOutputOptions, -) { - return options.format === 'system' && chunk.fileName.includes('-legacy') +function isLegacyChunk(chunk: Rollup.RenderedChunk) { + return chunk.fileName.includes('-legacy') } -function isLegacyBundle( - bundle: Rollup.OutputBundle, - options: Rollup.NormalizedOutputOptions, -) { - if (options.format === 'system') { - const entryChunk = Object.values(bundle).find( - (output) => output.type === 'chunk' && output.isEntry, - ) - - return !!entryChunk && entryChunk.fileName.includes('-legacy') - } +function isLegacyBundle(bundle: Rollup.OutputBundle) { + const entryChunk = Object.values(bundle).find( + (output) => output.type === 'chunk' && output.isEntry, + ) - return false + return !!entryChunk && entryChunk.fileName.includes('-legacy') } function recordAndRemovePolyfillBabelPlugin( diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 11a7d3df27fa57..a15e3478771025 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -1,466 +1,843 @@ -## [7.2.6](https://github.com/vitejs/vite/compare/v7.2.5...v7.2.6) (2025-12-01) -## [7.2.5](https://github.com/vitejs/vite/compare/v7.2.4...v7.2.5) (2025-12-01) -### Bug Fixes +## [7.2.10](https://github.com/vitejs/rolldown-vite/compare/v7.2.9...v7.2.10) (2025-12-03) +### Features -* **config:** handle shebang properly ([#21158](https://github.com/vitejs/vite/issues/21158)) ([df5a30d](https://github.com/vitejs/vite/commit/df5a30d2690a2ebc4824a79becdcef30538dc602)) -* **deps:** update all non-major dependencies ([#21146](https://github.com/vitejs/vite/issues/21146)) ([a3cd262](https://github.com/vitejs/vite/commit/a3cd262f37228967e455617e982b35fccc49ffe9)) -* **deps:** update all non-major dependencies ([#21175](https://github.com/vitejs/vite/issues/21175)) ([72e398a](https://github.com/vitejs/vite/commit/72e398a46d8d2f54fbcbeb9ff0dceab346aeb642)) -* fix `external: true` merging ([#21164](https://github.com/vitejs/vite/issues/21164)) ([5ef557a](https://github.com/vitejs/vite/commit/5ef557a96c4a1f2b3a3aa25c12df3ee87b4a03f5)) -* shortcuts not rebound after server restart ([#21166](https://github.com/vitejs/vite/issues/21166)) ([3765f7b](https://github.com/vitejs/vite/commit/3765f7baea36234bf3816eeed38776d27bfd3649)) +* deprecate `build.commonjsOptions` ([#530](https://github.com/vitejs/rolldown-vite/issues/530)) ([9cb6db9](https://github.com/vitejs/rolldown-vite/commit/9cb6db963b946f7b19e7fcd51c313f1a9dbbba4e)) +* update rolldown to 1.0.0-beta.53 ([#537](https://github.com/vitejs/rolldown-vite/issues/537)) ([d488ed4](https://github.com/vitejs/rolldown-vite/commit/d488ed49a0ef2d0df73aeda2f07c6de012e1b5ba)) -### Performance Improvements +### Bug Fixes -* **deps:** replace debug with obug ([#21137](https://github.com/vitejs/vite/issues/21137)) ([203a551](https://github.com/vitejs/vite/commit/203a5512a42a1031f685993f5d9cbae5f328354f)) +* disable resolver cache when watcher is disabled ([#471](https://github.com/vitejs/rolldown-vite/issues/471)) ([7d8436c](https://github.com/vitejs/rolldown-vite/commit/7d8436c6ec72f440166101aa91a0dcc2c3af7573)) ### Documentation -* clarify manifest.json `imports` field is JS chunks only ([#21136](https://github.com/vitejs/vite/issues/21136)) ([46d3077](https://github.com/vitejs/vite/commit/46d3077f2b63771cc50230bc907c48f5773c00fb)) +* update content for beta ([#529](https://github.com/vitejs/rolldown-vite/issues/529)) ([0e6179b](https://github.com/vitejs/rolldown-vite/commit/0e6179b167ce70475121b852ca5d23555f621c61)) + +### Tests + +* remove failure expected cases ([#536](https://github.com/vitejs/rolldown-vite/issues/536)) ([308fcf6](https://github.com/vitejs/rolldown-vite/commit/308fcf659a9bb60a3df0f2e36d59bfeb8bfc5cdb)) + +## [7.2.9](https://github.com/vitejs/rolldown-vite/compare/v7.2.8...v7.2.9) (2025-12-01) +### Bug Fixes + +* **config:** handle shebang properly ([#21158](https://github.com/vitejs/rolldown-vite/issues/21158)) ([df5a30d](https://github.com/vitejs/rolldown-vite/commit/df5a30d2690a2ebc4824a79becdcef30538dc602)) +* **deps:** update all non-major dependencies ([#21175](https://github.com/vitejs/rolldown-vite/issues/21175)) ([72e398a](https://github.com/vitejs/rolldown-vite/commit/72e398a46d8d2f54fbcbeb9ff0dceab346aeb642)) +* fix `external: true` merging ([#21164](https://github.com/vitejs/rolldown-vite/issues/21164)) ([5ef557a](https://github.com/vitejs/rolldown-vite/commit/5ef557a96c4a1f2b3a3aa25c12df3ee87b4a03f5)) +* shortcuts not rebound after server restart ([#21166](https://github.com/vitejs/rolldown-vite/issues/21166)) ([3765f7b](https://github.com/vitejs/rolldown-vite/commit/3765f7baea36234bf3816eeed38776d27bfd3649)) ### Miscellaneous Chores -* **deps:** update rolldown-related dependencies ([#21174](https://github.com/vitejs/vite/issues/21174)) ([74559c9](https://github.com/vitejs/vite/commit/74559c947483a8ee24da052ac2d9568f7cb3546a)) +* **deps:** update rolldown-related dependencies ([#21174](https://github.com/vitejs/rolldown-vite/issues/21174)) ([74559c9](https://github.com/vitejs/rolldown-vite/commit/74559c947483a8ee24da052ac2d9568f7cb3546a)) + +## [7.2.8](https://github.com/vitejs/rolldown-vite/compare/v7.2.7...v7.2.8) (2025-11-26) +### Features + +* update rolldown to 1.0.0-beta.52 ([#522](https://github.com/vitejs/rolldown-vite/issues/522)) ([a64ade3](https://github.com/vitejs/rolldown-vite/commit/a64ade3027b21f149d3e7e9e3784337b236d6373)) -## [7.2.4](https://github.com/vitejs/vite/compare/v7.2.3...v7.2.4) (2025-11-20) ### Bug Fixes -* revert "perf(deps): replace debug with obug ([#21107](https://github.com/vitejs/vite/issues/21107))" ([2d66b7b](https://github.com/vitejs/vite/commit/2d66b7b14aa6dfd62f3d6a59ee8382ed5ca6fd32)) +* `inconsistentCjsInterop: true` should affect dynamic imports as well ([#521](https://github.com/vitejs/rolldown-vite/issues/521)) ([38a8609](https://github.com/vitejs/rolldown-vite/commit/38a86096ff71426b044e985dba8db5b3abcf5782)) +* **deps:** update all non-major dependencies ([#21146](https://github.com/vitejs/rolldown-vite/issues/21146)) ([a3cd262](https://github.com/vitejs/rolldown-vite/commit/a3cd262f37228967e455617e982b35fccc49ffe9)) -## [7.2.3](https://github.com/vitejs/vite/compare/v7.2.2...v7.2.3) (2025-11-20) +### Performance Improvements + +* **deps:** replace debug with obug ([#21137](https://github.com/vitejs/rolldown-vite/issues/21137)) ([203a551](https://github.com/vitejs/rolldown-vite/commit/203a5512a42a1031f685993f5d9cbae5f328354f)) + +### Documentation + +* clarify manifest.json `imports` field is JS chunks only ([#21136](https://github.com/vitejs/rolldown-vite/issues/21136)) ([46d3077](https://github.com/vitejs/rolldown-vite/commit/46d3077f2b63771cc50230bc907c48f5773c00fb)) + +## [7.2.7](https://github.com/vitejs/rolldown-vite/compare/v7.2.6...v7.2.7) (2025-11-20) ### Bug Fixes -* allow multiple `bindCLIShortcuts` calls with shortcut merging ([#21103](https://github.com/vitejs/vite/issues/21103)) ([5909efd](https://github.com/vitejs/vite/commit/5909efd8fbfd1bf1eab65427aea0613124b2797a)) -* **deps:** update all non-major dependencies ([#21096](https://github.com/vitejs/vite/issues/21096)) ([6a34ac3](https://github.com/vitejs/vite/commit/6a34ac3422686e7cf7cc9a25d299cb8e5a8d92a0)) -* **deps:** update all non-major dependencies ([#21128](https://github.com/vitejs/vite/issues/21128)) ([4f8171e](https://github.com/vitejs/vite/commit/4f8171eb3046bd70c83964689897dab4c6b58bc0)) +* allow multiple `bindCLIShortcuts` calls with shortcut merging ([#21103](https://github.com/vitejs/rolldown-vite/issues/21103)) ([5909efd](https://github.com/vitejs/rolldown-vite/commit/5909efd8fbfd1bf1eab65427aea0613124b2797a)) +* **deps:** update all non-major dependencies ([#21096](https://github.com/vitejs/rolldown-vite/issues/21096)) ([6a34ac3](https://github.com/vitejs/rolldown-vite/commit/6a34ac3422686e7cf7cc9a25d299cb8e5a8d92a0)) +* **deps:** update all non-major dependencies ([#21128](https://github.com/vitejs/rolldown-vite/issues/21128)) ([4f8171e](https://github.com/vitejs/rolldown-vite/commit/4f8171eb3046bd70c83964689897dab4c6b58bc0)) +* esbuild plugin converter with empty JS files. ([#516](https://github.com/vitejs/rolldown-vite/issues/516)) ([54cfc00](https://github.com/vitejs/rolldown-vite/commit/54cfc006ce2456adeabbdd55a99bcd221af7332f)) +* revert "perf(deps): replace debug with obug ([#21107](https://github.com/vitejs/rolldown-vite/issues/21107))" ([2d66b7b](https://github.com/vitejs/rolldown-vite/commit/2d66b7b14aa6dfd62f3d6a59ee8382ed5ca6fd32)) ### Performance Improvements -* **deps:** replace debug with obug ([#21107](https://github.com/vitejs/vite/issues/21107)) ([acfe939](https://github.com/vitejs/vite/commit/acfe939e1f7c303c34b0b39b883cc302da767fa2)) +* **deps:** replace debug with obug ([#21107](https://github.com/vitejs/rolldown-vite/issues/21107)) ([acfe939](https://github.com/vitejs/rolldown-vite/commit/acfe939e1f7c303c34b0b39b883cc302da767fa2)) ### Miscellaneous Chores -* **deps:** update dependency @rollup/plugin-commonjs to v29 ([#21099](https://github.com/vitejs/vite/issues/21099)) ([02ceaec](https://github.com/vitejs/vite/commit/02ceaec45e17bef19159188a28d9196fed1761be)) -* **deps:** update rolldown-related dependencies ([#21095](https://github.com/vitejs/vite/issues/21095)) ([39a0a15](https://github.com/vitejs/vite/commit/39a0a15fd24ed37257c48b795097a3794e54d255)) -* **deps:** update rolldown-related dependencies ([#21127](https://github.com/vitejs/vite/issues/21127)) ([5029720](https://github.com/vitejs/vite/commit/50297208452241061cb44d09a4bbdf77a11ac01e)) +* **deps:** update dependency @rollup/plugin-commonjs to v29 ([#21099](https://github.com/vitejs/rolldown-vite/issues/21099)) ([02ceaec](https://github.com/vitejs/rolldown-vite/commit/02ceaec45e17bef19159188a28d9196fed1761be)) +* **deps:** update rolldown-related dependencies ([#21095](https://github.com/vitejs/rolldown-vite/issues/21095)) ([39a0a15](https://github.com/vitejs/rolldown-vite/commit/39a0a15fd24ed37257c48b795097a3794e54d255)) +* **deps:** update rolldown-related dependencies ([#21127](https://github.com/vitejs/rolldown-vite/issues/21127)) ([5029720](https://github.com/vitejs/rolldown-vite/commit/50297208452241061cb44d09a4bbdf77a11ac01e)) + +## [7.2.6](https://github.com/vitejs/rolldown-vite/compare/v7.2.5...v7.2.6) (2025-11-19) +### Features + +* update rolldown to 1.0.0-beta.51 ([#512](https://github.com/vitejs/rolldown-vite/issues/512)) ([22bd8e5](https://github.com/vitejs/rolldown-vite/commit/22bd8e5eafd8ddef52f3a28cfb6a1aa7ba0446f4)) + +## [7.2.5](https://github.com/vitejs/rolldown-vite/compare/v7.2.4...v7.2.5) (2025-11-12) +### Features + +* update rolldown to 1.0.0-beta.50 ([#508](https://github.com/vitejs/rolldown-vite/issues/508)) ([c23e699](https://github.com/vitejs/rolldown-vite/commit/c23e699c4ee151814c63df2194a84371e9b00b97)) + +## [7.2.4](https://github.com/vitejs/rolldown-vite/compare/v7.2.3...v7.2.4) (2025-11-11) +### ⚠ BREAKING CHANGES + +* change `minify` to be async (#505) + +### Features + +* change `minify` to be async ([#505](https://github.com/vitejs/rolldown-vite/issues/505)) ([ec441fc](https://github.com/vitejs/rolldown-vite/commit/ec441fc2135d450ba724b0fc4d68c1cd6984a918)) +* expose `parse` / `parseAsync` ([#503](https://github.com/vitejs/rolldown-vite/issues/503)) ([1ffb4ea](https://github.com/vitejs/rolldown-vite/commit/1ffb4ead4d855d1bfa6a218101cfba226d51a887)) -## [7.2.2](https://github.com/vitejs/vite/compare/v7.2.1...v7.2.2) (2025-11-07) ### Bug Fixes -* revert "refactor: use fs.cpSync ([#21019](https://github.com/vitejs/vite/issues/21019))" ([#21081](https://github.com/vitejs/vite/issues/21081)) ([728c8ee](https://github.com/vitejs/vite/commit/728c8eeebc0ad7ba48e680f46bbdb55020b2e152)) +* don't set `ssr.optimizeDeps.rollupOptions` compat if `ssr` option is not set ([#506](https://github.com/vitejs/rolldown-vite/issues/506)) ([8e32f61](https://github.com/vitejs/rolldown-vite/commit/8e32f61cbed914bf75e945e4b2af96fdd0e49222)) -## [7.2.1](https://github.com/vitejs/vite/compare/v7.2.0...v7.2.1) (2025-11-06) +### Code Refactoring + +* runtime deprecate `optimizeDeps.rollupOptions` ([#507](https://github.com/vitejs/rolldown-vite/issues/507)) ([46a6777](https://github.com/vitejs/rolldown-vite/commit/46a6777607968644cee79434bd465cfeb6c285b9)) + +## [7.2.3](https://github.com/vitejs/rolldown-vite/compare/v7.2.2...v7.2.3) (2025-11-11) +### Features + +* update rolldown ([#502](https://github.com/vitejs/rolldown-vite/issues/502)) ([242b321](https://github.com/vitejs/rolldown-vite/commit/242b3215bee94c7109c48caf5900edaa806800dc)) + +## [7.2.2](https://github.com/vitejs/rolldown-vite/compare/v7.2.1...v7.2.2) (2025-11-07) +### Features + +* convert `esbuild.jsxSideEffects` to `oxc.jsx.pure` ([#493](https://github.com/vitejs/rolldown-vite/issues/493)) ([feac3af](https://github.com/vitejs/rolldown-vite/commit/feac3afb6091e00b22af1adbc307ca4ad3ad328f)) + +### Bug Fixes + +* **optimizer:** convert to `optimizeDeps.rolldownOptions.transform.define` from `optimizeDeps.esbuildOptions.define` ([#494](https://github.com/vitejs/rolldown-vite/issues/494)) ([e8feb9f](https://github.com/vitejs/rolldown-vite/commit/e8feb9f014c4bd5a22bbee2210ff2bb385309a4d)) +* revert "refactor: use fs.cpSync ([#21019](https://github.com/vitejs/rolldown-vite/issues/21019))" ([#21081](https://github.com/vitejs/rolldown-vite/issues/21081)) ([728c8ee](https://github.com/vitejs/rolldown-vite/commit/728c8eeebc0ad7ba48e680f46bbdb55020b2e152)) +* set `legalComments: 'none'` to align with Vite ([#497](https://github.com/vitejs/rolldown-vite/issues/497)) ([3b8bc55](https://github.com/vitejs/rolldown-vite/commit/3b8bc554d83e9b4aab6876ac91b94ae20ce40080)) + +## [7.2.1](https://github.com/vitejs/rolldown-vite/compare/v7.2.0...v7.2.1) (2025-11-06) ### Bug Fixes -* **worker:** some worker asset was missing ([#21074](https://github.com/vitejs/vite/issues/21074)) ([82d2d6c](https://github.com/vitejs/vite/commit/82d2d6ccf5a69c3d67e44e3704a0c3eb34db2236)) +* **worker:** some worker asset was missing ([#21074](https://github.com/vitejs/rolldown-vite/issues/21074)) ([82d2d6c](https://github.com/vitejs/rolldown-vite/commit/82d2d6ccf5a69c3d67e44e3704a0c3eb34db2236)) ### Code Refactoring -* **build:** rename `indexOfMatchInSlice` to `findPreloadMarker` ([#21054](https://github.com/vitejs/vite/issues/21054)) ([f83264f](https://github.com/vitejs/vite/commit/f83264f5d97caa8ba80276a9ee9e82cb0e69c4ca)) +* **build:** rename `indexOfMatchInSlice` to `findPreloadMarker` ([#21054](https://github.com/vitejs/rolldown-vite/issues/21054)) ([f83264f](https://github.com/vitejs/rolldown-vite/commit/f83264f5d97caa8ba80276a9ee9e82cb0e69c4ca)) -## [7.2.0](https://github.com/vitejs/vite/compare/v7.2.0-beta.1...v7.2.0) (2025-11-05) +## [7.2.0](https://github.com/vitejs/rolldown-vite/compare/v7.2.0-beta.3...v7.2.0) (2025-11-05) ### Bug Fixes -* **css:** fallback to sass when sass-embedded platform binary is missing ([#21002](https://github.com/vitejs/vite/issues/21002)) ([b1fd616](https://github.com/vitejs/vite/commit/b1fd6161886caeb31ac646d6544116d37efe46d0)) -* **module-runner:** make `getBuiltins` response JSON serializable ([#21029](https://github.com/vitejs/vite/issues/21029)) ([ad5b3bf](https://github.com/vitejs/vite/commit/ad5b3bf6f3ad7b24886718c5f5de32eee923ae11)) -* **types:** add undefined to optional properties for exactOptionalProperties type compatibility ([#21040](https://github.com/vitejs/vite/issues/21040)) ([2833c55](https://github.com/vitejs/vite/commit/2833c5576a87be2db450c195ccf64dfc8925a15b)) +* **types:** add undefined to optional properties for exactOptionalProperties type compatibility ([#21040](https://github.com/vitejs/rolldown-vite/issues/21040)) ([2833c55](https://github.com/vitejs/rolldown-vite/commit/2833c5576a87be2db450c195ccf64dfc8925a15b)) ### Miscellaneous Chores -* **deps:** update rolldown-related dependencies ([#21047](https://github.com/vitejs/vite/issues/21047)) ([e3a6a83](https://github.com/vitejs/vite/commit/e3a6a83406943bc59a9916cae3f25ab33c2b5802)) +* **deps:** update rolldown-related dependencies ([#21047](https://github.com/vitejs/rolldown-vite/issues/21047)) ([e3a6a83](https://github.com/vitejs/rolldown-vite/commit/e3a6a83406943bc59a9916cae3f25ab33c2b5802)) + +## [7.2.0-beta.3](https://github.com/vitejs/rolldown-vite/compare/v7.2.0-beta.2...v7.2.0-beta.3) (2025-11-05) +### Features + +* expose `minify` function ([#489](https://github.com/vitejs/rolldown-vite/issues/489)) ([7568ceb](https://github.com/vitejs/rolldown-vite/commit/7568cebffacf38ea223f1d53addaad60f62aaf58)) +* update rolldown ([#488](https://github.com/vitejs/rolldown-vite/issues/488)) ([b2554c1](https://github.com/vitejs/rolldown-vite/commit/b2554c147444924ced5cdd5629f65577c8522a7f)) + +### Bug Fixes + +* **optimizer:** sync `optimizeDeps.rollupOptions` and `optimizeDeps.rolldownOptions` ([#482](https://github.com/vitejs/rolldown-vite/issues/482)) ([23711ec](https://github.com/vitejs/rolldown-vite/commit/23711ec094ac4600010b5c6a9cde465db7cf77b4)) + +## [7.2.0-beta.2](https://github.com/vitejs/rolldown-vite/compare/v7.2.0-beta.1...v7.2.0-beta.2) (2025-11-04) +### Features + +* update rolldown ([#481](https://github.com/vitejs/rolldown-vite/issues/481)) ([f4cfdf4](https://github.com/vitejs/rolldown-vite/commit/f4cfdf490fa0843243875d7b6a7938461d225b50)) -## [7.2.0-beta.1](https://github.com/vitejs/vite/compare/v7.2.0-beta.0...v7.2.0-beta.1) (2025-10-29) +## [7.2.0-beta.1](https://github.com/vitejs/rolldown-vite/compare/v7.2.0-beta.0...v7.2.0-beta.1) (2025-11-04) ### Bug Fixes -* increase stream reset rate limit for HTTP2 ([#21024](https://github.com/vitejs/vite/issues/21024)) ([4f44f22](https://github.com/vitejs/vite/commit/4f44f22f7f4595d74c76778bd522387138775055)) -* **optimizer:** externalize virtual modules for html like files ([#21001](https://github.com/vitejs/vite/issues/21001)) ([e5af352](https://github.com/vitejs/vite/commit/e5af352d8e1a9f187159137f836db5bedbd68a66)) +* **css:** fallback to sass when sass-embedded platform binary is missing ([#21002](https://github.com/vitejs/rolldown-vite/issues/21002)) ([b1fd616](https://github.com/vitejs/rolldown-vite/commit/b1fd6161886caeb31ac646d6544116d37efe46d0)) +* increase stream reset rate limit for HTTP2 ([#21024](https://github.com/vitejs/rolldown-vite/issues/21024)) ([4f44f22](https://github.com/vitejs/rolldown-vite/commit/4f44f22f7f4595d74c76778bd522387138775055)) +* **module-runner:** make `getBuiltins` response JSON serializable ([#21029](https://github.com/vitejs/rolldown-vite/issues/21029)) ([ad5b3bf](https://github.com/vitejs/rolldown-vite/commit/ad5b3bf6f3ad7b24886718c5f5de32eee923ae11)) +* **optimizer:** externalize virtual modules for html like files ([#21001](https://github.com/vitejs/rolldown-vite/issues/21001)) ([e5af352](https://github.com/vitejs/rolldown-vite/commit/e5af352d8e1a9f187159137f836db5bedbd68a66)) +* **optimizer:** support `namespace: 'file'` filter in esbuild plugin compat ([#479](https://github.com/vitejs/rolldown-vite/issues/479)) ([cc36605](https://github.com/vitejs/rolldown-vite/commit/cc3660552e186ceeee9ccc0d2ef2875d1f5e0942)) +* set inferred moduleType for virtual modules ([#470](https://github.com/vitejs/rolldown-vite/issues/470)) ([744ba3e](https://github.com/vitejs/rolldown-vite/commit/744ba3e66392e01d6028b482f8289ce8c5106282)) +* trigger watchChange hook for all environments for native resolver ([#463](https://github.com/vitejs/rolldown-vite/issues/463)) ([4139f2b](https://github.com/vitejs/rolldown-vite/commit/4139f2b17bb0e7edfea66d20d156a3a89cb263a5)) ### Documentation -* clarify the values are escaped automatically ([#21017](https://github.com/vitejs/vite/issues/21017)) ([246df13](https://github.com/vitejs/vite/commit/246df134dd58441e1e40dd361cf42419d05ea7a5)) +* clarify the values are escaped automatically ([#21017](https://github.com/vitejs/rolldown-vite/issues/21017)) ([246df13](https://github.com/vitejs/rolldown-vite/commit/246df134dd58441e1e40dd361cf42419d05ea7a5)) ### Code Refactoring -* use `fs.cpSync` ([#21019](https://github.com/vitejs/vite/issues/21019)) ([a2df778](https://github.com/vitejs/vite/commit/a2df77812814b927880bc4d68aafa8c8fa47daf0)) +* use `fs.cpSync` ([#21019](https://github.com/vitejs/rolldown-vite/issues/21019)) ([a2df778](https://github.com/vitejs/rolldown-vite/commit/a2df77812814b927880bc4d68aafa8c8fa47daf0)) -## [7.2.0-beta.0](https://github.com/vitejs/vite/compare/v7.1.11...v7.2.0-beta.0) (2025-10-28) +## [7.2.0-beta.0](https://github.com/vitejs/rolldown-vite/compare/v7.1.20...v7.2.0-beta.0) (2025-10-28) ### Features -* add `import.meta.resolve` support for ESM config (bundle config loader) ([#20962](https://github.com/vitejs/vite/issues/20962)) ([f86789a](https://github.com/vitejs/vite/commit/f86789a6e237bd0e31cde3a3f09bdef45bfa7d1c)) -* add `perEnvironmentWatchChangeDuringDev` ([#20996](https://github.com/vitejs/vite/issues/20996)) ([a5e98e6](https://github.com/vitejs/vite/commit/a5e98e695ee4152127977abb506029dc8f7544fb)) -* add vite client connect events ([#20978](https://github.com/vitejs/vite/issues/20978)) ([543d87c](https://github.com/vitejs/vite/commit/543d87c2cd1ec629f19de56a903a15185f20db1f)) -* **build:** emit license ([#18546](https://github.com/vitejs/vite/issues/18546)) ([b42c3fb](https://github.com/vitejs/vite/commit/b42c3fb2cb75bb4fdf7557cb35946564d6dc4384)) -* **dev:** support HTTP2 even if proxy feature is used ([#20869](https://github.com/vitejs/vite/issues/20869)) ([fc21af7](https://github.com/vitejs/vite/commit/fc21af7a42dd559a95f54b6165d34f36883eaa7f)) -* **lib:** enable minification but keep pure annotations for es output with terser ([#20522](https://github.com/vitejs/vite/issues/20522)) ([df997d0](https://github.com/vitejs/vite/commit/df997d0cfca8e1dad04ac1bf8119caa2d2e4c1fc)) -* **optimizer:** add rush lockfile support ([#20833](https://github.com/vitejs/vite/issues/20833)) ([718ca2d](https://github.com/vitejs/vite/commit/718ca2d708dbeb393839932437a6b161851ca24c)) -* **utils:** support multiple certificates in resolveServerUrls ([#20707](https://github.com/vitejs/vite/issues/20707)) ([24513e5](https://github.com/vitejs/vite/commit/24513e567c643d5f6fb61af6298aa3fc2b166b90)) +* add `import.meta.resolve` support for ESM config (bundle config loader) ([#20962](https://github.com/vitejs/rolldown-vite/issues/20962)) ([f86789a](https://github.com/vitejs/rolldown-vite/commit/f86789a6e237bd0e31cde3a3f09bdef45bfa7d1c)) +* add `perEnvironmentWatchChangeDuringDev` ([#20996](https://github.com/vitejs/rolldown-vite/issues/20996)) ([a5e98e6](https://github.com/vitejs/rolldown-vite/commit/a5e98e695ee4152127977abb506029dc8f7544fb)) +* add vite client connect events ([#20978](https://github.com/vitejs/rolldown-vite/issues/20978)) ([543d87c](https://github.com/vitejs/rolldown-vite/commit/543d87c2cd1ec629f19de56a903a15185f20db1f)) +* **build:** emit license ([#18546](https://github.com/vitejs/rolldown-vite/issues/18546)) ([b42c3fb](https://github.com/vitejs/rolldown-vite/commit/b42c3fb2cb75bb4fdf7557cb35946564d6dc4384)) +* **dev:** support HTTP2 even if proxy feature is used ([#20869](https://github.com/vitejs/rolldown-vite/issues/20869)) ([fc21af7](https://github.com/vitejs/rolldown-vite/commit/fc21af7a42dd559a95f54b6165d34f36883eaa7f)) +* **lib:** enable minification but keep pure annotations for es output with terser ([#20522](https://github.com/vitejs/rolldown-vite/issues/20522)) ([df997d0](https://github.com/vitejs/rolldown-vite/commit/df997d0cfca8e1dad04ac1bf8119caa2d2e4c1fc)) +* **optimizer:** add rush lockfile support ([#20833](https://github.com/vitejs/rolldown-vite/issues/20833)) ([718ca2d](https://github.com/vitejs/rolldown-vite/commit/718ca2d708dbeb393839932437a6b161851ca24c)) +* **utils:** support multiple certificates in resolveServerUrls ([#20707](https://github.com/vitejs/rolldown-vite/issues/20707)) ([24513e5](https://github.com/vitejs/rolldown-vite/commit/24513e567c643d5f6fb61af6298aa3fc2b166b90)) ### Bug Fixes -* **build:** ensure amd bundles request `require` to be injected ([#20861](https://github.com/vitejs/vite/issues/20861)) ([bb85bd7](https://github.com/vitejs/vite/commit/bb85bd751e4568c707612b708deaba67f8af4ca3)) -* **build:** replace `names` in the manifest with unmangled `name` for CSS assets ([#20585](https://github.com/vitejs/vite/issues/20585)) ([4abf056](https://github.com/vitejs/vite/commit/4abf0566024a70c38a0eb5bf614f72189038247d)) -* **deps:** downgrade commonjs plugin to 28.0.6 to avoid rollup/plugins[#1909](https://github.com/vitejs/vite/issues/1909) ([#20988](https://github.com/vitejs/vite/issues/20988)) ([856e683](https://github.com/vitejs/vite/commit/856e683885ed53ec6044897451608bc6518baef6)) -* **deps:** update all non-major dependencies ([#21008](https://github.com/vitejs/vite/issues/21008)) ([185641e](https://github.com/vitejs/vite/commit/185641e3cdae29277c41eb8028f6eac542215f01)) -* disable optional peer dep handling for `nodeResolveWithVite` ([#20989](https://github.com/vitejs/vite/issues/20989)) ([ca18b23](https://github.com/vitejs/vite/commit/ca18b233d43a8f31883726ca565940ad1dc85f38)) -* handle query parameters for `/@vite/*` modules ([#20998](https://github.com/vitejs/vite/issues/20998)) ([6843a6a](https://github.com/vitejs/vite/commit/6843a6ae49df8ca523104a8ccfb9a8f9602b3881)) -* **module-runner:** resolve `resolvedSources` correctly ([#20959](https://github.com/vitejs/vite/issues/20959)) ([c4f6039](https://github.com/vitejs/vite/commit/c4f6039436657db50c610aa17eaf821dbd4ad57d)) -* **resolve:** match resolved subpath import path's relative prefix with regex (fix [#20972](https://github.com/vitejs/vite/issues/20972)) ([#20973](https://github.com/vitejs/vite/issues/20973)) ([ff2d83e](https://github.com/vitejs/vite/commit/ff2d83e2e7a3f7eba72f41b40686912f1e4b6843)) -* update build log to include environment name ([#20987](https://github.com/vitejs/vite/issues/20987)) ([77c25c1](https://github.com/vitejs/vite/commit/77c25c16ba9f3568e55fd4135f57c70f984d3fdd)) -* use esm entrypoint for css preprocessors and terser ([#20918](https://github.com/vitejs/vite/issues/20918)) ([1460824](https://github.com/vitejs/vite/commit/14608241cc4c821e7a392f6d92ef291a926bd94d)) +* **build:** ensure amd bundles request `require` to be injected ([#20861](https://github.com/vitejs/rolldown-vite/issues/20861)) ([bb85bd7](https://github.com/vitejs/rolldown-vite/commit/bb85bd751e4568c707612b708deaba67f8af4ca3)) +* **build:** replace `names` in the manifest with unmangled `name` for CSS assets ([#20585](https://github.com/vitejs/rolldown-vite/issues/20585)) ([4abf056](https://github.com/vitejs/rolldown-vite/commit/4abf0566024a70c38a0eb5bf614f72189038247d)) +* **deps:** downgrade commonjs plugin to 28.0.6 to avoid rollup/plugins[#1909](https://github.com/vitejs/rolldown-vite/issues/1909) ([#20988](https://github.com/vitejs/rolldown-vite/issues/20988)) ([856e683](https://github.com/vitejs/rolldown-vite/commit/856e683885ed53ec6044897451608bc6518baef6)) +* **deps:** update all non-major dependencies ([#21008](https://github.com/vitejs/rolldown-vite/issues/21008)) ([185641e](https://github.com/vitejs/rolldown-vite/commit/185641e3cdae29277c41eb8028f6eac542215f01)) +* disable optional peer dep handling for `nodeResolveWithVite` ([#20989](https://github.com/vitejs/rolldown-vite/issues/20989)) ([ca18b23](https://github.com/vitejs/rolldown-vite/commit/ca18b233d43a8f31883726ca565940ad1dc85f38)) +* handle query parameters for `/@vite/*` modules ([#20998](https://github.com/vitejs/rolldown-vite/issues/20998)) ([6843a6a](https://github.com/vitejs/rolldown-vite/commit/6843a6ae49df8ca523104a8ccfb9a8f9602b3881)) +* **resolve:** don't modify resolve options ([#468](https://github.com/vitejs/rolldown-vite/issues/468)) ([2b87665](https://github.com/vitejs/rolldown-vite/commit/2b876659af6931fe30c149359adbdb83ded360c5)) +* **resolve:** match resolved subpath import path's relative prefix with regex (fix [#20972](https://github.com/vitejs/rolldown-vite/issues/20972)) ([#20973](https://github.com/vitejs/rolldown-vite/issues/20973)) ([ff2d83e](https://github.com/vitejs/rolldown-vite/commit/ff2d83e2e7a3f7eba72f41b40686912f1e4b6843)) +* update build log to include environment name ([#20987](https://github.com/vitejs/rolldown-vite/issues/20987)) ([77c25c1](https://github.com/vitejs/rolldown-vite/commit/77c25c16ba9f3568e55fd4135f57c70f984d3fdd)) +* use esm entrypoint for css preprocessors and terser ([#20918](https://github.com/vitejs/rolldown-vite/issues/20918)) ([1460824](https://github.com/vitejs/rolldown-vite/commit/14608241cc4c821e7a392f6d92ef291a926bd94d)) ### Performance Improvements -* **module-runner:** add client-side builtin module check ([#20924](https://github.com/vitejs/vite/issues/20924)) ([ccffead](https://github.com/vitejs/vite/commit/ccffead5f8340bf9e7d88fed4b3c0ac5a74f5926)) -* **module-runner:** use `module.registerHooks` when available ([#20980](https://github.com/vitejs/vite/issues/20980)) ([9c8a780](https://github.com/vitejs/vite/commit/9c8a7801c5ad29da4c3822c414223593c526e855)) -* run `dev.createEnvironment` and `build.createEnvironment` concurrently ([#20699](https://github.com/vitejs/vite/issues/20699)) ([d636220](https://github.com/vitejs/vite/commit/d6362207ba817a210cbcea1253a174542a6c8c68)) -* **worker:** rebuild only when affected ([#20559](https://github.com/vitejs/vite/issues/20559)) ([5cd3890](https://github.com/vitejs/vite/commit/5cd38906afe1fab4ec967b18b21c05a80ac49c92)) +* **module-runner:** add client-side builtin module check ([#20924](https://github.com/vitejs/rolldown-vite/issues/20924)) ([ccffead](https://github.com/vitejs/rolldown-vite/commit/ccffead5f8340bf9e7d88fed4b3c0ac5a74f5926)) +* **module-runner:** use `module.registerHooks` when available ([#20980](https://github.com/vitejs/rolldown-vite/issues/20980)) ([9c8a780](https://github.com/vitejs/rolldown-vite/commit/9c8a7801c5ad29da4c3822c414223593c526e855)) +* run `dev.createEnvironment` and `build.createEnvironment` concurrently ([#20699](https://github.com/vitejs/rolldown-vite/issues/20699)) ([d636220](https://github.com/vitejs/rolldown-vite/commit/d6362207ba817a210cbcea1253a174542a6c8c68)) +* **worker:** rebuild only when affected ([#20559](https://github.com/vitejs/rolldown-vite/issues/20559)) ([5cd3890](https://github.com/vitejs/rolldown-vite/commit/5cd38906afe1fab4ec967b18b21c05a80ac49c92)) + +### Miscellaneous Chores + +* **deps:** update rolldown-related dependencies ([#21009](https://github.com/vitejs/rolldown-vite/issues/21009)) ([7cec1ad](https://github.com/vitejs/rolldown-vite/commit/7cec1addc257eb5bd0856adbe1e4306f0bb83e22)) +* fix merge error ([d79ee4e](https://github.com/vitejs/rolldown-vite/commit/d79ee4e056650e2bd7908f9fe30274c9d1122219)) +* fix merge error ([075caa0](https://github.com/vitejs/rolldown-vite/commit/075caa065bab659f45411cfe9b3b02e23ebe5406)) +* fix typecheck ([37a5392](https://github.com/vitejs/rolldown-vite/commit/37a53924995607766c11f5a002e30e45f313599b)) + +### Code Refactoring + +* remove `listenersForEvents` variable ([#20977](https://github.com/vitejs/rolldown-vite/issues/20977)) ([4d01112](https://github.com/vitejs/rolldown-vite/commit/4d01112415a9c3d06f2fe143a9987e50c4d47f36)) +* remove unused `invoke` parameter ([#20991](https://github.com/vitejs/rolldown-vite/issues/20991)) ([29cdb39](https://github.com/vitejs/rolldown-vite/commit/29cdb390374689e4dec9017b21fefe88b6ce4203)) + +### Build System + +* normalize license repo url ([#21010](https://github.com/vitejs/rolldown-vite/issues/21010)) ([bb65468](https://github.com/vitejs/rolldown-vite/commit/bb65468f3c6213fdd870c085610ec575af66b03c)) + +## [7.1.20](https://github.com/vitejs/rolldown-vite/compare/v7.1.19...v7.1.20) (2025-10-27) +### Features + +* add legacy inconsistent cjs interop ([#464](https://github.com/vitejs/rolldown-vite/issues/464)) ([10aa992](https://github.com/vitejs/rolldown-vite/commit/10aa99287ed936cf80bfaafa122db90498bd32f0)) +* update rolldown ([#467](https://github.com/vitejs/rolldown-vite/issues/467)) ([e373d76](https://github.com/vitejs/rolldown-vite/commit/e373d7673230db638c9177c111a76544fb28bdf5)) + +### Bug Fixes + +* **deps:** downgrade commonjs plugin to 28.0.6 to avoid rollup/plugins[#1909](https://github.com/vitejs/rolldown-vite/issues/1909) ([#20988](https://github.com/vitejs/rolldown-vite/issues/20988)) ([d5bd5bf](https://github.com/vitejs/rolldown-vite/commit/d5bd5bf64423f08d0beacace0c23aaebdafcd9ab)) +* **optimizer:** pass target to optimizer ([4406b5c](https://github.com/vitejs/rolldown-vite/commit/4406b5c117feb6990850ccb4c12300cf3c980e3c)) + +### Tests + +* enable temporary disabled tests ([946b447](https://github.com/vitejs/rolldown-vite/commit/946b4473be440bde494e1d9a90d38e360b7a5c5f)) + +## [7.1.19](https://github.com/vitejs/rolldown-vite/compare/v7.1.18...v7.1.19) (2025-10-20) +### Features + +* update rolldown ([#456](https://github.com/vitejs/rolldown-vite/issues/456)) ([f9d348e](https://github.com/vitejs/rolldown-vite/commit/f9d348e78a0e148a2e31c4e6d014a145abcba932)) + +### Bug Fixes + +* **module-runner:** resolve `resolvedSources` correctly ([#20959](https://github.com/vitejs/rolldown-vite/issues/20959)) ([c4f6039](https://github.com/vitejs/rolldown-vite/commit/c4f6039436657db50c610aa17eaf821dbd4ad57d)) +* resolve default export consistently ([#444](https://github.com/vitejs/rolldown-vite/issues/444)) ([46e89c0](https://github.com/vitejs/rolldown-vite/commit/46e89c0932c1ff9abb4fce590f83d9da58e62afc)) ### Miscellaneous Chores -* **deps:** update rolldown-related dependencies ([#20965](https://github.com/vitejs/vite/issues/20965)) ([6ad5424](https://github.com/vitejs/vite/commit/6ad5424f0bcabd8943c34d341cf9ed2e64b3d53c)) -* **deps:** update rolldown-related dependencies ([#21009](https://github.com/vitejs/vite/issues/21009)) ([7cec1ad](https://github.com/vitejs/vite/commit/7cec1addc257eb5bd0856adbe1e4306f0bb83e22)) -* fix merge error ([075caa0](https://github.com/vitejs/vite/commit/075caa065bab659f45411cfe9b3b02e23ebe5406)) +* **deps:** update rolldown-related dependencies ([#20965](https://github.com/vitejs/rolldown-vite/issues/20965)) ([6ad5424](https://github.com/vitejs/rolldown-vite/commit/6ad5424f0bcabd8943c34d341cf9ed2e64b3d53c)) +* fix type ([8455590](https://github.com/vitejs/rolldown-vite/commit/84555907d137d81b2e125c535cea74de344dfb68)) +* fix types ([db4d46d](https://github.com/vitejs/rolldown-vite/commit/db4d46d91cc87e06db9f9d7661150834d28cb5aa)) ### Code Refactoring -* remove `listenersForEvents` variable ([#20977](https://github.com/vitejs/vite/issues/20977)) ([4d01112](https://github.com/vitejs/vite/commit/4d01112415a9c3d06f2fe143a9987e50c4d47f36)) -* remove unused `invoke` parameter ([#20991](https://github.com/vitejs/vite/issues/20991)) ([29cdb39](https://github.com/vitejs/vite/commit/29cdb390374689e4dec9017b21fefe88b6ce4203)) +* avoid deprecated rolldown options (e.g. top level `define`) ([61f4caa](https://github.com/vitejs/rolldown-vite/commit/61f4caa9ea8ce3c2f38d21dca14e5b68f3bdd8ef)) +* revert [#322](https://github.com/vitejs/rolldown-vite/issues/322) ([b8970d0](https://github.com/vitejs/rolldown-vite/commit/b8970d0a0dd33df2cb63080d709c768b1187b9c4)) ### Build System -* normalize license repo url ([#21010](https://github.com/vitejs/vite/issues/21010)) ([bb65468](https://github.com/vitejs/vite/commit/bb65468f3c6213fdd870c085610ec575af66b03c)) -* use isolated declarations ([#20928](https://github.com/vitejs/vite/issues/20928)) ([dad7643](https://github.com/vitejs/vite/commit/dad76436e96e1bac2baa805a0a3c1861e88e050c)) +* use isolated declarations ([#20928](https://github.com/vitejs/rolldown-vite/issues/20928)) ([dad7643](https://github.com/vitejs/rolldown-vite/commit/dad76436e96e1bac2baa805a0a3c1861e88e050c)) -## [7.1.11](https://github.com/vitejs/vite/compare/v7.1.10...v7.1.11) (2025-10-20) +## [7.1.18](https://github.com/vitejs/rolldown-vite/compare/v7.1.17...v7.1.18) (2025-10-20) ### Bug Fixes -* **dev:** trim trailing slash before `server.fs.deny` check ([#20968](https://github.com/vitejs/vite/issues/20968)) ([f479cc5](https://github.com/vitejs/vite/commit/f479cc57c425ed41ceb434fecebd63931b1ed4ed)) +* **dev:** trim trailing slash before `server.fs.deny` check ([#20968](https://github.com/vitejs/rolldown-vite/issues/20968)) ([f479cc5](https://github.com/vitejs/rolldown-vite/commit/f479cc57c425ed41ceb434fecebd63931b1ed4ed)) ### Miscellaneous Chores -* **deps:** update all non-major dependencies ([#20966](https://github.com/vitejs/vite/issues/20966)) ([6fb41a2](https://github.com/vitejs/vite/commit/6fb41a260bda443685e719ea4765d3faca3db944)) +* **deps:** update all non-major dependencies ([#20966](https://github.com/vitejs/rolldown-vite/issues/20966)) ([6fb41a2](https://github.com/vitejs/rolldown-vite/commit/6fb41a260bda443685e719ea4765d3faca3db944)) ### Code Refactoring -* use subpath imports for types module reference ([#20921](https://github.com/vitejs/vite/issues/20921)) ([d0094af](https://github.com/vitejs/vite/commit/d0094af639d9ebbb51d4e00910b74f23eb8fe131)) +* revert [#313](https://github.com/vitejs/rolldown-vite/issues/313) ([5305fc7](https://github.com/vitejs/rolldown-vite/commit/5305fc7839830a4dce0ab471260637b481199043)) +* use subpath imports for types module reference ([#20921](https://github.com/vitejs/rolldown-vite/issues/20921)) ([d0094af](https://github.com/vitejs/rolldown-vite/commit/d0094af639d9ebbb51d4e00910b74f23eb8fe131)) ### Build System -* remove cjs reference in files field ([#20945](https://github.com/vitejs/vite/issues/20945)) ([ef411ce](https://github.com/vitejs/vite/commit/ef411cee2696af3ba791879fdae9aad165f178b2)) -* remove hash from built filenames ([#20946](https://github.com/vitejs/vite/issues/20946)) ([a817307](https://github.com/vitejs/vite/commit/a81730754d655d1371ce0f4354af1c84e12f9f2d)) +* remove cjs reference in files field ([#20945](https://github.com/vitejs/rolldown-vite/issues/20945)) ([ef411ce](https://github.com/vitejs/rolldown-vite/commit/ef411cee2696af3ba791879fdae9aad165f178b2)) +* remove hash from built filenames ([#20946](https://github.com/vitejs/rolldown-vite/issues/20946)) ([a817307](https://github.com/vitejs/rolldown-vite/commit/a81730754d655d1371ce0f4354af1c84e12f9f2d)) + +## [7.1.17](https://github.com/vitejs/rolldown-vite/compare/v7.1.16...v7.1.17) (2025-10-14) +### Features + +* update rolldown ([08ea49e](https://github.com/vitejs/rolldown-vite/commit/08ea49e0b68f7a74d4c945e01f57a23cb810cd9d)) -## [7.1.10](https://github.com/vitejs/vite/compare/v7.1.9...v7.1.10) (2025-10-14) ### Bug Fixes -* **css:** avoid duplicate style for server rendered stylesheet link and client inline style during dev ([#20767](https://github.com/vitejs/vite/issues/20767)) ([3a92bc7](https://github.com/vitejs/vite/commit/3a92bc79b306a01b8aaf37f80b2239eaf6e488e7)) -* **css:** respect emitAssets when cssCodeSplit=false ([#20883](https://github.com/vitejs/vite/issues/20883)) ([d3e7eee](https://github.com/vitejs/vite/commit/d3e7eeefa91e1992f47694d16fe4dbe708c4d80e)) -* **deps:** update all non-major dependencies ([879de86](https://github.com/vitejs/vite/commit/879de86935a31b4e47ab907ddd859366518ce268)) -* **deps:** update all non-major dependencies ([#20894](https://github.com/vitejs/vite/issues/20894)) ([3213f90](https://github.com/vitejs/vite/commit/3213f90ff0d8f274bcec65f40aac6dfcff1ac244)) -* **dev:** allow aliases starting with `//` ([#20760](https://github.com/vitejs/vite/issues/20760)) ([b95fa2a](https://github.com/vitejs/vite/commit/b95fa2aa7564eda4c9f05ee7616a2dbada35e463)) -* **dev:** remove timestamp query consistently ([#20887](https://github.com/vitejs/vite/issues/20887)) ([6537d15](https://github.com/vitejs/vite/commit/6537d15591619d7e1cfc1e50599bec16cd88340f)) -* **esbuild:** inject esbuild helpers correctly for esbuild 0.25.9+ ([#20906](https://github.com/vitejs/vite/issues/20906)) ([446eb38](https://github.com/vitejs/vite/commit/446eb386329ef682d614c77958a542f2dc222880)) -* normalize path before calling `fileToBuiltUrl` ([#20898](https://github.com/vitejs/vite/issues/20898)) ([73b6d24](https://github.com/vitejs/vite/commit/73b6d243e0398ee5d8d44c7d24162f4a0f4b1cf1)) -* preserve original sourcemap file field when combining sourcemaps ([#20926](https://github.com/vitejs/vite/issues/20926)) ([c714776](https://github.com/vitejs/vite/commit/c714776aa1dcc24299a81c1495cbcbb1b1ef1dd3)) +* **css:** avoid duplicate style for server rendered stylesheet link and client inline style during dev ([#20767](https://github.com/vitejs/rolldown-vite/issues/20767)) ([3a92bc7](https://github.com/vitejs/rolldown-vite/commit/3a92bc79b306a01b8aaf37f80b2239eaf6e488e7)) +* **css:** respect emitAssets when cssCodeSplit=false ([#20883](https://github.com/vitejs/rolldown-vite/issues/20883)) ([d3e7eee](https://github.com/vitejs/rolldown-vite/commit/d3e7eeefa91e1992f47694d16fe4dbe708c4d80e)) +* **deps:** update all non-major dependencies ([879de86](https://github.com/vitejs/rolldown-vite/commit/879de86935a31b4e47ab907ddd859366518ce268)) +* **deps:** update all non-major dependencies ([#20894](https://github.com/vitejs/rolldown-vite/issues/20894)) ([3213f90](https://github.com/vitejs/rolldown-vite/commit/3213f90ff0d8f274bcec65f40aac6dfcff1ac244)) +* **dev:** allow aliases starting with `//` ([#20760](https://github.com/vitejs/rolldown-vite/issues/20760)) ([b95fa2a](https://github.com/vitejs/rolldown-vite/commit/b95fa2aa7564eda4c9f05ee7616a2dbada35e463)) +* **dev:** remove timestamp query consistently ([#20887](https://github.com/vitejs/rolldown-vite/issues/20887)) ([6537d15](https://github.com/vitejs/rolldown-vite/commit/6537d15591619d7e1cfc1e50599bec16cd88340f)) +* **esbuild:** inject esbuild helpers correctly for esbuild 0.25.9+ ([#20906](https://github.com/vitejs/rolldown-vite/issues/20906)) ([446eb38](https://github.com/vitejs/rolldown-vite/commit/446eb386329ef682d614c77958a542f2dc222880)) +* normalize path before calling `fileToBuiltUrl` ([#20898](https://github.com/vitejs/rolldown-vite/issues/20898)) ([73b6d24](https://github.com/vitejs/rolldown-vite/commit/73b6d243e0398ee5d8d44c7d24162f4a0f4b1cf1)) +* preserve original sourcemap file field when combining sourcemaps ([#20926](https://github.com/vitejs/rolldown-vite/issues/20926)) ([c714776](https://github.com/vitejs/rolldown-vite/commit/c714776aa1dcc24299a81c1495cbcbb1b1ef1dd3)) ### Documentation -* correct `WebSocket` spelling ([#20890](https://github.com/vitejs/vite/issues/20890)) ([29e98dc](https://github.com/vitejs/vite/commit/29e98dc3efe35efbd978523367c05db7d2e7a278)) +* correct `WebSocket` spelling ([#20890](https://github.com/vitejs/rolldown-vite/issues/20890)) ([29e98dc](https://github.com/vitejs/rolldown-vite/commit/29e98dc3efe35efbd978523367c05db7d2e7a278)) ### Miscellaneous Chores -* **deps:** update rolldown-related dependencies ([#20923](https://github.com/vitejs/vite/issues/20923)) ([a5e3b06](https://github.com/vitejs/vite/commit/a5e3b064fa7ca981cb6f15f8e88806b36a99b8bf)) +* **deps:** update rolldown-related dependencies ([#20923](https://github.com/vitejs/rolldown-vite/issues/20923)) ([a5e3b06](https://github.com/vitejs/rolldown-vite/commit/a5e3b064fa7ca981cb6f15f8e88806b36a99b8bf)) +* fix type error ([2ac79ea](https://github.com/vitejs/rolldown-vite/commit/2ac79ea3e11184b3db0a6ceb14eb45f2604f999c)) + +## [7.1.16](https://github.com/vitejs/rolldown-vite/compare/v7.1.15...v7.1.16) (2025-10-07) +### Features + +* update rolldown ([#443](https://github.com/vitejs/rolldown-vite/issues/443)) ([4eb7418](https://github.com/vitejs/rolldown-vite/commit/4eb7418726d99899b66c95ecb3049055464a6a5f)) + +### Bug Fixes + +* set transform target ([#441](https://github.com/vitejs/rolldown-vite/issues/441)) ([80ec52c](https://github.com/vitejs/rolldown-vite/commit/80ec52cd696352b14dde6e8a4361edb11a9d4e77)) -## [7.1.9](https://github.com/vitejs/vite/compare/v7.1.8...v7.1.9) (2025-10-03) ### Reverts -* **server:** drain stdin when not interactive ([#20885](https://github.com/vitejs/vite/issues/20885)) ([12d72b0](https://github.com/vitejs/vite/commit/12d72b0538ef1540bfb0f1dd8a44b75deaa3464e)) +* **server:** drain stdin when not interactive ([#20885](https://github.com/vitejs/rolldown-vite/issues/20885)) ([12d72b0](https://github.com/vitejs/rolldown-vite/commit/12d72b0538ef1540bfb0f1dd8a44b75deaa3464e)) -## [7.1.8](https://github.com/vitejs/vite/compare/v7.1.7...v7.1.8) (2025-10-02) +## [7.1.15](https://github.com/vitejs/rolldown-vite/compare/v7.1.14...v7.1.15) (2025-10-02) ### Bug Fixes -* **css:** improve url escape characters handling ([#20847](https://github.com/vitejs/vite/issues/20847)) ([24a61a3](https://github.com/vitejs/vite/commit/24a61a3f5404279e91f7ceebf7449a5e874f9d56)) -* **deps:** update all non-major dependencies ([#20855](https://github.com/vitejs/vite/issues/20855)) ([788a183](https://github.com/vitejs/vite/commit/788a183afce57de13f5656f0cf42cdf6fdc3ebaa)) -* **deps:** update artichokie to 0.4.2 ([#20864](https://github.com/vitejs/vite/issues/20864)) ([e670799](https://github.com/vitejs/vite/commit/e670799e123dca78e1a63aeb06dbadade3d5ab51)) -* **dev:** skip JS responses for document requests ([#20866](https://github.com/vitejs/vite/issues/20866)) ([6bc6c4d](https://github.com/vitejs/vite/commit/6bc6c4dbc23501577d3919dc841454eb2eb14a54)) -* **glob:** fix HMR for array patterns with exclusions ([#20872](https://github.com/vitejs/vite/issues/20872)) ([63e040f](https://github.com/vitejs/vite/commit/63e040f1ca6b635a007eb40aa7c8b891e8cc5799)) -* keep ids for virtual modules as-is ([#20808](https://github.com/vitejs/vite/issues/20808)) ([d4eca98](https://github.com/vitejs/vite/commit/d4eca986d679c77bd449db20fd99d8255985b550)) -* **server:** drain stdin when not interactive ([#20837](https://github.com/vitejs/vite/issues/20837)) ([bb950e9](https://github.com/vitejs/vite/commit/bb950e92b372f9a52245e9542cf9d9700d23ef8c)) -* **server:** improve malformed URL handling in middlewares ([#20830](https://github.com/vitejs/vite/issues/20830)) ([d65a983](https://github.com/vitejs/vite/commit/d65a9831c984e562c5bf2b5f427de16f6e1bd931)) +* **css:** improve url escape characters handling ([#20847](https://github.com/vitejs/rolldown-vite/issues/20847)) ([24a61a3](https://github.com/vitejs/rolldown-vite/commit/24a61a3f5404279e91f7ceebf7449a5e874f9d56)) +* **deps:** update all non-major dependencies ([#20855](https://github.com/vitejs/rolldown-vite/issues/20855)) ([788a183](https://github.com/vitejs/rolldown-vite/commit/788a183afce57de13f5656f0cf42cdf6fdc3ebaa)) +* **deps:** update artichokie to 0.4.2 ([#20864](https://github.com/vitejs/rolldown-vite/issues/20864)) ([e670799](https://github.com/vitejs/rolldown-vite/commit/e670799e123dca78e1a63aeb06dbadade3d5ab51)) +* **dev:** skip JS responses for document requests ([#20866](https://github.com/vitejs/rolldown-vite/issues/20866)) ([6bc6c4d](https://github.com/vitejs/rolldown-vite/commit/6bc6c4dbc23501577d3919dc841454eb2eb14a54)) +* **glob:** fix HMR for array patterns with exclusions ([#20872](https://github.com/vitejs/rolldown-vite/issues/20872)) ([63e040f](https://github.com/vitejs/rolldown-vite/commit/63e040f1ca6b635a007eb40aa7c8b891e8cc5799)) +* keep ids for virtual modules as-is ([#20808](https://github.com/vitejs/rolldown-vite/issues/20808)) ([d4eca98](https://github.com/vitejs/rolldown-vite/commit/d4eca986d679c77bd449db20fd99d8255985b550)) +* **oxc:** set typescript jsx options ([9afe6f6](https://github.com/vitejs/rolldown-vite/commit/9afe6f6daaa097f3dc60dff9f9aa09a21e5d377d)) +* **server:** drain stdin when not interactive ([#20837](https://github.com/vitejs/rolldown-vite/issues/20837)) ([bb950e9](https://github.com/vitejs/rolldown-vite/commit/bb950e92b372f9a52245e9542cf9d9700d23ef8c)) +* **server:** improve malformed URL handling in middlewares ([#20830](https://github.com/vitejs/rolldown-vite/issues/20830)) ([d65a983](https://github.com/vitejs/rolldown-vite/commit/d65a9831c984e562c5bf2b5f427de16f6e1bd931)) + +### Miscellaneous Chores + +* **deps:** update rolldown-related dependencies ([#20854](https://github.com/vitejs/rolldown-vite/issues/20854)) ([4dd06fd](https://github.com/vitejs/rolldown-vite/commit/4dd06fdc8d643059c2abf88188eae7c4877aab6e)) +* update url of `create-react-app` license ([#20865](https://github.com/vitejs/rolldown-vite/issues/20865)) ([166a178](https://github.com/vitejs/rolldown-vite/commit/166a178f45b6e48db27b5626559f5ec3358c2fb4)) + +## [7.1.14](https://github.com/vitejs/rolldown-vite/compare/v7.1.13...v7.1.14) (2025-09-30) +### Features + +* set `generatedCode: 'es2015'` ([4cfe8e1](https://github.com/vitejs/rolldown-vite/commit/4cfe8e1d2e0d75e47ac58de9c382efc7786cd023)) +* update rolldown ([bac2c1b](https://github.com/vitejs/rolldown-vite/commit/bac2c1b10fc39350eba46925ed87e5fa8e944b7d)) + +### Bug Fixes + +* use readFileSync to avoid "too many open files" ([7c7ffdc](https://github.com/vitejs/rolldown-vite/commit/7c7ffdc2536f39a0ae7a04fe384aa59cc1b5a7e7)) + +### Performance Improvements + +* use single regex for `isEntirelyImport` ([ac1ceaf](https://github.com/vitejs/rolldown-vite/commit/ac1ceaf804d52360f94312a6602046da72c4fb03)) ### Documentation -* **create-vite:** provide deno example ([#20747](https://github.com/vitejs/vite/issues/20747)) ([fdb758a](https://github.com/vitejs/vite/commit/fdb758a51796b1ab605437b2eee778a84e87e169)) +* **create-vite:** provide deno example ([#20747](https://github.com/vitejs/rolldown-vite/issues/20747)) ([fdb758a](https://github.com/vitejs/rolldown-vite/commit/fdb758a51796b1ab605437b2eee778a84e87e169)) ### Miscellaneous Chores -* **deps:** update rolldown-related dependencies ([#20810](https://github.com/vitejs/vite/issues/20810)) ([ea68a88](https://github.com/vitejs/vite/commit/ea68a8868c7ee249213057f8a81c3f92a9839dde)) -* **deps:** update rolldown-related dependencies ([#20854](https://github.com/vitejs/vite/issues/20854)) ([4dd06fd](https://github.com/vitejs/vite/commit/4dd06fdc8d643059c2abf88188eae7c4877aab6e)) -* update url of `create-react-app` license ([#20865](https://github.com/vitejs/vite/issues/20865)) ([166a178](https://github.com/vitejs/vite/commit/166a178f45b6e48db27b5626559f5ec3358c2fb4)) +* **deps:** update rolldown-related dependencies ([#20810](https://github.com/vitejs/rolldown-vite/issues/20810)) ([ea68a88](https://github.com/vitejs/rolldown-vite/commit/ea68a8868c7ee249213057f8a81c3f92a9839dde)) + +## [7.1.13](https://github.com/vitejs/rolldown-vite/compare/v7.1.12...v7.1.13) (2025-09-24) +### Features + +* **hmr:** skip self-imports for `import.meta.hot.invalidate` ([ebd134f](https://github.com/vitejs/rolldown-vite/commit/ebd134faefd60e8716543b6b765763b6fa7b5371)) +* update rolldown ([007e115](https://github.com/vitejs/rolldown-vite/commit/007e115a714772524db97c3bde1d23acce1179dd)) + +## [7.1.12](https://github.com/vitejs/rolldown-vite/compare/v7.1.11...v7.1.12) (2025-09-22) +### Features + +* update rolldown ([#423](https://github.com/vitejs/rolldown-vite/issues/423)) ([6713908](https://github.com/vitejs/rolldown-vite/commit/671390887f7dd2d091ba14ecf7c40fb6af4c65a0)) -## [7.1.7](https://github.com/vitejs/vite/compare/v7.1.6...v7.1.7) (2025-09-22) ### Bug Fixes -* **build:** fix ssr environment `emitAssets: true` when `sharedConfigBuild: true` ([#20787](https://github.com/vitejs/vite/issues/20787)) ([4c4583c](https://github.com/vitejs/vite/commit/4c4583ce7a13306e0853901570c5d95517fe81da)) -* **client:** use CSP nonce when rendering error overlay ([#20791](https://github.com/vitejs/vite/issues/20791)) ([9bc9d12](https://github.com/vitejs/vite/commit/9bc9d1258f550e9d8f5e530cd27aecb1bee32bdb)) -* **deps:** update all non-major dependencies ([#20811](https://github.com/vitejs/vite/issues/20811)) ([9f2247c](https://github.com/vitejs/vite/commit/9f2247c066cac75746356c9391845235445a154b)) -* **glob:** handle glob imports from folders starting with dot ([#20800](https://github.com/vitejs/vite/issues/20800)) ([105abe8](https://github.com/vitejs/vite/commit/105abe87c412cf0f83859ba41fed869221cbb3e0)) -* **hmr:** trigger prune event when import is removed from non hmr module ([#20768](https://github.com/vitejs/vite/issues/20768)) ([9f32b1d](https://github.com/vitejs/vite/commit/9f32b1dc710991c53a9f665c8d0d6945f342bf92)) -* **hmr:** wait for `import.meta.hot.prune` callbacks to complete before running other HMRs ([#20698](https://github.com/vitejs/vite/issues/20698)) ([98a3484](https://github.com/vitejs/vite/commit/98a3484733443ee529870477a6ab6a03572e3cbc)) +* **build:** fix ssr environment `emitAssets: true` when `sharedConfigBuild: true` ([#20787](https://github.com/vitejs/rolldown-vite/issues/20787)) ([4c4583c](https://github.com/vitejs/rolldown-vite/commit/4c4583ce7a13306e0853901570c5d95517fe81da)) +* **client:** use CSP nonce when rendering error overlay ([#20791](https://github.com/vitejs/rolldown-vite/issues/20791)) ([9bc9d12](https://github.com/vitejs/rolldown-vite/commit/9bc9d1258f550e9d8f5e530cd27aecb1bee32bdb)) +* **deps:** update all non-major dependencies ([#20811](https://github.com/vitejs/rolldown-vite/issues/20811)) ([9f2247c](https://github.com/vitejs/rolldown-vite/commit/9f2247c066cac75746356c9391845235445a154b)) +* **glob:** handle glob imports from folders starting with dot ([#20800](https://github.com/vitejs/rolldown-vite/issues/20800)) ([105abe8](https://github.com/vitejs/rolldown-vite/commit/105abe87c412cf0f83859ba41fed869221cbb3e0)) +* **hmr:** trigger prune event when import is removed from non hmr module ([#20768](https://github.com/vitejs/rolldown-vite/issues/20768)) ([9f32b1d](https://github.com/vitejs/rolldown-vite/commit/9f32b1dc710991c53a9f665c8d0d6945f342bf92)) +* **hmr:** wait for `import.meta.hot.prune` callbacks to complete before running other HMRs ([#20698](https://github.com/vitejs/rolldown-vite/issues/20698)) ([98a3484](https://github.com/vitejs/rolldown-vite/commit/98a3484733443ee529870477a6ab6a03572e3cbc)) -## [7.1.6](https://github.com/vitejs/vite/compare/v7.1.5...v7.1.6) (2025-09-18) +## [7.1.11](https://github.com/vitejs/rolldown-vite/compare/v7.1.10...v7.1.11) (2025-09-18) ### Bug Fixes -* **deps:** update all non-major dependencies ([#20773](https://github.com/vitejs/vite/issues/20773)) ([88af2ae](https://github.com/vitejs/vite/commit/88af2ae7df77160e7d11a9fa147a4967c8499f13)) -* **esbuild:** inject esbuild helper functions with minified `$` variables correctly ([#20761](https://github.com/vitejs/vite/issues/20761)) ([7e8e004](https://github.com/vitejs/vite/commit/7e8e0043d60379e11da481d9cc3c3556c9756ac0)) -* fallback terser to main thread when nameCache is provided ([#20750](https://github.com/vitejs/vite/issues/20750)) ([a679a64](https://github.com/vitejs/vite/commit/a679a643404c95556dda2670643e14eca9c585bd)) -* **types:** strict env typings fail when `skipLibCheck` is `false` ([#20755](https://github.com/vitejs/vite/issues/20755)) ([cc54e29](https://github.com/vitejs/vite/commit/cc54e294746d3eac868de96f85d98dd0fa0cda11)) +* **deps:** update all non-major dependencies ([#20773](https://github.com/vitejs/rolldown-vite/issues/20773)) ([88af2ae](https://github.com/vitejs/rolldown-vite/commit/88af2ae7df77160e7d11a9fa147a4967c8499f13)) +* **esbuild:** inject esbuild helper functions with minified `$` variables correctly ([#20761](https://github.com/vitejs/rolldown-vite/issues/20761)) ([7e8e004](https://github.com/vitejs/rolldown-vite/commit/7e8e0043d60379e11da481d9cc3c3556c9756ac0)) +* fallback terser to main thread when nameCache is provided ([#20750](https://github.com/vitejs/rolldown-vite/issues/20750)) ([a679a64](https://github.com/vitejs/rolldown-vite/commit/a679a643404c95556dda2670643e14eca9c585bd)) +* **optimizer:** avoid mutating `optimizeDeps.rollupOptions.transforms` for stable optimizer hash ([#417](https://github.com/vitejs/rolldown-vite/issues/417)) ([efed40f](https://github.com/vitejs/rolldown-vite/commit/efed40fe328019dcf6989ea7d19ead0393d9689f)) +* **types:** strict env typings fail when `skipLibCheck` is `false` ([#20755](https://github.com/vitejs/rolldown-vite/issues/20755)) ([cc54e29](https://github.com/vitejs/rolldown-vite/commit/cc54e294746d3eac868de96f85d98dd0fa0cda11)) ### Miscellaneous Chores -* **deps:** update rolldown-related dependencies ([#20675](https://github.com/vitejs/vite/issues/20675)) ([a67bb5f](https://github.com/vitejs/vite/commit/a67bb5fbec5f3e42151dc7e3166858d0d33533de)) -* **deps:** update rolldown-related dependencies ([#20772](https://github.com/vitejs/vite/issues/20772)) ([d785e72](https://github.com/vitejs/vite/commit/d785e72f2ead705e8b2416c0a5097878fced3435)) +* **deps:** update rolldown-related dependencies ([#20772](https://github.com/vitejs/rolldown-vite/issues/20772)) ([d785e72](https://github.com/vitejs/rolldown-vite/commit/d785e72f2ead705e8b2416c0a5097878fced3435)) +* fix typecheck ([438fee4](https://github.com/vitejs/rolldown-vite/commit/438fee4b17a91c7fa678f0385e40cf3d81d615a4)) + +## [7.1.10](https://github.com/vitejs/rolldown-vite/compare/v7.1.9...v7.1.10) (2025-09-16) +### Features + +* update rolldown ([#415](https://github.com/vitejs/rolldown-vite/issues/415)) ([854436b](https://github.com/vitejs/rolldown-vite/commit/854436b145843a192fcb62598af8bd9f21b67102)) + +## [7.1.9](https://github.com/vitejs/rolldown-vite/compare/v7.1.8...v7.1.9) (2025-09-11) +### Features + +* update rolldown ([d14afd7](https://github.com/vitejs/rolldown-vite/commit/d14afd72acd25bf2cbc84030552a7a556b769486)) -## [7.1.5](https://github.com/vitejs/vite/compare/v7.1.4...v7.1.5) (2025-09-08) ### Bug Fixes -* apply `fs.strict` check to HTML files ([#20736](https://github.com/vitejs/vite/issues/20736)) ([14015d7](https://github.com/vitejs/vite/commit/14015d794f69accba68798bd0e15135bc51c9c1e)) -* **deps:** update all non-major dependencies ([#20732](https://github.com/vitejs/vite/issues/20732)) ([122bfba](https://github.com/vitejs/vite/commit/122bfbabeb1f095ce7cabd30893e5531e9a007c4)) -* upgrade sirv to 3.0.2 ([#20735](https://github.com/vitejs/vite/issues/20735)) ([09f2b52](https://github.com/vitejs/vite/commit/09f2b52e8d5907f26602653caf41b3a56692600d)) +* enable minify other than codegen for ES lib mode ([ad72fc3](https://github.com/vitejs/rolldown-vite/commit/ad72fc3ec6d5eac24b21c0413566b9eb1551aabd)) + +### Miscellaneous Chores + +* bump `rolldown-plugin-dts` ([#409](https://github.com/vitejs/rolldown-vite/issues/409)) ([2fbd7f1](https://github.com/vitejs/rolldown-vite/commit/2fbd7f1654ee01b638c1b7167cd79944e7ef2ad8)) -## [7.1.4](https://github.com/vitejs/vite/compare/v7.1.3...v7.1.4) (2025-09-01) +## [7.1.8](https://github.com/vitejs/rolldown-vite/compare/v7.1.7...v7.1.8) (2025-09-08) +### Features + +* enable `optimization.inlineConst: { mode: 'smart' }` by default ([#399](https://github.com/vitejs/rolldown-vite/issues/399)) ([b2b89d7](https://github.com/vitejs/rolldown-vite/commit/b2b89d7cf76ecea8fd538916f84c447a3631cd75)) +* update rolldown ([#400](https://github.com/vitejs/rolldown-vite/issues/400)) ([88a0359](https://github.com/vitejs/rolldown-vite/commit/88a0359b03b65d45760618de77e50c2ed27a84b7)) + +### Miscellaneous Chores + +* **deps:** update rolldown-related dependencies ([#20675](https://github.com/vitejs/rolldown-vite/issues/20675)) ([a67bb5f](https://github.com/vitejs/rolldown-vite/commit/a67bb5fbec5f3e42151dc7e3166858d0d33533de)) +* support ESM rolldown ([80120d6](https://github.com/vitejs/rolldown-vite/commit/80120d6a024ac498a70ea2445616d8632c8c844c)) +* update type build ([762cb49](https://github.com/vitejs/rolldown-vite/commit/762cb49b9bec5f5e66c1f9721eddc8d1c2655118)) +* update typos ([4698941](https://github.com/vitejs/rolldown-vite/commit/4698941ef4d87a93878e6381bf4b8869f5bc6f07)) + +## [7.1.7](https://github.com/vitejs/rolldown-vite/compare/v7.1.6...v7.1.7) (2025-09-08) ### Bug Fixes -* add missing awaits ([#20697](https://github.com/vitejs/vite/issues/20697)) ([79d10ed](https://github.com/vitejs/vite/commit/79d10ed6341ba7a751d007b7ad113a9b8be9c853)) -* **deps:** update all non-major dependencies ([#20676](https://github.com/vitejs/vite/issues/20676)) ([5a274b2](https://github.com/vitejs/vite/commit/5a274b29df83744cf0ce4dafd94029d2a9e01135)) -* **deps:** update all non-major dependencies ([#20709](https://github.com/vitejs/vite/issues/20709)) ([0401feb](https://github.com/vitejs/vite/commit/0401feba17e60bd7e976c5643128a0da49670a83)) -* pass rollup watch options when building in watch mode ([#20674](https://github.com/vitejs/vite/issues/20674)) ([f367453](https://github.com/vitejs/vite/commit/f367453ca2825bc8a390d41c5d13b161756f2b41)) +* add missing awaits ([#20697](https://github.com/vitejs/rolldown-vite/issues/20697)) ([79d10ed](https://github.com/vitejs/rolldown-vite/commit/79d10ed6341ba7a751d007b7ad113a9b8be9c853)) +* apply `fs.strict` check to HTML files ([#20736](https://github.com/vitejs/rolldown-vite/issues/20736)) ([14015d7](https://github.com/vitejs/rolldown-vite/commit/14015d794f69accba68798bd0e15135bc51c9c1e)) +* **deps:** update all non-major dependencies ([#20676](https://github.com/vitejs/rolldown-vite/issues/20676)) ([5a274b2](https://github.com/vitejs/rolldown-vite/commit/5a274b29df83744cf0ce4dafd94029d2a9e01135)) +* **deps:** update all non-major dependencies ([#20709](https://github.com/vitejs/rolldown-vite/issues/20709)) ([0401feb](https://github.com/vitejs/rolldown-vite/commit/0401feba17e60bd7e976c5643128a0da49670a83)) +* **deps:** update all non-major dependencies ([#20732](https://github.com/vitejs/rolldown-vite/issues/20732)) ([122bfba](https://github.com/vitejs/rolldown-vite/commit/122bfbabeb1f095ce7cabd30893e5531e9a007c4)) +* pass rollup watch options when building in watch mode ([#20674](https://github.com/vitejs/rolldown-vite/issues/20674)) ([f367453](https://github.com/vitejs/rolldown-vite/commit/f367453ca2825bc8a390d41c5d13b161756f2b41)) +* upgrade sirv to 3.0.2 ([#20735](https://github.com/vitejs/rolldown-vite/issues/20735)) ([09f2b52](https://github.com/vitejs/rolldown-vite/commit/09f2b52e8d5907f26602653caf41b3a56692600d)) ### Miscellaneous Chores -* remove unused constants entry from rolldown.config.ts ([#20710](https://github.com/vitejs/vite/issues/20710)) ([537fcf9](https://github.com/vitejs/vite/commit/537fcf91862a1bf51e70ce6fe9b414319dd3a675)) +* remove unused constants entry from rolldown.config.ts ([#20710](https://github.com/vitejs/rolldown-vite/issues/20710)) ([537fcf9](https://github.com/vitejs/rolldown-vite/commit/537fcf91862a1bf51e70ce6fe9b414319dd3a675)) ### Code Refactoring -* remove unnecessary `minify` parameter from `finalizeCss` ([#20701](https://github.com/vitejs/vite/issues/20701)) ([8099582](https://github.com/vitejs/vite/commit/8099582e5364f907f2bc6cb8e2d52ae0c4d937e4)) +* remove unnecessary `minify` parameter from `finalizeCss` ([#20701](https://github.com/vitejs/rolldown-vite/issues/20701)) ([8099582](https://github.com/vitejs/rolldown-vite/commit/8099582e5364f907f2bc6cb8e2d52ae0c4d937e4)) + +## [7.1.6](https://github.com/vitejs/rolldown-vite/compare/v7.1.5...v7.1.6) (2025-09-08) +### Features + +* enable `output.topLevelVar` by default ([#380](https://github.com/vitejs/rolldown-vite/issues/380)) ([7ea4f54](https://github.com/vitejs/rolldown-vite/commit/7ea4f5457ffb68b7238613060941e97cdf63c6fe)) +* update rolldown ([6ea9918](https://github.com/vitejs/rolldown-vite/commit/6ea991806f5b9c9d383d5fcb6c8e0eb6cad78eb9)) + +### Bug Fixes + +* `build.minify: 'esbuild'` + native plugins were not working ([#397](https://github.com/vitejs/rolldown-vite/issues/397)) ([1a05fc4](https://github.com/vitejs/rolldown-vite/commit/1a05fc4bca1ab6f56c6c31ba1115cb1846174bb7)) +* **oxc:** respect `oxc.typescript.onlyRemoveTypeImports` if it's set ([#394](https://github.com/vitejs/rolldown-vite/issues/394)) ([dd64f89](https://github.com/vitejs/rolldown-vite/commit/dd64f89c8b2ef7bf2f40fe4a692fa037a3fd33c0)) + +## [7.1.5](https://github.com/vitejs/rolldown-vite/compare/v7.1.4...v7.1.5) (2025-08-25) +### Features + +* update rolldown ([#389](https://github.com/vitejs/rolldown-vite/issues/389)) ([6db67e5](https://github.com/vitejs/rolldown-vite/commit/6db67e5ed45e6a2ffc5b5e5799b79a0ef006e032)) + +### Bug Fixes -## [7.1.3](https://github.com/vitejs/vite/compare/v7.1.2...v7.1.3) (2025-08-19) +* **native-plugin:** generate a more readable manifest ([#388](https://github.com/vitejs/rolldown-vite/issues/388)) ([e76ad17](https://github.com/vitejs/rolldown-vite/commit/e76ad172ab66c545ae4a2508b512f817adbff255)) + +## [7.1.4](https://github.com/vitejs/rolldown-vite/compare/v7.1.3...v7.1.4) (2025-08-19) ### Features -* **cli:** add Node.js version warning for unsupported versions ([#20638](https://github.com/vitejs/vite/issues/20638)) ([a1be1bf](https://github.com/vitejs/vite/commit/a1be1bf0905b9086e5f1370c63d76a7fa4a195ec)) -* generate code frame for parse errors thrown by terser ([#20642](https://github.com/vitejs/vite/issues/20642)) ([a9ba017](https://github.com/vitejs/vite/commit/a9ba0174a58b949373d6b4240bc69180dff0b780)) -* support long lines in `generateCodeFrame` ([#20640](https://github.com/vitejs/vite/issues/20640)) ([1559577](https://github.com/vitejs/vite/commit/15595773170c2a07f2efdccee05964fb87c19ae6)) +* **cli:** add Node.js version warning for unsupported versions ([#20638](https://github.com/vitejs/rolldown-vite/issues/20638)) ([a1be1bf](https://github.com/vitejs/rolldown-vite/commit/a1be1bf0905b9086e5f1370c63d76a7fa4a195ec)) +* generate code frame for parse errors thrown by terser ([#20642](https://github.com/vitejs/rolldown-vite/issues/20642)) ([a9ba017](https://github.com/vitejs/rolldown-vite/commit/a9ba0174a58b949373d6b4240bc69180dff0b780)) +* support long lines in `generateCodeFrame` ([#20640](https://github.com/vitejs/rolldown-vite/issues/20640)) ([1559577](https://github.com/vitejs/rolldown-vite/commit/15595773170c2a07f2efdccee05964fb87c19ae6)) ### Bug Fixes -* **deps:** update all non-major dependencies ([#20634](https://github.com/vitejs/vite/issues/20634)) ([4851cab](https://github.com/vitejs/vite/commit/4851cab3ba818b5f0f82eef3796b61d4b12768f1)) -* **optimizer:** incorrect incompatible error ([#20439](https://github.com/vitejs/vite/issues/20439)) ([446fe83](https://github.com/vitejs/vite/commit/446fe83033686dd38d13b786a217b8277b5c5f09)) -* support multiline new URL(..., import.meta.url) expressions ([#20644](https://github.com/vitejs/vite/issues/20644)) ([9ccf142](https://github.com/vitejs/vite/commit/9ccf142764d48292aa33e5ca6f020a7d55b97f61)) +* **deps:** update all non-major dependencies ([#20634](https://github.com/vitejs/rolldown-vite/issues/20634)) ([4851cab](https://github.com/vitejs/rolldown-vite/commit/4851cab3ba818b5f0f82eef3796b61d4b12768f1)) +* **optimizer:** incorrect incompatible error ([#20439](https://github.com/vitejs/rolldown-vite/issues/20439)) ([446fe83](https://github.com/vitejs/rolldown-vite/commit/446fe83033686dd38d13b786a217b8277b5c5f09)) +* support multiline new URL(..., import.meta.url) expressions ([#20644](https://github.com/vitejs/rolldown-vite/issues/20644)) ([9ccf142](https://github.com/vitejs/rolldown-vite/commit/9ccf142764d48292aa33e5ca6f020a7d55b97f61)) ### Performance Improvements -* **cli:** dynamically import `resolveConfig` ([#20646](https://github.com/vitejs/vite/issues/20646)) ([f691f57](https://github.com/vitejs/vite/commit/f691f57e46118328e00174160ceab2101b7256ca)) +* **cli:** dynamically import `resolveConfig` ([#20646](https://github.com/vitejs/rolldown-vite/issues/20646)) ([f691f57](https://github.com/vitejs/rolldown-vite/commit/f691f57e46118328e00174160ceab2101b7256ca)) ### Miscellaneous Chores -* **deps:** update rolldown-related dependencies ([#20633](https://github.com/vitejs/vite/issues/20633)) ([98b92e8](https://github.com/vitejs/vite/commit/98b92e8c4b10ae87c48292a8ac09b01ca81a02cf)) +* **deps:** update rolldown-related dependencies ([#20633](https://github.com/vitejs/rolldown-vite/issues/20633)) ([98b92e8](https://github.com/vitejs/rolldown-vite/commit/98b92e8c4b10ae87c48292a8ac09b01ca81a02cf)) ### Code Refactoring -* replace startsWith with strict equality ([#20603](https://github.com/vitejs/vite/issues/20603)) ([42816de](https://github.com/vitejs/vite/commit/42816dee0e177dded1c9de4d9099089ec4acef96)) -* use `import` in worker threads ([#20641](https://github.com/vitejs/vite/issues/20641)) ([530687a](https://github.com/vitejs/vite/commit/530687a344c51daf3115d1c134586bbde58356e0)) +* replace startsWith with strict equality ([#20603](https://github.com/vitejs/rolldown-vite/issues/20603)) ([42816de](https://github.com/vitejs/rolldown-vite/commit/42816dee0e177dded1c9de4d9099089ec4acef96)) +* use `import` in worker threads ([#20641](https://github.com/vitejs/rolldown-vite/issues/20641)) ([530687a](https://github.com/vitejs/rolldown-vite/commit/530687a344c51daf3115d1c134586bbde58356e0)) ### Tests -* remove `checkNodeVersion` test ([#20647](https://github.com/vitejs/vite/issues/20647)) ([731d3e6](https://github.com/vitejs/vite/commit/731d3e61f444f6c5e611f67b531416ed6450f90f)) +* remove `checkNodeVersion` test ([#20647](https://github.com/vitejs/rolldown-vite/issues/20647)) ([731d3e6](https://github.com/vitejs/rolldown-vite/commit/731d3e61f444f6c5e611f67b531416ed6450f90f)) + +## [7.1.3](https://github.com/vitejs/rolldown-vite/compare/v7.1.2...v7.1.3) (2025-08-18) +### Features + +* update rolldown ([#379](https://github.com/vitejs/rolldown-vite/issues/379)) ([4056cc6](https://github.com/vitejs/rolldown-vite/commit/4056cc655d1f46585413bf1663d8bb3c319a1131)) +* warn if a plugin specified both `rollupOptions` and `rolldownOptions` ([#377](https://github.com/vitejs/rolldown-vite/issues/377)) ([07da856](https://github.com/vitejs/rolldown-vite/commit/07da85623d9dce8d0a8b1cf83fe9e97f7b623f3f)) -## [7.1.2](https://github.com/vitejs/vite/compare/v7.1.1...v7.1.2) (2025-08-12) ### Bug Fixes -* **client:** add `[vite]` prefixes to debug logs ([#20595](https://github.com/vitejs/vite/issues/20595)) ([7cdef61](https://github.com/vitejs/vite/commit/7cdef612a65da5363905723f77516b6745ac9a94)) -* **config:** make debugger work with bundle loader ([#20573](https://github.com/vitejs/vite/issues/20573)) ([c583927](https://github.com/vitejs/vite/commit/c583927bee657f15f63fdf80468fbe6a74eacdec)) -* **deps:** update all non-major dependencies ([#20587](https://github.com/vitejs/vite/issues/20587)) ([20d4817](https://github.com/vitejs/vite/commit/20d48172a0352d32f766b3c878d52a8944fdbf6e)) -* don't consider ids with `npm:` prefix as a built-in module ([#20558](https://github.com/vitejs/vite/issues/20558)) ([ab33803](https://github.com/vitejs/vite/commit/ab33803f2c831a82ddee637ad62e0c4ceeb663f1)) -* **hmr:** watch non-inlined assets referenced by CSS ([#20581](https://github.com/vitejs/vite/issues/20581)) ([b7d494b](https://github.com/vitejs/vite/commit/b7d494bf60af3ef7316d87266bb3ebf56617d5fd)) -* **module-runner:** prevent crash when sourceMappingURL pattern appears in string literals ([#20554](https://github.com/vitejs/vite/issues/20554)) ([2770478](https://github.com/vitejs/vite/commit/2770478d1c190d3e3de34ef9a3d2c493c06e9933)) +* merge tsconfig jsx options even when `oxc.jsx.runtime` is set ([#376](https://github.com/vitejs/rolldown-vite/issues/376)) ([e6eb30a](https://github.com/vitejs/rolldown-vite/commit/e6eb30a1b713b8b6c29480533fe8c9ec487cd2c3)) -### Miscellaneous Chores +## [7.1.2](https://github.com/vitejs/rolldown-vite/compare/v7.1.1...v7.1.2) (2025-08-12) +### Features + +* enable all native plugins by default ([#168](https://github.com/vitejs/rolldown-vite/issues/168)) ([7ad2330](https://github.com/vitejs/rolldown-vite/commit/7ad23302e63b1402fb0295111464cd0f2f86b9c4)) + +## [7.1.1](https://github.com/vitejs/rolldown-vite/compare/v7.1.0...v7.1.1) (2025-08-12) +### Features -* **deps:** migrate to `@jridgewell/remapping` from `@ampproject/remapping` ([#20577](https://github.com/vitejs/vite/issues/20577)) ([0a6048a](https://github.com/vitejs/vite/commit/0a6048aba4523f451edf29ae4037d252cc963815)) -* **deps:** update rolldown-related dependencies ([#20586](https://github.com/vitejs/vite/issues/20586)) ([77632c5](https://github.com/vitejs/vite/commit/77632c55db51cd6d03bcf24a1cef8d21058100a3)) +* update rolldown ([#366](https://github.com/vitejs/rolldown-vite/issues/366)) ([f51756e](https://github.com/vitejs/rolldown-vite/commit/f51756e8e9404b12a0c1bfde01c3663c64e5d337)) -## [7.1.1](https://github.com/vitejs/vite/compare/v7.1.0...v7.1.1) (2025-08-08) ### Bug Fixes -* **deps:** update `launch-editor-middleware` ([#20569](https://github.com/vitejs/vite/issues/20569)) ([826b394](https://github.com/vitejs/vite/commit/826b394e0efd033d2fe88126fe9a28da9573bd8f)) +* **client:** add `[vite]` prefixes to debug logs ([#20595](https://github.com/vitejs/rolldown-vite/issues/20595)) ([7cdef61](https://github.com/vitejs/rolldown-vite/commit/7cdef612a65da5363905723f77516b6745ac9a94)) +* **config:** make debugger work with bundle loader ([#20573](https://github.com/vitejs/rolldown-vite/issues/20573)) ([c583927](https://github.com/vitejs/rolldown-vite/commit/c583927bee657f15f63fdf80468fbe6a74eacdec)) +* **deps:** update `launch-editor-middleware` ([#20569](https://github.com/vitejs/rolldown-vite/issues/20569)) ([826b394](https://github.com/vitejs/rolldown-vite/commit/826b394e0efd033d2fe88126fe9a28da9573bd8f)) +* **deps:** update all non-major dependencies ([#20587](https://github.com/vitejs/rolldown-vite/issues/20587)) ([20d4817](https://github.com/vitejs/rolldown-vite/commit/20d48172a0352d32f766b3c878d52a8944fdbf6e)) +* don't consider ids with `npm:` prefix as a built-in module ([#20558](https://github.com/vitejs/rolldown-vite/issues/20558)) ([ab33803](https://github.com/vitejs/rolldown-vite/commit/ab33803f2c831a82ddee637ad62e0c4ceeb663f1)) +* **hmr:** watch non-inlined assets referenced by CSS ([#20581](https://github.com/vitejs/rolldown-vite/issues/20581)) ([b7d494b](https://github.com/vitejs/rolldown-vite/commit/b7d494bf60af3ef7316d87266bb3ebf56617d5fd)) +* **module-runner:** prevent crash when sourceMappingURL pattern appears in string literals ([#20554](https://github.com/vitejs/rolldown-vite/issues/20554)) ([2770478](https://github.com/vitejs/rolldown-vite/commit/2770478d1c190d3e3de34ef9a3d2c493c06e9933)) +* respect `rollupOptions.platform` options ([#361](https://github.com/vitejs/rolldown-vite/issues/361)) ([2603932](https://github.com/vitejs/rolldown-vite/commit/2603932b9e6bb4b9e1f9a1f070111e14eeff846c)) ### Miscellaneous Chores -* fix changelog beta links ([#20561](https://github.com/vitejs/vite/issues/20561)) ([2e0c21a](https://github.com/vitejs/vite/commit/2e0c21a07ec5ca7ed5eaa1b6a7d44682fa467a06)) -* update 7.1 changelog ([#20560](https://github.com/vitejs/vite/issues/20560)) ([d8869b8](https://github.com/vitejs/vite/commit/d8869b84208879c7aa6a0268ec073a34760c0d80)) - -## [7.1.0](https://github.com/vitejs/vite/compare/v7.1.0-beta.1...v7.1.0) (2025-08-07) -### Features - -* support files with more than 1000 lines by `generateCodeFrame` ([#20508](https://github.com/vitejs/vite/issues/20508)) ([e7d0b2a](https://github.com/vitejs/vite/commit/e7d0b2afa56840dabbbad10015dc04083caaf248)) -* add `import.meta.main` support in config (bundle config loader) ([#20516](https://github.com/vitejs/vite/issues/20516)) ([5d3e3c2](https://github.com/vitejs/vite/commit/5d3e3c2ae5a2174941fd09fd7842794a287c3ab7)) -* **optimizer:** improve dependency optimization error messages with esbuild formatMessages ([#20525](https://github.com/vitejs/vite/issues/20525)) ([d17cfed](https://github.com/vitejs/vite/commit/d17cfeda0741e4476570700a00b7b37917c97700)) -* **ssr:** add `import.meta.main` support for Node.js module runner ([#20517](https://github.com/vitejs/vite/issues/20517)) ([794a8f2](https://github.com/vitejs/vite/commit/794a8f230218a3b1e148defc5a2d7a67409177ff)) -* add `future: 'warn'` ([#20473](https://github.com/vitejs/vite/issues/20473)) ([e6aaf17](https://github.com/vitejs/vite/commit/e6aaf17ca21544572941957ce71bd8dbdc94e402)) -* add `removeServerPluginContainer` future deprecation ([#20437](https://github.com/vitejs/vite/issues/20437)) ([c1279e7](https://github.com/vitejs/vite/commit/c1279e75401ac6ea1d0678da88414a76ff36b6fe)) -* add `removeServerReloadModule` future deprecation ([#20436](https://github.com/vitejs/vite/issues/20436)) ([6970d17](https://github.com/vitejs/vite/commit/6970d1740cebd56af696abf60f30adb0c060f578)) -* add `server.warmupRequest` to future deprecation ([#20431](https://github.com/vitejs/vite/issues/20431)) ([8ad388a](https://github.com/vitejs/vite/commit/8ad388aeab0dc79e4bc14859b91174427805a46b)) -* add `ssrFixStacktrace` / `ssrRewriteStacktrace` to `removeSsrLoadModule` future deprecation ([#20435](https://github.com/vitejs/vite/issues/20435)) ([8c8f587](https://github.com/vitejs/vite/commit/8c8f5879ead251705c2c363f5b8b94f618fbf374)) -* **client:** ping from SharedWorker ([#19057](https://github.com/vitejs/vite/issues/19057)) ([5c97c22](https://github.com/vitejs/vite/commit/5c97c22548476e5f80856ece1d80b9234a7e6ecb)) -* **dev:** add `this.fs` support ([#20301](https://github.com/vitejs/vite/issues/20301)) ([0fe3f2f](https://github.com/vitejs/vite/commit/0fe3f2f7c325c5990f1059c28b66b24e1b8fd5d3)) -* export `defaultExternalConditions` ([#20279](https://github.com/vitejs/vite/issues/20279)) ([344d302](https://github.com/vitejs/vite/commit/344d30243b107852b133175e947a0410ea703f00)) -* implement `removePluginHookSsrArgument` future deprecation ([#20433](https://github.com/vitejs/vite/issues/20433)) ([95927d9](https://github.com/vitejs/vite/commit/95927d9c0ba1cb0b3bd8c900f039c099f8e29f90)) -* implement `removeServerHot` future deprecation ([#20434](https://github.com/vitejs/vite/issues/20434)) ([259f45d](https://github.com/vitejs/vite/commit/259f45d0698a184d6ecc352b610001fa1acdcee1)) -* resolve server URLs before calling other listeners ([#19981](https://github.com/vitejs/vite/issues/19981)) ([45f6443](https://github.com/vitejs/vite/commit/45f6443a935258d8eee62874f0695b8c1c60a481)) -* **ssr:** resolve externalized packages with `resolve.externalConditions` and add `module-sync` to default external condition ([#20409](https://github.com/vitejs/vite/issues/20409)) ([c669c52](https://github.com/vitejs/vite/commit/c669c524e6008a4902169f4b2f865e892297acf3)) -* **ssr:** support `import.meta.resolve` in module runner ([#20260](https://github.com/vitejs/vite/issues/20260)) ([62835f7](https://github.com/vitejs/vite/commit/62835f7c06d37802f0bc2abbf58bbaeaa8c73ce5)) - -### Bug Fixes - -* **css:** avoid warnings for `image-set` containing `__VITE_ASSET__` ([#20520](https://github.com/vitejs/vite/issues/20520)) ([f1a2635](https://github.com/vitejs/vite/commit/f1a2635e6977a3eda681bec036f64f07686dad0d)) -* **css:** empty CSS entry points should generate CSS files, not JS files ([#20518](https://github.com/vitejs/vite/issues/20518)) ([bac9f3e](https://github.com/vitejs/vite/commit/bac9f3ecf84ae5c5add6ef224ae057508247f89e)) -* **dev:** denied request stalled when requested concurrently ([#20503](https://github.com/vitejs/vite/issues/20503)) ([64a52e7](https://github.com/vitejs/vite/commit/64a52e70d9250b16aa81ce2df27c23fe56907257)) -* **manifest:** initialize `entryCssAssetFileNames` as an empty Set ([#20542](https://github.com/vitejs/vite/issues/20542)) ([6a46cda](https://github.com/vitejs/vite/commit/6a46cdac5dece70296d1179640958deeeb2e6c19)) -* skip prepareOutDirPlugin in workers ([#20556](https://github.com/vitejs/vite/issues/20556)) ([97d5111](https://github.com/vitejs/vite/commit/97d5111645a395dae48b16b110bc76c1ee8956c8)) -* **asset:** only watch existing files for `new URL(, import.meta.url)` ([#20507](https://github.com/vitejs/vite/issues/20507)) ([1b211fd](https://github.com/vitejs/vite/commit/1b211fd1beccd0fc13bec700815abaa9f54147e8)) -* **client:** keep ping on WS constructor error ([#20512](https://github.com/vitejs/vite/issues/20512)) ([3676da5](https://github.com/vitejs/vite/commit/3676da5bc5b2b69b28619b8521fca94d30468fe5)) -* **deps:** update all non-major dependencies ([#20537](https://github.com/vitejs/vite/issues/20537)) ([fc9a9d3](https://github.com/vitejs/vite/commit/fc9a9d3f1493caa3d614f64e0a61fd5684f0928b)) -* don't resolve as relative for specifiers starting with a dot ([#20528](https://github.com/vitejs/vite/issues/20528)) ([c5a10ec](https://github.com/vitejs/vite/commit/c5a10ec004130bec17cf42760b76d1d404008fa3)) -* **html:** allow control character in input stream ([#20483](https://github.com/vitejs/vite/issues/20483)) ([c12a4a7](https://github.com/vitejs/vite/commit/c12a4a76a299237a0a13b885c72fdda6e4a3c9b7)) -* merge old and new `noExternal: true` correctly ([#20502](https://github.com/vitejs/vite/issues/20502)) ([9ebe4a5](https://github.com/vitejs/vite/commit/9ebe4a514a2e48e3fe194f16b0556a45ff38077a)) -* **deps:** update all non-major dependencies ([#20489](https://github.com/vitejs/vite/issues/20489)) ([f6aa04a](https://github.com/vitejs/vite/commit/f6aa04a52d486c8881f666c450caa3dab3c6bba1)) -* **dev:** denied requests overly ([#20410](https://github.com/vitejs/vite/issues/20410)) ([4be5270](https://github.com/vitejs/vite/commit/4be5270b27f7e6323f1771974b4b3520d86600e4)) -* **hmr:** register css deps as `type: asset` ([#20391](https://github.com/vitejs/vite/issues/20391)) ([7eac8dd](https://github.com/vitejs/vite/commit/7eac8ddb65033b8c001d6c6bc46aaeeefb79680a)) -* **optimizer:** discover correct jsx runtime during scan ([#20495](https://github.com/vitejs/vite/issues/20495)) ([10d48bb](https://github.com/vitejs/vite/commit/10d48bb2e30824d217e415a58cea9e69c2820c2a)) -* **preview:** set correct host for `resolvedUrls` ([#20496](https://github.com/vitejs/vite/issues/20496)) ([62b3e0d](https://github.com/vitejs/vite/commit/62b3e0d95c143e2f8b4e88d99c381d23663025ee)) -* **worker:** resolve WebKit compat with inline workers by deferring blob URL revocation ([#20460](https://github.com/vitejs/vite/issues/20460)) ([8033e5b](https://github.com/vitejs/vite/commit/8033e5bf8d3ff43995d0620490ed8739c59171dd)) +* **deps:** migrate to `@jridgewell/remapping` from `@ampproject/remapping` ([#20577](https://github.com/vitejs/rolldown-vite/issues/20577)) ([0a6048a](https://github.com/vitejs/rolldown-vite/commit/0a6048aba4523f451edf29ae4037d252cc963815)) +* **deps:** update rolldown-related dependencies ([#20586](https://github.com/vitejs/rolldown-vite/issues/20586)) ([77632c5](https://github.com/vitejs/rolldown-vite/commit/77632c55db51cd6d03bcf24a1cef8d21058100a3)) +* fix changelog beta links ([#20561](https://github.com/vitejs/rolldown-vite/issues/20561)) ([2e0c21a](https://github.com/vitejs/rolldown-vite/commit/2e0c21a07ec5ca7ed5eaa1b6a7d44682fa467a06)) +* fix typecheck ([aa8f700](https://github.com/vitejs/rolldown-vite/commit/aa8f700641bc7871f973774a15269abbf575db35)) +* update 7.1 changelog ([#20560](https://github.com/vitejs/rolldown-vite/issues/20560)) ([d8869b8](https://github.com/vitejs/rolldown-vite/commit/d8869b84208879c7aa6a0268ec073a34760c0d80)) -### Performance Improvements +## [7.1.0](https://github.com/vitejs/rolldown-vite/compare/v7.1.0-beta.2...v7.1.0) (2025-08-07) +### Features + +* support files with more than 1000 lines by `generateCodeFrame` ([#20508](https://github.com/vitejs/rolldown-vite/issues/20508)) ([e7d0b2a](https://github.com/vitejs/rolldown-vite/commit/e7d0b2afa56840dabbbad10015dc04083caaf248)) -* **client:** reduce reload debounce ([#20429](https://github.com/vitejs/vite/issues/20429)) ([22ad43b](https://github.com/vitejs/vite/commit/22ad43b4bf2435efe78a65b84e8469b23521900a)) +### Bug Fixes + +* **css:** avoid warnings for `image-set` containing `__VITE_ASSET__` ([#20520](https://github.com/vitejs/rolldown-vite/issues/20520)) ([f1a2635](https://github.com/vitejs/rolldown-vite/commit/f1a2635e6977a3eda681bec036f64f07686dad0d)) +* **css:** empty CSS entry points should generate CSS files, not JS files ([#20518](https://github.com/vitejs/rolldown-vite/issues/20518)) ([bac9f3e](https://github.com/vitejs/rolldown-vite/commit/bac9f3ecf84ae5c5add6ef224ae057508247f89e)) +* **dev:** denied request stalled when requested concurrently ([#20503](https://github.com/vitejs/rolldown-vite/issues/20503)) ([64a52e7](https://github.com/vitejs/rolldown-vite/commit/64a52e70d9250b16aa81ce2df27c23fe56907257)) +* **manifest:** initialize `entryCssAssetFileNames` as an empty Set ([#20542](https://github.com/vitejs/rolldown-vite/issues/20542)) ([6a46cda](https://github.com/vitejs/rolldown-vite/commit/6a46cdac5dece70296d1179640958deeeb2e6c19)) +* skip prepareOutDirPlugin in workers ([#20556](https://github.com/vitejs/rolldown-vite/issues/20556)) ([97d5111](https://github.com/vitejs/rolldown-vite/commit/97d5111645a395dae48b16b110bc76c1ee8956c8)) ### Miscellaneous Chores -* **deps:** update rolldown-related dependencies ([#20536](https://github.com/vitejs/vite/issues/20536)) ([8be2787](https://github.com/vitejs/vite/commit/8be278748a92b128c49a24619d8d537dd2b08ceb)) -* **deps:** update dependency parse5 to v8 ([#20490](https://github.com/vitejs/vite/issues/20490)) ([744582d](https://github.com/vitejs/vite/commit/744582d0187c50045fb6cf229e3fab13093af08e)) -* format ([f20addc](https://github.com/vitejs/vite/commit/f20addc5363058f5fd797e5bc71fab3877ed0a76)) -* stablize `cssScopeTo` ([#19592](https://github.com/vitejs/vite/issues/19592)) ([ced1343](https://github.com/vitejs/vite/commit/ced13433fb71e2101850a4da1b0ef70cbc38b804)) +* update JSDoc of `experimental.enableNativePlugin` option ([2008da5](https://github.com/vitejs/rolldown-vite/commit/2008da53895a9925e7bc3220c603378f429b4942)) ### Code Refactoring -* use hook filters in the worker plugin ([#20527](https://github.com/vitejs/vite/issues/20527)) ([958cdf2](https://github.com/vitejs/vite/commit/958cdf24f882be6953ca20912dd30c84213b069b)) -* extract prepareOutDir as a plugin ([#20373](https://github.com/vitejs/vite/issues/20373)) ([2c4af1f](https://github.com/vitejs/vite/commit/2c4af1f90b3ac98df6f4585a329528e6bd850462)) -* extract resolve rollup options ([#20375](https://github.com/vitejs/vite/issues/20375)) ([61a9778](https://github.com/vitejs/vite/commit/61a97780e6c54adb87345cb8c1f5f0d8e9ca5c05)) -* rewrite openchrome.applescript to JXA ([#20424](https://github.com/vitejs/vite/issues/20424)) ([7979f9d](https://github.com/vitejs/vite/commit/7979f9da555aa16bd221b32ea78ce8cb5292fac4)) -* use `http-proxy-3` ([#20402](https://github.com/vitejs/vite/issues/20402)) ([26d9872](https://github.com/vitejs/vite/commit/26d987232aad389733a7635b92122bb1d78dfcad)) -* use hook filters in internal plugins ([#20358](https://github.com/vitejs/vite/issues/20358)) ([f19c4d7](https://github.com/vitejs/vite/commit/f19c4d72de142814994e30120aa4ad57552cb874)) -* use hook filters in internal resolve plugin ([#20480](https://github.com/vitejs/vite/issues/20480)) ([acd2a13](https://github.com/vitejs/vite/commit/acd2a13c2d80e8c5c721bcf9738dfc03346cbfe1)) +* deprecate esbuild / optimizeDeps.esbuild options ([#355](https://github.com/vitejs/rolldown-vite/issues/355)) ([4dab15e](https://github.com/vitejs/rolldown-vite/commit/4dab15e92bd312be4b3b237dd999b4a5bf4c4537)) ### Tests -* detect ts support via `process.features` ([#20544](https://github.com/vitejs/vite/issues/20544)) ([856d3f0](https://github.com/vitejs/vite/commit/856d3f06e6889979f630c8453fa385f01d8adaba)) -* fix unimportant errors in test-unit ([#20545](https://github.com/vitejs/vite/issues/20545)) ([1f23554](https://github.com/vitejs/vite/commit/1f235545b14a51d41b19a49da4a7e3a8e8eb5d10)) +* detect ts support via `process.features` ([#20544](https://github.com/vitejs/rolldown-vite/issues/20544)) ([856d3f0](https://github.com/vitejs/rolldown-vite/commit/856d3f06e6889979f630c8453fa385f01d8adaba)) +* fix unimportant errors in test-unit ([#20545](https://github.com/vitejs/rolldown-vite/issues/20545)) ([1f23554](https://github.com/vitejs/rolldown-vite/commit/1f235545b14a51d41b19a49da4a7e3a8e8eb5d10)) -### Beta Changelogs +## [7.1.0-beta.2](https://github.com/vitejs/rolldown-vite/compare/v7.1.0-beta.1...v7.1.0-beta.2) (2025-08-05) +### Features + +* add `import.meta.main` support in config (bundle config loader) ([#20516](https://github.com/vitejs/rolldown-vite/issues/20516)) ([5d3e3c2](https://github.com/vitejs/rolldown-vite/commit/5d3e3c2ae5a2174941fd09fd7842794a287c3ab7)) +* **optimizer:** improve dependency optimization error messages with esbuild formatMessages ([#20525](https://github.com/vitejs/rolldown-vite/issues/20525)) ([d17cfed](https://github.com/vitejs/rolldown-vite/commit/d17cfeda0741e4476570700a00b7b37917c97700)) +* **ssr:** add `import.meta.main` support for Node.js module runner ([#20517](https://github.com/vitejs/rolldown-vite/issues/20517)) ([794a8f2](https://github.com/vitejs/rolldown-vite/commit/794a8f230218a3b1e148defc5a2d7a67409177ff)) + +### Bug Fixes + +* **asset:** only watch existing files for `new URL(, import.meta.url)` ([#20507](https://github.com/vitejs/rolldown-vite/issues/20507)) ([1b211fd](https://github.com/vitejs/rolldown-vite/commit/1b211fd1beccd0fc13bec700815abaa9f54147e8)) +* **client:** keep ping on WS constructor error ([#20512](https://github.com/vitejs/rolldown-vite/issues/20512)) ([3676da5](https://github.com/vitejs/rolldown-vite/commit/3676da5bc5b2b69b28619b8521fca94d30468fe5)) +* **deps:** update all non-major dependencies ([#20537](https://github.com/vitejs/rolldown-vite/issues/20537)) ([fc9a9d3](https://github.com/vitejs/rolldown-vite/commit/fc9a9d3f1493caa3d614f64e0a61fd5684f0928b)) +* don't resolve as relative for specifiers starting with a dot ([#20528](https://github.com/vitejs/rolldown-vite/issues/20528)) ([c5a10ec](https://github.com/vitejs/rolldown-vite/commit/c5a10ec004130bec17cf42760b76d1d404008fa3)) +* **html:** allow control character in input stream ([#20483](https://github.com/vitejs/rolldown-vite/issues/20483)) ([c12a4a7](https://github.com/vitejs/rolldown-vite/commit/c12a4a76a299237a0a13b885c72fdda6e4a3c9b7)) +* merge old and new `noExternal: true` correctly ([#20502](https://github.com/vitejs/rolldown-vite/issues/20502)) ([9ebe4a5](https://github.com/vitejs/rolldown-vite/commit/9ebe4a514a2e48e3fe194f16b0556a45ff38077a)) + +### Miscellaneous Chores -#### [7.1.0-beta.1](https://github.com/vitejs/vite/compare/v7.1.0-beta.0...v7.1.0-beta.1) (2025-08-05) +* **deps:** update rolldown-related dependencies ([#20536](https://github.com/vitejs/rolldown-vite/issues/20536)) ([8be2787](https://github.com/vitejs/rolldown-vite/commit/8be278748a92b128c49a24619d8d537dd2b08ceb)) -See [7.1.0-beta.1 changelog](https://github.com/vitejs/vite/blob/v7.1.0-beta.1/packages/vite/CHANGELOG.md) +### Code Refactoring -#### [7.1.0-beta.0](https://github.com/vitejs/vite/compare/v7.0.6...v7.1.0-beta.0) (2025-07-30) +* use hook filters in the worker plugin ([#20527](https://github.com/vitejs/rolldown-vite/issues/20527)) ([958cdf2](https://github.com/vitejs/rolldown-vite/commit/958cdf24f882be6953ca20912dd30c84213b069b)) -See [7.1.0-beta.0 changelog](https://github.com/vitejs/vite/blob/v7.1.0-beta.0/packages/vite/CHANGELOG.md) +## [7.1.0-beta.1](https://github.com/vitejs/rolldown-vite/compare/v7.1.0-beta.0...v7.1.0-beta.1) (2025-08-05) +### Features +* enable native resolver by default ([#346](https://github.com/vitejs/rolldown-vite/issues/346)) ([793cf71](https://github.com/vitejs/rolldown-vite/commit/793cf716df2e38995012c0cdd68c651b4fd881c2)) -## [7.0.6](https://github.com/vitejs/vite/compare/v7.0.5...v7.0.6) (2025-07-24) ### Bug Fixes -* **deps:** update all non-major dependencies ([#20442](https://github.com/vitejs/vite/issues/20442)) ([e49f505](https://github.com/vitejs/vite/commit/e49f50599d852eec644e79b074b4648e2dff1e5d)) -* **dev:** incorrect sourcemap when optimized CJS is imported ([#20458](https://github.com/vitejs/vite/issues/20458)) ([ead2dec](https://github.com/vitejs/vite/commit/ead2dec74170ad26db8a18bbd68f075efaceb0e3)) -* **module-runner:** normalize file:// on windows ([#20449](https://github.com/vitejs/vite/issues/20449)) ([1c9cb49](https://github.com/vitejs/vite/commit/1c9cb493f0467c463113d301b00ce07cbe4b6f58)) -* respond with correct headers and status code for HEAD requests ([#20421](https://github.com/vitejs/vite/issues/20421)) ([23d04fc](https://github.com/vitejs/vite/commit/23d04fc2d8a4fcf7c2011418693d6000748aa655)) +* watch the config file itself ([#354](https://github.com/vitejs/rolldown-vite/issues/354)) ([6958a48](https://github.com/vitejs/rolldown-vite/commit/6958a484d0857953744c13d17094c996bec30c75)) + +### Code Refactoring + +* introduce `*.rolldownOptions` and deprecate `*.rollupOptions` ([#348](https://github.com/vitejs/rolldown-vite/issues/348)) ([80dc4d6](https://github.com/vitejs/rolldown-vite/commit/80dc4d6a11c32fef7cb5fe3048ff8c2a22d90203)) + +## [7.1.0-beta.0](https://github.com/vitejs/rolldown-vite/compare/v7.0.12...v7.1.0-beta.0) (2025-08-04) +### Features + +* add `future: 'warn'` ([#20473](https://github.com/vitejs/rolldown-vite/issues/20473)) ([e6aaf17](https://github.com/vitejs/rolldown-vite/commit/e6aaf17ca21544572941957ce71bd8dbdc94e402)) +* add `removeServerPluginContainer` future deprecation ([#20437](https://github.com/vitejs/rolldown-vite/issues/20437)) ([c1279e7](https://github.com/vitejs/rolldown-vite/commit/c1279e75401ac6ea1d0678da88414a76ff36b6fe)) +* add `removeServerReloadModule` future deprecation ([#20436](https://github.com/vitejs/rolldown-vite/issues/20436)) ([6970d17](https://github.com/vitejs/rolldown-vite/commit/6970d1740cebd56af696abf60f30adb0c060f578)) +* add `server.warmupRequest` to future deprecation ([#20431](https://github.com/vitejs/rolldown-vite/issues/20431)) ([8ad388a](https://github.com/vitejs/rolldown-vite/commit/8ad388aeab0dc79e4bc14859b91174427805a46b)) +* add `ssrFixStacktrace` / `ssrRewriteStacktrace` to `removeSsrLoadModule` future deprecation ([#20435](https://github.com/vitejs/rolldown-vite/issues/20435)) ([8c8f587](https://github.com/vitejs/rolldown-vite/commit/8c8f5879ead251705c2c363f5b8b94f618fbf374)) +* bump rolldown ([16fa088](https://github.com/vitejs/rolldown-vite/commit/16fa088ed2ba7cba3dd02f20e5aea115ab8c38db)) +* **client:** ping from SharedWorker ([#19057](https://github.com/vitejs/rolldown-vite/issues/19057)) ([5c97c22](https://github.com/vitejs/rolldown-vite/commit/5c97c22548476e5f80856ece1d80b9234a7e6ecb)) +* **dev:** add `this.fs` support ([#20301](https://github.com/vitejs/rolldown-vite/issues/20301)) ([0fe3f2f](https://github.com/vitejs/rolldown-vite/commit/0fe3f2f7c325c5990f1059c28b66b24e1b8fd5d3)) +* export `defaultExternalConditions` ([#20279](https://github.com/vitejs/rolldown-vite/issues/20279)) ([344d302](https://github.com/vitejs/rolldown-vite/commit/344d30243b107852b133175e947a0410ea703f00)) +* implement `removePluginHookSsrArgument` future deprecation ([#20433](https://github.com/vitejs/rolldown-vite/issues/20433)) ([95927d9](https://github.com/vitejs/rolldown-vite/commit/95927d9c0ba1cb0b3bd8c900f039c099f8e29f90)) +* implement `removeServerHot` future deprecation ([#20434](https://github.com/vitejs/rolldown-vite/issues/20434)) ([259f45d](https://github.com/vitejs/rolldown-vite/commit/259f45d0698a184d6ecc352b610001fa1acdcee1)) +* resolve server URLs before calling other listeners ([#19981](https://github.com/vitejs/rolldown-vite/issues/19981)) ([45f6443](https://github.com/vitejs/rolldown-vite/commit/45f6443a935258d8eee62874f0695b8c1c60a481)) +* **ssr:** resolve externalized packages with `resolve.externalConditions` and add `module-sync` to default external condition ([#20409](https://github.com/vitejs/rolldown-vite/issues/20409)) ([c669c52](https://github.com/vitejs/rolldown-vite/commit/c669c524e6008a4902169f4b2f865e892297acf3)) +* **ssr:** support `import.meta.resolve` in module runner ([#20260](https://github.com/vitejs/rolldown-vite/issues/20260)) ([62835f7](https://github.com/vitejs/rolldown-vite/commit/62835f7c06d37802f0bc2abbf58bbaeaa8c73ce5)) + +### Bug Fixes + +* apply https://github.com/vitejs/vite/pull/20503 ([a7b6ce0](https://github.com/vitejs/rolldown-vite/commit/a7b6ce01da56f948100491b0c9d3097e205a95e7)) +* **deps:** update all non-major dependencies ([#20489](https://github.com/vitejs/rolldown-vite/issues/20489)) ([f6aa04a](https://github.com/vitejs/rolldown-vite/commit/f6aa04a52d486c8881f666c450caa3dab3c6bba1)) +* **dev:** denied requests overly ([#20410](https://github.com/vitejs/rolldown-vite/issues/20410)) ([4be5270](https://github.com/vitejs/rolldown-vite/commit/4be5270b27f7e6323f1771974b4b3520d86600e4)) +* **hmr:** register css deps as `type: asset` ([#20391](https://github.com/vitejs/rolldown-vite/issues/20391)) ([7eac8dd](https://github.com/vitejs/rolldown-vite/commit/7eac8ddb65033b8c001d6c6bc46aaeeefb79680a)) +* **optimizer:** discover correct jsx runtime during scan ([#20495](https://github.com/vitejs/rolldown-vite/issues/20495)) ([10d48bb](https://github.com/vitejs/rolldown-vite/commit/10d48bb2e30824d217e415a58cea9e69c2820c2a)) +* **preview:** set correct host for `resolvedUrls` ([#20496](https://github.com/vitejs/rolldown-vite/issues/20496)) ([62b3e0d](https://github.com/vitejs/rolldown-vite/commit/62b3e0d95c143e2f8b4e88d99c381d23663025ee)) +* **worker:** resolve WebKit compat with inline workers by deferring blob URL revocation ([#20460](https://github.com/vitejs/rolldown-vite/issues/20460)) ([8033e5b](https://github.com/vitejs/rolldown-vite/commit/8033e5bf8d3ff43995d0620490ed8739c59171dd)) + +### Performance Improvements + +* **client:** reduce reload debounce ([#20429](https://github.com/vitejs/rolldown-vite/issues/20429)) ([22ad43b](https://github.com/vitejs/rolldown-vite/commit/22ad43b4bf2435efe78a65b84e8469b23521900a)) ### Miscellaneous Chores -* **deps:** update rolldown-related dependencies ([#20441](https://github.com/vitejs/vite/issues/20441)) ([f689d61](https://github.com/vitejs/vite/commit/f689d613429ae9452c74f8bc482d8cc2584ea6b8)) -* remove some files from prettier ignore ([#20459](https://github.com/vitejs/vite/issues/20459)) ([8403f69](https://github.com/vitejs/vite/commit/8403f69551131b5c39bfaf242ffac2e5efcd1dd6)) +* **deps:** update dependency parse5 to v8 ([#20490](https://github.com/vitejs/rolldown-vite/issues/20490)) ([744582d](https://github.com/vitejs/rolldown-vite/commit/744582d0187c50045fb6cf229e3fab13093af08e)) +* fix type error ([f2f4529](https://github.com/vitejs/rolldown-vite/commit/f2f45292366a68a7e6f7477d136f9dc3b9bae6a8)) +* format ([f20addc](https://github.com/vitejs/rolldown-vite/commit/f20addc5363058f5fd797e5bc71fab3877ed0a76)) +* stablize `cssScopeTo` ([#19592](https://github.com/vitejs/rolldown-vite/issues/19592)) ([ced1343](https://github.com/vitejs/rolldown-vite/commit/ced13433fb71e2101850a4da1b0ef70cbc38b804)) ### Code Refactoring -* use environment transform request ([#20430](https://github.com/vitejs/vite/issues/20430)) ([24e6a0c](https://github.com/vitejs/vite/commit/24e6a0c3165557396db6ab59d3001e037c76ce32)) +* extract prepareOutDir as a plugin ([#20373](https://github.com/vitejs/rolldown-vite/issues/20373)) ([2c4af1f](https://github.com/vitejs/rolldown-vite/commit/2c4af1f90b3ac98df6f4585a329528e6bd850462)) +* extract resolve rollup options ([#20375](https://github.com/vitejs/rolldown-vite/issues/20375)) ([61a9778](https://github.com/vitejs/rolldown-vite/commit/61a97780e6c54adb87345cb8c1f5f0d8e9ca5c05)) +* rewrite openchrome.applescript to JXA ([#20424](https://github.com/vitejs/rolldown-vite/issues/20424)) ([7979f9d](https://github.com/vitejs/rolldown-vite/commit/7979f9da555aa16bd221b32ea78ce8cb5292fac4)) +* use `http-proxy-3` ([#20402](https://github.com/vitejs/rolldown-vite/issues/20402)) ([26d9872](https://github.com/vitejs/rolldown-vite/commit/26d987232aad389733a7635b92122bb1d78dfcad)) +* use hook filters in internal plugins ([#20358](https://github.com/vitejs/rolldown-vite/issues/20358)) ([f19c4d7](https://github.com/vitejs/rolldown-vite/commit/f19c4d72de142814994e30120aa4ad57552cb874)) +* use hook filters in internal resolve plugin ([#20480](https://github.com/vitejs/rolldown-vite/issues/20480)) ([acd2a13](https://github.com/vitejs/rolldown-vite/commit/acd2a13c2d80e8c5c721bcf9738dfc03346cbfe1)) + +## [7.0.12](https://github.com/vitejs/rolldown-vite/compare/v7.0.11...v7.0.12) (2025-07-30) +### Features + +* bump rolldown ([#344](https://github.com/vitejs/rolldown-vite/issues/344)) ([56f94c7](https://github.com/vitejs/rolldown-vite/commit/56f94c7c1c1a23188f3ac41925b3bd7e52240c2d)) +* **native-plugin:** output warn / debug logs from resolver ([#343](https://github.com/vitejs/rolldown-vite/issues/343)) ([2ea6194](https://github.com/vitejs/rolldown-vite/commit/2ea61943c4a1934d3268ef5c42655a98c54b7130)) + +### Bug Fixes + +* reset viteMetadata in watch mode ([#342](https://github.com/vitejs/rolldown-vite/issues/342)) ([e2bb54e](https://github.com/vitejs/rolldown-vite/commit/e2bb54e794947c45e2a438c2df187e953ac5916c)) + +### Miscellaneous Chores + +* update rolldown-plugin-dts ([2c4159e](https://github.com/vitejs/rolldown-vite/commit/2c4159e516d63fd8f180b507fc2c561fbb3ee52e)) + +## [7.0.11](https://github.com/vitejs/rolldown-vite/compare/v7.0.10...v7.0.11) (2025-07-25) +### Features + +* **native-plugin:** inject css and assets for native manifest plugin ([#335](https://github.com/vitejs/rolldown-vite/issues/335)) ([f16e598](https://github.com/vitejs/rolldown-vite/commit/f16e598e0ed6a5316cb8a5f8f3b47acd68c1ef4d)) -## [7.0.5](https://github.com/vitejs/vite/compare/v7.0.4...v7.0.5) (2025-07-17) ### Bug Fixes -* **deps:** update all non-major dependencies ([#20406](https://github.com/vitejs/vite/issues/20406)) ([1a1cc8a](https://github.com/vitejs/vite/commit/1a1cc8a435a21996255b3e5cc75ed4680de2a7f3)) -* remove special handling for `Accept: text/html` ([#20376](https://github.com/vitejs/vite/issues/20376)) ([c9614b9](https://github.com/vitejs/vite/commit/c9614b9c378be4a32e84f37be71a8becce52af7b)) -* watch assets referenced by `new URL(, import.meta.url)` ([#20382](https://github.com/vitejs/vite/issues/20382)) ([6bc8bf6](https://github.com/vitejs/vite/commit/6bc8bf634d4a2c9915da9813963dd80a4186daeb)) +* **deps:** update all non-major dependencies ([#20442](https://github.com/vitejs/rolldown-vite/issues/20442)) ([e49f505](https://github.com/vitejs/rolldown-vite/commit/e49f50599d852eec644e79b074b4648e2dff1e5d)) +* **dev:** incorrect sourcemap when optimized CJS is imported ([#20458](https://github.com/vitejs/rolldown-vite/issues/20458)) ([ead2dec](https://github.com/vitejs/rolldown-vite/commit/ead2dec74170ad26db8a18bbd68f075efaceb0e3)) +* **lib:** keep annotation comments for es output ([#337](https://github.com/vitejs/rolldown-vite/issues/337)) ([c252dee](https://github.com/vitejs/rolldown-vite/commit/c252dee98a0195a13d83b3fd51f8ac3f15c85e32)) +* **module-runner:** normalize file:// on windows ([#20449](https://github.com/vitejs/rolldown-vite/issues/20449)) ([1c9cb49](https://github.com/vitejs/rolldown-vite/commit/1c9cb493f0467c463113d301b00ce07cbe4b6f58)) +* respond with correct headers and status code for HEAD requests ([#20421](https://github.com/vitejs/rolldown-vite/issues/20421)) ([23d04fc](https://github.com/vitejs/rolldown-vite/commit/23d04fc2d8a4fcf7c2011418693d6000748aa655)) +* **worker:** match worker import meta more quickly ([#336](https://github.com/vitejs/rolldown-vite/issues/336)) ([8cab72c](https://github.com/vitejs/rolldown-vite/commit/8cab72c3dac6ac3203c0b90c4b47673b88100071)) ### Miscellaneous Chores -* **deps:** update dependency rolldown to ^1.0.0-beta.27 ([#20405](https://github.com/vitejs/vite/issues/20405)) ([1165667](https://github.com/vitejs/vite/commit/1165667b271fb1fb76584278e72a85d564c9bb09)) +* **deps:** update rolldown-related dependencies ([#20441](https://github.com/vitejs/rolldown-vite/issues/20441)) ([f689d61](https://github.com/vitejs/rolldown-vite/commit/f689d613429ae9452c74f8bc482d8cc2584ea6b8)) +* remove some files from prettier ignore ([#20459](https://github.com/vitejs/rolldown-vite/issues/20459)) ([8403f69](https://github.com/vitejs/rolldown-vite/commit/8403f69551131b5c39bfaf242ffac2e5efcd1dd6)) + +## [7.0.10](https://github.com/vitejs/rolldown-vite/compare/v7.0.9...v7.0.10) (2025-07-22) +### Features + +* update rolldown ([2bbf424](https://github.com/vitejs/rolldown-vite/commit/2bbf424be20ff7f234b23af1b17bf6b3de5b01ed)) +* warn when `esbuild: false` is set but `oxc: false` is not set ([24c0417](https://github.com/vitejs/rolldown-vite/commit/24c04177c3df865349734ca8c665458a5699da8f)) + +### Bug Fixes + +* **deps:** update all non-major dependencies ([#20406](https://github.com/vitejs/rolldown-vite/issues/20406)) ([1a1cc8a](https://github.com/vitejs/rolldown-vite/commit/1a1cc8a435a21996255b3e5cc75ed4680de2a7f3)) +* remove special handling for `Accept: text/html` ([#20376](https://github.com/vitejs/rolldown-vite/issues/20376)) ([c9614b9](https://github.com/vitejs/rolldown-vite/commit/c9614b9c378be4a32e84f37be71a8becce52af7b)) +* watch assets referenced by `new URL(, import.meta.url)` ([#20382](https://github.com/vitejs/rolldown-vite/issues/20382)) ([6bc8bf6](https://github.com/vitejs/rolldown-vite/commit/6bc8bf634d4a2c9915da9813963dd80a4186daeb)) + +### Miscellaneous Chores + +* **deps:** update dependency rolldown to ^1.0.0-beta.27 ([#20405](https://github.com/vitejs/rolldown-vite/issues/20405)) ([1165667](https://github.com/vitejs/rolldown-vite/commit/1165667b271fb1fb76584278e72a85d564c9bb09)) ### Code Refactoring -* use `foo.endsWith("bar")` instead of `/bar$/.test(foo)` ([#20413](https://github.com/vitejs/vite/issues/20413)) ([862e192](https://github.com/vitejs/vite/commit/862e192d21f66039635a998724bdc6b94fd293a0)) +* use `foo.endsWith("bar")` instead of `/bar$/.test(foo)` ([#20413](https://github.com/vitejs/rolldown-vite/issues/20413)) ([862e192](https://github.com/vitejs/rolldown-vite/commit/862e192d21f66039635a998724bdc6b94fd293a0)) +* use environment transform request ([#20430](https://github.com/vitejs/rolldown-vite/issues/20430)) ([24e6a0c](https://github.com/vitejs/rolldown-vite/commit/24e6a0c3165557396db6ab59d3001e037c76ce32)) + +## [7.0.9](https://github.com/vitejs/rolldown-vite/compare/v7.0.8...v7.0.9) (2025-07-14) +### Features + +* update rolldown ([722cbf8](https://github.com/vitejs/rolldown-vite/commit/722cbf82a1603040bfeb7830eb4ee59f528f908c)) + +### Miscellaneous Chores + +* update some "rollup" -> "rolldown" ([ce60f95](https://github.com/vitejs/rolldown-vite/commit/ce60f955e14966f9276d68683fe76bfee4a911ec)) + +## [7.0.8](https://github.com/vitejs/rolldown-vite/compare/v7.0.7...v7.0.8) (2025-07-11) +### Features + +* update rolldown ([98ca5e3](https://github.com/vitejs/rolldown-vite/commit/98ca5e3cbd97718e05d53c617069db35378ce83e)) -## [7.0.4](https://github.com/vitejs/vite/compare/v7.0.3...v7.0.4) (2025-07-10) ### Bug Fixes -* allow resolving bare specifiers to relative paths for entries ([#20379](https://github.com/vitejs/vite/issues/20379)) ([324669c](https://github.com/vitejs/vite/commit/324669c2d84966a822b1b2c134c9830a90bed271)) +* allow resolving bare specifiers to relative paths for entries ([#20379](https://github.com/vitejs/rolldown-vite/issues/20379)) ([324669c](https://github.com/vitejs/rolldown-vite/commit/324669c2d84966a822b1b2c134c9830a90bed271)) + +## [7.0.7](https://github.com/vitejs/rolldown-vite/compare/v7.0.6...v7.0.7) (2025-07-10) +### Features + +* enable `output.minifyInternalExports` by default ([#322](https://github.com/vitejs/rolldown-vite/issues/322)) ([287a36e](https://github.com/vitejs/rolldown-vite/commit/287a36e85a6ea5076e78de8170ed524ee24dca10)) +* update rolldown ([949076c](https://github.com/vitejs/rolldown-vite/commit/949076c086c3edd8728bfcf4e464d34c8685cdda)) + +### Bug Fixes + +* disable refresh for non-jsx without react import ([#318](https://github.com/vitejs/rolldown-vite/issues/318)) ([de24b6b](https://github.com/vitejs/rolldown-vite/commit/de24b6bd8c3c5825ae72d3b8a7d95212245837b3)) + +### Code Refactoring + +* use Rolldown's `@oxc-project/runtime` ([#321](https://github.com/vitejs/rolldown-vite/issues/321)) ([d352c1b](https://github.com/vitejs/rolldown-vite/commit/d352c1b5153056c4ff1b85ba5a4690763ae8158a)) ### Build System -* remove `@oxc-project/runtime` devDep ([#20389](https://github.com/vitejs/vite/issues/20389)) ([5e29602](https://github.com/vitejs/vite/commit/5e29602f6fe4bf28f6e7c869a214dee6957f855c)) +* remove `@oxc-project/runtime` devDep ([#20389](https://github.com/vitejs/rolldown-vite/issues/20389)) ([5e29602](https://github.com/vitejs/rolldown-vite/commit/5e29602f6fe4bf28f6e7c869a214dee6957f855c)) + +## [7.0.6](https://github.com/vitejs/rolldown-vite/compare/v7.0.5...v7.0.6) (2025-07-08) +### Features + +* enable `treeshake.commonjs` by default ([#313](https://github.com/vitejs/rolldown-vite/issues/313)) ([d1efdd0](https://github.com/vitejs/rolldown-vite/commit/d1efdd02340661f031afc3f5953d95f03503f573)) +* enable decorator-metadata transform automatically ([#315](https://github.com/vitejs/rolldown-vite/issues/315)) ([36a8ca4](https://github.com/vitejs/rolldown-vite/commit/36a8ca464e3f46f338080fd3ceac026b48008343)) -## [7.0.3](https://github.com/vitejs/vite/compare/v7.0.2...v7.0.3) (2025-07-08) ### Bug Fixes -* **client:** protect against window being defined but addEv undefined ([#20359](https://github.com/vitejs/vite/issues/20359)) ([31d1467](https://github.com/vitejs/vite/commit/31d1467cf0da1e1dca623e6df0d345b30fae0c3d)) -* **define:** replace optional values ([#20338](https://github.com/vitejs/vite/issues/20338)) ([9465ae1](https://github.com/vitejs/vite/commit/9465ae1378b456e08659a22286bee6bce8edeedc)) -* **deps:** update all non-major dependencies ([#20366](https://github.com/vitejs/vite/issues/20366)) ([43ac73d](https://github.com/vitejs/vite/commit/43ac73da27b3907c701e95e6a7d28fde659729ec)) +* **client:** protect against window being defined but addEv undefined ([#20359](https://github.com/vitejs/rolldown-vite/issues/20359)) ([31d1467](https://github.com/vitejs/rolldown-vite/commit/31d1467cf0da1e1dca623e6df0d345b30fae0c3d)) +* **define:** replace optional values ([#20338](https://github.com/vitejs/rolldown-vite/issues/20338)) ([9465ae1](https://github.com/vitejs/rolldown-vite/commit/9465ae1378b456e08659a22286bee6bce8edeedc)) +* **deps:** update all non-major dependencies ([#20366](https://github.com/vitejs/rolldown-vite/issues/20366)) ([43ac73d](https://github.com/vitejs/rolldown-vite/commit/43ac73da27b3907c701e95e6a7d28fde659729ec)) +* **legacy:** fix remaining issues ([#312](https://github.com/vitejs/rolldown-vite/issues/312)) ([5d7dc73](https://github.com/vitejs/rolldown-vite/commit/5d7dc73cdbed9a7daae2390b4372be724e220372)) ### Miscellaneous Chores -* **deps:** update dependency dotenv to v17 ([#20325](https://github.com/vitejs/vite/issues/20325)) ([45040d4](https://github.com/vitejs/vite/commit/45040d48076302eeb101f8d07bbcd04758fde8a4)) -* **deps:** update dependency rolldown to ^1.0.0-beta.24 ([#20365](https://github.com/vitejs/vite/issues/20365)) ([5ab25e7](https://github.com/vitejs/vite/commit/5ab25e73a2ea2a2e2c0469350288a183dfb57030)) -* use `n/prefer-node-protocol` rule ([#20368](https://github.com/vitejs/vite/issues/20368)) ([38bb268](https://github.com/vitejs/vite/commit/38bb268cde15541321f36016e77d61eecb707298)) +* **deps:** update dependency dotenv to v17 ([#20325](https://github.com/vitejs/rolldown-vite/issues/20325)) ([45040d4](https://github.com/vitejs/rolldown-vite/commit/45040d48076302eeb101f8d07bbcd04758fde8a4)) +* **deps:** update dependency rolldown to ^1.0.0-beta.24 ([#20365](https://github.com/vitejs/rolldown-vite/issues/20365)) ([5ab25e7](https://github.com/vitejs/rolldown-vite/commit/5ab25e73a2ea2a2e2c0469350288a183dfb57030)) +* use `n/prefer-node-protocol` rule ([#20368](https://github.com/vitejs/rolldown-vite/issues/20368)) ([38bb268](https://github.com/vitejs/rolldown-vite/commit/38bb268cde15541321f36016e77d61eecb707298)) ### Code Refactoring -* minor changes to reduce diff between normal Vite and rolldown-vite ([#20354](https://github.com/vitejs/vite/issues/20354)) ([2e8050e](https://github.com/vitejs/vite/commit/2e8050e4cd8835673baf07375b7db35128144222)) +* minor changes to reduce diff between normal Vite and rolldown-vite ([#20354](https://github.com/vitejs/rolldown-vite/issues/20354)) ([2e8050e](https://github.com/vitejs/rolldown-vite/commit/2e8050e4cd8835673baf07375b7db35128144222)) + +## [7.0.5](https://github.com/vitejs/rolldown-vite/compare/v7.0.4...v7.0.5) (2025-07-07) +### Features + +* make oxc runtime helpers name mangle-able ([#306](https://github.com/vitejs/rolldown-vite/issues/306)) ([d9627ee](https://github.com/vitejs/rolldown-vite/commit/d9627ee1f2f048e1c51cb70c3d69c848de07b5f5)) +* plugin legacy ([#293](https://github.com/vitejs/rolldown-vite/issues/293)) ([e1ef2e5](https://github.com/vitejs/rolldown-vite/commit/e1ef2e58068a1185e1af10d076a7bb4b5514f21b)) +* update rolldown and support custom configs for native dynamic import vars plugin ([#310](https://github.com/vitejs/rolldown-vite/issues/310)) ([3f07670](https://github.com/vitejs/rolldown-vite/commit/3f076704917b468bbc87083d5bd562828330af06)) -## [7.0.2](https://github.com/vitejs/vite/compare/v7.0.1...v7.0.2) (2025-07-04) ### Bug Fixes -* **css:** resolve relative paths in sass, revert [#20300](https://github.com/vitejs/vite/issues/20300) ([#20349](https://github.com/vitejs/vite/issues/20349)) ([db8bd41](https://github.com/vitejs/vite/commit/db8bd412a8b783fe8e9f82d1a822b0534abbf5a3)) +* accept umd with only default export ([#305](https://github.com/vitejs/rolldown-vite/issues/305)) ([12f8197](https://github.com/vitejs/rolldown-vite/commit/12f81973e359a707e75bc5cf70a2e1c0132d1ce7)) +* correct "Unexpected IIFE format" shown for UMD output ([139d016](https://github.com/vitejs/rolldown-vite/commit/139d016b6750e938e4b2923d677975556eb34c87)) +* **css:** resolve relative paths in sass, revert [#20300](https://github.com/vitejs/rolldown-vite/issues/20300) ([#20349](https://github.com/vitejs/rolldown-vite/issues/20349)) ([db8bd41](https://github.com/vitejs/rolldown-vite/commit/db8bd412a8b783fe8e9f82d1a822b0534abbf5a3)) +* inject oxc runtime helpers correctly when multiple helpers are required ([#311](https://github.com/vitejs/rolldown-vite/issues/311)) ([6c5f468](https://github.com/vitejs/rolldown-vite/commit/6c5f46863c625e2ee7508cd02acd5de37c64be70)) + +### Miscellaneous Chores + +* fix typos and grammatical errors across documentation and comments ([#20337](https://github.com/vitejs/rolldown-vite/issues/20337)) ([c1c951d](https://github.com/vitejs/rolldown-vite/commit/c1c951dcc32ec9f133b03ebbceddd749fc14f1e9)) +* group commits by category in changelog ([#20310](https://github.com/vitejs/rolldown-vite/issues/20310)) ([41e83f6](https://github.com/vitejs/rolldown-vite/commit/41e83f62b1adb65f5af4c1ec006de1c845437edc)) +* reduce diff ([a657265](https://github.com/vitejs/rolldown-vite/commit/a6572654bea3942e3bbc5eca3fd35f7cbbb773f0)) + +## [7.0.4](https://github.com/vitejs/rolldown-vite/compare/v7.0.3...v7.0.4) (2025-07-02) +### Features + +* **native-plugin:** avoid presetting `process.env.NODE_ENV` when platform is `browser` ([#290](https://github.com/vitejs/rolldown-vite/issues/290)) ([6058493](https://github.com/vitejs/rolldown-vite/commit/605849358d50400d70aa0e3c8e64f42d80f8fe59)) +* **native-plugin:** pass `decodedBase` to `nativeWasmHelperPlugin` ([#300](https://github.com/vitejs/rolldown-vite/issues/300)) ([2d7ce9a](https://github.com/vitejs/rolldown-vite/commit/2d7ce9a18585536da9d3835584da557d86a68153)) +* **native-plugin:** use js define plugin in dev environment ([#298](https://github.com/vitejs/rolldown-vite/issues/298)) ([c45adb3](https://github.com/vitejs/rolldown-vite/commit/c45adb3fa0b0c53756a6910e0073409d2dec6bf5)) +* update rolldown and support `resolveSubpathImports` for `oxcResolvePlugin` ([#287](https://github.com/vitejs/rolldown-vite/issues/287)) ([5c0dddb](https://github.com/vitejs/rolldown-vite/commit/5c0dddbf30db0edc2e9017a3ab4973ba0938c544)) -## [7.0.1](https://github.com/vitejs/vite/compare/v7.0.0...v7.0.1) (2025-07-03) ### Bug Fixes -* **css:** skip resolving resolved paths in sass ([#20300](https://github.com/vitejs/vite/issues/20300)) ([ac528a4](https://github.com/vitejs/vite/commit/ac528a44c384fefb6f10c3f531df93b5ac39324c)) -* **deps:** update all non-major dependencies ([#20324](https://github.com/vitejs/vite/issues/20324)) ([3e81af3](https://github.com/vitejs/vite/commit/3e81af38a80c7617aba6bf3300d8b4267570f9cf)) -* **types:** add a global interface for Worker ([#20243](https://github.com/vitejs/vite/issues/20243)) ([37bdfc1](https://github.com/vitejs/vite/commit/37bdfc18f4c5bed053a38c5d717df33036acdd62)) +* **deps:** update all non-major dependencies ([#20324](https://github.com/vitejs/rolldown-vite/issues/20324)) ([3e81af3](https://github.com/vitejs/rolldown-vite/commit/3e81af38a80c7617aba6bf3300d8b4267570f9cf)) ### Miscellaneous Chores -* **deps:** update rolldown-related dependencies ([#20323](https://github.com/vitejs/vite/issues/20323)) ([30d2f1b](https://github.com/vitejs/vite/commit/30d2f1b38c72387ffdca3ee4746730959a020b59)) -* fix typos and grammatical errors across documentation and comments ([#20337](https://github.com/vitejs/vite/issues/20337)) ([c1c951d](https://github.com/vitejs/vite/commit/c1c951dcc32ec9f133b03ebbceddd749fc14f1e9)) -* group commits by category in changelog ([#20310](https://github.com/vitejs/vite/issues/20310)) ([41e83f6](https://github.com/vitejs/vite/commit/41e83f62b1adb65f5af4c1ec006de1c845437edc)) -* rearrange 7.0 changelog ([#20280](https://github.com/vitejs/vite/issues/20280)) ([eafd28a](https://github.com/vitejs/vite/commit/eafd28ac88d5908cbc3e0a047ed7a12094386436)) +* **deps:** update rolldown-related dependencies ([#20323](https://github.com/vitejs/rolldown-vite/issues/20323)) ([30d2f1b](https://github.com/vitejs/rolldown-vite/commit/30d2f1b38c72387ffdca3ee4746730959a020b59)) -## [7.0.0](https://github.com/vitejs/vite/compare/v7.0.0-beta.2...v7.0.0) (2025-06-24) +## [7.0.3](https://github.com/vitejs/rolldown-vite/compare/v7.0.2...v7.0.3) (2025-06-27) +### Features -![Vite 7 is out!](../../docs/public/og-image-announcing-vite7.png) +* add `resolve.tsconfigPaths` option to resolve with tsconfig paths ([#277](https://github.com/vitejs/rolldown-vite/issues/277)) ([5f3ce8b](https://github.com/vitejs/rolldown-vite/commit/5f3ce8b142a76d912ee5fd617ebb3492058c2fc3)) +* update rolldown ([d499b50](https://github.com/vitejs/rolldown-vite/commit/d499b505114d31586c5e885ac5e210a31e17e641)) -Today, we're excited to announce the release of the next Vite major: +### Bug Fixes -- **[Vite 7.0 announcement blog post](https://vite.dev/blog/announcing-vite7.html)** -- [Docs](https://vite.dev/) (translations: [简体中文](https://cn.vite.dev/), [日本語](https://ja.vite.dev/), [Español](https://es.vite.dev/), [Português](https://pt.vite.dev/), [한국어](https://ko.vite.dev/), [Deutsch](https://de.vite.dev/), [فارسی](https://fa.vite.dev/)) -- [Migration Guide](https://vite.dev/guide/migration.html) +* **css:** skip resolving resolved paths in sass ([#20300](https://github.com/vitejs/rolldown-vite/issues/20300)) ([ac528a4](https://github.com/vitejs/rolldown-vite/commit/ac528a44c384fefb6f10c3f531df93b5ac39324c)) +* **types:** add a global interface for Worker ([#20243](https://github.com/vitejs/rolldown-vite/issues/20243)) ([37bdfc1](https://github.com/vitejs/rolldown-vite/commit/37bdfc18f4c5bed053a38c5d717df33036acdd62)) + +## [7.0.2](https://github.com/vitejs/rolldown-vite/compare/v7.0.1...v7.0.2) (2025-06-26) +### Features + +* update rolldown ([0100764](https://github.com/vitejs/rolldown-vite/commit/01007646e4be4c483d13889f93ed86b06e305d22)) + +## [7.0.1](https://github.com/vitejs/rolldown-vite/compare/v7.0.0...v7.0.1) (2025-06-25) +### Features + +* update rolldown ([#279](https://github.com/vitejs/rolldown-vite/issues/279)) ([0b5708b](https://github.com/vitejs/rolldown-vite/commit/0b5708bde2f675bee2f28dc5616083c3b47da4f3)) +## [7.0.0](https://github.com/vitejs/rolldown-vite/compare/v7.0.0-beta.0...v7.0.0) (2025-06-24) +### Features + +* apply some middlewares before `configurePreviewServer` hook ([#20224](https://github.com/vitejs/rolldown-vite/issues/20224)) ([b989c42](https://github.com/vitejs/rolldown-vite/commit/b989c42cf84378e6cb93970de739941f0d56d6f6)) +* apply some middlewares before `configureServer` hook ([#20222](https://github.com/vitejs/rolldown-vite/issues/20222)) ([f5cc4c0](https://github.com/vitejs/rolldown-vite/commit/f5cc4c0ded337670b439e51bc95f173e2b5cf9ad)) +* **native-plugin:** fallback to js alias plugin when alias entries include `customResolver` ([#280](https://github.com/vitejs/rolldown-vite/issues/280)) ([de9074c](https://github.com/vitejs/rolldown-vite/commit/de9074c5299fccd6e37bd0d47c623ea654d66036)) +* **types:** use terser types from terser package ([#20274](https://github.com/vitejs/rolldown-vite/issues/20274)) ([a5799fa](https://github.com/vitejs/rolldown-vite/commit/a5799fa74c6190ecbb2da3d280136ff32463afc6)) + +### Bug Fixes + +* **deps:** update all non-major dependencies ([#20271](https://github.com/vitejs/rolldown-vite/issues/20271)) ([6b64d63](https://github.com/vitejs/rolldown-vite/commit/6b64d63d700154de2c00270300b671cef8863708)) +* keep `import.meta.url` in bundled Vite ([#20235](https://github.com/vitejs/rolldown-vite/issues/20235)) ([3bf3a8a](https://github.com/vitejs/rolldown-vite/commit/3bf3a8ab00e5a0dfab0bb5741cb871ea30b72651)) +* **module-runner:** export `ssrExportNameKey` ([#20266](https://github.com/vitejs/rolldown-vite/issues/20266)) ([ac302a7](https://github.com/vitejs/rolldown-vite/commit/ac302a729062dbfc67f762b3c4af46b7893c214f)) +* **module-runner:** expose `normalizeModuleId` ([#20277](https://github.com/vitejs/rolldown-vite/issues/20277)) ([9b98dcb](https://github.com/vitejs/rolldown-vite/commit/9b98dcbf75546240e1609185828e18a77bac8c8d)) + +### Performance Improvements + +* **utils:** improve performance of `numberToPos` ([#20244](https://github.com/vitejs/rolldown-vite/issues/20244)) ([3f46901](https://github.com/vitejs/rolldown-vite/commit/3f469012ad38e3cb330adc74a8b3ec88561c822e)) + +### Miscellaneous Chores + +* "indentity" → "identity" in test description ([#20225](https://github.com/vitejs/rolldown-vite/issues/20225)) ([ea9aed7](https://github.com/vitejs/rolldown-vite/commit/ea9aed7ebcb7f4be542bd2a384cbcb5a1e7b31bd)) +* **deps:** update rolldown-related dependencies ([#20270](https://github.com/vitejs/rolldown-vite/issues/20270)) ([f7377c3](https://github.com/vitejs/rolldown-vite/commit/f7377c3eae6323bd3237ff5de5ae55c879fe7325)) +* typos in comments ([#20259](https://github.com/vitejs/rolldown-vite/issues/20259)) ([b135918](https://github.com/vitejs/rolldown-vite/commit/b135918b91e8381c50bd2d076d40e9a65fe68bfe)) + +## [7.0.0-beta.0](https://github.com/vitejs/rolldown-vite/compare/v7.0.0-alpha.0...v7.0.0-beta.0) (2025-06-19) +### Features + +* update rolldown ([b292707](https://github.com/vitejs/rolldown-vite/commit/b2927076a747ca0777c90b72929aa82e7ccb15cf)) + +### Bug Fixes + +* **css:** set moduleType in css-post plugin ([#272](https://github.com/vitejs/rolldown-vite/issues/272)) ([8638a59](https://github.com/vitejs/rolldown-vite/commit/8638a59de12cfcd7c675e9f1867f0e5851e004b9)) +* **json:** require(json) should return the content ([#268](https://github.com/vitejs/rolldown-vite/issues/268)) ([bdd4d29](https://github.com/vitejs/rolldown-vite/commit/bdd4d297f3e6f1ed3cc02a26d66146a6eedab62b)) +* resolve oxc runtime from Vite directory correctly ([#269](https://github.com/vitejs/rolldown-vite/issues/269)) ([d6369f3](https://github.com/vitejs/rolldown-vite/commit/d6369f30b3ac908350db375e43bf32a7c3f29d1c)) + +## [7.0.0-alpha.0](https://github.com/vitejs/rolldown-vite/compare/v6.3.21...v7.0.0-alpha.0) (2025-06-18) ### ⚠ BREAKING CHANGES * **ssr:** don't access `Object` variable in ssr transformed code (#19996) @@ -478,276 +855,556 @@ Today, we're excited to announce the release of the next Vite major: ### Features -* **types:** use terser types from terser package ([#20274](https://github.com/vitejs/vite/issues/20274)) ([a5799fa](https://github.com/vitejs/vite/commit/a5799fa74c6190ecbb2da3d280136ff32463afc6)) -* apply some middlewares before `configurePreviewServer` hook ([#20224](https://github.com/vitejs/vite/issues/20224)) ([b989c42](https://github.com/vitejs/vite/commit/b989c42cf84378e6cb93970de739941f0d56d6f6)) -* apply some middlewares before `configureServer` hook ([#20222](https://github.com/vitejs/vite/issues/20222)) ([f5cc4c0](https://github.com/vitejs/vite/commit/f5cc4c0ded337670b439e51bc95f173e2b5cf9ad)) -* add base option to import.meta.glob ([#20163](https://github.com/vitejs/vite/issues/20163)) ([253d6c6](https://github.com/vitejs/vite/commit/253d6c6df2ebe3c4a88dabb6cec000128681561f)) -* add `this.meta.viteVersion` ([#20088](https://github.com/vitejs/vite/issues/20088)) ([f55bf41](https://github.com/vitejs/vite/commit/f55bf41e91f8dfe829a46e58f0035b19c8ab6a25)) -* allow passing down resolved config to vite's `createServer` ([#19894](https://github.com/vitejs/vite/issues/19894)) ([c1ae9bd](https://github.com/vitejs/vite/commit/c1ae9bd4a0542b4703ae7766ad61d072e8b833bd)) -* buildApp hook ([#19971](https://github.com/vitejs/vite/issues/19971)) ([5da659d](https://github.com/vitejs/vite/commit/5da659de902f0a2d6d8beefbf269128383b63887)) -* **build:** provide names for asset entrypoints ([#19912](https://github.com/vitejs/vite/issues/19912)) ([c4e01dc](https://github.com/vitejs/vite/commit/c4e01dc5ab0f1708383c39d28ce62e12b8f374fc)) -* bump `build.target` and name it `baseline-widely-available` ([#20007](https://github.com/vitejs/vite/issues/20007)) ([4a8aa82](https://github.com/vitejs/vite/commit/4a8aa82556eb2b9e54673a6aac77873e0eb27fa9)) -* **client:** support opening fileURL in editor ([#20040](https://github.com/vitejs/vite/issues/20040)) ([1bde4d2](https://github.com/vitejs/vite/commit/1bde4d25243cd9beaadb01413e896fef562626ef)) -* make PluginContext available for Vite-specific hooks ([#19936](https://github.com/vitejs/vite/issues/19936)) ([7063839](https://github.com/vitejs/vite/commit/7063839d47dfd4ac6be1247ba68e414ffe287b00)) -* resolve environments plugins at config time ([#20120](https://github.com/vitejs/vite/issues/20120)) ([f6a28d5](https://github.com/vitejs/vite/commit/f6a28d5f792ba5cc4dc236e3e6edd05199cabcc8)) -* stabilize `css.preprocessorMaxWorkers` and default to `true` ([#19992](https://github.com/vitejs/vite/issues/19992)) ([70aee13](https://github.com/vitejs/vite/commit/70aee139ea802478bad56e5e441f187140bcf0cc)) -* stabilize `optimizeDeps.noDiscovery` ([#19984](https://github.com/vitejs/vite/issues/19984)) ([6d2dcb4](https://github.com/vitejs/vite/commit/6d2dcb494db9f40565f11b50bdbb8c1b7245697d)) - -### Bug Fixes - -* **deps:** update all non-major dependencies ([#20271](https://github.com/vitejs/vite/issues/20271)) ([6b64d63](https://github.com/vitejs/vite/commit/6b64d63d700154de2c00270300b671cef8863708)) -* keep `import.meta.url` in bundled Vite ([#20235](https://github.com/vitejs/vite/issues/20235)) ([3bf3a8a](https://github.com/vitejs/vite/commit/3bf3a8ab00e5a0dfab0bb5741cb871ea30b72651)) -* **module-runner:** export `ssrExportNameKey` ([#20266](https://github.com/vitejs/vite/issues/20266)) ([ac302a7](https://github.com/vitejs/vite/commit/ac302a729062dbfc67f762b3c4af46b7893c214f)) -* **module-runner:** expose `normalizeModuleId` ([#20277](https://github.com/vitejs/vite/issues/20277)) ([9b98dcb](https://github.com/vitejs/vite/commit/9b98dcbf75546240e1609185828e18a77bac8c8d)) -* **deps:** update all non-major dependencies ([#20181](https://github.com/vitejs/vite/issues/20181)) ([d91d4f7](https://github.com/vitejs/vite/commit/d91d4f7ad55edbcb4a51fc23376cbff89f776d30)) -* **deps:** update all non-major dependencies ([#20212](https://github.com/vitejs/vite/issues/20212)) ([a80339b](https://github.com/vitejs/vite/commit/a80339b1798607dd7389f42964272181cf9eb453)) -* align dynamic import detection ([#20115](https://github.com/vitejs/vite/issues/20115)) ([1ea2222](https://github.com/vitejs/vite/commit/1ea2222302f128c4000289683480d8311ea34223)) -* applyToEnvironment after configResolved ([#20170](https://github.com/vitejs/vite/issues/20170)) ([a330b80](https://github.com/vitejs/vite/commit/a330b805b0733fadd1f7d586218c2aafcbb41a7f)) -* **deps:** update all non-major dependencies ([#20141](https://github.com/vitejs/vite/issues/20141)) ([89ca65b](https://github.com/vitejs/vite/commit/89ca65ba1d849046dccdea52e9eca980f331be26)) -* handle dynamic import with `.then(m => m.a)` ([#20117](https://github.com/vitejs/vite/issues/20117)) ([7b7410a](https://github.com/vitejs/vite/commit/7b7410abab7c95880d943e46bd1a16dcb1a893fc)) -* **hmr:** use monotonicDateNow for timestamp ([#20158](https://github.com/vitejs/vite/issues/20158)) ([8d26785](https://github.com/vitejs/vite/commit/8d26785b8c3f5295ca0c1519dda1ddae9096fc73)) -* **optimizer:** align relative `build.rollupOptions.input` resolution with rollup ([#20080](https://github.com/vitejs/vite/issues/20080)) ([9759c29](https://github.com/vitejs/vite/commit/9759c29a8985da1a51de452d741850f0bf2ef7ef)) -* **ssr:** don't access `Object` variable in ssr transformed code ([#19996](https://github.com/vitejs/vite/issues/19996)) ([fceff60](https://github.com/vitejs/vite/commit/fceff60dc81730f7768b57f14e7a112facff387d)) -* **types:** prefer sass-embedded types over sass types for `preprocessorOptions.sass` (fix [#20150](https://github.com/vitejs/vite/issues/20150)) ([#20166](https://github.com/vitejs/vite/issues/20166)) ([7db56be](https://github.com/vitejs/vite/commit/7db56be237dd1e1e875518475421d5c90cf950da)) -* virtual svg module ([#20144](https://github.com/vitejs/vite/issues/20144)) ([7dfcb31](https://github.com/vitejs/vite/commit/7dfcb316ee64aca0a98a1d2905deb1dfd113ae6d)) -* **client:** render the last part of the stacktrace ([#20039](https://github.com/vitejs/vite/issues/20039)) ([c7c1743](https://github.com/vitejs/vite/commit/c7c17434968848f1471179c10a5fc9d2804add8b)) -* **cli:** make `cleanGlobalCLIOptions()` clean `--force` ([#19999](https://github.com/vitejs/vite/issues/19999)) ([d4a171a](https://github.com/vitejs/vite/commit/d4a171afd387000789172a94c94a1c33c0856f85)) -* **css:** remove alias exclude logic from rebaseUrl ([#20100](https://github.com/vitejs/vite/issues/20100)) ([44c6d01](https://github.com/vitejs/vite/commit/44c6d0111f95c8aa44d6a09a768e8cf02232ed29)) -* **css:** sass rebase url in relative imported modules ([#20067](https://github.com/vitejs/vite/issues/20067)) ([261fad9](https://github.com/vitejs/vite/commit/261fad9b8e6380c84b8692b3fbe18d6f37d367bd)) -* **css:** should not wrap with double quote when the url rebase feature bailed out ([#20068](https://github.com/vitejs/vite/issues/20068)) ([a33d0c7](https://github.com/vitejs/vite/commit/a33d0c7d65d9fff9acd5de0cf3c4d371297b3990)) -* **deps:** update all non-major dependencies ([#19953](https://github.com/vitejs/vite/issues/19953)) ([ac8e1fb](https://github.com/vitejs/vite/commit/ac8e1fb289a06fc0671dab1f4ef68e508e34360e)) -* **deps:** update all non-major dependencies ([#20061](https://github.com/vitejs/vite/issues/20061)) ([7b58856](https://github.com/vitejs/vite/commit/7b588563636a6f735a6e25832f33fc08572b25d9)) -* importing an optional peer dep should throw an runtime error ([#20029](https://github.com/vitejs/vite/issues/20029)) ([d0221cd](https://github.com/vitejs/vite/commit/d0221cd7383c18d67a5ef594da52e6aa5fc4d87b)) -* merge `environments.*.resolve.noExternal` properly ([#20077](https://github.com/vitejs/vite/issues/20077)) ([daf4a25](https://github.com/vitejs/vite/commit/daf4a25a1c0a37c992606e6ae159e13190c2e101)) -* merge `server.allowedHosts: true` correctly ([#20138](https://github.com/vitejs/vite/issues/20138)) ([2ade756](https://github.com/vitejs/vite/commit/2ade756c9549a52d804797d45da37c8429a51fd3)) -* **optimizer:** non object module.exports for Node builtin modules in CJS external facade ([#20048](https://github.com/vitejs/vite/issues/20048)) ([00ac6e4](https://github.com/vitejs/vite/commit/00ac6e410eeb15719fe020fd497f0336e7fd1aa8)) -* **optimizer:** show error when `computeEntries` failed ([#20079](https://github.com/vitejs/vite/issues/20079)) ([b742b46](https://github.com/vitejs/vite/commit/b742b46f8308a71c1d2aa426eade0c50cbf1480f)) -* treat all `optimizeDeps.entries` values as globs ([#20045](https://github.com/vitejs/vite/issues/20045)) ([1422395](https://github.com/vitejs/vite/commit/142239588d6752c5b91d435aee9b4a6c00b7f924)) -* **types:** expose additional PluginContext types ([#20129](https://github.com/vitejs/vite/issues/20129)) ([b6df9aa](https://github.com/vitejs/vite/commit/b6df9aac3320cd953f6d45ad9245a7b564f67cc1)) +* add `this.meta.viteVersion` ([#20088](https://github.com/vitejs/rolldown-vite/issues/20088)) ([f55bf41](https://github.com/vitejs/rolldown-vite/commit/f55bf41e91f8dfe829a46e58f0035b19c8ab6a25)) +* add base option to import.meta.glob ([#20163](https://github.com/vitejs/rolldown-vite/issues/20163)) ([253d6c6](https://github.com/vitejs/rolldown-vite/commit/253d6c6df2ebe3c4a88dabb6cec000128681561f)) +* allow passing down resolved config to vite's `createServer` ([#19894](https://github.com/vitejs/rolldown-vite/issues/19894)) ([c1ae9bd](https://github.com/vitejs/rolldown-vite/commit/c1ae9bd4a0542b4703ae7766ad61d072e8b833bd)) +* buildApp hook ([#19971](https://github.com/vitejs/rolldown-vite/issues/19971)) ([5da659d](https://github.com/vitejs/rolldown-vite/commit/5da659de902f0a2d6d8beefbf269128383b63887)) +* **build:** provide names for asset entrypoints ([#19912](https://github.com/vitejs/rolldown-vite/issues/19912)) ([c4e01dc](https://github.com/vitejs/rolldown-vite/commit/c4e01dc5ab0f1708383c39d28ce62e12b8f374fc)) +* bump `build.target` and name it `baseline-widely-available` ([#20007](https://github.com/vitejs/rolldown-vite/issues/20007)) ([4a8aa82](https://github.com/vitejs/rolldown-vite/commit/4a8aa82556eb2b9e54673a6aac77873e0eb27fa9)) +* **client:** support opening fileURL in editor ([#20040](https://github.com/vitejs/rolldown-vite/issues/20040)) ([1bde4d2](https://github.com/vitejs/rolldown-vite/commit/1bde4d25243cd9beaadb01413e896fef562626ef)) +* make PluginContext available for Vite-specific hooks ([#19936](https://github.com/vitejs/rolldown-vite/issues/19936)) ([7063839](https://github.com/vitejs/rolldown-vite/commit/7063839d47dfd4ac6be1247ba68e414ffe287b00)) +* resolve environments plugins at config time ([#20120](https://github.com/vitejs/rolldown-vite/issues/20120)) ([f6a28d5](https://github.com/vitejs/rolldown-vite/commit/f6a28d5f792ba5cc4dc236e3e6edd05199cabcc8)) +* stabilize `css.preprocessorMaxWorkers` and default to `true` ([#19992](https://github.com/vitejs/rolldown-vite/issues/19992)) ([70aee13](https://github.com/vitejs/rolldown-vite/commit/70aee139ea802478bad56e5e441f187140bcf0cc)) +* stabilize `optimizeDeps.noDiscovery` ([#19984](https://github.com/vitejs/rolldown-vite/issues/19984)) ([6d2dcb4](https://github.com/vitejs/rolldown-vite/commit/6d2dcb494db9f40565f11b50bdbb8c1b7245697d)) +* update rolldown ([6f8287b](https://github.com/vitejs/rolldown-vite/commit/6f8287bcf7c27854f7cb653ff6697baf98fd5cb8)) + +### Bug Fixes + +* align dynamic import detection ([#20115](https://github.com/vitejs/rolldown-vite/issues/20115)) ([1ea2222](https://github.com/vitejs/rolldown-vite/commit/1ea2222302f128c4000289683480d8311ea34223)) +* applyToEnvironment after configResolved ([#20170](https://github.com/vitejs/rolldown-vite/issues/20170)) ([a330b80](https://github.com/vitejs/rolldown-vite/commit/a330b805b0733fadd1f7d586218c2aafcbb41a7f)) +* **css:** remove alias exclude logic from rebaseUrl ([#20100](https://github.com/vitejs/rolldown-vite/issues/20100)) ([44c6d01](https://github.com/vitejs/rolldown-vite/commit/44c6d0111f95c8aa44d6a09a768e8cf02232ed29)) +* **css:** sass rebase url in relative imported modules ([#20067](https://github.com/vitejs/rolldown-vite/issues/20067)) ([261fad9](https://github.com/vitejs/rolldown-vite/commit/261fad9b8e6380c84b8692b3fbe18d6f37d367bd)) +* **css:** should not wrap with double quote when the url rebase feature bailed out ([#20068](https://github.com/vitejs/rolldown-vite/issues/20068)) ([a33d0c7](https://github.com/vitejs/rolldown-vite/commit/a33d0c7d65d9fff9acd5de0cf3c4d371297b3990)) +* **deps:** update all non-major dependencies ([#20061](https://github.com/vitejs/rolldown-vite/issues/20061)) ([7b58856](https://github.com/vitejs/rolldown-vite/commit/7b588563636a6f735a6e25832f33fc08572b25d9)) +* **deps:** update all non-major dependencies ([#20141](https://github.com/vitejs/rolldown-vite/issues/20141)) ([89ca65b](https://github.com/vitejs/rolldown-vite/commit/89ca65ba1d849046dccdea52e9eca980f331be26)) +* **deps:** update all non-major dependencies ([#20181](https://github.com/vitejs/rolldown-vite/issues/20181)) ([d91d4f7](https://github.com/vitejs/rolldown-vite/commit/d91d4f7ad55edbcb4a51fc23376cbff89f776d30)) +* **deps:** update all non-major dependencies ([#20212](https://github.com/vitejs/rolldown-vite/issues/20212)) ([a80339b](https://github.com/vitejs/rolldown-vite/commit/a80339b1798607dd7389f42964272181cf9eb453)) +* handle dynamic import with `.then(m => m.a)` ([#20117](https://github.com/vitejs/rolldown-vite/issues/20117)) ([7b7410a](https://github.com/vitejs/rolldown-vite/commit/7b7410abab7c95880d943e46bd1a16dcb1a893fc)) +* **hmr:** use monotonicDateNow for timestamp ([#20158](https://github.com/vitejs/rolldown-vite/issues/20158)) ([8d26785](https://github.com/vitejs/rolldown-vite/commit/8d26785b8c3f5295ca0c1519dda1ddae9096fc73)) +* importing an optional peer dep should throw an runtime error ([#167](https://github.com/vitejs/rolldown-vite/issues/167)) ([b53667a](https://github.com/vitejs/rolldown-vite/commit/b53667a64168c2a68a06458aceabae5ae5cf74bd)) +* importing an optional peer dep should throw an runtime error ([#20029](https://github.com/vitejs/rolldown-vite/issues/20029)) ([d0221cd](https://github.com/vitejs/rolldown-vite/commit/d0221cd7383c18d67a5ef594da52e6aa5fc4d87b)) +* merge `environments.*.resolve.noExternal` properly ([#20077](https://github.com/vitejs/rolldown-vite/issues/20077)) ([daf4a25](https://github.com/vitejs/rolldown-vite/commit/daf4a25a1c0a37c992606e6ae159e13190c2e101)) +* merge `server.allowedHosts: true` correctly ([#20138](https://github.com/vitejs/rolldown-vite/issues/20138)) ([2ade756](https://github.com/vitejs/rolldown-vite/commit/2ade756c9549a52d804797d45da37c8429a51fd3)) +* merge conflict mistake ([bf77840](https://github.com/vitejs/rolldown-vite/commit/bf77840122a3e2e49efc3c47795eccbbffb6d368)) +* merge conflict mistake ([b77bcfe](https://github.com/vitejs/rolldown-vite/commit/b77bcfea3d00284c43556ee0d9fa87ba1a8f44b3)) +* **native-plugin:** run optimizer correctly ([#265](https://github.com/vitejs/rolldown-vite/issues/265)) ([2588f03](https://github.com/vitejs/rolldown-vite/commit/2588f03df771368821eb995bc6c087fcdd3a2f31)) +* **optimizer:** align relative `build.rollupOptions.input` resolution with rollup ([#20080](https://github.com/vitejs/rolldown-vite/issues/20080)) ([9759c29](https://github.com/vitejs/rolldown-vite/commit/9759c29a8985da1a51de452d741850f0bf2ef7ef)) +* **optimizer:** non object module.exports for Node builtin modules in CJS external facade ([#20048](https://github.com/vitejs/rolldown-vite/issues/20048)) ([00ac6e4](https://github.com/vitejs/rolldown-vite/commit/00ac6e410eeb15719fe020fd497f0336e7fd1aa8)) +* **optimizer:** show error when `computeEntries` failed ([#20079](https://github.com/vitejs/rolldown-vite/issues/20079)) ([b742b46](https://github.com/vitejs/rolldown-vite/commit/b742b46f8308a71c1d2aa426eade0c50cbf1480f)) +* set viteMetadata for `writeBundle` hook ([#263](https://github.com/vitejs/rolldown-vite/issues/263)) ([973087f](https://github.com/vitejs/rolldown-vite/commit/973087f600402abb3a6fc0d9a13e7f36189d2907)) +* **ssr:** don't access `Object` variable in ssr transformed code ([#19996](https://github.com/vitejs/rolldown-vite/issues/19996)) ([fceff60](https://github.com/vitejs/rolldown-vite/commit/fceff60dc81730f7768b57f14e7a112facff387d)) +* treat all `optimizeDeps.entries` values as globs ([#20045](https://github.com/vitejs/rolldown-vite/issues/20045)) ([1422395](https://github.com/vitejs/rolldown-vite/commit/142239588d6752c5b91d435aee9b4a6c00b7f924)) +* **types:** expose additional PluginContext types ([#20129](https://github.com/vitejs/rolldown-vite/issues/20129)) ([b6df9aa](https://github.com/vitejs/rolldown-vite/commit/b6df9aac3320cd953f6d45ad9245a7b564f67cc1)) +* **types:** prefer sass-embedded types over sass types for `preprocessorOptions.sass` (fix [#20150](https://github.com/vitejs/rolldown-vite/issues/20150)) ([#20166](https://github.com/vitejs/rolldown-vite/issues/20166)) ([7db56be](https://github.com/vitejs/rolldown-vite/commit/7db56be237dd1e1e875518475421d5c90cf950da)) +* virtual svg module ([#20144](https://github.com/vitejs/rolldown-vite/issues/20144)) ([7dfcb31](https://github.com/vitejs/rolldown-vite/commit/7dfcb316ee64aca0a98a1d2905deb1dfd113ae6d)) ### Performance Improvements -* **utils:** improve performance of `numberToPos` ([#20244](https://github.com/vitejs/vite/issues/20244)) ([3f46901](https://github.com/vitejs/vite/commit/3f469012ad38e3cb330adc74a8b3ec88561c822e)) +* set filter for import analysis build plugin ([#266](https://github.com/vitejs/rolldown-vite/issues/266)) ([e418d5e](https://github.com/vitejs/rolldown-vite/commit/e418d5ec450e77553b9815bf94a6e24dbde87240)) ### Documentation -* tiny typo ([#20110](https://github.com/vitejs/vite/issues/20110)) ([d20fc2c](https://github.com/vitejs/vite/commit/d20fc2cdc9700513425b18b625e01224f61e4eab)) +* tiny typo ([#20110](https://github.com/vitejs/rolldown-vite/issues/20110)) ([d20fc2c](https://github.com/vitejs/rolldown-vite/commit/d20fc2cdc9700513425b18b625e01224f61e4eab)) ### Miscellaneous Chores -* "indentity" → "identity" in test description ([#20225](https://github.com/vitejs/vite/issues/20225)) ([ea9aed7](https://github.com/vitejs/vite/commit/ea9aed7ebcb7f4be542bd2a384cbcb5a1e7b31bd)) -* **deps:** update rolldown-related dependencies ([#20270](https://github.com/vitejs/vite/issues/20270)) ([f7377c3](https://github.com/vitejs/vite/commit/f7377c3eae6323bd3237ff5de5ae55c879fe7325)) -* typos in comments ([#20259](https://github.com/vitejs/vite/issues/20259)) ([b135918](https://github.com/vitejs/vite/commit/b135918b91e8381c50bd2d076d40e9a65fe68bfe)) -* **deps:** update rolldown-related dependencies ([#20182](https://github.com/vitejs/vite/issues/20182)) ([6172f41](https://github.com/vitejs/vite/commit/6172f410b44cbae8d052997bb1819a6197a4d397)) -* **deps:** update rolldown-related dependencies ([#20211](https://github.com/vitejs/vite/issues/20211)) ([b13b7f5](https://github.com/vitejs/vite/commit/b13b7f5e21fe05c3214766b3de584a026fbfe144)) -* add a way to disable source maps when developing Vite ([#20168](https://github.com/vitejs/vite/issues/20168)) ([3a30c0a](https://github.com/vitejs/vite/commit/3a30c0a084a1b92a6265f8900df89e5102418e5e)) -* **deps:** update rolldown-related dependencies ([#20140](https://github.com/vitejs/vite/issues/20140)) ([0387447](https://github.com/vitejs/vite/commit/03874471e3de14e7d2f474ecb354499e7f5eb418)) -* fix source map support when developing Vite ([#20167](https://github.com/vitejs/vite/issues/20167)) ([279ab0d](https://github.com/vitejs/vite/commit/279ab0dc954c5e986810b78efa7fe898945f8f21)) -* use destructuring alias in buildEnvironment function ([#19472](https://github.com/vitejs/vite/issues/19472)) ([501572a](https://github.com/vitejs/vite/commit/501572a9a3e1e22ab7e19afb5b13d3f54da67c37)) -* declare version range for peer dependencies ([#19979](https://github.com/vitejs/vite/issues/19979)) ([c9bfd57](https://github.com/vitejs/vite/commit/c9bfd578f4c56314c6c6d6f34e49fe494ae11072)) -* deprecate `ResolvedConfig.createResolver` and recommend `createIdResolver` ([#20031](https://github.com/vitejs/vite/issues/20031)) ([d101d64](https://github.com/vitejs/vite/commit/d101d64722f82ed681b833bfd3fb394eeb496e21)) -* fix comment for `devEnvironmentOptions.moduleRunnerTransform` ([#20035](https://github.com/vitejs/vite/issues/20035)) ([338081d](https://github.com/vitejs/vite/commit/338081df9649f68484416d199113fc67abbb6cd5)) -* generate dts internally by rolldown-plugin-dts ([#20093](https://github.com/vitejs/vite/issues/20093)) ([a66afa3](https://github.com/vitejs/vite/commit/a66afa33bd92e2be6ee1d52b8fffa49da266adab)) -* remove deprecated splitVendorChunkPlugin ([#19255](https://github.com/vitejs/vite/issues/19255)) ([91a92c7](https://github.com/vitejs/vite/commit/91a92c7e1eaf55cd5d5cfa49c546e130045e7dee)) -* remove node 18 support ([#19972](https://github.com/vitejs/vite/issues/19972)) ([00b8a98](https://github.com/vitejs/vite/commit/00b8a98f36376804437e1342265453915ae613de)) -* remove redundant word in comment ([#20139](https://github.com/vitejs/vite/issues/20139)) ([9b2964d](https://github.com/vitejs/vite/commit/9b2964df79d31b17e6b387e7fc082753f8ee5774)) -* remove unused deps ([#20097](https://github.com/vitejs/vite/issues/20097)) ([d11ae6b](https://github.com/vitejs/vite/commit/d11ae6bca808407a9f0fb4f9c1cb8496a705c2d7)) -* rename rollup to rolldown where appropriate ([#20096](https://github.com/vitejs/vite/issues/20096)) ([306e250](https://github.com/vitejs/vite/commit/306e250a94e12584b4182db8ec531750b3d9e3ba)) -* speed up typechecking ([#20131](https://github.com/vitejs/vite/issues/20131)) ([a357c19](https://github.com/vitejs/vite/commit/a357c1987f332519d7bacafebc5620c7ab534d8f)) -* use plugin hooks filter for `patch-types` plugin for bundling vite ([#20089](https://github.com/vitejs/vite/issues/20089)) ([c127955](https://github.com/vitejs/vite/commit/c12795522fd95d3535100293f4cf53c53c3f301f)) -* use rolldown to bundle Vite itself ([#19925](https://github.com/vitejs/vite/issues/19925)) ([7753b02](https://github.com/vitejs/vite/commit/7753b028848d9e23bcea5f00565207f2d1de8291)) -* use rolldown-plugin-dts for dts bundling ([#19990](https://github.com/vitejs/vite/issues/19990)) ([449d7f3](https://github.com/vitejs/vite/commit/449d7f30a85ae70eb0037fdab0b1ebf2e4927a24)) +* add a way to disable source maps when developing Vite ([#20168](https://github.com/vitejs/rolldown-vite/issues/20168)) ([3a30c0a](https://github.com/vitejs/rolldown-vite/commit/3a30c0a084a1b92a6265f8900df89e5102418e5e)) +* declare version range for peer dependencies ([#19979](https://github.com/vitejs/rolldown-vite/issues/19979)) ([c9bfd57](https://github.com/vitejs/rolldown-vite/commit/c9bfd578f4c56314c6c6d6f34e49fe494ae11072)) +* **deps:** update rolldown-related dependencies ([#20140](https://github.com/vitejs/rolldown-vite/issues/20140)) ([0387447](https://github.com/vitejs/rolldown-vite/commit/03874471e3de14e7d2f474ecb354499e7f5eb418)) +* **deps:** update rolldown-related dependencies ([#20182](https://github.com/vitejs/rolldown-vite/issues/20182)) ([6172f41](https://github.com/vitejs/rolldown-vite/commit/6172f410b44cbae8d052997bb1819a6197a4d397)) +* **deps:** update rolldown-related dependencies ([#20211](https://github.com/vitejs/rolldown-vite/issues/20211)) ([b13b7f5](https://github.com/vitejs/rolldown-vite/commit/b13b7f5e21fe05c3214766b3de584a026fbfe144)) +* fix source map support when developing Vite ([#20167](https://github.com/vitejs/rolldown-vite/issues/20167)) ([279ab0d](https://github.com/vitejs/rolldown-vite/commit/279ab0dc954c5e986810b78efa7fe898945f8f21)) +* generate dts internally by rolldown-plugin-dts ([#20093](https://github.com/vitejs/rolldown-vite/issues/20093)) ([a66afa3](https://github.com/vitejs/rolldown-vite/commit/a66afa33bd92e2be6ee1d52b8fffa49da266adab)) +* remove deprecated splitVendorChunkPlugin ([#19255](https://github.com/vitejs/rolldown-vite/issues/19255)) ([91a92c7](https://github.com/vitejs/rolldown-vite/commit/91a92c7e1eaf55cd5d5cfa49c546e130045e7dee)) +* remove node 18 support ([#19972](https://github.com/vitejs/rolldown-vite/issues/19972)) ([00b8a98](https://github.com/vitejs/rolldown-vite/commit/00b8a98f36376804437e1342265453915ae613de)) +* remove redundant word in comment ([#20139](https://github.com/vitejs/rolldown-vite/issues/20139)) ([9b2964d](https://github.com/vitejs/rolldown-vite/commit/9b2964df79d31b17e6b387e7fc082753f8ee5774)) +* remove unused deps ([#20097](https://github.com/vitejs/rolldown-vite/issues/20097)) ([d11ae6b](https://github.com/vitejs/rolldown-vite/commit/d11ae6bca808407a9f0fb4f9c1cb8496a705c2d7)) +* rename rollup to rolldown where appropriate ([#20096](https://github.com/vitejs/rolldown-vite/issues/20096)) ([306e250](https://github.com/vitejs/rolldown-vite/commit/306e250a94e12584b4182db8ec531750b3d9e3ba)) +* speed up typechecking ([#20131](https://github.com/vitejs/rolldown-vite/issues/20131)) ([a357c19](https://github.com/vitejs/rolldown-vite/commit/a357c1987f332519d7bacafebc5620c7ab534d8f)) +* use destructuring alias in buildEnvironment function ([#19472](https://github.com/vitejs/rolldown-vite/issues/19472)) ([501572a](https://github.com/vitejs/rolldown-vite/commit/501572a9a3e1e22ab7e19afb5b13d3f54da67c37)) +* use plugin hooks filter for `patch-types` plugin for bundling vite ([#20089](https://github.com/vitejs/rolldown-vite/issues/20089)) ([c127955](https://github.com/vitejs/rolldown-vite/commit/c12795522fd95d3535100293f4cf53c53c3f301f)) +* use rolldown to bundle Vite itself ([#19925](https://github.com/vitejs/rolldown-vite/issues/19925)) ([7753b02](https://github.com/vitejs/rolldown-vite/commit/7753b028848d9e23bcea5f00565207f2d1de8291)) +* use rolldown-plugin-dts for dts bundling ([#19990](https://github.com/vitejs/rolldown-vite/issues/19990)) ([449d7f3](https://github.com/vitejs/rolldown-vite/commit/449d7f30a85ae70eb0037fdab0b1ebf2e4927a24)) ### Code Refactoring -* **worker:** set virtual file content in load hook ([#20160](https://github.com/vitejs/vite/issues/20160)) ([0d60667](https://github.com/vitejs/vite/commit/0d60667e03d91cc0d48dd2cdbd8154d94e0aba74)) -* bump required node version to 20.19+, 22.12+ and remove cjs build ([#20032](https://github.com/vitejs/vite/issues/20032)) ([2b80243](https://github.com/vitejs/vite/commit/2b80243fada75378e80475028fdcc78f4432bd6f)) -* **css:** always use sass compiler API ([#19978](https://github.com/vitejs/vite/issues/19978)) ([3bfe5c5](https://github.com/vitejs/vite/commit/3bfe5c5ff96af0a0624c8f14503ef87a0c0850ed)) -* **css:** remove sass legacy API support ([#19977](https://github.com/vitejs/vite/issues/19977)) ([6eaccc9](https://github.com/vitejs/vite/commit/6eaccc9009d718a1afcff2af587e81eb959f5b60)) -* merge `src/node/publicUtils.ts` to `src/node/index.ts` ([#20086](https://github.com/vitejs/vite/issues/20086)) ([999a1ed](https://github.com/vitejs/vite/commit/999a1ed8dff5117b2fd205c4e5384b6ac2ede80e)) -* remove `experimental.skipSsrTransform` option ([#20038](https://github.com/vitejs/vite/issues/20038)) ([6c3dd8e](https://github.com/vitejs/vite/commit/6c3dd8e46fa77060603679cda91a4c8d01d095ab)) -* remove `HotBroadcaster` ([#19988](https://github.com/vitejs/vite/issues/19988)) ([cda8c94](https://github.com/vitejs/vite/commit/cda8c947934466da27e874b6c064451cf73f03e5)) -* remove `options?.ssr` support in clientInjectionsPlugin ([#19589](https://github.com/vitejs/vite/issues/19589)) ([88e0076](https://github.com/vitejs/vite/commit/88e00765dbd3de4cb073c722dce3e8ef60c3a50e)) -* remove backward compat for calling internal plugins directly ([#20001](https://github.com/vitejs/vite/issues/20001)) ([9072a72](https://github.com/vitejs/vite/commit/9072a726731eccee32d38f04747fda8793ccc82a)) -* remove deprecated `HotBroadcaster` related types ([#19987](https://github.com/vitejs/vite/issues/19987)) ([86b5e00](https://github.com/vitejs/vite/commit/86b5e0030bf204f8f2db0cf8ee895ab3ecf154b8)) -* remove deprecated env api properties ([#19986](https://github.com/vitejs/vite/issues/19986)) ([52e5a1b](https://github.com/vitejs/vite/commit/52e5a1b32d0ce7604b633f001a352124e3ec623a)) -* remove deprecated hook-level `enforce`/`transform` from `transformIndexHtml` hook ([#19349](https://github.com/vitejs/vite/issues/19349)) ([6198b9d](https://github.com/vitejs/vite/commit/6198b9d2a32f7bd17b3332525a98c06d9a425fb1)) -* remove deprecated no-op type only properties ([#19985](https://github.com/vitejs/vite/issues/19985)) ([9151c24](https://github.com/vitejs/vite/commit/9151c2400f6ab494f73d78aea4435b7c1ef5fc30)) -* remove no-op `legacy.proxySsrExternalModules` ([#20013](https://github.com/vitejs/vite/issues/20013)) ([a37ac83](https://github.com/vitejs/vite/commit/a37ac836ac4da8e854d98c65450f12acb921aa98)) -* **ssr:** remove ssrTransform line offset preservation ([#19829](https://github.com/vitejs/vite/issues/19829)) ([61b6b96](https://github.com/vitejs/vite/commit/61b6b96b191c6071b9c574ad4c795f97f2646f18)) -* use `hostValidationMiddleware` ([#20019](https://github.com/vitejs/vite/issues/20019)) ([83bf90e](https://github.com/vitejs/vite/commit/83bf90edd5856ed6e27051e3e9a6032e02242b18)) -* use `mergeWithDefaults` for experimental option ([#20012](https://github.com/vitejs/vite/issues/20012)) ([98c5741](https://github.com/vitejs/vite/commit/98c57419426201596a962746436e5ad1aeef4eac)) -* use hook filters from rollup ([#19755](https://github.com/vitejs/vite/issues/19755)) ([0d18fc1](https://github.com/vitejs/vite/commit/0d18fc1dc65f5c8d855808f23754c0c4902f07d9)) +* bump required node version to 20.19+, 22.12+ and remove cjs build ([#20032](https://github.com/vitejs/rolldown-vite/issues/20032)) ([2b80243](https://github.com/vitejs/rolldown-vite/commit/2b80243fada75378e80475028fdcc78f4432bd6f)) +* **css:** always use sass compiler API ([#19978](https://github.com/vitejs/rolldown-vite/issues/19978)) ([3bfe5c5](https://github.com/vitejs/rolldown-vite/commit/3bfe5c5ff96af0a0624c8f14503ef87a0c0850ed)) +* **css:** remove sass legacy API support ([#19977](https://github.com/vitejs/rolldown-vite/issues/19977)) ([6eaccc9](https://github.com/vitejs/rolldown-vite/commit/6eaccc9009d718a1afcff2af587e81eb959f5b60)) +* merge `src/node/publicUtils.ts` to `src/node/index.ts` ([#20086](https://github.com/vitejs/rolldown-vite/issues/20086)) ([999a1ed](https://github.com/vitejs/rolldown-vite/commit/999a1ed8dff5117b2fd205c4e5384b6ac2ede80e)) +* remove `experimental.skipSsrTransform` option ([#20038](https://github.com/vitejs/rolldown-vite/issues/20038)) ([6c3dd8e](https://github.com/vitejs/rolldown-vite/commit/6c3dd8e46fa77060603679cda91a4c8d01d095ab)) +* remove `HotBroadcaster` ([#19988](https://github.com/vitejs/rolldown-vite/issues/19988)) ([cda8c94](https://github.com/vitejs/rolldown-vite/commit/cda8c947934466da27e874b6c064451cf73f03e5)) +* remove `options?.ssr` support in clientInjectionsPlugin ([#19589](https://github.com/vitejs/rolldown-vite/issues/19589)) ([88e0076](https://github.com/vitejs/rolldown-vite/commit/88e00765dbd3de4cb073c722dce3e8ef60c3a50e)) +* remove backward compat for calling internal plugins directly ([#20001](https://github.com/vitejs/rolldown-vite/issues/20001)) ([9072a72](https://github.com/vitejs/rolldown-vite/commit/9072a726731eccee32d38f04747fda8793ccc82a)) +* remove deprecated `HotBroadcaster` related types ([#19987](https://github.com/vitejs/rolldown-vite/issues/19987)) ([86b5e00](https://github.com/vitejs/rolldown-vite/commit/86b5e0030bf204f8f2db0cf8ee895ab3ecf154b8)) +* remove deprecated env api properties ([#19986](https://github.com/vitejs/rolldown-vite/issues/19986)) ([52e5a1b](https://github.com/vitejs/rolldown-vite/commit/52e5a1b32d0ce7604b633f001a352124e3ec623a)) +* remove deprecated hook-level `enforce`/`transform` from `transformIndexHtml` hook ([#19349](https://github.com/vitejs/rolldown-vite/issues/19349)) ([6198b9d](https://github.com/vitejs/rolldown-vite/commit/6198b9d2a32f7bd17b3332525a98c06d9a425fb1)) +* remove deprecated no-op type only properties ([#19985](https://github.com/vitejs/rolldown-vite/issues/19985)) ([9151c24](https://github.com/vitejs/rolldown-vite/commit/9151c2400f6ab494f73d78aea4435b7c1ef5fc30)) +* remove no-op `legacy.proxySsrExternalModules` ([#20013](https://github.com/vitejs/rolldown-vite/issues/20013)) ([a37ac83](https://github.com/vitejs/rolldown-vite/commit/a37ac836ac4da8e854d98c65450f12acb921aa98)) +* **ssr:** remove ssrTransform line offset preservation ([#19829](https://github.com/vitejs/rolldown-vite/issues/19829)) ([61b6b96](https://github.com/vitejs/rolldown-vite/commit/61b6b96b191c6071b9c574ad4c795f97f2646f18)) +* use `hostValidationMiddleware` ([#20019](https://github.com/vitejs/rolldown-vite/issues/20019)) ([83bf90e](https://github.com/vitejs/rolldown-vite/commit/83bf90edd5856ed6e27051e3e9a6032e02242b18)) +* use `mergeWithDefaults` for experimental option ([#20012](https://github.com/vitejs/rolldown-vite/issues/20012)) ([98c5741](https://github.com/vitejs/rolldown-vite/commit/98c57419426201596a962746436e5ad1aeef4eac)) +* use hook filters from rollup ([#19755](https://github.com/vitejs/rolldown-vite/issues/19755)) ([0d18fc1](https://github.com/vitejs/rolldown-vite/commit/0d18fc1dc65f5c8d855808f23754c0c4902f07d9)) +* **worker:** set virtual file content in load hook ([#20160](https://github.com/vitejs/rolldown-vite/issues/20160)) ([0d60667](https://github.com/vitejs/rolldown-vite/commit/0d60667e03d91cc0d48dd2cdbd8154d94e0aba74)) ### Tests -* correct esbuild `useDefineForClassFields` test ([#20143](https://github.com/vitejs/vite/issues/20143)) ([d90796e](https://github.com/vitejs/vite/commit/d90796ece7d30d1879d74c422628be30d1c90a7f)) -* skip writing files in build hook filter test ([#20076](https://github.com/vitejs/vite/issues/20076)) ([bf8b07d](https://github.com/vitejs/vite/commit/bf8b07da3e64dc4de446a9b24a33d5822a7736b9)) +* correct esbuild `useDefineForClassFields` test ([#20143](https://github.com/vitejs/rolldown-vite/issues/20143)) ([d90796e](https://github.com/vitejs/rolldown-vite/commit/d90796ece7d30d1879d74c422628be30d1c90a7f)) +* skip writing files in build hook filter test ([#20076](https://github.com/vitejs/rolldown-vite/issues/20076)) ([bf8b07d](https://github.com/vitejs/rolldown-vite/commit/bf8b07da3e64dc4de446a9b24a33d5822a7736b9)) ### Continuous Integration -* run tests on Node 24 as well ([#20049](https://github.com/vitejs/vite/issues/20049)) ([1fe07d3](https://github.com/vitejs/vite/commit/1fe07d3716012992dd7b2e78d8380add0b606a97)) +* run tests on Node 24 as well ([#20049](https://github.com/vitejs/rolldown-vite/issues/20049)) ([1fe07d3](https://github.com/vitejs/rolldown-vite/commit/1fe07d3716012992dd7b2e78d8380add0b606a97)) -### Beta Changelogs +## [6.3.21](https://github.com/vitejs/rolldown-vite/compare/v6.3.20...v6.3.21) (2025-06-16) +### Bug Fixes + +* make `viteMetadata` and `modules` enumerable ([#261](https://github.com/vitejs/rolldown-vite/issues/261)) ([f44607f](https://github.com/vitejs/rolldown-vite/commit/f44607f39a172bfef8bc313e2d0ebeee2af3adc2)) +* set `viteMetadata` for return value of `build` function ([#262](https://github.com/vitejs/rolldown-vite/issues/262)) ([3a86721](https://github.com/vitejs/rolldown-vite/commit/3a86721a44d376c9755bac839b195b188a4b9325)) + +## [6.3.20](https://github.com/vitejs/rolldown-vite/compare/v6.3.19...v6.3.20) (2025-06-16) +### Features + +* **native-plugin:** use js modulepreload polyfill plugin in dev environment ([#237](https://github.com/vitejs/rolldown-vite/issues/237)) ([d86c3bd](https://github.com/vitejs/rolldown-vite/commit/d86c3bd849615900d193bde165f184a7e0da798a)) +* update rolldown ([#259](https://github.com/vitejs/rolldown-vite/issues/259)) ([a4a60e9](https://github.com/vitejs/rolldown-vite/commit/a4a60e928e9998de7ab9d67494ce801a2ecf5b77)) + +## [6.3.19](https://github.com/vitejs/rolldown-vite/compare/v6.3.18...v6.3.19) (2025-06-12) +### Features + +* enable preserveEntrySignatures ([#253](https://github.com/vitejs/rolldown-vite/issues/253)) ([e625289](https://github.com/vitejs/rolldown-vite/commit/e625289629ef3b416377adec63846dc7b6105392)) +* **native-plugin:** use js alias plugin in dev environment ([#231](https://github.com/vitejs/rolldown-vite/issues/231)) ([bf84ccb](https://github.com/vitejs/rolldown-vite/commit/bf84ccb4c78b1dea9842d6c3e975284c4052ede2)) +* **native-plugin:** use js dynamic import vars plugin in dev environment ([#233](https://github.com/vitejs/rolldown-vite/issues/233)) ([f6d1dd5](https://github.com/vitejs/rolldown-vite/commit/f6d1dd526054c20cd499576f29d4d25f45cd38e4)) +* **native-plugin:** use js import glob plugin in dev environment ([#234](https://github.com/vitejs/rolldown-vite/issues/234)) ([a56245e](https://github.com/vitejs/rolldown-vite/commit/a56245e8150cf8d1fe43e1a0ba83a8fc34763e06)) +* **native-plugin:** use js oxc transform plugin in dev environment ([#238](https://github.com/vitejs/rolldown-vite/issues/238)) ([7246509](https://github.com/vitejs/rolldown-vite/commit/72465094edea4f9ad4db0cdd6529d1495f88ff78)) +* **native-plugin:** use js wasm helper in dev environment ([#245](https://github.com/vitejs/rolldown-vite/issues/245)) ([94c97b7](https://github.com/vitejs/rolldown-vite/commit/94c97b7feb5ad4574e5f21a4df19cf1fcee7ada6)) +* **native-plugin:** use js web worker post in dev environment ([#244](https://github.com/vitejs/rolldown-vite/issues/244)) ([420eb32](https://github.com/vitejs/rolldown-vite/commit/420eb32536350a3ace02a51ec6590fe1bca9bf19)) +* update rolldown ([849e744](https://github.com/vitejs/rolldown-vite/commit/849e744f49914ce87031da6585a65316af169adc)) +* update rolldown ([#247](https://github.com/vitejs/rolldown-vite/issues/247)) ([52e2490](https://github.com/vitejs/rolldown-vite/commit/52e24901d155515b3f30cfb877391e9851bb5497)) +* update rolldown ([#252](https://github.com/vitejs/rolldown-vite/issues/252)) ([5d2bba3](https://github.com/vitejs/rolldown-vite/commit/5d2bba33d45b65ab3264f1551a4b36b31b336b4a)) + +### Bug Fixes + +* accept umd without exports ([#240](https://github.com/vitejs/rolldown-vite/issues/240)) ([85f2db0](https://github.com/vitejs/rolldown-vite/commit/85f2db0fa0f4da87985e28dc5578ea8403aabb89)) + +### Performance Improvements + +* always use native plugin for load fallback plugin ([#236](https://github.com/vitejs/rolldown-vite/issues/236)) ([031c41a](https://github.com/vitejs/rolldown-vite/commit/031c41aaaeb9d2557bdc4fbae9517626a024ecf6)) + +### Code Refactoring + +* move the condition related to `enableNativePlugin` to the plugin file side ([#239](https://github.com/vitejs/rolldown-vite/issues/239)) ([a4d8319](https://github.com/vitejs/rolldown-vite/commit/a4d8319ca7df7fff3cc60e6a6b7629acaf873766)) + +## [6.3.18](https://github.com/vitejs/rolldown-vite/compare/v6.3.17...v6.3.18) (2025-06-06) +### Features + +* update rolldown ([#227](https://github.com/vitejs/rolldown-vite/issues/227)) ([b63345a](https://github.com/vitejs/rolldown-vite/commit/b63345a294c3ec34100e5a22fb43c873d49d028a)) + +### Tests + +* `onTestFinished` instead of `afterEach` for file restoration ([#221](https://github.com/vitejs/rolldown-vite/issues/221)) ([82d9315](https://github.com/vitejs/rolldown-vite/commit/82d9315ddff75df8c1dadd2ab2c7b7c0073ea256)) + +## [6.3.17](https://github.com/vitejs/rolldown-vite/compare/v6.3.16...v6.3.17) (2025-06-04) +### Features + +* append plugin name to logs ([#205](https://github.com/vitejs/rolldown-vite/issues/205)) ([a6ea3f8](https://github.com/vitejs/rolldown-vite/commit/a6ea3f8f508fdd0f32783c904d8b008cfc2e8ab6)) +* update rolldown ([69d1350](https://github.com/vitejs/rolldown-vite/commit/69d1350086037010a9f5014b323092c77dc6c894)) + +### Miscellaneous Chores +* tweak `optimizeDeps.esbuildOptions` deprecate message ([#209](https://github.com/vitejs/rolldown-vite/issues/209)) ([6133c97](https://github.com/vitejs/rolldown-vite/commit/6133c97567fb5e3e6affeef928348c87801fc87d)) +* typo in `optimizeDeps.esbuildOptions` deprecated message ([ee1a884](https://github.com/vitejs/rolldown-vite/commit/ee1a88430fd128fd134b57cd09eed507bf7e42f2)) -#### [7.0.0-beta.2](https://github.com/vitejs/vite/compare/v7.0.0-beta.1...v7.0.0-beta.2) (2025-06-17) +### Tests -See [7.0.0-beta.2 changelog](https://github.com/vitejs/vite/blob/v7.0.0-beta.2/packages/vite/CHANGELOG.md) +* add oxc plugin unit tests ([ab57b3f](https://github.com/vitejs/rolldown-vite/commit/ab57b3fb6fc4ac17da8fe848d047ddd548e80733)) +* correct esbuild `useDefineForClassFields` test ([#206](https://github.com/vitejs/rolldown-vite/issues/206)) ([1e7760e](https://github.com/vitejs/rolldown-vite/commit/1e7760eb78e2f980411461d24fe2d780965b4054)) +## [6.3.16](https://github.com/vitejs/rolldown-vite/compare/v6.3.15...v6.3.16) (2025-06-02) +### Features -#### [7.0.0-beta.1](https://github.com/vitejs/vite/compare/v7.0.0-beta.0...v7.0.0-beta.1) (2025-06-10) +* update rolldown ([fdd972b](https://github.com/vitejs/rolldown-vite/commit/fdd972b86edaafbd541bab1c886bb9283a4dbb87)) -See [7.0.0-beta.1 changelog](https://github.com/vitejs/vite/blob/v7.0.0-beta.1/packages/vite/CHANGELOG.md) +## [6.3.15](https://github.com/vitejs/rolldown-vite/compare/v6.3.14...v6.3.15) (2025-06-01) +### Features +* update rolldown ([c024b3d](https://github.com/vitejs/rolldown-vite/commit/c024b3dda7193ad981e57dfc9522860b898e609a)) -#### [7.0.0-beta.0](https://github.com/vitejs/vite/compare/6.3.5...v7.0.0-beta.0) (2025-06-02) +## [6.3.14](https://github.com/vitejs/rolldown-vite/compare/v6.3.13...v6.3.14) (2025-05-29) +### Features -See [7.0.0-beta.0 changelog](https://github.com/vitejs/vite/blob/v7.0.0-beta.0/packages/vite/CHANGELOG.md) +* update rolldown ([bbd4728](https://github.com/vitejs/rolldown-vite/commit/bbd472850bc595bc9785c5c21e2727c727c6fa7d)) +### Bug Fixes + +* **worker:** import.meta should be replaced ([c22ffbc](https://github.com/vitejs/rolldown-vite/commit/c22ffbca79cb4a12012ccf5939355f9318d2408d)) + +## [6.3.13](https://github.com/vitejs/rolldown-vite/compare/v6.3.12...v6.3.13) (2025-05-28) +### Features + +* **native-plugin:** support `import.meta.env.*` for native define plugin ([#188](https://github.com/vitejs/rolldown-vite/issues/188)) ([8557f7a](https://github.com/vitejs/rolldown-vite/commit/8557f7ad030ff6b2b8661e0f07664451d8debee8)) +* update rolldown ([#190](https://github.com/vitejs/rolldown-vite/issues/190)) ([3e8a826](https://github.com/vitejs/rolldown-vite/commit/3e8a82654db81e97300231cb29584c37894ffc1e)) -## [6.3.5](https://github.com/vitejs/vite/compare/v6.3.4...v6.3.5) (2025-05-05) ### Bug Fixes -* **ssr:** handle uninitialized export access as undefined ([#19959](https://github.com/vitejs/vite/issues/19959)) ([fd38d07](https://github.com/vitejs/vite/commit/fd38d076fe2455aac1e00a7b15cd51159bf12bb5)) +* **native-plugin:** run output generation hooks of buildImportAnalysisPlugin ([#187](https://github.com/vitejs/rolldown-vite/issues/187)) ([52af0fc](https://github.com/vitejs/rolldown-vite/commit/52af0fcefd10475e13c5c2536dfada3561c5542d)) + +## [6.3.12](https://github.com/vitejs/rolldown-vite/compare/v6.3.11...v6.3.12) (2025-05-21) +### Features + +* moduleType support in dev ([#172](https://github.com/vitejs/rolldown-vite/issues/172)) ([707778e](https://github.com/vitejs/rolldown-vite/commit/707778e60230bbe71a6ef5debcbdceae4e497840)) +* **native-plugin:** support native `webWorkerPostPlugin` ([#183](https://github.com/vitejs/rolldown-vite/issues/183)) ([f222910](https://github.com/vitejs/rolldown-vite/commit/f2229102dbed0e2843f028d86190b9a080d924c5)) +* update rolldown ([7016327](https://github.com/vitejs/rolldown-vite/commit/7016327de2c7f9c3bf8f3603d36ecf2f91110820)) -## [6.3.4](https://github.com/vitejs/vite/compare/v6.3.3...v6.3.4) (2025-04-30) ### Bug Fixes -* check static serve file inside sirv ([#19965](https://github.com/vitejs/vite/issues/19965)) ([c22c43d](https://github.com/vitejs/vite/commit/c22c43de612eebb6c182dd67850c24e4fab8cacb)) -* **optimizer:** return plain object when using `require` to import externals in optimized dependencies ([#19940](https://github.com/vitejs/vite/issues/19940)) ([efc5eab](https://github.com/vitejs/vite/commit/efc5eab253419fde0a6a48b8d2f233063d6a9643)) +* **css:** inject CSS correctly when `cssCodesplit: true` and IIFE/UMD ([#181](https://github.com/vitejs/rolldown-vite/issues/181)) ([a31c182](https://github.com/vitejs/rolldown-vite/commit/a31c1828e9bd542a6dee20cfda6e41bf565ebc7f)) + +## [6.3.11](https://github.com/vitejs/rolldown-vite/compare/v6.3.10...v6.3.11) (2025-05-19) +### Features + +* **types:** allow rollup plugin to be assigned to `plugins` option ([#176](https://github.com/vitejs/rolldown-vite/issues/176)) ([cfc8de8](https://github.com/vitejs/rolldown-vite/commit/cfc8de851ad8fcc411eecb203cf47095c734ceb5)) +* update rolldown ([ddf15a0](https://github.com/vitejs/rolldown-vite/commit/ddf15a0a0eb103774a51bdd1084814658684fd8a)) + +### Bug Fixes + +* apply filter for css-post plugin and json plugin ([b04fee7](https://github.com/vitejs/rolldown-vite/commit/b04fee7c6828134799e17481efed0e7915120814)) +* **native-plugin:** align native reporter plugin with non-native one ([#178](https://github.com/vitejs/rolldown-vite/issues/178)) ([d9c01ec](https://github.com/vitejs/rolldown-vite/commit/d9c01ec5daa1941880ccb13dcda4b80908908d28)) +* use correct self-reference import ([#180](https://github.com/vitejs/rolldown-vite/issues/180)) ([7f1c1dd](https://github.com/vitejs/rolldown-vite/commit/7f1c1dd04ab9c2814aac649029920bf830b8ad65)) +* use filter property set on functions ([9f56a22](https://github.com/vitejs/rolldown-vite/commit/9f56a22cd6423669350e35cbbacd3ca4a0002394)) ### Code Refactoring -* remove duplicate plugin context type ([#19935](https://github.com/vitejs/vite/issues/19935)) ([d6d01c2](https://github.com/vitejs/vite/commit/d6d01c2292fa4f9603e05b95d81c8724314c20e0)) +* **native-plugin:** rename nativeReporterPlugin ([12e9189](https://github.com/vitejs/rolldown-vite/commit/12e918960a28e3b76c1158387ee3543be317a6a2)) + +## [6.3.10](https://github.com/vitejs/rolldown-vite/compare/v6.3.9...v6.3.10) (2025-05-16) +### Features + +* update rolldown ([cb2e308](https://github.com/vitejs/rolldown-vite/commit/cb2e30845988e0d8089f181bf58c65a2079d0ee2)) -## [6.3.3](https://github.com/vitejs/vite/compare/v6.3.2...v6.3.3) (2025-04-24) ### Bug Fixes -* **assets:** ensure ?no-inline is not included in the asset url in the production environment ([#19496](https://github.com/vitejs/vite/issues/19496)) ([16a73c0](https://github.com/vitejs/vite/commit/16a73c05d35daa34117a173784895546212db5f4)) -* **css:** resolve relative imports in sass properly on Windows ([#19920](https://github.com/vitejs/vite/issues/19920)) ([ffab442](https://github.com/vitejs/vite/commit/ffab44270488f54ae344801024474b597249071b)) -* **deps:** update all non-major dependencies ([#19899](https://github.com/vitejs/vite/issues/19899)) ([a4b500e](https://github.com/vitejs/vite/commit/a4b500ef9ccc9b19a2882156a9ba8397e69bc6b2)) -* ignore malformed uris in tranform middleware ([#19853](https://github.com/vitejs/vite/issues/19853)) ([e4d5201](https://github.com/vitejs/vite/commit/e4d520141bcd83ad61f16767348b4a813bf9340a)) -* **ssr:** fix execution order of re-export ([#19841](https://github.com/vitejs/vite/issues/19841)) ([ed29dee](https://github.com/vitejs/vite/commit/ed29dee2eb2e3573b2bc337e1a9124c65222a1e5)) -* **ssr:** fix live binding of default export declaration and hoist exports getter ([#19842](https://github.com/vitejs/vite/issues/19842)) ([80a91ff](https://github.com/vitejs/vite/commit/80a91ff82426a4c88d54b9f5ec9a4205cb13899b)) +* **client:** render the last part of the stacktrace ([#20039](https://github.com/vitejs/rolldown-vite/issues/20039)) ([c7c1743](https://github.com/vitejs/rolldown-vite/commit/c7c17434968848f1471179c10a5fc9d2804add8b)) +* **deps:** update all non-major dependencies ([#19953](https://github.com/vitejs/rolldown-vite/issues/19953)) ([ac8e1fb](https://github.com/vitejs/rolldown-vite/commit/ac8e1fb289a06fc0671dab1f4ef68e508e34360e)) +* **optimizer:** pass define option to optimizer ([#170](https://github.com/vitejs/rolldown-vite/issues/170)) ([b642f48](https://github.com/vitejs/rolldown-vite/commit/b642f483f1284b57e2a8d9ed368807b1335b0428)) + +### Miscellaneous Chores + +* add deprecation warning for `transformWithEsbuild` ([#173](https://github.com/vitejs/rolldown-vite/issues/173)) ([1ee8ef4](https://github.com/vitejs/rolldown-vite/commit/1ee8ef468510df92cea71a1a61bc69dbeed9e03c)) +* deprecate `ResolvedConfig.createResolver` and recommend `createIdResolver` ([#20031](https://github.com/vitejs/rolldown-vite/issues/20031)) ([d101d64](https://github.com/vitejs/rolldown-vite/commit/d101d64722f82ed681b833bfd3fb394eeb496e21)) +* fix comment for `devEnvironmentOptions.moduleRunnerTransform` ([#20035](https://github.com/vitejs/rolldown-vite/issues/20035)) ([338081d](https://github.com/vitejs/rolldown-vite/commit/338081df9649f68484416d199113fc67abbb6cd5)) +* fix types ([1216e2f](https://github.com/vitejs/rolldown-vite/commit/1216e2fb4f7b2461c7c2178b754b58295e6ae3e5)) + +## [6.3.9](https://github.com/vitejs/rolldown-vite/compare/v6.3.8...v6.3.9) (2025-05-12) +### Features + +* support `useDefineForClassFields=false` with `target>=es2022` ([9933779](https://github.com/vitejs/rolldown-vite/commit/99337793b2f348cb0ce724df23f9dcaabf31dfda)) +* update rolldown ([9ff4513](https://github.com/vitejs/rolldown-vite/commit/9ff4513e138524656791f1207a913d8745a700ab)) + +### Bug Fixes + +* **cli:** make `cleanGlobalCLIOptions()` clean `--force` ([#19999](https://github.com/vitejs/rolldown-vite/issues/19999)) ([d4a171a](https://github.com/vitejs/rolldown-vite/commit/d4a171afd387000789172a94c94a1c33c0856f85)) +* **optimizer:** suppress warnings for optimizer ([#160](https://github.com/vitejs/rolldown-vite/issues/160)) ([9615b13](https://github.com/vitejs/rolldown-vite/commit/9615b136a8c554b1f0d3308e5e0e352f7d69be62)) + +### Code Refactoring + +* use util functions from `@rolldown/pluginutils` ([#166](https://github.com/vitejs/rolldown-vite/issues/166)) ([3903193](https://github.com/vitejs/rolldown-vite/commit/3903193cabbef0a0be89ae6e6884ff68faf53d37)) + +### Continuous Integration + +* run tests with native resolver ([#163](https://github.com/vitejs/rolldown-vite/issues/163)) ([284487e](https://github.com/vitejs/rolldown-vite/commit/284487e2370586342153548e446dce4aeda464e3)) + +## [6.3.8](https://github.com/vitejs/rolldown-vite/compare/v6.3.7...v6.3.8) (2025-05-07) +### Features + +* **types:** add `Rollup.RollupWatcherEvent` type ([#152](https://github.com/vitejs/rolldown-vite/issues/152)) ([1b31e92](https://github.com/vitejs/rolldown-vite/commit/1b31e92e263f7d8e2c6eb83ab3f9d412262d08c0)) +* update rolldown ([2fed74f](https://github.com/vitejs/rolldown-vite/commit/2fed74fbd4d2570126181d27e47710306ca0d550)) + +### Bug Fixes + +* **config:** make dynamic import work in config ([#157](https://github.com/vitejs/rolldown-vite/issues/157)) ([6e1d23e](https://github.com/vitejs/rolldown-vite/commit/6e1d23ece97b71e7b8d13eec88eeddaa62840613)) +* **ssr:** handle uninitialized export access as undefined ([#19959](https://github.com/vitejs/rolldown-vite/issues/19959)) ([fd38d07](https://github.com/vitejs/rolldown-vite/commit/fd38d076fe2455aac1e00a7b15cd51159bf12bb5)) +* watch related fixes ([#158](https://github.com/vitejs/rolldown-vite/issues/158)) ([ccfccef](https://github.com/vitejs/rolldown-vite/commit/ccfccef5c6f92cc00ef295faafcaa14ab038dce2)) + +## [6.3.7](https://github.com/vitejs/rolldown-vite/compare/v6.3.6...v6.3.7) (2025-05-02) +### Features + +* **types:** add `shouldTransformCachedModule` for compat ([#150](https://github.com/vitejs/rolldown-vite/issues/150)) ([f5d2494](https://github.com/vitejs/rolldown-vite/commit/f5d2494b61db5bc29639cda880bdaa3f119758e4)) +* update rolldown ([9b83bd1](https://github.com/vitejs/rolldown-vite/commit/9b83bd1fe699e3d9f49e950b04d7ec30c94e3977)) +* use Rolldown's watch API ([#67](https://github.com/vitejs/rolldown-vite/issues/67)) ([2b287c6](https://github.com/vitejs/rolldown-vite/commit/2b287c6edf49b970b6596b56b628ebaaf12fb581)) + +## [6.3.6](https://github.com/vitejs/rolldown-vite/compare/v6.3.5...v6.3.6) (2025-05-01) +### Features + +* **types:** make exposed `Rollup` type more compatible with Rollup ([#145](https://github.com/vitejs/rolldown-vite/issues/145)) ([f086663](https://github.com/vitejs/rolldown-vite/commit/f0866633aa99cfbf86746e5d1d50d3913b1a9f90)) +* update rolldown ([b3efa58](https://github.com/vitejs/rolldown-vite/commit/b3efa58b3790fb38ebf659d020ee2b6744785b59)) + +### Bug Fixes + +* **asset:** regex filter should not force query to be included ([#143](https://github.com/vitejs/rolldown-vite/issues/143)) ([265e4d4](https://github.com/vitejs/rolldown-vite/commit/265e4d49ff16f054e38cb3954c0214b7c6ff73ee)) +* check static serve file inside sirv ([#19965](https://github.com/vitejs/rolldown-vite/issues/19965)) ([c22c43d](https://github.com/vitejs/rolldown-vite/commit/c22c43de612eebb6c182dd67850c24e4fab8cacb)) +* **optimizer:** return plain object when using `require` to import externals in optimized dependencies ([#19940](https://github.com/vitejs/rolldown-vite/issues/19940)) ([efc5eab](https://github.com/vitejs/rolldown-vite/commit/efc5eab253419fde0a6a48b8d2f233063d6a9643)) +* set `typescript.removeClassFieldsWithoutInitializer` for `useDefineForClassFields=false` ([#148](https://github.com/vitejs/rolldown-vite/issues/148)) ([fca16ad](https://github.com/vitejs/rolldown-vite/commit/fca16adfd62aef42c0477efaf494984d64f6af78)) +* **types:** add ESBuildOptions type back ([#146](https://github.com/vitejs/rolldown-vite/issues/146)) ([6eccf22](https://github.com/vitejs/rolldown-vite/commit/6eccf22247988c09881f2ef0dd8c08d90b427d57)) + +### Miscellaneous Chores + +* add rolldown-vite indicator ([#141](https://github.com/vitejs/rolldown-vite/issues/141)) ([9c6218e](https://github.com/vitejs/rolldown-vite/commit/9c6218ea4b56eb97b40365b8d617de58c336fc3a)) + +### Code Refactoring + +* remove duplicate plugin context type ([#19935](https://github.com/vitejs/rolldown-vite/issues/19935)) ([d6d01c2](https://github.com/vitejs/rolldown-vite/commit/d6d01c2292fa4f9603e05b95d81c8724314c20e0)) + +## [6.3.5](https://github.com/vitejs/rolldown-vite/compare/v6.3.4...v6.3.5) (2025-04-24) +### Features + +* **native-plugin:** use native reporter plugin ([#138](https://github.com/vitejs/rolldown-vite/issues/138)) ([5306775](https://github.com/vitejs/rolldown-vite/commit/530677567b2f18839a639c3309c330abab5164b5)) +* update rolldown ([ec8faac](https://github.com/vitejs/rolldown-vite/commit/ec8faac6a45fc53ff1489646c18efab71bab5747)) + +### Bug Fixes + +* **assets:** ensure ?no-inline is not included in the asset url in the production environment ([#19496](https://github.com/vitejs/rolldown-vite/issues/19496)) ([16a73c0](https://github.com/vitejs/rolldown-vite/commit/16a73c05d35daa34117a173784895546212db5f4)) +* **css:** resolve relative imports in sass properly on Windows ([#19920](https://github.com/vitejs/rolldown-vite/issues/19920)) ([ffab442](https://github.com/vitejs/rolldown-vite/commit/ffab44270488f54ae344801024474b597249071b)) +* **deps:** update all non-major dependencies ([#19899](https://github.com/vitejs/rolldown-vite/issues/19899)) ([a4b500e](https://github.com/vitejs/rolldown-vite/commit/a4b500ef9ccc9b19a2882156a9ba8397e69bc6b2)) +* ignore malformed uris in tranform middleware ([#19853](https://github.com/vitejs/rolldown-vite/issues/19853)) ([e4d5201](https://github.com/vitejs/rolldown-vite/commit/e4d520141bcd83ad61f16767348b4a813bf9340a)) +* **ssr:** fix execution order of re-export ([#19841](https://github.com/vitejs/rolldown-vite/issues/19841)) ([ed29dee](https://github.com/vitejs/rolldown-vite/commit/ed29dee2eb2e3573b2bc337e1a9124c65222a1e5)) +* **ssr:** fix live binding of default export declaration and hoist exports getter ([#19842](https://github.com/vitejs/rolldown-vite/issues/19842)) ([80a91ff](https://github.com/vitejs/rolldown-vite/commit/80a91ff82426a4c88d54b9f5ec9a4205cb13899b)) ### Performance Improvements -* skip sourcemap generation for renderChunk hook of import-analysis-build plugin ([#19921](https://github.com/vitejs/vite/issues/19921)) ([55cfd04](https://github.com/vitejs/vite/commit/55cfd04b10f98cde7a96814a69b9813543ea79c2)) +* skip sourcemap generation for renderChunk hook of import-analysis-build plugin ([#19921](https://github.com/vitejs/rolldown-vite/issues/19921)) ([55cfd04](https://github.com/vitejs/rolldown-vite/commit/55cfd04b10f98cde7a96814a69b9813543ea79c2)) ### Tests -* **ssr:** test `ssrTransform` re-export deps and test stacktrace with first line ([#19629](https://github.com/vitejs/vite/issues/19629)) ([9399cda](https://github.com/vitejs/vite/commit/9399cdaf8c3b2efd5f4015d57dc3b0e4e5b91a9d)) +* **ssr:** test `ssrTransform` re-export deps and test stacktrace with first line ([#19629](https://github.com/vitejs/rolldown-vite/issues/19629)) ([9399cda](https://github.com/vitejs/rolldown-vite/commit/9399cdaf8c3b2efd5f4015d57dc3b0e4e5b91a9d)) -## [6.3.2](https://github.com/vitejs/vite/compare/v6.3.1...v6.3.2) (2025-04-18) +## [6.3.4](https://github.com/vitejs/rolldown-vite/compare/v6.3.3...v6.3.4) (2025-04-23) ### Features -* **css:** improve lightningcss messages ([#19880](https://github.com/vitejs/vite/issues/19880)) ([c713f79](https://github.com/vitejs/vite/commit/c713f79b5a4bd98542d8dbe4c85ba4cce9b1f358)) +* **native-plugin:** adapt to the new native `transformPlugin` ([#136](https://github.com/vitejs/rolldown-vite/issues/136)) ([e5fa092](https://github.com/vitejs/rolldown-vite/commit/e5fa092c8d8eff2f4aca603094fd27ccd04431c3)) +* update rolldown ([233b7bf](https://github.com/vitejs/rolldown-vite/commit/233b7bff5c4ce9c554722c9915c2a7877ccb2711)) + +## [6.3.3](https://github.com/vitejs/rolldown-vite/compare/v6.3.2...v6.3.3) (2025-04-22) +### Features + +* add backward compat and warning for esbuild.banner/footer ([#135](https://github.com/vitejs/rolldown-vite/issues/135)) ([702b6ac](https://github.com/vitejs/rolldown-vite/commit/702b6acefa0f62458bb2c23814a816fe511afe01)) +* update rolldown ([cd8aa76](https://github.com/vitejs/rolldown-vite/commit/cd8aa7610685855ffe835b026f028273487cce9b)) + +## [6.3.2](https://github.com/vitejs/rolldown-vite/compare/v6.3.1...v6.3.2) (2025-04-21) +### Features + +* update rolldown ([c655b43](https://github.com/vitejs/rolldown-vite/commit/c655b431db1067be224f3c16b36da0e2b199e9b3)) ### Bug Fixes -* **css:** respect `css.lightningcss` option in css minification process ([#19879](https://github.com/vitejs/vite/issues/19879)) ([b5055e0](https://github.com/vitejs/vite/commit/b5055e0dd4c0e084115c3dbfead5736a54807e0c)) -* **deps:** update all non-major dependencies ([#19698](https://github.com/vitejs/vite/issues/19698)) ([bab4cb9](https://github.com/vitejs/vite/commit/bab4cb92248adf6b9b18df12b2bf03889b0bd1eb)) -* match default asserts case insensitive ([#19852](https://github.com/vitejs/vite/issues/19852)) ([cbdab1d](https://github.com/vitejs/vite/commit/cbdab1d6a30e07263ec51b2ca042369e736adec6)) -* open first url if host does not match any urls ([#19886](https://github.com/vitejs/vite/issues/19886)) ([6abbdce](https://github.com/vitejs/vite/commit/6abbdce3d77990409e12380e72c7ec9dd3f8bec5)) +* **oxc:** correctly type oxc options ([#131](https://github.com/vitejs/rolldown-vite/issues/131)) ([bc90a9e](https://github.com/vitejs/rolldown-vite/commit/bc90a9ef6cd01783e429d1bf17f2a61636685501)) + +### Performance Improvements + +* add filter to asset plugin ([#118](https://github.com/vitejs/rolldown-vite/issues/118)) ([1f0f755](https://github.com/vitejs/rolldown-vite/commit/1f0f75507b6df50b5ed8a880af6bccb0fa753932)) +* remove data uri plugin ([#130](https://github.com/vitejs/rolldown-vite/issues/130)) ([33ba886](https://github.com/vitejs/rolldown-vite/commit/33ba88663e518773dc1151c103e90a1bed2acf1b)) + +## [6.3.1](https://github.com/vitejs/rolldown-vite/compare/v6.3.0...v6.3.1) (2025-04-18) +### Features + +* **css:** improve lightningcss messages ([#19880](https://github.com/vitejs/rolldown-vite/issues/19880)) ([c713f79](https://github.com/vitejs/rolldown-vite/commit/c713f79b5a4bd98542d8dbe4c85ba4cce9b1f358)) +* update rolldown ([4c2f7db](https://github.com/vitejs/rolldown-vite/commit/4c2f7db159b6f4986036978d0a9d5844c1618f1e)) -## [6.3.1](https://github.com/vitejs/vite/compare/v6.3.0...v6.3.1) (2025-04-17) ### Bug Fixes -* avoid using `Promise.allSettled` in preload function ([#19805](https://github.com/vitejs/vite/issues/19805)) ([35c7f35](https://github.com/vitejs/vite/commit/35c7f35e2b67f2158ededf2af58ecec53b3f16c5)) -* backward compat for internal plugin `transform` calls ([#19878](https://github.com/vitejs/vite/issues/19878)) ([a152b7c](https://github.com/vitejs/vite/commit/a152b7cbac72e05668f8fc23074d531ecebb77a5)) +* **css:** respect `css.lightningcss` option in css minification process ([#19879](https://github.com/vitejs/rolldown-vite/issues/19879)) ([b5055e0](https://github.com/vitejs/rolldown-vite/commit/b5055e0dd4c0e084115c3dbfead5736a54807e0c)) +* **deps:** update all non-major dependencies ([#19698](https://github.com/vitejs/rolldown-vite/issues/19698)) ([bab4cb9](https://github.com/vitejs/rolldown-vite/commit/bab4cb92248adf6b9b18df12b2bf03889b0bd1eb)) +* match default asserts case insensitive ([#19852](https://github.com/vitejs/rolldown-vite/issues/19852)) ([cbdab1d](https://github.com/vitejs/rolldown-vite/commit/cbdab1d6a30e07263ec51b2ca042369e736adec6)) +* open first url if host does not match any urls ([#19886](https://github.com/vitejs/rolldown-vite/issues/19886)) ([6abbdce](https://github.com/vitejs/rolldown-vite/commit/6abbdce3d77990409e12380e72c7ec9dd3f8bec5)) + +## [6.3.0](https://github.com/vitejs/rolldown-vite/compare/v6.3.0-beta.8...v6.3.0) (2025-04-17) +### Features + +* reexport `withFilter` from rolldown ([#122](https://github.com/vitejs/rolldown-vite/issues/122)) ([f2d0354](https://github.com/vitejs/rolldown-vite/commit/f2d0354b02881f35e97b95fcf7328ddb597e3b64)) +* update rolldown ([752d7f6](https://github.com/vitejs/rolldown-vite/commit/752d7f646cb16f9731b8bc9592dd539bbfc9bf86)) -## [6.3.0](https://github.com/vitejs/vite/compare/v6.3.0-beta.2...v6.3.0) (2025-04-16) ### Bug Fixes -* **hmr:** avoid infinite loop happening with `hot.invalidate` in circular deps ([#19870](https://github.com/vitejs/vite/issues/19870)) ([d4ee5e8](https://github.com/vitejs/vite/commit/d4ee5e8655a85f4d6bebc695b063d69406ab53ac)) -* **preview:** use host url to open browser ([#19836](https://github.com/vitejs/vite/issues/19836)) ([5003434](https://github.com/vitejs/vite/commit/50034340401b4043bb0b158f18ffb7ae1b7f5c86)) +* avoid using `Promise.allSettled` in preload function ([#19805](https://github.com/vitejs/rolldown-vite/issues/19805)) ([35c7f35](https://github.com/vitejs/rolldown-vite/commit/35c7f35e2b67f2158ededf2af58ecec53b3f16c5)) +* backward compat for internal plugin `transform` calls ([#19878](https://github.com/vitejs/rolldown-vite/issues/19878)) ([a152b7c](https://github.com/vitejs/rolldown-vite/commit/a152b7cbac72e05668f8fc23074d531ecebb77a5)) +* **hmr:** avoid infinite loop happening with `hot.invalidate` in circular deps ([#19870](https://github.com/vitejs/rolldown-vite/issues/19870)) ([d4ee5e8](https://github.com/vitejs/rolldown-vite/commit/d4ee5e8655a85f4d6bebc695b063d69406ab53ac)) +* **native-plugin:** disable optimizerResolvePlugin correctly ([#116](https://github.com/vitejs/rolldown-vite/issues/116)) ([bf2b441](https://github.com/vitejs/rolldown-vite/commit/bf2b4416f7cbf8c154e7bb07bf7472ca6714c183)) +* **optimizer:** include rollupOptions in config hash ([#115](https://github.com/vitejs/rolldown-vite/issues/115)) ([732a8e4](https://github.com/vitejs/rolldown-vite/commit/732a8e4867e1646fdfd78948bc3f8fcd5864945a)) + +## [6.3.0-beta.8](https://github.com/vitejs/rolldown-vite/compare/v6.3.0-beta.7...v6.3.0-beta.8) (2025-04-15) +### Features + +* update rolldown ([e996d54](https://github.com/vitejs/rolldown-vite/commit/e996d54d06b67cb1773e299ea6598debccc7712c)) -## [6.3.0-beta.2](https://github.com/vitejs/vite/compare/v6.3.0-beta.1...v6.3.0-beta.2) (2025-04-11) ### Bug Fixes -* addWatchFile doesn't work if base is specified (fixes [#19792](https://github.com/vitejs/vite/issues/19792)) ([#19794](https://github.com/vitejs/vite/issues/19794)) ([8bed1de](https://github.com/vitejs/vite/commit/8bed1de5710f2a097af0e22a196545446d98f988)) -* correct the behavior when multiple transform filter options are specified ([#19818](https://github.com/vitejs/vite/issues/19818)) ([7200dee](https://github.com/vitejs/vite/commit/7200deec91a501fb84734e23906f80808734540c)) -* **css:** remove empty chunk imports correctly when chunk file name contained special characters ([#19814](https://github.com/vitejs/vite/issues/19814)) ([b125172](https://github.com/vitejs/vite/commit/b1251720d47f15615ea354991cdaa90d9a94aae5)) -* **dev:** make query selector regexes more inclusive (fix [#19213](https://github.com/vitejs/vite/issues/19213)) ([#19767](https://github.com/vitejs/vite/issues/19767)) ([f530a72](https://github.com/vitejs/vite/commit/f530a72246ec8e73b1f2ba767f6c108e9ac9712a)) -* fs check with svg and relative paths ([#19782](https://github.com/vitejs/vite/issues/19782)) ([62d7e81](https://github.com/vitejs/vite/commit/62d7e81ee189d65899bb65f3263ddbd85247b647)) -* **hmr:** run HMR handler sequentially ([#19793](https://github.com/vitejs/vite/issues/19793)) ([380c10e](https://github.com/vitejs/vite/commit/380c10e665e78ef732a8d7b6c8f60a1226fc4c3b)) -* keep entry asset files imported by other files ([#19779](https://github.com/vitejs/vite/issues/19779)) ([2fa1495](https://github.com/vitejs/vite/commit/2fa149580118a6b7988593dea9e2bf2ee679506c)) -* **module-runner:** allow already resolved id as entry ([#19768](https://github.com/vitejs/vite/issues/19768)) ([e2e11b1](https://github.com/vitejs/vite/commit/e2e11b15a6083777ee521e26a3f79c3859abd411)) -* reject requests with `#` in request-target ([#19830](https://github.com/vitejs/vite/issues/19830)) ([175a839](https://github.com/vitejs/vite/commit/175a83909f02d3b554452a7bd02b9f340cdfef70)) -* **types:** remove the `keepProcessEnv` from the `DefaultEnvironmentOptions` type ([#19796](https://github.com/vitejs/vite/issues/19796)) ([36935b5](https://github.com/vitejs/vite/commit/36935b58eabde46ab845e121e21525df5ad65ff1)) -* unbundle `fdir` to fix `commonjsOptions.dynamicRequireTargets` ([#19791](https://github.com/vitejs/vite/issues/19791)) ([71227be](https://github.com/vitejs/vite/commit/71227be9aab52c1c5df59afba4539646204eff74)) +* update oxc esbuild option warning message ([#111](https://github.com/vitejs/rolldown-vite/issues/111)) ([aa29797](https://github.com/vitejs/rolldown-vite/commit/aa29797d3d421355a96e73d0cfe339f43abbdf88)) + +### Miscellaneous Chores + +* oxc esbuild option warning message grammar ([#112](https://github.com/vitejs/rolldown-vite/issues/112)) ([892cf34](https://github.com/vitejs/rolldown-vite/commit/892cf3470b30346ad077395ee712d7a10d5901bf)) + +## [6.3.0-beta.7](https://github.com/vitejs/rolldown-vite/compare/v6.3.0-beta.6...v6.3.0-beta.7) (2025-04-12) +### Features + +* **optimizer:** improve esbuild plugin conversion compat ([#110](https://github.com/vitejs/rolldown-vite/issues/110)) ([6ec06b6](https://github.com/vitejs/rolldown-vite/commit/6ec06b648a0f0dc4441fff63bce39905e8f23b89)) + +### Bug Fixes + +* addWatchFile doesn't work if base is specified (fixes [#19792](https://github.com/vitejs/rolldown-vite/issues/19792)) ([#19794](https://github.com/vitejs/rolldown-vite/issues/19794)) ([8bed1de](https://github.com/vitejs/rolldown-vite/commit/8bed1de5710f2a097af0e22a196545446d98f988)) +* export `rolldownVersion` ([#109](https://github.com/vitejs/rolldown-vite/issues/109)) ([698cbea](https://github.com/vitejs/rolldown-vite/commit/698cbea07d7708331bd46becaf97400b20050a51)) +* **hmr:** run HMR handler sequentially ([#19793](https://github.com/vitejs/rolldown-vite/issues/19793)) ([380c10e](https://github.com/vitejs/rolldown-vite/commit/380c10e665e78ef732a8d7b6c8f60a1226fc4c3b)) +* **preview:** use host url to open browser ([#19836](https://github.com/vitejs/rolldown-vite/issues/19836)) ([5003434](https://github.com/vitejs/rolldown-vite/commit/50034340401b4043bb0b158f18ffb7ae1b7f5c86)) + +### Code Refactoring + +* simplify pluginFilter implementation ([#19828](https://github.com/vitejs/rolldown-vite/issues/19828)) ([0a0c50a](https://github.com/vitejs/rolldown-vite/commit/0a0c50a7ed38017469ed6dcec941c2d8d0efd0d0)) + +## [6.3.0-beta.6](https://github.com/vitejs/rolldown-vite/compare/v6.3.0-beta.5...v6.3.0-beta.6) (2025-04-10) +### Features + +* update rolldown ([e28b1c0](https://github.com/vitejs/rolldown-vite/commit/e28b1c0b988a37fbe56068dab3a5cf58fa3bbfba)) +* update rolldown ([c7e3e04](https://github.com/vitejs/rolldown-vite/commit/c7e3e040627e0d9db19cb665950452b5295053c6)) + +### Bug Fixes + +* correct the behavior when multiple transform filter options are specified ([#19818](https://github.com/vitejs/rolldown-vite/issues/19818)) ([7200dee](https://github.com/vitejs/rolldown-vite/commit/7200deec91a501fb84734e23906f80808734540c)) +* **css:** remove empty chunk imports correctly when chunk file name contained special characters ([#19814](https://github.com/vitejs/rolldown-vite/issues/19814)) ([b125172](https://github.com/vitejs/rolldown-vite/commit/b1251720d47f15615ea354991cdaa90d9a94aae5)) +* **dev:** make query selector regexes more inclusive (fix [#19213](https://github.com/vitejs/rolldown-vite/issues/19213)) ([#19767](https://github.com/vitejs/rolldown-vite/issues/19767)) ([f530a72](https://github.com/vitejs/rolldown-vite/commit/f530a72246ec8e73b1f2ba767f6c108e9ac9712a)) +* **module-runner:** allow already resolved id as entry ([#19768](https://github.com/vitejs/rolldown-vite/issues/19768)) ([e2e11b1](https://github.com/vitejs/rolldown-vite/commit/e2e11b15a6083777ee521e26a3f79c3859abd411)) +* reject requests with `#` in request-target ([#19830](https://github.com/vitejs/rolldown-vite/issues/19830)) ([175a839](https://github.com/vitejs/rolldown-vite/commit/175a83909f02d3b554452a7bd02b9f340cdfef70)) +* **types:** remove the `keepProcessEnv` from the `DefaultEnvironmentOptions` type ([#19796](https://github.com/vitejs/rolldown-vite/issues/19796)) ([36935b5](https://github.com/vitejs/rolldown-vite/commit/36935b58eabde46ab845e121e21525df5ad65ff1)) +* unbundle `fdir` to fix `commonjsOptions.dynamicRequireTargets` ([#19791](https://github.com/vitejs/rolldown-vite/issues/19791)) ([71227be](https://github.com/vitejs/rolldown-vite/commit/71227be9aab52c1c5df59afba4539646204eff74)) ### Performance Improvements -* **css:** avoid constructing `renderedModules` ([#19775](https://github.com/vitejs/vite/issues/19775)) ([59d0b35](https://github.com/vitejs/vite/commit/59d0b35b30f3a38be33c0a9bdc177945b6f7eb1b)) +* **css:** avoid constructing `renderedModules` ([#19775](https://github.com/vitejs/rolldown-vite/issues/19775)) ([59d0b35](https://github.com/vitejs/rolldown-vite/commit/59d0b35b30f3a38be33c0a9bdc177945b6f7eb1b)) +* define viteMetadata instead of assign ([#106](https://github.com/vitejs/rolldown-vite/issues/106)) ([7912459](https://github.com/vitejs/rolldown-vite/commit/7912459239d438570eb21ef71a05cc8c3579ff72)) ### Documentation -* **vite:** fix description of `transformIndexHtml` hook ([#19799](https://github.com/vitejs/vite/issues/19799)) ([a0e1a04](https://github.com/vitejs/vite/commit/a0e1a0402648e0df60fb928ffd97b0230999990d)) +* **vite:** fix description of `transformIndexHtml` hook ([#19799](https://github.com/vitejs/rolldown-vite/issues/19799)) ([a0e1a04](https://github.com/vitejs/rolldown-vite/commit/a0e1a0402648e0df60fb928ffd97b0230999990d)) ### Miscellaneous Chores -* remove unused eslint directive ([#19781](https://github.com/vitejs/vite/issues/19781)) ([cb4f5b4](https://github.com/vitejs/vite/commit/cb4f5b4b6bb7dc96812b126ccc475d1e2c3f7f92)) +* bump rolldown ([#105](https://github.com/vitejs/rolldown-vite/issues/105)) ([8646e4e](https://github.com/vitejs/rolldown-vite/commit/8646e4e68b432c8197c3f138dbe65356ac73fe16)) -### Code Refactoring +### Tests -* simplify pluginFilter implementation ([#19828](https://github.com/vitejs/vite/issues/19828)) ([0a0c50a](https://github.com/vitejs/vite/commit/0a0c50a7ed38017469ed6dcec941c2d8d0efd0d0)) +* tweak generateCodeFrame test ([#19812](https://github.com/vitejs/rolldown-vite/issues/19812)) ([8fe3538](https://github.com/vitejs/rolldown-vite/commit/8fe3538d9095384c670815dc42ef67e051f3246f)) -### Tests +## [6.3.0-beta.5](https://github.com/vitejs/rolldown-vite/compare/v6.3.0-beta.4...v6.3.0-beta.5) (2025-04-03) +### ⚠ BREAKING CHANGES + +* **oxc:** jsxRefresh filter (#101) + +### Features + +* **oxc:** jsxRefresh filter ([#101](https://github.com/vitejs/rolldown-vite/issues/101)) ([7c6faa6](https://github.com/vitejs/rolldown-vite/commit/7c6faa6b2b8fca039ec4dcc994cdb911caf0adb6)) + +### Bug Fixes + +* fs check with svg and relative paths ([#19782](https://github.com/vitejs/rolldown-vite/issues/19782)) ([62d7e81](https://github.com/vitejs/rolldown-vite/commit/62d7e81ee189d65899bb65f3263ddbd85247b647)) +* **hmr:** throw non-standard error info causes logical error ([#19776](https://github.com/vitejs/rolldown-vite/issues/19776)) ([6b648c7](https://github.com/vitejs/rolldown-vite/commit/6b648c73ae33a57f648af87204a325335afffca8)) +* keep entry asset files imported by other files ([#19779](https://github.com/vitejs/rolldown-vite/issues/19779)) ([2fa1495](https://github.com/vitejs/rolldown-vite/commit/2fa149580118a6b7988593dea9e2bf2ee679506c)) + +### Miscellaneous Chores -* tweak generateCodeFrame test ([#19812](https://github.com/vitejs/vite/issues/19812)) ([8fe3538](https://github.com/vitejs/vite/commit/8fe3538d9095384c670815dc42ef67e051f3246f)) +* cleanup changelog ([b17bade](https://github.com/vitejs/rolldown-vite/commit/b17bade873dc21240ab60b1c941be4b2253f7581)) +* remove unused eslint directive ([#19781](https://github.com/vitejs/rolldown-vite/issues/19781)) ([cb4f5b4](https://github.com/vitejs/rolldown-vite/commit/cb4f5b4b6bb7dc96812b126ccc475d1e2c3f7f92)) -## [6.3.0-beta.1](https://github.com/vitejs/vite/compare/v6.3.0-beta.0...v6.3.0-beta.1) (2025-04-03) +## [6.3.0-beta.4](https://github.com/vitejs/rolldown-vite/compare/v6.3.0-beta.3...v6.3.0-beta.4) (2025-04-02) ### Features -* **env:** add false option for envDir to disable env loading ([#19503](https://github.com/vitejs/vite/issues/19503)) ([bca89e1](https://github.com/vitejs/vite/commit/bca89e153e58edd2b506807958557a21edacfaf8)) -* **types:** make CustomPluginOptionsVite backward compatible ([#19760](https://github.com/vitejs/vite/issues/19760)) ([821edf1](https://github.com/vitejs/vite/commit/821edf196f281b90af0742647a3feaf3226be439)) +* **env:** add false option for envDir to disable env loading ([#19503](https://github.com/vitejs/rolldown-vite/issues/19503)) ([bca89e1](https://github.com/vitejs/rolldown-vite/commit/bca89e153e58edd2b506807958557a21edacfaf8)) +* **types:** make CustomPluginOptionsVite backward compatible ([#19760](https://github.com/vitejs/rolldown-vite/issues/19760)) ([821edf1](https://github.com/vitejs/rolldown-vite/commit/821edf196f281b90af0742647a3feaf3226be439)) +* update rolldown ([96d9065](https://github.com/vitejs/rolldown-vite/commit/96d906568b867ddd623db98b5239f244947568b0)) ### Bug Fixes -* align plugin hook filter behavior with pluginutils ([#19736](https://github.com/vitejs/vite/issues/19736)) ([0bbdd2c](https://github.com/vitejs/vite/commit/0bbdd2c1338624fa0e76c81648989f8f9a5b36d7)) -* fs check in transform middleware ([#19761](https://github.com/vitejs/vite/issues/19761)) ([5967313](https://github.com/vitejs/vite/commit/59673137c45ac2bcfad1170d954347c1a17ab949)) -* **hmr:** throw non-standard error info causes logical error ([#19776](https://github.com/vitejs/vite/issues/19776)) ([6b648c7](https://github.com/vitejs/vite/commit/6b648c73ae33a57f648af87204a325335afffca8)) +* accept worker iife format ([#94](https://github.com/vitejs/rolldown-vite/issues/94)) ([df12968](https://github.com/vitejs/rolldown-vite/commit/df12968d590e54f6404da737c24a1f3caab21a0e)) +* align plugin hook filter behavior with pluginutils ([#19736](https://github.com/vitejs/rolldown-vite/issues/19736)) ([0bbdd2c](https://github.com/vitejs/rolldown-vite/commit/0bbdd2c1338624fa0e76c81648989f8f9a5b36d7)) +* fs check in transform middleware ([#19761](https://github.com/vitejs/rolldown-vite/issues/19761)) ([5967313](https://github.com/vitejs/rolldown-vite/commit/59673137c45ac2bcfad1170d954347c1a17ab949)) +* make `this.environment` available in outputOptions hook ([efe2728](https://github.com/vitejs/rolldown-vite/commit/efe2728c802073d65933bed609ec29ee9bcc48ab)) +* plugin hook filter ([8dd6f69](https://github.com/vitejs/rolldown-vite/commit/8dd6f6983b18cf6b58f005a11d0a96e8d1d76dfb)) +* **worker:** suppress export related warnings in worker build ([#95](https://github.com/vitejs/rolldown-vite/issues/95)) ([5a6a776](https://github.com/vitejs/rolldown-vite/commit/5a6a7763ffa0a893d19edc103197802286ef255e)) ### Performance Improvements -* only bundle node version `debug` ([#19715](https://github.com/vitejs/vite/issues/19715)) ([e435aae](https://github.com/vitejs/vite/commit/e435aae22ffda441a24332cd79226bfca55326aa)) +* only bundle node version `debug` ([#19715](https://github.com/vitejs/rolldown-vite/issues/19715)) ([e435aae](https://github.com/vitejs/rolldown-vite/commit/e435aae22ffda441a24332cd79226bfca55326aa)) ### Miscellaneous Chores -* fix some typos in comment ([#19728](https://github.com/vitejs/vite/issues/19728)) ([35ee848](https://github.com/vitejs/vite/commit/35ee84808af3a5443019e36cba351af859113695)) +* fix some typos in comment ([#19728](https://github.com/vitejs/rolldown-vite/issues/19728)) ([35ee848](https://github.com/vitejs/rolldown-vite/commit/35ee84808af3a5443019e36cba351af859113695)) -## [6.3.0-beta.0](https://github.com/vitejs/vite/compare/v6.2.2...v6.3.0-beta.0) (2025-03-26) +## [6.3.0-beta.3](https://github.com/vitejs/rolldown-vite/compare/v6.3.0-beta.2...v6.3.0-beta.3) (2025-03-27) +### Bug Fixes + +* **optimizer:** derive `resolve.symlinks` option properly ([#91](https://github.com/vitejs/rolldown-vite/issues/91)) ([0fc1af8](https://github.com/vitejs/rolldown-vite/commit/0fc1af82747f77bcad4430f19899d19078c2e81c)) +* **transform:** merge tsconfig jsx options with oxc jsx options correctly ([#90](https://github.com/vitejs/rolldown-vite/issues/90)) ([1851a57](https://github.com/vitejs/rolldown-vite/commit/1851a57ba4a5f5edb6cc1a82ad986a3eb9bbd5b7)) +* use exact regexp filter for virtual module ([#89](https://github.com/vitejs/rolldown-vite/issues/89)) ([fbbfca4](https://github.com/vitejs/rolldown-vite/commit/fbbfca4598fcb276411d3bf1e2f69054a64812fb)) + +## [6.3.0-beta.2](https://github.com/vitejs/rolldown-vite/compare/v6.3.0-beta.1...v6.3.0-beta.2) (2025-03-26) +### Miscellaneous Chores + +* fix publish workflow ([fbaeca3](https://github.com/vitejs/rolldown-vite/commit/fbaeca32d34396cfd4fbdac21552872462704887)) + +## [6.3.0-beta.1](https://github.com/vitejs/rolldown-vite/compare/v6.3.0-beta.0...v6.3.0-beta.1) (2025-03-26) ### Features -* **config:** improve bad character warning ([#19683](https://github.com/vitejs/vite/issues/19683)) ([998303b](https://github.com/vitejs/vite/commit/998303b438734e8219715fe6883b97fb10404c16)) -* **css:** support preprocessor with lightningcss ([#19071](https://github.com/vitejs/vite/issues/19071)) ([d3450ca](https://github.com/vitejs/vite/commit/d3450cae614af4c2b866903411b6d765df3e5a48)) -* **experimental:** add fetchable environment interface ([#19664](https://github.com/vitejs/vite/issues/19664)) ([c5b7191](https://github.com/vitejs/vite/commit/c5b71915099cfbc15447a166f35620fa0e05c023)) -* implement hook filters ([#19602](https://github.com/vitejs/vite/issues/19602)) ([04d58b4](https://github.com/vitejs/vite/commit/04d58b42ae69547f04ef8fcd574b1ee1b654dc32)) -* **types:** expose `CustomPluginOptionsVite` type ([#19557](https://github.com/vitejs/vite/issues/19557)) ([15abc01](https://github.com/vitejs/vite/commit/15abc01241b0da5c4af6aa59b0bc936ccab0f0b4)) -* **types:** make ImportMetaEnv strictly available ([#19077](https://github.com/vitejs/vite/issues/19077)) ([6cf5141](https://github.com/vitejs/vite/commit/6cf51417cdfc26f100c00c910e00829e48dec79c)) -* **types:** type hints for hmr events ([#19579](https://github.com/vitejs/vite/issues/19579)) ([95424b2](https://github.com/vitejs/vite/commit/95424b26892b005f438169d0ea426cb1a3176bf2)) -* warn if `define['process.env']` contains `path` key with a value ([#19517](https://github.com/vitejs/vite/issues/19517)) ([832b2c4](https://github.com/vitejs/vite/commit/832b2c409ebbb2ba1480e6ae4630c7f047c160d4)) +* **config:** improve bad character warning ([#19683](https://github.com/vitejs/rolldown-vite/issues/19683)) ([998303b](https://github.com/vitejs/rolldown-vite/commit/998303b438734e8219715fe6883b97fb10404c16)) +* convert `optimizeDep.esbuildOptions` to `optimizeDep.rollupOptions` automatically ([e66d358](https://github.com/vitejs/rolldown-vite/commit/e66d35879f25b434ec23b38f6ffad52c2b393bab)) +* **css:** support preprocessor with lightningcss ([#19071](https://github.com/vitejs/rolldown-vite/issues/19071)) ([d3450ca](https://github.com/vitejs/rolldown-vite/commit/d3450cae614af4c2b866903411b6d765df3e5a48)) +* **experimental:** add fetchable environment interface ([#19664](https://github.com/vitejs/rolldown-vite/issues/19664)) ([c5b7191](https://github.com/vitejs/rolldown-vite/commit/c5b71915099cfbc15447a166f35620fa0e05c023)) +* implement hook filters ([#19602](https://github.com/vitejs/rolldown-vite/issues/19602)) ([04d58b4](https://github.com/vitejs/rolldown-vite/commit/04d58b42ae69547f04ef8fcd574b1ee1b654dc32)) +* **types:** expose `CustomPluginOptionsVite` type ([#19557](https://github.com/vitejs/rolldown-vite/issues/19557)) ([15abc01](https://github.com/vitejs/rolldown-vite/commit/15abc01241b0da5c4af6aa59b0bc936ccab0f0b4)) +* **types:** make ImportMetaEnv strictly available ([#19077](https://github.com/vitejs/rolldown-vite/issues/19077)) ([6cf5141](https://github.com/vitejs/rolldown-vite/commit/6cf51417cdfc26f100c00c910e00829e48dec79c)) +* **types:** type hints for hmr events ([#19579](https://github.com/vitejs/rolldown-vite/issues/19579)) ([95424b2](https://github.com/vitejs/rolldown-vite/commit/95424b26892b005f438169d0ea426cb1a3176bf2)) +* use `parseAst` from rolldown ([aa4739a](https://github.com/vitejs/rolldown-vite/commit/aa4739ab32a22227ff671047520dfe29e7c4fe87)) +* use lightningcss by default for cssMinify ([7572013](https://github.com/vitejs/rolldown-vite/commit/7572013fdc68a03ab3def8f312387618d2199e7f)) +* use OXC for define plugin ([af62e81](https://github.com/vitejs/rolldown-vite/commit/af62e81e4b148082cc889e3f301edade091b29cd)) +* use OXC for transform ([393d1bc](https://github.com/vitejs/rolldown-vite/commit/393d1bc4bd8f124fb2c2b203761d794caaa8f994)) +* use rolldown builtin OXC minifier by default ([e8cbd79](https://github.com/vitejs/rolldown-vite/commit/e8cbd79861586b3a63475b94d03f7b18853b3ad0)) +* use rolldown for build ([47a4d50](https://github.com/vitejs/rolldown-vite/commit/47a4d506998e445e992f671b0fe876de1119c9bc)) +* use rolldown in the dep optimizer ([48c6010](https://github.com/vitejs/rolldown-vite/commit/48c60102705ff8f893828035e7df3bea48ae9363)) +* use rolldown to bundle config ([88077db](https://github.com/vitejs/rolldown-vite/commit/88077db36e6380a772d50668ba9e9508ef561455)) +* warn if `define['process.env']` contains `path` key with a value ([#19517](https://github.com/vitejs/rolldown-vite/issues/19517)) ([832b2c4](https://github.com/vitejs/rolldown-vite/commit/832b2c409ebbb2ba1480e6ae4630c7f047c160d4)) ### Bug Fixes -* add back `.mts` to default `resolve.extensions` ([#19701](https://github.com/vitejs/vite/issues/19701)) ([ae91bd0](https://github.com/vitejs/vite/commit/ae91bd0ad10942898c3d7aa8181249fb9682a4fe)) -* **css:** parse image-set without space after comma correctly ([#19661](https://github.com/vitejs/vite/issues/19661)) ([d0d4c66](https://github.com/vitejs/vite/commit/d0d4c66bd539a5232005ac7ad63ec19f0794f2a5)) -* **css:** scoped css order with non-scoped css ([#19678](https://github.com/vitejs/vite/issues/19678)) ([a3a94ab](https://github.com/vitejs/vite/commit/a3a94abb200c0bb1ed8bc4abb539a9ea27ce1a84)) -* **deps:** update all non-major dependencies ([#19649](https://github.com/vitejs/vite/issues/19649)) ([f4e712f](https://github.com/vitejs/vite/commit/f4e712ff861f8a9504594a4a5e6d35a7547e5a7e)) -* fs raw query with query separators ([#19702](https://github.com/vitejs/vite/issues/19702)) ([262b5ec](https://github.com/vitejs/vite/commit/262b5ec7ae4981208339b7b87fefbd3dd8465851)) -* **optimizer:** fix incorrect picomatch usage in filter() ([#19646](https://github.com/vitejs/vite/issues/19646)) ([300280d](https://github.com/vitejs/vite/commit/300280d52203b6c1d8867d956f7d5c991e2e9dfb)) -* **ssr:** hoist export to handle cyclic import better ([#18983](https://github.com/vitejs/vite/issues/18983)) ([8c04c69](https://github.com/vitejs/vite/commit/8c04c69a52c7b66d551d384ac34bb10ab1522f68)) +* add back `.mts` to default `resolve.extensions` ([#19701](https://github.com/vitejs/rolldown-vite/issues/19701)) ([ae91bd0](https://github.com/vitejs/rolldown-vite/commit/ae91bd0ad10942898c3d7aa8181249fb9682a4fe)) +* buffer full reload messages ([eb642a2](https://github.com/vitejs/rolldown-vite/commit/eb642a23d33d2aeae501ef6b3795a511693af788)) +* **css:** parse image-set without space after comma correctly ([#19661](https://github.com/vitejs/rolldown-vite/issues/19661)) ([d0d4c66](https://github.com/vitejs/rolldown-vite/commit/d0d4c66bd539a5232005ac7ad63ec19f0794f2a5)) +* **css:** scoped css order with non-scoped css ([#19678](https://github.com/vitejs/rolldown-vite/issues/19678)) ([a3a94ab](https://github.com/vitejs/rolldown-vite/commit/a3a94abb200c0bb1ed8bc4abb539a9ea27ce1a84)) +* **deps:** update all non-major dependencies ([#19649](https://github.com/vitejs/rolldown-vite/issues/19649)) ([f4e712f](https://github.com/vitejs/rolldown-vite/commit/f4e712ff861f8a9504594a4a5e6d35a7547e5a7e)) +* fs raw query with query separators ([#19702](https://github.com/vitejs/rolldown-vite/issues/19702)) ([262b5ec](https://github.com/vitejs/rolldown-vite/commit/262b5ec7ae4981208339b7b87fefbd3dd8465851)) +* **optimizer:** externalize as absolute ([de29115](https://github.com/vitejs/rolldown-vite/commit/de29115e9b28215dae80e106084512d1656bc7f7)) +* **optimizer:** fix incorrect picomatch usage in filter() ([#19646](https://github.com/vitejs/rolldown-vite/issues/19646)) ([300280d](https://github.com/vitejs/rolldown-vite/commit/300280d52203b6c1d8867d956f7d5c991e2e9dfb)) +* remove duplicate `createRequire` in optimizer ([#86](https://github.com/vitejs/rolldown-vite/issues/86)) ([d066bed](https://github.com/vitejs/rolldown-vite/commit/d066bed940b5a43049b61a42a15eaffdb588228d)) +* **ssr:** hoist export to handle cyclic import better ([#18983](https://github.com/vitejs/rolldown-vite/issues/18983)) ([8c04c69](https://github.com/vitejs/rolldown-vite/commit/8c04c69a52c7b66d551d384ac34bb10ab1522f68)) +* vite dir ([486a056](https://github.com/vitejs/rolldown-vite/commit/486a056e0b43993b02ddc9d5f01229f17fccb8f3)) + +### Performance Improvements + +* add `experimental.enableNativePlugin` ([ead8ded](https://github.com/vitejs/rolldown-vite/commit/ead8dedc0d3f8e2855c5d1d20499c6e23d6cf225)) +* use filter for plugins ([95f3ce6](https://github.com/vitejs/rolldown-vite/commit/95f3ce60a2e841100951a90beb039daecfa5553d)) ### Miscellaneous Chores -* **deps:** unbundle tinyglobby ([#19487](https://github.com/vitejs/vite/issues/19487)) ([a5ea6f0](https://github.com/vitejs/vite/commit/a5ea6f09ba79f4a5b72117899bccaa43613a777f)) +* add rolldown as dependency ([2716e1e](https://github.com/vitejs/rolldown-vite/commit/2716e1e1f992d89c18b7d64a3435ba671ff711fa)) +* **deps:** unbundle tinyglobby ([#19487](https://github.com/vitejs/rolldown-vite/issues/19487)) ([a5ea6f0](https://github.com/vitejs/rolldown-vite/commit/a5ea6f09ba79f4a5b72117899bccaa43613a777f)) +* enable continuous release ([228a599](https://github.com/vitejs/rolldown-vite/commit/228a59991bcf2c0f618f8970f3a1cc7b8638ad38)) +* update LICENSE ([140ccea](https://github.com/vitejs/rolldown-vite/commit/140ccea0d0ccb519727485a0345205354a3de136)) ### Code Refactoring -* `[hookName].handler` in plugins ([#19586](https://github.com/vitejs/vite/issues/19586)) ([9827df2](https://github.com/vitejs/vite/commit/9827df2195905e5eb04b46dce357d12c3dff4876)) -* **reporter:** only call modulesReporter when logLevel is info ([#19708](https://github.com/vitejs/vite/issues/19708)) ([7249553](https://github.com/vitejs/vite/commit/7249553625b667b6affb448d5acb7d6f457640f6)) +* `[hookName].handler` in plugins ([#19586](https://github.com/vitejs/rolldown-vite/issues/19586)) ([9827df2](https://github.com/vitejs/rolldown-vite/commit/9827df2195905e5eb04b46dce357d12c3dff4876)) +* make esbuild optional peer dependency ([7f44e70](https://github.com/vitejs/rolldown-vite/commit/7f44e7000e8a85b49cf70b66a75a9850c552554c)) +* **reporter:** only call modulesReporter when logLevel is info ([#19708](https://github.com/vitejs/rolldown-vite/issues/19708)) ([7249553](https://github.com/vitejs/rolldown-vite/commit/7249553625b667b6affb448d5acb7d6f457640f6)) +* skip hook filter inject in build ([efbc14b](https://github.com/vitejs/rolldown-vite/commit/efbc14b1cb96a9cd087cbce8f7546963c60d029d)) + +### Continuous Integration + +* update workflows ([af0d4d5](https://github.com/vitejs/rolldown-vite/commit/af0d4d541a53a8b1eafd9ac0d9a5ef1cdf4c093c)) ## [6.2.2](https://github.com/vitejs/vite/compare/v6.2.1...v6.2.2) (2025-03-14) ### Features diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index c0f6ed8846e407..9fdbcafbf6e54d 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -127,15 +127,11 @@ Repository: https://github.com/rolldown/rolldown --------------------------------------- -## @rollup/plugin-alias, @rollup/plugin-commonjs, @rollup/plugin-dynamic-import-vars, @rollup/pluginutils +## @rollup/plugin-alias, @rollup/plugin-dynamic-import-vars, @rollup/pluginutils License: MIT By: Johannes Stein Repository: https://github.com/rollup/plugins -License: MIT -By: Rich Harris -Repository: https://github.com/rollup/plugins - License: MIT By: LarsDenBakker Repository: https://github.com/rollup/plugins @@ -351,38 +347,6 @@ Repository: https://github.com/paulmillr/chokidar --------------------------------------- -## commondir, shell-quote -License: MIT -By: James Halliday -Repositories: http://github.com/substack/node-commondir, http://github.com/ljharb/shell-quote - -> The MIT License -> -> Copyright (c) 2013 James Halliday (mail@substack.net) -> -> 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. - ---------------------------------------- - ## connect License: MIT By: TJ Holowaychuk, Douglas Christopher Wilson, Jonathan Ong, Tim Caswell @@ -1023,13 +987,6 @@ Repository: https://github.com/micromatch/is-glob --------------------------------------- -## is-reference -License: MIT -By: Rich Harris -Repository: https://github.com/Rich-Harris/is-reference - ---------------------------------------- - ## isexe, which License: ISC By: Isaac Z. Schlueter @@ -1817,6 +1774,38 @@ Repository: https://github.com/kevva/shebang-command --------------------------------------- +## shell-quote +License: MIT +By: James Halliday +Repository: http://github.com/ljharb/shell-quote + +> The MIT License +> +> Copyright (c) 2013 James Halliday (mail@substack.net) +> +> 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. + +--------------------------------------- + ## sirv License: MIT By: Luke Edwards diff --git a/packages/vite/package.json b/packages/vite/package.json index af8da6d851eae4..8ad45eb0ff7282 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,10 +1,10 @@ { - "name": "vite", - "version": "7.2.6", + "name": "rolldown-vite", + "version": "7.2.10", "type": "module", "license": "MIT", "author": "Evan You", - "description": "Native-ESM powered web dev build tool", + "description": "Vite on Rolldown preview", "bin": { "vite": "bin/vite.js" }, @@ -24,6 +24,7 @@ "types": "./client.d.ts" }, "./module-runner": "./dist/node/module-runner.js", + "./internal": "./dist/node/internal.js", "./dist/client/*": "./dist/client/*", "./types/*": { "types": "./types/*" @@ -58,11 +59,11 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/vitejs/vite.git", + "url": "git+https://github.com/vitejs/rolldown-vite.git", "directory": "packages/vite" }, "bugs": { - "url": "https://github.com/vitejs/vite/issues" + "url": "https://github.com/vitejs/rolldown-vite/issues" }, "homepage": "https://vite.dev", "funding": "https://github.com/vitejs/vite?sponsor=1", @@ -81,11 +82,12 @@ }, "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!", "dependencies": { - "esbuild": "^0.25.0", + "@oxc-project/runtime": "0.101.0", "fdir": "^6.5.0", + "lightningcss": "^1.30.2", "picomatch": "^4.0.3", "postcss": "^8.5.6", - "rollup": "^4.43.0", + "rolldown": "1.0.0-beta.53", "tinyglobby": "^0.2.15" }, "optionalDependencies": { @@ -95,9 +97,9 @@ "@babel/parser": "^7.28.5", "@jridgewell/remapping": "^2.3.5", "@jridgewell/trace-mapping": "^0.3.31", - "@oxc-project/types": "0.95.0", + "@oxc-project/types": "0.101.0", "@polka/compression": "^1.0.0-next.25", - "@rolldown/pluginutils": "^1.0.0-beta.52", + "@rolldown/pluginutils": "1.0.0-beta.53", "@rollup/plugin-alias": "^5.1.1", "@rollup/plugin-commonjs": "^29.0.0", "@rollup/plugin-dynamic-import-vars": "2.1.4", @@ -116,13 +118,13 @@ "dotenv": "^17.2.3", "dotenv-expand": "^12.0.3", "es-module-lexer": "^1.7.0", + "esbuild": "^0.25.0", "escape-html": "^1.0.3", "estree-walker": "^3.0.3", "etag": "^1.8.1", "host-validation-middleware": "^0.1.2", "http-proxy-3": "^1.22.0", - "launch-editor-middleware": "^2.12.0", - "lightningcss": "^1.30.2", + "launch-editor-middleware": "^2.11.1", "magic-string": "^0.30.21", "mlly": "^1.8.0", "mrmime": "^2.0.1", @@ -137,8 +139,8 @@ "postcss-modules": "^6.0.1", "premove": "^4.0.0", "resolve.exports": "^2.0.3", - "rolldown": "^1.0.0-beta.52", "rolldown-plugin-dts": "^0.18.1", + "rollup": "^4.43.0", "rollup-plugin-license": "^3.6.0", "sass": "^1.94.2", "sass-embedded": "^1.93.3", @@ -151,9 +153,9 @@ }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", + "esbuild": "^0.25.0", "jiti": ">=1.21.0", "less": "^4.0.0", - "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", @@ -166,6 +168,9 @@ "@types/node": { "optional": true }, + "esbuild": { + "optional": true + }, "jiti": { "optional": true }, @@ -184,9 +189,6 @@ "sugarss": { "optional": true }, - "lightningcss": { - "optional": true - }, "terser": { "optional": true }, diff --git a/packages/vite/rolldown.config.ts b/packages/vite/rolldown.config.ts index 4aa8bf05ea8e9e..3c5a70b71d01ae 100644 --- a/packages/vite/rolldown.config.ts +++ b/packages/vite/rolldown.config.ts @@ -74,11 +74,11 @@ const nodeConfig = defineConfig({ input: { index: path.resolve(__dirname, 'src/node/index.ts'), cli: path.resolve(__dirname, 'src/node/cli.ts'), + internal: path.resolve(__dirname, 'src/node/internalIndex.ts'), }, external: [ - /^vite\//, 'fsevents', - 'rollup/parseAst', + /^rolldown\//, /^tsx\//, /^#/, 'sugarss', // postcss-import -> sugarss @@ -89,6 +89,14 @@ const nodeConfig = defineConfig({ ...Object.keys(pkg.peerDependencies), ], plugins: [ + { + name: 'externalize-vite', + resolveId(id) { + if (id.startsWith('vite/')) { + return { id: id.replace(/^vite\//, 'rolldown-vite/'), external: true } + } + }, + }, shimDepsPlugin({ 'postcss-load-config/src/req.js': [ { @@ -141,7 +149,7 @@ const moduleRunnerConfig = defineConfig({ external: [ 'fsevents', 'lightningcss', - 'rollup/parseAst', + /^rolldown\//, ...Object.keys(pkg.dependencies), ], plugins: [bundleSizeLimit(54), enableSourceMapsInWatchModePlugin()], diff --git a/packages/vite/rolldown.dts.config.ts b/packages/vite/rolldown.dts.config.ts index 0f28bf7e7e6e0c..8b84af39e71b33 100644 --- a/packages/vite/rolldown.dts.config.ts +++ b/packages/vite/rolldown.dts.config.ts @@ -24,9 +24,8 @@ const pkg = JSON.parse( ) const external = [ - /^node:/, - /^vite\//, - 'rollup/parseAst', + /^node:*/, + /^rolldown\//, /^#types\//, ...Object.keys(pkg.dependencies), ...Object.keys(pkg.peerDependencies), @@ -36,6 +35,7 @@ export default defineConfig({ input: { index: './src/node/index.ts', 'module-runner': './src/module-runner/index.ts', + internal: './src/node/internalIndex.ts', }, output: { dir: './dist/node', @@ -47,6 +47,20 @@ export default defineConfig({ }, external, plugins: [ + { + name: 'externalize-vite', + resolveId: { + order: 'pre', + handler(id) { + if (id.startsWith('vite/')) { + return { + id: id.replace(/^vite\//, 'rolldown-vite/'), + external: true, + } + } + }, + }, + }, patchTypes(), addNodePrefix(), dts({ @@ -76,14 +90,16 @@ const identifierWithTrailingDollarRE = /\b(\w+)\$\d+\b/g * the module that imports the identifier as a named import alias */ const identifierReplacements: Record> = { - rollup: { - Plugin$1: 'Rollup.Plugin', - TransformResult$1: 'Rollup.TransformResult', + 'rolldown-vite/module-runner': { + FetchResult$1: 'moduleRunner_FetchResult', + }, + rolldown: { + Plugin$1: 'Rolldown.Plugin', + TransformResult$1: 'Rolldown.TransformResult', }, - esbuild: { - TransformResult$2: 'esbuild_TransformResult', - TransformOptions$1: 'esbuild_TransformOptions', - BuildOptions$1: 'esbuild_BuildOptions', + 'rolldown/experimental': { + TransformOptions$1: 'rolldown_experimental_TransformOptions', + TransformResult$2: 'rolldown_experimental_TransformResult', }, 'node:http': { Server$1: 'http.Server', @@ -96,9 +112,6 @@ const identifierReplacements: Record> = { 'node:url': { URL$1: 'url_URL', }, - 'vite/module-runner': { - FetchResult$1: 'moduleRunner_FetchResult', - }, '#types/hmrPayload': { CustomPayload$1: 'hmrPayload_CustomPayload', HotPayload$1: 'hmrPayload_HotPayload', @@ -106,6 +119,9 @@ const identifierReplacements: Record> = { '#types/customEvent': { InferCustomEventPayload$1: 'hmrPayload_InferCustomEventPayload', }, + '#types/internal/esbuildOptions': { + EsbuildTransformOptions$1: 'esbuildOptions_EsbuildTransformOptions', + }, '#types/internal/lightningcssOptions': { LightningCSSOptions$1: 'lightningcssOptions_LightningCSSOptions', }, @@ -120,6 +136,9 @@ const ignoreConfusingTypeNames = [ 'T$1', 'K$1', 'Server$3', + // temporary variables for types + 'parseAst$1', + 'parseAstAsync$1', ] /** @@ -243,7 +262,7 @@ function validateChunkImports( !id.startsWith('#') && !id.startsWith('node:') && !id.startsWith('types.d') && - !id.startsWith('vite/') && + !id.startsWith('rolldown-vite/') && // index and moduleRunner have a common chunk !id.startsWith('chunks/') && !deps.includes(id) && @@ -268,43 +287,46 @@ function replaceConfusingTypeNames( chunk: OutputChunk, importBindings: ImportBindings[], ) { - for (const modName in identifierReplacements) { - const imp = importBindings.filter((imp) => imp.id === modName) - // Validate that `identifierReplacements` is not outdated if there's no match - if (imp.length === 0) { - this.warn( - `${chunk.fileName} does not import "${modName}" for replacement`, - ) - process.exitCode = 1 - continue - } - - const replacements = identifierReplacements[modName] - for (const id in replacements) { + const isInternalEntry = chunk.fileName.startsWith('internal.') + if (!isInternalEntry) { + for (const modName in identifierReplacements) { + const imp = importBindings.filter((imp) => imp.id === modName) // Validate that `identifierReplacements` is not outdated if there's no match - if (!imp.some((i) => i.locals.includes(id))) { + if (imp.length === 0) { this.warn( - `${chunk.fileName} does not import "${id}" from "${modName}" for replacement`, + `${chunk.fileName} does not import "${modName}" for replacement`, ) process.exitCode = 1 continue } - const betterId = replacements[id] - const regexEscapedId = escapeRegex(id) - // If the better id accesses a namespace, the existing `Foo as Foo$1` - // named import cannot be replaced with `Foo as Namespace.Foo`, so we - // pre-emptively remove the whole named import - if (betterId.includes('.')) { + const replacements = identifierReplacements[modName] + for (const id in replacements) { + // Validate that `identifierReplacements` is not outdated if there's no match + if (!imp.some((i) => i.locals.includes(id))) { + this.warn( + `${chunk.fileName} does not import "${id}" from "${modName}" for replacement`, + ) + process.exitCode = 1 + continue + } + + const betterId = replacements[id] + const regexEscapedId = escapeRegex(id) + // If the better id accesses a namespace, the existing `Foo as Foo$1` + // named import cannot be replaced with `Foo as Namespace.Foo`, so we + // pre-emptively remove the whole named import + if (betterId.includes('.')) { + chunk.code = chunk.code.replace( + new RegExp(`\\b\\w+\\b as ${regexEscapedId},?\\s?`), + '', + ) + } chunk.code = chunk.code.replace( - new RegExp(`\\b\\w+\\b as ${regexEscapedId},?\\s?`), - '', + new RegExp(`\\b${regexEscapedId}\\b`, 'g'), + betterId, ) } - chunk.code = chunk.code.replace( - new RegExp(`\\b${regexEscapedId}\\b`, 'g'), - betterId, - ) } } @@ -324,16 +346,21 @@ function replaceConfusingTypeNames( ) process.exitCode = 1 } - const notUsedConfusingTypeNames = ignoreConfusingTypeNames.filter( - (id) => !identifiers.includes(id), - ) - // Validate that `identifierReplacements` is not outdated if there's no match - if (notUsedConfusingTypeNames.length) { - const notUsedStr = notUsedConfusingTypeNames - .map((id) => `\n- ${id}`) - .join('') - this.warn(`${chunk.fileName} contains unused identifier names${notUsedStr}`) - process.exitCode = 1 + + if (!isInternalEntry) { + const notUsedConfusingTypeNames = ignoreConfusingTypeNames.filter( + (id) => !identifiers.includes(id), + ) + // Validate that `identifierReplacements` is not outdated if there's no match + if (notUsedConfusingTypeNames.length) { + const notUsedStr = notUsedConfusingTypeNames + .map((id) => `\n- ${id}`) + .join('') + this.warn( + `${chunk.fileName} contains unused identifier names${notUsedStr}`, + ) + process.exitCode = 1 + } } } diff --git a/packages/vite/src/node/__tests__/build.spec.ts b/packages/vite/src/node/__tests__/build.spec.ts index 0c2edac753fdff..c45d14ae6a50c1 100644 --- a/packages/vite/src/node/__tests__/build.spec.ts +++ b/packages/vite/src/node/__tests__/build.spec.ts @@ -8,10 +8,10 @@ import type { LogLevel, OutputChunk, OutputOptions, + RolldownOptions, + RolldownOutput, RollupLog, - RollupOptions, - RollupOutput, -} from 'rollup' +} from 'rolldown' import type { LibraryFormats, LibraryOptions } from '../build' import { build, @@ -62,7 +62,7 @@ describe('build', () => { }, }, ], - })) as RollupOutput + })) as RolldownOutput } const result = await Promise.all([ buildProject('red'), @@ -121,7 +121,7 @@ describe('build', () => { }, }, ], - })) as RollupOutput + })) as RolldownOutput } const result = await Promise.all([ buildProject('yellow'), @@ -131,13 +131,13 @@ describe('build', () => { { "changed": [ "index", - "_foo", "_bar", + "_foo", "_baz.css", ], "unchanged": [ - "_foo.css", "_bar.css", + "_foo.css", "undefined", ], } @@ -198,7 +198,7 @@ describe('build', () => { }, }, ], - })) as RollupOutput + })) as RolldownOutput const foo = esBundle.output.find( (chunk) => chunk.type === 'chunk' && chunk.isEntry, @@ -245,7 +245,7 @@ describe('build', () => { }, }, ], - })) as RollupOutput[] + })) as RolldownOutput[] const foo = esBundle.output.find( (chunk) => chunk.fileName === 'foo.js', @@ -756,7 +756,7 @@ describe('resolveBuildOutputs', () => { }, }) const result = await builder.build(builder.environments.ssr) - expect((result as RollupOutput).output[0].code).not.toContain('preload') + expect((result as RolldownOutput).output[0].code).not.toContain('preload') }) test('ssr custom', async () => { @@ -777,7 +777,7 @@ describe('resolveBuildOutputs', () => { }, }) const result = await builder.build(builder.environments.custom) - expect((result as RollupOutput).output[0].code).not.toContain('preload') + expect((result as RolldownOutput).output[0].code).not.toContain('preload') }) }) @@ -858,10 +858,10 @@ test.for([true, false])( const custom1 = await builder.build(builder.environments.custom1) const custom2 = await builder.build(builder.environments.custom2) expect( - ([client, ssr, custom1, custom2] as RollupOutput[]).map( + ([client, ssr, custom1, custom2] as RolldownOutput[]).map( (o) => o.output[0].code.split('\n').length, ), - ).toEqual([2, 5, 2, 5]) + ).toEqual([1, 6, 1, 6]) }, ) @@ -932,7 +932,7 @@ test('sharedConfigBuild and emitAssets', async () => { ]) }) -test('adjust worker build error for worker.format', async () => { +test.skip('adjust worker build error for worker.format', async () => { try { await build({ root: resolve(__dirname, 'fixtures/worker-dynamic'), @@ -961,7 +961,7 @@ describe('onRollupLog', () => { level: LogLevel | 'error', message: string | RollupLog, logger: Logger, - options?: Pick, + options?: Pick, ) => { await build({ root: resolve(__dirname, 'packages/build-project'), @@ -1046,7 +1046,7 @@ describe('onRollupLog', () => { }, }) expect(onLogInfo).toBeCalledWith( - expect.objectContaining({ message: `[plugin ${pluginName}] ${msgInfo}` }), + expect.objectContaining({ message: msgInfo, plugin: pluginName }), ) }) @@ -1060,7 +1060,7 @@ describe('onRollupLog', () => { }, }) expect(onWarn).toBeCalledWith( - expect.objectContaining({ message: `[plugin ${pluginName}] ${msgWarn}` }), + expect.objectContaining({ message: msgWarn, plugin: pluginName }), ) }) @@ -1071,7 +1071,7 @@ describe('onRollupLog', () => { code: 'UNRESOLVED_IMPORT', message: 'test', }), - ).rejects.toThrowError(/Rollup failed to resolve import/) + ).rejects.toThrowError(/Rolldown failed to resolve import/) }) test.each([[`Unsupported expression`], [`statically analyzed`]])( @@ -1126,7 +1126,7 @@ test('watch rebuild manifest', async (ctx) => { }, }) - function getManifestKeys(output: RollupOutput) { + function getManifestKeys(output: RolldownOutput) { return Object.keys( JSON.parse( (output.output.find((o) => o.fileName === '.vite/manifest.json') as any) @@ -1136,7 +1136,7 @@ test('watch rebuild manifest', async (ctx) => { } const result = await builder.build(builder.environments.client) - expect(getManifestKeys(result as RollupOutput)).toMatchInlineSnapshot(` + expect(getManifestKeys(result as RolldownOutput)).toMatchInlineSnapshot(` [ "dep.js", "entry.js", @@ -1154,7 +1154,7 @@ test('watch rebuild manifest', async (ctx) => { }) const result2 = await builder.build(builder.environments.client) - expect(getManifestKeys(result2 as RollupOutput)).toMatchInlineSnapshot(` + expect(getManifestKeys(result2 as RolldownOutput)).toMatchInlineSnapshot(` [ "entry.js", ] @@ -1166,8 +1166,8 @@ test('watch rebuild manifest', async (ctx) => { * ensure that the chunk code is the same. if not, the chunk hash should have changed. */ function assertOutputHashContentChange( - output1: RollupOutput, - output2: RollupOutput, + output1: RolldownOutput, + output2: RolldownOutput, ) { for (const chunk of output1.output) { if (chunk.type === 'chunk') { @@ -1184,7 +1184,10 @@ function assertOutputHashContentChange( } } -function getOutputHashChanges(output1: RollupOutput, output2: RollupOutput) { +function getOutputHashChanges( + output1: RolldownOutput, + output2: RolldownOutput, +) { const map1 = Object.fromEntries( output1.output.map((o) => [o.name, o.fileName]), ) diff --git a/packages/vite/src/node/__tests__/config.spec.ts b/packages/vite/src/node/__tests__/config.spec.ts index 2ef36fc934be3e..5fe65fd6cd3d0f 100644 --- a/packages/vite/src/node/__tests__/config.spec.ts +++ b/packages/vite/src/node/__tests__/config.spec.ts @@ -312,6 +312,311 @@ describe('mergeConfig', () => { ), ).toThrowError('Cannot merge config in form of callback') }) + + test('handles `rollupOptions`', () => { + const baseConfig = defineConfig({ + build: { + rollupOptions: { + treeshake: false, + }, + }, + worker: { + rollupOptions: { + treeshake: false, + }, + }, + optimizeDeps: { + rollupOptions: { + treeshake: false, + }, + }, + ssr: { + optimizeDeps: { + rollupOptions: { + treeshake: false, + }, + }, + }, + }) + + const newConfig = defineConfig({ + build: { + rollupOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + worker: { + rollupOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + optimizeDeps: { + rollupOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + ssr: { + optimizeDeps: { + rollupOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + }, + }) + + const mergedConfig = mergeConfig(baseConfig, newConfig) + + const expected = { + treeshake: false, + output: { + minifyInternalExports: true, + }, + } + expect(mergedConfig.build.rollupOptions).toStrictEqual(expected) + expect(mergedConfig.build.rolldownOptions).toStrictEqual(expected) + expect(mergedConfig.worker.rollupOptions).toStrictEqual(expected) + expect(mergedConfig.worker.rolldownOptions).toStrictEqual(expected) + expect(mergedConfig.optimizeDeps.rollupOptions).toStrictEqual(expected) + expect(mergedConfig.optimizeDeps.rolldownOptions).toStrictEqual(expected) + expect(mergedConfig.ssr.optimizeDeps.rollupOptions).toStrictEqual(expected) + expect(mergedConfig.ssr.optimizeDeps.rolldownOptions).toStrictEqual( + expected, + ) + }) + + test('handles `build.rolldownOptions`', () => { + const baseConfig = defineConfig({ + build: { + rolldownOptions: { + treeshake: false, + }, + }, + worker: { + rolldownOptions: { + treeshake: false, + }, + }, + optimizeDeps: { + rolldownOptions: { + treeshake: false, + }, + }, + ssr: { + optimizeDeps: { + rolldownOptions: { + treeshake: false, + }, + }, + }, + }) + + const newConfig = defineConfig({ + build: { + rolldownOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + worker: { + rolldownOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + optimizeDeps: { + rolldownOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + ssr: { + optimizeDeps: { + rolldownOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + }, + }) + + const mergedConfig = mergeConfig(baseConfig, newConfig) + + const expected = { + treeshake: false, + output: { + minifyInternalExports: true, + }, + } + expect(mergedConfig.build.rollupOptions).toStrictEqual(expected) + expect(mergedConfig.build.rolldownOptions).toStrictEqual(expected) + expect(mergedConfig.worker.rollupOptions).toStrictEqual(expected) + expect(mergedConfig.worker.rolldownOptions).toStrictEqual(expected) + expect(mergedConfig.optimizeDeps.rollupOptions).toStrictEqual(expected) + expect(mergedConfig.optimizeDeps.rolldownOptions).toStrictEqual(expected) + expect(mergedConfig.ssr.optimizeDeps.rollupOptions).toStrictEqual(expected) + expect(mergedConfig.ssr.optimizeDeps.rolldownOptions).toStrictEqual( + expected, + ) + }) + + test('syncs `build.rollupOptions` and `build.rolldownOptions`', () => { + const baseConfig = defineConfig({ + build: { + rollupOptions: { + treeshake: false, + }, + }, + worker: { + rollupOptions: { + treeshake: false, + }, + }, + optimizeDeps: { + rollupOptions: { + treeshake: false, + }, + }, + ssr: { + optimizeDeps: { + rollupOptions: { + treeshake: false, + }, + }, + }, + }) + + const newConfig = defineConfig({ + build: { + rolldownOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + worker: { + rolldownOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + optimizeDeps: { + rolldownOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + ssr: { + optimizeDeps: { + rollupOptions: { + output: { + minifyInternalExports: true, + }, + }, + }, + }, + }) + + const mergedConfig = mergeConfig(baseConfig, newConfig) as UserConfig + + const expected = { + treeshake: false, + output: { + minifyInternalExports: true, + }, + } + expect(mergedConfig.build!.rollupOptions).toStrictEqual(expected) + expect(mergedConfig.build!.rolldownOptions).toStrictEqual(expected) + expect(mergedConfig.worker!.rollupOptions).toStrictEqual(expected) + expect(mergedConfig.worker!.rolldownOptions).toStrictEqual(expected) + expect(mergedConfig.optimizeDeps!.rollupOptions).toStrictEqual(expected) + expect(mergedConfig.optimizeDeps!.rolldownOptions).toStrictEqual(expected) + expect(mergedConfig.ssr!.optimizeDeps!.rollupOptions).toStrictEqual( + expected, + ) + expect(mergedConfig.ssr!.optimizeDeps!.rolldownOptions).toStrictEqual( + expected, + ) + + const upOutput = mergedConfig.build!.rollupOptions!.output! + if (Array.isArray(upOutput)) throw new Error() + const downOutput = mergedConfig.build!.rolldownOptions!.output! + if (Array.isArray(downOutput)) throw new Error() + upOutput.hashCharacters = 'base36' + expect(upOutput.hashCharacters).toBe('base36') + expect(downOutput.hashCharacters).toBe('base36') + }) + + test('rollupOptions/rolldownOptions.platform', async () => { + const testRollupOptions = await resolveConfig( + { + plugins: [ + { + name: 'set-rollupOptions-platform', + configEnvironment(name) { + if (name === 'ssr') { + return { + build: { + rollupOptions: { + platform: 'neutral', + }, + }, + } + } + }, + }, + ], + }, + 'serve', + ) + expect( + testRollupOptions.environments.ssr.build.rolldownOptions.platform, + ).toBe('neutral') + expect( + testRollupOptions.environments.client.build.rolldownOptions.platform, + ).toBe('browser') + + const testRolldownOptions = await resolveConfig( + { + plugins: [ + { + name: 'set-rollupOptions-platform', + configEnvironment(name) { + if (name === 'ssr') { + return { + build: { + rolldownOptions: { + platform: 'neutral', + }, + }, + } + } + }, + }, + ], + }, + 'serve', + ) + expect( + testRolldownOptions.environments.ssr.build.rolldownOptions.platform, + ).toBe('neutral') + expect( + testRolldownOptions.environments.client.build.rolldownOptions.platform, + ).toBe('browser') + }) }) describe('resolveEnvPrefix', () => { @@ -452,6 +757,19 @@ describe('resolveConfig', () => { await resolveConfig({ root: './inc?ud#s*', customLogger: logger }, 'build') }) + + test('syncs `build.rollupOptions` and `build.rolldownOptions`', async () => { + const resolved = await resolveConfig({}, 'build') + expect(resolved.build!.rollupOptions).toStrictEqual( + resolved.build!.rolldownOptions, + ) + expect(resolved.worker!.rollupOptions).toStrictEqual( + resolved.worker!.rolldownOptions, + ) + expect(resolved.optimizeDeps!.rollupOptions).toStrictEqual( + resolved.optimizeDeps!.rolldownOptions, + ) + }) }) test('config compat 1', async () => { @@ -837,7 +1155,7 @@ describe('loadConfigFromFile', () => { ))! expect(config).toMatchInlineSnapshot(` { - "jsonValue": "vite", + "jsonValue": "rolldown-vite", } `) }) diff --git a/packages/vite/src/node/__tests__/environment.spec.ts b/packages/vite/src/node/__tests__/environment.spec.ts index 08bc215ce11409..0d0bc70d8d6c69 100644 --- a/packages/vite/src/node/__tests__/environment.spec.ts +++ b/packages/vite/src/node/__tests__/environment.spec.ts @@ -1,6 +1,6 @@ import path from 'node:path' import { describe, expect, onTestFinished, test } from 'vitest' -import type { RollupOutput } from 'rollup' +import type { RolldownOutput } from 'rolldown' import { createServer } from '../server' import type { InlineConfig } from '../config' import { createBuilder } from '../build' @@ -169,7 +169,7 @@ describe('custom environment conditions', () => { const results: Record = {} for (const key of ['ssr', 'worker', 'custom1', 'custom1_2']) { const output = await builder.build(builder.environments[key]) - const chunk = (output as RollupOutput).output[0] + const chunk = (output as RolldownOutput).output[0] const mod = await import( path.join( import.meta.dirname, diff --git a/packages/vite/src/node/__tests__/plugins/completeAmdWrap.spec.ts b/packages/vite/src/node/__tests__/plugins/completeAmdWrap.spec.ts deleted file mode 100644 index dea9543c7ee13f..00000000000000 --- a/packages/vite/src/node/__tests__/plugins/completeAmdWrap.spec.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { describe, expect, test } from 'vitest' -import { completeAmdWrapPlugin } from '../../plugins/completeAmdWrap' - -async function createCompleteAmdWrapPluginRenderChunk() { - const instance = completeAmdWrapPlugin() - - return async (code: string) => { - // @ts-expect-error transform.handler should exist - const result = await instance.renderChunk.call(instance, code, 'foo.ts', { - format: 'amd', - }) - return result?.code || result - } -} - -describe('completeAmdWrapPlugin', async () => { - const renderChunk = await createCompleteAmdWrapPluginRenderChunk() - - describe('adds require parameter', async () => { - test('without other dependencies', async () => { - expect( - await renderChunk('define((function() { } ))'), - ).toMatchInlineSnapshot(`"define(["require"], (function(require) { } ))"`) - }) - - test('with other dependencies', async () => { - expect( - await renderChunk( - 'define(["vue", "vue-router"], function(vue, vueRouter) { } ))', - ), - ).toMatchInlineSnapshot( - `"define(["require", "vue", "vue-router"], (function(require, vue, vueRouter) { } ))"`, - ) - }) - - test("only if require isn't injected already", async () => { - expect( - await renderChunk('define(["require"], function(require) { } ))'), - ).toMatchInlineSnapshot(`"define(["require"], (function(require) { } ))"`) - - expect( - await renderChunk(`define(['require'], function(require) { } ))`), - ).toMatchInlineSnapshot(`"define(['require'], (function(require) { } ))"`) - }) - }) -}) diff --git a/packages/vite/src/node/__tests__/plugins/define.spec.ts b/packages/vite/src/node/__tests__/plugins/define.spec.ts index ca88a177ff7343..a8f309859c5158 100644 --- a/packages/vite/src/node/__tests__/plugins/define.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/define.spec.ts @@ -1,4 +1,5 @@ import { describe, expect, test } from 'vitest' +import { rolldown } from 'rolldown' import { definePlugin } from '../../plugins/define' import { resolveConfig } from '../../config' import { PartialEnvironment } from '../../baseEnvironment' @@ -16,26 +17,57 @@ async function createDefinePluginTransform( const environment = new PartialEnvironment(ssr ? 'ssr' : 'client', config) return async (code: string) => { - // @ts-expect-error transform.handler should exist - const result = await instance.transform.handler.call( - { environment }, - code, - 'foo.ts', - ) - return result?.code || result + if (process.env._VITE_TEST_JS_PLUGIN) { + // @ts-expect-error transform.handler should exist + const result = await instance.transform.handler.call( + { environment }, + code, + 'foo.ts', + ) + return result?.code || result + } else { + const bundler = await rolldown({ + input: 'entry.js', + plugins: [ + { + name: 'test', + resolveId(id) { + if (id === 'entry.js') { + return '\0' + id + } + }, + load(id) { + if (id === '\0entry.js') { + return code + } + }, + }, + { + name: 'native:define', + options: (definePlugin(config).options! as any).bind({ + environment, + }), + }, + ], + experimental: { + attachDebugInfo: 'none', + }, + }) + return (await bundler.generate()).output[0].code + } } } -describe('definePlugin', () => { +describe.skipIf(!process.env._VITE_TEST_JS_PLUGIN)('definePlugin', () => { test('replaces custom define', async () => { const transform = await createDefinePluginTransform({ __APP_VERSION__: JSON.stringify('1.0'), }) - expect(await transform('const version = __APP_VERSION__ ;')).toBe( - 'const version = "1.0";\n', + expect(await transform('export const version = __APP_VERSION__ ;')).toBe( + 'export const version = "1.0";\n', ) - expect(await transform('const version = __APP_VERSION__;')).toBe( - 'const version = "1.0";\n', + expect(await transform('export const version = __APP_VERSION__;')).toBe( + 'export const version = "1.0";\n', ) }) @@ -43,45 +75,47 @@ describe('definePlugin', () => { const transform = await createDefinePluginTransform({ __APP_VERSION__: JSON.stringify('1.0'), }) - expect(await transform('const version = "1.0";')).toBe(undefined) - expect(await transform('const version = import.meta.SOMETHING')).toBe( - undefined, - ) + expect(await transform('export const version = "1.0";')).toBe(undefined) + expect( + await transform('export const version = import.meta.SOMETHING'), + ).toBe(undefined) }) test('replaces import.meta.env.SSR with false', async () => { const transform = await createDefinePluginTransform() - expect(await transform('const isSSR = import.meta.env.SSR;')).toBe( - 'const isSSR = false;\n', + expect(await transform('export const isSSR = import.meta.env.SSR;')).toBe( + 'export const isSSR = false;\n', ) }) test('preserve import.meta.hot with override', async () => { // assert that the default behavior is to replace import.meta.hot with undefined const transform = await createDefinePluginTransform() - expect(await transform('const hot = import.meta.hot;')).toBe( - 'const hot = void 0;\n', + expect(await transform('export const hot = import.meta.hot;')).toBe( + 'export const hot = void 0;\n', ) // assert that we can specify a user define to preserve import.meta.hot const overrideTransform = await createDefinePluginTransform({ 'import.meta.hot': 'import.meta.hot', }) - expect(await overrideTransform('const hot = import.meta.hot;')).toBe( - 'const hot = import.meta.hot;\n', + expect(await overrideTransform('export const hot = import.meta.hot;')).toBe( + 'export const hot = import.meta.hot;\n', ) }) test('replace import.meta.env.UNKNOWN with undefined', async () => { const transform = await createDefinePluginTransform() - expect(await transform('const foo = import.meta.env.UNKNOWN;')).toBe( - 'const foo = undefined ;\n', + expect(await transform('export const foo = import.meta.env.UNKNOWN;')).toBe( + 'export const foo = undefined ;\n', ) }) test('leave import.meta.env["UNKNOWN"] to runtime', async () => { const transform = await createDefinePluginTransform() - expect(await transform('const foo = import.meta.env["UNKNOWN"];')).toMatch( - /const __vite_import_meta_env__ = .*;\nconst foo = __vite_import_meta_env__\["UNKNOWN"\];/, + expect( + await transform('export const foo = import.meta.env["UNKNOWN"];'), + ).toMatch( + /const __vite_import_meta_env__ = .*;\nexport const foo = __vite_import_meta_env__\["UNKNOWN"\];/, ) }) @@ -89,8 +123,8 @@ describe('definePlugin', () => { const transform = await createDefinePluginTransform({ 'import.meta.env.UNKNOWN': 'import.meta.env.UNKNOWN', }) - expect(await transform('const foo = import.meta.env.UNKNOWN;')).toBe( - 'const foo = import.meta.env.UNKNOWN;\n', + expect(await transform('export const foo = import.meta.env.UNKNOWN;')).toBe( + 'export const foo = import.meta.env.UNKNOWN;\n', ) }) @@ -101,10 +135,10 @@ describe('definePlugin', () => { expect( await transform( - 'const isLegacy = import.meta.env.LEGACY;\nimport.meta.env.UNDEFINED && console.log(import.meta.env.UNDEFINED);', + 'export const isLegacy = import.meta.env.LEGACY;\nimport.meta.env.UNDEFINED && console.log(import.meta.env.UNDEFINED);', ), ).toMatchInlineSnapshot(` - "const isLegacy = __VITE_IS_LEGACY__; + "export const isLegacy = __VITE_IS_LEGACY__; undefined && console.log(undefined ); " `) @@ -112,8 +146,8 @@ describe('definePlugin', () => { test('replace bare import.meta.env', async () => { const transform = await createDefinePluginTransform() - expect(await transform('const env = import.meta.env;')).toMatch( - /const __vite_import_meta_env__ = .*;\nconst env = __vite_import_meta_env__;/, + expect(await transform('export const env = import.meta.env;')).toMatch( + /const __vite_import_meta_env__ = .*;\nexport const env = __vite_import_meta_env__;/, ) }) @@ -121,26 +155,143 @@ describe('definePlugin', () => { const transform = await createDefinePluginTransform() expect( await transform( - 'console.log(__vite_import_meta_env__);\nconst env = import.meta.env;', + 'console.log(__vite_import_meta_env__);\nexport const env = import.meta.env;', + ), + ).toMatch( + /const __vite_import_meta_env__1 = .*;\nconsole.log\(__vite_import_meta_env__\);\nexport const env = __vite_import_meta_env__1;/, + ) + + expect( + await transform( + 'console.log(__vite_import_meta_env__, __vite_import_meta_env__1);\n export const env = import.meta.env;', ), ).toMatch( - /const __vite_import_meta_env__1 = .*;\nconsole.log\(__vite_import_meta_env__\);\nconst env = __vite_import_meta_env__1;/, + /const __vite_import_meta_env__2 = .*;\nconsole.log\(__vite_import_meta_env__, __vite_import_meta_env__1\);\nexport const env = __vite_import_meta_env__2;/, + ) + + expect( + await transform( + 'console.log(__vite_import_meta_env__);\nexport const env = import.meta.env;\nconsole.log(import.meta.env.UNDEFINED);', + ), + ).toMatch( + /const __vite_import_meta_env__1 = .*;\nconsole.log\(__vite_import_meta_env__\);\nexport const env = __vite_import_meta_env__1;\nconsole.log\(undefined {26}\);/, + ) + }) +}) + +describe.skipIf(process.env._VITE_TEST_JS_PLUGIN)('native definePlugin', () => { + test('replaces custom define', async () => { + const transform = await createDefinePluginTransform({ + __APP_VERSION__: JSON.stringify('1.0'), + }) + expect(await transform('export const version = __APP_VERSION__;')).toBe( + 'const version = "1.0";\n\nexport { version };', + ) + expect(await transform('export const version = __APP_VERSION__ ;')).toBe( + 'const version = "1.0";\n\nexport { version };', + ) + }) + + test('should not replace if not defined', async () => { + const transform = await createDefinePluginTransform({ + __APP_VERSION__: JSON.stringify('1.0'), + }) + expect(await transform('export const version = "1.0";')).toBe( + 'const version = "1.0";\n\nexport { version };', + ) + expect( + await transform('export const version = import.meta.SOMETHING'), + ).toBe('const version = import.meta.SOMETHING;\n\nexport { version };') + }) + + test('replaces import.meta.env.SSR with false', async () => { + const transform = await createDefinePluginTransform() + expect(await transform('export const isSSR = import.meta.env.SSR;')).toBe( + 'const isSSR = false;\n\nexport { isSSR };', + ) + }) + + test('preserve import.meta.hot with override', async () => { + // assert that the default behavior is to replace import.meta.hot with undefined + const transform = await createDefinePluginTransform() + expect(await transform('export const hot = import.meta.hot;')).toBe( + 'const hot = void 0;\n\nexport { hot };', ) + // assert that we can specify a user define to preserve import.meta.hot + const overrideTransform = await createDefinePluginTransform({ + 'import.meta.hot': 'import.meta.hot', + }) + expect(await overrideTransform('export const hot = import.meta.hot;')).toBe( + 'const hot = import.meta.hot;\n\nexport { hot };', + ) + }) + + test('replace import.meta.env.UNKNOWN with undefined', async () => { + const transform = await createDefinePluginTransform() + expect(await transform('export const foo = import.meta.env.UNKNOWN;')).toBe( + 'const foo = void 0;\n\nexport { foo };', + ) + }) + + test('leave import.meta.env["UNKNOWN"] to runtime', async () => { + const transform = await createDefinePluginTransform() + expect( + await transform('export const foo = import.meta.env["UNKNOWN"];'), + ).toMatch(/const foo = .*\["UNKNOWN"\];\n\nexport \{ foo \};/s) + }) + + test('preserve import.meta.env.UNKNOWN with override', async () => { + const transform = await createDefinePluginTransform({ + 'import.meta.env.UNKNOWN': 'import.meta.env.UNKNOWN', + }) + expect(await transform('export const foo = import.meta.env.UNKNOWN;')).toBe( + 'const foo = import.meta.env.UNKNOWN;\n\nexport { foo };', + ) + }) + + test('replace import.meta.env when it is a invalid json', async () => { + const transform = await createDefinePluginTransform({ + 'import.meta.env.LEGACY': '__VITE_IS_LEGACY__', + }) + + expect( + await transform( + 'export const isLegacy = import.meta.env.LEGACY;\nimport.meta.env.UNDEFINED && console.log(import.meta.env.UNDEFINED);', + ), + ).toMatchInlineSnapshot( + `"const isLegacy = __VITE_IS_LEGACY__;\n\nexport { isLegacy };"`, + ) + }) + + test('replace bare import.meta.env', async () => { + const transform = await createDefinePluginTransform() + expect(await transform('export const env = import.meta.env;')).toMatch( + /const env = .*;\n\nexport \{ env \};/s, + ) + }) + + test('already has marker', async () => { + const transform = await createDefinePluginTransform() + expect( + await transform( + 'console.log(__vite_import_meta_env__);\nexport const env = import.meta.env;', + ), + ).toMatch(/console.log\(__vite_import_meta_env__\);\nconst env = .*/) expect( await transform( - 'console.log(__vite_import_meta_env__, __vite_import_meta_env__1);\n const env = import.meta.env;', + 'console.log(__vite_import_meta_env__, __vite_import_meta_env__1);\n export const env = import.meta.env;', ), ).toMatch( - /const __vite_import_meta_env__2 = .*;\nconsole.log\(__vite_import_meta_env__, __vite_import_meta_env__1\);\nconst env = __vite_import_meta_env__2;/, + /console.log\(__vite_import_meta_env__, __vite_import_meta_env__1\);\nconst env = .*/, ) expect( await transform( - 'console.log(__vite_import_meta_env__);\nconst env = import.meta.env;\nconsole.log(import.meta.env.UNDEFINED);', + 'console.log(__vite_import_meta_env__);\nexport const env = import.meta.env;\nconsole.log(import.meta.env.UNDEFINED);', ), ).toMatch( - /const __vite_import_meta_env__1 = .*;\nconsole.log\(__vite_import_meta_env__\);\nconst env = __vite_import_meta_env__1;\nconsole.log\(undefined {26}\);/, + /console.log\(__vite_import_meta_env__\);\nconst env = .*;\nconsole.log\(void 0\);/s, ) }) }) diff --git a/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/decorator-metadata/tsconfig.json b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/decorator-metadata/tsconfig.json new file mode 100644 index 00000000000000..6dacb8cc2c548f --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/decorator-metadata/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "experimentalDecorators": true, + "emitDecoratorMetadata": true + } +} diff --git a/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/empty/tsconfig.json b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/empty/tsconfig.json new file mode 100644 index 00000000000000..0967ef424bce67 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/empty/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/jsx-complex-options/tsconfig.json b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/jsx-complex-options/tsconfig.json new file mode 100644 index 00000000000000..a224293f4e48ac --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/jsx-complex-options/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "jsx": "react-jsx" + } +} diff --git a/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/jsx-preserve/tsconfig.json b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/jsx-preserve/tsconfig.json new file mode 100644 index 00000000000000..186ad251537010 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/jsx-preserve/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "jsx": "preserve" + } +} diff --git a/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/jsx-react-jsx/tsconfig.json b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/jsx-react-jsx/tsconfig.json new file mode 100644 index 00000000000000..a6377dd1adcf1b --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/jsx-react-jsx/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsxFactory": "g", + "jsxFragmentFactory": "foo", + "jsxImportSource": "baz" + } +} diff --git a/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/target-es2021/tsconfig.json b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/target-es2021/tsconfig.json new file mode 100644 index 00000000000000..ad0827577c94d1 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/target-es2021/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "target": "es2021" + } +} diff --git a/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/target-es2022/tsconfig.json b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/target-es2022/tsconfig.json new file mode 100644 index 00000000000000..f75c15e1d689bb --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/target-es2022/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "target": "es2022" + } +} diff --git a/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/target-esnext/tsconfig.json b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/target-esnext/tsconfig.json new file mode 100644 index 00000000000000..07b9f80cb05196 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/target-esnext/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/use-define-false/tsconfig.json b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/use-define-false/tsconfig.json new file mode 100644 index 00000000000000..28eb978d59d0fe --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/use-define-false/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "useDefineForClassFields": false + } +} diff --git a/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/use-define-true/tsconfig.json b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/use-define-true/tsconfig.json new file mode 100644 index 00000000000000..de4dca88946c03 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/fixtures/oxc-tsconfigs/use-define-true/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "useDefineForClassFields": true + } +} diff --git a/packages/vite/src/node/__tests__/plugins/import.spec.ts b/packages/vite/src/node/__tests__/plugins/import.spec.ts index 156a61ab283539..ac5b94c9be9624 100644 --- a/packages/vite/src/node/__tests__/plugins/import.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/import.spec.ts @@ -9,13 +9,14 @@ describe('runTransform', () => { }, } - function runTransformCjsImport(importExp: string) { + function runTransformCjsImport(importExp: string, isNodeMode: boolean) { const result = transformCjsImport( importExp, './node_modules/.vite/deps/react.js', 'react', 0, 'modA', + isNodeMode, config, ) if (result !== undefined) { @@ -23,7 +24,7 @@ describe('runTransform', () => { importExp.split('\n').length, ) } - return result + return result?.replaceAll(';', ';\n') } beforeEach(() => { @@ -34,97 +35,150 @@ describe('runTransform', () => { expect( runTransformCjsImport( 'import { useState, Component, "👋" as fake } from "react"', + false, ), - ).toBe( - 'import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; ' + - 'const useState = __vite__cjsImport0_react["useState"]; ' + - 'const Component = __vite__cjsImport0_react["Component"]; ' + - 'const fake = __vite__cjsImport0_react["👋"]', - ) + ).toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const useState = __vite__cjsImport0_react["useState"]; + const Component = __vite__cjsImport0_react["Component"]; + const fake = __vite__cjsImport0_react["👋"]" + `) + expect( + runTransformCjsImport( + 'import { useState, Component, "👋" as fake } from "react"', + true, + ), + ).toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const useState = __vite__cjsImport0_react["useState"]; + const Component = __vite__cjsImport0_react["Component"]; + const fake = __vite__cjsImport0_react["👋"]" + `) }) test('import default specifier', () => { - expect(runTransformCjsImport('import React from "react"')).toBe( - 'import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; ' + - 'const React = __vite__cjsImport0_react.__esModule ? __vite__cjsImport0_react.default : __vite__cjsImport0_react', - ) + expect(runTransformCjsImport('import React from "react"', false)) + .toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const React = !__vite__cjsImport0_react.__esModule ? __vite__cjsImport0_react : __vite__cjsImport0_react.default" + `) + expect(runTransformCjsImport('import React from "react"', true)) + .toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const React = __vite__cjsImport0_react" + `) expect( - runTransformCjsImport('import { default as React } from "react"'), - ).toBe( - 'import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; ' + - 'const React = __vite__cjsImport0_react.__esModule ? __vite__cjsImport0_react.default : __vite__cjsImport0_react', - ) + runTransformCjsImport('import { default as React } from "react"', false), + ).toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const React = !__vite__cjsImport0_react.__esModule ? __vite__cjsImport0_react : __vite__cjsImport0_react.default" + `) }) test('import all specifier', () => { - expect(runTransformCjsImport('import * as react from "react"')).toBe( - 'import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; ' + - `const react = ((m) => m?.__esModule ? m : { ...typeof m === "object" && !Array.isArray(m) || typeof m === "function" ? m : {}, default: m})(__vite__cjsImport0_react)`, - ) + expect(runTransformCjsImport('import * as react from "react"', false)) + .toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const react = ((m, n) => n || !m?.__esModule ? { ...typeof m === "object" && !Array.isArray(m) || typeof m === "function" ? m : {}, default: m} : m)(__vite__cjsImport0_react, 0)" + `) + expect(runTransformCjsImport('import * as react from "react"', true)) + .toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const react = ((m, n) => n || !m?.__esModule ? { ...typeof m === "object" && !Array.isArray(m) || typeof m === "function" ? m : {}, default: m} : m)(__vite__cjsImport0_react, 1)" + `) }) test('export all specifier', () => { - expect(runTransformCjsImport('export * from "react"')).toBe(undefined) + expect( + runTransformCjsImport('export * from "react"', false), + ).toMatchInlineSnapshot(`undefined`) + expect( + runTransformCjsImport('export * from "react"', true), + ).toMatchInlineSnapshot(`undefined`) expect(config.logger.warn).toBeCalledWith( expect.stringContaining(`export * from "react"\` in modA`), ) - expect(runTransformCjsImport('export * as react from "react"')).toBe( - undefined, - ) + expect( + runTransformCjsImport('export * as react from "react"', false), + ).toMatchInlineSnapshot(`undefined`) - expect(config.logger.warn).toBeCalledTimes(1) + expect(config.logger.warn).toBeCalledTimes(2) }) test('export name specifier', () => { expect( runTransformCjsImport( 'export { useState, Component, "👋" } from "react"', + false, ), - ).toBe( - 'import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; ' + - 'const __vite__cjsExportI_useState = __vite__cjsImport0_react["useState"]; ' + - 'const __vite__cjsExportI_Component = __vite__cjsImport0_react["Component"]; ' + - 'const __vite__cjsExportL_1d0452e3 = __vite__cjsImport0_react["👋"]; ' + - 'export { __vite__cjsExportI_useState as useState, __vite__cjsExportI_Component as Component, __vite__cjsExportL_1d0452e3 as "👋" }', - ) + ).toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const __vite__cjsExportI_useState = __vite__cjsImport0_react["useState"]; + const __vite__cjsExportI_Component = __vite__cjsImport0_react["Component"]; + const __vite__cjsExportL_1d0452e3 = __vite__cjsImport0_react["👋"]; + export { __vite__cjsExportI_useState as useState, __vite__cjsExportI_Component as Component, __vite__cjsExportL_1d0452e3 as "👋" }" + `) + expect( + runTransformCjsImport( + 'export { useState, Component, "👋" } from "react"', + true, + ), + ).toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const __vite__cjsExportI_useState = __vite__cjsImport0_react["useState"]; + const __vite__cjsExportI_Component = __vite__cjsImport0_react["Component"]; + const __vite__cjsExportL_1d0452e3 = __vite__cjsImport0_react["👋"]; + export { __vite__cjsExportI_useState as useState, __vite__cjsExportI_Component as Component, __vite__cjsExportL_1d0452e3 as "👋" }" + `) expect( runTransformCjsImport( 'export { useState as useStateAlias, Component as ComponentAlias, "👋" as "👍" } from "react"', + false, ), - ).toBe( - 'import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; ' + - 'const __vite__cjsExportI_useStateAlias = __vite__cjsImport0_react["useState"]; ' + - 'const __vite__cjsExportI_ComponentAlias = __vite__cjsImport0_react["Component"]; ' + - 'const __vite__cjsExportL_5d57d39e = __vite__cjsImport0_react["👋"]; ' + - 'export { __vite__cjsExportI_useStateAlias as useStateAlias, __vite__cjsExportI_ComponentAlias as ComponentAlias, __vite__cjsExportL_5d57d39e as "👍" }', - ) + ).toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const __vite__cjsExportI_useStateAlias = __vite__cjsImport0_react["useState"]; + const __vite__cjsExportI_ComponentAlias = __vite__cjsImport0_react["Component"]; + const __vite__cjsExportL_5d57d39e = __vite__cjsImport0_react["👋"]; + export { __vite__cjsExportI_useStateAlias as useStateAlias, __vite__cjsExportI_ComponentAlias as ComponentAlias, __vite__cjsExportL_5d57d39e as "👍" }" + `) }) test('export default specifier', () => { - expect(runTransformCjsImport('export { default } from "react"')).toBe( - 'import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; ' + - 'const __vite__cjsExportDefault_0 = __vite__cjsImport0_react.__esModule ? __vite__cjsImport0_react.default : __vite__cjsImport0_react; ' + - 'export default __vite__cjsExportDefault_0', - ) + expect(runTransformCjsImport('export { default } from "react"', false)) + .toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const __vite__cjsExportDefault_0 = !__vite__cjsImport0_react.__esModule ? __vite__cjsImport0_react : __vite__cjsImport0_react.default; + export default __vite__cjsExportDefault_0" + `) + expect(runTransformCjsImport('export { default } from "react"', true)) + .toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const __vite__cjsExportDefault_0 = __vite__cjsImport0_react; + export default __vite__cjsExportDefault_0" + `) expect( - runTransformCjsImport('export { default as React} from "react"'), - ).toBe( - 'import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; ' + - 'const __vite__cjsExportI_React = __vite__cjsImport0_react.__esModule ? __vite__cjsImport0_react.default : __vite__cjsImport0_react; ' + - 'export { __vite__cjsExportI_React as React }', - ) + runTransformCjsImport('export { default as React} from "react"', false), + ).toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const __vite__cjsExportI_React = !__vite__cjsImport0_react.__esModule ? __vite__cjsImport0_react : __vite__cjsImport0_react.default; + export { __vite__cjsExportI_React as React }" + `) expect( - runTransformCjsImport('export { Component as default } from "react"'), - ).toBe( - 'import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; ' + - 'const __vite__cjsExportDefault_0 = __vite__cjsImport0_react["Component"]; ' + - 'export default __vite__cjsExportDefault_0', - ) + runTransformCjsImport( + 'export { Component as default } from "react"', + false, + ), + ).toMatchInlineSnapshot(` + "import __vite__cjsImport0_react from "./node_modules/.vite/deps/react.js"; + const __vite__cjsExportDefault_0 = __vite__cjsImport0_react["Component"]; + export default __vite__cjsExportDefault_0" + `) }) }) diff --git a/packages/vite/src/node/__tests__/plugins/json.spec.ts b/packages/vite/src/node/__tests__/plugins/json.spec.ts index 644fd1a925084d..c1e27c16a57061 100644 --- a/packages/vite/src/node/__tests__/plugins/json.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/json.spec.ts @@ -35,9 +35,10 @@ describe('transform', () => { opts: Required, isBuild: boolean, ) => { - const plugin = jsonPlugin(opts, isBuild) + const plugin = jsonPlugin(opts, isBuild, false) // @ts-expect-error transform.handler should exist - return plugin.transform.handler(input, 'test.json').code + return plugin.transform.handler(input, 'test.json', { moduleType: 'json' }) + .code } test("namedExports: true, stringify: 'auto' should not transformed an array input", () => { diff --git a/packages/vite/src/node/__tests__/plugins/modulePreloadPolyfill/__snapshots__/modulePreloadPolyfill.spec.ts.snap b/packages/vite/src/node/__tests__/plugins/modulePreloadPolyfill/__snapshots__/modulePreloadPolyfill.spec.ts.snap index d00d19e409978c..33a76ebf34f4ac 100644 --- a/packages/vite/src/node/__tests__/plugins/modulePreloadPolyfill/__snapshots__/modulePreloadPolyfill.spec.ts.snap +++ b/packages/vite/src/node/__tests__/plugins/modulePreloadPolyfill/__snapshots__/modulePreloadPolyfill.spec.ts.snap @@ -1,47 +1,36 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`load > doesn't load modulepreload polyfill when format is cjs 1`] = ` -""use strict"; -" -`; +exports[`load > doesn't load modulepreload polyfill when format is cjs 1`] = `""`; exports[`load > loads modulepreload polyfill 1`] = ` "(function polyfill() { - const relList = document.createElement("link").relList; - if (relList && relList.supports && relList.supports("modulepreload")) { - return; - } - for (const link of document.querySelectorAll('link[rel="modulepreload"]')) { - processPreload(link); - } - new MutationObserver((mutations) => { - for (const mutation of mutations) { - if (mutation.type !== "childList") { - continue; - } - for (const node of mutation.addedNodes) { - if (node.tagName === "LINK" && node.rel === "modulepreload") - processPreload(node); - } - } - }).observe(document, { childList: true, subtree: true }); - function getFetchOpts(link) { - const fetchOpts = {}; - if (link.integrity) fetchOpts.integrity = link.integrity; - if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy; - if (link.crossOrigin === "use-credentials") - fetchOpts.credentials = "include"; - else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; - else fetchOpts.credentials = "same-origin"; - return fetchOpts; - } - function processPreload(link) { - if (link.ep) - return; - link.ep = true; - const fetchOpts = getFetchOpts(link); - fetch(link.href, fetchOpts); - } + const relList = document.createElement("link").relList; + if (relList && relList.supports && relList.supports("modulepreload")) return; + for (const link of document.querySelectorAll("link[rel=\\"modulepreload\\"]")) processPreload(link); + new MutationObserver((mutations) => { + for (const mutation of mutations) { + if (mutation.type !== "childList") continue; + for (const node of mutation.addedNodes) if (node.tagName === "LINK" && node.rel === "modulepreload") processPreload(node); + } + }).observe(document, { + childList: true, + subtree: true + }); + function getFetchOpts(link) { + const fetchOpts = {}; + if (link.integrity) fetchOpts.integrity = link.integrity; + if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy; + if (link.crossOrigin === "use-credentials") fetchOpts.credentials = "include"; + else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; + else fetchOpts.credentials = "same-origin"; + return fetchOpts; + } + function processPreload(link) { + if (link.ep) return; + link.ep = true; + const fetchOpts = getFetchOpts(link); + fetch(link.href, fetchOpts); + } })(); " `; diff --git a/packages/vite/src/node/__tests__/plugins/modulePreloadPolyfill/modulePreloadPolyfill.spec.ts b/packages/vite/src/node/__tests__/plugins/modulePreloadPolyfill/modulePreloadPolyfill.spec.ts index 3b24fbd5203baa..6eb0c1598b113d 100644 --- a/packages/vite/src/node/__tests__/plugins/modulePreloadPolyfill/modulePreloadPolyfill.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/modulePreloadPolyfill/modulePreloadPolyfill.spec.ts @@ -1,5 +1,5 @@ import { describe, it } from 'vitest' -import type { ModuleFormat, RollupOutput } from 'rollup' +import type { ModuleFormat, RolldownOutput } from 'rolldown' import { build } from '../../../build' import { modulePreloadPolyfillId } from '../../../plugins/modulePreloadPolyfill' @@ -34,7 +34,7 @@ const buildProject = ({ format = 'es' as ModuleFormat } = {}) => }, }, ], - }) as Promise + }) as Promise describe('load', () => { it('loads modulepreload polyfill', async ({ expect }) => { diff --git a/packages/vite/src/node/__tests__/plugins/oxc.spec.ts b/packages/vite/src/node/__tests__/plugins/oxc.spec.ts new file mode 100644 index 00000000000000..24b9735a141bd7 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/oxc.spec.ts @@ -0,0 +1,426 @@ +import path from 'node:path' +import { describe, expect, test } from 'vitest' +import type { InternalModuleFormat } from 'rolldown' +import { resolveConfig } from '../../config' +import { buildOxcPlugin, transformWithOxc } from '../../plugins/oxc' +import { PartialEnvironment } from '../../baseEnvironment' + +async function createBuildOxcPluginRenderChunk(target: string) { + const config = await resolveConfig( + { build: { target }, configFile: false }, + 'build', + ) + const instance = buildOxcPlugin() + const environment = new PartialEnvironment('client', config) + + return async (code: string, format: InternalModuleFormat) => { + // @ts-expect-error renderChunk should exist + const result = await instance.renderChunk.call( + { environment }, + code, + { + fileName: 'foo.ts', + }, + { format }, + ) + return result?.code || result + } +} + +describe('transformWithOxc', () => { + test('correctly overrides TS configuration and applies automatic transform', async () => { + const jsxImportSource = 'bar' + const result = await transformWithOxc( + 'const foo = () => <>', + path.resolve( + import.meta.dirname, + './fixtures/oxc-tsconfigs/jsx-preserve/baz.jsx', + ), + { + jsx: { + runtime: 'automatic', + importSource: jsxImportSource, + }, + }, + ) + expect(result?.code).toContain(`${jsxImportSource}/jsx-runtime`) + expect(result?.code).toContain('/* @__PURE__ */') + }) + + test('correctly overrides TS configuration and preserves code', async () => { + const foo = 'const foo = () => <>' + const result = await transformWithOxc( + foo, + path.resolve( + import.meta.dirname, + './fixtures/oxc-tsconfigs/jsx-react-jsx/baz.jsx', + ), + { + jsx: 'preserve', + }, + ) + expect(result?.code).toContain(foo) + }) + + test('correctly overrides TS configuration and transforms code', async () => { + const jsxFactory = 'h', + jsxFragment = 'bar' + const result = await transformWithOxc( + 'const foo = () => <>', + path.resolve( + import.meta.dirname, + './fixtures/oxc-tsconfigs/jsx-complex-options/baz.jsx', + ), + { + jsx: { + runtime: 'classic', + pragma: jsxFactory, + pragmaFrag: jsxFragment, + }, + }, + ) + expect(result?.code).toContain( + `/* @__PURE__ */ ${jsxFactory}(${jsxFragment}, null)`, + ) + }) + + describe('useDefineForClassFields', async () => { + const transformClassCode = async (target: string, tsconfigDir: string) => { + const result = await transformWithOxc( + ` + class foo { + bar = 'bar' + } + `, + path.resolve(import.meta.dirname, tsconfigDir, './bar.ts'), + { target }, + ) + return result?.code + } + + const [ + defineForClassFieldsTrueTransformedCode, + defineForClassFieldsTrueLowerTransformedCode, + defineForClassFieldsFalseTransformedCode, + ] = await Promise.all([ + transformClassCode('esnext', './fixtures/oxc-tsconfigs/use-define-true'), + transformClassCode('es2021', './fixtures/oxc-tsconfigs/use-define-true'), + transformClassCode('esnext', './fixtures/oxc-tsconfigs/use-define-false'), + ]) + + test('target: esnext and tsconfig.target: esnext => true', async () => { + const actual = await transformClassCode( + 'esnext', + './fixtures/oxc-tsconfigs/target-esnext', + ) + expect(actual).toBe(defineForClassFieldsTrueTransformedCode) + }) + + test('target: es2021 and tsconfig.target: esnext => true', async () => { + const actual = await transformClassCode( + 'es2021', + './fixtures/oxc-tsconfigs/target-esnext', + ) + expect(actual).toBe(defineForClassFieldsTrueLowerTransformedCode) + }) + + test('target: es2021 and tsconfig.target: es2021 => false', async () => { + const actual = await transformClassCode( + 'es2021', + './fixtures/oxc-tsconfigs/target-es2021', + ) + expect(actual).toBe(defineForClassFieldsFalseTransformedCode) + }) + + test('target: esnext and tsconfig.target: es2021 => false', async () => { + const actual = await transformClassCode( + 'esnext', + './fixtures/oxc-tsconfigs/target-es2021', + ) + expect(actual).toBe(defineForClassFieldsFalseTransformedCode) + }) + + test('target: es2022 and tsconfig.target: es2022 => true', async () => { + const actual = await transformClassCode( + 'es2022', + './fixtures/oxc-tsconfigs/target-es2022', + ) + expect(actual).toBe(defineForClassFieldsTrueTransformedCode) + }) + + test('target: es2022 and tsconfig.target: undefined => false', async () => { + const actual = await transformClassCode( + 'es2022', + './fixtures/oxc-tsconfigs/empty', + ) + expect(actual).toBe(defineForClassFieldsFalseTransformedCode) + }) + }) + + test('supports emitDecoratorMetadata: true', async () => { + const result = await transformWithOxc( + ` + function LogMethod(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) { + console.log(target, propertyKey, descriptor); + } + + class Demo { + @LogMethod + public foo(bar: number) {} + } + + const demo = new Demo(); + `, + path.resolve( + import.meta.dirname, + './fixtures/oxc-tsconfigs/decorator-metadata/bar.ts', + ), + ) + expect(result?.code).toContain('_decorateMetadata("design:type"') + }) +}) + +describe('renderChunk', () => { + test('should inject helper for iife without exports from esm', async () => { + const renderChunk = await createBuildOxcPluginRenderChunk('es2015') + const result = await renderChunk( + `(function() { + +"use strict"; + +//#region src/index.js +(async () => { + await new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); +})(); + +//#endregion +})();`, + 'iife', + ) + expect(result).toMatchInlineSnapshot(` + "(function() { + "use strict";var babelHelpers_asyncToGenerator;!(() => {function e(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=t.apply(n,r);function s(t){e(o,i,a,s,c,\`next\`,t)}function c(t){e(o,i,a,s,c,\`throw\`,t)}s(void 0)})}}babelHelpers_asyncToGenerator=t;})(); + + //#region src/index.js + babelHelpers_asyncToGenerator(function* () { + yield new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); + })(); + //#endregion + })(); + " + `) + }) + + test('should inject helper for iife without exports from cjs', async () => { + const renderChunk = await createBuildOxcPluginRenderChunk('es2015') + const result = await renderChunk( + `(function() { + + +//#region src/index.js +(async () => { + await new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); +})(); + +//#endregion +})();`, + 'iife', + ) + expect(result).toMatchInlineSnapshot(` + "(function() {var babelHelpers_asyncToGenerator;!(() => {function e(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=t.apply(n,r);function s(t){e(o,i,a,s,c,\`next\`,t)}function c(t){e(o,i,a,s,c,\`throw\`,t)}s(void 0)})}}babelHelpers_asyncToGenerator=t;})(); + + //#region src/index.js + babelHelpers_asyncToGenerator(function* () { + yield new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); + })(); + //#endregion + })(); + " + `) + }) + + test('should inject helper for iife with exports', async () => { + const renderChunk = await createBuildOxcPluginRenderChunk('es2015') + const result = await renderChunk( + `var lib = (function(exports) { + + +//#region entry.js +(async () => { + await new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); +})(); +const foo = "foo"; + +//#endregion +exports.foo = foo; +return exports; +})({});`, + 'iife', + ) + expect(result).toMatchInlineSnapshot(` + "var lib = (function(exports) {var babelHelpers_asyncToGenerator;!(() => {function e(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=t.apply(n,r);function s(t){e(o,i,a,s,c,\`next\`,t)}function c(t){e(o,i,a,s,c,\`throw\`,t)}s(void 0)})}}babelHelpers_asyncToGenerator=t;})(); + + //#region entry.js + babelHelpers_asyncToGenerator(function* () { + yield new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); + })(); + const foo = "foo"; + //#endregion + exports.foo = foo; + return exports; + })({}); + " + `) + }) + + test('should inject helper for umd without exports', async () => { + const renderChunk = await createBuildOxcPluginRenderChunk('es2015') + const result = await renderChunk( + `(function(factory) { + + typeof define === 'function' && define.amd ? define([], factory) : + factory(); +})(function() { + +//#region entry.js +(async () => { + await new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); +})(); + +//#endregion +});`, + 'umd', + ) + expect(result).toMatchInlineSnapshot(` + "(function(factory) { + typeof define === "function" && define.amd ? define([], factory) : factory(); + })(function() {var babelHelpers_asyncToGenerator;!(() => {function e(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=t.apply(n,r);function s(t){e(o,i,a,s,c,\`next\`,t)}function c(t){e(o,i,a,s,c,\`throw\`,t)}s(void 0)})}}babelHelpers_asyncToGenerator=t;})(); + + //#region entry.js + babelHelpers_asyncToGenerator(function* () { + yield new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); + })(); + //#endregion + }); + " + `) + }) + + test('should inject helper for umd with exports', async () => { + const renderChunk = await createBuildOxcPluginRenderChunk('es2015') + const result = await renderChunk( + `(function(global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.lib = {}))); +})(this, function(exports) { + +//#region entry.js +(async () => { + await new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); +})(); +const foo = "foo"; + +//#endregion +exports.foo = foo; +});`, + 'umd', + ) + expect(result).toMatchInlineSnapshot(` + "(function(global, factory) { + typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.lib = {})); + })(this, function(exports) {var babelHelpers_asyncToGenerator;!(() => {function e(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=t.apply(n,r);function s(t){e(o,i,a,s,c,\`next\`,t)}function c(t){e(o,i,a,s,c,\`throw\`,t)}s(void 0)})}}babelHelpers_asyncToGenerator=t;})(); + + //#region entry.js + babelHelpers_asyncToGenerator(function* () { + yield new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); + })(); + const foo = "foo"; + //#endregion + exports.foo = foo; + }); + " + `) + }) + + test('should inject helper for umd with only default export', async () => { + const renderChunk = await createBuildOxcPluginRenderChunk('es2015') + const result = await renderChunk( + `(function(global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define([], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.lib = factory())); +})(this, function() { + +//#region entry.js +(async () => { + await new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); +})(); +var index_default = "foo"; + +//#endregion +return index_default; +});`, + 'umd', + ) + expect(result).toMatchInlineSnapshot(` + "(function(global, factory) { + typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define([], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.lib = factory()); + })(this, function() {var babelHelpers_asyncToGenerator;!(() => {function e(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=t.apply(n,r);function s(t){e(o,i,a,s,c,\`next\`,t)}function c(t){e(o,i,a,s,c,\`throw\`,t)}s(void 0)})}}babelHelpers_asyncToGenerator=t;})(); + + //#region entry.js + babelHelpers_asyncToGenerator(function* () { + yield new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo"); + })(); + var index_default = "foo"; + //#endregion + return index_default; + }); + " + `) + }) + + test('should inject multiple helpers', async () => { + const renderChunk = await createBuildOxcPluginRenderChunk('es2015') + const result = await renderChunk( + `(function() { + +"use strict"; + +//#region src/index.js +(async () => { + await new Promise((resolve) => setTimeout(resolve, 1e3)); + console.log("foo", { ..."foo" }); +})(); + +//#endregion +})();`, + 'iife', + ) + expect(result).toMatchInlineSnapshot(` + "(function() { + "use strict";var babelHelpers_asyncToGenerator, babelHelpers_objectSpread2;!(() => {function e(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=t.apply(n,r);function s(t){e(o,i,a,s,c,\`next\`,t)}function c(t){e(o,i,a,s,c,\`throw\`,t)}s(void 0)})}}function n(e){"@babel/helpers - typeof";return n=typeof Symbol==\`function\`&&typeof Symbol.iterator==\`symbol\`?function(e){return typeof e}:function(e){return e&&typeof Symbol==\`function\`&&e.constructor===Symbol&&e!==Symbol.prototype?\`symbol\`:typeof e},n(e)}function r(e,t){if(n(e)!=\`object\`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||\`default\`);if(n(i)!=\`object\`)return i;throw TypeError(\`@@toPrimitive must return a primitive value.\`)}return(t===\`string\`?String:Number)(e)}function i(e){var t=r(e,\`string\`);return n(t)==\`symbol\`?t:t+\`\`}function a(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t setTimeout(resolve, 1e3)); + console.log("foo", babelHelpers_objectSpread2({}, "foo")); + })(); + //#endregion + })(); + " + `) + }) +}) diff --git a/packages/vite/src/node/__tests__/plugins/pluginFilter.spec.ts b/packages/vite/src/node/__tests__/plugins/pluginFilter.spec.ts index 934ff5781eaecf..4cb30a1f3d4ddc 100644 --- a/packages/vite/src/node/__tests__/plugins/pluginFilter.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/pluginFilter.spec.ts @@ -1,7 +1,9 @@ import util from 'node:util' import path from 'node:path' import { describe, expect, test } from 'vitest' +import type { ModuleTypeFilter } from 'rolldown' import { + type StringFilter, createCodeFilter, createFilterForTransform, createIdFilter, @@ -226,7 +228,22 @@ describe('createCodeFilter', () => { }) describe('createFilterForTransform', () => { - const filters = [ + type Filters = { + inputFilter: [ + idFilter: StringFilter | undefined, + codeFilter: StringFilter | undefined, + moduleTypeFilter?: ModuleTypeFilter | undefined, + ] + cases: + | { + id: string + code: string + moduleType?: string + expected: boolean + }[] + | undefined + }[] + const filters: Filters = [ { inputFilter: [undefined, undefined], cases: undefined }, { inputFilter: ['*.js', undefined], @@ -283,14 +300,29 @@ describe('createFilterForTransform', () => { { id: 'a', code: 'a', expected: true }, ], }, + { + inputFilter: [undefined, undefined, ['js']], + cases: [ + { id: 'foo.js', code: 'foo', moduleType: 'js', expected: true }, + { id: 'foo.ts', code: 'foo', moduleType: 'ts', expected: false }, + ], + }, + { + inputFilter: [undefined, undefined, { include: ['js'] }], + cases: [ + { id: 'foo.js', code: 'foo', moduleType: 'js', expected: true }, + { id: 'foo.ts', code: 'foo', moduleType: 'ts', expected: false }, + ], + }, ] for (const filter of filters) { test(`${util.inspect(filter.inputFilter)}`, () => { - const [idFilter, codeFilter] = filter.inputFilter + const [idFilter, codeFilter, moduleTypeFilter] = filter.inputFilter const filterForTransform = createFilterForTransform( idFilter, codeFilter, + moduleTypeFilter, '', ) if (!filter.cases) { @@ -300,10 +332,11 @@ describe('createFilterForTransform', () => { expect(filterForTransform).not.toBeUndefined() for (const testCase of filter.cases) { - const { id, code, expected } = testCase - expect(filterForTransform!(id, code), util.inspect({ id, code })).toBe( - expected, - ) + const { id, code, moduleType, expected } = testCase + expect( + filterForTransform!(id, code, moduleType ?? 'js'), + util.inspect({ id, code, moduleType }), + ).toBe(expected) } }) } diff --git a/packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts b/packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts index 1c35a178ed2ade..a6d60a84b345f3 100644 --- a/packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts @@ -27,7 +27,7 @@ describe('workerImportMetaUrlPlugin', async () => { expect( await transform('new Worker(new URL("./worker.js", import.meta.url))'), ).toMatchInlineSnapshot( - `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", import.meta.url))"`, + `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", '' + import.meta.url))"`, ) }) @@ -37,7 +37,7 @@ describe('workerImportMetaUrlPlugin', async () => { 'new SharedWorker(new URL("./worker.js", import.meta.url))', ), ).toMatchInlineSnapshot( - `"new SharedWorker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", import.meta.url))"`, + `"new SharedWorker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", '' + import.meta.url))"`, ) }) @@ -47,7 +47,7 @@ describe('workerImportMetaUrlPlugin', async () => { 'new Worker(new URL("./worker.js", import.meta.url), { type: "module", name: "worker1" })', ), ).toMatchInlineSnapshot( - `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { type: "module", name: "worker1" })"`, + `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), { type: "module", name: "worker1" })"`, ) }) @@ -57,7 +57,7 @@ describe('workerImportMetaUrlPlugin', async () => { 'new Worker(new URL("./worker.js", import.meta.url), { "type": "module", "name": "worker1" })', ), ).toMatchInlineSnapshot( - `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { "type": "module", "name": "worker1" })"`, + `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), { "type": "module", "name": "worker1" })"`, ) }) @@ -67,7 +67,7 @@ describe('workerImportMetaUrlPlugin', async () => { 'const id = 1; new Worker(new URL("./worker.js", import.meta.url), { name: "worker" + id })', ), ).toMatchInlineSnapshot( - `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", import.meta.url), { name: "worker" + id })"`, + `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", '' + import.meta.url), { name: "worker" + id })"`, ) }) @@ -77,7 +77,7 @@ describe('workerImportMetaUrlPlugin', async () => { 'const id = 1; new Worker(new URL("./worker.js", import.meta.url), { name: `worker-${id}` })', ), ).toMatchInlineSnapshot( - `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", import.meta.url), { name: \`worker-\${id}\` })"`, + `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", '' + import.meta.url), { name: \`worker-\${id}\` })"`, ) }) @@ -87,7 +87,7 @@ describe('workerImportMetaUrlPlugin', async () => { 'const id = 1; new Worker(new URL("./worker.js", import.meta.url), { name: "worker" + id, type: "module" })', ), ).toMatchInlineSnapshot( - `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { name: "worker" + id, type: "module" })"`, + `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), { name: "worker" + id, type: "module" })"`, ) }) @@ -97,7 +97,7 @@ describe('workerImportMetaUrlPlugin', async () => { 'const id = 1; new Worker(new URL("./worker.js", import.meta.url), { name: `worker-${id}`, type: "module" })', ), ).toMatchInlineSnapshot( - `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { name: \`worker-\${id}\`, type: "module" })"`, + `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), { name: \`worker-\${id}\`, type: "module" })"`, ) }) @@ -107,7 +107,7 @@ describe('workerImportMetaUrlPlugin', async () => { 'const worker = new Worker(new URL("./worker.js", import.meta.url), { name: genName(), type: "module"})', ), ).toMatchInlineSnapshot( - `"const worker = new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { name: genName(), type: "module"})"`, + `"const worker = new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), { name: genName(), type: "module"})"`, ) }) @@ -122,15 +122,17 @@ const worker = new Worker(new URL("./worker.js", import.meta.url), { worker.addEventListener('message', (ev) => text('.simple-worker-url', JSON.stringify(ev.data))) `), - ).toMatchInlineSnapshot(`" -const worker = new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { - name: genName(), - type: "module", - }, -) + ).toMatchInlineSnapshot(` + " + const worker = new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), { + name: genName(), + type: "module", + }, + ) -worker.addEventListener('message', (ev) => text('.simple-worker-url', JSON.stringify(ev.data))) -"`) + worker.addEventListener('message', (ev) => text('.simple-worker-url', JSON.stringify(ev.data))) + " + `) }) test('trailing comma', async () => { @@ -143,14 +145,16 @@ new Worker( }, // }, ) `), - ).toMatchInlineSnapshot(`" -new Worker( - new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), - { - type: 'module' - }, // }, -) -"`) + ).toMatchInlineSnapshot(` + " + new Worker( + new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), + { + type: 'module' + }, // }, + ) + " + `) }) test('throws an error when non-static worker options are provided', async () => { @@ -207,14 +211,14 @@ new Worker( `(() => { new Worker(new URL('./worker', import.meta.url)); repro({ test: "foo", }); })();`, ), ).toMatchInlineSnapshot( - `"(() => { new Worker(new URL(/* @vite-ignore */ "/worker?worker_file&type=classic", import.meta.url)); repro({ test: "foo", }); })();"`, + `"(() => { new Worker(new URL(/* @vite-ignore */ "/worker?worker_file&type=classic", '' + import.meta.url)); repro({ test: "foo", }); })();"`, ) expect( await transform( `repro(new Worker(new URL('./worker', import.meta.url)), { type: "module" })`, ), ).toMatchInlineSnapshot( - `"repro(new Worker(new URL(/* @vite-ignore */ "/worker?worker_file&type=classic", import.meta.url)), { type: "module" })"`, + `"repro(new Worker(new URL(/* @vite-ignore */ "/worker?worker_file&type=classic", '' + import.meta.url)), { type: "module" })"`, ) }) }) diff --git a/packages/vite/src/node/__tests_dts__/plugin.ts b/packages/vite/src/node/__tests_dts__/plugin.ts index 5b4ebeb82895c8..39b151772eb6b3 100644 --- a/packages/vite/src/node/__tests_dts__/plugin.ts +++ b/packages/vite/src/node/__tests_dts__/plugin.ts @@ -1,9 +1,10 @@ /** * This is a development only file for testing types. */ -import type { Plugin as RollupPlugin } from 'rollup' +import type { Plugin as RolldownPlugin } from 'rolldown' import type { Equal, ExpectExtends, ExpectTrue } from '@type-challenges/utils' -import type { Plugin, PluginContextExtension } from '../plugin' +import type { Plugin as RollupPlugin } from 'rollup' +import type { Plugin, PluginContextExtension, PluginOption } from '../plugin' import type { ROLLUP_HOOKS } from '../constants' import type { GetHookContextMap, @@ -26,13 +27,18 @@ type HooksMissingInConstants = Exclude< export type cases = [ // Ensure environment plugin hooks are superset of rollup plugin hooks - ExpectTrue>, + ExpectTrue>, // Ensure all Rollup hooks have Vite's plugin context extension ExpectTrue>, // Ensure the `ROLLUP_HOOKS` constant is up-to-date ExpectTrue>, + + // Ensure all Vite plugins, Rolldown plugins, and Rollup plugins can be assigned to `plugins` option + ExpectTrue>, + ExpectTrue>, + ExpectTrue>, ] export {} diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index 42505ee5bd488f..b588994b55f59a 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -8,21 +8,25 @@ import type { LogOrStringHandler, MinimalPluginContext, ModuleFormat, + OutputBundle, + OutputChunk, OutputOptions, PluginContext, - RollupBuild, + RenderedChunk, + RolldownBuild, + RolldownOptions, + RolldownOutput, + RolldownWatcher, RollupError, RollupLog, - RollupOptions, - RollupOutput, - RollupWatcher, WarningHandlerWithDefault, WatcherOptions, -} from 'rollup' -import commonjsPlugin from '@rollup/plugin-commonjs' -import type { TransformOptions } from 'esbuild' +} from 'rolldown' +import { viteLoadFallbackPlugin as nativeLoadFallbackPlugin } from 'rolldown/experimental' +import type { EsbuildTarget } from '#types/internal/esbuildOptions' import type { RollupCommonJSOptions } from '#dep-types/commonjs' import type { RollupDynamicImportVarsOptions } from '#dep-types/dynamicImportVars' +import type { ChunkMetadata } from '#types/metadata' import { DEFAULT_ASSETS_INLINE_LIMIT, ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, @@ -50,28 +54,28 @@ import { mergeConfig, mergeWithDefaults, partialEncodeURIPath, + setupRollupOptionCompat, + unique, } from './utils' import { perEnvironmentPlugin } from './plugin' import { manifestPlugin } from './plugins/manifest' -import type { Logger } from './logger' -import { dataURIPlugin } from './plugins/dataUri' +import { type Logger } from './logger' import { buildImportAnalysisPlugin } from './plugins/importAnalysisBuild' import { ssrManifestPlugin } from './ssr/ssrManifestPlugin' -import { buildLoadFallbackPlugin } from './plugins/loadFallback' import { findNearestMainPackageData, findNearestPackageData } from './packages' import type { PackageCache } from './packages' import { + convertToNotifyOptions, getResolvedOutDirs, resolveChokidarOptions, resolveEmptyOutDir, } from './watch' -import { completeAmdWrapPlugin } from './plugins/completeAmdWrap' -import { completeSystemWrapPlugin } from './plugins/completeSystemWrap' import { webWorkerPostPlugin } from './plugins/worker' import { getHookHandler } from './plugins' import { BaseEnvironment } from './baseEnvironment' import type { MinimalPluginContextWithoutEnvironment, Plugin } from './plugin' import type { RollupPluginHooks } from './typeUtils' +import { buildOxcPlugin } from './plugins/oxc' import { type LicenseOptions, licensePlugin } from './plugins/license' import { BasicMinimalPluginContext, @@ -101,7 +105,7 @@ export interface BuildEnvironmentOptions { * https://esbuild.github.io/content-types/#javascript for more details. * @default 'baseline-widely-available' */ - target?: 'baseline-widely-available' | TransformOptions['target'] | false + target?: 'baseline-widely-available' | EsbuildTarget | false /** * whether to inject module preload polyfill. * Note: does not apply to library mode. @@ -154,13 +158,13 @@ export interface BuildEnvironmentOptions { * doesn't support the #RGBA syntax. * @default target */ - cssTarget?: TransformOptions['target'] | false + cssTarget?: EsbuildTarget | false /** * Override CSS minification specifically instead of defaulting to `build.minify`, * so you can configure minification for JS and CSS separately. - * @default 'esbuild' + * @default 'lightningcss' */ - cssMinify?: boolean | 'esbuild' | 'lightningcss' + cssMinify?: boolean | 'lightningcss' | 'esbuild' /** * If `true`, a separate sourcemap file will be created. If 'inline', the * sourcemap will be appended to the resulting output file as data URI. @@ -171,10 +175,10 @@ export interface BuildEnvironmentOptions { sourcemap?: boolean | 'inline' | 'hidden' /** * Set to `false` to disable minification, or specify the minifier to use. - * Available options are 'terser' or 'esbuild'. - * @default 'esbuild' + * Available options are 'oxc' or 'terser' or 'esbuild'. + * @default 'oxc' */ - minify?: boolean | 'terser' | 'esbuild' + minify?: boolean | 'oxc' | 'terser' | 'esbuild' /** * Options for terser * https://terser.org/docs/api-reference#minify-options @@ -184,12 +188,18 @@ export interface BuildEnvironmentOptions { */ terserOptions?: TerserOptions /** - * Will be merged with internal rollup options. - * https://rollupjs.org/configuration-options/ + * Alias to `rolldownOptions` + * @deprecated Use `rolldownOptions` instead. */ - rollupOptions?: RollupOptions + rollupOptions?: RolldownOptions + /** + * Will be merged with internal rolldown options. + * https://rolldown.rs/reference/config-options + */ + rolldownOptions?: RolldownOptions /** * Options to pass on to `@rollup/plugin-commonjs` + * @deprecated This option is no-op and will be removed in future versions. */ commonjsOptions?: RollupCommonJSOptions /** @@ -323,7 +333,7 @@ export interface LibraryOptions { cssFileName?: string } -export type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife' | 'system' +export type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife' // | 'system' export interface ModulePreloadOptions { /** @@ -378,7 +388,7 @@ const _buildEnvironmentOptionsDefaults = Object.freeze({ sourcemap: false, // minify terserOptions: {}, - rollupOptions: {}, + rolldownOptions: {}, commonjsOptions: { include: [/node_modules/], extensions: ['.js', '.cjs'], @@ -430,24 +440,36 @@ export function resolveBuildEnvironmentOptions( { ..._buildEnvironmentOptionsDefaults, cssCodeSplit: !raw.lib, - minify: consumer === 'server' ? false : 'esbuild', + minify: consumer === 'server' ? false : 'oxc', + rollupOptions: {}, + rolldownOptions: undefined, ssr: consumer === 'server', emitAssets: consumer === 'client', createEnvironment: (name, config) => new BuildEnvironment(name, config), } satisfies BuildEnvironmentOptions, raw, ) + setupRollupOptionCompat(merged, 'build') + merged.rolldownOptions = { + platform: consumer === 'server' ? 'node' : 'browser', + ...merged.rolldownOptions, + } // handle special build targets if (merged.target === 'baseline-widely-available') { merged.target = ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET } + // dedupe target + if (Array.isArray(merged.target)) { + // esbuild allowed duplicate targets but oxc does not + merged.target = unique(merged.target) + } // normalize false string into actual false if ((merged.minify as string) === 'false') { merged.minify = false } else if (merged.minify === true) { - merged.minify = 'esbuild' + merged.minify = 'oxc' } const defaultModulePreload = { @@ -458,7 +480,8 @@ export function resolveBuildEnvironmentOptions( ...merged, cssTarget: merged.cssTarget ?? merged.target, cssMinify: - merged.cssMinify ?? (consumer === 'server' ? 'esbuild' : !!merged.minify), + merged.cssMinify ?? + (consumer === 'server' ? 'lightningcss' : !!merged.minify), // Resolve to false | object modulePreload: merged.modulePreload === false @@ -480,17 +503,7 @@ export async function resolveBuildPlugins(config: ResolvedConfig): Promise<{ }> { return { pre: [ - completeAmdWrapPlugin(), - completeSystemWrapPlugin(), ...(!config.isWorker ? [prepareOutDirPlugin()] : []), - perEnvironmentPlugin('commonjs', (environment) => { - const { commonjsOptions } = environment.config.build - const usePluginCommonjs = - !Array.isArray(commonjsOptions.include) || - commonjsOptions.include.length !== 0 - return usePluginCommonjs ? commonjsPlugin(commonjsOptions) : false - }), - dataURIPlugin(), perEnvironmentPlugin( 'vite:rollup-options-plugins', async (environment) => @@ -500,21 +513,22 @@ export async function resolveBuildPlugins(config: ResolvedConfig): Promise<{ ) ).filter(Boolean) as Plugin[], ), - ...(config.isWorker ? [webWorkerPostPlugin()] : []), + ...(config.isWorker ? [webWorkerPostPlugin(config)] : []), ], post: [ - buildImportAnalysisPlugin(config), - buildEsbuildPlugin(), + ...buildImportAnalysisPlugin(config), + ...(config.nativePluginEnabledLevel >= 1 ? [] : [buildOxcPlugin()]), + ...(config.build.minify === 'esbuild' ? [buildEsbuildPlugin()] : []), terserPlugin(config), ...(!config.isWorker ? [ licensePlugin(), - manifestPlugin(), + manifestPlugin(config), ssrManifestPlugin(), buildReporterPlugin(config), ] : []), - buildLoadFallbackPlugin(), + nativeLoadFallbackPlugin(), ], } } @@ -525,7 +539,7 @@ export async function resolveBuildPlugins(config: ResolvedConfig): Promise<{ */ export async function build( inlineConfig: InlineConfig = {}, -): Promise { +): Promise { const builder = await createBuilder(inlineConfig, true) const environment = Object.values(builder.environments)[0] if (!environment) throw new Error('No environment found') @@ -548,7 +562,10 @@ function resolveConfigToBuild( ) } -function resolveRollupOptions(environment: Environment) { +function resolveRolldownOptions( + environment: Environment, + chunkMetadataMap: ChunkMetadataMap, +) { const { root, packageCache, build: options } = environment.config const libOptions = options.lib const { logger } = environment @@ -595,16 +612,16 @@ function resolveRollupOptions(environment: Environment) { // inject environment and ssr arg to plugin load/transform hooks const plugins = environment.plugins.map((p) => - injectEnvironmentToHooks(environment, p), + injectEnvironmentToHooks(environment, chunkMetadataMap, p), ) - const rollupOptions: RollupOptions = { + const rollupOptions: RolldownOptions = { preserveEntrySignatures: ssr ? 'allow-extension' : libOptions ? 'strict' : false, - cache: options.watch ? undefined : false, + // cache: options.watch ? undefined : false, ...options.rollupOptions, output: options.rollupOptions.output, input, @@ -613,6 +630,34 @@ function resolveRollupOptions(environment: Environment) { onLog(level, log) { onRollupLog(level, log, environment) }, + transform: { + target: options.target === false ? undefined : options.target, + ...options.rollupOptions.transform, + define: { + ...options.rollupOptions.transform?.define, + // disable builtin process.env.NODE_ENV replacement as it is handled by the define plugin + 'process.env.NODE_ENV': 'process.env.NODE_ENV', + }, + }, + // TODO: remove this and enable rolldown's CSS support later + moduleTypes: { + ...options.rollupOptions.moduleTypes, + '.css': 'js', + }, + experimental: { + ...options.rollupOptions.experimental, + viteMode: true, + }, + optimization: { + inlineConst: + typeof options.rollupOptions.optimization?.inlineConst === 'boolean' + ? options.rollupOptions.optimization.inlineConst + : { + mode: 'smart', + ...options.rollupOptions.optimization?.inlineConst, + }, + ...options.rollupOptions.optimization, + }, } const isSsrTargetWebworkerEnvironment = @@ -658,11 +703,13 @@ function resolveRollupOptions(environment: Environment) { exports: 'auto', sourcemap: options.sourcemap, name: libOptions ? libOptions.name : undefined, - hoistTransitiveImports: libOptions ? false : undefined, + // hoistTransitiveImports: libOptions ? false : undefined, // es2015 enables `generatedCode.symbols` // - #764 add `Symbol.toStringTag` when build es module into cjs chunk // - #1048 add `Symbol.toStringTag` for module default export - generatedCode: 'es2015', + generatedCode: { + preset: 'es2015', + }, entryFileNames: ssr ? `[name].${jsExt}` : libOptions @@ -687,6 +734,22 @@ function resolveRollupOptions(environment: Environment) { output.format === 'iife' || (isSsrTargetWebworkerEnvironment && (typeof input === 'string' || Object.keys(input).length === 1)), + legalComments: 'none', + minify: + options.minify === 'oxc' + ? libOptions && (format === 'es' || format === 'esm') + ? { + compress: true, + mangle: true, + // Do not minify whitespace for ES lib output since that would remove + // pure annotations and break tree-shaking + codegen: false, + } + : true + : options.minify === false + ? 'dce-only' + : false, + topLevelVar: true, ...output, } } @@ -712,22 +775,23 @@ function resolveRollupOptions(environment: Environment) { **/ async function buildEnvironment( environment: BuildEnvironment, -): Promise { +): Promise { const { logger, config } = environment const { root, build: options } = config logger.info( colors.cyan( - `vite v${VERSION} ${colors.green( + `rolldown-vite v${VERSION} ${colors.green( `building ${environment.name} environment for ${environment.config.mode}...`, )}`, ), ) - let bundle: RollupBuild | undefined + let bundle: RolldownBuild | undefined let startTime: number | undefined try { - const rollupOptions = resolveRollupOptions(environment) + const chunkMetadataMap = new ChunkMetadataMap() + const rollupOptions = resolveRolldownOptions(environment, chunkMetadataMap) // watch file changes with rollup if (options.watch) { @@ -746,7 +810,9 @@ async function buildEnvironment( ) const resolvedChokidarOptions = resolveChokidarOptions( { + // @ts-expect-error chokidar option does not exist in rolldown but used for backward compat ...(rollupOptions.watch || {}).chokidar, + // @ts-expect-error chokidar option does not exist in rolldown but used for backward compat ...options.watch.chokidar, }, resolvedOutDirs, @@ -754,19 +820,20 @@ async function buildEnvironment( environment.config.cacheDir, ) - const { watch } = await import('rollup') + const { watch } = await import('rolldown') const watcher = watch({ ...rollupOptions, watch: { ...rollupOptions.watch, ...options.watch, - chokidar: resolvedChokidarOptions, + notify: convertToNotifyOptions(resolvedChokidarOptions), }, }) watcher.on('event', (event) => { if (event.code === 'BUNDLE_START') { logger.info(colors.cyan(`\nbuild started...`)) + chunkMetadataMap.clearResetChunks() } else if (event.code === 'BUNDLE_END') { event.result.close() logger.info(colors.cyan(`built in ${event.duration}ms.`)) @@ -781,15 +848,22 @@ async function buildEnvironment( return watcher } - // write or generate files with rollup - const { rollup } = await import('rollup') + // write or generate files with rolldown + const { rolldown } = await import('rolldown') startTime = Date.now() - bundle = await rollup(rollupOptions) + bundle = await rolldown(rollupOptions) - const res: RollupOutput[] = [] + const res: RolldownOutput[] = [] for (const output of arraify(rollupOptions.output!)) { res.push(await bundle[options.write ? 'write' : 'generate'](output)) } + for (const output of res) { + for (const chunk of output.output) { + if (chunk.type === 'chunk') { + injectChunkMetadata(chunkMetadataMap, chunk) + } + } + } logger.info( `${colors.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`, ) @@ -999,7 +1073,7 @@ export function onRollupLog( // throw unless it's commonjs external... if (!id || !id.endsWith('?commonjs-external')) { throw new Error( - `[vite]: Rollup failed to resolve import "${exporter}" from "${id}".\n` + + `[vite]: Rolldown failed to resolve import "${exporter}" from "${id}".\n` + `This is most likely unintended because it can break your application at runtime.\n` + `If you do want to externalize this module explicitly add it to\n` + `\`build.rollupOptions.external\``, @@ -1022,23 +1096,29 @@ export function onRollupLog( } } + // append plugin name to align with Rollup's behavior + let message = logging.message + if (logging.plugin) { + message = `[plugin ${logging.plugin}] ${message}` + } + switch (logLeveling) { case 'info': - environment.logger.info(logging.message) + environment.logger.info(message) return case 'warn': - environment.logger.warn(colors.yellow(logging.message)) + environment.logger.warn(colors.yellow(message)) return case 'error': - environment.logger.error(colors.red(logging.message)) + environment.logger.error(colors.red(message)) return case 'debug': - debugLogger?.(logging.message) + debugLogger?.(message) return default: logLeveling satisfies never // fallback to info if a unknown log level is passed - environment.logger.info(logging.message) + environment.logger.info(message) return } } @@ -1102,13 +1182,60 @@ function isExternal(id: string, test: string | RegExp) { } } +export class ChunkMetadataMap { + private _inner = new Map() + private _resetChunks = new Set() + + private _getKey(chunk: RenderedChunk | OutputChunk): string { + return 'preliminaryFileName' in chunk + ? chunk.preliminaryFileName + : chunk.fileName + } + + private _getDefaultValue(chunk: RenderedChunk | OutputChunk): ChunkMetadata { + return { + importedAssets: new Set(), + importedCss: new Set(), + // NOTE: adding this as a workaround for now ideally we'd want to remove this workaround + // use shared `chunk.modules` object to allow mutation on js side plugins + __modules: chunk.modules, + } + } + + get(chunk: RenderedChunk | OutputChunk): ChunkMetadata { + const key = this._getKey(chunk) + if (!this._inner.has(key)) { + this._inner.set(key, this._getDefaultValue(chunk)) + } + return this._inner.get(key)! + } + + // reset chunk metadata on the first RenderChunk call for watch mode + reset(chunk: RenderedChunk | OutputChunk): void { + const key = this._getKey(chunk) + if (this._resetChunks.has(key)) return + + this._resetChunks.add(key) + this._inner.set(key, this._getDefaultValue(chunk)) + } + + clearResetChunks(): void { + this._resetChunks.clear() + } +} + export function injectEnvironmentToHooks( environment: Environment, + chunkMetadataMap: ChunkMetadataMap, plugin: Plugin, ): Plugin { const { resolveId, load, transform } = plugin - const clone = { ...plugin } + // the plugin can be a class instance (e.g. native plugins) + const clone: Plugin = Object.assign( + Object.create(Object.getPrototypeOf(plugin)), + plugin, + ) for (const hook of Object.keys(clone) as RollupPluginHooks[]) { switch (hook) { @@ -1131,7 +1258,12 @@ export function injectEnvironmentToHooks( break default: if (ROLLUP_HOOKS.includes(hook)) { - ;(clone as any)[hook] = wrapEnvironmentHook(environment, clone[hook]) + ;(clone as any)[hook] = wrapEnvironmentHook( + environment, + chunkMetadataMap, + plugin, + hook, + ) } break } @@ -1222,8 +1354,11 @@ function wrapEnvironmentTransform( function wrapEnvironmentHook( environment: Environment, - hook?: Plugin[HookName], + chunkMetadataMap: ChunkMetadataMap, + plugin: Plugin, + hookName: HookName, ): Plugin[HookName] { + const hook = plugin[hookName] if (!hook) return const fn = getHookHandler(hook) @@ -1233,6 +1368,20 @@ function wrapEnvironmentHook( this: PluginContext, ...args: any[] ) { + if (hookName === 'renderChunk') { + injectChunkMetadata(chunkMetadataMap, args[1], true) + } + if (hookName === 'augmentChunkHash') { + injectChunkMetadata(chunkMetadataMap, args[0]) + } + if (hookName === 'generateBundle' || hookName === 'writeBundle') { + const bundle = args[1] as OutputBundle + for (const chunk of Object.values(bundle)) { + if (chunk.type === 'chunk') { + injectChunkMetadata(chunkMetadataMap, chunk) + } + } + } return fn.call(injectEnvironmentInContext(this, environment), ...args) } @@ -1246,6 +1395,28 @@ function wrapEnvironmentHook( } } +function injectChunkMetadata( + chunkMetadataMap: ChunkMetadataMap, + chunk: RenderedChunk | OutputChunk, + resetChunkMetadata = false, +) { + if (resetChunkMetadata) { + chunkMetadataMap.reset(chunk) + } + // define instead of assign to avoid detected as a change + // https://github.com/rolldown/rolldown/blob/f4c5ff27799f2b0152c689c398e61bc7d30429ff/packages/rolldown/src/utils/transform-to-rollup-output.ts#L87 + Object.defineProperty(chunk, 'viteMetadata', { + value: chunkMetadataMap.get(chunk), + enumerable: true, + }) + Object.defineProperty(chunk, 'modules', { + get() { + return chunk.viteMetadata!.__modules + }, + enumerable: true, + }) +} + function injectEnvironmentInContext( context: Context, environment: Environment, @@ -1328,12 +1499,12 @@ const relativeUrlMechanisms: Record< InternalModuleFormat, (relativePath: string) => string > = { - amd: (relativePath) => { - if (relativePath[0] !== '.') relativePath = './' + relativePath - return getResolveUrl( - `require.toUrl('${escapeId(relativePath)}'), document.baseURI`, - ) - }, + // amd: (relativePath) => { + // if (relativePath[0] !== '.') relativePath = './' + relativePath + // return getResolveUrl( + // `require.toUrl('${escapeId(relativePath)}'), document.baseURI`, + // ) + // }, cjs: (relativePath) => `(typeof document === 'undefined' ? ${getFileUrlFromRelativePath( relativePath, @@ -1344,10 +1515,10 @@ const relativeUrlMechanisms: Record< ), iife: (relativePath) => getRelativeUrlFromDocument(relativePath), // NOTE: make sure rollup generate `module` params - system: (relativePath) => - getResolveUrl( - `'${escapeId(partialEncodeURIPath(relativePath))}', module.meta.url`, - ), + // system: (relativePath) => + // getResolveUrl( + // `'${escapeId(partialEncodeURIPath(relativePath))}', module.meta.url`, + // ), umd: (relativePath) => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromRelativePath( relativePath, @@ -1505,7 +1676,7 @@ export interface ViteBuilder { buildApp(): Promise build( environment: BuildEnvironment, - ): Promise + ): Promise } export interface BuilderOptions { @@ -1612,7 +1783,7 @@ export async function createBuilder( }, async build( environment: BuildEnvironment, - ): Promise { + ): Promise { const output = await buildEnvironment(environment) environment.isBuilt = true return output diff --git a/packages/vite/src/node/cli.ts b/packages/vite/src/node/cli.ts index 6ed62cc5f833b2..bc18f3c91ac6b9 100644 --- a/packages/vite/src/node/cli.ts +++ b/packages/vite/src/node/cli.ts @@ -175,7 +175,7 @@ cli .option('--clearScreen', `[boolean] allow/disable clear screen when logging`) .option( '--configLoader ', - `[string] use 'bundle' to bundle the config with esbuild, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`, + `[string] use 'bundle' to bundle the config with Rolldown, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`, ) .option('-d, --debug [feat]', `[string | boolean] show debug logs`) .option('-f, --filter ', `[string] filter debug logs`) @@ -238,7 +238,7 @@ cli info( `\n ${colors.green( - `${colors.bold('VITE')} v${VERSION}`, + `${colors.bold('ROLLDOWN-VITE')} v${VERSION}`, )}${modeString} ${startupDurationString}\n`, { clear: !hasExistingLogs, diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index e6de733ecfe641..c23f4bd996503c 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -7,9 +7,14 @@ import { performance } from 'node:perf_hooks' import { createRequire } from 'node:module' import crypto from 'node:crypto' import colors from 'picocolors' -import type { PluginContextMeta, RollupOptions } from 'rollup' import picomatch from 'picomatch' -import { build } from 'esbuild' +import { + type NormalizedOutputOptions, + type OutputChunk, + type PluginContextMeta, + type RolldownOptions, + rolldown, +} from 'rolldown' import type { Alias, AliasOptions } from '#dep-types/alias' import type { AnymatchFn } from '../types/anymatch' import { withTrailingSlash } from '../shared/utils' @@ -67,9 +72,11 @@ import { resolveCSSOptions, } from './plugins/css' import { + arraify, asyncFlatten, createDebugger, createFilter, + hasBothRollupOptionsAndRolldownOptions, isExternalUrl, isFilePathESM, isInNodeModules, @@ -83,6 +90,7 @@ import { nodeLikeBuiltins, normalizeAlias, normalizePath, + setupRollupOptionCompat, } from './utils' import { createPluginHookUtils, @@ -109,6 +117,8 @@ import { PartialEnvironment } from './baseEnvironment' import { createIdResolver } from './idResolver' import { runnerImport } from './ssr/runnerImport' import { getAdditionalAllowedHosts } from './server/middlewares/hostCheck' +import { convertEsbuildPluginToRolldownPlugin } from './optimizer/pluginConverter' +import { type OxcOptions, convertEsbuildConfigToOxcConfig } from './plugins/oxc' import type { RequiredExceptFor } from './typeUtils' import { BasicMinimalPluginContext, @@ -302,6 +312,8 @@ export type ResolvedEnvironmentOptions = { dev: ResolvedDevEnvironmentOptions build: ResolvedBuildEnvironmentOptions plugins: readonly Plugin[] + /** @internal */ + optimizeDepsPluginNames: string[] } export type DefaultEnvironmentOptions = Omit< @@ -366,8 +378,15 @@ export interface UserConfig extends DefaultEnvironmentOptions { /** * Transform options to pass to esbuild. * Or set to `false` to disable esbuild. + * + * @deprecated Use `oxc` option instead. */ esbuild?: ESBuildOptions | false + /** + * Transform options to pass to Oxc. + * Or set to `false` to disable Oxc. + */ + oxc?: OxcOptions | false /** * Specify additional picomatch patterns to be treated as static assets. */ @@ -440,14 +459,22 @@ export interface UserConfig extends DefaultEnvironmentOptions { /** * Vite plugins that apply to worker bundle. The plugins returned by this function * should be new instances every time it is called, because they are used for each - * rollup worker bundling process. + * rolldown worker bundling process. */ plugins?: () => PluginOption[] /** - * Rollup options to build worker bundle + * Alias to `rolldownOptions`. + * @deprecated Use `rolldownOptions` instead. */ rollupOptions?: Omit< - RollupOptions, + RolldownOptions, + 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures' + > + /** + * Rolldown options to build worker bundle + */ + rolldownOptions?: Omit< + RolldownOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures' > } @@ -518,6 +545,17 @@ export interface ExperimentalOptions { * @default false */ hmrPartialAccept?: boolean + /** + * Enable builtin plugin that written by rust, which is faster than js plugin. + * + * - 'resolver' (deprecated, will be removed in v8 stable): Enable only the native resolver plugin. + * - 'v1' (will be deprecated, will be removed in v8 stable): Enable the first stable set of native plugins (including resolver). + * - true: Enable all native plugins (currently an alias of 'v1', it will map to a newer one in the future versions). + * + * @experimental + * @default 'v1' + */ + enableNativePlugin?: boolean | 'resolver' | 'v1' } export interface LegacyOptions { @@ -533,12 +571,27 @@ export interface LegacyOptions { * that security weakness.** */ skipWebSocketTokenCheck?: boolean + /** + * Opt-in to the pre-Vite 8 CJS interop behavior, which was inconsistent. + * + * In pre-Vite 8 versions, Vite had inconsistent CJS interop behavior. This was due to + * the different behavior of esbuild and the Rollup commonjs plugin. + * Vite 8+ uses Rolldown for both the dependency optimization in dev and the production build, + * which aligns the behavior to esbuild. + * + * See the Vite 8 migration guide for more details. + */ + inconsistentCjsInterop?: boolean } export interface ResolvedWorkerOptions { format: 'es' | 'iife' plugins: (bundleChain: string[]) => Promise - rollupOptions: RollupOptions + /** + * @deprecated Use `rolldownOptions` instead. + */ + rollupOptions: RolldownOptions + rolldownOptions: RolldownOptions } export interface InlineConfig extends UserConfig { @@ -595,7 +648,9 @@ export interface ResolvedConfig extends Readonly< plugins: readonly Plugin[] css: ResolvedCSSOptions json: Required + /** @deprecated Use `oxc` option instead. */ esbuild: ESBuildOptions | false + oxc: OxcOptions | false server: ResolvedServerOptions dev: ResolvedDevEnvironmentOptions /** @experimental */ @@ -604,6 +659,7 @@ export interface ResolvedConfig extends Readonly< preview: ResolvedPreviewOptions ssr: ResolvedSSROptions assetsInclude: (file: string) => boolean + rawAssetsInclude: (string | RegExp)[] logger: Logger /** * Create an internal resolver to be used in special scenarios, e.g. @@ -624,6 +680,10 @@ export interface ResolvedConfig extends Readonly< experimental: RequiredExceptFor future: FutureOptions | undefined environments: Record + /** @internal injected by legacy plugin */ + isOutputOptionsForLegacyChunks?( + outputOptions: NormalizedOutputOptions, + ): boolean /** * The token to connect to the WebSocket server from browsers. * @@ -640,6 +700,8 @@ export interface ResolvedConfig extends Readonly< /** @internal */ safeModulePaths: Set /** @internal */ + nativePluginEnabledLevel: number + /** @internal */ [SYMBOL_RESOLVED_CONFIG]: true } & PluginHookUtils > {} @@ -668,6 +730,7 @@ const configDefaults = Object.freeze({ noExternal: [], external: [], preserveSymlinks: false, + tsconfigPaths: false, alias: [], }, @@ -705,6 +768,7 @@ const configDefaults = Object.freeze({ importGlobRestoreExtension: false, renderBuiltUrl: undefined, hmrPartialAccept: false, + enableNativePlugin: process.env._VITE_TEST_JS_PLUGIN ? false : 'v1', }, future: { removePluginHookHandleHotUpdate: undefined, @@ -733,6 +797,7 @@ const configDefaults = Object.freeze({ exclude: [], needsInterop: [], // esbuildOptions + rolldownOptions: {}, /** @experimental */ extensions: [], /** @deprecated @experimental */ @@ -836,6 +901,7 @@ function resolveEnvironmentOptions( resolve.preserveSymlinks, forceOptimizeDeps, consumer, + logger, ), dev: resolveDevEnvironmentOptions( options.dev, @@ -849,6 +915,8 @@ function resolveEnvironmentOptions( consumer, ), plugins: undefined!, // to be resolved later + // will be set by `setOptimizeDepsPluginNames` later + optimizeDepsPluginNames: undefined!, } } @@ -1023,19 +1091,192 @@ function resolveDepOptimizationOptions( preserveSymlinks: boolean, forceOptimizeDeps: boolean | undefined, consumer: 'client' | 'server' | undefined, + logger: Logger, ): DepOptimizationOptions { - return mergeWithDefaults( + if ( + optimizeDeps?.rolldownOptions && + optimizeDeps?.rolldownOptions === optimizeDeps?.rollupOptions + ) { + delete optimizeDeps?.rollupOptions + } + const merged = mergeWithDefaults( { ...configDefaults.optimizeDeps, disabled: undefined, // do not set here to avoid deprecation warning noDiscovery: consumer !== 'client', - esbuildOptions: { - preserveSymlinks, - }, force: forceOptimizeDeps ?? configDefaults.optimizeDeps.force, }, optimizeDeps ?? {}, ) + setupRollupOptionCompat(merged, 'optimizeDeps') + + const rolldownOptions = merged.rolldownOptions as Exclude< + DepOptimizationOptions['rolldownOptions'], + undefined + > + + if (merged.esbuildOptions && Object.keys(merged.esbuildOptions).length > 0) { + logger.warn( + colors.yellow( + `You or a plugin you are using have set \`optimizeDeps.esbuildOptions\` ` + + `but this option is now deprecated. ` + + `Vite now uses Rolldown to optimize the dependencies. ` + + `Please use \`optimizeDeps.rolldownOptions\` instead.`, + ), + ) + + rolldownOptions.resolve ??= {} + rolldownOptions.output ??= {} + rolldownOptions.transform ??= {} + + const setResolveOptions = < + T extends keyof Exclude, + >( + key: T, + value: Exclude[T], + ) => { + if (value !== undefined && rolldownOptions.resolve![key] === undefined) { + rolldownOptions.resolve![key] = value + } + } + + if ( + merged.esbuildOptions.minify !== undefined && + rolldownOptions.output.minify === undefined + ) { + rolldownOptions.output.minify = merged.esbuildOptions.minify + } + if ( + merged.esbuildOptions.treeShaking !== undefined && + rolldownOptions.treeshake === undefined + ) { + rolldownOptions.treeshake = merged.esbuildOptions.treeShaking + } + if ( + merged.esbuildOptions.define !== undefined && + rolldownOptions.transform.define === undefined + ) { + rolldownOptions.transform.define = merged.esbuildOptions.define + } + if (merged.esbuildOptions.loader !== undefined) { + const loader = merged.esbuildOptions.loader + rolldownOptions.moduleTypes ??= {} + for (const [key, value] of Object.entries(loader)) { + if ( + rolldownOptions.moduleTypes[key] === undefined && + value !== 'copy' && + value !== 'css' && + value !== 'default' && + value !== 'file' && + value !== 'local-css' + ) { + rolldownOptions.moduleTypes[key] = value + } + } + } + if ( + merged.esbuildOptions.preserveSymlinks !== undefined && + rolldownOptions.resolve.symlinks === undefined + ) { + rolldownOptions.resolve.symlinks = !merged.esbuildOptions.preserveSymlinks + } + setResolveOptions('extensions', merged.esbuildOptions.resolveExtensions) + setResolveOptions('mainFields', merged.esbuildOptions.mainFields) + setResolveOptions('conditionNames', merged.esbuildOptions.conditions) + if ( + merged.esbuildOptions.keepNames !== undefined && + rolldownOptions.output.keepNames === undefined + ) { + rolldownOptions.output.keepNames = merged.esbuildOptions.keepNames + } + + if ( + merged.esbuildOptions.platform !== undefined && + rolldownOptions.platform === undefined + ) { + rolldownOptions.platform = merged.esbuildOptions.platform + } + + // NOTE: the following options cannot be converted + // - legalComments + // - target, supported (Vite used to transpile down to `ESBUILD_MODULES_TARGET`) + // - ignoreAnnotations + // - jsx, jsxFactory, jsxFragment, jsxImportSource, jsxDev, jsxSideEffects + // - tsconfigRaw, tsconfig + + // NOTE: the following options can be converted but probably not worth it + // - sourceRoot + // - sourcesContent (`output.sourcemapExcludeSources` is not supported by rolldown) + // - drop + // - dropLabels + // - mangleProps, reserveProps, mangleQuoted, mangleCache + // - minifyWhitespace, minifyIdentifiers, minifySyntax + // - lineLimit + // - charset + // - pure (`treeshake.manualPureFunctions` is not supported by rolldown) + // - alias (it probably does not work the same with `resolve.alias`) + // - inject + // - banner, footer + // - nodePaths + + // NOTE: the following options does not make sense to set / convert it + // - globalName (we only use ESM format) + // - color + // - logLimit + // - logOverride + // - splitting + // - outbase + // - packages (this should not be set) + // - allowOverwrite + // - publicPath (`file` loader is not supported by rolldown) + // - entryNames, chunkNames, assetNames (Vite does not support changing these options) + // - stdin + // - absWorkingDir + } + + merged.esbuildOptions ??= {} + merged.esbuildOptions.preserveSymlinks ??= preserveSymlinks + + rolldownOptions.resolve ??= {} + rolldownOptions.resolve.symlinks ??= !preserveSymlinks + rolldownOptions.output ??= {} + rolldownOptions.output.topLevelVar ??= true + + return merged +} + +async function setOptimizeDepsPluginNames(resolvedConfig: ResolvedConfig) { + await Promise.all( + Object.values(resolvedConfig.environments).map(async (environment) => { + const plugins = environment.optimizeDeps.rolldownOptions?.plugins ?? [] + const outputPlugins = + environment.optimizeDeps.rolldownOptions?.output?.plugins ?? [] + const flattenedPlugins = await asyncFlatten([plugins, outputPlugins]) + + const pluginNames = [] + for (const plugin of flattenedPlugins) { + if (plugin && 'name' in plugin) { + pluginNames.push(plugin.name) + } + } + environment.optimizeDepsPluginNames = pluginNames + }), + ) +} + +function applyDepOptimizationOptionCompat(resolvedConfig: ResolvedConfig) { + if ( + resolvedConfig.optimizeDeps.esbuildOptions?.plugins && + resolvedConfig.optimizeDeps.esbuildOptions.plugins.length > 0 + ) { + resolvedConfig.optimizeDeps.rolldownOptions ??= {} + resolvedConfig.optimizeDeps.rolldownOptions.plugins ||= [] + ;(resolvedConfig.optimizeDeps.rolldownOptions.plugins as any[]).push( + ...resolvedConfig.optimizeDeps.esbuildOptions.plugins.map((plugin) => + convertEsbuildPluginToRolldownPlugin(plugin), + ), + ) + } } export function isResolvedConfig( @@ -1059,6 +1300,17 @@ export async function resolveConfig( patchPlugins: ((resolvedPlugins: Plugin[]) => void) | undefined = undefined, ): Promise { let config = inlineConfig + config.build ??= {} + setupRollupOptionCompat(config.build, 'build') + config.worker ??= {} + setupRollupOptionCompat(config.worker, 'worker') + config.optimizeDeps ??= {} + setupRollupOptionCompat(config.optimizeDeps, 'optimizeDeps') + if (config.ssr) { + config.ssr.optimizeDeps ??= {} + setupRollupOptionCompat(config.ssr.optimizeDeps, 'ssr.optimizeDeps') + } + let configFileDependencies: string[] = [] let mode = inlineConfig.mode || defaultMode const isNodeEnvSet = !!process.env.NODE_ENV @@ -1477,11 +1729,18 @@ export async function resolveConfig( return workerResolved } - const resolvedWorkerOptions: ResolvedWorkerOptions = { + const resolvedWorkerOptions: Omit< + ResolvedWorkerOptions, + 'rolldownOptions' + > & { + rolldownOptions: ResolvedWorkerOptions['rolldownOptions'] | undefined + } = { format: config.worker?.format || 'iife', plugins: createWorkerPlugins, rollupOptions: config.worker?.rollupOptions || {}, + rolldownOptions: config.worker?.rolldownOptions, // will be set by setupRollupOptionCompat if undefined } + setupRollupOptionCompat(resolvedWorkerOptions, 'worker') const base = withTrailingSlash(resolvedBase) @@ -1495,6 +1754,32 @@ export async function resolveConfig( preview.allowedHosts.push(...additionalAllowedHosts) } + let oxc: OxcOptions | false | undefined = config.oxc + if (config.esbuild) { + if (config.oxc) { + logger.warn( + colors.yellow( + `Both esbuild and oxc options were set. oxc options will be used and esbuild options will be ignored.`, + ), + ) + } else { + oxc = convertEsbuildConfigToOxcConfig(config.esbuild, logger) + } + } else if (config.esbuild === false && config.oxc !== false) { + logger.warn( + colors.yellow( + `\`esbuild\` option is set to false, but \`oxc\` option was not set to false. ` + + `\`esbuild: false\` does not have effect any more. ` + + `If you want to disable the default transformation, which is now handled by Oxc, please set \`oxc: false\` instead.`, + ), + ) + } + + const experimental = mergeWithDefaults( + configDefaults.experimental, + config.experimental ?? {}, + ) + resolved = { configFile: configFile ? normalizePath(configFile) : undefined, configFileDependencies: configFileDependencies.map((name) => @@ -1516,6 +1801,7 @@ export async function resolveConfig( plugins: userPlugins, // placeholder to be replaced css: resolveCSSOptions(config.css), json: mergeWithDefaults(configDefaults.json, config.json ?? {}), + // preserve esbuild for buildEsbuildPlugin esbuild: config.esbuild === false ? false @@ -1526,6 +1812,19 @@ export async function resolveConfig( legalComments: 'none', ...config.esbuild, }, + oxc: + oxc === false + ? false + : { + ...oxc, + jsx: + typeof oxc?.jsx === 'string' + ? oxc.jsx + : { + development: oxc?.jsx?.development ?? !isProduction, + ...oxc?.jsx, + }, + }, server, builder, preview, @@ -1540,14 +1839,12 @@ export async function resolveConfig( assetsInclude(file: string) { return DEFAULT_ASSETS_RE.test(file) || assetsFilter(file) }, + rawAssetsInclude: config.assetsInclude ? arraify(config.assetsInclude) : [], logger, packageCache, worker: resolvedWorkerOptions, appType: config.appType ?? 'spa', - experimental: mergeWithDefaults( - configDefaults.experimental, - config.experimental ?? {}, - ), + experimental, future: config.future === 'warn' ? ({ @@ -1612,6 +1909,9 @@ export async function resolveConfig( }, ), safeModulePaths: new Set(), + nativePluginEnabledLevel: resolveNativePluginEnabledLevel( + experimental.enableNativePlugin, + ), [SYMBOL_RESOLVED_CONFIG]: true, } resolved = { @@ -1670,6 +1970,9 @@ export async function resolveConfig( resolved.build.ssrEmitAssets || resolved.build.emitAssets } + applyDepOptimizationOptionCompat(resolved) + await setOptimizeDepsPluginNames(resolved) + debug?.(`using resolved config: %O`, { ...resolved, plugins: resolved.plugins.map((p) => p.name), @@ -1733,9 +2036,40 @@ assetFileNames isn't equal for every build.rollupOptions.output. A single patter ) } + if ( + resolved.resolve.tsconfigPaths && + resolved.experimental.enableNativePlugin === false + ) { + resolved.logger.warn( + colors.yellow(` +(!) resolve.tsconfigPaths is set to true, but native plugins are disabled. To use resolve.tsconfigPaths, please enable native plugins via experimental.enableNativePlugin. +`), + ) + } + return resolved } +function resolveNativePluginEnabledLevel( + enableNativePlugin: Exclude< + ExperimentalOptions['enableNativePlugin'], + undefined + >, +) { + switch (enableNativePlugin) { + case 'resolver': + return 0 + case 'v1': + case true: + return 1 + case false: + return -1 + default: + enableNativePlugin satisfies never + return -1 + } +} + /** * Resolve base url. Note that some users use Vite to build for non-web targets like * electron or expects to deploy @@ -1937,101 +2271,93 @@ async function bundleConfigFile( const importMetaResolveVarName = '__vite_injected_original_import_meta_resolve' - const result = await build({ - absWorkingDir: process.cwd(), - entryPoints: [fileName], - write: false, - target: [`node${process.versions.node}`], + const bundle = await rolldown({ + input: fileName, + // target: [`node${process.versions.node}`], platform: 'node', - bundle: true, - format: isESM ? 'esm' : 'cjs', - mainFields: ['main'], - sourcemap: 'inline', - // the last slash is needed to make the path correct - sourceRoot: pathToFileURL(path.dirname(fileName)).href + '/', - metafile: true, - define: { - __dirname: dirnameVarName, - __filename: filenameVarName, - 'import.meta.url': importMetaUrlVarName, - 'import.meta.dirname': dirnameVarName, - 'import.meta.filename': filenameVarName, - 'import.meta.resolve': importMetaResolveVarName, - 'import.meta.main': 'false', + resolve: { + mainFields: ['main'], + }, + transform: { + define: { + __dirname: dirnameVarName, + __filename: filenameVarName, + 'import.meta.url': importMetaUrlVarName, + 'import.meta.dirname': dirnameVarName, + 'import.meta.filename': filenameVarName, + 'import.meta.resolve': importMetaResolveVarName, + 'import.meta.main': 'false', + }, }, + // disable treeshake to include files that is not sideeffectful to `moduleIds` + treeshake: false, plugins: [ { name: 'externalize-deps', - setup(build) { - // externalize bare imports - build.onResolve( - { filter: /^[^.#].*/ }, - async ({ path: id, importer, kind }) => { - if ( - kind === 'entry-point' || - path.isAbsolute(id) || - isNodeBuiltin(id) - ) { - return - } + resolveId: { + filter: { id: /^[^.#].*/ }, + async handler(id, importer, { kind }) { + if (!importer || path.isAbsolute(id) || isNodeBuiltin(id)) { + return + } - // With the `isNodeBuiltin` check above, this check captures if the builtin is a - // non-node built-in, which esbuild doesn't know how to handle. In that case, we - // externalize it so the non-node runtime handles it instead. - if (isNodeLikeBuiltin(id) || id.startsWith('npm:')) { - return { external: true } - } + // With the `isNodeBuiltin` check above, this check captures if the builtin is a + // non-node built-in, which esbuild doesn't know how to handle. In that case, we + // externalize it so the non-node runtime handles it instead. + if (isNodeLikeBuiltin(id) || id.startsWith('npm:')) { + return { id, external: true } + } - const isImport = isESM || kind === 'dynamic-import' - let idFsPath: string | undefined - try { - idFsPath = nodeResolveWithVite(id, importer, { - root, - isRequire: !isImport, - }) - } catch (e) { - if (!isImport) { - let canResolveWithImport = false - try { - canResolveWithImport = !!nodeResolveWithVite(id, importer, { - root, - }) - } catch {} - if (canResolveWithImport) { - throw new Error( - `Failed to resolve ${JSON.stringify( - id, - )}. This package is ESM only but it was tried to load by \`require\`. See https://vite.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.`, - ) - } + const isImport = isESM || kind === 'dynamic-import' + let idFsPath: string | undefined + try { + idFsPath = nodeResolveWithVite(id, importer, { + root, + isRequire: !isImport, + }) + } catch (e) { + if (!isImport) { + let canResolveWithImport = false + try { + canResolveWithImport = !!nodeResolveWithVite(id, importer, { + root, + }) + } catch {} + if (canResolveWithImport) { + throw new Error( + `Failed to resolve ${JSON.stringify( + id, + )}. This package is ESM only but it was tried to load by \`require\`. See https://vite.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.`, + ) } - throw e } - if (idFsPath && isImport) { - idFsPath = pathToFileURL(idFsPath).href - } - return { - path: idFsPath, - external: true, - } - }, - ) + throw e + } + if (!idFsPath) return + // always no-externalize json files as rolldown does not support import attributes + if (idFsPath.endsWith('.json')) { + return idFsPath + } + + if (idFsPath && isImport) { + idFsPath = pathToFileURL(idFsPath).href + } + return { id: idFsPath, external: true } + }, }, }, { name: 'inject-file-scope-variables', - setup(build) { - build.onLoad({ filter: /\.[cm]?[jt]s$/ }, async (args) => { - const contents = await fsp.readFile(args.path, 'utf-8') + transform: { + filter: { id: /\.[cm]?[jt]s$/ }, + async handler(code, id) { let injectValues = - `const ${dirnameVarName} = ${JSON.stringify( - path.dirname(args.path), - )};` + - `const ${filenameVarName} = ${JSON.stringify(args.path)};` + + `const ${dirnameVarName} = ${JSON.stringify(path.dirname(id))};` + + `const ${filenameVarName} = ${JSON.stringify(id)};` + `const ${importMetaUrlVarName} = ${JSON.stringify( - pathToFileURL(args.path).href, + pathToFileURL(id).href, )};` - if (contents.includes('import.meta.resolve')) { + if (code.includes('import.meta.resolve')) { if (isESM) { if (!importMetaResolverRegistered) { importMetaResolverRegistered = true @@ -2044,31 +2370,74 @@ async function bundleConfigFile( } let injectedContents: string - if (contents.startsWith('#!')) { + if (code.startsWith('#!')) { // hashbang - let firstLineEndIndex = contents.indexOf('\n') - if (firstLineEndIndex < 0) firstLineEndIndex = contents.length + let firstLineEndIndex = code.indexOf('\n') + if (firstLineEndIndex < 0) firstLineEndIndex = code.length injectedContents = - contents.slice(0, firstLineEndIndex + 1) + + code.slice(0, firstLineEndIndex + 1) + injectValues + - contents.slice(firstLineEndIndex + 1) + code.slice(firstLineEndIndex + 1) } else { - injectedContents = injectValues + contents + injectedContents = injectValues + code } return { - loader: args.path.endsWith('ts') ? 'ts' : 'js', - contents: injectedContents, + code: injectedContents, + map: null, } - }) + }, }, }, ], }) - const { text } = result.outputFiles[0] + const result = await bundle.generate({ + format: isESM ? 'esm' : 'cjs', + sourcemap: 'inline', + sourcemapPathTransform(relative) { + return path.resolve(fileName, relative) + }, + // we want to generate a single chunk like esbuild does with `splitting: false` + inlineDynamicImports: true, + }) + await bundle.close() + + const entryChunk = result.output.find( + (chunk): chunk is OutputChunk => chunk.type === 'chunk' && chunk.isEntry, + )! + const bundleChunks = Object.fromEntries( + result.output.flatMap((c) => (c.type === 'chunk' ? [[c.fileName, c]] : [])), + ) + + const allModules = new Set() + collectAllModules(bundleChunks, entryChunk.fileName, allModules) + return { - code: text, - dependencies: Object.keys(result.metafile.inputs), + code: entryChunk.code, + dependencies: [...allModules], + } +} + +function collectAllModules( + bundle: Record, + fileName: string, + allModules: Set, + analyzedModules = new Set(), +) { + if (analyzedModules.has(fileName)) return + analyzedModules.add(fileName) + + const chunk = bundle[fileName]! + for (const mod of chunk.moduleIds) { + allModules.add(mod) + } + for (const i of chunk.imports) { + analyzedModules.add(i) + collectAllModules(bundle, i, allModules, analyzedModules) + } + for (const i of chunk.dynamicImports) { + analyzedModules.add(i) + collectAllModules(bundle, i, allModules, analyzedModules) } } @@ -2166,6 +2535,12 @@ async function runConfigHook( const handler = getHookHandler(hook) const res = await handler.call(context, conf, configEnv) if (res && res !== conf) { + if (hasBothRollupOptionsAndRolldownOptions(res)) { + context.warn( + `Both \`rollupOptions\` and \`rolldownOptions\` were specified by ${JSON.stringify(p.name)} plugin. ` + + `\`rollupOptions\` specified by that plugin will be ignored.`, + ) + } conf = mergeConfig(conf, res) } } diff --git a/packages/vite/src/node/constants.ts b/packages/vite/src/node/constants.ts index c58dda10f03ad2..0e02ab5eba9bd7 100644 --- a/packages/vite/src/node/constants.ts +++ b/packages/vite/src/node/constants.ts @@ -20,9 +20,9 @@ export const ROLLUP_HOOKS: RollupPluginHooks[] = [ 'footer', 'augmentChunkHash', 'outputOptions', - 'renderDynamicImport', - 'resolveFileUrl', - 'resolveImportMeta', + // 'renderDynamicImport', + // 'resolveFileUrl', + // 'resolveImportMeta', 'intro', 'outro', 'closeBundle', @@ -32,7 +32,7 @@ export const ROLLUP_HOOKS: RollupPluginHooks[] = [ 'watchChange', 'resolveDynamicImport', 'resolveId', - 'shouldTransformCachedModule', + // 'shouldTransformCachedModule', 'transform', 'onLog', ] diff --git a/packages/vite/src/node/environment.ts b/packages/vite/src/node/environment.ts index b1cac275beae13..3a7dc18fec5d33 100644 --- a/packages/vite/src/node/environment.ts +++ b/packages/vite/src/node/environment.ts @@ -1,4 +1,4 @@ -import type { PluginContext } from 'rollup' +import type { PluginContext } from 'rolldown' import type { DevEnvironment } from './server/environment' import type { BuildEnvironment } from './build' import type { ScanEnvironment } from './optimizer/scan' diff --git a/packages/vite/src/node/idResolver.ts b/packages/vite/src/node/idResolver.ts index 7860d568fbf419..6f43238ded87e2 100644 --- a/packages/vite/src/node/idResolver.ts +++ b/packages/vite/src/node/idResolver.ts @@ -1,9 +1,9 @@ -import type { PartialResolvedId } from 'rollup' +import type { PartialResolvedId } from 'rolldown' import aliasPlugin from '@rollup/plugin-alias' import type { ResolvedConfig } from './config' import type { EnvironmentPluginContainer } from './server/pluginContainer' import { createEnvironmentPluginContainer } from './server/pluginContainer' -import { resolvePlugin } from './plugins/resolve' +import { oxcResolvePlugin, resolvePlugin } from './plugins/resolve' import type { InternalResolveOptions } from './plugins/resolve' import type { Environment } from './environment' import type { PartialEnvironment } from './baseEnvironment' @@ -59,18 +59,36 @@ export function createIdResolver( pluginContainer = await createEnvironmentPluginContainer( environment as Environment, [ + // @ts-expect-error the aliasPlugin uses rollup types aliasPlugin({ entries: environment.config.resolve.alias }), - resolvePlugin({ - root: config.root, - isProduction: config.isProduction, - isBuild: config.command === 'build', - asSrc: true, - preferRelative: false, - tryIndex: true, - ...options, - // Ignore sideEffects and other computations as we only need the id - idOnly: true, - }), + ...(config.experimental.enableNativePlugin + ? oxcResolvePlugin( + { + root: config.root, + isProduction: config.isProduction, + isBuild: config.command === 'build', + asSrc: true, + preferRelative: false, + tryIndex: true, + ...options, + // Ignore sideEffects and other computations as we only need the id + idOnly: true, + }, + environment.config, + ) + : [ + resolvePlugin({ + root: config.root, + isProduction: config.isProduction, + isBuild: config.command === 'build', + asSrc: true, + preferRelative: false, + tryIndex: true, + ...options, + // Ignore sideEffects and other computations as we only need the id + idOnly: true, + }), + ]), ], undefined, false, @@ -93,6 +111,7 @@ export function createIdResolver( if (!pluginContainer) { pluginContainer = await createEnvironmentPluginContainer( environment as Environment, + // @ts-expect-error the aliasPlugin uses rollup types [aliasPlugin({ entries: environment.config.resolve.alias })], undefined, false, diff --git a/packages/vite/src/node/index.ts b/packages/vite/src/node/index.ts index 760301c7d0672a..1a38799e752735 100644 --- a/packages/vite/src/node/index.ts +++ b/packages/vite/src/node/index.ts @@ -1,7 +1,28 @@ -import type * as Rollup from 'rollup' +import type * as Rolldown from 'rolldown' +import { + parseAst as _parseAst, + parseAstAsync as _parseAstAsync, +} from 'rolldown/parseAst' +import type * as Rollup from '#types/internal/rollupTypeCompat' + +export type { Rollup, Rolldown } +export { esmExternalRequirePlugin } from 'rolldown/plugins' +export { + parse, + parseSync, + type ParserOptions, + type ParseResult, + minify, + minifySync, + type MinifyOptions, + type MinifyResult, +} from 'rolldown/experimental' + +/** @deprecated - use `parse` instead */ +export const parseAst: typeof _parseAst = _parseAst +/** @deprecated - use `parseAsync` instead */ +export const parseAstAsync: typeof _parseAstAsync = _parseAstAsync -export type { Rollup } -export { parseAst, parseAstAsync } from 'rollup/parseAst' export { defineConfig, loadConfigFromFile, @@ -19,6 +40,7 @@ export { createIdResolver } from './idResolver' export { formatPostcssSourceMap, preprocessCSS } from './plugins/css' export { transformWithEsbuild } from './plugins/esbuild' +export { transformWithOxc } from './plugins/oxc' export { buildErrorMessage } from './server/middlewares/error' export { @@ -58,14 +80,17 @@ export { DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defaultAllowedOrigins, } from './constants' -export { version as esbuildVersion } from 'esbuild' +// NOTE: export for backward compat +export const esbuildVersion = '0.25.0' export { normalizePath, mergeConfig, mergeAlias, createFilter, + withFilter, isCSSRequest, rollupVersion, + rolldownVersion, } from './utils' export { send } from './server/send' export { createLogger } from './logger' @@ -176,8 +201,9 @@ export type { StylusPreprocessorOptions, } from './plugins/css' export type { JsonOptions } from './plugins/json' -export type { TransformOptions as EsbuildTransformOptions } from 'esbuild' -export type { ESBuildOptions, ESBuildTransformResult } from './plugins/esbuild' +export type { ESBuildOptions } from './plugins/esbuild' +export type { EsbuildTransformOptions } from '#types/internal/esbuildOptions' +export type { OxcOptions } from './plugins/oxc' export type { Manifest, ManifestChunk } from './plugins/manifest' export type { ResolveOptions, InternalResolveOptions } from './plugins/resolve' export type { TerserOptions } from './plugins/terser' diff --git a/packages/vite/src/node/internalIndex.ts b/packages/vite/src/node/internalIndex.ts new file mode 100644 index 00000000000000..f5680dd6012d9f --- /dev/null +++ b/packages/vite/src/node/internalIndex.ts @@ -0,0 +1 @@ +export { viteReactRefreshWrapperPlugin as reactRefreshWrapperPlugin } from 'rolldown/experimental' diff --git a/packages/vite/src/node/logger.ts b/packages/vite/src/node/logger.ts index 8bfa027c61fcd2..b55d9351f1df6b 100644 --- a/packages/vite/src/node/logger.ts +++ b/packages/vite/src/node/logger.ts @@ -2,7 +2,7 @@ import readline from 'node:readline' import colors from 'picocolors' -import type { RollupError } from 'rollup' +import type { RollupError } from 'rolldown' import type { ResolvedServerUrls } from './server' export type LogType = 'error' | 'warn' | 'info' diff --git a/packages/vite/src/node/nodeResolve.ts b/packages/vite/src/node/nodeResolve.ts index d1b69b5259d3d4..d221405df354d2 100644 --- a/packages/vite/src/node/nodeResolve.ts +++ b/packages/vite/src/node/nodeResolve.ts @@ -33,6 +33,7 @@ export function nodeResolveWithVite( dedupe: [], extensions: DEFAULT_EXTENSIONS, preserveSymlinks: false, + tsconfigPaths: false, // Intentionally disable package cache for now as consumers don't need it packageCache: undefined, isRequire: options.isRequire, diff --git a/packages/vite/src/node/optimizer/esbuildDepPlugin.ts b/packages/vite/src/node/optimizer/esbuildDepPlugin.ts deleted file mode 100644 index 09e9d84a23dfe0..00000000000000 --- a/packages/vite/src/node/optimizer/esbuildDepPlugin.ts +++ /dev/null @@ -1,345 +0,0 @@ -import path from 'node:path' -import type { ImportKind, Plugin } from 'esbuild' -import { JS_TYPES_RE, KNOWN_ASSET_TYPES } from '../constants' -import type { PackageCache } from '../packages' -import { - escapeRegex, - flattenId, - isBuiltin, - isCSSRequest, - isExternalUrl, - isNodeBuiltin, - moduleListContains, - normalizePath, -} from '../utils' -import { browserExternalId, optionalPeerDepId } from '../plugins/resolve' -import { isModuleCSSRequest } from '../plugins/css' -import type { Environment } from '../environment' -import { createBackCompatIdResolver } from '../idResolver' - -const externalWithConversionNamespace = - 'vite:dep-pre-bundle:external-conversion' -const convertedExternalPrefix = 'vite-dep-pre-bundle-external:' - -const cjsExternalFacadeNamespace = 'vite:cjs-external-facade' -const nonFacadePrefix = 'vite-cjs-external-facade:' - -const externalTypes = [ - 'css', - // supported pre-processor types - 'less', - 'sass', - 'scss', - 'styl', - 'stylus', - 'pcss', - 'postcss', - // wasm - 'wasm', - // known SFC types - 'vue', - 'svelte', - 'marko', - 'astro', - 'imba', - // JSX/TSX may be configured to be compiled differently from how esbuild - // handles it by default, so exclude them as well - 'jsx', - 'tsx', - ...KNOWN_ASSET_TYPES, -] - -export function esbuildDepPlugin( - environment: Environment, - qualified: Record, - external: string[], -): Plugin { - const { isProduction } = environment.config - const { extensions } = environment.config.optimizeDeps - - // remove optimizable extensions from `externalTypes` list - const allExternalTypes = extensions - ? externalTypes.filter((type) => !extensions.includes('.' + type)) - : externalTypes - - // use separate package cache for optimizer as it caches paths around node_modules - // and it's unlikely for the core Vite process to traverse into node_modules again - const esmPackageCache: PackageCache = new Map() - const cjsPackageCache: PackageCache = new Map() - - // default resolver which prefers ESM - const _resolve = createBackCompatIdResolver(environment.getTopLevelConfig(), { - asSrc: false, - scan: true, - packageCache: esmPackageCache, - }) - - // cjs resolver that prefers Node - const _resolveRequire = createBackCompatIdResolver( - environment.getTopLevelConfig(), - { - asSrc: false, - isRequire: true, - scan: true, - packageCache: cjsPackageCache, - }, - ) - - const resolve = ( - id: string, - importer: string, - kind: ImportKind, - resolveDir?: string, - ): Promise => { - let _importer: string - // explicit resolveDir - this is passed only during yarn pnp resolve for - // entries - if (resolveDir) { - _importer = normalizePath(path.join(resolveDir, '*')) - } else { - // map importer ids to file paths for correct resolution - _importer = importer in qualified ? qualified[importer] : importer - } - const resolver = kind.startsWith('require') ? _resolveRequire : _resolve - return resolver(environment, id, _importer) - } - - const resolveResult = (id: string, resolved: string) => { - if (resolved.startsWith(browserExternalId)) { - return { - path: id, - namespace: 'browser-external', - } - } - if (resolved.startsWith(optionalPeerDepId)) { - return { - path: resolved, - namespace: 'optional-peer-dep', - } - } - if (isBuiltin(environment.config.resolve.builtins, resolved)) { - return - } - if (isExternalUrl(resolved)) { - return { - path: resolved, - external: true, - } - } - return { - path: path.resolve(resolved), - } - } - - return { - name: 'vite:dep-pre-bundle', - setup(build) { - // clear package cache when esbuild is finished - build.onEnd(() => { - esmPackageCache.clear() - cjsPackageCache.clear() - }) - - // externalize assets and commonly known non-js file types - // See #8459 for more details about this require-import conversion - build.onResolve( - { - filter: new RegExp( - `\\.(` + allExternalTypes.join('|') + `)(\\?.*)?$`, - ), - }, - async ({ path: id, importer, kind }) => { - // if the prefix exist, it is already converted to `import`, so set `external: true` - if (id.startsWith(convertedExternalPrefix)) { - return { - path: id.slice(convertedExternalPrefix.length), - external: true, - } - } - - const resolved = await resolve(id, importer, kind) - if (resolved) { - // `resolved` can be javascript even when `id` matches `allExternalTypes` - // due to cjs resolution (e.g. require("./test.pdf") for "./test.pdf.js") - // or package name (e.g. import "some-package.pdf") - if (JS_TYPES_RE.test(resolved)) { - return { - path: resolved, - external: false, - } - } - - if (kind === 'require-call') { - // here it is not set to `external: true` to convert `require` to `import` - return { - path: resolved, - namespace: externalWithConversionNamespace, - } - } - return { - path: resolved, - external: true, - } - } - }, - ) - build.onLoad( - { filter: /./, namespace: externalWithConversionNamespace }, - (args) => { - // import itself with prefix (this is the actual part of require-import conversion) - const modulePath = `"${convertedExternalPrefix}${args.path}"` - return { - contents: - isCSSRequest(args.path) && !isModuleCSSRequest(args.path) - ? `import ${modulePath};` - : `export { default } from ${modulePath};` + - `export * from ${modulePath};`, - loader: 'js', - } - }, - ) - - function resolveEntry(id: string) { - const flatId = flattenId(id) - if (flatId in qualified) { - return { - path: qualified[flatId], - } - } - } - - build.onResolve( - { filter: /^[\w@][^:]/ }, - async ({ path: id, importer, kind }) => { - if (moduleListContains(external, id)) { - return { - path: id, - external: true, - } - } - - // ensure esbuild uses our resolved entries - let entry: { path: string } | undefined - // if this is an entry, return entry namespace resolve result - if (!importer) { - if ((entry = resolveEntry(id))) return entry - // check if this is aliased to an entry - also return entry namespace - const aliased = await _resolve(environment, id, undefined, true) - if (aliased && (entry = resolveEntry(aliased))) { - return entry - } - } - - // use vite's own resolver - const resolved = await resolve(id, importer, kind) - if (resolved) { - return resolveResult(id, resolved) - } - }, - ) - - build.onLoad( - { filter: /.*/, namespace: 'browser-external' }, - ({ path }) => { - if (isProduction) { - return { - contents: 'module.exports = {}', - } - } else { - return { - // Return in CJS to intercept named imports. Use `Object.create` to - // create the Proxy in the prototype to workaround esbuild issue. Why? - // - // In short, esbuild cjs->esm flow: - // 1. Create empty object using `Object.create(Object.getPrototypeOf(module.exports))`. - // 2. Assign props of `module.exports` to the object. - // 3. Return object for ESM use. - // - // If we do `module.exports = new Proxy({}, {})`, step 1 returns empty object, - // step 2 does nothing as there's no props for `module.exports`. The final object - // is just an empty object. - // - // Creating the Proxy in the prototype satisfies step 1 immediately, which means - // the returned object is a Proxy that we can intercept. - // - // Note: Skip keys that are accessed by esbuild and browser devtools. - contents: `\ -module.exports = Object.create(new Proxy({}, { - get(_, key) { - if ( - key !== '__esModule' && - key !== '__proto__' && - key !== 'constructor' && - key !== 'splice' - ) { - console.warn(\`Module "${path}" has been externalized for browser compatibility. Cannot access "${path}.\${key}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.\`) - } - } -}))`, - } - } - }, - ) - - build.onLoad( - { filter: /.*/, namespace: 'optional-peer-dep' }, - ({ path }) => { - const [, peerDep, parentDep] = path.split(':') - return { - contents: - 'module.exports = {};' + - `throw new Error(\`Could not resolve "${peerDep}" imported by "${parentDep}".${isProduction ? '' : ' Is it installed?'}\`)`, - } - }, - ) - }, - } -} - -const matchesEntireLine = (text: string) => `^${escapeRegex(text)}$` - -// esbuild doesn't transpile `require('foo')` into `import` statements if 'foo' is externalized -// https://github.com/evanw/esbuild/issues/566#issuecomment-735551834 -export function esbuildCjsExternalPlugin( - externals: string[], - platform: 'node' | 'browser' | 'neutral', -): Plugin { - return { - name: 'cjs-external', - setup(build) { - const filter = new RegExp(externals.map(matchesEntireLine).join('|')) - - build.onResolve({ filter: new RegExp(`^${nonFacadePrefix}`) }, (args) => { - return { - path: args.path.slice(nonFacadePrefix.length), - external: true, - } - }) - - build.onResolve({ filter }, (args) => { - // preserve `require` for node because it's more accurate than converting it to import - if (args.kind === 'require-call' && platform !== 'node') { - return { - path: args.path, - namespace: cjsExternalFacadeNamespace, - } - } - - return { - path: args.path, - external: true, - } - }) - - build.onLoad( - { filter: /.*/, namespace: cjsExternalFacadeNamespace }, - (args) => ({ - contents: `\ -import * as m from ${JSON.stringify(nonFacadePrefix + args.path)}; -module.exports = ${isNodeBuiltin(args.path) ? 'm.default' : '{ ...m }'}; -`, - }), - ) - }, - } -} diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index f58f3870e947e0..9dbb835c069f5f 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -4,12 +4,19 @@ import path from 'node:path' import { promisify } from 'node:util' import { performance } from 'node:perf_hooks' import colors from 'picocolors' -import type { BuildContext, BuildOptions as EsbuildBuildOptions } from 'esbuild' -import esbuild, { build, formatMessages } from 'esbuild' import { init, parse } from 'es-module-lexer' import { isDynamicPattern } from 'tinyglobby' +import { + type RolldownOptions, + type RolldownOutput, + type OutputOptions as RolldownOutputOptions, + rolldown, +} from 'rolldown' +import type { DepsOptimizerEsbuildOptions } from '#types/internal/esbuildOptions' import type { ResolvedConfig } from '../config' import { + arraify, + asyncFlatten, createDebugger, flattenId, getHash, @@ -21,24 +28,23 @@ import { tryStatSync, unique, } from '../utils' -import { - defaultEsbuildSupported, - transformWithEsbuild, -} from '../plugins/esbuild' import { ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, METADATA_FILENAME, } from '../constants' import { isWindows } from '../../shared/utils' import type { Environment } from '../environment' -import { esbuildCjsExternalPlugin, esbuildDepPlugin } from './esbuildDepPlugin' +import { transformWithOxc } from '../plugins/oxc' import { ScanEnvironment, scanImports } from './scan' import { createOptimizeDepsIncludeResolver, expandGlobIds } from './resolve' +import { + rolldownCjsExternalPlugin, + rolldownDepPlugin, +} from './rolldownDepPlugin' const debug = createDebugger('vite:deps') const jsExtensionRE = /\.js$/i -const jsMapExtensionRE = /\.js\.map$/i export type ExportsData = { hasModuleSyntax: boolean @@ -92,20 +98,33 @@ export interface DepOptimizationConfig { * - `plugins` are merged with Vite's dep plugin * * https://esbuild.github.io/api + * + * @deprecated Use `rolldownOptions` instead. + */ + esbuildOptions?: DepsOptimizerEsbuildOptions + /** + * @deprecated Use `rolldownOptions` instead. + */ + rollupOptions?: Omit & { + output?: Omit< + RolldownOutputOptions, + 'format' | 'sourcemap' | 'dir' | 'banner' + > + } + /** + * Options to pass to rolldown during the dep scanning and optimization + * + * Certain options are omitted since changing them would not be compatible + * with Vite's dep optimization. + * + * - `plugins` are merged with Vite's dep plugin */ - esbuildOptions?: Omit< - EsbuildBuildOptions, - | 'bundle' - | 'entryPoints' - | 'external' - | 'write' - | 'watch' - | 'outdir' - | 'outfile' - | 'outbase' - | 'outExtension' - | 'metafile' - > + rolldownOptions?: Omit & { + output?: Omit< + RolldownOutputOptions, + 'format' | 'sourcemap' | 'dir' | 'banner' + > + } /** * List of file extensions that can be optimized. A corresponding esbuild * plugin must exist to handle the specific extension. @@ -203,6 +222,7 @@ export interface OptimizedDepInfo { * data used both to define if interop is needed and when pre-bundling */ exportsData?: Promise + isDynamicEntry?: boolean } export interface DepOptimizationMetadata { @@ -616,7 +636,7 @@ export function runOptimizeDeps( const start = performance.now() - const preparedRun = prepareEsbuildOptimizerRun( + const preparedRun = prepareRolldownOptimizerRun( environment, depsInfo, processingCacheDir, @@ -624,64 +644,49 @@ export function runOptimizeDeps( ) const runResult = preparedRun.then(({ context, idToExports }) => { - function disposeContext() { - return context?.dispose().catch((e) => { - environment.logger.error('Failed to dispose esbuild context', { - error: e, - }) - }) - } if (!context || optimizerContext.cancelled) { - disposeContext() return cancelledResult } return context - .rebuild() + .build() .then((result) => { - const meta = result.metafile! + const depForEntryFileName: Record = {} + for (const dep of Object.values(depsInfo)) { + const entryFileName = flattenId(dep.id) + '.js' + depForEntryFileName[entryFileName] = dep + } - // the paths in `meta.outputs` are relative to `process.cwd()` - const processingCacheDirOutputPath = path.relative( - process.cwd(), - processingCacheDir, - ) + for (const chunk of result.output) { + if (chunk.type !== 'chunk') continue - for (const id in depsInfo) { - const output = esbuildOutputFromId( - meta.outputs, - id, - processingCacheDir, - ) - - const { exportsData, ...info } = depsInfo[id] - addOptimizedDepInfo(metadata, 'optimized', { - ...info, - // We only need to hash the output.imports in to check for stability, but adding the hash - // and file path gives us a unique hash that may be useful for other things in the future - fileHash: getHash( - metadata.hash + - depsInfo[id].file + - JSON.stringify(output.imports), - ), - browserHash: metadata.browserHash, - // After bundling we have more information and can warn the user about legacy packages - // that require manual configuration - needsInterop: needsInterop( - environment, + if (chunk.isEntry) { + const { exportsData, file, id, ...info } = + depForEntryFileName[chunk.fileName] + addOptimizedDepInfo(metadata, 'optimized', { id, - idToExports[id], - output, - ), - }) - } - - for (const o of Object.keys(meta.outputs)) { - if (!jsMapExtensionRE.test(o)) { - const id = path - .relative(processingCacheDirOutputPath, o) - .replace(jsExtensionRE, '') - const file = getOptimizedDepPath(environment, id) + file, + ...info, + // We only need to hash the chunk.imports in to check for stability, but adding the hash + // and file path gives us a unique hash that may be useful for other things in the future + fileHash: getHash( + metadata.hash + file + JSON.stringify(chunk.imports), + ), + browserHash: metadata.browserHash, + // After bundling we have more information and can warn the user about legacy packages + // that require manual configuration + needsInterop: needsInterop( + environment, + id, + idToExports[id], + chunk, + ), + }) + } else { + const id = chunk.fileName.replace(jsExtensionRE, '') + const file = normalizePath( + path.resolve(getDepsCacheDir(environment), chunk.fileName), + ) if ( !findOptimizedDepInfoInRecord( metadata.optimized, @@ -693,27 +698,9 @@ export function runOptimizeDeps( file, needsInterop: false, browserHash: metadata.browserHash, + isDynamicEntry: chunk.isDynamicEntry, }) } - } else { - // workaround Firefox warning by removing blank source map reference - // https://github.com/evanw/esbuild/issues/3945 - const output = meta.outputs[o] - // filter by exact bytes of an empty source map - if (output.bytes === 93) { - const jsMapPath = path.resolve(o) - const jsPath = jsMapPath.slice(0, -4) - if (fs.existsSync(jsPath) && fs.existsSync(jsMapPath)) { - const map = JSON.parse(fs.readFileSync(jsMapPath, 'utf-8')) - if (map.sources.length === 0) { - const js = fs.readFileSync(jsPath, 'utf-8') - fs.writeFileSync( - jsPath, - js.slice(0, js.lastIndexOf('//# sourceMappingURL=')), - ) - } - } - } } } @@ -724,29 +711,18 @@ export function runOptimizeDeps( return successfulResult }) - .catch(async (e) => { + .catch((e) => { if (e.errors && e.message.includes('The build was canceled')) { - // esbuild logs an error when cancelling, but this is expected so + // an error happens when cancelling, but this is expected so // return an empty result instead return cancelledResult } const prependMessage = colors.red( 'Error during dependency optimization:\n\n', ) - if (e.errors) { - const msgs = await formatMessages(e.errors, { - kind: 'error', - color: true, - }) - e.message = prependMessage + msgs.join('\n') - } else { - e.message = prependMessage + e.message - } + e.message = prependMessage + e.message throw e }) - .finally(() => { - return disposeContext() - }) }) runResult.catch(() => { @@ -757,20 +733,20 @@ export function runOptimizeDeps( async cancel() { optimizerContext.cancelled = true const { context } = await preparedRun - await context?.cancel() + context?.cancel() cleanUp() }, result: runResult, } } -async function prepareEsbuildOptimizerRun( +async function prepareRolldownOptimizerRun( environment: Environment, depsInfo: Record, processingCacheDir: string, optimizerContext: { cancelled: boolean }, ): Promise<{ - context?: BuildContext + context?: { build: () => Promise; cancel: () => void } idToExports: Record }> { // esbuild generates nested directory output with lowest common ancestor base @@ -784,21 +760,19 @@ async function prepareEsbuildOptimizerRun( const { optimizeDeps } = environment.config - const { plugins: pluginsFromConfig = [], ...esbuildOptions } = - optimizeDeps.esbuildOptions ?? {} + const { plugins: pluginsFromConfig = [], ...rolldownOptions } = + optimizeDeps.rolldownOptions ?? {} + let jsxLoader = false await Promise.all( Object.keys(depsInfo).map(async (id) => { const src = depsInfo[id].src! const exportsData = await (depsInfo[id].exportsData ?? extractExportsData(environment, src)) - if (exportsData.jsxLoader && !esbuildOptions.loader?.['.js']) { + if (exportsData.jsxLoader) { // Ensure that optimization won't fail by defaulting '.js' to the JSX parser. // This is useful for packages such as Gatsby. - esbuildOptions.loader = { - '.js': 'jsx', - ...esbuildOptions.loader, - } + jsxLoader = true } const flatId = flattenId(id) flatIdDeps[flatId] = src @@ -814,10 +788,11 @@ async function prepareEsbuildOptimizerRun( // as esbuild will replace it automatically when `platform` is `'browser'` 'process.env.NODE_ENV' : JSON.stringify(process.env.NODE_ENV || environment.config.mode), + ...rolldownOptions.transform?.define, } const platform = - optimizeDeps.esbuildOptions?.platform ?? + optimizeDeps.rolldownOptions?.platform ?? // We generally don't want to use platform 'neutral', as esbuild has custom handling // when the platform is 'node' or 'browser' that can't be emulated by using mainFields // and conditions @@ -828,44 +803,57 @@ async function prepareEsbuildOptimizerRun( const external = [...(optimizeDeps.exclude ?? [])] - const plugins = [...pluginsFromConfig] + const plugins = await asyncFlatten(arraify(pluginsFromConfig)) if (external.length) { - plugins.push(esbuildCjsExternalPlugin(external, platform)) + plugins.push(rolldownCjsExternalPlugin(external, platform)) } - plugins.push(esbuildDepPlugin(environment, flatIdDeps, external)) - - const context = await esbuild.context({ - absWorkingDir: process.cwd(), - entryPoints: Object.keys(flatIdDeps), - bundle: true, - platform, - define, - format: 'esm', - // See https://github.com/evanw/esbuild/issues/1921#issuecomment-1152991694 - banner: - platform === 'node' - ? { - js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`, - } - : undefined, - target: ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, - external, - logLevel: 'error', - splitting: true, - sourcemap: true, - outdir: processingCacheDir, - ignoreAnnotations: true, - metafile: true, - plugins, - charset: 'utf8', - legalComments: 'none', - ...esbuildOptions, - supported: { - ...defaultEsbuildSupported, - ...esbuildOptions.supported, - }, - }) - return { context, idToExports } + plugins.push(...rolldownDepPlugin(environment, flatIdDeps, external)) + + let canceled = false + async function build() { + const bundle = await rolldown({ + ...rolldownOptions, + input: flatIdDeps, + logLevel: 'silent', + plugins, + platform, + transform: { + ...rolldownOptions.transform, + target: ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, + define, + }, + resolve: { + extensions: ['.tsx', '.ts', '.jsx', '.js', '.css', '.json'], + ...rolldownOptions.resolve, + }, + // TODO: remove this and enable rolldown's CSS support later + moduleTypes: { + '.css': 'js', + ...rolldownOptions.moduleTypes, + ...(jsxLoader ? { '.js': 'jsx' } : {}), + }, + }) + if (canceled) { + await bundle.close() + throw new Error('The build was canceled') + } + const result = await bundle.write({ + legalComments: 'none', + ...rolldownOptions.output, + format: 'esm', + sourcemap: true, + dir: processingCacheDir, + entryFileNames: '[name].js', + }) + await bundle.close() + return result + } + + function cancel() { + canceled = true + } + + return { context: { build, cancel }, idToExports } } export async function addManuallyIncludedOptimizeDeps( @@ -1062,19 +1050,23 @@ function stringifyDepsOptimizerMetadata( browserHash, optimized: Object.fromEntries( Object.values(optimized).map( - ({ id, src, file, fileHash, needsInterop }) => [ + ({ id, src, file, fileHash, needsInterop, isDynamicEntry }) => [ id, { src, file, fileHash, needsInterop, + isDynamicEntry, }, ], ), ), chunks: Object.fromEntries( - Object.values(chunks).map(({ id, file }) => [id, { file }]), + Object.values(chunks).map(({ id, file, isDynamicEntry }) => [ + id, + { file, isDynamicEntry }, + ]), ), }, (key: string, value: string) => { @@ -1089,29 +1081,6 @@ function stringifyDepsOptimizerMetadata( ) } -function esbuildOutputFromId( - outputs: Record, - id: string, - cacheDirOutputPath: string, -): any { - const cwd = process.cwd() - const flatId = flattenId(id) + '.js' - const normalizedOutputPath = normalizePath( - path.relative(cwd, path.join(cacheDirOutputPath, flatId)), - ) - const output = outputs[normalizedOutputPath] - if (output) { - return output - } - // If the root dir was symlinked, esbuild could return output keys as `../cwd/` - // Normalize keys to support this case too - for (const [key, value] of Object.entries(outputs)) { - if (normalizePath(path.relative(cwd, key)) === normalizedOutputPath) { - return value - } - } -} - export async function extractExportsData( environment: Environment, filePath: string, @@ -1120,18 +1089,38 @@ export async function extractExportsData( const { optimizeDeps } = environment.config - const esbuildOptions = optimizeDeps.esbuildOptions ?? {} + const rolldownOptions = optimizeDeps.rolldownOptions ?? {} if (optimizeDeps.extensions?.some((ext) => filePath.endsWith(ext))) { // For custom supported extensions, build the entry file to transform it into JS, // and then parse with es-module-lexer. Note that the `bundle` option is not `true`, // so only the entry file is being transformed. - const result = await build({ - ...esbuildOptions, - entryPoints: [filePath], - write: false, + const { plugins: pluginsFromConfig = [], ...remainingRolldownOptions } = + rolldownOptions + const plugins = await asyncFlatten(arraify(pluginsFromConfig)) + plugins.unshift({ + name: 'externalize', + resolveId(id, importer) { + if (importer !== undefined) { + return { id, external: true } + } + }, + }) + const build = await rolldown({ + ...remainingRolldownOptions, + plugins, + input: [filePath], + // TODO: remove this and enable rolldown's CSS support later + moduleTypes: { + '.css': 'js', + ...remainingRolldownOptions.moduleTypes, + }, + }) + const result = await build.generate({ + ...rolldownOptions.output, format: 'esm', + sourcemap: false, }) - const [, exports, , hasModuleSyntax] = parse(result.outputFiles[0].text) + const [, exports, , hasModuleSyntax] = parse(result.output[0].code) return { hasModuleSyntax, exports: exports.map((e) => e.n), @@ -1141,18 +1130,21 @@ export async function extractExportsData( let parseResult: ReturnType let usedJsxLoader = false - const entryContent = await fsp.readFile(filePath, 'utf-8') + const entryContent = fs.readFileSync(filePath, 'utf-8') try { parseResult = parse(entryContent) } catch { - const loader = esbuildOptions.loader?.[path.extname(filePath)] || 'jsx' + const lang = rolldownOptions.moduleTypes?.[path.extname(filePath)] || 'jsx' debug?.( - `Unable to parse: ${filePath}.\n Trying again with a ${loader} transform.`, + `Unable to parse: ${filePath}.\n Trying again with a ${lang} transform.`, ) - const transformed = await transformWithEsbuild( + if (lang !== 'jsx' && lang !== 'tsx' && lang !== 'ts') { + throw new Error(`Unable to parse : ${filePath}.`) + } + const transformed = await transformWithOxc( entryContent, filePath, - { loader }, + { lang }, undefined, environment.config, ) @@ -1282,11 +1274,19 @@ function getConfigHash(environment: Environment): string { exclude: optimizeDeps.exclude ? unique(optimizeDeps.exclude).sort() : undefined, - esbuildOptions: { - ...optimizeDeps.esbuildOptions, - plugins: optimizeDeps.esbuildOptions?.plugins?.map((p) => p.name), + rolldownOptions: { + ...optimizeDeps.rolldownOptions, + plugins: undefined, // included in optimizeDepsPluginNames + onLog: undefined, + onwarn: undefined, + checks: undefined, + output: { + ...optimizeDeps.rolldownOptions?.output, + plugins: undefined, // included in optimizeDepsPluginNames + }, }, }, + optimizeDepsPluginNames: config.optimizeDepsPluginNames, }, (_, value) => { if (typeof value === 'function' || value instanceof RegExp) { diff --git a/packages/vite/src/node/optimizer/pluginConverter.ts b/packages/vite/src/node/optimizer/pluginConverter.ts new file mode 100644 index 00000000000000..0fc1e3f7e32281 --- /dev/null +++ b/packages/vite/src/node/optimizer/pluginConverter.ts @@ -0,0 +1,311 @@ +import { dirname } from 'node:path' +import type * as esbuild from 'esbuild' +import type { + ImportKind, + LoadResult, + PartialResolvedId, + PluginContext, + ResolveIdResult, + Plugin as RolldownPlugin, + RolldownPluginOption, +} from 'rolldown' + +type MaybePromise = T | Promise +type EsbuildOnResolveCallback = ( + args: esbuild.OnResolveArgs, +) => MaybePromise +type EsbuildOnLoadCallback = ( + args: esbuild.OnLoadArgs, +) => MaybePromise +type ResolveIdHandler = ( + this: PluginContext, + id: string, + importer: string | undefined, + opts: { kind: ImportKind }, +) => MaybePromise< + | (PartialResolvedId & { namespace?: string }) + | Exclude +> +type LoadHandler = (this: PluginContext, id: string) => MaybePromise + +export function convertEsbuildPluginToRolldownPlugin( + esbuildPlugin: esbuild.Plugin, +): RolldownPlugin { + const onStartCallbacks: Array<() => void> = [] + const onEndCallbacks: Array<(buildResult: esbuild.BuildResult) => void> = [] + const onDisposeCallbacks: Array<() => void> = [] + let resolveIdHandlers: ResolveIdHandler[] + let loadHandlers: LoadHandler[] + + let isSetupDone = false + const setup = async ( + plugins: RolldownPluginOption[], + platform: 'browser' | 'node' | 'neutral', + ) => { + const onResolveCallbacks: Array< + [options: esbuild.OnResolveOptions, callback: EsbuildOnResolveCallback] + > = [] + const onLoadCallbacks: Array< + [options: esbuild.OnLoadOptions, callback: EsbuildOnLoadCallback] + > = [] + + const pluginBuild: esbuild.PluginBuild = { + initialOptions: new Proxy( + { + platform, + plugins: + plugins?.flatMap((p) => + p && 'name' in p + ? [ + { + name: p.name, + // eslint-disable-next-line @typescript-eslint/no-empty-function + setup() {}, + }, + ] + : [], + ) ?? [], + }, + { + get(target, p, _receiver) { + if (p in target) return (target as any)[p] + throw new Error('Not implemented') + }, + }, + ) as esbuild.BuildOptions, + resolve() { + throw new Error('Not implemented') + }, + onStart(callback) { + onStartCallbacks.push(callback) + }, + onEnd(callback) { + onEndCallbacks.push(callback) + }, + onResolve(options, callback) { + onResolveCallbacks.push([options, callback]) + }, + onLoad(options, callback) { + onLoadCallbacks.push([options, callback]) + }, + onDispose(callback) { + onDisposeCallbacks.push(callback) + }, + get esbuild(): esbuild.PluginBuild['esbuild'] { + throw new Error('Not implemented') + }, + set esbuild(_: unknown) { + throw new Error('Not implemented') + }, + } + + await esbuildPlugin.setup(pluginBuild) + + resolveIdHandlers = onResolveCallbacks.map(([options, callback]) => + createResolveIdHandler(options, callback), + ) + loadHandlers = onLoadCallbacks.map(([options, callback]) => + createLoadHandler(options, callback), + ) + isSetupDone = true + } + + const usedNamespaces = new Set() + return { + name: esbuildPlugin.name, + async options(inputOptions) { + await setup( + inputOptions.plugins as RolldownPluginOption[], + inputOptions.platform ?? 'node', + ) + }, + async buildStart(inputOptions) { + // options hook is not called for scanner + if (!isSetupDone) { + // inputOptions.plugins is not available for buildStart hook + // put a dummy plugin to tell that this is a scan + await setup( + [{ name: 'vite:dep-scan' }], + inputOptions.platform ?? 'node', + ) + } + + for (const cb of onStartCallbacks) { + cb() + } + }, + generateBundle() { + const buildResult = new Proxy( + {}, + { + get(_target, _prop) { + throw new Error('Not implemented') + }, + }, + ) as esbuild.BuildResult + for (const cb of onEndCallbacks) { + cb(buildResult) + } + }, + async resolveId(id, importer, opts) { + for (const handler of resolveIdHandlers) { + const result = await handler.call(this, id, importer, opts) + if (result) { + if (typeof result === 'object' && result.namespace) { + usedNamespaces.add(result.namespace) + } + return result + } + } + if (usedNamespaces.size) { + const [importerWithoutNamespace, namespaceFromImporter] = + idToPathAndNamespace(importer) + if (usedNamespaces.has(namespaceFromImporter)) { + return await this.resolve(id, importerWithoutNamespace, opts) + } + } + }, + async load(id) { + for (const handler of loadHandlers) { + const result = await handler.call(this, id) + if (result) { + return result + } + } + }, + closeBundle() { + if (!this.meta.watchMode) { + for (const cb of onDisposeCallbacks) { + cb() + } + } + }, + closeWatcher() { + for (const cb of onDisposeCallbacks) { + cb() + } + }, + } +} + +function createResolveIdHandler( + options: esbuild.OnResolveOptions, + callback: EsbuildOnResolveCallback, +): ResolveIdHandler { + return async function (id, importer, opts) { + const [importerWithoutNamespace, importerNamespace] = + idToPathAndNamespace(importer) + if ( + options.namespace !== undefined && + options.namespace !== importerNamespace + ) { + return + } + if (options.filter !== undefined && !options.filter.test(id)) { + return + } + + const result = await callback({ + path: id, + importer: importerWithoutNamespace ?? '', + namespace: importerNamespace, + resolveDir: dirname(importerWithoutNamespace ?? ''), + kind: + importerWithoutNamespace === undefined + ? 'entry-point' + : opts.kind === 'new-url' || opts.kind === 'hot-accept' + ? 'dynamic-import' + : opts.kind, + pluginData: {}, + with: {}, + }) + if (!result) return + if (result.errors && result.errors.length > 0) { + throw new AggregateError(result.errors) + } + if ( + (result.warnings && result.warnings.length > 0) || + (result.watchDirs && result.watchDirs.length > 0) || + !result.path + ) { + throw new Error('not implemented') + } + for (const file of result.watchFiles ?? []) { + this.addWatchFile(file) + } + + return { + id: result.namespace ? `${result.namespace}:${result.path}` : result.path, + external: result.external, + moduleSideEffects: result.sideEffects, + namespace: result.namespace, + } + } +} + +function createLoadHandler( + options: esbuild.OnLoadOptions, + callback: EsbuildOnLoadCallback, +): LoadHandler { + const textDecoder = new TextDecoder() + return async function (id) { + const [idWithoutNamespace, idNamespace] = idToPathAndNamespace(id) + if ( + options.namespace !== undefined && + options.namespace !== 'file' && + options.namespace !== idNamespace + ) { + return + } + if (options.filter !== undefined && !options.filter.test(id)) { + return + } + + const result = await callback.call(this, { + path: idWithoutNamespace, + namespace: idNamespace, + suffix: '', + pluginData: {}, + with: {}, + }) + if (!result) return + if (result.errors && result.errors.length > 0) { + throw new AggregateError(result.errors) + } + if ( + (result.warnings && result.warnings.length > 0) || + (result.watchDirs && result.watchDirs.length > 0) || + result.contents == null + ) { + throw new Error('not implemented') + } + for (const file of result.watchFiles ?? []) { + this.addWatchFile(file) + } + + return { + code: + typeof result.contents === 'string' + ? result.contents + : textDecoder.decode(result.contents), + moduleType: result.loader, + } + } +} + +function idToPathAndNamespace(id: string): [path: string, namespace: string] +function idToPathAndNamespace( + id: string | undefined, +): [path: string | undefined, namespace: string] +function idToPathAndNamespace( + id: string | undefined, +): [path: string | undefined, namespace: string] { + if (id === undefined) return [undefined, 'file'] + + const namespaceIndex = id.indexOf(':') + if (namespaceIndex >= 0) { + return [id.slice(namespaceIndex + 1), id.slice(0, namespaceIndex)] + } else { + return [id, 'file'] + } +} diff --git a/packages/vite/src/node/optimizer/rolldownDepPlugin.ts b/packages/vite/src/node/optimizer/rolldownDepPlugin.ts new file mode 100644 index 00000000000000..12f76bed986c96 --- /dev/null +++ b/packages/vite/src/node/optimizer/rolldownDepPlugin.ts @@ -0,0 +1,366 @@ +import path from 'node:path' +import type { ImportKind, Plugin, RolldownPlugin } from 'rolldown' +import { prefixRegex } from '@rolldown/pluginutils' +import { JS_TYPES_RE, KNOWN_ASSET_TYPES } from '../constants' +import type { PackageCache } from '../packages' +import { + escapeRegex, + flattenId, + isBuiltin, + isCSSRequest, + isExternalUrl, + isNodeBuiltin, + moduleListContains, + normalizePath, +} from '../utils' +import { browserExternalId, optionalPeerDepId } from '../plugins/resolve' +import { isModuleCSSRequest } from '../plugins/css' +import type { Environment } from '../environment' +import { createBackCompatIdResolver } from '../idResolver' +import { isWindows } from '../../shared/utils' + +const externalWithConversionNamespace = + 'vite:dep-pre-bundle:external-conversion' +const convertedExternalPrefix = 'vite-dep-pre-bundle-external:' + +const cjsExternalFacadeNamespace = 'vite:cjs-external-facade' +const nonFacadePrefix = 'vite-cjs-external-facade:' + +const externalTypes = [ + 'css', + // supported pre-processor types + 'less', + 'sass', + 'scss', + 'styl', + 'stylus', + 'pcss', + 'postcss', + // wasm + 'wasm', + // known SFC types + 'vue', + 'svelte', + 'marko', + 'astro', + 'imba', + // JSX/TSX may be configured to be compiled differently from how esbuild + // handles it by default, so exclude them as well + 'jsx', + 'tsx', + ...KNOWN_ASSET_TYPES, +] + +const optionalPeerDepNamespace = 'optional-peer-dep:' +const browserExternalNamespace = 'browser-external:' + +export function rolldownDepPlugin( + environment: Environment, + qualified: Record, + external: string[], +): RolldownPlugin[] { + const { isProduction } = environment.config + const { extensions } = environment.config.optimizeDeps + + // remove optimizable extensions from `externalTypes` list + const allExternalTypes = extensions + ? externalTypes.filter((type) => !extensions.includes('.' + type)) + : externalTypes + + // use separate package cache for optimizer as it caches paths around node_modules + // and it's unlikely for the core Vite process to traverse into node_modules again + const esmPackageCache: PackageCache = new Map() + const cjsPackageCache: PackageCache = new Map() + + // default resolver which prefers ESM + const _resolve = createBackCompatIdResolver(environment.getTopLevelConfig(), { + asSrc: false, + scan: true, + packageCache: esmPackageCache, + }) + + // cjs resolver that prefers Node + const _resolveRequire = createBackCompatIdResolver( + environment.getTopLevelConfig(), + { + asSrc: false, + isRequire: true, + scan: true, + packageCache: cjsPackageCache, + }, + ) + + const resolve = ( + id: string, + importer: string | undefined, + kind: ImportKind, + resolveDir?: string, + ): Promise => { + let _importer: string | undefined + // explicit resolveDir - this is passed only during yarn pnp resolve for + // entries + if (resolveDir) { + _importer = normalizePath(path.join(resolveDir, '*')) + } else if (importer) { + // map importer ids to file paths for correct resolution + _importer = importer in qualified ? qualified[importer] : importer + } + const resolver = kind.startsWith('require') ? _resolveRequire : _resolve + return resolver(environment, id, _importer) + } + + const resolveResult = (id: string, resolved: string) => { + if (resolved.startsWith(browserExternalId)) { + return { + id: browserExternalNamespace + id, + } + } + if (resolved.startsWith(optionalPeerDepId)) { + return { + id: optionalPeerDepNamespace + resolved, + } + } + if (isBuiltin(environment.config.resolve.builtins, resolved)) { + return + } + if (isExternalUrl(resolved)) { + return { + id: resolved, + external: 'absolute', + } + } + return { + id: path.resolve(resolved), + } + } + + const allExternalTypesReg = new RegExp( + `\\.(` + allExternalTypes.join('|') + `)(\\?.*)?$`, + ) + + function resolveEntry(id: string) { + const flatId = flattenId(id) + if (flatId in qualified) { + return { + id: qualified[flatId], + } + } + } + + return [ + { + name: 'vite:dep-pre-bundle-assets', + // externalize assets and commonly known non-js file types + // See #8459 for more details about this require-import conversion + resolveId: { + filter: { id: allExternalTypesReg }, + async handler(id, importer, options) { + const kind = options.kind + // if the prefix exist, it is already converted to `import`, so set `external: true` + if (id.startsWith(convertedExternalPrefix)) { + return { + id: id.slice(convertedExternalPrefix.length), + external: 'absolute', + } + } + + const resolved = await resolve(id, importer, kind) + if (resolved) { + // `resolved` can be javascript even when `id` matches `allExternalTypes` + // due to cjs resolution (e.g. require("./test.pdf") for "./test.pdf.js") + // or package name (e.g. import "some-package.pdf") + if (JS_TYPES_RE.test(resolved)) { + return { + // normalize to \\ on windows for esbuild/rolldown behavior difference: https://github.com/sapphi-red-repros/rolldown-esbuild-path-normalization + id: isWindows ? resolved.replaceAll('/', '\\') : resolved, + external: false, + } + } + + if (kind === 'require-call') { + // here it is not set to `external: true` to convert `require` to `import` + return { + id: externalWithConversionNamespace + resolved, + } + } + return { + id: resolved, + external: 'absolute', + } + } + }, + }, + load: { + filter: { + id: prefixRegex(externalWithConversionNamespace), + }, + handler(id) { + const path = id.slice(externalWithConversionNamespace.length) + // import itself with prefix (this is the actual part of require-import conversion) + const modulePath = `"${convertedExternalPrefix}${path}"` + return { + code: + isCSSRequest(path) && !isModuleCSSRequest(path) + ? `import ${modulePath};` + : `export { default } from ${modulePath};` + + `export * from ${modulePath};`, + } + }, + }, + }, + { + name: 'vite:dep-pre-bundle', + // clear package cache when build is finished + buildEnd() { + esmPackageCache.clear() + cjsPackageCache.clear() + }, + resolveId: { + filter: { id: /^[\w@][^:]/ }, + async handler(id, importer, options) { + const kind = options.kind + + if (moduleListContains(external, id)) { + return { + id: id, + external: 'absolute', + } + } + + // ensure rolldown uses our resolved entries + let entry: { id: string } | undefined + // if this is an entry, return entry namespace resolve result + if (!importer) { + if ((entry = resolveEntry(id))) return entry + // check if this is aliased to an entry - also return entry namespace + const aliased = await _resolve(environment, id, undefined, true) + if (aliased && (entry = resolveEntry(aliased))) { + return entry + } + } + + // use vite's own resolver + const resolved = await resolve(id, importer, kind) + if (resolved) { + return resolveResult(id, resolved) + } + }, + }, + load: { + filter: { + id: [ + prefixRegex(browserExternalNamespace), + prefixRegex(optionalPeerDepNamespace), + ], + }, + handler(id) { + if (id.startsWith(browserExternalNamespace)) { + const path = id.slice(browserExternalNamespace.length) + if (isProduction) { + return { + code: 'module.exports = {}', + } + } else { + return { + // Return in CJS to intercept named imports. Use `Object.create` to + // create the Proxy in the prototype to workaround esbuild issue. Why? + // + // In short, esbuild cjs->esm flow: + // 1. Create empty object using `Object.create(Object.getPrototypeOf(module.exports))`. + // 2. Assign props of `module.exports` to the object. + // 3. Return object for ESM use. + // + // If we do `module.exports = new Proxy({}, {})`, step 1 returns empty object, + // step 2 does nothing as there's no props for `module.exports`. The final object + // is just an empty object. + // + // Creating the Proxy in the prototype satisfies step 1 immediately, which means + // the returned object is a Proxy that we can intercept. + // + // Note: Skip keys that are accessed by esbuild and browser devtools. + code: `\ + module.exports = Object.create(new Proxy({}, { + get(_, key) { + if ( + key !== '__esModule' && + key !== '__proto__' && + key !== 'constructor' && + key !== 'splice' + ) { + console.warn(\`Module "${path}" has been externalized for browser compatibility. Cannot access "${path}.\${key}" in client code. See http://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.\`) + } + } + }))`, + } + } + } + + if (id.startsWith(optionalPeerDepNamespace)) { + const path = id.slice(optionalPeerDepNamespace.length) + const [, peerDep, parentDep] = path.split(':') + return { + code: + 'module.exports = {};' + + `throw new Error(\`Could not resolve "${peerDep}" imported by "${parentDep}". Is it installed?\`)`, + } + } + }, + }, + }, + ] +} + +const matchesEntireLine = (text: string) => `^${escapeRegex(text)}$` + +// rolldown (and esbuild) doesn't transpile `require('foo')` into `import` statements if 'foo' is externalized +// https://github.com/evanw/esbuild/issues/566#issuecomment-735551834 +export function rolldownCjsExternalPlugin( + externals: string[], + platform: 'node' | 'browser' | 'neutral', +): Plugin { + const filter = new RegExp(externals.map(matchesEntireLine).join('|')) + + return { + name: 'cjs-external', + resolveId: { + filter: { id: [prefixRegex(nonFacadePrefix), filter] }, + handler(id, _importer, options) { + if (id.startsWith(nonFacadePrefix)) { + return { + id: id.slice(nonFacadePrefix.length), + external: 'absolute', + } + } + + if (filter.test(id)) { + const kind = options.kind + // preserve `require` for node because it's more accurate than converting it to import + if (kind === 'require-call' && platform !== 'node') { + return { + id: cjsExternalFacadeNamespace + id, + } + } + + return { + id, + external: 'absolute', + } + } + }, + }, + load: { + filter: { id: prefixRegex(cjsExternalFacadeNamespace) }, + handler(id) { + if (id.startsWith(cjsExternalFacadeNamespace)) { + const idWithoutNamespace = id.slice(cjsExternalFacadeNamespace.length) + return { + code: `\ +import * as m from ${JSON.stringify(nonFacadePrefix + idWithoutNamespace)}; +module.exports = ${isNodeBuiltin(idWithoutNamespace) ? 'm.default' : '{ ...m }'}; +`, + } + } + }, + }, + } +} diff --git a/packages/vite/src/node/optimizer/scan.ts b/packages/vite/src/node/optimizer/scan.ts index 02d7e94b4a228e..59df4e909fb413 100644 --- a/packages/vite/src/node/optimizer/scan.ts +++ b/packages/vite/src/node/optimizer/scan.ts @@ -2,15 +2,8 @@ import fs from 'node:fs' import fsp from 'node:fs/promises' import path from 'node:path' import { performance } from 'node:perf_hooks' -import type { - BuildContext, - Loader, - OnLoadArgs, - OnLoadResult, - Plugin, -} from 'esbuild' -import esbuild, { formatMessages, transform } from 'esbuild' -import type { PartialResolvedId } from 'rollup' +import { scan, transformSync } from 'rolldown/experimental' +import type { PartialResolvedId, Plugin } from 'rolldown' import colors from 'picocolors' import { glob } from 'tinyglobby' import { @@ -21,8 +14,10 @@ import { } from '../constants' import { arraify, + asyncFlatten, createDebugger, dataUrlRE, + deepClone, externalRE, isInNodeModules, isObject, @@ -41,6 +36,7 @@ import type { DevEnvironment } from '../server/environment' import { transformGlobImport } from '../plugins/importMetaGlob' import { cleanUrl } from '../../shared/utils' import { loadTsconfigJsonForFile } from '../plugins/esbuild' +import { setOxcTransformOptionsFromTsconfigOptions } from '../plugins/oxc' export class ScanEnvironment extends BaseEnvironment { mode = 'scan' as const @@ -100,7 +96,7 @@ export function devToScanEnvironment( const debug = createDebugger('vite:deps') -const htmlTypesRE = /\.(html|vue|svelte|astro|imba)$/ +const htmlTypesRE = /\.(?:html|vue|svelte|astro|imba)$/ // A simple regex to detect import sources. This is only used on // - - - diff --git a/playground/amd/vite.config.ts b/playground/amd/vite.config.ts deleted file mode 100644 index 0715c829cab499..00000000000000 --- a/playground/amd/vite.config.ts +++ /dev/null @@ -1,53 +0,0 @@ -import fs from 'node:fs/promises' -import path from 'node:path' -import { type Connect, defineConfig } from 'vite' - -export default defineConfig({ - base: './', - build: { - outDir: 'dist/nested', - rollupOptions: { - preserveEntrySignatures: 'strict', - input: { - plugin: path.resolve(import.meta.dirname, './index.ts'), - }, - output: { - format: 'amd', - entryFileNames: 'assets/[name].js', - }, - }, - }, - plugins: [ - { - name: 'serve-npm-code-directly', - configureServer({ middlewares }) { - middlewares.use(serveNpmCodeDirectlyMiddleware) - }, - configurePreviewServer({ middlewares }) { - middlewares.use(serveNpmCodeDirectlyMiddleware) - }, - }, - ], - appType: 'mpa', // to cause 404 for incorrect URLs -}) - -const npmDirectServeConfig = { - '/npm/requirejs.js': 'requirejs/require.js', -} -const serveNpmCodeDirectlyMiddleware: Connect.NextHandleFunction = async ( - req, - res, - next, -) => { - for (const [url, file] of Object.entries(npmDirectServeConfig)) { - if (req.originalUrl === url) { - const code = await fs.readFile( - new URL(`./node_modules/${file}`, import.meta.url), - ) - res.setHeader('Content-Type', 'text/javascript') - res.end(code) - return - } - } - next() -} diff --git a/playground/assets/index.html b/playground/assets/index.html index 6d2af8675452c8..6b6eac7f2df73b 100644 --- a/playground/assets/index.html +++ b/playground/assets/index.html @@ -648,9 +648,10 @@

assets in template

import someString from './static/foo.txt?raw' document.querySelector('.raw-query').textContent = someString + // NOTE: add `'' +` to opt-out rolldown's transform: https://github.com/rolldown/rolldown/issues/2745 const metaUrlNonExistent = new URL( /* @vite-ignore */ 'non-existent', - import.meta.url, + '' + import.meta.url, ).pathname text('.non-existent-import-meta-url', metaUrlNonExistent) diff --git a/playground/assets/vite.config-relative-base.js b/playground/assets/vite.config-relative-base.js index 1e25168e1c0aff..dabaedb26136b3 100644 --- a/playground/assets/vite.config-relative-base.js +++ b/playground/assets/vite.config-relative-base.js @@ -15,11 +15,11 @@ export default defineConfig(({ isPreview }) => ({ entryFileNames: 'entries/[name].js', chunkFileNames: 'chunks/[name]-[hash].js', assetFileNames: 'other-assets/[name]-[hash][extname]', - manualChunks(id) { - if (id.includes('css/manual-chunks.css')) { - return 'css/manual-chunks' - } - }, + // manualChunks(id) { + // if (id.includes('css/manual-chunks.css')) { + // return 'css/manual-chunks' + // } + // }, }, }, }, diff --git a/playground/css-codesplit-cjs/__tests__/css-codesplit-cjs.spec.ts b/playground/css-codesplit-cjs/__tests__/css-codesplit-cjs.spec.ts index ced1f904bd2f49..9efe9d2ef5a543 100644 --- a/playground/css-codesplit-cjs/__tests__/css-codesplit-cjs.spec.ts +++ b/playground/css-codesplit-cjs/__tests__/css-codesplit-cjs.spec.ts @@ -1,12 +1,12 @@ import { describe, expect, test } from 'vitest' import { findAssetFile, getColor, isBuild, readManifest } from '~utils' -test('should load both stylesheets', async () => { +test.skip('should load both stylesheets', async () => { expect(await getColor('h1')).toBe('red') expect(await getColor('h2')).toBe('blue') }) -describe.runIf(isBuild)('build', () => { +describe.runIf(isBuild).skip('build', () => { test('should remove empty chunk', async () => { expect(findAssetFile(/style.*\.js$/)).toBeUndefined() expect(findAssetFile('main.*.js$')).toMatch(`/* empty css`) diff --git a/playground/css-codesplit-cjs/vite.config.js b/playground/css-codesplit-cjs/vite.config.js index d1353babe8336e..0c8a0cbf562a4b 100644 --- a/playground/css-codesplit-cjs/vite.config.js +++ b/playground/css-codesplit-cjs/vite.config.js @@ -13,7 +13,7 @@ export default defineConfig({ treeshake: false, output: { format: 'cjs', - freeze: false, + // freeze: false, externalLiveBindings: false, }, }, diff --git a/playground/css-codesplit/__tests__/css-codesplit-consistent.spec.ts b/playground/css-codesplit/__tests__/css-codesplit-consistent.spec.ts index fb4f743df5f5bb..9b112e2f1548fa 100644 --- a/playground/css-codesplit/__tests__/css-codesplit-consistent.spec.ts +++ b/playground/css-codesplit/__tests__/css-codesplit-consistent.spec.ts @@ -8,8 +8,8 @@ beforeEach(async () => { for (let i = 0; i < 5; i++) { describe.runIf(isBuild)('css-codesplit build', () => { test('should be consistent with same content', () => { - expect(findAssetFile(/style-.+\.css/)).toMatch('h2{color:#00f}') - expect(findAssetFile(/style2-.+\.css/)).toBeUndefined() + expect(findAssetFile(/style-.+\.css/)).toBeUndefined() + expect(findAssetFile(/style2-.+\.css/)).toMatch('h2{color:#00f}') }) }) } diff --git a/playground/css-codesplit/__tests__/css-codesplit.spec.ts b/playground/css-codesplit/__tests__/css-codesplit.spec.ts index b22156a4ffcda1..904da085bb569d 100644 --- a/playground/css-codesplit/__tests__/css-codesplit.spec.ts +++ b/playground/css-codesplit/__tests__/css-codesplit.spec.ts @@ -54,7 +54,7 @@ describe.runIf(isBuild)('build', () => { expect(sharedCSSWithJSChunk).toMatch(`/* empty css`) // there are functions and modules in the src code that should be tree-shaken expect(sharedCSSWithJSChunk).not.toMatch('function') - expect(sharedCSSWithJSChunk).not.toMatch(/import(?!".\/modulepreload)/) + expect(sharedCSSWithJSChunk).not.toMatch(/import(?!\s*".\/modulepreload)/) }) test('should generate correct manifest', async () => { diff --git a/playground/css-codesplit/vite.config.js b/playground/css-codesplit/vite.config.js index 5042b6d9b9cab7..0d3d006e4dda7f 100644 --- a/playground/css-codesplit/vite.config.js +++ b/playground/css-codesplit/vite.config.js @@ -13,11 +13,20 @@ export default defineConfig({ 'shared-css-no-js': resolve(__dirname, 'shared-css-no-js.html'), }, output: { - manualChunks(id) { - // make `chunk.css` it's own chunk for easier testing of pure css chunks - if (id.includes('chunk.css')) { - return 'chunk' - } + // manualChunks(id) { + // // make `chunk.css` it's own chunk for easier testing of pure css chunks + // if (id.includes('chunk.css')) { + // return 'chunk' + // } + // }, + advancedChunks: { + groups: [ + // make `chunk.css` it's own chunk for easier testing of pure css chunks + { + name: 'chunk', + test: 'chunk.css', + }, + ], }, }, }, diff --git a/playground/css/__tests__/tests.ts b/playground/css/__tests__/tests.ts index 68ff600a39c002..a41bc4183bb2d1 100644 --- a/playground/css/__tests__/tests.ts +++ b/playground/css/__tests__/tests.ts @@ -516,7 +516,8 @@ export const tests = (isLightningCSS: boolean) => { expect(await getColor('.at-import-scss')).toBe('red') }) - test.runIf(isBuild)('manual chunk path', async () => { + // TODO: skipped because of https://github.com/rolldown/rolldown/issues/7315 + test.runIf(isBuild).skip('manual chunk path', async () => { // assert that the manual-chunk css is output in the directory specified in manualChunk (#12072) expect( findAssetFile( diff --git a/playground/dynamic-import/__tests__/dynamic-import.spec.ts b/playground/dynamic-import/__tests__/dynamic-import.spec.ts index c9dcc560bbe73e..384f4190295f46 100644 --- a/playground/dynamic-import/__tests__/dynamic-import.spec.ts +++ b/playground/dynamic-import/__tests__/dynamic-import.spec.ts @@ -145,6 +145,8 @@ test('should work a load path that contains parentheses.', async () => { test.runIf(isBuild)( 'should rollup warn when static and dynamic import a module in same chunk', + // NOTE: this is a warning related to rollup's chunking behavior + { skip: true }, async () => { const log = serverLogs.join('\n') expect(log).toContain( diff --git a/playground/environment-react-ssr/vite.config.ts b/playground/environment-react-ssr/vite.config.ts index f4b06cc803105f..7803dc15ae9016 100644 --- a/playground/environment-react-ssr/vite.config.ts +++ b/playground/environment-react-ssr/vite.config.ts @@ -37,6 +37,12 @@ export default defineConfig((env) => ({ sourcemap: true, outDir: 'dist/client', }, + optimizeDeps: { + rolldownOptions: { + // manual test for https://github.com/vitejs/rolldown-vite/issues/416 + transform: {}, + }, + }, }, ssr: { optimizeDeps: { diff --git a/playground/external/src/main.js b/playground/external/src/main.js index 46d97cebd47915..db3f5b3ac58c7c 100644 --- a/playground/external/src/main.js +++ b/playground/external/src/main.js @@ -1,2 +1,3 @@ +import './require-polyfill' import '@vitejs/test-dep-that-imports' import '@vitejs/test-dep-that-requires' diff --git a/playground/external/src/require-polyfill.js b/playground/external/src/require-polyfill.js new file mode 100644 index 00000000000000..ded978f98ab108 --- /dev/null +++ b/playground/external/src/require-polyfill.js @@ -0,0 +1,8 @@ +import * as vue from 'vue' +import slash3 from 'slash3' + +export default (id) => { + if (id === 'vue') return vue + if (id === 'slash3') return slash3 + throw new Error(`Cannot require "${id}"`) +} diff --git a/playground/external/vite.config.js b/playground/external/vite.config.js index 4df027fe19431d..d79decb009ca6d 100644 --- a/playground/external/vite.config.js +++ b/playground/external/vite.config.js @@ -1,4 +1,5 @@ import fs from 'node:fs/promises' +import path from 'node:path' import { defineConfig } from 'vite' const npmDirectServeConfig = { @@ -29,6 +30,11 @@ export default defineConfig({ minify: false, rollupOptions: { external: ['vue', 'slash3', 'slash5'], + transform: { + inject: { + require: path.resolve(__dirname, 'src/require-polyfill.js'), + }, + }, }, commonjsOptions: { esmExternals: ['vue', 'slash5'], diff --git a/playground/glob-import/__tests__/glob-import.spec.ts b/playground/glob-import/__tests__/glob-import.spec.ts index 0674eaecc6e67c..452b518ef46957 100644 --- a/playground/glob-import/__tests__/glob-import.spec.ts +++ b/playground/glob-import/__tests__/glob-import.spec.ts @@ -88,12 +88,15 @@ const baseRawResult = { } test('should work', async () => { - await expect - .poll(async () => JSON.parse(await page.textContent('.result'))) - .toStrictEqual(allResult) - await expect - .poll(async () => JSON.parse(await page.textContent('.result-eager'))) - .toStrictEqual(allResult) + // TODO: extglobs are not supported yet: https://github.com/vitejs/rolldown-vite/issues/365 + if (process.env._VITE_TEST_JS_PLUGIN) { + await expect + .poll(async () => JSON.parse(await page.textContent('.result'))) + .toStrictEqual(allResult) + await expect + .poll(async () => JSON.parse(await page.textContent('.result-eager'))) + .toStrictEqual(allResult) + } await expect .poll(async () => JSON.parse(await page.textContent('.result-node_modules')), diff --git a/playground/glob-import/vite.config.ts b/playground/glob-import/vite.config.ts index 054fae9f8d4788..99317f08a0031e 100644 --- a/playground/glob-import/vite.config.ts +++ b/playground/glob-import/vite.config.ts @@ -26,11 +26,11 @@ export default defineConfig({ sourcemap: true, rollupOptions: { output: { - manualChunks(id) { - if (id.includes('foo.css')) { - return 'foo_css' - } - }, + // manualChunks(id) { + // if (id.includes('foo.css')) { + // return 'foo_css' + // } + // }, }, }, }, diff --git a/playground/js-sourcemap/__tests__/js-sourcemap.spec.ts b/playground/js-sourcemap/__tests__/js-sourcemap.spec.ts index 7d0cbe50f745e6..2a9c9da1b038e7 100644 --- a/playground/js-sourcemap/__tests__/js-sourcemap.spec.ts +++ b/playground/js-sourcemap/__tests__/js-sourcemap.spec.ts @@ -1,6 +1,7 @@ import { URL, fileURLToPath } from 'node:url' import { promisify } from 'node:util' import { execFile } from 'node:child_process' +import { existsSync } from 'node:fs' import { describe, expect, test } from 'vitest' import { mapFileCommentRegex } from 'convert-source-map' import { commentSourceMap } from '../foo-with-sourcemap-plugin' @@ -94,7 +95,7 @@ if (!isBuild) { expect(formatSourcemapForSnapshot(map, js)).toMatchInlineSnapshot(` SourceMap { content: { - "mappings": "AAAO,aAAM,MAAM;", + "mappings": "AAAA,OAAO,MAAM,MAAM", "sources": [ "bar.ts", ], @@ -104,7 +105,7 @@ if (!isBuild) { ], "version": 3, }, - visualization: "https://evanw.github.io/source-map-visualization/#MjYAZXhwb3J0IGNvbnN0IGJhciA9ICJiYXIiOwoxMTEAeyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJhci50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgYmFyID0gJ2JhcidcbiJdLCJtYXBwaW5ncyI6IkFBQU8sYUFBTSxNQUFNOyJ9" + visualization: "https://evanw.github.io/source-map-visualization/#MjYAZXhwb3J0IGNvbnN0IGJhciA9ICJiYXIiOwoxMTUAeyJtYXBwaW5ncyI6IkFBQUEsT0FBTyxNQUFNLE1BQU0iLCJzb3VyY2VzIjpbImJhci50cyJdLCJ2ZXJzaW9uIjozLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgYmFyID0gJ2JhcidcbiJdfQ==" } `) }) @@ -118,7 +119,7 @@ if (!isBuild) { expect(formatSourcemapForSnapshot(map, js)).toMatchInlineSnapshot(` SourceMap { content: { - "mappings": "AACA;AAAA,EACE;AAAA,OACK;AAEP,QAAQ,IAAI,yBAAyB,GAAG;", + "mappings": ";AACA,SACE,WACK;AAEP,QAAQ,IAAI,yBAAyB,IAAI", "sources": [ "with-multiline-import.ts", ], @@ -133,7 +134,7 @@ if (!isBuild) { ], "version": 3, }, - visualization: "https://evanw.github.io/source-map-visualization/#MjMxAGltcG9ydCBfX3ZpdGVfX2Nqc0ltcG9ydDBfX3ZpdGVqc190ZXN0SW1wb3J0ZWVQa2cgZnJvbSAiL25vZGVfbW9kdWxlcy8udml0ZS9kZXBzL0B2aXRlanNfdGVzdC1pbXBvcnRlZS1wa2cuanM/dj0wMDAwMDAwMCI7IGNvbnN0IGZvbyA9IF9fdml0ZV9fY2pzSW1wb3J0MF9fdml0ZWpzX3Rlc3RJbXBvcnRlZVBrZ1siZm9vIl0KCjsKY29uc29sZS5sb2coIndpdGgtbXVsdGlsaW5lLWltcG9ydCIsIGZvbyk7CjI1OAB7InZlcnNpb24iOjMsInNvdXJjZXMiOlsid2l0aC1tdWx0aWxpbmUtaW1wb3J0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIHByZXR0aWVyLWlnbm9yZVxuaW1wb3J0IHtcbiAgZm9vXG59IGZyb20gJ0B2aXRlanMvdGVzdC1pbXBvcnRlZS1wa2cnXG5cbmNvbnNvbGUubG9nKCd3aXRoLW11bHRpbGluZS1pbXBvcnQnLCBmb28pXG4iXSwibWFwcGluZ3MiOiJBQUNBO0FBQUEsRUFDRTtBQUFBLE9BQ0s7QUFFUCxRQUFRLElBQUkseUJBQXlCLEdBQUc7In0=" + visualization: "https://evanw.github.io/source-map-visualization/#MjQ4AC8vIHByZXR0aWVyLWlnbm9yZQppbXBvcnQgX192aXRlX19janNJbXBvcnQwX192aXRlanNfdGVzdEltcG9ydGVlUGtnIGZyb20gIi9ub2RlX21vZHVsZXMvLnZpdGUvZGVwcy9Adml0ZWpzX3Rlc3QtaW1wb3J0ZWUtcGtnLmpzP3Y9MDAwMDAwMDAiOyBjb25zdCBmb28gPSBfX3ZpdGVfX2Nqc0ltcG9ydDBfX3ZpdGVqc190ZXN0SW1wb3J0ZWVQa2dbImZvbyJdOwpjb25zb2xlLmxvZygid2l0aC1tdWx0aWxpbmUtaW1wb3J0IiwgZm9vKTsKMjQ4AHsibWFwcGluZ3MiOiI7QUFDQSxTQUNFLFdBQ0s7QUFFUCxRQUFRLElBQUkseUJBQXlCLElBQUkiLCJzb3VyY2VzIjpbIndpdGgtbXVsdGlsaW5lLWltcG9ydC50cyJdLCJ2ZXJzaW9uIjozLCJzb3VyY2VzQ29udGVudCI6WyIvLyBwcmV0dGllci1pZ25vcmVcbmltcG9ydCB7XG4gIGZvb1xufSBmcm9tICdAdml0ZWpzL3Rlc3QtaW1wb3J0ZWUtcGtnJ1xuXG5jb25zb2xlLmxvZygnd2l0aC1tdWx0aWxpbmUtaW1wb3J0JywgZm9vKVxuIl19" } `) }) @@ -155,30 +156,54 @@ describe.runIf(isBuild)('build tests', () => { test('sourcemap is correct when preload information is injected', async () => { const js = findAssetFile(/after-preload-dynamic-[-\w]{8}\.js$/) const map = findAssetFile(/after-preload-dynamic-[-\w]{8}\.js\.map/) - expect(formatSourcemapForSnapshot(JSON.parse(map), js)) - .toMatchInlineSnapshot(` - SourceMap { - content: { - "debugId": "00000000-0000-0000-0000-000000000000", - "ignoreList": [], - "mappings": ";4kCAAA,OAAO,2BAAuB,0BAE9B,QAAQ,IAAI,uBAAuB", - "sources": [ - "../../after-preload-dynamic.js", - ], - "sourcesContent": [ - "import('./dynamic/dynamic-foo') + if (process.env._VITE_TEST_JS_PLUGIN) { + expect(formatSourcemapForSnapshot(JSON.parse(map), js)) + .toMatchInlineSnapshot(` + SourceMap { + content: { + "debugId": "00000000-0000-0000-0000-000000000000", + "ignoreList": [], + "mappings": ";sqCAAA,OAAO,6BAAuB,wBAE9B,QAAQ,IAAI,wBAAuB", + "sources": [ + "../../after-preload-dynamic.js", + ], + "sourcesContent": [ + "import('./dynamic/dynamic-foo') - console.log('after preload dynamic') - ", - ], - "version": 3, - }, - visualization: "https://evanw.github.io/source-map-visualization/#MTQ2NgBjb25zdCBfX3ZpdGVfX21hcERlcHM9KGksbT1fX3ZpdGVfX21hcERlcHMsZD0obS5mfHwobS5mPVsiYXNzZXRzL2R5bmFtaWMtZm9vLUZfYXJUX3E1LmpzIiwiYXNzZXRzL2R5bmFtaWMtZm9vLURzcUtSckV5LmNzcyJdKSkpPT5pLm1hcChpPT5kW2ldKTsKY29uc3QgcD0ibW9kdWxlcHJlbG9hZCIsdj1mdW5jdGlvbihsKXtyZXR1cm4iLyIrbH0sdT17fSxFPWZ1bmN0aW9uKGQsYyx5KXtsZXQgaT1Qcm9taXNlLnJlc29sdmUoKTtpZihjJiZjLmxlbmd0aD4wKXtsZXQgZj1mdW5jdGlvbihlKXtyZXR1cm4gUHJvbWlzZS5hbGwoZS5tYXAobz0+UHJvbWlzZS5yZXNvbHZlKG8pLnRoZW4ocz0+KHtzdGF0dXM6ImZ1bGZpbGxlZCIsdmFsdWU6c30pLHM9Pih7c3RhdHVzOiJyZWplY3RlZCIscmVhc29uOnN9KSkpKX07ZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoImxpbmsiKTtjb25zdCBuPWRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIm1ldGFbcHJvcGVydHk9Y3NwLW5vbmNlXSIpLHQ9bj8ubm9uY2V8fG4/LmdldEF0dHJpYnV0ZSgibm9uY2UiKTtpPWYoYy5tYXAoZT0+e2lmKGU9dihlKSxlIGluIHUpcmV0dXJuO3VbZV09ITA7Y29uc3Qgbz1lLmVuZHNXaXRoKCIuY3NzIikscz1vPydbcmVsPSJzdHlsZXNoZWV0Il0nOiIiO2lmKGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoYGxpbmtbaHJlZj0iJHtlfSJdJHtzfWApKXJldHVybjtjb25zdCByPWRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImxpbmsiKTtpZihyLnJlbD1vPyJzdHlsZXNoZWV0IjpwLG98fChyLmFzPSJzY3JpcHQiKSxyLmNyb3NzT3JpZ2luPSIiLHIuaHJlZj1lLHQmJnIuc2V0QXR0cmlidXRlKCJub25jZSIsdCksZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChyKSxvKXJldHVybiBuZXcgUHJvbWlzZSgobSxoKT0+e3IuYWRkRXZlbnRMaXN0ZW5lcigibG9hZCIsbSksci5hZGRFdmVudExpc3RlbmVyKCJlcnJvciIsKCk9PmgobmV3IEVycm9yKGBVbmFibGUgdG8gcHJlbG9hZCBDU1MgZm9yICR7ZX1gKSkpfSl9KSl9ZnVuY3Rpb24gYShuKXtjb25zdCB0PW5ldyBFdmVudCgidml0ZTpwcmVsb2FkRXJyb3IiLHtjYW5jZWxhYmxlOiEwfSk7aWYodC5wYXlsb2FkPW4sd2luZG93LmRpc3BhdGNoRXZlbnQodCksIXQuZGVmYXVsdFByZXZlbnRlZCl0aHJvdyBufXJldHVybiBpLnRoZW4obj0+e2Zvcihjb25zdCB0IG9mIG58fFtdKXQuc3RhdHVzPT09InJlamVjdGVkIiYmYSh0LnJlYXNvbik7cmV0dXJuIGQoKS5jYXRjaChhKX0pfTtFKCgpPT5pbXBvcnQoIi4vZHluYW1pYy1mb28tRl9hclRfcTUuanMiKSxfX3ZpdGVfX21hcERlcHMoWzAsMV0pKTtjb25zb2xlLmxvZygiYWZ0ZXIgcHJlbG9hZCBkeW5hbWljIik7ZXhwb3J0e0UgYXMgX307Ci8vIyBkZWJ1Z0lkPThjNDM0NWFiLWYxMzAtNGZmMi05NWRlLTA3NWI2ZTBhOGZjNgovLyMgc291cmNlTWFwcGluZ1VSTD1hZnRlci1wcmVsb2FkLWR5bmFtaWMtQ3E4cGpBT0wuanMubWFwCjI3NQB7InZlcnNpb24iOjMsIm1hcHBpbmdzIjoiOzRrQ0FBQSxPQUFPLDJCQUF1QiwwQkFFOUIsUUFBUSxJQUFJLHVCQUF1QiIsImlnbm9yZUxpc3QiOltdLCJzb3VyY2VzIjpbIi4uLy4uL2FmdGVyLXByZWxvYWQtZHluYW1pYy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQoJy4vZHluYW1pYy9keW5hbWljLWZvbycpXG5cbmNvbnNvbGUubG9nKCdhZnRlciBwcmVsb2FkIGR5bmFtaWMnKVxuIl0sImRlYnVnSWQiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAifQ==" - } - `) + console.log('after preload dynamic') + ", + ], + "version": 3, + }, + visualization: "https://evanw.github.io/source-map-visualization/#MTU1NQBjb25zdCBfX3ZpdGVfX21hcERlcHM9KGksbT1fX3ZpdGVfX21hcERlcHMsZD0obS5mfHwobS5mPVsiYXNzZXRzL2R5bmFtaWMtZm9vLXRpUHBTUURiLmpzIiwiYXNzZXRzL2R5bmFtaWMtZm9vLURzcUtSckV5LmNzcyJdKSkpPT5pLm1hcChpPT5kW2ldKTsKdmFyIGU9YG1vZHVsZXByZWxvYWRgLHQ9ZnVuY3Rpb24oZSl7cmV0dXJuYC9gK2V9LG49e307Y29uc3Qgcj1mdW5jdGlvbihyLGksYSl7bGV0IG89UHJvbWlzZS5yZXNvbHZlKCk7aWYoaSYmaS5sZW5ndGg+MCl7bGV0IHI9ZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoYGxpbmtgKSxzPWRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoYG1ldGFbcHJvcGVydHk9Y3NwLW5vbmNlXWApLGM9cz8ubm9uY2V8fHM/LmdldEF0dHJpYnV0ZShgbm9uY2VgKTtmdW5jdGlvbiBsKGUpe3JldHVybiBQcm9taXNlLmFsbChlLm1hcChlPT5Qcm9taXNlLnJlc29sdmUoZSkudGhlbihlPT4oe3N0YXR1czpgZnVsZmlsbGVkYCx2YWx1ZTplfSksZT0+KHtzdGF0dXM6YHJlamVjdGVkYCxyZWFzb246ZX0pKSkpfW89bChpLm1hcChpPT57aWYoaT10KGksYSksaSBpbiBuKXJldHVybjtuW2ldPSEwO2xldCBvPWkuZW5kc1dpdGgoYC5jc3NgKSxzPW8/YFtyZWw9InN0eWxlc2hlZXQiXWA6YGA7aWYoYSlmb3IobGV0IGU9ci5sZW5ndGgtMTtlPj0wO2UtLSl7bGV0IHQ9cltlXTtpZih0LmhyZWY9PT1pJiYoIW98fHQucmVsPT09YHN0eWxlc2hlZXRgKSlyZXR1cm59ZWxzZSBpZihkb2N1bWVudC5xdWVyeVNlbGVjdG9yKGBsaW5rW2hyZWY9IiR7aX0iXSR7c31gKSlyZXR1cm47bGV0IGw9ZG9jdW1lbnQuY3JlYXRlRWxlbWVudChgbGlua2ApO2lmKGwucmVsPW8/YHN0eWxlc2hlZXRgOmUsb3x8KGwuYXM9YHNjcmlwdGApLGwuY3Jvc3NPcmlnaW49YGAsbC5ocmVmPWksYyYmbC5zZXRBdHRyaWJ1dGUoYG5vbmNlYCxjKSxkb2N1bWVudC5oZWFkLmFwcGVuZENoaWxkKGwpLG8pcmV0dXJuIG5ldyBQcm9taXNlKChlLHQpPT57bC5hZGRFdmVudExpc3RlbmVyKGBsb2FkYCxlKSxsLmFkZEV2ZW50TGlzdGVuZXIoYGVycm9yYCwoKT0+dChFcnJvcihgVW5hYmxlIHRvIHByZWxvYWQgQ1NTIGZvciAke2l9YCkpKX0pfSkpfWZ1bmN0aW9uIHMoZSl7bGV0IHQ9bmV3IEV2ZW50KGB2aXRlOnByZWxvYWRFcnJvcmAse2NhbmNlbGFibGU6ITB9KTtpZih0LnBheWxvYWQ9ZSx3aW5kb3cuZGlzcGF0Y2hFdmVudCh0KSwhdC5kZWZhdWx0UHJldmVudGVkKXRocm93IGV9cmV0dXJuIG8udGhlbihlPT57Zm9yKGxldCB0IG9mIGV8fFtdKXQuc3RhdHVzPT09YHJlamVjdGVkYCYmcyh0LnJlYXNvbik7cmV0dXJuIHIoKS5jYXRjaChzKX0pfTtyKCgpPT5pbXBvcnQoYC4vZHluYW1pYy1mb28tdGlQcFNRRGIuanNgKSxfX3ZpdGVfX21hcERlcHMoWzAsMV0pKSxjb25zb2xlLmxvZyhgYWZ0ZXIgcHJlbG9hZCBkeW5hbWljYCk7ZXhwb3J0e3IgYXMgdH07Ci8vIyBkZWJ1Z0lkPTk5MWIzYWRkLWY2MWQtNDhiNy1hZDY1LThhZjVhODBmMzhkNwovLyMgc291cmNlTWFwcGluZ1VSTD1hZnRlci1wcmVsb2FkLWR5bmFtaWMtQ1pHenJkOWguanMubWFwMjc1AHsidmVyc2lvbiI6MywibWFwcGluZ3MiOiI7c3FDQUFBLE9BQU8sNkJBQXVCLHdCQUU5QixRQUFRLElBQUksd0JBQXVCIiwiaWdub3JlTGlzdCI6W10sInNvdXJjZXMiOlsiLi4vLi4vYWZ0ZXItcHJlbG9hZC1keW5hbWljLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCgnLi9keW5hbWljL2R5bmFtaWMtZm9vJylcblxuY29uc29sZS5sb2coJ2FmdGVyIHByZWxvYWQgZHluYW1pYycpXG4iXSwiZGVidWdJZCI6IjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCJ9" + } + `) + } else { + expect(formatSourcemapForSnapshot(JSON.parse(map), js)) + .toMatchInlineSnapshot(` + SourceMap { + content: { + "debugId": "00000000-0000-0000-0000-000000000000", + "ignoreList": [], + "mappings": ";sqCAAA,OAAO,qDAEP,QAAQ,IAAI,wBAAwB", + "sources": [ + "../../after-preload-dynamic.js", + ], + "sourcesContent": [ + "import('./dynamic/dynamic-foo') + + console.log('after preload dynamic') + ", + ], + "version": 3, + }, + visualization: "https://evanw.github.io/source-map-visualization/#MTU1NQBjb25zdCBfX3ZpdGVfX21hcERlcHM9KGksbT1fX3ZpdGVfX21hcERlcHMsZD0obS5mfHwobS5mPVsiYXNzZXRzL2R5bmFtaWMtZm9vLXRpUHBTUURiLmpzIiwiYXNzZXRzL2R5bmFtaWMtZm9vLURzcUtSckV5LmNzcyJdKSkpPT5pLm1hcChpPT5kW2ldKTsKdmFyIGU9YG1vZHVsZXByZWxvYWRgLHQ9ZnVuY3Rpb24oZSl7cmV0dXJuYC9gK2V9LG49e307Y29uc3Qgcj1mdW5jdGlvbihyLGksYSl7bGV0IG89UHJvbWlzZS5yZXNvbHZlKCk7aWYoaSYmaS5sZW5ndGg+MCl7bGV0IHI9ZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoYGxpbmtgKSxzPWRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoYG1ldGFbcHJvcGVydHk9Y3NwLW5vbmNlXWApLGM9cz8ubm9uY2V8fHM/LmdldEF0dHJpYnV0ZShgbm9uY2VgKTtmdW5jdGlvbiBsKGUpe3JldHVybiBQcm9taXNlLmFsbChlLm1hcChlPT5Qcm9taXNlLnJlc29sdmUoZSkudGhlbihlPT4oe3N0YXR1czpgZnVsZmlsbGVkYCx2YWx1ZTplfSksZT0+KHtzdGF0dXM6YHJlamVjdGVkYCxyZWFzb246ZX0pKSkpfW89bChpLm1hcChpPT57aWYoaT10KGksYSksaSBpbiBuKXJldHVybjtuW2ldPSEwO2xldCBvPWkuZW5kc1dpdGgoYC5jc3NgKSxzPW8/YFtyZWw9InN0eWxlc2hlZXQiXWA6YGA7aWYoYSlmb3IobGV0IGU9ci5sZW5ndGgtMTtlPj0wO2UtLSl7bGV0IHQ9cltlXTtpZih0LmhyZWY9PT1pJiYoIW98fHQucmVsPT09YHN0eWxlc2hlZXRgKSlyZXR1cm59ZWxzZSBpZihkb2N1bWVudC5xdWVyeVNlbGVjdG9yKGBsaW5rW2hyZWY9IiR7aX0iXSR7c31gKSlyZXR1cm47bGV0IGw9ZG9jdW1lbnQuY3JlYXRlRWxlbWVudChgbGlua2ApO2lmKGwucmVsPW8/YHN0eWxlc2hlZXRgOmUsb3x8KGwuYXM9YHNjcmlwdGApLGwuY3Jvc3NPcmlnaW49YGAsbC5ocmVmPWksYyYmbC5zZXRBdHRyaWJ1dGUoYG5vbmNlYCxjKSxkb2N1bWVudC5oZWFkLmFwcGVuZENoaWxkKGwpLG8pcmV0dXJuIG5ldyBQcm9taXNlKChlLHQpPT57bC5hZGRFdmVudExpc3RlbmVyKGBsb2FkYCxlKSxsLmFkZEV2ZW50TGlzdGVuZXIoYGVycm9yYCwoKT0+dChFcnJvcihgVW5hYmxlIHRvIHByZWxvYWQgQ1NTIGZvciAke2l9YCkpKX0pfSkpfWZ1bmN0aW9uIHMoZSl7bGV0IHQ9bmV3IEV2ZW50KGB2aXRlOnByZWxvYWRFcnJvcmAse2NhbmNlbGFibGU6ITB9KTtpZih0LnBheWxvYWQ9ZSx3aW5kb3cuZGlzcGF0Y2hFdmVudCh0KSwhdC5kZWZhdWx0UHJldmVudGVkKXRocm93IGV9cmV0dXJuIG8udGhlbihlPT57Zm9yKGxldCB0IG9mIGV8fFtdKXQuc3RhdHVzPT09YHJlamVjdGVkYCYmcyh0LnJlYXNvbik7cmV0dXJuIHIoKS5jYXRjaChzKX0pfTtyKCgpPT5pbXBvcnQoYC4vZHluYW1pYy1mb28tdGlQcFNRRGIuanNgKSxfX3ZpdGVfX21hcERlcHMoWzAsMV0pKSxjb25zb2xlLmxvZyhgYWZ0ZXIgcHJlbG9hZCBkeW5hbWljYCk7ZXhwb3J0e3IgYXMgdH07Ci8vIyBkZWJ1Z0lkPTk5MWIzYWRkLWY2MWQtNDhiNy1hZDY1LThhZjVhODBmMzhkNwovLyMgc291cmNlTWFwcGluZ1VSTD1hZnRlci1wcmVsb2FkLWR5bmFtaWMtQ1pHenJkOWguanMubWFwMjY3AHsidmVyc2lvbiI6MywibWFwcGluZ3MiOiI7c3FDQUFBLE9BQU8scURBRVAsUUFBUSxJQUFJLHdCQUF3QiIsImlnbm9yZUxpc3QiOltdLCJzb3VyY2VzIjpbIi4uLy4uL2FmdGVyLXByZWxvYWQtZHluYW1pYy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQoJy4vZHluYW1pYy9keW5hbWljLWZvbycpXG5cbmNvbnNvbGUubG9nKCdhZnRlciBwcmVsb2FkIGR5bmFtaWMnKVxuIl0sImRlYnVnSWQiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAifQ==" + } + `) + } // verify sourcemap comment is preserved at the last line expect(js).toMatch( - /\n\/\/# sourceMappingURL=after-preload-dynamic-[-\w]{8}\.js\.map\n$/, + /\n\/\/# sourceMappingURL=after-preload-dynamic-[-\w]{8}\.js\.map\n?$/, ) }) @@ -220,12 +245,7 @@ describe.runIf(isBuild)('build tests', () => { SourceMap { content: { "debugId": "00000000-0000-0000-0000-000000000000", - "mappings": "qBAEA,SAASA,GAAO,CACJC,EAAA,CACZ,CAEA,SAASA,GAAY,CAEX,QAAA,MAAM,qBAAsBC,CAAkB,CACxD,CAEAF,EAAK", - "names": [ - "main", - "mainInner", - "define_testDefineObject_default", - ], + "mappings": "AAEA,SAAS,GAAO,CACd,GAAW,CAGb,SAAS,GAAY,CAEnB,QAAQ,MAAM,qBAAA,CAAA,MAAA,OAAA,CAAyC,CAGzD,GAAM", "sources": [ "../../with-define-object.ts", ], @@ -246,7 +266,7 @@ describe.runIf(isBuild)('build tests', () => { ], "version": 3, }, - visualization: "https://evanw.github.io/source-map-visualization/#MTk5AHZhciBlPXtoZWxsbzoidGVzdCJ9O2Z1bmN0aW9uIG4oKXt0KCl9ZnVuY3Rpb24gdCgpe2NvbnNvbGUudHJhY2UoIndpdGgtZGVmaW5lLW9iamVjdCIsZSl9bigpOwovLyMgZGVidWdJZD1iZDM5NjJmYy1lZGI1LTRhNmQtYTVkYS1mMjdhMWU1ZjMyNjgKLy8jIHNvdXJjZU1hcHBpbmdVUkw9d2l0aC1kZWZpbmUtb2JqZWN0LWhBU2RrZG55LmpzLm1hcAo1NjQAeyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3dpdGgtZGVmaW5lLW9iamVjdC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyB0ZXN0IGNvbXBsaWNhdGVkIHN0YWNrIHNpbmNlIGJyb2tlbiBzb3VyY2VtYXBcbi8vIG1pZ2h0IHN0aWxsIGxvb2sgY29ycmVjdCB3aXRoIGEgc2ltcGxlIGNhc2VcbmZ1bmN0aW9uIG1haW4oKSB7XG4gIG1haW5Jbm5lcigpXG59XG5cbmZ1bmN0aW9uIG1haW5Jbm5lcigpIHtcbiAgLy8gQHRzLWV4cGVjdC1lcnJvciBcImRlZmluZVwiXG4gIGNvbnNvbGUudHJhY2UoJ3dpdGgtZGVmaW5lLW9iamVjdCcsIF9fdGVzdERlZmluZU9iamVjdClcbn1cblxubWFpbigpXG4iXSwibmFtZXMiOlsibWFpbiIsIm1haW5Jbm5lciIsImRlZmluZV90ZXN0RGVmaW5lT2JqZWN0X2RlZmF1bHQiXSwibWFwcGluZ3MiOiJxQkFFQSxTQUFTQSxHQUFPLENBQ0pDLEVBQUEsQ0FDWixDQUVBLFNBQVNBLEdBQVksQ0FFWCxRQUFBLE1BQU0scUJBQXNCQyxDQUFrQixDQUN4RCxDQUVBRixFQUFLIiwiZGVidWdJZCI6IjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCJ9" + visualization: "https://evanw.github.io/source-map-visualization/#MTkwAGZ1bmN0aW9uIGUoKXt0KCl9ZnVuY3Rpb24gdCgpe2NvbnNvbGUudHJhY2UoYHdpdGgtZGVmaW5lLW9iamVjdGAse2hlbGxvOmB0ZXN0YH0pfWUoKTsKLy8jIGRlYnVnSWQ9NTBlZDE3M2ItOTIxYS00ZjMyLTk0MTAtMzBlZjc3ZmVlMGI5Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPXdpdGgtZGVmaW5lLW9iamVjdC1CUTdSYzdraC5qcy5tYXA1MDAAeyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3dpdGgtZGVmaW5lLW9iamVjdC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyB0ZXN0IGNvbXBsaWNhdGVkIHN0YWNrIHNpbmNlIGJyb2tlbiBzb3VyY2VtYXBcbi8vIG1pZ2h0IHN0aWxsIGxvb2sgY29ycmVjdCB3aXRoIGEgc2ltcGxlIGNhc2VcbmZ1bmN0aW9uIG1haW4oKSB7XG4gIG1haW5Jbm5lcigpXG59XG5cbmZ1bmN0aW9uIG1haW5Jbm5lcigpIHtcbiAgLy8gQHRzLWV4cGVjdC1lcnJvciBcImRlZmluZVwiXG4gIGNvbnNvbGUudHJhY2UoJ3dpdGgtZGVmaW5lLW9iamVjdCcsIF9fdGVzdERlZmluZU9iamVjdClcbn1cblxubWFpbigpXG4iXSwibWFwcGluZ3MiOiJBQUVBLFNBQVMsR0FBTyxDQUNkLEdBQVcsQ0FHYixTQUFTLEdBQVksQ0FFbkIsUUFBUSxNQUFNLHFCQUFBLENBQUEsTUFBQSxPQUFBLENBQXlDLENBR3pELEdBQU0iLCJkZWJ1Z0lkIjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIn0=" } `) }) @@ -269,6 +289,9 @@ describe.runIf(isBuild)('build tests', () => { for (const jsAsset of jsAssets) { const jsContent = readFile(jsAsset) + const hasSourcemap = existsSync(`${jsAsset}.map`) + if (!hasSourcemap) continue + const sourceDebugId = getDebugIdFromString(jsContent) expect( sourceDebugId, diff --git a/playground/js-sourcemap/vite.config.js b/playground/js-sourcemap/vite.config.js index 4d3d5818b5dde9..320a385bc074c9 100644 --- a/playground/js-sourcemap/vite.config.js +++ b/playground/js-sourcemap/vite.config.js @@ -11,19 +11,33 @@ export default defineConfig({ sourcemap: true, rollupOptions: { output: { - manualChunks(name) { - if (name.endsWith('after-preload-dynamic.js')) { - return 'after-preload-dynamic' - } - if (name.endsWith('after-preload-dynamic-hashbang.js')) { - return 'after-preload-dynamic-hashbang' - } - if (name.endsWith('after-preload-dynamic-no-dep.js')) { - return 'after-preload-dynamic-no-dep' - } - if (name.includes('with-define-object')) { - return 'with-define-object' - } + // manualChunks(name) { + // if (name.endsWith('after-preload-dynamic.js')) { + // return 'after-preload-dynamic' + // } + // if (name.endsWith('after-preload-dynamic-hashbang.js')) { + // return 'after-preload-dynamic-hashbang' + // } + // if (name.endsWith('after-preload-dynamic-no-dep.js')) { + // return 'after-preload-dynamic-no-dep' + // } + // if (name.includes('with-define-object')) { + // return 'with-define-object' + // } + // }, + advancedChunks: { + groups: [ + { name: 'after-preload-dynamic', test: 'after-preload-dynamic.js' }, + { + name: 'after-preload-dynamic-hashbang', + test: 'after-preload-dynamic-hashbang.js', + }, + { + name: 'after-preload-dynamic-no-dep', + test: 'after-preload-dynamic-no-dep.js', + }, + { name: 'with-define-object', test: 'with-define-object' }, + ], }, banner(chunk) { if (chunk.name.endsWith('after-preload-dynamic-hashbang')) { diff --git a/playground/legacy/__tests__/legacy.spec.ts b/playground/legacy/__tests__/legacy.spec.ts index 329731141a14ac..39135c89094f66 100644 --- a/playground/legacy/__tests__/legacy.spec.ts +++ b/playground/legacy/__tests__/legacy.spec.ts @@ -86,10 +86,11 @@ describe.runIf(isBuild)('build', () => { test('should generate correct manifest', async () => { const manifest = readManifest() // legacy polyfill - expect(manifest['../../vite/legacy-polyfills-legacy']).toBeDefined() - expect(manifest['../../vite/legacy-polyfills-legacy'].src).toBe( - '../../vite/legacy-polyfills-legacy', - ) + // FIXME: needs https://github.com/rolldown/rolldown/issues/4034 + // expect(manifest['../../vite/legacy-polyfills-legacy']).toBeDefined() + // expect(manifest['../../vite/legacy-polyfills-legacy'].src).toBe( + // '../../vite/legacy-polyfills-legacy', + // ) expect(manifest['custom0-legacy.js'].file).toMatch( /chunk-X-legacy\.[-\w]{8}.js/, ) @@ -100,10 +101,11 @@ describe.runIf(isBuild)('build', () => { /chunk-X-legacy[-\w]{8}.js/, ) // modern polyfill - expect(manifest['../../vite/legacy-polyfills']).toBeDefined() - expect(manifest['../../vite/legacy-polyfills'].src).toBe( - '../../vite/legacy-polyfills', - ) + // FIXME: needs https://github.com/rolldown/rolldown/issues/4034 + // expect(manifest['../../vite/legacy-polyfills']).toBeDefined() + // expect(manifest['../../vite/legacy-polyfills'].src).toBe( + // '../../vite/legacy-polyfills', + // ) }) test('should minify legacy chunks with terser', async () => { @@ -137,7 +139,7 @@ describe.runIf(isBuild)('build', () => { test('should generate legacy sourcemap file', async () => { expect( listAssets().some((filename) => - /index-legacy-[-\w]{8}\.js\.map$/.test(filename), + /chunk-main-legacy\.[-\w]{8}\.js\.map$/.test(filename), ), ).toBeTruthy() expect( diff --git a/playground/legacy/__tests__/watch/legacy-styles-only-entry-watch.spec.ts b/playground/legacy/__tests__/watch/legacy-styles-only-entry-watch.spec.ts index 20a62b5855411f..528f85c57903b8 100644 --- a/playground/legacy/__tests__/watch/legacy-styles-only-entry-watch.spec.ts +++ b/playground/legacy/__tests__/watch/legacy-styles-only-entry-watch.spec.ts @@ -17,7 +17,7 @@ test.runIf(isBuild)('rebuilds styles only entry on change', async () => { ) expect(findAssetFile(/polyfills-legacy-.+\.js/, 'watch')).toBeTruthy() const numberOfManifestEntries = Object.keys(readManifest('watch')).length - expect(numberOfManifestEntries).toBe(3) + expect(numberOfManifestEntries).toBe(2) // FIXME: needs https://github.com/rolldown/rolldown/issues/4034 editFile('style-only-entry.css', (originalContents) => originalContents.replace('#ff69b4', '#ffb6c1'), diff --git a/playground/lib/__tests__/lib.spec.ts b/playground/lib/__tests__/lib.spec.ts index c9983e0b9f2047..e0371cb358d4d0 100644 --- a/playground/lib/__tests__/lib.spec.ts +++ b/playground/lib/__tests__/lib.spec.ts @@ -14,9 +14,9 @@ describe.runIf(isBuild)('build', () => { ) const namedCode = readFile('dist/named/my-lib-named.umd.cjs') // esbuild helpers are injected inside of the UMD wrapper - expect(code).toMatch(/^\(function\(/) + expect(code).toMatch(/^\/\*[^*]*\*\/\s*\(function\(/) expect(noMinifyCode).toMatch( - /^\(function\(global.+?"use strict";var.+?function\smyLib\(/s, + /^\/\*[^*]*\*\/\s*\(function\(global.+?function\smyLib\(/s, ) expect(namedCode).toMatch(/^\(function\(/) }) @@ -29,13 +29,11 @@ describe.runIf(isBuild)('build', () => { ) const namedCode = readFile('dist/named/my-lib-named.iife.js') // esbuild helpers are injected inside of the IIFE wrapper - expect(code).toMatch(/^var MyLib=function\(\)\{\s*"use strict";/) + expect(code).toMatch(/^\/\*[^*]*\*\/\s*var MyLib=\(function\(\)\{\s*/) expect(noMinifyCode).toMatch( - /^var MyLib\s*=\s*function\(\)\s*\{\s*"use strict";/, - ) - expect(namedCode).toMatch( - /^var MyLibNamed=function\([^()]+\)\{\s*"use strict";/, + /^\/\*[^*]*\*\/\s*var MyLib\s*=\s*\(function\(\)\s*\{\s*/, ) + expect(namedCode).toMatch(/^var MyLibNamed=\(function\([^()]+\)\{\s*/) }) test('restrisct-helpers-injection', async () => { @@ -43,7 +41,7 @@ describe.runIf(isBuild)('build', () => { 'dist/helpers-injection/my-lib-custom-filename.iife.js', ) expect(code).toMatch( - `'"use strict"; return (' + expressionSyntax + ").constructor;"`, + `\\"use strict\\"; return (" + expressionSyntax + ").constructor;"`, ) }) @@ -62,7 +60,9 @@ describe.runIf(isBuild)('build', () => { const code = readFile('dist/lib/dynamic-import-message.es.mjs') // Does not import pure CSS chunks and replaced by `Promise.resolve({})` instead - expect(code).not.toMatch(/await import\("\.\/dynamic-[-\w]{8}.js"\)/) + expect(code).not.toMatch( + /await import\(['"`]\.\/dynamic-[-\w]{8}.js['"`]\)/, + ) expect(code).toMatch(/await Promise.resolve\(\{.*\}\)/) }) diff --git a/playground/lib/vite.config.js b/playground/lib/vite.config.js index 84612ba1f65306..8961efc72fb6cd 100644 --- a/playground/lib/vite.config.js +++ b/playground/lib/vite.config.js @@ -11,8 +11,13 @@ export default defineConfig({ }, }, build: { + // Force oxc inject helpers to test regex + // - object rest spread + // - optional chaining + target: 'chrome46', rollupOptions: { output: { + legalComments: 'inline', banner: `/*!\nMayLib\n*/`, }, }, diff --git a/playground/minify/__tests__/minify.spec.ts b/playground/minify/__tests__/minify.spec.ts index 7b672d21134257..e7449449f8c40d 100644 --- a/playground/minify/__tests__/minify.spec.ts +++ b/playground/minify/__tests__/minify.spec.ts @@ -13,7 +13,7 @@ test.runIf(isBuild)('no minifySyntax', () => { const cssFile = files.find((f) => f.endsWith('.css')) const cssContent = readFile(path.resolve(assetsDir, cssFile)) - expect(jsContent).toContain('{console.log("hello world")}') + expect(jsContent).toContain('console.log("hello world")') expect(jsContent).not.toContain('/*! explicit comment */') expect(cssContent).toContain('color:#ff0000') diff --git a/playground/minify/vite.config.js b/playground/minify/vite.config.js index 018cc196e60707..a23f2bc8147c0a 100644 --- a/playground/minify/vite.config.js +++ b/playground/minify/vite.config.js @@ -5,4 +5,13 @@ export default defineConfig({ legalComments: 'none', minifySyntax: false, }, + build: { + minify: 'esbuild', + cssMinify: 'esbuild', + rollupOptions: { + output: { + legalComments: 'none', + }, + }, + }, }) diff --git a/playground/optimize-deps/__tests__/optimize-deps.spec.ts b/playground/optimize-deps/__tests__/optimize-deps.spec.ts index 96b5790f9fa2c7..17e9b5daaf4eaa 100644 --- a/playground/optimize-deps/__tests__/optimize-deps.spec.ts +++ b/playground/optimize-deps/__tests__/optimize-deps.spec.ts @@ -141,10 +141,9 @@ test('dep with optional peer dep (cjs)', async () => { await expect .poll(() => page.textContent('.dep-with-optional-peer-dep-cjs')) .toMatch(`[success]`) - // FIXME - // await expect - // .poll(() => page.textContent('.dep-with-optional-peer-dep-cjs-error')) - // .toMatch(`[success]`) + await expect + .poll(() => page.textContent('.dep-with-optional-peer-dep-cjs-error')) + .toMatch(`[success]`) }) test('dep with css import', async () => { diff --git a/playground/optimize-deps/cjs-dynamic.js b/playground/optimize-deps/cjs-dynamic.js index 69c11051692272..f172af8493b91d 100644 --- a/playground/optimize-deps/cjs-dynamic.js +++ b/playground/optimize-deps/cjs-dynamic.js @@ -17,7 +17,7 @@ } const cjsFromESM = await import('@vitejs/test-dep-cjs-compiled-from-esm') - if (typeof cjsFromESM.default === 'function') { + if (typeof cjsFromESM.default.default === 'function') { text('.cjs-dynamic-dep-cjs-compiled-from-esm', 'ok') } diff --git a/playground/optimize-deps/cjs.js b/playground/optimize-deps/cjs.js index cd26c373a4765a..3e011dd5ea346d 100644 --- a/playground/optimize-deps/cjs.js +++ b/playground/optimize-deps/cjs.js @@ -22,7 +22,7 @@ if (typeof Socket === 'function') { text('.cjs-phoenix', 'ok') } -if (typeof cjsFromESM === 'function') { +if (typeof cjsFromESM.default === 'function') { text('.cjs-dep-cjs-compiled-from-esm', 'ok') } diff --git a/playground/optimize-deps/dep-cjs-with-external-deps/index.js b/playground/optimize-deps/dep-cjs-with-external-deps/index.js index b0a9600ce4feb9..cf2a3b9f5f8206 100644 --- a/playground/optimize-deps/dep-cjs-with-external-deps/index.js +++ b/playground/optimize-deps/dep-cjs-with-external-deps/index.js @@ -1,6 +1,14 @@ // `stream` is used as the package name for `@vitejs/test-dep-esm-dummy-node-builtin` so that it is treated like a Node builtin // eslint-disable-next-line n/prefer-node-protocol -const externalDummyNodeBuiltin = require('stream') +let externalDummyNodeBuiltin = require('stream') +// NOTE: plugin-commonjs adds some compat code (`requireReturnsDefault`), but rolldown doesn't +if (process.env.NODE_ENV === 'production') { + const mod = externalDummyNodeBuiltin + externalDummyNodeBuiltin = mod.default + for (const key in mod) { + externalDummyNodeBuiltin[key] = mod[key] + } +} const external = require('@vitejs/test-dep-esm-external') // eslint-disable-next-line no-prototype-builtins const externalResult = external.hasOwnProperty('foo') ? 'ok' : 'error' diff --git a/playground/optimize-deps/dep-incompatible/index.js b/playground/optimize-deps/dep-incompatible/index.js index 6d67368a1d4df7..e7258d640ff45f 100644 --- a/playground/optimize-deps/dep-incompatible/index.js +++ b/playground/optimize-deps/dep-incompatible/index.js @@ -1,3 +1,4 @@ -const subUrl = new URL('./sub.js', import.meta.url) +const target = './sub.js' +const subUrl = new URL(target, import.meta.url) export default () => import(subUrl) diff --git a/playground/optimize-deps/vite.config.js b/playground/optimize-deps/vite.config.js index f07d8990ddeafe..6fe5229b277b69 100644 --- a/playground/optimize-deps/vite.config.js +++ b/playground/optimize-deps/vite.config.js @@ -33,18 +33,14 @@ export default defineConfig({ '@vitejs/test-dep-esm-external', 'stream', ], - esbuildOptions: { + rolldownOptions: { plugins: [ { name: 'replace-a-file', - setup(build) { - build.onLoad( - { filter: /dep-esbuild-plugin-transform(\\|\/)index\.js$/ }, - () => ({ - contents: `export const hello = () => 'Hello from an esbuild plugin'`, - loader: 'js', - }), - ) + load(id) { + if (/dep-esbuild-plugin-transform(?:\\|\/)index\.js$/.test(id)) { + return `export const hello = () => 'Hello from an esbuild plugin'` + } }, }, ], @@ -55,13 +51,6 @@ export default defineConfig({ build: { // to make tests faster minify: false, - rollupOptions: { - onwarn(msg, warn) { - // filter `"Buffer" is not exported by "__vite-browser-external"` warning - if (msg.message.includes('Buffer')) return - warn(msg) - }, - }, }, plugins: [ @@ -93,19 +82,6 @@ export default defineConfig({ } }, }, - // TODO: Remove this one support for prebundling in build lands. - // It is expected that named importing in build doesn't work - // as it incurs a lot of overhead in build. - { - name: 'polyfill-named-fs-build', - apply: 'build', - enforce: 'pre', - load(id) { - if (id === '__vite-browser-external') { - return `export default {}; export function readFileSync() {}` - } - }, - }, ], }) @@ -145,18 +121,19 @@ function notjs() { return { optimizeDeps: { extensions: ['.notjs'], - esbuildOptions: { + rolldownOptions: { plugins: [ { name: 'esbuild-notjs', - setup(build) { - build.onLoad({ filter: /\.notjs$/ }, ({ path }) => { - let contents = fs.readFileSync(path, 'utf-8') + load: { + filter: { id: /\.notjs$/ }, + handler(id) { + let contents = fs.readFileSync(id, 'utf-8') contents = contents .replace('', '') .replace('', '') - return { contents, loader: 'js' } - }) + return contents + }, }, }, ], diff --git a/playground/package.json b/playground/package.json index 21467041129d21..5ca767d2b2cd84 100644 --- a/playground/package.json +++ b/playground/package.json @@ -9,6 +9,7 @@ "devDependencies": { "convert-source-map": "^2.0.0", "css-color-names": "^1.0.1", - "kill-port": "^1.6.1" + "kill-port": "^1.6.1", + "rolldown": "1.0.0-beta.53" } } diff --git a/playground/preload/vite.config-preload-disabled.js b/playground/preload/vite.config-preload-disabled.js index e1a9f4f17d3df2..4ae19be2a3b482 100644 --- a/playground/preload/vite.config-preload-disabled.js +++ b/playground/preload/vite.config-preload-disabled.js @@ -14,11 +14,11 @@ export default defineConfig({ }, rollupOptions: { output: { - manualChunks(id) { - if (id.includes('chunk.js')) { - return 'chunk' - } - }, + // manualChunks(id) { + // if (id.includes('chunk.js')) { + // return 'chunk' + // } + // }, }, }, modulePreload: false, diff --git a/playground/preload/vite.config-resolve-deps.js b/playground/preload/vite.config-resolve-deps.js index accc72a6e1d42d..5ef2a82147ae01 100644 --- a/playground/preload/vite.config-resolve-deps.js +++ b/playground/preload/vite.config-resolve-deps.js @@ -14,11 +14,11 @@ export default defineConfig({ }, rollupOptions: { output: { - manualChunks(id) { - if (id.includes('chunk.js')) { - return 'chunk' - } - }, + // manualChunks(id) { + // if (id.includes('chunk.js')) { + // return 'chunk' + // } + // }, }, }, modulePreload: { diff --git a/playground/preload/vite.config.ts b/playground/preload/vite.config.ts index 6ec8716860526a..0c27f0ab75c1ca 100644 --- a/playground/preload/vite.config.ts +++ b/playground/preload/vite.config.ts @@ -14,11 +14,11 @@ export default defineConfig({ }, rollupOptions: { output: { - manualChunks(id) { - if (id.includes('chunk.js')) { - return 'chunk' - } - }, + // manualChunks(id) { + // if (id.includes('chunk.js')) { + // return 'chunk' + // } + // }, }, }, }, diff --git a/playground/resolve-tsconfig-paths/__tests__/resolve.spec.ts b/playground/resolve-tsconfig-paths/__tests__/resolve.spec.ts new file mode 100644 index 00000000000000..91f39fd71bc58d --- /dev/null +++ b/playground/resolve-tsconfig-paths/__tests__/resolve.spec.ts @@ -0,0 +1,19 @@ +import { expect, test } from 'vitest' +import { page } from '~utils' + +test('import from .ts', async () => { + await expect.poll(() => page.textContent('.ts')).toMatch('[success]') +}) + +test('import from .js', async () => { + await expect.poll(() => page.textContent('.js')).toMatch('[success]') +}) + +test('fallback works', async () => { + await expect.poll(() => page.textContent('.fallback')).toMatch('[success]') +}) + +test('nested tsconfig.json & references / include works', async () => { + await expect.poll(() => page.textContent('.nested-a')).toMatch('[success]') + await expect.poll(() => page.textContent('.nested-b')).toMatch('[success]') +}) diff --git a/playground/resolve-tsconfig-paths/fallback/fallback.js b/playground/resolve-tsconfig-paths/fallback/fallback.js new file mode 100644 index 00000000000000..3407a59f7c86ac --- /dev/null +++ b/playground/resolve-tsconfig-paths/fallback/fallback.js @@ -0,0 +1 @@ +export default '[success] imported from fallback' diff --git a/playground/resolve-tsconfig-paths/index.html b/playground/resolve-tsconfig-paths/index.html new file mode 100644 index 00000000000000..564e8d19ceeea5 --- /dev/null +++ b/playground/resolve-tsconfig-paths/index.html @@ -0,0 +1,33 @@ +

Resolve: tsconfig paths

+ +

Import from .ts

+

+ +

Import from .js

+

+ +

Fallback works

+

+ +

Nested tsconfig.json & references / include works

+

+

+ + diff --git a/playground/amd/package.json b/playground/resolve-tsconfig-paths/package.json similarity index 58% rename from playground/amd/package.json rename to playground/resolve-tsconfig-paths/package.json index 0fac1378aeb3ff..e4b0a23a3c65a3 100644 --- a/playground/amd/package.json +++ b/playground/resolve-tsconfig-paths/package.json @@ -1,14 +1,12 @@ { - "name": "@vitejs/test-amd", + "name": "@vitejs/test-resolve-tsconfig-paths", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "vite build", + "debug": "node --inspect-brk ../../packages/vite/bin/vite", "preview": "vite preview" - }, - "dependencies": { - "requirejs": "^2.3.8" } } diff --git a/playground/resolve-tsconfig-paths/src/imported.js b/playground/resolve-tsconfig-paths/src/imported.js new file mode 100644 index 00000000000000..49d5a8f82b28e5 --- /dev/null +++ b/playground/resolve-tsconfig-paths/src/imported.js @@ -0,0 +1 @@ +export default '[success] imported' diff --git a/playground/resolve-tsconfig-paths/src/js.js b/playground/resolve-tsconfig-paths/src/js.js new file mode 100644 index 00000000000000..8d1fff745b93ac --- /dev/null +++ b/playground/resolve-tsconfig-paths/src/js.js @@ -0,0 +1 @@ +export { default } from '@/imported' diff --git a/playground/resolve-tsconfig-paths/src/nested/a-imported.ts b/playground/resolve-tsconfig-paths/src/nested/a-imported.ts new file mode 100644 index 00000000000000..ff65ae59767257 --- /dev/null +++ b/playground/resolve-tsconfig-paths/src/nested/a-imported.ts @@ -0,0 +1 @@ +export const value = '[success] a-imported' as const diff --git a/playground/resolve-tsconfig-paths/src/nested/a.ts b/playground/resolve-tsconfig-paths/src/nested/a.ts new file mode 100644 index 00000000000000..cfb01f49c88cff --- /dev/null +++ b/playground/resolve-tsconfig-paths/src/nested/a.ts @@ -0,0 +1 @@ +export { value } from '@imported' diff --git a/playground/resolve-tsconfig-paths/src/nested/b-imported.ts b/playground/resolve-tsconfig-paths/src/nested/b-imported.ts new file mode 100644 index 00000000000000..a6017d93689be2 --- /dev/null +++ b/playground/resolve-tsconfig-paths/src/nested/b-imported.ts @@ -0,0 +1 @@ +export const value = '[success] b-imported' as const diff --git a/playground/resolve-tsconfig-paths/src/nested/b.ts b/playground/resolve-tsconfig-paths/src/nested/b.ts new file mode 100644 index 00000000000000..cfb01f49c88cff --- /dev/null +++ b/playground/resolve-tsconfig-paths/src/nested/b.ts @@ -0,0 +1 @@ +export { value } from '@imported' diff --git a/playground/resolve-tsconfig-paths/src/nested/index.ts b/playground/resolve-tsconfig-paths/src/nested/index.ts new file mode 100644 index 00000000000000..cee5554cbd4802 --- /dev/null +++ b/playground/resolve-tsconfig-paths/src/nested/index.ts @@ -0,0 +1,2 @@ +export { value as valueA } from './a' +export { value as valueB } from './b' diff --git a/playground/resolve-tsconfig-paths/src/nested/tsconfig.a.json b/playground/resolve-tsconfig-paths/src/nested/tsconfig.a.json new file mode 100644 index 00000000000000..1ab3caa6659df1 --- /dev/null +++ b/playground/resolve-tsconfig-paths/src/nested/tsconfig.a.json @@ -0,0 +1,8 @@ +{ + "include": ["./a.ts"], + "compilerOptions": { + "paths": { + "@imported": ["./a-imported.ts"] + } + } +} diff --git a/playground/resolve-tsconfig-paths/src/nested/tsconfig.b.json b/playground/resolve-tsconfig-paths/src/nested/tsconfig.b.json new file mode 100644 index 00000000000000..6271ce7184be5c --- /dev/null +++ b/playground/resolve-tsconfig-paths/src/nested/tsconfig.b.json @@ -0,0 +1,8 @@ +{ + "include": ["./b.ts"], + "compilerOptions": { + "paths": { + "@imported": ["./b-imported.ts"] + } + } +} diff --git a/playground/resolve-tsconfig-paths/src/nested/tsconfig.json b/playground/resolve-tsconfig-paths/src/nested/tsconfig.json new file mode 100644 index 00000000000000..ccb40ae44221f6 --- /dev/null +++ b/playground/resolve-tsconfig-paths/src/nested/tsconfig.json @@ -0,0 +1,7 @@ +{ + "include": [], + "references": [ + { "path": "./tsconfig.a.json" }, + { "path": "./tsconfig.b.json" } + ] +} diff --git a/playground/resolve-tsconfig-paths/src/ts.ts b/playground/resolve-tsconfig-paths/src/ts.ts new file mode 100644 index 00000000000000..8d1fff745b93ac --- /dev/null +++ b/playground/resolve-tsconfig-paths/src/ts.ts @@ -0,0 +1 @@ +export { default } from '@/imported' diff --git a/playground/resolve-tsconfig-paths/tsconfig.json b/playground/resolve-tsconfig-paths/tsconfig.json new file mode 100644 index 00000000000000..8d9202c7c1d633 --- /dev/null +++ b/playground/resolve-tsconfig-paths/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "allowJs": true, + "noEmit": true, + "paths": { + "@/*": ["./src/*"], + "@fallback/*": ["./src/*", "./fallback/*"] + } + }, + "exclude": ["./__tests__"] +} diff --git a/playground/resolve-tsconfig-paths/vite.config.js b/playground/resolve-tsconfig-paths/vite.config.js new file mode 100644 index 00000000000000..25158f653fe3fa --- /dev/null +++ b/playground/resolve-tsconfig-paths/vite.config.js @@ -0,0 +1,10 @@ +import { defineConfig } from 'vite' + +export default defineConfig({ + resolve: { + tsconfigPaths: true, + }, + experimental: { + enableNativePlugin: 'resolver', + }, +}) diff --git a/playground/resolve/__tests__/resolve.spec.ts b/playground/resolve/__tests__/resolve.spec.ts index 96749b3820ed7b..57dbbd85470d40 100644 --- a/playground/resolve/__tests__/resolve.spec.ts +++ b/playground/resolve/__tests__/resolve.spec.ts @@ -139,14 +139,6 @@ test('Resolve browser field even if module field exists', async () => { expect(await page.textContent('.browser-module1')).toMatch('[success]') }) -test('Resolve module field if browser field is likely UMD or CJS', async () => { - expect(await page.textContent('.browser-module2')).toMatch('[success]') -}) - -test('Resolve module field if browser field is likely IIFE', async () => { - expect(await page.textContent('.browser-module3')).toMatch('[success]') -}) - test('css entry', async () => { expect(await page.textContent('.css')).toMatch('[success]') }) @@ -159,6 +151,10 @@ test('plugin resolved virtual file', async () => { expect(await page.textContent('.virtual')).toMatch('[success]') }) +test('plugin resolved virtual file that has import', async () => { + expect(await page.textContent('.virtual-has-import')).toMatch('[success]') +}) + test('plugin resolved custom virtual file', async () => { expect(await page.textContent('.custom-virtual')).toMatch('[success]') }) diff --git a/playground/resolve/browser-field/relative.js b/playground/resolve/browser-field/relative.js index 660d6be578a728..6b45c5758d37dd 100644 --- a/playground/resolve/browser-field/relative.js +++ b/playground/resolve/browser-field/relative.js @@ -4,7 +4,6 @@ import rb from './no-ext.js' // no substitution import rc from './ext' import rd from './ext.js' import re from './ext-index/index.js' -import rf from './ext-index' -import rg from './no-ext-index/index.js' // no substitution +import rf from './no-ext-index/index.js' // no substitution -export { ra, rb, rc, rd, re, rf, rg } +export { ra, rb, rc, rd, re, rf } diff --git a/playground/resolve/browser-module-field2/index.js b/playground/resolve/browser-module-field2/index.js deleted file mode 100644 index 99af62f8e3700e..00000000000000 --- a/playground/resolve/browser-module-field2/index.js +++ /dev/null @@ -1 +0,0 @@ -export default '[success] this should run in browser' diff --git a/playground/resolve/browser-module-field2/index.web.js b/playground/resolve/browser-module-field2/index.web.js deleted file mode 100644 index 172aa9928c86ae..00000000000000 --- a/playground/resolve/browser-module-field2/index.web.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = '[fail] this should not run in the browser' diff --git a/playground/resolve/browser-module-field2/package.json b/playground/resolve/browser-module-field2/package.json deleted file mode 100644 index f496de2b9cbcf4..00000000000000 --- a/playground/resolve/browser-module-field2/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "@vitejs/test-resolve-browser-module-field2", - "private": true, - "version": "1.0.0", - "module": "index.js", - "browser": "index.web.js" -} diff --git a/playground/resolve/browser-module-field3/index.js b/playground/resolve/browser-module-field3/index.js deleted file mode 100644 index 99af62f8e3700e..00000000000000 --- a/playground/resolve/browser-module-field3/index.js +++ /dev/null @@ -1 +0,0 @@ -export default '[success] this should run in browser' diff --git a/playground/resolve/browser-module-field3/index.web.js b/playground/resolve/browser-module-field3/index.web.js deleted file mode 100644 index 843b376e2c4daa..00000000000000 --- a/playground/resolve/browser-module-field3/index.web.js +++ /dev/null @@ -1,7 +0,0 @@ -var browserModuleField3 = (function () { - 'use strict' - - var main = '[fail] this should not run in the browser' - - return main -})() diff --git a/playground/resolve/browser-module-field3/package.json b/playground/resolve/browser-module-field3/package.json deleted file mode 100644 index db4afca86dc5cd..00000000000000 --- a/playground/resolve/browser-module-field3/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "@vitejs/test-resolve-browser-module-field3", - "private": true, - "version": "1.0.0", - "module": "index.js", - "browser": "index.web.js" -} diff --git a/playground/resolve/index.html b/playground/resolve/index.html index eada635b4085b0..56984bfd82c894 100644 --- a/playground/resolve/index.html +++ b/playground/resolve/index.html @@ -137,12 +137,6 @@

Browser Field

Resolve browser field even if module field exists

fail

-

Resolve module field if browser field is likely UMD or CJS

-

fail

- -

Resolve module field if browser field is likely IIFE

-

fail

-

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

fail

@@ -158,6 +152,9 @@

Plugin resolved virtual file

Plugin resolved virtual file (#9036)

+

Plugin resolved virtual file that has import

+

+

Plugin resolved custom virtual file

@@ -331,7 +328,8 @@

utf8-bom-package

import c from '@vitejs/test-resolve-browser-field/ext' import d from '@vitejs/test-resolve-browser-field/ext.js' import e from '@vitejs/test-resolve-browser-field/ext-index/index.js' - import f from '@vitejs/test-resolve-browser-field/ext-index' + // webpack does not support this case, so should be fine + // import f from '@vitejs/test-resolve-browser-field/ext-index' import g from '@vitejs/test-resolve-browser-field/no-ext-index/index.js' // no substitution import h from '@vitejs/test-resolve-browser-field/no-ext?query' import i from '@vitejs/test-resolve-browser-field/bare-import' @@ -343,11 +341,10 @@

utf8-bom-package

rd, re, rf, - rg, } from '@vitejs/test-resolve-browser-field/relative' - const success = [main, a, c, d, e, f, h, i, ra, rc, rd, re, rf] - const noSuccess = [b, g, rb, rg] + const success = [main, a, c, d, e, h, i, ra, rc, rd, re] + const noSuccess = [b, g, rb, rf] if ( [...success, ...noSuccess].filter((text) => text.includes('[success]')) @@ -359,12 +356,6 @@

utf8-bom-package

import browserModule1 from '@vitejs/test-resolve-browser-module-field1' text('.browser-module1', browserModule1) - import browserModule2 from '@vitejs/test-resolve-browser-module-field2' - text('.browser-module2', browserModule2) - - import browserModule3 from '@vitejs/test-resolve-browser-module-field3' - text('.browser-module3', browserModule3) - import { msg as requireButWithModuleFieldMsg } from '@vitejs/test-require-pkg-with-module-field' text('.require-pkg-with-module-field', requireButWithModuleFieldMsg) @@ -400,6 +391,9 @@

utf8-bom-package

import { msg as virtualMsg9036 } from 'virtual:file-9036.js' text('.virtual-9036', virtualMsg9036) + import { msg as virtualMsgHasImport } from 'virtual:file-has-import.js' + text('.virtual-has-import', virtualMsgHasImport) + import { msg as customVirtualMsg } from '@custom-virtual-file' text('.custom-virtual', customVirtualMsg) diff --git a/playground/resolve/package.json b/playground/resolve/package.json index d88160f3030085..0f71ba477d0141 100644 --- a/playground/resolve/package.json +++ b/playground/resolve/package.json @@ -26,8 +26,6 @@ "@vitejs/test-require-pkg-with-module-field": "link:./require-pkg-with-module-field", "@vitejs/test-resolve-browser-field": "link:./browser-field", "@vitejs/test-resolve-browser-module-field1": "link:./browser-module-field1", - "@vitejs/test-resolve-browser-module-field2": "link:./browser-module-field2", - "@vitejs/test-resolve-browser-module-field3": "link:./browser-module-field3", "@vitejs/test-resolve-custom-condition": "link:./custom-condition", "@vitejs/test-resolve-custom-main-field": "link:./custom-main-field", "@vitejs/test-resolve-custom-browser-main-field": "link:./custom-browser-main-field", diff --git a/playground/resolve/vite.config.js b/playground/resolve/vite.config.js index f9f353c9e02aa9..d618ce33f1fc52 100644 --- a/playground/resolve/vite.config.js +++ b/playground/resolve/vite.config.js @@ -8,6 +8,9 @@ const virtualId = '\0' + virtualFile const virtualFile9036 = 'virtual:file-9036.js' const virtualId9036 = '\0' + virtualFile9036 +const virtualFileHasImport = 'virtual:file-has-import.js' +const virtualIdHasImport = '/file-has-import.js' + const customVirtualFile = '@custom-virtual-file' const virtualFileWithScheme = 'virtual-with-scheme' @@ -67,6 +70,30 @@ export default defineConfig({ } }, }, + { + name: 'virtual-module-has-import', + enforce: 'pre', + resolveId(id, _importer, opts) { + if (id === virtualFileHasImport) { + // make scanner happy + // @ts-expect-error -- opts.scan is internal + if (opts?.scan) { + return normalizePath( + path.resolve(import.meta.dirname, './exports-path/main.js'), + ) + } + return virtualIdHasImport + } + }, + load(id) { + if (id === virtualIdHasImport) { + return ( + 'import { msg as importedMsg } from "@vitejs/test-resolve-exports-path"\n' + + 'export const msg = importedMsg.includes("[success]") ? "[success] from virtual file that has import" : "[failure]"' + ) + } + }, + }, { name: 'custom-resolve', resolveId(id) { diff --git a/playground/transform-plugin/__tests__/transform-plugin.spec.ts b/playground/transform-plugin/__tests__/transform-plugin.spec.ts index 6ef86c1fd23b6a..c706df3c6bcd1d 100644 --- a/playground/transform-plugin/__tests__/transform-plugin.spec.ts +++ b/playground/transform-plugin/__tests__/transform-plugin.spec.ts @@ -1,3 +1,12 @@ +import { expect, test } from 'vitest' import { tests } from './tests' +import { page } from '~utils' + +test('module type should be supported', async () => { + expect(await page.textContent('#module-type-json-pre')).toBe('json') + expect(await page.textContent('#module-type-json-post')).toBe('js') + expect(await page.textContent('#module-type-json-virtual-pre')).toBe('json') + expect(await page.textContent('#module-type-json-virtual-post')).toBe('js') +}) tests() diff --git a/playground/transform-plugin/foo.json b/playground/transform-plugin/foo.json new file mode 100644 index 00000000000000..753f11a8226717 --- /dev/null +++ b/playground/transform-plugin/foo.json @@ -0,0 +1,4 @@ +{ + "moduleTypePre": "MODULE_TYPE_PRE", + "moduleTypePost": "MODULE_TYPE_POST" +} diff --git a/playground/transform-plugin/index.html b/playground/transform-plugin/index.html index 83450ae9ed2350..b6d8bce8952ae1 100644 --- a/playground/transform-plugin/index.html +++ b/playground/transform-plugin/index.html @@ -1,3 +1,12 @@ +

Transform Plugin

+ +

addWatchFile

+

Module Type

+
+
+
+
+ diff --git a/playground/transform-plugin/index.js b/playground/transform-plugin/index.js index ac3da49609d222..bb7d910bd88c87 100644 --- a/playground/transform-plugin/index.js +++ b/playground/transform-plugin/index.js @@ -1,2 +1,15 @@ +import barJson from 'virtual:/bar.json' +import fooJson from './foo.json' + // 'TRANSFORM_COUNT' is injected by the transform plugin document.getElementById('transform-count').innerHTML = TRANSFORM_COUNT + +document.getElementById('module-type-json-pre').innerHTML = + fooJson.moduleTypePre +document.getElementById('module-type-json-post').innerHTML = + fooJson.moduleTypePost + +document.getElementById('module-type-json-virtual-pre').innerHTML = + barJson.moduleTypePre +document.getElementById('module-type-json-virtual-post').innerHTML = + barJson.moduleTypePost diff --git a/playground/transform-plugin/package.json b/playground/transform-plugin/package.json index 5ec3132d97cd29..bf9f74bb7551b1 100644 --- a/playground/transform-plugin/package.json +++ b/playground/transform-plugin/package.json @@ -7,6 +7,6 @@ "dev": "vite", "build": "vite build", "debug": "node --inspect-brk ../../vite/bin/vite", - "serve": "vite preview" + "preview": "vite preview" } } diff --git a/playground/transform-plugin/vite.config.js b/playground/transform-plugin/vite.config.js index dae98317ad1de5..719f052b5595a2 100644 --- a/playground/transform-plugin/vite.config.js +++ b/playground/transform-plugin/vite.config.js @@ -27,6 +27,38 @@ const transformPlugin = { }, } +const moduleTypePlugins = [ + /** @type {const} */ ...['pre', 'post'].map((enforce) => ({ + name: `module-type-${enforce}`, + enforce, + transform(code, id, opts) { + if (id.endsWith('/foo.json') || id.endsWith('\0/bar.json')) { + code = code.replace( + `MODULE_TYPE_${enforce.toUpperCase()}`, + opts.moduleType, + ) + return code + } + }, + })), + { + name: `module-type-load`, + resolveId(id) { + if (id === 'virtual:/bar.json') { + return '\0/bar.json' + } + }, + load(id) { + if (id.endsWith('\0/bar.json')) { + return JSON.stringify({ + moduleTypePre: 'MODULE_TYPE_PRE', + moduleTypePost: 'MODULE_TYPE_POST', + }) + } + }, + }, +] + export default defineConfig({ - plugins: [transformPlugin], + plugins: [transformPlugin, moduleTypePlugins], }) diff --git a/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts b/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts index 67e4d522b5f64f..64b5b96d17d6d2 100644 --- a/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts +++ b/playground/tsconfig-json-load-error/__tests__/tsconfig-json-load-error.spec.ts @@ -3,7 +3,7 @@ import { clearServeError, serveError } from './serve' import { browserLogs, editFile, isBuild, isServe, page, readFile } from '~utils' const unexpectedTokenSyntaxErrorRE = - /(\[vite:esbuild\] )*parsing .* failed: SyntaxError: Unexpected token.*\}.*/ + /(\[vite:esbuild\] )*parsing .* failed: SyntaxError: Unexpected token.*\}.*|Build failed/ describe.runIf(isBuild)('build', () => { test('should throw an error on build', () => { diff --git a/playground/tsconfig.json b/playground/tsconfig.json index 8e5a4523fa61cb..c64534f6602301 100644 --- a/playground/tsconfig.json +++ b/playground/tsconfig.json @@ -1,6 +1,6 @@ { "include": ["**/vite*config*", "**/*.ts"], - "exclude": ["**/dist/**"], + "exclude": ["**/dist/**", "./legacy/**", "./resolve-tsconfig-paths/**"], "compilerOptions": { "checkJs": true, "target": "ES2023", diff --git a/playground/vitestSetup.ts b/playground/vitestSetup.ts index e7ef0f78d85587..353e776d19d149 100644 --- a/playground/vitestSetup.ts +++ b/playground/vitestSetup.ts @@ -20,7 +20,11 @@ import { preview, } from 'vite' import type { Browser, Page } from 'playwright-chromium' -import type { RollupError, RollupWatcher, RollupWatcherEvent } from 'rollup' +import type { + RolldownWatcher, + RolldownWatcherEvent, + RollupError, +} from 'rolldown' import { beforeAll, expect, inject } from 'vitest' // #region serializer @@ -101,7 +105,7 @@ export const browserErrors: Error[] = [] export let page: Page = undefined! export let browser: Browser = undefined! export let viteTestUrl: string = '' -export let watcher: RollupWatcher | undefined = undefined +export let watcher: RolldownWatcher | undefined = undefined export function setViteUrl(url: string): void { viteTestUrl = url @@ -305,7 +309,7 @@ export async function startDefaultServe(): Promise { const isWatch = !!resolvedConfig!.build.watch // in build watch,call startStaticServer after the build is complete if (isWatch) { - watcher = rollupOutput as RollupWatcher + watcher = rollupOutput as RolldownWatcher await notifyRebuildComplete(watcher) } if (buildConfig.__test__) { @@ -334,10 +338,10 @@ export async function startDefaultServe(): Promise { * Send the rebuild complete message in build watch */ export async function notifyRebuildComplete( - watcher: RollupWatcher, -): Promise { + watcher: RolldownWatcher, +): Promise { let resolveFn: undefined | (() => void) - const callback = (event: RollupWatcherEvent): void => { + const callback = (event: RolldownWatcherEvent): void => { if (event.code === 'END') { resolveFn?.() } @@ -346,6 +350,7 @@ export async function notifyRebuildComplete( await new Promise((resolve) => { resolveFn = resolve }) + return watcher.off('event', callback) } diff --git a/playground/worker/__tests__/es/worker-es.spec.ts b/playground/worker/__tests__/es/worker-es.spec.ts index 2545038d1b49ce..95282d30fa27fb 100644 --- a/playground/worker/__tests__/es/worker-es.spec.ts +++ b/playground/worker/__tests__/es/worker-es.spec.ts @@ -96,7 +96,7 @@ describe.runIf(isBuild)('build', () => { test('inlined code generation', async () => { const assetsDir = path.resolve(testDir, 'dist/es/assets') const files = fs.readdirSync(assetsDir) - expect(files.length).toBe(36) + expect(files.length).toBe(38) 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')) @@ -106,20 +106,20 @@ describe.runIf(isBuild)('build', () => { ) // worker should have all imports resolved and no exports - expect(workerContent).not.toMatch(/import[^.]/) - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/import\s*["(]/) + expect(workerContent).not.toMatch(/\bexport\b/) // chunk - expect(content).toMatch(`new Worker("/es/assets`) - expect(content).toMatch(`new SharedWorker("/es/assets`) + expect(content).toMatch('new Worker(`/es/assets') + expect(content).toMatch('new SharedWorker(`/es/assets') // inlined worker expect(content).toMatch(`(self.URL||self.webkitURL).createObjectURL`) expect(content).toMatch(`self.Blob`) expect(content).toMatch( - /try\{if\(\w+=\w+&&\(self\.URL\|\|self\.webkitURL\)\.createObjectURL\(\w+\),!\w+\)throw""/, + /try\{if\(\w+=\w+&&\(self\.URL\|\|self\.webkitURL\)\.createObjectURL\(\w+\),!\w+\)throw``/, ) // inlined shared worker expect(content).toMatch( - `return new SharedWorker("data:text/javascript;charset=utf-8,"+`, + 'return new SharedWorker(`data:text/javascript;charset=utf-8,', ) }) diff --git a/playground/worker/__tests__/iife/worker-iife.spec.ts b/playground/worker/__tests__/iife/worker-iife.spec.ts index a4c84800921f77..07ae7ab0bc9221 100644 --- a/playground/worker/__tests__/iife/worker-iife.spec.ts +++ b/playground/worker/__tests__/iife/worker-iife.spec.ts @@ -93,11 +93,11 @@ describe.runIf(isBuild)('build', () => { ) // worker should have all imports resolved and no exports - expect(workerContent).not.toMatch(`import`) - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/import\s*["(]/) + expect(workerContent).not.toMatch(/\bexport\b/) // chunk - expect(content).toMatch(`new Worker("/iife/assets`) - expect(content).toMatch(`new SharedWorker("/iife/assets`) + expect(content).toMatch('new Worker(`/iife/assets') + expect(content).toMatch('new SharedWorker(`/iife/assets') // inlined expect(content).toMatch(`(self.URL||self.webkitURL).createObjectURL`) expect(content).toMatch(`self.Blob`) @@ -191,13 +191,13 @@ test.runIf(isServe)('sourcemap is correct after env is injected', async () => { SourceMap { content: { "ignoreList": [], - "mappings": ";;AAAA,SAAS,OAAO,kBAAkB;AAClC,OAAO,YAAY;AACnB,SAAS,MAAM,WAAW;AAC1B,SAAS,wBAAwB;AACjC,OAAO,aAAa;AACpB,MAAM,UAAU,YAAY;AAE5B,KAAK,YAAY,CAAC,MAAM;AACtB,MAAI,EAAE,SAAS,QAAQ;AACrB,SAAK,YAAY;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACA,MAAI,EAAE,SAAS,gBAAgB;AAC7B,SAAK,YAAY;AAAA,MACf,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;AACA,KAAK,YAAY;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,QAAQ,IAAI,cAAc", + "mappings": ";;AAAA,SAAS,OAAO,kBAAkB;AAClC,OAAO,YAAY;AACnB,SAAS,MAAM,WAAW;AAC1B,SAAS,wBAAwB;AACjC,OAAO,aAAa;AACpB,MAAM,UAAU,OAAO,KAAK;AAE5B,KAAK,aAAa,MAAM;AACtB,KAAI,EAAE,SAAS,QAAQ;AACrB,OAAK,YAAY;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAAC;;AAEJ,KAAI,EAAE,SAAS,gBAAgB;AAC7B,OAAK,YAAY;GACf,KAAK;GACL;GACA;GACA;GACA;GACA;GACA;GACD,CAAC;;;AAGN,KAAK,YAAY;CACf;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;AAGF,QAAQ,IAAI,eAAe", "sources": [ "my-worker.ts?worker_file&type=module", ], "version": 3, }, - visualization: "https://evanw.github.io/source-map-visualization/#MTE0NgAKOwppbXBvcnQgeyBtc2cgYXMgbXNnRnJvbURlcCB9IGZyb20gIi9paWZlL25vZGVfbW9kdWxlcy8udml0ZS1paWZlL2RlcHMvQHZpdGVqc190ZXN0LWRlcC10by1vcHRpbWl6ZS5qcz92PTAwMDAwMDAwIjsKaW1wb3J0IF9fdml0ZV9fY2pzSW1wb3J0Ml9fdml0ZWpzX3Rlc3RXb3JrZXJEZXBDanMgZnJvbSAiL2lpZmUvbm9kZV9tb2R1bGVzLy52aXRlLWlpZmUvZGVwcy9Adml0ZWpzX3Rlc3Qtd29ya2VyLWRlcC1janMuanM/dj0wMDAwMDAwMCI7IGNvbnN0IGRlcENqcyA9IF9fdml0ZV9fY2pzSW1wb3J0Ml9fdml0ZWpzX3Rlc3RXb3JrZXJEZXBDanMuX19lc01vZHVsZSA/IF9fdml0ZV9fY2pzSW1wb3J0Ml9fdml0ZWpzX3Rlc3RXb3JrZXJEZXBDanMuZGVmYXVsdCA6IF9fdml0ZV9fY2pzSW1wb3J0Ml9fdml0ZWpzX3Rlc3RXb3JrZXJEZXBDanM7CmltcG9ydCB7IG1vZGUsIG1zZyB9IGZyb20gIi9paWZlL21vZHVsZXMvd29ya2VySW1wb3J0LnRzIjsKaW1wb3J0IHsgYnVuZGxlV2l0aFBsdWdpbiB9IGZyb20gIi9paWZlL21vZHVsZXMvdGVzdC1wbHVnaW4uanMiOwppbXBvcnQgdml0ZVN2ZyBmcm9tICIvaWlmZS92aXRlLnN2Zz9pbXBvcnQiOwpjb25zdCBtZXRhVXJsID0gaW1wb3J0Lm1ldGEudXJsOwpzZWxmLm9ubWVzc2FnZSA9IChlKSA9PiB7CiAgaWYgKGUuZGF0YSA9PT0gInBpbmciKSB7CiAgICBzZWxmLnBvc3RNZXNzYWdlKHsKICAgICAgbXNnLAogICAgICBtb2RlLAogICAgICBidW5kbGVXaXRoUGx1Z2luLAogICAgICB2aXRlU3ZnLAogICAgICBtZXRhVXJsLAogICAgICBuYW1lLAogICAgICBkZXBDanMKICAgIH0pOwogIH0KICBpZiAoZS5kYXRhID09PSAicGluZy11bmljb2RlIikgewogICAgc2VsZi5wb3N0TWVzc2FnZSh7CiAgICAgIG1zZzogIuKAonBvbmfigKIiLAogICAgICBtb2RlLAogICAgICBidW5kbGVXaXRoUGx1Z2luLAogICAgICB2aXRlU3ZnLAogICAgICBtZXRhVXJsLAogICAgICBuYW1lLAogICAgICBkZXBDanMKICAgIH0pOwogIH0KfTsKc2VsZi5wb3N0TWVzc2FnZSh7CiAgbXNnLAogIG1vZGUsCiAgYnVuZGxlV2l0aFBsdWdpbiwKICBtc2dGcm9tRGVwLAogIHZpdGVTdmcsCiAgbWV0YVVybCwKICBuYW1lLAogIGRlcENqcwp9KTsKY29uc29sZS5sb2coIm15LXdvcmtlci5qcyIpOwoxNTM3AHsidmVyc2lvbiI6MywibWFwcGluZ3MiOiI7O0FBQUEsU0FBUyxPQUFPLGtCQUFrQjtBQUNsQyxPQUFPLFlBQVk7QUFDbkIsU0FBUyxNQUFNLFdBQVc7QUFDMUIsU0FBUyx3QkFBd0I7QUFDakMsT0FBTyxhQUFhO0FBQ3BCLE1BQU0sVUFBVSxZQUFZO0FBRTVCLEtBQUssWUFBWSxDQUFDLE1BQU07QUFDdEIsTUFBSSxFQUFFLFNBQVMsUUFBUTtBQUNyQixTQUFLLFlBQVk7QUFBQSxNQUNmO0FBQUEsTUFDQTtBQUFBLE1BQ0E7QUFBQSxNQUNBO0FBQUEsTUFDQTtBQUFBLE1BQ0E7QUFBQSxNQUNBO0FBQUEsSUFDRixDQUFDO0FBQUEsRUFDSDtBQUNBLE1BQUksRUFBRSxTQUFTLGdCQUFnQjtBQUM3QixTQUFLLFlBQVk7QUFBQSxNQUNmLEtBQUs7QUFBQSxNQUNMO0FBQUEsTUFDQTtBQUFBLE1BQ0E7QUFBQSxNQUNBO0FBQUEsTUFDQTtBQUFBLE1BQ0E7QUFBQSxJQUNGLENBQUM7QUFBQSxFQUNIO0FBQ0Y7QUFDQSxLQUFLLFlBQVk7QUFBQSxFQUNmO0FBQUEsRUFDQTtBQUFBLEVBQ0E7QUFBQSxFQUNBO0FBQUEsRUFDQTtBQUFBLEVBQ0E7QUFBQSxFQUNBO0FBQUEsRUFDQTtBQUNGLENBQUM7QUFHRCxRQUFRLElBQUksY0FBYyIsImlnbm9yZUxpc3QiOltdLCJzb3VyY2VzIjpbIm15LXdvcmtlci50cz93b3JrZXJfZmlsZSZ0eXBlPW1vZHVsZSJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBtc2cgYXMgbXNnRnJvbURlcCB9IGZyb20gJ0B2aXRlanMvdGVzdC1kZXAtdG8tb3B0aW1pemUnXG5pbXBvcnQgZGVwQ2pzIGZyb20gJ0B2aXRlanMvdGVzdC13b3JrZXItZGVwLWNqcydcbmltcG9ydCB7IG1vZGUsIG1zZyB9IGZyb20gJy4vbW9kdWxlcy93b3JrZXJJbXBvcnQuanMnXG5pbXBvcnQgeyBidW5kbGVXaXRoUGx1Z2luIH0gZnJvbSAnLi9tb2R1bGVzL3Rlc3QtcGx1Z2luJ1xuaW1wb3J0IHZpdGVTdmcgZnJvbSAnLi92aXRlLnN2ZydcbmNvbnN0IG1ldGFVcmwgPSBpbXBvcnQubWV0YS51cmxcblxuc2VsZi5vbm1lc3NhZ2UgPSAoZSkgPT4ge1xuICBpZiAoZS5kYXRhID09PSAncGluZycpIHtcbiAgICBzZWxmLnBvc3RNZXNzYWdlKHtcbiAgICAgIG1zZyxcbiAgICAgIG1vZGUsXG4gICAgICBidW5kbGVXaXRoUGx1Z2luLFxuICAgICAgdml0ZVN2ZyxcbiAgICAgIG1ldGFVcmwsXG4gICAgICBuYW1lLFxuICAgICAgZGVwQ2pzLFxuICAgIH0pXG4gIH1cbiAgaWYgKGUuZGF0YSA9PT0gJ3BpbmctdW5pY29kZScpIHtcbiAgICBzZWxmLnBvc3RNZXNzYWdlKHtcbiAgICAgIG1zZzogJ+KAonBvbmfigKInLFxuICAgICAgbW9kZSxcbiAgICAgIGJ1bmRsZVdpdGhQbHVnaW4sXG4gICAgICB2aXRlU3ZnLFxuICAgICAgbWV0YVVybCxcbiAgICAgIG5hbWUsXG4gICAgICBkZXBDanMsXG4gICAgfSlcbiAgfVxufVxuc2VsZi5wb3N0TWVzc2FnZSh7XG4gIG1zZyxcbiAgbW9kZSxcbiAgYnVuZGxlV2l0aFBsdWdpbixcbiAgbXNnRnJvbURlcCxcbiAgdml0ZVN2ZyxcbiAgbWV0YVVybCxcbiAgbmFtZSxcbiAgZGVwQ2pzLFxufSlcblxuLy8gZm9yIHNvdXJjZW1hcFxuY29uc29sZS5sb2coJ215LXdvcmtlci5qcycpXG4iXX0=" + visualization: "https://evanw.github.io/source-map-visualization/#OTkwAAo7CmltcG9ydCB7IG1zZyBhcyBtc2dGcm9tRGVwIH0gZnJvbSAiL2lpZmUvbm9kZV9tb2R1bGVzLy52aXRlLWlpZmUvZGVwcy9Adml0ZWpzX3Rlc3QtZGVwLXRvLW9wdGltaXplLmpzP3Y9MDAwMDAwMDAiOwppbXBvcnQgX192aXRlX19janNJbXBvcnQyX192aXRlanNfdGVzdFdvcmtlckRlcENqcyBmcm9tICIvaWlmZS9ub2RlX21vZHVsZXMvLnZpdGUtaWlmZS9kZXBzL0B2aXRlanNfdGVzdC13b3JrZXItZGVwLWNqcy5qcz92PTAwMDAwMDAwIjsgY29uc3QgZGVwQ2pzID0gX192aXRlX19janNJbXBvcnQyX192aXRlanNfdGVzdFdvcmtlckRlcENqczsKaW1wb3J0IHsgbW9kZSwgbXNnIH0gZnJvbSAiL2lpZmUvbW9kdWxlcy93b3JrZXJJbXBvcnQudHMiOwppbXBvcnQgeyBidW5kbGVXaXRoUGx1Z2luIH0gZnJvbSAiL2lpZmUvbW9kdWxlcy90ZXN0LXBsdWdpbi5qcyI7CmltcG9ydCB2aXRlU3ZnIGZyb20gIi9paWZlL3ZpdGUuc3ZnP2ltcG9ydCI7CmNvbnN0IG1ldGFVcmwgPSBpbXBvcnQubWV0YS51cmw7CnNlbGYub25tZXNzYWdlID0gKGUpID0+IHsKCWlmIChlLmRhdGEgPT09ICJwaW5nIikgewoJCXNlbGYucG9zdE1lc3NhZ2UoewoJCQltc2csCgkJCW1vZGUsCgkJCWJ1bmRsZVdpdGhQbHVnaW4sCgkJCXZpdGVTdmcsCgkJCW1ldGFVcmwsCgkJCW5hbWUsCgkJCWRlcENqcwoJCX0pOwoJfQoJaWYgKGUuZGF0YSA9PT0gInBpbmctdW5pY29kZSIpIHsKCQlzZWxmLnBvc3RNZXNzYWdlKHsKCQkJbXNnOiAi4oCicG9uZ+KAoiIsCgkJCW1vZGUsCgkJCWJ1bmRsZVdpdGhQbHVnaW4sCgkJCXZpdGVTdmcsCgkJCW1ldGFVcmwsCgkJCW5hbWUsCgkJCWRlcENqcwoJCX0pOwoJfQp9OwpzZWxmLnBvc3RNZXNzYWdlKHsKCW1zZywKCW1vZGUsCglidW5kbGVXaXRoUGx1Z2luLAoJbXNnRnJvbURlcCwKCXZpdGVTdmcsCgltZXRhVXJsLAoJbmFtZSwKCWRlcENqcwp9KTsKLy8gZm9yIHNvdXJjZW1hcApjb25zb2xlLmxvZygibXktd29ya2VyLmpzIik7CjEzOTYAeyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6Ijs7QUFBQSxTQUFTLE9BQU8sa0JBQWtCO0FBQ2xDLE9BQU8sWUFBWTtBQUNuQixTQUFTLE1BQU0sV0FBVztBQUMxQixTQUFTLHdCQUF3QjtBQUNqQyxPQUFPLGFBQWE7QUFDcEIsTUFBTSxVQUFVLE9BQU8sS0FBSztBQUU1QixLQUFLLGFBQWEsTUFBTTtBQUN0QixLQUFJLEVBQUUsU0FBUyxRQUFRO0FBQ3JCLE9BQUssWUFBWTtHQUNmO0dBQ0E7R0FDQTtHQUNBO0dBQ0E7R0FDQTtHQUNBO0dBQ0QsQ0FBQzs7QUFFSixLQUFJLEVBQUUsU0FBUyxnQkFBZ0I7QUFDN0IsT0FBSyxZQUFZO0dBQ2YsS0FBSztHQUNMO0dBQ0E7R0FDQTtHQUNBO0dBQ0E7R0FDQTtHQUNELENBQUM7OztBQUdOLEtBQUssWUFBWTtDQUNmO0NBQ0E7Q0FDQTtDQUNBO0NBQ0E7Q0FDQTtDQUNBO0NBQ0E7Q0FDRCxDQUFDOztBQUdGLFFBQVEsSUFBSSxlQUFlIiwiaWdub3JlTGlzdCI6W10sInNvdXJjZXMiOlsibXktd29ya2VyLnRzP3dvcmtlcl9maWxlJnR5cGU9bW9kdWxlIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IG1zZyBhcyBtc2dGcm9tRGVwIH0gZnJvbSAnQHZpdGVqcy90ZXN0LWRlcC10by1vcHRpbWl6ZSdcbmltcG9ydCBkZXBDanMgZnJvbSAnQHZpdGVqcy90ZXN0LXdvcmtlci1kZXAtY2pzJ1xuaW1wb3J0IHsgbW9kZSwgbXNnIH0gZnJvbSAnLi9tb2R1bGVzL3dvcmtlckltcG9ydC5qcydcbmltcG9ydCB7IGJ1bmRsZVdpdGhQbHVnaW4gfSBmcm9tICcuL21vZHVsZXMvdGVzdC1wbHVnaW4nXG5pbXBvcnQgdml0ZVN2ZyBmcm9tICcuL3ZpdGUuc3ZnJ1xuY29uc3QgbWV0YVVybCA9IGltcG9ydC5tZXRhLnVybFxuXG5zZWxmLm9ubWVzc2FnZSA9IChlKSA9PiB7XG4gIGlmIChlLmRhdGEgPT09ICdwaW5nJykge1xuICAgIHNlbGYucG9zdE1lc3NhZ2Uoe1xuICAgICAgbXNnLFxuICAgICAgbW9kZSxcbiAgICAgIGJ1bmRsZVdpdGhQbHVnaW4sXG4gICAgICB2aXRlU3ZnLFxuICAgICAgbWV0YVVybCxcbiAgICAgIG5hbWUsXG4gICAgICBkZXBDanMsXG4gICAgfSlcbiAgfVxuICBpZiAoZS5kYXRhID09PSAncGluZy11bmljb2RlJykge1xuICAgIHNlbGYucG9zdE1lc3NhZ2Uoe1xuICAgICAgbXNnOiAn4oCicG9uZ+KAoicsXG4gICAgICBtb2RlLFxuICAgICAgYnVuZGxlV2l0aFBsdWdpbixcbiAgICAgIHZpdGVTdmcsXG4gICAgICBtZXRhVXJsLFxuICAgICAgbmFtZSxcbiAgICAgIGRlcENqcyxcbiAgICB9KVxuICB9XG59XG5zZWxmLnBvc3RNZXNzYWdlKHtcbiAgbXNnLFxuICBtb2RlLFxuICBidW5kbGVXaXRoUGx1Z2luLFxuICBtc2dGcm9tRGVwLFxuICB2aXRlU3ZnLFxuICBtZXRhVXJsLFxuICBuYW1lLFxuICBkZXBDanMsXG59KVxuXG4vLyBmb3Igc291cmNlbWFwXG5jb25zb2xlLmxvZygnbXktd29ya2VyLmpzJylcbiJdfQ==" } `) }) diff --git a/playground/worker/__tests__/relative-base/worker-relative-base.spec.ts b/playground/worker/__tests__/relative-base/worker-relative-base.spec.ts index 07bfc47be8428e..883b5e5a743e5f 100644 --- a/playground/worker/__tests__/relative-base/worker-relative-base.spec.ts +++ b/playground/worker/__tests__/relative-base/worker-relative-base.spec.ts @@ -76,11 +76,11 @@ describe.runIf(isBuild)('build', () => { ) // worker should have all imports resolved and no exports - expect(workerContent).not.toMatch(/import(?!\.)/) // accept import.meta.url - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/import\s*["(]/) + expect(workerContent).not.toMatch(/\bexport\b/) // chunk - expect(content).toMatch(`new Worker(""+new URL("../worker-entries/`) - expect(content).toMatch(`new SharedWorker(""+new URL("../worker-entries/`) + expect(content).toMatch('new Worker(``+new URL(`../worker-entries/') + expect(content).toMatch('new SharedWorker(``+new URL(`../worker-entries/') // inlined expect(content).toMatch(`(self.URL||self.webkitURL).createObjectURL`) expect(content).toMatch(`self.Blob`) diff --git a/playground/worker/__tests__/sourcemap-hidden/worker-sourcemap-hidden.spec.ts b/playground/worker/__tests__/sourcemap-hidden/worker-sourcemap-hidden.spec.ts index 1f407ee24cd5a3..6a149cdb522f30 100644 --- a/playground/worker/__tests__/sourcemap-hidden/worker-sourcemap-hidden.spec.ts +++ b/playground/worker/__tests__/sourcemap-hidden/worker-sourcemap-hidden.spec.ts @@ -83,26 +83,26 @@ describe.runIf(isBuild)('build', () => { expect(subWorkerSourcemap).toBe(null) // worker should have all imports resolved and no exports - expect(workerContent).not.toMatch(`import`) - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/import\s*["(]/) + expect(workerContent).not.toMatch(/\bexport\b/) // shared worker should have all imports resolved and no exports - expect(sharedWorkerContent).not.toMatch(`import`) - expect(sharedWorkerContent).not.toMatch(`export`) + expect(sharedWorkerContent).not.toMatch(/import\s*["(]/) + expect(sharedWorkerContent).not.toMatch(/\bexport\b/) // chunk expect(content).toMatch( - `new Worker("/iife-sourcemap-hidden/assets/my-worker`, + 'new Worker(`/iife-sourcemap-hidden/assets/my-worker', ) - expect(content).toMatch(`new Worker("data:text/javascript;charset=utf-8,"+`) + expect(content).toMatch('new Worker(`data:text/javascript;charset=utf-8,') expect(content).toMatch( - `new Worker("/iife-sourcemap-hidden/assets/possible-ts-output-worker`, + 'new Worker(`/iife-sourcemap-hidden/assets/possible-ts-output-worker', ) expect(content).toMatch( - `new Worker("/iife-sourcemap-hidden/assets/worker-nested-worker`, + 'new Worker(`/iife-sourcemap-hidden/assets/worker-nested-worker', ) expect(content).toMatch( - `new SharedWorker("/iife-sourcemap-hidden/assets/my-shared-worker`, + 'new SharedWorker(`/iife-sourcemap-hidden/assets/my-shared-worker', ) // inlined @@ -110,7 +110,7 @@ describe.runIf(isBuild)('build', () => { expect(content).toMatch(`self.Blob`) expect(workerNestedWorkerContent).toMatch( - `new Worker("/iife-sourcemap-hidden/assets/sub-worker`, + 'new Worker(`/iife-sourcemap-hidden/assets/sub-worker', ) }) }) diff --git a/playground/worker/__tests__/sourcemap-inline/worker-sourcemap-inline.spec.ts b/playground/worker/__tests__/sourcemap-inline/worker-sourcemap-inline.spec.ts index 8e6e040cfded04..c32e3a6b8195b7 100644 --- a/playground/worker/__tests__/sourcemap-inline/worker-sourcemap-inline.spec.ts +++ b/playground/worker/__tests__/sourcemap-inline/worker-sourcemap-inline.spec.ts @@ -64,26 +64,26 @@ describe.runIf(isBuild)('build', () => { expect(subWorkerSourcemap).toMatch(/^data:/) // worker should have all imports resolved and no exports - expect(workerContent).not.toMatch(`import`) - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/import\s*["(]/) + expect(workerContent).not.toMatch(/\bexport\b/) // shared worker should have all imports resolved and no exports - expect(sharedWorkerContent).not.toMatch(`import`) - expect(sharedWorkerContent).not.toMatch(`export`) + expect(sharedWorkerContent).not.toMatch(/import\s*["(]/) + expect(sharedWorkerContent).not.toMatch(/\bexport\b/) // chunk expect(content).toMatch( - `new Worker("/iife-sourcemap-inline/assets/my-worker`, + 'new Worker(`/iife-sourcemap-inline/assets/my-worker', ) - expect(content).toMatch(`new Worker("data:text/javascript;charset=utf-8,"+`) + expect(content).toMatch('new Worker(`data:text/javascript;charset=utf-8,') expect(content).toMatch( - `new Worker("/iife-sourcemap-inline/assets/possible-ts-output-worker`, + 'new Worker(`/iife-sourcemap-inline/assets/possible-ts-output-worker', ) expect(content).toMatch( - `new Worker("/iife-sourcemap-inline/assets/worker-nested-worker`, + 'new Worker(`/iife-sourcemap-inline/assets/worker-nested-worker', ) expect(content).toMatch( - `new SharedWorker("/iife-sourcemap-inline/assets/my-shared-worker`, + 'new SharedWorker(`/iife-sourcemap-inline/assets/my-shared-worker', ) // inlined @@ -91,7 +91,7 @@ describe.runIf(isBuild)('build', () => { expect(content).toMatch(`self.Blob`) expect(workerNestedWorkerContent).toMatch( - `new Worker("/iife-sourcemap-inline/assets/sub-worker`, + 'new Worker(`/iife-sourcemap-inline/assets/sub-worker', ) }) }) diff --git a/playground/worker/__tests__/sourcemap/worker-sourcemap.spec.ts b/playground/worker/__tests__/sourcemap/worker-sourcemap.spec.ts index 3bff04a5c8d79a..1d00ecea2cd925 100644 --- a/playground/worker/__tests__/sourcemap/worker-sourcemap.spec.ts +++ b/playground/worker/__tests__/sourcemap/worker-sourcemap.spec.ts @@ -86,24 +86,24 @@ describe.runIf(isBuild)('build', () => { expect(subWorkerSourcemap).toMatch(/^sub-worker-[-\w]+\.js\.map$/) // worker should have all imports resolved and no exports - expect(workerContent).not.toMatch(`import`) - expect(workerContent).not.toMatch(`export`) + expect(workerContent).not.toMatch(/import\s*["(]/) + expect(workerContent).not.toMatch(/\bexport\b/) // shared worker should have all imports resolved and no exports - expect(sharedWorkerContent).not.toMatch(`import`) - expect(sharedWorkerContent).not.toMatch(`export`) + expect(sharedWorkerContent).not.toMatch(/import\s*["(]/) + expect(sharedWorkerContent).not.toMatch(/\bexport\b/) // chunk - expect(content).toMatch(`new Worker("/iife-sourcemap/assets/my-worker`) - expect(content).toMatch(`new Worker("data:text/javascript;charset=utf-8,"+`) + expect(content).toMatch('new Worker(`/iife-sourcemap/assets/my-worker') + expect(content).toMatch('new Worker(`data:text/javascript;charset=utf-8,') expect(content).toMatch( - `new Worker("/iife-sourcemap/assets/possible-ts-output-worker`, + 'new Worker(`/iife-sourcemap/assets/possible-ts-output-worker', ) expect(content).toMatch( - `new Worker("/iife-sourcemap/assets/worker-nested-worker`, + 'new Worker(`/iife-sourcemap/assets/worker-nested-worker', ) expect(content).toMatch( - `new SharedWorker("/iife-sourcemap/assets/my-shared-worker`, + 'new SharedWorker(`/iife-sourcemap/assets/my-shared-worker', ) // inlined @@ -111,7 +111,7 @@ describe.runIf(isBuild)('build', () => { expect(content).toMatch(`self.Blob`) expect(workerNestedWorkerContent).toMatch( - `new Worker("/iife-sourcemap/assets/sub-worker`, + 'new Worker(`/iife-sourcemap/assets/sub-worker', ) }) }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d5094edf30bdd3..819555880234a9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,8 +5,8 @@ settings: excludeLinksFromLockfile: false overrides: - rolldown: ^1.0.0-beta.52 - vite: workspace:* + rolldown: 1.0.0-beta.53 + vite: workspace:rolldown-vite@* debug: npm:obug@^1.0.2 packageExtensionsChecksum: sha256-BLDZCgUIohvBXMHo3XFOlGLzGXRyK3sDU0nMBRk9APY= @@ -102,8 +102,8 @@ importers: specifier: 3.7.3 version: 3.7.3 rolldown: - specifier: ^1.0.0-beta.52 - version: 1.0.0-beta.52 + specifier: 1.0.0-beta.53 + version: 1.0.0-beta.53 rollup: specifier: ^4.43.0 version: 4.43.0 @@ -120,7 +120,7 @@ importers: specifier: ^8.48.0 version: 8.48.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3))(ms@2.1.3)(typescript@5.9.3) vite: - specifier: workspace:* + specifier: workspace:rolldown-vite@* version: link:packages/vite vitest: specifier: ^4.0.14 @@ -143,9 +143,12 @@ importers: markdown-it-image-size: specifier: ^15.0.1 version: 15.0.1(markdown-it@14.1.0) + oxc-minify: + specifier: ^0.101.0 + version: 0.101.0 vitepress: specifier: ^2.0.0-alpha.15 - version: 2.0.0-alpha.15(axios@1.13.2)(postcss@8.5.6)(typescript@5.9.3) + version: 2.0.0-alpha.15(axios@1.13.2)(oxc-minify@0.101.0)(postcss@8.5.6)(typescript@5.9.3) vitepress-plugin-group-icons: specifier: ^1.6.5 version: 1.6.5(ms@2.1.3)(vite@packages+vite) @@ -232,26 +235,29 @@ importers: specifier: ^0.16.8 version: 0.16.8(publint@0.3.12)(typescript@5.9.3)(vue-tsc@3.1.5(typescript@5.9.3)) vite: - specifier: workspace:* + specifier: workspace:rolldown-vite@* version: link:../vite packages/vite: dependencies: - esbuild: - specifier: ^0.25.0 - version: 0.25.0 + '@oxc-project/runtime': + specifier: 0.101.0 + version: 0.101.0 fdir: specifier: ^6.5.0 version: 6.5.0(picomatch@4.0.3) + lightningcss: + specifier: ^1.30.2 + version: 1.30.2 picomatch: specifier: ^4.0.3 version: 4.0.3 postcss: specifier: ^8.5.6 version: 8.5.6 - rollup: - specifier: ^4.43.0 - version: 4.43.0 + rolldown: + specifier: 1.0.0-beta.53 + version: 1.0.0-beta.53 tinyglobby: specifier: ^0.2.15 version: 0.2.15 @@ -266,14 +272,14 @@ importers: specifier: ^0.3.31 version: 0.3.31 '@oxc-project/types': - specifier: 0.95.0 - version: 0.95.0 + specifier: 0.101.0 + version: 0.101.0 '@polka/compression': specifier: ^1.0.0-next.25 version: 1.0.0-next.25 '@rolldown/pluginutils': - specifier: ^1.0.0-beta.52 - version: 1.0.0-beta.52 + specifier: 1.0.0-beta.53 + version: 1.0.0-beta.53 '@rollup/plugin-alias': specifier: ^5.1.1 version: 5.1.1(rollup@4.43.0) @@ -325,6 +331,9 @@ importers: es-module-lexer: specifier: ^1.7.0 version: 1.7.0 + esbuild: + specifier: ^0.25.0 + version: 0.25.0 escape-html: specifier: ^1.0.3 version: 1.0.3 @@ -341,11 +350,8 @@ importers: specifier: ^1.22.0 version: 1.22.0(patch_hash=d89dff5a0afc2cb277080ad056a3baf7feeeeac19144878abc17f4c91ad89095)(ms@2.1.3) launch-editor-middleware: - specifier: ^2.12.0 - version: 2.12.0 - lightningcss: - specifier: ^1.30.2 - version: 1.30.2 + specifier: ^2.11.1 + version: 2.11.1 magic-string: specifier: ^0.30.21 version: 0.30.21 @@ -391,12 +397,12 @@ importers: resolve.exports: specifier: ^2.0.3 version: 2.0.3 - rolldown: - specifier: ^1.0.0-beta.52 - version: 1.0.0-beta.52 rolldown-plugin-dts: specifier: ^0.18.1 - version: 0.18.1(rolldown@1.0.0-beta.52)(typescript@5.9.3)(vue-tsc@3.1.5(typescript@5.9.3)) + version: 0.18.1(rolldown@1.0.0-beta.53)(typescript@5.9.3)(vue-tsc@3.1.5(typescript@5.9.3)) + rollup: + specifier: ^4.43.0 + version: 4.43.0 rollup-plugin-license: specifier: ^3.6.0 version: 3.6.0(picomatch@4.0.3)(rollup@4.43.0) @@ -442,7 +448,7 @@ importers: version: file:packages/vite/src/node/__tests__/fixtures/test-dep-conditions vue: specifier: ^3.5.18 - version: 3.5.25(typescript@5.9.3) + version: 3.5.22(typescript@5.9.3) packages/vite/src/node/__tests__/fixtures/cjs-ssr-dep: {} @@ -554,6 +560,9 @@ importers: kill-port: specifier: ^1.6.1 version: 1.6.1 + rolldown: + specifier: 1.0.0-beta.53 + version: 1.0.0-beta.53 playground/alias: dependencies: @@ -573,12 +582,6 @@ importers: playground/alias/dir/module: {} - playground/amd: - dependencies: - requirejs: - specifier: ^2.3.8 - version: 2.3.8 - playground/assets: {} playground/assets-sanitize: {} @@ -796,7 +799,7 @@ importers: specifier: npm:slash@^5.1.0 version: slash@5.1.0 vite: - specifier: workspace:* + specifier: workspace:rolldown-vite@* version: link:../../packages/vite vue: specifier: ^3.5.25 @@ -898,7 +901,7 @@ importers: specifier: ^5.44.1 version: 5.44.1 vite: - specifier: workspace:* + specifier: workspace:rolldown-vite@* version: link:../../packages/vite playground/lib: @@ -1291,12 +1294,6 @@ importers: '@vitejs/test-resolve-browser-module-field1': specifier: link:./browser-module-field1 version: link:browser-module-field1 - '@vitejs/test-resolve-browser-module-field2': - specifier: link:./browser-module-field2 - version: link:browser-module-field2 - '@vitejs/test-resolve-browser-module-field3': - specifier: link:./browser-module-field3 - version: link:browser-module-field3 '@vitejs/test-resolve-custom-browser-main-field': specifier: link:./custom-browser-main-field version: link:custom-browser-main-field @@ -1354,6 +1351,8 @@ importers: playground/resolve-linked: {} + playground/resolve-tsconfig-paths: {} + playground/resolve/browser-field: dependencies: '@vitejs/test-resolve-browser-field-bare-import-fail': @@ -1369,10 +1368,6 @@ importers: playground/resolve/browser-module-field1: {} - playground/resolve/browser-module-field2: {} - - playground/resolve/browser-module-field3: {} - playground/resolve/custom-browser-main-field: {} playground/resolve/custom-condition: {} @@ -1779,6 +1774,10 @@ packages: resolution: {integrity: sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==} engines: {node: '>=6.9.0'} + '@babel/compat-data@7.27.7': + resolution: {integrity: sha512-xgu/ySj2mTiUFmdE9yCMfBxLp4DHd5DwmbbD05YAuICfodYT3VvRxbrh81LGQ/8UpSdtMdfKMn3KouYDX59DGQ==} + engines: {node: '>=6.9.0'} + '@babel/compat-data@7.28.5': resolution: {integrity: sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==} engines: {node: '>=6.9.0'} @@ -1878,6 +1877,11 @@ packages: resolution: {integrity: sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==} engines: {node: '>=6.9.0'} + '@babel/parser@7.27.5': + resolution: {integrity: sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg==} + engines: {node: '>=6.0.0'} + hasBin: true + '@babel/parser@7.28.5': resolution: {integrity: sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==} engines: {node: '>=6.0.0'} @@ -2266,6 +2270,14 @@ packages: resolution: {integrity: sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==} engines: {node: '>=6.9.0'} + '@babel/types@7.27.7': + resolution: {integrity: sha512-8OLQgDScAOHXnAz2cV+RfzzNMipuLVBz2biuAJFMV9bfkNf393je3VM8CLkjQodW5+iWsSJdSgSWT6rsZoXHPw==} + engines: {node: '>=6.9.0'} + + '@babel/types@7.28.4': + resolution: {integrity: sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q==} + engines: {node: '>=6.9.0'} + '@babel/types@7.28.5': resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==} engines: {node: '>=6.9.0'} @@ -2340,11 +2352,20 @@ packages: '@docsearch/js@4.3.2': resolution: {integrity: sha512-xdfpPXMgKRY9EW7U1vtY7gLKbLZFa9ed+t0Dacquq8zXBqAlH9HlUf0h4Mhxm0xatsVeMaIR2wr/u6g0GsZyQw==} - '@emnapi/core@1.5.0': - resolution: {integrity: sha512-sbP8GzB1WDzacS8fgNPpHlp6C9VZe+SJP3F90W9rLemaQj2PzIuTEl1qDOYQf58YIpyjViI24y9aPWCjEzY2cg==} + '@emnapi/core@1.4.3': + resolution: {integrity: sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g==} + + '@emnapi/core@1.7.1': + resolution: {integrity: sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg==} - '@emnapi/runtime@1.5.0': - resolution: {integrity: sha512-97/BJ3iXHww3djw6hYIfErCZFee7qCtrneuLa20UXFCOTCfBM2cvQHjWJ2EG0s0MtdNwInarqCTz35i4wWXHsQ==} + '@emnapi/runtime@1.4.3': + resolution: {integrity: sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ==} + + '@emnapi/runtime@1.7.1': + resolution: {integrity: sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA==} + + '@emnapi/wasi-threads@1.0.2': + resolution: {integrity: sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA==} '@emnapi/wasi-threads@1.1.0': resolution: {integrity: sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==} @@ -2661,6 +2682,12 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + '@eslint-community/eslint-utils@4.9.0': + resolution: {integrity: sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + '@eslint-community/regexpp@4.12.1': resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} @@ -2725,8 +2752,8 @@ packages: '@iconify-json/logos@1.2.9': resolution: {integrity: sha512-G6VCdFnwZcrT6Eveq3m43oJfLw/CX8plwFcE+2jgv3fiGB64pTmnU7Yd1MNZ/eA+/Re2iEDhuCfSNOWTHwwK8w==} - '@iconify-json/simple-icons@1.2.60': - resolution: {integrity: sha512-KlwLBKCdMCqfySdkAA+jehdUx6VSjnj6lvzQKus7HjkPSQ6QP58d6xiptkIp0jd/Hw3PW2++nRuGvCvSYaF0Mg==} + '@iconify-json/simple-icons@1.2.59': + resolution: {integrity: sha512-fYx/InyQsWFW4wVxWka3CGDJ6m/fXoTqWBSl+oA3FBXO5RhPAb6S3Y5bRgCPnrYevErH8VjAL0TZevIqlN2PhQ==} '@iconify-json/vscode-icons@1.2.32': resolution: {integrity: sha512-UzZmL6hF02YGu/qEbpskEVnstlNJG+c+0PNzNYTIBf/dXylWHLUVufhOXqAzuGRjkUZ2q7rPpOEwLUPkhkFHUA==} @@ -2869,6 +2896,10 @@ packages: '@jridgewell/gen-mapping@0.3.12': resolution: {integrity: sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==} + '@jridgewell/gen-mapping@0.3.8': + resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==} + engines: {node: '>=6.0.0'} + '@jridgewell/remapping@2.3.5': resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==} @@ -2876,6 +2907,10 @@ packages: resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} + '@jridgewell/set-array@1.2.1': + resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} + engines: {node: '>=6.0.0'} + '@jridgewell/source-map@0.3.6': resolution: {integrity: sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==} @@ -2898,8 +2933,11 @@ packages: '@napi-rs/wasm-runtime@0.2.11': resolution: {integrity: sha512-9DPkXtvHydrcOsopiYpUgPHpmj0HWZKMUnL2dZqpvC42lsratuBG06V5ipyno0fUek5VlFsNQ+AcFATSrJXgMA==} - '@napi-rs/wasm-runtime@1.0.7': - resolution: {integrity: sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw==} + '@napi-rs/wasm-runtime@0.2.9': + resolution: {integrity: sha512-OKRBiajrrxB9ATokgEQoG87Z25c67pCpYcCwmXYX8PBftC9pBfN18gnm/fh1wurSLEKIAt+QRFLFCQISrb66Jg==} + + '@napi-rs/wasm-runtime@1.1.0': + resolution: {integrity: sha512-Fq6DJW+Bb5jaWE69/qOE0D1TUN9+6uWhCeZpdnSBk14pjLcCWR7Q8n49PTSPHazM37JqrsdpEthXy2xn6jWWiA==} '@node-rs/bcrypt-android-arm-eabi@1.10.7': resolution: {integrity: sha512-8dO6/PcbeMZXS3VXGEtct9pDYdShp2WBOWlDvSbcRwVqyB580aCBh0BEFmKYtXLzLvUK8Wf+CG3U6sCdILW1lA==} @@ -3004,15 +3042,111 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@oxc-minify/binding-android-arm64@0.101.0': + resolution: {integrity: sha512-BsiE1+5kouWKqSujg2v0Ju0H+VpSntQvIXeh/MBTkrwdpxBo6SHvlGEA+H0LZmb8GEwb1igm0G+ziCx8uuobrw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxc-minify/binding-darwin-arm64@0.101.0': + resolution: {integrity: sha512-dZBr4dVuUk5jjxXYJyUN3uMLGU5onaxOmcBhQYXWicXTnEY7gvFVWxiIj3Mc4yaYYBPG7uU0//leEIKV5yazfQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxc-minify/binding-darwin-x64@0.101.0': + resolution: {integrity: sha512-5PTMwp/RP7QnGoaI9VRixQDJC+YvqKaGZk9SdQpAOf5k+WDVINiQGN3o+D6DNk8N2rsWmRjuUQb471+Z2JVu4w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxc-minify/binding-freebsd-x64@0.101.0': + resolution: {integrity: sha512-yDz0fV6ngwsqIx5q64Hj3UR60Rtr7UrdFJLYG0RwiONU6LUCXLX5yfoJwBwyMsGQlOyTSwItABZKamyAhUKOEw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxc-minify/binding-linux-arm-gnueabihf@0.101.0': + resolution: {integrity: sha512-ksy8AG2BZoCRi8mjTy4K+wtJR4cDcWA25OUw3QNrZ3apaVeCGakwCciOvTpj58FYCV72vtZqyykA1NFr6mEEVg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxc-minify/binding-linux-arm64-gnu@0.101.0': + resolution: {integrity: sha512-b4BzBNV+vYcz2CUgHJMzi/iZAVK28qfaQCFg3O8o3bAE/TuLFl8ndCdHqP17s+3eEDinRp5Xpk8W0/jaBZfFlw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@oxc-minify/binding-linux-arm64-musl@0.101.0': + resolution: {integrity: sha512-jjJ9qfa7iFbMeHJnbt8I43HRUEX16N79VAm7F1VNYp4gPBb0eP8wUqXsWAuFFRjH4ofK0UU6LM+IbbAyn2HcGw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@oxc-minify/binding-linux-riscv64-gnu@0.101.0': + resolution: {integrity: sha512-9hxzW09GKgkg8CCtMTqJmyA3nlUIaHOCD/ERAsF7NYNefHAzZ96XVcw9RquZxZfomD4s5hfJKRjHq5EwrxL9IA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@oxc-minify/binding-linux-s390x-gnu@0.101.0': + resolution: {integrity: sha512-W/MkwsxTT1rxnvX/oRKK9uHtD2et8sBYDYLkYLRO8uWcgV4G2ENzge3JSB8pc/dBUHL4vrysozRUeaw/WiAD/g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@oxc-minify/binding-linux-x64-gnu@0.101.0': + resolution: {integrity: sha512-HRJxY94+uhrpkFEPNKH3/7THqnRdy4HbkHbRjbZiJ9SH1Lo1joX2wmQZdUUWXDHPMEtzDF4WP9IUtAc8qMIZGA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@oxc-minify/binding-linux-x64-musl@0.101.0': + resolution: {integrity: sha512-5Sw9j6xSSFkUi84kGXhthxZeM+JL3OKPRmol2aThJ/V38YP0hGDl/q1STx5KGpgcHVgrVIrBOABNnMrvn2In0A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@oxc-minify/binding-openharmony-arm64@0.101.0': + resolution: {integrity: sha512-8M9RUb0ERObHrq+U4RAQ+aFHX+gpviDtZrvLpBCSqM2lDHzzzgCU1kNlZxV4m4W4FyfnbaPKDwkeUclctXC1Ag==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxc-minify/binding-wasm32-wasi@0.101.0': + resolution: {integrity: sha512-k208dXvhBpyCET35UTDRlNS19Z0d53dB5UqvpIjUrzZb+ructXs6Cffxceei8EYUHnOzqNLQ6fnKxHja8yV1Dg==} + engines: {node: '>=14.0.0'} + cpu: [wasm32] + + '@oxc-minify/binding-win32-arm64-msvc@0.101.0': + resolution: {integrity: sha512-u0PTuX59X2BggiMG64uadwuqPLtxEkfsNbBQ162sLGAPxg3VZaGcpCxHzm4dXtjUoBXheIpaHxqYcq+3NRHr8A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxc-minify/binding-win32-x64-msvc@0.101.0': + resolution: {integrity: sha512-ntwPl6erDXK51Fz/U5trqH9FHkQIZL1mZxW4M/2+VJujT6hxL8tzIQaZKSnwrRgFBGZhQzO+i7CSlb1keEax6w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@oxc-project/runtime@0.101.0': + resolution: {integrity: sha512-t3qpfVZIqSiLQ5Kqt/MC4Ge/WCOGrrcagAdzTcDaggupjiGxUx4nJF2v6wUCXWSzWHn5Ns7XLv13fCJEwCOERQ==} + engines: {node: ^20.19.0 || >=22.12.0} + '@oxc-project/runtime@0.99.0': resolution: {integrity: sha512-8iE5/4OK0SLHqWzRxSvI1gjFPmIH6718s8iwkuco95rBZsCZIHq+5wy4lYsASxnH+8FOhbGndiUrcwsVG5i2zw==} engines: {node: ^20.19.0 || >=22.12.0} - '@oxc-project/types@0.95.0': - resolution: {integrity: sha512-vACy7vhpMPhjEJhULNxrdR0D943TkA/MigMpJCHmBHvMXxRStRi/dPtTlfQ3uDwWSzRpT8z+7ImjZVf8JWBocQ==} - - '@oxc-project/types@0.99.0': - resolution: {integrity: sha512-LLDEhXB7g1m5J+woRSgfKsFPS3LhR9xRhTeIoEBm5WrkwMxn6eZ0Ld0c0K5eHB57ChZX6I3uSmmLjZ8pcjlRcw==} + '@oxc-project/types@0.101.0': + resolution: {integrity: sha512-nuFhqlUzJX+gVIPPfuE6xurd4lST3mdcWOhyK/rZO0B9XWMKm79SuszIQEnSMmmDhq1DC8WWVYGVd+6F93o1gQ==} '@parcel/watcher-android-arm64@2.5.1': resolution: {integrity: sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==} @@ -3129,89 +3263,83 @@ packages: '@quansync/fs@0.1.5': resolution: {integrity: sha512-lNS9hL2aS2NZgNW7BBj+6EBl4rOf8l+tQ0eRY6JWCI8jI2kc53gSoqbjojU0OnAWhzoXiOjFyGsHcDGePB3lhA==} - '@rolldown/binding-android-arm64@1.0.0-beta.52': - resolution: {integrity: sha512-MBGIgysimZPqTDcLXI+i9VveijkP5C3EAncEogXhqfax6YXj1Tr2LY3DVuEOMIjWfMPMhtQSPup4fSTAmgjqIw==} + '@rolldown/binding-android-arm64@1.0.0-beta.53': + resolution: {integrity: sha512-Ok9V8o7o6YfSdTTYA/uHH30r3YtOxLD6G3wih/U9DO0ucBBFq8WPt/DslU53OgfteLRHITZny9N/qCUxMf9kjQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] - '@rolldown/binding-darwin-arm64@1.0.0-beta.52': - resolution: {integrity: sha512-MmKeoLnKu1d9j6r19K8B+prJnIZ7u+zQ+zGQ3YHXGnr41rzE3eqQLovlkvoZnRoxDGPA4ps0pGiwXy6YE3lJyg==} + '@rolldown/binding-darwin-arm64@1.0.0-beta.53': + resolution: {integrity: sha512-yIsKqMz0CtRnVa6x3Pa+mzTihr4Ty+Z6HfPbZ7RVbk1Uxnco4+CUn7Qbm/5SBol1JD/7nvY8rphAgyAi7Lj6Vg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] - '@rolldown/binding-darwin-x64@1.0.0-beta.52': - resolution: {integrity: sha512-qpHedvQBmIjT8zdnjN3nWPR2qjQyJttbXniCEKKdHeAbZG9HyNPBUzQF7AZZGwmS9coQKL+hWg9FhWzh2dZ2IA==} + '@rolldown/binding-darwin-x64@1.0.0-beta.53': + resolution: {integrity: sha512-GTXe+mxsCGUnJOFMhfGWmefP7Q9TpYUseHvhAhr21nCTgdS8jPsvirb0tJwM3lN0/u/cg7bpFNa16fQrjKrCjQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] - '@rolldown/binding-freebsd-x64@1.0.0-beta.52': - resolution: {integrity: sha512-dDp7WbPapj/NVW0LSiH/CLwMhmLwwKb3R7mh2kWX+QW85X1DGVnIEyKh9PmNJjB/+suG1dJygdtdNPVXK1hylg==} + '@rolldown/binding-freebsd-x64@1.0.0-beta.53': + resolution: {integrity: sha512-9Tmp7bBvKqyDkMcL4e089pH3RsjD3SUungjmqWtyhNOxoQMh0fSmINTyYV8KXtE+JkxYMPWvnEt+/mfpVCkk8w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.52': - resolution: {integrity: sha512-9e4l6vy5qNSliDPqNfR6CkBOAx6PH7iDV4OJiEJzajajGrVy8gc/IKKJUsoE52G8ud8MX6r3PMl97NfwgOzB7g==} + '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.53': + resolution: {integrity: sha512-a1y5fiB0iovuzdbjUxa7+Zcvgv+mTmlGGC4XydVIsyl48eoxgaYkA3l9079hyTyhECsPq+mbr0gVQsFU11OJAQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.52': - resolution: {integrity: sha512-V48oDR84feRU2KRuzpALp594Uqlx27+zFsT6+BgTcXOtu7dWy350J1G28ydoCwKB+oxwsRPx2e7aeQnmd3YJbQ==} + '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.53': + resolution: {integrity: sha512-bpIGX+ov9PhJYV+wHNXl9rzq4F0QvILiURn0y0oepbQx+7stmQsKA0DhPGwmhfvF856wq+gbM8L92SAa/CBcLg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] libc: [glibc] - '@rolldown/binding-linux-arm64-musl@1.0.0-beta.52': - resolution: {integrity: sha512-ENLmSQCWqSA/+YN45V2FqTIemg7QspaiTjlm327eUAMeOLdqmSOVVyrQexJGNTQ5M8sDYCgVAig2Kk01Ggmqaw==} + '@rolldown/binding-linux-arm64-musl@1.0.0-beta.53': + resolution: {integrity: sha512-bGe5EBB8FVjHBR1mOLOPEFg1Lp3//7geqWkU5NIhxe+yH0W8FVrQ6WRYOap4SUTKdklD/dC4qPLREkMMQ855FA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] libc: [musl] - '@rolldown/binding-linux-x64-gnu@1.0.0-beta.52': - resolution: {integrity: sha512-klahlb2EIFltSUubn/VLjuc3qxp1E7th8ukayPfdkcKvvYcQ5rJztgx8JsJSuAKVzKtNTqUGOhy4On71BuyV8g==} + '@rolldown/binding-linux-x64-gnu@1.0.0-beta.53': + resolution: {integrity: sha512-qL+63WKVQs1CMvFedlPt0U9PiEKJOAL/bsHMKUDS6Vp2Q+YAv/QLPu8rcvkfIMvQ0FPU2WL0aX4eWwF6e/GAnA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] libc: [glibc] - '@rolldown/binding-linux-x64-musl@1.0.0-beta.52': - resolution: {integrity: sha512-UuA+JqQIgqtkgGN2c/AQ5wi8M6mJHrahz/wciENPTeI6zEIbbLGoth5XN+sQe2pJDejEVofN9aOAp0kaazwnVg==} + '@rolldown/binding-linux-x64-musl@1.0.0-beta.53': + resolution: {integrity: sha512-VGl9JIGjoJh3H8Mb+7xnVqODajBmrdOOb9lxWXdcmxyI+zjB2sux69br0hZJDTyLJfvBoYm439zPACYbCjGRmw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] libc: [musl] - '@rolldown/binding-openharmony-arm64@1.0.0-beta.52': - resolution: {integrity: sha512-1BNQW8u4ro8bsN1+tgKENJiqmvc+WfuaUhXzMImOVSMw28pkBKdfZtX2qJPADV3terx+vNJtlsgSGeb3+W6Jiw==} + '@rolldown/binding-openharmony-arm64@1.0.0-beta.53': + resolution: {integrity: sha512-B4iIserJXuSnNzA5xBLFUIjTfhNy7d9sq4FUMQY3GhQWGVhS2RWWzzDnkSU6MUt7/aHUrep0CdQfXUJI9D3W7A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] - '@rolldown/binding-wasm32-wasi@1.0.0-beta.52': - resolution: {integrity: sha512-K/p7clhCqJOQpXGykrFaBX2Dp9AUVIDHGc+PtFGBwg7V+mvBTv/tsm3LC3aUmH02H2y3gz4y+nUTQ0MLpofEEg==} + '@rolldown/binding-wasm32-wasi@1.0.0-beta.53': + resolution: {integrity: sha512-BUjAEgpABEJXilGq/BPh7jeU3WAJ5o15c1ZEgHaDWSz3LB881LQZnbNJHmUiM4d1JQWMYYyR1Y490IBHi2FPJg==} engines: {node: '>=14.0.0'} cpu: [wasm32] - '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.52': - resolution: {integrity: sha512-a4EkXBtnYYsKipjS7QOhEBM4bU5IlR9N1hU+JcVEVeuTiaslIyhWVKsvf7K2YkQHyVAJ+7/A9BtrGqORFcTgng==} + '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.53': + resolution: {integrity: sha512-s27uU7tpCWSjHBnxyVXHt3rMrQdJq5MHNv3BzsewCIroIw3DJFjMH1dzCPPMUFxnh1r52Nf9IJ/eWp6LDoyGcw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] - '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.52': - resolution: {integrity: sha512-5ZXcYyd4GxPA6QfbGrNcQjmjbuLGvfz6728pZMsQvGHI+06LT06M6TPtXvFvLgXtexc+OqvFe1yAIXJU1gob/w==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [ia32] - os: [win32] - - '@rolldown/binding-win32-x64-msvc@1.0.0-beta.52': - resolution: {integrity: sha512-tzpnRQXJrSzb8Z9sm97UD3cY0toKOImx+xRKsDLX4zHaAlRXWh7jbaKBePJXEN7gNw7Nm03PBNwphdtA8KSUYQ==} + '@rolldown/binding-win32-x64-msvc@1.0.0-beta.53': + resolution: {integrity: sha512-cjWL/USPJ1g0en2htb4ssMjIycc36RvdQAx1WlXnS6DpULswiUTVXPDesTifSKYSyvx24E0YqQkEm0K/M2Z/AA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] @@ -3219,8 +3347,8 @@ packages: '@rolldown/pluginutils@1.0.0-beta.29': resolution: {integrity: sha512-NIJgOsMjbxAXvoGq/X0gD7VPMQ8j9g0BiDaNjVNVjvl+iKXxL3Jre0v31RmBYeLEmkbj2s02v8vFTbUXi5XS2Q==} - '@rolldown/pluginutils@1.0.0-beta.52': - resolution: {integrity: sha512-/L0htLJZbaZFL1g9OHOblTxbCYIGefErJjtYOwgl9ZqNx27P3L0SDfjhhHIss32gu5NWgnxuT2a2Hnnv6QGHKA==} + '@rolldown/pluginutils@1.0.0-beta.53': + resolution: {integrity: sha512-vENRlFU4YbrwVqNDZ7fLvy+JR1CRkyr01jhSiDpE1u6py3OMzQfztQU2jxykW3ALNxO4kSlqIDeYyD0Y9RcQeQ==} '@rollup/plugin-alias@5.1.1': resolution: {integrity: sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==} @@ -3527,7 +3655,7 @@ packages: '@tailwindcss/vite@4.1.17': resolution: {integrity: sha512-4+9w8ZHOiGnpcGI6z1TVVfWaX/koK7fKeSYF3qlYg2xpBtbteP2ddBxiarL+HVgfSJGeK5RIxRQmKm4rTJJAwA==} peerDependencies: - vite: workspace:* + vite: workspace:rolldown-vite@* '@tybys/wasm-util@0.10.1': resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==} @@ -3577,6 +3705,9 @@ packages: '@types/escape-html@1.0.4': resolution: {integrity: sha512-qZ72SFTgUAZ5a7Tj6kf2SHLetiH5S6f8G5frB2SPQ3EyF02kxdyBFf4Tz4banE3xCgGnKgWLt//a6VuYHKYJTg==} + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + '@types/estree@1.0.7': resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==} @@ -3707,6 +3838,10 @@ packages: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/types@8.35.1': + resolution: {integrity: sha512-q/O04vVnKHfrrhNAscndAn1tuQhIkwqnaW+eu5waD5IPts2eX1dgJxgqcPx5BX109/qAz7IG6VrEPTOYKCNfRQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/types@8.48.0': resolution: {integrity: sha512-cQMcGQQH7kwKoVswD1xdOytxQR60MWKM1di26xSUtxehaDs/32Zpqsu5WJlXTtTTqyAVK8R7hvsUnIXRS+bjvA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -3848,13 +3983,13 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} peerDependencies: terser: ^5.16.0 - vite: workspace:* + vite: workspace:rolldown-vite@* '@vitejs/plugin-vue@6.0.1': resolution: {integrity: sha512-+MaE752hU0wfPFJEUAIxqw18+20euHHdxVtMvbFcOEpjEyfqXH/5DCoTHiVJ0J29EhTJdoTkjEv5YBKU9dnoTw==} engines: {node: ^20.19.0 || >=22.12.0} peerDependencies: - vite: workspace:* + vite: workspace:rolldown-vite@* vue: ^3.2.25 '@vitejs/release-scripts@1.6.0': @@ -4158,7 +4293,7 @@ packages: resolution: {integrity: sha512-RzS5NujlCzeRPF1MK7MXLiEFpkIXeMdQ+rN3Kk3tDI9j0mtbr7Nmuq67tpkOJQpgyClbOltCXMjLZicJHsH5Cg==} peerDependencies: msw: ^2.4.9 - vite: workspace:* + vite: workspace:rolldown-vite@* peerDependenciesMeta: msw: optional: true @@ -4192,24 +4327,36 @@ packages: '@vue/compiler-core@3.4.38': resolution: {integrity: sha512-8IQOTCWnLFqfHzOGm9+P8OPSEDukgg3Huc92qSG49if/xI2SAwLHQO2qaPQbjCWPBcQoO1WYfXfTACUrWV3c5A==} + '@vue/compiler-core@3.5.22': + resolution: {integrity: sha512-jQ0pFPmZwTEiRNSb+i9Ow/I/cHv2tXYqsnHKKyCQ08irI2kdF5qmYedmF8si8mA7zepUFmJ2hqzS8CQmNOWOkQ==} + '@vue/compiler-core@3.5.25': resolution: {integrity: sha512-vay5/oQJdsNHmliWoZfHPoVZZRmnSWhug0BYT34njkYTPqClh3DNWLkZNJBVSjsNMrg0CCrBfoKkjZQPM/QVUw==} '@vue/compiler-dom@3.4.38': resolution: {integrity: sha512-Osc/c7ABsHXTsETLgykcOwIxFktHfGSUDkb05V61rocEfsFDcjDLH/IHJSNJP+/Sv9KeN2Lx1V6McZzlSb9EhQ==} + '@vue/compiler-dom@3.5.22': + resolution: {integrity: sha512-W8RknzUM1BLkypvdz10OVsGxnMAuSIZs9Wdx1vzA3mL5fNMN15rhrSCLiTm6blWeACwUwizzPVqGJgOGBEN/hA==} + '@vue/compiler-dom@3.5.25': resolution: {integrity: sha512-4We0OAcMZsKgYoGlMjzYvaoErltdFI2/25wqanuTu+S4gismOTRTBPi4IASOjxWdzIwrYSjnqONfKvuqkXzE2Q==} '@vue/compiler-sfc@3.4.38': resolution: {integrity: sha512-s5QfZ+9PzPh3T5H4hsQDJtI8x7zdJaew/dCGgqZ2630XdzaZ3AD8xGZfBqpT8oaD/p2eedd+pL8tD5vvt5ZYJQ==} + '@vue/compiler-sfc@3.5.22': + resolution: {integrity: sha512-tbTR1zKGce4Lj+JLzFXDq36K4vcSZbJ1RBu8FxcDv1IGRz//Dh2EBqksyGVypz3kXpshIfWKGOCcqpSbyGWRJQ==} + '@vue/compiler-sfc@3.5.25': resolution: {integrity: sha512-PUgKp2rn8fFsI++lF2sO7gwO2d9Yj57Utr5yEsDf3GNaQcowCLKL7sf+LvVFvtJDXUp/03+dC6f2+LCv5aK1ag==} '@vue/compiler-ssr@3.4.38': resolution: {integrity: sha512-YXznKFQ8dxYpAz9zLuVvfcXhc31FSPFDcqr0kyujbOwNhlmaNvL2QfIy+RZeJgSn5Fk54CWoEUeW+NVBAogGaw==} + '@vue/compiler-ssr@3.5.22': + resolution: {integrity: sha512-GdgyLvg4R+7T8Nk2Mlighx7XGxq/fJf9jaVofc3IL0EPesTE86cP/8DD1lT3h1JeZr2ySBvyqKQJgbS54IX1Ww==} + '@vue/compiler-ssr@3.5.25': resolution: {integrity: sha512-ritPSKLBcParnsKYi+GNtbdbrIE1mtuFEJ4U1sWeuOMlIziK5GtOL85t5RhsNy4uWIXPgk+OUdpnXiTdzn8o3A==} @@ -4236,18 +4383,27 @@ packages: '@vue/reactivity@3.4.38': resolution: {integrity: sha512-4vl4wMMVniLsSYYeldAKzbk72+D3hUnkw9z8lDeJacTxAkXeDAP1uE9xr2+aKIN0ipOL8EG2GPouVTH6yF7Gnw==} + '@vue/reactivity@3.5.22': + resolution: {integrity: sha512-f2Wux4v/Z2pqc9+4SmgZC1p73Z53fyD90NFWXiX9AKVnVBEvLFOWCEgJD3GdGnlxPZt01PSlfmLqbLYzY/Fw4A==} + '@vue/reactivity@3.5.25': resolution: {integrity: sha512-5xfAypCQepv4Jog1U4zn8cZIcbKKFka3AgWHEFQeK65OW+Ys4XybP6z2kKgws4YB43KGpqp5D/K3go2UPPunLA==} '@vue/runtime-core@3.4.38': resolution: {integrity: sha512-21z3wA99EABtuf+O3IhdxP0iHgkBs1vuoCAsCKLVJPEjpVqvblwBnTj42vzHRlWDCyxu9ptDm7sI2ZMcWrQqlA==} + '@vue/runtime-core@3.5.22': + resolution: {integrity: sha512-EHo4W/eiYeAzRTN5PCextDUZ0dMs9I8mQ2Fy+OkzvRPUYQEyK9yAjbasrMCXbLNhF7P0OUyivLjIy0yc6VrLJQ==} + '@vue/runtime-core@3.5.25': resolution: {integrity: sha512-Z751v203YWwYzy460bzsYQISDfPjHTl+6Zzwo/a3CsAf+0ccEjQ8c+0CdX1WsumRTHeywvyUFtW6KvNukT/smA==} '@vue/runtime-dom@3.4.38': resolution: {integrity: sha512-afZzmUreU7vKwKsV17H1NDThEEmdYI+GCAK/KY1U957Ig2NATPVjCROv61R19fjZNzMmiU03n79OMnXyJVN0UA==} + '@vue/runtime-dom@3.5.22': + resolution: {integrity: sha512-Av60jsryAkI023PlN7LsqrfPvwfxOd2yAwtReCjeuugTJTkgrksYJJstg1e12qle0NarkfhfFu1ox2D+cQotww==} + '@vue/runtime-dom@3.5.25': resolution: {integrity: sha512-a4WrkYFbb19i9pjkz38zJBg8wa/rboNERq3+hRRb0dHiJh13c+6kAbgqCPfMaJ2gg4weWD3APZswASOfmKwamA==} @@ -4256,6 +4412,11 @@ packages: peerDependencies: vue: 3.4.38 + '@vue/server-renderer@3.5.22': + resolution: {integrity: sha512-gXjo+ao0oHYTSswF+a3KRHZ1WszxIqO7u6XwNHqcqb9JfyIL/pbWrrh/xLv7jeDqla9u+LK7yfZKHih1e1RKAQ==} + peerDependencies: + vue: 3.5.22 + '@vue/server-renderer@3.5.25': resolution: {integrity: sha512-UJaXR54vMG61i8XNIzTSf2Q7MOqZHpp8+x3XLGtE3+fL+nQd+k7O5+X3D/uWrnQXOdMw5VPih+Uremcw+u1woQ==} peerDependencies: @@ -4264,6 +4425,9 @@ packages: '@vue/shared@3.4.38': resolution: {integrity: sha512-q0xCiLkuWWQLzVrecPb0RMsNWyxICOjPrcrwxTUEHb1fsnvni4dcuyG7RT/Ie7VPTvnjzIaWzRMUBsrqNj/hhw==} + '@vue/shared@3.5.22': + resolution: {integrity: sha512-F4yc6palwq3TT0u+FYf0Ns4Tfl9GRFURDN2gWG7L1ecIaS/4fCIuFOjMTnCyjsu/OK6vaDKLCrGAa+KvvH+h4w==} + '@vue/shared@3.5.25': resolution: {integrity: sha512-AbOPdQQnAnzs58H2FrrDxYj/TJfmeS2jdfEEhgiKINy+bnOANmVizIEgq1r+C5zsbs6l1CCQxtcj71rwNQ4jWg==} @@ -4539,8 +4703,8 @@ packages: resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==} engines: {node: '>= 6'} - caniuse-lite@1.0.30001755: - resolution: {integrity: sha512-44V+Jm6ctPj7R52Na4TLi3Zri4dWUljJd+RDm+j8LtNCc/ihLCT+X1TzoOAkRETEWqjuLnh9581Tl80FvK7jVA==} + caniuse-lite@1.0.30001756: + resolution: {integrity: sha512-4HnCNKbMLkLdhJz3TToeVWHSnfJvPaq6vu/eRP0Ahub/07n484XHhBF5AJoSGHdVrS8tKFauUQz8Bp9P7LVx7A==} ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} @@ -4716,8 +4880,8 @@ packages: resolution: {integrity: sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==} engines: {node: '>=12.13'} - core-js-compat@3.44.0: - resolution: {integrity: sha512-JepmAj2zfl6ogy34qfWtcE7nHKAJnKsQFRn++scjVS2bZFllwptzw61BZcZFYBPpUznLfAvh0LGhxKppk04ClA==} + core-js-compat@3.43.0: + resolution: {integrity: sha512-2GML2ZsCc5LR7hZYz4AXmjQw8zuy2T//2QntwdnpuYI7jteT6GVYJL7F6C2C57R7gSYrcqVW3lAALefdbhBLDA==} core-js@3.47.0: resolution: {integrity: sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg==} @@ -4738,6 +4902,9 @@ packages: engines: {node: '>=4'} hasBin: true + csstype@3.1.3: + resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + csstype@3.2.3: resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==} @@ -4778,6 +4945,10 @@ packages: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} + destroy@1.2.0: + resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} + engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} + detect-libc@1.0.3: resolution: {integrity: sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==} engines: {node: '>=0.10'} @@ -4838,8 +5009,8 @@ packages: ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - electron-to-chromium@1.5.254: - resolution: {integrity: sha512-DcUsWpVhv9svsKRxnSCZ86SjD+sp32SGidNB37KpqXJncp1mfUgKbHvBomE89WJDbfVKw1mdv5+ikrvd43r+Bg==} + electron-to-chromium@1.5.258: + resolution: {integrity: sha512-rHUggNV5jKQ0sSdWwlaRDkFc3/rRJIVnOSe9yR4zrR07m3ZxhP4N27Hlg8VeJGGYgFTxK5NqDmWI4DSH72vIJg==} emoji-regex@10.4.0: resolution: {integrity: sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==} @@ -5167,8 +5338,8 @@ packages: focus-trap@7.6.6: resolution: {integrity: sha512-v/Z8bvMCajtx4mEXmOo7QEsIzlIOqRXTIwgUfsFOF9gEsespdbD0AkPIka1bSXZ8Y8oZ+2IVDQZePkTfEHZl7Q==} - follow-redirects@1.15.11: - resolution: {integrity: sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==} + follow-redirects@1.15.9: + resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==} engines: {node: '>=4.0'} peerDependencies: debug: '*' @@ -5195,6 +5366,10 @@ packages: fraction.js@5.3.4: resolution: {integrity: sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==} + fresh@0.5.2: + resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} + engines: {node: '>= 0.6'} + fresh@2.0.0: resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} engines: {node: '>= 0.8'} @@ -5222,8 +5397,8 @@ packages: resolution: {integrity: sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==} engines: {node: '>=18'} - get-intrinsic@1.3.0: - resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + get-intrinsic@1.2.7: + resolution: {integrity: sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==} engines: {node: '>= 0.4'} get-proto@1.0.1: @@ -5241,6 +5416,9 @@ packages: get-them-args@1.3.2: resolution: {integrity: sha512-LRn8Jlk+DwZE4GTlDbT3Hikd1wSHgLMme/+7ddlqKd7ldwR6LjJgTVWzBnR01wnYGe4KgrXjg287RaI22UHmAw==} + get-tsconfig@4.10.1: + resolution: {integrity: sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==} + get-tsconfig@4.13.0: resolution: {integrity: sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ==} @@ -5589,11 +5767,11 @@ packages: kolorist@1.8.0: resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} - launch-editor-middleware@2.12.0: - resolution: {integrity: sha512-SgU5QWoR+Grq1sQedvS/RlfoyO6bdvrztpP+2RRg8UzE7Jz2Yup5J4jiFfm2J9dYBCQYD26AbJVbjnvgwdL6Pw==} + launch-editor-middleware@2.11.1: + resolution: {integrity: sha512-6xpn4pJz5mDg2kUH7L6gK5BuZcZPdVwoSs/DhfebefwLyszNXqFFjksGup/w4CTRzzrr8FSEufDzb/gKFLle6w==} - launch-editor@2.12.0: - resolution: {integrity: sha512-giOHXoOtifjdHqUamwKq6c49GzBdLjvxrd2D+Q4V6uOHopJv7p9VJxikDsQ/CBXZbEITgUqSVHXLTG3VhPP1Dg==} + launch-editor@2.11.1: + resolution: {integrity: sha512-SEET7oNfgSaB6Ym0jufAdCeo3meJVeCaaDyzRygy0xsp2BFKCprcfHljTq4QkzTLUxEKkFK6OK4811YM2oSrRg==} less@4.4.2: resolution: {integrity: sha512-j1n1IuTX1VQjIy3tT7cyGbX7nvQOsFLoIqobZv4ttI5axP923gA44zUj6miiA6R5Aoms4sEGVIIcucXUbRI14g==} @@ -5917,6 +6095,10 @@ packages: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} + mime-db@1.53.0: + resolution: {integrity: sha512-oHlN/w+3MQ3rba9rqFr6V/ypF10LSkdwUysQL7GkXoTgIWeV+tcXGA852TBxH+gsh8UWoyhR1hKcoMJTuWflpg==} + engines: {node: '>= 0.6'} + mime-db@1.54.0: resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} engines: {node: '>= 0.6'} @@ -5925,9 +6107,13 @@ packages: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} - mime-types@3.0.2: - resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==} - engines: {node: '>=18'} + mime-types@3.0.0: + resolution: {integrity: sha512-XqoSHeCGjVClAmoGFG3lVFqQFRIrTVw2OH3axRqAcfaw+gHWIfnASS92AV+Rl/mk0MupgZTRHQOjxY6YVnzK5w==} + engines: {node: '>= 0.6'} + + mime-types@3.0.1: + resolution: {integrity: sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==} + engines: {node: '>= 0.6'} mime@1.6.0: resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} @@ -5947,6 +6133,10 @@ packages: engines: {node: '>=18.0.0'} hasBin: true + minimatch@10.0.1: + resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} + engines: {node: 20 || >=22} + minimatch@10.0.3: resolution: {integrity: sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==} engines: {node: 20 || >=22} @@ -6008,8 +6198,8 @@ packages: engines: {node: ^18 || >=20} hasBin: true - napi-postinstall@0.2.5: - resolution: {integrity: sha512-kmsgUvCRIJohHjbZ3V8avP0I1Pekw329MVAMDzVxsrkjgdnqiwvMX5XwR+hWV66vsAtZ+iM+fVnq8RTQawUmCQ==} + napi-postinstall@0.2.4: + resolution: {integrity: sha512-ZEzHJwBhZ8qQSbknHqYcdtQVr8zUgGyM/q6h6qAyhtyVMNrSgDhrC4disf03dYW0e+czXyLnZINnCTEkWy0eJg==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} hasBin: true @@ -6128,6 +6318,10 @@ packages: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} + oxc-minify@0.101.0: + resolution: {integrity: sha512-HbndptRRVTuLNiuNsd/uP75u8t2t1V+xNPz/+U486cyTBMkJyyNbKvf5TeDszSw4dKX6WjpjCo9P9dV99SR9KQ==} + engines: {node: ^20.19.0 || >=22.12.0} + p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -6436,6 +6630,9 @@ packages: resolution: {integrity: sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==} engines: {node: '>=0.6'} + quansync@0.2.10: + resolution: {integrity: sha512-t41VRkMYbkHyCYmOvx/6URnN80H7k4X0lLdBMGsz+maAwrJQYB1djpV6vHrQIBE0WBSGqhtEHrK9U3DWWH8v7A==} + quansync@0.2.11: resolution: {integrity: sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA==} @@ -6528,11 +6725,6 @@ packages: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} - requirejs@2.3.8: - resolution: {integrity: sha512-7/cTSLOdYkNBNJcDMWf+luFvMriVm7eYxp4BcFCsAX0wF421Vyce5SXP17c+Jd5otXKGNehIonFlyQXSowL6Mw==} - engines: {node: '>=0.4.0'} - hasBin: true - resolve-from@4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} @@ -6566,7 +6758,7 @@ packages: peerDependencies: '@ts-macro/tsc': ^0.3.6 '@typescript/native-preview': '>=7.0.0-dev.20250601.1' - rolldown: ^1.0.0-beta.52 + rolldown: 1.0.0-beta.53 typescript: ^5.0.0 vue-tsc: ~3.1.0 peerDependenciesMeta: @@ -6579,8 +6771,8 @@ packages: vue-tsc: optional: true - rolldown@1.0.0-beta.52: - resolution: {integrity: sha512-Hbnpljue+JhMJrlOjQ1ixp9me7sUec7OjFvS+A1Qm8k8Xyxmw3ZhxFu7LlSXW1s9AX3POE9W9o2oqCEeR5uDmg==} + rolldown@1.0.0-beta.53: + resolution: {integrity: sha512-Qd9c2p0XKZdgT5AYd+KgAMggJ8ZmCs3JnS9PTMWkyUfteKlfmKtxJbWTHkVakxwXs1Ub7jrRYVeFeF7N0sQxyw==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true @@ -6778,6 +6970,10 @@ packages: engines: {node: '>=10'} hasBin: true + send@1.1.0: + resolution: {integrity: sha512-v67WcEouB5GxbTWL/4NeToqcZiAWEq90N888fczVArY8A79J0L4FD7vj5hm3eUMua5EpoQ59wa/oovY6TLvRUA==} + engines: {node: '>= 18'} + send@1.2.0: resolution: {integrity: sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==} engines: {node: '>= 18'} @@ -7329,7 +7525,7 @@ packages: vitepress-plugin-group-icons@1.6.5: resolution: {integrity: sha512-+pg4+GKDq2fLqKb1Sat5p1p4SuIZ5tEPxu8HjpwoeecZ/VaXKy6Bdf0wyjedjaTAyZQzXbvyavJegqAcQ+B0VA==} peerDependencies: - vite: workspace:* + vite: workspace:rolldown-vite@* peerDependenciesMeta: vite: optional: true @@ -7412,6 +7608,14 @@ packages: typescript: optional: true + vue@3.5.22: + resolution: {integrity: sha512-toaZjQ3a/G/mYaLSbV+QsQhIdMo9x5rrqIpYRObsJ6T/J+RyCSFwN2LHNVH9v8uIcljDNa3QzPVdv3Y6b9hAJQ==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + vue@3.5.25: resolution: {integrity: sha512-YLVdgv2K13WJ6n+kD5owehKtEXwdwXuj2TTyJMsO7pSeKw2bfRNZGjhB7YzrpbMYj5b5QsUebHpOqR3R3ziy/g==} peerDependencies: @@ -7569,6 +7773,8 @@ snapshots: js-tokens: 4.0.0 picocolors: 1.1.1 + '@babel/compat-data@7.27.7': {} + '@babel/compat-data@7.28.5': {} '@babel/core@7.28.5(ms@2.1.3)': @@ -7601,11 +7807,11 @@ snapshots: '@babel/helper-annotate-as-pure@7.27.3': dependencies: - '@babel/types': 7.28.5 + '@babel/types': 7.28.4 '@babel/helper-compilation-targets@7.27.2': dependencies: - '@babel/compat-data': 7.28.5 + '@babel/compat-data': 7.27.7 '@babel/helper-validator-option': 7.27.1 browserslist: 4.28.0 lru-cache: 5.1.1 @@ -7647,7 +7853,7 @@ snapshots: '@babel/helper-member-expression-to-functions@7.27.1(ms@2.1.3)': dependencies: '@babel/traverse': 7.28.5(ms@2.1.3) - '@babel/types': 7.28.5 + '@babel/types': 7.28.4 transitivePeerDependencies: - ms @@ -7669,7 +7875,7 @@ snapshots: '@babel/helper-optimise-call-expression@7.27.1': dependencies: - '@babel/types': 7.28.5 + '@babel/types': 7.28.4 '@babel/helper-plugin-utils@7.27.1': {} @@ -7694,7 +7900,7 @@ snapshots: '@babel/helper-skip-transparent-expression-wrappers@7.27.1(ms@2.1.3)': dependencies: '@babel/traverse': 7.28.5(ms@2.1.3) - '@babel/types': 7.28.5 + '@babel/types': 7.28.4 transitivePeerDependencies: - ms @@ -7708,7 +7914,7 @@ snapshots: dependencies: '@babel/template': 7.27.2 '@babel/traverse': 7.28.5(ms@2.1.3) - '@babel/types': 7.28.5 + '@babel/types': 7.28.4 transitivePeerDependencies: - ms @@ -7717,6 +7923,10 @@ snapshots: '@babel/template': 7.27.2 '@babel/types': 7.28.5 + '@babel/parser@7.27.5': + dependencies: + '@babel/types': 7.27.7 + '@babel/parser@7.28.5': dependencies: '@babel/types': 7.28.5 @@ -8180,7 +8390,7 @@ snapshots: babel-plugin-polyfill-corejs2: 0.4.14(@babel/core@7.28.5(ms@2.1.3))(ms@2.1.3) babel-plugin-polyfill-corejs3: 0.13.0(@babel/core@7.28.5(ms@2.1.3))(ms@2.1.3) babel-plugin-polyfill-regenerator: 0.6.5(@babel/core@7.28.5(ms@2.1.3))(ms@2.1.3) - core-js-compat: 3.44.0 + core-js-compat: 3.43.0 semver: 6.3.1 transitivePeerDependencies: - ms @@ -8189,7 +8399,7 @@ snapshots: dependencies: '@babel/core': 7.28.5(ms@2.1.3) '@babel/helper-plugin-utils': 7.27.1 - '@babel/types': 7.28.5 + '@babel/types': 7.28.4 esutils: 2.0.3 '@babel/runtime@7.28.4': {} @@ -8212,6 +8422,16 @@ snapshots: transitivePeerDependencies: - ms + '@babel/types@7.27.7': + dependencies: + '@babel/helper-string-parser': 7.27.1 + '@babel/helper-validator-identifier': 7.28.5 + + '@babel/types@7.28.4': + dependencies: + '@babel/helper-string-parser': 7.27.1 + '@babel/helper-validator-identifier': 7.28.5 + '@babel/types@7.28.5': dependencies: '@babel/helper-string-parser': 7.27.1 @@ -8278,13 +8498,29 @@ snapshots: dependencies: htm: 3.1.1 - '@emnapi/core@1.5.0': + '@emnapi/core@1.4.3': + dependencies: + '@emnapi/wasi-threads': 1.0.2 + tslib: 2.8.1 + optional: true + + '@emnapi/core@1.7.1': dependencies: '@emnapi/wasi-threads': 1.1.0 tslib: 2.8.1 optional: true - '@emnapi/runtime@1.5.0': + '@emnapi/runtime@1.4.3': + dependencies: + tslib: 2.8.1 + optional: true + + '@emnapi/runtime@1.7.1': + dependencies: + tslib: 2.8.1 + optional: true + + '@emnapi/wasi-threads@1.0.2': dependencies: tslib: 2.8.1 optional: true @@ -8452,6 +8688,11 @@ snapshots: eslint: 9.39.1(jiti@2.6.1)(ms@2.1.3) eslint-visitor-keys: 3.4.3 + '@eslint-community/eslint-utils@4.9.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3))': + dependencies: + eslint: 9.39.1(jiti@2.6.1)(ms@2.1.3) + eslint-visitor-keys: 3.4.3 + '@eslint-community/regexpp@4.12.1': {} '@eslint/config-array@0.21.1(ms@2.1.3)': @@ -8520,7 +8761,7 @@ snapshots: dependencies: '@iconify/types': 2.0.0 - '@iconify-json/simple-icons@1.2.60': + '@iconify-json/simple-icons@1.2.59': dependencies: '@iconify/types': 2.0.0 @@ -8609,7 +8850,7 @@ snapshots: '@img/sharp-wasm32@0.33.5': dependencies: - '@emnapi/runtime': 1.5.0 + '@emnapi/runtime': 1.7.1 optional: true '@img/sharp-win32-ia32@0.33.5': @@ -8638,6 +8879,12 @@ snapshots: '@jridgewell/sourcemap-codec': 1.5.5 '@jridgewell/trace-mapping': 0.3.31 + '@jridgewell/gen-mapping@0.3.8': + dependencies: + '@jridgewell/set-array': 1.2.1 + '@jridgewell/sourcemap-codec': 1.5.5 + '@jridgewell/trace-mapping': 0.3.31 + '@jridgewell/remapping@2.3.5': dependencies: '@jridgewell/gen-mapping': 0.3.12 @@ -8645,6 +8892,8 @@ snapshots: '@jridgewell/resolve-uri@3.1.2': {} + '@jridgewell/set-array@1.2.1': {} + '@jridgewell/source-map@0.3.6': dependencies: '@jridgewell/gen-mapping': 0.3.12 @@ -8670,15 +8919,22 @@ snapshots: '@napi-rs/wasm-runtime@0.2.11': dependencies: - '@emnapi/core': 1.5.0 - '@emnapi/runtime': 1.5.0 + '@emnapi/core': 1.7.1 + '@emnapi/runtime': 1.7.1 + '@tybys/wasm-util': 0.9.0 + optional: true + + '@napi-rs/wasm-runtime@0.2.9': + dependencies: + '@emnapi/core': 1.4.3 + '@emnapi/runtime': 1.4.3 '@tybys/wasm-util': 0.9.0 optional: true - '@napi-rs/wasm-runtime@1.0.7': + '@napi-rs/wasm-runtime@1.1.0': dependencies: - '@emnapi/core': 1.5.0 - '@emnapi/runtime': 1.5.0 + '@emnapi/core': 1.7.1 + '@emnapi/runtime': 1.7.1 '@tybys/wasm-util': 0.10.1 optional: true @@ -8714,7 +8970,7 @@ snapshots: '@node-rs/bcrypt-wasm32-wasi@1.10.7': dependencies: - '@napi-rs/wasm-runtime': 0.2.11 + '@napi-rs/wasm-runtime': 0.2.9 optional: true '@node-rs/bcrypt-win32-arm64-msvc@1.10.7': @@ -8755,11 +9011,58 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.19.0 - '@oxc-project/runtime@0.99.0': {} + '@oxc-minify/binding-android-arm64@0.101.0': + optional: true - '@oxc-project/types@0.95.0': {} + '@oxc-minify/binding-darwin-arm64@0.101.0': + optional: true - '@oxc-project/types@0.99.0': {} + '@oxc-minify/binding-darwin-x64@0.101.0': + optional: true + + '@oxc-minify/binding-freebsd-x64@0.101.0': + optional: true + + '@oxc-minify/binding-linux-arm-gnueabihf@0.101.0': + optional: true + + '@oxc-minify/binding-linux-arm64-gnu@0.101.0': + optional: true + + '@oxc-minify/binding-linux-arm64-musl@0.101.0': + optional: true + + '@oxc-minify/binding-linux-riscv64-gnu@0.101.0': + optional: true + + '@oxc-minify/binding-linux-s390x-gnu@0.101.0': + optional: true + + '@oxc-minify/binding-linux-x64-gnu@0.101.0': + optional: true + + '@oxc-minify/binding-linux-x64-musl@0.101.0': + optional: true + + '@oxc-minify/binding-openharmony-arm64@0.101.0': + optional: true + + '@oxc-minify/binding-wasm32-wasi@0.101.0': + dependencies: + '@napi-rs/wasm-runtime': 1.1.0 + optional: true + + '@oxc-minify/binding-win32-arm64-msvc@0.101.0': + optional: true + + '@oxc-minify/binding-win32-x64-msvc@0.101.0': + optional: true + + '@oxc-project/runtime@0.101.0': {} + + '@oxc-project/runtime@0.99.0': {} + + '@oxc-project/types@0.101.0': {} '@parcel/watcher-android-arm64@2.5.1': optional: true @@ -8847,53 +9150,50 @@ snapshots: dependencies: quansync: 0.2.11 - '@rolldown/binding-android-arm64@1.0.0-beta.52': + '@rolldown/binding-android-arm64@1.0.0-beta.53': optional: true - '@rolldown/binding-darwin-arm64@1.0.0-beta.52': + '@rolldown/binding-darwin-arm64@1.0.0-beta.53': optional: true - '@rolldown/binding-darwin-x64@1.0.0-beta.52': + '@rolldown/binding-darwin-x64@1.0.0-beta.53': optional: true - '@rolldown/binding-freebsd-x64@1.0.0-beta.52': + '@rolldown/binding-freebsd-x64@1.0.0-beta.53': optional: true - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.52': + '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.53': optional: true - '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.52': + '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.53': optional: true - '@rolldown/binding-linux-arm64-musl@1.0.0-beta.52': + '@rolldown/binding-linux-arm64-musl@1.0.0-beta.53': optional: true - '@rolldown/binding-linux-x64-gnu@1.0.0-beta.52': + '@rolldown/binding-linux-x64-gnu@1.0.0-beta.53': optional: true - '@rolldown/binding-linux-x64-musl@1.0.0-beta.52': + '@rolldown/binding-linux-x64-musl@1.0.0-beta.53': optional: true - '@rolldown/binding-openharmony-arm64@1.0.0-beta.52': + '@rolldown/binding-openharmony-arm64@1.0.0-beta.53': optional: true - '@rolldown/binding-wasm32-wasi@1.0.0-beta.52': + '@rolldown/binding-wasm32-wasi@1.0.0-beta.53': dependencies: - '@napi-rs/wasm-runtime': 1.0.7 + '@napi-rs/wasm-runtime': 1.1.0 optional: true - '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.52': + '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.53': optional: true - '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.52': - optional: true - - '@rolldown/binding-win32-x64-msvc@1.0.0-beta.52': + '@rolldown/binding-win32-x64-msvc@1.0.0-beta.53': optional: true '@rolldown/pluginutils@1.0.0-beta.29': {} - '@rolldown/pluginutils@1.0.0-beta.52': {} + '@rolldown/pluginutils@1.0.0-beta.53': {} '@rollup/plugin-alias@5.1.1(rollup@4.43.0)': optionalDependencies: @@ -9177,26 +9477,26 @@ snapshots: '@types/babel__core@7.20.5': dependencies: - '@babel/parser': 7.28.5 - '@babel/types': 7.28.5 + '@babel/parser': 7.27.5 + '@babel/types': 7.27.7 '@types/babel__generator': 7.6.8 '@types/babel__template': 7.4.4 '@types/babel__traverse': 7.20.6 '@types/babel__generator@7.6.8': dependencies: - '@babel/types': 7.28.5 + '@babel/types': 7.27.7 '@types/babel__preset-env@7.10.0': {} '@types/babel__template@7.4.4': dependencies: '@babel/parser': 7.28.5 - '@babel/types': 7.28.5 + '@babel/types': 7.27.7 '@types/babel__traverse@7.20.6': dependencies: - '@babel/types': 7.28.5 + '@babel/types': 7.27.7 '@types/body-parser@1.19.5': dependencies: @@ -9225,6 +9525,8 @@ snapshots: '@types/escape-html@1.0.4': {} + '@types/estree@1.0.6': {} + '@types/estree@1.0.7': {} '@types/estree@1.0.8': {} @@ -9379,6 +9681,8 @@ snapshots: transitivePeerDependencies: - ms + '@typescript-eslint/types@8.35.1': {} + '@typescript-eslint/types@8.48.0': {} '@typescript-eslint/typescript-estree@8.48.0(ms@2.1.3)(typescript@5.9.3)': @@ -9398,7 +9702,7 @@ snapshots: '@typescript-eslint/utils@8.48.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3))(ms@2.1.3)(typescript@5.9.3)': dependencies: - '@eslint-community/eslint-utils': 4.8.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3)) + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3)) '@typescript-eslint/scope-manager': 8.48.0 '@typescript-eslint/types': 8.48.0 '@typescript-eslint/typescript-estree': 8.48.0(ms@2.1.3)(typescript@5.9.3) @@ -9804,6 +10108,14 @@ snapshots: estree-walker: 2.0.2 source-map-js: 1.2.1 + '@vue/compiler-core@3.5.22': + dependencies: + '@babel/parser': 7.28.5 + '@vue/shared': 3.5.22 + entities: 4.5.0 + estree-walker: 2.0.2 + source-map-js: 1.2.1 + '@vue/compiler-core@3.5.25': dependencies: '@babel/parser': 7.28.5 @@ -9817,6 +10129,11 @@ snapshots: '@vue/compiler-core': 3.4.38 '@vue/shared': 3.4.38 + '@vue/compiler-dom@3.5.22': + dependencies: + '@vue/compiler-core': 3.5.22 + '@vue/shared': 3.5.22 + '@vue/compiler-dom@3.5.25': dependencies: '@vue/compiler-core': 3.5.25 @@ -9834,6 +10151,18 @@ snapshots: postcss: 8.5.6 source-map-js: 1.2.1 + '@vue/compiler-sfc@3.5.22': + dependencies: + '@babel/parser': 7.28.5 + '@vue/compiler-core': 3.5.22 + '@vue/compiler-dom': 3.5.22 + '@vue/compiler-ssr': 3.5.22 + '@vue/shared': 3.5.22 + estree-walker: 2.0.2 + magic-string: 0.30.21 + postcss: 8.5.6 + source-map-js: 1.2.1 + '@vue/compiler-sfc@3.5.25': dependencies: '@babel/parser': 7.28.5 @@ -9851,6 +10180,11 @@ snapshots: '@vue/compiler-dom': 3.4.38 '@vue/shared': 3.4.38 + '@vue/compiler-ssr@3.5.22': + dependencies: + '@vue/compiler-dom': 3.5.22 + '@vue/shared': 3.5.22 + '@vue/compiler-ssr@3.5.25': dependencies: '@vue/compiler-dom': 3.5.25 @@ -9892,6 +10226,10 @@ snapshots: dependencies: '@vue/shared': 3.4.38 + '@vue/reactivity@3.5.22': + dependencies: + '@vue/shared': 3.5.22 + '@vue/reactivity@3.5.25': dependencies: '@vue/shared': 3.5.25 @@ -9901,6 +10239,11 @@ snapshots: '@vue/reactivity': 3.4.38 '@vue/shared': 3.4.38 + '@vue/runtime-core@3.5.22': + dependencies: + '@vue/reactivity': 3.5.22 + '@vue/shared': 3.5.22 + '@vue/runtime-core@3.5.25': dependencies: '@vue/reactivity': 3.5.25 @@ -9911,7 +10254,14 @@ snapshots: '@vue/reactivity': 3.4.38 '@vue/runtime-core': 3.4.38 '@vue/shared': 3.4.38 - csstype: 3.2.3 + csstype: 3.1.3 + + '@vue/runtime-dom@3.5.22': + dependencies: + '@vue/reactivity': 3.5.22 + '@vue/runtime-core': 3.5.22 + '@vue/shared': 3.5.22 + csstype: 3.1.3 '@vue/runtime-dom@3.5.25': dependencies: @@ -9926,6 +10276,12 @@ snapshots: '@vue/shared': 3.4.38 vue: 3.5.25(typescript@5.9.3) + '@vue/server-renderer@3.5.22(vue@3.5.22(typescript@5.9.3))': + dependencies: + '@vue/compiler-ssr': 3.5.22 + '@vue/shared': 3.5.22 + vue: 3.5.22(typescript@5.9.3) + '@vue/server-renderer@3.5.25(vue@3.5.25(typescript@5.9.3))': dependencies: '@vue/compiler-ssr': 3.5.25 @@ -9934,6 +10290,8 @@ snapshots: '@vue/shared@3.4.38': {} + '@vue/shared@3.5.22': {} + '@vue/shared@3.5.25': {} '@vueuse/core@14.0.0(vue@3.5.25(typescript@5.9.3))': @@ -9960,7 +10318,7 @@ snapshots: accepts@2.0.0: dependencies: - mime-types: 3.0.2 + mime-types: 3.0.0 negotiator: 1.0.0 acorn-jsx@5.3.2(acorn@8.15.0): @@ -10037,7 +10395,7 @@ snapshots: autoprefixer@10.4.22(postcss@8.5.6): dependencies: browserslist: 4.28.0 - caniuse-lite: 1.0.30001755 + caniuse-lite: 1.0.30001756 fraction.js: 5.3.4 normalize-range: 0.1.2 picocolors: 1.1.1 @@ -10046,7 +10404,7 @@ snapshots: axios@1.13.2: dependencies: - follow-redirects: 1.15.11(obug@1.0.2(ms@2.1.3)) + follow-redirects: 1.15.9(obug@1.0.2(ms@2.1.3)) form-data: 4.0.4 proxy-from-env: 1.1.0 transitivePeerDependencies: @@ -10065,7 +10423,7 @@ snapshots: dependencies: '@babel/core': 7.28.5(ms@2.1.3) '@babel/helper-define-polyfill-provider': 0.6.5(@babel/core@7.28.5(ms@2.1.3))(ms@2.1.3) - core-js-compat: 3.44.0 + core-js-compat: 3.43.0 transitivePeerDependencies: - ms @@ -10078,7 +10436,7 @@ snapshots: babel-walk@3.0.0-canary-5: dependencies: - '@babel/types': 7.28.5 + '@babel/types': 7.28.4 bail@2.0.2: {} @@ -10129,8 +10487,8 @@ snapshots: browserslist@4.28.0: dependencies: baseline-browser-mapping: 2.8.32 - caniuse-lite: 1.0.30001755 - electron-to-chromium: 1.5.254 + caniuse-lite: 1.0.30001756 + electron-to-chromium: 1.5.258 node-releases: 2.0.27 update-browserslist-db: 1.1.4(browserslist@4.28.0) @@ -10162,13 +10520,13 @@ snapshots: call-bound@1.0.3: dependencies: call-bind-apply-helpers: 1.0.2 - get-intrinsic: 1.3.0 + get-intrinsic: 1.2.7 callsites@3.1.0: {} camelcase-css@2.0.1: {} - caniuse-lite@1.0.30001755: {} + caniuse-lite@1.0.30001756: {} ccount@2.0.1: {} @@ -10291,7 +10649,7 @@ snapshots: constantinople@4.0.1: dependencies: '@babel/parser': 7.28.5 - '@babel/types': 7.28.5 + '@babel/types': 7.28.4 content-disposition@1.0.1: {} @@ -10345,7 +10703,7 @@ snapshots: dependencies: is-what: 4.1.16 - core-js-compat@3.44.0: + core-js-compat@3.43.0: dependencies: browserslist: 4.28.0 @@ -10366,6 +10724,8 @@ snapshots: cssesc@3.0.0: {} + csstype@3.1.3: {} + csstype@3.2.3: {} d@1.0.2: @@ -10396,6 +10756,8 @@ snapshots: dequal@2.0.3: {} + destroy@1.2.0: {} + detect-libc@1.0.3: optional: true @@ -10437,7 +10799,7 @@ snapshots: ee-first@1.1.1: {} - electron-to-chromium@1.5.254: {} + electron-to-chromium@1.5.258: {} emoji-regex@10.4.0: {} @@ -10482,7 +10844,7 @@ snapshots: es-set-tostringtag@2.1.0: dependencies: es-errors: 1.3.0 - get-intrinsic: 1.3.0 + get-intrinsic: 1.2.7 has-tostringtag: 1.0.2 hasown: 2.0.2 @@ -10576,27 +10938,27 @@ snapshots: eslint-import-context@0.1.9(unrs-resolver@1.9.2): dependencies: - get-tsconfig: 4.13.0 + get-tsconfig: 4.10.1 stable-hash-x: 0.2.0 optionalDependencies: unrs-resolver: 1.9.2 eslint-plugin-es-x@7.8.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3)): dependencies: - '@eslint-community/eslint-utils': 4.8.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3)) + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3)) '@eslint-community/regexpp': 4.12.1 eslint: 9.39.1(jiti@2.6.1)(ms@2.1.3) eslint-compat-utils: 0.5.1(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3)) eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.48.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3))(ms@2.1.3)(typescript@5.9.3))(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3))(ms@2.1.3): dependencies: - '@typescript-eslint/types': 8.48.0 + '@typescript-eslint/types': 8.35.1 comment-parser: 1.4.1 debug: obug@1.0.2(ms@2.1.3) eslint: 9.39.1(jiti@2.6.1)(ms@2.1.3) eslint-import-context: 0.1.9(unrs-resolver@1.9.2) is-glob: 4.0.3 - minimatch: 10.0.3 + minimatch: 10.0.1 semver: 7.7.3 stable-hash-x: 0.2.0 unrs-resolver: 1.9.2 @@ -10607,11 +10969,11 @@ snapshots: eslint-plugin-n@17.23.1(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3))(typescript@5.9.3): dependencies: - '@eslint-community/eslint-utils': 4.8.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3)) + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3)) enhanced-resolve: 5.18.3 eslint: 9.39.1(jiti@2.6.1)(ms@2.1.3) eslint-plugin-es-x: 7.8.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3)) - get-tsconfig: 4.13.0 + get-tsconfig: 4.10.1 globals: 15.15.0 globrex: 0.1.2 ignore: 5.3.2 @@ -10642,7 +11004,7 @@ snapshots: eslint@9.39.1(jiti@2.6.1)(ms@2.1.3): dependencies: - '@eslint-community/eslint-utils': 4.8.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3)) + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1(jiti@2.6.1)(ms@2.1.3)) '@eslint-community/regexpp': 4.12.1 '@eslint/config-array': 0.21.1(ms@2.1.3) '@eslint/config-helpers': 0.4.2 @@ -10710,7 +11072,7 @@ snapshots: estree-walker@3.0.3: dependencies: - '@types/estree': 1.0.8 + '@types/estree': 1.0.6 esutils@2.0.3: {} @@ -10771,7 +11133,7 @@ snapshots: fresh: 2.0.0 http-errors: 2.0.1 merge-descriptors: 2.0.0 - mime-types: 3.0.2 + mime-types: 3.0.0 on-finished: 2.4.1 once: 1.4.0 parseurl: 1.3.3 @@ -10779,7 +11141,7 @@ snapshots: qs: 6.14.0 range-parser: 1.2.1 router: 2.2.0(ms@2.1.3) - send: 1.2.0 + send: 1.1.0 serve-static: 2.2.0 statuses: 2.0.2 type-is: 2.0.1 @@ -10896,7 +11258,7 @@ snapshots: dependencies: tabbable: 6.3.0 - follow-redirects@1.15.11(obug@1.0.2(ms@2.1.3)): + follow-redirects@1.15.9(obug@1.0.2(ms@2.1.3)): optionalDependencies: debug: obug@1.0.2(ms@2.1.3) @@ -10919,6 +11281,8 @@ snapshots: fraction.js@5.3.4: {} + fresh@0.5.2: {} + fresh@2.0.0: {} fsevents@2.3.3: @@ -10936,7 +11300,7 @@ snapshots: get-east-asian-width@1.3.0: {} - get-intrinsic@1.3.0: + get-intrinsic@1.2.7: dependencies: call-bind-apply-helpers: 1.0.2 es-define-property: 1.0.1 @@ -10963,6 +11327,10 @@ snapshots: get-them-args@1.3.2: {} + get-tsconfig@4.10.1: + dependencies: + resolve-pkg-maps: 1.0.0 + get-tsconfig@4.13.0: dependencies: resolve-pkg-maps: 1.0.0 @@ -11077,7 +11445,7 @@ snapshots: http-proxy-3@1.22.0(patch_hash=d89dff5a0afc2cb277080ad056a3baf7feeeeac19144878abc17f4c91ad89095)(ms@2.1.3): dependencies: debug: obug@1.0.2(ms@2.1.3) - follow-redirects: 1.15.11(obug@1.0.2(ms@2.1.3)) + follow-redirects: 1.15.9(obug@1.0.2(ms@2.1.3)) transitivePeerDependencies: - ms @@ -11261,11 +11629,11 @@ snapshots: kolorist@1.8.0: {} - launch-editor-middleware@2.12.0: + launch-editor-middleware@2.11.1: dependencies: - launch-editor: 2.12.0 + launch-editor: 2.11.1 - launch-editor@2.12.0: + launch-editor@2.11.1: dependencies: picocolors: 1.1.1 shell-quote: 1.8.3 @@ -11371,7 +11739,7 @@ snapshots: dependencies: mlly: 1.8.0 pkg-types: 2.2.0 - quansync: 0.2.11 + quansync: 0.2.10 locate-path@6.0.0: dependencies: @@ -11733,13 +12101,19 @@ snapshots: mime-db@1.52.0: {} + mime-db@1.53.0: {} + mime-db@1.54.0: {} mime-types@2.1.35: dependencies: mime-db: 1.52.0 - mime-types@3.0.2: + mime-types@3.0.0: + dependencies: + mime-db: 1.53.0 + + mime-types@3.0.1: dependencies: mime-db: 1.54.0 @@ -11768,6 +12142,10 @@ snapshots: - bufferutil - utf-8-validate + minimatch@10.0.1: + dependencies: + brace-expansion: 2.0.2 + minimatch@10.0.3: dependencies: '@isaacs/brace-expansion': 5.0.0 @@ -11817,7 +12195,7 @@ snapshots: nanoid@5.1.6: {} - napi-postinstall@0.2.5: {} + napi-postinstall@0.2.4: {} natural-compare@1.4.0: {} @@ -11921,6 +12299,24 @@ snapshots: type-check: 0.4.0 word-wrap: 1.2.5 + oxc-minify@0.101.0: + optionalDependencies: + '@oxc-minify/binding-android-arm64': 0.101.0 + '@oxc-minify/binding-darwin-arm64': 0.101.0 + '@oxc-minify/binding-darwin-x64': 0.101.0 + '@oxc-minify/binding-freebsd-x64': 0.101.0 + '@oxc-minify/binding-linux-arm-gnueabihf': 0.101.0 + '@oxc-minify/binding-linux-arm64-gnu': 0.101.0 + '@oxc-minify/binding-linux-arm64-musl': 0.101.0 + '@oxc-minify/binding-linux-riscv64-gnu': 0.101.0 + '@oxc-minify/binding-linux-s390x-gnu': 0.101.0 + '@oxc-minify/binding-linux-x64-gnu': 0.101.0 + '@oxc-minify/binding-linux-x64-musl': 0.101.0 + '@oxc-minify/binding-openharmony-arm64': 0.101.0 + '@oxc-minify/binding-wasm32-wasi': 0.101.0 + '@oxc-minify/binding-win32-arm64-msvc': 0.101.0 + '@oxc-minify/binding-win32-x64-msvc': 0.101.0 + p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 @@ -11972,7 +12368,7 @@ snapshots: periscopic@4.0.2: dependencies: - '@types/estree': 1.0.8 + '@types/estree': 1.0.6 is-reference: 3.0.3 zimmerframe: 1.1.2 @@ -12226,6 +12622,8 @@ snapshots: dependencies: side-channel: 1.1.0 + quansync@0.2.10: {} + quansync@0.2.11: {} queue-microtask@1.2.3: {} @@ -12335,8 +12733,6 @@ snapshots: require-directory@2.1.1: {} - requirejs@2.3.8: {} - resolve-from@4.0.0: {} resolve-pkg-maps@1.0.0: {} @@ -12358,7 +12754,7 @@ snapshots: rfdc@1.4.1: {} - rolldown-plugin-dts@0.18.1(rolldown@1.0.0-beta.52)(typescript@5.9.3)(vue-tsc@3.1.5(typescript@5.9.3)): + rolldown-plugin-dts@0.18.1(rolldown@1.0.0-beta.53)(typescript@5.9.3)(vue-tsc@3.1.5(typescript@5.9.3)): dependencies: '@babel/generator': 7.28.5 '@babel/parser': 7.28.5 @@ -12369,32 +12765,31 @@ snapshots: get-tsconfig: 4.13.0 magic-string: 0.30.21 obug: 2.1.1 - rolldown: 1.0.0-beta.52 + rolldown: 1.0.0-beta.53 optionalDependencies: typescript: 5.9.3 vue-tsc: 3.1.5(typescript@5.9.3) transitivePeerDependencies: - oxc-resolver - rolldown@1.0.0-beta.52: + rolldown@1.0.0-beta.53: dependencies: - '@oxc-project/types': 0.99.0 - '@rolldown/pluginutils': 1.0.0-beta.52 + '@oxc-project/types': 0.101.0 + '@rolldown/pluginutils': 1.0.0-beta.53 optionalDependencies: - '@rolldown/binding-android-arm64': 1.0.0-beta.52 - '@rolldown/binding-darwin-arm64': 1.0.0-beta.52 - '@rolldown/binding-darwin-x64': 1.0.0-beta.52 - '@rolldown/binding-freebsd-x64': 1.0.0-beta.52 - '@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.52 - '@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.52 - '@rolldown/binding-linux-arm64-musl': 1.0.0-beta.52 - '@rolldown/binding-linux-x64-gnu': 1.0.0-beta.52 - '@rolldown/binding-linux-x64-musl': 1.0.0-beta.52 - '@rolldown/binding-openharmony-arm64': 1.0.0-beta.52 - '@rolldown/binding-wasm32-wasi': 1.0.0-beta.52 - '@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.52 - '@rolldown/binding-win32-ia32-msvc': 1.0.0-beta.52 - '@rolldown/binding-win32-x64-msvc': 1.0.0-beta.52 + '@rolldown/binding-android-arm64': 1.0.0-beta.53 + '@rolldown/binding-darwin-arm64': 1.0.0-beta.53 + '@rolldown/binding-darwin-x64': 1.0.0-beta.53 + '@rolldown/binding-freebsd-x64': 1.0.0-beta.53 + '@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.53 + '@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.53 + '@rolldown/binding-linux-arm64-musl': 1.0.0-beta.53 + '@rolldown/binding-linux-x64-gnu': 1.0.0-beta.53 + '@rolldown/binding-linux-x64-musl': 1.0.0-beta.53 + '@rolldown/binding-openharmony-arm64': 1.0.0-beta.53 + '@rolldown/binding-wasm32-wasi': 1.0.0-beta.53 + '@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.53 + '@rolldown/binding-win32-x64-msvc': 1.0.0-beta.53 rollup-plugin-license@3.6.0(picomatch@4.0.3)(rollup@4.43.0): dependencies: @@ -12592,6 +12987,21 @@ snapshots: semver@7.7.3: {} + send@1.1.0: + dependencies: + debug: obug@1.0.2(ms@2.1.3) + destroy: 1.2.0 + encodeurl: 2.0.0 + escape-html: 1.0.3 + etag: 1.8.1 + fresh: 0.5.2 + http-errors: 2.0.1 + mime-types: 2.1.35 + ms: 2.1.3 + on-finished: 2.4.1 + range-parser: 1.2.1 + statuses: 2.0.2 + send@1.2.0: dependencies: debug: obug@1.0.2(ms@2.1.3) @@ -12600,7 +13010,7 @@ snapshots: etag: 1.8.1 fresh: 2.0.0 http-errors: 2.0.1 - mime-types: 3.0.2 + mime-types: 3.0.1 ms: 2.1.3 on-finished: 2.4.1 range-parser: 1.2.1 @@ -12671,14 +13081,14 @@ snapshots: dependencies: call-bound: 1.0.3 es-errors: 1.3.0 - get-intrinsic: 1.3.0 + get-intrinsic: 1.2.7 object-inspect: 1.13.4 side-channel-weakmap@1.0.2: dependencies: call-bound: 1.0.3 es-errors: 1.3.0 - get-intrinsic: 1.3.0 + get-intrinsic: 1.2.7 object-inspect: 1.13.4 side-channel-map: 1.0.1 @@ -12842,7 +13252,7 @@ snapshots: sucrase@3.35.0: dependencies: - '@jridgewell/gen-mapping': 0.3.12 + '@jridgewell/gen-mapping': 0.3.8 commander: 4.1.1 glob: 10.4.5 lines-and-columns: 1.2.4 @@ -12994,8 +13404,8 @@ snapshots: empathic: 2.0.0 hookable: 5.5.3 obug: 2.1.1 - rolldown: 1.0.0-beta.52 - rolldown-plugin-dts: 0.18.1(rolldown@1.0.0-beta.52)(typescript@5.9.3)(vue-tsc@3.1.5(typescript@5.9.3)) + rolldown: 1.0.0-beta.53 + rolldown-plugin-dts: 0.18.1(rolldown@1.0.0-beta.53)(typescript@5.9.3)(vue-tsc@3.1.5(typescript@5.9.3)) semver: 7.7.3 tinyexec: 1.0.2 tinyglobby: 0.2.15 @@ -13017,7 +13427,7 @@ snapshots: tsx@4.21.0: dependencies: esbuild: 0.27.0 - get-tsconfig: 4.13.0 + get-tsconfig: 4.10.1 optionalDependencies: fsevents: 2.3.3 @@ -13048,7 +13458,7 @@ snapshots: dependencies: content-type: 1.0.5 media-typer: 1.1.0 - mime-types: 3.0.2 + mime-types: 3.0.0 type@2.7.3: {} @@ -13137,7 +13547,7 @@ snapshots: unrs-resolver@1.9.2: dependencies: - napi-postinstall: 0.2.5 + napi-postinstall: 0.2.4 optionalDependencies: '@unrs/resolver-binding-android-arm-eabi': 1.9.2 '@unrs/resolver-binding-android-arm64': 1.9.2 @@ -13162,7 +13572,7 @@ snapshots: unrun@0.2.15: dependencies: '@oxc-project/runtime': 0.99.0 - rolldown: 1.0.0-beta.52 + rolldown: 1.0.0-beta.53 update-browserslist-db@1.1.4(browserslist@4.28.0): dependencies: @@ -13231,12 +13641,12 @@ snapshots: transitivePeerDependencies: - ms - vitepress@2.0.0-alpha.15(axios@1.13.2)(postcss@8.5.6)(typescript@5.9.3): + vitepress@2.0.0-alpha.15(axios@1.13.2)(oxc-minify@0.101.0)(postcss@8.5.6)(typescript@5.9.3): dependencies: '@docsearch/css': 4.3.2 '@docsearch/js': 4.3.2 - '@iconify-json/simple-icons': 1.2.60 - '@shikijs/core': 3.17.0 + '@iconify-json/simple-icons': 1.2.59 + '@shikijs/core': 3.15.0 '@shikijs/transformers': 3.15.0 '@shikijs/types': 3.17.0 '@types/markdown-it': 14.1.2 @@ -13252,6 +13662,7 @@ snapshots: vite: link:packages/vite vue: 3.5.25(typescript@5.9.3) optionalDependencies: + oxc-minify: 0.101.0 postcss: 8.5.6 transitivePeerDependencies: - async-validator @@ -13318,6 +13729,16 @@ snapshots: optionalDependencies: typescript: 5.9.3 + vue@3.5.22(typescript@5.9.3): + dependencies: + '@vue/compiler-dom': 3.5.22 + '@vue/compiler-sfc': 3.5.22 + '@vue/runtime-dom': 3.5.22 + '@vue/server-renderer': 3.5.22(vue@3.5.22(typescript@5.9.3)) + '@vue/shared': 3.5.22 + optionalDependencies: + typescript: 5.9.3 + vue@3.5.25(typescript@5.9.3): dependencies: '@vue/compiler-dom': 3.5.25 @@ -13354,7 +13775,7 @@ snapshots: with@7.0.2: dependencies: '@babel/parser': 7.28.5 - '@babel/types': 7.28.5 + '@babel/types': 7.28.4 assert-never: 1.4.0 babel-walk: 3.0.0-canary-5 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 61ebab37dcf40c..ac099874dfba30 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -13,7 +13,7 @@ autoInstallPeers: false dedupeInjectedDeps: false overrides: rolldown: $rolldown - vite: 'workspace:*' + vite: 'workspace:rolldown-vite@*' debug: 'npm:obug@^1.0.2' patchedDependencies: "sirv@3.0.2": "patches/sirv@3.0.2.patch" diff --git a/scripts/release.ts b/scripts/release.ts index bdfc32bf224e79..6d3c2dba3bc4e9 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -9,7 +9,8 @@ release({ pkg === 'vite' ? `v${version}` : `${pkg}@${version}`, logChangelog: (pkg) => logRecentCommits(pkg), generateChangelog: async (pkgName) => { - if (pkgName === 'create-vite') await updateTemplateVersions() + if (pkgName === 'create-vite' || pkgName === 'vite') + await updateTemplateVersions() console.log(colors.cyan('\nGenerating changelog...')) diff --git a/scripts/releaseUtils.ts b/scripts/releaseUtils.ts index 6a7654960a753a..0b76d646989eb5 100644 --- a/scripts/releaseUtils.ts +++ b/scripts/releaseUtils.ts @@ -64,7 +64,7 @@ export async function updateTemplateVersions(): Promise { for (const template of templates) { const pkgPath = path.join(dir, template, `package.json`) const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8')) - pkg.devDependencies.vite = `^` + viteVersion + pkg.devDependencies.vite = `npm:rolldown-vite@^` + viteVersion await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n') } } diff --git a/vitest.config.e2e.ts b/vitest.config.e2e.ts index 4303a2d8c09f45..57a6772caa8a44 100644 --- a/vitest.config.e2e.ts +++ b/vitest.config.e2e.ts @@ -1,5 +1,7 @@ import { resolve } from 'node:path' -import { defineConfig } from 'vitest/config' +import { defaultExclude, defineConfig } from 'vitest/config' + +const isBuild = !!process.env.VITE_TEST_BUILD const timeout = process.env.PWDEBUG ? Infinity : process.env.CI ? 50000 : 30000 @@ -11,6 +13,14 @@ export default defineConfig({ }, test: { include: ['./playground/**/*.spec.[tj]s'], + exclude: [ + ...(isBuild + ? [ + './playground/object-hooks/**/*.spec.[tj]s', // object hook sequential + ] + : []), + ...defaultExclude, + ], setupFiles: ['./playground/vitestSetup.ts'], globalSetup: ['./playground/vitestGlobalSetup.ts'], testTimeout: timeout,