@tsplc/compiler 0.2.21 → 0.4.0

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 (115) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +280 -223
  3. package/dist/cli.js.map +12 -12
  4. package/dist/codesys.js +452 -330
  5. package/dist/codesys.js.map +24 -24
  6. package/dist/elaborate-capture.js +112 -7
  7. package/dist/elaborate-capture.js.map +5 -4
  8. package/dist/index.js +5682 -5407
  9. package/dist/index.js.map +39 -37
  10. package/dist/ir.js +1154 -327
  11. package/dist/ir.js.map +23 -20
  12. package/dist/project.js +68 -29
  13. package/dist/project.js.map +4 -4
  14. package/dist/retain.js +8 -0
  15. package/dist/retain.js.map +10 -0
  16. package/dist/server-check.js +59 -0
  17. package/dist/server-check.js.map +11 -0
  18. package/dist/telemetry.js +19 -10
  19. package/dist/telemetry.js.map +3 -3
  20. package/package.json +33 -12
  21. package/src/codesys/config.ts +1 -1
  22. package/src/codesys/debug.ts +7 -21
  23. package/src/codesys/engineering.ts +8 -12
  24. package/src/codesys/global-lists.ts +19 -17
  25. package/src/codesys/global-names.ts +3 -3
  26. package/src/codesys/http.ts +37 -34
  27. package/src/codesys/index.ts +5 -22
  28. package/src/codesys/instrumentation.ts +3 -1
  29. package/src/codesys/io-paths.ts +2 -1
  30. package/src/codesys/manifest.ts +35 -18
  31. package/src/codesys/numeric.ts +2 -4
  32. package/src/codesys/plan.ts +94 -26
  33. package/src/codesys/publication.ts +4 -3
  34. package/src/codesys/routines.ts +2 -2
  35. package/src/codesys/sources.ts +1 -0
  36. package/src/codesys/st-files.ts +86 -50
  37. package/src/codesys/storage.ts +44 -9
  38. package/src/codesys/task-access.ts +32 -10
  39. package/src/codesys/telemetry.ts +93 -46
  40. package/src/codesys/types.ts +81 -3
  41. package/src/codesys/vendor.ts +1 -1
  42. package/src/frontend/analyzer.ts +15 -14
  43. package/src/frontend/async.ts +23 -21
  44. package/src/frontend/blocks.ts +7 -6
  45. package/src/frontend/configuration.ts +8 -6
  46. package/src/frontend/const-functions.ts +5 -5
  47. package/src/frontend/cooperative.ts +2 -1
  48. package/src/frontend/coroutines.ts +24 -21
  49. package/src/frontend/elaborate/calls.ts +12 -7
  50. package/src/frontend/elaborate/capture-protocol.ts +103 -0
  51. package/src/frontend/elaborate/capture.ts +48 -19
  52. package/src/frontend/elaborate/dialect.ts +2 -2
  53. package/src/frontend/elaborate/expressions.ts +9 -6
  54. package/src/frontend/elaborate/frame.ts +1 -1
  55. package/src/frontend/elaborate/graph.ts +27 -43
  56. package/src/frontend/elaborate/index.ts +52 -17
  57. package/src/frontend/elaborate/initializers.ts +3 -2
  58. package/src/frontend/elaborate/layouts.ts +2 -2
  59. package/src/frontend/elaborate/model.ts +34 -21
  60. package/src/frontend/elaborate/retention.ts +206 -0
  61. package/src/frontend/elaborate/specialize.ts +7 -6
  62. package/src/frontend/elaborate/statements.ts +47 -38
  63. package/src/frontend/elaborate/storage.ts +26 -6
  64. package/src/frontend/exposure.ts +6 -6
  65. package/src/frontend/expressions.ts +26 -25
  66. package/src/frontend/intrinsics.ts +3 -3
  67. package/src/frontend/module-graph.ts +1 -1
  68. package/src/frontend/positions.ts +2 -1
  69. package/src/frontend/promise-chains.ts +1 -0
  70. package/src/frontend/promises.ts +8 -7
  71. package/src/frontend/routines.ts +3 -2
  72. package/src/frontend/sdk.ts +2 -2
  73. package/src/frontend/services.ts +23 -20
  74. package/src/frontend/statements.ts +8 -6
  75. package/src/frontend/tasks.ts +11 -6
  76. package/src/frontend/telemetry.ts +1 -1
  77. package/src/frontend/types.ts +11 -9
  78. package/src/frontend/typescript.ts +92 -42
  79. package/src/index.ts +2 -1
  80. package/src/ir/aggregates.ts +4 -3
  81. package/src/ir/allocation.ts +2 -1
  82. package/src/ir/core-model.ts +38 -8
  83. package/src/ir/declarations.ts +12 -12
  84. package/src/ir/domains.ts +8 -8
  85. package/src/ir/fold.ts +2 -2
  86. package/src/ir/index.ts +53 -40
  87. package/src/ir/job-errors.ts +22 -11
  88. package/src/ir/layouts.ts +3 -2
  89. package/src/ir/link.ts +6 -24
  90. package/src/ir/model.ts +3 -2
  91. package/src/ir/normalization-error.ts +1 -1
  92. package/src/ir/normalize.ts +19 -12
  93. package/src/ir/numeric.ts +1 -0
  94. package/src/{codesys → ir}/operands.ts +2 -6
  95. package/src/ir/ranges.ts +2 -2
  96. package/src/ir/routine.ts +35 -20
  97. package/src/ir/scalars.ts +3 -3
  98. package/src/ir/share.ts +862 -0
  99. package/src/ir/temporaries.ts +236 -0
  100. package/src/ir/types.ts +1 -1
  101. package/src/project/artifacts.ts +12 -2
  102. package/src/project/cli.ts +42 -44
  103. package/src/project/debugger.ts +15 -9
  104. package/src/project/index.ts +1 -1
  105. package/src/project/plant.ts +34 -23
  106. package/src/project/project-commands.ts +92 -73
  107. package/src/project/project.ts +91 -42
  108. package/src/project/release.ts +50 -57
  109. package/src/project/server-check.ts +54 -0
  110. package/src/project/server.ts +60 -41
  111. package/src/project/terminal.ts +3 -1
  112. package/stdlib/retain.ts +2 -0
  113. package/types/globals.d.ts +1 -0
  114. package/types/retain.d.ts +6 -0
  115. package/types/telemetry.d.ts +2 -2
@@ -1,8 +1,89 @@
1
1
  // @bun
2
2
  // packages/compiler/src/frontend/elaborate/capture.ts
3
+ import { readFileSync, realpathSync, writeFileSync } from "fs";
3
4
  var {plugin } = globalThis.Bun;
4
- import { readFileSync, realpathSync } from "fs";
5
- var request = JSON.parse(readFileSync(process.argv[2], "utf8"));
5
+
6
+ // packages/compiler/src/frontend/elaborate/capture-protocol.ts
7
+ import { z } from "zod";
8
+ var captureRequestSchema = z.strictObject({
9
+ entry: z.string().nonempty(),
10
+ files: z.array(z.string().nonempty()),
11
+ bindings: z.record(z.string(), z.strictObject({
12
+ values: z.array(z.string()),
13
+ classes: z.array(z.string()),
14
+ functions: z.array(z.string())
15
+ }))
16
+ });
17
+ var capturedValueSchema = z.discriminatedUnion("kind", [
18
+ z.strictObject({ kind: z.literal("undefined") }),
19
+ z.strictObject({ kind: z.literal("number"), value: z.number() }),
20
+ z.strictObject({ kind: z.literal("boolean"), value: z.boolean() }),
21
+ z.strictObject({ kind: z.literal("string"), value: z.string() }),
22
+ z.strictObject({
23
+ kind: z.literal("bigint"),
24
+ value: z.string().regex(/^-?\d+$/)
25
+ }),
26
+ z.strictObject({
27
+ kind: z.literal("node"),
28
+ id: z.number().int().nonnegative()
29
+ })
30
+ ]);
31
+ var fieldsSchema = z.record(z.string(), capturedValueSchema);
32
+ var capturedNodeSchema = z.discriminatedUnion("kind", [
33
+ z.strictObject({ kind: z.literal("object"), fields: fieldsSchema }),
34
+ z.strictObject({
35
+ kind: z.literal("instance"),
36
+ file: z.string(),
37
+ name: z.string(),
38
+ fields: fieldsSchema
39
+ }),
40
+ z.strictObject({
41
+ kind: z.literal("array"),
42
+ items: z.array(capturedValueSchema)
43
+ }),
44
+ z.strictObject({
45
+ kind: z.literal("function"),
46
+ file: z.string(),
47
+ name: z.string()
48
+ }),
49
+ z.strictObject({ kind: z.literal("service"), path: z.string() })
50
+ ]);
51
+ var capturedGraphSchema = z.strictObject({
52
+ nodes: z.array(capturedNodeSchema),
53
+ bindings: z.array(z.strictObject({
54
+ file: z.string(),
55
+ name: z.string(),
56
+ value: capturedValueSchema
57
+ })),
58
+ retained: z.array(z.number().int().nonnegative())
59
+ }).superRefine((graph, context) => {
60
+ const references = [
61
+ ...graph.bindings.map((binding) => binding.value),
62
+ ...graph.nodes.flatMap((node) => {
63
+ if (node.kind === "array") {
64
+ return node.items;
65
+ }
66
+ if (node.kind === "object" || node.kind === "instance") {
67
+ return Object.values(node.fields);
68
+ }
69
+ return [];
70
+ })
71
+ ];
72
+ for (const id of graph.retained) {
73
+ references.push({ kind: "node", id });
74
+ }
75
+ for (const value of references) {
76
+ if (value.kind === "node" && value.id >= graph.nodes.length) {
77
+ context.addIssue({
78
+ code: "custom",
79
+ message: `Captured value refers to missing node ${value.id}.`
80
+ });
81
+ }
82
+ }
83
+ });
84
+
85
+ // packages/compiler/src/frontend/elaborate/capture.ts
86
+ var request = captureRequestSchema.parse(JSON.parse(readFileSync(process.argv[2], "utf8")));
6
87
  var real = new Map(request.files.map((file) => [realpathSync(file), file]));
7
88
  var runtime = new Set(real.keys());
8
89
  var exportName = "__tsplcCapture";
@@ -35,6 +116,10 @@ plugin({
35
116
  export const onTelemetry = () => () => {};`,
36
117
  loader: "js"
37
118
  }));
119
+ build.module("@tsplc/compiler/retain", () => ({
120
+ contents: "export const retain = (value) => globalThis.__tsplcRetain(value);",
121
+ loader: "js"
122
+ }));
38
123
  build.module("@tsplc/compiler/async", () => ({
39
124
  contents: `export const createServiceClient = () => globalThis.__tsplcService([]);
40
125
  const unsupported = (name) => () => { throw new Error(name + " cannot run during PLC setup."); };
@@ -44,6 +129,13 @@ plugin({
44
129
  }
45
130
  });
46
131
  globalThis.__tsplcService = service;
132
+ var retainedObjects = new Set;
133
+ globalThis.__tsplcRetain = (value) => {
134
+ if (typeof value === "object" && value !== null) {
135
+ retainedObjects.add(value);
136
+ }
137
+ return value;
138
+ };
47
139
  var modules = new Map;
48
140
  for (const file of [
49
141
  request.entry,
@@ -71,8 +163,17 @@ var capture = (value, where) => {
71
163
  if (value === null) {
72
164
  throw new Error(`${where}: null has no PLC value; use undefined.`);
73
165
  }
74
- if (typeof value === "number" || typeof value === "boolean" || typeof value === "string") {
75
- return { kind: typeof value, value };
166
+ if (typeof value === "number") {
167
+ if (!Number.isFinite(value)) {
168
+ throw new Error(`${where}: ${value} has no PLC value.`);
169
+ }
170
+ return { kind: "number", value };
171
+ }
172
+ if (typeof value === "boolean") {
173
+ return { kind: "boolean", value };
174
+ }
175
+ if (typeof value === "string") {
176
+ return { kind: "string", value };
76
177
  }
77
178
  if (typeof value === "bigint") {
78
179
  return { kind: "bigint", value: String(value) };
@@ -119,7 +220,7 @@ var capture = (value, where) => {
119
220
  nodes[id] = registered ? { kind: "instance", ...registered, fields } : { kind: "object", fields };
120
221
  return { kind: "node", id };
121
222
  };
122
- var graph = { nodes, bindings: [] };
223
+ var graph = { nodes, bindings: [], retained: [] };
123
224
  for (const [file, registry] of modules) {
124
225
  for (const [name, read] of Object.entries(registry.values)) {
125
226
  let value;
@@ -134,7 +235,11 @@ for (const [file, registry] of modules) {
134
235
  graph.bindings.push({ file, name, value: capture(value, name) });
135
236
  }
136
237
  }
137
- process.stdout.write(JSON.stringify(graph));
238
+ graph.retained = [...retainedObjects].flatMap((value) => {
239
+ const id = ids.get(value);
240
+ return id === undefined ? [] : [id];
241
+ });
242
+ writeFileSync(process.argv[3], JSON.stringify(graph));
138
243
 
139
- //# debugId=3CF60731C59A118B64756E2164756E21
244
+ //# debugId=F9AACF3DF259896064756E2164756E21
140
245
  //# sourceMappingURL=elaborate-capture.js.map
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/frontend/elaborate/capture.ts"],
3
+ "sources": ["../src/frontend/elaborate/capture.ts", "../src/frontend/elaborate/capture-protocol.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * Runs a program's setup code in Bun and prints the object graph it builds: every module binding,\n * and every object, array, class instance and function reachable from them. The compiler runs\n * this in a subprocess (graph.ts), so setup code never shares the compiler's process.\n *\n * Usage: bun capture.ts <request.json>\n */\nimport { plugin } from \"bun\";\nimport { readFileSync, realpathSync } from \"node:fs\";\nimport type {\n\tCaptureRequest,\n\tCapturedGraph,\n\tCapturedValue,\n\tCapturedNode,\n} from \"./graph.ts\";\n\nconst request: CaptureRequest = JSON.parse(\n\treadFileSync(process.argv[2]!, \"utf8\"),\n);\n// Bun loads modules by their real path; the compiler may name them through a symlink.\nconst real = new Map(request.files.map((file) => [realpathSync(file), file]));\nconst runtime = new Set(real.keys());\nconst exportName = \"__tsplcCapture\";\n\n/** Top-level bindings a module declares, so captured state can be traced back to its source. */\nconst bindings = (source: string, names: CaptureRequest[\"bindings\"][string]) =>\n\t`${source}\\n;export const ${exportName} = { values: { ${names.values\n\t\t.map((name) => `${JSON.stringify(name)}: () => ${name}`)\n\t\t.join(\", \")} }, classes: { ${names.classes\n\t\t.map((name) => `${JSON.stringify(name)}: ${name}`)\n\t\t.join(\", \")} }, functions: { ${names.functions\n\t\t.map((name) => `${JSON.stringify(name)}: ${name}`)\n\t\t.join(\", \")} } };\\n`;\n\nconst servicePath = Symbol(\"tsplc service path\");\n/** A service client: any property is a deeper procedure path, and its identity names that path. */\nconst service = (path: readonly string[]): unknown =>\n\tnew Proxy(function serviceProcedure() {}, {\n\t\tget: (_, key) =>\n\t\t\tkey === servicePath ? path.join(\".\") : service([...path, String(key)]),\n\t\tapply: () => {\n\t\t\tthrow new Error(`Setup code called the PLC service ${path.join(\".\")}.`);\n\t\t},\n\t});\n\nplugin({\n\tname: \"tsplc-capture\",\n\tsetup(build) {\n\t\tbuild.onLoad(\n\t\t\t{\n\t\t\t\tfilter: new RegExp(\n\t\t\t\t\t`^(${[...runtime].map((file) => file.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")).join(\"|\")})$`,\n\t\t\t\t),\n\t\t\t},\n\t\t\t({ path }) => ({\n\t\t\t\tcontents: bindings(\n\t\t\t\t\treadFileSync(path, \"utf8\"),\n\t\t\t\t\trequest.bindings[real.get(path)!]!,\n\t\t\t\t),\n\t\t\t\tloader: \"ts\",\n\t\t\t}),\n\t\t);\n\t\t// Setup runs before the first scan, so the clock reads 0 there.\n\t\tbuild.module(\"@tsplc/compiler/clock\", () => ({\n\t\t\tcontents: \"export const now = () => 0;\",\n\t\t\tloader: \"js\",\n\t\t}));\n\t\t// Records describe scans, so setup has none to make.\n\t\tbuild.module(\"@tsplc/compiler/telemetry\", () => ({\n\t\t\tcontents: `const unsupported = (name) => () => { throw new Error(\"telemetry.\" + name + \" cannot run during PLC setup.\"); };\n export const telemetry = Object.fromEntries([\"capture\", \"info\", \"warn\", \"error\", \"captureException\", \"text\"].map((name) => [name, unsupported(name)]));\n export const onTelemetry = () => () => {};`,\n\t\t\tloader: \"js\",\n\t\t}));\n\t\tbuild.module(\"@tsplc/compiler/async\", () => ({\n\t\t\tcontents: `export const createServiceClient = () => globalThis.__tsplcService([]);\n const unsupported = (name) => () => { throw new Error(name + \" cannot run during PLC setup.\"); };\n export const sleep = unsupported(\"sleep\"), fetch = unsupported(\"fetch\"), cancelAsync = unsupported(\"cancelAsync\");`,\n\t\t\tloader: \"js\",\n\t\t}));\n\t},\n});\n(globalThis as { __tsplcService?: unknown }).__tsplcService = service;\n\n/** The bindings each runtime module exports for capture, as `bindings` above adds them. */\ninterface Registry {\n\tvalues: Record<string, () => unknown>;\n\tclasses: Record<string, unknown>;\n\tfunctions: Record<string, unknown>;\n}\n\nconst modules = new Map<string, Registry>();\nfor (const file of [\n\trequest.entry,\n\t...request.files.filter((file) => file !== request.entry),\n]) {\n\tconst loaded = (await import(realpathSync(file))) as Record<string, unknown>;\n\tmodules.set(file, loaded[exportName] as Registry);\n}\n\nconst classes = new Map<unknown, { file: string; name: string }>();\nconst functions = new Map<unknown, { file: string; name: string }>();\nfor (const [file, registry] of modules) {\n\tfor (const [name, value] of Object.entries(registry.classes)) {\n\t\tclasses.set(value, { file, name });\n\t}\n\tfor (const [name, value] of Object.entries(registry.functions)) {\n\t\tfunctions.set(value, { file, name });\n\t}\n}\n\nconst nodes: CapturedNode[] = [];\nconst ids = new Map<object, number>();\nconst capture = (value: unknown, where: string): CapturedValue => {\n\tif (value === undefined) {\n\t\treturn { kind: \"undefined\" };\n\t}\n\tif (value === null) {\n\t\tthrow new Error(`${where}: null has no PLC value; use undefined.`);\n\t}\n\tif (\n\t\ttypeof value === \"number\" ||\n\t\ttypeof value === \"boolean\" ||\n\t\ttypeof value === \"string\"\n\t) {\n\t\treturn { kind: typeof value, value } as CapturedValue;\n\t}\n\tif (typeof value === \"bigint\") {\n\t\treturn { kind: \"bigint\", value: String(value) };\n\t}\n\tif (typeof value !== \"object\" && typeof value !== \"function\") {\n\t\tthrow new Error(`${where}: a ${typeof value} has no PLC value.`);\n\t}\n\tconst known = ids.get(value);\n\tif (known !== undefined) {\n\t\treturn { kind: \"node\", id: known };\n\t}\n\tconst id = nodes.length;\n\tids.set(value, id);\n\tnodes.push({ kind: \"object\", fields: {} });\n\tif (typeof value === \"function\") {\n\t\tconst path = (value as { [servicePath]?: string })[servicePath];\n\t\tconst named = functions.get(value) ?? classes.get(value);\n\t\tif (path !== undefined) {\n\t\t\tnodes[id] = { kind: \"service\", path };\n\t\t} else if (named) {\n\t\t\tnodes[id] = { kind: \"function\", ...named };\n\t\t} else {\n\t\t\tthrow new Error(\n\t\t\t\t`${where}: setup stored a function that is not a module-level function, so the PLC can't call it.`,\n\t\t\t);\n\t\t}\n\t\treturn { kind: \"node\", id };\n\t}\n\tif (Array.isArray(value)) {\n\t\tnodes[id] = {\n\t\t\tkind: \"array\",\n\t\t\titems: value.map((item, index) => capture(item, `${where}[${index}]`)),\n\t\t};\n\t\treturn { kind: \"node\", id };\n\t}\n\tconst prototype = Object.getPrototypeOf(value);\n\tconst owner =\n\t\tprototype === Object.prototype || prototype === null\n\t\t\t? undefined\n\t\t\t: prototype.constructor;\n\tconst registered = owner && classes.get(owner);\n\tif (owner && !registered) {\n\t\tthrow new Error(\n\t\t\t`${where}: a ${owner.name} has no PLC layout; use a class from the program.`,\n\t\t);\n\t}\n\tconst fields: Record<string, CapturedValue> = {};\n\tfor (const [key, field] of Object.entries(value)) {\n\t\tfields[key] = capture(field, `${where}.${key}`);\n\t}\n\tnodes[id] = registered\n\t\t? { kind: \"instance\", ...registered, fields }\n\t\t: { kind: \"object\", fields };\n\treturn { kind: \"node\", id };\n};\n\nconst graph: CapturedGraph = { nodes, bindings: [] };\nfor (const [file, registry] of modules) {\n\tfor (const [name, read] of Object.entries(registry.values)) {\n\t\tlet value: unknown;\n\t\ttry {\n\t\t\tvalue = read();\n\t\t} catch {\n\t\t\tcontinue; // A binding the module never initialized.\n\t\t}\n\t\tif (\n\t\t\ttypeof value === \"function\" &&\n\t\t\t(functions.has(value) || classes.has(value))\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\t\tgraph.bindings.push({ file, name, value: capture(value, name) });\n\t}\n}\nprocess.stdout.write(JSON.stringify(graph));\n"
5
+ "// biome-ignore-all lint/style/noNonNullAssertion: Retain existing non-null assertions during the tooling migration; changing their contracts requires a separate review.\n/**\n * Runs a program's setup code in Bun and writes the object graph it builds: every module binding,\n * and every object, array, class instance and function reachable from them. The compiler runs\n * this in a subprocess (graph.ts), so setup code never shares the compiler's process.\n *\n * Usage: bun capture.ts <request.json> <graph.json>\n */\n\nimport { readFileSync, realpathSync, writeFileSync } from \"node:fs\";\nimport { plugin } from \"bun\";\nimport {\n\ttype CapturedGraph,\n\ttype CapturedNode,\n\ttype CapturedValue,\n\ttype CaptureRequest,\n\tcaptureRequestSchema,\n} from \"./capture-protocol.ts\";\n\nconst request: CaptureRequest = captureRequestSchema.parse(\n\tJSON.parse(readFileSync(process.argv[2]!, \"utf8\")),\n);\n// Bun loads modules by their real path; the compiler may name them through a symlink.\nconst real = new Map(request.files.map((file) => [realpathSync(file), file]));\nconst runtime = new Set(real.keys());\nconst exportName = \"__tsplcCapture\";\n\n/** Top-level bindings a module declares, so captured state can be traced back to its source. */\nconst bindings = (source: string, names: CaptureRequest[\"bindings\"][string]) =>\n\t`${source}\\n;export const ${exportName} = { values: { ${names.values\n\t\t.map((name) => `${JSON.stringify(name)}: () => ${name}`)\n\t\t.join(\", \")} }, classes: { ${names.classes\n\t\t.map((name) => `${JSON.stringify(name)}: ${name}`)\n\t\t.join(\", \")} }, functions: { ${names.functions\n\t\t.map((name) => `${JSON.stringify(name)}: ${name}`)\n\t\t.join(\", \")} } };\\n`;\n\nconst servicePath = Symbol(\"tsplc service path\");\n/** A service client: any property is a deeper procedure path, and its identity names that path. */\nconst service = (path: readonly string[]): unknown =>\n\tnew Proxy(function serviceProcedure() {}, {\n\t\tget: (_, key) =>\n\t\t\tkey === servicePath ? path.join(\".\") : service([...path, String(key)]),\n\t\tapply: () => {\n\t\t\tthrow new Error(`Setup code called the PLC service ${path.join(\".\")}.`);\n\t\t},\n\t});\n\nplugin({\n\tname: \"tsplc-capture\",\n\tsetup(build) {\n\t\tbuild.onLoad(\n\t\t\t{\n\t\t\t\tfilter: new RegExp(\n\t\t\t\t\t`^(${[...runtime].map((file) => file.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")).join(\"|\")})$`,\n\t\t\t\t),\n\t\t\t},\n\t\t\t({ path }) => ({\n\t\t\t\tcontents: bindings(\n\t\t\t\t\treadFileSync(path, \"utf8\"),\n\t\t\t\t\trequest.bindings[real.get(path)!]!,\n\t\t\t\t),\n\t\t\t\tloader: \"ts\",\n\t\t\t}),\n\t\t);\n\t\t// Setup runs before the first scan, so the clock reads 0 there.\n\t\tbuild.module(\"@tsplc/compiler/clock\", () => ({\n\t\t\tcontents: \"export const now = () => 0;\",\n\t\t\tloader: \"js\",\n\t\t}));\n\t\t// Records describe scans, so setup has none to make.\n\t\tbuild.module(\"@tsplc/compiler/telemetry\", () => ({\n\t\t\tcontents: `const unsupported = (name) => () => { throw new Error(\"telemetry.\" + name + \" cannot run during PLC setup.\"); };\n export const telemetry = Object.fromEntries([\"capture\", \"info\", \"warn\", \"error\", \"captureException\", \"text\"].map((name) => [name, unsupported(name)]));\n export const onTelemetry = () => () => {};`,\n\t\t\tloader: \"js\",\n\t\t}));\n\t\t// Retention belongs to storage, so setup notes each object it retains for the compiler.\n\t\tbuild.module(\"@tsplc/compiler/retain\", () => ({\n\t\t\tcontents:\n\t\t\t\t\"export const retain = (value) => globalThis.__tsplcRetain(value);\",\n\t\t\tloader: \"js\",\n\t\t}));\n\t\tbuild.module(\"@tsplc/compiler/async\", () => ({\n\t\t\tcontents: `export const createServiceClient = () => globalThis.__tsplcService([]);\n const unsupported = (name) => () => { throw new Error(name + \" cannot run during PLC setup.\"); };\n export const sleep = unsupported(\"sleep\"), fetch = unsupported(\"fetch\"), cancelAsync = unsupported(\"cancelAsync\");`,\n\t\t\tloader: \"js\",\n\t\t}));\n\t},\n});\n(globalThis as { __tsplcService?: unknown }).__tsplcService = service;\n/** Objects setup passed to `retain`. A retained primitive has no identity; the compiler finds those in the source. */\nconst retainedObjects = new Set<object>();\n(globalThis as { __tsplcRetain?: unknown }).__tsplcRetain = (\n\tvalue: unknown,\n) => {\n\tif (typeof value === \"object\" && value !== null) {\n\t\tretainedObjects.add(value);\n\t}\n\treturn value;\n};\n\n/** The bindings each runtime module exports for capture, as `bindings` above adds them. */\ninterface Registry {\n\tvalues: Record<string, () => unknown>;\n\tclasses: Record<string, unknown>;\n\tfunctions: Record<string, unknown>;\n}\n\nconst modules = new Map<string, Registry>();\nfor (const file of [\n\trequest.entry,\n\t...request.files.filter((file) => file !== request.entry),\n]) {\n\tconst loaded = (await import(realpathSync(file))) as Record<string, unknown>;\n\tmodules.set(file, loaded[exportName] as Registry);\n}\n\nconst classes = new Map<unknown, { file: string; name: string }>();\nconst functions = new Map<unknown, { file: string; name: string }>();\nfor (const [file, registry] of modules) {\n\tfor (const [name, value] of Object.entries(registry.classes)) {\n\t\tclasses.set(value, { file, name });\n\t}\n\tfor (const [name, value] of Object.entries(registry.functions)) {\n\t\tfunctions.set(value, { file, name });\n\t}\n}\n\nconst nodes: CapturedNode[] = [];\nconst ids = new Map<object, number>();\nconst capture = (value: unknown, where: string): CapturedValue => {\n\tif (value === undefined) {\n\t\treturn { kind: \"undefined\" };\n\t}\n\tif (value === null) {\n\t\tthrow new Error(`${where}: null has no PLC value; use undefined.`);\n\t}\n\tif (typeof value === \"number\") {\n\t\tif (!Number.isFinite(value)) {\n\t\t\tthrow new Error(`${where}: ${value} has no PLC value.`);\n\t\t}\n\t\treturn { kind: \"number\", value };\n\t}\n\tif (typeof value === \"boolean\") {\n\t\treturn { kind: \"boolean\", value };\n\t}\n\tif (typeof value === \"string\") {\n\t\treturn { kind: \"string\", value };\n\t}\n\tif (typeof value === \"bigint\") {\n\t\treturn { kind: \"bigint\", value: String(value) };\n\t}\n\tif (typeof value !== \"object\" && typeof value !== \"function\") {\n\t\tthrow new Error(`${where}: a ${typeof value} has no PLC value.`);\n\t}\n\tconst known = ids.get(value);\n\tif (known !== undefined) {\n\t\treturn { kind: \"node\", id: known };\n\t}\n\tconst id = nodes.length;\n\tids.set(value, id);\n\tnodes.push({ kind: \"object\", fields: {} });\n\tif (typeof value === \"function\") {\n\t\tconst path = (value as { [servicePath]?: string })[servicePath];\n\t\tconst named = functions.get(value) ?? classes.get(value);\n\t\tif (path !== undefined) {\n\t\t\tnodes[id] = { kind: \"service\", path };\n\t\t} else if (named) {\n\t\t\tnodes[id] = { kind: \"function\", ...named };\n\t\t} else {\n\t\t\tthrow new Error(\n\t\t\t\t`${where}: setup stored a function that is not a module-level function, so the PLC can't call it.`,\n\t\t\t);\n\t\t}\n\t\treturn { kind: \"node\", id };\n\t}\n\tif (Array.isArray(value)) {\n\t\tnodes[id] = {\n\t\t\tkind: \"array\",\n\t\t\titems: value.map((item, index) => capture(item, `${where}[${index}]`)),\n\t\t};\n\t\treturn { kind: \"node\", id };\n\t}\n\tconst prototype = Object.getPrototypeOf(value);\n\tconst owner =\n\t\tprototype === Object.prototype || prototype === null\n\t\t\t? undefined\n\t\t\t: prototype.constructor;\n\tconst registered = owner && classes.get(owner);\n\tif (owner && !registered) {\n\t\tthrow new Error(\n\t\t\t`${where}: a ${owner.name} has no PLC layout; use a class from the program.`,\n\t\t);\n\t}\n\tconst fields: Record<string, CapturedValue> = {};\n\tfor (const [key, field] of Object.entries(value)) {\n\t\tfields[key] = capture(field, `${where}.${key}`);\n\t}\n\tnodes[id] = registered\n\t\t? { kind: \"instance\", ...registered, fields }\n\t\t: { kind: \"object\", fields };\n\treturn { kind: \"node\", id };\n};\n\nconst graph: CapturedGraph = { nodes, bindings: [], retained: [] };\nfor (const [file, registry] of modules) {\n\tfor (const [name, read] of Object.entries(registry.values)) {\n\t\tlet value: unknown;\n\t\ttry {\n\t\t\tvalue = read();\n\t\t} catch {\n\t\t\tcontinue; // A binding the module never initialized.\n\t\t}\n\t\tif (\n\t\t\ttypeof value === \"function\" &&\n\t\t\t(functions.has(value) || classes.has(value))\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\t\tgraph.bindings.push({ file, name, value: capture(value, name) });\n\t}\n}\n// A retained object no binding reaches is stored nowhere, so it has no id.\ngraph.retained = [...retainedObjects].flatMap((value) => {\n\tconst id = ids.get(value);\n\treturn id === undefined ? [] : [id];\n});\nwriteFileSync(process.argv[3]!, JSON.stringify(graph));\n",
6
+ "import { z } from \"zod\";\n\n/**\n * The files the compiler and its setup subprocess (capture.ts) exchange: the request names the\n * program's runtime files and the bindings each declares; the graph is what setup built.\n */\nexport const captureRequestSchema = z.strictObject({\n\tentry: z.string().nonempty(),\n\tfiles: z.array(z.string().nonempty()),\n\tbindings: z.record(\n\t\tz.string(),\n\t\tz.strictObject({\n\t\t\tvalues: z.array(z.string()),\n\t\t\tclasses: z.array(z.string()),\n\t\t\tfunctions: z.array(z.string()),\n\t\t}),\n\t),\n});\nexport type CaptureRequest = z.infer<typeof captureRequestSchema>;\n\nconst capturedValueSchema = z.discriminatedUnion(\"kind\", [\n\tz.strictObject({ kind: z.literal(\"undefined\") }),\n\t// JSON has no NaN or infinity; capture rejects them rather than write null.\n\tz.strictObject({ kind: z.literal(\"number\"), value: z.number() }),\n\tz.strictObject({ kind: z.literal(\"boolean\"), value: z.boolean() }),\n\tz.strictObject({ kind: z.literal(\"string\"), value: z.string() }),\n\tz.strictObject({\n\t\tkind: z.literal(\"bigint\"),\n\t\tvalue: z.string().regex(/^-?\\d+$/),\n\t}),\n\tz.strictObject({\n\t\tkind: z.literal(\"node\"),\n\t\tid: z.number().int().nonnegative(),\n\t}),\n]);\nexport type CapturedValue = z.infer<typeof capturedValueSchema>;\n\n/** A captured value that is not an object setup built. */\nexport type CapturedPrimitive = Exclude<CapturedValue, { kind: \"node\" }>;\n\nconst fieldsSchema = z.record(z.string(), capturedValueSchema);\n\nconst capturedNodeSchema = z.discriminatedUnion(\"kind\", [\n\tz.strictObject({ kind: z.literal(\"object\"), fields: fieldsSchema }),\n\tz.strictObject({\n\t\tkind: z.literal(\"instance\"),\n\t\tfile: z.string(),\n\t\tname: z.string(),\n\t\tfields: fieldsSchema,\n\t}),\n\tz.strictObject({\n\t\tkind: z.literal(\"array\"),\n\t\titems: z.array(capturedValueSchema),\n\t}),\n\tz.strictObject({\n\t\tkind: z.literal(\"function\"),\n\t\tfile: z.string(),\n\t\tname: z.string(),\n\t}),\n\tz.strictObject({ kind: z.literal(\"service\"), path: z.string() }),\n]);\nexport type CapturedNode = z.infer<typeof capturedNodeSchema>;\n\nexport const capturedGraphSchema = z\n\t.strictObject({\n\t\tnodes: z.array(capturedNodeSchema),\n\t\t/** Every module-level value binding, in module evaluation order. */\n\t\tbindings: z.array(\n\t\t\tz.strictObject({\n\t\t\t\tfile: z.string(),\n\t\t\t\tname: z.string(),\n\t\t\t\tvalue: capturedValueSchema,\n\t\t\t}),\n\t\t),\n\t\t/** The objects setup passed to `retain`. */\n\t\tretained: z.array(z.number().int().nonnegative()),\n\t})\n\t.superRefine((graph, context) => {\n\t\tconst references = [\n\t\t\t...graph.bindings.map((binding) => binding.value),\n\t\t\t...graph.nodes.flatMap((node) => {\n\t\t\t\tif (node.kind === \"array\") {\n\t\t\t\t\treturn node.items;\n\t\t\t\t}\n\t\t\t\tif (node.kind === \"object\" || node.kind === \"instance\") {\n\t\t\t\t\treturn Object.values(node.fields);\n\t\t\t\t}\n\t\t\t\treturn [];\n\t\t\t}),\n\t\t];\n\t\tfor (const id of graph.retained) {\n\t\t\treferences.push({ kind: \"node\", id });\n\t\t}\n\t\tfor (const value of references) {\n\t\t\tif (value.kind === \"node\" && value.id >= graph.nodes.length) {\n\t\t\t\tcontext.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: `Captured value refers to missing node ${value.id}.`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\nexport type CapturedGraph = z.infer<typeof capturedGraphSchema>;\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