Skip to content

Commit 0fd64c3

Browse files
authored
Merge pull request #185 from rollup/sync-2029f639
docs(en): merge rollup/master into rollup-docs-cn/master @ 2029f63
2 parents f269fd1 + d8d7ccb commit 0fd64c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1325
-701
lines changed

.github/workflows/build-and-tests.yml

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Setup Node
3636
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
3737
with:
38-
node-version: 24.7.0
38+
node-version: 24.8.0
3939
- name: Install and Cache Node Dependencies
4040
uses: ./.github/actions/install-and-cache-node-deps
4141
- name: Lint
@@ -82,6 +82,24 @@ jobs:
8282
target: i686-pc-windows-msvc
8383
- host: windows-latest
8484
target: aarch64-pc-windows-msvc
85+
- host: windows-latest
86+
target: x86_64-pc-windows-gnu
87+
msystem: ucrt64
88+
toolchain: ucrt-x86_64
89+
setup: |
90+
rustup default
91+
rustVersion=$(sed -n 's/channel *= *"\(.*\)"/\1/p' rust-toolchain.toml)
92+
rustup install "$rustVersion"
93+
rustup set default-host x86_64-pc-windows-gnu
94+
rustup show
95+
build: >-
96+
set -e &&
97+
which rustup &&
98+
rustup target add x86_64-pc-windows-gnu &&
99+
rustup component add rust-src --toolchain nightly-2025-07-25-x86_64-pc-windows-gnu &&
100+
npm run build:napi -- --release --target x86_64-pc-windows-gnu
101+
env:
102+
MINGW_ARCH: ucrt64
85103

86104
# MacOS
87105
- host: macos-latest
@@ -200,9 +218,22 @@ jobs:
200218
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
201219
- name: Setup Node
202220
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
203-
if: ${{ !matrix.settings.docker }}
221+
if: ${{ !matrix.settings.docker && matrix.settings.target != 'x86_64-pc-windows-gnu' }}
222+
with:
223+
node-version: 24.8.0
224+
- uses: msys2/setup-msys2@v2
225+
if: ${{ matrix.settings.target == 'x86_64-pc-windows-gnu' }}
204226
with:
205-
node-version: 24.7.0
227+
msystem: ${{ matrix.settings.msystem }}
228+
install: mingw-w64-${{ matrix.settings.toolchain }}-toolchain base-devel binutils
229+
pacboy: >-
230+
rustup:p
231+
nodejs:p
232+
rust-wasm:p
233+
rust-src:p
234+
update: true
235+
path-type: inherit
236+
release: false
206237
- name: Install Toolchain
207238
uses: dtolnay/rust-toolchain@stable
208239
if: ${{ !matrix.settings.docker }}
@@ -211,7 +242,7 @@ jobs:
211242
components: rust-src
212243
- name: Setup OpenHarmony SDK
213244
if: ${{ contains(matrix.settings.target, 'ohos') }}
214-
uses: openharmony-rs/setup-ohos-sdk@52d50de65363f895558a43de0dceb1f8e3679b1c # v0.2.3
245+
uses: openharmony-rs/setup-ohos-sdk@3c181b3244cec76aaec289ab84fb00f55f2fce3f # v0.2.4
215246
- name: Restore Cargo cache
216247
uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
217248
if: matrix.settings.cache-cargo != false
@@ -229,7 +260,7 @@ jobs:
229260
with:
230261
version: 0.14.1
231262
- name: Install cargo-zigbuild
232-
uses: taiki-e/install-action@0c5db7f7f897c03b771660e91d065338615679f4 # v2.60.0
263+
uses: taiki-e/install-action@cc60de1d6831d7e9c4342f618ce7a5d6a9f223a4 # v2.61.6
233264
if: ${{ matrix.settings.cross == 'zig' }}
234265
env:
235266
GITHUB_TOKEN: ${{ github.token }}
@@ -253,10 +284,14 @@ jobs:
253284
image: ${{ matrix.settings.docker }}
254285
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'
255286
run: ${{ matrix.settings.build }}
287+
- name: Msys2 build
288+
if: ${{ matrix.settings.target == 'x86_64-pc-windows-gnu' }}
289+
run: ${{ matrix.settings.build }}
290+
shell: msys2 {0}
256291
- name: Build (Matrix override)
257292
env: ${{ matrix.settings.env || fromJSON('{}') }}
258293
run: ${{ matrix.settings.build }}
259-
if: ${{ !matrix.settings.docker && matrix.settings.build }}
294+
if: ${{ !matrix.settings.docker && matrix.settings.build && matrix.settings.target != 'x86_64-pc-windows-gnu' }}
260295
- name: Build (Classic)
261296
env: ${{ matrix.settings.env || fromJSON('{}') }}
262297
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' || '' }}

.github/workflows/performance-report.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ permissions:
1717

1818
jobs:
1919
build-artefacts:
20-
if: ${{ github.event.pull_request.head.repo.full_name == 'rollup/rollup' || contains( toJson(github.event.pull_request.labels), 'x⁸ ⚙️ build repl artefacts' ) }}
20+
if: >-
21+
${{ github.event.pull_request.head.repo.full_name == 'rollup/rollup' ||
22+
(github.event.action == 'labeled' && github.event.label.name == 'x⁸ ⚙️ build repl artefacts') }}
2123
strategy:
2224
matrix:
2325
settings:
@@ -51,7 +53,7 @@ jobs:
5153
- name: Setup Node
5254
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
5355
with:
54-
node-version: 24.7.0
56+
node-version: 24.8.0
5557
- name: Install and Cache Node Dependencies
5658
uses: ./.github/actions/install-and-cache-node-deps
5759
- name: Build artefacts 123
@@ -93,7 +95,7 @@ jobs:
9395
- name: Setup Node
9496
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
9597
with:
96-
node-version: 24.7.0
98+
node-version: 24.8.0
9799
- name: Install and Cache Node Dependencies
98100
uses: ./.github/actions/install-and-cache-node-deps
99101
- name: Download all artifacts

.github/workflows/repl-artefacts.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,21 @@ jobs:
1919
upload:
2020
permissions:
2121
pull-requests: write # for peter-evans/find-comment and peter-evans/create-or-update-comment
22-
if: ${{ github.event.pull_request.head.repo.full_name == 'rollup/rollup' || contains( toJson(github.event.pull_request.labels), 'x⁸ ⚙️ build repl artefacts' ) }}
22+
if: >-
23+
${{ github.event.pull_request.head.repo.full_name == 'rollup/rollup' ||
24+
(github.event.action == 'labeled' && github.event.label.name == 'x⁸ ⚙️ build repl artefacts') }}
2325
runs-on: ubuntu-latest
2426
name: Upload
2527
steps:
2628
- name: Checkout Commit
2729
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2830
with:
2931
ref: refs/pull/${{ github.event.number }}/merge
32+
- name: Remove 'x⁸ ⚙️ build repl artefacts' label
33+
if: ${{ github.event.action == 'labeled' }}
34+
run: gh pr edit ${{ github.event.pull_request.number }} --remove-label 'x⁸ ⚙️ build repl artefacts'
35+
env:
36+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3037
- name: Install Toolchain
3138
uses: dtolnay/rust-toolchain@stable
3239
with:
@@ -46,7 +53,7 @@ jobs:
4653
- name: Setup Node
4754
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
4855
with:
49-
node-version: 24.7.0
56+
node-version: 24.8.0
5057
- name: Install and Cache Node Dependencies
5158
uses: ./.github/actions/install-and-cache-node-deps
5259
- name: Build artefacts

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,42 @@
11
# rollup changelog
22

3+
## 4.52.0
4+
5+
_2025-09-19_
6+
7+
### Features
8+
9+
- Add option `output.onlyExplicitManualChunks` to turn off merging additional dependencies into manual chunks (#6087)
10+
- Add support for x86_64-pc-windows-gnu platform (#6110)
11+
12+
### Pull Requests
13+
14+
- [#6087](https://github.com/rollup/rollup/pull/6087): fix: manualChunks and non manualChunks shared dependencies are merged with the first manualChunk encountered alphabetically (@maiieul)
15+
- [#6110](https://github.com/rollup/rollup/pull/6110): Add support x86_64-pc-windows-gnu (@lsq, @lukastaegert)
16+
- [#6118](https://github.com/rollup/rollup/pull/6118): Automatically remove REPL artefacts label from PRs (@lukastaegert)
17+
18+
## 4.51.0
19+
20+
_2025-09-19_
21+
22+
### Features
23+
24+
- Support ROLLUP_FILE_URL_OBJ placeholder to inject file URLs into the generated code (#6108)
25+
26+
### Bug Fixes
27+
28+
- Improve OpenHarmony build to work in more situations (#6115)
29+
30+
### Pull Requests
31+
32+
- [#6108](https://github.com/rollup/rollup/pull/6108): feat: support ROLLUP_FILE_URL_OBJ for URL object instead of string (@guybedford, @lukastaegert)
33+
- [#6112](https://github.com/rollup/rollup/pull/6112): Disable Cargo cache for Android (@lukastaegert)
34+
- [#6113](https://github.com/rollup/rollup/pull/6113): fix(deps): update rust crate swc_compiler_base to v35 (@renovate[bot])
35+
- [#6114](https://github.com/rollup/rollup/pull/6114): chore(deps): lock file maintenance minor/patch updates (@renovate[bot])
36+
- [#6115](https://github.com/rollup/rollup/pull/6115): Disable local_dynamic_tls for OpenHarmony (@hqzing)
37+
- [#6116](https://github.com/rollup/rollup/pull/6116): chore(deps): lock file maintenance minor/patch updates (@renovate[bot])
38+
- [#6117](https://github.com/rollup/rollup/pull/6117): chore(deps): lock file maintenance (@renovate[bot])
39+
340
## 4.50.2
441

542
_2025-09-15_

browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rollup/browser",
3-
"version": "4.50.2",
3+
"version": "4.52.0",
44
"description": "Next-generation ES module bundler browser build",
55
"main": "dist/rollup.browser.js",
66
"module": "dist/es/rollup.browser.js",

docs/configuration-options/index.md

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,19 +1440,17 @@ export default {
14401440
| --: | :-- |
14411441
| 类型: | `{ [chunkAlias: string]: string[] } \| ((id: string, {getModuleInfo, getModuleIds}) => string \| void)` |
14421442

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

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

14471447
```javascript
1448-
({
1449-
manualChunks: {
1450-
lodash: ['lodash']
1451-
}
1452-
});
1448+
manualChunks: {
1449+
lodash: ['lodash'];
1450+
}
14531451
```
14541452

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

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

@@ -1469,6 +1467,8 @@ function manualChunks(id) {
14691467
}
14701468
```
14711469

1470+
默认情况下,函数形式也会将返回ID的依赖项合并到 `manualChunk` 中。如果需要更严格的行为,可以使用 [`output.onlyExplicitManualChunks`](#output-onlyexplicitmanualchunks),该选项将在 Rollup 5 中成为默认设置。
1471+
14721472
请注意,如果自定义 chunk 在使用相应模块之前触发了副作用,那么它可能改变整个应用的行为。
14731473

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

31103110
是否在输出中为外部导入添加导入断言,如果输出格式为 `es`。默认情况下,断言来自输入文件,但是插件可以稍后添加或删除断言。例如,`import "foo" assert {type: "json"}` 将导致相同的导入出现在输出中,除非将该选项设置为 `false`。请注意,模块的所有导入都需要具有一致的断言,否则将发出警告。
3111+
3112+
### output.onlyExplicitManualChunks
3113+
3114+
| | |
3115+
| -----: | :-------- |
3116+
| 类型: | `boolean` |
3117+
3118+
该选项如果设置为 `true`,使用 [output.manualChunks](#output-manualchunks) 的函数形式时,不会将依赖项合并到输出块中。
3119+
3120+
例如,以下项目结构
3121+
3122+
```js
3123+
// src/main.js (入口文件)
3124+
import './manual1';
3125+
import './manual2';
3126+
3127+
console.log('main');
3128+
3129+
// src/manual1.js
3130+
import './dep.js';
3131+
3132+
console.log('manual1');
3133+
3134+
// src/manual2.js
3135+
import './dep.js';
3136+
3137+
console.log('manual2');
3138+
3139+
// src/dep.js
3140+
console.log('dep');
3141+
```
3142+
3143+
并配置
3144+
3145+
<!-- prettier-ignore-start -->
3146+
3147+
```js twoslash
3148+
// ---cut-start---
3149+
/** @type {import('rollup').GetManualChunk} */
3150+
// ---cut-end---
3151+
function manualChunks(id) {
3152+
if (id.endsWith('manual1.js') && id.endsWith('manual2.js')) {
3153+
return 'manual';
3154+
}
3155+
}
3156+
```
3157+
3158+
dep.js 中的 `export const dep = 'dep';` 代码将不会被合并到 `manual` 手动分块中。这使你能够完全控制哪些代码进入哪个手动分块。如果您的手动分块非常细粒度,这可以防止导入图的不准确,并帮助减少缓存失效。
3159+
3160+
请注意,尽管此选项在 Rollup 4 中是新增的,但它已被标记为已弃用(deprecated),因为在 Rollup 5 中,函数形式将直接采用此行为作为默认设置。

native.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ const bindingsByPlatformAndArch = {
3232
win32: {
3333
arm64: { base: 'win32-arm64-msvc' },
3434
ia32: { base: 'win32-ia32-msvc' },
35-
x64: { base: 'win32-x64-msvc' }
35+
x64: {
36+
base: report.getReport().header.osName.startsWith('MINGW32_NT')
37+
? 'win32-x64-gnu'
38+
: 'win32-x64-msvc'
39+
}
3640
}
3741
};
3842

npm/win32-x64-gnu/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `@rollup/rollup-win32-x64-gnu`
2+
3+
This is the **x86_64-pc-windows-gnu** binary for `rollup`

npm/win32-x64-gnu/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "@rollup/rollup-win32-x64-gnu",
3+
"version": "0.0.0",
4+
"os": [
5+
"win32"
6+
],
7+
"cpu": [
8+
"x64"
9+
],
10+
"files": [
11+
"rollup.win32-x64-gnu.node"
12+
],
13+
"description": "Native bindings for Rollup",
14+
"author": "Lukas Taegert-Atkinson",
15+
"homepage": "https://rollupjs.org/",
16+
"license": "MIT",
17+
"repository": "rollup/rollup",
18+
"main": "./rollup.win32-x64-gnu.node"
19+
}

0 commit comments

Comments
 (0)