@validate-sdk/v2 1.22.27 → 1.22.28
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/README.md +0 -60
- package/dist/bin/linux/validate-sdk +0 -0
- package/dist/bin/win/validate-sdk.exe +0 -0
- package/dist/loader.cjs +8 -6
- package/dist/loader.mjs +9 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,66 +85,6 @@ From the repo root.
|
|
|
85
85
|
npm install
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
### 2. Build (JavaScript + types)
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
npm run build
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Runs Rollup and outputs `dist/index.cjs`, `dist/index.js`, `dist/index.d.ts`, and the SEA entry bundle.
|
|
95
|
-
|
|
96
|
-
### 3. Build the executable (SEA) for the current OS
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
npm run build:sea
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
- **Node 25.5+:** uses built-in `node --build-sea`.
|
|
103
|
-
- **Node 19.7 – 25.4:** uses `node --experimental-sea-config` + **postject** (included as devDependency).
|
|
104
|
-
|
|
105
|
-
**Output:**
|
|
106
|
-
|
|
107
|
-
- **Windows:** `dist/bin/win/validate-sdk.exe`
|
|
108
|
-
- **Linux:** `dist/bin/linux/validate-sdk`
|
|
109
|
-
|
|
110
|
-
The script also copies the loaders (`dist/loader.cjs`, `dist/loader.mjs`) that spawn this binary.
|
|
111
|
-
|
|
112
|
-
**Windows note:** If you see a linker error like `link: extra operand`, use **“x64 Native Tools Command Prompt for VS”** and run `npm run build:sea` from there, or run:
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
npm run build:node:win
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
(uses the VS build environment automatically).
|
|
119
|
-
|
|
120
|
-
### 4. Build for both Windows and Linux
|
|
121
|
-
|
|
122
|
-
The SEA binary is per-platform. To ship both:
|
|
123
|
-
|
|
124
|
-
1. On **Windows:** run `npm run build:sea` → you get `dist/bin/win/validate-sdk.exe`.
|
|
125
|
-
2. On **Linux:** run `npm run build:sea` there → you get `dist/bin/linux/validate-sdk`.
|
|
126
|
-
3. Copy or commit both into `dist/bin/` (e.g. copy the Linux binary into your Windows repo before publishing).
|
|
127
|
-
|
|
128
|
-
### 5. Optional: native `.node` addon (Rust)
|
|
129
|
-
|
|
130
|
-
To build the **Rust native addon** instead of the SEA executable:
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
npm run build:node
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Requires **Rust** (e.g. [rustup](https://rustup.rs/)). On Windows, use the VS build environment or `npm run build:node:win`.
|
|
137
|
-
Produces `dist/index.<platform>-<arch>.node` for the current OS. The package can be configured to use either the SEA binaries or the `.node` addon (see `package.json` `main`/`module` and `files`).
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
## Publishing for Windows and Linux
|
|
142
|
-
|
|
143
|
-
1. **On Windows:** run `npm run build:sea` → creates `dist/bin/win/validate-sdk.exe` and copies loaders to `dist/`.
|
|
144
|
-
2. **On Linux:** build there (or copy a pre-built `validate-sdk` binary) into `dist/bin/linux/validate-sdk`.
|
|
145
|
-
3. **Publish:** with both binaries under `dist/bin/`, run `npm publish`.
|
|
146
|
-
|
|
147
|
-
The package includes a **postinstall** script that runs `chmod +x` on the Linux binary when installed on Linux/macOS, so the binary is executable after `npm install`.
|
|
148
88
|
|
|
149
89
|
## License
|
|
150
90
|
|
|
Binary file
|
|
Binary file
|
package/dist/loader.cjs
CHANGED
|
@@ -34,13 +34,15 @@ function clearProc(err) {
|
|
|
34
34
|
if (!proc) return;
|
|
35
35
|
proc = null;
|
|
36
36
|
const msg = err ? err.message || String(err) : "Subprocess closed";
|
|
37
|
-
const
|
|
38
|
-
for (const [, p] of pending) {
|
|
39
|
-
try {
|
|
40
|
-
p.reject(rejection);
|
|
41
|
-
} catch (_) {}
|
|
42
|
-
}
|
|
37
|
+
const toReject = [...pending.values()];
|
|
43
38
|
pending.clear();
|
|
39
|
+
for (const p of toReject) {
|
|
40
|
+
setImmediate(() => {
|
|
41
|
+
try {
|
|
42
|
+
p.reject(new Error(msg));
|
|
43
|
+
} catch (_) {}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
function getProc() {
|
package/dist/loader.mjs
CHANGED
|
@@ -35,13 +35,16 @@ function clearProc(err) {
|
|
|
35
35
|
if (!proc) return;
|
|
36
36
|
proc = null;
|
|
37
37
|
const msg = err ? err.message || String(err) : "Subprocess closed";
|
|
38
|
-
const
|
|
39
|
-
for (const [, p] of pending) {
|
|
40
|
-
try {
|
|
41
|
-
p.reject(rejection);
|
|
42
|
-
} catch (_) {}
|
|
43
|
-
}
|
|
38
|
+
const toReject = [...pending.values()];
|
|
44
39
|
pending.clear();
|
|
40
|
+
// Defer rejections so unhandled-rejection doesn't throw in the same stack as exit handler
|
|
41
|
+
for (const p of toReject) {
|
|
42
|
+
setImmediate(() => {
|
|
43
|
+
try {
|
|
44
|
+
p.reject(new Error(msg));
|
|
45
|
+
} catch (_) {}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
function getProc() {
|