@rspack/binding 1.5.1 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.js +10 -0
- package/napi-binding.d.ts +2 -1
- package/package.json +13 -12
- package/webcontainer-fallback.cjs +27 -0
package/binding.js
CHANGED
|
@@ -380,6 +380,16 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
+
if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
|
|
384
|
+
try {
|
|
385
|
+
nativeBinding = require("./webcontainer-fallback.cjs")
|
|
386
|
+
} catch (err) {
|
|
387
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
388
|
+
loadErrors.push(err)
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
383
393
|
if (!nativeBinding) {
|
|
384
394
|
if (loadErrors.length > 0) {
|
|
385
395
|
throw new Error(
|
package/napi-binding.d.ts
CHANGED
|
@@ -443,7 +443,7 @@ export declare class ModuleGraphConnection {
|
|
|
443
443
|
|
|
444
444
|
export declare class NativeWatcher {
|
|
445
445
|
constructor(options: NativeWatcherOptions)
|
|
446
|
-
watch(files: [Array<string>, Array<string>], directories: [Array<string>, Array<string>], missing: [Array<string>, Array<string>], callback: (err: Error | null, result: NativeWatchResult) => void, callbackUndelayed: (path: string) => void): void
|
|
446
|
+
watch(files: [Array<string>, Array<string>], directories: [Array<string>, Array<string>], missing: [Array<string>, Array<string>], startTime: bigint, callback: (err: Error | null, result: NativeWatchResult) => void, callbackUndelayed: (path: string) => void): void
|
|
447
447
|
triggerEvent(kind: 'change' | 'remove' | 'create', path: string): void
|
|
448
448
|
/**
|
|
449
449
|
* # Safety
|
|
@@ -2111,6 +2111,7 @@ parallelCodeSplitting: boolean
|
|
|
2111
2111
|
rspackFuture?: RawRspackFuture
|
|
2112
2112
|
cache: boolean | { type: "persistent" } & RawExperimentCacheOptionsPersistent | { type: "memory" }
|
|
2113
2113
|
useInputFileSystem?: false | Array<RegExp>
|
|
2114
|
+
css?: boolean
|
|
2114
2115
|
inlineConst: boolean
|
|
2115
2116
|
inlineEnum: boolean
|
|
2116
2117
|
typeReexportsPresence: boolean
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/binding",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node binding for rspack",
|
|
6
6
|
"main": "binding.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"binding.js",
|
|
14
14
|
"binding.d.ts",
|
|
15
|
-
"napi-binding.d.ts"
|
|
15
|
+
"napi-binding.d.ts",
|
|
16
|
+
"webcontainer-fallback.cjs"
|
|
16
17
|
],
|
|
17
18
|
"homepage": "https://rspack.rs",
|
|
18
19
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
@@ -50,16 +51,16 @@
|
|
|
50
51
|
}
|
|
51
52
|
},
|
|
52
53
|
"optionalDependencies": {
|
|
53
|
-
"@rspack/binding-darwin-arm64": "1.5.
|
|
54
|
-
"@rspack/binding-
|
|
55
|
-
"@rspack/binding-
|
|
56
|
-
"@rspack/binding-linux-arm64-musl": "1.5.
|
|
57
|
-
"@rspack/binding-
|
|
58
|
-
"@rspack/binding-
|
|
59
|
-
"@rspack/binding-
|
|
60
|
-
"@rspack/binding-win32-x64-msvc": "1.5.
|
|
61
|
-
"@rspack/binding-linux-x64-gnu": "1.5.
|
|
62
|
-
"@rspack/binding-linux-x64-musl": "1.5.
|
|
54
|
+
"@rspack/binding-darwin-arm64": "1.5.3",
|
|
55
|
+
"@rspack/binding-win32-arm64-msvc": "1.5.3",
|
|
56
|
+
"@rspack/binding-linux-arm64-gnu": "1.5.3",
|
|
57
|
+
"@rspack/binding-linux-arm64-musl": "1.5.3",
|
|
58
|
+
"@rspack/binding-win32-ia32-msvc": "1.5.3",
|
|
59
|
+
"@rspack/binding-wasm32-wasi": "1.5.3",
|
|
60
|
+
"@rspack/binding-darwin-x64": "1.5.3",
|
|
61
|
+
"@rspack/binding-win32-x64-msvc": "1.5.3",
|
|
62
|
+
"@rspack/binding-linux-x64-gnu": "1.5.3",
|
|
63
|
+
"@rspack/binding-linux-x64-musl": "1.5.3"
|
|
63
64
|
},
|
|
64
65
|
"scripts": {
|
|
65
66
|
"build:dev": "node scripts/build.js",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on https://github.com/oxc-project/oxc/blob/main/napi/parser/webcontainer-fallback.js
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
const childProcess = require('node:child_process');
|
|
8
|
+
|
|
9
|
+
const pkg = JSON.parse(
|
|
10
|
+
fs.readFileSync(path.join(__dirname, 'package.json'), 'utf-8'),
|
|
11
|
+
);
|
|
12
|
+
const version = pkg.version;
|
|
13
|
+
const baseDir = `/tmp/rspack-${version}`;
|
|
14
|
+
const bindingEntry = `${baseDir}/node_modules/${pkg.name}-wasm32-wasi/rspack.wasi.cjs`;
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(bindingEntry)) {
|
|
17
|
+
fs.rmSync(baseDir, { recursive: true, force: true });
|
|
18
|
+
fs.mkdirSync(baseDir, { recursive: true });
|
|
19
|
+
const bindingPkg = `${pkg.name}-wasm32-wasi@${version}`;
|
|
20
|
+
console.log(`[rspack] Downloading ${bindingPkg} on WebContainer...`);
|
|
21
|
+
childProcess.execFileSync('pnpm', ['i', bindingPkg], {
|
|
22
|
+
cwd: baseDir,
|
|
23
|
+
stdio: 'inherit',
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = require(bindingEntry);
|