@scriptc/compiler 0.0.11 → 0.0.13

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 (97) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +153 -24
  2. package/ambient/scriptc.d.ts +2 -2
  3. package/dist/backend/cc.d.ts +10 -2
  4. package/dist/backend/cc.js +12 -0
  5. package/dist/backend/cc.js.map +1 -1
  6. package/dist/backend/emission/emit-async.js +1 -1
  7. package/dist/backend/emission/emit-exprs.js +235 -64
  8. package/dist/backend/emission/emit-exprs.js.map +1 -1
  9. package/dist/backend/emission/emit-island.js +1 -1
  10. package/dist/backend/emission/emit-shapes.js +1 -1
  11. package/dist/backend/emission/emit-walkers.d.ts +14 -14
  12. package/dist/backend/emission/emit-walkers.js +44 -44
  13. package/dist/backend/emission/emit-walkers.js.map +1 -1
  14. package/dist/backend/emission/emitter.d.ts +3 -3
  15. package/dist/backend/emission/emitter.js +8 -8
  16. package/dist/backend/emission/may-throw.js +1 -1
  17. package/dist/backend/llvm/dyn.d.ts +10 -10
  18. package/dist/backend/llvm/dyn.js +26 -26
  19. package/dist/backend/llvm/dyn.js.map +1 -1
  20. package/dist/backend/llvm/emitter.js +140 -49
  21. package/dist/backend/llvm/emitter.js.map +1 -1
  22. package/dist/backend/llvm/shapes.js +1 -1
  23. package/dist/backend/llvm/walkers.js +2 -2
  24. package/dist/backend/llvm/walkers.js.map +1 -1
  25. package/dist/diagnostics/diagnostic.d.ts +1 -1
  26. package/dist/diagnostics/diagnostic.js +4 -3
  27. package/dist/diagnostics/diagnostic.js.map +1 -1
  28. package/dist/frontend/lowering/crypto-tables.d.ts +7 -0
  29. package/dist/frontend/lowering/crypto-tables.js +139 -0
  30. package/dist/frontend/lowering/crypto-tables.js.map +1 -0
  31. package/dist/frontend/lowering/lib-boundary.js +5 -5
  32. package/dist/frontend/lowering/lib-boundary.js.map +1 -1
  33. package/dist/frontend/lowering/lower-assert.js +12 -12
  34. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  35. package/dist/frontend/lowering/lower-builtins.d.ts +45 -27
  36. package/dist/frontend/lowering/lower-builtins.js +203 -70
  37. package/dist/frontend/lowering/lower-builtins.js.map +1 -1
  38. package/dist/frontend/lowering/lower-calls.d.ts +4 -4
  39. package/dist/frontend/lowering/lower-calls.js +74 -66
  40. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  41. package/dist/frontend/lowering/lower-classes.js +41 -7
  42. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  43. package/dist/frontend/lowering/lower-containers.d.ts +5 -5
  44. package/dist/frontend/lowering/lower-containers.js +19 -19
  45. package/dist/frontend/lowering/lower-containers.js.map +1 -1
  46. package/dist/frontend/lowering/lower-emitter.js +2 -2
  47. package/dist/frontend/lowering/lower-emitter.js.map +1 -1
  48. package/dist/frontend/lowering/lower-exprs.d.ts +7 -7
  49. package/dist/frontend/lowering/lower-exprs.js +227 -119
  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.js +17 -17
  56. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  57. package/dist/frontend/lowering/lower-namespaces.d.ts +11 -1
  58. package/dist/frontend/lowering/lower-namespaces.js +41 -6
  59. package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
  60. package/dist/frontend/lowering/lower-server.d.ts +21 -0
  61. package/dist/frontend/lowering/lower-server.js +278 -23
  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 +195 -34
  65. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  66. package/dist/frontend/lowering/lower-stream.js +67 -23
  67. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  68. package/dist/frontend/lowering/lowerer.d.ts +31 -13
  69. package/dist/frontend/lowering/lowerer.js +99 -45
  70. package/dist/frontend/lowering/lowerer.js.map +1 -1
  71. package/dist/frontend/lowering/surfaces.d.ts +6 -0
  72. package/dist/frontend/lowering/surfaces.js +78 -2
  73. package/dist/frontend/lowering/surfaces.js.map +1 -1
  74. package/dist/frontend/program.js +1 -1
  75. package/dist/frontend/shared.js +7 -7
  76. package/dist/frontend/shared.js.map +1 -1
  77. package/dist/frontend/types.d.ts +2 -2
  78. package/dist/frontend/types.js +27 -15
  79. package/dist/frontend/types.js.map +1 -1
  80. package/dist/index.js +44 -8
  81. package/dist/index.js.map +1 -1
  82. package/dist/ir/nodes.d.ts +208 -106
  83. package/dist/ir/nodes.js +100 -22
  84. package/dist/ir/nodes.js.map +1 -1
  85. package/dist/ir/validate.js +96 -38
  86. package/dist/ir/validate.js.map +1 -1
  87. package/dist/library/int-infer.js +13 -0
  88. package/dist/library/int-infer.js.map +1 -1
  89. package/dist/library/profile.d.ts +8 -6
  90. package/dist/library/profile.js.map +1 -1
  91. package/dist/library/sidecar-validate.js +1 -1
  92. package/dist/library/sidecar-validate.js.map +1 -1
  93. package/dist/library/sidecar.d.ts +1 -1
  94. package/dist/library/sidecar.js +20 -7
  95. package/dist/library/sidecar.js.map +1 -1
  96. package/package.json +2 -2
  97. package/surface-manifest.json +289 -4
@@ -27,9 +27,9 @@ import { bindingNeverReassigned, bodyReadsArguments, isThisParameter, paramShape
27
27
  import { lowerArrayMethodCall, lowerBufferStaticCall, lowerBytesMethodCall, lowerBytesNew, lowerMapMethodCall, lowerMapForEachCall, buildMapForEachFn, lowerRecordOvfCaptureHelper, lowerEnvToPairsHelper, lowerSetMethodCall, lowerSetForEachCall, buildSetForEachFn, lowerRegexMethodCall, lowerStringMethodCall } from "./lower-containers.js";
28
28
  import { lowerStreamModuleCall } from "./lower-stream.js";
29
29
  import { lowerEmitOverrideSpec } from "./lower-emitter.js";
30
- import { builtinImportOf, createRequireBindingDecl, createRequireNamespaceDecl, createRequireSpecOf, stripTypeCasts, lowerBuiltinModuleCall, lowerFsToUnixTimestampCall, lowerFsLadderCall, lowerChildArgsArg, lowerSpawnSyncCall, lowerSpawnCall, lowerExecSyncCall, recordToEnvPairs, lowerJsonMethodCall, fencedBuiltinImportOf, lowerCryptoComposedCall, lowerUrlMethodCall, lowerSearchParamsMethodCall, lowerStatsMethodCall, lowerChildMethodCall, lowerAtomicsCall, lowerBuiltinExtraProperty, promisifiedExecFileDecl, lowerExecFileAsyncCall, execFileAsyncHelper, lowerStringDecoderMethodCall, strdecHelper, lowerReadlineMethodCall, lowerDcChannelMethodCall, lowerDcChannelProperty, lowerAlsMethodCall, lowerDcTracingChannelMethodCall, lowerDcTracingChannelProperty, lowerJsonProperty, lowerErrorCodeProperty, lowerProcessProperty, isProcessEnv, envValueType, lowerProcessEnvGet, lowerProcessMethodCall, lowerProcessOptionalMethodCall, lowerTimeoutMethodCall, envSnapshotHelper, isConsoleLog, consoleCallMember, lowerNumberStaticCall, lowerNumberStaticProperty, lowerDateCall, lowerTextCodecCall, lowerFsConstantsProperty, lowerHttp2ConstantsProperty, http2ConstantBindingOf, http2ConstantsDestructureDecl, lowerProcessStreamProperty, lowerStringStaticCall, lowerStringLastIndexOfCall, lowerPromiseStaticCall } from "./lower-builtins.js";
30
+ import { builtinImportOf, createRequireBindingDecl, createRequireNamespaceDecl, createRequireSpecOf, stripTypeCasts, lowerBuiltinModuleCall, lowerFsToUnixTimestampCall, lowerFsLadderCall, lowerChildArgsArg, lowerSpawnSyncCall, lowerSpawnCall, lowerExecSyncCall, recordToEnvPairs, lowerJsonMethodCall, fencedBuiltinImportOf, lowerCryptoComposedCall, lowerUrlMethodCall, lowerSearchParamsMethodCall, lowerStatsMethodCall, lowerChildMethodCall, lowerAtomicsCall, lowerBuiltinExtraProperty, promisifiedExecFileDecl, lowerExecFileAsyncCall, execFileAsyncHelper, lowerStringDecoderMethodCall, strdecHelper, lowerReadlineMethodCall, lowerDcChannelMethodCall, lowerDcChannelProperty, lowerAlsMethodCall, lowerDcTracingChannelMethodCall, lowerDcTracingChannelProperty, lowerJsonProperty, lowerErrorCodeProperty, lowerProcessProperty, isProcessEnv, envValueType, lowerProcessEnvGet, lowerProcessMethodCall, lowerProcessOptionalMethodCall, lowerTimeoutMethodCall, envSnapshotHelper, isConsoleLog, consoleCallMember, lowerNumberStaticCall, lowerNumberStaticProperty, lowerDateCall, lowerTextCodecCall, lowerCryptoModuleCall, lowerFsConstantsProperty, lowerBuiltinConstantsProperty, builtinConstantBindingOf, builtinConstantsDestructureDecl, lowerProcessStreamProperty, lowerStringStaticCall, lowerStringLastIndexOfCall, lowerPromiseStaticCall } from "./lower-builtins.js";
31
31
  import { isIslandExpr, islandFuncValueFence, islandRegexpOf, jsvalIn, requireDynamicApi, islandGlobalFnOf, lowerDynamicImportCall, lowerFetchCall, lowerIslandMethodCall, lowerMathProperty, npmPackageOf, npmMemberFence, npmPackageOfSymbol } from "./lower-island.js";
32
- import { lowerHttpHeadersElement, lowerNetModuleCall, lowerServerMethodCall, lowerServerProperty } from "./lower-server.js";
32
+ import { lowerHttpHeadersElement, lowerNetModuleCall, lowerServerMethodCall, lowerServerProperty, lowerTlsRootCertificates } from "./lower-server.js";
33
33
  import { lowerDgramDnsModuleCall, lowerDgramMethodCall } from "./lower-dgram.js";
34
34
  import { lowerNodeTestModuleCall, lowerTestDirectCall, lowerTestMethodCall, lowerTestCtxProperty } from "./lower-test.js";
35
35
  import { lowerAssertModuleCall, lowerAssertDirectCall } from "./lower-assert.js";
@@ -282,7 +282,7 @@ export function neverTaintedJsType(L, node, t) {
282
282
  };
283
283
  return walk(t, 4);
284
284
  }
285
- /** The DOM undefined value — what an uninitialized checked-dynamic
285
+ /** The dyn undefined value — what an uninitialized checked-dynamic
286
286
  * binding holds (JS: declared bindings read `undefined` before any
287
287
  * assignment). A NULL dyn slot is a trap, never a value, so every dyn
288
288
  * binding that is READABLE before its first assignment must start here:
@@ -349,10 +349,10 @@ export function ladderFenceExpr(L, surface, node, hint) {
349
349
  * only unmappable pieces are `any` (`(value: any) => value is string` —
350
350
  * the arrow the binding holds lowers those params to dyn, so the binding
351
351
  * keeps its func-ness with the same per-piece fallback). The honest
352
- * static subset of `any` is a binding whose VALUES are DOM-representable:
352
+ * static subset of `any` is a binding whose VALUES are dyn-representable:
353
353
  * the binding is 'unknown' storage with the boundary conversions
354
354
  * coerceToExpected already applies (dynFrom into the slot, validated
355
- * dynCheck out) and per-site SC2011 fences for the operations the DOM
355
+ * dynCheck out) and per-site SC2011 fences for the operations the checked-dynamic tree
356
356
  * cannot carry JS-exactly (the island still lifts those). Every OTHER
357
357
  * unmappable TS type keeps its own diagnostic — annotations exist there,
358
358
  * and the fence names the real blocker. `--dynamic` builds never reach
@@ -376,8 +376,8 @@ export function dynFallbackType(L, node, t) {
376
376
  ((elem.flags & ts.TypeFlags.Never) !== 0 || neverTaintedJsType(L, node, elem));
377
377
  const mappedElem = elem !== undefined && !elemTainted ? L.mapTypeOf(elem) : null;
378
378
  // A mappable element keeps the static array; an unmappable one makes
379
- // the WHOLE value dyn (the DOM has real arrays — length/index/push
380
- // read through the keyed-DOM paths; dyn-element STATIC arrays have no
379
+ // the WHOLE value dyn (the checked-dynamic tree has real arrays — length/index/push
380
+ // read through the keyed-dyn paths; dyn-element STATIC arrays have no
381
381
  // backend representation).
382
382
  if (mappedElem)
383
383
  return { kind: "array", elem: mappedElem };
@@ -2199,6 +2199,31 @@ export class Lowerer {
2199
2199
  mapTypeOf(t) {
2200
2200
  return mapType(t, this.typeCtx);
2201
2201
  }
2202
+ /** The one position where a contextual UNION must not be adopted over the
2203
+ * expression's own: the LEFT operand of `&&`, `||`, or `??`. Adopting a
2204
+ * contextual union is normally safe because tsc proved the value
2205
+ * assignable to the slot; that proof does not exist here, because tsc
2206
+ * builds a logical operator's result by DROPPING the left's falsy (or
2207
+ * nullish) arms. `const s: string | null = (c ? env : undefined) || null`
2208
+ * contextually types the ternary `string | null` while its value is
2209
+ * `string | undefined` — adopting that strands the very arm the operator
2210
+ * exists to answer, throwing where Node yields the default. Such operands
2211
+ * represent by their own union; the operator's own lowering re-tags on
2212
+ * the branch where the dropped arms are gone. Narrow by design: only the
2213
+ * union choice is unsound here. A contextual ARRAY still types the
2214
+ * element, and an unmappable own type still falls back to the context. */
2215
+ inLogicalLeftPosition(node) {
2216
+ let n = node;
2217
+ while (n.parent && ts.isParenthesizedExpression(n.parent))
2218
+ n = n.parent;
2219
+ const p = n.parent;
2220
+ if (!p || !ts.isBinaryExpression(p) || p.left !== n)
2221
+ return false;
2222
+ const k = p.operatorToken.kind;
2223
+ return (k === ts.SyntaxKind.AmpersandAmpersandToken ||
2224
+ k === ts.SyntaxKind.BarBarToken ||
2225
+ k === ts.SyntaxKind.QuestionQuestionToken);
2226
+ }
2202
2227
  /** True when a ?. token blocks this lowering — i.e. it is NOT the one an
2203
2228
  * active optional-chain lowering is currently handling. Every receiver-
2204
2229
  * typed lowering that supports chained receivers guards with this
@@ -2317,7 +2342,7 @@ export class Lowerer {
2317
2342
  // The reverse — a TYPED value flowing into an 'unknown' slot
2318
2343
  // (`const u: unknown = 5`, an unknown-typed param/return) — IS tsc-clean
2319
2344
  // and rejected here: a typed value has no dynamic representation
2320
- // (constructing a DOM from static values is deliberately out this
2345
+ // (constructing a dyn from static values is deliberately out this
2321
2346
  // round; only JSON.parse results are dyn).
2322
2347
  if (actual.kind === "dyn") {
2323
2348
  this.unsupported("SC1100", node, `passing 'unknown' values where '${this.fmt(expected)}' is expected`);
@@ -2426,8 +2451,8 @@ export class Lowerer {
2426
2451
  }
2427
2452
  // A CHECKED-DYNAMIC (dyn/'unknown') value entering the island (the
2428
2453
  // `isJson ? JSON.parse(text) : islandParser(text)` config ternary):
2429
- // the DOM tree deep-copies into engine values — data kinds only; a
2430
- // DOM carrying a boxed function/handle/promise throws the catchable
2454
+ // the dyn tree deep-copies into engine values — data kinds only; a
2455
+ // dyn carrying a boxed function/handle/promise throws the catchable
2431
2456
  // TypeError at runtime (trust-but-verify, like every boundary).
2432
2457
  if (expr.type.kind === "dyn") {
2433
2458
  return { kind: "jsMarshal", value: expr, type: JSVAL, loc: expr.loc };
@@ -2460,21 +2485,35 @@ export class Lowerer {
2460
2485
  return expr;
2461
2486
  }
2462
2487
  if (expr.type.kind === "jsval" && expected.kind !== "jsval") {
2463
- // The jsval→DOM crossing (the world unification's engine-handle
2488
+ // The jsval→dyn crossing (the world unification's engine-handle
2464
2489
  // kind): an 'any'-typed engine value flowing into an 'unknown'/
2465
- // 'object'/JS-residue slot wraps BY REFERENCE as the DOM's island
2466
- // kind — engine scalars normalize to native DOM kinds at wrap time,
2467
- // typeof/truthiness/String()/=== route to the engine, un-armed DOM
2490
+ // 'object'/JS-residue slot wraps BY REFERENCE as the checked-dynamic tree's island
2491
+ // kind — engine scalars normalize to native dyn kinds at wrap time,
2492
+ // typeof/truthiness/String()/=== route to the engine, un-armed dyn
2468
2493
  // walks fence loudly, and the value unwraps back identity-preserved
2469
2494
  // (scr_jsval_from_dyn). Monotone under evolution/widening: a value
2470
2495
  // wraps once at its first dyn edge and stays valid through every
2471
2496
  // subsequent dyn slot; narrowing never changes representation.
2472
2497
  // This wrap RETIRES the silent-wrong-answer fence-closure box for
2473
- // jsval members of DOM object literals (lowerDynObjectLiteral's
2498
+ // jsval members of dyn object literals (lowerDynObjectLiteral's
2474
2499
  // coercion lands here first).
2475
2500
  if (expected.kind === "dyn") {
2476
2501
  return { kind: "dynFromJsval", value: expr, type: DYN, loc: expr.loc };
2477
2502
  }
2503
+ // An island value flowing into a PROMISE-typed slot (the inferred
2504
+ // `loadPlugins` return — `Promise.all(...)` lowered engine-side
2505
+ // against a Promise<any[]> inference): the island→static promise
2506
+ // bridge — the engine promise settles a fresh static promise (void
2507
+ // fulfillments drop, `any[]`-declared fulfillments exit
2508
+ // Array.isArray-gated by reference at the settle, 'any' parks as an
2509
+ // island handle). Only inner shapes the bridge can deliver take the
2510
+ // arm; the rest keep the exit fence with the type named.
2511
+ if (expected.kind === "promise" &&
2512
+ (expected.inner.kind === "void" ||
2513
+ expected.inner.kind === "jsval" ||
2514
+ (expected.inner.kind === "array" && expected.inner.elem.kind === "jsval"))) {
2515
+ return { kind: "jsBridgePromise", value: expr, type: expected, loc: expr.loc };
2516
+ }
2478
2517
  // The exit set: everything round-trippable, plus bare undefined-armed
2479
2518
  // unions of JSON-safe data arms (the engine's undefined takes the
2480
2519
  // undefined arm before the JSON detour) — canExitIslandToType.
@@ -2485,10 +2524,10 @@ export class Lowerer {
2485
2524
  }
2486
2525
  // A TYPED value flowing into an 'unknown' slot (`const u: unknown = 5`,
2487
2526
  // an unknown-typed param/return, a dyn-valued index slot): the
2488
- // static→DOM conversion — dynFrom, a DEEP COPY (the jsMarshal aliasing
2527
+ // static→dyn conversion — dynFrom, a DEEP COPY (the jsMarshal aliasing
2489
2528
  // stance intoIndexValueSlot documents; SEMANTICS.md). Bare
2490
- // undefined/null literals store the DOM unit values. Types outside the
2491
- // DOM's domain (bytes, classes, Maps, ...) fall through to
2529
+ // undefined/null literals store the dyn unit values. Types outside the
2530
+ // dyn's domain (bytes, classes, Maps, ...) fall through to
2492
2531
  // requireExactShape's SC1101 fence.
2493
2532
  // A promise flowing into a VOID-promise slot (an inferred
2494
2533
  // Promise<never> return holding a `return Promise.reject(value)` the
@@ -2576,7 +2615,7 @@ export class Lowerer {
2576
2615
  // JS func-into-func mismatches ride the checked-dynamic function
2577
2616
  // boundary: box the value (dynFrom), adapt to the slot (dynCheck) —
2578
2617
  // the thunk delivers JS arity exactly (extras ignored, missing args
2579
- // the undefined DOM value), so `return _return` fits _mustCallInner's
2618
+ // the undefined dyn value), so `return _return` fits _mustCallInner's
2580
2619
  // inferred (unknown) => unknown slot even though the wrapper declares
2581
2620
  // (). JS files only: TypeScript signatures keep the exact-shape
2582
2621
  // fences (a mismatch there is a compile-time story, not a boundary).
@@ -2884,7 +2923,7 @@ export class Lowerer {
2884
2923
  * arr — array into array whose element pair lifts (per-element
2885
2924
  * copy loop, arrayWidthHelper)
2886
2925
  * dynIn — a typed value into an 'unknown' (dyn) slot — the same
2887
- * static→DOM deep copy coerceToExpected applies top-level
2926
+ * static→dyn deep copy coerceToExpected applies top-level
2888
2927
  * upcast — a derived class instance into a base-typed slot (the
2889
2928
  * prefix-layout pointer reinterpret, no copy)
2890
2929
  * funcAdapt — a function into a slot whose signature differs only by
@@ -2894,7 +2933,7 @@ export class Lowerer {
2894
2933
  widthLiftPlan(src, dst) {
2895
2934
  if (typeEquals(src, dst))
2896
2935
  return { how: "copy" };
2897
- // An 'unknown' (dyn) DESTINATION slot: the static→DOM conversion —
2936
+ // An 'unknown' (dyn) DESTINATION slot: the static→dyn conversion —
2898
2937
  // dynFrom, a DEEP COPY (`{ v: 5 }` into `{ v: unknown }`, `number[]`
2899
2938
  // into `unknown[]` — tsc's top type over the width family's copies).
2900
2939
  if (dst.kind === "dyn" && src.kind !== "dyn" && this.dynConvertible(src)) {
@@ -3156,7 +3195,7 @@ export class Lowerer {
3156
3195
  // A target field MISSING on the source: legal exactly when it is
3157
3196
  // optional-flavored (an undefined-armed union) — the unset field
3158
3197
  // IS the undefined arm, the same rule literal completion applies
3159
- // — or 'unknown' (a dyn slot holds the DOM undefined, exactly
3198
+ // — or 'unknown' (a dyn slot holds the dyn undefined, exactly
3160
3199
  // the absent-property read: the options-record call shape
3161
3200
  // against `{ plugins: unknown, ... }`). Never for tuples: a
3162
3201
  // completed position would change .length and JSON where Node
@@ -3312,7 +3351,7 @@ export class Lowerer {
3312
3351
  fields: to.fields.map((f) => {
3313
3352
  const lift = plan.get(f.name);
3314
3353
  if ("absentDyn" in lift) {
3315
- // The unset 'unknown' field: the DOM undefined — exactly
3354
+ // The unset 'unknown' field: the dyn undefined — exactly
3316
3355
  // the absent-property read's answer.
3317
3356
  return { name: f.name, value: dynUndefinedExpr(loc) };
3318
3357
  }
@@ -3897,7 +3936,7 @@ export class Lowerer {
3897
3936
  if (typeEquals(src, dst))
3898
3937
  return true;
3899
3938
  // The island boundary joins the mechanical set: values that MARSHAL
3900
- // in (units, the checked-dynamic DOM copy, JSON-safe data, liftable
3939
+ // in (units, the checked-dynamic deep copy, JSON-safe data, liftable
3901
3940
  // composites, marshalable closures — coerceToExpected's jsval-IN
3902
3941
  // block) and island handles whose exits VALIDATE (boundaryExitSafe) —
3903
3942
  // the `defaultFallback(cfg) { return { login, id, scopes } }` shape,
@@ -3982,7 +4021,7 @@ export class Lowerer {
3982
4021
  // never-called mismatched callback is exact; divergence 38's stance
3983
4022
  // extended to calls).
3984
4023
  // - voidRet "dyn"/"jsval": calling yields JS's undefined — the exact
3985
- // undefined DOM/engine value after the call's effects.
4024
+ // undefined dyn/engine value after the call's effects.
3986
4025
  // - voidRet "strand": a void result where the slot promises a typed
3987
4026
  // value — the call runs (a `never` thrower never comes back, so the
3988
4027
  // trap is unreachable there), then the stranded TypeError.
@@ -4767,7 +4806,7 @@ export class Lowerer {
4767
4806
  return { kind: "call", callee: helper, args: [e], type: JSVAL, loc };
4768
4807
  }
4769
4808
  // Checked-dynamic values and marshalable closures ride jsMarshal
4770
- // directly (the DOM deep copy / the host-function wrap).
4809
+ // directly (the checked-dynamic tree deep copy / the host-function wrap).
4771
4810
  if (e.type.kind === "dyn" || e.type.kind === "func") {
4772
4811
  return { kind: "jsMarshal", value: e, type: JSVAL, loc };
4773
4812
  }
@@ -5208,9 +5247,9 @@ export class Lowerer {
5208
5247
  }
5209
5248
  // An OBJECT LITERAL against a checked-dynamic slot in a JS file (the
5210
5249
  // getSupportInfo options argument — a dyn-ABI param): the value's
5211
- // world IS the DOM — build the DOM literal directly, before the
5250
+ // world IS the checked-dynamic tree — build the dyn literal directly, before the
5212
5251
  // island gate could claim the checker's `any` context (an island
5213
- // build could never land in the slot: no engine→DOM crossing).
5252
+ // build could never land in the slot: no engine→dyn crossing).
5214
5253
  if (expected?.kind === "dyn") {
5215
5254
  let x = node;
5216
5255
  while (ts.isParenthesizedExpression(x))
@@ -5260,7 +5299,7 @@ export class Lowerer {
5260
5299
  }
5261
5300
  /** A value flowing into an index-signature VALUE slot (an overflow
5262
5301
  * literal entry, a dynamic-keyed record write). dyn slots (`unknown`
5263
- * signatures — ModelPricing's) take a DOM conversion: dyn values pass
5302
+ * signatures — ModelPricing's) take a dyn conversion: dyn values pass
5264
5303
  * through, JSON-safe static values convert with dynFrom (a deep copy —
5265
5304
  * the jsMarshal aliasing stance), everything else keeps the dyn-boundary
5266
5305
  * fence. Typed slots ride the ordinary coercion path (union slots wrap
@@ -5270,12 +5309,12 @@ export class Lowerer {
5270
5309
  return this.coerceInto(node, value, indexValue);
5271
5310
  if (value.type.kind === "dyn")
5272
5311
  return value;
5273
- // Bare `undefined`/`null` literals store the DOM unit values (JS keeps
5312
+ // Bare `undefined`/`null` literals store the dyn unit values (JS keeps
5274
5313
  // the key; JSON.stringify drops an undefined-valued one, like Node).
5275
5314
  if (value.kind === "unitLit") {
5276
5315
  return { kind: "dynFrom", value, type: DYN, loc: value.loc };
5277
5316
  }
5278
- // An ISLAND ('any') value: the by-reference jsval→DOM wrap — the same
5317
+ // An ISLAND ('any') value: the by-reference jsval→dyn wrap — the same
5279
5318
  // edge coerceToExpected converts (dyn slots accept engine values).
5280
5319
  if (value.type.kind === "jsval") {
5281
5320
  return { kind: "dynFromJsval", value, type: DYN, loc: value.loc };
@@ -5291,13 +5330,13 @@ export class Lowerer {
5291
5330
  withUndefinedArmOf(t) {
5292
5331
  return withUndefinedArmCanonical(t, this.unions);
5293
5332
  }
5294
- /** True when a static type converts to a dyn DOM value (the dynFrom
5295
- * walker's domain): JSON-safe, bytes<u8> (Uint8Array/Buffer — the DOM's
5333
+ /** True when a static type converts to a dyn value (the dynFrom
5334
+ * walker's domain): JSON-safe, bytes<u8> (Uint8Array/Buffer — the checked-dynamic tree's
5296
5335
  * bytes kind, payload copied; stdin chunks into unknown-typed helpers),
5297
5336
  * an undefined-armed union whose other arms are JSON-safe — the
5298
- * undefined arm becomes the undefined DOM singleton — or a BOXABLE
5337
+ * undefined arm becomes the undefined dyn singleton — or a BOXABLE
5299
5338
  * function type (the checked-dynamic function boundary: the closure
5300
- * crosses as the DOM's callable kind, identity preserved). */
5339
+ * crosses as the checked-dynamic tree's callable kind, identity preserved). */
5301
5340
  dynConvertible(t) {
5302
5341
  return canConvertToDyn(t, (id) => this.shapes.get(id), (id) => this.unions.get(id));
5303
5342
  }
@@ -5800,7 +5839,7 @@ export class Lowerer {
5800
5839
  if (abi.kind === "dyn" || abi.kind === "jsval") {
5801
5840
  // A DYNAMIC-TIER pattern source (`function f({} = a)` with
5802
5841
  // `a: any` — jsval for island values, dyn for the checked-
5803
- // dynamic DOM): the slot holds its tier's undefined directly,
5842
+ // dynamic dyn): the slot holds its tier's undefined directly,
5804
5843
  // so the default test is the runtime undefined test — then
5805
5844
  // the pattern destructures the picked value.
5806
5845
  const dflt = this.lowerExprExpecting(decl.initializer, abi);
@@ -5868,7 +5907,7 @@ export class Lowerer {
5868
5907
  if (abi.kind === "dyn" || abi.kind === "jsval") {
5869
5908
  // A DYNAMIC-TIER defaulted param (`function f(x = a)` with
5870
5909
  // `a: any` — jsval for island values, dyn for the checked-
5871
- // dynamic DOM): the slot holds its tier's undefined directly —
5910
+ // dynamic dyn): the slot holds its tier's undefined directly —
5872
5911
  // the body local picks the default on the runtime test.
5873
5912
  const loc = locOf(decl);
5874
5913
  const slot = this.declareHiddenLocal(name, abi);
@@ -6053,7 +6092,7 @@ export class Lowerer {
6053
6092
  continue;
6054
6093
  // dyn captures ride an UNTRACED obj-box (scr_dyn_retain_v/release_v
6055
6094
  // — boxNewC): the mustCall wrapper closing over its implicit-any
6056
- // `fn` param. A DOM tree is pure data except the function kind,
6095
+ // `fn` param. A dyn tree is pure data except the function kind,
6057
6096
  // whose closure edge the collector never sees — cycles through a
6058
6097
  // captured dyn are uncollectable (leak, never dangle: trial
6059
6098
  // deletion treats untraced edges as external roots). SEMANTICS.md.
@@ -6388,7 +6427,7 @@ export class Lowerer {
6388
6427
  // The CHECKED-DYNAMIC twin of the handle rescue (the runtime-world
6389
6428
  // local rule): an unmappable declared type over a dyn initializer
6390
6429
  // (`const first = plugins[0]` — the checker spells 'string |
6391
- // object' while the read is a DOM keyed read) keeps the binding
6430
+ // object' while the read is a dyn keyed read) keeps the binding
6392
6431
  // dyn; typed use sites ride validated extractions and the routed
6393
6432
  // engine ops, exactly the JSON.parse-binding story.
6394
6433
  if (mapped === null && init.type.kind === "dyn") {
@@ -6929,6 +6968,11 @@ export class Lowerer {
6929
6968
  const fsLadder = this.lowerFsLadderCall(call, bi, locOf(access));
6930
6969
  if (fsLadder)
6931
6970
  return fsLadder;
6971
+ // The crypto introspection statics (getFips and the name lists) bake
6972
+ // at the call site — no runtime entry exists to table.
6973
+ const cryptoServed = this.lowerCryptoModuleCall(call, bi, locOf(access));
6974
+ if (cryptoServed)
6975
+ return cryptoServed;
6932
6976
  const builtinFn = builtinModuleFnOf(this, bi.module, bi.member);
6933
6977
  if (!builtinFn) {
6934
6978
  this.noLowering(`${bi.module}.${bi.member}`, call, builtinFenceHintOf(bi.module, bi.member), this.checker.getSymbolAtLocation(access.name));
@@ -6972,6 +7016,13 @@ export class Lowerer {
6972
7016
  if (bi.module === "module" && bi.member === "builtinModules") {
6973
7017
  return builtinModulesArrayLit(loc);
6974
7018
  }
7019
+ // tls.rootCertificates through the namespace: the same runtime-valued
7020
+ // constant the named-import read lowers to.
7021
+ {
7022
+ const roots = lowerTlsRootCertificates(this, bi, loc);
7023
+ if (roots)
7024
+ return roots;
7025
+ }
6975
7026
  if (bi.member === "constants" && bi.module === "fs") {
6976
7027
  // A bare `fs.constants` read (not one of the baked bits above).
6977
7028
  this.noLowering(`fs.constants`, expr, "F_OK, R_OK, W_OK, and X_OK are the lowered constants");
@@ -7114,14 +7165,17 @@ export class Lowerer {
7114
7165
  lowerFsConstantsProperty(expr) {
7115
7166
  return lowerFsConstantsProperty(this, expr);
7116
7167
  }
7117
- lowerHttp2ConstantsProperty(expr) {
7118
- return lowerHttp2ConstantsProperty(this, expr);
7168
+ lowerBuiltinConstantsProperty(expr) {
7169
+ return lowerBuiltinConstantsProperty(this, expr);
7170
+ }
7171
+ builtinConstantBindingOf(ident) {
7172
+ return builtinConstantBindingOf(this, ident);
7119
7173
  }
7120
- http2ConstantBindingOf(ident) {
7121
- return http2ConstantBindingOf(this, ident);
7174
+ builtinConstantsDestructureDecl(nameNode, init) {
7175
+ return builtinConstantsDestructureDecl(this, nameNode, init);
7122
7176
  }
7123
- http2ConstantsDestructureDecl(nameNode, init) {
7124
- return http2ConstantsDestructureDecl(this, nameNode, init);
7177
+ lowerCryptoModuleCall(expr, bi, loc) {
7178
+ return lowerCryptoModuleCall(this, expr, bi, loc);
7125
7179
  }
7126
7180
  lowerProcessStreamProperty(expr) {
7127
7181
  return lowerProcessStreamProperty(this, expr);