@tsplc/compiler 0.5.3 → 0.5.5

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 (105) hide show
  1. package/dist/bun-runtime.js.map +7 -7
  2. package/dist/cli.js.map +8 -8
  3. package/dist/codesys.js +2 -2
  4. package/dist/codesys.js.map +23 -23
  5. package/dist/elaborate-capture.js +3 -2
  6. package/dist/elaborate-capture.js.map +3 -3
  7. package/dist/index.js +26 -19
  8. package/dist/index.js.map +38 -38
  9. package/dist/ir.js.map +19 -19
  10. package/dist/project.js.map +1 -1
  11. package/dist/server-check.js.map +1 -1
  12. package/dist/telemetry.js.map +1 -1
  13. package/package.json +9 -9
  14. package/src/codesys/config.ts +2 -2
  15. package/src/codesys/debug.ts +2 -2
  16. package/src/codesys/emit.ts +10 -10
  17. package/src/codesys/engineering.ts +1 -1
  18. package/src/codesys/expressions.ts +1 -1
  19. package/src/codesys/global-lists.ts +6 -6
  20. package/src/codesys/global-names.ts +3 -3
  21. package/src/codesys/http.ts +3 -3
  22. package/src/codesys/index.ts +8 -8
  23. package/src/codesys/instrumentation.ts +9 -13
  24. package/src/codesys/io-paths.ts +1 -1
  25. package/src/codesys/manifest.ts +5 -5
  26. package/src/codesys/plan.ts +9 -9
  27. package/src/codesys/programs.ts +3 -3
  28. package/src/codesys/publication.ts +4 -4
  29. package/src/codesys/routines.ts +5 -5
  30. package/src/codesys/st-files.ts +4 -4
  31. package/src/codesys/symbols.ts +6 -6
  32. package/src/codesys/telemetry.ts +6 -6
  33. package/src/codesys/types.ts +2 -2
  34. package/src/codesys/vendor.ts +2 -2
  35. package/src/frontend/analyzer.ts +9 -9
  36. package/src/frontend/async.ts +6 -6
  37. package/src/frontend/blocks.ts +1 -1
  38. package/src/frontend/configuration.ts +4 -4
  39. package/src/frontend/const-functions.ts +2 -2
  40. package/src/frontend/cooperative.ts +1 -1
  41. package/src/frontend/coroutines.ts +6 -6
  42. package/src/frontend/elaborate/calls.ts +29 -18
  43. package/src/frontend/elaborate/capture.ts +3 -2
  44. package/src/frontend/elaborate/dialect.ts +9 -9
  45. package/src/frontend/elaborate/expressions.ts +12 -12
  46. package/src/frontend/elaborate/frame.ts +4 -4
  47. package/src/frontend/elaborate/graph.ts +1 -1
  48. package/src/frontend/elaborate/imports.ts +14 -15
  49. package/src/frontend/elaborate/index.ts +12 -12
  50. package/src/frontend/elaborate/initializers.ts +4 -4
  51. package/src/frontend/elaborate/layouts.ts +3 -3
  52. package/src/frontend/elaborate/model.ts +1 -1
  53. package/src/frontend/elaborate/retention.ts +5 -5
  54. package/src/frontend/elaborate/specialize.ts +11 -11
  55. package/src/frontend/elaborate/statements.ts +8 -11
  56. package/src/frontend/elaborate/storage.ts +6 -11
  57. package/src/frontend/elaborate/values.ts +2 -2
  58. package/src/frontend/exposure.ts +3 -3
  59. package/src/frontend/expressions.ts +5 -5
  60. package/src/frontend/intrinsics.ts +2 -2
  61. package/src/frontend/module-graph.ts +1 -1
  62. package/src/frontend/promise-chains.ts +2 -2
  63. package/src/frontend/promises.ts +5 -5
  64. package/src/frontend/routines.ts +2 -2
  65. package/src/frontend/sdk.ts +7 -1
  66. package/src/frontend/services.ts +3 -3
  67. package/src/frontend/statements.ts +4 -4
  68. package/src/frontend/tasks.ts +5 -10
  69. package/src/frontend/telemetry.ts +2 -2
  70. package/src/frontend/types.ts +1 -1
  71. package/src/frontend/typescript.ts +11 -15
  72. package/src/index.ts +1 -1
  73. package/src/ir/aggregates.ts +6 -6
  74. package/src/ir/allocation.ts +5 -5
  75. package/src/ir/core-model.ts +3 -3
  76. package/src/ir/declarations.ts +6 -6
  77. package/src/ir/domains.ts +3 -7
  78. package/src/ir/fold.ts +4 -9
  79. package/src/ir/index.ts +16 -16
  80. package/src/ir/layouts.ts +3 -3
  81. package/src/ir/link.ts +5 -5
  82. package/src/ir/model.ts +2 -2
  83. package/src/ir/normalization-error.ts +1 -1
  84. package/src/ir/normalize.ts +8 -8
  85. package/src/ir/numeric.ts +2 -2
  86. package/src/ir/operands.ts +2 -2
  87. package/src/ir/ranges.ts +4 -9
  88. package/src/ir/routine.ts +10 -15
  89. package/src/ir/scalars.ts +5 -5
  90. package/src/ir/share.ts +4 -4
  91. package/src/ir/temporaries.ts +4 -4
  92. package/src/project/cli.ts +3 -3
  93. package/src/project/debugger.ts +1 -1
  94. package/src/project/index.ts +1 -1
  95. package/src/project/plant.ts +2 -2
  96. package/src/project/project-commands.ts +3 -3
  97. package/src/project/project.ts +2 -2
  98. package/src/project/release.ts +2 -2
  99. package/src/project/server-check.ts +1 -1
  100. package/src/runtime/main.ts +2 -2
  101. package/src/runtime/process.ts +1 -1
  102. package/src/runtime/program.ts +2 -2
  103. package/src/runtime/retain.ts +1 -1
  104. package/src/runtime/runtime.ts +11 -16
  105. package/stdlib/telemetry.ts +2 -2
@@ -4,8 +4,8 @@ import type {
4
4
  EmitResult,
5
5
  GeneratedObject,
6
6
  } from "@tsplc/compiler/ir";
7
- import type { SourceMapping } from "./emit.ts";
8
- import { declarationFile } from "./st-files.ts";
7
+ import type { SourceMapping } from "./emit";
8
+ import { declarationFile } from "./st-files";
9
9
 
10
10
  type MappedBundle = Pick<EmitResult, "objects"> & {
11
11
  mappings: readonly SourceMapping[];
@@ -10,17 +10,17 @@ import {
10
10
  type Variable,
11
11
  } from "@tsplc/compiler/ir";
12
12
  import ts from "typescript";
13
- import { BlockResolver, storageInitializer } from "./blocks.ts";
13
+ import { BlockResolver, storageInitializer } from "./blocks";
14
14
  import {
15
15
  type AnalysisContext,
16
16
  ExpressionLowering,
17
17
  type LoweringScope,
18
- } from "./expressions.ts";
19
- import { runtimeSources } from "./module-graph.ts";
20
- import type { Positions } from "./positions.ts";
21
- import { methodAccess, RoutineTable } from "./routines.ts";
22
- import { inSdk, unaliased } from "./sdk.ts";
23
- import { StatementLowering } from "./statements.ts";
18
+ } from "./expressions";
19
+ import { runtimeSources } from "./module-graph";
20
+ import type { Positions } from "./positions";
21
+ import { methodAccess, RoutineTable } from "./routines";
22
+ import { inSdk, unaliased } from "./sdk";
23
+ import { StatementLowering } from "./statements";
24
24
  import {
25
25
  type Fail,
26
26
  hasModifier,
@@ -29,8 +29,8 @@ import {
29
29
  type ResolvedType,
30
30
  SemanticError,
31
31
  TypeResolver,
32
- } from "./types.ts";
33
- import type { FrontendOptions } from "./typescript.ts";
32
+ } from "./types";
33
+ import type { FrontendOptions } from "./typescript";
34
34
 
35
35
  /** What a module variable's initializer and keyword establish about its storage. */
36
36
  interface StorageFacts {
@@ -7,8 +7,8 @@ import {
7
7
  type PlcProgram,
8
8
  } from "@tsplc/compiler/ir";
9
9
  import ts from "typescript";
10
- import { lowerCoroutine } from "./coroutines.ts";
11
- import { runtimeSources } from "./module-graph.ts";
10
+ import { lowerCoroutine } from "./coroutines";
11
+ import { runtimeSources } from "./module-graph";
12
12
  import {
13
13
  type Edit,
14
14
  edited,
@@ -18,10 +18,10 @@ import {
18
18
  mapped,
19
19
  type Positions,
20
20
  slice,
21
- } from "./positions.ts";
22
- import { namesSdk, symbolAt } from "./sdk.ts";
23
- import { lowerTaskDefinitions } from "./tasks.ts";
24
- import { hasModifier, SemanticError } from "./types.ts";
21
+ } from "./positions";
22
+ import { namesSdk, symbolAt } from "./sdk";
23
+ import { lowerTaskDefinitions } from "./tasks";
24
+ import { hasModifier, SemanticError } from "./types";
25
25
 
26
26
  export type Job = NonNullable<FunctionBlock["job"]>;
27
27
  /** A named async function or method. */
@@ -16,7 +16,7 @@ import {
16
16
  type Fail,
17
17
  numericLiteralType,
18
18
  type TypeResolver,
19
- } from "./types.ts";
19
+ } from "./types";
20
20
 
21
21
  export interface BlockSource {
22
22
  block: FunctionBlock;
@@ -1,9 +1,9 @@
1
1
  import { type Diagnostic, error } from "@tsplc/compiler/ir";
2
2
  import ts from "typescript";
3
- import { runtimeSources } from "./module-graph.ts";
4
- import { type Edit, edited, type Mapped, type Positions } from "./positions.ts";
5
- import { namesSdk, symbolAt } from "./sdk.ts";
6
- import type { CompileEnvironment } from "./typescript.ts";
3
+ import { runtimeSources } from "./module-graph";
4
+ import { type Edit, edited, type Mapped, type Positions } from "./positions";
5
+ import { namesSdk, symbolAt } from "./sdk";
6
+ import type { CompileEnvironment } from "./typescript";
7
7
 
8
8
  export const lowerEnvironment = (
9
9
  program: ts.Program,
@@ -1,6 +1,6 @@
1
1
  import { type Diagnostic, error } from "@tsplc/compiler/ir";
2
2
  import ts from "typescript";
3
- import { runtimeSources } from "./module-graph.ts";
3
+ import { runtimeSources } from "./module-graph";
4
4
  import {
5
5
  copied,
6
6
  type Edit,
@@ -11,7 +11,7 @@ import {
11
11
  mapped,
12
12
  type Part,
13
13
  type Positions,
14
- } from "./positions.ts";
14
+ } from "./positions";
15
15
 
16
16
  /** An arrow body as a function body: a block as written, or its expression returned (or, for void, evaluated). */
17
17
  const functionBody = (
@@ -1,5 +1,5 @@
1
1
  import { jobError } from "@tsplc/compiler/ir";
2
- import { mapped, type Part } from "./positions.ts";
2
+ import { mapped, type Part } from "./positions";
3
3
 
4
4
  interface Parameter {
5
5
  name: string;
@@ -7,10 +7,10 @@ import type {
7
7
  MethodMembers,
8
8
  Routine,
9
9
  SourceRewrite,
10
- } from "./async.ts";
11
- import { staticString } from "./configuration.ts";
12
- import { copyValue } from "./cooperative.ts";
13
- import { importSpecifier } from "./module-graph.ts";
10
+ } from "./async";
11
+ import { staticString } from "./configuration";
12
+ import { copyValue } from "./cooperative";
13
+ import { importSpecifier } from "./module-graph";
14
14
  import {
15
15
  copied,
16
16
  type Edit,
@@ -20,8 +20,8 @@ import {
20
20
  type Mapped,
21
21
  mapped,
22
22
  type Part,
23
- } from "./positions.ts";
24
- import { hasModifier } from "./types.ts";
23
+ } from "./positions";
24
+ import { hasModifier } from "./types";
25
25
 
26
26
  type Step = Job["steps"][number];
27
27
  /** What a step does when the operation it waits on fails; `cancellable` failures may be a cancel. */
@@ -7,24 +7,21 @@ import {
7
7
  type Mapped,
8
8
  mapped,
9
9
  type Part,
10
- } from "../positions.ts";
11
- import { declaredBySdk, inSdk, symbolAt } from "../sdk.ts";
12
- import type { DialectText } from "./dialect.ts";
13
- import type {
14
- ExpressionSpecializer,
15
- SpecializeContext,
16
- } from "./expressions.ts";
17
- import type { Frame } from "./frame.ts";
18
- import type { EntryImports } from "./imports.ts";
19
- import type { Model } from "./model.ts";
20
- import type { Storage } from "./storage.ts";
10
+ } from "../positions";
11
+ import { declaredBySdk, inSdk, sdkModule, symbolAt } from "../sdk";
12
+ import type { DialectText } from "./dialect";
13
+ import type { ExpressionSpecializer, SpecializeContext } from "./expressions";
14
+ import type { Frame } from "./frame";
15
+ import type { EntryImports } from "./imports";
16
+ import type { Model } from "./model";
17
+ import type { Storage } from "./storage";
21
18
  import {
22
19
  constant,
23
20
  type FunctionLike,
24
21
  repeatable,
25
22
  SpecializeError,
26
23
  type Value,
27
- } from "./values.ts";
24
+ } from "./values";
28
25
 
29
26
  /** Specializes calls: to what the language and SDK provide, to the service client, and to functions. */
30
27
  export class CallSpecializer {
@@ -149,8 +146,9 @@ export class CallSpecializer {
149
146
  expected,
150
147
  );
151
148
  }
152
- if (ts.isIdentifier(callee) && this.sdkCall(callee)) {
153
- return this.sdk(callee.text, node, frame);
149
+ const sdkFile = ts.isIdentifier(callee) && this.sdkDeclaration(callee);
150
+ if (ts.isIdentifier(callee) && sdkFile) {
151
+ return this.sdk(callee.text, sdkModule(sdkFile), node, frame);
154
152
  }
155
153
  return this.expressions.invoke(
156
154
  target,
@@ -208,9 +206,17 @@ export class CallSpecializer {
208
206
  }
209
207
 
210
208
  /** SDK functions scan code calls, such as the PLC clock. */
211
- private sdkCall(callee: ts.Identifier): boolean {
209
+ /** The SDK declaration file of the function `callee` names, or null when the SDK doesn't declare it. */
210
+ private sdkDeclaration(callee: ts.Identifier): string | null {
212
211
  const symbol = symbolAt(this.checker, callee);
213
- return symbol !== undefined && declaredBySdk(this.sdkFile, symbol);
212
+ if (symbol === undefined || !declaredBySdk(this.sdkFile, symbol)) {
213
+ return null;
214
+ }
215
+ return (
216
+ symbol.declarations
217
+ ?.map((declaration) => declaration.getSourceFile().fileName)
218
+ .find((file) => inSdk(this.sdkFile, file)) ?? null
219
+ );
214
220
  }
215
221
 
216
222
  /** A method of `@tsplc/compiler/telemetry`'s `telemetry`. */
@@ -272,14 +278,19 @@ export class CallSpecializer {
272
278
  );
273
279
  }
274
280
 
275
- private sdk(name: string, node: ts.CallExpression, frame: Frame): Value {
281
+ private sdk(
282
+ name: string,
283
+ module: string,
284
+ node: ts.CallExpression,
285
+ frame: Frame,
286
+ ): Value {
276
287
  const args = node.arguments.map((argument) =>
277
288
  this.dialect.code(
278
289
  this.expressions.expression(argument, frame),
279
290
  undefined,
280
291
  ),
281
292
  );
282
- this.imports.clock.add(name);
293
+ this.imports.addSdk(module, name);
283
294
  return {
284
295
  kind: "code",
285
296
  text: mapped`${name}(${joined(args, ", ")})`,
@@ -16,7 +16,7 @@ import {
16
16
  type CaptureRequest,
17
17
  captureRequestSchema,
18
18
  withBindingRegistry,
19
- } from "./capture-protocol.ts";
19
+ } from "./capture-protocol";
20
20
 
21
21
  const request: CaptureRequest = captureRequestSchema.parse(
22
22
  JSON.parse(readFileSync(process.argv[2]!, "utf8")),
@@ -76,7 +76,8 @@ plugin({
76
76
  build.module("@tsplc/compiler/async", () => ({
77
77
  contents: `export const createServiceClient = () => globalThis.__tsplcService([]);
78
78
  const unsupported = (name) => () => { throw new Error(name + " cannot run during PLC setup."); };
79
- export const sleep = unsupported("sleep"), fetch = unsupported("fetch"), cancelAsync = unsupported("cancelAsync");`,
79
+ export const sleep = unsupported("sleep"), fetch = unsupported("fetch"), cancelAsync = unsupported("cancelAsync");
80
+ export const errorCode = unsupported("errorCode"), asyncDiagnostics = unsupported("asyncDiagnostics"), opcuaCall = unsupported("opcuaCall");`,
80
81
  loader: "js",
81
82
  }));
82
83
  },
@@ -1,12 +1,12 @@
1
1
  import { canAssign, integerType, primitiveTypes } from "@tsplc/compiler/ir";
2
2
  import ts from "typescript";
3
- import { joined, type Mapped, mapped } from "../positions.ts";
4
- import type { EntryImports } from "./imports.ts";
5
- import type { Initializers } from "./initializers.ts";
6
- import type { Layouts } from "./layouts.ts";
7
- import type { Model } from "./model.ts";
8
- import type { Storage } from "./storage.ts";
9
- import type { Value } from "./values.ts";
3
+ import { joined, type Mapped, mapped } from "../positions";
4
+ import type { EntryImports } from "./imports";
5
+ import type { Initializers } from "./initializers";
6
+ import type { Layouts } from "./layouts";
7
+ import type { Model } from "./model";
8
+ import type { Storage } from "./storage";
9
+ import type { Value } from "./values";
10
10
 
11
11
  /**
12
12
  * Specialized values as dialect text, in a place of a declared type: literals as enum members,
@@ -152,7 +152,7 @@ export class DialectText {
152
152
  needsConversion(value.iec ?? "DINT", target)
153
153
  ) {
154
154
  // A TypeScript number holds any of these; in the PLC a value converts as an IEC assignment does.
155
- this.imports.conversions.add("wrap");
155
+ this.imports.addSdk("@tsplc/compiler/types", "wrap");
156
156
  return mapped`wrap<${target}>(${this.code(value, undefined)})`;
157
157
  }
158
158
  if (declared && this.layouts.isOptionalRecord(declared)) {
@@ -237,7 +237,7 @@ export class DialectText {
237
237
  if (!needsConversion(from, to) || !needsConversion(to, from)) {
238
238
  return [leftText, rightText];
239
239
  }
240
- this.imports.conversions.add("wrap");
240
+ this.imports.addSdk("@tsplc/compiler/types", "wrap");
241
241
  return [mapped`wrap<LINT>(${leftText})`, mapped`wrap<LINT>(${rightText})`];
242
242
  }
243
243
  }
@@ -1,15 +1,15 @@
1
1
  // biome-ignore-all lint/style/noNonNullAssertion: Retain existing non-null assertions during the tooling migration; changing their contracts requires a separate review.
2
2
  import ts from "typescript";
3
- import { from, joined, type Mapped, mapped } from "../positions.ts";
4
- import { unaliased } from "../sdk.ts";
5
- import { CallSpecializer } from "./calls.ts";
6
- import type { DialectText } from "./dialect.ts";
7
- import type { Frame } from "./frame.ts";
8
- import type { EntryImports } from "./imports.ts";
9
- import type { Initializers } from "./initializers.ts";
10
- import { type Layouts, recordTypes } from "./layouts.ts";
11
- import type { Model, ModelNode } from "./model.ts";
12
- import type { Storage } from "./storage.ts";
3
+ import { from, joined, type Mapped, mapped } from "../positions";
4
+ import { unaliased } from "../sdk";
5
+ import { CallSpecializer } from "./calls";
6
+ import type { DialectText } from "./dialect";
7
+ import type { Frame } from "./frame";
8
+ import type { EntryImports } from "./imports";
9
+ import type { Initializers } from "./initializers";
10
+ import { type Layouts, recordTypes } from "./layouts";
11
+ import type { Model, ModelNode } from "./model";
12
+ import type { Storage } from "./storage";
13
13
  import {
14
14
  constant,
15
15
  type Env,
@@ -17,8 +17,8 @@ import {
17
17
  repeatable,
18
18
  SpecializeError,
19
19
  type Value,
20
- } from "./values.ts";
21
- import { isAssignment } from "./writes.ts";
20
+ } from "./values";
21
+ import { isAssignment } from "./writes";
22
22
 
23
23
  /** What every part of scan-code specialization shares. */
24
24
  export interface SpecializeContext {
@@ -1,8 +1,8 @@
1
1
  import type ts from "typescript";
2
- import { from, type Mapped, mapped, type Part } from "../positions.ts";
3
- import { unusedName } from "./layouts.ts";
4
- import type { ModelNode } from "./model.ts";
5
- import type { Env } from "./values.ts";
2
+ import { from, type Mapped, mapped, type Part } from "../positions";
3
+ import { unusedName } from "./layouts";
4
+ import type { ModelNode } from "./model";
5
+ import type { Env } from "./values";
6
6
 
7
7
  /** Indented lines of one generated routine, with the local names it has used. */
8
8
  export class Emitter {
@@ -15,7 +15,7 @@ import {
15
15
  type CapturedGraph,
16
16
  type CaptureRequest,
17
17
  capturedGraphSchema,
18
- } from "./capture-protocol.ts";
18
+ } from "./capture-protocol";
19
19
 
20
20
  /** The top-level bindings a module declares: values, classes and functions, arrow functions among them. */
21
21
  export const bindingNames = (source: ts.SourceFile) => {
@@ -31,20 +31,25 @@ export class ModuleImports {
31
31
 
32
32
  /**
33
33
  * What the generated entry module imports besides the generated types: the storage modules,
34
- * kept modules' bindings and the SDK functions scan code calls.
34
+ * kept modules' bindings, and the SDK functions scan code and generated conversions call.
35
35
  */
36
36
  export class EntryImports {
37
37
  /** Storage modules generated code reads through a namespace import, by import name. */
38
38
  readonly namespaces = new Map<string, string>();
39
39
  /** Bindings of kept modules, read by their own names. */
40
40
  readonly kept = new ModuleImports();
41
- /** `@tsplc/compiler/clock` functions scan code calls. */
42
- readonly clock = new Set<string>();
43
- /** Conversions generated code calls from `@tsplc/compiler/types`. */
44
- readonly conversions = new Set<string>();
41
+ /** SDK functions by the module that declares them, such as `@tsplc/compiler/clock`. */
42
+ private readonly sdk = new Map<string, Set<string>>();
45
43
  /** Whether scan code calls `telemetry`. */
46
44
  telemetry = false;
47
45
 
46
+ /** Records a call of `name`, which `module` of the SDK declares. */
47
+ addSdk(module: string, name: string): void {
48
+ const names = this.sdk.get(module) ?? new Set<string>();
49
+ names.add(name);
50
+ this.sdk.set(module, names);
51
+ }
52
+
48
53
  lines(entryFile: string): string[] {
49
54
  return [
50
55
  ...[...this.namespaces].map(
@@ -52,19 +57,13 @@ export class EntryImports {
52
57
  `import * as ${name} from "${importPath(entryFile, file)}";`,
53
58
  ),
54
59
  ...this.kept.lines(entryFile, "import"),
55
- ...(this.clock.size
56
- ? [
57
- `import { ${[...this.clock].join(", ")} } from "@tsplc/compiler/clock";`,
58
- ]
59
- : []),
60
+ ...[...this.sdk].map(
61
+ ([module, names]) =>
62
+ `import { ${[...names].join(", ")} } from "${module}";`,
63
+ ),
60
64
  ...(this.telemetry
61
65
  ? [`import { telemetry } from "@tsplc/compiler/telemetry";`]
62
66
  : []),
63
- ...(this.conversions.size
64
- ? [
65
- `import { ${[...this.conversions].join(", ")} } from "@tsplc/compiler/types";`,
66
- ]
67
- : []),
68
67
  ];
69
68
  }
70
69
  }
@@ -8,24 +8,24 @@ import {
8
8
  } from "@tsplc/compiler/ir";
9
9
  import { generatedDirectory } from "@tsplc/config/project-files";
10
10
  import ts from "typescript";
11
- import { runtimeSources } from "../module-graph.ts";
11
+ import { runtimeSources } from "../module-graph";
12
12
  import {
13
13
  copied,
14
14
  from,
15
15
  joined,
16
16
  type Mapped,
17
17
  type Positions,
18
- } from "../positions.ts";
19
- import { inSdk, namesSdk } from "../sdk.ts";
20
- import type { CompileDebug } from "../typescript.ts";
21
- import type { CapturedValue } from "./capture-protocol.ts";
22
- import { captureGraph } from "./graph.ts";
23
- import { importPath } from "./imports.ts";
24
- import { Model, type Root } from "./model.ts";
25
- import { Retention, retainedDeclarations } from "./retention.ts";
26
- import { closingBrace, Specializer } from "./specialize.ts";
27
- import { setterName } from "./storage.ts";
28
- import { SpecializeError } from "./values.ts";
18
+ } from "../positions";
19
+ import { inSdk, namesSdk } from "../sdk";
20
+ import type { CompileDebug } from "../typescript";
21
+ import type { CapturedValue } from "./capture-protocol";
22
+ import { captureGraph } from "./graph";
23
+ import { importPath } from "./imports";
24
+ import { Model, type Root } from "./model";
25
+ import { Retention, retainedDeclarations } from "./retention";
26
+ import { closingBrace, Specializer } from "./specialize";
27
+ import { setterName } from "./storage";
28
+ import { SpecializeError } from "./values";
29
29
 
30
30
  /**
31
31
  * A module the compiled program keeps as written: only types, enums, constants and the service
@@ -1,9 +1,9 @@
1
1
  // biome-ignore-all lint/style/noNonNullAssertion: Retain existing non-null assertions during the tooling migration; changing their contracts requires a separate review.
2
2
  import ts from "typescript";
3
- import type { CapturedValue } from "./capture-protocol.ts";
4
- import { type Layouts, recordTypes } from "./layouts.ts";
5
- import type { Model, ModelNode } from "./model.ts";
6
- import type { Storage } from "./storage.ts";
3
+ import type { CapturedValue } from "./capture-protocol";
4
+ import { type Layouts, recordTypes } from "./layouts";
5
+ import type { Model, ModelNode } from "./model";
6
+ import type { Storage } from "./storage";
7
7
 
8
8
  /** Values setup captured as dialect text: storage initializers, and fixed data scan code reads. */
9
9
  export class Initializers {
@@ -1,8 +1,8 @@
1
1
  import { primitiveTypes } from "@tsplc/compiler/ir";
2
2
  import ts from "typescript";
3
- import type { CapturedValue } from "./capture-protocol.ts";
4
- import { ModuleImports } from "./imports.ts";
5
- import type { Model } from "./model.ts";
3
+ import type { CapturedValue } from "./capture-protocol";
4
+ import { ModuleImports } from "./imports";
5
+ import type { Model } from "./model";
6
6
 
7
7
  /** IEC names a program can write as types; they keep their width rather than becoming DINT. */
8
8
  const iecNames = new Set(primitiveTypes.map((type) => type.id));
@@ -3,7 +3,7 @@ import type {
3
3
  CapturedGraph,
4
4
  CapturedNode,
5
5
  CapturedValue,
6
- } from "./capture-protocol.ts";
6
+ } from "./capture-protocol";
7
7
 
8
8
  /** One step from an owner to the object it holds. */
9
9
  export type Step =
@@ -1,6 +1,6 @@
1
1
  import ts from "typescript";
2
- import { namesSdk } from "../sdk.ts";
3
- import type { CapturedValue } from "./capture-protocol.ts";
2
+ import { namesSdk } from "../sdk";
3
+ import type { CapturedValue } from "./capture-protocol";
4
4
  import {
5
5
  children,
6
6
  type Model,
@@ -8,9 +8,9 @@ import {
8
8
  type Owner,
9
9
  type Root,
10
10
  tsPath,
11
- } from "./model.ts";
12
- import type { Storage } from "./storage.ts";
13
- import { SpecializeError } from "./values.ts";
11
+ } from "./model";
12
+ import type { Storage } from "./storage";
13
+ import { SpecializeError } from "./values";
14
14
 
15
15
  /** A declaration whose initializer retains a primitive: a module binding or a class field. */
16
16
  type RetainedDeclaration = ts.VariableDeclaration | ts.PropertyDeclaration;
@@ -1,27 +1,27 @@
1
1
  // biome-ignore-all lint/style/noNonNullAssertion: Retain existing non-null assertions during the tooling migration; changing their contracts requires a separate review.
2
2
  import ts from "typescript";
3
- import { from, joined, type Mapped, mapped } from "../positions.ts";
4
- import { DialectText } from "./dialect.ts";
3
+ import { from, joined, type Mapped, mapped } from "../positions";
4
+ import { DialectText } from "./dialect";
5
5
  import {
6
6
  ExpressionSpecializer,
7
7
  type RoutineCall,
8
8
  type RoutineTable,
9
9
  type SpecializeContext,
10
- } from "./expressions.ts";
11
- import { Emitter, type Frame } from "./frame.ts";
12
- import { EntryImports } from "./imports.ts";
13
- import { Initializers } from "./initializers.ts";
14
- import { Layouts, unusedName } from "./layouts.ts";
15
- import { type Model, type ModelNode, type Root, tsPath } from "./model.ts";
16
- import { StatementSpecializer } from "./statements.ts";
17
- import { Storage } from "./storage.ts";
10
+ } from "./expressions";
11
+ import { Emitter, type Frame } from "./frame";
12
+ import { EntryImports } from "./imports";
13
+ import { Initializers } from "./initializers";
14
+ import { Layouts, unusedName } from "./layouts";
15
+ import { type Model, type ModelNode, type Root, tsPath } from "./model";
16
+ import { StatementSpecializer } from "./statements";
17
+ import { Storage } from "./storage";
18
18
  import {
19
19
  constant,
20
20
  type Env,
21
21
  type FunctionLike,
22
22
  SpecializeError,
23
23
  type Value,
24
- } from "./values.ts";
24
+ } from "./values";
25
25
 
26
26
  /**
27
27
  * Evaluates the program's scan code against the setup graph. Everything setup decided (which
@@ -1,16 +1,13 @@
1
1
  // biome-ignore-all lint/style/noNonNullAssertion: Retain existing non-null assertions during the tooling migration; changing their contracts requires a separate review.
2
2
  import ts from "typescript";
3
- import { copied, type Mapped, mapped, type Part } from "../positions.ts";
4
- import type { DialectText } from "./dialect.ts";
5
- import type {
6
- ExpressionSpecializer,
7
- SpecializeContext,
8
- } from "./expressions.ts";
9
- import type { Frame } from "./frame.ts";
10
- import type { Initializers } from "./initializers.ts";
11
- import type { Layouts } from "./layouts.ts";
12
- import { SpecializeError, type Value } from "./values.ts";
13
- import { isAssignment, isUpdate } from "./writes.ts";
3
+ import { copied, type Mapped, mapped, type Part } from "../positions";
4
+ import type { DialectText } from "./dialect";
5
+ import type { ExpressionSpecializer, SpecializeContext } from "./expressions";
6
+ import type { Frame } from "./frame";
7
+ import type { Initializers } from "./initializers";
8
+ import type { Layouts } from "./layouts";
9
+ import { SpecializeError, type Value } from "./values";
10
+ import { isAssignment, isUpdate } from "./writes";
14
11
 
15
12
  /** Specializes one routine's statements; expressions in them go through its ExpressionSpecializer. */
16
13
  export class StatementSpecializer {
@@ -1,13 +1,8 @@
1
1
  // biome-ignore-all lint/style/noNonNullAssertion: Retain existing non-null assertions during the tooling migration; changing their contracts requires a separate review.
2
2
  import ts from "typescript";
3
- import type { CapturedPrimitive, CapturedValue } from "./capture-protocol.ts";
4
- import type { EntryImports } from "./imports.ts";
5
- import {
6
- type Layouts,
7
- pascalCase,
8
- recordTypes,
9
- unusedName,
10
- } from "./layouts.ts";
3
+ import type { CapturedPrimitive, CapturedValue } from "./capture-protocol";
4
+ import type { EntryImports } from "./imports";
5
+ import { type Layouts, pascalCase, recordTypes, unusedName } from "./layouts";
11
6
  import {
12
7
  children,
13
8
  type Model,
@@ -16,9 +11,9 @@ import {
16
11
  type Root,
17
12
  type Step,
18
13
  tsPath,
19
- } from "./model.ts";
20
- import { constant, type Value } from "./values.ts";
21
- import { ScanWrites } from "./writes.ts";
14
+ } from "./model";
15
+ import { constant, type Value } from "./values";
16
+ import { ScanWrites } from "./writes";
22
17
 
23
18
  /** A primitive scan code read from setup and folded, at its TypeScript path. */
24
19
  interface FoldedField {
@@ -1,6 +1,6 @@
1
1
  import type ts from "typescript";
2
- import type { Mapped } from "../positions.ts";
3
- import type { ModelNode } from "./model.ts";
2
+ import type { Mapped } from "../positions";
3
+ import type { ModelNode } from "./model";
4
4
 
5
5
  export type FunctionLike =
6
6
  | ts.FunctionDeclaration
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
2
2
  import { type Diagnostic, error } from "@tsplc/compiler/ir";
3
3
  import { elementaryType, isIntegerValued } from "@tsplc/iec";
4
4
  import ts from "typescript";
5
- import { runtimeSources } from "./module-graph.ts";
5
+ import { runtimeSources } from "./module-graph";
6
6
  import {
7
7
  copied,
8
8
  type Edit,
@@ -12,8 +12,8 @@ import {
12
12
  type Mapped,
13
13
  mapped,
14
14
  type Positions,
15
- } from "./positions.ts";
16
- import { namesSdk, symbolAt } from "./sdk.ts";
15
+ } from "./positions";
16
+ import { namesSdk, symbolAt } from "./sdk";
17
17
 
18
18
  /** Telemetry carries a BOOL, an integer or bit string of up to 32 bits, or a bounded STRING. */
19
19
  const telemetryType = (annotation: string): boolean => {