@tsplc/compiler 0.5.2 → 0.5.4
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.
- package/dist/bun-runtime.js.map +7 -7
- package/dist/cli.js.map +8 -8
- package/dist/codesys.js +91 -20
- package/dist/codesys.js.map +24 -24
- package/dist/elaborate-capture.js.map +1 -1
- package/dist/index.js.map +35 -35
- package/dist/ir.js.map +19 -19
- package/dist/project.js.map +1 -1
- package/dist/server-check.js.map +1 -1
- package/dist/telemetry.js.map +1 -1
- package/package.json +9 -9
- package/src/codesys/config.ts +2 -2
- package/src/codesys/debug.ts +2 -2
- package/src/codesys/emit.ts +10 -10
- package/src/codesys/engineering.ts +1 -1
- package/src/codesys/expressions.ts +1 -1
- package/src/codesys/global-lists.ts +6 -6
- package/src/codesys/global-names.ts +3 -3
- package/src/codesys/http.ts +77 -6
- package/src/codesys/index.ts +8 -8
- package/src/codesys/instrumentation.ts +9 -13
- package/src/codesys/io-paths.ts +1 -1
- package/src/codesys/manifest.ts +5 -5
- package/src/codesys/plan.ts +9 -9
- package/src/codesys/programs.ts +3 -3
- package/src/codesys/publication.ts +4 -4
- package/src/codesys/routines.ts +5 -5
- package/src/codesys/sources.ts +48 -8
- package/src/codesys/st-files.ts +14 -20
- package/src/codesys/symbols.ts +6 -6
- package/src/codesys/telemetry.ts +8 -8
- package/src/codesys/types.ts +2 -2
- package/src/codesys/vendor.ts +2 -2
- package/src/frontend/analyzer.ts +9 -9
- package/src/frontend/async.ts +6 -6
- package/src/frontend/blocks.ts +1 -1
- package/src/frontend/configuration.ts +4 -4
- package/src/frontend/const-functions.ts +2 -2
- package/src/frontend/cooperative.ts +1 -1
- package/src/frontend/coroutines.ts +6 -6
- package/src/frontend/elaborate/calls.ts +9 -12
- package/src/frontend/elaborate/capture.ts +1 -1
- package/src/frontend/elaborate/dialect.ts +7 -7
- package/src/frontend/elaborate/expressions.ts +12 -12
- package/src/frontend/elaborate/frame.ts +4 -4
- package/src/frontend/elaborate/graph.ts +1 -1
- package/src/frontend/elaborate/index.ts +12 -12
- package/src/frontend/elaborate/initializers.ts +4 -4
- package/src/frontend/elaborate/layouts.ts +3 -3
- package/src/frontend/elaborate/model.ts +1 -1
- package/src/frontend/elaborate/retention.ts +5 -5
- package/src/frontend/elaborate/specialize.ts +11 -11
- package/src/frontend/elaborate/statements.ts +8 -11
- package/src/frontend/elaborate/storage.ts +6 -11
- package/src/frontend/elaborate/values.ts +2 -2
- package/src/frontend/exposure.ts +3 -3
- package/src/frontend/expressions.ts +5 -5
- package/src/frontend/intrinsics.ts +2 -2
- package/src/frontend/module-graph.ts +1 -1
- package/src/frontend/promise-chains.ts +2 -2
- package/src/frontend/promises.ts +5 -5
- package/src/frontend/routines.ts +2 -2
- package/src/frontend/services.ts +3 -3
- package/src/frontend/statements.ts +4 -4
- package/src/frontend/tasks.ts +5 -10
- package/src/frontend/telemetry.ts +2 -2
- package/src/frontend/types.ts +1 -1
- package/src/frontend/typescript.ts +11 -15
- package/src/index.ts +1 -1
- package/src/ir/aggregates.ts +6 -6
- package/src/ir/allocation.ts +5 -5
- package/src/ir/core-model.ts +3 -3
- package/src/ir/declarations.ts +6 -6
- package/src/ir/domains.ts +3 -7
- package/src/ir/fold.ts +4 -9
- package/src/ir/index.ts +16 -16
- package/src/ir/layouts.ts +3 -3
- package/src/ir/link.ts +5 -5
- package/src/ir/model.ts +2 -2
- package/src/ir/normalization-error.ts +1 -1
- package/src/ir/normalize.ts +8 -8
- package/src/ir/numeric.ts +2 -2
- package/src/ir/operands.ts +2 -2
- package/src/ir/ranges.ts +4 -9
- package/src/ir/routine.ts +10 -15
- package/src/ir/scalars.ts +5 -5
- package/src/ir/share.ts +4 -4
- package/src/ir/temporaries.ts +4 -4
- package/src/project/cli.ts +3 -3
- package/src/project/debugger.ts +1 -1
- package/src/project/index.ts +1 -1
- package/src/project/plant.ts +2 -2
- package/src/project/project-commands.ts +3 -3
- package/src/project/project.ts +2 -2
- package/src/project/release.ts +2 -2
- package/src/project/server-check.ts +1 -1
- package/src/runtime/main.ts +2 -2
- package/src/runtime/process.ts +1 -1
- package/src/runtime/program.ts +2 -2
- package/src/runtime/retain.ts +1 -1
- package/src/runtime/runtime.ts +11 -16
- package/stdlib/telemetry.ts +2 -2
package/src/ir/operands.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CoreExpression, CorePath, CoreStatement } from "./core-model
|
|
2
|
-
import { telemetryOperands } from "./model
|
|
1
|
+
import type { CoreExpression, CorePath, CoreStatement } from "./core-model";
|
|
2
|
+
import { telemetryOperands } from "./model";
|
|
3
3
|
|
|
4
4
|
/** The index expressions along a place's path. */
|
|
5
5
|
export const pathIndexes = (path: CorePath = []): CoreExpression[] =>
|
package/src/ir/ranges.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { fold } from "./fold
|
|
2
|
-
import type {
|
|
3
|
-
BinaryOperator,
|
|
4
|
-
Expression,
|
|
5
|
-
MathHelper,
|
|
6
|
-
Variable,
|
|
7
|
-
} from "./model.ts";
|
|
1
|
+
import { fold } from "./fold";
|
|
2
|
+
import type { BinaryOperator, Expression, MathHelper, Variable } from "./model";
|
|
8
3
|
import {
|
|
9
4
|
admits,
|
|
10
5
|
highest,
|
|
@@ -12,8 +7,8 @@ import {
|
|
|
12
7
|
integerType,
|
|
13
8
|
lowest,
|
|
14
9
|
within,
|
|
15
|
-
} from "./numeric
|
|
16
|
-
import { integerRange, type PlcType } from "./types
|
|
10
|
+
} from "./numeric";
|
|
11
|
+
import { integerRange, type PlcType } from "./types";
|
|
17
12
|
|
|
18
13
|
export const interval = (
|
|
19
14
|
expression: Expression,
|
package/src/ir/routine.ts
CHANGED
|
@@ -1,20 +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
|
-
import {
|
|
3
|
-
aggregate,
|
|
4
|
-
expressionIssue,
|
|
5
|
-
placeType,
|
|
6
|
-
valueFits,
|
|
7
|
-
} from "./aggregates.ts";
|
|
2
|
+
import { aggregate, expressionIssue, placeType, valueFits } from "./aggregates";
|
|
8
3
|
import type {
|
|
9
4
|
CoreExpression,
|
|
10
5
|
CoreFunction,
|
|
11
6
|
CoreFunctionBlock,
|
|
12
7
|
CorePath,
|
|
13
8
|
CoreStatement,
|
|
14
|
-
} from "./core-model
|
|
15
|
-
import type { ModuleDeclarations } from "./declarations
|
|
16
|
-
import type { SourceSpan } from "./diagnostics
|
|
17
|
-
import { fold } from "./fold
|
|
9
|
+
} from "./core-model";
|
|
10
|
+
import type { ModuleDeclarations } from "./declarations";
|
|
11
|
+
import type { SourceSpan } from "./diagnostics";
|
|
12
|
+
import { fold } from "./fold";
|
|
18
13
|
import type {
|
|
19
14
|
Expression,
|
|
20
15
|
FunctionBlock,
|
|
@@ -22,17 +17,17 @@ import type {
|
|
|
22
17
|
PlcFunction,
|
|
23
18
|
Statement,
|
|
24
19
|
Variable,
|
|
25
|
-
} from "./model
|
|
26
|
-
import { reject } from "./normalization-error
|
|
27
|
-
import { admits, canonicalInteger, type IntegerInterval } from "./numeric
|
|
20
|
+
} from "./model";
|
|
21
|
+
import { reject } from "./normalization-error";
|
|
22
|
+
import { admits, canonicalInteger, type IntegerInterval } from "./numeric";
|
|
28
23
|
import {
|
|
29
24
|
interval,
|
|
30
25
|
loopBounds,
|
|
31
26
|
maxLoopIterations,
|
|
32
27
|
narrowRanges,
|
|
33
28
|
valueRange,
|
|
34
|
-
} from "./ranges
|
|
35
|
-
import { instancedBlock, integerRange } from "./types
|
|
29
|
+
} from "./ranges";
|
|
30
|
+
import { instancedBlock, integerRange } from "./types";
|
|
36
31
|
|
|
37
32
|
type Flow = "fallthrough" | "return" | "loop" | "mixed";
|
|
38
33
|
interface FlowState {
|
package/src/ir/scalars.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { fold } from "./fold
|
|
1
|
+
import { fold } from "./fold";
|
|
2
2
|
import {
|
|
3
3
|
type Constant,
|
|
4
4
|
comparisonOperators,
|
|
5
5
|
type Expression,
|
|
6
6
|
type Variable,
|
|
7
|
-
} from "./model
|
|
7
|
+
} from "./model";
|
|
8
8
|
import {
|
|
9
9
|
admits,
|
|
10
10
|
canAssign,
|
|
@@ -16,9 +16,9 @@ import {
|
|
|
16
16
|
roundFloat,
|
|
17
17
|
within,
|
|
18
18
|
wrapsNatively,
|
|
19
|
-
} from "./numeric
|
|
20
|
-
import { interval } from "./ranges
|
|
21
|
-
import { integerRange, type PlcType } from "./types
|
|
19
|
+
} from "./numeric";
|
|
20
|
+
import { interval } from "./ranges";
|
|
21
|
+
import { integerRange, type PlcType } from "./types";
|
|
22
22
|
|
|
23
23
|
/** An operand's constant value and proved integer range, over the storage in scope. */
|
|
24
24
|
interface Proof {
|
package/src/ir/share.ts
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
type CoreStatement,
|
|
7
7
|
nestedBodies,
|
|
8
8
|
type VerifiedCoreModule,
|
|
9
|
-
} from "./core-model
|
|
10
|
-
import type { Variable } from "./model
|
|
11
|
-
import { admitCore } from "./normalize
|
|
12
|
-
import type { PlcType } from "./types
|
|
9
|
+
} from "./core-model";
|
|
10
|
+
import type { Variable } from "./model";
|
|
11
|
+
import { admitCore } from "./normalize";
|
|
12
|
+
import type { PlcType } from "./types";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Routines that are the same code over different storage, such as one method elaborated once per
|
package/src/ir/temporaries.ts
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
type CoreStatement,
|
|
7
7
|
nestedBodies,
|
|
8
8
|
type VerifiedCoreModule,
|
|
9
|
-
} from "./core-model
|
|
10
|
-
import { admitCore } from "./normalize
|
|
11
|
-
import { statementExpressions, subexpressions } from "./operands
|
|
12
|
-
import { isTemporary } from "./routine
|
|
9
|
+
} from "./core-model";
|
|
10
|
+
import { admitCore } from "./normalize";
|
|
11
|
+
import { statementExpressions, subexpressions } from "./operands";
|
|
12
|
+
import { isTemporary } from "./routine";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Writes a temporary's value where it is read, when nothing can happen in between: the temporary
|
package/src/project/cli.ts
CHANGED
|
@@ -4,15 +4,15 @@ import { parseArgs } from "node:util";
|
|
|
4
4
|
import { formatDiagnostic, hasErrors } from "@tsplc/compiler/ir";
|
|
5
5
|
import { loadTsplcConfig } from "@tsplc/config";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import { serveProjectDebugger } from "./debugger
|
|
8
|
-
import { connect, plantCommand, runPlantCommand } from "./plant
|
|
7
|
+
import { serveProjectDebugger } from "./debugger";
|
|
8
|
+
import { connect, plantCommand, runPlantCommand } from "./plant";
|
|
9
9
|
import {
|
|
10
10
|
type CommandResult,
|
|
11
11
|
checkProjectFlags,
|
|
12
12
|
DiagnosticFailure,
|
|
13
13
|
projectCommand,
|
|
14
14
|
runProjectCommand,
|
|
15
|
-
} from "./project-commands
|
|
15
|
+
} from "./project-commands";
|
|
16
16
|
|
|
17
17
|
const usage = `tsplc install|typegen|check|build|run|download|online-change|inspect|clean|configure [--config tsplc.config.ts] [--target name] [--plc|--server] [--simulate] [--runtime] [--emit-only] [--format json] [--read symbol]
|
|
18
18
|
|
package/src/project/debugger.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
serveDebugger,
|
|
16
16
|
} from "@tsplc/debug";
|
|
17
17
|
import { debugManifestFile } from "@tsplc/debug/manifest";
|
|
18
|
-
import { connect, readThroughAgent } from "./plant
|
|
18
|
+
import { connect, readThroughAgent } from "./plant";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Serves the debugger for the project's last build until interrupted. It reads the controller
|
package/src/project/index.ts
CHANGED
package/src/project/plant.ts
CHANGED
|
@@ -15,8 +15,8 @@ import type { CompileEnvironment } from "@tsplc/compiler";
|
|
|
15
15
|
import type { LoadedConfig } from "@tsplc/config";
|
|
16
16
|
import { LoginUnavailable, noLogin } from "@tsplc/debug";
|
|
17
17
|
import { z } from "zod";
|
|
18
|
-
import { prepareRelease } from "./release
|
|
19
|
-
import { choose, confirm, progress, timedProgress } from "./terminal
|
|
18
|
+
import { prepareRelease } from "./release";
|
|
19
|
+
import { choose, confirm, progress, timedProgress } from "./terminal";
|
|
20
20
|
|
|
21
21
|
const plantCommands = [
|
|
22
22
|
"deploy",
|
|
@@ -22,15 +22,15 @@ import {
|
|
|
22
22
|
} from "@tsplc/config";
|
|
23
23
|
import { resolveConfig } from "@tsplc/config/build";
|
|
24
24
|
import { generateProject } from "@tsplc/typegen";
|
|
25
|
-
import { runInBun } from "../runtime/process
|
|
25
|
+
import { runInBun } from "../runtime/process";
|
|
26
26
|
import {
|
|
27
27
|
buildConfigs,
|
|
28
28
|
buildProject,
|
|
29
29
|
checkProject,
|
|
30
30
|
cleanProject,
|
|
31
31
|
projectTargets,
|
|
32
|
-
} from "./project
|
|
33
|
-
import { buildServer, checkServer } from "./server
|
|
32
|
+
} from "./project";
|
|
33
|
+
import { buildServer, checkServer } from "./server";
|
|
34
34
|
|
|
35
35
|
const projectCommands = [
|
|
36
36
|
"install",
|
package/src/project/project.ts
CHANGED
|
@@ -49,13 +49,13 @@ import {
|
|
|
49
49
|
type ProjectTargets,
|
|
50
50
|
resolveIo,
|
|
51
51
|
} from "@tsplc/typegen";
|
|
52
|
-
import { serviceRoutes } from "../runtime/launch
|
|
52
|
+
import { serviceRoutes } from "../runtime/launch";
|
|
53
53
|
import {
|
|
54
54
|
cleanArtifacts,
|
|
55
55
|
engineeringDirectory,
|
|
56
56
|
owned,
|
|
57
57
|
publishArtifacts,
|
|
58
|
-
} from "./artifacts
|
|
58
|
+
} from "./artifacts";
|
|
59
59
|
|
|
60
60
|
/** The emitted ST's directory inside the compiler's artifacts directory. */
|
|
61
61
|
const emittedSt = basename(emittedStDirectory);
|
package/src/project/release.ts
CHANGED
|
@@ -15,8 +15,8 @@ import type { ReleaseConfig } from "@tsplc/config/build";
|
|
|
15
15
|
import { debugManifestFile } from "@tsplc/debug/manifest";
|
|
16
16
|
import { contractVariables, plcContractSchema } from "@tsplc/opcua/contract";
|
|
17
17
|
import { generatedFiles, generateProject } from "@tsplc/typegen";
|
|
18
|
-
import { buildConfigs, buildProject } from "./project
|
|
19
|
-
import { bundleServer, checkServer } from "./server
|
|
18
|
+
import { buildConfigs, buildProject } from "./project";
|
|
19
|
+
import { bundleServer, checkServer } from "./server";
|
|
20
20
|
|
|
21
21
|
/** Every published leaf the generated contract describes, as CODESYS expressions name it. */
|
|
22
22
|
const releaseVariables = async (
|
package/src/runtime/main.ts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
import { rm, writeFile } from "node:fs/promises";
|
|
10
10
|
import { dirname, join } from "node:path";
|
|
11
|
-
import { launchSchema, type RuntimeState, runtimeFiles } from "./launch
|
|
12
|
-
import { runtimeEndpoint, startRuntime } from "./runtime
|
|
11
|
+
import { launchSchema, type RuntimeState, runtimeFiles } from "./launch";
|
|
12
|
+
import { runtimeEndpoint, startRuntime } from "./runtime";
|
|
13
13
|
|
|
14
14
|
const [launchFile, port] = process.argv.slice(2);
|
|
15
15
|
if (!launchFile) {
|
package/src/runtime/process.ts
CHANGED
package/src/runtime/program.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFileSync, realpathSync } from "node:fs";
|
|
2
2
|
import { plugin } from "bun";
|
|
3
3
|
import ts from "typescript";
|
|
4
|
-
import { withBindingRegistry } from "../frontend/elaborate/capture-protocol
|
|
5
|
-
import { bindingNames } from "../frontend/elaborate/graph
|
|
4
|
+
import { withBindingRegistry } from "../frontend/elaborate/capture-protocol";
|
|
5
|
+
import { bindingNames } from "../frontend/elaborate/graph";
|
|
6
6
|
|
|
7
7
|
/** The SDK modules a program imports, as the runtime implements them, by export name. */
|
|
8
8
|
export type Sdk = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
package/src/runtime/retain.ts
CHANGED
package/src/runtime/runtime.ts
CHANGED
|
@@ -9,22 +9,17 @@ import {
|
|
|
9
9
|
servePublishedGlobals,
|
|
10
10
|
} from "@tsplc/opcua/server";
|
|
11
11
|
import { readDeclarations } from "@tsplc/typegen/declarations";
|
|
12
|
-
import { now } from "../../stdlib/clock
|
|
13
|
-
import { clamp, max, min } from "../../stdlib/math
|
|
14
|
-
import { retain } from "../../stdlib/retain
|
|
15
|
-
import { onTelemetry, telemetry } from "../../stdlib/telemetry
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from "./
|
|
22
|
-
import {
|
|
23
|
-
import { loadProgram } from "./program.ts";
|
|
24
|
-
import { createRetention } from "./retain.ts";
|
|
25
|
-
import { createStorage } from "./storage.ts";
|
|
26
|
-
import { plcGlobals, scalarPaths } from "./symbols.ts";
|
|
27
|
-
import { createTelemetry } from "./telemetry.ts";
|
|
12
|
+
import { now } from "../../stdlib/clock";
|
|
13
|
+
import { clamp, max, min } from "../../stdlib/math";
|
|
14
|
+
import { retain } from "../../stdlib/retain";
|
|
15
|
+
import { onTelemetry, telemetry } from "../../stdlib/telemetry";
|
|
16
|
+
import { createAsync, httpCall, oneLaunchAtATime, unsupported } from "./async";
|
|
17
|
+
import { type Launch, runtimeDirectory, runtimeFiles } from "./launch";
|
|
18
|
+
import { loadProgram } from "./program";
|
|
19
|
+
import { createRetention } from "./retain";
|
|
20
|
+
import { createStorage } from "./storage";
|
|
21
|
+
import { plcGlobals, scalarPaths } from "./symbols";
|
|
22
|
+
import { createTelemetry } from "./telemetry";
|
|
28
23
|
|
|
29
24
|
/** Where the runtime publishes OPC UA: the local CODESYS runtime's address and port. */
|
|
30
25
|
export const runtimeEndpoint = { host: "127.0.0.1", port: 4840 } as const;
|
package/stdlib/telemetry.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { relative } from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { errorName } from "../src/ir/job-errors
|
|
4
|
-
import { now } from "./clock
|
|
3
|
+
import { errorName } from "../src/ir/job-errors";
|
|
4
|
+
import { now } from "./clock";
|
|
5
5
|
|
|
6
6
|
type Reported = Readonly<Record<string, unknown>>;
|
|
7
7
|
class Text {
|