@scriptc/compiler 0.1.3 → 0.1.4

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 (147) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +200 -51
  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 +10 -0
  6. package/dist/backend/c/c-emitter.js +14 -2
  7. package/dist/backend/c/c-emitter.js.map +1 -1
  8. package/dist/backend/c/exprs.js +293 -51
  9. package/dist/backend/c/exprs.js.map +1 -1
  10. package/dist/backend/c/types.js +2 -0
  11. package/dist/backend/c/types.js.map +1 -1
  12. package/dist/backend/link-plan.d.ts +2 -1
  13. package/dist/backend/link-plan.js +2 -1
  14. package/dist/backend/link-plan.js.map +1 -1
  15. package/dist/backend/llvm/emitter.js +20 -6
  16. package/dist/backend/llvm/emitter.js.map +1 -1
  17. package/dist/backend/llvm/expr-bytes.d.ts +1 -1
  18. package/dist/backend/llvm/expr-bytes.js +8 -8
  19. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  20. package/dist/backend/llvm/expr-callbacks.d.ts +9 -0
  21. package/dist/backend/llvm/expr-callbacks.js +125 -0
  22. package/dist/backend/llvm/expr-callbacks.js.map +1 -1
  23. package/dist/backend/llvm/expr-context.d.ts +14 -2
  24. package/dist/backend/llvm/expr-dispatch.js +1 -0
  25. package/dist/backend/llvm/expr-dispatch.js.map +1 -1
  26. package/dist/backend/llvm/expr-primitives.d.ts +1 -1
  27. package/dist/backend/llvm/expr-primitives.js +30 -9
  28. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  29. package/dist/backend/llvm/expr-primitives.test.d.ts +1 -0
  30. package/dist/backend/llvm/expr-primitives.test.js +38 -0
  31. package/dist/backend/llvm/expr-primitives.test.js.map +1 -0
  32. package/dist/backend/llvm/expr-stream-callbacks.d.ts +3 -0
  33. package/dist/backend/llvm/expr-stream-callbacks.js +69 -0
  34. package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
  35. package/dist/backend/llvm/lib-filesystem.js +68 -10
  36. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  37. package/dist/backend/llvm/lib-network.js +18 -2
  38. package/dist/backend/llvm/lib-network.js.map +1 -1
  39. package/dist/backend/llvm/lib-process.js +156 -6
  40. package/dist/backend/llvm/lib-process.js.map +1 -1
  41. package/dist/backend/llvm/lib-shared.js +36 -0
  42. package/dist/backend/llvm/lib-shared.js.map +1 -1
  43. package/dist/backend/llvm/lib-stream.js +23 -0
  44. package/dist/backend/llvm/lib-stream.js.map +1 -1
  45. package/dist/backend/native-toolchain.d.ts +3 -0
  46. package/dist/backend/native-toolchain.js +3 -1
  47. package/dist/backend/native-toolchain.js.map +1 -1
  48. package/dist/backend/runtime-pack.test.js +28 -10
  49. package/dist/backend/runtime-pack.test.js.map +1 -1
  50. package/dist/backend/targets.d.ts +4 -0
  51. package/dist/backend/targets.js +13 -0
  52. package/dist/backend/targets.js.map +1 -1
  53. package/dist/backend/targets.test.js +8 -1
  54. package/dist/backend/targets.test.js.map +1 -1
  55. package/dist/coverage/surface-manifest.js +8 -0
  56. package/dist/coverage/surface-manifest.js.map +1 -1
  57. package/dist/diagnostics/diagnostic.js +1 -1
  58. package/dist/diagnostics/diagnostic.js.map +1 -1
  59. package/dist/executable/executable-cache.d.ts +2 -0
  60. package/dist/executable/executable-cache.js +3 -0
  61. package/dist/executable/executable-cache.js.map +1 -1
  62. package/dist/frontend/fork-target.d.ts +17 -0
  63. package/dist/frontend/fork-target.js +256 -0
  64. package/dist/frontend/fork-target.js.map +1 -0
  65. package/dist/frontend/lowering/abstract-equality.d.ts +6 -0
  66. package/dist/frontend/lowering/abstract-equality.js +250 -0
  67. package/dist/frontend/lowering/abstract-equality.js.map +1 -0
  68. package/dist/frontend/lowering/lower-assert.js +71 -2
  69. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  70. package/dist/frontend/lowering/lower-builtins.d.ts +50 -23
  71. package/dist/frontend/lowering/lower-builtins.js +939 -106
  72. package/dist/frontend/lowering/lower-builtins.js.map +1 -1
  73. package/dist/frontend/lowering/lower-calls.d.ts +29 -21
  74. package/dist/frontend/lowering/lower-calls.js +573 -121
  75. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  76. package/dist/frontend/lowering/lower-classes.js +39 -8
  77. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  78. package/dist/frontend/lowering/lower-containers.js +150 -0
  79. package/dist/frontend/lowering/lower-containers.js.map +1 -1
  80. package/dist/frontend/lowering/lower-event-emitter.js +212 -21
  81. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  82. package/dist/frontend/lowering/lower-exprs.js +135 -83
  83. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  84. package/dist/frontend/lowering/lower-inspect.d.ts +4 -0
  85. package/dist/frontend/lowering/lower-inspect.js +1 -1
  86. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  87. package/dist/frontend/lowering/lower-island.d.ts +6 -3
  88. package/dist/frontend/lowering/lower-island.js +165 -6
  89. package/dist/frontend/lowering/lower-island.js.map +1 -1
  90. package/dist/frontend/lowering/lower-modules.d.ts +6 -0
  91. package/dist/frontend/lowering/lower-modules.js +184 -38
  92. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  93. package/dist/frontend/lowering/lower-namespaces.js +7 -0
  94. package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
  95. package/dist/frontend/lowering/lower-server.d.ts +1 -1
  96. package/dist/frontend/lowering/lower-server.js +130 -27
  97. package/dist/frontend/lowering/lower-server.js.map +1 -1
  98. package/dist/frontend/lowering/lower-stmts.js +118 -15
  99. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  100. package/dist/frontend/lowering/lower-stream.d.ts +3 -0
  101. package/dist/frontend/lowering/lower-stream.js +7 -0
  102. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  103. package/dist/frontend/lowering/lowerer.d.ts +86 -9
  104. package/dist/frontend/lowering/lowerer.js +412 -72
  105. package/dist/frontend/lowering/lowerer.js.map +1 -1
  106. package/dist/frontend/lowering/surfaces.d.ts +26 -0
  107. package/dist/frontend/lowering/surfaces.js +140 -77
  108. package/dist/frontend/lowering/surfaces.js.map +1 -1
  109. package/dist/frontend/npm-static-declarations.d.ts +4 -0
  110. package/dist/frontend/npm-static-declarations.js +56 -0
  111. package/dist/frontend/npm-static-declarations.js.map +1 -1
  112. package/dist/frontend/npm-static-declarations.test.js +23 -2
  113. package/dist/frontend/npm-static-declarations.test.js.map +1 -1
  114. package/dist/frontend/npm-static.js +6 -5
  115. package/dist/frontend/npm-static.js.map +1 -1
  116. package/dist/frontend/npm.d.ts +15 -3
  117. package/dist/frontend/npm.js +80 -8
  118. package/dist/frontend/npm.js.map +1 -1
  119. package/dist/frontend/npm.test.js +76 -9
  120. package/dist/frontend/npm.test.js.map +1 -1
  121. package/dist/frontend/program.js +92 -10
  122. package/dist/frontend/program.js.map +1 -1
  123. package/dist/frontend/resolve.d.ts +6 -0
  124. package/dist/frontend/resolve.js +7 -4
  125. package/dist/frontend/resolve.js.map +1 -1
  126. package/dist/frontend/type-mapper.d.ts +5 -0
  127. package/dist/frontend/type-mapper.js +64 -24
  128. package/dist/frontend/type-mapper.js.map +1 -1
  129. package/dist/index.d.ts +5 -0
  130. package/dist/index.js +24 -3
  131. package/dist/index.js.map +1 -1
  132. package/dist/ir/ir.d.ts +93 -47
  133. package/dist/ir/ir.js +63 -4
  134. package/dist/ir/ir.js.map +1 -1
  135. package/dist/ir/ir.test.js +14 -1
  136. package/dist/ir/ir.test.js.map +1 -1
  137. package/dist/ir/serialize.d.ts +1 -1
  138. package/dist/ir/serialize.js +1 -1
  139. package/dist/ir/serialize.js.map +1 -1
  140. package/dist/ir/validate.js +165 -13
  141. package/dist/ir/validate.js.map +1 -1
  142. package/dist/library/int-infer.test.js +4 -4
  143. package/dist/library/int-infer.test.js.map +1 -1
  144. package/dist/library/library-cache.test.js +5 -5
  145. package/dist/library/library-cache.test.js.map +1 -1
  146. package/package.json +17 -17
  147. package/surface-manifest.json +132 -38
@@ -62,15 +62,14 @@ declare namespace NodeJS {
62
62
  * keeps the loop alive. */
63
63
  interface ReadableStream {
64
64
  on(event: "data", listener: (chunk: Buffer) => void): void;
65
+ on(event: "data", listener: (chunk: string) => void): void;
65
66
  on(event: "end", listener: () => void): void;
66
67
  once(event: "data", listener: (chunk: Buffer) => void): void;
68
+ once(event: "data", listener: (chunk: string) => void): void;
67
69
  once(event: "end", listener: () => void): void;
68
- /* Declared surface without a lowering (chunks stay bytes; decode
69
- * with TextDecoder) — string-mode consumers typecheck and fence at
70
- * the reached site. With setEncoding in force Node hands strings to
71
- * 'data', hence the string arm on the listener above being absent:
72
- * the lowered surface is bytes-only. */
73
- setEncoding(encoding: string): void;
70
+ /* setEncoding('utf8') makes subsequent data chunks strings, including
71
+ * multibyte sequences split across native pipe reads. */
72
+ setEncoding(encoding: string): this;
74
73
  }
75
74
  }
76
75
 
@@ -181,11 +180,13 @@ declare var process: {
181
180
  * callers forward a `string | null` result field. */
182
181
  kill(pid: number, signal?: string | number | null): true;
183
182
  env: { [name: string]: string | undefined };
183
+ /** Numeric writes set the status returned by ordinary program exit. */
184
+ exitCode?: number;
184
185
  /* `never`, like @types/node: code behind an early-exit guard narrows
185
186
  * (`if (!x) process.exit(1)` proves x afterwards) — typed `void` the
186
187
  * guard narrows nothing and correct programs fail preflight. The
187
- * lowering already handles the optional code (bare exit() is exit(0),
188
- * Node's behavior when exitCode was never set). */
188
+ * lowering already handles the optional code (bare exit() uses exitCode,
189
+ * or zero when it was never set). */
189
190
  exit(code?: number | null): never;
190
191
  cwd(): string;
191
192
  /* The user tick queue: callbacks run before promise jobs at every loop
@@ -280,6 +281,14 @@ declare var process: {
280
281
  /* emitWarning — Node's full grammar (string or Error warning; type/
281
282
  * ctor/options second; code/ctor third). */
282
283
  emitWarning(warning: string | Error, ...args: any[]): void;
284
+ /** Present in a child created by child_process.fork(). */
285
+ readonly connected: boolean;
286
+ send?(message: object, callback?: (error: Error | null) => void): boolean;
287
+ disconnect(): void;
288
+ on(event: "message", listener: (message: any) => void): void;
289
+ on(event: "disconnect", listener: () => void): void;
290
+ once(event: "message", listener: (message: any) => void): void;
291
+ once(event: "disconnect", listener: () => void): void;
283
292
  };
284
293
 
285
294
  /* Node's process module default export is the global process object. These
@@ -770,6 +779,7 @@ interface Request {
770
779
  arrayBuffer(): Promise<ArrayBuffer>;
771
780
  bytes(): Promise<Uint8Array>;
772
781
  }
782
+ type RequestInfo = string | URL | Request;
773
783
  interface RequestInit {
774
784
  method?: string;
775
785
  headers?:
@@ -782,7 +792,7 @@ interface RequestInit {
782
792
  signal?: AbortSignal;
783
793
  }
784
794
  declare var Request: {
785
- new (input: string | URL | Request, init?: RequestInit): Request;
795
+ new (input: RequestInfo, init?: RequestInit): Request;
786
796
  readonly prototype: Request;
787
797
  };
788
798
  declare function fetch(input: string | URL, init?: RequestInit): Promise<Response>;
@@ -947,15 +957,19 @@ declare var performance: import("node:perf_hooks").Performance;
947
957
  * createRequire(import.meta.url) (or __filename) whose require calls
948
958
  * take STATIC string literals — the indirection erases at compile time.
949
959
  * A builtin spec makes the binding a namespace import in const clothing;
950
- * a relative .json document bakes and parses (JSON.parse's `unknown`
951
- * stance — validate with a checked cast); an installed npm package loads
952
- * through the island's require-condition entry under --dynamic; a bare
953
- * name nothing installed resolves compiles to Node's catchable
954
- * MODULE_NOT_FOUND throw (the optional-dependency try/require pattern).
960
+ * relative and package-import program modules use the compiled module
961
+ * graph; a relative .json document bakes and parses (JSON.parse's
962
+ * `unknown` stance — validate with a checked cast); an installed npm
963
+ * package loads through the island's require-condition entry under
964
+ * --dynamic, or through the compiled graph under --npm-static; a bare name
965
+ * nothing installed resolves compiles to Node's catchable MODULE_NOT_FOUND
966
+ * throw (the optional-dependency try/require pattern).
955
967
  * Dynamic specifiers fence: a compiled binary's module graph is fixed at
956
968
  * build time. builtinModules is the baked Node v24 list (a fresh
957
969
  * mutable array per read where Node ships one frozen singleton);
958
- * isBuiltin and syncBuiltinESMExports fence per site. Both spellings
970
+ * isBuiltin checks runtime strings against that pinned list, and
971
+ * syncBuiltinESMExports is a no-op because the static builtin surface is
972
+ * immutable. Both spellings
959
973
  * name the builtin, like in Node (the builtin wins over the npm package
960
974
  * named "module" for the bare specifier there too). */
961
975
  declare module "node:module" {
@@ -1007,6 +1021,15 @@ declare module "node:fs" {
1007
1021
  export function readFileSync(fd: number): Buffer;
1008
1022
  /* The options-object spelling of the utf8 form. */
1009
1023
  export function readFileSync(path: string, options: { encoding: "utf8" | "utf-8" }): string;
1024
+ /* Error-first callback target used by the static util.promisify
1025
+ * projection. Its options stay unknown because direct calls remain
1026
+ * outside the typed fs slice; this also lets checked-JS validation
1027
+ * ladders observe invalid runtime encodings without contextual narrowing. */
1028
+ export function readFile(
1029
+ path: string,
1030
+ options: unknown,
1031
+ callback: (error: Error | null, data: string) => void,
1032
+ ): void;
1010
1033
  /* The options form carries the mode (applied at CREATION only, like
1011
1034
  * Node — an existing file keeps its permissions) and/or the utf8
1012
1035
  * encoding spelling. */
@@ -1026,6 +1049,9 @@ declare module "node:fs" {
1026
1049
  export function mkdirSync(path: string, options: { recursive?: boolean; mode?: number }): void;
1027
1050
  export function unlinkSync(path: string): void;
1028
1051
  export function chmodSync(path: string, mode: number): void;
1052
+ export function fchmodSync(fd: number, mode: number): void;
1053
+ export function fsyncSync(fd: number): void;
1054
+ export function linkSync(existingPath: string, newPath: string): void;
1029
1055
  export function chownSync(path: string, uid: number, gid: number): void;
1030
1056
  /* The 2-argument form only (Node's mode flags have no lowering). The
1031
1057
  * destination is created or truncated carrying the SOURCE's mode. */
@@ -1064,36 +1090,61 @@ declare module "node:fs" {
1064
1090
  readonly R_OK: number;
1065
1091
  readonly W_OK: number;
1066
1092
  readonly X_OK: number;
1093
+ readonly O_RDONLY: number;
1094
+ readonly O_WRONLY: number;
1095
+ readonly O_RDWR: number;
1096
+ readonly O_CREAT: number;
1097
+ readonly O_EXCL: number;
1098
+ readonly O_NOFOLLOW: number;
1099
+ readonly O_NONBLOCK: number;
1100
+ readonly O_TRUNC: number;
1101
+ readonly O_APPEND: number;
1067
1102
  };
1068
1103
  /* A stat(2) snapshot (statSync follows symlinks, lstatSync does not —
1069
1104
  * Node's split) — immutable; the supported surface is exactly these
1070
- * members. blocks is the allocated size in 512-byte units; the time
1071
- * fields are milliseconds with their sub-second fractions. */
1105
+ * members. dev/ino identify the filesystem entry, blocks is the allocated
1106
+ * size in 512-byte units, and the time fields are milliseconds with their
1107
+ * sub-second fractions. */
1072
1108
  export interface Stats {
1073
1109
  isFile(): boolean;
1074
1110
  isDirectory(): boolean;
1075
1111
  isSymbolicLink(): boolean;
1112
+ readonly dev: number;
1113
+ readonly ino: number;
1076
1114
  readonly size: number;
1077
1115
  readonly blocks: number;
1078
1116
  readonly nlink: number;
1079
1117
  readonly atimeMs: number;
1080
1118
  readonly mtimeMs: number;
1119
+ readonly ctimeMs: number;
1081
1120
  }
1082
1121
  export function statSync(path: string): Stats;
1083
1122
  export function lstatSync(path: string): Stats;
1084
1123
  /* The fd pair behind spawn's fd-stdio form: openSync(path, flags) →
1085
- * the raw fd (string flags only — "r", "w", "a" and the +/x/s
1086
- * variants), closeSync(fd). */
1124
+ * the raw fd. Numeric flags use an inline OR of the O_* constants. */
1087
1125
  export function openSync(path: string, flags: string): number;
1126
+ export function openSync(path: string, flags: number, mode?: number): number;
1088
1127
  export function closeSync(fd: number): void;
1089
1128
  /* Read into a caller buffer from the fd's current position when position
1090
1129
  * is omitted/null, or from a numeric byte position without advancing the
1091
1130
  * fd. Answers the byte count, 0 at EOF. */
1131
+ export interface ReadSyncOptions {
1132
+ offset?: number;
1133
+ length?: number;
1134
+ position?: number | null;
1135
+ }
1136
+ export function readSync(fd: number, buffer: Uint8Array, options?: ReadSyncOptions): number;
1092
1137
  export function readSync(fd: number, buffer: Uint8Array, offset: number, length: number, position?: number | null): number;
1093
1138
  /* Write a caller-buffer window, or a utf8 string, at the fd's current
1094
1139
  * position when position is omitted/null (advancing it), or at a numeric
1095
1140
  * byte position without advancing it. Answers the byte count. */
1096
- export function writeSync(fd: number, buffer: Uint8Array, offset: number, length: number, position?: number | null): number;
1141
+ export interface WriteSyncOptions {
1142
+ offset?: number;
1143
+ length?: number;
1144
+ position?: number | null;
1145
+ }
1146
+ export function writeSync(fd: number, buffer: Uint8Array, options: WriteSyncOptions): number;
1147
+ export function writeSync(fd: number, buffer: Uint8Array, offset?: number, length?: number, position?: number | null): number;
1097
1148
  export function writeSync(fd: number, string: string, position?: number | null, encoding?: "utf8" | "utf-8"): number;
1098
1149
  /* statSync over an open fd — the same Stats snapshot. */
1099
1150
  export function fstatSync(fd: number): Stats;
@@ -1198,8 +1249,19 @@ declare module "fs/promises" {
1198
1249
  export function writeFile(path: string, data: string, encoding: "utf8" | "utf-8"): Promise<void>;
1199
1250
  export function mkdir(path: string, options?: { recursive?: boolean; mode?: number }): Promise<void>;
1200
1251
  export function readdir(path: string): Promise<string[]>;
1252
+ export function readdir(
1253
+ path: string,
1254
+ options: {
1255
+ encoding?: "utf8" | "utf-8";
1256
+ withFileTypes: true;
1257
+ recursive?: boolean;
1258
+ [option: string]: unknown;
1259
+ },
1260
+ ): Promise<import("node:fs").Dirent[]>;
1201
1261
  export function rm(path: string): Promise<void>;
1202
1262
  export function stat(path: string): Promise<import("node:fs").Stats>;
1263
+ export function realpath(path: string): Promise<string>;
1264
+ export function lstat(path: string): Promise<import("node:fs").Stats>;
1203
1265
  export function unlink(path: string): Promise<void>;
1204
1266
  export function chmod(path: string, mode: number): Promise<void>;
1205
1267
  export function rename(oldPath: string, newPath: string): Promise<void>;
@@ -1328,7 +1390,7 @@ declare module "node:os" {
1328
1390
  /* The WHATWG URL class (a Node global; the es2023 lib doesn't declare it),
1329
1391
  * typed as exactly the supported surface: construction from ONE absolute-
1330
1392
  * URL string (invalid input throws a catchable TypeError, like Node), the
1331
- * protocol/pathname/href/host/hostname/search getters, searchParams (the
1393
+ * protocol/origin/username/pathname/href/host/hostname/port/search/hash getters, searchParams (the
1332
1394
  * LIVE query view — mutations through it re-serialize into the URL, so
1333
1395
  * href reflects immediately; every read answers the same object, Node's
1334
1396
  * caching), and toString() (the href serialization).
@@ -1340,16 +1402,21 @@ declare module "node:os" {
1340
1402
  * documented in SEMANTICS.md. */
1341
1403
  interface URL {
1342
1404
  readonly protocol: string;
1405
+ readonly origin: string;
1406
+ readonly username: string;
1407
+ readonly password: string;
1343
1408
  readonly pathname: string;
1344
1409
  readonly href: string;
1345
1410
  readonly host: string;
1346
1411
  readonly hostname: string;
1412
+ readonly port: string;
1347
1413
  readonly search: string;
1414
+ readonly hash: string;
1348
1415
  readonly searchParams: URLSearchParams;
1349
1416
  toString(): string;
1350
1417
  }
1351
1418
  declare var URL: {
1352
- new (input: string): URL;
1419
+ new (input: string, base?: string | URL): URL;
1353
1420
  };
1354
1421
 
1355
1422
  /* URLSearchParams — the WHATWG application/x-www-form-urlencoded list.
@@ -1546,16 +1613,16 @@ declare module "child_process" {
1546
1613
 
1547
1614
  /* The asynchronous slice: spawn with stdio "ignore"/"inherit"/fd/"pipe"
1548
1615
  * tuples (piped stdin is writable through child.stdin; piped stdout/stderr
1549
- * deliver through child.stdout/stderr) and
1550
- * the two terminal events. "exit" fires once with the exit code, or
1616
+ * deliver through child.stdout/stderr) and the terminal events. "exit"
1617
+ * fires once with the exit code, or
1551
1618
  * null when the child died to a signal; "error" fires ONLY when the
1552
1619
  * child could not be spawned at all (Node's split: a spawn failure
1553
- * emits "error" and never "exit"). Listeners take at most one
1554
- * parameter; Node's second "exit" parameter (the signal name) has no
1555
- * lowering. `on` returns void here (Node returns the child; chaining
1556
- * is fenced). The event loop keeps the process alive until every
1557
- * spawned child is reaped, like Node — reaping polls at loop
1558
- * quiescence (SEMANTICS.md documents the divergence). An "error"
1620
+ * emits "error" and never "exit"). "close" fires after exit/error and
1621
+ * every piped stdio handle reaches EOF. Exit/close listeners may take
1622
+ * Node's code and signal parameters. `on`/`once` return void here (Node
1623
+ * returns the child; chaining is fenced). The event loop keeps the process
1624
+ * alive until every spawned child is reaped, like Node — reaping polls at
1625
+ * loop quiescence (SEMANTICS.md documents the divergence). An "error"
1559
1626
  * event with no registered listener prints the error and exits 1,
1560
1627
  * exactly the unhandled-'error' EventEmitter behavior. */
1561
1628
  export interface ChildStdin {
@@ -1573,7 +1640,15 @@ declare module "child_process" {
1573
1640
  /* The exit listener may also take Node's second parameter — the
1574
1641
  * terminating signal's name, null for a normal exit. */
1575
1642
  on(event: "exit", listener: (code: number | null, signal: string | null) => void): void;
1643
+ on(event: "close", listener: (code: number | null, signal: string | null) => void): void;
1576
1644
  on(event: "error", listener: (err: Error) => void): void;
1645
+ once(event: "exit", listener: (code: number | null, signal: string | null) => void): void;
1646
+ once(event: "close", listener: (code: number | null, signal: string | null) => void): void;
1647
+ once(event: "error", listener: (err: Error) => void): void;
1648
+ on(event: "message", listener: (message: any) => void): void;
1649
+ on(event: "disconnect", listener: () => void): void;
1650
+ once(event: "message", listener: (message: any) => void): void;
1651
+ once(event: "disconnect", listener: () => void): void;
1577
1652
  /* The lifecycle members, Node's exact shapes: pid is undefined exactly
1578
1653
  * when the spawn failed; exitCode is null while running, the code
1579
1654
  * after a normal exit, null for a signal death, and -errno once a
@@ -1589,6 +1664,9 @@ declare module "child_process" {
1589
1664
  readonly killed: boolean;
1590
1665
  kill(signal?: string | number): boolean;
1591
1666
  unref(): void;
1667
+ readonly connected: boolean;
1668
+ send(message: object, callback?: (error: Error | null) => void): boolean;
1669
+ disconnect(): void;
1592
1670
  [Symbol.dispose](): void;
1593
1671
  /* The piped streams — non-null exactly when the matching stdio slot
1594
1672
  * was "pipe" (Node's shape). */
@@ -1608,11 +1686,27 @@ declare module "child_process" {
1608
1686
  stdio: "ignore" | "inherit" | "pipe" | ("ignore" | "inherit" | "pipe" | number)[];
1609
1687
  /* detached gives the child its own session and process group
1610
1688
  * (POSIX_SPAWN_SETSID); env REPLACES the child environment; cwd
1611
- * sets its working directory; windowsHide is a POSIX no-op. */
1689
+ * sets its working directory; windowsHide is a POSIX no-op; shell
1690
+ * runs the complete command string through /bin/sh or cmd.exe. */
1612
1691
  detached?: boolean;
1613
1692
  env?: { [k: string]: string | undefined };
1614
1693
  cwd?: string;
1615
1694
  windowsHide?: boolean;
1695
+ shell?: boolean;
1696
+ },
1697
+ ): ChildProcess;
1698
+
1699
+ export function fork(
1700
+ modulePath: string | URL,
1701
+ args?: string[],
1702
+ options?: {
1703
+ cwd?: string;
1704
+ env?: { [k: string]: string | undefined };
1705
+ execArgv?: string[];
1706
+ silent?: boolean;
1707
+ stdio?: "pipe" | "ignore" | "inherit" | ("pipe" | "ignore" | "inherit" | "ipc")[];
1708
+ serialization?: "json" | "advanced";
1709
+ windowsHide?: boolean;
1616
1710
  },
1617
1711
  ): ChildProcess;
1618
1712
 
@@ -1657,9 +1751,13 @@ declare module "child_process" {
1657
1751
  }
1658
1752
  export function execFileSync(file: string, args?: string[], options?: ExecSyncOptions): string;
1659
1753
  export function execSync(command: string, options?: ExecSyncOptions): string;
1660
- /* The callback form exists to be PROMISIFIED — `const execFileAsync =
1661
- * promisify(execFile)` is the one lowered use (see "util"); calling it
1662
- * directly with a callback has no lowering and fences per site. */
1754
+ export type ExecFileCallback = (error: Error | null, stdout: string, stderr: string) => void;
1755
+ /* The callback form starts an asynchronous child and captures utf8
1756
+ * stdout/stderr. The no-callback overload remains for util.promisify's
1757
+ * static target recognition; reached no-callback calls still fence. */
1758
+ export function execFile(file: string, callback: ExecFileCallback): ChildProcess;
1759
+ export function execFile(file: string, args: string[] | null, callback: ExecFileCallback): ChildProcess;
1760
+ export function execFile(file: string, args: string[] | null, options: ExecSyncOptions, callback: ExecFileCallback): ChildProcess;
1663
1761
  export function execFile(
1664
1762
  file: string,
1665
1763
  args?: string[] | null,
@@ -1678,13 +1776,14 @@ declare module "node:child_process" {
1678
1776
  export * from "child_process";
1679
1777
  }
1680
1778
 
1681
- /* node:util — promisify, for exactly ONE target: child_process.execFile.
1682
- * `const execFileAsync = promisify(execFile)` binds an async exec whose
1683
- * calls run the file (no shell, PATH-searched) and settle with
1684
- * { stdout, stderr } — fulfilled on exit 0, rejected with Node's
1685
- * Command-failed / spawn-ENOENT errors otherwise. Other promisify
1686
- * targets and bare promisify values fence per site. */
1779
+ /* node:util — compile-time projections for child_process.execFile and
1780
+ * fs.readFile. The former retains Node's custom { stdout, stderr } result;
1781
+ * the latter resolves the callback's data argument. Other targets and bare
1782
+ * promisify values fence per site. */
1687
1783
  declare module "util" {
1784
+ export function promisify(
1785
+ fn: typeof import("node:fs").readFile,
1786
+ ): (path: string, encoding: "utf8" | "utf-8") => Promise<string>;
1688
1787
  export function promisify(
1689
1788
  fn: (file: string, args?: string[] | null, options?: object) => unknown,
1690
1789
  ): (
@@ -1781,9 +1880,10 @@ declare module "node:util/types" {
1781
1880
  * Object.is over scalars; deepStrictEqual compares composites
1782
1881
  * structurally per their static types. The messages here are plain
1783
1882
  * strings (Node accepts Errors — that form fences per site), and the
1784
- * loose-equality quartet (equal/notEqual/deepEqual/notDeepEqual) is
1785
- * declared so real code typechecks but fences at its use sites (== has
1786
- * no lowering; assert/strict's equal IS strictEqual and lowers). */
1883
+ * shallow legacy pair (equal/notEqual) follows Node's == coercions for
1884
+ * primitive and primitive-union operands, including Node v24's NaN
1885
+ * exception. deepEqual/notDeepEqual remain declared-but-fenced;
1886
+ * assert/strict's loose names alias the strict forms and lower. */
1787
1887
  /* node:test — the in-process test runner (prefix-only in Node too:
1788
1888
  * require("test") is MODULE_NOT_FOUND). test/it register tests (sync and
1789
1889
  * async bodies, skip/todo/only options and method twins), describe/suite
@@ -2023,14 +2123,38 @@ declare module "node:readline" {
2023
2123
  export * from "readline";
2024
2124
  }
2025
2125
 
2026
- /* node:zlib — deflateSync/inflateSync lower (Buffer in, Buffer out,
2027
- * Node's default options; libz links only into zlib-using binaries);
2028
- * gzip and friends typecheck and fence at their use sites. */
2126
+ /* node:zlib — the one-shot zlib/raw/gzip codecs lower for string/Buffer
2127
+ * inputs with Node's default options; libz links only into zlib-using
2128
+ * binaries. Callback forms use the executable worker pool. Options stay
2129
+ * declared so reached uses receive a named SC2020 refusal; Brotli,
2130
+ * streaming, and Zstd remain outside the lowered surface. */
2029
2131
  declare module "zlib" {
2030
- export function deflateSync(data: string | Uint8Array): Buffer;
2031
- export function inflateSync(data: Uint8Array): Buffer;
2032
- export function gzipSync(data: string | Uint8Array): Buffer;
2033
- export function gunzipSync(data: Uint8Array): Buffer;
2132
+ export interface ZlibOptions { [option: string]: unknown }
2133
+ export type ZlibCallback = (error: NodeJS.ErrnoException | null, result: Buffer) => void;
2134
+ export function deflate(data: string | Uint8Array, callback: ZlibCallback): void;
2135
+ export function deflate(data: string | Uint8Array, options: ZlibOptions, callback: ZlibCallback): void;
2136
+ export function deflateSync(data: string | Uint8Array, options?: ZlibOptions): Buffer;
2137
+ export function inflate(data: string | Uint8Array, callback: ZlibCallback): void;
2138
+ export function inflate(data: string | Uint8Array, options: ZlibOptions, callback: ZlibCallback): void;
2139
+ export function inflateSync(data: string | Uint8Array, options?: ZlibOptions): Buffer;
2140
+ export function deflateRaw(data: string | Uint8Array, callback: ZlibCallback): void;
2141
+ export function deflateRaw(data: string | Uint8Array, options: ZlibOptions, callback: ZlibCallback): void;
2142
+ export function deflateRawSync(data: string | Uint8Array, options?: ZlibOptions): Buffer;
2143
+ export function inflateRaw(data: string | Uint8Array, callback: ZlibCallback): void;
2144
+ export function inflateRaw(data: string | Uint8Array, options: ZlibOptions, callback: ZlibCallback): void;
2145
+ export function inflateRawSync(data: string | Uint8Array, options?: ZlibOptions): Buffer;
2146
+ export function gzip(data: string | Uint8Array, callback: ZlibCallback): void;
2147
+ export function gzip(data: string | Uint8Array, options: ZlibOptions, callback: ZlibCallback): void;
2148
+ export function gzipSync(data: string | Uint8Array, options?: ZlibOptions): Buffer;
2149
+ export function gunzip(data: string | Uint8Array, callback: ZlibCallback): void;
2150
+ export function gunzip(data: string | Uint8Array, options: ZlibOptions, callback: ZlibCallback): void;
2151
+ export function gunzipSync(data: string | Uint8Array, options?: ZlibOptions): Buffer;
2152
+ export function unzip(data: string | Uint8Array, callback: ZlibCallback): void;
2153
+ export function unzip(data: string | Uint8Array, options: ZlibOptions, callback: ZlibCallback): void;
2154
+ export function unzipSync(data: string | Uint8Array, options?: ZlibOptions): Buffer;
2155
+ export function crc32(data: string | Uint8Array, value?: number): number;
2156
+ export function brotliCompressSync(data: string | Uint8Array): Buffer;
2157
+ export function brotliDecompressSync(data: Uint8Array): Buffer;
2034
2158
  }
2035
2159
  declare module "node:zlib" {
2036
2160
  export * from "zlib";
@@ -2236,7 +2360,11 @@ declare module "http" {
2236
2360
  readonly statusMessage: string | undefined;
2237
2361
  readonly socket: Socket;
2238
2362
  readonly headers: { [name: string]: string | undefined };
2363
+ readonly headersDistinct: { [name: string]: string[] | undefined };
2239
2364
  readonly rawHeaders: string[];
2365
+ readonly trailers: { [name: string]: string | undefined };
2366
+ readonly trailersDistinct: { [name: string]: string[] | undefined };
2367
+ readonly rawTrailers: string[];
2240
2368
  resume(): void;
2241
2369
  destroy(): void;
2242
2370
  /* setEncoding('utf8'): 'data' delivers strings (other real encodings
@@ -2258,6 +2386,7 @@ declare module "http" {
2258
2386
  }
2259
2387
  export interface ServerResponse {
2260
2388
  readonly headersSent: boolean;
2389
+ readonly writableCorked: number;
2261
2390
  /* Node's writable head properties: the implicit head reads them. */
2262
2391
  statusCode: number;
2263
2392
  statusMessage: string;
@@ -2270,6 +2399,10 @@ declare module "http" {
2270
2399
  writeHead(statusCode: number, headers?: OutgoingHttpHeaders | string[]): ServerResponse;
2271
2400
  writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders | string[]): ServerResponse;
2272
2401
  write(data: string | Uint8Array): void;
2402
+ flushHeaders(): void;
2403
+ cork(): void;
2404
+ uncork(): void;
2405
+ addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
2273
2406
  /* end's callback forms fire once the body went out (the 'finish'
2274
2407
  * emit, deferred past the handler's synchronous tail). */
2275
2408
  end(data?: string | Uint8Array, callback?: () => void): void;
@@ -2345,6 +2478,11 @@ declare module "http" {
2345
2478
  export const globalAgent: Agent;
2346
2479
  export interface ClientRequest {
2347
2480
  readonly destroyed: boolean;
2481
+ readonly writableCorked: number;
2482
+ flushHeaders(): void;
2483
+ addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
2484
+ cork(): void;
2485
+ uncork(): void;
2348
2486
  write(data: string | Uint8Array): void;
2349
2487
  end(data?: string | Uint8Array): void;
2350
2488
  destroy(): void;
@@ -2562,6 +2700,7 @@ declare module "http2" {
2562
2700
  }
2563
2701
  export interface Http2ServerResponse {
2564
2702
  readonly headersSent: boolean;
2703
+ readonly writableCorked: number;
2565
2704
  /* The same lowered surface as http.ServerResponse — the allowHTTP1
2566
2705
  * lowering serves every connection as HTTP/1.1, where the compat
2567
2706
  * response IS this parser's response handle. */
@@ -2574,6 +2713,10 @@ declare module "http2" {
2574
2713
  writeHead(statusCode: number, headers?: import("http").OutgoingHttpHeaders | string[]): Http2ServerResponse;
2575
2714
  writeHead(statusCode: number, statusMessage: string, headers?: import("http").OutgoingHttpHeaders | string[]): Http2ServerResponse;
2576
2715
  write(data: string | Uint8Array): void;
2716
+ flushHeaders(): void;
2717
+ cork(): void;
2718
+ uncork(): void;
2719
+ addTrailers(headers: import("http").OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
2577
2720
  end(data?: string | Uint8Array, callback?: () => void): void;
2578
2721
  end(callback: () => void): void;
2579
2722
  destroy(): void;
@@ -3162,8 +3305,14 @@ declare module "node:cluster" {
3162
3305
  export = cluster;
3163
3306
  }
3164
3307
 
3165
- /* node:tty — the fd probe (the same isatty(3) behind process.*.isTTY). */
3308
+ /* node:tty — the fd probe (the same isatty(3) behind process.*.isTTY)
3309
+ * and the supported structural view of a process output stream. */
3166
3310
  declare module "tty" {
3311
+ export interface WriteStream {
3312
+ write(data: string | Uint8Array, callback?: (error?: Error | null) => void): boolean;
3313
+ write(data: string | Uint8Array, encoding: BufferEncoding, callback?: (error?: Error | null) => void): boolean;
3314
+ readonly isTTY: boolean;
3315
+ }
3167
3316
  export function isatty(fd: number): boolean;
3168
3317
  }
3169
3318
  declare module "node:tty" {
@@ -64,6 +64,10 @@ export declare function fsRenameThunkFor(emitter: CEmitter, cbT: IrType): string
64
64
  * checked-dynamic null) first argument and either transfers or boxes the
65
65
  * Buffer according to the program-specific callback signature. */
66
66
  export declare function cryptoBytesThunkFor(emitter: CEmitter, cbT: IrType): string;
67
+ /** Error-first Buffer callback adapter for worker-backed zlib operations.
68
+ * The runtime transfers the success Buffer and borrows the failure Error;
69
+ * exactly one is non-NULL. */
70
+ export declare function zlibBytesThunkFor(emitter: CEmitter, cbT: IrType): string;
67
71
  /** Interned CONNECT-listener adapter for a UNION socket slot — the h2
68
72
  * compat listener (`(req, resOrSocket: Http2ServerResponse | net.Socket)
69
73
  * => void`): the runtime fires (cb, req, sock, head) like an upgrade;
@@ -122,6 +126,27 @@ export declare function resolveThunkFor(emitter: CEmitter, inner: IrType): strin
122
126
  * (the callee owns +1 per the universal convention; f64/bool copy), and
123
127
  * calls cb->fn behind its exact C signature. Interned per func-type key. */
124
128
  export declare function emitterInvokeThunkFor(emitter: CEmitter, cbT: IrType): string;
129
+ /** child_process.execFile's error-first callback adapter. The runtime owns
130
+ * one +1 callback plus +1 error/output values at settlement; the adapter
131
+ * wraps the nullable error with this program's union tags, transfers every
132
+ * declared argument into the compiled closure, and releases ignored suffix
133
+ * values for callbacks that declare fewer than three parameters. */
134
+ export declare function execFileThunkFor(emitter: CEmitter, cbT: IrType & {
135
+ kind: "func";
136
+ }): string;
137
+ /** Fork IPC message adapter: parse results arrive as a borrowed dyn tree,
138
+ * then validate into the listener's static JSON shape. Async listener
139
+ * promises are deliberately released without attaching a handler, matching
140
+ * EventEmitter's ignored return value. */
141
+ export declare function ipcMessageThunkFor(emitter: CEmitter, cbT: IrType & {
142
+ kind: "func";
143
+ }): string;
144
+ /** Fork IPC send completion adapter. The nullable +1 runtime Error moves
145
+ * into the callback's Error|null union, or is released for a zero-argument
146
+ * callback. */
147
+ export declare function ipcSendThunkFor(emitter: CEmitter, cbT: IrType & {
148
+ kind: "func";
149
+ }): string;
125
150
  /** The stream-'data' listener invoke adapter for one listener func type:
126
151
  * the runtime's 'data' emission carries BOTH payload slots (ScrBytes *b,
127
152
  * ScrStr *s — exactly one non-NULL; encoded streams deliver strings),