@tsplc/build 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/images.js CHANGED
@@ -97,7 +97,7 @@ var containerManifest = async () => {
97
97
  }
98
98
  return { type: "module", dependencies: containerDependencies(manifests) };
99
99
  };
100
- var recipeFile = (path) => path === "docker" || path === "docker/Dockerfile" || path === "docker/entrypoint.sh" || (path === "docker/install" || path.startsWith("docker/install/")) && includeSource(basename(path)) && !path.split("/").includes("tests") && path !== "docker/install/wine-signal/check.sh";
100
+ var recipeFile = (path) => path === "docker" || path === "docker/Dockerfile" || path === "docker/entrypoint.sh" || (path === "docker/install" || path.startsWith("docker/install/")) && includeSource(basename(path)) && basename(path) !== ".npmignore" && !path.split("/").includes("tests") && path !== "docker/install/wine-signal/check.sh";
101
101
  var builderRecipe = async () => digestFiles((await recipeFiles()).map((name) => ({
102
102
  name,
103
103
  path: resolve2(packageDirectory, name)
@@ -134,7 +134,9 @@ async function prepareDockerContext() {
134
134
  var builderImage = dockerImage;
135
135
  var gatewayImage = "tsplc-edge-gateway:4.22.0.0";
136
136
  var runtimeImage = "tsplc-control-linux-sl:4.22.0.0";
137
- var publishedImage = (image, version) => `ghcr.io/livingforjesus/${image.split(":")[0]}:${version}`;
137
+ var registry = "ghcr.io/livingforjesus";
138
+ var publishedImage = (image) => `${registry}/${image}`;
139
+ var publishedBuilderImage = async () => `${registry}/${builderImage.split(":")[0]}:recipe-${await builderRecipe()}`;
138
140
  var setupPlatformFor = (server) => {
139
141
  if (server === "linux/aarch64" || server === "linux/arm64") {
140
142
  return "linux/arm64";
@@ -214,11 +216,12 @@ export {
214
216
  buildRuntimeImage,
215
217
  builderImage,
216
218
  gatewayImage,
219
+ publishedBuilderImage,
217
220
  publishedImage,
218
221
  recipeLabel,
219
222
  runtimeImage,
220
223
  setupPlatformFor
221
224
  };
222
225
 
223
- //# debugId=C04CB7D81098D9E964756E2164756E21
226
+ //# debugId=5C665E6889C8F40A64756E2164756E21
224
227
  //# sourceMappingURL=images.js.map
@@ -2,11 +2,11 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/images.ts", "../src/docker-context.ts", "../src/package-path.ts"],
4
4
  "sourcesContent": [
5
- "import { copyFile, cp, mkdir, mkdtemp, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { resolve } from \"node:path\";\nimport { dockerImage } from \"@tsplc/config/build\";\nimport { builderRecipe, prepareDockerContext } from \"./docker-context.ts\";\nimport { packageDirectory } from \"./package-path.ts\";\n\nexport const builderImage = dockerImage;\n\nexport const gatewayImage = \"tsplc-edge-gateway:4.22.0.0\";\n\n/** The local CODESYS Control for Linux SL runtime; it is always built here, never published. */\nexport const runtimeImage = \"tsplc-control-linux-sl:4.22.0.0\";\n\n/** The registry name each tsPLC version's copy of a local image is published under. */\nexport const publishedImage = (image: string, version: string) =>\n\t`ghcr.io/livingforjesus/${image.split(\":\")[0]}:${version}`;\n\n/** The platform the vendor installer runs on; the compiler image itself is always AMD64. */\nexport type SetupPlatform = \"linux/amd64\" | \"linux/arm64\";\n\n/** The setup platform for a Docker server's `{{.OSType}}/{{.Architecture}}`, or null when it has none. */\nexport const setupPlatformFor = (server: string): SetupPlatform | null => {\n\tif (server === \"linux/aarch64\" || server === \"linux/arm64\") {\n\t\treturn \"linux/arm64\";\n\t}\n\tif (server === \"linux/x86_64\" || server === \"linux/amd64\") {\n\t\treturn \"linux/amd64\";\n\t}\n\treturn null;\n};\n\n/** The label an image built by `buildBuilderImage` carries its `builderRecipe` in. */\nexport const recipeLabel = \"tsplc.recipe\";\n\n/**\n * Builds the builder image from the full recipe, labelled with it. `installer` is a local CODESYS installer,\n * or null to download the official one; `winetricksCache` seeds the prerequisite downloads.\n * `docker` runs one Docker client command, so each caller keeps its own terminal handling.\n */\nexport async function buildBuilderImage(options: {\n\ttag: string;\n\tsetupPlatform: SetupPlatform;\n\tinstaller: string | null;\n\twinetricksCache: string | null;\n\tdocker: (args: string[]) => Promise<void>;\n}) {\n\tconst installerContext = await mkdtemp(\n\t\tresolve(tmpdir(), \"codesys-installer-\"),\n\t);\n\tlet context: string | undefined;\n\ttry {\n\t\tcontext = await prepareDockerContext();\n\t\tconst cache = resolve(installerContext, \"winetricks\");\n\t\tawait mkdir(cache);\n\t\tif (options.winetricksCache) {\n\t\t\tawait cp(options.winetricksCache, cache, { recursive: true });\n\t\t}\n\t\tif (options.installer) {\n\t\t\tawait copyFile(\n\t\t\t\toptions.installer,\n\t\t\t\tresolve(installerContext, \"codesys.exe\"),\n\t\t\t);\n\t\t}\n\t\tconst arm = options.setupPlatform === \"linux/arm64\";\n\t\t// FEX handles ARM setup's 32-bit prerequisites; the compiler runtime stays AMD64.\n\t\tawait options.docker([\n\t\t\t\"build\",\n\t\t\t\"--platform\",\n\t\t\t\"linux/amd64\",\n\t\t\t\"--build-arg\",\n\t\t\t`SETUP_BASE=${arm ? \"arm-setup\" : \"base\"}`,\n\t\t\t\"--build-arg\",\n\t\t\t`SETUP_PLATFORM=${options.setupPlatform}`,\n\t\t\t\"--build-arg\",\n\t\t\t`INSTALLER_SOURCE=${options.installer ? \"installer-local\" : \"installer-download\"}`,\n\t\t\t\"--label\",\n\t\t\t`${recipeLabel}=${await builderRecipe()}`,\n\t\t\t\"--progress\",\n\t\t\t\"plain\",\n\t\t\t\"--build-context\",\n\t\t\t`installer=${installerContext}`,\n\t\t\t\"-f\",\n\t\t\tresolve(context, \"docker/Dockerfile\"),\n\t\t\t\"-t\",\n\t\t\toptions.tag,\n\t\t\tcontext,\n\t\t]);\n\t} finally {\n\t\tawait Promise.all([\n\t\t\trm(installerContext, { recursive: true, force: true }),\n\t\t\t...(context ? [rm(context, { recursive: true, force: true })] : []),\n\t\t]);\n\t}\n}\n\n/** Builds the local CODESYS Control for Linux SL runtime, the device a production build targets. */\nexport const buildRuntimeImage = (options: {\n\ttag: string;\n\tdocker: (args: string[]) => Promise<void>;\n}) =>\n\toptions.docker([\n\t\t\"build\",\n\t\t\"--platform\",\n\t\t\"linux/amd64\",\n\t\t\"--progress\",\n\t\t\"plain\",\n\t\t\"-t\",\n\t\toptions.tag,\n\t\tresolve(packageDirectory, \"docker/control-linux-sl\"),\n\t]);\n\nexport const buildGatewayImage = (options: {\n\ttag: string;\n\tdocker: (args: string[]) => Promise<void>;\n}) =>\n\toptions.docker([\n\t\t\"build\",\n\t\t\"--platform\",\n\t\t\"linux/amd64\",\n\t\t\"--progress\",\n\t\t\"plain\",\n\t\t\"-t\",\n\t\toptions.tag,\n\t\tresolve(packageDirectory, \"docker/edge-gateway\"),\n\t]);\n",
6
- "import { createHash } from \"node:crypto\";\nimport {\n\tcp,\n\tmkdir,\n\tmkdtemp,\n\treaddir,\n\treadFile,\n\trm,\n\tstat,\n\twriteFile,\n} from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { tmpdir } from \"node:os\";\nimport { basename, dirname, posix, relative, resolve, sep } from \"node:path\";\nimport { z } from \"zod\";\nimport { packageDirectory } from \"./package-path.ts\";\n\nconst includeSource = (source: string) => {\n\tconst name = basename(source);\n\treturn (\n\t\tname !== \"__pycache__\" &&\n\t\tname !== \".DS_Store\" &&\n\t\t!name.endsWith(\".pyc\") &&\n\t\t!name.endsWith(\".test.ts\") &&\n\t\t!name.endsWith(\".fixtures.ts\") &&\n\t\t!(name.startsWith(\"test_\") && name.endsWith(\".py\"))\n\t);\n};\n\n/**\n * The workspace packages container code imports, each copied with the files Bun runs it from,\n * to `directory` in the context and `image` in the image.\n */\nconst containerPackages = [\n\t{\n\t\tentry: \"@tsplc/config/build\",\n\t\tdirectory: \"shared-config\",\n\t\timage: \"/opt/tsplc-config\",\n\t\tfiles: [\"src\", \"templates\", \"package.json\"],\n\t},\n\t{\n\t\tentry: \"@tsplc/iec\",\n\t\tdirectory: \"shared-iec\",\n\t\timage: \"/opt/tsplc-iec\",\n\t\tfiles: [\"src\", \"package.json\"],\n\t},\n];\n\n/** Where the image keeps this package. */\nconst imagePackage = \"/opt/codesys-build\";\n/**\n * This package's files that the image runs and a container may take from the installed package\n * instead: everything the runner imports and the CODESYS scripts. The entrypoint stays the image's.\n */\nconst packageCode = [\"src\", \"python\", \"docker/runner.ts\", \"docker/config.ts\"];\n\nconst packageRoot = (entry: string) =>\n\tresolve(dirname(createRequire(import.meta.url).resolve(entry)), \"..\");\n\n/** A host file or directory and the path in the image it replaces. */\nexport interface ContainerMount {\n\tsource: string;\n\ttarget: string;\n}\n\n/**\n * The code a builder container runs, as this installation has it, and where the image keeps its\n * own copy. Mounted over the image's, it makes a container run this installation's tsPLC whatever\n * tsPLC built the image, so only a change of the image's recipe needs a new image.\n */\nexport const containerCode = (): ContainerMount[] => [\n\t...packageCode.map((path) => ({\n\t\tsource: resolve(packageDirectory, path),\n\t\ttarget: posix.join(imagePackage, path),\n\t})),\n\t...containerPackages.flatMap(({ entry, image, files }) =>\n\t\tfiles.map((file) => ({\n\t\t\tsource: resolve(packageRoot(entry), file),\n\t\t\ttarget: posix.join(image, file),\n\t\t})),\n\t),\n];\n\n/** Every file under `path`, or `path` itself, that `include` keeps, by its path relative to `root`. */\nconst listFiles = async (\n\troot: string,\n\tpath: string,\n\tinclude: (relativePath: string) => boolean,\n): Promise<string[]> => {\n\tconst name = relative(root, path).split(sep).join(\"/\");\n\tif (!include(name)) {\n\t\treturn [];\n\t}\n\tif (!(await stat(path)).isDirectory()) {\n\t\treturn [name];\n\t}\n\tconst entries = await readdir(path);\n\treturn (\n\t\tawait Promise.all(\n\t\t\tentries.map((entry) => listFiles(root, resolve(path, entry), include)),\n\t\t)\n\t).flat();\n};\n\n/** A digest of named texts and files, which changes when a name or a file's content does. */\nconst digestFiles = async (\n\tfiles: { name: string; path: string }[],\n\ttexts: Record<string, string>,\n) => {\n\tconst hash = createHash(\"sha256\");\n\tfor (const [name, text] of Object.entries(texts)) {\n\t\thash.update(`${name}\\0${text}\\0`);\n\t}\n\tfor (const file of [...files].sort((a, b) => a.name.localeCompare(b.name))) {\n\t\thash.update(`${file.name}\\0`);\n\t\thash.update(await readFile(file.path));\n\t\thash.update(\"\\0\");\n\t}\n\treturn hash.digest(\"hex\");\n};\n\n/**\n * A digest of the code `containerCode` mounts, which a long-running container is labelled with so\n * that one running other code is replaced.\n */\nexport const containerCodeDigest = async () =>\n\tdigestFiles(\n\t\t(\n\t\t\tawait Promise.all(\n\t\t\t\tcontainerCode().map(async ({ source, target }) =>\n\t\t\t\t\t(\n\t\t\t\t\t\tawait listFiles(dirname(source), source, (path) =>\n\t\t\t\t\t\t\tincludeSource(basename(path)),\n\t\t\t\t\t\t)\n\t\t\t\t\t).map((name) => ({\n\t\t\t\t\t\tname: posix.join(posix.dirname(target), name),\n\t\t\t\t\t\tpath: resolve(dirname(source), name),\n\t\t\t\t\t})),\n\t\t\t\t),\n\t\t\t)\n\t\t).flat(),\n\t\t{},\n\t);\n\nconst manifestDependencies = z.object({\n\tname: z.string(),\n\tdependencies: z.record(z.string(), z.string()).default({}),\n});\n\n/**\n * The third-party packages the image installs: what this package and each package the\n * context carries depend on, at the versions their manifests pin.\n */\nexport function containerDependencies(\n\tmanifests: z.infer<typeof manifestDependencies>[],\n) {\n\tconst selected = new Map<string, { version: string; owner: string }>();\n\tfor (const manifest of manifests) {\n\t\tfor (const [name, version] of Object.entries(manifest.dependencies)) {\n\t\t\tif (name.startsWith(\"@tsplc/\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst existing = selected.get(name);\n\t\t\tif (existing && existing.version !== version) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`The builder image cannot install ${name}: ${existing.owner} pins ${existing.version} and ${manifest.name} pins ${version}.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tselected.set(name, { version, owner: manifest.name });\n\t\t}\n\t}\n\treturn Object.fromEntries(\n\t\t[...selected].map(([name, { version }]) => [name, version]),\n\t);\n}\n\nconst readManifest = async (directory: string) =>\n\tmanifestDependencies.parse(\n\t\tJSON.parse(await readFile(resolve(directory, \"package.json\"), \"utf8\")),\n\t);\n\n/** The manifest of the third-party packages the image installs, as its recipe writes it. */\nexport const containerManifest = async () => {\n\tconst manifests = [await readManifest(packageDirectory)];\n\tfor (const { entry } of containerPackages) {\n\t\tmanifests.push(await readManifest(packageRoot(entry)));\n\t}\n\treturn { type: \"module\", dependencies: containerDependencies(manifests) };\n};\n\n/**\n * The files of the image's recipe that its containers can't take from the installed package: the\n * Dockerfile, the entrypoint and the installation's scripts and data. Tests and checks of the\n * installation's own tools stay out, as the published package leaves them out.\n */\nconst recipeFile = (path: string) =>\n\tpath === \"docker\" ||\n\tpath === \"docker/Dockerfile\" ||\n\tpath === \"docker/entrypoint.sh\" ||\n\t((path === \"docker/install\" || path.startsWith(\"docker/install/\")) &&\n\t\tincludeSource(basename(path)) &&\n\t\t!path.split(\"/\").includes(\"tests\") &&\n\t\tpath !== \"docker/install/wine-signal/check.sh\");\n\n/**\n * The builder image's recipe: what it installs and how. An image built from another recipe has\n * another vendor installation or other third-party packages, so its containers can't run this\n * installation's code, while one built from this recipe runs any tsPLC with this recipe.\n */\nexport const builderRecipe = async () =>\n\tdigestFiles(\n\t\t(await recipeFiles()).map((name) => ({\n\t\t\tname,\n\t\t\tpath: resolve(packageDirectory, name),\n\t\t})),\n\t\t{ manifest: JSON.stringify(await containerManifest()) },\n\t);\n\n/** The package's files `builderRecipe` covers, beside the third-party manifest. */\nexport const recipeFiles = () =>\n\tlistFiles(packageDirectory, resolve(packageDirectory, \"docker\"), recipeFile);\n\nexport async function prepareDockerContext() {\n\tconst context = await mkdtemp(resolve(tmpdir(), \"tsplc-docker-\"));\n\ttry {\n\t\tfor (const directory of [\"src\", \"python\", \"docker\", \"runtime\"]) {\n\t\t\tawait cp(\n\t\t\t\tresolve(packageDirectory, directory),\n\t\t\t\tresolve(context, directory),\n\t\t\t\t{\n\t\t\t\t\trecursive: true,\n\t\t\t\t\tfilter: includeSource,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t\tfor (const { entry, directory, files } of containerPackages) {\n\t\t\tconst root = packageRoot(entry);\n\t\t\tawait mkdir(resolve(context, directory));\n\t\t\tfor (const file of files) {\n\t\t\t\tawait cp(resolve(root, file), resolve(context, directory, file), {\n\t\t\t\t\trecursive: true,\n\t\t\t\t\tfilter: includeSource,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tawait writeFile(\n\t\t\tresolve(context, \"package.json\"),\n\t\t\tJSON.stringify(await containerManifest()),\n\t\t);\n\t\treturn context;\n\t} catch (cause) {\n\t\tawait rm(context, { recursive: true, force: true });\n\t\tthrow cause;\n\t}\n}\n",
5
+ "import { copyFile, cp, mkdir, mkdtemp, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { resolve } from \"node:path\";\nimport { dockerImage } from \"@tsplc/config/build\";\nimport { builderRecipe, prepareDockerContext } from \"./docker-context\";\nimport { packageDirectory } from \"./package-path\";\n\nexport const builderImage = dockerImage;\n\nexport const gatewayImage = \"tsplc-edge-gateway:4.22.0.0\";\n\n/** The local CODESYS Control for Linux SL runtime; it is always built here, never published. */\nexport const runtimeImage = \"tsplc-control-linux-sl:4.22.0.0\";\n\nconst registry = \"ghcr.io/livingforjesus\";\n\n/**\n * The published copy of a local image whose tag already names what is in it, as the gateway's names its CODESYS version:\n * every tsPLC that uses that version shares the one copy.\n */\nexport const publishedImage = (image: string) => `${registry}/${image}`;\n\n/**\n * The published copy of the builder image for this installation's recipe. Containers run the installed tsPLC's code, so\n * the image changes only with its recipe, and every tsPLC with the same recipe shares the one copy rather than a release\n * rebuilding the vendor installation.\n */\nexport const publishedBuilderImage = async () =>\n\t`${registry}/${builderImage.split(\":\")[0]}:recipe-${await builderRecipe()}`;\n\n/** The platform the vendor installer runs on; the compiler image itself is always AMD64. */\nexport type SetupPlatform = \"linux/amd64\" | \"linux/arm64\";\n\n/** The setup platform for a Docker server's `{{.OSType}}/{{.Architecture}}`, or null when it has none. */\nexport const setupPlatformFor = (server: string): SetupPlatform | null => {\n\tif (server === \"linux/aarch64\" || server === \"linux/arm64\") {\n\t\treturn \"linux/arm64\";\n\t}\n\tif (server === \"linux/x86_64\" || server === \"linux/amd64\") {\n\t\treturn \"linux/amd64\";\n\t}\n\treturn null;\n};\n\n/** The label an image built by `buildBuilderImage` carries its `builderRecipe` in. */\nexport const recipeLabel = \"tsplc.recipe\";\n\n/**\n * Builds the builder image from the full recipe, labelled with it. `installer` is a local CODESYS installer,\n * or null to download the official one; `winetricksCache` seeds the prerequisite downloads.\n * `docker` runs one Docker client command, so each caller keeps its own terminal handling.\n */\nexport async function buildBuilderImage(options: {\n\ttag: string;\n\tsetupPlatform: SetupPlatform;\n\tinstaller: string | null;\n\twinetricksCache: string | null;\n\tdocker: (args: string[]) => Promise<void>;\n}) {\n\tconst installerContext = await mkdtemp(\n\t\tresolve(tmpdir(), \"codesys-installer-\"),\n\t);\n\tlet context: string | undefined;\n\ttry {\n\t\tcontext = await prepareDockerContext();\n\t\tconst cache = resolve(installerContext, \"winetricks\");\n\t\tawait mkdir(cache);\n\t\tif (options.winetricksCache) {\n\t\t\tawait cp(options.winetricksCache, cache, { recursive: true });\n\t\t}\n\t\tif (options.installer) {\n\t\t\tawait copyFile(\n\t\t\t\toptions.installer,\n\t\t\t\tresolve(installerContext, \"codesys.exe\"),\n\t\t\t);\n\t\t}\n\t\tconst arm = options.setupPlatform === \"linux/arm64\";\n\t\t// FEX handles ARM setup's 32-bit prerequisites; the compiler runtime stays AMD64.\n\t\tawait options.docker([\n\t\t\t\"build\",\n\t\t\t\"--platform\",\n\t\t\t\"linux/amd64\",\n\t\t\t\"--build-arg\",\n\t\t\t`SETUP_BASE=${arm ? \"arm-setup\" : \"base\"}`,\n\t\t\t\"--build-arg\",\n\t\t\t`SETUP_PLATFORM=${options.setupPlatform}`,\n\t\t\t\"--build-arg\",\n\t\t\t`INSTALLER_SOURCE=${options.installer ? \"installer-local\" : \"installer-download\"}`,\n\t\t\t\"--label\",\n\t\t\t`${recipeLabel}=${await builderRecipe()}`,\n\t\t\t\"--progress\",\n\t\t\t\"plain\",\n\t\t\t\"--build-context\",\n\t\t\t`installer=${installerContext}`,\n\t\t\t\"-f\",\n\t\t\tresolve(context, \"docker/Dockerfile\"),\n\t\t\t\"-t\",\n\t\t\toptions.tag,\n\t\t\tcontext,\n\t\t]);\n\t} finally {\n\t\tawait Promise.all([\n\t\t\trm(installerContext, { recursive: true, force: true }),\n\t\t\t...(context ? [rm(context, { recursive: true, force: true })] : []),\n\t\t]);\n\t}\n}\n\n/** Builds the local CODESYS Control for Linux SL runtime, the device a production build targets. */\nexport const buildRuntimeImage = (options: {\n\ttag: string;\n\tdocker: (args: string[]) => Promise<void>;\n}) =>\n\toptions.docker([\n\t\t\"build\",\n\t\t\"--platform\",\n\t\t\"linux/amd64\",\n\t\t\"--progress\",\n\t\t\"plain\",\n\t\t\"-t\",\n\t\toptions.tag,\n\t\tresolve(packageDirectory, \"docker/control-linux-sl\"),\n\t]);\n\nexport const buildGatewayImage = (options: {\n\ttag: string;\n\tdocker: (args: string[]) => Promise<void>;\n}) =>\n\toptions.docker([\n\t\t\"build\",\n\t\t\"--platform\",\n\t\t\"linux/amd64\",\n\t\t\"--progress\",\n\t\t\"plain\",\n\t\t\"-t\",\n\t\toptions.tag,\n\t\tresolve(packageDirectory, \"docker/edge-gateway\"),\n\t]);\n",
6
+ "import { createHash } from \"node:crypto\";\nimport {\n\tcp,\n\tmkdir,\n\tmkdtemp,\n\treaddir,\n\treadFile,\n\trm,\n\tstat,\n\twriteFile,\n} from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { tmpdir } from \"node:os\";\nimport { basename, dirname, posix, relative, resolve, sep } from \"node:path\";\nimport { z } from \"zod\";\nimport { packageDirectory } from \"./package-path\";\n\nconst includeSource = (source: string) => {\n\tconst name = basename(source);\n\treturn (\n\t\tname !== \"__pycache__\" &&\n\t\tname !== \".DS_Store\" &&\n\t\t!name.endsWith(\".pyc\") &&\n\t\t!name.endsWith(\".test.ts\") &&\n\t\t!name.endsWith(\".fixtures.ts\") &&\n\t\t!(name.startsWith(\"test_\") && name.endsWith(\".py\"))\n\t);\n};\n\n/**\n * The workspace packages container code imports, each copied with the files Bun runs it from,\n * to `directory` in the context and `image` in the image.\n */\nconst containerPackages = [\n\t{\n\t\tentry: \"@tsplc/config/build\",\n\t\tdirectory: \"shared-config\",\n\t\timage: \"/opt/tsplc-config\",\n\t\tfiles: [\"src\", \"templates\", \"package.json\"],\n\t},\n\t{\n\t\tentry: \"@tsplc/iec\",\n\t\tdirectory: \"shared-iec\",\n\t\timage: \"/opt/tsplc-iec\",\n\t\tfiles: [\"src\", \"package.json\"],\n\t},\n];\n\n/** Where the image keeps this package. */\nconst imagePackage = \"/opt/codesys-build\";\n/**\n * This package's files that the image runs and a container may take from the installed package\n * instead: everything the runner imports and the CODESYS scripts. The entrypoint stays the image's.\n */\nconst packageCode = [\"src\", \"python\", \"docker/runner.ts\", \"docker/config.ts\"];\n\nconst packageRoot = (entry: string) =>\n\tresolve(dirname(createRequire(import.meta.url).resolve(entry)), \"..\");\n\n/** A host file or directory and the path in the image it replaces. */\nexport interface ContainerMount {\n\tsource: string;\n\ttarget: string;\n}\n\n/**\n * The code a builder container runs, as this installation has it, and where the image keeps its\n * own copy. Mounted over the image's, it makes a container run this installation's tsPLC whatever\n * tsPLC built the image, so only a change of the image's recipe needs a new image.\n */\nexport const containerCode = (): ContainerMount[] => [\n\t...packageCode.map((path) => ({\n\t\tsource: resolve(packageDirectory, path),\n\t\ttarget: posix.join(imagePackage, path),\n\t})),\n\t...containerPackages.flatMap(({ entry, image, files }) =>\n\t\tfiles.map((file) => ({\n\t\t\tsource: resolve(packageRoot(entry), file),\n\t\t\ttarget: posix.join(image, file),\n\t\t})),\n\t),\n];\n\n/** Every file under `path`, or `path` itself, that `include` keeps, by its path relative to `root`. */\nconst listFiles = async (\n\troot: string,\n\tpath: string,\n\tinclude: (relativePath: string) => boolean,\n): Promise<string[]> => {\n\tconst name = relative(root, path).split(sep).join(\"/\");\n\tif (!include(name)) {\n\t\treturn [];\n\t}\n\tif (!(await stat(path)).isDirectory()) {\n\t\treturn [name];\n\t}\n\tconst entries = await readdir(path);\n\treturn (\n\t\tawait Promise.all(\n\t\t\tentries.map((entry) => listFiles(root, resolve(path, entry), include)),\n\t\t)\n\t).flat();\n};\n\n/** A digest of named texts and files, which changes when a name or a file's content does. */\nconst digestFiles = async (\n\tfiles: { name: string; path: string }[],\n\ttexts: Record<string, string>,\n) => {\n\tconst hash = createHash(\"sha256\");\n\tfor (const [name, text] of Object.entries(texts)) {\n\t\thash.update(`${name}\\0${text}\\0`);\n\t}\n\tfor (const file of [...files].sort((a, b) => a.name.localeCompare(b.name))) {\n\t\thash.update(`${file.name}\\0`);\n\t\thash.update(await readFile(file.path));\n\t\thash.update(\"\\0\");\n\t}\n\treturn hash.digest(\"hex\");\n};\n\n/**\n * A digest of the code `containerCode` mounts, which a long-running container is labelled with so\n * that one running other code is replaced.\n */\nexport const containerCodeDigest = async () =>\n\tdigestFiles(\n\t\t(\n\t\t\tawait Promise.all(\n\t\t\t\tcontainerCode().map(async ({ source, target }) =>\n\t\t\t\t\t(\n\t\t\t\t\t\tawait listFiles(dirname(source), source, (path) =>\n\t\t\t\t\t\t\tincludeSource(basename(path)),\n\t\t\t\t\t\t)\n\t\t\t\t\t).map((name) => ({\n\t\t\t\t\t\tname: posix.join(posix.dirname(target), name),\n\t\t\t\t\t\tpath: resolve(dirname(source), name),\n\t\t\t\t\t})),\n\t\t\t\t),\n\t\t\t)\n\t\t).flat(),\n\t\t{},\n\t);\n\nconst manifestDependencies = z.object({\n\tname: z.string(),\n\tdependencies: z.record(z.string(), z.string()).default({}),\n});\n\n/**\n * The third-party packages the image installs: what this package and each package the\n * context carries depend on, at the versions their manifests pin.\n */\nexport function containerDependencies(\n\tmanifests: z.infer<typeof manifestDependencies>[],\n) {\n\tconst selected = new Map<string, { version: string; owner: string }>();\n\tfor (const manifest of manifests) {\n\t\tfor (const [name, version] of Object.entries(manifest.dependencies)) {\n\t\t\tif (name.startsWith(\"@tsplc/\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst existing = selected.get(name);\n\t\t\tif (existing && existing.version !== version) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`The builder image cannot install ${name}: ${existing.owner} pins ${existing.version} and ${manifest.name} pins ${version}.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tselected.set(name, { version, owner: manifest.name });\n\t\t}\n\t}\n\treturn Object.fromEntries(\n\t\t[...selected].map(([name, { version }]) => [name, version]),\n\t);\n}\n\nconst readManifest = async (directory: string) =>\n\tmanifestDependencies.parse(\n\t\tJSON.parse(await readFile(resolve(directory, \"package.json\"), \"utf8\")),\n\t);\n\n/** The manifest of the third-party packages the image installs, as its recipe writes it. */\nexport const containerManifest = async () => {\n\tconst manifests = [await readManifest(packageDirectory)];\n\tfor (const { entry } of containerPackages) {\n\t\tmanifests.push(await readManifest(packageRoot(entry)));\n\t}\n\treturn { type: \"module\", dependencies: containerDependencies(manifests) };\n};\n\n/**\n * The files of the image's recipe that its containers can't take from the installed package: the\n * Dockerfile, the entrypoint and the installation's scripts and data. Tests and checks of the\n * installation's own tools stay out, as the published package leaves them out, and so does\n * `.npmignore`, which npm never packs: an image built from a checkout carries the recipe an\n * installed tsPLC computes, so it finds the image published under that recipe current.\n */\nconst recipeFile = (path: string) =>\n\tpath === \"docker\" ||\n\tpath === \"docker/Dockerfile\" ||\n\tpath === \"docker/entrypoint.sh\" ||\n\t((path === \"docker/install\" || path.startsWith(\"docker/install/\")) &&\n\t\tincludeSource(basename(path)) &&\n\t\tbasename(path) !== \".npmignore\" &&\n\t\t!path.split(\"/\").includes(\"tests\") &&\n\t\tpath !== \"docker/install/wine-signal/check.sh\");\n\n/**\n * The builder image's recipe: what it installs and how. An image built from another recipe has\n * another vendor installation or other third-party packages, so its containers can't run this\n * installation's code, while one built from this recipe runs any tsPLC with this recipe.\n */\nexport const builderRecipe = async () =>\n\tdigestFiles(\n\t\t(await recipeFiles()).map((name) => ({\n\t\t\tname,\n\t\t\tpath: resolve(packageDirectory, name),\n\t\t})),\n\t\t{ manifest: JSON.stringify(await containerManifest()) },\n\t);\n\n/** The package's files `builderRecipe` covers, beside the third-party manifest. */\nexport const recipeFiles = () =>\n\tlistFiles(packageDirectory, resolve(packageDirectory, \"docker\"), recipeFile);\n\nexport async function prepareDockerContext() {\n\tconst context = await mkdtemp(resolve(tmpdir(), \"tsplc-docker-\"));\n\ttry {\n\t\tfor (const directory of [\"src\", \"python\", \"docker\", \"runtime\"]) {\n\t\t\tawait cp(\n\t\t\t\tresolve(packageDirectory, directory),\n\t\t\t\tresolve(context, directory),\n\t\t\t\t{\n\t\t\t\t\trecursive: true,\n\t\t\t\t\tfilter: includeSource,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t\tfor (const { entry, directory, files } of containerPackages) {\n\t\t\tconst root = packageRoot(entry);\n\t\t\tawait mkdir(resolve(context, directory));\n\t\t\tfor (const file of files) {\n\t\t\t\tawait cp(resolve(root, file), resolve(context, directory, file), {\n\t\t\t\t\trecursive: true,\n\t\t\t\t\tfilter: includeSource,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tawait writeFile(\n\t\t\tresolve(context, \"package.json\"),\n\t\t\tJSON.stringify(await containerManifest()),\n\t\t);\n\t\treturn context;\n\t} catch (cause) {\n\t\tawait rm(context, { recursive: true, force: true });\n\t\tthrow cause;\n\t}\n}\n",
7
7
  "import { resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n// Both source modules and published bundles live one directory below the package root.\nexport const packageDirectory = resolve(\n\tfileURLToPath(new URL(\"..\", import.meta.url)),\n);\n"
8
8
  ],
9
- "mappings": ";AAAA,yBAAmB,cAAI,mBAAO,gBAAS;AACvC,mBAAS;AACT,oBAAS;AACT;;;ACHA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AACA;AACA,wDAA6C;AAC7C;;;ACdA;AACA;A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 @@ import { randomUUID } from "node:crypto";
78
78
  import { mkdir as mkdir4, mkdtemp as mkdtemp3, readFile as readFile4, rm as rm4 } from "node:fs/promises";
79
79
  import { tmpdir as tmpdir3 } from "node:os";
80
80
  import { resolve as resolve6 } from "node:path";
81
- import { z as z5 } from "zod";
82
81
 
83
82
  // packages/build/src/builder-image.ts
84
83
  import { isDeepStrictEqual } from "node:util";
@@ -193,7 +192,7 @@ var containerManifest = async () => {
193
192
  }
194
193
  return { type: "module", dependencies: containerDependencies(manifests) };
195
194
  };
196
- var recipeFile = (path) => path === "docker" || path === "docker/Dockerfile" || path === "docker/entrypoint.sh" || (path === "docker/install" || path.startsWith("docker/install/")) && includeSource(basename(path)) && !path.split("/").includes("tests") && path !== "docker/install/wine-signal/check.sh";
195
+ var recipeFile = (path) => path === "docker" || path === "docker/Dockerfile" || path === "docker/entrypoint.sh" || (path === "docker/install" || path.startsWith("docker/install/")) && includeSource(basename(path)) && basename(path) !== ".npmignore" && !path.split("/").includes("tests") && path !== "docker/install/wine-signal/check.sh";
197
196
  var builderRecipe = async () => digestFiles((await recipeFiles()).map((name) => ({
198
197
  name,
199
198
  path: resolve3(packageDirectory, name)
@@ -356,7 +355,9 @@ import { dockerImage } from "@tsplc/config/build";
356
355
  var builderImage = dockerImage;
357
356
  var gatewayImage = "tsplc-edge-gateway:4.22.0.0";
358
357
  var runtimeImage = "tsplc-control-linux-sl:4.22.0.0";
359
- var publishedImage = (image, version) => `ghcr.io/livingforjesus/${image.split(":")[0]}:${version}`;
358
+ var registry = "ghcr.io/livingforjesus";
359
+ var publishedImage = (image) => `${registry}/${image}`;
360
+ var publishedBuilderImage = async () => `${registry}/${builderImage.split(":")[0]}:recipe-${await builderRecipe()}`;
360
361
  var setupPlatformFor = (server) => {
361
362
  if (server === "linux/aarch64" || server === "linux/arm64") {
362
363
  return "linux/arm64";
@@ -510,9 +511,7 @@ var buildFailureSchema = z4.strictObject({
510
511
  });
511
512
 
512
513
  // packages/build/src/docker-build.ts
513
- var packageVersion = async () => z5.object({ version: z5.string() }).parse(JSON.parse(await readFile4(resolve6(packageDirectory, "package.json"), "utf8"))).version;
514
- var pullPublished = async (image, progress) => {
515
- const published = publishedImage(image, await packageVersion());
514
+ var pullPublished = async ({ image, published }, progress) => {
516
515
  const output = { progress, environment: {} };
517
516
  progressLog(progress)(`Pulling ${published}`);
518
517
  try {
@@ -548,7 +547,7 @@ var configureDocker = async ({
548
547
  return image;
549
548
  }
550
549
  progressLog(progress)(`Rebuilding the Docker builder: ${status.kind === "unverified" ? status.reason : setupReason(status)}.`);
551
- if (await pullPublished(image, progress) && (await builderImageStatus(image)).kind === "current") {
550
+ if (await pullPublished({ image, published: await publishedBuilderImage() }, progress) && (await builderImageStatus(image)).kind === "current") {
552
551
  return image;
553
552
  }
554
553
  progressLog(progress)(`Preparing Docker builder (${image}). Downloading and installing CODESYS 3.5.22.30 and prerequisites.`);
@@ -578,7 +577,7 @@ var configureGateway = async ({
578
577
  progressLog(progress)(`The CODESYS gateway (${gatewayImage}) is present.`);
579
578
  return gatewayImage;
580
579
  }
581
- if (await pullPublished(gatewayImage, progress)) {
580
+ if (await pullPublished({ image: gatewayImage, published: publishedImage(gatewayImage) }, progress)) {
582
581
  return gatewayImage;
583
582
  }
584
583
  progressLog(progress)(`Preparing the CODESYS gateway (${gatewayImage}).`);
@@ -657,7 +656,7 @@ import {
657
656
  } from "node:fs/promises";
658
657
  import { resolve as resolve7 } from "node:path";
659
658
  import { setTimeout as delay } from "node:timers/promises";
660
- import { z as z8 } from "zod";
659
+ import { z as z7 } from "zod";
661
660
 
662
661
  // packages/build/src/controller-protocol.ts
663
662
  import {
@@ -665,44 +664,44 @@ import {
665
664
  sha256Digest,
666
665
  tcpPort
667
666
  } from "@tsplc/config/build";
668
- import { z as z6 } from "zod";
669
- var imageIdSchema = z6.string().regex(/^sha256:[a-f0-9]{64}$/);
670
- var endpointSchema = z6.strictObject({
671
- host: z6.string().nonempty(),
667
+ import { z as z5 } from "zod";
668
+ var imageIdSchema = z5.string().regex(/^sha256:[a-f0-9]{64}$/);
669
+ var endpointSchema = z5.strictObject({
670
+ host: z5.string().nonempty(),
672
671
  port: tcpPort
673
672
  });
674
- var controllerResultSchema = z6.strictObject({
675
- schemaVersion: z6.literal(1),
676
- operationId: z6.uuid(),
677
- operation: z6.enum(["download", "online-change", "inspect"]),
673
+ var controllerResultSchema = z5.strictObject({
674
+ schemaVersion: z5.literal(1),
675
+ operationId: z5.uuid(),
676
+ operation: z5.enum(["download", "online-change", "inspect"]),
678
677
  imageId: imageIdSchema,
679
678
  templateHash: sha256Digest,
680
- target: z6.strictObject({
681
- network: z6.string().nonempty(),
679
+ target: z5.strictObject({
680
+ network: z5.string().nonempty(),
682
681
  gateway: endpointSchema,
683
682
  device: endpointSchema,
684
683
  controller: controllerSchema.optional(),
685
684
  deviceTree: sha256Digest.optional()
686
685
  }),
687
- generation: z6.string().nonempty(),
688
- application: z6.string().nonempty(),
689
- applicationGuid: z6.string().nonempty(),
690
- controllerIds: z6.strictObject({
691
- codeId: z6.string().nonempty(),
692
- dataId: z6.string().nonempty()
686
+ generation: z5.string().nonempty(),
687
+ application: z5.string().nonempty(),
688
+ applicationGuid: z5.string().nonempty(),
689
+ controllerIds: z5.strictObject({
690
+ codeId: z5.string().nonempty(),
691
+ dataId: z5.string().nonempty()
693
692
  }),
694
- state: z6.string().nonempty(),
695
- values: z6.record(z6.string(), z6.string())
693
+ state: z5.string().nonempty(),
694
+ values: z5.record(z5.string(), z5.string())
696
695
  });
697
- var controllerCredentialsSchema = z6.strictObject({
698
- username: z6.string().nonempty(),
699
- password: z6.string().nonempty()
696
+ var controllerCredentialsSchema = z5.strictObject({
697
+ username: z5.string().nonempty(),
698
+ password: z5.string().nonempty()
700
699
  });
701
- var warmOperationSchema = z6.strictObject({
702
- operation: z6.enum(["download", "online-change"]),
703
- operationId: z6.uuid(),
704
- request: z6.string().nonempty(),
705
- initializeUser: z6.boolean(),
700
+ var warmOperationSchema = z5.strictObject({
701
+ operation: z5.enum(["download", "online-change"]),
702
+ operationId: z5.uuid(),
703
+ request: z5.string().nonempty(),
704
+ initializeUser: z5.boolean(),
706
705
  credentials: controllerCredentialsSchema.optional()
707
706
  });
708
707
  var tracebackFailure = (traceback) => {
@@ -733,7 +732,7 @@ var explicitDownload = "use an explicit download";
733
732
  class DownloadRequiredError extends Error {
734
733
  downloadRequired = true;
735
734
  }
736
- var rollbackSchema = z6.enum([
735
+ var rollbackSchema = z5.enum([
737
736
  "intact",
738
737
  "restored",
739
738
  "failed",
@@ -754,30 +753,30 @@ var transferRollback = (error) => {
754
753
  return rollbackSchema.safeParse(error.rollback).data;
755
754
  };
756
755
  var requiresDownload = (error) => error instanceof Error && ("downloadRequired" in error) && error.downloadRequired === true;
757
- var loginCommandSchema = z6.discriminatedUnion("command", [
758
- z6.strictObject({ command: z6.literal("state") }),
759
- z6.strictObject({
760
- command: z6.literal("read"),
761
- expressions: z6.array(z6.string().nonempty()).nonempty()
756
+ var loginCommandSchema = z5.discriminatedUnion("command", [
757
+ z5.strictObject({ command: z5.literal("state") }),
758
+ z5.strictObject({
759
+ command: z5.literal("read"),
760
+ expressions: z5.array(z5.string().nonempty()).nonempty()
762
761
  }),
763
- z6.strictObject({
764
- command: z6.enum(["write", "force"]),
765
- values: z6.record(z6.string().nonempty(), z6.string().nonempty())
762
+ z5.strictObject({
763
+ command: z5.enum(["write", "force"]),
764
+ values: z5.record(z5.string().nonempty(), z5.string().nonempty())
766
765
  }),
767
- z6.strictObject({
768
- command: z6.literal("unforce"),
769
- expressions: z6.array(z6.string().nonempty()),
770
- restore: z6.boolean()
766
+ z5.strictObject({
767
+ command: z5.literal("unforce"),
768
+ expressions: z5.array(z5.string().nonempty()),
769
+ restore: z5.boolean()
771
770
  }),
772
- z6.strictObject({ command: z6.enum(["start", "stop"]) }),
773
- z6.strictObject({
774
- command: z6.literal("reset"),
775
- kind: z6.enum(["Warm", "Cold"])
771
+ z5.strictObject({ command: z5.enum(["start", "stop"]) }),
772
+ z5.strictObject({
773
+ command: z5.literal("reset"),
774
+ kind: z5.enum(["Warm", "Cold"])
776
775
  })
777
776
  ]);
778
- var loginResultSchema = z6.union([
779
- z6.strictObject({ values: z6.record(z6.string(), z6.string()) }),
780
- z6.strictObject({ state: z6.string(), forced: z6.array(z6.string()) })
777
+ var loginResultSchema = z5.union([
778
+ z5.strictObject({ values: z5.record(z5.string(), z5.string()) }),
779
+ z5.strictObject({ state: z5.string(), forced: z5.array(z5.string()) })
781
780
  ]);
782
781
 
783
782
  // packages/build/src/host/codesys-command.ts
@@ -795,7 +794,7 @@ var codesysCommand = [
795
794
  // packages/build/src/host/codesys-host.ts
796
795
  import { execFile as execFile3, spawn as spawn2 } from "node:child_process";
797
796
  import { promisify as promisify3 } from "node:util";
798
- import { z as z7 } from "zod";
797
+ import { z as z6 } from "zod";
799
798
 
800
799
  // packages/build/src/host/windows-path.ts
801
800
  import { execFile as execFile2 } from "node:child_process";
@@ -808,10 +807,10 @@ var execute2 = promisify2(execFile2);
808
807
 
809
808
  // packages/build/src/host/codesys-host.ts
810
809
  var execute3 = promisify3(execFile3);
811
- var exitSchema = z7.object({
812
- pid: z7.int().positive(),
813
- code: z7.int().nullable(),
814
- signal: z7.string().nullable()
810
+ var exitSchema = z6.object({
811
+ pid: z6.int().positive(),
812
+ code: z6.int().nullable(),
813
+ signal: z6.string().nullable()
815
814
  });
816
815
 
817
816
  // packages/build/src/host/codesys-worker.ts
@@ -824,12 +823,12 @@ var workerScripts = [
824
823
  "codesys_login.py"
825
824
  ];
826
825
  var workerScriptsDigest = async () => createHash4("sha256").update(JSON.stringify(await Promise.all(workerScripts.map((script) => readFile5(resolve7(pythonDirectory, script), "utf8"))))).digest("hex");
827
- var sessionSchema = z8.object({
828
- directory: z8.string(),
829
- fingerprint: z8.string(),
830
- pid: z8.int().positive()
826
+ var sessionSchema = z7.object({
827
+ directory: z7.string(),
828
+ fingerprint: z7.string(),
829
+ pid: z7.int().positive()
831
830
  });
832
- var phaseSchema = z8.enum(["prepare", "transfer"]);
831
+ var phaseSchema = z7.enum(["prepare", "transfer"]);
833
832
  var hasCode = (error, code) => error instanceof Error && ("code" in error) && error.code === code;
834
833
  var isProcessAlive = (pid) => {
835
834
  try {
@@ -1668,7 +1667,7 @@ import { tmpdir as tmpdir4 } from "node:os";
1668
1667
  import { posix as posix3, resolve as resolve10 } from "node:path";
1669
1668
  import { setTimeout as delay2 } from "node:timers/promises";
1670
1669
  import { controllerBudgets as controllerBudgets2 } from "@tsplc/config/build";
1671
- import { z as z10 } from "zod";
1670
+ import { z as z9 } from "zod";
1672
1671
 
1673
1672
  // packages/build/src/controller-session.ts
1674
1673
  import { cp as cp5, mkdir as mkdir6, readdir as readdir3, readFile as readFile7, rm as rm6, writeFile as writeFile5 } from "node:fs/promises";
@@ -1677,15 +1676,15 @@ import {
1677
1676
  controllerBudgets,
1678
1677
  sha256Digest as sha256Digest2
1679
1678
  } from "@tsplc/config/build";
1680
- import { z as z9 } from "zod";
1681
- var guid = z9.string().regex(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i);
1682
- var pointerSchema = z9.strictObject({
1683
- schemaVersion: z9.literal(1),
1684
- generation: z9.uuid()
1679
+ import { z as z8 } from "zod";
1680
+ var guid = z8.string().regex(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i);
1681
+ var pointerSchema = z8.strictObject({
1682
+ schemaVersion: z8.literal(1),
1683
+ generation: z8.uuid()
1685
1684
  });
1686
1685
  var baselineSchema = controllerResultSchema.extend({
1687
- objects: z9.array(z9.record(z9.string(), z9.unknown())),
1688
- files: z9.record(z9.string(), sha256Digest2),
1686
+ objects: z8.array(z8.record(z8.string(), z8.unknown())),
1687
+ files: z8.record(z8.string(), sha256Digest2),
1689
1688
  deviceSettings: sha256Digest2.optional()
1690
1689
  });
1691
1690
  var controllerDirectory = (outDir) => resolve9(outDir, ".codesys/controller");
@@ -1706,10 +1705,10 @@ var controllerBaseline = async (outDir) => {
1706
1705
  return "malformed";
1707
1706
  }
1708
1707
  };
1709
- var restoreResultSchema = z9.object({
1710
- restored: z9.boolean(),
1711
- controllerIds: z9.strictObject({ codeId: guid, dataId: guid }),
1712
- state: z9.string()
1708
+ var restoreResultSchema = z8.object({
1709
+ restored: z8.boolean(),
1710
+ controllerIds: z8.strictObject({ codeId: guid, dataId: guid }),
1711
+ state: z8.string()
1713
1712
  });
1714
1713
 
1715
1714
  // packages/build/src/controller-online.ts
@@ -1792,12 +1791,12 @@ var controllerOperation = async (config, operation, options) => {
1792
1791
  };
1793
1792
  var updateController = (config, operation, options = {}) => controllerOperation(config, operation, options);
1794
1793
  var inspectController = (config, read, options = {}) => controllerOperation(config, "inspect", { ...options, read });
1795
- var loginReplySchema = z10.discriminatedUnion("ok", [
1796
- z10.strictObject({ ok: z10.literal(true), result: z10.unknown() }),
1797
- z10.strictObject({
1798
- ok: z10.literal(false),
1799
- error: z10.string(),
1800
- downloadRequired: z10.literal(true).optional(),
1794
+ var loginReplySchema = z9.discriminatedUnion("ok", [
1795
+ z9.strictObject({ ok: z9.literal(true), result: z9.unknown() }),
1796
+ z9.strictObject({
1797
+ ok: z9.literal(false),
1798
+ error: z9.string(),
1799
+ downloadRequired: z9.literal(true).optional(),
1801
1800
  rollback: rollbackSchema.optional()
1802
1801
  })
1803
1802
  ]);
@@ -1841,7 +1840,7 @@ var callContainer = async (name, port, method, body) => {
1841
1840
  return reply.result;
1842
1841
  };
1843
1842
  var answers = (name, port) => callContainer(name, port, "GET").then(() => true, () => false);
1844
- var warmStateSchema = z10.object({ finishing: z10.boolean() });
1843
+ var warmStateSchema = z9.object({ finishing: z9.boolean() });
1845
1844
  var finishing = (name) => callContainer(name, warmPort, "GET").then((state) => warmStateSchema.safeParse(state).data?.finishing === true, () => false);
1846
1845
  var settleWarmController = async (config, name) => {
1847
1846
  const deadline = Date.now() + 2 * controllerBudgets2(config.timeouts).prepare;
@@ -2057,21 +2056,21 @@ import { mkdir as mkdir8, readFile as readFile9, rename as rename3, writeFile as
2057
2056
  import { basename as basename5, relative as relative3, resolve as resolve11 } from "node:path";
2058
2057
  import { sha256Digest as sha256Digest3 } from "@tsplc/config/build";
2059
2058
  import { generatedDirectory } from "@tsplc/config/project-files";
2060
- import { z as z11 } from "zod";
2059
+ import { z as z10 } from "zod";
2061
2060
  var libraryRegistry = "https://store-archive.codesys.com/CODESYSLibs";
2062
2061
  var libraryFile = /\.(?:compiled-library(?:-v\d+)?|library)$/i;
2063
- var installedLibrarySchema = z11.object({
2064
- title: z11.string(),
2065
- company: z11.string().optional(),
2066
- version: z11.string().optional(),
2067
- namespace: z11.string().optional(),
2068
- path: z11.string(),
2062
+ var installedLibrarySchema = z10.object({
2063
+ title: z10.string(),
2064
+ company: z10.string().optional(),
2065
+ version: z10.string().optional(),
2066
+ namespace: z10.string().optional(),
2067
+ path: z10.string(),
2069
2068
  sha256: sha256Digest3,
2070
- url: z11.string().optional()
2069
+ url: z10.string().optional()
2071
2070
  });
2072
- var libraryLockSchema = z11.object({
2073
- version: z11.literal(1),
2074
- dependencies: z11.record(z11.string(), installedLibrarySchema)
2071
+ var libraryLockSchema = z10.object({
2072
+ version: z10.literal(1),
2073
+ dependencies: z10.record(z10.string(), installedLibrarySchema)
2075
2074
  });
2076
2075
  var readLock = async (file) => {
2077
2076
  const text = await readFile9(file, "utf8").catch((cause) => {
@@ -2255,7 +2254,7 @@ import { mkdtemp as mkdtemp5, readFile as readFile10, rm as rm8, writeFile as wr
2255
2254
  import { tmpdir as tmpdir5 } from "node:os";
2256
2255
  import { basename as basename6, dirname as dirname2, join } from "node:path";
2257
2256
  import { setTimeout as delay3 } from "node:timers/promises";
2258
- import { z as z12 } from "zod";
2257
+ import { z as z11 } from "zod";
2259
2258
 
2260
2259
  // packages/build/src/runtime-status.ts
2261
2260
  var getApplicationStatus = (log, application, startedAt) => {
@@ -2273,9 +2272,9 @@ var getApplicationStatus = (log, application, startedAt) => {
2273
2272
  };
2274
2273
 
2275
2274
  // packages/build/src/run.ts
2276
- var stateSchema = z12.object({
2277
- Running: z12.boolean(),
2278
- StartedAt: z12.iso.datetime({ offset: true })
2275
+ var stateSchema = z11.object({
2276
+ Running: z11.boolean(),
2277
+ StartedAt: z11.iso.datetime({ offset: true })
2279
2278
  });
2280
2279
  var service = "plc";
2281
2280
  var runtimeProject = (name) => name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9_-]+/g, "-");
@@ -2388,5 +2387,5 @@ export {
2388
2387
  workerScriptsDigest
2389
2388
  };
2390
2389
 
2391
- //# debugId=85FDA40C1C513B4D64756E2164756E21
2390
+ //# debugId=429690DB6F268B1964756E2164756E21
2392
2391
  //# sourceMappingURL=index.js.map