@tsplc/compiler 0.5.0 → 0.5.1

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.
@@ -14,6 +14,9 @@ var captureRequestSchema = z.strictObject({
14
14
  functions: z.array(z.string())
15
15
  }))
16
16
  });
17
+ var withBindingRegistry = (source, names, exportName) => `${source}
18
+ ;export const ${exportName} = { values: { ${names.values.map((name) => `${JSON.stringify(name)}: () => ${name}`).join(", ")} }, classes: { ${names.classes.map((name) => `${JSON.stringify(name)}: ${name}`).join(", ")} }, functions: { ${names.functions.map((name) => `${JSON.stringify(name)}: ${name}`).join(", ")} } };
19
+ `;
17
20
  var capturedValueSchema = z.discriminatedUnion("kind", [
18
21
  z.strictObject({ kind: z.literal("undefined") }),
19
22
  z.strictObject({ kind: z.literal("number"), value: z.number() }),
@@ -87,9 +90,6 @@ var request = captureRequestSchema.parse(JSON.parse(readFileSync(process.argv[2]
87
90
  var real = new Map(request.files.map((file) => [realpathSync(file), file]));
88
91
  var runtime = new Set(real.keys());
89
92
  var exportName = "__tsplcCapture";
90
- var bindings = (source, names) => `${source}
91
- ;export const ${exportName} = { values: { ${names.values.map((name) => `${JSON.stringify(name)}: () => ${name}`).join(", ")} }, classes: { ${names.classes.map((name) => `${JSON.stringify(name)}: ${name}`).join(", ")} }, functions: { ${names.functions.map((name) => `${JSON.stringify(name)}: ${name}`).join(", ")} } };
92
- `;
93
93
  var servicePath = Symbol("tsplc service path");
94
94
  var service = (path) => new Proxy(function serviceProcedure() {}, {
95
95
  get: (_, key) => key === servicePath ? path.join(".") : service([...path, String(key)]),
@@ -103,7 +103,7 @@ plugin({
103
103
  build.onLoad({
104
104
  filter: new RegExp(`^(${[...runtime].map((file) => file.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`)
105
105
  }, ({ path }) => ({
106
- contents: bindings(readFileSync(path, "utf8"), request.bindings[real.get(path)]),
106
+ contents: withBindingRegistry(readFileSync(path, "utf8"), request.bindings[real.get(path)], exportName),
107
107
  loader: "ts"
108
108
  }));
109
109
  build.module("@tsplc/compiler/clock", () => ({
@@ -241,5 +241,5 @@ graph.retained = [...retainedObjects].flatMap((value) => {
241
241
  });
242
242
  writeFileSync(process.argv[3], JSON.stringify(graph));
243
243
 
244
- //# debugId=F9AACF3DF259896064756E2164756E21
244
+ //# debugId=98C9D85BB675420664756E2164756E21
245
245
  //# sourceMappingURL=elaborate-capture.js.map
@@ -2,10 +2,10 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/frontend/elaborate/capture.ts", "../src/frontend/elaborate/capture-protocol.ts"],
4
4
  "sourcesContent": [
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>;\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\twithBindingRegistry,\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\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: withBindingRegistry(\n\t\t\t\t\treadFileSync(path, \"utf8\"),\n\t\t\t\t\trequest.bindings[real.get(path)!]!,\n\t\t\t\t\texportName,\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\n/**\n * A module's source with one more export, `exportName`, through which a host reads the module's\n * top-level bindings: each value through a getter, so a `let` reads as it is now, and its classes\n * and functions themselves.\n */\nexport const withBindingRegistry = (\n\tsource: string,\n\tnames: CaptureRequest[\"bindings\"][string],\n\texportName: string,\n) =>\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 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>;\n"
7
7
  ],
8
- "mappings": ";;AASA;AACA;;;ACVA;AAMO,IAAM,uBAAuB,EAAE,aAAa;AAAA,EAClD,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC;AAAA,EACpC,UAAU,EAAE,OACX,EAAE,OAAO,GACT,EAAE,aAAa;AAAA,IACd,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,IAC1B,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,IAC3B,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EAC9B,CAAC,CACF;AACD,CAAC;AAGD,IAAM,sBAAsB,EAAE,mBAAmB,QAAQ;AAAA,EACxD,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,WAAW,EAAE,CAAC;AAAA,EAE/C,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,QAAQ,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;AAAA,EAC/D,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,SAAS,GAAG,OAAO,EAAE,QAAQ,EAAE,CAAC;AAAA,EACjE,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,QAAQ,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;AAAA,EAC/D,EAAE,aAAa;AAAA,IACd,MAAM,EAAE,QAAQ,QAAQ;AAAA,IACxB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS;AAAA,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AAY,KAAK,UAAU,OAAO,QAAQ,KAAK,GAAG;AAAA,IACjD,OAAO,OAAO,QAAQ,OAAO,GAAG,SAAS,KAAK;AAAA,EAC/C;AAAA,EACA,MAAM,MAAM,aACT,EAAE,MAAM,eAAe,YAAY,OAAO,IAC1C,EAAE,MAAM,UAAU,OAAO;AAAA,EAC5B,OAAO,EAAE,MAAM,QAAQ,GAAG;AAAA;AAG3B,IAAM,QAAuB,EAAE,OAAO,UAAU,CAAC,GAAG,UAAU,CAAC,EAAE;AACjE,YAAY,MAAM,aAAa,SAAS;AAAA,EACvC,YAAY,MAAM,SAAS,OAAO,QAAQ,SAAS,MAAM,GAAG;AAAA,IAC3D,IAAI;AAAA,IACJ,IAAI;AAAA,MACH,QAAQ,KAAK;AAAA,MACZ,MAAM;AAAA,MACP;AAAA;AAAA,IAED,IACC,OAAO,UAAU,eAChB,UAAU,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,IACzC;AAAA,MACD;AAAA,IACD;AAAA,IACA,MAAM,SAAS,KAAK,EAAE,MAAM,MAAM,OAAO,QAAQ,OAAO,IAAI,EAAE,CAAC;AAAA,EAChE;AACD;AAEA,MAAM,WAAW,CAAC,GAAG,eAAe,EAAE,QAAQ,CAAC,UAAU;AAAA,EACxD,MAAM,KAAK,IAAI,IAAI,KAAK;AAAA,EACxB,OAAO,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE;AAAA,CAClC;AACD,cAAc,QAAQ,KAAK,IAAK,KAAK,UAAU,KAAK,CAAC;",
9
+ "debugId": "98C9D85BB675420664756E2164756E21",
10
10
  "names": []
11
11
  }
package/dist/index.js CHANGED
@@ -4750,7 +4750,7 @@ var capturedGraphSchema = z.strictObject({
4750
4750
  });
4751
4751
 
4752
4752
  // packages/compiler/src/frontend/elaborate/graph.ts
4753
- var names = (source) => {
4753
+ var bindingNames = (source) => {
4754
4754
  const found = {
4755
4755
  values: [],
4756
4756
  classes: [],
@@ -4795,7 +4795,7 @@ var captureGraph = (entry, sources) => {
4795
4795
  const request = {
4796
4796
  entry,
4797
4797
  files: files.map((source) => source.fileName),
4798
- bindings: Object.fromEntries(files.map((source) => [source.fileName, names(source)]))
4798
+ bindings: Object.fromEntries(files.map((source) => [source.fileName, bindingNames(source)]))
4799
4799
  };
4800
4800
  const directory = mkdtempSync(join(tmpdir(), "tsplc-capture-"));
4801
4801
  try {
@@ -9584,5 +9584,5 @@ export {
9584
9584
  typeCheckOnly
9585
9585
  };
9586
9586
 
9587
- //# debugId=16279797F1A1FD1264756E2164756E21
9587
+ //# debugId=1389F73476DB68D664756E2164756E21
9588
9588
  //# sourceMappingURL=index.js.map