reg-cli 0.19.0-rc0 → 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.
@@ -13,6 +13,22 @@ const resolveExtention = () => {
13
13
  return isCJS ? "cjs" : "mjs";
14
14
  };
15
15
  /**
16
+ * Restrict the WASI namespace passed to `WebAssembly.instantiate` to only the
17
+ * functions the wasm module actually imports. `@tybys/wasm-util` exposes the
18
+ * full WASI preview1 surface (~46 fns) but `reg.wasm` declares ~20. The unused
19
+ * 26 include capabilities reg-cli never needs (`path_unlink_file`,
20
+ * `path_remove_directory`, `sock_*`, `proc_raise`, ...). Withholding them
21
+ * shrinks the blast radius if the bundled wasm or one of its image-decoder
22
+ * dependencies (libpng/libwebp/libjpeg) is ever compromised.
23
+ */
24
+ const filterWasiImports = (module, full) => {
25
+ const needed = new Set(WebAssembly.Module.imports(module).filter((i) => i.module === "wasi_snapshot_preview1").map((i) => i.name));
26
+ const filtered = {};
27
+ const src = full;
28
+ for (const name of needed) if (name in src) filtered[name] = src[name];
29
+ return filtered;
30
+ };
31
+ /**
16
32
  * Host environment variables intentionally forwarded into the Wasm sandbox.
17
33
  * Everything else (shell secrets, CI credentials, AWS_*, NPM_TOKEN, ...) is
18
34
  * filtered out.
@@ -51,6 +67,34 @@ const commonAncestor = (paths) => {
51
67
  if (common.length === 0) return allAbs ? "/" : ".";
52
68
  return (allAbs ? "/" : "") + common.join("/");
53
69
  };
70
+ const WASI_PATH_FLAGS = new Set([
71
+ "--report",
72
+ "-R",
73
+ "--json",
74
+ "-J",
75
+ "--junit",
76
+ "--from",
77
+ "-F"
78
+ ]);
79
+ /**
80
+ * Normalize `./foo` to `foo` for paths passed into WASI. wasm-util does not
81
+ * match a guest path beginning with `./` to an otherwise equivalent relative
82
+ * preopen, so leaving the prefix intact makes valid paths unreachable.
83
+ */
84
+ const normalizeWasiArgv = (argv) => {
85
+ const normalized = [...argv];
86
+ const stripDot = (value) => value.startsWith("./") ? value.slice(2) || "." : value;
87
+ const offset = normalized[0] === "--" ? 1 : 0;
88
+ for (let i = offset; i < normalized.length && i < offset + 3; i++) {
89
+ if (normalized[i].startsWith("-")) break;
90
+ normalized[i] = stripDot(normalized[i]);
91
+ }
92
+ for (let i = offset; i < normalized.length - 1; i++) if (WASI_PATH_FLAGS.has(normalized[i])) {
93
+ normalized[i + 1] = stripDot(normalized[i + 1]);
94
+ i++;
95
+ }
96
+ return normalized;
97
+ };
54
98
  /**
55
99
  * Compute the minimum-capability WASI sandbox for a given reg-cli invocation:
56
100
  *
@@ -375,4 +419,4 @@ const processWorkerSpans = (spans, workerLabel) => {
375
419
  }
376
420
  };
377
421
  //#endregion
378
- export { processWorkerSpans as a, computeWasiSandbox as c, resolveExtention as d, processRustTraceData as i, isCJS as l, initTracing as n, shutdownTracing as o, isTracingEnabled as r, startRootSpan as s, endRootSpan as t, readWasm as u };
422
+ export { processWorkerSpans as a, computeWasiSandbox as c, normalizeWasiArgv as d, readWasm as f, processRustTraceData as i, filterWasiImports as l, initTracing as n, shutdownTracing as o, resolveExtention as p, isTracingEnabled as r, startRootSpan as s, endRootSpan as t, isCJS as u };
@@ -1,6 +1,36 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-D_mwlA32.cjs");
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __exportAll = (all, no_symbols) => {
9
+ let target = {};
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
+ return target;
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
+ key = keys[i];
20
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
+ get: ((k) => from[k]).bind(null, key),
22
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
+ });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ //#endregion
2
32
  let path = require("path");
3
- path = require_rolldown_runtime.__toESM(path, 1);
33
+ path = __toESM(path, 1);
4
34
  let url = require("url");
5
35
  let node_fs_promises = require("node:fs/promises");
6
36
  let node_path = require("node:path");
@@ -15,6 +45,22 @@ const resolveExtention = () => {
15
45
  return isCJS ? "cjs" : "mjs";
16
46
  };
17
47
  /**
48
+ * Restrict the WASI namespace passed to `WebAssembly.instantiate` to only the
49
+ * functions the wasm module actually imports. `@tybys/wasm-util` exposes the
50
+ * full WASI preview1 surface (~46 fns) but `reg.wasm` declares ~20. The unused
51
+ * 26 include capabilities reg-cli never needs (`path_unlink_file`,
52
+ * `path_remove_directory`, `sock_*`, `proc_raise`, ...). Withholding them
53
+ * shrinks the blast radius if the bundled wasm or one of its image-decoder
54
+ * dependencies (libpng/libwebp/libjpeg) is ever compromised.
55
+ */
56
+ const filterWasiImports = (module, full) => {
57
+ const needed = new Set(WebAssembly.Module.imports(module).filter((i) => i.module === "wasi_snapshot_preview1").map((i) => i.name));
58
+ const filtered = {};
59
+ const src = full;
60
+ for (const name of needed) if (name in src) filtered[name] = src[name];
61
+ return filtered;
62
+ };
63
+ /**
18
64
  * Host environment variables intentionally forwarded into the Wasm sandbox.
19
65
  * Everything else (shell secrets, CI credentials, AWS_*, NPM_TOKEN, ...) is
20
66
  * filtered out.
@@ -53,6 +99,34 @@ const commonAncestor = (paths) => {
53
99
  if (common.length === 0) return allAbs ? "/" : ".";
54
100
  return (allAbs ? "/" : "") + common.join("/");
55
101
  };
102
+ const WASI_PATH_FLAGS = new Set([
103
+ "--report",
104
+ "-R",
105
+ "--json",
106
+ "-J",
107
+ "--junit",
108
+ "--from",
109
+ "-F"
110
+ ]);
111
+ /**
112
+ * Normalize `./foo` to `foo` for paths passed into WASI. wasm-util does not
113
+ * match a guest path beginning with `./` to an otherwise equivalent relative
114
+ * preopen, so leaving the prefix intact makes valid paths unreachable.
115
+ */
116
+ const normalizeWasiArgv = (argv) => {
117
+ const normalized = [...argv];
118
+ const stripDot = (value) => value.startsWith("./") ? value.slice(2) || "." : value;
119
+ const offset = normalized[0] === "--" ? 1 : 0;
120
+ for (let i = offset; i < normalized.length && i < offset + 3; i++) {
121
+ if (normalized[i].startsWith("-")) break;
122
+ normalized[i] = stripDot(normalized[i]);
123
+ }
124
+ for (let i = offset; i < normalized.length - 1; i++) if (WASI_PATH_FLAGS.has(normalized[i])) {
125
+ normalized[i + 1] = stripDot(normalized[i + 1]);
126
+ i++;
127
+ }
128
+ return normalized;
129
+ };
56
130
  /**
57
131
  * Compute the minimum-capability WASI sandbox for a given reg-cli invocation:
58
132
  *
@@ -377,6 +451,18 @@ const processWorkerSpans = (spans, workerLabel) => {
377
451
  }
378
452
  };
379
453
  //#endregion
454
+ Object.defineProperty(exports, "__exportAll", {
455
+ enumerable: true,
456
+ get: function() {
457
+ return __exportAll;
458
+ }
459
+ });
460
+ Object.defineProperty(exports, "__toESM", {
461
+ enumerable: true,
462
+ get: function() {
463
+ return __toESM;
464
+ }
465
+ });
380
466
  Object.defineProperty(exports, "computeWasiSandbox", {
381
467
  enumerable: true,
382
468
  get: function() {
@@ -389,6 +475,12 @@ Object.defineProperty(exports, "endRootSpan", {
389
475
  return endRootSpan;
390
476
  }
391
477
  });
478
+ Object.defineProperty(exports, "filterWasiImports", {
479
+ enumerable: true,
480
+ get: function() {
481
+ return filterWasiImports;
482
+ }
483
+ });
392
484
  Object.defineProperty(exports, "initTracing", {
393
485
  enumerable: true,
394
486
  get: function() {
@@ -407,6 +499,12 @@ Object.defineProperty(exports, "isTracingEnabled", {
407
499
  return isTracingEnabled;
408
500
  }
409
501
  });
502
+ Object.defineProperty(exports, "normalizeWasiArgv", {
503
+ enumerable: true,
504
+ get: function() {
505
+ return normalizeWasiArgv;
506
+ }
507
+ });
410
508
  Object.defineProperty(exports, "processRustTraceData", {
411
509
  enumerable: true,
412
510
  get: function() {
@@ -1,9 +1,9 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-D_mwlA32.cjs");
1
+ const require_tracing = require("./tracing-Cf9TNPXQ.cjs");
2
2
  let node_fs_promises = require("node:fs/promises");
3
3
  let node_path = require("node:path");
4
4
  let node_module = require("node:module");
5
5
  //#region src/ximgdiff.ts
6
- var ximgdiff_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({ writeXimgdiffAssets: () => writeXimgdiffAssets });
6
+ var ximgdiff_exports = /* @__PURE__ */ require_tracing.__exportAll({ writeXimgdiffAssets: () => writeXimgdiffAssets });
7
7
  const requireShim = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
8
8
  const renderWorkerPre = (template, wasmUrl) => template.replace(/\{\{&\s*ximgdiffWasmUrl\s*\}\}/g, wasmUrl);
9
9
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reg-cli",
3
- "version": "0.19.0-rc0",
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": {
@@ -45,7 +45,7 @@
45
45
  "author": "bokuweb",
46
46
  "license": "MIT",
47
47
  "dependencies": {
48
- "@tybys/wasm-util": "^0.9.0",
48
+ "@tybys/wasm-util": "^0.10.2",
49
49
  "x-img-diff-js": "^0.3.5"
50
50
  },
51
51
  "peerDependencies": {
@@ -57,12 +57,24 @@
57
57
  "@opentelemetry/semantic-conventions": "^1.40.0"
58
58
  },
59
59
  "peerDependenciesMeta": {
60
- "@opentelemetry/api": { "optional": true },
61
- "@opentelemetry/exporter-trace-otlp-http": { "optional": true },
62
- "@opentelemetry/resources": { "optional": true },
63
- "@opentelemetry/sdk-trace-base": { "optional": true },
64
- "@opentelemetry/sdk-trace-node": { "optional": true },
65
- "@opentelemetry/semantic-conventions": { "optional": true }
60
+ "@opentelemetry/api": {
61
+ "optional": true
62
+ },
63
+ "@opentelemetry/exporter-trace-otlp-http": {
64
+ "optional": true
65
+ },
66
+ "@opentelemetry/resources": {
67
+ "optional": true
68
+ },
69
+ "@opentelemetry/sdk-trace-base": {
70
+ "optional": true
71
+ },
72
+ "@opentelemetry/sdk-trace-node": {
73
+ "optional": true
74
+ },
75
+ "@opentelemetry/semantic-conventions": {
76
+ "optional": true
77
+ }
66
78
  },
67
79
  "devDependencies": {
68
80
  "@types/node": "^22.5.5",
@@ -72,7 +84,12 @@
72
84
  "@opentelemetry/sdk-trace-base": "^2.7.1",
73
85
  "@opentelemetry/sdk-trace-node": "^2.7.1",
74
86
  "@opentelemetry/semantic-conventions": "^1.40.0",
75
- "tsdown": "^0.21.10"
87
+ "tsdown": "^0.22.0"
76
88
  },
77
- "packageManager": "pnpm@10.33.2+sha512.a90faf6feeab71ad6c6e57f94e0fe1a12f5dcc22cd754db40ae9593eb6a3e0b6b12e3540218bb37ae083404b1f2ce6db2a4121e979829b4aff94b99f49da1cf8"
89
+ "packageManager": "pnpm@10.33.3+sha512.a19744364a7e248b92657a4ca5973f9354d21caf982579674b1c539f32c7420c47138ad8b1254df07aba9bc782d9b3029e3db34d5dbff974326eb74dac8ff489",
90
+ "pnpm": {
91
+ "overrides": {
92
+ "protobufjs": "^8.6.5"
93
+ }
94
+ }
78
95
  }
package/dist/entry.cjs DELETED
@@ -1,119 +0,0 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-D_mwlA32.cjs");
2
- const require_tracing = require("./tracing-DlLL541f.cjs");
3
- const require_progress = require("./progress-UOiKHaTY.cjs");
4
- let node_worker_threads = require("node:worker_threads");
5
- let node_process = require("node:process");
6
- let node_fs = require("node:fs");
7
- node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
8
- let _tybys_wasm_util = require("@tybys/wasm-util");
9
- //#region src/entry.ts
10
- const isTracingEnabled = () => {
11
- return node_process.env.OTEL_ENABLED === "true" || node_process.env.JAEGER_ENABLED === "true";
12
- };
13
- const workerSpans = [];
14
- const tSpan = async (name, fn, attributes) => {
15
- if (!isTracingEnabled()) return fn();
16
- const start_ms = Date.now();
17
- const result = await fn();
18
- workerSpans.push({
19
- name,
20
- start_ms,
21
- end_ms: Date.now(),
22
- attributes,
23
- worker_label: "entry"
24
- });
25
- return result;
26
- };
27
- const sandbox = require_tracing.computeWasiSandbox(node_worker_threads.workerData.argv);
28
- const printErr = require_progress.createPrintErrHook((ev) => {
29
- node_worker_threads.parentPort?.postMessage({
30
- cmd: "compare-event",
31
- event: ev
32
- });
33
- });
34
- const wasi = new _tybys_wasm_util.WASI({
35
- version: "preview1",
36
- args: node_worker_threads.workerData.argv,
37
- env: sandbox.env,
38
- returnOnExit: true,
39
- preopens: sandbox.preopens,
40
- fs: node_fs.default,
41
- printErr
42
- });
43
- const imports = wasi.getImportObject();
44
- const file = require_tracing.readWasm();
45
- /**
46
- * Read a string from WASM memory using WasmOutput structure
47
- */
48
- const readWasmString = (exports, memory, outputPtr) => {
49
- const view = new DataView(memory.buffer, outputPtr);
50
- const len = view.getUint32(0, true);
51
- const bufPtr = view.getUint32(4, true);
52
- const stringData = new Uint8Array(memory.buffer, bufPtr, len);
53
- const str = new TextDecoder("utf-8").decode(stringData);
54
- exports.free_wasm_output(outputPtr);
55
- return str;
56
- };
57
- (async () => {
58
- try {
59
- const entry_start_ms = Date.now();
60
- const wasm = await tSpan("entry.wasm_compile", async () => WebAssembly.compile(await file));
61
- const memory = new WebAssembly.Memory({
62
- initial: 256,
63
- maximum: 16384,
64
- shared: true
65
- });
66
- let instance = await tSpan("entry.wasm_instantiate", async () => WebAssembly.instantiate(wasm, {
67
- ...imports,
68
- wasi: { "thread-spawn": (startArg) => {
69
- const threadIdBuffer = new SharedArrayBuffer(4);
70
- const id = new Int32Array(threadIdBuffer);
71
- Atomics.store(id, 0, -1);
72
- node_worker_threads.parentPort?.postMessage({
73
- cmd: "thread-spawn",
74
- startArg,
75
- threadId: id,
76
- memory
77
- });
78
- Atomics.wait(id, 0, -1);
79
- return Atomics.load(id, 0);
80
- } },
81
- env: { memory }
82
- }));
83
- const exports = instance.exports;
84
- await tSpan("entry.wasi_start", async () => {
85
- wasi.start(instance);
86
- });
87
- if (isTracingEnabled() && typeof exports.init_tracing === "function") await tSpan("entry.init_tracing_rust", async () => {
88
- exports.init_tracing();
89
- });
90
- const m = await tSpan("entry.wasm_main", async () => exports.wasm_main());
91
- const reportString = await tSpan("entry.read_report_string", async () => readWasmString(exports, memory, m));
92
- const report = JSON.parse(reportString);
93
- let traceData = null;
94
- if (isTracingEnabled() && typeof exports.get_trace_data === "function") await tSpan("entry.collect_rust_traces", async () => {
95
- const traceJson = readWasmString(exports, memory, exports.get_trace_data());
96
- try {
97
- traceData = JSON.parse(traceJson);
98
- } catch (e) {
99
- console.error("[Tracing] Failed to parse trace data:", e);
100
- }
101
- if (typeof exports.clear_trace_data === "function") exports.clear_trace_data();
102
- });
103
- if (isTracingEnabled()) workerSpans.push({
104
- name: "entry.worker_total",
105
- start_ms: entry_start_ms,
106
- end_ms: Date.now(),
107
- worker_label: "entry"
108
- });
109
- node_worker_threads.parentPort?.postMessage({
110
- cmd: "complete",
111
- data: report,
112
- traceData,
113
- workerSpans
114
- });
115
- } catch (e) {
116
- throw e;
117
- }
118
- })();
119
- //#endregion
package/dist/entry.d.cts DELETED
@@ -1,15 +0,0 @@
1
- //#region src/entry.d.ts
2
- type CompareOutput = {
3
- failedItems: string[];
4
- newItems: string[];
5
- deletedItems: string[];
6
- passedItems: string[];
7
- expectedItems: string[];
8
- actualItems: string[];
9
- diffItems: string[];
10
- actualDir: string;
11
- expectedDir: string;
12
- diffDir: string;
13
- };
14
- //#endregion
15
- export { CompareOutput };
package/dist/entry.d.mts DELETED
@@ -1,15 +0,0 @@
1
- //#region src/entry.d.ts
2
- type CompareOutput = {
3
- failedItems: string[];
4
- newItems: string[];
5
- deletedItems: string[];
6
- passedItems: string[];
7
- expectedItems: string[];
8
- actualItems: string[];
9
- diffItems: string[];
10
- actualDir: string;
11
- expectedDir: string;
12
- diffDir: string;
13
- };
14
- //#endregion
15
- export { CompareOutput };
package/dist/entry.mjs DELETED
@@ -1,118 +0,0 @@
1
- import { c as computeWasiSandbox, u as readWasm } from "./tracing-7HO8hac9.mjs";
2
- import { t as createPrintErrHook } from "./progress-BB7D-xke.mjs";
3
- import { parentPort, workerData } from "node:worker_threads";
4
- import { env } from "node:process";
5
- import fs from "node:fs";
6
- import { WASI } from "@tybys/wasm-util";
7
- //#region src/entry.ts
8
- const isTracingEnabled = () => {
9
- return env.OTEL_ENABLED === "true" || env.JAEGER_ENABLED === "true";
10
- };
11
- const workerSpans = [];
12
- const tSpan = async (name, fn, attributes) => {
13
- if (!isTracingEnabled()) return fn();
14
- const start_ms = Date.now();
15
- const result = await fn();
16
- workerSpans.push({
17
- name,
18
- start_ms,
19
- end_ms: Date.now(),
20
- attributes,
21
- worker_label: "entry"
22
- });
23
- return result;
24
- };
25
- const sandbox = computeWasiSandbox(workerData.argv);
26
- const printErr = createPrintErrHook((ev) => {
27
- parentPort?.postMessage({
28
- cmd: "compare-event",
29
- event: ev
30
- });
31
- });
32
- const wasi = new WASI({
33
- version: "preview1",
34
- args: workerData.argv,
35
- env: sandbox.env,
36
- returnOnExit: true,
37
- preopens: sandbox.preopens,
38
- fs,
39
- printErr
40
- });
41
- const imports = wasi.getImportObject();
42
- const file = readWasm();
43
- /**
44
- * Read a string from WASM memory using WasmOutput structure
45
- */
46
- const readWasmString = (exports, memory, outputPtr) => {
47
- const view = new DataView(memory.buffer, outputPtr);
48
- const len = view.getUint32(0, true);
49
- const bufPtr = view.getUint32(4, true);
50
- const stringData = new Uint8Array(memory.buffer, bufPtr, len);
51
- const str = new TextDecoder("utf-8").decode(stringData);
52
- exports.free_wasm_output(outputPtr);
53
- return str;
54
- };
55
- (async () => {
56
- try {
57
- const entry_start_ms = Date.now();
58
- const wasm = await tSpan("entry.wasm_compile", async () => WebAssembly.compile(await file));
59
- const memory = new WebAssembly.Memory({
60
- initial: 256,
61
- maximum: 16384,
62
- shared: true
63
- });
64
- let instance = await tSpan("entry.wasm_instantiate", async () => WebAssembly.instantiate(wasm, {
65
- ...imports,
66
- wasi: { "thread-spawn": (startArg) => {
67
- const threadIdBuffer = new SharedArrayBuffer(4);
68
- const id = new Int32Array(threadIdBuffer);
69
- Atomics.store(id, 0, -1);
70
- parentPort?.postMessage({
71
- cmd: "thread-spawn",
72
- startArg,
73
- threadId: id,
74
- memory
75
- });
76
- Atomics.wait(id, 0, -1);
77
- return Atomics.load(id, 0);
78
- } },
79
- env: { memory }
80
- }));
81
- const exports = instance.exports;
82
- await tSpan("entry.wasi_start", async () => {
83
- wasi.start(instance);
84
- });
85
- if (isTracingEnabled() && typeof exports.init_tracing === "function") await tSpan("entry.init_tracing_rust", async () => {
86
- exports.init_tracing();
87
- });
88
- const m = await tSpan("entry.wasm_main", async () => exports.wasm_main());
89
- const reportString = await tSpan("entry.read_report_string", async () => readWasmString(exports, memory, m));
90
- const report = JSON.parse(reportString);
91
- let traceData = null;
92
- if (isTracingEnabled() && typeof exports.get_trace_data === "function") await tSpan("entry.collect_rust_traces", async () => {
93
- const traceJson = readWasmString(exports, memory, exports.get_trace_data());
94
- try {
95
- traceData = JSON.parse(traceJson);
96
- } catch (e) {
97
- console.error("[Tracing] Failed to parse trace data:", e);
98
- }
99
- if (typeof exports.clear_trace_data === "function") exports.clear_trace_data();
100
- });
101
- if (isTracingEnabled()) workerSpans.push({
102
- name: "entry.worker_total",
103
- start_ms: entry_start_ms,
104
- end_ms: Date.now(),
105
- worker_label: "entry"
106
- });
107
- parentPort?.postMessage({
108
- cmd: "complete",
109
- data: report,
110
- traceData,
111
- workerSpans
112
- });
113
- } catch (e) {
114
- throw e;
115
- }
116
- })();
117
- //#endregion
118
- export {};
@@ -1,28 +0,0 @@
1
- //#region src/progress.ts
2
- const MARKER = "__REG_CLI_EVT__ ";
3
- /**
4
- * Build a WASI `printErr` hook that forwards progress events to `onEvent`
5
- * and everything else to `fallback` (defaults to `console.error`).
6
- *
7
- * `@tybys/wasm-util`'s `StandardOutput.write` already buffers until a
8
- * newline and invokes the callback with one stripped line per call (see
9
- * `node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js` line
10
- * ~749-779). So we can treat each invocation as a single complete line.
11
- */
12
- const createPrintErrHook = (onEvent, fallback = (s) => console.error(s)) => {
13
- return (line) => {
14
- if (line.startsWith(MARKER)) {
15
- const json = line.slice(16);
16
- try {
17
- const ev = JSON.parse(json);
18
- if (ev && typeof ev.type === "string" && typeof ev.path === "string") {
19
- onEvent(ev);
20
- return;
21
- }
22
- } catch {}
23
- }
24
- fallback(line);
25
- };
26
- };
27
- //#endregion
28
- export { createPrintErrHook as t };
@@ -1,33 +0,0 @@
1
- //#region src/progress.ts
2
- const MARKER = "__REG_CLI_EVT__ ";
3
- /**
4
- * Build a WASI `printErr` hook that forwards progress events to `onEvent`
5
- * and everything else to `fallback` (defaults to `console.error`).
6
- *
7
- * `@tybys/wasm-util`'s `StandardOutput.write` already buffers until a
8
- * newline and invokes the callback with one stripped line per call (see
9
- * `node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js` line
10
- * ~749-779). So we can treat each invocation as a single complete line.
11
- */
12
- const createPrintErrHook = (onEvent, fallback = (s) => console.error(s)) => {
13
- return (line) => {
14
- if (line.startsWith(MARKER)) {
15
- const json = line.slice(16);
16
- try {
17
- const ev = JSON.parse(json);
18
- if (ev && typeof ev.type === "string" && typeof ev.path === "string") {
19
- onEvent(ev);
20
- return;
21
- }
22
- } catch {}
23
- }
24
- fallback(line);
25
- };
26
- };
27
- //#endregion
28
- Object.defineProperty(exports, "createPrintErrHook", {
29
- enumerable: true,
30
- get: function() {
31
- return createPrintErrHook;
32
- }
33
- });
@@ -1,43 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __exportAll = (all, no_symbols) => {
9
- let target = {};
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
14
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
- return target;
16
- };
17
- var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
- key = keys[i];
20
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
- get: ((k) => from[k]).bind(null, key),
22
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
- });
24
- }
25
- return to;
26
- };
27
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
30
- }) : target, mod));
31
- //#endregion
32
- Object.defineProperty(exports, "__exportAll", {
33
- enumerable: true,
34
- get: function() {
35
- return __exportAll;
36
- }
37
- });
38
- Object.defineProperty(exports, "__toESM", {
39
- enumerable: true,
40
- get: function() {
41
- return __toESM;
42
- }
43
- });