Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 41 additions & 6 deletions .github/workflows/build-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 24.7.0
node-version: 24.8.0
- name: Install and Cache Node Dependencies
uses: ./.github/actions/install-and-cache-node-deps
- name: Lint
Expand Down Expand Up @@ -82,6 +82,24 @@ jobs:
target: i686-pc-windows-msvc
- host: windows-latest
target: aarch64-pc-windows-msvc
- host: windows-latest
target: x86_64-pc-windows-gnu
msystem: ucrt64
toolchain: ucrt-x86_64
setup: |
rustup default
rustVersion=$(sed -n 's/channel *= *"\(.*\)"/\1/p' rust-toolchain.toml)
rustup install "$rustVersion"
rustup set default-host x86_64-pc-windows-gnu
rustup show
build: >-
set -e &&
which rustup &&
rustup target add x86_64-pc-windows-gnu &&
rustup component add rust-src --toolchain nightly-2025-07-25-x86_64-pc-windows-gnu &&
npm run build:napi -- --release --target x86_64-pc-windows-gnu
env:
MINGW_ARCH: ucrt64

# MacOS
- host: macos-latest
Expand Down Expand Up @@ -200,9 +218,22 @@ jobs:
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
if: ${{ !matrix.settings.docker }}
if: ${{ !matrix.settings.docker && matrix.settings.target != 'x86_64-pc-windows-gnu' }}
with:
node-version: 24.8.0
- uses: msys2/setup-msys2@v2
if: ${{ matrix.settings.target == 'x86_64-pc-windows-gnu' }}
with:
node-version: 24.7.0
msystem: ${{ matrix.settings.msystem }}
install: mingw-w64-${{ matrix.settings.toolchain }}-toolchain base-devel binutils
pacboy: >-
rustup:p
nodejs:p
rust-wasm:p
rust-src:p
update: true
path-type: inherit
release: false
- name: Install Toolchain
uses: dtolnay/rust-toolchain@stable
if: ${{ !matrix.settings.docker }}
Expand All @@ -211,7 +242,7 @@ jobs:
components: rust-src
- name: Setup OpenHarmony SDK
if: ${{ contains(matrix.settings.target, 'ohos') }}
uses: openharmony-rs/setup-ohos-sdk@52d50de65363f895558a43de0dceb1f8e3679b1c # v0.2.3
uses: openharmony-rs/setup-ohos-sdk@3c181b3244cec76aaec289ab84fb00f55f2fce3f # v0.2.4
- name: Restore Cargo cache
uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
if: matrix.settings.cache-cargo != false
Expand All @@ -229,7 +260,7 @@ jobs:
with:
version: 0.14.1
- name: Install cargo-zigbuild
uses: taiki-e/install-action@0c5db7f7f897c03b771660e91d065338615679f4 # v2.60.0
uses: taiki-e/install-action@cc60de1d6831d7e9c4342f618ce7a5d6a9f223a4 # v2.61.6
if: ${{ matrix.settings.cross == 'zig' }}
env:
GITHUB_TOKEN: ${{ github.token }}
Expand All @@ -253,10 +284,14 @@ jobs:
image: ${{ matrix.settings.docker }}
options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build'
run: ${{ matrix.settings.build }}
- name: Msys2 build
if: ${{ matrix.settings.target == 'x86_64-pc-windows-gnu' }}
run: ${{ matrix.settings.build }}
shell: msys2 {0}
- name: Build (Matrix override)
env: ${{ matrix.settings.env || fromJSON('{}') }}
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker && matrix.settings.build }}
if: ${{ !matrix.settings.docker && matrix.settings.build && matrix.settings.target != 'x86_64-pc-windows-gnu' }}
- name: Build (Classic)
env: ${{ matrix.settings.env || fromJSON('{}') }}
run: npm run build:napi -- --release --target ${{ matrix.settings.target }} ${{ matrix.settings.cross == 'zig' && '-x' || matrix.settings.cross == 'napi' && '--use-napi-cross' || matrix.settings.cross == 'cross' && '--use-cross' || '' }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/performance-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ permissions:

jobs:
build-artefacts:
if: ${{ github.event.pull_request.head.repo.full_name == 'rollup/rollup' || contains( toJson(github.event.pull_request.labels), 'x⁸ ⚙️ build repl artefacts' ) }}
if: >-
${{ github.event.pull_request.head.repo.full_name == 'rollup/rollup' ||
(github.event.action == 'labeled' && github.event.label.name == 'x⁸ ⚙️ build repl artefacts') }}
strategy:
matrix:
settings:
Expand Down Expand Up @@ -51,7 +53,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 24.7.0
node-version: 24.8.0
- name: Install and Cache Node Dependencies
uses: ./.github/actions/install-and-cache-node-deps
- name: Build artefacts 123
Expand Down Expand Up @@ -93,7 +95,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 24.7.0
node-version: 24.8.0
- name: Install and Cache Node Dependencies
uses: ./.github/actions/install-and-cache-node-deps
- name: Download all artifacts
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/repl-artefacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@ jobs:
upload:
permissions:
pull-requests: write # for peter-evans/find-comment and peter-evans/create-or-update-comment
if: ${{ github.event.pull_request.head.repo.full_name == 'rollup/rollup' || contains( toJson(github.event.pull_request.labels), 'x⁸ ⚙️ build repl artefacts' ) }}
if: >-
${{ github.event.pull_request.head.repo.full_name == 'rollup/rollup' ||
(github.event.action == 'labeled' && github.event.label.name == 'x⁸ ⚙️ build repl artefacts') }}
runs-on: ubuntu-latest
name: Upload
steps:
- name: Checkout Commit
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: refs/pull/${{ github.event.number }}/merge
- name: Remove 'x⁸ ⚙️ build repl artefacts' label
if: ${{ github.event.action == 'labeled' }}
run: gh pr edit ${{ github.event.pull_request.number }} --remove-label 'x⁸ ⚙️ build repl artefacts'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Toolchain
uses: dtolnay/rust-toolchain@stable
with:
Expand All @@ -46,7 +53,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 24.7.0
node-version: 24.8.0
- name: Install and Cache Node Dependencies
uses: ./.github/actions/install-and-cache-node-deps
- name: Build artefacts
Expand Down
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# rollup changelog

## 4.52.0

_2025-09-19_

### Features

- Add option `output.onlyExplicitManualChunks` to turn off merging additional dependencies into manual chunks (#6087)
- Add support for x86_64-pc-windows-gnu platform (#6110)

### Pull Requests

- [#6087](https://github.com/rollup/rollup/pull/6087): fix: manualChunks and non manualChunks shared dependencies are merged with the first manualChunk encountered alphabetically (@maiieul)
- [#6110](https://github.com/rollup/rollup/pull/6110): Add support x86_64-pc-windows-gnu (@lsq, @lukastaegert)
- [#6118](https://github.com/rollup/rollup/pull/6118): Automatically remove REPL artefacts label from PRs (@lukastaegert)

## 4.51.0

_2025-09-19_

### Features

- Support ROLLUP_FILE_URL_OBJ placeholder to inject file URLs into the generated code (#6108)

### Bug Fixes

- Improve OpenHarmony build to work in more situations (#6115)

### Pull Requests

- [#6108](https://github.com/rollup/rollup/pull/6108): feat: support ROLLUP_FILE_URL_OBJ for URL object instead of string (@guybedford, @lukastaegert)
- [#6112](https://github.com/rollup/rollup/pull/6112): Disable Cargo cache for Android (@lukastaegert)
- [#6113](https://github.com/rollup/rollup/pull/6113): fix(deps): update rust crate swc_compiler_base to v35 (@renovate[bot])
- [#6114](https://github.com/rollup/rollup/pull/6114): chore(deps): lock file maintenance minor/patch updates (@renovate[bot])
- [#6115](https://github.com/rollup/rollup/pull/6115): Disable local_dynamic_tls for OpenHarmony (@hqzing)
- [#6116](https://github.com/rollup/rollup/pull/6116): chore(deps): lock file maintenance minor/patch updates (@renovate[bot])
- [#6117](https://github.com/rollup/rollup/pull/6117): chore(deps): lock file maintenance (@renovate[bot])

## 4.50.2

_2025-09-15_
Expand Down
2 changes: 1 addition & 1 deletion browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/browser",
"version": "4.50.2",
"version": "4.52.0",
"description": "Next-generation ES module bundler browser build",
"main": "dist/rollup.browser.js",
"module": "dist/es/rollup.browser.js",
Expand Down
66 changes: 58 additions & 8 deletions docs/configuration-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1440,19 +1440,17 @@ export default {
| --: | :-- |
| 类型: | `{ [chunkAlias: string]: string[] } \| ((id: string, {getModuleInfo, getModuleIds}) => string \| void)` |

该选项允许你创建自定义的公共 chunk。当值为对象形式时,每个属性代表一个 chunk,其中包含列出的模块及其所有依赖,除非他们已经在其他 chunk 中,否则将会是模块图(module graph)的一部分。chunk 的名称由对象属性的键决定
该选项允许你创建自定义的公共块。当值为对象形式时,可用于更简单、更安全的手动分块,为函数形式时,可以实现更强大且可控的行为

请注意,列出的模块本身不一定是模块图的一部分,该特性对于使用 `@rollup/plugin-node-resolve` 包并从中使用深度引用(deep imports)是非常有用的。例如:
对象形式时,每个属性代表一个包含所列出的模块及其所有依赖项的块(若这些依赖项属于模块图且未被其他手动块包含)。块的名称由属性键决定。需要注意的是,列出的模块本身不一定是模块图的一部分,该特性对于使用 `@rollup/plugin-node-resolve` 包并使用深度引用(deep imports)时非常有用的。例如:

```javascript
({
manualChunks: {
lodash: ['lodash']
}
});
manualChunks: {
lodash: ['lodash'];
}
```

上述例子中,即使你只是使用 `import get from 'lodash/get'` 形式引入,Rollup 也会将 lodash 的所有模块放到一个自定义 chunk 中。
上述例子中,即使你只是使用 `import get from 'lodash/get'` 形式引入,Rollup 也会将 lodash 的所有模块合并到一个自定义 chunk 中。

当该选项值为函数形式时,每个被解析的模块都会经过该函数处理。如果函数返回字符串,那么该模块及其所有依赖将被添加到以返回字符串命名的自定义 chunk 中。例如,以下例子会创建一个命名为 `vendor` 的 chunk,它包含所有在 `node_modules` 中的依赖:

Expand All @@ -1469,6 +1467,8 @@ function manualChunks(id) {
}
```

默认情况下,函数形式也会将返回ID的依赖项合并到 `manualChunk` 中。如果需要更严格的行为,可以使用 [`output.onlyExplicitManualChunks`](#output-onlyexplicitmanualchunks),该选项将在 Rollup 5 中成为默认设置。

请注意,如果自定义 chunk 在使用相应模块之前触发了副作用,那么它可能改变整个应用的行为。

当 `manualChunks` 值为函数形式时,它的第二个参数是一个对象,包含 `getModuleInfo` 函数和 `getModuleIds` 函数,其工作方式与插件上下文中的 [`this.getModuleInfo`](../plugin-development/index.md#this-getmoduleinfo) 和 [`this.getModuleIds`](../plugin-development/index.md#this-getmoduleids) 相同。
Expand Down Expand Up @@ -3108,3 +3108,53 @@ _使用 [`output.externalImportAttributes`](#output-externalimportattributes)
| 默认: | `true` |

是否在输出中为外部导入添加导入断言,如果输出格式为 `es`。默认情况下,断言来自输入文件,但是插件可以稍后添加或删除断言。例如,`import "foo" assert {type: "json"}` 将导致相同的导入出现在输出中,除非将该选项设置为 `false`。请注意,模块的所有导入都需要具有一致的断言,否则将发出警告。

### output.onlyExplicitManualChunks

| | |
| -----: | :-------- |
| 类型: | `boolean` |

该选项如果设置为 `true`,使用 [output.manualChunks](#output-manualchunks) 的函数形式时,不会将依赖项合并到输出块中。

例如,以下项目结构

```js
// src/main.js (入口文件)
import './manual1';
import './manual2';

console.log('main');

// src/manual1.js
import './dep.js';

console.log('manual1');

// src/manual2.js
import './dep.js';

console.log('manual2');

// src/dep.js
console.log('dep');
```

并配置

<!-- prettier-ignore-start -->

```js twoslash
// ---cut-start---
/** @type {import('rollup').GetManualChunk} */
// ---cut-end---
function manualChunks(id) {
if (id.endsWith('manual1.js') && id.endsWith('manual2.js')) {
return 'manual';
}
}
```

dep.js 中的 `export const dep = 'dep';` 代码将不会被合并到 `manual` 手动分块中。这使你能够完全控制哪些代码进入哪个手动分块。如果您的手动分块非常细粒度,这可以防止导入图的不准确,并帮助减少缓存失效。

请注意,尽管此选项在 Rollup 4 中是新增的,但它已被标记为已弃用(deprecated),因为在 Rollup 5 中,函数形式将直接采用此行为作为默认设置。
6 changes: 5 additions & 1 deletion native.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ const bindingsByPlatformAndArch = {
win32: {
arm64: { base: 'win32-arm64-msvc' },
ia32: { base: 'win32-ia32-msvc' },
x64: { base: 'win32-x64-msvc' }
x64: {
base: report.getReport().header.osName.startsWith('MINGW32_NT')
? 'win32-x64-gnu'
: 'win32-x64-msvc'
}
}
};

Expand Down
3 changes: 3 additions & 0 deletions npm/win32-x64-gnu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `@rollup/rollup-win32-x64-gnu`

This is the **x86_64-pc-windows-gnu** binary for `rollup`
19 changes: 19 additions & 0 deletions npm/win32-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@rollup/rollup-win32-x64-gnu",
"version": "0.0.0",
"os": [
"win32"
],
"cpu": [
"x64"
],
"files": [
"rollup.win32-x64-gnu.node"
],
"description": "Native bindings for Rollup",
"author": "Lukas Taegert-Atkinson",
"homepage": "https://rollupjs.org/",
"license": "MIT",
"repository": "rollup/rollup",
"main": "./rollup.win32-x64-gnu.node"
}
Loading
Loading