@tsplc/compiler 0.5.10 → 0.5.13
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/cli.js +45 -10
- package/dist/cli.js.map +6 -6
- package/dist/codesys.js +2 -2
- package/dist/codesys.js.map +1 -1
- package/package.json +9 -9
- package/src/project/cli.ts +1 -0
- package/src/project/plant.ts +51 -2
- package/src/project/release.ts +15 -6
- package/src/runtime/.runtime-65O4JH/server/router.ts +17 -0
- package/src/runtime/.runtime-65O4JH/src/cell.ts +45 -0
- package/src/runtime/.runtime-65O4JH/src/controller.ts +58 -0
- package/src/runtime/.runtime-65O4JH/src/lane.ts +6 -0
- package/src/runtime/.runtime-65O4JH/src/main.ts +11 -0
- package/src/runtime/.runtime-65O4JH/src/services.ts +8 -0
- package/src/runtime/.runtime-65O4JH/tsconfig.json +13 -0
- package/src/runtime/.runtime-65O4JH/tsplc.config.ts +31 -0
- package/src/runtime/.runtime-Brw2kO/server/router.ts +17 -0
- package/src/runtime/.runtime-Brw2kO/src/cell.ts +45 -0
- package/src/runtime/.runtime-Brw2kO/src/controller.ts +58 -0
- package/src/runtime/.runtime-Brw2kO/src/lane.ts +6 -0
- package/src/runtime/.runtime-Brw2kO/src/main.ts +11 -0
- package/src/runtime/.runtime-Brw2kO/src/services.ts +8 -0
- package/src/runtime/.runtime-Brw2kO/tsconfig.json +13 -0
- package/src/runtime/.runtime-Brw2kO/tsplc.config.ts +31 -0
- package/src/runtime/.runtime-NHfu1D/server/router.ts +17 -0
- package/src/runtime/.runtime-NHfu1D/src/cell.ts +45 -0
- package/src/runtime/.runtime-NHfu1D/src/controller.ts +58 -0
- package/src/runtime/.runtime-NHfu1D/src/lane.ts +6 -0
- package/src/runtime/.runtime-NHfu1D/src/main.ts +11 -0
- package/src/runtime/.runtime-NHfu1D/src/services.ts +8 -0
- package/src/runtime/.runtime-NHfu1D/tsconfig.json +13 -0
- package/src/runtime/.runtime-NHfu1D/tsplc.config.ts +31 -0
- package/src/runtime/.runtime-WbtNvR/server/router.ts +17 -0
- package/src/runtime/.runtime-WbtNvR/src/cell.ts +45 -0
- package/src/runtime/.runtime-WbtNvR/src/controller.ts +58 -0
- package/src/runtime/.runtime-WbtNvR/src/lane.ts +6 -0
- package/src/runtime/.runtime-WbtNvR/src/main.ts +11 -0
- package/src/runtime/.runtime-WbtNvR/src/services.ts +8 -0
- package/src/runtime/.runtime-WbtNvR/tsconfig.json +13 -0
- package/src/runtime/.runtime-WbtNvR/tsplc.config.ts +31 -0
- package/src/runtime/.runtime-opcua-GMPUt8/server/router.ts +17 -0
- package/src/runtime/.runtime-opcua-GMPUt8/src/cell.ts +45 -0
- package/src/runtime/.runtime-opcua-GMPUt8/src/controller.ts +58 -0
- package/src/runtime/.runtime-opcua-GMPUt8/src/lane.ts +6 -0
- package/src/runtime/.runtime-opcua-GMPUt8/src/main.ts +11 -0
- package/src/runtime/.runtime-opcua-GMPUt8/src/services.ts +8 -0
- package/src/runtime/.runtime-opcua-GMPUt8/tsconfig.json +13 -0
- package/src/runtime/.runtime-opcua-GMPUt8/tsplc.config.ts +31 -0
- package/src/runtime/.runtime-opcua-UwafxO/server/router.ts +17 -0
- package/src/runtime/.runtime-opcua-UwafxO/src/cell.ts +45 -0
- package/src/runtime/.runtime-opcua-UwafxO/src/controller.ts +58 -0
- package/src/runtime/.runtime-opcua-UwafxO/src/lane.ts +6 -0
- package/src/runtime/.runtime-opcua-UwafxO/src/main.ts +11 -0
- package/src/runtime/.runtime-opcua-UwafxO/src/services.ts +8 -0
- package/src/runtime/.runtime-opcua-UwafxO/tsconfig.json +13 -0
- package/src/runtime/.runtime-opcua-UwafxO/tsplc.config.ts +31 -0
- package/src/runtime/.runtime-opcua-ecaSee/server/router.ts +17 -0
- package/src/runtime/.runtime-opcua-ecaSee/src/cell.ts +45 -0
- package/src/runtime/.runtime-opcua-ecaSee/src/controller.ts +58 -0
- package/src/runtime/.runtime-opcua-ecaSee/src/lane.ts +6 -0
- package/src/runtime/.runtime-opcua-ecaSee/src/main.ts +11 -0
- package/src/runtime/.runtime-opcua-ecaSee/src/services.ts +8 -0
- package/src/runtime/.runtime-opcua-ecaSee/tsconfig.json +13 -0
- package/src/runtime/.runtime-opcua-ecaSee/tsplc.config.ts +31 -0
- package/src/runtime/.runtime-opcua-y91UCm/server/router.ts +17 -0
- package/src/runtime/.runtime-opcua-y91UCm/src/cell.ts +45 -0
- package/src/runtime/.runtime-opcua-y91UCm/src/controller.ts +58 -0
- package/src/runtime/.runtime-opcua-y91UCm/src/lane.ts +6 -0
- package/src/runtime/.runtime-opcua-y91UCm/src/main.ts +11 -0
- package/src/runtime/.runtime-opcua-y91UCm/src/services.ts +8 -0
- package/src/runtime/.runtime-opcua-y91UCm/tsconfig.json +13 -0
- package/src/runtime/.runtime-opcua-y91UCm/tsplc.config.ts +31 -0
package/dist/cli.js
CHANGED
|
@@ -34,6 +34,9 @@ import {
|
|
|
34
34
|
askCredentials
|
|
35
35
|
} from "@tsplc/agent";
|
|
36
36
|
import { createAgentClient } from "@tsplc/agent/client";
|
|
37
|
+
import {
|
|
38
|
+
releaseEnvironment
|
|
39
|
+
} from "@tsplc/config";
|
|
37
40
|
import { LoginUnavailable, noLogin } from "@tsplc/debug";
|
|
38
41
|
import { z as z4 } from "zod";
|
|
39
42
|
|
|
@@ -1087,8 +1090,9 @@ var releaseVariables = async (config, root) => {
|
|
|
1087
1090
|
const contract = plcContractSchema.parse(await import(pathToFileURL(resolve3(root, config.typegen.dir, generatedFiles.contract)).href));
|
|
1088
1091
|
return contractVariables(contract).map(({ path, type }) => ({ path, type }));
|
|
1089
1092
|
};
|
|
1090
|
-
var prepareRelease = async (file, loaded, flags,
|
|
1091
|
-
const {
|
|
1093
|
+
var prepareRelease = async (file, loaded, flags, built) => {
|
|
1094
|
+
const project = { ...loaded, env: built.env };
|
|
1095
|
+
const { config, root } = project;
|
|
1092
1096
|
if (!config.compiler) {
|
|
1093
1097
|
throw new Error("tsplc deploy deploys tsPLC programs; configure compiler.");
|
|
1094
1098
|
}
|
|
@@ -1101,10 +1105,9 @@ var prepareRelease = async (file, loaded, flags, environment) => {
|
|
|
1101
1105
|
emitOnly: true,
|
|
1102
1106
|
forController: true,
|
|
1103
1107
|
frozenLockfile: flags["frozen-lockfile"],
|
|
1104
|
-
...buildConfigs(
|
|
1108
|
+
...buildConfigs(project, flags),
|
|
1105
1109
|
buildTarget: buildTargetFor(command),
|
|
1106
|
-
controller: controllerFor(config, command)
|
|
1107
|
-
environment
|
|
1110
|
+
controller: controllerFor(config, command)
|
|
1108
1111
|
});
|
|
1109
1112
|
if (hasErrors2(emitted.diagnostics)) {
|
|
1110
1113
|
return { diagnostics: emitted.diagnostics };
|
|
@@ -1113,7 +1116,7 @@ var prepareRelease = async (file, loaded, flags, environment) => {
|
|
|
1113
1116
|
if (!settings) {
|
|
1114
1117
|
throw new Error("Configure build settings for deployment.");
|
|
1115
1118
|
}
|
|
1116
|
-
await generateProject(file, { loaded, targets: emitted.targets });
|
|
1119
|
+
await generateProject(file, { loaded: project, targets: emitted.targets });
|
|
1117
1120
|
const portable = (path) => path.split(sep).join("/");
|
|
1118
1121
|
const libraries = (settings.libraries ?? []).map((library) => ({
|
|
1119
1122
|
...library,
|
|
@@ -1173,7 +1176,8 @@ var prepareRelease = async (file, loaded, flags, environment) => {
|
|
|
1173
1176
|
server: server?.path,
|
|
1174
1177
|
debug: config.debug,
|
|
1175
1178
|
serverTokenEnv: serverTokenEnv(config),
|
|
1176
|
-
secrets:
|
|
1179
|
+
secrets: built.secrets,
|
|
1180
|
+
values: built.values
|
|
1177
1181
|
};
|
|
1178
1182
|
return { release: { manifest, files } };
|
|
1179
1183
|
};
|
|
@@ -1277,6 +1281,9 @@ import {
|
|
|
1277
1281
|
askCredentials as askCredentials2
|
|
1278
1282
|
} from "@tsplc/agent";
|
|
1279
1283
|
import { createAgentClient as createAgentClient2 } from "@tsplc/agent/client";
|
|
1284
|
+
import {
|
|
1285
|
+
releaseEnvironment as releaseEnvironment2
|
|
1286
|
+
} from "@tsplc/config";
|
|
1280
1287
|
import { LoginUnavailable as LoginUnavailable2, noLogin as noLogin2 } from "@tsplc/debug";
|
|
1281
1288
|
import { z as z5 } from "zod";
|
|
1282
1289
|
var plantCommands = [
|
|
@@ -1296,7 +1303,8 @@ var plantCommands = [
|
|
|
1296
1303
|
"unforce",
|
|
1297
1304
|
"start",
|
|
1298
1305
|
"stop",
|
|
1299
|
-
"reset"
|
|
1306
|
+
"reset",
|
|
1307
|
+
"restart"
|
|
1300
1308
|
];
|
|
1301
1309
|
var plantCommand = (name) => plantCommands.find((command) => command === name);
|
|
1302
1310
|
var connect2 = (env) => {
|
|
@@ -1337,15 +1345,29 @@ var controllerCredentials = async (environment, agent, prompt) => {
|
|
|
1337
1345
|
}
|
|
1338
1346
|
return agent.stored && !agent.initializeUser ? null : prompt();
|
|
1339
1347
|
};
|
|
1348
|
+
var plantSummary = ({ values, secrets }) => {
|
|
1349
|
+
const named = (noun, names) => names.length ? `${noun}${names.length === 1 ? "" : "s"} ${names.join(", ")}` : null;
|
|
1350
|
+
const parts = [
|
|
1351
|
+
named("variable", Object.keys(values)),
|
|
1352
|
+
named("secret", secrets)
|
|
1353
|
+
].filter((part) => part !== null);
|
|
1354
|
+
return parts.length ? parts.join(" and ") : null;
|
|
1355
|
+
};
|
|
1340
1356
|
var deploy = async (agent, file, loaded, flags, environment, follow) => {
|
|
1341
1357
|
const status = await agent.status();
|
|
1342
1358
|
if (status.login) {
|
|
1343
1359
|
throw new Error("A login is open; log out before deploying: tsplc logout");
|
|
1344
1360
|
}
|
|
1345
1361
|
const target = !status.target || flags.select ? await selectTarget(agent) : status.target;
|
|
1362
|
+
const plant = await agent.releaseVariables(loaded.config.secrets?.service ?? null);
|
|
1363
|
+
const built = releaseEnvironment2(loaded.config, { env: environment, values: loaded.values }, plant);
|
|
1346
1364
|
console.log(`Building the release for ${target.host}…`);
|
|
1365
|
+
const held = plantSummary(plant);
|
|
1366
|
+
if (held) {
|
|
1367
|
+
console.log(` With the plant PC's ${held}`);
|
|
1368
|
+
}
|
|
1347
1369
|
const building = timedProgress();
|
|
1348
|
-
const { release, diagnostics } = await prepareRelease(file, loaded, flags,
|
|
1370
|
+
const { release, diagnostics } = await prepareRelease(file, loaded, flags, built);
|
|
1349
1371
|
if (!release) {
|
|
1350
1372
|
return { diagnostics };
|
|
1351
1373
|
}
|
|
@@ -1548,6 +1570,18 @@ var runPlantCommand = async (agent, command, args, flags, project) => {
|
|
|
1548
1570
|
throw new Error("Cancelled.");
|
|
1549
1571
|
}
|
|
1550
1572
|
return send({ command: "stop" });
|
|
1573
|
+
case "restart": {
|
|
1574
|
+
if (args.length > 1) {
|
|
1575
|
+
throw new Error("Usage: tsplc restart [warm|cold] [-y]");
|
|
1576
|
+
}
|
|
1577
|
+
const reset = z5.enum(["warm", "cold"]).parse(args[0] ?? "warm");
|
|
1578
|
+
if (!await confirm(`Reset the application (${reset}) and start it again? Its variables go back to their initial values${reset === "warm" ? ", but for retain ones" : ""}.`, flags)) {
|
|
1579
|
+
throw new Error("Cancelled.");
|
|
1580
|
+
}
|
|
1581
|
+
const { state } = await agent.restartController({ reset });
|
|
1582
|
+
console.log(`Reset ${reset}; the application is ${state === "run" ? "running" : state}.`);
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1551
1585
|
case "reset": {
|
|
1552
1586
|
expect(1, "warm|cold");
|
|
1553
1587
|
const kind = z5.enum(["warm", "cold"]).parse(args[0]);
|
|
@@ -1975,6 +2009,7 @@ Plant agent (the target's agent, else TSPLC_AGENT_URL; TSPLC_AGENT_TOKEN):
|
|
|
1975
2009
|
tsplc vars [path] | read <expression>... | write <expression> <value>
|
|
1976
2010
|
tsplc force <expression> <value> | unforce [expression]... [--restore]
|
|
1977
2011
|
tsplc start | stop | reset warm|cold (-y skips confirmations)
|
|
2012
|
+
tsplc restart [warm|cold] resets and starts the application, with or without a login
|
|
1978
2013
|
|
|
1979
2014
|
Debugger, on http://127.0.0.1, for the built .tsplc/artifacts/st/debug.json; it reads through
|
|
1980
2015
|
the plant agent's login (TSPLC_AGENT_URL, TSPLC_AGENT_TOKEN), or --opcua at config monitor:
|
|
@@ -2113,5 +2148,5 @@ try {
|
|
|
2113
2148
|
}
|
|
2114
2149
|
}
|
|
2115
2150
|
|
|
2116
|
-
//# debugId=
|
|
2151
|
+
//# debugId=4E4AFC84CE5CE5BF64756E2164756E21
|
|
2117
2152
|
//# sourceMappingURL=cli.js.map
|