@scriptc/compiler 0.1.2 → 0.1.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/ambient/scriptc-node-fallback.d.ts +59 -14
- package/dist/backend/c/async.d.ts +5 -0
- package/dist/backend/c/async.js +57 -0
- package/dist/backend/c/async.js.map +1 -1
- package/dist/backend/c/c-emitter.d.ts +3 -0
- package/dist/backend/c/c-emitter.js +15 -8
- package/dist/backend/c/c-emitter.js.map +1 -1
- package/dist/backend/c/exprs.d.ts +8 -1
- package/dist/backend/c/exprs.js +152 -9
- package/dist/backend/c/exprs.js.map +1 -1
- package/dist/backend/c/shapes.js +15 -13
- package/dist/backend/c/shapes.js.map +1 -1
- package/dist/backend/c/types.d.ts +4 -0
- package/dist/backend/c/types.js +18 -1
- package/dist/backend/c/types.js.map +1 -1
- package/dist/backend/c/types.test.js +8 -1
- package/dist/backend/c/types.test.js.map +1 -1
- package/dist/backend/c/walkers.js +32 -11
- package/dist/backend/c/walkers.js.map +1 -1
- package/dist/backend/json-literal.d.ts +7 -0
- package/dist/backend/json-literal.js +17 -0
- package/dist/backend/json-literal.js.map +1 -0
- package/dist/backend/json-literal.test.d.ts +1 -0
- package/dist/backend/json-literal.test.js +17 -0
- package/dist/backend/json-literal.test.js.map +1 -0
- package/dist/backend/link-plan.d.ts +1 -1
- package/dist/backend/link-plan.js +5 -1
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/llvm/classes.js +8 -7
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +4 -0
- package/dist/backend/llvm/common.js +6 -0
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/common.test.d.ts +1 -0
- package/dist/backend/llvm/common.test.js +9 -0
- package/dist/backend/llvm/common.test.js.map +1 -0
- package/dist/backend/llvm/dyn.d.ts +4 -0
- package/dist/backend/llvm/dyn.js +24 -13
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.js +35 -7
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +4 -0
- package/dist/backend/llvm/expr-dynamic.js +9 -0
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +8 -0
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +3 -3
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +2 -1
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +3 -0
- package/dist/backend/llvm/expr-stream-callbacks.js +53 -0
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +22 -0
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +50 -5
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +46 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/shapes.js +10 -8
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/walkers.js +7 -5
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/native-link-info.d.ts +2 -1
- package/dist/backend/native-link-info.js +4 -0
- package/dist/backend/native-link-info.js.map +1 -1
- package/dist/backend/native-link-info.test.js +24 -1
- package/dist/backend/native-link-info.test.js.map +1 -1
- package/dist/backend/native-toolchain.d.ts +8 -6
- package/dist/backend/native-toolchain.js +28 -13
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +36 -1
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +1 -1
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +1 -0
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/targets.d.ts +5 -0
- package/dist/backend/targets.js +9 -0
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +6 -1
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/coverage/surface-manifest.js +1 -0
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.js +3 -3
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +1 -0
- package/dist/executable/executable-cache.js +1 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +1 -0
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.d.ts +0 -4
- package/dist/frontend/lowering/containers/bytes.js +112 -28
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +16 -10
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.d.ts +22 -21
- package/dist/frontend/lowering/lower-builtins.js +392 -67
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +8 -6
- package/dist/frontend/lowering/lower-calls.js +110 -12
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.js +12 -8
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +104 -5
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +7 -0
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +8 -0
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +5 -4
- package/dist/frontend/lowering/lower-stmts.js +23 -6
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +4 -4
- package/dist/frontend/lowering/lowerer.js +5 -5
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +5 -3
- package/dist/frontend/lowering/surfaces.js +33 -13
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/npm-static-declarations.js +27 -14
- package/dist/frontend/npm-static-declarations.js.map +1 -1
- package/dist/frontend/npm-static-declarations.test.js +10 -0
- package/dist/frontend/npm-static-declarations.test.js.map +1 -1
- package/dist/frontend/program.js +18 -2
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.d.ts +22 -7
- package/dist/frontend/resolve.js +83 -22
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/resolve.test.js +21 -1
- package/dist/frontend/resolve.test.js.map +1 -1
- package/dist/frontend/type-mapper.js +52 -10
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.js +1 -0
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/ir.d.ts +67 -24
- package/dist/ir/ir.js +81 -3
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +1 -1
- package/dist/ir/validate.js +77 -5
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/int-infer.test.js +4 -4
- package/dist/library/library-cache.d.ts +1 -0
- package/dist/library/library-cache.js +1 -0
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/library-cache.test.js +18 -5
- package/dist/library/library-cache.test.js.map +1 -1
- package/package.json +17 -17
- package/surface-manifest.json +32 -17
package/dist/ir/ir.d.ts
CHANGED
|
@@ -12,6 +12,14 @@ export type IrBytesElem = "u8" | "u32" | "i32" | "f32";
|
|
|
12
12
|
export type IrType = {
|
|
13
13
|
kind: "f64";
|
|
14
14
|
}
|
|
15
|
+
/** An ECMAScript bigint primitive. Runtime values are immutable,
|
|
16
|
+
* arbitrary-precision signed integers (ScrBigInt) whose numeric value,
|
|
17
|
+
* not pointer identity, defines equality. The heap representation is an
|
|
18
|
+
* implementation detail: bigint remains a JS primitive for truthiness,
|
|
19
|
+
* typeof, comparison, inspection, and container semantics. */
|
|
20
|
+
| {
|
|
21
|
+
kind: "bigint";
|
|
22
|
+
}
|
|
15
23
|
/** The supported ES Date value slice: a scalar TimeClip'd millisecond
|
|
16
24
|
* value. Getters and toISOString observe only this slot, so copying it
|
|
17
25
|
* through locals/params/fields is exact while Date mutation and object
|
|
@@ -216,6 +224,13 @@ export type IrType = {
|
|
|
216
224
|
| {
|
|
217
225
|
kind: "childStream";
|
|
218
226
|
}
|
|
227
|
+
/** A piped child-input stream (child.stdin — spawn with a piped stdin
|
|
228
|
+
* slot; scr_child.c). Heap, refcounted, and mutable: writes queue into
|
|
229
|
+
* the platform pipe without blocking the JavaScript thread, and
|
|
230
|
+
* drain/finish/error listeners drop when the writer settles. */
|
|
231
|
+
| {
|
|
232
|
+
kind: "childWriter";
|
|
233
|
+
}
|
|
219
234
|
/** A process output stream as a FIRST-CLASS value (process.stdout /
|
|
220
235
|
* process.stderr flowing into a `NodeJS.WritableStream` slot — the
|
|
221
236
|
* prefixStream idiom). Representation is the raw FD as a double (1 or
|
|
@@ -245,6 +260,16 @@ export type IrType = {
|
|
|
245
260
|
| {
|
|
246
261
|
kind: "secureCtx";
|
|
247
262
|
}
|
|
263
|
+
/** A node:crypto Hash or Hmac handle (scr_lib.c): heap, refcounted,
|
|
264
|
+
* MUTABLE until digest(), then permanently finalized. The two TypeScript
|
|
265
|
+
* surfaces share one runtime representation but stay distinct IR kinds so
|
|
266
|
+
* Hash.copy() cannot accidentally appear on Hmac values. The incremental
|
|
267
|
+
* digest state owns no script values and cannot participate in a cycle. */
|
|
268
|
+
| {
|
|
269
|
+
kind: "cryptoHash";
|
|
270
|
+
} | {
|
|
271
|
+
kind: "cryptoHmac";
|
|
272
|
+
}
|
|
248
273
|
/** Heap, refcounted closure. `rest` marks a VARIADIC JS function (a
|
|
249
274
|
* `...args` rest parameter, or a zero-param function body reading
|
|
250
275
|
* `arguments` — test/common's mustCall wrapper): the lifted function
|
|
@@ -388,13 +413,13 @@ interface IrKindSet<K extends IrType["kind"]> extends ReadonlySet<IrType["kind"]
|
|
|
388
413
|
}
|
|
389
414
|
/** The opaque runtime handle kinds. procStream is the one scalar handle;
|
|
390
415
|
* every other handle has pointer representation. */
|
|
391
|
-
declare const HANDLE_KIND_LIST: readonly ["stats", "fileHandle", "spawnRes", "child", "netServer", "netSocket", "http2Session", "http2Stream", "dgramSocket", "testCtx", "httpReq", "httpRes", "httpClientReq", "secureCtx", "fsWatcher", "childStream", "procStream"];
|
|
416
|
+
declare const HANDLE_KIND_LIST: readonly ["stats", "fileHandle", "spawnRes", "child", "netServer", "netSocket", "http2Session", "http2Stream", "dgramSocket", "testCtx", "httpReq", "httpRes", "httpClientReq", "secureCtx", "cryptoHash", "cryptoHmac", "fsWatcher", "childStream", "childWriter", "procStream"];
|
|
392
417
|
export type HandleKind = typeof HANDLE_KIND_LIST[number];
|
|
393
|
-
export declare const HANDLE_KINDS: IrKindSet<"child" | "childStream" | "dgramSocket" | "fileHandle" | "fsWatcher" | "http2Session" | "http2Stream" | "httpClientReq" | "httpReq" | "httpRes" | "netServer" | "netSocket" | "procStream" | "secureCtx" | "spawnRes" | "stats" | "testCtx">;
|
|
418
|
+
export declare const HANDLE_KINDS: IrKindSet<"child" | "childStream" | "childWriter" | "cryptoHash" | "cryptoHmac" | "dgramSocket" | "fileHandle" | "fsWatcher" | "http2Session" | "http2Stream" | "httpClientReq" | "httpReq" | "httpRes" | "netServer" | "netSocket" | "procStream" | "secureCtx" | "spawnRes" | "stats" | "testCtx">;
|
|
394
419
|
/** The IR kinds represented as pointers in both native backends. */
|
|
395
|
-
declare const POINTER_KIND_LIST: readonly ["string", "array", "map", "set", "regex", "bytes", "url", "searchParams", "symbol", "stats", "fileHandle", "spawnRes", "child", "netServer", "netSocket", "http2Session", "http2Stream", "dgramSocket", "testCtx", "httpReq", "httpRes", "httpClientReq", "secureCtx", "fsWatcher", "childStream", "func", "object", "classval", "record", "union", "dyn", "jsval", "caught", "promise", "generator"];
|
|
420
|
+
declare const POINTER_KIND_LIST: readonly ["string", "bigint", "array", "map", "set", "regex", "bytes", "url", "searchParams", "symbol", "stats", "fileHandle", "spawnRes", "child", "netServer", "netSocket", "http2Session", "http2Stream", "dgramSocket", "testCtx", "httpReq", "httpRes", "httpClientReq", "secureCtx", "cryptoHash", "cryptoHmac", "fsWatcher", "childStream", "childWriter", "func", "object", "classval", "record", "union", "dyn", "jsval", "caught", "promise", "generator"];
|
|
396
421
|
export type PointerKind = typeof POINTER_KIND_LIST[number];
|
|
397
|
-
export declare const POINTER_KINDS: IrKindSet<"array" | "bytes" | "caught" | "child" | "childStream" | "classval" | "dgramSocket" | "dyn" | "fileHandle" | "fsWatcher" | "func" | "generator" | "http2Session" | "http2Stream" | "httpClientReq" | "httpReq" | "httpRes" | "jsval" | "map" | "netServer" | "netSocket" | "object" | "promise" | "record" | "regex" | "searchParams" | "secureCtx" | "set" | "spawnRes" | "stats" | "string" | "symbol" | "testCtx" | "union" | "url">;
|
|
422
|
+
export declare const POINTER_KINDS: IrKindSet<"array" | "bigint" | "bytes" | "caught" | "child" | "childStream" | "childWriter" | "classval" | "cryptoHash" | "cryptoHmac" | "dgramSocket" | "dyn" | "fileHandle" | "fsWatcher" | "func" | "generator" | "http2Session" | "http2Stream" | "httpClientReq" | "httpReq" | "httpRes" | "jsval" | "map" | "netServer" | "netSocket" | "object" | "promise" | "record" | "regex" | "searchParams" | "secureCtx" | "set" | "spawnRes" | "stats" | "string" | "symbol" | "testCtx" | "union" | "url">;
|
|
398
423
|
/** Runtime RC symbol stem for each IR type kind. An empty stem means the
|
|
399
424
|
* kind is scalar/unit or uses an emitted per-shape helper (object/record).
|
|
400
425
|
* Keeping this exhaustive makes a new runtime handle kind a compile error
|
|
@@ -409,6 +434,7 @@ export declare function runtimeRcStem(t: IrType): string | null;
|
|
|
409
434
|
* arms with `true`. */
|
|
410
435
|
export declare const REF_TRUTHY_KINDS: ReadonlySet<string>;
|
|
411
436
|
export declare const F64: IrType;
|
|
437
|
+
export declare const BIGINT_T: IrType;
|
|
412
438
|
export declare const DATE_T: IrType;
|
|
413
439
|
export declare const BYTES_U8: IrType;
|
|
414
440
|
export declare const STRING: IrType;
|
|
@@ -431,8 +457,11 @@ export declare const HTTPREQ_T: IrType;
|
|
|
431
457
|
export declare const HTTPRES_T: IrType;
|
|
432
458
|
export declare const HTTPCLIENTREQ_T: IrType;
|
|
433
459
|
export declare const SECURECTX_T: IrType;
|
|
460
|
+
export declare const CRYPTOHASH_T: IrType;
|
|
461
|
+
export declare const CRYPTOHMAC_T: IrType;
|
|
434
462
|
export declare const FSWATCHER_T: IrType;
|
|
435
463
|
export declare const CHILDSTREAM_T: IrType;
|
|
464
|
+
export declare const CHILDWRITER_T: IrType;
|
|
436
465
|
export declare const PROCSTREAM_T: IrType;
|
|
437
466
|
export declare const VOID: IrType;
|
|
438
467
|
export declare const DYN: IrType;
|
|
@@ -520,7 +549,7 @@ export declare function typeEquals(a: IrType, b: IrType): boolean;
|
|
|
520
549
|
export declare function isRefCounted(t: IrType): boolean;
|
|
521
550
|
export interface IrModule {
|
|
522
551
|
/** Bumped on any breaking IR change; serialize.ts refuses mismatches. */
|
|
523
|
-
irVersion:
|
|
552
|
+
irVersion: 9;
|
|
524
553
|
sourceFile: string;
|
|
525
554
|
functions: IrFunction[];
|
|
526
555
|
/** Class shapes. Constructors and methods are ordinary module functions
|
|
@@ -1815,6 +1844,11 @@ export type IrLibFn =
|
|
|
1815
1844
|
* (the runtime returns +1-or-NULL; the backend builds the union arms —
|
|
1816
1845
|
* the child.stdout pattern). None of these throw. */
|
|
1817
1846
|
| "sym.new" | "sym.newAnon" | "sym.for" | "sym.keyFor" | "sym.desc" | "sym.toString"
|
|
1847
|
+
/** Engine-free arbitrary-precision bigint operations (scr_bigint.c).
|
|
1848
|
+
* parse accepts the ECMAScript BigInt string grammar; fromF64 accepts
|
|
1849
|
+
* finite integral Numbers. Arithmetic returns fresh immutable values.
|
|
1850
|
+
* cmp returns -1/0/1 as f64; toString accepts a numeric radix. */
|
|
1851
|
+
| "bigint.parse" | "bigint.fromF64" | "bigint.neg" | "bigint.not" | "bigint.add" | "bigint.sub" | "bigint.mul" | "bigint.div" | "bigint.mod" | "bigint.pow" | "bigint.and" | "bigint.or" | "bigint.xor" | "bigint.shl" | "bigint.shr" | "bigint.eq" | "bigint.cmp" | "bigint.cmpNumber" | "bigint.truthy" | "bigint.toString" | "bigint.inspect" | "bigint.toF64" | "bigint.asUintN" | "bigint.asIntN" | "bigint.bufferRead" | "bigint.bufferWrite" | "bigint.dataViewGet" | "bigint.dataViewSet"
|
|
1818
1852
|
/** fs.statSync → a Stats value (may throw, like the other sync fs
|
|
1819
1853
|
* calls); the stats.* getters are pure reads on it. */
|
|
1820
1854
|
| "fs.statSync" | "stats.isFile" | "stats.isDirectory" | "stats.size"
|
|
@@ -1836,10 +1870,9 @@ export type IrLibFn =
|
|
|
1836
1870
|
* the backend (the envGet convention). Never throws. */
|
|
1837
1871
|
| "spawnRes.error"
|
|
1838
1872
|
/** child_process.spawn (scr_child.c + the scr_async.c loop): posix_spawnp
|
|
1839
|
-
* with
|
|
1840
|
-
*
|
|
1841
|
-
*
|
|
1842
|
-
* timers (kqueue is the follow-up; SEMANTICS.md documents the polling).
|
|
1873
|
+
* with per-slot ignore/inherit/pipe modes (and number output fds), the
|
|
1874
|
+
* all-piped Node default, and the child registered with the event loop,
|
|
1875
|
+
* which polls waitpid(WNOHANG) at quiescence like timers.
|
|
1843
1876
|
* NEVER throws: spawn failure defers to the "error" event, Node-exact
|
|
1844
1877
|
* (the error message is Node's "spawn <cmd> <ERRNO-NAME>"; an "error"
|
|
1845
1878
|
* event with no listener prints it and exits 1 like an EventEmitter).
|
|
@@ -1887,6 +1920,11 @@ export type IrLibFn =
|
|
|
1887
1920
|
* the child's 'exit' (the pinned ordering). A flowing stream keeps the
|
|
1888
1921
|
* loop alive: usesTimers. */
|
|
1889
1922
|
| "child.stdout" | "child.stderr" | "stream.onData" | "stream.onEnd"
|
|
1923
|
+
/** The piped-input writer (stdio mode 3 on fd 0). child.stdin answers
|
|
1924
|
+
* `Writable | null`; writes copy borrowed data into the nonblocking
|
|
1925
|
+
* queue, end/destroy settle it, writable is a pure state read, and
|
|
1926
|
+
* listener callbacks move into the writer registry. */
|
|
1927
|
+
| "child.stdin" | "writer.writeString" | "writer.writeBytes" | "writer.end" | "writer.destroy" | "writer.writable" | "writer.onDrain" | "writer.onFinish" | "writer.onError"
|
|
1890
1928
|
/** The first-class WritableStream write (`output.write(line)` — the
|
|
1891
1929
|
* prefixStream idiom): the receiver IS the fd scalar (process.stdout/
|
|
1892
1930
|
* stderr reads mint 1/2), dispatched onto the exact stdoutWrite/
|
|
@@ -2329,18 +2367,19 @@ export type IrLibFn =
|
|
|
2329
2367
|
* these are in the may-throw seed. readFile is utf8-fenced like
|
|
2330
2368
|
* readFileSync. The non-interleaving divergence is documented in
|
|
2331
2369
|
* SEMANTICS.md. */
|
|
2332
|
-
/** node:crypto
|
|
2333
|
-
*
|
|
2334
|
-
*
|
|
2335
|
-
* randomBytesToString THROWS Node's RangeError on out-of-range sizes. */
|
|
2370
|
+
/** node:crypto randomness: randomUUID plus randomBytes as either a real
|
|
2371
|
+
* Buffer or the fused randomBytes(n).toString("hex"|"base64") path.
|
|
2372
|
+
* The size-taking forms throw Node's RangeError on invalid values. */
|
|
2336
2373
|
| "crypto.randomUUID" | "crypto.randomBytesToString"
|
|
2337
|
-
/** The
|
|
2338
|
-
*
|
|
2339
|
-
*
|
|
2340
|
-
* both compile-time literals (frontend-fenced). Strings hash their
|
|
2341
|
-
* UTF-8 bytes (Node's default input encoding); the bytes form hashes a
|
|
2342
|
-
* Buffer/typed array's bytes. Pure; never throw. */
|
|
2374
|
+
/** The fused createHash(alg).update(data).digest(enc) fast path and the
|
|
2375
|
+
* one-shot crypto.hash implementation. First-class Hash/Hmac handles use
|
|
2376
|
+
* the entries below; all paths share the incremental runtime core. */
|
|
2343
2377
|
| "crypto.hashDigestStr" | "crypto.hashDigestBytes"
|
|
2378
|
+
/** First-class static Hash/Hmac handles. Constructors validate the
|
|
2379
|
+
* runtime algorithm string (md5/sha1/sha256); update returns the same
|
|
2380
|
+
* handle by retained identity, copy snapshots Hash state, and digest
|
|
2381
|
+
* finalizes the handle and returns either a Buffer or encoded string. */
|
|
2382
|
+
| "crypto.hashNew" | "crypto.hmacNewStr" | "crypto.hmacNewBytes" | "crypto.hashUpdateStr" | "crypto.hashUpdateBytes" | "crypto.hmacUpdateStr" | "crypto.hmacUpdateBytes" | "crypto.hashCopy" | "crypto.hashDigestString" | "crypto.hashDigestBuffer" | "crypto.hmacDigestString" | "crypto.hmacDigestBuffer" | "crypto.timingSafeEqual" | "crypto.randomFill" | "crypto.randomFillRest" | "crypto.randomInt" | "crypto.pbkdf2" | "crypto.randomBytesCb" | "crypto.pbkdf2Cb"
|
|
2344
2383
|
/** crypto.randomBytes(n) → a real u8 Buffer (+1). THROWS Node's
|
|
2345
2384
|
* RangeError on out-of-range sizes, exactly like the composed
|
|
2346
2385
|
* randomBytesToString (which keeps its one-libCall lowering — the two
|
|
@@ -2894,8 +2933,8 @@ export type IrLibFn =
|
|
|
2894
2933
|
*
|
|
2895
2934
|
* assert.ok: (pass, message) — the frontend computed the truthiness AND
|
|
2896
2935
|
* the full message (the user's, or the compile-time source-text form —
|
|
2897
|
-
* assert.fail lowers here too with pass=false). assert.eqF64/
|
|
2898
|
-
* eqBool: (a, b, negated, deep, msg, hasMsg) — Object.is comparison,
|
|
2936
|
+
* assert.fail lowers here too with pass=false). assert.eqF64/eqBigInt/
|
|
2937
|
+
* eqStr/eqBool: (a, b, negated, deep, msg, hasMsg) — Object.is comparison,
|
|
2899
2938
|
* covering strictEqual/notStrictEqual and the scalar deepStrictEqual
|
|
2900
2939
|
* pair; msg is a typed dummy ("" literal) when hasMsg is false (Node
|
|
2901
2940
|
* distinguishes an omitted message from an empty one per operator).
|
|
@@ -2941,7 +2980,7 @@ export type IrLibFn =
|
|
|
2941
2980
|
* the value's inspection) — the frontend routes null/undefined to a
|
|
2942
2981
|
* no-op and everything else here (Node throws for falsy values too).
|
|
2943
2982
|
* All arguments are borrowed. */
|
|
2944
|
-
| "assert.ok" | "assert.eqF64" | "assert.eqStr" | "assert.eqBool" | "assert.eqSym" | "assert.eqDyn" | "assert.deepResult" | "assert.sameValue" | "assert.deqEnter" | "assert.deqLeave" | "assert.match" | "assert.throwsNone" | "assert.throwsMismatch" | "assert.throwsRegex" | "assert.shapeBegin" | "assert.shapeStr" | "assert.shapeRe" | "assert.shapeEnd" | "assert.regexErrTest" | "assert.unwantedRejection"
|
|
2983
|
+
| "assert.ok" | "assert.eqF64" | "assert.eqBigInt" | "assert.eqStr" | "assert.eqBool" | "assert.eqSym" | "assert.eqDyn" | "assert.deepResult" | "assert.sameValue" | "assert.deqEnter" | "assert.deqLeave" | "assert.match" | "assert.throwsNone" | "assert.throwsMismatch" | "assert.throwsRegex" | "assert.shapeBegin" | "assert.shapeStr" | "assert.shapeRe" | "assert.shapeEnd" | "assert.regexErrTest" | "assert.unwantedRejection"
|
|
2945
2984
|
/** Node's expectsError over an error-INSTANCE expected (assert.throws/
|
|
2946
2985
|
* rejects second argument): walk the expected dyn error's keys (name,
|
|
2947
2986
|
* message, code — the %error marker skipped) and deep-compare each
|
|
@@ -3400,8 +3439,8 @@ export type IrExpr =
|
|
|
3400
3439
|
type: IrType;
|
|
3401
3440
|
loc: SrcLoc;
|
|
3402
3441
|
}
|
|
3403
|
-
/** JS ToBoolean: f64 is false iff 0, -0, or NaN; string is false iff empty
|
|
3404
|
-
*
|
|
3442
|
+
/** JS ToBoolean: f64 is false iff 0, -0, or NaN; string is false iff empty;
|
|
3443
|
+
* dyn asks its runtime kind. The other operand form is a UNION — the ARM
|
|
3405
3444
|
* value's ToBoolean via a per-union interned helper (unit arms false;
|
|
3406
3445
|
* f64/string/bool arms per-value; ref arms — arrays, records, objects,
|
|
3407
3446
|
* functions, maps, sets, promises, ... — always true; jsval arms ask the
|
|
@@ -5124,6 +5163,10 @@ export declare function moduleUsesNet(mod: IrModule): boolean;
|
|
|
5124
5163
|
* fence still emits release calls that need the unit linked. Symbol-free
|
|
5125
5164
|
* programs pay zero bytes and keep their exact link line. */
|
|
5126
5165
|
export declare function moduleUsesSymbol(mod: IrModule): boolean;
|
|
5166
|
+
/** True when bigint runtime operations or bigint-typed storage appears in
|
|
5167
|
+
* the IR. The type check keeps retain/release references link-safe even
|
|
5168
|
+
* when a producing statement was replaced by a runtime fence. */
|
|
5169
|
+
export declare function moduleUsesBigInt(mod: IrModule): boolean;
|
|
5127
5170
|
/** True when the module uses the URLSearchParams surface — sp.* libCalls,
|
|
5128
5171
|
* the url.searchParams getter, or a searchParams-kind type anywhere on
|
|
5129
5172
|
* the IR (a fenced statement can leave a typed local whose release call
|
package/dist/ir/ir.js
CHANGED
|
@@ -14,8 +14,11 @@ const POINTER_HANDLE_KINDS = [
|
|
|
14
14
|
"httpRes",
|
|
15
15
|
"httpClientReq",
|
|
16
16
|
"secureCtx",
|
|
17
|
+
"cryptoHash",
|
|
18
|
+
"cryptoHmac",
|
|
17
19
|
"fsWatcher",
|
|
18
20
|
"childStream",
|
|
21
|
+
"childWriter",
|
|
19
22
|
];
|
|
20
23
|
function irKindSet(kinds) {
|
|
21
24
|
return new Set(kinds);
|
|
@@ -30,6 +33,7 @@ export const HANDLE_KINDS = irKindSet(HANDLE_KIND_LIST);
|
|
|
30
33
|
/** The IR kinds represented as pointers in both native backends. */
|
|
31
34
|
const POINTER_KIND_LIST = [
|
|
32
35
|
"string",
|
|
36
|
+
"bigint",
|
|
33
37
|
"array",
|
|
34
38
|
"map",
|
|
35
39
|
"set",
|
|
@@ -57,6 +61,7 @@ export const POINTER_KINDS = irKindSet(POINTER_KIND_LIST);
|
|
|
57
61
|
* until its one retain/release family is named here. */
|
|
58
62
|
export const RUNTIME_RC_STEMS = {
|
|
59
63
|
f64: "",
|
|
64
|
+
bigint: "scr_bigint",
|
|
60
65
|
date: "",
|
|
61
66
|
string: "scr_str",
|
|
62
67
|
bool: "",
|
|
@@ -82,9 +87,12 @@ export const RUNTIME_RC_STEMS = {
|
|
|
82
87
|
httpRes: "scr_http_res",
|
|
83
88
|
httpClientReq: "scr_http_client",
|
|
84
89
|
childStream: "scr_child_stream",
|
|
90
|
+
childWriter: "scr_child_writer",
|
|
85
91
|
procStream: "",
|
|
86
92
|
fsWatcher: "scr_watcher",
|
|
87
93
|
secureCtx: "scr_secure_ctx",
|
|
94
|
+
cryptoHash: "scr_crypto_hash",
|
|
95
|
+
cryptoHmac: "scr_crypto_hash",
|
|
88
96
|
func: "scr_closure",
|
|
89
97
|
object: "",
|
|
90
98
|
classval: "scr_classobj",
|
|
@@ -124,13 +132,14 @@ export const REF_TRUTHY_KINDS = new Set([
|
|
|
124
132
|
"symbol",
|
|
125
133
|
"date", "array", "map", "set", "regex", "url", "searchParams", "stats", "fileHandle", "spawnRes", "child",
|
|
126
134
|
"netServer", "netSocket", "http2Session", "http2Stream", "dgramSocket", "testCtx", "httpReq", "httpRes", "httpClientReq",
|
|
127
|
-
"secureCtx", "fsWatcher", "childStream", "procStream", "bytes", "func", "object", "record", "promise",
|
|
135
|
+
"secureCtx", "cryptoHash", "cryptoHmac", "fsWatcher", "childStream", "childWriter", "procStream", "bytes", "func", "object", "record", "promise",
|
|
128
136
|
// A generator object is a JS object: always truthy.
|
|
129
137
|
"generator",
|
|
130
138
|
// A class object is a JS object (constructors are functions): always truthy.
|
|
131
139
|
"classval",
|
|
132
140
|
]);
|
|
133
141
|
export const F64 = { kind: "f64" };
|
|
142
|
+
export const BIGINT_T = { kind: "bigint" };
|
|
134
143
|
export const DATE_T = { kind: "date" };
|
|
135
144
|
export const BYTES_U8 = { kind: "bytes", elem: "u8" };
|
|
136
145
|
export const STRING = { kind: "string" };
|
|
@@ -153,8 +162,11 @@ export const HTTPREQ_T = { kind: "httpReq" };
|
|
|
153
162
|
export const HTTPRES_T = { kind: "httpRes" };
|
|
154
163
|
export const HTTPCLIENTREQ_T = { kind: "httpClientReq" };
|
|
155
164
|
export const SECURECTX_T = { kind: "secureCtx" };
|
|
165
|
+
export const CRYPTOHASH_T = { kind: "cryptoHash" };
|
|
166
|
+
export const CRYPTOHMAC_T = { kind: "cryptoHmac" };
|
|
156
167
|
export const FSWATCHER_T = { kind: "fsWatcher" };
|
|
157
168
|
export const CHILDSTREAM_T = { kind: "childStream" };
|
|
169
|
+
export const CHILDWRITER_T = { kind: "childWriter" };
|
|
158
170
|
export const PROCSTREAM_T = { kind: "procStream" };
|
|
159
171
|
export const VOID = { kind: "void" };
|
|
160
172
|
export const DYN = { kind: "dyn" };
|
|
@@ -177,6 +189,7 @@ export function isUnitType(t) {
|
|
|
177
189
|
export function isSupportedArrayElem(t) {
|
|
178
190
|
switch (t.kind) {
|
|
179
191
|
case "f64":
|
|
192
|
+
case "bigint":
|
|
180
193
|
case "bool":
|
|
181
194
|
case "string":
|
|
182
195
|
case "array":
|
|
@@ -239,6 +252,7 @@ export function isSupportedSetElem(t) {
|
|
|
239
252
|
export function isSupportedMapValue(t) {
|
|
240
253
|
switch (t.kind) {
|
|
241
254
|
case "f64":
|
|
255
|
+
case "bigint":
|
|
242
256
|
case "string":
|
|
243
257
|
case "bool":
|
|
244
258
|
case "record":
|
|
@@ -329,6 +343,7 @@ export function typeKey(t) {
|
|
|
329
343
|
return t.kind;
|
|
330
344
|
switch (t.kind) {
|
|
331
345
|
case "f64":
|
|
346
|
+
case "bigint":
|
|
332
347
|
case "date":
|
|
333
348
|
case "string":
|
|
334
349
|
case "bool":
|
|
@@ -746,6 +761,7 @@ function isJsonSafeAt(t, getRecord, getUnion, stringify, undefinedAllowed, visit
|
|
|
746
761
|
// Symbols are DROPPED by Node's stringify (undefined at the top level,
|
|
747
762
|
// omitted as object values) — silent divergence banned; rejected.
|
|
748
763
|
case "symbol":
|
|
764
|
+
case "bigint":
|
|
749
765
|
// Typed arrays stringify as index-keyed objects ({"0":1,...}) and
|
|
750
766
|
// Buffers as {type:"Buffer",data:[...]} in Node — neither shape is
|
|
751
767
|
// representable type-directedly; rejected like Maps.
|
|
@@ -1630,11 +1646,11 @@ export function moduleUsesChildProcess(mod) {
|
|
|
1630
1646
|
const node = v;
|
|
1631
1647
|
if (node.kind === "libCall" &&
|
|
1632
1648
|
typeof node.fn === "string" &&
|
|
1633
|
-
(node.fn.startsWith("cp.") || node.fn.startsWith("child.") || node.fn.startsWith("spawnRes."))) {
|
|
1649
|
+
(node.fn.startsWith("cp.") || node.fn.startsWith("child.") || node.fn.startsWith("writer.") || node.fn.startsWith("spawnRes."))) {
|
|
1634
1650
|
found = true;
|
|
1635
1651
|
return;
|
|
1636
1652
|
}
|
|
1637
|
-
if (node.kind === "child" || node.kind === "childStream" || node.kind === "spawnRes") {
|
|
1653
|
+
if (node.kind === "child" || node.kind === "childStream" || node.kind === "childWriter" || node.kind === "spawnRes") {
|
|
1638
1654
|
found = true;
|
|
1639
1655
|
return;
|
|
1640
1656
|
}
|
|
@@ -1719,6 +1735,31 @@ export function moduleUsesSymbol(mod) {
|
|
|
1719
1735
|
visit(mod);
|
|
1720
1736
|
return found;
|
|
1721
1737
|
}
|
|
1738
|
+
/** True when bigint runtime operations or bigint-typed storage appears in
|
|
1739
|
+
* the IR. The type check keeps retain/release references link-safe even
|
|
1740
|
+
* when a producing statement was replaced by a runtime fence. */
|
|
1741
|
+
export function moduleUsesBigInt(mod) {
|
|
1742
|
+
let found = false;
|
|
1743
|
+
const visit = (v) => {
|
|
1744
|
+
if (found || v === null || typeof v !== "object")
|
|
1745
|
+
return;
|
|
1746
|
+
if (Array.isArray(v)) {
|
|
1747
|
+
for (const item of v)
|
|
1748
|
+
visit(item);
|
|
1749
|
+
return;
|
|
1750
|
+
}
|
|
1751
|
+
const node = v;
|
|
1752
|
+
if (node.kind === "bigint" ||
|
|
1753
|
+
(node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("bigint."))) {
|
|
1754
|
+
found = true;
|
|
1755
|
+
return;
|
|
1756
|
+
}
|
|
1757
|
+
for (const key of Object.keys(v))
|
|
1758
|
+
visit(v[key]);
|
|
1759
|
+
};
|
|
1760
|
+
visit(mod);
|
|
1761
|
+
return found;
|
|
1762
|
+
}
|
|
1722
1763
|
/** True when the module uses the URLSearchParams surface — sp.* libCalls,
|
|
1723
1764
|
* the url.searchParams getter, or a searchParams-kind type anywhere on
|
|
1724
1765
|
* the IR (a fenced statement can leave a typed local whose release call
|
|
@@ -2103,6 +2144,7 @@ const LIB_MODE_REFUSED_KINDS = new Map([
|
|
|
2103
2144
|
["child", "the child_process surface"],
|
|
2104
2145
|
["spawnRes", "the child_process surface"],
|
|
2105
2146
|
["childStream", "the child_process surface"],
|
|
2147
|
+
["childWriter", "the child_process surface"],
|
|
2106
2148
|
["netServer", "the node:net surface"],
|
|
2107
2149
|
["netSocket", "the node:net surface"],
|
|
2108
2150
|
["http2Session", "the node:http2 surface"],
|
|
@@ -2281,6 +2323,20 @@ export function moduleLibNondeterministicSurface(mod) {
|
|
|
2281
2323
|
* seed on `dynCheck` and `awaitExpr` nodes, which throw on validation
|
|
2282
2324
|
* failure / promise rejection). */
|
|
2283
2325
|
export const MAY_THROW_LIB_FNS = new Set([
|
|
2326
|
+
"bigint.parse",
|
|
2327
|
+
"bigint.fromF64",
|
|
2328
|
+
"bigint.div",
|
|
2329
|
+
"bigint.mod",
|
|
2330
|
+
"bigint.pow",
|
|
2331
|
+
"bigint.shl",
|
|
2332
|
+
"bigint.shr",
|
|
2333
|
+
"bigint.toString",
|
|
2334
|
+
"bigint.asUintN",
|
|
2335
|
+
"bigint.asIntN",
|
|
2336
|
+
"bigint.bufferRead",
|
|
2337
|
+
"bigint.bufferWrite",
|
|
2338
|
+
"bigint.dataViewGet",
|
|
2339
|
+
"bigint.dataViewSet",
|
|
2284
2340
|
"fetch.responseNew",
|
|
2285
2341
|
"fetch.abortTimeout",
|
|
2286
2342
|
"fetch.abortAny",
|
|
@@ -2555,6 +2611,27 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2555
2611
|
"fs.statSync",
|
|
2556
2612
|
"crypto.randomBytesToString",
|
|
2557
2613
|
"crypto.randomBytes",
|
|
2614
|
+
"crypto.hashDigestStr",
|
|
2615
|
+
"crypto.hashDigestBytes",
|
|
2616
|
+
"crypto.hashNew",
|
|
2617
|
+
"crypto.hmacNewStr",
|
|
2618
|
+
"crypto.hmacNewBytes",
|
|
2619
|
+
"crypto.hashUpdateStr",
|
|
2620
|
+
"crypto.hashUpdateBytes",
|
|
2621
|
+
"crypto.hmacUpdateStr",
|
|
2622
|
+
"crypto.hmacUpdateBytes",
|
|
2623
|
+
"crypto.hashCopy",
|
|
2624
|
+
"crypto.hashDigestString",
|
|
2625
|
+
"crypto.hashDigestBuffer",
|
|
2626
|
+
"crypto.hmacDigestString",
|
|
2627
|
+
"crypto.hmacDigestBuffer",
|
|
2628
|
+
"crypto.timingSafeEqual",
|
|
2629
|
+
"crypto.randomFill",
|
|
2630
|
+
"crypto.randomFillRest",
|
|
2631
|
+
"crypto.randomInt",
|
|
2632
|
+
"crypto.pbkdf2",
|
|
2633
|
+
"crypto.randomBytesCb",
|
|
2634
|
+
"crypto.pbkdf2Cb",
|
|
2558
2635
|
"buffer.concat",
|
|
2559
2636
|
"buffer.concatLen",
|
|
2560
2637
|
// The checked-dynamic compare/equals validators: Node's argument
|
|
@@ -2612,6 +2689,7 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2612
2689
|
// catchable AssertionError on failure.
|
|
2613
2690
|
"assert.ok",
|
|
2614
2691
|
"assert.eqF64",
|
|
2692
|
+
"assert.eqBigInt",
|
|
2615
2693
|
"assert.eqStr",
|
|
2616
2694
|
"assert.eqBool",
|
|
2617
2695
|
"assert.eqSym",
|