@tsplc/build 0.4.0 → 0.4.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.
package/dist/cli.js CHANGED
@@ -59,6 +59,21 @@ var readBuild = async (directory) => {
59
59
  };
60
60
  };
61
61
 
62
+ // packages/build/src/device-tree.ts
63
+ import { createHash } from "node:crypto";
64
+ var sha256 = (text) => createHash("sha256").update(text).digest("hex");
65
+ var deviceTreeStructure = (tree) => {
66
+ const { mappings: _mappings, ...structure } = tree;
67
+ return sha256(JSON.stringify({
68
+ ...structure,
69
+ devices: structure.devices.map(({ comments: _comments, address, rpiMicroseconds, ...device }) => ({
70
+ ...device,
71
+ address: address !== undefined,
72
+ rpiMicroseconds: rpiMicroseconds !== undefined
73
+ }))
74
+ }));
75
+ };
76
+
62
77
  // packages/build/src/docker-build.ts
63
78
  import { randomUUID } from "node:crypto";
64
79
  import { mkdir as mkdir4, mkdtemp as mkdtemp3, readFile as readFile4, rm as rm4 } from "node:fs/promises";
@@ -105,7 +120,7 @@ var buildFailureSchema = z2.strictObject({
105
120
 
106
121
  // packages/build/src/docker-run.ts
107
122
  import { execFile, spawn } from "node:child_process";
108
- import { createHash } from "node:crypto";
123
+ import { createHash as createHash2 } from "node:crypto";
109
124
  import { copyFile as copyFile2, cp as cp2, mkdir, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
110
125
  import { basename, posix, relative, resolve as resolve2, sep } from "node:path";
111
126
  import { promisify } from "node:util";
@@ -160,7 +175,7 @@ async function mountLibraries(libraries, directory, root = "/input") {
160
175
  await mkdir(resolve2(directory, "libraries"), { recursive: true });
161
176
  return Promise.all(libraries.map(async (library) => {
162
177
  const data = await readFile2(library.path);
163
- if (createHash("sha256").update(data).digest("hex") !== library.sha256) {
178
+ if (createHash2("sha256").update(data).digest("hex") !== library.sha256) {
164
179
  throw new Error(`Library changed after installation: ${library.title}`);
165
180
  }
166
181
  const filename = `${library.sha256}-${basename(library.path)}`;
@@ -414,7 +429,6 @@ import { setTimeout as delay } from "node:timers/promises";
414
429
  import { z as z7 } from "zod";
415
430
 
416
431
  // packages/build/src/controller-protocol.ts
417
- import { createHash as createHash2 } from "node:crypto";
418
432
  import {
419
433
  controllerSchema,
420
434
  sha256Digest,
@@ -478,7 +492,7 @@ var controllerTarget = (config, online) => ({
478
492
  device: online.device,
479
493
  controller: config.controller,
480
494
  ...config.deviceTree && {
481
- deviceTree: createHash2("sha256").update(JSON.stringify(config.deviceTree)).digest("hex")
495
+ deviceTree: deviceTreeStructure(config.deviceTree)
482
496
  }
483
497
  });
484
498
  var sameBaseline = (state, expected) => state.imageId === expected.imageId && state.templateHash === expected.templateHash && JSON.stringify(state.target) === JSON.stringify(expected.target);
@@ -1393,6 +1407,7 @@ import { existsSync } from "node:fs";
1393
1407
  import { mkdir as mkdir6, mkdtemp as mkdtemp4, readFile as readFile7, rm as rm6 } from "node:fs/promises";
1394
1408
  import { tmpdir as tmpdir4 } from "node:os";
1395
1409
  import { posix as posix2, resolve as resolve10 } from "node:path";
1410
+ import { controllerBudgets as controllerBudgets2 } from "@tsplc/config/build";
1396
1411
  import { z as z9 } from "zod";
1397
1412
 
1398
1413
  // packages/build/src/controller-session.ts
@@ -1409,7 +1424,8 @@ var pointerSchema = z8.strictObject({
1409
1424
  });
1410
1425
  var baselineSchema = controllerResultSchema.extend({
1411
1426
  objects: z8.array(z8.record(z8.string(), z8.unknown())),
1412
- files: z8.record(z8.string(), sha256Digest2)
1427
+ files: z8.record(z8.string(), sha256Digest2),
1428
+ deviceSettings: sha256Digest2.optional()
1413
1429
  });
1414
1430
  var controllerDirectory = (outDir) => resolve9(outDir, ".codesys/controller");
1415
1431
  var restoreResultSchema = z8.object({
@@ -1506,6 +1522,7 @@ var loginReplySchema = z9.discriminatedUnion("ok", [
1506
1522
  rollback: rollbackSchema.optional()
1507
1523
  })
1508
1524
  ]);
1525
+ var warmStateSchema = z9.object({ finishing: z9.boolean() });
1509
1526
 
1510
1527
  // packages/build/src/docker-build.ts
1511
1528
  import { mkdir as mkdir7, mkdtemp as mkdtemp5, readFile as readFile8, rm as rm7 } from "node:fs/promises";
@@ -1934,6 +1951,7 @@ import { existsSync as existsSync2 } from "node:fs";
1934
1951
  import { mkdir as mkdir10, mkdtemp as mkdtemp6, readFile as readFile11, rm as rm8 } from "node:fs/promises";
1935
1952
  import { tmpdir as tmpdir5 } from "node:os";
1936
1953
  import { posix as posix3, resolve as resolve14 } from "node:path";
1954
+ import { controllerBudgets as controllerBudgets3 } from "@tsplc/config/build";
1937
1955
  import { z as z13 } from "zod";
1938
1956
  var credentialEnvironment2 = (config, { environment = process.env }) => {
1939
1957
  const names = config.online?.credentials ? [
@@ -2022,6 +2040,7 @@ var loginReplySchema2 = z13.discriminatedUnion("ok", [
2022
2040
  rollback: rollbackSchema.optional()
2023
2041
  })
2024
2042
  ]);
2043
+ var warmStateSchema2 = z13.object({ finishing: z13.boolean() });
2025
2044
 
2026
2045
  // packages/build/src/project-operations.ts
2027
2046
  var checkRawSources = async ({
@@ -2225,5 +2244,5 @@ try {
2225
2244
  process.exitCode = 1;
2226
2245
  }
2227
2246
 
2228
- //# debugId=D84AA398FDE959C164756E2164756E21
2247
+ //# debugId=A427AAF163638DD664756E2164756E21
2229
2248
  //# sourceMappingURL=cli.js.map