@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
@@ -1,6 +1,6 @@
1
1
  import * as ts from "../ts7/adapter.js";
2
2
  import type { Lowerer } from "./lowerer.js";
3
- import { IrExpr } from "../../ir/nodes.js";
3
+ import { IrExpr, IrType } from "../../ir/nodes.js";
4
4
  import { IslandFnEntry } from "./surfaces.js";
5
5
  /** True iff the checker's type for this node maps to jsval ('any') —
6
6
  * the island test in front of every engine-op lowering (receivers,
@@ -43,8 +43,16 @@ export declare function requireDynamicApi(L: Lowerer, feature: string, node: ts.
43
43
  * symbol's declaration must live in the ambient file, so a user function
44
44
  * named `parseFloat` never matches. */
45
45
  export declare function islandGlobalFnOf(L: Lowerer, ident: ts.Identifier): IslandFnEntry | null;
46
- /** USER-code `fetch(url)` / `fetch(url, init)` — the island-backed ambient
47
- * global (provenance, not the name: a user's own `fetch` never matches).
46
+ /** USER-code `fetch(url)` / `fetch(url, init)` — the ambient global
47
+ * (provenance, not the name: a user's own `fetch` never matches).
48
+ *
49
+ * The static tier owns URL requests directly: scr_fetch_static runs
50
+ * over the native net/http/tls stack, consumes a checked-dynamic
51
+ * RequestInit object, and returns a promise of an opaque native
52
+ * Response handle. AbortSignal and readable Web Streams are native
53
+ * checked-dynamic handles too, so cancellation and streaming bodies
54
+ * stay engine-free.
55
+ *
48
56
  * The engine's own fetch executes (the same one embedded npm code calls —
49
57
  * scr_fetch.c over the native net/tls stack): the url marshals in (strings; template
50
58
  * results), an init OBJECT LITERAL builds natively in the island through
@@ -55,9 +63,93 @@ export declare function islandGlobalFnOf(L: Lowerer, ident: ts.Identifier): Isla
55
63
  * fiber like any await and resumes with the Response HANDLE. Member
56
64
  * reads/calls on the handle are engine ops; typed extraction happens at
57
65
  * the user's narrowing sites through the validated-exit machinery.
58
- * Without --dynamic every call site is its own SC2012. Null for
59
- * anything that isn't THE ambient fetch, so lowerCall keeps trying. */
66
+ * Null for anything that isn't THE ambient fetch, so lowerCall keeps
67
+ * trying. */
60
68
  export declare function lowerFetchCall(L: Lowerer, call: ts.CallExpression): IrExpr | null;
69
+ /** Static Response.json(): consume the native Response's readable body
70
+ * stream and parse its UTF-8 payload into the ordinary checked-dynamic
71
+ * JSON tree. Syntax and stream failures reject at await like the web API. */
72
+ export declare function lowerStaticResponseCall(L: Lowerer, call: ts.CallExpression): IrExpr | null;
73
+ type StaticResponseAccess = ts.PropertyAccessExpression | ts.ElementAccessExpression;
74
+ /** Constructor-object operations are distinct from Response instance
75
+ * methods. The inventory marks the former unsupported in both tiers; fence
76
+ * them explicitly so the generic call fallback cannot report SC1090 for
77
+ * Response.json while the other statics report SC2020. */
78
+ export declare function fenceUnsupportedFetchConstructorMember(L: Lowerer, access: StaticResponseAccess): IrExpr | null;
79
+ /** The adopted undici Response declaration is wider than the native static
80
+ * handle. Keep the supported fallback slice on checked-dynamic dispatch, but
81
+ * fence every other declared member before the generic dyn keyed-read/call
82
+ * paths can turn a missing handle operation into a runtime TypeError. */
83
+ export declare function fenceStaticResponseMember(L: Lowerer, access: StaticResponseAccess, use: "read" | "call"): IrExpr | null;
84
+ /** Response Headers are native checked-dynamic handles. Keep their exact
85
+ * supported method slice aligned with the compatibility census so newly
86
+ * observed Node members cannot fall through to a runtime missing-method
87
+ * error in an engine-free build. */
88
+ export declare function fenceStaticHeadersMember(L: Lowerer, access: StaticResponseAccess, use: "read" | "call"): IrExpr | null;
89
+ /** Object binding syntax reads members without constructing property-access
90
+ * nodes, so the ordinary Response/Headers/ReadableStream chokepoints never
91
+ * see it. Attribute those reads to the same inventory rows before generic
92
+ * dyn/jsval destructuring either reports SC1031 or admits an unsupported
93
+ * member in the dynamic tier. */
94
+ export declare function fenceFetchObjectBinding(L: Lowerer, pattern: ts.ObjectBindingPattern): void;
95
+ /** Assignment-position object destructuring is the same member-read form as
96
+ * a binding pattern, but its source type lives on the right-hand expression
97
+ * instead of the target AST. */
98
+ export declare function fenceFetchObjectAssignment(L: Lowerer, target: ts.ObjectLiteralExpression, source: ts.Expression): void;
99
+ /** Iteration syntax invokes Headers[Symbol.iterator] without constructing
100
+ * an element-access node, so the member chokepoint above never sees it.
101
+ * Keep engine-free builds on the same SC2020 profile row for for-of,
102
+ * array spread, and array destructuring. The dynamic tier uses the
103
+ * engine's iterator protocol and is intentionally allowed. */
104
+ export declare function fenceStaticHeadersIteration(L: Lowerer, node: ts.Node): void;
105
+ /** Dynamic element-spelled Headers iteration. Symbol.iterator uses the
106
+ * engine's GetIterator operation. A finite union of keys()/values()/entries()
107
+ * dispatches through fixed-name engine calls after evaluating the receiver
108
+ * and key once, preserving the method receiver and JavaScript evaluation
109
+ * order without trying to represent the union of method values. */
110
+ export declare function lowerDynamicHeadersIteratorCall(L: Lowerer, call: ts.CallExpression, access: ts.ElementAccessExpression): IrExpr | null;
111
+ /** Bracket-spelled calls on a profiled fetch/Web-stream handle. A call such
112
+ * as `headers["get"](name)` is still a method reference in JavaScript: the
113
+ * receiver must remain bound. Lower it before the generic callee-as-value
114
+ * path (which correctly fences bare method extraction), evaluating receiver,
115
+ * key, and arguments once in source order. Finite string-literal unions
116
+ * dispatch through fixed-name calls after the key value is captured. */
117
+ export declare function lowerFetchElementMethodCall(L: Lowerer, call: ts.CallExpression): IrExpr | null;
118
+ /** `[...headers]` in the dynamic tier: Array.from runs inside the engine
119
+ * over the real Headers iterator, then the resulting pair array exits
120
+ * through the checker's declared array type. For Headers this is the
121
+ * spread algorithm's exact iterable snapshot. */
122
+ export declare function lowerDynamicHeadersSpread(L: Lowerer, node: ts.Expression, type: IrType & {
123
+ kind: "array";
124
+ }): IrExpr | null;
125
+ /** The fallback ambient declaration intentionally exposes only the native
126
+ * stream slice, but @types/node adopts the complete WHATWG ReadableStream
127
+ * interface. Fence that wider surface before its checked-dynamic handle can
128
+ * fall through to a runtime missing-method error. */
129
+ export declare function fenceStaticReadableStreamMember(L: Lowerer, access: StaticResponseAccess, use: "read" | "call"): IrExpr | null;
130
+ export declare function lowerStaticFetchCompanionCall(L: Lowerer, call: ts.CallExpression): IrExpr | null;
131
+ /** Controller chunks and error reasons are dyn-handle calls, but unlike a
132
+ * general checked-dynamic boundary the Web Streams contract preserves their
133
+ * object identity for the reader/source callbacks that observe them. */
134
+ export declare function lowerStaticReadableStreamControllerCall(L: Lowerer, call: ts.CallExpression): IrExpr | null;
135
+ /** `ReadableStream.cancel(reason)` and default-reader `cancel(reason)` pass
136
+ * the same reason object to the underlying source's cancel callback. Keep a
137
+ * live typed-reference capsule instead of the general dyn boundary's copy. */
138
+ export declare function lowerStaticReadableStreamCancelCall(L: Lowerer, call: ts.CallExpression): IrExpr | null;
139
+ /** AbortSignal retains listener object identity for duplicate detection and
140
+ * removeEventListener(). Functions already box by closure identity; mutable
141
+ * record/array/bytes listeners need the same live capsule used by stream
142
+ * chunks so repeated crossings still denote one EventListener object. */
143
+ export declare function lowerStaticAbortSignalListenerCall(L: Lowerer, call: ts.CallExpression): IrExpr | null;
144
+ /** `new ReadableStream(source?)`. Static builds box the source record into
145
+ * the checked-dynamic tree; dynamic builds construct the island's Web
146
+ * stream directly so the returned handle composes with dynamic fetch. */
147
+ export declare function lowerStaticReadableStreamNew(L: Lowerer, expr: ts.NewExpression): IrExpr | null;
148
+ /** A static default reader's read() exits the native checked-dynamic
149
+ * transport into the checker's concrete chunk type. An exact chunk type
150
+ * preserves ReadableStream.from(array)'s element identity; structural
151
+ * widening keeps the compiler's ordinary copy-based width semantics. */
152
+ export declare function lowerStaticReadableStreamReaderCall(L: Lowerer, call: ts.CallExpression): IrExpr | null;
61
153
  /** Dynamic `import(spec)` — the island's module system at a USER site.
62
154
  * Under --dynamic the call lowers to island.importDyn(key): the engine
63
155
  * loads the module (embedded npm graph, a shipped local .js/.mjs the
@@ -78,8 +170,10 @@ export declare function lowerDynamicImportCall(L: Lowerer, call: ts.CallExpressi
78
170
  * the JSON-safe copy-marshal). The same jsOp the 'any'-contextual
79
171
  * literal path emits, callable from lowerings that KNOW the literal is
80
172
  * island-bound (fetch's init) even when the contextual type is a union
81
- * the generic path declines. Identifier AND string-literal keys — engine
82
- * property names have no identifier restriction ("content-type"). */
173
+ * the generic path declines. Spelled and pure const-folded computed keys
174
+ * are admitted; engine property names have no identifier restriction. Plain
175
+ * spreads copy through the engine's CopyDataProperties operation in
176
+ * source order, including nested RequestInit/header dictionaries. */
83
177
  export declare function lowerIslandObjectLiteral(L: Lowerer, expr: ts.ObjectLiteralExpression): IrExpr;
84
178
  /** Method calls on the island-backed ambient surface: `Math.<fn>(...)`
85
179
  * (the engine's own Math object executes) and the number/string methods
@@ -113,3 +207,4 @@ export declare function npmMemberFence(L: Lowerer, access: ts.PropertyAccessExpr
113
207
  * npmPackageOf, also asked directly for import-alias bindings (whose
114
208
  * aliased symbol is the package's export). */
115
209
  export declare function npmPackageOfSymbol(L: Lowerer, sym: ts.Symbol | undefined): string | null;
210
+ export {};