@scriptc/compiler 0.1.3 → 0.1.5

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.
Files changed (217) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +275 -62
  2. package/dist/backend/c/async.d.ts +25 -0
  3. package/dist/backend/c/async.js +167 -0
  4. package/dist/backend/c/async.js.map +1 -1
  5. package/dist/backend/c/c-emitter.d.ts +15 -1
  6. package/dist/backend/c/c-emitter.js +36 -11
  7. package/dist/backend/c/c-emitter.js.map +1 -1
  8. package/dist/backend/c/exprs.d.ts +2 -2
  9. package/dist/backend/c/exprs.js +556 -71
  10. package/dist/backend/c/exprs.js.map +1 -1
  11. package/dist/backend/c/stmts.js +5 -3
  12. package/dist/backend/c/stmts.js.map +1 -1
  13. package/dist/backend/c/types.d.ts +2 -3
  14. package/dist/backend/c/types.js +10 -1
  15. package/dist/backend/c/types.js.map +1 -1
  16. package/dist/backend/c/walkers.js +1 -1
  17. package/dist/backend/c/walkers.js.map +1 -1
  18. package/dist/backend/link-plan.d.ts +3 -1
  19. package/dist/backend/link-plan.js +3 -1
  20. package/dist/backend/link-plan.js.map +1 -1
  21. package/dist/backend/llvm/dyn.js +1 -1
  22. package/dist/backend/llvm/dyn.js.map +1 -1
  23. package/dist/backend/llvm/emitter.js +42 -12
  24. package/dist/backend/llvm/emitter.js.map +1 -1
  25. package/dist/backend/llvm/expr-bytes.d.ts +1 -2
  26. package/dist/backend/llvm/expr-bytes.js +28 -23
  27. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  28. package/dist/backend/llvm/expr-callbacks.d.ts +9 -0
  29. package/dist/backend/llvm/expr-callbacks.js +125 -0
  30. package/dist/backend/llvm/expr-callbacks.js.map +1 -1
  31. package/dist/backend/llvm/expr-containers.d.ts +1 -0
  32. package/dist/backend/llvm/expr-containers.js +32 -4
  33. package/dist/backend/llvm/expr-containers.js.map +1 -1
  34. package/dist/backend/llvm/expr-context.d.ts +19 -3
  35. package/dist/backend/llvm/expr-dispatch.js +1 -0
  36. package/dist/backend/llvm/expr-dispatch.js.map +1 -1
  37. package/dist/backend/llvm/expr-primitives.d.ts +1 -1
  38. package/dist/backend/llvm/expr-primitives.js +49 -13
  39. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  40. package/dist/backend/llvm/expr-primitives.test.d.ts +1 -0
  41. package/dist/backend/llvm/expr-primitives.test.js +38 -0
  42. package/dist/backend/llvm/expr-primitives.test.js.map +1 -0
  43. package/dist/backend/llvm/expr-stream-callbacks.d.ts +3 -0
  44. package/dist/backend/llvm/expr-stream-callbacks.js +69 -0
  45. package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
  46. package/dist/backend/llvm/lib-filesystem.js +80 -10
  47. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  48. package/dist/backend/llvm/lib-network.js +69 -10
  49. package/dist/backend/llvm/lib-network.js.map +1 -1
  50. package/dist/backend/llvm/lib-process.js +156 -6
  51. package/dist/backend/llvm/lib-process.js.map +1 -1
  52. package/dist/backend/llvm/lib-shared.js +100 -0
  53. package/dist/backend/llvm/lib-shared.js.map +1 -1
  54. package/dist/backend/llvm/lib-stream.js +23 -0
  55. package/dist/backend/llvm/lib-stream.js.map +1 -1
  56. package/dist/backend/native-toolchain.d.ts +5 -0
  57. package/dist/backend/native-toolchain.js +4 -1
  58. package/dist/backend/native-toolchain.js.map +1 -1
  59. package/dist/backend/runtime-pack.test.js +28 -10
  60. package/dist/backend/runtime-pack.test.js.map +1 -1
  61. package/dist/backend/targets.d.ts +7 -0
  62. package/dist/backend/targets.js +26 -0
  63. package/dist/backend/targets.js.map +1 -1
  64. package/dist/backend/targets.test.js +8 -1
  65. package/dist/backend/targets.test.js.map +1 -1
  66. package/dist/coverage/surface-manifest.js +14 -4
  67. package/dist/coverage/surface-manifest.js.map +1 -1
  68. package/dist/diagnostics/diagnostic.js +1 -1
  69. package/dist/diagnostics/diagnostic.js.map +1 -1
  70. package/dist/executable/executable-cache.d.ts +4 -0
  71. package/dist/executable/executable-cache.js +6 -1
  72. package/dist/executable/executable-cache.js.map +1 -1
  73. package/dist/executable/executable-cache.test.js +3 -3
  74. package/dist/executable/executable-cache.test.js.map +1 -1
  75. package/dist/frontend/fork-target.d.ts +17 -0
  76. package/dist/frontend/fork-target.js +256 -0
  77. package/dist/frontend/fork-target.js.map +1 -0
  78. package/dist/frontend/lowering/abstract-equality.d.ts +6 -0
  79. package/dist/frontend/lowering/abstract-equality.js +250 -0
  80. package/dist/frontend/lowering/abstract-equality.js.map +1 -0
  81. package/dist/frontend/lowering/containers/bytes.d.ts +1 -1
  82. package/dist/frontend/lowering/containers/bytes.js +6 -5
  83. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  84. package/dist/frontend/lowering/containers/string-and-regexp.d.ts +7 -6
  85. package/dist/frontend/lowering/containers/string-and-regexp.js +237 -28
  86. package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
  87. package/dist/frontend/lowering/expressions/object-literals.js +8 -0
  88. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  89. package/dist/frontend/lowering/lower-assert.js +71 -2
  90. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  91. package/dist/frontend/lowering/lower-builtins.d.ts +54 -28
  92. package/dist/frontend/lowering/lower-builtins.js +957 -116
  93. package/dist/frontend/lowering/lower-builtins.js.map +1 -1
  94. package/dist/frontend/lowering/lower-calls.d.ts +32 -23
  95. package/dist/frontend/lowering/lower-calls.js +835 -206
  96. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  97. package/dist/frontend/lowering/lower-classes.js +41 -10
  98. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  99. package/dist/frontend/lowering/lower-containers.d.ts +7 -9
  100. package/dist/frontend/lowering/lower-containers.js +293 -51
  101. package/dist/frontend/lowering/lower-containers.js.map +1 -1
  102. package/dist/frontend/lowering/lower-event-emitter.js +212 -21
  103. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  104. package/dist/frontend/lowering/lower-exprs.d.ts +12 -0
  105. package/dist/frontend/lowering/lower-exprs.js +263 -93
  106. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  107. package/dist/frontend/lowering/lower-inspect.d.ts +4 -0
  108. package/dist/frontend/lowering/lower-inspect.js +1 -1
  109. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  110. package/dist/frontend/lowering/lower-island.d.ts +6 -3
  111. package/dist/frontend/lowering/lower-island.js +182 -12
  112. package/dist/frontend/lowering/lower-island.js.map +1 -1
  113. package/dist/frontend/lowering/lower-modules.d.ts +6 -0
  114. package/dist/frontend/lowering/lower-modules.js +184 -38
  115. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  116. package/dist/frontend/lowering/lower-namespaces.js +7 -0
  117. package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
  118. package/dist/frontend/lowering/lower-server.d.ts +3 -5
  119. package/dist/frontend/lowering/lower-server.js +413 -54
  120. package/dist/frontend/lowering/lower-server.js.map +1 -1
  121. package/dist/frontend/lowering/lower-stmts.js +122 -19
  122. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  123. package/dist/frontend/lowering/lower-stream.d.ts +3 -0
  124. package/dist/frontend/lowering/lower-stream.js +7 -0
  125. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  126. package/dist/frontend/lowering/lowerer.d.ts +86 -9
  127. package/dist/frontend/lowering/lowerer.js +449 -74
  128. package/dist/frontend/lowering/lowerer.js.map +1 -1
  129. package/dist/frontend/lowering/optional-arguments.d.ts +9 -1
  130. package/dist/frontend/lowering/optional-arguments.js +67 -1
  131. package/dist/frontend/lowering/optional-arguments.js.map +1 -1
  132. package/dist/frontend/lowering/pairs-snapshot.d.ts +3 -1
  133. package/dist/frontend/lowering/pairs-snapshot.js +12 -4
  134. package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
  135. package/dist/frontend/lowering/surfaces.d.ts +34 -14
  136. package/dist/frontend/lowering/surfaces.js +177 -104
  137. package/dist/frontend/lowering/surfaces.js.map +1 -1
  138. package/dist/frontend/npm-static-declarations.d.ts +4 -0
  139. package/dist/frontend/npm-static-declarations.js +56 -0
  140. package/dist/frontend/npm-static-declarations.js.map +1 -1
  141. package/dist/frontend/npm-static-declarations.test.js +23 -2
  142. package/dist/frontend/npm-static-declarations.test.js.map +1 -1
  143. package/dist/frontend/npm-static-prune.d.ts +6 -0
  144. package/dist/frontend/npm-static-prune.js +203 -0
  145. package/dist/frontend/npm-static-prune.js.map +1 -0
  146. package/dist/frontend/npm-static-prune.test.d.ts +1 -0
  147. package/dist/frontend/npm-static-prune.test.js +48 -0
  148. package/dist/frontend/npm-static-prune.test.js.map +1 -0
  149. package/dist/frontend/npm-static.js +6 -5
  150. package/dist/frontend/npm-static.js.map +1 -1
  151. package/dist/frontend/npm.d.ts +15 -3
  152. package/dist/frontend/npm.js +87 -14
  153. package/dist/frontend/npm.js.map +1 -1
  154. package/dist/frontend/npm.test.js +76 -9
  155. package/dist/frontend/npm.test.js.map +1 -1
  156. package/dist/frontend/program.js +107 -14
  157. package/dist/frontend/program.js.map +1 -1
  158. package/dist/frontend/provenance.js +8 -3
  159. package/dist/frontend/provenance.js.map +1 -1
  160. package/dist/frontend/resolve.d.ts +6 -0
  161. package/dist/frontend/resolve.js +7 -4
  162. package/dist/frontend/resolve.js.map +1 -1
  163. package/dist/frontend/type-mapper.d.ts +5 -0
  164. package/dist/frontend/type-mapper.js +80 -29
  165. package/dist/frontend/type-mapper.js.map +1 -1
  166. package/dist/index.d.ts +8 -3
  167. package/dist/index.js +34 -41
  168. package/dist/index.js.map +1 -1
  169. package/dist/ir/analysis.d.ts +5 -3
  170. package/dist/ir/analysis.js +25 -11
  171. package/dist/ir/analysis.js.map +1 -1
  172. package/dist/ir/analysis.test.js +50 -2
  173. package/dist/ir/analysis.test.js.map +1 -1
  174. package/dist/ir/constant-tables.d.ts +17 -0
  175. package/dist/ir/constant-tables.js +99 -0
  176. package/dist/ir/constant-tables.js.map +1 -0
  177. package/dist/ir/constant-tables.test.d.ts +1 -0
  178. package/dist/ir/constant-tables.test.js +78 -0
  179. package/dist/ir/constant-tables.test.js.map +1 -0
  180. package/dist/ir/integer-ranges.d.ts +13 -0
  181. package/dist/ir/integer-ranges.js +122 -0
  182. package/dist/ir/integer-ranges.js.map +1 -0
  183. package/dist/ir/integer-ranges.test.d.ts +1 -0
  184. package/dist/ir/integer-ranges.test.js +63 -0
  185. package/dist/ir/integer-ranges.test.js.map +1 -0
  186. package/dist/ir/ir.d.ts +130 -76
  187. package/dist/ir/ir.js +69 -4
  188. package/dist/ir/ir.js.map +1 -1
  189. package/dist/ir/ir.test.js +20 -1
  190. package/dist/ir/ir.test.js.map +1 -1
  191. package/dist/ir/scalar-records.d.ts +8 -0
  192. package/dist/ir/scalar-records.js +216 -0
  193. package/dist/ir/scalar-records.js.map +1 -0
  194. package/dist/ir/scalar-records.test.d.ts +1 -0
  195. package/dist/ir/scalar-records.test.js +142 -0
  196. package/dist/ir/scalar-records.test.js.map +1 -0
  197. package/dist/ir/serialize.d.ts +1 -1
  198. package/dist/ir/serialize.js +1 -1
  199. package/dist/ir/serialize.js.map +1 -1
  200. package/dist/ir/validate.js +256 -20
  201. package/dist/ir/validate.js.map +1 -1
  202. package/dist/ir/validate.test.d.ts +1 -0
  203. package/dist/ir/validate.test.js +31 -0
  204. package/dist/ir/validate.test.js.map +1 -0
  205. package/dist/library/cache-primitives.d.ts +1 -1
  206. package/dist/library/cache-primitives.js +3 -3
  207. package/dist/library/cache-primitives.js.map +1 -1
  208. package/dist/library/fence-eval.js +11 -4
  209. package/dist/library/fence-eval.js.map +1 -1
  210. package/dist/library/int-infer.test.js +4 -4
  211. package/dist/library/int-infer.test.js.map +1 -1
  212. package/dist/library/library-cache.js +0 -1
  213. package/dist/library/library-cache.js.map +1 -1
  214. package/dist/library/library-cache.test.js +8 -8
  215. package/dist/library/library-cache.test.js.map +1 -1
  216. package/package.json +17 -17
  217. package/surface-manifest.json +186 -79
package/dist/ir/ir.d.ts CHANGED
@@ -4,11 +4,10 @@ export interface SrcLoc {
4
4
  start: number;
5
5
  end: number;
6
6
  }
7
- /** The typed-array element kinds with a runtime representation: exactly
8
- * the constructors real CLI code reaches (Uint8Array/Buffer, Uint32Array,
9
- * Int32Array — the Atomics.wait sleep idiom's array — Float32Array). The
10
- * other TypedArray flavors stay frontend-fenced. */
11
- export type IrBytesElem = "u8" | "u32" | "i32" | "f32";
7
+ /** Typed-array element kinds with a runtime representation: Uint8Array/Buffer,
8
+ * Uint32Array, Int32Array, Float32Array, and Float64Array. Other flavors stay
9
+ * frontend-fenced. */
10
+ export type IrBytesElem = "u8" | "u32" | "i32" | "f32" | "f64";
12
11
  export type IrType = {
13
12
  kind: "f64";
14
13
  }
@@ -69,14 +68,14 @@ export type IrType = {
69
68
  | {
70
69
  kind: "regex";
71
70
  }
72
- /** A typed array / Node Buffer (Uint8Array, Uint32Array, Float32Array;
71
+ /** A typed array / Node Buffer (Uint8Array, Uint32Array, Float32Array,
72
+ * Float64Array;
73
73
  * Buffer IS a Uint8Array subclass and shares the u8 kind) — heap,
74
74
  * refcounted, MUTABLE, fixed-length, with ONE runtime representation
75
- * (ScrBytes) that OWNS its storage: no views exist — subarray()/slice()
76
- * both COPY (documented divergence for subarray), `.buffer`/
77
- * `.byteOffset`/DataView are frontend-fenced. Element reads widen to
78
- * f64; writes coerce JS-exactly (ToUint8/ToUint32 modular truncation,
79
- * double→float rounding). OOB element access traps like arrays. Allowed
75
+ * (ScrBytes) that owns storage or borrows it for subarray and DataView
76
+ * views. Typed-array slice copies. Element reads widen to f64; writes
77
+ * coerce JS-exactly (ToUint8/ToUint32 modular truncation and f32
78
+ * rounding). OOB element access traps like arrays. Allowed
80
79
  * as array elements and union arms (tag-based narrowing, like url);
81
80
  * fenced out of map keys/values, set elements, and JSON. Holds only raw
82
81
  * bytes — never part of a cycle, no trace. */
@@ -270,21 +269,24 @@ export type IrType = {
270
269
  } | {
271
270
  kind: "cryptoHmac";
272
271
  }
273
- /** Heap, refcounted closure. `rest` marks a VARIADIC JS function (a
274
- * `...args` rest parameter, or a zero-param function body reading
275
- * `arguments` — test/common's mustCall wrapper): the lifted function
276
- * takes one extra trailing `ScrDyn *` param — a dyn ARRAY carrying the
277
- * call's arguments from index params.length on — which the dyn call
278
- * thunk builds per call. `params` stays the DECLARED (non-rest) list
279
- * (fn.length semantics). Rest-marked values are only ever CALLED
280
- * through the dyn boundary (boxed thunks); direct static calls box
281
- * first (lower-calls). */
272
+ /** Heap, refcounted closure. `rest` marks a variadic function value.
273
+ * `restAbi: "typed"` spells one trailing typed array in `params`; static
274
+ * call sites pack their surplus arguments into it before `callValue`.
275
+ * `restAbi: "jsval"` similarly spells one trailing engine array for an
276
+ * island host callback. An absent `restAbi` is the legacy checked-dynamic
277
+ * JS form: `params` stays the declared non-rest list and the lifted
278
+ * function has one hidden trailing ScrDyn array filled by its boxed call
279
+ * thunk. `argumentsAll` keeps that hidden ABI but fills it with every
280
+ * actual argument, including named positions. The backends therefore
281
+ * still see one fixed native closure ABI;
282
+ * only the frontend's call completion observes variadic source arity. */
282
283
  | {
283
284
  kind: "func";
284
285
  params: IrType[];
285
286
  ret: IrType;
286
287
  rest?: true;
287
- restAbi?: "jsval";
288
+ restAbi?: "jsval" | "typed";
289
+ argumentsAll?: true;
288
290
  } | {
289
291
  kind: "object";
290
292
  className: string;
@@ -308,6 +310,15 @@ export type IrType = {
308
310
  kind: "classval";
309
311
  className: string;
310
312
  }
313
+ /** An ECMAScript module namespace object for one statically-known module.
314
+ * `moduleId` is a canonical compiled source-file or builtin identity.
315
+ * Runtime representation is an interned immortal string token: identity
316
+ * is pointer identity, while member reads resolve to live module globals
317
+ * or builtin lowering tables rather than snapshotting export values. */
318
+ | {
319
+ kind: "moduleNs";
320
+ moduleId: string;
321
+ }
311
322
  /** Structural record shape (object literal / interface / type alias over
312
323
  * data properties). `shapeId` indexes IrModule.records; the frontend
313
324
  * interns shapes structurally, so equal shapeId ⇔ equal shape and
@@ -417,9 +428,9 @@ declare const HANDLE_KIND_LIST: readonly ["stats", "fileHandle", "spawnRes", "ch
417
428
  export type HandleKind = typeof HANDLE_KIND_LIST[number];
418
429
  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">;
419
430
  /** The IR kinds represented as pointers in both native backends. */
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"];
431
+ 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", "moduleNs", "record", "union", "dyn", "jsval", "caught", "promise", "generator"];
421
432
  export type PointerKind = typeof POINTER_KIND_LIST[number];
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">;
433
+ 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" | "moduleNs" | "netServer" | "netSocket" | "object" | "promise" | "record" | "regex" | "searchParams" | "secureCtx" | "set" | "spawnRes" | "stats" | "string" | "symbol" | "testCtx" | "union" | "url">;
423
434
  /** Runtime RC symbol stem for each IR type kind. An empty stem means the
424
435
  * kind is scalar/unit or uses an emitted per-shape helper (object/record).
425
436
  * Keeping this exhaustive makes a new runtime handle kind a compile error
@@ -549,7 +560,7 @@ export declare function typeEquals(a: IrType, b: IrType): boolean;
549
560
  export declare function isRefCounted(t: IrType): boolean;
550
561
  export interface IrModule {
551
562
  /** Bumped on any breaking IR change; serialize.ts refuses mismatches. */
552
- irVersion: 9;
563
+ irVersion: 11;
553
564
  sourceFile: string;
554
565
  functions: IrFunction[];
555
566
  /** Class shapes. Constructors and methods are ordinary module functions
@@ -1341,7 +1352,11 @@ export type IrStmt =
1341
1352
  * from the end, clamping; omitted args omitted from `args` — backends fill
1342
1353
  * 0 / +Infinity, the strIntrinsic convention); ref elements retain into
1343
1354
  * the fresh array. */
1344
- export type IrArrIntrinsicMethod = "length" | "push" | "pushSpread" | "concatSpread" | "unshift" | "unshiftSpread" | "pop" | "indexOf" | "includes"
1355
+ export type IrArrIntrinsicMethod = "length"
1356
+ /** Internal ToNumber(a[index]) for f64-backed arrays: one numeric index,
1357
+ * returning the stored number or NaN for a hole/undefined/missing key.
1358
+ * Borrows the receiver and never traps on missing values. */
1359
+ | "getNumber" | "push" | "pushSpread" | "concatSpread" | "unshift" | "unshiftSpread" | "pop" | "indexOf" | "includes"
1345
1360
  /** Internal sparse traversal: the first present index at/after start,
1346
1361
  * or length when the remaining positions are holes. */
1347
1362
  | "nextPresent" | "join" | "slice" | "shift" | "splice" | "reverse"
@@ -1667,7 +1682,7 @@ export type IrLibFn =
1667
1682
  * result, ±0 order by the JS comparison (max prefers +0, min prefers
1668
1683
  * -0), and the empty array yields -Infinity / +Infinity like the
1669
1684
  * zero-argument calls. Borrows the array; never throws. */
1670
- | "math.maxArr" | "math.minArr"
1685
+ | "math.maxArr" | "math.minArr" | "math.hypotArr"
1671
1686
  /** `fs.readdirSync(path, { withFileTypes: true })` — Dirent rows over
1672
1687
  * one readdir pass (scr_lib.c's scandir snapshot; DT_UNKNOWN falls back
1673
1688
  * to lstat, Node's getDirents rule). The result type is the call site's
@@ -1699,7 +1714,9 @@ export type IrLibFn =
1699
1714
  * round-toward-+Infinity exactly as ECMA says). Static like floor —
1700
1715
  * they are ask-4's wholeness-discharge operators, so the library
1701
1716
  * inference needs them compiled, not island-served. Never throw. */
1702
- | "math.trunc" | "math.ceil"
1717
+ | "math.trunc" | "math.ceil" | "math.sin" | "math.cos" | "math.tan" | "math.asin" | "math.acos" | "math.atan" | "math.cbrt"
1718
+ /** Return -1, +1, or the original NaN/zero. In particular, -0 remains -0. */
1719
+ | "math.sign" | "math.exp" | "math.sqrt" | "math.log" | "math.log2" | "math.log10" | "math.atan2" | "math.pow"
1703
1720
  /** The static global parsers/tests (scr_string.c). num.parseInt is
1704
1721
  * ECMA-262 19.2.5 exactly — JS whitespace, sign, ToInt32 radix (the
1705
1722
  * frontend completes an omitted radix to 0 = the spec's "undefined":
@@ -1783,7 +1800,7 @@ export type IrLibFn =
1783
1800
  * value / string) — both THROW Node's TypeErrors on non-file schemes,
1784
1801
  * encoded slashes, and non-empty hosts. url.pathToFileURL resolves the
1785
1802
  * path (getcwd) and never throws. */
1786
- | "url.new" | "url.protocol" | "url.host" | "url.hostname" | "url.pathname" | "url.href" | "url.fileURLToPathUrl" | "url.fileURLToPathStr" | "url.pathToFileURL"
1803
+ | "url.new" | "url.protocol" | "url.origin" | "url.username" | "url.password" | "url.host" | "url.hostname" | "url.port" | "url.pathname" | "url.href" | "url.fileURLToPathUrl" | "url.fileURLToPathStr" | "url.pathToFileURL"
1787
1804
  /** pathToFileURL under a win32 TARGET: the same scr_url_from_path call
1788
1805
  * (the runtime selects the win32 arm by _WIN32), but a distinct IR name
1789
1806
  * because that arm THROWS for malformed UNC inputs — may-throw seeds on
@@ -1806,7 +1823,7 @@ export type IrLibFn =
1806
1823
  * bools; sp.size/sp.toString are pure reads. sp.keyAt/sp.valAt are
1807
1824
  * the for-of/forEach desugar's index reads (live — the loop re-reads
1808
1825
  * sp.size each pass). */
1809
- | "sp.new" | "sp.parse" | "sp.copy" | "sp.fromPairs" | "sp.with" | "url.searchParams" | "url.search" | "sp.get" | "sp.getAll" | "sp.append" | "sp.set" | "sp.delete" | "sp.deleteValue" | "sp.has" | "sp.hasValue" | "sp.sort" | "sp.size" | "sp.toString" | "sp.keyAt" | "sp.valAt"
1826
+ | "sp.new" | "sp.parse" | "sp.copy" | "sp.fromPairs" | "sp.with" | "url.searchParams" | "url.search" | "url.hash" | "sp.get" | "sp.getAll" | "sp.append" | "sp.set" | "sp.delete" | "sp.deleteValue" | "sp.has" | "sp.hasValue" | "sp.sort" | "sp.size" | "sp.toString" | "sp.keyAt" | "sp.valAt"
1810
1827
  /** node:querystring (scr_qs.c — link-gated by moduleUsesQs; NOT
1811
1828
  * URLSearchParams: the legacy codec's escaping and '+' rules differ).
1812
1829
  * qs.escape is Node's qsEscape, which encodes exactly the component
@@ -1848,10 +1865,10 @@ export type IrLibFn =
1848
1865
  * parse accepts the ECMAScript BigInt string grammar; fromF64 accepts
1849
1866
  * finite integral Numbers. Arithmetic returns fresh immutable values.
1850
1867
  * 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"
1868
+ | "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.eqString" | "bigint.cmp" | "bigint.cmpNumber" | "bigint.truthy" | "bigint.toString" | "bigint.inspect" | "bigint.toF64" | "bigint.asUintN" | "bigint.asIntN" | "bigint.bufferRead" | "bigint.bufferWrite" | "bigint.dataViewGet" | "bigint.dataViewSet"
1852
1869
  /** fs.statSync → a Stats value (may throw, like the other sync fs
1853
1870
  * calls); the stats.* getters are pure reads on it. */
1854
- | "fs.statSync" | "stats.isFile" | "stats.isDirectory" | "stats.size"
1871
+ | "fs.statSync" | "stats.isFile" | "stats.isDirectory" | "stats.size" | "stats.dev" | "stats.ino"
1855
1872
  /** child_process.spawnSync (scr_child.c): posix_spawn + waitpid + piped
1856
1873
  * utf8 capture — cmd borrowed, args one borrowed string[] (the frontend
1857
1874
  * completes an omitted list to an empty literal), result an owned (+1)
@@ -1879,7 +1896,9 @@ export type IrLibFn =
1879
1896
  * cmd/args borrowed; result an owned (+1) child handle. The loop will
1880
1897
  * not exhaust while any spawned child is unreaped — Node's keep-alive.
1881
1898
  *
1882
- * child.onExit / child.onError — `child.on("exit"|"error", cb)`: the
1899
+ * child.onExit / child.onClose / child.onError — terminal listener
1900
+ * registration through child.on/once. Close uses the exit adapter shape
1901
+ * but fires only after every piped stdio handle reaches EOF. The
1883
1902
  * receiver is borrowed, the CALLBACK MOVES into the child's listener
1884
1903
  * registry (released after the terminal event fires, or at reap for
1885
1904
  * the event that never fires). Both are void (chaining is fenced).
@@ -1891,7 +1910,16 @@ export type IrLibFn =
1891
1910
  * shape — scr_error_new needs no program types). "exit" fires once
1892
1911
  * with the code (f64 arm) or null (signal death); "error" fires only
1893
1912
  * for spawn failure, exactly Node's split. */
1894
- | "cp.spawn" | "child.onExit" | "child.onError"
1913
+ | "cp.spawn"
1914
+ /** Static-native fork startup and IPC. process.forkTarget initializes a
1915
+ * re-executed child's inherited channel and returns its embedded target id
1916
+ * (-1 in the parent). The remaining entries mirror Node's JSON channel. */
1917
+ | "process.forkTarget" | "cp.fork" | "child.connected" | "child.send" | "child.sendCb" | "child.disconnect" | "child.onMessage" | "child.onDisconnect" | "process.connected" | "process.send" | "process.sendCb" | "process.disconnect" | "process.onMessage" | "process.onDisconnect"
1918
+ /** child_process.execFile's callback slice: starts an all-piped child,
1919
+ * captures stdout/stderr, and moves the error-first callback into the
1920
+ * child registry. The callback shape is program-dependent and checked
1921
+ * by the validator/backends. */
1922
+ | "cp.execFile" | "child.onExit" | "child.onClose" | "child.onError"
1895
1923
  /** The ChildProcess lifecycle members (scr_child.c), Node's shapes
1896
1924
  * exactly (SEMANTICS.md has the pinned matrix). child.pid is the
1897
1925
  * checker's `number | undefined` (undefined = spawn failure) and
@@ -1914,12 +1942,14 @@ export type IrLibFn =
1914
1942
  * arm). stream.onData/onEnd register 'data'/'end' listeners (receiver
1915
1943
  * borrowed, CALLBACK MOVES, trailing once-flag, void — chaining
1916
1944
  * fenced): 'data' fires one Buffer chunk per read (zero-param and
1917
- * Buffer-param adapters are runtime-provided; a union-param listener —
1945
+ * Buffer/string adapters are runtime-provided; setEncoding threads
1946
+ * split multibyte sequences through the shared StringDecoder core. A
1947
+ * union-param listener —
1918
1948
  * ngrok's `Buffer | string` — gets a compiler-emitted adapter wrapping
1919
1949
  * the chunk at its Buffer arm), 'end' fires once at EOF, always BEFORE
1920
1950
  * the child's 'exit' (the pinned ordering). A flowing stream keeps the
1921
1951
  * loop alive: usesTimers. */
1922
- | "child.stdout" | "child.stderr" | "stream.onData" | "stream.onEnd"
1952
+ | "child.stdout" | "child.stderr" | "stream.onData" | "stream.onDataStr" | "stream.onEnd" | "stream.childSetEncoding"
1923
1953
  /** The piped-input writer (stdio mode 3 on fd 0). child.stdin answers
1924
1954
  * `Writable | null`; writes copy borrowed data into the nonblocking
1925
1955
  * queue, end/destroy settle it, writable is a pure state read, and
@@ -1962,7 +1992,7 @@ export type IrLibFn =
1962
1992
  * those values in the callback form. The final BOOL is the requested
1963
1993
  * kernel connection-distribution option; old spellings remain
1964
1994
  * four/five-argument calls so serialized IR stays compatible. */
1965
- | "net.listenOptsReusePort" | "net.listenOptsReusePortCb" | "net.serverPort"
1995
+ | "net.listenOptsReusePort" | "net.listenOptsReusePortCb" | "net.serverPort" | "net.serverListening"
1966
1996
  /** server.address() as the full AddressInfo record (the dgram.address
1967
1997
  * materialization pattern: the emitter builds the record from the three
1968
1998
  * runtime reads; the frontend pinned the shape). Never throws — before
@@ -2071,18 +2101,16 @@ export type IrLibFn =
2071
2101
  * for end-before-head, chunked after an explicit writeHead/write). */
2072
2102
  | "http.createServer"
2073
2103
  /** http.createServer() / http.Server() with no handler — the
2074
- * on("request") route; createServerOpts is the (options[, listener])
2075
- * overload's twin carrying the two lowered parser flags
2076
- * (requireHostHeader: false is already this parser's behavior;
2077
- * joinDuplicateHeaders joins repeated request-header reads ", "). */
2078
- | "http.createServerEmpty" | "http.serverJoinDupHeaders"
2104
+ * on("request") route; option helpers set parser behavior on a fresh
2105
+ * server before the constructor/factory result is returned. */
2106
+ | "http.createServerEmpty" | "http.validateHeaderName" | "http.validateHeaderValue" | "http.serverJoinDupHeaders" | "http.serverAllowMissingHostHeader"
2079
2107
  /** The five writable numeric http.Server timeout fields use one
2080
2108
  * selector ABI: 0 timeout, 1 keepAliveTimeout, 2 headersTimeout,
2081
2109
  * 3 requestTimeout, 4 keepAliveTimeoutBuffer. These calls store/read
2082
2110
  * the property values; timer enforcement remains outside this surface.
2083
2111
  * The constructor-option setter takes dyn so explicit undefined remains
2084
2112
  * distinguishable from a numeric value until its Node validation ladder. */
2085
- | "http.serverTimeoutGet" | "http.serverTimeoutSet" | "http.serverTimeoutOptionSet"
2113
+ | "http.serverTimeoutGet" | "http.serverSetTimeout" | "http.serverSetTimeoutCb" | "http.serverOnTimeout" | "http.serverCloseAllConnections" | "http.serverCloseIdleConnections" | "http.serverTimeoutSet" | "http.serverTimeoutOptionSet"
2086
2114
  /** server.on("listening", cb) — the deferred listen-callback list. */
2087
2115
  | "net.serverOnListening"
2088
2116
  /** The ServerResponse member surface: statusCode/statusMessage reads
@@ -2092,9 +2120,12 @@ export type IrLibFn =
2092
2120
  * the callback fires deferred, Node's 'finish' emit). writeHead's
2093
2121
  * statusMessage forms compose in interned helpers: resStatusMsgSet
2094
2122
  * then the ordinary writeHead entry. */
2095
- | "http.resStatusGet" | "http.resStatusSet" | "http.resStatusMsgGet" | "http.resStatusMsgSet" | "http.resGetHeader" | "http.resHasHeader" | "http.resRemoveHeader" | "http.resOnFinish" | "http.reqUrl" | "http.reqMethod" | "http.reqHeader" | "http.reqOnData" | "http.reqOnEnd" | "http.resSetHeader" | "http.resWriteHead" | "http.resWriteHeadN" | "http.resWrite" | "http.resWriteBytes" | "http.resEnd" | "http.resEndStr" | "http.resEndBytes"
2123
+ | "http.resStatusGet" | "http.resStatusSet" | "http.resStatusMsgGet" | "http.resStatusMsgSet" | "http.resRequest" | "http.resSocket" | "http.resWritableFinished" | "http.resSendDateGet" | "http.resSendDateSet" | "http.resStrictContentLengthGet" | "http.resStrictContentLengthSet" | "http.resSetTimeout" | "http.resSetTimeoutCb" | "http.resGetHeader" | "http.resGetHeaderNames" | "http.resGetRawHeaderNames" | "http.resGetHeaders" | "http.resHasHeader" | "http.resRemoveHeader" | "http.resOnFinish" | "http.reqUrl" | "http.reqMethod" | "http.reqHeader" | "http.reqTrailer" | "http.reqHeaderValues" | "http.reqTrailerValues" | "http.reqOnData" | "http.reqOnEnd" | "http.resSetHeader" | "http.resWriteHead" | "http.resWriteHeadN"
2124
+ /** HTTP/1.1 informational heads; early hints takes flat string pairs,
2125
+ * with a lowercase `link` key required to send anything. */
2126
+ | "http.resWriteContinue" | "http.resWriteProcessing" | "http.resWriteEarlyHints" | "http.resWrite" | "http.resWriteBytes" | "http.resEnd" | "http.resEndStr" | "http.resEndBytes"
2096
2127
  /** The checked-dynamic chunk twins (the net.sockWriteDyn story). */
2097
- | "http.resWriteDyn" | "http.resEndDyn" | "http.resHeadersSent"
2128
+ | "http.resWriteDyn" | "http.resEndDyn" | "http.resHeadersSent" | "http.resWritableEnded" | "http.resFlushHeaders" | "http.resAddTrailers" | "http.resCork" | "http.resUncork" | "http.resWritableCorked"
2098
2129
  /** The server-surface member follow-ups: reqStatusCode answers the
2099
2130
  * interned `number | undefined` union (negative = the undefined arm —
2100
2131
  * a SERVER request, where Node's statusCode is undefined; every client
@@ -2117,11 +2148,11 @@ export type IrLibFn =
2117
2148
  * line carried none), the undefined arm on server requests (the
2118
2149
  * statusCode split). sockDestroyed is socket.destroyed — true once the
2119
2150
  * fd is gone (destroy() or full close). */
2120
- | "http.reqRawHeaders" | "http.reqStatusMessage"
2151
+ | "http.reqRawHeaders" | "http.reqRawTrailers" | "http.reqStatusMessage"
2121
2152
  /** The `{ ...req.headers }` snapshot feed: [lowercased name, value,
2122
2153
  * ...] pairs in arrival order — the interned %headers.snapshot helper
2123
2154
  * builds the record over it, exactly the process.envPairs pattern. */
2124
- | "http.reqHeaderPairs" | "net.sockDestroyed"
2155
+ | "http.reqHeaderPairs" | "http.reqTrailerPairs" | "net.sockDestroyed"
2125
2156
  /** socket.writable — the write half is open: no end() yet, no FIN sent,
2126
2157
  * fd alive (connecting sockets answer true; writes queue). Node's
2127
2158
  * stream flag. Borrows; never throws. */
@@ -2354,13 +2385,13 @@ export type IrLibFn =
2354
2385
  * socket carries a TLS transport (Node types `encrypted: true` on
2355
2386
  * TLSSocket; plain sockets answer undefined — the proxy.ts isEncrypted
2356
2387
  * idiom reads it through a cast). */
2357
- | "net.sockEncrypted" | "http.clientWrite" | "http.clientWriteBytes" | "http.clientEnd" | "http.clientEndStr" | "http.clientEndBytes"
2388
+ | "net.sockEncrypted" | "http.clientWrite" | "http.clientSetHeader" | "http.clientGetHeader" | "http.clientHasHeader" | "http.clientRemoveHeader" | "http.clientGetHeaderNames" | "http.clientGetRawHeaderNames" | "http.clientGetHeaders" | "http.clientWriteBytes" | "http.clientEnd" | "http.clientEndStr" | "http.clientEndBytes"
2358
2389
  /** The checked-dynamic chunk twins (the net.sockWriteDyn story). */
2359
- | "http.clientWriteDyn" | "http.clientEndDyn"
2390
+ | "http.clientWriteDyn" | "http.clientEndDyn" | "http.clientFlushHeaders" | "http.clientAddTrailers" | "http.clientCork" | "http.clientUncork" | "http.clientWritableCorked" | "http.clientMethod" | "http.clientPath" | "http.clientHost" | "http.clientProtocol" | "http.clientHeadersSent" | "http.clientWritableEnded" | "http.clientWritableFinished" | "http.clientSocket" | "http.clientReusedSocket" | "http.clientSetNoDelay" | "http.clientSetSocketKeepAlive" | "http.clientSetTimeout" | "http.clientSetTimeoutCb" | "http.statusCodes" | "http.methods" | "http.reqSetTimeout" | "http.reqSetTimeoutCb"
2360
2391
  /** request/get with a URL-STRING first argument: the runtime parses it
2361
2392
  * (WHATWG) and dials — throws catchably on an unparsable input or a
2362
2393
  * non-http scheme. */
2363
- | "http.requestUrl" | "http.requestUrlCb" | "http.clientDestroy" | "http.clientDestroyed" | "http.clientOnResponse" | "http.clientOnError" | "http.clientOnTimeout" | "http.clientOnClose"
2394
+ | "http.requestUrl" | "http.requestUrlCb" | "http.clientDestroy" | "http.clientAbort" | "http.clientAborted" | "http.clientDestroyed" | "http.clientOnResponse" | "http.clientOnSocket" | "http.clientOnFinish" | "http.clientOnError" | "http.clientOnTimeout" | "http.clientOnClose" | "http.clientOnAbort"
2364
2395
  /** fs/promises (scr_lib.c over scr_async.c's settled minting): the SAME
2365
2396
  * sync syscalls, wrapped in an ALREADY-SETTLED promise — failure
2366
2397
  * REJECTS (catchable at the await) instead of throwing, so none of
@@ -2452,11 +2483,15 @@ export type IrLibFn =
2452
2483
  * pair THROWS catchably on failure exactly like the utf8 forms. */
2453
2484
  | "fs.readFileSyncBytes" | "fs.writeFileSyncBytes" | "fsp.readFileBytes"
2454
2485
  /** node:zlib (scr_zlib.c — native-toolchain.ts compiles/links it ONLY when these
2455
- * appear on the IR, the regex/libcurl gating precedent): deflateSync/
2456
- * inflateSync over u8 bytes with Node's default options. deflate never
2457
- * throws (OOM aborts); inflate of corrupt input THROWS Node's error
2458
- * catchably. */
2459
- | "zlib.deflateSync" | "zlib.inflateSync"
2486
+ * appear on the IR, the regex/libcurl gating precedent): one-shot zlib,
2487
+ * raw-DEFLATE, gzip, and auto-detect codecs over u8 bytes with Node's
2488
+ * default options. Compression never throws (OOM aborts); decompression
2489
+ * of corrupt input THROWS Node's error catchably. */
2490
+ | "zlib.deflateSync" | "zlib.inflateSync" | "zlib.deflateRawSync" | "zlib.inflateRawSync" | "zlib.gzipSync" | "zlib.gunzipSync" | "zlib.unzipSync"
2491
+ /** The default-options callback twins run on the executable's shared
2492
+ * native work pool and deliver (Error | null, Buffer) on a later loop
2493
+ * turn. crc32 validates its optional uint32 seed synchronously. */
2494
+ | "zlib.deflateCb" | "zlib.inflateCb" | "zlib.deflateRawCb" | "zlib.inflateRawCb" | "zlib.gzipCb" | "zlib.gunzipCb" | "zlib.unzipCb" | "zlib.crc32"
2460
2495
  /** The Buffer overloads of the raw stream writes — same promptly
2461
2496
  * submitted streams as process.stdoutWrite/stderrWrite, constantly true.
2462
2497
  * The encoding arg is evaluated but ignored for bytes, like Node. The Cb
@@ -2469,7 +2504,12 @@ export type IrLibFn =
2469
2504
  * literal { recursive?, mode? } options (the mkdirSync matrix behind
2470
2505
  * settled promises), unlink, chmod. Failures REJECT (catchable at the
2471
2506
  * await), like the rest of the fsp family. */
2472
- | "fsp.mkdirMode" | "fsp.mkdirRecursive" | "fsp.mkdirRecursiveMode" | "fsp.unlink" | "fsp.chmod" | "fsp.rename" | "fsp.readdir" | "fsp.rm" | "fsp.stat"
2507
+ | "fsp.mkdirMode" | "fsp.mkdirRecursive" | "fsp.mkdirRecursiveMode" | "fsp.unlink" | "fsp.chmod" | "fsp.rename" | "fsp.readdir"
2508
+ /** `fs.promises.readdir(path, { withFileTypes: true })` — the settled-
2509
+ * promise twin of fs.readdirTypesSync. The backends assemble the same
2510
+ * call-site-shaped Dirent rows, then move the array into a promise;
2511
+ * scandir failure becomes its rejection. */
2512
+ | "fsp.readdirTypes" | "fsp.rm" | "fsp.stat" | "fsp.realpath" | "fsp.lstat"
2473
2513
  /** fs/promises.open and the statically represented FileHandle surface.
2474
2514
  * Every operation returns an already-settled promise; syscall failures
2475
2515
  * become rejections rather than escaping synchronously. read/write
@@ -2490,7 +2530,11 @@ export type IrLibFn =
2490
2530
  * (the frontend's interned %env.snapshot helper keyed-writes the pairs
2491
2531
  * into a fresh `{ [k: string]: string | undefined }` record). Fresh +1
2492
2532
  * array; never throws. */
2493
- | "process.envPairs" | "process.exit" | "process.cwd"
2533
+ | "process.envPairs" | "process.exit"
2534
+ /** Numeric process.exitCode write (integer validation, implicit exit status). */
2535
+ | "process.setExitCode"
2536
+ /** The code for process.exit() with no argument, or zero when unset. */
2537
+ | "process.currentExitCode" | "process.cwd"
2494
2538
  /** getpid(2) / getuid(2): zero args → f64. POSIX-only target, so both
2495
2539
  * always answer (the checker's `getuid?` optionality covers Windows —
2496
2540
  * `process.getuid?.()` lowers as the plain call). Never throw. */
@@ -2694,6 +2738,11 @@ export type IrLibFn =
2694
2738
  * render "null"/"undefined") — the WHATWG USVString conversions
2695
2739
  * (URLSearchParams names/values). Borrowed dyn; +1 string. May-throw. */
2696
2740
  | "dyn.toStringCoerce"
2741
+ /** JS ToNumber over a dyn value WITH the object protocol (number-hint
2742
+ * valueOf/toString ordering; user throws propagate). Borrowed dyn;
2743
+ * f64 result, or a throw. Used by statically lowered numeric coercions
2744
+ * whose checker type remained any. */
2745
+ | "dyn.toNumberCoerce"
2697
2746
  /** A read of a `declare`d const NOTHING defines (the bundler-define
2698
2747
  * pattern — __VERSION__): always throws the catchable ReferenceError
2699
2748
  * Node raises at the access ("<name> is not defined"). args[0] is the
@@ -2820,7 +2869,7 @@ export type IrLibFn =
2820
2869
  * the had-listeners bool. emitter.emitError: emit('error', err) —
2821
2870
  * throws err when unhandled. count/countFn/names/listeners/getMax/
2822
2871
  * setMax/setDefaultMax/getDefaultMax are the introspection surface. */
2823
- | "emitter.new" | "emitter.ctor" | "emitter.on" | "emitter.off" | "emitter.checkListener" | "emitter.onDyn" | "emitter.offDyn" | "emitter.removeAll" | "emitter.emit" | "emitter.emitError" | "emitter.count" | "emitter.countFn" | "emitter.names" | "emitter.listeners" | "emitter.setMax" | "emitter.getMax"
2872
+ | "emitter.new" | "emitter.ctor" | "emitter.on" | "emitter.off" | "emitter.checkListener" | "emitter.onDyn" | "emitter.onFlex" | "emitter.offDyn" | "emitter.removeAll" | "emitter.emit" | "emitter.emitFlex" | "emitter.emitError" | "emitter.count" | "emitter.countFn" | "emitter.names" | "emitter.listeners" | "emitter.setMax" | "emitter.getMax"
2824
2873
  /** Stream-'data' registration twins of emitter.on/onDyn (same args):
2825
2874
  * chosen at registration sites whose receiver is stream-rooted, so the
2826
2875
  * backend emits DATA thunks — the runtime's 'data' emission carries
@@ -2980,7 +3029,7 @@ export type IrLibFn =
2980
3029
  * the value's inspection) — the frontend routes null/undefined to a
2981
3030
  * no-op and everything else here (Node throws for falsy values too).
2982
3031
  * All arguments are borrowed. */
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"
3032
+ | "assert.ok" | "assert.eqF64" | "assert.eqBigInt" | "assert.eqStr" | "assert.eqBool" | "assert.eqSym" | "assert.eqDyn" | "assert.looseResult" | "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"
2984
3033
  /** Node's expectsError over an error-INSTANCE expected (assert.throws/
2985
3034
  * rejects second argument): walk the expected dyn error's keys (name,
2986
3035
  * message, code — the %error marker skipped) and deep-compare each
@@ -3134,7 +3183,9 @@ export type IrLibFn =
3134
3183
  * ToInteger truncation of fractional ms) and THROWS Node's "Invalid
3135
3184
  * time value" RangeError on NaN / out-of-range input (may-throw seed).
3136
3185
  * Results: f64 / owned (+1) string. */
3137
- | "date.now" | "date.newNow" | "date.newMs" | "date.newString" | "date.getTime" | "date.valueOf" | "date.toISOString" | "date.toISOStringValue" | "date.getFullYear" | "date.getUTCFullYear" | "date.getMonth" | "date.getUTCMonth" | "date.getDate" | "date.getUTCDate" | "date.getDay" | "date.getUTCDay" | "date.getHours" | "date.getUTCHours" | "date.getMinutes" | "date.getUTCMinutes" | "date.getSeconds" | "date.getUTCSeconds" | "date.getMilliseconds" | "date.getUTCMilliseconds" | "date.getTimezoneOffset"
3186
+ | "date.now" | "date.newNow" | "date.newMs" | "date.newString"
3187
+ /** Date.parse(dateString), with its own reach witness for exact fences. */
3188
+ | "date.parse" | "date.getTime" | "date.valueOf" | "date.toISOString" | "date.toISOStringValue" | "date.getFullYear" | "date.getUTCFullYear" | "date.getMonth" | "date.getUTCMonth" | "date.getDate" | "date.getUTCDate" | "date.getDay" | "date.getUTCDay" | "date.getHours" | "date.getUTCHours" | "date.getMinutes" | "date.getUTCMinutes" | "date.getSeconds" | "date.getUTCSeconds" | "date.getMilliseconds" | "date.getUTCMilliseconds" | "date.getTimezoneOffset"
3138
3189
  /** The composed `new Date(dateString).getTime()` read: one borrowed
3139
3190
  * string, f64 milliseconds since epoch. The parsed grammar is BOUNDED
3140
3191
  * (documented divergence — V8's parser accepts far more): the ASN.1
@@ -3192,17 +3243,14 @@ export type IrLibFn =
3192
3243
  * yields the undefined arm, exactly Node's missing `.columns`. Never
3193
3244
  * throws. */
3194
3245
  | "process.columns"
3195
- /** String surface with scr_lib.c implementations. fromCharCode takes
3196
- * ONE f64[] arg (the frontend packs plain arguments into an array
3197
- * literal, or forwards a whole-array spread — the path.join
3198
- * convention) and builds the string from UTF-16 code units: each code
3199
- * goes through ToUint16, adjacent surrogate pairs combine into one
3200
- * code point, and LONE surrogates become U+FFFD (divergence 1's
3201
- * storage policy — printed output still matches Node byte-for-byte).
3202
- * lastIndexOf is the one-argument form: the LAST occurrence as a
3203
- * UTF-16 index (-1 when absent; the empty needle finds the length,
3204
- * per spec). Borrowed args; +1 string / plain f64; neither throws. */
3205
- | "string.fromCharCode" | "string.lastIndexOf"
3246
+ /** fromCharCode takes one packed f64[] or bytes arg and builds a string
3247
+ * from UTF-16 code units. Adjacent surrogate pairs combine; lone
3248
+ * surrogates follow the runtime's replacement policy. */
3249
+ | "string.fromCharCode"
3250
+ /** lastIndexOf returns the last UTF-16 start index, or -1. The two-arg
3251
+ * form searches at or before its numeric position; NaN starts at the end.
3252
+ * String arguments are borrowed and neither form throws. */
3253
+ | "string.lastIndexOf" | "string.lastIndexOfFrom"
3206
3254
  /** String.raw(template, ...subs): the raw literals array (a string[]
3207
3255
  * read off the template record) interleaved with the PRE-STRINGIFIED
3208
3256
  * substitutions (the frontend applies the static ToString and packs
@@ -3235,7 +3283,7 @@ export type IrLibFn =
3235
3283
  * uv_fs_copyfile behavior); its errors carry BOTH paths — Node's
3236
3284
  * "copyfile 'src' -> 'dest'". lstatSync is statSync without following
3237
3285
  * a trailing symlink (Node reports lstat); stats.isSymbolicLink /
3238
- * stats.blocks / nlink / atimeMs / mtimeMs are pure reads on the widened
3286
+ * stats.dev / ino / blocks / nlink / atimeMs / mtimeMs / ctimeMs are pure reads on the widened
3239
3287
  * snapshot (blocks is allocated 512-byte units; the times are milliseconds
3240
3288
  * with their sub-second fractions, Node's arithmetic).
3241
3289
  * writeFileModeSync is writeFileSync(path, data, { mode }): the mode
@@ -3248,7 +3296,7 @@ export type IrLibFn =
3248
3296
  /** renameSync is the direct two-path syscall wrapper. renameCb defers
3249
3297
  * the operation to the loop and fires a program-shaped Error | null
3250
3298
  * callback through a backend-emitted adapter. */
3251
- | "fs.renameSync" | "fs.renameCb" | "fs.lstatSync"
3299
+ | "fs.renameSync" | "fs.renameCb" | "fs.lstatSync" | "fs.fstatSync" | "fs.fchmodSync" | "fs.fsyncSync" | "fs.linkSync"
3252
3300
  /** fs.openSync(path, flags) → the raw fd as f64; fs.readSync/fs.writeSync
3253
3301
  * over Buffer windows perform sequential I/O when position is -1 and
3254
3302
  * offset-preserving positioned I/O otherwise; fs.writeStrSync is the
@@ -3259,7 +3307,7 @@ export type IrLibFn =
3259
3307
  * Node's ERR_INVALID_ARG_VALUE TypeError text). All throw Node-shaped
3260
3308
  * fs errors (openSync ENOENT/EACCES..., readSync EBADF/range errors,
3261
3309
  * closeSync EBADF). */
3262
- | "fs.openSync" | "fs.readSync" | "fs.writeSync" | "fs.writeStrSync" | "fs.closeSync"
3310
+ | "fs.openSync" | "fs.openNumericSync" | "fs.readSync" | "fs.writeSync" | "fs.writeStrSync" | "fs.closeSync"
3263
3311
  /** fs.watch(path, listener?) → an FSWatcher handle (scr_watch.c —
3264
3312
  * linked, and scr_watch_install() emitted, only when these appear on
3265
3313
  * the IR; moduleUsesFsWatch is the switch). The path opens NOW —
@@ -3282,7 +3330,7 @@ export type IrLibFn =
3282
3330
  * ASN1_TIME_print shape ("Jul 1 00:00:00 2026 GMT" — %2d space-padded
3283
3331
  * day). Same input contract and PEM error as the fingerprint pair
3284
3332
  * (may-throw). */
3285
- | "crypto.x509ValidFrom" | "crypto.x509ValidFromStr" | "crypto.x509ValidTo" | "crypto.x509ValidToStr" | "stats.isSymbolicLink" | "stats.blocks" | "stats.nlink" | "stats.atimeMs" | "stats.mtimeMs" | "fs.writeFileModeSync" | "fs.mkdirModeSync" | "fs.mkdirRecursiveModeSync"
3333
+ | "crypto.x509ValidFrom" | "crypto.x509ValidFromStr" | "crypto.x509ValidTo" | "crypto.x509ValidToStr" | "stats.isSymbolicLink" | "stats.blocks" | "stats.nlink" | "stats.atimeMs" | "stats.mtimeMs" | "stats.ctimeMs" | "fs.writeFileModeSync" | "fs.mkdirModeSync" | "fs.mkdirRecursiveModeSync"
3286
3334
  /** spawnSync with options (scr_child.c): the cp.spawnSync core plus the
3287
3335
  * option slice portless-class CLIs pass — timeout (killSignal fires at
3288
3336
  * the deadline and the result carries error: ETIMEDOUT + the signal,
@@ -3348,6 +3396,13 @@ export type IrExpr =
3348
3396
  value: string;
3349
3397
  type: IrType;
3350
3398
  loc: SrcLoc;
3399
+ }
3400
+ /** The singleton namespace token for one compiled or builtin module. */
3401
+ | {
3402
+ kind: "moduleNsRef";
3403
+ moduleId: string;
3404
+ type: IrType;
3405
+ loc: SrcLoc;
3351
3406
  } | {
3352
3407
  kind: "boolLit";
3353
3408
  value: boolean;
@@ -5258,8 +5313,7 @@ export declare function moduleLibNondeterministicSurface(mod: IrModule): string
5258
5313
  /** The may-throw seed: libCall members that can raise. Every fs.* member
5259
5314
  * EXCEPT existsSync (which, like Node's, swallows errors and returns false)
5260
5315
  * throws a catchable error on failure; json.parse throws a catchable
5261
- * SyntaxError-shaped string on malformed input; process.* members never
5262
- * throw. Backends' may-throw analyses must treat a function containing one
5316
+ * SyntaxError-shaped string on malformed input. Backends' may-throw analyses must treat a function containing one
5263
5317
  * of these as throwing, exactly like a `throw` statement (and must ALSO
5264
5318
  * seed on `dynCheck` and `awaitExpr` nodes, which throw on validation
5265
5319
  * failure / promise rejection). */