@scriptc/compiler 0.0.20 → 0.0.22

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 (75) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +78 -34
  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-exprs.js +355 -8
  9. package/dist/backend/emission/emit-exprs.js.map +1 -1
  10. package/dist/backend/emission/emit-walkers.js +108 -7
  11. package/dist/backend/emission/emit-walkers.js.map +1 -1
  12. package/dist/backend/emission/emitter.d.ts +16 -0
  13. package/dist/backend/emission/emitter.js +23 -2
  14. package/dist/backend/emission/emitter.js.map +1 -1
  15. package/dist/backend/llvm/dyn.d.ts +1 -0
  16. package/dist/backend/llvm/dyn.js +305 -8
  17. package/dist/backend/llvm/dyn.js.map +1 -1
  18. package/dist/backend/llvm/emitter.js +527 -2
  19. package/dist/backend/llvm/emitter.js.map +1 -1
  20. package/dist/compat/fetch-profile.d.ts +108 -0
  21. package/dist/compat/fetch-profile.js +482 -0
  22. package/dist/compat/fetch-profile.js.map +1 -0
  23. package/dist/coverage/surface-manifest.js +54 -0
  24. package/dist/coverage/surface-manifest.js.map +1 -1
  25. package/dist/frontend/lowering/lower-builtins.d.ts +21 -8
  26. package/dist/frontend/lowering/lower-builtins.js +137 -14
  27. package/dist/frontend/lowering/lower-builtins.js.map +1 -1
  28. package/dist/frontend/lowering/lower-calls.js +40 -0
  29. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  30. package/dist/frontend/lowering/lower-classes.js +4 -3
  31. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  32. package/dist/frontend/lowering/lower-exprs.d.ts +2 -2
  33. package/dist/frontend/lowering/lower-exprs.js +63 -12
  34. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  35. package/dist/frontend/lowering/lower-island.d.ts +102 -7
  36. package/dist/frontend/lowering/lower-island.js +1702 -26
  37. package/dist/frontend/lowering/lower-island.js.map +1 -1
  38. package/dist/frontend/lowering/lower-modules.js +17 -1
  39. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  40. package/dist/frontend/lowering/lower-stmts.js +25 -5
  41. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  42. package/dist/frontend/lowering/lowerer.d.ts +39 -0
  43. package/dist/frontend/lowering/lowerer.js +286 -18
  44. package/dist/frontend/lowering/lowerer.js.map +1 -1
  45. package/dist/frontend/lowering/surfaces.js +12 -0
  46. package/dist/frontend/lowering/surfaces.js.map +1 -1
  47. package/dist/frontend/program.d.ts +16 -0
  48. package/dist/frontend/program.js +130 -6
  49. package/dist/frontend/program.js.map +1 -1
  50. package/dist/frontend/types.d.ts +14 -7
  51. package/dist/frontend/types.js +95 -31
  52. package/dist/frontend/types.js.map +1 -1
  53. package/dist/index.d.ts +7 -1
  54. package/dist/index.js +86 -20
  55. package/dist/index.js.map +1 -1
  56. package/dist/ir/nodes.d.ts +32 -16
  57. package/dist/ir/nodes.js +36 -28
  58. package/dist/ir/nodes.js.map +1 -1
  59. package/dist/ir/validate.js +61 -1
  60. package/dist/ir/validate.js.map +1 -1
  61. package/dist/library/int-infer.d.ts +7 -12
  62. package/dist/library/int-infer.js +72 -30
  63. package/dist/library/int-infer.js.map +1 -1
  64. package/dist/library/int-infer.test.js +200 -1
  65. package/dist/library/int-infer.test.js.map +1 -1
  66. package/dist/library/profile.d.ts +7 -0
  67. package/dist/library/profile.js +2 -0
  68. package/dist/library/profile.js.map +1 -1
  69. package/dist/library/sidecar-validate.js +5 -0
  70. package/dist/library/sidecar-validate.js.map +1 -1
  71. package/dist/library/sidecar.d.ts +3 -0
  72. package/dist/library/sidecar.js +168 -30
  73. package/dist/library/sidecar.js.map +1 -1
  74. package/package.json +2 -2
  75. package/surface-manifest.json +859 -1
@@ -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,23 +677,26 @@ 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;
640
681
  readonly bodyUsed: boolean;
641
682
  json(): Promise<unknown>;
642
683
  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). */
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(). */
649
688
  arrayBuffer(): Promise<ArrayBuffer>;
650
689
  bytes(): Promise<Uint8Array>;
651
690
  }
652
691
  interface RequestInit {
653
692
  method?: string;
654
- headers?: Record<string, string>;
655
- body?: string;
693
+ headers?:
694
+ | Headers
695
+ | Record<string, string>
696
+ | readonly (readonly [string, string])[];
697
+ body?: string | Uint8Array | ReadableStream<Uint8Array> | null;
698
+ duplex?: "half";
699
+ redirect?: "follow" | "error" | "manual";
656
700
  signal?: AbortSignal;
657
701
  }
658
702
  declare function fetch(input: string | URL, init?: RequestInit): Promise<Response>;
@@ -0,0 +1 @@
1
+ export {};