@scriptc/compiler 0.0.10 → 0.0.12

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 (111) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +63 -15
  2. package/ambient/scriptc.d.ts +2 -2
  3. package/dist/backend/cc.d.ts +2 -2
  4. package/dist/backend/emission/emit-async.js +1 -1
  5. package/dist/backend/emission/emit-exprs.js +131 -54
  6. package/dist/backend/emission/emit-exprs.js.map +1 -1
  7. package/dist/backend/emission/emit-island.js +1 -1
  8. package/dist/backend/emission/emit-shapes.js +1 -1
  9. package/dist/backend/emission/emit-walkers.d.ts +14 -14
  10. package/dist/backend/emission/emit-walkers.js +44 -44
  11. package/dist/backend/emission/emit-walkers.js.map +1 -1
  12. package/dist/backend/emission/emitter.d.ts +3 -3
  13. package/dist/backend/emission/emitter.js +33 -9
  14. package/dist/backend/emission/emitter.js.map +1 -1
  15. package/dist/backend/emission/may-throw.js +1 -1
  16. package/dist/backend/llvm/dyn.d.ts +10 -10
  17. package/dist/backend/llvm/dyn.js +26 -26
  18. package/dist/backend/llvm/dyn.js.map +1 -1
  19. package/dist/backend/llvm/emitter.js +156 -47
  20. package/dist/backend/llvm/emitter.js.map +1 -1
  21. package/dist/backend/llvm/shapes.js +1 -1
  22. package/dist/backend/llvm/walkers.js +2 -2
  23. package/dist/backend/llvm/walkers.js.map +1 -1
  24. package/dist/coverage/surface-manifest.js +16 -2
  25. package/dist/coverage/surface-manifest.js.map +1 -1
  26. package/dist/diagnostics/diagnostic.d.ts +21 -8
  27. package/dist/diagnostics/diagnostic.js +48 -14
  28. package/dist/diagnostics/diagnostic.js.map +1 -1
  29. package/dist/frontend/lowering/lib-boundary.js +5 -5
  30. package/dist/frontend/lowering/lib-boundary.js.map +1 -1
  31. package/dist/frontend/lowering/lower-assert.js +12 -12
  32. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  33. package/dist/frontend/lowering/lower-builtins.d.ts +63 -7
  34. package/dist/frontend/lowering/lower-builtins.js +327 -35
  35. package/dist/frontend/lowering/lower-builtins.js.map +1 -1
  36. package/dist/frontend/lowering/lower-calls.d.ts +4 -4
  37. package/dist/frontend/lowering/lower-calls.js +104 -70
  38. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  39. package/dist/frontend/lowering/lower-classes.d.ts +7 -0
  40. package/dist/frontend/lowering/lower-classes.js +82 -6
  41. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  42. package/dist/frontend/lowering/lower-containers.d.ts +9 -5
  43. package/dist/frontend/lowering/lower-containers.js +88 -26
  44. package/dist/frontend/lowering/lower-containers.js.map +1 -1
  45. package/dist/frontend/lowering/lower-emitter.d.ts +70 -3
  46. package/dist/frontend/lowering/lower-emitter.js +438 -31
  47. package/dist/frontend/lowering/lower-emitter.js.map +1 -1
  48. package/dist/frontend/lowering/lower-exprs.d.ts +87 -12
  49. package/dist/frontend/lowering/lower-exprs.js +630 -125
  50. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  51. package/dist/frontend/lowering/lower-inspect.js +5 -5
  52. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  53. package/dist/frontend/lowering/lower-island.js +12 -3
  54. package/dist/frontend/lowering/lower-island.js.map +1 -1
  55. package/dist/frontend/lowering/lower-modules.d.ts +8 -5
  56. package/dist/frontend/lowering/lower-modules.js +157 -63
  57. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  58. package/dist/frontend/lowering/lower-namespaces.d.ts +24 -0
  59. package/dist/frontend/lowering/lower-namespaces.js +158 -16
  60. package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
  61. package/dist/frontend/lowering/lower-server.js +11 -11
  62. package/dist/frontend/lowering/lower-server.js.map +1 -1
  63. package/dist/frontend/lowering/lower-stmts.d.ts +1 -1
  64. package/dist/frontend/lowering/lower-stmts.js +271 -36
  65. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  66. package/dist/frontend/lowering/lower-stream.js +171 -20
  67. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  68. package/dist/frontend/lowering/lowerer.d.ts +27 -10
  69. package/dist/frontend/lowering/lowerer.js +156 -54
  70. package/dist/frontend/lowering/lowerer.js.map +1 -1
  71. package/dist/frontend/lowering/surfaces.d.ts +44 -0
  72. package/dist/frontend/lowering/surfaces.js +236 -5
  73. package/dist/frontend/lowering/surfaces.js.map +1 -1
  74. package/dist/frontend/npm.d.ts +12 -0
  75. package/dist/frontend/npm.js +30 -0
  76. package/dist/frontend/npm.js.map +1 -1
  77. package/dist/frontend/program.d.ts +25 -0
  78. package/dist/frontend/program.js +145 -136
  79. package/dist/frontend/program.js.map +1 -1
  80. package/dist/frontend/shared.d.ts +1 -1
  81. package/dist/frontend/shared.js +8 -8
  82. package/dist/frontend/shared.js.map +1 -1
  83. package/dist/frontend/types.d.ts +2 -2
  84. package/dist/frontend/types.js +15 -15
  85. package/dist/frontend/types.js.map +1 -1
  86. package/dist/index.d.ts +2 -1
  87. package/dist/index.js +169 -5
  88. package/dist/index.js.map +1 -1
  89. package/dist/ir/nodes.d.ts +174 -106
  90. package/dist/ir/nodes.js +69 -24
  91. package/dist/ir/nodes.js.map +1 -1
  92. package/dist/ir/validate.js +55 -36
  93. package/dist/ir/validate.js.map +1 -1
  94. package/dist/library/fence-eval.js +12 -2
  95. package/dist/library/fence-eval.js.map +1 -1
  96. package/dist/library/int-infer.d.ts +119 -0
  97. package/dist/library/int-infer.js +1314 -0
  98. package/dist/library/int-infer.js.map +1 -0
  99. package/dist/library/int-infer.test.d.ts +1 -0
  100. package/dist/library/int-infer.test.js +279 -0
  101. package/dist/library/int-infer.test.js.map +1 -0
  102. package/dist/library/profile.d.ts +34 -5
  103. package/dist/library/profile.js +77 -13
  104. package/dist/library/profile.js.map +1 -1
  105. package/dist/library/sidecar-validate.js +1 -1
  106. package/dist/library/sidecar-validate.js.map +1 -1
  107. package/dist/library/sidecar.d.ts +24 -1
  108. package/dist/library/sidecar.js +163 -16
  109. package/dist/library/sidecar.js.map +1 -1
  110. package/package.json +2 -2
  111. package/surface-manifest.json +210 -12
@@ -246,7 +246,7 @@ declare var process: {
246
246
  on(event: "SIGINT" | "SIGTERM", listener: () => void): void;
247
247
  on(event: "exit", listener: (code: number) => void): void;
248
248
  /* 'warning' — Node's process-warning channel: listeners receive the
249
- * warning Error (as a DOM value); emitWarning and the runtime's
249
+ * warning Error (as a dyn value); emitWarning and the runtime's
250
250
  * deprecation sites dispatch synchronously (SEMANTICS.md). */
251
251
  on(event: "warning", listener: (warning: Error & { code?: string }) => void): void;
252
252
  /* 'unhandledRejection' — dispatched per never-observed rejection at
@@ -266,7 +266,7 @@ declare var process: {
266
266
  emitWarning(warning: string | Error, ...args: any[]): void;
267
267
  };
268
268
 
269
- /* ── globals a real CLI's sources reference (all @types/node or DOM-lib
269
+ /* ── globals a real CLI's sources reference (all @types/node or dyn-lib
270
270
  * territory; the fallback declares the slice so projects PREFLIGHT and
271
271
  * every reached use lands on the SC2020 fence — or a real lowering where
272
272
  * one exists — instead of "Cannot find name"). With @types/node these
@@ -341,7 +341,7 @@ declare var AbortController: { new (): AbortController };
341
341
  * them below): base64 → binary string and back, Latin-1 domain like the
342
342
  * WHATWG originals. The parameter is `unknown` because WebIDL ToStrings
343
343
  * whatever arrives (Node's atob(null) decodes "null") — the coercion
344
- * runs in the runtime over the DOM kind, and the Node suite exercises
344
+ * runs in the runtime over the dyn kind, and the Node suite exercises
345
345
  * it; malformed input throws the catchable DOMException
346
346
  * InvalidCharacterError, the zero-argument call Node's TypeError
347
347
  * [ERR_MISSING_ARGS]. */
@@ -447,7 +447,10 @@ interface Buffer<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> extends
447
447
  }
448
448
  interface BufferConstructor {
449
449
  from(data: string, encoding?: BufferEncoding): Buffer;
450
- from(data: Uint8Array | ArrayBuffer | readonly number[]): Buffer;
450
+ /* The ArrayBuffer form is the VIEW construction: x.buffer with an
451
+ * optional byte offset/length shares x's storage (the subarray rule). */
452
+ from(data: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
453
+ from(data: Uint8Array | readonly number[]): Buffer;
451
454
  alloc(size: number, fill?: string | number | Uint8Array, encoding?: BufferEncoding): Buffer;
452
455
  compare(buf1: Uint8Array, buf2: Uint8Array): number;
453
456
  /* alloc without the zero-fill guarantee — the lowering zero-fills
@@ -708,7 +711,7 @@ declare module "timers/promises" {
708
711
  * traceSync/traceCallback run Node's publish choreography in the runtime
709
712
  * (context defaults to a fresh {}); tracePromise is declared (the member
710
713
  * exists in Node) but fences at the call site — the traced function's
711
- * promise cannot cross the DOM boundary yet. */
714
+ * promise cannot cross the checked-dynamic tree boundary yet. */
712
715
  declare module "node:diagnostics_channel" {
713
716
  export type ChannelListener = (message: unknown, name: string) => void;
714
717
  export interface Channel {
@@ -798,16 +801,41 @@ declare module "perf_hooks" {
798
801
  * performance.now() either way. */
799
802
  declare var performance: import("node:perf_hooks").Performance;
800
803
 
801
- /* node:module — the ADMIT-THEN-FENCE surface: the import compiles (the
802
- * module carries no evaluation), and every member keeps a per-site fence.
803
- * createRequire loads CommonJS from disk at runtime — a compiled
804
- * program's modules are fixed at build time, so the call's fence defers
805
- * to a runtime error in JS sources (the config-loader idiom is
806
- * reached only when a CJS config/plugin must load). Bare "module" stays a
807
- * package specifier (an npm package by that name exists); only the node:
808
- * spelling names the builtin. */
804
+ /* node:module. createRequire's lowered shape is the version/config-
805
+ * reading pattern real CLIs ship: a const binding over
806
+ * createRequire(import.meta.url) (or __filename) whose require calls
807
+ * take STATIC string literals — the indirection erases at compile time.
808
+ * A builtin spec makes the binding a namespace import in const clothing;
809
+ * a relative .json document bakes and parses (JSON.parse's `unknown`
810
+ * stance — validate with a checked cast); an installed npm package loads
811
+ * through the island's require-condition entry under --dynamic; a bare
812
+ * name nothing installed resolves compiles to Node's catchable
813
+ * MODULE_NOT_FOUND throw (the optional-dependency try/require pattern).
814
+ * Dynamic specifiers fence: a compiled binary's module graph is fixed at
815
+ * build time. builtinModules is the baked Node v24 list (a fresh
816
+ * mutable array per read where Node ships one frozen singleton);
817
+ * isBuiltin and syncBuiltinESMExports fence per site. Both spellings
818
+ * name the builtin, like in Node (the builtin wins over the npm package
819
+ * named "module" for the bare specifier there too). */
809
820
  declare module "node:module" {
810
821
  export function createRequire(filename: string | URL): (id: string) => unknown;
822
+ export const builtinModules: string[];
823
+ export function isBuiltin(moduleName: string): boolean;
824
+ export function syncBuiltinESMExports(): void;
825
+ }
826
+ declare module "module" {
827
+ export * from "node:module";
828
+ }
829
+ /* import.meta: module-loader metadata with no value representation —
830
+ * every read fences (SC1090) EXCEPT as createRequire's base, where it
831
+ * only NAMES the containing file (import.meta.url, import.meta.filename,
832
+ * and __filename all mean "this file" there). Declared so the pattern
833
+ * typechecks under the fallback surface; @types/node's own augmentation
834
+ * stands in when adopted. */
835
+ interface ImportMeta {
836
+ url: string;
837
+ filename: string;
838
+ dirname: string;
811
839
  }
812
840
 
813
841
  /* The synchronous node:fs surface — utf8-only, no options objects, no
@@ -2498,7 +2526,7 @@ declare module "http2" {
2498
2526
  setTimeout(msecs: number, callback?: () => void): void;
2499
2527
  ping(callback: (err: Error | null, duration: number, payload: Uint8Array) => void): boolean;
2500
2528
  /* The settings surface rides the checked-dynamic machinery (records
2501
- * cross as DOM values — the suite's mustCall listeners are dyn). */
2529
+ * cross as dyn values — the suite's mustCall listeners are dyn). */
2502
2530
  settings(settings?: any, callback?: any): void;
2503
2531
  readonly localSettings: any;
2504
2532
  readonly remoteSettings: any;
@@ -2761,7 +2789,7 @@ declare module "node:tty" {
2761
2789
  declare module "async_hooks" {
2762
2790
  /* AsyncLocalStorage: fiber-carried context snapshots — run/getStore/
2763
2791
  * exit/enterWith/disable lower onto the runtime's active-slot machinery
2764
- * (als.* libCalls); values cross as DOM values. */
2792
+ * (als.* libCalls); values cross as dyn values. */
2765
2793
  export class AsyncLocalStorage<T = any> {
2766
2794
  constructor();
2767
2795
  run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
@@ -3148,3 +3176,23 @@ declare module "node:stream/promises" {
3148
3176
  import streamPromises = require("stream/promises");
3149
3177
  export = streamPromises;
3150
3178
  }
3179
+ declare module "stream/consumers" {
3180
+ /* The promise consumers over a readable: accumulate every chunk and
3181
+ * settle — text (the utf8 decode), json (the text through JSON.parse:
3182
+ * `unknown`, validated with a checked cast; malformed input rejects
3183
+ * with the parse's SyntaxError), buffer (the concatenated bytes;
3184
+ * string chunks contribute their utf8 bytes, Node's Blob rule).
3185
+ * Stream errors reject; an early close rejects with
3186
+ * ERR_STREAM_PREMATURE_CLOSE. arrayBuffer and blob fence per site:
3187
+ * neither value has a representation in a compiled binary. */
3188
+ function text(stream: unknown): Promise<string>;
3189
+ function json(stream: unknown): Promise<unknown>;
3190
+ function buffer(stream: unknown): Promise<Buffer>;
3191
+ function arrayBuffer(stream: unknown): Promise<ArrayBuffer>;
3192
+ function blob(stream: unknown): Promise<unknown>;
3193
+ export { arrayBuffer, blob, buffer, json, text };
3194
+ }
3195
+ declare module "node:stream/consumers" {
3196
+ import streamConsumers = require("stream/consumers");
3197
+ export = streamConsumers;
3198
+ }
@@ -1,12 +1,12 @@
1
1
  /* scriptc's shipped declarations — the ALWAYS-SHIPPED CORE. Programs
2
2
  * compile against the REAL TypeScript standard library (lib.es2023, no
3
- * DOM, no @types): the checker sees the full standard surface, and the
3
+ * dyn, no @types): the checker sees the full standard surface, and the
4
4
  * LOWERER is the scope fence — any reached use of standard-library surface
5
5
  * without a lowering is a SC2020 diagnostic at its use site. This file
6
6
  * declares only what the es2023 lib does not:
7
7
  *
8
8
  * 1. scriptc's own primitives (comptime, __island_eval).
9
- * 2. setTimeout/clearTimeout and the Timeout handle (Node/DOM territory the
9
+ * 2. setTimeout/clearTimeout and the Timeout handle (Node/dyn territory the
10
10
  * lib files don't cover; plain declarations, so with @types/node present
11
11
  * they MERGE as overloads instead of colliding — the Timeout handle maps
12
12
  * to the numeric timer id either way, and .unref()/.ref()/.hasRef() are
@@ -65,12 +65,12 @@ export interface CcOptions {
65
65
  dynInvoke?: boolean;
66
66
  /** The program uses the diagnostics_channel surface (index.ts detects
67
67
  * dc.* libCalls on the IR): compiles scr_dc.c — pure data structure
68
- * over the DOM (no loop hooks, no install), cross-compiles everywhere.
68
+ * over the checked-dynamic tree (no loop hooks, no install), cross-compiles everywhere.
69
69
  * Channel-free binaries keep their exact size class. */
70
70
  dc?: boolean;
71
71
  /** The program uses the checked-dynamic async surfaces
72
72
  * (moduleUsesDynAsync on the IR, or the dynInvoke/dc gates — their TUs
73
- * call into this one): compiles scr_async_dyn.c — DOM-promise
73
+ * call into this one): compiles scr_async_dyn.c — dyn-promise
74
74
  * reactions, AsyncLocalStorage, the unhandledRejection/warning
75
75
  * process events. */
76
76
  dynAsync?: boolean;
@@ -902,7 +902,7 @@ export function streamCbThunkFor(E, kind, cbT) {
902
902
  const isDonePos = kind === "e" ? false
903
903
  : (kind === "w" || kind === "t") ? pos === 2 : (kind === "f" || kind === "l") ? pos === 0 : pos === 1;
904
904
  // The JS lane's implicitly-any parameters: each position boxes into
905
- // dyn by kind — the chunk as DOM bytes, the encoding as a string,
905
+ // dyn by kind — the chunk as dyn bytes, the encoding as a string,
906
906
  // the error as the boundary's {name, message} shape (null when
907
907
  // none), and the completion callback as a CALLABLE dyn whose glue
908
908
  // dispatches to the runtime's *_done entry (the closure's one cap