@scriptc/compiler 0.0.0 → 0.0.2

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 (206) hide show
  1. package/LICENSE +202 -0
  2. package/ambient/package.json +3 -0
  3. package/ambient/scriptc-node-fallback.d.ts +3001 -0
  4. package/ambient/scriptc-overrides.d.ts +95 -0
  5. package/ambient/scriptc.d.ts +74 -0
  6. package/dist/backend/cc.d.ts +169 -0
  7. package/dist/backend/cc.js +897 -0
  8. package/dist/backend/cc.js.map +1 -0
  9. package/dist/backend/emission/emit-async.d.ts +145 -0
  10. package/dist/backend/emission/emit-async.js +996 -0
  11. package/dist/backend/emission/emit-async.js.map +1 -0
  12. package/dist/backend/emission/emit-exprs.d.ts +3 -0
  13. package/dist/backend/emission/emit-exprs.js +5949 -0
  14. package/dist/backend/emission/emit-exprs.js.map +1 -0
  15. package/dist/backend/emission/emit-island.d.ts +45 -0
  16. package/dist/backend/emission/emit-island.js +271 -0
  17. package/dist/backend/emission/emit-island.js.map +1 -0
  18. package/dist/backend/emission/emit-shapes.d.ts +142 -0
  19. package/dist/backend/emission/emit-shapes.js +575 -0
  20. package/dist/backend/emission/emit-shapes.js.map +1 -0
  21. package/dist/backend/emission/emit-stmts.d.ts +78 -0
  22. package/dist/backend/emission/emit-stmts.js +960 -0
  23. package/dist/backend/emission/emit-stmts.js.map +1 -0
  24. package/dist/backend/emission/emit-types.d.ts +65 -0
  25. package/dist/backend/emission/emit-types.js +652 -0
  26. package/dist/backend/emission/emit-types.js.map +1 -0
  27. package/dist/backend/emission/emit-walkers.d.ts +154 -0
  28. package/dist/backend/emission/emit-walkers.js +1587 -0
  29. package/dist/backend/emission/emit-walkers.js.map +1 -0
  30. package/dist/backend/emission/emitter.d.ts +452 -0
  31. package/dist/backend/emission/emitter.js +1249 -0
  32. package/dist/backend/emission/emitter.js.map +1 -0
  33. package/dist/backend/emission/may-throw.d.ts +15 -0
  34. package/dist/backend/emission/may-throw.js +250 -0
  35. package/dist/backend/emission/may-throw.js.map +1 -0
  36. package/dist/backend/llvm/blocks.d.ts +21 -0
  37. package/dist/backend/llvm/blocks.js +68 -0
  38. package/dist/backend/llvm/blocks.js.map +1 -0
  39. package/dist/backend/llvm/classes.d.ts +84 -0
  40. package/dist/backend/llvm/classes.js +438 -0
  41. package/dist/backend/llvm/classes.js.map +1 -0
  42. package/dist/backend/llvm/dyn.d.ts +123 -0
  43. package/dist/backend/llvm/dyn.js +2624 -0
  44. package/dist/backend/llvm/dyn.js.map +1 -0
  45. package/dist/backend/llvm/emitter.d.ts +3 -0
  46. package/dist/backend/llvm/emitter.js +10102 -0
  47. package/dist/backend/llvm/emitter.js.map +1 -0
  48. package/dist/backend/llvm/shapes.d.ts +78 -0
  49. package/dist/backend/llvm/shapes.js +754 -0
  50. package/dist/backend/llvm/shapes.js.map +1 -0
  51. package/dist/backend/llvm/unsupported.d.ts +6 -0
  52. package/dist/backend/llvm/unsupported.js +12 -0
  53. package/dist/backend/llvm/unsupported.js.map +1 -0
  54. package/dist/backend/llvm/walkers.d.ts +58 -0
  55. package/dist/backend/llvm/walkers.js +793 -0
  56. package/dist/backend/llvm/walkers.js.map +1 -0
  57. package/dist/backend/mangle.d.ts +124 -0
  58. package/dist/backend/mangle.js +232 -0
  59. package/dist/backend/mangle.js.map +1 -0
  60. package/dist/coverage/report.d.ts +65 -0
  61. package/dist/coverage/report.js +238 -0
  62. package/dist/coverage/report.js.map +1 -0
  63. package/dist/diagnostics/diagnostic.d.ts +140 -0
  64. package/dist/diagnostics/diagnostic.js +458 -0
  65. package/dist/diagnostics/diagnostic.js.map +1 -0
  66. package/dist/diagnostics/render.d.ts +11 -0
  67. package/dist/diagnostics/render.js +58 -0
  68. package/dist/diagnostics/render.js.map +1 -0
  69. package/dist/frontend/cjs-lexer.d.ts +20 -0
  70. package/dist/frontend/cjs-lexer.js +813 -0
  71. package/dist/frontend/cjs-lexer.js.map +1 -0
  72. package/dist/frontend/lowering/http2-constants.d.ts +1 -0
  73. package/dist/frontend/lowering/http2-constants.js +251 -0
  74. package/dist/frontend/lowering/http2-constants.js.map +1 -0
  75. package/dist/frontend/lowering/lib-boundary.d.ts +6 -0
  76. package/dist/frontend/lowering/lib-boundary.js +143 -0
  77. package/dist/frontend/lowering/lib-boundary.js.map +1 -0
  78. package/dist/frontend/lowering/lower-assert.d.ts +18 -0
  79. package/dist/frontend/lowering/lower-assert.js +1269 -0
  80. package/dist/frontend/lowering/lower-assert.js.map +1 -0
  81. package/dist/frontend/lowering/lower-builtins.d.ts +511 -0
  82. package/dist/frontend/lowering/lower-builtins.js +5249 -0
  83. package/dist/frontend/lowering/lower-builtins.js.map +1 -0
  84. package/dist/frontend/lowering/lower-calls.d.ts +581 -0
  85. package/dist/frontend/lowering/lower-calls.js +6286 -0
  86. package/dist/frontend/lowering/lower-calls.js.map +1 -0
  87. package/dist/frontend/lowering/lower-classes.d.ts +727 -0
  88. package/dist/frontend/lowering/lower-classes.js +4701 -0
  89. package/dist/frontend/lowering/lower-classes.js.map +1 -0
  90. package/dist/frontend/lowering/lower-comptime.d.ts +53 -0
  91. package/dist/frontend/lowering/lower-comptime.js +244 -0
  92. package/dist/frontend/lowering/lower-comptime.js.map +1 -0
  93. package/dist/frontend/lowering/lower-containers.d.ts +486 -0
  94. package/dist/frontend/lowering/lower-containers.js +6345 -0
  95. package/dist/frontend/lowering/lower-containers.js.map +1 -0
  96. package/dist/frontend/lowering/lower-dgram.d.ts +20 -0
  97. package/dist/frontend/lowering/lower-dgram.js +319 -0
  98. package/dist/frontend/lowering/lower-dgram.js.map +1 -0
  99. package/dist/frontend/lowering/lower-emitter.d.ts +10 -0
  100. package/dist/frontend/lowering/lower-emitter.js +688 -0
  101. package/dist/frontend/lowering/lower-emitter.js.map +1 -0
  102. package/dist/frontend/lowering/lower-enums.d.ts +22 -0
  103. package/dist/frontend/lowering/lower-enums.js +235 -0
  104. package/dist/frontend/lowering/lower-enums.js.map +1 -0
  105. package/dist/frontend/lowering/lower-expando.d.ts +35 -0
  106. package/dist/frontend/lowering/lower-expando.js +276 -0
  107. package/dist/frontend/lowering/lower-expando.js.map +1 -0
  108. package/dist/frontend/lowering/lower-exprs.d.ts +524 -0
  109. package/dist/frontend/lowering/lower-exprs.js +8111 -0
  110. package/dist/frontend/lowering/lower-exprs.js.map +1 -0
  111. package/dist/frontend/lowering/lower-generators.d.ts +50 -0
  112. package/dist/frontend/lowering/lower-generators.js +421 -0
  113. package/dist/frontend/lowering/lower-generators.js.map +1 -0
  114. package/dist/frontend/lowering/lower-inspect.d.ts +20 -0
  115. package/dist/frontend/lowering/lower-inspect.js +1074 -0
  116. package/dist/frontend/lowering/lower-inspect.js.map +1 -0
  117. package/dist/frontend/lowering/lower-island.d.ts +108 -0
  118. package/dist/frontend/lowering/lower-island.js +650 -0
  119. package/dist/frontend/lowering/lower-island.js.map +1 -0
  120. package/dist/frontend/lowering/lower-mixins.d.ts +96 -0
  121. package/dist/frontend/lowering/lower-mixins.js +534 -0
  122. package/dist/frontend/lowering/lower-mixins.js.map +1 -0
  123. package/dist/frontend/lowering/lower-modules.d.ts +135 -0
  124. package/dist/frontend/lowering/lower-modules.js +1613 -0
  125. package/dist/frontend/lowering/lower-modules.js.map +1 -0
  126. package/dist/frontend/lowering/lower-namespaces.d.ts +168 -0
  127. package/dist/frontend/lowering/lower-namespaces.js +706 -0
  128. package/dist/frontend/lowering/lower-namespaces.js.map +1 -0
  129. package/dist/frontend/lowering/lower-server.d.ts +90 -0
  130. package/dist/frontend/lowering/lower-server.js +3471 -0
  131. package/dist/frontend/lowering/lower-server.js.map +1 -0
  132. package/dist/frontend/lowering/lower-stmts.d.ts +361 -0
  133. package/dist/frontend/lowering/lower-stmts.js +5341 -0
  134. package/dist/frontend/lowering/lower-stmts.js.map +1 -0
  135. package/dist/frontend/lowering/lower-stream.d.ts +88 -0
  136. package/dist/frontend/lowering/lower-stream.js +1533 -0
  137. package/dist/frontend/lowering/lower-stream.js.map +1 -0
  138. package/dist/frontend/lowering/lower-test.d.ts +27 -0
  139. package/dist/frontend/lowering/lower-test.js +353 -0
  140. package/dist/frontend/lowering/lower-test.js.map +1 -0
  141. package/dist/frontend/lowering/lowerer.d.ts +1748 -0
  142. package/dist/frontend/lowering/lowerer.js +6257 -0
  143. package/dist/frontend/lowering/lowerer.js.map +1 -0
  144. package/dist/frontend/lowering/surfaces.d.ts +272 -0
  145. package/dist/frontend/lowering/surfaces.js +1096 -0
  146. package/dist/frontend/lowering/surfaces.js.map +1 -0
  147. package/dist/frontend/npm-static.d.ts +55 -0
  148. package/dist/frontend/npm-static.js +300 -0
  149. package/dist/frontend/npm-static.js.map +1 -0
  150. package/dist/frontend/npm.d.ts +330 -0
  151. package/dist/frontend/npm.js +1259 -0
  152. package/dist/frontend/npm.js.map +1 -0
  153. package/dist/frontend/program.d.ts +186 -0
  154. package/dist/frontend/program.js +2255 -0
  155. package/dist/frontend/program.js.map +1 -0
  156. package/dist/frontend/provenance-registry.d.ts +48 -0
  157. package/dist/frontend/provenance-registry.js +87 -0
  158. package/dist/frontend/provenance-registry.js.map +1 -0
  159. package/dist/frontend/provenance.d.ts +6 -0
  160. package/dist/frontend/provenance.js +459 -0
  161. package/dist/frontend/provenance.js.map +1 -0
  162. package/dist/frontend/resolve.d.ts +56 -0
  163. package/dist/frontend/resolve.js +682 -0
  164. package/dist/frontend/resolve.js.map +1 -0
  165. package/dist/frontend/shared.d.ts +67 -0
  166. package/dist/frontend/shared.js +241 -0
  167. package/dist/frontend/shared.js.map +1 -0
  168. package/dist/frontend/ts7/adapter.d.ts +7 -0
  169. package/dist/frontend/ts7/adapter.js +54 -0
  170. package/dist/frontend/ts7/adapter.js.map +1 -0
  171. package/dist/frontend/ts7/ast.d.ts +50 -0
  172. package/dist/frontend/ts7/ast.js +211 -0
  173. package/dist/frontend/ts7/ast.js.map +1 -0
  174. package/dist/frontend/ts7/census-check.d.ts +1 -0
  175. package/dist/frontend/ts7/census-check.js +12 -0
  176. package/dist/frontend/ts7/census-check.js.map +1 -0
  177. package/dist/frontend/ts7/checker.d.ts +140 -0
  178. package/dist/frontend/ts7/checker.js +544 -0
  179. package/dist/frontend/ts7/checker.js.map +1 -0
  180. package/dist/frontend/ts7/enums.d.ts +18 -0
  181. package/dist/frontend/ts7/enums.js +43 -0
  182. package/dist/frontend/ts7/enums.js.map +1 -0
  183. package/dist/frontend/ts7/program.d.ts +99 -0
  184. package/dist/frontend/ts7/program.js +278 -0
  185. package/dist/frontend/ts7/program.js.map +1 -0
  186. package/dist/frontend/ts7/world-check.d.ts +3 -0
  187. package/dist/frontend/ts7/world-check.js +34 -0
  188. package/dist/frontend/ts7/world-check.js.map +1 -0
  189. package/dist/frontend/types.d.ts +205 -0
  190. package/dist/frontend/types.js +2485 -0
  191. package/dist/frontend/types.js.map +1 -0
  192. package/dist/index.d.ts +85 -0
  193. package/dist/index.js +429 -0
  194. package/dist/index.js.map +1 -0
  195. package/dist/ir/nodes.d.ts +4334 -0
  196. package/dist/ir/nodes.js +1906 -0
  197. package/dist/ir/nodes.js.map +1 -0
  198. package/dist/ir/serialize.d.ts +4 -0
  199. package/dist/ir/serialize.js +34 -0
  200. package/dist/ir/serialize.js.map +1 -0
  201. package/dist/ir/validate.d.ts +36 -0
  202. package/dist/ir/validate.js +4885 -0
  203. package/dist/ir/validate.js.map +1 -0
  204. package/package.json +30 -6
  205. package/README.md +0 -3
  206. package/index.js +0 -2
@@ -0,0 +1,238 @@
1
+ import { renderAll } from "../diagnostics/render.js";
2
+ const GREEN = "\x1b[32m";
3
+ const YELLOW = "\x1b[33m";
4
+ const RED = "\x1b[31m";
5
+ const DIM = "\x1b[2m";
6
+ const BOLD = "\x1b[1m";
7
+ const RESET = "\x1b[0m";
8
+ const MILESTONE_ORDER = ["M1", "M2", "M3", "M4", "M5", "later"];
9
+ /** Codes whose construct RUNS under --dynamic (the embedded engine) — the
10
+ * report separates "one flag away" from "cannot compile at all". */
11
+ const DYNAMIC_CAPABLE = new Set(["SC2010", "SC2011", "SC2012", "SC2013"]);
12
+ export function renderCoverage(input, opts = {}) {
13
+ const c = (code, s) => (opts.color ? code + s + RESET : s);
14
+ const out = [];
15
+ out.push(`${c(BOLD, "scriptc coverage")} ${DIMPath(input.file, opts.color ?? false)}`);
16
+ out.push("");
17
+ if (input.preflightFailed) {
18
+ // Three preflight failure shapes, in order of "whose problem is it":
19
+ // an incompatible project config (SC0002 — ours to explain), real
20
+ // TypeScript errors (theirs to fix), and OUR import-form fences
21
+ // (SC1xxx from checkPreflight — lowering-style blockers that shape
22
+ // the module graph, reported as blockers instead of masquerading as
23
+ // "TypeScript errors").
24
+ const config = input.diagnostics.filter((d) => d.code === "SC0002");
25
+ if (config.length > 0) {
26
+ out.push(` ${c(RED, "not analyzable")}: ${config[0].message}`);
27
+ return out.join("\n");
28
+ }
29
+ const tsc = input.diagnostics.filter((d) => d.code === "SC0001");
30
+ if (tsc.length > 0) {
31
+ out.push(` ${c(RED, "not analyzable")}: ${tsc.length} TypeScript error${tsc.length === 1 ? "" : "s"} — ` +
32
+ `fix type errors first (scriptc only analyzes programs that typecheck)`);
33
+ // The same rendered diagnostics a build prints: coverage is the
34
+ // command people reach for first, so the verdict line alone would
35
+ // swallow the code frames that say what to fix.
36
+ if (opts.sourceTexts) {
37
+ out.push("");
38
+ out.push(renderAll(tsc, opts.sourceTexts, { color: opts.color ?? false }));
39
+ }
40
+ return out.join("\n");
41
+ }
42
+ const n = input.diagnostics.length;
43
+ out.push(` ${c(RED, "analysis stopped at preflight")}: ${n} unsupported import site${n === 1 ? "" : "s"} — ` +
44
+ `the module graph must load before statements can be counted`);
45
+ const blockers = groupBlockers(input.diagnostics);
46
+ const widest = Math.max(...blockers.map((b) => b.what.length));
47
+ for (const b of blockers) {
48
+ out.push(` ${c(RED, `×${b.count}`.padStart(4))} ${b.what.padEnd(widest)} ${c(DIM, b.code)}`);
49
+ }
50
+ if (opts.sourceTexts) {
51
+ out.push("");
52
+ out.push(renderAll(input.diagnostics, opts.sourceTexts, { color: opts.color ?? false }));
53
+ }
54
+ return out.join("\n");
55
+ }
56
+ // Top-line numbers stay whole-program: reached statements plus the
57
+ // unreached remainder the analysis lowered anyway. Under --dynamic the
58
+ // island-lowered statements split out as "compile dynamically" — they
59
+ // BUILD, but their work runs in the embedded engine, and counting them
60
+ // as static would overstate how native the program is.
61
+ const un = input.unreached;
62
+ const total = input.stats.statementsTotal + (un?.stats.statementsTotal ?? 0);
63
+ const failed = input.stats.statementsFailed + (un?.stats.statementsFailed ?? 0);
64
+ const island = input.stats.statementsIsland + (un?.stats.statementsIsland ?? 0);
65
+ const skipped = input.stats.functionsSkipped + (un?.stats.functionsSkipped ?? 0);
66
+ const ok = total - failed - island;
67
+ const pct = total === 0 ? 100 : Math.floor((ok / total) * 100);
68
+ const pctColor = pct === 100 ? GREEN : pct >= 75 ? YELLOW : RED;
69
+ out.push(` statements analyzed ${total}`);
70
+ out.push(` compile statically ${ok} ${c(pctColor, c(BOLD, `(${pct}%)`))}`);
71
+ if (input.dynamic) {
72
+ const ipct = total === 0 ? 0 : Math.floor((island / total) * 100);
73
+ out.push(` compile dynamically ${island} ${c(YELLOW, c(BOLD, `(${ipct}%)`))} ${c(DIM, "(island sites — the embedded engine runs them)")}`);
74
+ }
75
+ if (skipped > 0) {
76
+ out.push(` ${c(DIM, `(+${skipped} function${skipped === 1 ? "" : "s"} not analyzed — signature blocked)`)}`);
77
+ }
78
+ out.push("");
79
+ // --npm-static outcomes: which opted-in packages compiled statically as
80
+ // program modules and which fell back to the island (with the first
81
+ // refusal reason) — the flag's honesty section.
82
+ const npmStatic = input.npmStatic ?? [];
83
+ if (npmStatic.length > 0) {
84
+ out.push(` ${c(DIM, "npm packages compiled statically (--npm-static):")}`);
85
+ const widestP = Math.max(...npmStatic.map((s) => s.package.length));
86
+ for (const s of npmStatic) {
87
+ const status = s.status === "static"
88
+ ? c(GREEN, "static")
89
+ : c(YELLOW, "island fallback") + (s.detail !== undefined ? ` ${c(DIM, `(${s.detail})`)}` : "");
90
+ out.push(` ${s.package.padEnd(widestP)} ${status}`);
91
+ }
92
+ out.push("");
93
+ }
94
+ // What the embedded npm code asks of the island: every Node builtin the
95
+ // graph imports, with its shim status, plus every unresolvable specifier
96
+ // only require()/import() edges reach. Eagerly-blocked builtins also
97
+ // surface as SC2030 blockers below; "lazy trap" rows DON'T fail the
98
+ // build — the binary embeds Node's call-time error and the call throws
99
+ // at runtime, exactly where Node would have failed.
100
+ const builtins = (input.dynamic && input.npmBuiltins) || [];
101
+ const traps = (input.dynamic && input.npmLazyTraps) || [];
102
+ if (builtins.length > 0 || traps.length > 0) {
103
+ out.push(` ${c(DIM, traps.length > 0 ? "embedded npm code imports Node builtins and unresolved specifiers:" : "embedded npm code imports Node builtins:")}`);
104
+ const widestB = Math.max(...builtins.map((b) => b.builtin.length), ...traps.map((t) => t.specifier.length));
105
+ // Pad the plain words before coloring — escape codes have no width.
106
+ const widestS = Math.max(...builtins.map((b) => (b.shimmed ? 7 : b.lazy ? 23 : 11)), ...traps.map(() => 24));
107
+ for (const b of builtins) {
108
+ const status = b.shimmed
109
+ ? c(GREEN, "shimmed".padEnd(widestS))
110
+ : b.lazy
111
+ ? c(YELLOW, "not shimmed — lazy trap".padEnd(widestS))
112
+ : c(RED, "not shimmed".padEnd(widestS));
113
+ out.push(` ${b.builtin.padEnd(widestB)} ${status} ${c(DIM, `(${b.packages.join(", ")})`)}`);
114
+ }
115
+ for (const t of traps) {
116
+ // A native .node addon RESOLVED — the island cannot dlopen it, so
117
+ // the build embedded a throwing ERR_DLOPEN_FAILED stub instead of
118
+ // the addon's machine code; unresolvable rows keep Node's not-found
119
+ // error shapes.
120
+ const what = t.native ? "native addon — lazy trap" : "unresolvable — lazy trap";
121
+ out.push(` ${t.specifier.padEnd(widestB)} ${c(YELLOW, what.padEnd(widestS))} ` +
122
+ c(DIM, `(${t.via.join("/")} in ${t.packages.join(", ")})`));
123
+ }
124
+ if (builtins.some((b) => b.lazy) || traps.length > 0) {
125
+ out.push(` ${c(DIM, "(lazy trap: only reachable through require()/import() boundaries — the build embeds Node's call-time error; the call throws at runtime)")}`);
126
+ }
127
+ out.push("");
128
+ }
129
+ // --provenance-sources: per-package attribution — the answer to "did
130
+ // the DEPENDENCY's statements compile static?", computed by summing
131
+ // statsByFile entries under each package's source dir. Elided
132
+ // pure-annotated dead consts and fallback notes render here too, so
133
+ // the provenance story is complete in one place.
134
+ if (input.provenance !== undefined) {
135
+ const prov = input.provenance;
136
+ out.push(` ${c(BOLD, "provenance sources")} ${c(DIM, "(attested source compiled as program modules)")}`);
137
+ for (const pkg of prov.packages) {
138
+ let pTotal = 0;
139
+ let pFailed = 0;
140
+ let pIsland = 0;
141
+ const dir = pkg.dir.endsWith("/") ? pkg.dir : `${pkg.dir}/`;
142
+ for (const [file, s] of input.statsByFile ?? []) {
143
+ if (!file.startsWith(dir))
144
+ continue;
145
+ pTotal += s.total;
146
+ pFailed += s.failed;
147
+ pIsland += s.island;
148
+ }
149
+ const elided = (input.provenanceElided ?? []).filter((d) => d.loc.file.startsWith(dir)).length;
150
+ const pOk = pTotal - pFailed - pIsland;
151
+ const pPct = pTotal === 0 ? 100 : Math.floor((pOk / pTotal) * 100);
152
+ const pColor = pPct === 100 ? GREEN : pPct >= 75 ? YELLOW : RED;
153
+ const shortRepo = pkg.repo.replace(/^git\+/, "").replace(/^https:\/\//, "").replace(/@refs\/.*$/, "");
154
+ out.push(` ${pkg.name}@${pkg.version} ${c(DIM, `${shortRepo} @ ${pkg.commit.slice(0, 12)}`)}`);
155
+ out.push(` ${pTotal} statements: ${pOk} static ${c(pColor, c(BOLD, `(${pPct}%)`))}, ${pIsland} island, ${pFailed} fenced` +
156
+ (elided > 0 ? ` ${c(DIM, `(${elided} fence${elided === 1 ? "" : "s"} elided as @__PURE__ dead consts — uses would fence per site)`)}` : ""));
157
+ }
158
+ for (const note of prov.notes)
159
+ out.push(` ${c(YELLOW, "note")} ${note}`);
160
+ out.push("");
161
+ }
162
+ // JS statements whose fences DEFERRED to runtime (the runtimeFence
163
+ // statements the module carries): they compile, but executing one
164
+ // throws its SC-coded error — the report lists them so a "compiling"
165
+ // JS program never hides its dynamic gaps.
166
+ const fences = input.runtimeFences ?? [];
167
+ if (fences.length > 0) {
168
+ const grouped = groupBlockers(fences);
169
+ const widestF = Math.max(...grouped.map((b) => b.what.length));
170
+ out.push(` ${c(YELLOW, "deferred to runtime")} ${fences.length} site${fences.length === 1 ? "" : "s"} ${c(DIM, "(JS statements that throw their fence if executed)")}`);
171
+ for (const b of grouped) {
172
+ out.push(` ${c(YELLOW, `×${b.count}`.padStart(4))} ${b.what.padEnd(widestF)} ${c(DIM, b.code)}`);
173
+ }
174
+ out.push("");
175
+ }
176
+ const unreachedDiags = un?.diagnostics ?? [];
177
+ if (failed === 0 && input.diagnostics.length === 0 && unreachedDiags.length === 0) {
178
+ out.push(island > 0
179
+ ? ` ${c(GREEN, "builds with --dynamic")} — no remaining blockers (the island sites above run in the embedded engine).`
180
+ : ` ${c(GREEN, "fully static")} — this program has no dynamic remainder.`);
181
+ return out.join("\n");
182
+ }
183
+ // Ordered by internal scheduling (soonest first), then by frequency —
184
+ // the top line is the blocker most likely to disappear next. The
185
+ // milestone labels themselves are maintainer business and never rendered.
186
+ // Blockers split by what a flag can fix: sites that RUN under --dynamic
187
+ // (the embedded engine) versus constructs with no lowering at all.
188
+ const blockers = groupBlockers(input.diagnostics);
189
+ const unreachedBlockers = groupBlockers(unreachedDiags);
190
+ const dynamic = blockers.filter((b) => DYNAMIC_CAPABLE.has(b.code));
191
+ const rejected = blockers.filter((b) => !DYNAMIC_CAPABLE.has(b.code));
192
+ const widest = Math.max(...[...blockers, ...unreachedBlockers].map((b) => b.what.length));
193
+ const renderGroup = (group, dim = false) => {
194
+ for (const b of group) {
195
+ const what = b.what.padEnd(widest);
196
+ out.push(` ${c(dim ? DIM : RED, `×${b.count}`.padStart(4))} ${dim ? c(DIM, what) : what} ${c(DIM, b.code)}`);
197
+ }
198
+ };
199
+ if (dynamic.length > 0) {
200
+ const sites = dynamic.reduce((n, b) => n + b.count, 0);
201
+ out.push(` ${c(YELLOW, `runs with --dynamic`)} ${sites} site${sites === 1 ? "" : "s"} ${c(DIM, "(embeds a JS engine, ~620KB — static stays the default)")}`);
202
+ renderGroup(dynamic);
203
+ out.push("");
204
+ }
205
+ if (rejected.length > 0) {
206
+ out.push(` blockers:`);
207
+ renderGroup(rejected);
208
+ }
209
+ // Blockers in code nothing on the entry path reaches: never lowered by
210
+ // a build, so they cannot fail one — secondary by design.
211
+ if (unreachedBlockers.length > 0) {
212
+ if (rejected.length > 0)
213
+ out.push("");
214
+ out.push(` ${c(DIM, "in unreached code")} ${c(DIM, "(never lowered — cannot fail a build)")}`);
215
+ renderGroup(unreachedBlockers, true);
216
+ }
217
+ return out.join("\n");
218
+ }
219
+ function DIMPath(file, color) {
220
+ return color ? DIM + file + RESET : file;
221
+ }
222
+ function groupBlockers(diags) {
223
+ const byCode = new Map();
224
+ for (const d of diags) {
225
+ const what = d.message.replace(/ (?:is|are) not supported yet$/, "");
226
+ const key = `${d.code}:${what}`;
227
+ const existing = byCode.get(key);
228
+ if (existing)
229
+ existing.count++;
230
+ else
231
+ byCode.set(key, { code: d.code, what, milestone: d.milestone, count: 1 });
232
+ }
233
+ const rank = (m) => m === undefined ? MILESTONE_ORDER.length : MILESTONE_ORDER.indexOf(m);
234
+ return [...byCode.values()].sort((a, b) => rank(a.milestone) - rank(b.milestone) ||
235
+ b.count - a.count ||
236
+ a.code.localeCompare(b.code));
237
+ }
238
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/coverage/report.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAyDrD,MAAM,KAAK,GAAG,UAAU,CAAC;AACzB,MAAM,MAAM,GAAG,UAAU,CAAC;AAC1B,MAAM,GAAG,GAAG,UAAU,CAAC;AACvB,MAAM,GAAG,GAAG,S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AAC,IAAI,CAC9B,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACrC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK;QACjB,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAC/B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,140 @@
1
+ import type { SrcLoc } from "../ir/nodes.js";
2
+ export type Milestone = "M1" | "M2" | "M3" | "M4" | "M5" | "later";
3
+ export interface ScrDiagnostic {
4
+ code: `SC${number}`;
5
+ message: string;
6
+ loc: SrcLoc;
7
+ milestone?: Milestone;
8
+ hint?: string;
9
+ }
10
+ interface UnsupportedEntry {
11
+ feature: string;
12
+ milestone: Milestone;
13
+ hint?: string;
14
+ }
15
+ export declare const UNSUPPORTED: Record<string, UnsupportedEntry>;
16
+ export declare function unsupportedDiag(code: keyof typeof UNSUPPORTED & `SC${number}`, loc: SrcLoc, featureOverride?: string, hintOverride?: string): ScrDiagnostic;
17
+ export declare function tscPassthroughDiag(message: string, loc: SrcLoc): ScrDiagnostic;
18
+ /** The project's tsconfig disables strictNullChecks, which scriptc cannot
19
+ * adopt: null and undefined are DISTINCT STATIC TYPES in the value model
20
+ * (union arms with their own runtime representation) — with the knob off,
21
+ * every type silently includes them and nothing about the model holds. The
22
+ * config gate fails loudly instead of silently re-enabling the knob. */
23
+ /** True for the sync channel's surfaced Go panics: typescript-go wraps a
24
+ * server-side panic into a thrown Error whose message starts "panic:" and
25
+ * keeps the server intact (the prefetch fence's original finding). The
26
+ * 2026-07-19 sweep's three upstream panics — the TupleType interface
27
+ * conversion, the import.defer Debug failure, the 1e999 JSON marshal — all
28
+ * arrive in this shape. */
29
+ export declare function isCheckerPanic(e: unknown): e is Error;
30
+ /** A Go panic inside the typescript-go checker reached through a query
31
+ * about this source position. Upstream bugs from scriptc's point of view —
32
+ * but scriptc still owes a source-anchored diagnostic, never a crashed
33
+ * CLI. */
34
+ export declare function checkerPanicDiag(detail: string, loc: SrcLoc): ScrDiagnostic;
35
+ /** An imported .json module whose text strict JSON.parse rejects (a leading
36
+ * `//` comment line — the importAttributes11 shape). tsgo tolerates it, so
37
+ * the SC0001 passthrough never fires; Node itself refuses to import such a
38
+ * module at runtime, and the honest answer is a source-anchored gate at the
39
+ * import, never an uncaught parse throw. */
40
+ export declare function invalidJsonModuleDiag(fileName: string, detail: string, loc: SrcLoc): ScrDiagnostic;
41
+ export declare function strictNullChecksFloorDiag(configFile: string): ScrDiagnostic;
42
+ export declare function unsupportedTypeDiag(typeText: string, loc: SrcLoc): ScrDiagnostic;
43
+ /** A type with a DYNAMIC representation but no static one — `any[]`,
44
+ * records/functions with `any`-typed members, or a shipped-.d.ts type whose
45
+ * values are island handles. The caller PROVED the claim by re-running
46
+ * mapType with `dynamic: true` before choosing this wording, so the message
47
+ * is a measured fact, not a guess. SC2011 like the bare-`any` arm of
48
+ * unsupportedTypeDiag (one dynamic-family code per story: this is the
49
+ * "values of this TYPE run in the engine" story), and "runs in" voice like
50
+ * SC2012 — the value exists under --dynamic; the build just didn't opt in. */
51
+ export declare function requiresDynamicTypeDiag(typeText: string, loc: SrcLoc): ScrDiagnostic;
52
+ /** A value whose type keeps a GENERIC call signature (`let g: <T>(x: T) =>
53
+ * T`, a stored generic function, a call result the checker left
54
+ * higher-order generic): every compiled function is one concrete
55
+ * signature, so a slot that keeps type parameters has no instance to hold
56
+ * — the generic-value monomorphization rule, named instead of the generic
57
+ * supported-types recitation. */
58
+ export declare function genericSignatureTypeDiag(typeText: string, loc: SrcLoc): ScrDiagnostic;
59
+ /** An index-signature object type that STILL does not map: STRING and
60
+ * NUMBER index signatures compile (declared fields + an overflow map for
61
+ * undeclared keys, number keys canonicalized to their JS string spelling),
62
+ * so reaching this means a symbol-keyed signature, dual signatures with
63
+ * UNEQUAL value types, a value type outside the supported set (functions,
64
+ * Maps, promises, ...), or a declared `unknown` field under the signature.
65
+ * The message points at the working alternatives. */
66
+ export declare function indexSignatureTypeDiag(typeText: string, loc: SrcLoc): ScrDiagnostic;
67
+ /** A REACHED use of standard-library surface with no lowering — the scope
68
+ * fence of the real-lib type world. The checker sees the full es2025
69
+ * standard library, so `Symbol`, `new Date()`, `p.then(...)`, `Math.min`
70
+ * with three arguments all TYPECHECK; each use site of surface (or a call
71
+ * form of it) that nothing lowers reports here instead of the old minimal-
72
+ * ambient "Cannot find name" — and never ICEs. `surface` names what was
73
+ * used ('Symbol', 'Math.sumPrecise', 'new Date', 'string.normalize'). */
74
+ export declare function noLoweringDiag(surface: string, loc: SrcLoc, hint?: string, viaNodeTypes?: boolean): ScrDiagnostic;
75
+ /** Records are monomorphic structs, so a value's shape must match the
76
+ * expected shape EXACTLY — TypeScript's structural width subtyping
77
+ * (`{a: 1, b: 2}` where `{a: number}` is expected) would need a runtime
78
+ * shape coercion that doesn't exist yet. */
79
+ export declare function recordShapeMismatchDiag(expectedText: string, actualText: string, loc: SrcLoc): ScrDiagnostic;
80
+ /** Union values carry a runtime tag assigned per-union: a value of one
81
+ * union type flowing into a DIFFERENT union's slot re-tags at runtime when
82
+ * every source arm has a home in the destination (`A | B` into `A | B | C`
83
+ * — see unionRetagHelper). What this rejects is the remainder: a source arm
84
+ * with no identical destination arm, where the value could not be
85
+ * represented in the target union at all. */
86
+ export declare function unionMismatchDiag(expectedText: string, actualText: string, loc: SrcLoc): ScrDiagnostic;
87
+ /** A use of a binding whose DECLARATION did not compile: the declaration
88
+ * site already carries the real diagnostic (a fenced type, a blocked
89
+ * signature, an unsupported binding form), and every later reference falls
90
+ * through the resolution steps because no local/global/function was ever
91
+ * registered under the symbol. This cascade marker names the binding and
92
+ * points back at the root cause instead of misreporting the reference as
93
+ * an unsupported construct of its own. */
94
+ export declare function blockedBindingUseDiag(name: string, loc: SrcLoc): ScrDiagnostic;
95
+ /** An OPERATION on an `any`-typed value with no static lowering, in a
96
+ * static build. The honest static subset of `any` compiles (bindings ride
97
+ * the checked-dynamic DOM — declarations, assignments, reads, equality,
98
+ * typeof, truthiness, templates, calls through boxed functions), but the
99
+ * operations that need JS's full coercion/mutation semantics (operators,
100
+ * expando writes, computed member names, iteration) execute only in the
101
+ * engine. Same code as the `any` type fence (SC2011) so the coverage
102
+ * report and the two-tier retry treat both as one dynamic-capable family:
103
+ * the island lifts exactly these sites. */
104
+ export declare function anyOpRequiresDynamicDiag(feature: string, loc: SrcLoc): ScrDiagnostic;
105
+ /** A construct that needs the embedded dynamic-island engine was used in a
106
+ * static build. Static is the default and never silently embeds the engine
107
+ * (~620KB); the fix is spelled out in the hint, not applied implicitly.
108
+ * "Requires" (vs SC2011/SC2012's "runs in"): the construct is engine-only
109
+ * — it has no static form to stay with, so the hint offers no alternative. */
110
+ export declare function requiresDynamicDiag(feature: string, loc: SrcLoc): ScrDiagnostic;
111
+ /** An ambient API with an island-backed lowering (Math.*, number/string
112
+ * methods beyond the static set, parseFloat, ...) was used in a static
113
+ * build. Same contract as SC2010, its own code so the coverage report can
114
+ * name the construct: the call RUNS under --dynamic (the engine executes
115
+ * it with JS-exact semantics); without the flag each use site reports the
116
+ * choice instead of ICEing or failing at link time. */
117
+ export declare function requiresDynamicApiDiag(feature: string, loc: SrcLoc): ScrDiagnostic;
118
+ /** An npm package import in a static build. The package's shipped JS has
119
+ * exactly one execution home — the embedded engine — so the import itself
120
+ * "requires" (SC2010's voice); its own code so the coverage report can
121
+ * attribute sites per package. */
122
+ export declare function requiresDynamicImportDiag(pkg: string, loc: SrcLoc): ScrDiagnostic;
123
+ /** A USE SITE of a value whose type the package's .d.ts declares, in a
124
+ * static build. Message names ONLY the package (never the type) so the
125
+ * coverage report groups all of a package's sites into one line. */
126
+ export declare function requiresDynamicPackageDiag(pkg: string, loc: SrcLoc): ScrDiagnostic;
127
+ /** Building the embedded npm runtime graph failed — the package's entry
128
+ * or one of its internal modules can't resolve, or it needs a Node builtin
129
+ * the island doesn't shim. Named per problem, at the import site. */
130
+ export declare function npmEmbedFailedDiag(detail: string, loc: SrcLoc): ScrDiagnostic;
131
+ /** comptime went wrong at evaluation time. The callback runs in an isolated
132
+ * `node:vm` context inside the compiler's own Node process and its RESULT is
133
+ * baked into the binary as a literal — everything that can fail at that
134
+ * stage lands here with a specific detail: the callback threw, evaluation
135
+ * exceeded the compile-time budget, or the returned value cannot be written
136
+ * as a literal of the expected type (NaN/Infinity, undefined/null/functions,
137
+ * shape mismatches — the detail names the offending path, dynCheck-style). */
138
+ export declare function comptimeFailedDiag(detail: string, loc: SrcLoc): ScrDiagnostic;
139
+ export declare function iceDiag(message: string, loc: SrcLoc): ScrDiagnostic;
140
+ export {};