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