Skip to content

Commit 02fbc02

Browse files
committed
Merge branch 'main' into renovate/rslint-core-0.x
2 parents 436cb0f + 8886496 commit 02fbc02

File tree

50 files changed

+747
-902
lines changed

Some content is hidden

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

50 files changed

+747
-902
lines changed

.cargo/config.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ rustflags = [
5555
[target.wasm32-wasip1-threads]
5656
rustflags = [
5757
"-C",
58-
"target-feature=+simd128",
58+
"target-feature=+simd128",
59+
"-C",
60+
# Set initial and max memory to 2GB to disable memory.grow at runtime.
61+
# The allocator uses this link-time value to decide whether to call memory.grow,
62+
# so it must match the runtime initial pages to ensure memory.grow is never called.
63+
"link-args=--initial-memory=2147483648 --max-memory=2147483648",
5964
"--cfg", "tokio_unstable"
6065
]
6166

.github/workflows/reusable-build-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ jobs:
156156
- name: Build wasm32-wasip1-threads with linux
157157
if: ${{ inputs.target == 'wasm32-wasip1-threads' && inputs.profile != 'release' }}
158158
run: |
159+
159160
DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads RSPACK_TARGET_BROWSER=1 pnpm build:binding:${{ inputs.profile }}
160161
DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads pnpm build:binding:${{ inputs.profile }}
161162

.github/workflows/reusable-build-test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ jobs:
172172
NODE_NO_WARNINGS: 1
173173
WASM: 1
174174
RSPACK_LOADER_WORKER_THREADS: 1
175-
NODE_OPTIONS: '--max_old_space_size=8192 --stack-trace-limit=100'
176-
run: pnpm run build:js && pnpm --filter "@rspack/cli" test && pnpm --filter "@rspack/tests" test
175+
run: pnpm run test:ci
177176

178177
- name: Upload Test Reporter
179178
if: always()

crates/node_binding/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"devDependencies": {
3636
"@emnapi/core": "1.9.2",
3737
"@emnapi/runtime": "1.9.2",
38-
"@napi-rs/cli": "3.6.0",
39-
"@napi-rs/wasm-runtime": "1.1.2",
38+
"@napi-rs/cli": "3.6.1",
39+
"@napi-rs/wasm-runtime": "1.1.3",
4040
"@types/node": "^20.19.39",
4141
"emnapi": "1.9.2",
4242
"typescript": "^6.0.2"

crates/node_binding/rspack.wasi-browser.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ const __wasmUrl = new URL('./rspack.wasm32-wasi.wasm', import.meta.url).href
2121
const __emnapiContext = __emnapiGetDefaultContext()
2222
__emnapiContext.feature.Buffer = Buffer
2323

24+
// Allocate 2GB fixed shared memory (initial == maximum to disable memory.grow).
2425
const __sharedMemory = new WebAssembly.Memory({
25-
initial: 16384,
26-
maximum: 65536,
26+
initial: 32768,
27+
maximum: 32768,
2728
shared: true,
2829
})
2930

@@ -57,6 +58,10 @@ const {
5758
...importObject.napi,
5859
...importObject.emnapi,
5960
memory: __sharedMemory,
61+
// Override emnapi's napi_adjust_external_memory to a no-op.
62+
// emnapi implements this by calling memory.grow, but we've disabled memory.grow
63+
// (initial == maximum).
64+
napi_adjust_external_memory() { return 0 },
6065
}
6166
return importObject
6267
},

crates/node_binding/rspack.wasi.cjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ const __wasi = new __nodeWASI({
2626

2727
const __emnapiContext = __emnapiGetDefaultContext()
2828

29+
// Allocate 2GB fixed shared memory (initial == maximum to disable memory.grow).
2930
const __sharedMemory = new WebAssembly.Memory({
30-
initial: 16384,
31-
maximum: 65536,
31+
initial: 32768,
32+
maximum: 32768,
3233
shared: true,
3334
})
3435

@@ -97,6 +98,10 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
9798
...importObject.napi,
9899
...importObject.emnapi,
99100
memory: __sharedMemory,
101+
// Override emnapi's napi_adjust_external_memory to a no-op.
102+
// emnapi implements this by calling memory.grow, but we've disabled memory.grow
103+
// (initial == maximum).
104+
napi_adjust_external_memory() { return 0 },
100105
}
101106
return importObject
102107
},

crates/node_binding/wasi-worker-browser.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ const handler = new MessageHandler({
1616
// eslint-disable-next-line no-console
1717
console.log.apply(console, arguments)
1818
},
19-
printErr: function() {
19+
printErr: function () {
2020
// eslint-disable-next-line no-console
2121
console.error.apply(console, arguments)
22-
22+
2323
errorOutputs.push([...arguments])
2424
},
2525
})
@@ -32,6 +32,10 @@ const handler = new MessageHandler({
3232
...importObject.napi,
3333
...importObject.emnapi,
3434
memory: wasmMemory,
35+
// Override emnapi's napi_adjust_external_memory to a no-op.
36+
// emnapi implements this by calling memory.grow, but we've disabled memory.grow
37+
// (initial == maximum).
38+
napi_adjust_external_memory() { return 0 },
3539
}
3640
},
3741
})

crates/node_binding/wasi-worker.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Object.assign(globalThis, {
1919
require,
2020
Worker,
2121
importScripts: function (f) {
22-
;(0, eval)(fs.readFileSync(f, "utf8") + "//# sourceURL=" + f);
22+
; (0, eval)(fs.readFileSync(f, "utf8") + "//# sourceURL=" + f);
2323
},
2424
postMessage: function (msg) {
2525
if (parentPort) {
@@ -51,7 +51,11 @@ const handler = new MessageHandler({
5151
...importObject.env,
5252
...importObject.napi,
5353
...importObject.emnapi,
54-
memory: wasmMemory
54+
memory: wasmMemory,
55+
// Override emnapi's napi_adjust_external_memory to a no-op.
56+
// emnapi implements this by calling memory.grow, but we've disabled memory.grow
57+
// (initial == maximum).
58+
napi_adjust_external_memory() { return 0 },
5559
};
5660
},
5761
});

crates/rspack_binding_api/src/codegen_result.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@ impl From<&CodeGenerationResults> for JsCodegenerationResults {
4747
runtime_map.insert(
4848
get_runtime_key(runtime_result_map.single_runtime.as_ref().expect("exist")).clone(),
4949
id_result_map
50-
.get(&runtime_result_map.single_value.expect("TODO"))
51-
.expect("TODO")
50+
.get(
51+
&runtime_result_map
52+
.single_value
53+
.expect("should have single value in SingleEntry mode"),
54+
)
55+
.expect("should have codegen result for single value")
5256
.as_ref()
5357
.into(),
5458
);
@@ -57,7 +61,11 @@ impl From<&CodeGenerationResults> for JsCodegenerationResults {
5761
runtime_result_map.map.iter().for_each(|(k, v)| {
5862
runtime_map.insert(
5963
k.clone(),
60-
id_result_map.get(v).expect("TODO").as_ref().into(),
64+
id_result_map
65+
.get(v)
66+
.expect("should have codegen result for runtime value")
67+
.as_ref()
68+
.into(),
6169
);
6270
});
6371
}

crates/rspack_binding_builder_testing/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"devDependencies": {
2525
"@emnapi/core": "1.9.2",
2626
"@emnapi/runtime": "1.9.2",
27-
"@napi-rs/cli": "3.6.0",
28-
"@napi-rs/wasm-runtime": "1.1.2",
27+
"@napi-rs/cli": "3.6.1",
28+
"@napi-rs/wasm-runtime": "1.1.3",
2929
"emnapi": "1.9.2",
3030
"typescript": "^6.0.2"
3131
},

0 commit comments

Comments
 (0)