reg-cli 0.19.0-rc1 → 0.19.0-rc2
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/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/cli.d.cts +0 -0
- package/dist/cli.d.mts +0 -0
- package/dist/index.cjs +4 -3
- package/dist/index.d.cts +0 -0
- package/dist/index.d.mts +0 -0
- package/dist/index.mjs +4 -3
- package/dist/reg.wasm +0 -0
- package/dist/runner.cjs +20 -13
- package/dist/runner.d.cts +0 -0
- package/dist/runner.d.mts +0 -0
- package/dist/runner.mjs +20 -13
- package/dist/shared/report-worker.js +0 -0
- package/dist/shared/worker_pre.js +0 -0
- package/dist/tracing-Bo38b9aR.mjs +0 -0
- package/dist/tracing-Cf9TNPXQ.cjs +0 -0
- package/dist/ximgdiff-B16oe7EL.cjs +0 -0
- package/dist/ximgdiff-D8GAJaxA.mjs +0 -0
- package/package.json +1 -1
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/dist/cli.d.cts
CHANGED
|
File without changes
|
package/dist/cli.d.mts
CHANGED
|
File without changes
|
package/dist/index.cjs
CHANGED
|
@@ -50,7 +50,7 @@ const runInternal = async (argv, emitter) => {
|
|
|
50
50
|
if (msg.event) emitter.emit("compare", msg.event);
|
|
51
51
|
return;
|
|
52
52
|
case "thread-spawn":
|
|
53
|
-
spawn(msg.startArg, msg.threadId, msg.memory);
|
|
53
|
+
spawn(msg.startArg, msg.threadId, msg.memory, msg.wasmModule);
|
|
54
54
|
return;
|
|
55
55
|
case "worker-spans":
|
|
56
56
|
if (Array.isArray(msg.workerSpans)) threadWorkerSpans.push(...msg.workerSpans);
|
|
@@ -66,7 +66,7 @@ const runInternal = async (argv, emitter) => {
|
|
|
66
66
|
emitter.emit("error", e);
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
|
-
const spawn = (startArg, threadId, memory) => {
|
|
69
|
+
const spawn = (startArg, threadId, memory, wasmModule) => {
|
|
70
70
|
const t_new_worker = Date.now();
|
|
71
71
|
const w = new node_worker_threads.Worker((0, node_path.join)(dir(), `./runner.${require_tracing.resolveExtention()}`), { workerData: {
|
|
72
72
|
argv,
|
|
@@ -83,7 +83,8 @@ const runInternal = async (argv, emitter) => {
|
|
|
83
83
|
w.postMessage({
|
|
84
84
|
startArg,
|
|
85
85
|
tid,
|
|
86
|
-
memory
|
|
86
|
+
memory,
|
|
87
|
+
wasmModule
|
|
87
88
|
});
|
|
88
89
|
return tid;
|
|
89
90
|
};
|
package/dist/index.d.cts
CHANGED
|
File without changes
|
package/dist/index.d.mts
CHANGED
|
File without changes
|
package/dist/index.mjs
CHANGED
|
@@ -48,7 +48,7 @@ const runInternal = async (argv, emitter) => {
|
|
|
48
48
|
if (msg.event) emitter.emit("compare", msg.event);
|
|
49
49
|
return;
|
|
50
50
|
case "thread-spawn":
|
|
51
|
-
spawn(msg.startArg, msg.threadId, msg.memory);
|
|
51
|
+
spawn(msg.startArg, msg.threadId, msg.memory, msg.wasmModule);
|
|
52
52
|
return;
|
|
53
53
|
case "worker-spans":
|
|
54
54
|
if (Array.isArray(msg.workerSpans)) threadWorkerSpans.push(...msg.workerSpans);
|
|
@@ -64,7 +64,7 @@ const runInternal = async (argv, emitter) => {
|
|
|
64
64
|
emitter.emit("error", e);
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
-
const spawn = (startArg, threadId, memory) => {
|
|
67
|
+
const spawn = (startArg, threadId, memory, wasmModule) => {
|
|
68
68
|
const t_new_worker = Date.now();
|
|
69
69
|
const w = new Worker(join(dir(), `./runner.${resolveExtention()}`), { workerData: {
|
|
70
70
|
argv,
|
|
@@ -81,7 +81,8 @@ const runInternal = async (argv, emitter) => {
|
|
|
81
81
|
w.postMessage({
|
|
82
82
|
startArg,
|
|
83
83
|
tid,
|
|
84
|
-
memory
|
|
84
|
+
memory,
|
|
85
|
+
wasmModule
|
|
85
86
|
});
|
|
86
87
|
return tid;
|
|
87
88
|
};
|
package/dist/reg.wasm
CHANGED
|
Binary file
|
package/dist/runner.cjs
CHANGED
|
@@ -105,7 +105,7 @@ const wasi = new _tybys_wasm_util.WASI({
|
|
|
105
105
|
fs: node_fs.default,
|
|
106
106
|
printErr
|
|
107
107
|
});
|
|
108
|
-
const wasmFile = require_tracing.readWasm();
|
|
108
|
+
const wasmFile = mode === "entry" ? require_tracing.readWasm() : null;
|
|
109
109
|
const readWasmString = (exports, memory, outputPtr) => {
|
|
110
110
|
const view = new DataView(memory.buffer, outputPtr);
|
|
111
111
|
const len = view.getUint32(0, true);
|
|
@@ -135,7 +135,7 @@ const makeSpanRecorder = (workerLabel) => {
|
|
|
135
135
|
tSpan
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
|
-
const makeThreadSpawnImport = (memory) => (startArg) => {
|
|
138
|
+
const makeThreadSpawnImport = (memory, wasmModule) => (startArg) => {
|
|
139
139
|
const buf = new SharedArrayBuffer(4);
|
|
140
140
|
const id = new Int32Array(buf);
|
|
141
141
|
Atomics.store(id, 0, -1);
|
|
@@ -143,19 +143,26 @@ const makeThreadSpawnImport = (memory) => (startArg) => {
|
|
|
143
143
|
cmd: "thread-spawn",
|
|
144
144
|
startArg,
|
|
145
145
|
threadId: id,
|
|
146
|
-
memory
|
|
146
|
+
memory,
|
|
147
|
+
wasmModule
|
|
147
148
|
});
|
|
148
149
|
Atomics.wait(id, 0, -1);
|
|
149
150
|
return Atomics.load(id, 0);
|
|
150
151
|
};
|
|
151
|
-
const compileAndInstantiate = async (memory, tSpan, prefix) => {
|
|
152
|
-
const wasm = await tSpan(`${prefix}.wasm_compile`, async () =>
|
|
152
|
+
const compileAndInstantiate = async (memory, tSpan, prefix, compiledModule) => {
|
|
153
|
+
const wasm = compiledModule ?? await tSpan(`${prefix}.wasm_compile`, async () => {
|
|
154
|
+
if (!wasmFile) throw new Error("Wasm bytes are unavailable in a thread worker");
|
|
155
|
+
return WebAssembly.compile(await wasmFile);
|
|
156
|
+
});
|
|
153
157
|
const wasi_snapshot_preview1 = require_tracing.filterWasiImports(wasm, wasi.getImportObject().wasi_snapshot_preview1);
|
|
154
|
-
return
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
158
|
+
return {
|
|
159
|
+
instance: await tSpan(`${prefix}.wasm_instantiate`, async () => WebAssembly.instantiate(wasm, {
|
|
160
|
+
wasi_snapshot_preview1,
|
|
161
|
+
wasi: { "thread-spawn": makeThreadSpawnImport(memory, wasm) },
|
|
162
|
+
env: { memory }
|
|
163
|
+
})),
|
|
164
|
+
module: wasm
|
|
165
|
+
};
|
|
159
166
|
};
|
|
160
167
|
if (mode === "entry") (async () => {
|
|
161
168
|
const entry_start_ms = Date.now();
|
|
@@ -165,7 +172,7 @@ if (mode === "entry") (async () => {
|
|
|
165
172
|
maximum: 16384,
|
|
166
173
|
shared: true
|
|
167
174
|
});
|
|
168
|
-
const instance = await compileAndInstantiate(memory, tSpan, "entry");
|
|
175
|
+
const { instance } = await compileAndInstantiate(memory, tSpan, "entry");
|
|
169
176
|
const exports = instance.exports;
|
|
170
177
|
await tSpan("entry.wasi_start", async () => {
|
|
171
178
|
wasi.start(instance);
|
|
@@ -199,11 +206,11 @@ if (mode === "entry") (async () => {
|
|
|
199
206
|
workerSpans
|
|
200
207
|
});
|
|
201
208
|
})();
|
|
202
|
-
else node_worker_threads.parentPort?.addListener("message", async ({ startArg, tid, memory }) => {
|
|
209
|
+
else node_worker_threads.parentPort?.addListener("message", async ({ startArg, tid, memory, wasmModule }) => {
|
|
203
210
|
const workerLabel = `thread-${tid}`;
|
|
204
211
|
const handler_start_ms = Date.now();
|
|
205
212
|
const { workerSpans, tSpan } = makeSpanRecorder(workerLabel);
|
|
206
|
-
let instance = await compileAndInstantiate(memory, tSpan, "worker");
|
|
213
|
+
let { instance } = await compileAndInstantiate(memory, tSpan, "worker", wasmModule);
|
|
207
214
|
instance = createInstanceProxy(instance, memory);
|
|
208
215
|
await tSpan("worker.wasi_start", async () => {
|
|
209
216
|
wasi.start(instance);
|
package/dist/runner.d.cts
CHANGED
|
File without changes
|
package/dist/runner.d.mts
CHANGED
|
File without changes
|
package/dist/runner.mjs
CHANGED
|
@@ -104,7 +104,7 @@ const wasi = new WASI({
|
|
|
104
104
|
fs,
|
|
105
105
|
printErr
|
|
106
106
|
});
|
|
107
|
-
const wasmFile = readWasm();
|
|
107
|
+
const wasmFile = mode === "entry" ? readWasm() : null;
|
|
108
108
|
const readWasmString = (exports, memory, outputPtr) => {
|
|
109
109
|
const view = new DataView(memory.buffer, outputPtr);
|
|
110
110
|
const len = view.getUint32(0, true);
|
|
@@ -134,7 +134,7 @@ const makeSpanRecorder = (workerLabel) => {
|
|
|
134
134
|
tSpan
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
|
-
const makeThreadSpawnImport = (memory) => (startArg) => {
|
|
137
|
+
const makeThreadSpawnImport = (memory, wasmModule) => (startArg) => {
|
|
138
138
|
const buf = new SharedArrayBuffer(4);
|
|
139
139
|
const id = new Int32Array(buf);
|
|
140
140
|
Atomics.store(id, 0, -1);
|
|
@@ -142,19 +142,26 @@ const makeThreadSpawnImport = (memory) => (startArg) => {
|
|
|
142
142
|
cmd: "thread-spawn",
|
|
143
143
|
startArg,
|
|
144
144
|
threadId: id,
|
|
145
|
-
memory
|
|
145
|
+
memory,
|
|
146
|
+
wasmModule
|
|
146
147
|
});
|
|
147
148
|
Atomics.wait(id, 0, -1);
|
|
148
149
|
return Atomics.load(id, 0);
|
|
149
150
|
};
|
|
150
|
-
const compileAndInstantiate = async (memory, tSpan, prefix) => {
|
|
151
|
-
const wasm = await tSpan(`${prefix}.wasm_compile`, async () =>
|
|
151
|
+
const compileAndInstantiate = async (memory, tSpan, prefix, compiledModule) => {
|
|
152
|
+
const wasm = compiledModule ?? await tSpan(`${prefix}.wasm_compile`, async () => {
|
|
153
|
+
if (!wasmFile) throw new Error("Wasm bytes are unavailable in a thread worker");
|
|
154
|
+
return WebAssembly.compile(await wasmFile);
|
|
155
|
+
});
|
|
152
156
|
const wasi_snapshot_preview1 = filterWasiImports(wasm, wasi.getImportObject().wasi_snapshot_preview1);
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
return {
|
|
158
|
+
instance: await tSpan(`${prefix}.wasm_instantiate`, async () => WebAssembly.instantiate(wasm, {
|
|
159
|
+
wasi_snapshot_preview1,
|
|
160
|
+
wasi: { "thread-spawn": makeThreadSpawnImport(memory, wasm) },
|
|
161
|
+
env: { memory }
|
|
162
|
+
})),
|
|
163
|
+
module: wasm
|
|
164
|
+
};
|
|
158
165
|
};
|
|
159
166
|
if (mode === "entry") (async () => {
|
|
160
167
|
const entry_start_ms = Date.now();
|
|
@@ -164,7 +171,7 @@ if (mode === "entry") (async () => {
|
|
|
164
171
|
maximum: 16384,
|
|
165
172
|
shared: true
|
|
166
173
|
});
|
|
167
|
-
const instance = await compileAndInstantiate(memory, tSpan, "entry");
|
|
174
|
+
const { instance } = await compileAndInstantiate(memory, tSpan, "entry");
|
|
168
175
|
const exports = instance.exports;
|
|
169
176
|
await tSpan("entry.wasi_start", async () => {
|
|
170
177
|
wasi.start(instance);
|
|
@@ -198,11 +205,11 @@ if (mode === "entry") (async () => {
|
|
|
198
205
|
workerSpans
|
|
199
206
|
});
|
|
200
207
|
})();
|
|
201
|
-
else parentPort?.addListener("message", async ({ startArg, tid, memory }) => {
|
|
208
|
+
else parentPort?.addListener("message", async ({ startArg, tid, memory, wasmModule }) => {
|
|
202
209
|
const workerLabel = `thread-${tid}`;
|
|
203
210
|
const handler_start_ms = Date.now();
|
|
204
211
|
const { workerSpans, tSpan } = makeSpanRecorder(workerLabel);
|
|
205
|
-
let instance = await compileAndInstantiate(memory, tSpan, "worker");
|
|
212
|
+
let { instance } = await compileAndInstantiate(memory, tSpan, "worker", wasmModule);
|
|
206
213
|
instance = createInstanceProxy(instance, memory);
|
|
207
214
|
await tSpan("worker.wasi_start", async () => {
|
|
208
215
|
wasi.start(instance);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reg-cli",
|
|
3
|
-
"version": "0.19.0-
|
|
3
|
+
"version": "0.19.0-rc2",
|
|
4
4
|
"description": "Visual regression testing CLI, Wasm-backed. Drop-in compatible with classic reg-cli's CLI flags, reg.json/junit schema, and `compare()` EventEmitter API (verified against reg-suit's processor.ts).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|