@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
@@ -2906,6 +2906,12 @@ export function lowerCall(L, expr) {
2906
2906
  // receiver reading back as the chain's bound handle.
2907
2907
  if (ts.isPropertyAccessExpression(expr.expression) &&
2908
2908
  L.isIslandExpr(expr.expression.expression)) {
2909
+ // Typed fetch/Web Streams handles map to island values under
2910
+ // --dynamic, but their inventory still owns which methods exist.
2911
+ // Reject unsupported rows before the universal jsval method path.
2912
+ L.fenceStaticResponseMember(expr.expression, "call");
2913
+ L.fenceStaticHeadersMember(expr.expression, "call");
2914
+ L.fenceStaticReadableStreamMember(expr.expression, "call");
2909
2915
  const receiver = L.lowerExpr(expr.expression.expression);
2910
2916
  // A checker-`any` receiver whose VALUE lives in the checked-dynamic tree (a
2911
2917
  // checked-dynamic local behind the any-typed spelling — the JS
@@ -3591,6 +3597,19 @@ export function lowerCall(L, expr) {
3591
3597
  // hasOwnProperty on a program class CONSTRUCTOR — own statics are
3592
3598
  // compile-time-known, so a literal key folds to a constant.
3593
3599
  lowerClassHasOwnPropertyCall(L, expr, expr.expression) ??
3600
+ // Response constructor-object operations are unsupported in both
3601
+ // tiers. Keep their SC2020 inventory contract ahead of the island
3602
+ // and generic-call fallbacks (Response.json otherwise reports the
3603
+ // generic SC1090 fence).
3604
+ L.fenceUnsupportedFetchConstructorMember(expr.expression) ??
3605
+ // Static fetch responses are checked-dynamic handles, but the
3606
+ // adopted undici declaration exposes a wider API than that handle.
3607
+ // Fence unimplemented members before either the island or generic
3608
+ // dyn receiver path can compile them into a runtime missing-method
3609
+ // failure. Dynamic-only rows pass through these checks unchanged.
3610
+ L.fenceStaticResponseMember(expr.expression, "call") ??
3611
+ L.fenceStaticHeadersMember(expr.expression, "call") ??
3612
+ L.fenceStaticReadableStreamMember(expr.expression, "call") ??
3594
3613
  L.lowerIslandMethodCall(expr, expr.expression) ??
3595
3614
  // Dyn receivers (JSON.parse-derived `unknown`/`any` values) —
3596
3615
  // validated-extract, then the static machinery. After the island
@@ -3679,6 +3698,17 @@ export function lowerCall(L, expr) {
3679
3698
  }
3680
3699
  L.unsupported("SC1090", expr, `method calls like '${expr.expression.getText()}'`);
3681
3700
  }
3701
+ // The element spelling of an unsupported native Web method must fence
3702
+ // before lowering the callee into a checked-dynamic keyed read.
3703
+ if (ts.isElementAccessExpression(expr.expression)) {
3704
+ const headersIterator = L.lowerDynamicHeadersIteratorCall(expr, expr.expression);
3705
+ if (headersIterator)
3706
+ return headersIterator;
3707
+ L.fenceUnsupportedFetchConstructorMember(expr.expression);
3708
+ L.fenceStaticResponseMember(expr.expression, "call");
3709
+ L.fenceStaticHeadersMember(expr.expression, "call");
3710
+ L.fenceStaticReadableStreamMember(expr.expression, "call");
3711
+ }
3682
3712
  // The ELEMENT spelling of a primitive method call — `x['toString']()`,
3683
3713
  // `s['charAt'](0)`: JS resolves it exactly like the dot form, so the
3684
3714
  // literal-keyed shapes with a static lowering route there before the
@@ -4092,6 +4122,7 @@ export const DYN_DISPATCH_METHODS = new Set([
4092
4122
  "setEncoding", "setDefaultEncoding", "setTimeout", "read", "isPaused",
4093
4123
  "writeHead", "setHeader", "getHeader", "hasHeader", "removeHeader",
4094
4124
  "getHeaders", "getHeaderNames", "appendHeader", "flushHeaders",
4125
+ "append", "delete", "get", "getSetCookie", "has", "set",
4095
4126
  "writeContinue", "writeEarlyHints", "cork", "uncork", "addTrailers",
4096
4127
  "ref", "unref", "address", "setNoDelay", "setKeepAlive", "connect",
4097
4128
  "resetAndDestroy", "destroySoon",
@@ -4104,6 +4135,15 @@ export const DYN_DISPATCH_METHODS = new Set([
4104
4135
  // server ops; no other dyn prototype declares either name, so the
4105
4136
  // remainder keeps the stored-member answers.
4106
4137
  "listen", "close",
4138
+ // The native WHATWG readable-stream and AbortSignal handles used by
4139
+ // static fetch. These route through SCR_DYN_HANDLE dispatch just like
4140
+ // the http/net names above.
4141
+ "getReader", "cancel", "releaseLock", "enqueue", "error",
4142
+ "throwIfAborted", "addEventListener", "removeEventListener",
4143
+ "dispatchEvent",
4144
+ "preventDefault", "stopPropagation", "stopImmediatePropagation",
4145
+ "composedPath",
4146
+ "json", "text", "bytes",
4107
4147
  // Promise.prototype (SCR_DYN_PROMISE receivers): the reaction trio
4108
4148
  // rides the fiber machinery (scr_dyn_promise_then); on every other dyn
4109
4149
  // kind then/catch/finally answer the stored-member path (OBJ own