Skip to content

Commit 55490c5

Browse files
committed
Merge branch 'master' of https://github.com/rollup/rollup into sync-fa2315c4
2 parents 0fd64c3 + fa2315c commit 55490c5

File tree

21 files changed

+133
-53
lines changed

21 files changed

+133
-53
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ jobs:
139139
- host: ubuntu-latest
140140
target: armv7-linux-androideabi
141141
cross: napi
142-
# There are compile issues when using the cache with Android
143-
cache-cargo: false
144142
- host: ubuntu-latest
145143
target: aarch64-linux-android
146144
cross: napi
@@ -167,6 +165,8 @@ jobs:
167165
-C link-args=-L/sysroot-riscv64/usr/lib
168166
-C linker=riscv64-alpine-linux-musl-ld
169167
" &&
168+
rustup default nightly-2025-07-25 &&
169+
rustup target add riscv64gc-unknown-linux-musl &&
170170
npm run build:napi -- --release --target riscv64gc-unknown-linux-musl
171171
- host: ubuntu-latest
172172
target: powerpc64le-unknown-linux-gnu
@@ -206,9 +206,11 @@ jobs:
206206
- host: ubuntu-latest
207207
target: x86_64-unknown-freebsd
208208
cross: cross
209+
build-std: true
209210
- host: ubuntu-latest
210211
target: aarch64-unknown-freebsd
211212
cross: cross
213+
build-std: true
212214

213215
name: Build ${{ matrix.settings.name || matrix.settings.target }}
214216
runs-on: ${{ matrix.settings.host }}
@@ -239,7 +241,8 @@ jobs:
239241
if: ${{ !matrix.settings.docker }}
240242
with:
241243
toolchain: nightly-2025-07-25
242-
components: rust-src
244+
components: ${{ matrix.settings.build-std && 'rust-src' || '' }}
245+
targets: ${{ !matrix.settings.build-std && matrix.settings.target || '' }}
243246
- name: Setup OpenHarmony SDK
244247
if: ${{ contains(matrix.settings.target, 'ohos') }}
245248
uses: openharmony-rs/setup-ohos-sdk@3c181b3244cec76aaec289ab84fb00f55f2fce3f # v0.2.4
@@ -294,7 +297,7 @@ jobs:
294297
if: ${{ !matrix.settings.docker && matrix.settings.build && matrix.settings.target != 'x86_64-pc-windows-gnu' }}
295298
- name: Build (Classic)
296299
env: ${{ matrix.settings.env || fromJSON('{}') }}
297-
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' || '' }}
300+
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' || '' }} -- ${{ matrix.settings.build-std && '-Zbuild-std=std,core,alloc,panic_unwind -Zbuild-std-features=panic-unwind' || '' }}
298301
if: ${{ !matrix.settings.docker && !matrix.settings.build }}
299302
shell: bash
300303
- name: Save Cargo cache

CHANGELOG.md

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

3+
## 4.52.2
4+
5+
_2025-09-23_
6+
7+
### Bug Fixes
8+
9+
- Fix Android build crashing due to failed dlopen (#6109)
10+
11+
### Pull Requests
12+
13+
- [#6109](https://github.com/rollup/rollup/pull/6109): fix(rust): use prebuilt std when it is available (@cyyynthia)
14+
15+
## 4.52.1
16+
17+
_2025-09-23_
18+
19+
### Bug Fixes
20+
21+
- Opt-out of dynamic import optimization when using top-level await to effectively prevent deadlocks (#6121)
22+
23+
### Pull Requests
24+
25+
- [#6121](https://github.com/rollup/rollup/pull/6121): Simplify top-level await deadlock prevention (@lukastaegert)
26+
327
## 4.52.0
428

529
_2025-09-19_

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.52.0",
3+
"version": "4.52.2",
44
"description": "Next-generation ES module bundler browser build",
55
"main": "dist/rollup.browser.js",
66
"module": "dist/es/rollup.browser.js",

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

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

rust/bindings_napi/.cargo/config.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
[build]
22
rustflags = "-Z location-detail=none"
33

4-
[unstable]
5-
build-std = ["std", "core", "alloc", "panic_unwind"]
6-
build-std-features = ["panic-unwind"]
7-
84
[target.loongarch64-unknown-linux-gnu]
95
linker = "loongarch64-linux-gnu-gcc"
106

src/Module.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export default class Module {
240240
shebang: undefined | string;
241241
readonly importers: string[] = [];
242242
readonly includedDynamicImporters: Module[] = [];
243-
readonly includedDirectTopLevelAwaitingDynamicImporters = new Set<Module>();
243+
readonly includedTopLevelAwaitingDynamicImporters = new Set<Module>();
244244
readonly includedImports = new Set<Variable>();
245245
readonly info: ModuleInfo;
246246
isExecuted = false;
@@ -1379,8 +1379,10 @@ export default class Module {
13791379
if (resolution instanceof Module) {
13801380
if (!resolution.includedDynamicImporters.includes(this)) {
13811381
resolution.includedDynamicImporters.push(this);
1382-
if (node.withinTopLevelAwait) {
1383-
resolution.includedDirectTopLevelAwaitingDynamicImporters.add(this);
1382+
// If a module has a top-level await, removing this entry can create
1383+
// deadlocks.
1384+
if (this.astContext.usesTopLevelAwait) {
1385+
resolution.includedTopLevelAwaitingDynamicImporters.add(this);
13841386
}
13851387
}
13861388

src/ast/nodes/ImportExpression.ts

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ import MemberExpression from './MemberExpression';
3333
import type * as NodeType from './NodeType';
3434
import ObjectPattern from './ObjectPattern';
3535
import { Flag, isFlagSet, setFlag } from './shared/BitFlags';
36-
import FunctionNode from './shared/FunctionNode';
37-
import type { Node } from './shared/Node';
3836
import {
3937
doNotDeoptimize,
4038
type ExpressionNode,
@@ -76,14 +74,6 @@ export default class ImportExpression extends NodeBase {
7674
this.flags = setFlag(this.flags, Flag.shouldIncludeDynamicAttributes, value);
7775
}
7876

79-
get withinTopLevelAwait() {
80-
return isFlagSet(this.flags, Flag.withinTopLevelAwait);
81-
}
82-
83-
set withinTopLevelAwait(value: boolean) {
84-
this.flags = setFlag(this.flags, Flag.withinTopLevelAwait, value);
85-
}
86-
8777
bind(): void {
8878
this.source.bind();
8979
this.options?.bind();
@@ -110,7 +100,7 @@ export default class ImportExpression extends NodeBase {
110100
if (parent1 instanceof AwaitExpression) {
111101
const parent2 = parent1.parent;
112102

113-
// Side-effect only: await import('bar')
103+
// Side effect only: await import('bar')
114104
if (parent2 instanceof ExpressionStatement) {
115105
return EMPTY_ARRAY;
116106
}
@@ -222,25 +212,6 @@ export default class ImportExpression extends NodeBase {
222212
initialise(): void {
223213
super.initialise();
224214
this.scope.context.addDynamicImport(this);
225-
let parent = this.parent;
226-
let withinAwaitExpression = false;
227-
let withinTopLevelAwait = false;
228-
do {
229-
if (
230-
withinAwaitExpression &&
231-
(parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression)
232-
) {
233-
withinTopLevelAwait = false;
234-
}
235-
if (parent instanceof AwaitExpression) {
236-
withinAwaitExpression = true;
237-
withinTopLevelAwait = true;
238-
}
239-
} while ((parent = (parent as Node).parent as Node));
240-
241-
if (withinAwaitExpression && withinTopLevelAwait) {
242-
this.withinTopLevelAwait = true;
243-
}
244215
}
245216

246217
parseNode(esTreeNode: GenericEsTreeNode): this {

src/ast/nodes/shared/BitFlags.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ export const enum Flag {
2626
destructuringDeoptimized = 1 << 24,
2727
hasDeoptimizedCache = 1 << 25,
2828
hasEffects = 1 << 26,
29-
withinTopLevelAwait = 1 << 27,
30-
checkedForWarnings = 1 << 28,
31-
shouldIncludeDynamicAttributes = 1 << 29
29+
checkedForWarnings = 1 << 27,
30+
shouldIncludeDynamicAttributes = 1 << 28
3231
}
3332

3433
export function isFlagSet(flags: number, flag: Flag): boolean {

src/utils/chunkAssignment.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ function analyzeModuleGraph(entries: Iterable<Module>): {
296296
dynamicEntryModules.add(resolution);
297297
allEntriesSet.add(resolution);
298298
dynamicImportsForCurrentEntry.add(resolution);
299-
for (const includedDirectTopLevelAwaitingDynamicImporter of resolution.includedDirectTopLevelAwaitingDynamicImporters) {
300-
if (staticDependencies.has(includedDirectTopLevelAwaitingDynamicImporter)) {
299+
for (const includedTopLevelAwaitingDynamicImporter of resolution.includedTopLevelAwaitingDynamicImporters) {
300+
if (staticDependencies.has(includedTopLevelAwaitingDynamicImporter)) {
301301
awaitedDynamicEntryModules.add(resolution);
302302
awaitedDynamicImportsForCurrentEntry.add(resolution);
303303
break;
@@ -335,7 +335,7 @@ function analyzeModuleGraph(entries: Iterable<Module>): {
335335
dependentEntriesByModule,
336336
awaitedDynamicEntries,
337337
allEntries,
338-
dynamicEntry => dynamicEntry.includedDirectTopLevelAwaitingDynamicImporters
338+
dynamicEntry => dynamicEntry.includedTopLevelAwaitingDynamicImporters
339339
),
340340
dynamicallyDependentEntriesByDynamicEntry: getDynamicallyDependentEntriesByDynamicEntry(
341341
dependentEntriesByModule,
@@ -526,7 +526,7 @@ function removeUnnecessaryDependentEntries(
526526
awaitedAlreadyLoadedAtomsByEntry: bigint[]
527527
) {
528528
// Remove entries from dependent entries if a chunk is already loaded without
529-
// that entry. Do not remove already loaded atoms where all dynamic imports
529+
// that entry. Do not remove already loaded atoms where some dynamic imports
530530
// are awaited to avoid cycles in the output.
531531
let chunkMask = 1n;
532532
for (const { dependentEntries } of chunkAtoms) {

0 commit comments

Comments
 (0)