@ohos-ports/rspack-binding 1.7.11-beta.0

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/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@ohos-ports/rspack-binding",
3
+ "version": "1.7.11-beta.0",
4
+ "license": "MIT",
5
+ "description": "Node binding for rspack",
6
+ "main": "binding.js",
7
+ "types": "binding.d.ts",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "files": [
12
+ "binding.js",
13
+ "binding.d.ts",
14
+ "napi-binding.d.ts",
15
+ "webcontainer-fallback.cjs",
16
+ "rspack.linux-arm64-ohos.node"
17
+ ],
18
+ "homepage": "https://rspack.rs",
19
+ "bugs": "https://github.com/web-infra-dev/rspack/issues",
20
+ "repository": "web-infra-dev/rspack",
21
+ "devDependencies": {
22
+ "@napi-rs/cli": "3.0.4",
23
+ "@napi-rs/wasm-runtime": "1.0.7",
24
+ "emnapi": "1.8.1",
25
+ "typescript": "^5.9.3"
26
+ },
27
+ "napi": {
28
+ "binaryName": "rspack",
29
+ "packageName": "@rspack/binding",
30
+ "targets": [
31
+ "x86_64-apple-darwin",
32
+ "x86_64-pc-windows-msvc",
33
+ "x86_64-unknown-linux-gnu",
34
+ "x86_64-unknown-linux-musl",
35
+ "x86_64-unknown-freebsd",
36
+ "i686-pc-windows-msvc",
37
+ "armv7-unknown-linux-gnueabihf",
38
+ "aarch64-unknown-linux-gnu",
39
+ "aarch64-apple-darwin",
40
+ "aarch64-unknown-linux-musl",
41
+ "aarch64-pc-windows-msvc"
42
+ ],
43
+ "wasm": {
44
+ "initialMemory": 16384,
45
+ "browser": {
46
+ "fs": true,
47
+ "asyncInit": true,
48
+ "buffer": true
49
+ }
50
+ }
51
+ },
52
+ "optionalDependencies": {
53
+ "@rspack/binding-darwin-arm64": "1.7.11",
54
+ "@rspack/binding-win32-arm64-msvc": "1.7.11",
55
+ "@rspack/binding-linux-arm64-musl": "1.7.11",
56
+ "@rspack/binding-linux-arm64-gnu": "1.7.11",
57
+ "@rspack/binding-win32-ia32-msvc": "1.7.11",
58
+ "@rspack/binding-darwin-x64": "1.7.11",
59
+ "@rspack/binding-win32-x64-msvc": "1.7.11",
60
+ "@rspack/binding-wasm32-wasi": "1.7.11",
61
+ "@rspack/binding-linux-x64-gnu": "1.7.11",
62
+ "@rspack/binding-linux-x64-musl": "1.7.11"
63
+ },
64
+ "scripts": {
65
+ "build:dev": "node scripts/build.js",
66
+ "build:debug": "node scripts/build.js --profile release-debug",
67
+ "build:ci": "node scripts/build.js --profile ci",
68
+ "build:profiling": "node scripts/build.js --profile profiling",
69
+ "build:release": "node scripts/build.js --profile release",
70
+ "build:dev:wasm": "DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads node scripts/build.js",
71
+ "build:release:wasm": "DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads node scripts/build.js --profile release-wasi",
72
+ "build:dev:browser": "DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads RSPACK_TARGET_BROWSER=1 node scripts/build.js",
73
+ "build:release:browser": "DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads RSPACK_TARGET_BROWSER=1 node scripts/build.js --profile release-wasi",
74
+ "move-binding": "node scripts/move-binding",
75
+ "test": "tsc -p tsconfig.type-test.json"
76
+ }
77
+ }
Binary file
@@ -0,0 +1,23 @@
1
+ const fs = require('node:fs');
2
+ const path = require('node:path');
3
+ const childProcess = require('node:child_process');
4
+
5
+ const pkg = JSON.parse(
6
+ fs.readFileSync(path.join(__dirname, 'package.json'), 'utf-8'),
7
+ );
8
+ const version = pkg.version;
9
+ const baseDir = `/tmp/rspack-${version}`;
10
+ const bindingEntry = `${baseDir}/node_modules/${pkg.name}-wasm32-wasi/rspack.wasi.cjs`;
11
+
12
+ if (!fs.existsSync(bindingEntry)) {
13
+ fs.rmSync(baseDir, { recursive: true, force: true });
14
+ fs.mkdirSync(baseDir, { recursive: true });
15
+ const bindingPkg = `${pkg.name}-wasm32-wasi@${version}`;
16
+ console.log(`[rspack] Downloading ${bindingPkg} on WebContainer...`);
17
+ childProcess.execFileSync('pnpm', ['i', bindingPkg], {
18
+ cwd: baseDir,
19
+ stdio: 'inherit',
20
+ });
21
+ }
22
+
23
+ module.exports = require(bindingEntry);