@scriptc/compiler 0.0.21 → 0.0.23

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 (92) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +117 -37
  2. package/dist/backend/cc-cache.test.d.ts +1 -0
  3. package/dist/backend/cc-cache.test.js +2507 -0
  4. package/dist/backend/cc-cache.test.js.map +1 -0
  5. package/dist/backend/cc.d.ts +69 -11
  6. package/dist/backend/cc.js +1937 -222
  7. package/dist/backend/cc.js.map +1 -1
  8. package/dist/backend/emission/emit-async.js +3 -1
  9. package/dist/backend/emission/emit-async.js.map +1 -1
  10. package/dist/backend/emission/emit-exprs.d.ts +10 -0
  11. package/dist/backend/emission/emit-exprs.js +482 -18
  12. package/dist/backend/emission/emit-exprs.js.map +1 -1
  13. package/dist/backend/emission/emit-stmts.js +13 -5
  14. package/dist/backend/emission/emit-stmts.js.map +1 -1
  15. package/dist/backend/emission/emit-types.js +4 -1
  16. package/dist/backend/emission/emit-types.js.map +1 -1
  17. package/dist/backend/emission/emit-walkers.js +108 -7
  18. package/dist/backend/emission/emit-walkers.js.map +1 -1
  19. package/dist/backend/emission/emitter.d.ts +27 -1
  20. package/dist/backend/emission/emitter.js +84 -3
  21. package/dist/backend/emission/emitter.js.map +1 -1
  22. package/dist/backend/llvm/dyn.d.ts +1 -0
  23. package/dist/backend/llvm/dyn.js +305 -8
  24. package/dist/backend/llvm/dyn.js.map +1 -1
  25. package/dist/backend/llvm/emitter.js +831 -23
  26. package/dist/backend/llvm/emitter.js.map +1 -1
  27. package/dist/backend/llvm/shapes.js +3 -2
  28. package/dist/backend/llvm/shapes.js.map +1 -1
  29. package/dist/compat/fetch-profile.d.ts +118 -0
  30. package/dist/compat/fetch-profile.js +531 -0
  31. package/dist/compat/fetch-profile.js.map +1 -0
  32. package/dist/coverage/surface-manifest.js +69 -0
  33. package/dist/coverage/surface-manifest.js.map +1 -1
  34. package/dist/diagnostics/diagnostic.d.ts +10 -0
  35. package/dist/diagnostics/diagnostic.js +27 -1
  36. package/dist/diagnostics/diagnostic.js.map +1 -1
  37. package/dist/frontend/lowering/lower-builtins.d.ts +24 -15
  38. package/dist/frontend/lowering/lower-builtins.js +217 -69
  39. package/dist/frontend/lowering/lower-builtins.js.map +1 -1
  40. package/dist/frontend/lowering/lower-calls.js +41 -0
  41. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  42. package/dist/frontend/lowering/lower-classes.js +32 -11
  43. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  44. package/dist/frontend/lowering/lower-exprs.d.ts +3 -3
  45. package/dist/frontend/lowering/lower-exprs.js +87 -15
  46. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  47. package/dist/frontend/lowering/lower-generators.js +7 -1
  48. package/dist/frontend/lowering/lower-generators.js.map +1 -1
  49. package/dist/frontend/lowering/lower-island.d.ts +123 -7
  50. package/dist/frontend/lowering/lower-island.js +1976 -26
  51. package/dist/frontend/lowering/lower-island.js.map +1 -1
  52. package/dist/frontend/lowering/lower-modules.js +17 -1
  53. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  54. package/dist/frontend/lowering/lower-stmts.js +33 -9
  55. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  56. package/dist/frontend/lowering/lowerer.d.ts +40 -0
  57. package/dist/frontend/lowering/lowerer.js +290 -18
  58. package/dist/frontend/lowering/lowerer.js.map +1 -1
  59. package/dist/frontend/lowering/surfaces.js +55 -12
  60. package/dist/frontend/lowering/surfaces.js.map +1 -1
  61. package/dist/frontend/program.d.ts +20 -4
  62. package/dist/frontend/program.js +391 -49
  63. package/dist/frontend/program.js.map +1 -1
  64. package/dist/frontend/resolve.d.ts +10 -0
  65. package/dist/frontend/resolve.js +37 -0
  66. package/dist/frontend/resolve.js.map +1 -1
  67. package/dist/frontend/ts7/enums.d.ts +9 -0
  68. package/dist/frontend/ts7/enums.js +8 -6
  69. package/dist/frontend/ts7/enums.js.map +1 -1
  70. package/dist/frontend/ts7/program.js +4 -1
  71. package/dist/frontend/ts7/program.js.map +1 -1
  72. package/dist/frontend/types.d.ts +16 -9
  73. package/dist/frontend/types.js +119 -38
  74. package/dist/frontend/types.js.map +1 -1
  75. package/dist/index.d.ts +7 -1
  76. package/dist/index.js +70 -14
  77. package/dist/index.js.map +1 -1
  78. package/dist/ir/nodes.d.ts +55 -26
  79. package/dist/ir/nodes.js +42 -29
  80. package/dist/ir/nodes.js.map +1 -1
  81. package/dist/ir/validate.js +106 -9
  82. package/dist/ir/validate.js.map +1 -1
  83. package/dist/library/int-infer.js +7 -1
  84. package/dist/library/int-infer.js.map +1 -1
  85. package/dist/library/int-infer.test.js +80 -0
  86. package/dist/library/int-infer.test.js.map +1 -1
  87. package/dist/library/sidecar-validate.js +5 -0
  88. package/dist/library/sidecar-validate.js.map +1 -1
  89. package/dist/library/sidecar.d.ts +3 -0
  90. package/dist/library/sidecar.js.map +1 -1
  91. package/package.json +2 -2
  92. package/surface-manifest.json +1097 -130
@@ -473,10 +473,11 @@ interface BufferConstructor {
473
473
  }
474
474
  declare var Buffer: BufferConstructor;
475
475
 
476
- /* The WHATWG encoders (Node globals). Only the COMPOSED forms lower —
477
- * `new TextEncoder().encode(s)` and `new TextDecoder().decode(bytes)`;
478
- * the label is typed as the utf-8 spellings (the one supported decoder;
479
- * other labels and the fatal/ignoreBOM options fence at the use site). */
476
+ /* The WHATWG encoders (Node globals). The COMPOSED forms lower —
477
+ * `new TextEncoder().encode(s)` and `new TextDecoder().decode(bytes)` —
478
+ * as do same-scope const store-then-call forms. The label is typed as the
479
+ * utf-8 spellings (the one supported decoder; other labels and the
480
+ * fatal/ignoreBOM options fence at the use site). */
480
481
  interface TextEncoder {
481
482
  encode(input?: string): Uint8Array;
482
483
  }
@@ -587,10 +588,9 @@ declare var MessageChannel: {
587
588
  readonly prototype: MessageChannel;
588
589
  };
589
590
 
590
- /* AbortSignal, the fetch-cancellation slice (AbortSignal.timeout is the
591
- * whole surface real CLIs construct; the statics beyond it — abort/any —
592
- * and the instance events are declared for the suite and fence per site
593
- * statically, with the island's real implementation behind --dynamic). */
591
+ /* AbortSignal, the native fetch-cancellation slice. The three statics,
592
+ * state/reason reads, throwIfAborted, and abort listeners all lower in
593
+ * static builds; dynamic builds use the island's Web implementation. */
594
594
  interface AbortSignal extends EventTarget {
595
595
  readonly aborted: boolean;
596
596
  readonly reason: unknown;
@@ -604,22 +604,55 @@ declare var AbortSignal: {
604
604
  readonly prototype: AbortSignal;
605
605
  };
606
606
 
607
- /* fetch, typed as the JSON-API slice: one URL, an optional init with the
608
- * members CLI requests carry, a Response with the probe members and body
609
- * readers. json() returns unknown — the same dynamic boundary as
610
- * JSON.parse: cast and validate. Response, AbortSignal, and RequestInit
611
- * are ISLAND-BACKED ambients: under --dynamic their values are handles
612
- * into the embedded engine (the engine's own fetch executes; member reads
613
- * and calls are engine ops with validated exits at typed boundaries), so
614
- * `body` is honestly `any` — the streaming world lives entirely in the
615
- * island. The named RequestInit interface is what routes init object
616
- * literals through the island literal builder. */
617
- /* Headers — a response's header map (r.headers), island-backed like
618
- * Response itself: the value is the engine's real Headers (lowercase
619
- * names, combine-on-append, sorted iteration), member reads and calls are
620
- * engine ops with validated exits at typed boundaries. Declared to the
621
- * implemented surface; constructing one statically (`new Headers()`) keeps
622
- * the constructor fence. */
607
+ interface ReadableStreamReadValueResult<T> {
608
+ done: false;
609
+ value: T;
610
+ }
611
+ interface ReadableStreamReadDoneResult<T> {
612
+ done: true;
613
+ value: T | undefined;
614
+ }
615
+ type ReadableStreamReadResult<T> =
616
+ | ReadableStreamReadValueResult<T>
617
+ | ReadableStreamReadDoneResult<T>;
618
+ interface ReadableStreamDefaultReader<T = unknown> {
619
+ readonly closed: Promise<void>;
620
+ read(): Promise<ReadableStreamReadResult<T>>;
621
+ cancel(reason?: unknown): Promise<void>;
622
+ releaseLock(): void;
623
+ }
624
+ interface ReadableStreamDefaultController<T = unknown> {
625
+ readonly desiredSize: number | null;
626
+ enqueue(chunk?: T): void;
627
+ close(): void;
628
+ error(reason?: unknown): void;
629
+ }
630
+ interface UnderlyingSource<T = unknown> {
631
+ start?(controller: ReadableStreamDefaultController<T>): unknown;
632
+ pull?(controller: ReadableStreamDefaultController<T>): unknown;
633
+ cancel?(reason?: unknown): unknown;
634
+ }
635
+ interface ReadableStream<T = unknown> {
636
+ readonly locked: boolean;
637
+ cancel(reason?: unknown): Promise<void>;
638
+ getReader(): ReadableStreamDefaultReader<T>;
639
+ }
640
+ declare var ReadableStream: {
641
+ new <T = unknown>(source?: UnderlyingSource<T>): ReadableStream<T>;
642
+ from<T>(iterable: readonly T[]): ReadableStream<T>;
643
+ from(iterable: Uint8Array): ReadableStream<number>;
644
+ from(iterable: string): ReadableStream<string>;
645
+ readonly prototype: ReadableStream<unknown>;
646
+ };
647
+
648
+ /* fetch, typed as the native JSON + readable-stream slice: one URL, an
649
+ * optional init with the members CLI requests carry, and a Response
650
+ * whose body is the same stream consumed by json(). json() returns
651
+ * unknown — the same dynamic boundary as JSON.parse: cast and validate. */
652
+ /* Headers — a response's native header map (lowercase names,
653
+ * combine-on-append, sorted iteration). The value is a checked-dynamic
654
+ * native handle like Response itself; constructing one statically
655
+ * (`new Headers()`) keeps the constructor fence. */
623
656
  interface Headers {
624
657
  append(name: string, value: string): void;
625
658
  delete(name: string): void;
@@ -627,8 +660,16 @@ interface Headers {
627
660
  getSetCookie(): string[];
628
661
  has(name: string): boolean;
629
662
  set(name: string, value: string): void;
630
- forEach(callbackfn: (value: string, key: string, parent: Headers) => void): void;
663
+ forEach(
664
+ callbackfn: (value: string, key: string, parent: Headers) => void,
665
+ thisArg?: unknown,
666
+ ): void;
667
+ [Symbol.iterator](): IterableIterator<[string, string]>;
631
668
  }
669
+ declare var Headers: {
670
+ new (init?: Record<string, string> | readonly (readonly [string, string])[]): Headers;
671
+ readonly prototype: Headers;
672
+ };
632
673
  interface Response {
633
674
  readonly ok: boolean;
634
675
  readonly status: number;
@@ -636,25 +677,62 @@ interface Response {
636
677
  readonly url: string;
637
678
  readonly redirected: boolean;
638
679
  readonly headers: Headers;
639
- readonly body: any;
680
+ readonly body: ReadableStream<Uint8Array> | null;
681
+ readonly bodyUsed: boolean;
682
+ json(): Promise<unknown>;
683
+ text(): Promise<string>;
684
+ /* The whole body as bytes: bytes() answers a Uint8Array in both tiers.
685
+ * arrayBuffer() remains dynamic-only because static programs have no
686
+ * free-standing ArrayBuffer representation; the compiler diagnoses its
687
+ * direct use and points at bytes(). */
688
+ arrayBuffer(): Promise<ArrayBuffer>;
689
+ bytes(): Promise<Uint8Array>;
690
+ }
691
+ interface ResponseInit {
692
+ headers?:
693
+ | Headers
694
+ | Record<string, string>
695
+ | readonly (readonly [string, string])[];
696
+ status?: number;
697
+ statusText?: string;
698
+ }
699
+ declare var Response: {
700
+ new (
701
+ body?: string | Uint8Array | ReadableStream<Uint8Array> | null,
702
+ init?: ResponseInit,
703
+ ): Response;
704
+ readonly prototype: Response;
705
+ error(): Response;
706
+ json(data: unknown, init?: ResponseInit): Response;
707
+ redirect(url: string | URL, status?: number): Response;
708
+ };
709
+ interface Request {
710
+ readonly method: string;
711
+ readonly url: string;
712
+ readonly headers: Headers;
713
+ readonly signal: AbortSignal;
714
+ readonly body: ReadableStream<Uint8Array> | null;
640
715
  readonly bodyUsed: boolean;
641
716
  json(): Promise<unknown>;
642
717
  text(): Promise<string>;
643
- /* The whole body as bytes: arrayBuffer() answers the engine's
644
- * ArrayBuffer (a handle — read it through `new Uint8Array(...)` in
645
- * island code or its byteLength directly); bytes() answers a
646
- * Uint8Array, which exits to the static bytes tier at a typed
647
- * boundary (`const b: Uint8Array = await r.bytes()` is a validated
648
- * copy — divergence 44's aliasing stance). */
649
718
  arrayBuffer(): Promise<ArrayBuffer>;
650
719
  bytes(): Promise<Uint8Array>;
651
720
  }
652
721
  interface RequestInit {
653
722
  method?: string;
654
- headers?: Record<string, string>;
655
- body?: string;
723
+ headers?:
724
+ | Headers
725
+ | Record<string, string>
726
+ | readonly (readonly [string, string])[];
727
+ body?: string | Uint8Array | ReadableStream<Uint8Array> | null;
728
+ duplex?: "half";
729
+ redirect?: "follow" | "error" | "manual";
656
730
  signal?: AbortSignal;
657
731
  }
732
+ declare var Request: {
733
+ new (input: string | URL | Request, init?: RequestInit): Request;
734
+ readonly prototype: Request;
735
+ };
658
736
  declare function fetch(input: string | URL, init?: RequestInit): Promise<Response>;
659
737
 
660
738
  /* The repeating timer pair (setTimeout lives in scriptc.d.ts — always
@@ -947,9 +1025,9 @@ declare module "node:fs" {
947
1025
  * variants), closeSync(fd). */
948
1026
  export function openSync(path: string, flags: string): number;
949
1027
  export function closeSync(fd: number): void;
950
- /* read(2) into a caller buffer from the fd's current position (the
951
- * position argument is declared for parity and fences when non-null);
952
- * answers the byte count, 0 at EOF. */
1028
+ /* Read into a caller buffer from the fd's current position when position
1029
+ * is omitted/null, or from a numeric byte position without advancing the
1030
+ * fd. Answers the byte count, 0 at EOF. */
953
1031
  export function readSync(fd: number, buffer: Uint8Array, offset: number, length: number, position?: number | null): number;
954
1032
  /* statSync over an open fd — the same Stats snapshot. */
955
1033
  export function fstatSync(fd: number): Stats;
@@ -1952,6 +2030,8 @@ declare module "node:net" {
1952
2030
  declare module "http" {
1953
2031
  import { Server as NetServer, Socket } from "net";
1954
2032
  export type Server = NetServer;
2033
+ export type RequestListener =
2034
+ (req: IncomingMessage, res: ServerResponse) => void;
1955
2035
  /* The Server VALUE — Node's constructor works with and without `new`
1956
2036
  * (test/parallel's http.Server(fn) spelling); both route to the
1957
2037
  * createServer lowering. */
@@ -0,0 +1 @@
1
+ export {};