@platforma-sdk/package-builder-lib 1.1.0 → 1.2.0

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 (99) hide show
  1. package/dist/core/archive.cjs +3 -3
  2. package/dist/core/archive.cjs.map +1 -1
  3. package/dist/core/archive.js.map +1 -1
  4. package/dist/core/conda/builder.cjs +9 -4
  5. package/dist/core/conda/builder.cjs.map +1 -1
  6. package/dist/core/conda/builder.js +5 -1
  7. package/dist/core/conda/builder.js.map +1 -1
  8. package/dist/core/conda/validate-spec.cjs +2 -2
  9. package/dist/core/conda/validate-spec.cjs.map +1 -1
  10. package/dist/core/conda/validate-spec.js.map +1 -1
  11. package/dist/core/core.cjs +29 -8
  12. package/dist/core/core.cjs.map +1 -1
  13. package/dist/core/core.d.ts +6 -1
  14. package/dist/core/core.d.ts.map +1 -1
  15. package/dist/core/core.js +27 -6
  16. package/dist/core/core.js.map +1 -1
  17. package/dist/core/docker-conda.cjs +2 -2
  18. package/dist/core/docker-conda.cjs.map +1 -1
  19. package/dist/core/docker-conda.js.map +1 -1
  20. package/dist/core/docker-python.cjs +3 -2
  21. package/dist/core/docker-python.cjs.map +1 -1
  22. package/dist/core/docker-python.js +1 -1
  23. package/dist/core/docker-python.js.map +1 -1
  24. package/dist/core/docker.cjs +3 -3
  25. package/dist/core/docker.cjs.map +1 -1
  26. package/dist/core/docker.js.map +1 -1
  27. package/dist/core/envs.cjs +34 -0
  28. package/dist/core/envs.cjs.map +1 -1
  29. package/dist/core/envs.d.ts +8 -2
  30. package/dist/core/envs.d.ts.map +1 -1
  31. package/dist/core/envs.js +13 -1
  32. package/dist/core/envs.js.map +1 -1
  33. package/dist/core/package-info.cjs +59 -5
  34. package/dist/core/package-info.cjs.map +1 -1
  35. package/dist/core/package-info.d.ts +11 -2
  36. package/dist/core/package-info.d.ts.map +1 -1
  37. package/dist/core/package-info.js +60 -6
  38. package/dist/core/package-info.js.map +1 -1
  39. package/dist/core/paths.cjs +1 -1
  40. package/dist/core/paths.cjs.map +1 -1
  41. package/dist/core/paths.js +1 -1
  42. package/dist/core/paths.js.map +1 -1
  43. package/dist/core/resolver.cjs +7 -2
  44. package/dist/core/resolver.cjs.map +1 -1
  45. package/dist/core/resolver.js +1 -1
  46. package/dist/core/resolver.js.map +1 -1
  47. package/dist/core/schemas/artifacts.cjs +7 -1
  48. package/dist/core/schemas/artifacts.cjs.map +1 -1
  49. package/dist/core/schemas/artifacts.d.ts +1 -1
  50. package/dist/core/schemas/artifacts.d.ts.map +1 -1
  51. package/dist/core/schemas/artifacts.js +1 -1
  52. package/dist/core/schemas/artifacts.js.map +1 -1
  53. package/dist/core/schemas/entrypoints.cjs +4 -1
  54. package/dist/core/schemas/entrypoints.cjs.map +1 -1
  55. package/dist/core/schemas/entrypoints.d.ts +1 -1
  56. package/dist/core/schemas/entrypoints.d.ts.map +1 -1
  57. package/dist/core/schemas/entrypoints.js +1 -1
  58. package/dist/core/schemas/entrypoints.js.map +1 -1
  59. package/dist/core/schemas/sw-json.cjs +16 -1
  60. package/dist/core/schemas/sw-json.cjs.map +1 -1
  61. package/dist/core/schemas/sw-json.js +1 -1
  62. package/dist/core/schemas/sw-json.js.map +1 -1
  63. package/dist/core/storage.cjs +6 -2
  64. package/dist/core/storage.cjs.map +1 -1
  65. package/dist/core/storage.js +4 -1
  66. package/dist/core/storage.js.map +1 -1
  67. package/dist/core/sw-json-render.cjs +38 -7
  68. package/dist/core/sw-json-render.cjs.map +1 -1
  69. package/dist/core/sw-json-render.js +37 -8
  70. package/dist/core/sw-json-render.js.map +1 -1
  71. package/dist/core/util.cjs +33 -12
  72. package/dist/core/util.cjs.map +1 -1
  73. package/dist/core/util.d.ts +12 -7
  74. package/dist/core/util.d.ts.map +1 -1
  75. package/dist/core/util.js +17 -8
  76. package/dist/core/util.js.map +1 -1
  77. package/dist/defaults.cjs +18 -1
  78. package/dist/defaults.cjs.map +1 -1
  79. package/dist/defaults.d.ts +9 -3
  80. package/dist/defaults.d.ts.map +1 -1
  81. package/dist/defaults.js +13 -2
  82. package/dist/defaults.js.map +1 -1
  83. package/dist/index.cjs.map +1 -1
  84. package/dist/index.d.ts +4 -2
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js.map +1 -1
  87. package/package.json +3 -3
  88. package/src/core/core.test.ts +17 -0
  89. package/src/core/core.ts +48 -8
  90. package/src/core/envs.ts +8 -0
  91. package/src/core/package-info.test.ts +162 -3
  92. package/src/core/package-info.ts +88 -3
  93. package/src/core/schemas/test-artifacts.ts +1 -1
  94. package/src/core/sw-json-render.test.ts +23 -0
  95. package/src/core/sw-json-render.ts +30 -2
  96. package/src/core/util.test.ts +52 -0
  97. package/src/core/util.ts +27 -7
  98. package/src/defaults.ts +19 -1
  99. package/src/index.ts +4 -0
@@ -1,14 +1,14 @@
1
- import { z } from "zod/v4";
2
1
  import { Hash } from "node:crypto";
2
+ import { z } from "zod/v4";
3
3
  import winston from "winston";
4
4
 
5
5
  //#region src/core/util.d.ts
6
6
  declare namespace util_d_exports {
7
- export { AllPlatforms, AllSoftwareSources, ArchType, Arches, BuildMode, CLIError, CLIErrorClass, OSType, OSes, PlatformType, SoftwareSource, artifactID, artifactIDFromString, artifactIDToString, assertNever, createLogger, currentArch, currentOS, currentPlatform, ensureDirsExist, findInstalledModule, findNodeModules, findPackageRoot, formatZodIssues, hashDirMetaSync, hashDirSync, indentText, isDevLocalMode, isPlatformSupported, joinPlatform, packageJsonName, rSplit, softwareConfigName, splitPlatform, toInt, trimPrefix, trimSuffix, urlJoin, wrapErr };
7
+ export { AllPlatforms, AllSoftwareSources, ArchType, Arches, BuildMode, CLIError, CLIErrorClass, OSType, OSes, PlatformType, SoftwareSource, artifactID, artifactIDFromString, artifactIDToString, assertNever, createLogger, currentArch, currentOS, currentPlatform, ensureDirsExist, findInstalledModule, findNodeModules, findPackageRoot, formatZodIssues, hashDirMetaSync, hashDirSync, indentText, isDevMode, isPlatformSupported, joinPlatform, packageJsonName, producesRegistryDescriptor, rSplit, shouldDoAction, softwareConfigName, splitPlatform, toInt, trimPrefix, trimSuffix, urlJoin, wrapErr };
8
8
  }
9
9
  declare const packageJsonName = "package.json";
10
10
  declare const softwareConfigName = "package.json";
11
- declare function assertNever(_a: never): void;
11
+ declare function assertNever(_a: never): never;
12
12
  declare function trimPrefix(str: string, prefix: string): string;
13
13
  declare function trimSuffix(str: string, suffix: string): string;
14
14
  declare function hashDirMetaSync(folder: string, hasher?: Hash): Hash;
@@ -46,9 +46,14 @@ declare function isPlatformSupported(os: OSType, arch: ArchType): boolean;
46
46
  declare function currentPlatform(): PlatformType;
47
47
  declare const AllSoftwareSources: readonly ["archive", "docker"];
48
48
  type SoftwareSource = (typeof AllSoftwareSources)[number];
49
- type BuildMode = "dev-local" | "release";
50
- /** True for dev-local build mode. */
51
- declare function isDevLocalMode(mode: BuildMode): mode is "dev-local";
49
+ type BuildMode = "dev-local" | "dev-remote" | "release";
50
+ declare function isDevMode(mode: BuildMode): mode is "dev-local" | "dev-remote";
51
+ declare function producesRegistryDescriptor(mode: BuildMode): mode is "dev-remote" | "release";
52
+ declare function shouldDoAction(opts: {
53
+ default: boolean;
54
+ enable?: boolean;
55
+ disable?: boolean;
56
+ }): boolean;
52
57
  type artifactID = {
53
58
  package: string;
54
59
  name: string;
@@ -62,5 +67,5 @@ declare class CLIErrorClass extends Error {
62
67
  }
63
68
  declare function CLIError(msg: string | Error): CLIErrorClass;
64
69
  //#endregion
65
- export { ArchType, BuildMode, OSType, PlatformType, SoftwareSource, util_d_exports };
70
+ export { AllPlatforms, AllSoftwareSources, ArchType, Arches, BuildMode, CLIError, CLIErrorClass, OSType, OSes, PlatformType, SoftwareSource, artifactID, artifactIDFromString, artifactIDToString, assertNever, createLogger, currentArch, currentOS, currentPlatform, ensureDirsExist, findInstalledModule, findNodeModules, findPackageRoot, formatZodIssues, hashDirMetaSync, hashDirSync, indentText, isDevMode, isPlatformSupported, joinPlatform, packageJsonName, producesRegistryDescriptor, rSplit, shouldDoAction, softwareConfigName, splitPlatform, toInt, trimPrefix, trimSuffix, urlJoin, util_d_exports, wrapErr };
66
71
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","names":[],"sources":["../../src/core/util.ts"],"mappings":";;;;;;;;cASa,eAAA;AAAA,cACA,kBAAA;AAAA,iBAEG,WAAA,CAAY,EAAA;AAAA,iBAIZ,UAAA,CAAW,GAAA,UAAa,MAAA;AAAA,iBAOxB,UAAA,CAAW,GAAA,UAAa,MAAA;AAAA,iBAOxB,eAAA,CAAgB,MAAA,UAAgB,MAAA,GAAS,IAAA,GAAO,IAAA;AAAA,iBAmBhD,WAAA,CAAY,OAAA,UAAiB,MAAA,GAAS,IAAA,EAAM,MAAA,YAAkB,IAAA;AAAA,iBAiC9D,eAAA,CAAgB,OAAA;AAAA,iBAShB,eAAA,CAAgB,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAAQ,SAAA;AAAA,iBAWxC,eAAA,CAAgB,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAAQ,SAAA;AAAA,iBAWxC,mBAAA,CACd,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAChB,WAAA,UACA,SAAA;AAAA,iBA+Bc,YAAA,CAAa,KAAA,YAA0B,OAAA,CAAQ,MAAA;AAAA,iBAiC/C,MAAA,CAAO,KAAA,UAAe,SAAA,UAAmB,KAAA;AAAA,iBAUzC,OAAA,CAAQ,GAAA,UAAa,UAAA;AAAA,iBAWrB,OAAA,CAAQ,CAAA,OAAQ,GAAA;;;;;;;;iBAoBhB,KAAA,CAAM,KAAA;AAAA,cAIT,IAAA;AAAA,KACD,MAAA,WAAiB,IAAA;AAAA,iBAEb,SAAA,CAAA,GAAa,MAAA;AAAA,cAiBhB,MAAA;AAAA,KACD,QAAA,WAAmB,MAAA;AAAA,iBAEf,WAAA,CAAA,GAAe,QAAA;AAAA,cAgBlB,YAAA,KAAiB,MAAA,IAAU,QAAA;AAAA,KAO5B,Y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,cAAA,CAAe,IAAA;EAC7B,OAAA;EACA,MAAA;EACA,OAAA;AAAA;AAAA,KAOU,UAAA;EACV,OAAA;EACA,IAAI;AAAA;AAAA,iBAGU,oBAAA,CAAqB,CAAA,WAAY,UAAU;AAAA,iBAa3C,kBAAA,CAAmB,CAAa,EAAV,UAAU;AAAA,iBAIhC,UAAA,CAAW,GAAA,UAAa,MAAA,mBAAyB,aAAA;AAAA,cASpD,eAAA,GACX,MAAA,EAAQ,CAAA,CAAE,IAAA,CAAK,SAAA,IACf,CAAA,WACA,CAAA,GAAG,WAAW;AAAA,cA0CH,aAAA,SAAsB,KAAK;cAC1B,GAAA,WAAc,KAAA;AAAA;AAAA,iBAMZ,QAAA,CAAS,GAAA,WAAc,KAAA,GAAQ,aAAa"}
package/dist/core/util.js CHANGED
@@ -2,8 +2,8 @@ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { isCI, isRunnerDebug } from "./envs.js";
3
3
  import fs from "node:fs";
4
4
  import * as path$1 from "node:path";
5
- import * as os from "node:os";
6
5
  import { createHash } from "node:crypto";
6
+ import * as os from "node:os";
7
7
  import winston from "winston";
8
8
  //#region src/core/util.ts
9
9
  var util_exports = /* @__PURE__ */ __exportAll({
@@ -28,11 +28,13 @@ var util_exports = /* @__PURE__ */ __exportAll({
28
28
  hashDirMetaSync: () => hashDirMetaSync,
29
29
  hashDirSync: () => hashDirSync,
30
30
  indentText: () => indentText,
31
- isDevLocalMode: () => isDevLocalMode,
31
+ isDevMode: () => isDevMode,
32
32
  isPlatformSupported: () => isPlatformSupported,
33
33
  joinPlatform: () => joinPlatform,
34
34
  packageJsonName: () => packageJsonName,
35
+ producesRegistryDescriptor: () => producesRegistryDescriptor,
35
36
  rSplit: () => rSplit,
37
+ shouldDoAction: () => shouldDoAction,
36
38
  softwareConfigName: () => softwareConfigName,
37
39
  splitPlatform: () => splitPlatform,
38
40
  toInt: () => toInt,
@@ -70,7 +72,7 @@ function hashDirMetaSync(folder, hasher) {
70
72
  function hashDirSync(rootDir, hasher, subdir) {
71
73
  const hash = hasher ? hasher : createHash("sha256");
72
74
  const folder = path$1.join(rootDir, subdir ?? ".");
73
- const info = fs.readdirSync(folder, { withFileTypes: true });
75
+ const info = fs.readdirSync(folder, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
74
76
  for (const item of info) {
75
77
  const relPath = path$1.join(subdir ?? ".", item.name);
76
78
  const fullPath = path$1.join(folder, item.name);
@@ -81,7 +83,7 @@ function hashDirSync(rootDir, hasher, subdir) {
81
83
  let bytesRead;
82
84
  while ((bytesRead = fs.readSync(fileDescriptor, buffer, 0, buffer.length, null)) !== 0) hash.update(buffer.subarray(0, bytesRead));
83
85
  fs.closeSync(fileDescriptor);
84
- } else if (item.isDirectory()) hashDirSync(fullPath, hash);
86
+ } else if (item.isDirectory()) hashDirSync(rootDir, hash, relPath);
85
87
  }
86
88
  return hash;
87
89
  }
@@ -220,9 +222,16 @@ function currentPlatform() {
220
222
  return `${currentOS()}-${currentArch()}`;
221
223
  }
222
224
  const AllSoftwareSources = ["archive", "docker"];
223
- /** True for dev-local build mode. */
224
- function isDevLocalMode(mode) {
225
- return mode === "dev-local";
225
+ function isDevMode(mode) {
226
+ return mode === "dev-local" || mode === "dev-remote";
227
+ }
228
+ function producesRegistryDescriptor(mode) {
229
+ return mode === "dev-remote" || mode === "release";
230
+ }
231
+ function shouldDoAction(opts) {
232
+ if (opts.disable) return false;
233
+ if (opts.enable) return true;
234
+ return opts.default;
226
235
  }
227
236
  function artifactIDFromString(s) {
228
237
  const parts = s.split(":", 2);
@@ -276,6 +285,6 @@ function CLIError(msg) {
276
285
  return new CLIErrorClass(msg);
277
286
  }
278
287
  //#endregion
279
- export { AllPlatforms, CLIError, artifactIDToString, assertNever, currentArch, currentOS, currentPlatform, ensureDirsExist, findInstalledModule, findPackageRoot, formatZodIssues, hashDirMetaSync, hashDirSync, isDevLocalMode, joinPlatform, packageJsonName, rSplit, softwareConfigName, splitPlatform, toInt, trimPrefix, urlJoin, util_exports, wrapErr };
288
+ export { AllPlatforms, AllSoftwareSources, Arches, CLIError, CLIErrorClass, OSes, artifactIDFromString, artifactIDToString, assertNever, createLogger, currentArch, currentOS, currentPlatform, ensureDirsExist, findInstalledModule, findNodeModules, findPackageRoot, formatZodIssues, hashDirMetaSync, hashDirSync, indentText, isDevMode, isPlatformSupported, joinPlatform, packageJsonName, producesRegistryDescriptor, rSplit, shouldDoAction, softwareConfigName, splitPlatform, toInt, trimPrefix, trimSuffix, urlJoin, util_exports, wrapErr };
280
289
 
281
290
  //# sourceMappingURL=util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","names":["path","envs.isCI","envs.isRunnerDebug"],"sources":["../../src/core/util.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as os from \"node:os\";\nimport fs from \"node:fs\";\nimport type { Hash } from \"node:crypto\";\nimport { createHash } from \"node:crypto\";\nimport winston from \"winston\";\nimport type { z } from \"zod/v4\";\nimport * as envs from \"./envs\";\n\nexport const packageJsonName = \"package.json\";\nexport const softwareConfigName = \"package.json\";\n\nexport function assertNever(_a: never) {\n throw new Error(`code logic error: assertNever() call for ${JSON.stringify(_a)}`);\n}\n\nexport function trimPrefix(str: string, prefix: string): string {\n if (str.startsWith(prefix)) {\n return str.slice(prefix.length);\n }\n return str;\n}\n\nexport function trimSuffix(str: string, suffix: string): string {\n if (str.endsWith(suffix)) {\n return str.slice(0, -suffix.length);\n }\n return str;\n}\n\nexport function hashDirMetaSync(folder: string, hasher?: Hash): Hash {\n const hash = hasher ? hasher : createHash(\"sha256\");\n const info = fs.readdirSync(folder, { withFileTypes: true });\n\n for (const item of info) {\n const fullPath = path.join(folder, item.name);\n\n if (item.isFile()) {\n const statInfo = fs.statSync(fullPath);\n const fileInfo = `${fullPath}:${statInfo.size}:${statInfo.mtimeMs}`;\n hash.update(fileInfo);\n } else if (item.isDirectory()) {\n hashDirMetaSync(fullPath, hash);\n }\n }\n\n return hash;\n}\n\nexport function hashDirSync(rootDir: string, hasher?: Hash, subdir?: string): Hash {\n const hash = hasher ? hasher : createHash(\"sha256\");\n const folder = path.join(rootDir, subdir ?? \".\");\n\n const info = fs.readdirSync(folder, { withFileTypes: true });\n\n for (const item of info) {\n const relPath = path.join(subdir ?? \".\", item.name);\n const fullPath = path.join(folder, item.name);\n\n hash.update(relPath);\n\n if (item.isFile()) {\n const fileDescriptor = fs.openSync(fullPath, \"r\");\n const buffer = Buffer.alloc(65536);\n let bytesRead: number;\n\n while ((bytesRead = fs.readSync(fileDescriptor, buffer, 0, buffer.length, null)) !== 0) {\n hash.update(buffer.subarray(0, bytesRead));\n }\n\n fs.closeSync(fileDescriptor);\n } else if (item.isDirectory()) {\n hashDirSync(fullPath, hash);\n }\n }\n\n return hash;\n}\n\n//\n// Creates all intermediate directories down to given <dirPath>.\n//\nexport function ensureDirsExist(dirPath: string) {\n if (fs.existsSync(dirPath)) {\n return;\n }\n const parentDir = path.dirname(dirPath);\n ensureDirsExist(parentDir);\n fs.mkdirSync(dirPath);\n}\n\nexport function findPackageRoot(logger: winston.Logger, startPath?: string): string {\n if (!startPath) {\n startPath = process.cwd();\n }\n logger.debug(`Detecting package root...`);\n const pkgRoot = searchPathUp(startPath, startPath, packageJsonName);\n logger.debug(` package root found at '${pkgRoot}'`);\n\n return pkgRoot;\n}\n\nexport function findNodeModules(logger: winston.Logger, startPath?: string): string {\n if (!startPath) {\n startPath = process.cwd();\n }\n logger.debug(`Detecting 'node_modules' directory...`);\n const nodeModules = searchPathUp(startPath, startPath, \"node_modules\");\n logger.debug(` 'node_modules' found at '${nodeModules}'`);\n\n return path.join(nodeModules, \"node_modules\");\n}\n\nexport function findInstalledModule(\n logger: winston.Logger,\n packageName: string,\n startPath?: string,\n): string {\n const nodeModules = findNodeModules(logger, startPath);\n const packagePath = path.resolve(nodeModules, packageName);\n\n if (!fs.existsSync(packagePath)) {\n throw CLIError(\n `package '${packageName}' not found in '${nodeModules}'. Did you forget to add it as a dependency?`,\n );\n }\n\n return packagePath;\n}\n\nfunction searchPathUp(startPath: string, pathToCheck: string, itemToCheck: string): string {\n const itemPath = path.resolve(pathToCheck, itemToCheck);\n\n if (fs.existsSync(itemPath)) {\n return pathToCheck;\n }\n\n const parentDir = path.dirname(pathToCheck);\n if (parentDir === pathToCheck || pathToCheck === \"\") {\n throw CLIError(\n `failed to find '${itemToCheck}' file in any of parent directories starting from '${startPath}'`,\n );\n }\n\n return searchPathUp(startPath, parentDir, itemToCheck);\n}\n\nexport function createLogger(level: string = \"debug\"): winston.Logger {\n if (envs.isCI() && envs.isRunnerDebug()) {\n level = \"debug\";\n }\n\n return winston.createLogger({\n level: level,\n\n format: winston.format.printf(({ level, message }) => {\n const indent = \" \".repeat(level.length + 2); // For ': ' after the level\n if (typeof message !== \"string\") {\n const messageJson = JSON.stringify(message);\n throw new Error(`logger message ${messageJson} is not a string`);\n }\n const indentedMessage = message\n .split(\"\\n\")\n .map((line: string, index: number) => (index === 0 ? line : indent + line))\n .join(\"\\n\");\n\n const colorize = (l: string) => winston.format.colorize().colorize(l, l);\n\n return `${colorize(level)}: ${indentedMessage}`;\n }),\n\n transports: [\n new winston.transports.Console({\n stderrLevels: [\"error\", \"warn\", \"info\", \"debug\"],\n handleExceptions: true,\n }),\n ],\n });\n}\n\nexport function rSplit(input: string, delimiter: string, limit?: number): string[] {\n const parts = input.split(delimiter);\n if (!limit || parts.length <= limit) {\n return parts;\n }\n\n return [parts.slice(0, -limit + 1).join(delimiter), ...parts.slice(-limit + 1)];\n}\n\nconst replaceDuplicateSlashes = new RegExp(\"//+\", \"g\");\nexport function urlJoin(url: string, appendPath: string): string {\n const u = new URL(url, \"file:/nonexistent-9672674c/\");\n if (u.protocol === \"file:\" && u.pathname.startsWith(\"/nonexistent-9672674c/\")) {\n throw new Error(`string '${url}' is not valid URL`);\n }\n\n u.pathname = u.pathname + \"/\" + appendPath;\n u.pathname = u.pathname.replaceAll(replaceDuplicateSlashes, \"/\");\n return u.toString();\n}\n\nexport function wrapErr(e: any, msg: string): any {\n if (!(e instanceof Error)) {\n return e;\n }\n\n const wrappedError = new Error(`${msg}: ${e.message}`);\n wrappedError.name = e.name;\n wrappedError.stack = e.stack;\n // Copy any additional custom properties\n Object.assign(wrappedError, e);\n return wrappedError;\n}\n\n/**\n * Converts any value to integer number 1 if value is truthful and 0 otherwice.\n * Provides simple way to count values that are defined in an object:\n * toInt(options.a) + toInt(options.b) + toInt(options.c) === 1\n * @param input: any\n * @returns number - '1' or '0'\n */\nexport function toInt(input: any): number {\n return input ? 1 : 0;\n}\n\nexport const OSes = [\"linux\", \"macosx\", \"windows\"] as const;\nexport type OSType = (typeof OSes)[number];\n\nexport function currentOS(): OSType {\n const platform = os.platform();\n switch (platform) {\n case \"darwin\":\n return \"macosx\";\n case \"linux\":\n return \"linux\";\n case \"win32\":\n return \"windows\";\n default:\n throw CLIError(\n `operating system '${platform}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` +\n JSON.stringify(OSes),\n );\n }\n}\n\nexport const Arches = [\"x64\", \"aarch64\"] as const;\nexport type ArchType = (typeof Arches)[number];\n\nexport function currentArch(): ArchType {\n const arch = os.arch();\n switch (arch) {\n case \"arm64\":\n return \"aarch64\";\n case \"x64\":\n return \"x64\";\n default:\n throw CLIError(\n `processor architecture '${arch}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` +\n JSON.stringify(Arches),\n );\n }\n}\n\n// Combinartions of OS and architecture, Platforma supports.\nexport const AllPlatforms: `${OSType}-${ArchType}`[] = [\n \"linux-x64\",\n \"linux-aarch64\",\n \"macosx-x64\",\n \"macosx-aarch64\",\n \"windows-x64\",\n] as const;\nexport type PlatformType = (typeof AllPlatforms)[number];\n\nexport function splitPlatform(platform: PlatformType): { os: OSType; arch: ArchType } {\n const parts = platform.split(\"-\");\n\n return {\n os: parts[0] as OSType,\n arch: parts[1] as ArchType,\n };\n}\n\nexport function joinPlatform(os: OSType, arch: ArchType): PlatformType {\n return `${os}-${arch}`;\n}\n\nexport function isPlatformSupported(os: OSType, arch: ArchType): boolean {\n return AllPlatforms.includes(`${os}-${arch}`);\n}\n\nexport function currentPlatform(): PlatformType {\n return `${currentOS()}-${currentArch()}`;\n}\n\nexport const AllSoftwareSources = [\"archive\", \"docker\"] as const; // add 'image', '<whatever>' here when supported\nexport type SoftwareSource = (typeof AllSoftwareSources)[number];\n\nexport type BuildMode = \"dev-local\" | \"release\";\n\n/** True for dev-local build mode. */\nexport function isDevLocalMode(mode: BuildMode): mode is \"dev-local\" {\n return mode === \"dev-local\";\n}\n\nexport type artifactID = {\n package: string;\n name: string;\n};\n\nexport function artifactIDFromString(s: string): artifactID {\n const parts = s.split(\":\", 2);\n if (parts.length < 2) {\n throw CLIError(\n `string '${s}' is not an artifact ID (artifact ID format is <packageName>:<artifactName>)`,\n );\n }\n return {\n package: parts[0],\n name: parts[1],\n };\n}\n\nexport function artifactIDToString(a: artifactID): string {\n return `${a.package}:${a.name}`;\n}\n\nexport function indentText(txt: string, indent: string | number, skipFirstLine: boolean = false) {\n indent = typeof indent === \"number\" ? \" \".repeat(indent) : indent;\n\n return txt\n .split(\"\\n\")\n .map((line, index) => (index === 0 && skipFirstLine ? line : `${indent}${line}`))\n .join(\"\\n\");\n}\n\nexport const formatZodIssues = (\n issues: z.core.$ZodIssue[],\n i: string = \"\",\n p: PropertyKey[] = [],\n): string => {\n const _errors: string[] = [];\n\n const formatSubpath = (path: PropertyKey[], prefix: string = \"\") => {\n let pp = path.join(\".\");\n if (pp != \"\" && p.length > 0) pp = `.${pp}`;\n if (pp != \"\") pp = `${prefix}${pp}`;\n return pp;\n };\n\n const addItem = (item: string) => _errors.push(indentText(item, i));\n\n for (const issue of issues) {\n if (issue.code === \"invalid_union\") {\n addItem(`✖ Expected one of several possible values`);\n const path = formatSubpath(issue.path, \"\");\n addItem(` → at '${path}':`);\n for (const errGrp of issue.errors) {\n _errors.push(formatZodIssues(errGrp, `${i} `, [...p, ...issue.path]));\n }\n } else if (issue.code === \"invalid_element\" || issue.code === \"invalid_key\") {\n addItem(`✖ ${issue.code.replaceAll(\"_\", \" \")}:`);\n _errors.push(formatZodIssues(issue.issues, `${i} `, [...p, ...issue.path]));\n } else if (issue.code === \"invalid_type\") {\n const path = formatSubpath(issue.path, \" \");\n const prefix = `✖ (${issue.expected})${path}: `;\n const msg = indentText(issue.message, Math.min(prefix.length, 20), true);\n addItem(`${prefix}${msg}`);\n } else {\n const path = formatSubpath(issue.path, \" \");\n const prefix = `✖ (${issue.code.replaceAll(\"_\", \" \")})${path}: `;\n const msg = indentText(issue.message, Math.min(prefix.length, 20), true);\n addItem(`${prefix}${msg}`);\n }\n }\n\n return _errors.join(\"\\n\");\n};\n\n// User-facing CLI error. The top-level handler (bin/run.mjs) prints its\n// message without a stack trace and exits non-zero.\nexport class CLIErrorClass extends Error {\n constructor(msg: string | Error) {\n super(typeof msg === \"string\" ? msg : msg.message);\n this.name = \"CLIError\";\n }\n}\n\nexport function CLIError(msg: string | Error): CLIErrorClass {\n return new CLIErrorClass(msg);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAa,kBAAkB;AAC/B,MAAa,qBAAqB;AAElC,SAAgB,YAAY,IAAW;AACrC,OAAM,IAAI,MAAM,4CAA4C,KAAK,UAAU,GAAG,GAAG;;AAGnF,SAAgB,WAAW,KAAa,QAAwB;AAC9D,KAAI,IAAI,WAAW,OAAO,CACxB,QAAO,IAAI,MAAM,OAAO,OAAO;AAEjC,QAAO;;AAGT,SAAgB,WAAW,KAAa,QAAwB;AAC9D,KAAI,IAAI,SAAS,OAAO,CACtB,QAAO,IAAI,MAAM,GAAG,CAAC,OAAO,OAAO;AAErC,QAAO;;AAGT,SAAgB,gBAAgB,QAAgB,QAAqB;CACnE,MAAM,OAAO,SAAS,SAAS,WAAW,SAAS;CACnD,MAAM,OAAO,GAAG,YAAY,QAAQ,EAAE,eAAe,MAAM,CAAC;AAE5D,MAAK,MAAM,QA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,WAAW,KAAK,IAAI,CAAC,GAAG,KAAK;AAE7D,UAAQ,GAAG,SADC,WAAW,MAAM,SAAS,KAAK,IAAI,OAAO,QAAQ,GAAG,EAAE,KAAK,GAC9C;;AAI9B,QAAO,QAAQ,KAAK,KAAK;;AAK3B,IAAa,gBAAb,cAAmC,MAAM;CACvC,YAAY,KAAqB;AAC/B,QAAM,OAAO,QAAQ,WAAW,MAAM,IAAI,QAAQ;AAClD,OAAK,OAAO;;;AAIhB,SAAgB,SAAS,KAAoC;AAC3D,QAAO,IAAI,cAAc,IAAI"}
1
+ {"version":3,"file":"util.js","names":["path","envs.isCI","envs.isRunnerDebug"],"sources":["../../src/core/util.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as os from \"node:os\";\nimport fs from \"node:fs\";\nimport type { Hash } from \"node:crypto\";\nimport { createHash } from \"node:crypto\";\nimport winston from \"winston\";\nimport type { z } from \"zod/v4\";\nimport * as envs from \"./envs\";\n\nexport const packageJsonName = \"package.json\";\nexport const softwareConfigName = \"package.json\";\n\nexport function assertNever(_a: never): never {\n throw new Error(`code logic error: assertNever() call for ${JSON.stringify(_a)}`);\n}\n\nexport function trimPrefix(str: string, prefix: string): string {\n if (str.startsWith(prefix)) {\n return str.slice(prefix.length);\n }\n return str;\n}\n\nexport function trimSuffix(str: string, suffix: string): string {\n if (str.endsWith(suffix)) {\n return str.slice(0, -suffix.length);\n }\n return str;\n}\n\nexport function hashDirMetaSync(folder: string, hasher?: Hash): Hash {\n const hash = hasher ? hasher : createHash(\"sha256\");\n const info = fs.readdirSync(folder, { withFileTypes: true });\n\n for (const item of info) {\n const fullPath = path.join(folder, item.name);\n\n if (item.isFile()) {\n const statInfo = fs.statSync(fullPath);\n const fileInfo = `${fullPath}:${statInfo.size}:${statInfo.mtimeMs}`;\n hash.update(fileInfo);\n } else if (item.isDirectory()) {\n hashDirMetaSync(fullPath, hash);\n }\n }\n\n return hash;\n}\n\nexport function hashDirSync(rootDir: string, hasher?: Hash, subdir?: string): Hash {\n const hash = hasher ? hasher : createHash(\"sha256\");\n const folder = path.join(rootDir, subdir ?? \".\");\n\n // Sort for a host-independent hash: readdir enumeration order is not guaranteed.\n const info = fs\n .readdirSync(folder, { withFileTypes: true })\n .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));\n\n for (const item of info) {\n const relPath = path.join(subdir ?? \".\", item.name);\n const fullPath = path.join(folder, item.name);\n\n hash.update(relPath);\n\n if (item.isFile()) {\n const fileDescriptor = fs.openSync(fullPath, \"r\");\n const buffer = Buffer.alloc(65536);\n let bytesRead: number;\n\n while ((bytesRead = fs.readSync(fileDescriptor, buffer, 0, buffer.length, null)) !== 0) {\n hash.update(buffer.subarray(0, bytesRead));\n }\n\n fs.closeSync(fileDescriptor);\n } else if (item.isDirectory()) {\n // Keep rootDir fixed and pass the accumulated relPath so nested entries hash under their\n // full path from the root — otherwise `dirA/` + `file` collides with `dirA/file`.\n hashDirSync(rootDir, hash, relPath);\n }\n }\n\n return hash;\n}\n\n//\n// Creates all intermediate directories down to given <dirPath>.\n//\nexport function ensureDirsExist(dirPath: string) {\n if (fs.existsSync(dirPath)) {\n return;\n }\n const parentDir = path.dirname(dirPath);\n ensureDirsExist(parentDir);\n fs.mkdirSync(dirPath);\n}\n\nexport function findPackageRoot(logger: winston.Logger, startPath?: string): string {\n if (!startPath) {\n startPath = process.cwd();\n }\n logger.debug(`Detecting package root...`);\n const pkgRoot = searchPathUp(startPath, startPath, packageJsonName);\n logger.debug(` package root found at '${pkgRoot}'`);\n\n return pkgRoot;\n}\n\nexport function findNodeModules(logger: winston.Logger, startPath?: string): string {\n if (!startPath) {\n startPath = process.cwd();\n }\n logger.debug(`Detecting 'node_modules' directory...`);\n const nodeModules = searchPathUp(startPath, startPath, \"node_modules\");\n logger.debug(` 'node_modules' found at '${nodeModules}'`);\n\n return path.join(nodeModules, \"node_modules\");\n}\n\nexport function findInstalledModule(\n logger: winston.Logger,\n packageName: string,\n startPath?: string,\n): string {\n const nodeModules = findNodeModules(logger, startPath);\n const packagePath = path.resolve(nodeModules, packageName);\n\n if (!fs.existsSync(packagePath)) {\n throw CLIError(\n `package '${packageName}' not found in '${nodeModules}'. Did you forget to add it as a dependency?`,\n );\n }\n\n return packagePath;\n}\n\nfunction searchPathUp(startPath: string, pathToCheck: string, itemToCheck: string): string {\n const itemPath = path.resolve(pathToCheck, itemToCheck);\n\n if (fs.existsSync(itemPath)) {\n return pathToCheck;\n }\n\n const parentDir = path.dirname(pathToCheck);\n if (parentDir === pathToCheck || pathToCheck === \"\") {\n throw CLIError(\n `failed to find '${itemToCheck}' file in any of parent directories starting from '${startPath}'`,\n );\n }\n\n return searchPathUp(startPath, parentDir, itemToCheck);\n}\n\nexport function createLogger(level: string = \"debug\"): winston.Logger {\n if (envs.isCI() && envs.isRunnerDebug()) {\n level = \"debug\";\n }\n\n return winston.createLogger({\n level: level,\n\n format: winston.format.printf(({ level, message }) => {\n const indent = \" \".repeat(level.length + 2); // For ': ' after the level\n if (typeof message !== \"string\") {\n const messageJson = JSON.stringify(message);\n throw new Error(`logger message ${messageJson} is not a string`);\n }\n const indentedMessage = message\n .split(\"\\n\")\n .map((line: string, index: number) => (index === 0 ? line : indent + line))\n .join(\"\\n\");\n\n const colorize = (l: string) => winston.format.colorize().colorize(l, l);\n\n return `${colorize(level)}: ${indentedMessage}`;\n }),\n\n transports: [\n new winston.transports.Console({\n stderrLevels: [\"error\", \"warn\", \"info\", \"debug\"],\n handleExceptions: true,\n }),\n ],\n });\n}\n\nexport function rSplit(input: string, delimiter: string, limit?: number): string[] {\n const parts = input.split(delimiter);\n if (!limit || parts.length <= limit) {\n return parts;\n }\n\n return [parts.slice(0, -limit + 1).join(delimiter), ...parts.slice(-limit + 1)];\n}\n\nconst replaceDuplicateSlashes = new RegExp(\"//+\", \"g\");\nexport function urlJoin(url: string, appendPath: string): string {\n const u = new URL(url, \"file:/nonexistent-9672674c/\");\n if (u.protocol === \"file:\" && u.pathname.startsWith(\"/nonexistent-9672674c/\")) {\n throw new Error(`string '${url}' is not valid URL`);\n }\n\n u.pathname = u.pathname + \"/\" + appendPath;\n u.pathname = u.pathname.replaceAll(replaceDuplicateSlashes, \"/\");\n return u.toString();\n}\n\nexport function wrapErr(e: any, msg: string): any {\n if (!(e instanceof Error)) {\n return e;\n }\n\n const wrappedError = new Error(`${msg}: ${e.message}`);\n wrappedError.name = e.name;\n wrappedError.stack = e.stack;\n // Copy any additional custom properties\n Object.assign(wrappedError, e);\n return wrappedError;\n}\n\n/**\n * Converts any value to integer number 1 if value is truthful and 0 otherwice.\n * Provides simple way to count values that are defined in an object:\n * toInt(options.a) + toInt(options.b) + toInt(options.c) === 1\n * @param input: any\n * @returns number - '1' or '0'\n */\nexport function toInt(input: any): number {\n return input ? 1 : 0;\n}\n\nexport const OSes = [\"linux\", \"macosx\", \"windows\"] as const;\nexport type OSType = (typeof OSes)[number];\n\nexport function currentOS(): OSType {\n const platform = os.platform();\n switch (platform) {\n case \"darwin\":\n return \"macosx\";\n case \"linux\":\n return \"linux\";\n case \"win32\":\n return \"windows\";\n default:\n throw CLIError(\n `operating system '${platform}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` +\n JSON.stringify(OSes),\n );\n }\n}\n\nexport const Arches = [\"x64\", \"aarch64\"] as const;\nexport type ArchType = (typeof Arches)[number];\n\nexport function currentArch(): ArchType {\n const arch = os.arch();\n switch (arch) {\n case \"arm64\":\n return \"aarch64\";\n case \"x64\":\n return \"x64\";\n default:\n throw CLIError(\n `processor architecture '${arch}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` +\n JSON.stringify(Arches),\n );\n }\n}\n\n// Combinartions of OS and architecture, Platforma supports.\nexport const AllPlatforms: `${OSType}-${ArchType}`[] = [\n \"linux-x64\",\n \"linux-aarch64\",\n \"macosx-x64\",\n \"macosx-aarch64\",\n \"windows-x64\",\n] as const;\nexport type PlatformType = (typeof AllPlatforms)[number];\n\nexport function splitPlatform(platform: PlatformType): { os: OSType; arch: ArchType } {\n const parts = platform.split(\"-\");\n\n return {\n os: parts[0] as OSType,\n arch: parts[1] as ArchType,\n };\n}\n\nexport function joinPlatform(os: OSType, arch: ArchType): PlatformType {\n return `${os}-${arch}`;\n}\n\nexport function isPlatformSupported(os: OSType, arch: ArchType): boolean {\n return AllPlatforms.includes(`${os}-${arch}`);\n}\n\nexport function currentPlatform(): PlatformType {\n return `${currentOS()}-${currentArch()}`;\n}\n\nexport const AllSoftwareSources = [\"archive\", \"docker\"] as const; // add 'image', '<whatever>' here when supported\nexport type SoftwareSource = (typeof AllSoftwareSources)[number];\n\nexport type BuildMode = \"dev-local\" | \"dev-remote\" | \"release\";\n\nexport function isDevMode(mode: BuildMode): mode is \"dev-local\" | \"dev-remote\" {\n return mode === \"dev-local\" || mode === \"dev-remote\";\n}\n\nexport function producesRegistryDescriptor(mode: BuildMode): mode is \"dev-remote\" | \"release\" {\n return mode === \"dev-remote\" || mode === \"release\";\n}\n\n// Resolve a `--do`/`--no-do` (or PL_*_/PL_*_NO_ env) tri-state: explicit disable wins, then enable,\n// else the default.\nexport function shouldDoAction(opts: {\n default: boolean;\n enable?: boolean;\n disable?: boolean;\n}): boolean {\n if (opts.disable) return false;\n if (opts.enable) return true;\n return opts.default;\n}\n\nexport type artifactID = {\n package: string;\n name: string;\n};\n\nexport function artifactIDFromString(s: string): artifactID {\n const parts = s.split(\":\", 2);\n if (parts.length < 2) {\n throw CLIError(\n `string '${s}' is not an artifact ID (artifact ID format is <packageName>:<artifactName>)`,\n );\n }\n return {\n package: parts[0],\n name: parts[1],\n };\n}\n\nexport function artifactIDToString(a: artifactID): string {\n return `${a.package}:${a.name}`;\n}\n\nexport function indentText(txt: string, indent: string | number, skipFirstLine: boolean = false) {\n indent = typeof indent === \"number\" ? \" \".repeat(indent) : indent;\n\n return txt\n .split(\"\\n\")\n .map((line, index) => (index === 0 && skipFirstLine ? line : `${indent}${line}`))\n .join(\"\\n\");\n}\n\nexport const formatZodIssues = (\n issues: z.core.$ZodIssue[],\n i: string = \"\",\n p: PropertyKey[] = [],\n): string => {\n const _errors: string[] = [];\n\n const formatSubpath = (path: PropertyKey[], prefix: string = \"\") => {\n let pp = path.join(\".\");\n if (pp != \"\" && p.length > 0) pp = `.${pp}`;\n if (pp != \"\") pp = `${prefix}${pp}`;\n return pp;\n };\n\n const addItem = (item: string) => _errors.push(indentText(item, i));\n\n for (const issue of issues) {\n if (issue.code === \"invalid_union\") {\n addItem(`✖ Expected one of several possible values`);\n const path = formatSubpath(issue.path, \"\");\n addItem(` → at '${path}':`);\n for (const errGrp of issue.errors) {\n _errors.push(formatZodIssues(errGrp, `${i} `, [...p, ...issue.path]));\n }\n } else if (issue.code === \"invalid_element\" || issue.code === \"invalid_key\") {\n addItem(`✖ ${issue.code.replaceAll(\"_\", \" \")}:`);\n _errors.push(formatZodIssues(issue.issues, `${i} `, [...p, ...issue.path]));\n } else if (issue.code === \"invalid_type\") {\n const path = formatSubpath(issue.path, \" \");\n const prefix = `✖ (${issue.expected})${path}: `;\n const msg = indentText(issue.message, Math.min(prefix.length, 20), true);\n addItem(`${prefix}${msg}`);\n } else {\n const path = formatSubpath(issue.path, \" \");\n const prefix = `✖ (${issue.code.replaceAll(\"_\", \" \")})${path}: `;\n const msg = indentText(issue.message, Math.min(prefix.length, 20), true);\n addItem(`${prefix}${msg}`);\n }\n }\n\n return _errors.join(\"\\n\");\n};\n\n// User-facing CLI error. The top-level handler (bin/run.mjs) prints its\n// message without a stack trace and exits non-zero.\nexport class CLIErrorClass extends Error {\n constructor(msg: string | Error) {\n super(typeof msg === \"string\" ? msg : msg.message);\n this.name = \"CLIError\";\n }\n}\n\nexport function CLIError(msg: string | Error): CLIErrorClass {\n return new CLIErrorClass(msg);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAa,kBAAkB;AAC/B,MAAa,qBAAqB;AAElC,SAAgB,YAAY,IAAkB;CAC5C,MAAM,IAAI,MAAM,4CAA4C,KAA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ACF;AAEA,SAAgB,SAAS,KAAoC;CAC3D,OAAO,IAAI,cAAc,GAAG;AAC9B"}
package/dist/defaults.cjs CHANGED
@@ -1,5 +1,6 @@
1
1
  //#region src/defaults.ts
2
2
  var defaults_exports = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.cjs").__exportAll({
3
+ AWS_DEV_PROFILE: () => AWS_DEV_PROFILE,
3
4
  BIN_REGISTRY_DOWNLOAD_URL: () => BIN_REGISTRY_DOWNLOAD_URL,
4
5
  BIN_REGISTRY_NAME: () => BIN_REGISTRY_NAME,
5
6
  CONDA_DATA_LOCATION: () => CONDA_DATA_LOCATION,
@@ -7,17 +8,24 @@ var defaults_exports = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.cjs
7
8
  CONDA_FROZEN_ENV_SPEC_FILE: () => CONDA_FROZEN_ENV_SPEC_FILE,
8
9
  CONDA_MICROMAMBA_VERSION: () => CONDA_MICROMAMBA_VERSION,
9
10
  CONDA_SOURCE_ENV_SPEC_FILE: () => CONDA_SOURCE_ENV_SPEC_FILE,
11
+ DEV_BINARY_UPLOAD_TARGET: () => DEV_BINARY_UPLOAD_TARGET,
12
+ DEV_BIN_REGISTRY_NAME: () => DEV_BIN_REGISTRY_NAME,
13
+ DEV_BIN_REGISTRY_NAME_OVERRIDDEN: () => "dev",
14
+ DEV_DOCKER_PUSH_TARGET: () => DEV_DOCKER_PUSH_TARGET,
10
15
  DEV_DOCKER_REGISTRY: () => DEV_DOCKER_REGISTRY,
11
16
  DOCKER_BUILD_PLATFORM: () => DOCKER_BUILD_PLATFORM,
12
17
  DOCKER_DOCKERFILE: () => DOCKER_DOCKERFILE,
13
18
  DOCKER_PLACEHOLDER_PKG: () => DOCKER_PLACEHOLDER_PKG,
14
19
  DOCKER_REGISTRY: () => DOCKER_REGISTRY,
20
+ NO_SOFTWARE_PLACEHOLDER: () => NO_SOFTWARE_PLACEHOLDER,
15
21
  PYTHON_DOCKER_BASE_IMAGE: () => PYTHON_DOCKER_BASE_IMAGE,
16
22
  PYTHON_REQUIREMENTS_FILE: () => PYTHON_REQUIREMENTS_FILE,
17
23
  PYTHON_TOOLSET: () => "pip"
18
24
  });
19
25
  const BIN_REGISTRY_NAME = "platforma-open";
20
26
  const BIN_REGISTRY_DOWNLOAD_URL = "https://bin.pl-open.science/";
27
+ const DEV_BIN_REGISTRY_NAME = "midev";
28
+ const DEV_BINARY_UPLOAD_TARGET = "s3://milab-midev-registry?region=eu-central-1";
21
29
  const PYTHON_REQUIREMENTS_FILE = "requirements.txt";
22
30
  const PYTHON_DOCKER_BASE_IMAGE = "python:3.12-slim";
23
31
  const CONDA_MICROMAMBA_VERSION = "2.3.2-0";
@@ -28,9 +36,13 @@ const CONDA_DOCKER_BASE_IMAGE = "ubuntu:22.04";
28
36
  const DOCKER_REGISTRY = "containers.pl-open.science/milaboratories/pl-containers";
29
37
  const DOCKER_DOCKERFILE = "Dockerfile";
30
38
  const DOCKER_PLACEHOLDER_PKG = "/app";
31
- const DEV_DOCKER_REGISTRY = "public.ecr.aws/u5p1x5q2/pl-containers";
39
+ const NO_SOFTWARE_PLACEHOLDER = "no-software-placeholder";
40
+ const DEV_DOCKER_REGISTRY = "public.ecr.aws/miresearch/pl-containers";
41
+ const DEV_DOCKER_PUSH_TARGET = `ecr://${DEV_DOCKER_REGISTRY}`;
42
+ const AWS_DEV_PROFILE = "research-poweruser";
32
43
  const DOCKER_BUILD_PLATFORM = "linux/amd64";
33
44
  //#endregion
45
+ exports.AWS_DEV_PROFILE = AWS_DEV_PROFILE;
34
46
  exports.BIN_REGISTRY_DOWNLOAD_URL = BIN_REGISTRY_DOWNLOAD_URL;
35
47
  exports.BIN_REGISTRY_NAME = BIN_REGISTRY_NAME;
36
48
  exports.CONDA_DATA_LOCATION = CONDA_DATA_LOCATION;
@@ -38,10 +50,15 @@ exports.CONDA_DOCKER_BASE_IMAGE = CONDA_DOCKER_BASE_IMAGE;
38
50
  exports.CONDA_FROZEN_ENV_SPEC_FILE = CONDA_FROZEN_ENV_SPEC_FILE;
39
51
  exports.CONDA_MICROMAMBA_VERSION = CONDA_MICROMAMBA_VERSION;
40
52
  exports.CONDA_SOURCE_ENV_SPEC_FILE = CONDA_SOURCE_ENV_SPEC_FILE;
53
+ exports.DEV_BINARY_UPLOAD_TARGET = DEV_BINARY_UPLOAD_TARGET;
54
+ exports.DEV_BIN_REGISTRY_NAME = DEV_BIN_REGISTRY_NAME;
55
+ exports.DEV_DOCKER_PUSH_TARGET = DEV_DOCKER_PUSH_TARGET;
56
+ exports.DEV_DOCKER_REGISTRY = DEV_DOCKER_REGISTRY;
41
57
  exports.DOCKER_BUILD_PLATFORM = DOCKER_BUILD_PLATFORM;
42
58
  exports.DOCKER_DOCKERFILE = DOCKER_DOCKERFILE;
43
59
  exports.DOCKER_PLACEHOLDER_PKG = DOCKER_PLACEHOLDER_PKG;
44
60
  exports.DOCKER_REGISTRY = DOCKER_REGISTRY;
61
+ exports.NO_SOFTWARE_PLACEHOLDER = NO_SOFTWARE_PLACEHOLDER;
45
62
  exports.PYTHON_DOCKER_BASE_IMAGE = PYTHON_DOCKER_BASE_IMAGE;
46
63
  exports.PYTHON_REQUIREMENTS_FILE = PYTHON_REQUIREMENTS_FILE;
47
64
  Object.defineProperty(exports, "defaults_exports", {
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.cjs","names":[],"sources":["../src/defaults.ts"],"sourcesContent":["// This file contains default values that are part of external contract from the package-builder prospective.\n//\n// DO NOT CHANGE THEIR VALUES UNLESS YOU KNOW WHAT YOU ARE DOING,\n//\n// as these values could be used in different parts of the system (i.e. tengo code, go code of backend and so on).\n\n// Global\nexport const BIN_REGISTRY_NAME = \"platforma-open\";\nexport const BIN_REGISTRY_DOWNLOAD_URL = \"https://bin.pl-open.science/\";\n\n// Python\nexport const PYTHON_TOOLSET = \"pip\";\nexport const PYTHON_REQUIREMENTS_FILE = \"requirements.txt\";\n\nexport const PYTHON_DOCKER_BASE_IMAGE = \"python:3.12-slim\";\n\n// Conda\nexport const CONDA_MICROMAMBA_VERSION = \"2.3.2-0\";\nexport const CONDA_SOURCE_ENV_SPEC_FILE = \"conda-spec.yaml\"; // inside git repo: what env to build in CI\nexport const CONDA_FROZEN_ENV_SPEC_FILE = \"frozen-spec.yaml\"; // inside built package: how to restore env on backend side\nexport const CONDA_DATA_LOCATION = \"conda-env-data\"; // inside built package: where MICROMAMBA_ROOT_PREFIX should point on backend side\n\nexport const CONDA_DOCKER_BASE_IMAGE = \"ubuntu:22.04\";\n\n// Docker\nexport const DOCKER_REGISTRY = \"containers.pl-open.science/milaboratories/pl-containers\";\nexport const DOCKER_DOCKERFILE = \"Dockerfile\"; // inside git repo: path to Dockerfile to build by default\nexport const DOCKER_PLACEHOLDER_PKG = \"/app\"; // {pkg} placeholder value to by used in 'cmd' (for autogenerated docker images)\n\n// Block-software dev pushes (pl-pkg build --dev=local) target this ECR by default.\n// Override per-run with --docker-registry / PL_DOCKER_REGISTRY.\nexport const DEV_DOCKER_REGISTRY = \"public.ecr.aws/u5p1x5q2/pl-containers\";\n\n// All docker images are built for and pushed as linux/amd64, regardless of host arch.\n// Platforma's K8s nodes are linux/amd64; building for any other platform produces\n// a non-runnable artifact. On non-x64 hosts the build cross-compiles via the\n// Docker daemon's qemu emulation.\nexport const DOCKER_BUILD_PLATFORM = \"linux/amd64\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAOA,MAAa,oBAAoB;AACjC,MAAa,4BAA4B;AAIzC,MAAa,2BAA2B;AAExC,MAAa,2BAA2B;AAGxC,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,6BAA6B;AAC1C,MAAa,sBAAsB;AAEnC,MAAa,0BAA0B;AAGvC,MAAa,kBAAkB;AAC/B,MAAa,oBAAoB;AACjC,MAAa,yBAAyB;AAItC,MAAa,sBAAsB;AAMnC,MAAa,wBAAwB"}
1
+ {"version":3,"file":"defaults.cjs","names":[],"sources":["../src/defaults.ts"],"sourcesContent":["// This file contains default values that are part of external contract from the package-builder prospective.\n//\n// DO NOT CHANGE THEIR VALUES UNLESS YOU KNOW WHAT YOU ARE DOING,\n//\n// as these values could be used in different parts of the system (i.e. tengo code, go code of backend and so on).\n\n// Global\nexport const BIN_REGISTRY_NAME = \"platforma-open\";\nexport const BIN_REGISTRY_DOWNLOAD_URL = \"https://bin.pl-open.science/\";\n\n// Built-in dev binary registry name; flips to DEV_BIN_REGISTRY_NAME_OVERRIDDEN under PL_DEV_BINARY_UPLOAD_URL.\nexport const DEV_BIN_REGISTRY_NAME = \"midev\";\nexport const DEV_BIN_REGISTRY_NAME_OVERRIDDEN = \"dev\";\n\n// Built-in midev dev binary upload endpoint (zero-config dev push), the binary counterpart of\n// DEV_DOCKER_PUSH_TARGET. Override with PL_DEV_BINARY_UPLOAD_URL.\nexport const DEV_BINARY_UPLOAD_TARGET = \"s3://milab-midev-registry?region=eu-central-1\";\n\n// Python\nexport const PYTHON_TOOLSET = \"pip\";\nexport const PYTHON_REQUIREMENTS_FILE = \"requirements.txt\";\n\nexport const PYTHON_DOCKER_BASE_IMAGE = \"python:3.12-slim\";\n\n// Conda\nexport const CONDA_MICROMAMBA_VERSION = \"2.3.2-0\";\nexport const CONDA_SOURCE_ENV_SPEC_FILE = \"conda-spec.yaml\"; // inside git repo: what env to build in CI\nexport const CONDA_FROZEN_ENV_SPEC_FILE = \"frozen-spec.yaml\"; // inside built package: how to restore env on backend side\nexport const CONDA_DATA_LOCATION = \"conda-env-data\"; // inside built package: where MICROMAMBA_ROOT_PREFIX should point on backend side\n\nexport const CONDA_DOCKER_BASE_IMAGE = \"ubuntu:22.04\";\n\n// Docker\nexport const DOCKER_REGISTRY = \"containers.pl-open.science/milaboratories/pl-containers\";\nexport const DOCKER_DOCKERFILE = \"Dockerfile\"; // inside git repo: path to Dockerfile to build by default\nexport const DOCKER_PLACEHOLDER_PKG = \"/app\"; // {pkg} placeholder value to by used in 'cmd' (for autogenerated docker images)\n\n// Sentinel registry/package name for placeholder descriptors, so an accidental execution fails\n// with a recognizable error instead of an opaque registry 404.\nexport const NO_SOFTWARE_PLACEHOLDER = \"no-software-placeholder\";\n\n// Block-software dev pushes (pl-pkg build --dev=local) target this ECR by default.\n// Override per-run with --docker-registry / PL_DOCKER_REGISTRY.\nexport const DEV_DOCKER_REGISTRY = \"public.ecr.aws/miresearch/pl-containers\";\n\n// ecr:// scheme requests automatic docker login; the pull address stays the bare registry.\nexport const DEV_DOCKER_PUSH_TARGET = `ecr://${DEV_DOCKER_REGISTRY}`;\n\n// Fallback AWS SSO profile for dev push; override with PL_AWS_PROFILE or AWS_PROFILE.\nexport const AWS_DEV_PROFILE = \"research-poweruser\";\n\n// All docker images are built for and pushed as linux/amd64, regardless of host arch.\n// Platforma's K8s nodes are linux/amd64; building for any other platform produces\n// a non-runnable artifact. On non-x64 hosts the build cross-compiles via the\n// Docker daemon's qemu emulation.\nexport const DOCKER_BUILD_PLATFORM = \"linux/amd64\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAa,oBAAoB;AACjC,MAAa,4BAA4B;AAGzC,MAAa,wBAAwB;AAKrC,MAAa,2BAA2B;AAIxC,MAAa,2BAA2B;AAExC,MAAa,2BAA2B;AAGxC,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,6BAA6B;AAC1C,MAAa,sBAAsB;AAEnC,MAAa,0BAA0B;AAGvC,MAAa,kBAAkB;AAC/B,MAAa,oBAAoB;AACjC,MAAa,yBAAyB;AAItC,MAAa,0BAA0B;AAIvC,MAAa,sBAAsB;AAGnC,MAAa,yBAAyB,SAAS;AAG/C,MAAa,kBAAkB;AAM/B,MAAa,wBAAwB"}
@@ -1,8 +1,11 @@
1
1
  declare namespace defaults_d_exports {
2
- export { BIN_REGISTRY_DOWNLOAD_URL, BIN_REGISTRY_NAME, CONDA_DATA_LOCATION, CONDA_DOCKER_BASE_IMAGE, CONDA_FROZEN_ENV_SPEC_FILE, CONDA_MICROMAMBA_VERSION, CONDA_SOURCE_ENV_SPEC_FILE, DEV_DOCKER_REGISTRY, DOCKER_BUILD_PLATFORM, DOCKER_DOCKERFILE, DOCKER_PLACEHOLDER_PKG, DOCKER_REGISTRY, PYTHON_DOCKER_BASE_IMAGE, PYTHON_REQUIREMENTS_FILE, PYTHON_TOOLSET };
2
+ export { AWS_DEV_PROFILE, BIN_REGISTRY_DOWNLOAD_URL, BIN_REGISTRY_NAME, CONDA_DATA_LOCATION, CONDA_DOCKER_BASE_IMAGE, CONDA_FROZEN_ENV_SPEC_FILE, CONDA_MICROMAMBA_VERSION, CONDA_SOURCE_ENV_SPEC_FILE, DEV_BINARY_UPLOAD_TARGET, DEV_BIN_REGISTRY_NAME, DEV_BIN_REGISTRY_NAME_OVERRIDDEN, DEV_DOCKER_PUSH_TARGET, DEV_DOCKER_REGISTRY, DOCKER_BUILD_PLATFORM, DOCKER_DOCKERFILE, DOCKER_PLACEHOLDER_PKG, DOCKER_REGISTRY, NO_SOFTWARE_PLACEHOLDER, PYTHON_DOCKER_BASE_IMAGE, PYTHON_REQUIREMENTS_FILE, PYTHON_TOOLSET };
3
3
  }
4
4
  declare const BIN_REGISTRY_NAME = "platforma-open";
5
5
  declare const BIN_REGISTRY_DOWNLOAD_URL = "https://bin.pl-open.science/";
6
+ declare const DEV_BIN_REGISTRY_NAME = "midev";
7
+ declare const DEV_BIN_REGISTRY_NAME_OVERRIDDEN = "dev";
8
+ declare const DEV_BINARY_UPLOAD_TARGET = "s3://milab-midev-registry?region=eu-central-1";
6
9
  declare const PYTHON_TOOLSET = "pip";
7
10
  declare const PYTHON_REQUIREMENTS_FILE = "requirements.txt";
8
11
  declare const PYTHON_DOCKER_BASE_IMAGE = "python:3.12-slim";
@@ -14,8 +17,11 @@ declare const CONDA_DOCKER_BASE_IMAGE = "ubuntu:22.04";
14
17
  declare const DOCKER_REGISTRY = "containers.pl-open.science/milaboratories/pl-containers";
15
18
  declare const DOCKER_DOCKERFILE = "Dockerfile";
16
19
  declare const DOCKER_PLACEHOLDER_PKG = "/app";
17
- declare const DEV_DOCKER_REGISTRY = "public.ecr.aws/u5p1x5q2/pl-containers";
20
+ declare const NO_SOFTWARE_PLACEHOLDER = "no-software-placeholder";
21
+ declare const DEV_DOCKER_REGISTRY = "public.ecr.aws/miresearch/pl-containers";
22
+ declare const DEV_DOCKER_PUSH_TARGET = "ecr://public.ecr.aws/miresearch/pl-containers";
23
+ declare const AWS_DEV_PROFILE = "research-poweruser";
18
24
  declare const DOCKER_BUILD_PLATFORM = "linux/amd64";
19
25
  //#endregion
20
- export { defaults_d_exports };
26
+ export { AWS_DEV_PROFILE, BIN_REGISTRY_DOWNLOAD_URL, BIN_REGISTRY_NAME, CONDA_DATA_LOCATION, CONDA_DOCKER_BASE_IMAGE, CONDA_FROZEN_ENV_SPEC_FILE, CONDA_MICROMAMBA_VERSION, CONDA_SOURCE_ENV_SPEC_FILE, DEV_BINARY_UPLOAD_TARGET, DEV_BIN_REGISTRY_NAME, DEV_BIN_REGISTRY_NAME_OVERRIDDEN, DEV_DOCKER_PUSH_TARGET, DEV_DOCKER_REGISTRY, DOCKER_BUILD_PLATFORM, DOCKER_DOCKERFILE, DOCKER_PLACEHOLDER_PKG, DOCKER_REGISTRY, NO_SOFTWARE_PLACEHOLDER, PYTHON_DOCKER_BASE_IMAGE, PYTHON_REQUIREMENTS_FILE, PYTHON_TOOLSET, defaults_d_exports };
21
27
  //# sourceMappingURL=defaults.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","names":[],"sources":["../src/defaults.ts"],"mappings":";;;cAOa,iBAAA;AAAA,cACA,yBAAA;AAAA,cAGA,cAAA;AAAA,cACA,wBAAA;AAAA,cAEA,wBAAA;AAAA,cAGA,wBAAA;AAAA,cACA,0BAAA;AAAA,cACA,0BAAA;AAAA,cACA,mBAAA;AAAA,cAEA,uBAAA;AAAA,cAGA,eAAA;AAAA,cACA,iBAAA;AAAA,cACA,sBAAA;AAAA,cAIA,mBAAA;AAAA,cAMA,qBAAA"}
1
+ {"version":3,"file":"defaults.d.ts","names":[],"sources":["../src/defaults.ts"],"mappings":";;;cAOa,iBAAA;AAAA,cACA,yBAAA;AAAA,cAGA,qBAAA;AAAA,cACA,gCAAA;AAAA,cAIA,wBAAA;AAAA,cAGA,cAAA;AAAA,cACA,wBAAA;AAAA,cAEA,wBAAA;AAAA,cAGA,wBAAA;AAAA,cACA,0BAAA;AAAA,cACA,0BAAA;AAAA,cACA,mBAAA;AAAA,cAEA,uBAAA;AAAA,cAGA,eAAA;AAAA,cACA,iBAAA;AAAA,cACA,sBAAA;AAAA,cAIA,uBAAA;AAAA,cAIA,mBAAA;AAAA,cAGA,sBAAA;AAAA,cAGA,eAAA;AAAA,cAMA,qBAAA"}
package/dist/defaults.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  //#region src/defaults.ts
3
3
  var defaults_exports = /* @__PURE__ */ __exportAll({
4
+ AWS_DEV_PROFILE: () => AWS_DEV_PROFILE,
4
5
  BIN_REGISTRY_DOWNLOAD_URL: () => BIN_REGISTRY_DOWNLOAD_URL,
5
6
  BIN_REGISTRY_NAME: () => BIN_REGISTRY_NAME,
6
7
  CONDA_DATA_LOCATION: () => CONDA_DATA_LOCATION,
@@ -8,17 +9,24 @@ var defaults_exports = /* @__PURE__ */ __exportAll({
8
9
  CONDA_FROZEN_ENV_SPEC_FILE: () => CONDA_FROZEN_ENV_SPEC_FILE,
9
10
  CONDA_MICROMAMBA_VERSION: () => CONDA_MICROMAMBA_VERSION,
10
11
  CONDA_SOURCE_ENV_SPEC_FILE: () => CONDA_SOURCE_ENV_SPEC_FILE,
12
+ DEV_BINARY_UPLOAD_TARGET: () => DEV_BINARY_UPLOAD_TARGET,
13
+ DEV_BIN_REGISTRY_NAME: () => DEV_BIN_REGISTRY_NAME,
14
+ DEV_BIN_REGISTRY_NAME_OVERRIDDEN: () => "dev",
15
+ DEV_DOCKER_PUSH_TARGET: () => DEV_DOCKER_PUSH_TARGET,
11
16
  DEV_DOCKER_REGISTRY: () => DEV_DOCKER_REGISTRY,
12
17
  DOCKER_BUILD_PLATFORM: () => DOCKER_BUILD_PLATFORM,
13
18
  DOCKER_DOCKERFILE: () => DOCKER_DOCKERFILE,
14
19
  DOCKER_PLACEHOLDER_PKG: () => DOCKER_PLACEHOLDER_PKG,
15
20
  DOCKER_REGISTRY: () => DOCKER_REGISTRY,
21
+ NO_SOFTWARE_PLACEHOLDER: () => NO_SOFTWARE_PLACEHOLDER,
16
22
  PYTHON_DOCKER_BASE_IMAGE: () => PYTHON_DOCKER_BASE_IMAGE,
17
23
  PYTHON_REQUIREMENTS_FILE: () => PYTHON_REQUIREMENTS_FILE,
18
24
  PYTHON_TOOLSET: () => "pip"
19
25
  });
20
26
  const BIN_REGISTRY_NAME = "platforma-open";
21
27
  const BIN_REGISTRY_DOWNLOAD_URL = "https://bin.pl-open.science/";
28
+ const DEV_BIN_REGISTRY_NAME = "midev";
29
+ const DEV_BINARY_UPLOAD_TARGET = "s3://milab-midev-registry?region=eu-central-1";
22
30
  const PYTHON_REQUIREMENTS_FILE = "requirements.txt";
23
31
  const PYTHON_DOCKER_BASE_IMAGE = "python:3.12-slim";
24
32
  const CONDA_MICROMAMBA_VERSION = "2.3.2-0";
@@ -29,9 +37,12 @@ const CONDA_DOCKER_BASE_IMAGE = "ubuntu:22.04";
29
37
  const DOCKER_REGISTRY = "containers.pl-open.science/milaboratories/pl-containers";
30
38
  const DOCKER_DOCKERFILE = "Dockerfile";
31
39
  const DOCKER_PLACEHOLDER_PKG = "/app";
32
- const DEV_DOCKER_REGISTRY = "public.ecr.aws/u5p1x5q2/pl-containers";
40
+ const NO_SOFTWARE_PLACEHOLDER = "no-software-placeholder";
41
+ const DEV_DOCKER_REGISTRY = "public.ecr.aws/miresearch/pl-containers";
42
+ const DEV_DOCKER_PUSH_TARGET = `ecr://${DEV_DOCKER_REGISTRY}`;
43
+ const AWS_DEV_PROFILE = "research-poweruser";
33
44
  const DOCKER_BUILD_PLATFORM = "linux/amd64";
34
45
  //#endregion
35
- export { BIN_REGISTRY_DOWNLOAD_URL, BIN_REGISTRY_NAME, CONDA_DATA_LOCATION, CONDA_DOCKER_BASE_IMAGE, CONDA_FROZEN_ENV_SPEC_FILE, CONDA_MICROMAMBA_VERSION, CONDA_SOURCE_ENV_SPEC_FILE, DOCKER_BUILD_PLATFORM, DOCKER_DOCKERFILE, DOCKER_PLACEHOLDER_PKG, DOCKER_REGISTRY, PYTHON_DOCKER_BASE_IMAGE, PYTHON_REQUIREMENTS_FILE, defaults_exports };
46
+ export { AWS_DEV_PROFILE, BIN_REGISTRY_DOWNLOAD_URL, BIN_REGISTRY_NAME, CONDA_DATA_LOCATION, CONDA_DOCKER_BASE_IMAGE, CONDA_FROZEN_ENV_SPEC_FILE, CONDA_MICROMAMBA_VERSION, CONDA_SOURCE_ENV_SPEC_FILE, DEV_BINARY_UPLOAD_TARGET, DEV_BIN_REGISTRY_NAME, DEV_DOCKER_PUSH_TARGET, DEV_DOCKER_REGISTRY, DOCKER_BUILD_PLATFORM, DOCKER_DOCKERFILE, DOCKER_PLACEHOLDER_PKG, DOCKER_REGISTRY, NO_SOFTWARE_PLACEHOLDER, PYTHON_DOCKER_BASE_IMAGE, PYTHON_REQUIREMENTS_FILE, defaults_exports };
36
47
 
37
48
  //# sourceMappingURL=defaults.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","names":[],"sources":["../src/defaults.ts"],"sourcesContent":["// This file contains default values that are part of external contract from the package-builder prospective.\n//\n// DO NOT CHANGE THEIR VALUES UNLESS YOU KNOW WHAT YOU ARE DOING,\n//\n// as these values could be used in different parts of the system (i.e. tengo code, go code of backend and so on).\n\n// Global\nexport const BIN_REGISTRY_NAME = \"platforma-open\";\nexport const BIN_REGISTRY_DOWNLOAD_URL = \"https://bin.pl-open.science/\";\n\n// Python\nexport const PYTHON_TOOLSET = \"pip\";\nexport const PYTHON_REQUIREMENTS_FILE = \"requirements.txt\";\n\nexport const PYTHON_DOCKER_BASE_IMAGE = \"python:3.12-slim\";\n\n// Conda\nexport const CONDA_MICROMAMBA_VERSION = \"2.3.2-0\";\nexport const CONDA_SOURCE_ENV_SPEC_FILE = \"conda-spec.yaml\"; // inside git repo: what env to build in CI\nexport const CONDA_FROZEN_ENV_SPEC_FILE = \"frozen-spec.yaml\"; // inside built package: how to restore env on backend side\nexport const CONDA_DATA_LOCATION = \"conda-env-data\"; // inside built package: where MICROMAMBA_ROOT_PREFIX should point on backend side\n\nexport const CONDA_DOCKER_BASE_IMAGE = \"ubuntu:22.04\";\n\n// Docker\nexport const DOCKER_REGISTRY = \"containers.pl-open.science/milaboratories/pl-containers\";\nexport const DOCKER_DOCKERFILE = \"Dockerfile\"; // inside git repo: path to Dockerfile to build by default\nexport const DOCKER_PLACEHOLDER_PKG = \"/app\"; // {pkg} placeholder value to by used in 'cmd' (for autogenerated docker images)\n\n// Block-software dev pushes (pl-pkg build --dev=local) target this ECR by default.\n// Override per-run with --docker-registry / PL_DOCKER_REGISTRY.\nexport const DEV_DOCKER_REGISTRY = \"public.ecr.aws/u5p1x5q2/pl-containers\";\n\n// All docker images are built for and pushed as linux/amd64, regardless of host arch.\n// Platforma's K8s nodes are linux/amd64; building for any other platform produces\n// a non-runnable artifact. On non-x64 hosts the build cross-compiles via the\n// Docker daemon's qemu emulation.\nexport const DOCKER_BUILD_PLATFORM = \"linux/amd64\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAOA,MAAa,oBAAoB;AACjC,MAAa,4BAA4B;AAIzC,MAAa,2BAA2B;AAExC,MAAa,2BAA2B;AAGxC,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,6BAA6B;AAC1C,MAAa,sBAAsB;AAEnC,MAAa,0BAA0B;AAGvC,MAAa,kBAAkB;AAC/B,MAAa,oBAAoB;AACjC,MAAa,yBAAyB;AAItC,MAAa,sBAAsB;AAMnC,MAAa,wBAAwB"}
1
+ {"version":3,"file":"defaults.js","names":[],"sources":["../src/defaults.ts"],"sourcesContent":["// This file contains default values that are part of external contract from the package-builder prospective.\n//\n// DO NOT CHANGE THEIR VALUES UNLESS YOU KNOW WHAT YOU ARE DOING,\n//\n// as these values could be used in different parts of the system (i.e. tengo code, go code of backend and so on).\n\n// Global\nexport const BIN_REGISTRY_NAME = \"platforma-open\";\nexport const BIN_REGISTRY_DOWNLOAD_URL = \"https://bin.pl-open.science/\";\n\n// Built-in dev binary registry name; flips to DEV_BIN_REGISTRY_NAME_OVERRIDDEN under PL_DEV_BINARY_UPLOAD_URL.\nexport const DEV_BIN_REGISTRY_NAME = \"midev\";\nexport const DEV_BIN_REGISTRY_NAME_OVERRIDDEN = \"dev\";\n\n// Built-in midev dev binary upload endpoint (zero-config dev push), the binary counterpart of\n// DEV_DOCKER_PUSH_TARGET. Override with PL_DEV_BINARY_UPLOAD_URL.\nexport const DEV_BINARY_UPLOAD_TARGET = \"s3://milab-midev-registry?region=eu-central-1\";\n\n// Python\nexport const PYTHON_TOOLSET = \"pip\";\nexport const PYTHON_REQUIREMENTS_FILE = \"requirements.txt\";\n\nexport const PYTHON_DOCKER_BASE_IMAGE = \"python:3.12-slim\";\n\n// Conda\nexport const CONDA_MICROMAMBA_VERSION = \"2.3.2-0\";\nexport const CONDA_SOURCE_ENV_SPEC_FILE = \"conda-spec.yaml\"; // inside git repo: what env to build in CI\nexport const CONDA_FROZEN_ENV_SPEC_FILE = \"frozen-spec.yaml\"; // inside built package: how to restore env on backend side\nexport const CONDA_DATA_LOCATION = \"conda-env-data\"; // inside built package: where MICROMAMBA_ROOT_PREFIX should point on backend side\n\nexport const CONDA_DOCKER_BASE_IMAGE = \"ubuntu:22.04\";\n\n// Docker\nexport const DOCKER_REGISTRY = \"containers.pl-open.science/milaboratories/pl-containers\";\nexport const DOCKER_DOCKERFILE = \"Dockerfile\"; // inside git repo: path to Dockerfile to build by default\nexport const DOCKER_PLACEHOLDER_PKG = \"/app\"; // {pkg} placeholder value to by used in 'cmd' (for autogenerated docker images)\n\n// Sentinel registry/package name for placeholder descriptors, so an accidental execution fails\n// with a recognizable error instead of an opaque registry 404.\nexport const NO_SOFTWARE_PLACEHOLDER = \"no-software-placeholder\";\n\n// Block-software dev pushes (pl-pkg build --dev=local) target this ECR by default.\n// Override per-run with --docker-registry / PL_DOCKER_REGISTRY.\nexport const DEV_DOCKER_REGISTRY = \"public.ecr.aws/miresearch/pl-containers\";\n\n// ecr:// scheme requests automatic docker login; the pull address stays the bare registry.\nexport const DEV_DOCKER_PUSH_TARGET = `ecr://${DEV_DOCKER_REGISTRY}`;\n\n// Fallback AWS SSO profile for dev push; override with PL_AWS_PROFILE or AWS_PROFILE.\nexport const AWS_DEV_PROFILE = \"research-poweruser\";\n\n// All docker images are built for and pushed as linux/amd64, regardless of host arch.\n// Platforma's K8s nodes are linux/amd64; building for any other platform produces\n// a non-runnable artifact. On non-x64 hosts the build cross-compiles via the\n// Docker daemon's qemu emulation.\nexport const DOCKER_BUILD_PLATFORM = \"linux/amd64\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAa,oBAAoB;AACjC,MAAa,4BAA4B;AAGzC,MAAa,wBAAwB;AAKrC,MAAa,2BAA2B;AAIxC,MAAa,2BAA2B;AAExC,MAAa,2BAA2B;AAGxC,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,6BAA6B;AAC1C,MAAa,sBAAsB;AAEnC,MAAa,0BAA0B;AAGvC,MAAa,kBAAkB;AAC/B,MAAa,oBAAoB;AACjC,MAAa,yBAAyB;AAItC,MAAa,0BAA0B;AAIvC,MAAa,sBAAsB;AAGnC,MAAa,yBAAyB,SAAS;AAG/C,MAAa,kBAAkB;AAM/B,MAAa,wBAAwB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["Core"],"sources":["../src/index.ts"],"sourcesContent":["import type winston from \"winston\";\nimport { Core } from \"./core/core\";\n\nexport * as util from \"./core/util\";\nexport * as envs from \"./core/envs\";\nexport * as defaults from \"./defaults\";\n\n/**\n * Public surface of the build engine. Derived from `Core` so signatures never\n * drift, while the `Core` class itself stays internal (per A-0023: the engine is\n * a library, not a half-binary with an exported orchestrator class). Consumers\n * (`pl-pkg`, and later `block-tools software`) wrap this, they do not subclass it.\n */\nexport type Builder = Pick<\n Core,\n | \"buildMode\"\n | \"targetPlatform\"\n | \"allPlatforms\"\n | \"fullDirHash\"\n | \"version\"\n | \"isPrivate\"\n | \"buildDockerImages\"\n | \"buildSoftwareArchives\"\n | \"buildSwJsonFiles\"\n | \"publishPackages\"\n | \"publishDockerImages\"\n>;\n\nexport function createBuilder(logger: winston.Logger, opts?: { packageRoot?: string }): Builder {\n return new Core(logger, opts);\n}\n"],"mappings":";;;;;;AA4BA,SAAgB,cAAc,QAAwB,MAA0C;AAC9F,QAAO,IAAIA,aAAAA,KAAK,QAAQ,KAAK"}
1
+ {"version":3,"file":"index.cjs","names":["Core"],"sources":["../src/index.ts"],"sourcesContent":["import type winston from \"winston\";\nimport { Core } from \"./core/core\";\n\nexport * as util from \"./core/util\";\nexport * as envs from \"./core/envs\";\nexport * as defaults from \"./defaults\";\n\n/** The logger the engine and its callers pass around. */\nexport type Logger = winston.Logger;\n\n/**\n * Public surface of the build engine. Derived from `Core` so signatures never\n * drift, while the `Core` class itself stays internal (per A-0023: the engine is\n * a library, not a half-binary with an exported orchestrator class). Consumers\n * (`pl-pkg`, and later `block-tools software`) wrap this, they do not subclass it.\n */\nexport type Builder = Pick<\n Core,\n | \"buildMode\"\n | \"targetPlatform\"\n | \"allPlatforms\"\n | \"fullDirHash\"\n | \"version\"\n | \"isPrivate\"\n | \"buildDockerImages\"\n | \"buildSoftwareArchives\"\n | \"buildSwJsonFiles\"\n | \"writePublishedArtifactInfo\"\n | \"publishPackages\"\n | \"publishDockerImages\"\n>;\n\nexport function createBuilder(logger: winston.Logger, opts?: { packageRoot?: string }): Builder {\n return new Core(logger, opts);\n}\n"],"mappings":";;;;;;AAgCA,SAAgB,cAAc,QAAwB,MAA0C;CAC9F,OAAO,IAAIA,aAAAA,KAAK,QAAQ,IAAI;AAC9B"}
package/dist/index.d.ts CHANGED
@@ -5,16 +5,18 @@ import { defaults_d_exports } from "./defaults.js";
5
5
  import winston from "winston";
6
6
 
7
7
  //#region src/index.d.ts
8
+ /** The logger the engine and its callers pass around. */
9
+ type Logger = winston.Logger;
8
10
  /**
9
11
  * Public surface of the build engine. Derived from `Core` so signatures never
10
12
  * drift, while the `Core` class itself stays internal (per A-0023: the engine is
11
13
  * a library, not a half-binary with an exported orchestrator class). Consumers
12
14
  * (`pl-pkg`, and later `block-tools software`) wrap this, they do not subclass it.
13
15
  */
14
- type Builder = Pick<Core, "buildMode" | "targetPlatform" | "allPlatforms" | "fullDirHash" | "version" | "isPrivate" | "buildDockerImages" | "buildSoftwareArchives" | "buildSwJsonFiles" | "publishPackages" | "publishDockerImages">;
16
+ type Builder = Pick<Core, "buildMode" | "targetPlatform" | "allPlatforms" | "fullDirHash" | "version" | "isPrivate" | "buildDockerImages" | "buildSoftwareArchives" | "buildSwJsonFiles" | "writePublishedArtifactInfo" | "publishPackages" | "publishDockerImages">;
15
17
  declare function createBuilder(logger: winston.Logger, opts?: {
16
18
  packageRoot?: string;
17
19
  }): Builder;
18
20
  //#endregion
19
- export { Builder, createBuilder, defaults_d_exports as defaults, envs_d_exports as envs, util_d_exports as util };
21
+ export { Builder, Logger, createBuilder, defaults_d_exports as defaults, envs_d_exports as envs, util_d_exports as util };
20
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;AAaA;;;;KAAY,OAAA,GAAU,IAAA,CACpB,IAAA;AAAA,iBAcc,aAAA,CAAc,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAAQ,IAAA;EAAS,WAAA;AAAA,IAAyB,OAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;KAQY,MAAA,GAAS,OAAA,CAAQ,MAAM;AAAnC;;;;AAAmC;AAQnC;AARA,KAQY,OAAA,GAAU,IAAI,CACxB,IAAA;AAAA,iBAec,aAAA,CAAc,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAAQ,IAAA;EAAS,WAAA;AAAA,IAAyB,OAAO"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type winston from \"winston\";\nimport { Core } from \"./core/core\";\n\nexport * as util from \"./core/util\";\nexport * as envs from \"./core/envs\";\nexport * as defaults from \"./defaults\";\n\n/**\n * Public surface of the build engine. Derived from `Core` so signatures never\n * drift, while the `Core` class itself stays internal (per A-0023: the engine is\n * a library, not a half-binary with an exported orchestrator class). Consumers\n * (`pl-pkg`, and later `block-tools software`) wrap this, they do not subclass it.\n */\nexport type Builder = Pick<\n Core,\n | \"buildMode\"\n | \"targetPlatform\"\n | \"allPlatforms\"\n | \"fullDirHash\"\n | \"version\"\n | \"isPrivate\"\n | \"buildDockerImages\"\n | \"buildSoftwareArchives\"\n | \"buildSwJsonFiles\"\n | \"publishPackages\"\n | \"publishDockerImages\"\n>;\n\nexport function createBuilder(logger: winston.Logger, opts?: { packageRoot?: string }): Builder {\n return new Core(logger, opts);\n}\n"],"mappings":";;;;;AA4BA,SAAgB,cAAc,QAAwB,MAA0C;AAC9F,QAAO,IAAI,KAAK,QAAQ,KAAK"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type winston from \"winston\";\nimport { Core } from \"./core/core\";\n\nexport * as util from \"./core/util\";\nexport * as envs from \"./core/envs\";\nexport * as defaults from \"./defaults\";\n\n/** The logger the engine and its callers pass around. */\nexport type Logger = winston.Logger;\n\n/**\n * Public surface of the build engine. Derived from `Core` so signatures never\n * drift, while the `Core` class itself stays internal (per A-0023: the engine is\n * a library, not a half-binary with an exported orchestrator class). Consumers\n * (`pl-pkg`, and later `block-tools software`) wrap this, they do not subclass it.\n */\nexport type Builder = Pick<\n Core,\n | \"buildMode\"\n | \"targetPlatform\"\n | \"allPlatforms\"\n | \"fullDirHash\"\n | \"version\"\n | \"isPrivate\"\n | \"buildDockerImages\"\n | \"buildSoftwareArchives\"\n | \"buildSwJsonFiles\"\n | \"writePublishedArtifactInfo\"\n | \"publishPackages\"\n | \"publishDockerImages\"\n>;\n\nexport function createBuilder(logger: winston.Logger, opts?: { packageRoot?: string }): Builder {\n return new Core(logger, opts);\n}\n"],"mappings":";;;;;AAgCA,SAAgB,cAAc,QAAwB,MAA0C;CAC9F,OAAO,IAAI,KAAK,QAAQ,IAAI;AAC9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/package-builder-lib",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "MiLaboratories Platforma Package builder engine (library)",
5
5
  "keywords": [],
6
6
  "license": "UNLICENSED",
@@ -38,9 +38,9 @@
38
38
  "typescript": "~5.9.3",
39
39
  "vite": "^8.0.6",
40
40
  "vitest": "^4.1.3",
41
- "@milaboratories/ts-builder": "1.5.2",
42
41
  "@milaboratories/build-configs": "2.0.0",
43
- "@milaboratories/ts-configs": "1.2.3"
42
+ "@milaboratories/ts-builder": "1.6.0",
43
+ "@milaboratories/ts-configs": "1.3.0"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "ts-builder build --target node",
@@ -0,0 +1,17 @@
1
+ import { Core } from "./core";
2
+ import { PackageInfo } from "./package-info";
3
+ import * as testArtifacts from "./schemas/test-artifacts";
4
+ import { createLogger } from "./util";
5
+ import { test, expect } from "vitest";
6
+
7
+ // Docker software is linux/amd64 only. An explicit non-x64 target must fail clearly, before any
8
+ // `docker build` runs, rather than silently producing an amd64 image.
9
+ test("buildDockerImages rejects a non-x64 target platform", () => {
10
+ const logger = createLogger("error");
11
+ const pkgInfo = new PackageInfo(logger, { pkgJsonData: testArtifacts.PackageJson });
12
+ const core = new Core(logger, { pkgInfo });
13
+
14
+ core.targetPlatform = "linux-aarch64";
15
+
16
+ expect(() => core.buildDockerImages()).toThrow(/docker.*linux\/amd64 only/);
17
+ });
package/src/core/core.ts CHANGED
@@ -23,7 +23,6 @@ export class Core {
23
23
  private _renderer: SwJsonRenderer | undefined;
24
24
 
25
25
  public readonly pkgInfo: PackageInfo;
26
- public buildMode: util.BuildMode;
27
26
  public targetPlatform: util.PlatformType | undefined;
28
27
  public allPlatforms: boolean = false;
29
28
  public fullDirHash: boolean;
@@ -38,11 +37,17 @@ export class Core {
38
37
  this.logger = logger;
39
38
  this.pkgInfo = opts?.pkgInfo ?? new PackageInfo(logger, { packageRoot: opts?.packageRoot });
40
39
 
41
- this.buildMode = "release";
42
-
43
40
  this.fullDirHash = false;
44
41
  }
45
42
 
43
+ public get buildMode(): util.BuildMode {
44
+ return this.pkgInfo.buildMode;
45
+ }
46
+
47
+ public set buildMode(mode: util.BuildMode) {
48
+ this.pkgInfo.buildMode = mode;
49
+ }
50
+
46
51
  public set version(v: string | undefined) {
47
52
  this.pkgInfo.version = v;
48
53
  }
@@ -200,6 +205,7 @@ export class Core {
200
205
  entrypoints?: string[];
201
206
  sources?: util.SoftwareSource[];
202
207
  requireAllArtifacts?: boolean;
208
+ noSoftware?: boolean;
203
209
  }) {
204
210
  const index = this.packageEntrypointsIndex;
205
211
 
@@ -222,10 +228,12 @@ export class Core {
222
228
  entrypoints = entrypoints.filter(([epName, _]) => entrypointNames.includes(epName));
223
229
  }
224
230
 
225
- const infos = this.renderer.renderSoftwareEntrypoints(this.buildMode, new Map(entrypoints), {
226
- requireAllArtifacts: options?.requireAllArtifacts,
227
- fullDirHash: this.fullDirHash,
228
- });
231
+ const infos = options?.noSoftware
232
+ ? this.renderer.renderPlaceholderEntrypoints(new Map(entrypoints))
233
+ : this.renderer.renderSoftwareEntrypoints(this.buildMode, new Map(entrypoints), {
234
+ requireAllArtifacts: options?.requireAllArtifacts,
235
+ fullDirHash: this.fullDirHash,
236
+ });
229
237
 
230
238
  for (const swJson of infos.values()) {
231
239
  this.renderer.writeSwJson(swJson);
@@ -239,6 +247,29 @@ export class Core {
239
247
  }
240
248
  }
241
249
 
250
+ // Point artifact-info at the already-published, version-derived artifact without building or
251
+ // uploading, so buildSwJsonFiles renders a registry descriptor for it. Release mode, binary only.
252
+ public writePublishedArtifactInfo(options?: { ids?: string[] }) {
253
+ const platform = util.currentPlatform();
254
+ for (const [id, artifact] of this.buildablePackages) {
255
+ if (options?.ids && !options.ids.includes(id)) continue;
256
+
257
+ // Cross-platform archives are stored under a platform-agnostic key; this is the key
258
+ // renderBinaryInfo reads back from.
259
+ const locationKey = artifacts.isCrossPlatform(artifact.type) ? undefined : platform;
260
+ const registry = this.pkgInfo.artifactRegistrySettings(artifact);
261
+
262
+ writeBuiltArtifactInfo(this.pkgInfo.artifactInfoLocation(id, "archive", locationKey), {
263
+ type: artifact.type,
264
+ platform,
265
+ registryURL: registry.downloadURL,
266
+ registryName: registry.name,
267
+ remoteArtifactLocation: this.pkgInfo.artifactArchiveAddressPattern(artifact),
268
+ uploadPath: this.pkgInfo.artifactArchiveFullName(artifact, platform),
269
+ });
270
+ }
271
+ }
272
+
242
273
  public async buildSoftwareArchives(options?: {
243
274
  ids?: string[];
244
275
  forceBuild?: boolean;
@@ -344,7 +375,7 @@ export class Core {
344
375
  }
345
376
  }
346
377
 
347
- if (util.isDevLocalMode(this.buildMode)) {
378
+ if (!util.producesRegistryDescriptor(this.buildMode)) {
348
379
  this.logger.info(
349
380
  ` no need to build software archive in '${this.buildMode}' mode: archive build was skipped`,
350
381
  );
@@ -391,6 +422,15 @@ export class Core {
391
422
  }
392
423
  }
393
424
 
425
+ // Docker software is built as linux/amd64 only (Platforma's K8s target). An explicit
426
+ // non-x64 target cannot be honored — fail clearly instead of silently emitting amd64.
427
+ if (this.targetPlatform && util.splitPlatform(this.targetPlatform).arch !== "x64") {
428
+ throw util.CLIError(
429
+ `cannot build docker image '${artifact.id}' for target '${this.targetPlatform}': ` +
430
+ `docker software is built as ${defaults.DOCKER_BUILD_PLATFORM} only`,
431
+ );
432
+ }
433
+
394
434
  this.buildDockerImage(artifact.id, artifact, options?.registry);
395
435
  }
396
436
  }
package/src/core/envs.ts CHANGED
@@ -15,6 +15,14 @@ export const PL_CONDA_NO_BUILD = "PL_CONDA_NO_BUILD";
15
15
  export const PL_DOCKER_REGISTRY = "PL_DOCKER_REGISTRY";
16
16
  export const PL_DOCKER_REGISTRY_PUSH_TO = "PL_DOCKER_REGISTRY_PUSH_TO";
17
17
 
18
+ export const PL_DEV_BINARY_UPLOAD_URL = "PL_DEV_BINARY_UPLOAD_URL";
19
+ export const PL_RELEASE_BINARY_UPLOAD_URL = "PL_RELEASE_BINARY_UPLOAD_URL";
20
+
21
+ export const PL_DEV_DOCKER_PUSH_URL = "PL_DEV_DOCKER_PUSH_URL";
22
+ export const PL_DEV_DOCKER_PULL_URL = "PL_DEV_DOCKER_PULL_URL";
23
+ export const PL_RELEASE_DOCKER_PUSH_URL = "PL_RELEASE_DOCKER_PUSH_URL";
24
+ export const PL_RELEASE_DOCKER_PULL_URL = "PL_RELEASE_DOCKER_PULL_URL";
25
+
18
26
  export const PL_DOCKER_BUILD = "PL_DOCKER_BUILD";
19
27
  export const PL_DOCKER_NO_BUILD = "PL_DOCKER_NO_BUILD";
20
28
  export const PL_DOCKER_AUTOPUSH = "PL_DOCKER_AUTOPUSH";