@platforma-sdk/block-tools 2.16.17 → 2.17.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.
- package/dist/cli.js +13 -13
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +849 -875
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-Dx45aFJ_.mjs → config-C07cYptA.mjs} +606 -591
- package/dist/config-C07cYptA.mjs.map +1 -0
- package/dist/config-on5N57rI.js +3 -0
- package/dist/config-on5N57rI.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -5
- package/dist/index.mjs.map +1 -1
- package/dist/structure/engine/api.d.ts +1 -1
- package/dist/structure/engine/content-rules.d.ts +12 -0
- package/dist/structure/rules/root-pnpm-workspace.d.ts +1 -1
- package/dist/structure/rules/shared/key-order.d.ts +1 -1
- package/dist/structure/rules/shared/toolchain.d.ts +18 -0
- package/package.json +25 -25
- package/src/structure/__tests__/root-catalog-bump.test.ts +1 -1
- package/src/structure/__tests__/root-ci-workflows.test.ts +4 -3
- package/src/structure/__tests__/toolchain.test.ts +156 -0
- package/src/structure/engine/__tests__/content-rules/ensure-catalog-at-least.test.ts +28 -0
- package/src/structure/engine/api.ts +4 -0
- package/src/structure/engine/content-rules.ts +60 -0
- package/src/structure/rules/root-ci.ts +3 -0
- package/src/structure/rules/root-package-json.ts +17 -2
- package/src/structure/rules/root-pnpm-workspace.ts +23 -5
- package/src/structure/rules/shared/key-order.ts +2 -1
- package/src/structure/rules/shared/toolchain.ts +35 -0
- package/src/structure/templates/text/workflows/build.tpl.yaml +1 -1
- package/src/structure/templates/text/workflows/mark-stable.tpl.yaml +1 -1
- package/dist/config-CtXMWNgm.js +0 -3
- package/dist/config-CtXMWNgm.js.map +0 -1
- package/dist/config-Dx45aFJ_.mjs.map +0 -1
- package/src/structure/templates/static/root/.gitignore +0 -13
package/dist/cli.mjs
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import { Ct as e,
|
|
1
|
+
import { Ct as e, G as t, It as n, M as r, Nt as i, Qt as a, X as o, Y as s, Zt as c, _ as l, _t as u, n as d, p as f, q as ee, w as p, wt as te, yt as ne } from "./config-C07cYptA.mjs";
|
|
2
2
|
import { Command as m, Option as h } from "commander";
|
|
3
3
|
import g from "node:path";
|
|
4
4
|
import _ from "node:fs";
|
|
5
|
-
import { BlockPackManifest as
|
|
6
|
-
import { assertDockerPushIntent as
|
|
5
|
+
import { BlockPackManifest as re, StableChannel as ie, overrideDescriptionVersion as ae, overrideManifestVersion as oe } from "@milaboratories/pl-model-middle-layer";
|
|
6
|
+
import { assertDockerPushIntent as se, createBuilder as ce, defaults as le, envs as v, util as y } from "@platforma-sdk/package-builder-lib";
|
|
7
7
|
import { ConsoleLoggerAdapter as b } from "@milaboratories/ts-helpers";
|
|
8
|
-
import
|
|
9
|
-
import { setTimeout as
|
|
10
|
-
import * as
|
|
11
|
-
import { confirm as
|
|
12
|
-
import { spawnSync as
|
|
13
|
-
import { ECRPUBLICClient as
|
|
14
|
-
|
|
15
|
-
function
|
|
8
|
+
import ue, { isMap as de, isSeq as fe, parse as pe, parseDocument as me, stringify as he } from "yaml";
|
|
9
|
+
import { setTimeout as ge } from "node:timers/promises";
|
|
10
|
+
import * as _e from "node:os";
|
|
11
|
+
import { confirm as ve, input as ye, select as be } from "@inquirer/prompts";
|
|
12
|
+
import { spawnSync as xe } from "node:child_process";
|
|
13
|
+
import { ECRPUBLICClient as Se, GetAuthorizationTokenCommand as Ce } from "@aws-sdk/client-ecr-public";
|
|
14
|
+
// src/cmd/build-meta.ts
|
|
15
|
+
function we() {
|
|
16
16
|
let e = new m("build-meta").description("Extracts meta information from blocks package.json and outputs meta.json with embedded binary and textual information linked from the meta section.");
|
|
17
17
|
return e.option("-i, --modulePath <path>", "input module path", "."), e.requiredOption("-o, --destination <path>", "output meta.json file"), e.action(async (e) => {
|
|
18
|
-
let
|
|
19
|
-
await _.promises.writeFile(g.resolve(e.destination), JSON.stringify(
|
|
18
|
+
let t = g.resolve(e.modulePath), r = await ne(t), a = await i(await n(r.meta, t));
|
|
19
|
+
await _.promises.writeFile(g.resolve(e.destination), JSON.stringify(a));
|
|
20
20
|
}), e;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
async function xe(e) {
|
|
22
|
+
// src/cmd/build-model.ts
|
|
23
|
+
async function Te(e) {
|
|
25
24
|
try {
|
|
26
25
|
return await _.promises.readFile(e, "utf8");
|
|
27
26
|
} catch (e) {
|
|
@@ -29,88 +28,87 @@ async function xe(e) {
|
|
|
29
28
|
throw e;
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
function
|
|
31
|
+
function Ee() {
|
|
33
32
|
let e = new m("build-model").description("Extracts and outputs block model JSON from pre-built block model module");
|
|
34
33
|
return e.option("-i, --modulePath <path>", "input module path", "."), e.option("-b, --sourceBundle <path>", "bundled model code to embed into the model for callback-based rendering to work", "./dist/bundle.js"), e.option("-o, --destination <path>", "output model file", "./dist/model.json"), e.action(async (e) => {
|
|
35
|
-
let { model:
|
|
36
|
-
if (
|
|
37
|
-
let { config:
|
|
38
|
-
if (!
|
|
39
|
-
if (!("outputs" in
|
|
40
|
-
let
|
|
41
|
-
|
|
34
|
+
let t = g.resolve(e.modulePath), { model: n, platforma: r } = c(t);
|
|
35
|
+
if (n ||= r, !n) throw Error("\"model\" export not found");
|
|
36
|
+
let { config: i } = n;
|
|
37
|
+
if (!i) throw Error("Malformed \"model\" object, check it is created with \"BlockModel\" and \".done()\" is executed as the call in the chain.");
|
|
38
|
+
if (!("outputs" in i) || !("sections" in i)) throw Error("\"config\" has unexpected structure");
|
|
39
|
+
let a = await Te(e.sourceBundle);
|
|
40
|
+
a !== void 0 && (i.code = {
|
|
42
41
|
type: "plain",
|
|
43
|
-
content:
|
|
44
|
-
}), await _.promises.writeFile(g.resolve(e.destination), JSON.stringify(
|
|
42
|
+
content: a
|
|
43
|
+
}), await _.promises.writeFile(g.resolve(e.destination), JSON.stringify(i));
|
|
45
44
|
}), e;
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
dst: e.dst
|
|
46
|
+
// src/cmd/build-kind-manifest.ts
|
|
47
|
+
function De() {
|
|
48
|
+
let t = new m("build-kind-manifest").description("Writes the block-kind dist manifest (identity + src source-hash) from a pre-built kind bundle");
|
|
49
|
+
return t.option("-i, --modulePath <path>", "kind package dir (contains package.json, src/, dist/)", "."), t.option("-s, --srcDir <path>", "source dir hashed into sourceHash, relative to modulePath", "src"), t.option("-o, --dst <path>", "output dir with the compiled bundle, relative to modulePath", "dist"), t.action(async (t) => {
|
|
50
|
+
await e({
|
|
51
|
+
modulePath: t.modulePath,
|
|
52
|
+
srcDir: t.srcDir,
|
|
53
|
+
dst: t.dst
|
|
56
54
|
});
|
|
57
|
-
}), e;
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region src/cmd/pack.ts
|
|
61
|
-
function we() {
|
|
62
|
-
let t = new m("pack").description("Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder");
|
|
63
|
-
return t.option("-i, --modulePath <path>", "input module path", "."), t.option("-o, --destinationPath <path>", "output folder", "./block-pack"), t.action(async (t) => {
|
|
64
|
-
await e(await u(g.resolve(t.modulePath)), g.resolve(t.destinationPath));
|
|
65
55
|
}), t;
|
|
66
56
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
// src/cmd/pack.ts
|
|
58
|
+
function Oe() {
|
|
59
|
+
let e = new m("pack").description("Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder");
|
|
60
|
+
return e.option("-i, --modulePath <path>", "input module path", "."), e.option("-o, --destinationPath <path>", "output folder", "./block-pack"), e.action(async (e) => {
|
|
61
|
+
let t = await u(g.resolve(e.modulePath));
|
|
62
|
+
await te(t, g.resolve(e.destinationPath));
|
|
63
|
+
}), e;
|
|
64
|
+
}
|
|
65
|
+
// src/cmd/publish.ts
|
|
66
|
+
function ke(e, t) {
|
|
70
67
|
let n = { ...e };
|
|
71
|
-
for (let e in t) t[e] && typeof t[e] == "object" && !Array.isArray(t[e]) && n[e] && typeof n[e] == "object" && !Array.isArray(n[e]) ?
|
|
68
|
+
for (let e in t) n[e] = t[e] && typeof t[e] == "object" && !Array.isArray(t[e]) && n[e] && typeof n[e] == "object" && !Array.isArray(n[e]) ? ke(n[e], t[e]) : t[e];
|
|
72
69
|
return n;
|
|
73
70
|
}
|
|
74
|
-
function
|
|
71
|
+
function Ae() {
|
|
75
72
|
let e = new m("publish").description("Publishes the block package and refreshes the registry (for v2 block-pack schema)");
|
|
76
|
-
return e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new h("--registry-serve-url <url>", "CDN serve URL written into block-pack/published.json (npm-consumed blocks)").env("PL_REGISTRY_SERVE_URL").makeOptionMandatory()), e.option("-m, --manifest <path>", "manifest file path", `./block-pack/${
|
|
77
|
-
let t = new b(),
|
|
78
|
-
|
|
79
|
-
let
|
|
80
|
-
t.info(`Manifest root = ${
|
|
81
|
-
let
|
|
82
|
-
await
|
|
73
|
+
return e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new h("--registry-serve-url <url>", "CDN serve URL written into block-pack/published.json (npm-consumed blocks)").env("PL_REGISTRY_SERVE_URL").makeOptionMandatory()), e.option("-m, --manifest <path>", "manifest file path", `./block-pack/${r}`), e.option("-v, --version-override <path>", "override package version"), e.addOption(new h("--refresh", "refresh repository after adding the package").default(!0).env("PL_REGISTRY_REFRESH")), e.option("--no-refresh", "do not refresh repository after adding the package"), e.addOption(new h("--unstable", "do not add the published package to stable channel").default(!1).env("PL_PUBLISH_UNSTABLE")), e.action(async (e) => {
|
|
74
|
+
let t = new b(), n = g.resolve(e.manifest), r = JSON.parse(await _.promises.readFile(n, { encoding: "utf-8" })), i = re.parse(r);
|
|
75
|
+
i = ke(r, i);
|
|
76
|
+
let a = g.dirname(n), c = g.dirname(a);
|
|
77
|
+
t.info(`Manifest root = ${a}`), t.info(`Facade root = ${c}`), e.versionOverride && (i = oe(i, e.versionOverride));
|
|
78
|
+
let u = l(e.registry), d = new p(u, t);
|
|
79
|
+
await o(d, i, c, async (e) => Buffer.from(await _.promises.readFile(g.resolve(a, e)))), e.unstable || (t.info(`Adding package to ${ie} channel...`), await d.addPackageToChannel(i.description.id, ie));
|
|
80
|
+
let f = ee({
|
|
83
81
|
registryUrl: e.registryServeUrl,
|
|
84
|
-
id:
|
|
85
|
-
})
|
|
82
|
+
id: i.description.id
|
|
83
|
+
});
|
|
84
|
+
await s(a, f), t.info(`Wrote published coordinates to ${g.resolve(a, "published.json")}`), e.refresh && await d.updateIfNeeded();
|
|
86
85
|
}), e;
|
|
87
86
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
function De() {
|
|
87
|
+
// src/cmd/refresh-registry.ts
|
|
88
|
+
function je() {
|
|
91
89
|
let e = new m("refresh-registry").description("Refresh overview files based on published but not proecessed artefacts");
|
|
92
90
|
return e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new h("-m, --mode <mode>", "refresh mode (allowed valiues: \"force\", \"normal\", \"dry-run\")").choices([
|
|
93
91
|
"force",
|
|
94
92
|
"normal",
|
|
95
93
|
"dry-run"
|
|
96
94
|
]).env("PL_REGISTRY_REFRESH_DRY_RUN").default("normal")), e.action(async (e) => {
|
|
97
|
-
|
|
95
|
+
let t = l(e.registry);
|
|
96
|
+
await new p(t, new b()).updateIfNeeded(e.mode);
|
|
98
97
|
}), e;
|
|
99
98
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
function Oe() {
|
|
99
|
+
// src/cmd/mark-stable.ts
|
|
100
|
+
function Me() {
|
|
103
101
|
let e = new m("mark-stable").description("Mark target block stable");
|
|
104
|
-
return e.option("-i, --modulePath <path>", "input module path", "."), e.addOption(new h("-c, --channel <channel name>", "custom channel").default(
|
|
105
|
-
let t = await
|
|
106
|
-
e.versionOverride && (t =
|
|
107
|
-
let n =
|
|
108
|
-
e.unmark ? await
|
|
102
|
+
return e.option("-i, --modulePath <path>", "input module path", "."), e.addOption(new h("-c, --channel <channel name>", "custom channel").default(ie).hideHelp()), e.option("-v, --version-override <path>", "override package version"), e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new h("--refresh", "refresh repository after adding the package").default(!0).env("PL_REGISTRY_REFRESH")), e.option("--no-refresh", "do not refresh repository after adding the package"), e.option("--unmark", "reverses meaning of this command, flag can be used to remove \"stable\" flag from the package", !1), e.action(async (e) => {
|
|
103
|
+
let t = await ne(g.resolve(e.modulePath));
|
|
104
|
+
e.versionOverride && (t = ae(t, e.versionOverride));
|
|
105
|
+
let n = l(e.registry), r = new p(n, new b());
|
|
106
|
+
e.unmark ? await r.removePackageFromChannel(t.id, e.channel) : await r.addPackageToChannel(t.id, e.channel), e.refresh && await r.updateIfNeeded();
|
|
109
107
|
}), e;
|
|
110
108
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
// src/structure/engine/fs/node.ts
|
|
110
|
+
var Ne = class {
|
|
111
|
+
root;
|
|
114
112
|
constructor(e) {
|
|
115
113
|
this.root = e;
|
|
116
114
|
}
|
|
@@ -174,7 +172,8 @@ var ke = class {
|
|
|
174
172
|
force: !0
|
|
175
173
|
});
|
|
176
174
|
}
|
|
177
|
-
},
|
|
175
|
+
}, Pe = class {
|
|
176
|
+
root;
|
|
178
177
|
constructor(e) {
|
|
179
178
|
this.root = e;
|
|
180
179
|
}
|
|
@@ -188,64 +187,54 @@ var ke = class {
|
|
|
188
187
|
return _.readFileSync(g.resolve(this.root, "text", e), "utf-8");
|
|
189
188
|
}
|
|
190
189
|
};
|
|
191
|
-
function
|
|
190
|
+
function Fe(e, t) {
|
|
192
191
|
return e.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (e, n) => t[n] ?? `\${${n}}`);
|
|
193
192
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
function Ne(e, t) {
|
|
193
|
+
// src/structure/engine/flatten.ts
|
|
194
|
+
var Ie = ["default", "init"];
|
|
195
|
+
function Le(e, t) {
|
|
198
196
|
if (!e) return t;
|
|
199
197
|
if (!t) return e;
|
|
200
198
|
let n = e.endsWith("/") ? e.slice(0, -1) : e, r = t.startsWith("/") ? t.slice(1) : t;
|
|
201
199
|
return r ? `${n}/${r}` : n;
|
|
202
200
|
}
|
|
203
|
-
function
|
|
201
|
+
function Re(e, t) {
|
|
204
202
|
return e.filter((e) => e.scope === t).slice().sort((e, t) => e.path.localeCompare(t.path));
|
|
205
203
|
}
|
|
206
|
-
function
|
|
204
|
+
function ze(e, t) {
|
|
207
205
|
let n = [];
|
|
208
206
|
function r(e, i, a, o, s) {
|
|
209
207
|
if (e.kind === "scope") {
|
|
210
|
-
let n =
|
|
208
|
+
let n = Re(t.modules, e.scope);
|
|
211
209
|
for (let t of n) for (let n of e.children) r(n, e.scope, t.path, o, s);
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
if (e.kind === "when") {
|
|
210
|
+
} else if (e.kind === "when") {
|
|
215
211
|
let t = o.concat(e.trigger);
|
|
216
212
|
for (let n of e.children) r(n, i, a, t, s);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${Le(e)}' is not inside a scope() frame`);
|
|
224
|
-
if (e.kind === "rename") {
|
|
225
|
-
n.push({
|
|
213
|
+
} else if (e.kind === "mode") for (let t of e.children) r(t, i, a, o, e.modes);
|
|
214
|
+
else {
|
|
215
|
+
if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${Ve(e)}' is not inside a scope() frame`);
|
|
216
|
+
e.kind === "rename" ? n.push({
|
|
226
217
|
leaf: e,
|
|
227
218
|
scope: i,
|
|
228
219
|
modulePath: a,
|
|
229
|
-
resolvedPath:
|
|
230
|
-
resolvedTo:
|
|
220
|
+
resolvedPath: Le(a, e.from),
|
|
221
|
+
resolvedTo: Le(a, e.to),
|
|
222
|
+
triggers: o,
|
|
223
|
+
modes: s
|
|
224
|
+
}) : n.push({
|
|
225
|
+
leaf: e,
|
|
226
|
+
scope: i,
|
|
227
|
+
modulePath: a,
|
|
228
|
+
resolvedPath: Le(a, Be(e)),
|
|
231
229
|
triggers: o,
|
|
232
230
|
modes: s
|
|
233
231
|
});
|
|
234
|
-
return;
|
|
235
232
|
}
|
|
236
|
-
n.push({
|
|
237
|
-
leaf: e,
|
|
238
|
-
scope: i,
|
|
239
|
-
modulePath: a,
|
|
240
|
-
resolvedPath: Ne(a, Ie(e)),
|
|
241
|
-
triggers: o,
|
|
242
|
-
modes: s
|
|
243
|
-
});
|
|
244
233
|
}
|
|
245
|
-
for (let t of e.children) r(t, void 0, void 0, [],
|
|
234
|
+
for (let t of e.children) r(t, void 0, void 0, [], Ie);
|
|
246
235
|
return n;
|
|
247
236
|
}
|
|
248
|
-
function
|
|
237
|
+
function Be(e) {
|
|
249
238
|
switch (e.kind) {
|
|
250
239
|
case "fixed":
|
|
251
240
|
case "managed":
|
|
@@ -255,47 +244,45 @@ function Ie(e) {
|
|
|
255
244
|
case "rename": return e.from;
|
|
256
245
|
}
|
|
257
246
|
}
|
|
258
|
-
function
|
|
247
|
+
function Ve(e) {
|
|
259
248
|
return e.kind === "rename" ? `rename ${e.from} -> ${e.to}` : `${e.kind} ${e.path}`;
|
|
260
249
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
function ze(e) {
|
|
250
|
+
// src/structure/engine/glob.ts
|
|
251
|
+
var He = /[.+^${}()|[\]\\]/g;
|
|
252
|
+
function Ue(e) {
|
|
265
253
|
let t = "";
|
|
266
254
|
for (let n = 0; n < e.length; n++) {
|
|
267
255
|
let r = e[n];
|
|
268
|
-
r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : r === "?" ?
|
|
256
|
+
r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : t += r === "?" ? "[^/]" : r.replace(He, "\\$&");
|
|
269
257
|
}
|
|
270
258
|
return RegExp(`^${t}$`);
|
|
271
259
|
}
|
|
272
|
-
function
|
|
273
|
-
return
|
|
260
|
+
function We(e, t) {
|
|
261
|
+
return Ue(e).test(t);
|
|
274
262
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
function He(e) {
|
|
263
|
+
// src/structure/engine/builders.ts
|
|
264
|
+
var x, Ge;
|
|
265
|
+
function Ke(e) {
|
|
279
266
|
if (!x) throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);
|
|
280
267
|
return x;
|
|
281
268
|
}
|
|
282
|
-
function
|
|
283
|
-
let n =
|
|
269
|
+
function qe(e, t) {
|
|
270
|
+
let n = Ke(e);
|
|
284
271
|
n.stack[n.stack.length - 1].push(t);
|
|
285
272
|
}
|
|
286
|
-
function
|
|
287
|
-
let n =
|
|
288
|
-
|
|
273
|
+
function Je(e, t) {
|
|
274
|
+
let n = Ge;
|
|
275
|
+
Ge = e;
|
|
289
276
|
try {
|
|
290
277
|
return t();
|
|
291
278
|
} finally {
|
|
292
|
-
|
|
279
|
+
Ge = n;
|
|
293
280
|
}
|
|
294
281
|
}
|
|
295
|
-
function
|
|
296
|
-
return
|
|
282
|
+
function Ye() {
|
|
283
|
+
return Ge;
|
|
297
284
|
}
|
|
298
|
-
function
|
|
285
|
+
function Xe(e) {
|
|
299
286
|
if (x) throw Error("defineStructure() cannot be called from inside another defineStructure().");
|
|
300
287
|
let t = [], n = {
|
|
301
288
|
root: t,
|
|
@@ -306,12 +293,12 @@ function Ge(e) {
|
|
|
306
293
|
try {
|
|
307
294
|
if (e(), n.stack.length !== 1) throw Error(`defineStructure: builder body left ${n.stack.length - 1} unclosed group frame(s)`);
|
|
308
295
|
let r = { children: t };
|
|
309
|
-
return
|
|
296
|
+
return Ze(r), r;
|
|
310
297
|
} finally {
|
|
311
298
|
x = void 0;
|
|
312
299
|
}
|
|
313
300
|
}
|
|
314
|
-
function
|
|
301
|
+
function Ze(e) {
|
|
315
302
|
let t = /* @__PURE__ */ new Map();
|
|
316
303
|
function n(e, r) {
|
|
317
304
|
if (e.kind === "scope") {
|
|
@@ -334,8 +321,8 @@ function Ke(e) {
|
|
|
334
321
|
throw Error(`defineStructure validation: path '${t}' under scope '${e}' is declared as both seed and ${n}. Seeds are block-author territory (written once at init, untouched thereafter); engine-managed primitives (fixed/managed/scaffold) rewrite on every refresh. The two contracts cannot coexist on the same path.`);
|
|
335
322
|
}
|
|
336
323
|
}
|
|
337
|
-
function
|
|
338
|
-
let n =
|
|
324
|
+
function S(e, t) {
|
|
325
|
+
let n = Ke("scope");
|
|
339
326
|
if (n.inScope) throw Error("scope() cannot nest. Already inside a scope.");
|
|
340
327
|
let r = {
|
|
341
328
|
kind: "scope",
|
|
@@ -349,21 +336,18 @@ function C(e, t) {
|
|
|
349
336
|
n.stack.pop(), n.inScope = !1;
|
|
350
337
|
}
|
|
351
338
|
}
|
|
352
|
-
var
|
|
353
|
-
function
|
|
354
|
-
|
|
339
|
+
var Qe;
|
|
340
|
+
function $e(e) {
|
|
341
|
+
Qe = e;
|
|
355
342
|
}
|
|
356
|
-
function
|
|
357
|
-
|
|
343
|
+
function C(e, t, n) {
|
|
344
|
+
et(e, t), n && et((t) => !e(t), n);
|
|
358
345
|
}
|
|
359
|
-
function
|
|
360
|
-
if (x)
|
|
361
|
-
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
if (!(qe?.(e, t) ?? !1)) throw Error("when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.");
|
|
346
|
+
function et(e, t) {
|
|
347
|
+
if (x) tt(e, t);
|
|
348
|
+
else if (!(Qe?.(e, t) ?? !1)) throw Error("when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.");
|
|
365
349
|
}
|
|
366
|
-
function
|
|
350
|
+
function tt(e, t) {
|
|
367
351
|
let n = x, r = {
|
|
368
352
|
kind: "when",
|
|
369
353
|
trigger: e,
|
|
@@ -376,11 +360,11 @@ function Xe(e, t) {
|
|
|
376
360
|
n.stack.pop();
|
|
377
361
|
}
|
|
378
362
|
}
|
|
379
|
-
function
|
|
363
|
+
function w(e) {
|
|
380
364
|
return (t) => t.filesMatch(e);
|
|
381
365
|
}
|
|
382
|
-
function
|
|
383
|
-
let r =
|
|
366
|
+
function nt(e, t, n) {
|
|
367
|
+
let r = Ke(e), i = {
|
|
384
368
|
kind: "mode",
|
|
385
369
|
modes: t,
|
|
386
370
|
children: []
|
|
@@ -392,140 +376,140 @@ function Ze(e, t, n) {
|
|
|
392
376
|
r.stack.pop();
|
|
393
377
|
}
|
|
394
378
|
}
|
|
395
|
-
function
|
|
396
|
-
|
|
379
|
+
function rt(e) {
|
|
380
|
+
nt("onInitOrUpdate", ["init", "updateDeps"], e);
|
|
397
381
|
}
|
|
398
|
-
function
|
|
399
|
-
|
|
382
|
+
function T(e, t) {
|
|
383
|
+
qe("fixed", {
|
|
400
384
|
kind: "fixed",
|
|
401
385
|
path: e,
|
|
402
386
|
content: t
|
|
403
387
|
});
|
|
404
388
|
}
|
|
405
|
-
function
|
|
406
|
-
|
|
389
|
+
function E(e, t, n) {
|
|
390
|
+
qe("managed", {
|
|
407
391
|
kind: "managed",
|
|
408
392
|
path: e,
|
|
409
393
|
initial: t,
|
|
410
394
|
body: n
|
|
411
395
|
});
|
|
412
396
|
}
|
|
413
|
-
function
|
|
414
|
-
|
|
397
|
+
function D(e, t) {
|
|
398
|
+
qe("scaffold", {
|
|
415
399
|
kind: "scaffold",
|
|
416
400
|
path: e,
|
|
417
401
|
initial: t
|
|
418
402
|
});
|
|
419
403
|
}
|
|
420
|
-
function
|
|
421
|
-
|
|
404
|
+
function O(e, t) {
|
|
405
|
+
qe("seed", {
|
|
422
406
|
kind: "seed",
|
|
423
407
|
path: e,
|
|
424
408
|
initial: t
|
|
425
409
|
});
|
|
426
410
|
}
|
|
427
|
-
function
|
|
428
|
-
|
|
411
|
+
function k(e) {
|
|
412
|
+
qe("remove", {
|
|
429
413
|
kind: "remove",
|
|
430
414
|
path: e
|
|
431
415
|
});
|
|
432
416
|
}
|
|
433
|
-
function
|
|
417
|
+
function A(e) {
|
|
434
418
|
return {
|
|
435
419
|
kind: "file",
|
|
436
420
|
path: e
|
|
437
421
|
};
|
|
438
422
|
}
|
|
439
|
-
function
|
|
423
|
+
function it(e) {
|
|
440
424
|
return {
|
|
441
425
|
kind: "binary",
|
|
442
426
|
path: e
|
|
443
427
|
};
|
|
444
428
|
}
|
|
445
|
-
function
|
|
429
|
+
function at(e) {
|
|
446
430
|
return {
|
|
447
431
|
kind: "text",
|
|
448
432
|
value: e
|
|
449
433
|
};
|
|
450
434
|
}
|
|
451
|
-
function
|
|
435
|
+
function j(e, t) {
|
|
452
436
|
return {
|
|
453
437
|
kind: "tpl",
|
|
454
438
|
path: e,
|
|
455
439
|
vars: t
|
|
456
440
|
};
|
|
457
441
|
}
|
|
458
|
-
function
|
|
442
|
+
function M(e) {
|
|
459
443
|
return {
|
|
460
444
|
kind: "generate",
|
|
461
445
|
fn: e
|
|
462
446
|
};
|
|
463
447
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
function
|
|
448
|
+
// src/structure/engine/parsers/json.ts
|
|
449
|
+
var ot = /* @__PURE__ */ a(t());
|
|
450
|
+
function st(e) {
|
|
467
451
|
return JSON.parse(e);
|
|
468
452
|
}
|
|
469
|
-
var
|
|
470
|
-
function
|
|
471
|
-
return e.length === 0 ? "[]" : "[" + e.map(
|
|
453
|
+
var ct = 100, lt = 2;
|
|
454
|
+
function ut(e) {
|
|
455
|
+
return e.length === 0 ? "[]" : "[" + e.map(dt).join(", ") + "]";
|
|
472
456
|
}
|
|
473
|
-
function
|
|
474
|
-
if (Array.isArray(e)) return
|
|
475
|
-
if (
|
|
457
|
+
function dt(e) {
|
|
458
|
+
if (Array.isArray(e)) return ut(e);
|
|
459
|
+
if (N(e)) {
|
|
476
460
|
let t = Object.entries(e);
|
|
477
|
-
return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${
|
|
461
|
+
return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${dt(t)}`).join(", ") + " }";
|
|
478
462
|
}
|
|
479
463
|
return JSON.stringify(e);
|
|
480
464
|
}
|
|
481
|
-
function
|
|
482
|
-
let i = t +
|
|
465
|
+
function ft(e, t, n, r) {
|
|
466
|
+
let i = t + lt, a = " ".repeat(i);
|
|
483
467
|
if (Array.isArray(e)) {
|
|
484
|
-
let o =
|
|
485
|
-
if (n + o.length + r <=
|
|
468
|
+
let o = ut(e);
|
|
469
|
+
if (n + o.length + r <= ct) return o;
|
|
486
470
|
let s = e.length - 1;
|
|
487
|
-
return "[\n" + e.map((e, t) => a +
|
|
471
|
+
return "[\n" + e.map((e, t) => a + ft(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
|
|
488
472
|
}
|
|
489
|
-
if (
|
|
473
|
+
if (N(e)) {
|
|
490
474
|
let n = Object.entries(e);
|
|
491
475
|
if (n.length === 0) return "{}";
|
|
492
476
|
let r = n.length - 1;
|
|
493
477
|
return "{\n" + n.map(([e, t], n) => {
|
|
494
478
|
let o = `${a}${JSON.stringify(e)}: `;
|
|
495
|
-
return o +
|
|
479
|
+
return o + ft(t, i, o.length, n === r ? 0 : 1);
|
|
496
480
|
}).join(",\n") + "\n" + " ".repeat(t) + "}";
|
|
497
481
|
}
|
|
498
482
|
return JSON.stringify(e);
|
|
499
483
|
}
|
|
500
|
-
function
|
|
501
|
-
return t?.collapse ?
|
|
484
|
+
function pt(e, t) {
|
|
485
|
+
return t?.collapse ? ft(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
|
|
502
486
|
}
|
|
503
|
-
function
|
|
487
|
+
function mt(e) {
|
|
504
488
|
return e === "" || e === void 0 ? [] : e.split(".");
|
|
505
489
|
}
|
|
506
|
-
function
|
|
490
|
+
function N(e) {
|
|
507
491
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
508
492
|
}
|
|
509
|
-
function
|
|
510
|
-
let n =
|
|
493
|
+
function ht(e, t) {
|
|
494
|
+
let n = mt(t), r = e;
|
|
511
495
|
for (let e of n) {
|
|
512
|
-
if (!
|
|
496
|
+
if (!N(r)) return;
|
|
513
497
|
r = r[e];
|
|
514
498
|
}
|
|
515
499
|
return r;
|
|
516
500
|
}
|
|
517
|
-
function
|
|
518
|
-
let n =
|
|
501
|
+
function gt(e, t) {
|
|
502
|
+
let n = mt(t);
|
|
519
503
|
if (n.length === 0) return !0;
|
|
520
504
|
let r = e;
|
|
521
505
|
for (let e = 0; e < n.length - 1; e++) {
|
|
522
|
-
if (!
|
|
506
|
+
if (!N(r)) return !1;
|
|
523
507
|
r = r[n[e]];
|
|
524
508
|
}
|
|
525
|
-
return
|
|
509
|
+
return N(r) ? n[n.length - 1] in r : !1;
|
|
526
510
|
}
|
|
527
|
-
function
|
|
528
|
-
let r =
|
|
511
|
+
function _t(e, t, n) {
|
|
512
|
+
let r = mt(t);
|
|
529
513
|
if (r.length === 0) throw Error("setAtPath: jsonPath must be non-empty");
|
|
530
514
|
let i = e;
|
|
531
515
|
for (let e = 0; e < r.length - 1; e++) {
|
|
@@ -533,22 +517,22 @@ function dt(e, t, n) {
|
|
|
533
517
|
if (n === void 0) {
|
|
534
518
|
let e = {};
|
|
535
519
|
i[t] = e, i = e;
|
|
536
|
-
} else if (
|
|
520
|
+
} else if (N(n)) i = n;
|
|
537
521
|
else throw Error(`setAtPath: cannot descend into non-object at '${r.slice(0, e + 1).join(".")}'`);
|
|
538
522
|
}
|
|
539
523
|
i[r[r.length - 1]] = n;
|
|
540
524
|
}
|
|
541
|
-
function
|
|
542
|
-
let n =
|
|
525
|
+
function vt(e, t) {
|
|
526
|
+
let n = mt(t);
|
|
543
527
|
if (n.length === 0) throw Error("deleteAtPath: jsonPath must be non-empty");
|
|
544
528
|
let r = e;
|
|
545
529
|
for (let e = 0; e < n.length - 1; e++) {
|
|
546
|
-
if (!
|
|
530
|
+
if (!N(r)) return;
|
|
547
531
|
r = r[n[e]];
|
|
548
532
|
}
|
|
549
|
-
|
|
533
|
+
N(r) && delete r[n[n.length - 1]];
|
|
550
534
|
}
|
|
551
|
-
function
|
|
535
|
+
function yt(e, t) {
|
|
552
536
|
let n = new Set(t), r = Object.keys(e), i = /* @__PURE__ */ new Map();
|
|
553
537
|
i.set("", []);
|
|
554
538
|
let a = "";
|
|
@@ -561,74 +545,72 @@ function pt(e, t) {
|
|
|
561
545
|
}
|
|
562
546
|
return o;
|
|
563
547
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
function mt(e) {
|
|
548
|
+
// src/structure/engine/parsers/lines.ts
|
|
549
|
+
function bt(e) {
|
|
567
550
|
let t = e.split("\n");
|
|
568
551
|
return t.length > 0 && t[t.length - 1] === "" && t.pop(), t;
|
|
569
552
|
}
|
|
570
|
-
function
|
|
553
|
+
function xt(e) {
|
|
571
554
|
return e.join("\n") + "\n";
|
|
572
555
|
}
|
|
573
|
-
function
|
|
556
|
+
function St(e) {
|
|
574
557
|
return e.replace(/(^|\s)#.*$/, "$1").trim();
|
|
575
558
|
}
|
|
576
|
-
function
|
|
577
|
-
let n =
|
|
578
|
-
return n
|
|
559
|
+
function Ct(e, t) {
|
|
560
|
+
let n = St(e);
|
|
561
|
+
return n !== "" && n === t.trim();
|
|
579
562
|
}
|
|
580
|
-
function
|
|
581
|
-
for (let n of e) if (
|
|
563
|
+
function wt(e, t) {
|
|
564
|
+
for (let n of e) if (Ct(n, t)) return !0;
|
|
582
565
|
return !1;
|
|
583
566
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
function yt(e, t) {
|
|
567
|
+
// src/structure/engine/content-rules.ts
|
|
568
|
+
function Tt(e, t) {
|
|
587
569
|
return e === "sdk:" ? t ? "workspace:*" : "catalog:" : e;
|
|
588
570
|
}
|
|
589
|
-
var
|
|
571
|
+
var Et = [
|
|
590
572
|
"dependencies",
|
|
591
573
|
"devDependencies",
|
|
592
574
|
"peerDependencies",
|
|
593
575
|
"optionalDependencies"
|
|
594
576
|
];
|
|
595
|
-
function
|
|
596
|
-
if (L(e)) for (let n of
|
|
577
|
+
function Dt(e, t) {
|
|
578
|
+
if (L(e)) for (let n of Et) {
|
|
597
579
|
let r = e[n];
|
|
598
580
|
if (L(r)) for (let e of Object.keys(r)) r[e] === "sdk:" && (r[e] = t ? "workspace:*" : "catalog:");
|
|
599
581
|
}
|
|
600
582
|
}
|
|
601
|
-
var
|
|
602
|
-
function
|
|
603
|
-
if (!
|
|
604
|
-
return
|
|
583
|
+
var P;
|
|
584
|
+
function Ot(e) {
|
|
585
|
+
if (!P) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
|
|
586
|
+
return P;
|
|
605
587
|
}
|
|
606
|
-
function
|
|
607
|
-
let t =
|
|
588
|
+
function F(e) {
|
|
589
|
+
let t = Ot(e);
|
|
608
590
|
if (t.kind !== "json") throw Error(`${e}() requires a JSON-managed body; got '${t.kind}'.`);
|
|
609
591
|
return t;
|
|
610
592
|
}
|
|
611
|
-
function
|
|
612
|
-
let t =
|
|
593
|
+
function I(e) {
|
|
594
|
+
let t = Ot(e);
|
|
613
595
|
if (t.kind !== "yaml") throw Error(`${e}() requires a YAML-managed body; got '${t.kind}'.`);
|
|
614
596
|
return t;
|
|
615
597
|
}
|
|
616
|
-
function
|
|
617
|
-
let t =
|
|
598
|
+
function kt(e) {
|
|
599
|
+
let t = Ot(e);
|
|
618
600
|
if (t.kind !== "lines") throw Error(`${e}() requires a lines-managed body; got '${t.kind}'.`);
|
|
619
601
|
return t;
|
|
620
602
|
}
|
|
621
|
-
function
|
|
622
|
-
let n = e.ctx ??
|
|
603
|
+
function At(e, t) {
|
|
604
|
+
let n = e.ctx ?? Ye();
|
|
623
605
|
if (!n) throw Error(`${t}() needs a RunContext but none is active. Pass { ctx } via the with-managed-* helper or run inside engine.run(...).`);
|
|
624
606
|
return n;
|
|
625
607
|
}
|
|
626
608
|
function L(e) {
|
|
627
609
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
628
610
|
}
|
|
629
|
-
function
|
|
630
|
-
if (
|
|
631
|
-
|
|
611
|
+
function jt(e, t, n = {}) {
|
|
612
|
+
if (P) throw Error("Nested managed(...) body — engine bug.");
|
|
613
|
+
P = {
|
|
632
614
|
kind: "json",
|
|
633
615
|
obj: e,
|
|
634
616
|
ctx: n.ctx,
|
|
@@ -637,12 +619,12 @@ function Et(e, t, n = {}) {
|
|
|
637
619
|
try {
|
|
638
620
|
return t(n.ctx ?? n.triggerContext?.ctx), e;
|
|
639
621
|
} finally {
|
|
640
|
-
|
|
622
|
+
P = void 0;
|
|
641
623
|
}
|
|
642
624
|
}
|
|
643
|
-
function
|
|
644
|
-
if (
|
|
645
|
-
|
|
625
|
+
function Mt(e, t, n = {}) {
|
|
626
|
+
if (P) throw Error("Nested managed(...) body — engine bug.");
|
|
627
|
+
P = {
|
|
646
628
|
kind: "yaml",
|
|
647
629
|
doc: e,
|
|
648
630
|
ctx: n.ctx,
|
|
@@ -653,12 +635,12 @@ function Dt(e, t, n = {}) {
|
|
|
653
635
|
try {
|
|
654
636
|
return t(n.ctx ?? n.triggerContext?.ctx), e;
|
|
655
637
|
} finally {
|
|
656
|
-
|
|
638
|
+
P = void 0;
|
|
657
639
|
}
|
|
658
640
|
}
|
|
659
|
-
function
|
|
660
|
-
if (
|
|
661
|
-
|
|
641
|
+
function Nt(e, t, n = {}) {
|
|
642
|
+
if (P) throw Error("Nested managed(...) body — engine bug.");
|
|
643
|
+
P = {
|
|
662
644
|
kind: "lines",
|
|
663
645
|
lines: e,
|
|
664
646
|
ctx: n.ctx,
|
|
@@ -667,46 +649,49 @@ function Ot(e, t, n = {}) {
|
|
|
667
649
|
try {
|
|
668
650
|
return t(n.ctx ?? n.triggerContext?.ctx), e;
|
|
669
651
|
} finally {
|
|
670
|
-
|
|
652
|
+
P = void 0;
|
|
671
653
|
}
|
|
672
654
|
}
|
|
673
|
-
|
|
674
|
-
if (!
|
|
675
|
-
let n =
|
|
655
|
+
$e((e, t) => {
|
|
656
|
+
if (!P) return !1;
|
|
657
|
+
let n = P.triggerContext;
|
|
676
658
|
if (!n) throw Error("when() inside a managed(...) body requires a triggerContext. The runner supplies it via the `triggerContext` opt to with-managed-*; ensure your test/test helper passes one.");
|
|
677
659
|
return e(n) && t(), !0;
|
|
678
660
|
});
|
|
679
661
|
function R(e, t) {
|
|
680
|
-
|
|
662
|
+
_t(F("ensureField").obj, e, t);
|
|
681
663
|
}
|
|
682
|
-
function
|
|
683
|
-
let n =
|
|
684
|
-
|
|
664
|
+
function z(e, t) {
|
|
665
|
+
let n = F("removeField").obj;
|
|
666
|
+
gt(n, e) && (!t || t(ht(n, e))) && vt(n, e);
|
|
685
667
|
}
|
|
686
|
-
function
|
|
687
|
-
let n =
|
|
688
|
-
if (!
|
|
668
|
+
function Pt(e, t) {
|
|
669
|
+
let n = F("requireField").obj;
|
|
670
|
+
if (!gt(n, e)) throw Error(t ?? `requireField: missing field '${e}'`);
|
|
671
|
+
}
|
|
672
|
+
function Ft(e, t) {
|
|
673
|
+
if (gt(F("forbidField").obj, e)) throw Error(t);
|
|
689
674
|
}
|
|
690
|
-
function
|
|
691
|
-
let n =
|
|
675
|
+
function It(e, t) {
|
|
676
|
+
let n = F("ensureFieldEntries").obj, r = gt(n, e) ? ht(n, e) : void 0, i = L(r) ? r : {};
|
|
692
677
|
for (let [e, n] of Object.entries(t)) i[e] = n;
|
|
693
|
-
L(r) ||
|
|
678
|
+
L(r) || _t(n, e, i);
|
|
694
679
|
}
|
|
695
|
-
function
|
|
680
|
+
function B(e, t) {
|
|
696
681
|
R(`scripts.${e}`, t);
|
|
697
682
|
}
|
|
698
|
-
function
|
|
699
|
-
|
|
683
|
+
function V(e) {
|
|
684
|
+
z(`scripts.${e}`);
|
|
700
685
|
}
|
|
701
|
-
var
|
|
686
|
+
var Lt = [
|
|
702
687
|
"dependencies",
|
|
703
688
|
"devDependencies",
|
|
704
689
|
"peerDependencies",
|
|
705
690
|
"optionalDependencies"
|
|
706
691
|
];
|
|
707
|
-
function
|
|
708
|
-
let i =
|
|
709
|
-
for (let e of
|
|
692
|
+
function Rt(e, t, n, r) {
|
|
693
|
+
let i = F(e), a = i.obj, o = n === "sdk:" ? Tt(n, At(i, e).isSdkInternal) : n;
|
|
694
|
+
for (let e of Lt) {
|
|
710
695
|
if (e === r) continue;
|
|
711
696
|
let n = a[e];
|
|
712
697
|
L(n) && t in n && delete n[t];
|
|
@@ -714,140 +699,158 @@ function Nt(e, t, n, r) {
|
|
|
714
699
|
let s = a[r], c = L(s) ? s : {};
|
|
715
700
|
c[t] = o, L(s) || (a[r] = c);
|
|
716
701
|
}
|
|
717
|
-
function
|
|
718
|
-
|
|
702
|
+
function zt(e, t) {
|
|
703
|
+
Rt("ensureDep", e, t, "dependencies");
|
|
719
704
|
}
|
|
720
|
-
function
|
|
721
|
-
|
|
705
|
+
function H(e, t) {
|
|
706
|
+
Rt("ensureDevDep", e, t, "devDependencies");
|
|
722
707
|
}
|
|
723
|
-
function
|
|
724
|
-
|
|
708
|
+
function Bt(e, t) {
|
|
709
|
+
Rt("ensurePeerDep", e, t, "peerDependencies");
|
|
725
710
|
}
|
|
726
|
-
function
|
|
727
|
-
let t =
|
|
728
|
-
for (let n of
|
|
711
|
+
function U(e) {
|
|
712
|
+
let t = F("removeDep").obj;
|
|
713
|
+
for (let n of Lt) {
|
|
729
714
|
let r = t[n];
|
|
730
715
|
L(r) && e in r && delete r[e];
|
|
731
716
|
}
|
|
732
717
|
}
|
|
733
|
-
function
|
|
734
|
-
for (let [t, n] of Object.entries(e))
|
|
718
|
+
function W(e) {
|
|
719
|
+
for (let [t, n] of Object.entries(e)) H(t, n);
|
|
735
720
|
}
|
|
736
|
-
function
|
|
737
|
-
for (let [t, n] of Object.entries(e))
|
|
721
|
+
function Vt(e) {
|
|
722
|
+
for (let [t, n] of Object.entries(e)) Bt(t, n);
|
|
738
723
|
}
|
|
739
|
-
function
|
|
740
|
-
let r =
|
|
741
|
-
for (let i of r.modules) i.scope === t &&
|
|
724
|
+
function Ht(e, t, n) {
|
|
725
|
+
let r = At(F(e), e);
|
|
726
|
+
for (let i of r.modules) i.scope === t && Rt(e, i.name, "workspace:*", n);
|
|
742
727
|
}
|
|
743
|
-
function
|
|
744
|
-
|
|
728
|
+
function Ut(e) {
|
|
729
|
+
Ht("ensureWorkspaceScopeDeps", e, "dependencies");
|
|
745
730
|
}
|
|
746
|
-
function
|
|
747
|
-
|
|
731
|
+
function Wt(e) {
|
|
732
|
+
Ht("ensureWorkspaceScopeDevDeps", e, "devDependencies");
|
|
748
733
|
}
|
|
749
|
-
function
|
|
750
|
-
let t =
|
|
734
|
+
function Gt(e) {
|
|
735
|
+
let t = F("pruneKeysMatching").obj;
|
|
751
736
|
for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
|
|
752
737
|
}
|
|
753
|
-
function
|
|
754
|
-
let n =
|
|
738
|
+
function Kt(e, t) {
|
|
739
|
+
let n = yt(e, t);
|
|
755
740
|
for (let t of Object.keys(e)) delete e[t];
|
|
756
741
|
for (let t of Object.keys(n)) e[t] = n[t];
|
|
757
742
|
}
|
|
758
|
-
function
|
|
759
|
-
|
|
743
|
+
function G(e) {
|
|
744
|
+
Kt(F("enforceFieldOrder").obj, e);
|
|
760
745
|
}
|
|
761
|
-
function
|
|
746
|
+
function qt(e, t) {
|
|
762
747
|
let n = Object.keys(e).sort(), r = {};
|
|
763
748
|
for (let t of n) r[t] = e[t];
|
|
764
749
|
for (let t of Object.keys(e)) delete e[t];
|
|
765
|
-
for (let i of n) e[i] = r[i], t && L(e[i]) &&
|
|
750
|
+
for (let i of n) e[i] = r[i], t && L(e[i]) && qt(e[i], !0);
|
|
766
751
|
}
|
|
767
|
-
function
|
|
752
|
+
function K(e = "", t = {}) {
|
|
768
753
|
let n = t.recursive ?? !1;
|
|
769
754
|
if (e === "" && !n) return;
|
|
770
|
-
let r =
|
|
755
|
+
let r = F("enforceAlphabeticalOrder").obj;
|
|
771
756
|
if (e === "") {
|
|
772
|
-
|
|
757
|
+
qt(r, !0);
|
|
773
758
|
return;
|
|
774
759
|
}
|
|
775
|
-
let i =
|
|
776
|
-
L(i) &&
|
|
760
|
+
let i = ht(r, e);
|
|
761
|
+
L(i) && qt(i, n);
|
|
777
762
|
}
|
|
778
|
-
function
|
|
779
|
-
let n =
|
|
780
|
-
|
|
763
|
+
function Jt(e, t) {
|
|
764
|
+
let n = F("transformAt").obj;
|
|
765
|
+
_t(n, e, t(ht(n, e)));
|
|
781
766
|
}
|
|
782
|
-
function
|
|
783
|
-
let e =
|
|
767
|
+
function Yt() {
|
|
768
|
+
let e = I("ensureWorkspaceModulePaths"), t = At(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
|
|
784
769
|
Array.isArray(n) && n.length === t.length && n.every((e, n) => e === t[n]) || e.doc.setIn(["packages"], t);
|
|
785
770
|
}
|
|
786
|
-
function
|
|
771
|
+
function Xt(e, t) {
|
|
787
772
|
let n = e.doc.getIn(["catalog", t]);
|
|
788
773
|
return typeof n == "string" ? n : void 0;
|
|
789
774
|
}
|
|
790
|
-
function
|
|
791
|
-
let n =
|
|
792
|
-
|
|
775
|
+
function Zt(e, t) {
|
|
776
|
+
let n = I("ensureCatalogVersion");
|
|
777
|
+
Xt(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
|
|
793
778
|
}
|
|
794
|
-
function
|
|
795
|
-
let t =
|
|
779
|
+
function Qt(e) {
|
|
780
|
+
let t = I("ensureCatalogLatest");
|
|
796
781
|
if (!t.getLatestVersion) return;
|
|
797
782
|
let n = t.getLatestVersion(e);
|
|
798
|
-
n !== void 0 &&
|
|
783
|
+
n !== void 0 && Xt(t, e) !== n && t.doc.setIn(["catalog", e], n);
|
|
799
784
|
}
|
|
800
|
-
function
|
|
801
|
-
let n =
|
|
785
|
+
function $t(e, t) {
|
|
786
|
+
let n = I("pinCatalogToDependencyOf");
|
|
802
787
|
if (!n.getDerivedDependencyPin) return;
|
|
803
788
|
let r = n.getDerivedDependencyPin(e);
|
|
804
|
-
r !== void 0 &&
|
|
789
|
+
r !== void 0 && Xt(n, e) !== r && n.doc.setIn(["catalog", e], r);
|
|
790
|
+
}
|
|
791
|
+
function en(e, t) {
|
|
792
|
+
let n = I("ensureCatalogAtLeast"), r = Xt(n, e), i = (0, ot.minVersion)(t), a = r !== void 0 && (0, ot.validRange)(r) !== null ? (0, ot.minVersion)(r) : null;
|
|
793
|
+
(r === void 0 || i !== null && a !== null && !(0, ot.gte)(a, i)) && n.doc.setIn(["catalog", e], t);
|
|
805
794
|
}
|
|
806
|
-
function
|
|
807
|
-
let t =
|
|
795
|
+
function tn(e) {
|
|
796
|
+
let t = I("ensureCatalogAbsent");
|
|
808
797
|
t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
|
|
809
798
|
}
|
|
810
|
-
function
|
|
811
|
-
let
|
|
812
|
-
|
|
799
|
+
function nn(e, t, { keepExisting: n = !1 } = {}) {
|
|
800
|
+
let r = I("ensureWorkspaceMapEntries");
|
|
801
|
+
de(r.doc.get(e)) || r.doc.delete(e);
|
|
802
|
+
let i = Object.entries(t).filter(([t, i]) => n ? !r.doc.hasIn([e, t]) : r.doc.getIn([e, t]) !== i);
|
|
803
|
+
for (let [t, n] of i) r.doc.setIn([e, t], n);
|
|
804
|
+
}
|
|
805
|
+
function rn(e, t) {
|
|
806
|
+
let n = I("ensureWorkspaceListItems"), r = n.doc.toJSON()?.[e], i = new Set(Array.isArray(r) ? r : []), a = t.filter((e) => !i.has(e));
|
|
807
|
+
if (a.length !== 0) {
|
|
808
|
+
if (!fe(n.doc.get(e))) n.doc.set(e, a);
|
|
809
|
+
else for (let t of a) n.doc.addIn([e], t);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
function an(e) {
|
|
813
|
+
let t = kt("ensureGitignoreEntries");
|
|
814
|
+
for (let n of e) wt(t.lines, n) || t.lines.push(n);
|
|
813
815
|
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
return ue(e);
|
|
816
|
+
// src/structure/engine/parsers/yaml.ts
|
|
817
|
+
function on(e) {
|
|
818
|
+
return me(e);
|
|
818
819
|
}
|
|
819
|
-
function
|
|
820
|
+
function sn(e) {
|
|
820
821
|
return e.toString();
|
|
821
822
|
}
|
|
822
|
-
var
|
|
823
|
-
function
|
|
823
|
+
var cn = ".structure";
|
|
824
|
+
function ln(e) {
|
|
824
825
|
if (!e.exists(".structure")) return { version: 0 };
|
|
825
826
|
try {
|
|
826
|
-
let t = JSON.parse(e.read(
|
|
827
|
+
let t = JSON.parse(e.read(cn));
|
|
827
828
|
return { version: typeof t?.version == "number" ? t.version : 0 };
|
|
828
829
|
} catch {
|
|
829
830
|
return { version: 0 };
|
|
830
831
|
}
|
|
831
832
|
}
|
|
832
|
-
function
|
|
833
|
-
if (e < t) throw new
|
|
833
|
+
function un(e, t = 0) {
|
|
834
|
+
if (e < t) throw new dn(e, t);
|
|
834
835
|
}
|
|
835
|
-
var
|
|
836
|
+
var dn = class extends Error {
|
|
837
|
+
version;
|
|
838
|
+
floor;
|
|
836
839
|
constructor(e, t) {
|
|
837
840
|
super(`Block .structure version is ${e}, below floor ${t}. Bootstrap via the legacy-migration skill, then re-run.`), this.version = e, this.floor = t, this.name = "StructureVersionFloorError";
|
|
838
841
|
}
|
|
839
842
|
};
|
|
840
|
-
function
|
|
841
|
-
e.write(
|
|
843
|
+
function fn(e, t) {
|
|
844
|
+
e.write(cn, JSON.stringify(t));
|
|
842
845
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
+
// src/structure/engine/runner.ts
|
|
847
|
+
var pn = class extends Error {
|
|
848
|
+
failing;
|
|
846
849
|
constructor(e) {
|
|
847
850
|
super(`Post-run recheck: rule set not idempotent. Failing item: ${e.primitive} '${e.path}' (scope=${e.scope}, action=${e.action}). Engine bug.`), this.failing = e, this.name = "RecheckError";
|
|
848
851
|
}
|
|
849
852
|
};
|
|
850
|
-
function
|
|
853
|
+
function mn(e, t, n, r) {
|
|
851
854
|
switch (e.kind) {
|
|
852
855
|
case "text": return e.value;
|
|
853
856
|
case "file":
|
|
@@ -855,47 +858,45 @@ function on(e, t, n, r) {
|
|
|
855
858
|
return n.staticRead(e.path);
|
|
856
859
|
case "tpl":
|
|
857
860
|
if (!n) throw Error(`tpl('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
|
|
858
|
-
return
|
|
861
|
+
return Fe(n.textRead(e.path), typeof e.vars == "function" ? e.vars(r) : e.vars);
|
|
859
862
|
case "generate": {
|
|
860
863
|
let n = e.fn(r);
|
|
861
|
-
if (t.endsWith(".json")) return
|
|
862
|
-
if (t.endsWith(".yaml") || t.endsWith(".yml")) return
|
|
864
|
+
if (t.endsWith(".json")) return Dt(n, r.isSdkInternal), pt(n, { collapse: !t.endsWith("package.json") });
|
|
865
|
+
if (t.endsWith(".yaml") || t.endsWith(".yml")) return he(n);
|
|
863
866
|
if (typeof n != "string") throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);
|
|
864
867
|
return n;
|
|
865
868
|
}
|
|
866
869
|
case "binary": throw Error(`binary('${e.path}') cannot be resolved to a string; it is only valid inside seed()/scaffold(), which copy it verbatim via fs.writeBinary.`);
|
|
867
870
|
}
|
|
868
871
|
}
|
|
869
|
-
function
|
|
872
|
+
function hn(e, t, n, r, i) {
|
|
870
873
|
if (n.kind === "binary") {
|
|
871
874
|
if (!r) throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
|
|
872
875
|
e.writeBinary(t, r.staticReadBinary(n.path));
|
|
873
|
-
|
|
874
|
-
}
|
|
875
|
-
e.write(t, on(n, t, r, i));
|
|
876
|
+
} else e.write(t, mn(n, t, r, i));
|
|
876
877
|
}
|
|
877
|
-
function
|
|
878
|
+
function gn(e, t, n, r, i, a) {
|
|
878
879
|
let o = e.split("/").pop() ?? e;
|
|
879
880
|
if (e.endsWith(".json")) {
|
|
880
|
-
let i =
|
|
881
|
+
let i = st(t);
|
|
881
882
|
if (typeof i != "object" || !i || Array.isArray(i)) throw Error(`managed: parsed value at '${e}' is not a JSON object`);
|
|
882
|
-
return
|
|
883
|
+
return jt(i, n, { triggerContext: r }), pt(i, { collapse: o !== "package.json" });
|
|
883
884
|
}
|
|
884
885
|
if (e.endsWith(".yaml") || e.endsWith(".yml")) {
|
|
885
|
-
let e =
|
|
886
|
-
return
|
|
886
|
+
let e = on(t);
|
|
887
|
+
return Mt(e, n, {
|
|
887
888
|
triggerContext: r,
|
|
888
889
|
getLatestVersion: i,
|
|
889
890
|
getDerivedDependencyPin: a
|
|
890
|
-
}),
|
|
891
|
+
}), sn(e);
|
|
891
892
|
}
|
|
892
893
|
if (o === ".gitignore" || o.endsWith(".gitignore")) {
|
|
893
|
-
let e =
|
|
894
|
-
return
|
|
894
|
+
let e = bt(t);
|
|
895
|
+
return Nt(e, n, { triggerContext: r }), xt(e);
|
|
895
896
|
}
|
|
896
897
|
throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`);
|
|
897
898
|
}
|
|
898
|
-
function
|
|
899
|
+
function _n(e) {
|
|
899
900
|
let t = e.list(""), n = /* @__PURE__ */ new Set();
|
|
900
901
|
for (let e of t) {
|
|
901
902
|
n.add(e);
|
|
@@ -904,37 +905,37 @@ function ln(e) {
|
|
|
904
905
|
}
|
|
905
906
|
return n;
|
|
906
907
|
}
|
|
907
|
-
function
|
|
908
|
+
function vn(e, t) {
|
|
908
909
|
let n = t === "" ? t : t.endsWith("/") ? t.slice(0, -1) : t;
|
|
909
910
|
return e.has(n);
|
|
910
911
|
}
|
|
911
|
-
function
|
|
912
|
+
function yn(e, t, n) {
|
|
912
913
|
return {
|
|
913
914
|
ctx: t,
|
|
914
915
|
version: t.version,
|
|
915
|
-
pathExists: (t) =>
|
|
916
|
-
pathMissing: (t) => !
|
|
916
|
+
pathExists: (t) => vn(e, t),
|
|
917
|
+
pathMissing: (t) => !vn(e, t),
|
|
917
918
|
filesMatch: (t) => {
|
|
918
919
|
let r = n ? `${n}/${t}` : t;
|
|
919
|
-
for (let t of e) if (
|
|
920
|
+
for (let t of e) if (We(r, t)) return !0;
|
|
920
921
|
return !1;
|
|
921
922
|
}
|
|
922
923
|
};
|
|
923
924
|
}
|
|
924
|
-
function
|
|
925
|
+
function bn(e, t) {
|
|
925
926
|
for (let n of e.triggers) if (!n(t)) return !1;
|
|
926
927
|
return !0;
|
|
927
928
|
}
|
|
928
|
-
function
|
|
929
|
+
function xn(e, t) {
|
|
929
930
|
return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
|
|
930
931
|
}
|
|
931
|
-
function
|
|
932
|
+
function Sn(e, t) {
|
|
932
933
|
return e.filter((e) => e.modes.includes(t));
|
|
933
934
|
}
|
|
934
|
-
function
|
|
935
|
+
function Cn(e, t, n, r, i, a) {
|
|
935
936
|
let o = e.leaf;
|
|
936
937
|
if (o.kind === "fixed") {
|
|
937
|
-
let i =
|
|
938
|
+
let i = mn(o.content, e.resolvedPath, r, a);
|
|
938
939
|
return t.exists(e.resolvedPath) ? t.read(e.resolvedPath) === i ? void 0 : (n || t.write(e.resolvedPath, i), {
|
|
939
940
|
scope: e.scope,
|
|
940
941
|
path: e.resolvedPath,
|
|
@@ -947,13 +948,13 @@ function hn(e, t, n, r, i, a) {
|
|
|
947
948
|
action: "create"
|
|
948
949
|
});
|
|
949
950
|
}
|
|
950
|
-
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
951
|
+
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || hn(t, e.resolvedPath, o.initial, r, a), {
|
|
951
952
|
scope: e.scope,
|
|
952
953
|
path: e.resolvedPath,
|
|
953
954
|
primitive: "scaffold",
|
|
954
955
|
action: "create"
|
|
955
956
|
});
|
|
956
|
-
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
957
|
+
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || hn(t, e.resolvedPath, o.initial, r, a), {
|
|
957
958
|
scope: e.scope,
|
|
958
959
|
path: e.resolvedPath,
|
|
959
960
|
primitive: "seed",
|
|
@@ -976,58 +977,57 @@ function hn(e, t, n, r, i, a) {
|
|
|
976
977
|
});
|
|
977
978
|
}
|
|
978
979
|
}
|
|
979
|
-
function
|
|
980
|
+
function wn(e, t, n, r, i, a, o, s) {
|
|
980
981
|
if (e.leaf.kind !== "managed") return;
|
|
981
982
|
let c = e.leaf, l = e.resolvedPath, u = t.exists(l), d, f = !1;
|
|
982
|
-
u ? d = t.read(l) : (d =
|
|
983
|
-
let
|
|
984
|
-
if (f) return n || t.write(l,
|
|
983
|
+
u ? d = t.read(l) : (d = mn(c.initial, l, i, s), f = !0);
|
|
984
|
+
let ee = gn(l, d, c.body, r, a, o);
|
|
985
|
+
if (f) return n || t.write(l, ee), {
|
|
985
986
|
scope: e.scope,
|
|
986
987
|
path: l,
|
|
987
988
|
primitive: "managed",
|
|
988
989
|
action: "create"
|
|
989
990
|
};
|
|
990
|
-
if (
|
|
991
|
+
if (ee !== d) return n || t.write(l, ee), {
|
|
991
992
|
scope: e.scope,
|
|
992
993
|
path: l,
|
|
993
994
|
primitive: "managed",
|
|
994
995
|
action: "update"
|
|
995
996
|
};
|
|
996
997
|
}
|
|
997
|
-
function
|
|
998
|
-
let c =
|
|
998
|
+
function Tn(e, t, n, r, i, a, o, s) {
|
|
999
|
+
let c = Sn(e, xn(n, a)), l = [], u = _n(t);
|
|
999
1000
|
for (let e of c) {
|
|
1000
|
-
if (e.leaf.kind === "managed" || !
|
|
1001
|
-
let o =
|
|
1001
|
+
if (e.leaf.kind === "managed" || !bn(e, yn(u, n, e.modulePath))) continue;
|
|
1002
|
+
let o = Cn(e, t, r, i, a, n);
|
|
1002
1003
|
o && l.push(o);
|
|
1003
1004
|
}
|
|
1004
|
-
let d =
|
|
1005
|
+
let d = _n(t);
|
|
1005
1006
|
for (let e of c) {
|
|
1006
1007
|
if (e.leaf.kind !== "managed") continue;
|
|
1007
|
-
let a =
|
|
1008
|
-
if (!
|
|
1009
|
-
let c =
|
|
1008
|
+
let a = yn(d, n, e.modulePath);
|
|
1009
|
+
if (!bn(e, a)) continue;
|
|
1010
|
+
let c = wn(e, t, r, a, i, o, s, n);
|
|
1010
1011
|
c && l.push(c);
|
|
1011
1012
|
}
|
|
1012
1013
|
return l;
|
|
1013
1014
|
}
|
|
1014
|
-
function
|
|
1015
|
-
return
|
|
1016
|
-
let i =
|
|
1015
|
+
function En(e, t, n, r = {}) {
|
|
1016
|
+
return Je(n, () => {
|
|
1017
|
+
let i = ze(e, n), a = !!r.initMode, o = Tn(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
|
|
1017
1018
|
if (!n.dryRun && !n.updateDepsOnly && !a) {
|
|
1018
|
-
|
|
1019
|
+
fn(t, { version: 3 });
|
|
1019
1020
|
let i = {
|
|
1020
1021
|
...r.rediscover ? r.rediscover(t) : n,
|
|
1021
1022
|
dryRun: !0
|
|
1022
|
-
}, a =
|
|
1023
|
-
if (a.length > 0) throw new
|
|
1023
|
+
}, a = Tn(ze(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== cn);
|
|
1024
|
+
if (a.length > 0) throw new pn(a[0]);
|
|
1024
1025
|
}
|
|
1025
|
-
return a && !n.dryRun &&
|
|
1026
|
+
return a && !n.dryRun && fn(t, { version: 3 }), { changes: o };
|
|
1026
1027
|
});
|
|
1027
1028
|
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
var yn = [
|
|
1029
|
+
// src/structure/engine/discovery.ts
|
|
1030
|
+
var Dn = [
|
|
1031
1031
|
"root",
|
|
1032
1032
|
"block",
|
|
1033
1033
|
"model",
|
|
@@ -1036,12 +1036,13 @@ var yn = [
|
|
|
1036
1036
|
"test",
|
|
1037
1037
|
"software",
|
|
1038
1038
|
"kind"
|
|
1039
|
-
],
|
|
1039
|
+
], On = class extends Error {
|
|
1040
|
+
path;
|
|
1040
1041
|
constructor(e, t) {
|
|
1041
1042
|
super(e), this.path = t, this.name = "DiscoveryError";
|
|
1042
1043
|
}
|
|
1043
1044
|
};
|
|
1044
|
-
function
|
|
1045
|
+
function kn(e) {
|
|
1045
1046
|
let t = /* @__PURE__ */ new Set();
|
|
1046
1047
|
for (let n of [
|
|
1047
1048
|
e.dependencies,
|
|
@@ -1051,18 +1052,18 @@ function xn(e) {
|
|
|
1051
1052
|
]) if (n) for (let e of Object.keys(n)) t.add(e);
|
|
1052
1053
|
return t;
|
|
1053
1054
|
}
|
|
1054
|
-
function
|
|
1055
|
+
function An(e) {
|
|
1055
1056
|
return e === "" || e === ".";
|
|
1056
1057
|
}
|
|
1057
|
-
function
|
|
1058
|
+
function jn(e) {
|
|
1058
1059
|
let t = e.pkg["block-scope"];
|
|
1059
1060
|
if (typeof t == "string") {
|
|
1060
|
-
if (!
|
|
1061
|
+
if (!Dn.includes(t)) throw new On(`package.json "block-scope" must be one of ${Dn.join(", ")}, got '${t}'`, e.path);
|
|
1061
1062
|
return t;
|
|
1062
1063
|
}
|
|
1063
|
-
if (
|
|
1064
|
+
if (An(e.path)) return "root";
|
|
1064
1065
|
if (e.pkg.block !== void 0) return "block";
|
|
1065
|
-
let n =
|
|
1066
|
+
let n = kn(e.pkg);
|
|
1066
1067
|
if (n.has("@platforma-sdk/block-kind")) return "kind";
|
|
1067
1068
|
if (e.pkg["block-software"] !== void 0) return "software";
|
|
1068
1069
|
if (n.has("@platforma-sdk/package-builder")) {
|
|
@@ -1073,39 +1074,38 @@ function Cn(e) {
|
|
|
1073
1074
|
if (n.has("@platforma-sdk/model") && e.pkg.main) return "model";
|
|
1074
1075
|
if (n.has("@platforma-sdk/test")) return "test";
|
|
1075
1076
|
}
|
|
1076
|
-
function
|
|
1077
|
+
function Mn(e) {
|
|
1077
1078
|
let t = [];
|
|
1078
1079
|
for (let n of e) {
|
|
1079
|
-
let e =
|
|
1080
|
-
if (!e) throw new
|
|
1080
|
+
let e = jn(n);
|
|
1081
|
+
if (!e) throw new On(`Unclassified workspace package at '${n.path}'. Add a top-level "block-scope" string to its package.json.`, n.path);
|
|
1081
1082
|
t.push({
|
|
1082
1083
|
scope: e,
|
|
1083
1084
|
name: n.pkg.name ?? n.path,
|
|
1084
|
-
path:
|
|
1085
|
+
path: An(n.path) ? "" : n.path
|
|
1085
1086
|
});
|
|
1086
1087
|
}
|
|
1087
1088
|
return t;
|
|
1088
1089
|
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
function K(e, t) {
|
|
1090
|
+
// src/structure/engine/ctx.ts
|
|
1091
|
+
function q(e, t) {
|
|
1092
1092
|
return e.modules.filter((e) => e.scope === t);
|
|
1093
1093
|
}
|
|
1094
|
-
function
|
|
1095
|
-
let n =
|
|
1094
|
+
function Nn(e, t) {
|
|
1095
|
+
let n = q(e, t);
|
|
1096
1096
|
if (n.length === 0) throw Error(`findModule: expected one '${t}' module, found none`);
|
|
1097
1097
|
if (n.length > 1) throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);
|
|
1098
1098
|
return n[0];
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1101
|
-
return { [
|
|
1100
|
+
function Pn(e, t) {
|
|
1101
|
+
return { [Nn(e, t).name]: "workspace:*" };
|
|
1102
1102
|
}
|
|
1103
|
-
function
|
|
1103
|
+
function J(e, t) {
|
|
1104
1104
|
let n = {};
|
|
1105
|
-
for (let r of
|
|
1105
|
+
for (let r of q(e, t)) n[r.name] = "workspace:*";
|
|
1106
1106
|
return n;
|
|
1107
1107
|
}
|
|
1108
|
-
function
|
|
1108
|
+
function Fn(e) {
|
|
1109
1109
|
let t = e.facadeName, n = [
|
|
1110
1110
|
{
|
|
1111
1111
|
scope: "root",
|
|
@@ -1149,7 +1149,7 @@ function Dn(e) {
|
|
|
1149
1149
|
path: "software"
|
|
1150
1150
|
}), n;
|
|
1151
1151
|
}
|
|
1152
|
-
function
|
|
1152
|
+
function In(e) {
|
|
1153
1153
|
return {
|
|
1154
1154
|
isSdkInternal: e.isSdkInternal ?? !1,
|
|
1155
1155
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
@@ -1159,43 +1159,42 @@ function On(e) {
|
|
|
1159
1159
|
dryRun: e.dryRun ?? !1
|
|
1160
1160
|
};
|
|
1161
1161
|
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
var J = class extends Error {
|
|
1162
|
+
// src/structure/engine/discovery-fs.ts
|
|
1163
|
+
var Y = class extends Error {
|
|
1165
1164
|
constructor(e) {
|
|
1166
1165
|
super(e), this.name = "StructureCliError";
|
|
1167
1166
|
}
|
|
1168
1167
|
};
|
|
1169
|
-
function
|
|
1168
|
+
function Ln(e, t) {
|
|
1170
1169
|
return e === "" ? t : `${e}/${t}`;
|
|
1171
1170
|
}
|
|
1172
|
-
function
|
|
1171
|
+
function Rn(e, t) {
|
|
1173
1172
|
try {
|
|
1174
1173
|
return JSON.parse(e.read(t));
|
|
1175
1174
|
} catch {
|
|
1176
1175
|
return;
|
|
1177
1176
|
}
|
|
1178
1177
|
}
|
|
1179
|
-
function
|
|
1180
|
-
if (e.includes("*")) throw new
|
|
1178
|
+
function zn(e) {
|
|
1179
|
+
if (e.includes("*")) throw new Y(`pnpm-workspace.yaml 'packages:' entry '${e}' contains a glob. The structurer requires literal package paths — replace the glob with one entry per package directory.`);
|
|
1181
1180
|
let t = e.replace(/^\.\//, "").replace(/\/$/, "");
|
|
1182
1181
|
return t === "." ? "" : t;
|
|
1183
1182
|
}
|
|
1184
|
-
function
|
|
1183
|
+
function Bn(e) {
|
|
1185
1184
|
let t;
|
|
1186
1185
|
try {
|
|
1187
1186
|
t = e.read("pnpm-workspace.yaml");
|
|
1188
1187
|
} catch {
|
|
1189
|
-
throw new
|
|
1188
|
+
throw new Y("No pnpm-workspace.yaml found. This directory is empty or unrecognisable as a block — run 'block-tools structure init' instead, or pass --sdk-internal for an in-monorepo block.");
|
|
1190
1189
|
}
|
|
1191
|
-
let n =
|
|
1190
|
+
let n = pe(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = /* @__PURE__ */ new Set([""]);
|
|
1192
1191
|
for (let t of r) {
|
|
1193
|
-
let n =
|
|
1192
|
+
let n = zn(t);
|
|
1194
1193
|
(n === "" || e.exists(n)) && i.add(n);
|
|
1195
1194
|
}
|
|
1196
1195
|
let a = [];
|
|
1197
1196
|
for (let t of i) {
|
|
1198
|
-
let n =
|
|
1197
|
+
let n = Rn(e, Ln(t, "package.json"));
|
|
1199
1198
|
n && a.push({
|
|
1200
1199
|
path: t,
|
|
1201
1200
|
pkg: n
|
|
@@ -1203,8 +1202,8 @@ function Mn(e) {
|
|
|
1203
1202
|
}
|
|
1204
1203
|
return a;
|
|
1205
1204
|
}
|
|
1206
|
-
function
|
|
1207
|
-
let t = [], n = new Set([
|
|
1205
|
+
function Vn(e) {
|
|
1206
|
+
let t = [], n = /* @__PURE__ */ new Set([
|
|
1208
1207
|
"node_modules",
|
|
1209
1208
|
".turbo",
|
|
1210
1209
|
"dist",
|
|
@@ -1215,7 +1214,7 @@ function Nn(e) {
|
|
|
1215
1214
|
let o = e.listDir(i);
|
|
1216
1215
|
for (let s of o) {
|
|
1217
1216
|
if (!s.isDirectory || n.has(s.name)) continue;
|
|
1218
|
-
let o =
|
|
1217
|
+
let o = Ln(i, s.name), c = Rn(e, Ln(o, "package.json"));
|
|
1219
1218
|
c && t.push({
|
|
1220
1219
|
path: o,
|
|
1221
1220
|
pkg: c
|
|
@@ -1224,11 +1223,11 @@ function Nn(e) {
|
|
|
1224
1223
|
}
|
|
1225
1224
|
return r("", 1), t;
|
|
1226
1225
|
}
|
|
1227
|
-
function
|
|
1226
|
+
function Hn(e) {
|
|
1228
1227
|
let t = e.indexOf("/");
|
|
1229
|
-
if (!e.startsWith("@") || t < 0) throw new
|
|
1228
|
+
if (!e.startsWith("@") || t < 0) throw new Y(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
|
|
1230
1229
|
let n = e.slice(0, t), r = e.slice(t + 1), i = r.indexOf(".");
|
|
1231
|
-
if (i < 0) throw new
|
|
1230
|
+
if (i < 0) throw new Y(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
|
|
1232
1231
|
return {
|
|
1233
1232
|
facadeName: e,
|
|
1234
1233
|
baseName: r,
|
|
@@ -1237,19 +1236,19 @@ function Pn(e) {
|
|
|
1237
1236
|
shortName: r.slice(i + 1)
|
|
1238
1237
|
};
|
|
1239
1238
|
}
|
|
1240
|
-
function
|
|
1241
|
-
let { fs: t, isSdkInternal: n } = e, r = n ?
|
|
1242
|
-
if (r.length === 0) throw new
|
|
1243
|
-
let i =
|
|
1244
|
-
|
|
1239
|
+
function Un(e) {
|
|
1240
|
+
let { fs: t, isSdkInternal: n } = e, r = n ? Vn(t) : Bn(t);
|
|
1241
|
+
if (r.length === 0) throw new Y("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
|
|
1242
|
+
let i = Mn(r), a = ln(t);
|
|
1243
|
+
un(a.version, 0);
|
|
1245
1244
|
let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
|
|
1246
|
-
if (!o) throw new
|
|
1247
|
-
let s = o.name.replace(/\.block$/, ""), c =
|
|
1245
|
+
if (!o) throw new Y("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
|
|
1246
|
+
let s = o.name.replace(/\.block$/, ""), c = Hn(s);
|
|
1248
1247
|
return i.some((e) => e.scope === "kind") || i.push({
|
|
1249
1248
|
scope: "kind",
|
|
1250
1249
|
name: `${s}.kind`,
|
|
1251
1250
|
path: "kind"
|
|
1252
|
-
}),
|
|
1251
|
+
}), In({
|
|
1253
1252
|
isSdkInternal: n,
|
|
1254
1253
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
1255
1254
|
modules: i,
|
|
@@ -1258,9 +1257,8 @@ function Fn(e) {
|
|
|
1258
1257
|
dryRun: e.dryRun ?? !1
|
|
1259
1258
|
});
|
|
1260
1259
|
}
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
var Y = [
|
|
1260
|
+
// src/structure/rules/shared/key-order.ts
|
|
1261
|
+
var X = [
|
|
1264
1262
|
"name",
|
|
1265
1263
|
"version",
|
|
1266
1264
|
"private",
|
|
@@ -1277,35 +1275,49 @@ var Y = [
|
|
|
1277
1275
|
"devDependencies",
|
|
1278
1276
|
"peerDependencies",
|
|
1279
1277
|
"optionalDependencies",
|
|
1278
|
+
"devEngines",
|
|
1279
|
+
"engines",
|
|
1280
1280
|
"packageManager",
|
|
1281
|
-
"pnpm",
|
|
1282
1281
|
"block",
|
|
1283
1282
|
"block-software"
|
|
1284
|
-
],
|
|
1285
|
-
function
|
|
1286
|
-
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1283
|
+
], Z = "1.0.0";
|
|
1284
|
+
function Q() {
|
|
1285
|
+
Jt("version", (e) => typeof e == "string" && e.length > 0 ? e : Z);
|
|
1286
|
+
}
|
|
1287
|
+
// src/structure/rules/shared/toolchain.ts
|
|
1288
|
+
var Wn = "24.22.1", Gn = {
|
|
1289
|
+
name: "node",
|
|
1290
|
+
version: Wn,
|
|
1291
|
+
onFail: "download"
|
|
1292
|
+
}, Kn = "pnpm@12.16.1+sha512.091d1dee7927575661b25dab3c2ae31cafc1c54d6b71ed6a6600cf0c1cb10434a447eae14015f1b23e2e6bedeed79df94a932e2164d2832280dce3fb32f656d1", qn = "~2.11.10", Jn = [
|
|
1293
|
+
"@milaboratories/*",
|
|
1294
|
+
"@platforma-sdk/*",
|
|
1295
|
+
"@platforma-open/*"
|
|
1296
|
+
], Yn = { "@milaboratories/pframes-rs-node": !0 }, Xn = {
|
|
1297
|
+
"@milaboratories/tengo-tester": !1,
|
|
1298
|
+
"cpu-features": !1,
|
|
1299
|
+
esbuild: !1,
|
|
1300
|
+
protobufjs: !1,
|
|
1301
|
+
ssh2: !1
|
|
1302
|
+
}, Zn = {
|
|
1291
1303
|
"build:dev-local": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=local turbo run build",
|
|
1292
1304
|
"build:dev-remote": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build",
|
|
1293
1305
|
"build:dev-no-software": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=none turbo run build",
|
|
1294
1306
|
"build:dev-binary-existing": "env PL_BUILD_CHANNEL=dev PL_BUILD_USE_PUBLISHED=true turbo run build",
|
|
1295
1307
|
"build:release": "env PL_BUILD_CHANNEL=release PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build"
|
|
1296
|
-
},
|
|
1308
|
+
}, Qn = {
|
|
1297
1309
|
test: "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --concurrency 1",
|
|
1298
1310
|
"test:dry-run": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --dry-run=json"
|
|
1299
1311
|
};
|
|
1300
|
-
function
|
|
1312
|
+
function $n() {
|
|
1301
1313
|
return {
|
|
1302
|
-
version:
|
|
1314
|
+
version: Z,
|
|
1303
1315
|
private: !0,
|
|
1304
1316
|
scripts: {
|
|
1305
1317
|
fmt: "turbo run fmt",
|
|
1306
1318
|
check: "turbo run check",
|
|
1307
|
-
...
|
|
1308
|
-
...
|
|
1319
|
+
...Zn,
|
|
1320
|
+
...Qn,
|
|
1309
1321
|
"mark-stable": "turbo run mark-stable",
|
|
1310
1322
|
"do-pack": "turbo run do-pack",
|
|
1311
1323
|
watch: "turbo watch build",
|
|
@@ -1324,32 +1336,30 @@ function Rn() {
|
|
|
1324
1336
|
"@platforma-sdk/block-tools": "sdk:",
|
|
1325
1337
|
shx: "catalog:",
|
|
1326
1338
|
turbo: "catalog:"
|
|
1327
|
-
}
|
|
1328
|
-
packageManager: "pnpm@9.12.0"
|
|
1339
|
+
}
|
|
1329
1340
|
};
|
|
1330
1341
|
}
|
|
1331
|
-
function
|
|
1332
|
-
R("packageManager", "pnpm
|
|
1333
|
-
for (let [e, t] of Object.entries(
|
|
1334
|
-
for (let [e, t] of Object.entries(
|
|
1335
|
-
|
|
1342
|
+
function er() {
|
|
1343
|
+
R("packageManager", Kn), R("devEngines.runtime", Gn), z("pnpm", (e) => e === null || typeof e == "object" && Object.values(e).every((e) => typeof e == "object" && !!e && Object.keys(e).length === 0)), Ft("pnpm", "pnpm 11+ ignores the \"pnpm\" field in package.json. Move its settings to pnpm-workspace.yaml: overrides as is, onlyBuiltDependencies as allowBuilds true, neverBuiltDependencies as allowBuilds false."), z("name"), B("fmt", "turbo run fmt"), B("check", "turbo run check");
|
|
1344
|
+
for (let [e, t] of Object.entries(Zn)) B(e, t);
|
|
1345
|
+
for (let [e, t] of Object.entries(Qn)) B(e, t);
|
|
1346
|
+
V("build"), V("build:dev"), B("mark-stable", "turbo run mark-stable"), B("do-pack", "turbo run do-pack"), B("watch", "turbo watch build"), B("changeset", "changeset"), B("version-packages", "changeset version"), B("update-sdk", "block-tools structure refresh --update-deps-only"), V("update"), B("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), W({
|
|
1336
1347
|
"@changesets/cli": "catalog:",
|
|
1337
1348
|
"@milaboratories/ts-builder": "sdk:",
|
|
1338
1349
|
"@platforma-sdk/block-tools": "sdk:",
|
|
1339
1350
|
shx: "catalog:",
|
|
1340
1351
|
turbo: "catalog:"
|
|
1341
|
-
}),
|
|
1352
|
+
}), Vt({
|
|
1342
1353
|
oxlint: "*",
|
|
1343
1354
|
oxfmt: "*"
|
|
1344
|
-
}),
|
|
1355
|
+
}), Gt((e, t) => {
|
|
1345
1356
|
if (!/^(\/\/|--)/.test(e) || typeof t != "object" || !t) return !1;
|
|
1346
1357
|
let n = t;
|
|
1347
1358
|
return n.pnpm !== void 0 || n.overrides !== void 0;
|
|
1348
|
-
}),
|
|
1359
|
+
}), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1349
1360
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
var Bn = "https://turbo.build/schema.json", Vn = ["tsconfig.json"], Hn = {
|
|
1361
|
+
// src/structure/rules/root-turbo-json.ts
|
|
1362
|
+
var tr = "https://turbo.build/schema.json", nr = ["tsconfig.json"], rr = {
|
|
1353
1363
|
fmt: { cache: !1 },
|
|
1354
1364
|
check: {
|
|
1355
1365
|
dependsOn: ["^build"],
|
|
@@ -1398,94 +1408,94 @@ var Bn = "https://turbo.build/schema.json", Vn = ["tsconfig.json"], Hn = {
|
|
|
1398
1408
|
cache: !1
|
|
1399
1409
|
}
|
|
1400
1410
|
};
|
|
1401
|
-
function
|
|
1411
|
+
function ir() {
|
|
1402
1412
|
return {
|
|
1403
|
-
$schema:
|
|
1404
|
-
globalDependencies:
|
|
1405
|
-
tasks: { ...
|
|
1413
|
+
$schema: tr,
|
|
1414
|
+
globalDependencies: nr,
|
|
1415
|
+
tasks: { ...rr }
|
|
1406
1416
|
};
|
|
1407
1417
|
}
|
|
1408
|
-
function
|
|
1409
|
-
R("$schema",
|
|
1418
|
+
function ar() {
|
|
1419
|
+
R("$schema", tr), R("globalDependencies", nr), It("tasks", rr), z("tasks.build:dev"), G([
|
|
1410
1420
|
"$schema",
|
|
1411
1421
|
"globalDependencies",
|
|
1412
1422
|
"tasks"
|
|
1413
1423
|
]);
|
|
1414
1424
|
}
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
function Jn(e) {
|
|
1425
|
+
// src/structure/engine/registry-client.ts
|
|
1426
|
+
var or = 2, sr = 500, cr = 3e4;
|
|
1427
|
+
function lr(e) {
|
|
1419
1428
|
if (!e) return null;
|
|
1420
1429
|
let t = Number(e);
|
|
1421
1430
|
if (Number.isFinite(t) && t > 0) return t * 1e3;
|
|
1422
1431
|
let n = Date.parse(e);
|
|
1423
1432
|
return Number.isNaN(n) ? null : Math.max(0, n - Date.now());
|
|
1424
1433
|
}
|
|
1425
|
-
async function
|
|
1434
|
+
async function ur(e) {
|
|
1426
1435
|
for (let t = 1;; t++) {
|
|
1427
1436
|
let n;
|
|
1428
1437
|
try {
|
|
1429
|
-
n = await fetch(e, { signal: AbortSignal.timeout(
|
|
1438
|
+
n = await fetch(e, { signal: AbortSignal.timeout(cr) });
|
|
1430
1439
|
} catch (e) {
|
|
1431
|
-
if (t >
|
|
1432
|
-
|
|
1440
|
+
if (t > or) throw e;
|
|
1441
|
+
let n = sr * 2 ** (t - 1) * (.8 + .4 * Math.random());
|
|
1442
|
+
await ge(n);
|
|
1433
1443
|
continue;
|
|
1434
1444
|
}
|
|
1435
1445
|
if (n.ok) return n;
|
|
1436
|
-
if (!(n.status === 429 || n.status >= 500) || t >
|
|
1437
|
-
let r =
|
|
1446
|
+
if (!(n.status === 429 || n.status >= 500) || t > or) throw Error(`registry returned HTTP ${n.status}`);
|
|
1447
|
+
let r = lr(n.headers.get("retry-after"));
|
|
1438
1448
|
if (r != null) {
|
|
1439
|
-
await
|
|
1449
|
+
await ge(r);
|
|
1440
1450
|
continue;
|
|
1441
1451
|
}
|
|
1442
|
-
|
|
1452
|
+
let i = sr * 2 ** (t - 1) * (.8 + .4 * Math.random());
|
|
1453
|
+
await ge(i);
|
|
1443
1454
|
}
|
|
1444
1455
|
}
|
|
1445
|
-
function
|
|
1456
|
+
function dr() {
|
|
1446
1457
|
return {
|
|
1447
1458
|
async getLatestVersion(e) {
|
|
1448
|
-
let t = (await (await
|
|
1459
|
+
let t = (await (await ur(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
|
|
1449
1460
|
if (!t) throw Error("no 'latest' dist-tag in registry response");
|
|
1450
1461
|
return t;
|
|
1451
1462
|
},
|
|
1452
1463
|
async getDeclaredDependency(e, t, n) {
|
|
1453
|
-
let r = await (await
|
|
1464
|
+
let r = await (await ur(`https://registry.npmjs.org/${e}/${t}`)).json();
|
|
1454
1465
|
return r.dependencies?.[n] ?? r.peerDependencies?.[n];
|
|
1455
1466
|
}
|
|
1456
1467
|
};
|
|
1457
1468
|
}
|
|
1458
|
-
async function
|
|
1469
|
+
async function fr(e, t) {
|
|
1459
1470
|
let n = await Promise.all(t.map(async (t) => [t, await e.getLatestVersion(t)]));
|
|
1460
1471
|
return new Map(n);
|
|
1461
1472
|
}
|
|
1462
|
-
function
|
|
1473
|
+
function pr(e) {
|
|
1463
1474
|
return (t) => e.get(t);
|
|
1464
1475
|
}
|
|
1465
|
-
var
|
|
1466
|
-
function
|
|
1467
|
-
return
|
|
1476
|
+
var mr = [/^@platforma-sdk\//, /^@milaboratories\//];
|
|
1477
|
+
function hr(e) {
|
|
1478
|
+
return mr.some((t) => t.test(e));
|
|
1468
1479
|
}
|
|
1469
|
-
async function
|
|
1470
|
-
return e.length === 0 ? () => void 0 :
|
|
1480
|
+
async function gr(e, t = dr()) {
|
|
1481
|
+
return e.length === 0 ? () => void 0 : pr(await fr(t, e));
|
|
1471
1482
|
}
|
|
1472
|
-
function
|
|
1483
|
+
function _r(e) {
|
|
1473
1484
|
return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
|
|
1474
1485
|
}
|
|
1475
|
-
async function
|
|
1486
|
+
async function vr(e, t = dr()) {
|
|
1476
1487
|
if (e.length === 0) return () => void 0;
|
|
1477
1488
|
let n = await Promise.all(e.map(async (e) => {
|
|
1478
1489
|
let n = await t.getDeclaredDependency(e.of, e.ofVersion ?? "latest", e.entry);
|
|
1479
1490
|
if (n === void 0) throw Error(`derived catalog pin '${e.entry}': package '${e.of}'${e.ofVersion ? `@${e.ofVersion}` : " (latest)"} declares no dependency '${e.entry}'. A derived pin requires the source to declare the dep as an exact version.`);
|
|
1480
|
-
if (!
|
|
1491
|
+
if (!_r(n)) throw Error(`derived catalog pin '${e.entry}': package '${e.of}'${e.ofVersion ? `@${e.ofVersion}` : " (latest)"} declares '${e.entry}: ${n}', which is not an exact version. A derived pin requires an exact ('x.y.z') source dependency so the catalog can pin to it precisely.`);
|
|
1481
1492
|
return [e.entry, n];
|
|
1482
1493
|
})), r = new Map(n);
|
|
1483
1494
|
return (e) => r.get(e);
|
|
1484
1495
|
}
|
|
1485
|
-
|
|
1486
|
-
//#region src/structure/rules/shared/retired-deps.ts
|
|
1496
|
+
// src/structure/rules/shared/retired-deps.ts
|
|
1487
1497
|
// @vitejs/plugin-vue — bundled by ts-builder's internal vite config.
|
|
1488
|
-
var
|
|
1498
|
+
var yr = [
|
|
1489
1499
|
"vite",
|
|
1490
1500
|
"tsup",
|
|
1491
1501
|
"vue-tsc",
|
|
@@ -1493,12 +1503,11 @@ var ir = [
|
|
|
1493
1503
|
"vite-plugin-dts",
|
|
1494
1504
|
"@platforma-sdk/eslint-config"
|
|
1495
1505
|
];
|
|
1496
|
-
function
|
|
1497
|
-
for (let e of
|
|
1506
|
+
function br() {
|
|
1507
|
+
for (let e of yr) U(e);
|
|
1498
1508
|
}
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
var or = [
|
|
1509
|
+
// src/structure/rules/root-pnpm-workspace.ts
|
|
1510
|
+
var xr = [
|
|
1502
1511
|
"@platforma-sdk/model",
|
|
1503
1512
|
"@platforma-sdk/ui-vue",
|
|
1504
1513
|
"@platforma-sdk/workflow-tengo",
|
|
@@ -1510,36 +1519,35 @@ var or = [
|
|
|
1510
1519
|
"@platforma-sdk/package-builder",
|
|
1511
1520
|
"@milaboratories/ts-builder",
|
|
1512
1521
|
"@milaboratories/ts-configs"
|
|
1513
|
-
],
|
|
1514
|
-
for (let e of
|
|
1515
|
-
var
|
|
1516
|
-
turbo:
|
|
1522
|
+
], Sr = "0.0.0-init-must-fetch";
|
|
1523
|
+
for (let e of xr) if (!hr(e)) throw Error(`SDK_CATALOG_PACKAGES entry '${e}' matches no catalog bump pattern; its placeholder would never be resolved to npm latest on init. Add it to CATALOG_BUMP_PATTERNS or move it to the infra floor.`);
|
|
1524
|
+
var Cr = {
|
|
1525
|
+
turbo: qn,
|
|
1517
1526
|
shx: "~0.4.0",
|
|
1518
1527
|
"@changesets/cli": "~2.29.8",
|
|
1519
1528
|
vitest: "~4.0.18",
|
|
1520
1529
|
typescript: "~5.9.3"
|
|
1521
|
-
},
|
|
1530
|
+
}, wr = [{
|
|
1522
1531
|
entry: "vue",
|
|
1523
1532
|
of: "@platforma-sdk/ui-vue"
|
|
1524
1533
|
}, {
|
|
1525
1534
|
entry: "@milaboratories/helpers",
|
|
1526
1535
|
of: "@platforma-sdk/model"
|
|
1527
|
-
}],
|
|
1528
|
-
function
|
|
1536
|
+
}], Tr = "@platforma-open/milaboratories.runenv-python-3", Er = "1.8.2";
|
|
1537
|
+
function Dr(e) {
|
|
1529
1538
|
let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
|
|
1530
|
-
for (let e of
|
|
1531
|
-
return Object.assign(n,
|
|
1539
|
+
for (let e of xr) n[e] = Sr;
|
|
1540
|
+
return Object.assign(n, Cr), e.modules.some((e) => e.scope === "software") && (n[Tr] = Er), {
|
|
1532
1541
|
packages: t,
|
|
1533
1542
|
catalog: n
|
|
1534
1543
|
};
|
|
1535
1544
|
}
|
|
1536
|
-
function
|
|
1537
|
-
|
|
1538
|
-
for (let e of
|
|
1545
|
+
function Or() {
|
|
1546
|
+
Yt(), rn("minimumReleaseAgeExclude", Jn), nn("allowBuilds", Xn, { keepExisting: !0 }), nn("allowBuilds", Yn), en("turbo", qn);
|
|
1547
|
+
for (let e of yr) tn(e);
|
|
1539
1548
|
}
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
var mr = [
|
|
1549
|
+
// src/structure/rules/root-gitignore.ts
|
|
1550
|
+
var kr = [
|
|
1543
1551
|
".test_auth.json",
|
|
1544
1552
|
"node_modules/",
|
|
1545
1553
|
"dist/",
|
|
@@ -1554,31 +1562,30 @@ var mr = [
|
|
|
1554
1562
|
".vscode/sftp.json",
|
|
1555
1563
|
"test-dry-run.json"
|
|
1556
1564
|
];
|
|
1557
|
-
function
|
|
1558
|
-
|
|
1565
|
+
function Ar() {
|
|
1566
|
+
an(kr);
|
|
1559
1567
|
}
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
function _r(e) {
|
|
1568
|
+
// src/structure/rules/root-changeset-config.ts
|
|
1569
|
+
var jr = "---\n---\n\nInitial release.\n";
|
|
1570
|
+
function Mr(e) {
|
|
1564
1571
|
return {
|
|
1565
1572
|
$schema: "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
1566
|
-
changelog:
|
|
1573
|
+
changelog: Pr,
|
|
1567
1574
|
commit: !1,
|
|
1568
|
-
fixed: [
|
|
1575
|
+
fixed: [Br(e)],
|
|
1569
1576
|
linked: [],
|
|
1570
|
-
access:
|
|
1571
|
-
baseBranch:
|
|
1572
|
-
updateInternalDependencies:
|
|
1577
|
+
access: Fr,
|
|
1578
|
+
baseBranch: Ir,
|
|
1579
|
+
updateInternalDependencies: Lr,
|
|
1573
1580
|
ignore: []
|
|
1574
1581
|
};
|
|
1575
1582
|
}
|
|
1576
|
-
function
|
|
1577
|
-
R("changelog",
|
|
1578
|
-
let t =
|
|
1579
|
-
|
|
1583
|
+
function Nr(e) {
|
|
1584
|
+
R("changelog", Pr), R("commit", !1), R("access", Fr), R("baseBranch", Ir), R("updateInternalDependencies", Lr);
|
|
1585
|
+
let t = Br(e);
|
|
1586
|
+
Jt("fixed", (e) => Vr(e, t)), G(Rr);
|
|
1580
1587
|
}
|
|
1581
|
-
var
|
|
1588
|
+
var Pr = "@changesets/cli/changelog", Fr = "restricted", Ir = "main", Lr = "patch", Rr = [
|
|
1582
1589
|
"$schema",
|
|
1583
1590
|
"changelog",
|
|
1584
1591
|
"commit",
|
|
@@ -1588,65 +1595,66 @@ var yr = "@changesets/cli/changelog", br = "restricted", xr = "main", Sr = "patc
|
|
|
1588
1595
|
"baseBranch",
|
|
1589
1596
|
"updateInternalDependencies",
|
|
1590
1597
|
"ignore"
|
|
1591
|
-
],
|
|
1598
|
+
], zr = [
|
|
1592
1599
|
"block",
|
|
1593
1600
|
"model",
|
|
1594
1601
|
"ui",
|
|
1595
1602
|
"workflow"
|
|
1596
1603
|
];
|
|
1597
|
-
function
|
|
1598
|
-
return
|
|
1604
|
+
function Br(e) {
|
|
1605
|
+
return zr.flatMap((t) => q(e, t).map((e) => e.name));
|
|
1599
1606
|
}
|
|
1600
|
-
function
|
|
1601
|
-
let n = new Set(t), r = Array.isArray(e) ? e.filter(
|
|
1607
|
+
function Vr(e, t) {
|
|
1608
|
+
let n = new Set(t), r = Array.isArray(e) ? e.filter(Hr) : [], i = r.findIndex((e) => e.some((e) => n.has(e))), a = [];
|
|
1602
1609
|
return r.forEach((e, r) => {
|
|
1603
1610
|
let o = e.filter((e) => !n.has(e));
|
|
1604
1611
|
r === i ? a.push([...t, ...o]) : o.length > 0 && a.push(o);
|
|
1605
1612
|
}), i === -1 && a.push(t), a;
|
|
1606
1613
|
}
|
|
1607
|
-
function
|
|
1614
|
+
function Hr(e) {
|
|
1608
1615
|
return Array.isArray(e) && e.every((e) => typeof e == "string");
|
|
1609
1616
|
}
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
}), k(".changeset/scaffold.md", et(gr));
|
|
1617
|
+
// src/structure/rules/root.ts
|
|
1618
|
+
function Ur() {
|
|
1619
|
+
S("root", () => {
|
|
1620
|
+
C(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1621
|
+
E("turbo.json", M(() => ir()), () => {
|
|
1622
|
+
ar();
|
|
1623
|
+
}), T(".vscode/settings.json", A("root/.vscode/settings.json")), E("package.json", M(() => $n()), () => {
|
|
1624
|
+
er();
|
|
1625
|
+
}), E("pnpm-workspace.yaml", M((e) => Dr(e)), () => {
|
|
1626
|
+
Or();
|
|
1627
|
+
}), E(".gitignore", A("root/.gitignore"), () => {
|
|
1628
|
+
Ar();
|
|
1629
|
+
}), E(".changeset/config.json", M((e) => Mr(e)), (e) => {
|
|
1630
|
+
Nr(e);
|
|
1631
|
+
}), O(".changeset/scaffold.md", at(jr));
|
|
1626
1632
|
});
|
|
1627
1633
|
});
|
|
1628
1634
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
function kr(e) {
|
|
1635
|
+
// src/structure/rules/root-ci.ts
|
|
1636
|
+
function Wr(e) {
|
|
1632
1637
|
return e.split(/[-_]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
1633
1638
|
}
|
|
1634
|
-
function
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1639
|
+
function Gr() {
|
|
1640
|
+
S("root", () => {
|
|
1641
|
+
C(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1642
|
+
T(".github/workflows/build.yaml", j("workflows/build.tpl.yaml", (e) => {
|
|
1638
1643
|
let t = e.blockVars.shortName;
|
|
1639
1644
|
return {
|
|
1640
|
-
appName: `Block: ${
|
|
1641
|
-
appNameSlug: `block-${t}
|
|
1645
|
+
appName: `Block: ${Wr(t)}`,
|
|
1646
|
+
appNameSlug: `block-${t}`,
|
|
1647
|
+
nodeVersion: Wn
|
|
1642
1648
|
};
|
|
1643
|
-
})),
|
|
1649
|
+
})), T(".github/workflows/mark-stable.yaml", j("workflows/mark-stable.tpl.yaml", (e) => ({
|
|
1650
|
+
appName: `Block: ${Wr(e.blockVars.shortName)} - Mark Stable`,
|
|
1651
|
+
nodeVersion: Wn
|
|
1652
|
+
})));
|
|
1644
1653
|
});
|
|
1645
1654
|
});
|
|
1646
1655
|
}
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
var jr = {
|
|
1656
|
+
// src/structure/rules/block-package-json.ts
|
|
1657
|
+
var Kr = {
|
|
1650
1658
|
"@platforma-open": {
|
|
1651
1659
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1652
1660
|
serveUrl: "https://blocks.pl-open.science"
|
|
@@ -1655,45 +1663,45 @@ var jr = {
|
|
|
1655
1663
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1656
1664
|
serveUrl: "https://block.registry.platforma.bio/releases"
|
|
1657
1665
|
}
|
|
1658
|
-
},
|
|
1666
|
+
}, qr = {
|
|
1659
1667
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
|
|
1660
1668
|
serveUrl: "https://blocks.pl-open.science"
|
|
1661
|
-
},
|
|
1669
|
+
}, Jr = {
|
|
1662
1670
|
s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/aux/dev/?region=eu-central-1",
|
|
1663
1671
|
serveUrl: "https://aux-blocks.pl-open.science"
|
|
1664
1672
|
};
|
|
1665
|
-
function
|
|
1666
|
-
let n = t ?
|
|
1673
|
+
function Yr(e, t) {
|
|
1674
|
+
let n = t ? Jr : Kr[e] ?? qr;
|
|
1667
1675
|
return `block-tools publish -r ${n.s3} --registry-serve-url ${n.serveUrl}`;
|
|
1668
1676
|
}
|
|
1669
|
-
function
|
|
1677
|
+
function Xr(e) {
|
|
1670
1678
|
let t = {};
|
|
1671
|
-
for (let n of
|
|
1672
|
-
for (let n of
|
|
1673
|
-
for (let n of
|
|
1679
|
+
for (let n of q(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
|
|
1680
|
+
for (let n of q(e, "model")) t.model = `${n.name}/dist/model.json`;
|
|
1681
|
+
for (let n of q(e, "ui")) t.ui = `${n.name}/dist`;
|
|
1674
1682
|
return t;
|
|
1675
1683
|
}
|
|
1676
|
-
function
|
|
1684
|
+
function Zr(e, t) {
|
|
1677
1685
|
return {
|
|
1678
1686
|
build: "ts-builder build --target block-facade && block-tools pack",
|
|
1679
1687
|
check: "ts-builder type-check --target block-facade",
|
|
1680
|
-
prepublishOnly:
|
|
1688
|
+
prepublishOnly: Yr(e, t),
|
|
1681
1689
|
"do-pack": "shx rm -f package.tgz && pnpm pack && shx mv *.tgz package.tgz"
|
|
1682
1690
|
};
|
|
1683
1691
|
}
|
|
1684
|
-
var
|
|
1692
|
+
var Qr = {
|
|
1685
1693
|
"@milaboratories/ts-builder": "sdk:",
|
|
1686
1694
|
"@milaboratories/ts-configs": "sdk:",
|
|
1687
1695
|
"@platforma-sdk/block-tools": "sdk:",
|
|
1688
1696
|
"@platforma-sdk/model": "sdk:",
|
|
1689
1697
|
shx: "catalog:",
|
|
1690
1698
|
typescript: "catalog:"
|
|
1691
|
-
},
|
|
1699
|
+
}, $r = { ".": {
|
|
1692
1700
|
sources: "./src/index.ts",
|
|
1693
1701
|
types: "./dist/index.d.ts",
|
|
1694
1702
|
default: "./dist/index.js"
|
|
1695
1703
|
} };
|
|
1696
|
-
function
|
|
1704
|
+
function ei(e) {
|
|
1697
1705
|
if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
|
|
1698
1706
|
let t = e.meta, n = [
|
|
1699
1707
|
["block.meta.title", t.title],
|
|
@@ -1705,15 +1713,15 @@ function zr(e) {
|
|
|
1705
1713
|
];
|
|
1706
1714
|
for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
|
|
1707
1715
|
}
|
|
1708
|
-
function
|
|
1716
|
+
function ti(e) {
|
|
1709
1717
|
let t = e.blockVars, n = {
|
|
1710
|
-
...
|
|
1711
|
-
...
|
|
1712
|
-
...
|
|
1713
|
-
...
|
|
1714
|
-
...
|
|
1718
|
+
...Qr,
|
|
1719
|
+
...J(e, "model"),
|
|
1720
|
+
...J(e, "ui"),
|
|
1721
|
+
...J(e, "workflow"),
|
|
1722
|
+
...J(e, "kind")
|
|
1715
1723
|
}, r = {
|
|
1716
|
-
components:
|
|
1724
|
+
components: Xr(e),
|
|
1717
1725
|
meta: {
|
|
1718
1726
|
title: t.shortName,
|
|
1719
1727
|
description: `${t.shortName} block`,
|
|
@@ -1725,56 +1733,52 @@ function Br(e) {
|
|
|
1725
1733
|
}
|
|
1726
1734
|
}
|
|
1727
1735
|
};
|
|
1728
|
-
return
|
|
1736
|
+
return ei(r), {
|
|
1729
1737
|
name: `${t.facadeName}.block`,
|
|
1730
|
-
version:
|
|
1738
|
+
version: Z,
|
|
1731
1739
|
type: "module",
|
|
1732
1740
|
files: ["dist", "block-pack"],
|
|
1733
1741
|
main: "./dist/index.js",
|
|
1734
1742
|
module: "./dist/index.js",
|
|
1735
1743
|
types: "./dist/index.d.ts",
|
|
1736
|
-
exports:
|
|
1737
|
-
scripts:
|
|
1744
|
+
exports: $r,
|
|
1745
|
+
scripts: Zr(t.npmOrg, e.isSdkInternal),
|
|
1738
1746
|
dependencies: {},
|
|
1739
1747
|
devDependencies: n,
|
|
1740
1748
|
block: r
|
|
1741
1749
|
};
|
|
1742
1750
|
}
|
|
1743
|
-
function
|
|
1744
|
-
let t = e.blockVars, n =
|
|
1751
|
+
function ni(e) {
|
|
1752
|
+
let t = e.blockVars, n = q(e, "kind");
|
|
1745
1753
|
if (n.length !== 1) throw Error(n.length === 0 ? `block '${t.facadeName}' declares no kind — every block must have a sibling kind/ package` : `block '${t.facadeName}' declares ${n.length} kinds; exactly one is required`);
|
|
1746
|
-
R("type", "module"), R("files", ["dist", "block-pack"]), R("main", "./dist/index.js"), R("module", "./dist/index.js"), R("types", "./dist/index.d.ts"), R("exports",
|
|
1747
|
-
let r =
|
|
1748
|
-
for (let [e, t] of Object.entries(r))
|
|
1749
|
-
|
|
1754
|
+
R("type", "module"), R("files", ["dist", "block-pack"]), R("main", "./dist/index.js"), R("module", "./dist/index.js"), R("types", "./dist/index.d.ts"), R("exports", $r);
|
|
1755
|
+
let r = Zr(t.npmOrg, e.isSdkInternal);
|
|
1756
|
+
for (let [e, t] of Object.entries(r)) B(e, t);
|
|
1757
|
+
Wt("model"), Wt("ui"), Wt("workflow"), Wt("kind"), H("@milaboratories/ts-builder", "sdk:"), H("@milaboratories/ts-configs", "sdk:"), H("@platforma-sdk/block-tools", "sdk:"), H("@platforma-sdk/model", "sdk:"), H("shx", "catalog:"), H("typescript", "catalog:"), R("block.components", Xr(e)), Pt("version", "facade package.json must carry a 'version' (the facade publishes)"), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1750
1758
|
}
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
function Hr(e) {
|
|
1759
|
+
// src/structure/rules/shared/pascal-case.ts
|
|
1760
|
+
function ri(e) {
|
|
1754
1761
|
let t = e.split(/[^A-Za-z0-9]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
|
|
1755
1762
|
return /^[0-9]/.test(t) ? `_${t}` : t;
|
|
1756
1763
|
}
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
A("index.js"), A("index.d.ts"), E("src/index.ts", M("block/src/index.tpl.ts", (e) => ({
|
|
1764
|
+
// src/structure/rules/block.ts
|
|
1765
|
+
function ii() {
|
|
1766
|
+
S("block", () => {
|
|
1767
|
+
k("index.js"), k("index.d.ts"), T("src/index.ts", j("block/src/index.tpl.ts", (e) => ({
|
|
1762
1768
|
facadeName: e.blockVars.facadeName,
|
|
1763
|
-
pascalName:
|
|
1764
|
-
}))),
|
|
1765
|
-
|
|
1769
|
+
pascalName: ri(e.blockVars.shortName)
|
|
1770
|
+
}))), T("src/AGENTS.ts", A("block/src/AGENTS.ts")), D("src/block-extra.ts", A("block/src/block-extra.ts")), D("src/agents-extra.ts", A("block/src/agents-extra.ts")), T("tsconfig.json", A("block/tsconfig.json")), O("logos/block-logo.png", it("block/logos/block-logo.png")), O("logos/organization-logo.png", it("block/logos/organization-logo.png")), E("package.json", M((e) => ti(e)), (e) => {
|
|
1771
|
+
ni(e);
|
|
1766
1772
|
});
|
|
1767
1773
|
});
|
|
1768
1774
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
//#region src/structure/rules/model-package-json.ts
|
|
1774
|
-
function Gr(e) {
|
|
1775
|
+
// src/structure/rules/shared/colocated-tests.ts
|
|
1776
|
+
var $ = "src/**/*.test.ts", ai = "src/**/*.test.tengo";
|
|
1777
|
+
// src/structure/rules/model-package-json.ts
|
|
1778
|
+
function oi(e) {
|
|
1775
1779
|
return {
|
|
1776
1780
|
name: `${e.blockVars.facadeName}.model`,
|
|
1777
|
-
version:
|
|
1781
|
+
version: Z,
|
|
1778
1782
|
private: !0,
|
|
1779
1783
|
type: "module",
|
|
1780
1784
|
main: "dist/index.cjs",
|
|
@@ -1796,7 +1800,7 @@ function Gr(e) {
|
|
|
1796
1800
|
},
|
|
1797
1801
|
dependencies: {
|
|
1798
1802
|
"@platforma-sdk/model": "sdk:",
|
|
1799
|
-
...
|
|
1803
|
+
...J(e, "kind")
|
|
1800
1804
|
},
|
|
1801
1805
|
devDependencies: {
|
|
1802
1806
|
"@milaboratories/ts-builder": "sdk:",
|
|
@@ -1809,53 +1813,51 @@ function Gr(e) {
|
|
|
1809
1813
|
}
|
|
1810
1814
|
};
|
|
1811
1815
|
}
|
|
1812
|
-
function
|
|
1813
|
-
|
|
1816
|
+
function si() {
|
|
1817
|
+
Q(), R("private", !0), R("type", "module"), R("main", "dist/index.cjs"), R("module", "dist/index.js"), R("types", "dist/index.d.ts"), R("exports", {
|
|
1814
1818
|
".": {
|
|
1815
1819
|
types: "./dist/index.d.ts",
|
|
1816
1820
|
sources: "./src/index.ts",
|
|
1817
1821
|
import: "./dist/index.js"
|
|
1818
1822
|
},
|
|
1819
1823
|
"./dist/*": "./dist/*"
|
|
1820
|
-
}),
|
|
1824
|
+
}), B("fmt", "ts-builder format"), B("watch", "ts-builder build --target block-model --watch"), B("build", "ts-builder build --target block-model && block-tools build-model"), B("check", "ts-builder check --target block-model"), zt("@platforma-sdk/model", "sdk:"), Ut("kind"), W({
|
|
1821
1825
|
"@milaboratories/ts-builder": "sdk:",
|
|
1822
1826
|
"@milaboratories/ts-configs": "sdk:",
|
|
1823
1827
|
"@platforma-sdk/block-tools": "sdk:"
|
|
1824
|
-
}),
|
|
1828
|
+
}), Vt({
|
|
1825
1829
|
"@types/node": "*",
|
|
1826
1830
|
typescript: "*"
|
|
1827
|
-
}),
|
|
1828
|
-
|
|
1829
|
-
}, () =>
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
Kr();
|
|
1831
|
+
}), C(({ ctx: e }) => !e.isSdkInternal, () => C(w($), () => {
|
|
1832
|
+
B("test", "vitest run --passWithNoTests"), H("vitest", "catalog:"), H("@types/node", "*");
|
|
1833
|
+
}, () => U("vitest"))), br(), z("tsup"), V("lint"), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1834
|
+
}
|
|
1835
|
+
// src/structure/rules/model.ts
|
|
1836
|
+
function ci() {
|
|
1837
|
+
S("model", () => {
|
|
1838
|
+
C(w($), () => T("tsconfig.json", A("model/tsconfig.node.json")), () => T("tsconfig.json", A("model/tsconfig.json"))), T(".oxlintrc.json", A("model/.oxlintrc.json")), T(".oxfmtrc.json", A("model/.oxfmtrc.json")), O("src/index.ts", j("model/src/index.tpl.ts", (e) => ({ kindPkg: `${e.blockVars.facadeName}.kind` }))), E("package.json", M((e) => oi(e)), () => {
|
|
1839
|
+
si();
|
|
1837
1840
|
});
|
|
1838
1841
|
});
|
|
1839
1842
|
}
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
var Jr = { ".": {
|
|
1843
|
+
// src/structure/rules/kind-package-json.ts
|
|
1844
|
+
var li = { ".": {
|
|
1843
1845
|
types: "./dist/index.d.ts",
|
|
1844
1846
|
sources: "./src/index.ts",
|
|
1845
1847
|
import: "./dist/index.js",
|
|
1846
1848
|
require: "./dist/index.cjs",
|
|
1847
1849
|
default: "./dist/index.js"
|
|
1848
1850
|
} };
|
|
1849
|
-
function
|
|
1851
|
+
function ui(e) {
|
|
1850
1852
|
return {
|
|
1851
1853
|
name: `${e.blockVars.facadeName}.kind`,
|
|
1852
|
-
version:
|
|
1854
|
+
version: Z,
|
|
1853
1855
|
private: !0,
|
|
1854
1856
|
type: "module",
|
|
1855
1857
|
main: "./dist/index.cjs",
|
|
1856
1858
|
module: "./dist/index.js",
|
|
1857
1859
|
types: "./dist/index.d.ts",
|
|
1858
|
-
exports:
|
|
1860
|
+
exports: li,
|
|
1859
1861
|
scripts: {
|
|
1860
1862
|
fmt: "ts-builder format",
|
|
1861
1863
|
watch: "ts-builder build --target block-kind --watch",
|
|
@@ -1874,31 +1876,29 @@ function Yr(e) {
|
|
|
1874
1876
|
}
|
|
1875
1877
|
};
|
|
1876
1878
|
}
|
|
1877
|
-
function
|
|
1878
|
-
|
|
1879
|
+
function di() {
|
|
1880
|
+
Q(), R("private", !0), R("type", "module"), R("main", "./dist/index.cjs"), R("module", "./dist/index.js"), R("types", "./dist/index.d.ts"), R("exports", li), B("fmt", "ts-builder format"), B("watch", "ts-builder build --target block-kind --watch"), B("build", "ts-builder build --target block-kind && block-tools build-kind-manifest"), B("check", "ts-builder check --target block-kind"), V("lint"), zt("@platforma-sdk/block-kind", "sdk:"), W({
|
|
1879
1881
|
"@milaboratories/ts-builder": "sdk:",
|
|
1880
1882
|
"@milaboratories/ts-configs": "sdk:",
|
|
1881
1883
|
"@platforma-sdk/block-tools": "sdk:"
|
|
1882
|
-
}),
|
|
1884
|
+
}), Vt({
|
|
1883
1885
|
"@types/node": "*",
|
|
1884
1886
|
typescript: "*"
|
|
1885
|
-
}),
|
|
1886
|
-
}
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
Xr();
|
|
1887
|
+
}), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1888
|
+
}
|
|
1889
|
+
// src/structure/rules/kind.ts
|
|
1890
|
+
function fi() {
|
|
1891
|
+
S("kind", () => {
|
|
1892
|
+
T("tsconfig.json", A("kind/tsconfig.json")), T(".oxlintrc.json", A("kind/.oxlintrc.json")), T(".oxfmtrc.json", A("kind/.oxfmtrc.json")), D("src/index.ts", A("kind/src/index.ts")), E("package.json", M((e) => ui(e)), () => {
|
|
1893
|
+
di();
|
|
1893
1894
|
});
|
|
1894
1895
|
});
|
|
1895
1896
|
}
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
function Qr(e) {
|
|
1897
|
+
// src/structure/rules/ui-package-json.ts
|
|
1898
|
+
function pi(e) {
|
|
1899
1899
|
return {
|
|
1900
1900
|
name: `${e.blockVars.facadeName}.ui`,
|
|
1901
|
-
version:
|
|
1901
|
+
version: Z,
|
|
1902
1902
|
private: !0,
|
|
1903
1903
|
type: "module",
|
|
1904
1904
|
scripts: {
|
|
@@ -1911,7 +1911,7 @@ function Qr(e) {
|
|
|
1911
1911
|
dependencies: {
|
|
1912
1912
|
"@platforma-sdk/ui-vue": "sdk:",
|
|
1913
1913
|
vue: "catalog:",
|
|
1914
|
-
...
|
|
1914
|
+
...Pn(e, "model")
|
|
1915
1915
|
},
|
|
1916
1916
|
devDependencies: {
|
|
1917
1917
|
"@milaboratories/ts-builder": "sdk:",
|
|
@@ -1923,32 +1923,30 @@ function Qr(e) {
|
|
|
1923
1923
|
}
|
|
1924
1924
|
};
|
|
1925
1925
|
}
|
|
1926
|
-
function
|
|
1927
|
-
|
|
1926
|
+
function mi() {
|
|
1927
|
+
Q(), R("private", !0), R("type", "module"), B("fmt", "ts-builder format"), B("dev", "ts-builder serve --target block-ui"), B("watch", "ts-builder build --target block-ui --watch"), B("build", "ts-builder build --target block-ui"), B("check", "ts-builder check --target block-ui"), zt("@platforma-sdk/ui-vue", "sdk:"), zt("vue", "catalog:"), Ut("model"), W({
|
|
1928
1928
|
"@milaboratories/ts-builder": "sdk:",
|
|
1929
1929
|
"@milaboratories/ts-configs": "sdk:"
|
|
1930
|
-
}),
|
|
1930
|
+
}), br(), V("preview"), V("lint"), Vt({
|
|
1931
1931
|
"@types/node": "*",
|
|
1932
1932
|
typescript: "*"
|
|
1933
|
-
}),
|
|
1934
|
-
|
|
1935
|
-
}, () =>
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
$r();
|
|
1933
|
+
}), C(({ ctx: e }) => !e.isSdkInternal, () => C(w($), () => {
|
|
1934
|
+
B("test", "vitest run --passWithNoTests"), H("vitest", "catalog:"), H("@types/node", "*");
|
|
1935
|
+
}, () => U("vitest"))), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1936
|
+
}
|
|
1937
|
+
// src/structure/rules/ui.ts
|
|
1938
|
+
function hi() {
|
|
1939
|
+
S("ui", () => {
|
|
1940
|
+
C(w($), () => T("tsconfig.json", A("ui/tsconfig.node.json")), () => T("tsconfig.json", A("ui/tsconfig.json"))), T(".oxlintrc.json", A("ui/.oxlintrc.json")), T(".oxfmtrc.json", A("ui/.oxfmtrc.json")), D("index.html", A("ui/index.html")), O("src/main.ts", A("ui/src/main.ts")), O("src/app.ts", j("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), O("src/MainPage.vue", j("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), E("package.json", M((e) => pi(e)), () => {
|
|
1941
|
+
mi();
|
|
1943
1942
|
});
|
|
1944
1943
|
});
|
|
1945
1944
|
}
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
function ti(e) {
|
|
1945
|
+
// src/structure/rules/workflow-package-json.ts
|
|
1946
|
+
function gi(e) {
|
|
1949
1947
|
return {
|
|
1950
1948
|
name: `${e.blockVars.facadeName}.workflow`,
|
|
1951
|
-
version:
|
|
1949
|
+
version: Z,
|
|
1952
1950
|
private: !0,
|
|
1953
1951
|
type: "module",
|
|
1954
1952
|
scripts: {
|
|
@@ -1958,7 +1956,7 @@ function ti(e) {
|
|
|
1958
1956
|
},
|
|
1959
1957
|
dependencies: {
|
|
1960
1958
|
"@platforma-sdk/workflow-tengo": "sdk:",
|
|
1961
|
-
...
|
|
1959
|
+
...J(e, "software")
|
|
1962
1960
|
},
|
|
1963
1961
|
devDependencies: {
|
|
1964
1962
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
@@ -1967,36 +1965,34 @@ function ti(e) {
|
|
|
1967
1965
|
}
|
|
1968
1966
|
};
|
|
1969
1967
|
}
|
|
1970
|
-
function
|
|
1971
|
-
|
|
1972
|
-
w(
|
|
1968
|
+
function _i() {
|
|
1969
|
+
Q(), R("private", !0), R("type", "module"), B("build", "shx rm -rf dist && pl-tengo build"), B("check", "pl-tengo imports && pl-tengo check"), B("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), C(({ ctx: e }) => !e.isSdkInternal, () => C(w($), () => {
|
|
1970
|
+
C(w(ai), () => B("test", "pl-tengo test && vitest run --passWithNoTests"), () => B("test", "vitest run --passWithNoTests")), W({ vitest: "catalog:" });
|
|
1973
1971
|
}, () => {
|
|
1974
|
-
w(
|
|
1975
|
-
})),
|
|
1972
|
+
C(w(ai), () => B("test", "pl-tengo test")), U("vitest");
|
|
1973
|
+
})), zt("@platforma-sdk/workflow-tengo", "sdk:"), Ut("software"), W({
|
|
1976
1974
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1977
1975
|
"@platforma-sdk/test": "sdk:",
|
|
1978
1976
|
shx: "catalog:"
|
|
1979
|
-
}),
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
E("tsconfig.json", j("workflow/tsconfig.json")), O("vitest.config.mts", j("workflow/vitest.config.mts"));
|
|
1977
|
+
}), br(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1978
|
+
}
|
|
1979
|
+
// src/structure/rules/workflow.ts
|
|
1980
|
+
function vi() {
|
|
1981
|
+
S("workflow", () => {
|
|
1982
|
+
T("format.el", A("workflow/format.el")), C(({ ctx: e }) => !e.isSdkInternal, () => C(w($), () => {
|
|
1983
|
+
T("tsconfig.json", A("workflow/tsconfig.json")), D("vitest.config.mts", A("workflow/vitest.config.mts"));
|
|
1987
1984
|
}, () => {
|
|
1988
|
-
|
|
1989
|
-
})),
|
|
1990
|
-
|
|
1985
|
+
k("tsconfig.json"), k("vitest.config.mts");
|
|
1986
|
+
})), k("index.js"), k("index.d.ts"), O("src/main.tpl.tengo", j("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), E("package.json", M((e) => gi(e)), () => {
|
|
1987
|
+
_i();
|
|
1991
1988
|
});
|
|
1992
1989
|
});
|
|
1993
1990
|
}
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
function ii(e) {
|
|
1991
|
+
// src/structure/rules/test-package-json.ts
|
|
1992
|
+
function yi(e) {
|
|
1997
1993
|
return {
|
|
1998
1994
|
name: `${e.blockVars.facadeName}.test`,
|
|
1999
|
-
version:
|
|
1995
|
+
version: Z,
|
|
2000
1996
|
private: !0,
|
|
2001
1997
|
type: "module",
|
|
2002
1998
|
scripts: {
|
|
@@ -2013,27 +2009,25 @@ function ii(e) {
|
|
|
2013
2009
|
}
|
|
2014
2010
|
};
|
|
2015
2011
|
}
|
|
2016
|
-
function
|
|
2017
|
-
|
|
2012
|
+
function bi() {
|
|
2013
|
+
Q(), R("private", !0), R("type", "module"), B("fmt", "ts-builder format"), B("check", "ts-builder check --target block-test"), B("test", "vitest run --passWithNoTests"), V("lint"), W({
|
|
2018
2014
|
"@platforma-sdk/test": "sdk:",
|
|
2019
2015
|
"@milaboratories/ts-builder": "sdk:",
|
|
2020
2016
|
"@milaboratories/ts-configs": "sdk:",
|
|
2021
2017
|
vitest: "catalog:"
|
|
2022
|
-
}),
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
ai();
|
|
2018
|
+
}), Vt({ typescript: "*" }), U("@types/node"), br(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
2019
|
+
}
|
|
2020
|
+
// src/structure/rules/test.ts
|
|
2021
|
+
function xi() {
|
|
2022
|
+
S("test", () => {
|
|
2023
|
+
T("tsconfig.json", A("test/tsconfig.json")), T(".oxlintrc.json", A("test/.oxlintrc.json")), T(".oxfmtrc.json", A("test/.oxfmtrc.json")), D("vitest.config.mts", A("test/vitest.config.mts")), O("src/demo.test.ts", at("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), E("package.json", M((e) => yi(e)), () => {
|
|
2024
|
+
bi();
|
|
2030
2025
|
});
|
|
2031
2026
|
});
|
|
2032
2027
|
}
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
function li() {
|
|
2028
|
+
// src/structure/rules/software-package-json.ts
|
|
2029
|
+
var Si = "block-tools software build", Ci = "shx rm -f *.tgz && block-tools software build && pnpm pack && shx mv platforma-open*.tgz package.tgz";
|
|
2030
|
+
function wi() {
|
|
2037
2031
|
return { entrypoints: { main: { binary: {
|
|
2038
2032
|
artifact: {
|
|
2039
2033
|
type: "python",
|
|
@@ -2048,92 +2042,88 @@ function li() {
|
|
|
2048
2042
|
cmd: ["python", "{pkg}/main.py"]
|
|
2049
2043
|
} } } };
|
|
2050
2044
|
}
|
|
2051
|
-
function
|
|
2045
|
+
function Ti(e) {
|
|
2052
2046
|
return {
|
|
2053
2047
|
name: `${e.blockVars.facadeName}.software`,
|
|
2054
|
-
version:
|
|
2048
|
+
version: Z,
|
|
2055
2049
|
type: "module",
|
|
2056
2050
|
description: "Block Software",
|
|
2057
2051
|
files: ["./dist/**/*"],
|
|
2058
2052
|
scripts: {
|
|
2059
|
-
build:
|
|
2060
|
-
"do-pack":
|
|
2053
|
+
build: Si,
|
|
2054
|
+
"do-pack": Ci,
|
|
2061
2055
|
changeset: "changeset",
|
|
2062
2056
|
"version-packages": "changeset version"
|
|
2063
2057
|
},
|
|
2064
|
-
"block-software":
|
|
2058
|
+
"block-software": wi(),
|
|
2065
2059
|
devDependencies: {
|
|
2066
2060
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
2067
2061
|
"@platforma-sdk/block-tools": "sdk:"
|
|
2068
2062
|
}
|
|
2069
2063
|
};
|
|
2070
2064
|
}
|
|
2071
|
-
function
|
|
2072
|
-
|
|
2065
|
+
function Ei() {
|
|
2066
|
+
z("private"), Q(), R("type", "module"), R("files", ["./dist/**/*"]), B("build", Si), B("do-pack", Ci), V("prepublishOnly"), B("changeset", "changeset"), B("version-packages", "changeset version"), H("@platforma-open/milaboratories.runenv-python-3", "catalog:"), H("@platforma-sdk/block-tools", "sdk:"), U("@platforma-sdk/package-builder"), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
2073
2067
|
}
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
di();
|
|
2068
|
+
// src/structure/rules/software.ts
|
|
2069
|
+
var Di = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", Oi = "# No dependencies specified for this script\n";
|
|
2070
|
+
function ki() {
|
|
2071
|
+
S("software", () => {
|
|
2072
|
+
O("src/main.py", at(Di)), O("src/requirements.txt", at(Oi)), E("package.json", M((e) => Ti(e)), () => {
|
|
2073
|
+
Ei();
|
|
2081
2074
|
});
|
|
2082
2075
|
});
|
|
2083
2076
|
}
|
|
2084
|
-
function
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
}),
|
|
2088
|
-
|
|
2089
|
-
}),
|
|
2090
|
-
|
|
2091
|
-
}),
|
|
2092
|
-
|
|
2093
|
-
|
|
2077
|
+
function Ai() {
|
|
2078
|
+
S("model", () => {
|
|
2079
|
+
k("eslint.config.mjs"), k("vite.config.mts");
|
|
2080
|
+
}), S("ui", () => {
|
|
2081
|
+
k("eslint.config.mjs"), k("vite.config.ts"), k("tsconfig.app.json"), k("tsconfig.node.json");
|
|
2082
|
+
}), S("test", () => {
|
|
2083
|
+
k("eslint.config.mjs");
|
|
2084
|
+
}), S("root", () => {
|
|
2085
|
+
k(".prettierrc"), E("package.json", M(() => $n()), () => {
|
|
2086
|
+
V("pretty"), U("@platforma-sdk/blocks-deps-updater");
|
|
2094
2087
|
});
|
|
2095
2088
|
});
|
|
2096
2089
|
}
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
for (let e of
|
|
2105
|
-
for (let e of lr) Jt(e.entry, {
|
|
2090
|
+
// src/structure/rules/root-catalog-bump.ts
|
|
2091
|
+
function ji() {
|
|
2092
|
+
rt(() => {
|
|
2093
|
+
S("root", () => {
|
|
2094
|
+
C(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
2095
|
+
E("pnpm-workspace.yaml", M((e) => Dr(e)), (e) => {
|
|
2096
|
+
for (let e of xr) Qt(e);
|
|
2097
|
+
for (let e of wr) $t(e.entry, {
|
|
2106
2098
|
of: e.of,
|
|
2107
2099
|
ofVersion: e.ofVersion
|
|
2108
2100
|
});
|
|
2109
|
-
for (let [e, t] of Object.entries(
|
|
2110
|
-
e.modules.some((e) => e.scope === "software") &&
|
|
2101
|
+
for (let [e, t] of Object.entries(Cr)) Zt(e, t);
|
|
2102
|
+
e.modules.some((e) => e.scope === "software") && Zt(Tr, Er);
|
|
2111
2103
|
});
|
|
2112
2104
|
});
|
|
2113
2105
|
});
|
|
2114
2106
|
});
|
|
2115
2107
|
}
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
Or(), Ar(), Ur(), qr(), Zr(), ei(), ri(), oi(), mi(), hi(), gi();
|
|
2108
|
+
// src/structure/structure-definition.ts
|
|
2109
|
+
var Mi = Xe(() => {
|
|
2110
|
+
Ur(), Gr(), ii(), ci(), fi(), hi(), vi(), xi(), ki(), Ai(), ji();
|
|
2120
2111
|
});
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
return tr(or.filter(er));
|
|
2112
|
+
// src/structure/cli/run-structure.ts
|
|
2113
|
+
async function Ni() {
|
|
2114
|
+
return gr(xr.filter(hr));
|
|
2125
2115
|
}
|
|
2126
|
-
async function
|
|
2127
|
-
let t = g.resolve(e.blockPath), n = e.mode === "check", r = new
|
|
2116
|
+
async function Pi(e) {
|
|
2117
|
+
let t = g.resolve(e.blockPath), n = e.mode === "check", r = new Ne(t), i = new Pe(e.templatesRoot), a = En(Mi, r, Un({
|
|
2128
2118
|
fs: r,
|
|
2129
2119
|
isSdkInternal: e.isSdkInternal,
|
|
2130
2120
|
updateDepsOnly: e.updateDepsOnly,
|
|
2131
2121
|
dryRun: n
|
|
2132
2122
|
}), {
|
|
2133
2123
|
templates: i,
|
|
2134
|
-
registryLookup: e.updateDepsOnly ? await
|
|
2135
|
-
derivedPinLookup: e.updateDepsOnly ? await
|
|
2136
|
-
rediscover: () =>
|
|
2124
|
+
registryLookup: e.updateDepsOnly ? await Ni() : void 0,
|
|
2125
|
+
derivedPinLookup: e.updateDepsOnly ? await vr(wr) : void 0,
|
|
2126
|
+
rediscover: () => Un({
|
|
2137
2127
|
fs: r,
|
|
2138
2128
|
isSdkInternal: e.isSdkInternal,
|
|
2139
2129
|
updateDepsOnly: !1,
|
|
@@ -2145,16 +2135,15 @@ async function yi(e) {
|
|
|
2145
2135
|
changes: a.changes
|
|
2146
2136
|
};
|
|
2147
2137
|
}
|
|
2148
|
-
function
|
|
2138
|
+
function Fi(e, t) {
|
|
2149
2139
|
if (t.length === 0) return ` ${e}: up to date (0 changes)`;
|
|
2150
2140
|
let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
|
|
2151
2141
|
return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
|
|
2152
2142
|
}
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
async function xi(e) {
|
|
2143
|
+
// src/cmd/structure/refresh.ts
|
|
2144
|
+
async function Ii(e) {
|
|
2156
2145
|
for (let t of e.paths) {
|
|
2157
|
-
let n = await
|
|
2146
|
+
let n = await Pi({
|
|
2158
2147
|
blockPath: t,
|
|
2159
2148
|
isSdkInternal: e.isSdkInternal,
|
|
2160
2149
|
updateDepsOnly: e.updateDepsOnly,
|
|
@@ -2162,14 +2151,14 @@ async function xi(e) {
|
|
|
2162
2151
|
templatesRoot: e.templatesRoot,
|
|
2163
2152
|
log: (t) => e.logger.info(t)
|
|
2164
2153
|
});
|
|
2165
|
-
e.logger.info(
|
|
2154
|
+
e.logger.info(Fi(t, n.changes));
|
|
2166
2155
|
}
|
|
2167
2156
|
}
|
|
2168
|
-
function
|
|
2157
|
+
function Li(e) {
|
|
2169
2158
|
let t = new m("refresh").description("Bring block(s) up to date with the canonical structure. Applies rules, writes files, bumps .structure version. Default mode is offline; --update-deps-only fires only catalog-bump rules (network).");
|
|
2170
2159
|
return t.argument("[paths...]", "block path(s); defaults to the current directory"), t.option("--sdk-internal", "block(s) live inside the SDK monorepo; skip root-scope rules"), t.option("--update-deps-only", "fire ONLY catalog-bump rules (npm network). Follow with `pnpm install` then a plain refresh."), t.action(async (t, n) => {
|
|
2171
2160
|
let r = t.length > 0 ? t : ["."], i = g.join(e, "src", "structure", "templates");
|
|
2172
|
-
await
|
|
2161
|
+
await Ii({
|
|
2173
2162
|
paths: r,
|
|
2174
2163
|
isSdkInternal: !!n.sdkInternal,
|
|
2175
2164
|
updateDepsOnly: !!n.updateDepsOnly,
|
|
@@ -2178,13 +2167,12 @@ function Si(e) {
|
|
|
2178
2167
|
});
|
|
2179
2168
|
}), t;
|
|
2180
2169
|
}
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
function Ci(e) {
|
|
2170
|
+
// src/cmd/update-deps.ts
|
|
2171
|
+
function Ri(e) {
|
|
2184
2172
|
let t = new m("update-deps").description("[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.");
|
|
2185
2173
|
return t.action(async () => {
|
|
2186
2174
|
let t = new b();
|
|
2187
|
-
t.warn("`block-tools update-deps` is deprecated and will be removed in a future release. Use `block-tools structure refresh --update-deps-only` instead. Delegating now."), await
|
|
2175
|
+
t.warn("`block-tools update-deps` is deprecated and will be removed in a future release. Use `block-tools structure refresh --update-deps-only` instead. Delegating now."), await Ii({
|
|
2188
2176
|
paths: ["."],
|
|
2189
2177
|
isSdkInternal: !1,
|
|
2190
2178
|
updateDepsOnly: !0,
|
|
@@ -2193,27 +2181,25 @@ function Ci(e) {
|
|
|
2193
2181
|
});
|
|
2194
2182
|
}), t;
|
|
2195
2183
|
}
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
function wi() {
|
|
2184
|
+
// src/cmd/list-overview-snapshots.ts
|
|
2185
|
+
function zi() {
|
|
2199
2186
|
let e = new m("list-overview-snapshots").description("List all available global overview snapshots in the registry");
|
|
2200
2187
|
return e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.option("--json", "output in JSON format", !1), e.action(async (e) => {
|
|
2201
|
-
let t = new b(), n =
|
|
2202
|
-
if (e.json) t.info(JSON.stringify(
|
|
2203
|
-
else if (
|
|
2188
|
+
let t = new b(), n = l(e.registry), r = await new p(n, t).listGlobalOverviewSnapshots();
|
|
2189
|
+
if (e.json) t.info(JSON.stringify(r, null, 2));
|
|
2190
|
+
else if (r.length === 0) t.info("No snapshots found.");
|
|
2204
2191
|
else {
|
|
2205
|
-
t.info(`Found ${
|
|
2206
|
-
for (let e of
|
|
2192
|
+
t.info(`Found ${r.length} snapshot(s):\n`);
|
|
2193
|
+
for (let e of r) t.info(` ${e.timestamp}`), t.info(` Path: ${e.path}`), t.info("");
|
|
2207
2194
|
}
|
|
2208
2195
|
}), e;
|
|
2209
2196
|
}
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
function Ti() {
|
|
2197
|
+
// src/cmd/restore-overview-from-snapshot.ts
|
|
2198
|
+
function Bi() {
|
|
2213
2199
|
let e = new m("restore-overview-from-snapshot").description("Restore global overview from a snapshot");
|
|
2214
2200
|
return e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.requiredOption("-s, --snapshot <timestamp>", "snapshot timestamp ID to restore from"), e.option("--skip-confirmation", "skip confirmation prompt (use with caution)", !1), e.action(async (e) => {
|
|
2215
|
-
let t = new b(), n =
|
|
2216
|
-
if (!
|
|
2201
|
+
let t = new b(), n = l(e.registry), r = new p(n, t), i = await r.listGlobalOverviewSnapshots();
|
|
2202
|
+
if (!i.find((t) => t.timestamp === e.snapshot)) throw Error(`Snapshot '${e.snapshot}' not found. Available snapshots:\n${i.map((e) => ` - ${e.timestamp}`).join("\n") || " (none)"}`);
|
|
2217
2203
|
if (!e.skipConfirmation) {
|
|
2218
2204
|
let n = (await import("node:readline")).createInterface({
|
|
2219
2205
|
input: process.stdin,
|
|
@@ -2227,15 +2213,14 @@ function Ti() {
|
|
|
2227
2213
|
}
|
|
2228
2214
|
}
|
|
2229
2215
|
try {
|
|
2230
|
-
await
|
|
2216
|
+
await r.restoreGlobalOverviewFromSnapshot(e.snapshot), t.info(`✅ Successfully restored global overview from snapshot '${e.snapshot}'`);
|
|
2231
2217
|
} catch (e) {
|
|
2232
2218
|
throw Error(`Failed to restore from snapshot: ${String(e)}`);
|
|
2233
2219
|
}
|
|
2234
2220
|
}), e;
|
|
2235
2221
|
}
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
function Ei(e) {
|
|
2222
|
+
// src/registry_v1/flags.ts
|
|
2223
|
+
function Vi(e) {
|
|
2239
2224
|
let t = e.match(/(?<destName>[^/\\]+)=(?<src>.*)/);
|
|
2240
2225
|
if (t) {
|
|
2241
2226
|
let { src: e, destName: n } = t.groups;
|
|
@@ -2243,31 +2228,31 @@ function Ei(e) {
|
|
|
2243
2228
|
src: e,
|
|
2244
2229
|
destName: n
|
|
2245
2230
|
};
|
|
2246
|
-
}
|
|
2231
|
+
}
|
|
2232
|
+
return {
|
|
2247
2233
|
src: e,
|
|
2248
2234
|
destName: g.basename(e)
|
|
2249
2235
|
};
|
|
2250
2236
|
}
|
|
2251
|
-
function
|
|
2252
|
-
return new h(e, t).argParser((e, t) => [...t ?? [],
|
|
2237
|
+
function Hi(e, t) {
|
|
2238
|
+
return new h(e, t).argParser((e, t) => [...t ?? [], Vi(e)]).default([]);
|
|
2253
2239
|
}
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
var Oi = [
|
|
2240
|
+
// src/cmd/upload-package-v1.ts
|
|
2241
|
+
var Ui = [
|
|
2257
2242
|
"registry",
|
|
2258
2243
|
"organization",
|
|
2259
2244
|
"package",
|
|
2260
2245
|
"version"
|
|
2261
2246
|
];
|
|
2262
|
-
function
|
|
2247
|
+
function Wi() {
|
|
2263
2248
|
let e = new m("upload-package-v1").description("Uploads V1 package and refreshes the registry");
|
|
2264
|
-
return e.addOption(new h("-r, --registry <address|alias>", "full address of the registry or alias from .pl.reg").env("PL_REGISTRY")), e.addOption(new h("-o, --organization <organization>", "target organisation").env("PL_PACKAGE_ORGANIZATION")), e.addOption(new h("-p, --package <package>", "target package").env("PL_PACKAGE_NAME")), e.addOption(new h("-v, --version <version>", "target version").env("PL_PACKAGE_VERSION")), e.option("-m, --meta <path>", "json file containing meta information to associate with tha package"), e.addOption(
|
|
2249
|
+
return e.addOption(new h("-r, --registry <address|alias>", "full address of the registry or alias from .pl.reg").env("PL_REGISTRY")), e.addOption(new h("-o, --organization <organization>", "target organisation").env("PL_PACKAGE_ORGANIZATION")), e.addOption(new h("-p, --package <package>", "target package").env("PL_PACKAGE_NAME")), e.addOption(new h("-v, --version <version>", "target version").env("PL_PACKAGE_VERSION")), e.option("-m, --meta <path>", "json file containing meta information to associate with tha package"), e.addOption(Hi("-f, --file <file>", "package files")), e.addOption(new h("--refresh", "refresh repository after adding the package").default(!0).env("PL_REGISTRY_REFRESH")), e.option("--no-refresh", "do not refresh repository after adding the package"), e.action(async (e) => {
|
|
2265
2250
|
let t = new b(), n = f.parse({});
|
|
2266
|
-
for (let t of
|
|
2267
|
-
e.meta && (e.meta.endsWith(".json") ? n.meta = JSON.parse(await _.promises.readFile(e.meta, { encoding: "utf-8" })) : e.meta.endsWith(".yaml") && (n.meta =
|
|
2251
|
+
for (let t of Ui) e[t] && (n[t] = e[t]);
|
|
2252
|
+
e.meta && (e.meta.endsWith(".json") ? n.meta = JSON.parse(await _.promises.readFile(e.meta, { encoding: "utf-8" })) : e.meta.endsWith(".yaml") && (n.meta = ue.parse(await _.promises.readFile(e.meta, { encoding: "utf-8" }))));
|
|
2268
2253
|
for (let t of e.file) n.files[t.destName] = t.src;
|
|
2269
2254
|
let r = await d(n);
|
|
2270
|
-
t.info(
|
|
2255
|
+
t.info(ue.stringify(r.conf));
|
|
2271
2256
|
let i = r.createRegistry(t), a = r.fullPackageName, o = i.constructNewPackage(a);
|
|
2272
2257
|
for (let [e, n] of Object.entries(r.conf.files)) {
|
|
2273
2258
|
t.info(`Uploading ${n} -> ${e} ...`);
|
|
@@ -2277,14 +2262,13 @@ function ki() {
|
|
|
2277
2262
|
t.info("Uploading meta information..."), await o.writeMeta(r.conf.meta), await o.finish(), e.refresh && await i.updateIfNeeded();
|
|
2278
2263
|
}), e;
|
|
2279
2264
|
}
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
function Ai(e) {
|
|
2265
|
+
// src/cmd/structure/check.ts
|
|
2266
|
+
function Gi(e) {
|
|
2283
2267
|
let t = new m("check").description("Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.");
|
|
2284
2268
|
return t.argument("[paths...]", "block path(s); defaults to the current directory"), t.option("--sdk-internal", "block(s) live inside the SDK monorepo; skip root-scope rules"), t.action(async (t, n) => {
|
|
2285
2269
|
let r = new b(), i = t.length > 0 ? t : ["."], a = g.join(e, "src", "structure", "templates"), o = !1;
|
|
2286
2270
|
for (let e of i) {
|
|
2287
|
-
let t = await
|
|
2271
|
+
let t = await Pi({
|
|
2288
2272
|
blockPath: e,
|
|
2289
2273
|
isSdkInternal: !!n.sdkInternal,
|
|
2290
2274
|
updateDepsOnly: !1,
|
|
@@ -2292,41 +2276,40 @@ function Ai(e) {
|
|
|
2292
2276
|
templatesRoot: a,
|
|
2293
2277
|
log: (e) => r.info(e)
|
|
2294
2278
|
});
|
|
2295
|
-
r.info(
|
|
2279
|
+
r.info(Fi(e, t.changes)), t.changes.length > 0 && (o = !0);
|
|
2296
2280
|
}
|
|
2297
2281
|
if (o) throw Error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.");
|
|
2298
2282
|
}), t;
|
|
2299
2283
|
}
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
var $ = ["python"], ji = class extends Error {
|
|
2284
|
+
// src/structure/init-block-constructor.ts
|
|
2285
|
+
var Ki = ["python"], qi = class extends Error {
|
|
2303
2286
|
constructor(e) {
|
|
2304
2287
|
super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
|
|
2305
2288
|
}
|
|
2306
2289
|
};
|
|
2307
|
-
async function
|
|
2290
|
+
async function Ji(e, t, n, r) {
|
|
2308
2291
|
if (e !== void 0 && e !== "") return e;
|
|
2309
|
-
if (n) throw new
|
|
2292
|
+
if (n) throw new qi(t);
|
|
2310
2293
|
return r();
|
|
2311
2294
|
}
|
|
2312
|
-
async function
|
|
2313
|
-
let t = await
|
|
2295
|
+
async function Yi(e) {
|
|
2296
|
+
let t = await Ji(e.npmOrg, "npm-org", e.nonInteractive, () => ye({
|
|
2314
2297
|
message: "npm org (e.g. @platforma-open):",
|
|
2315
2298
|
default: "@platforma-open"
|
|
2316
|
-
})), n = await
|
|
2317
|
-
i = e.withSoftware === void 0 ? e.nonInteractive
|
|
2299
|
+
})), n = await Ji(e.orgScope, "org-scope", e.nonInteractive, () => ye({ message: "org scope (e.g. my-org):" })), r = await Ji(e.shortName, "short-name", e.nonInteractive, () => ye({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
|
|
2300
|
+
i = e.withSoftware === void 0 ? !e.nonInteractive && await ve({
|
|
2318
2301
|
message: "Include a software module?",
|
|
2319
2302
|
default: !1
|
|
2320
2303
|
}) : e.withSoftware;
|
|
2321
2304
|
let a;
|
|
2322
2305
|
if (i) {
|
|
2323
|
-
if (a = await
|
|
2306
|
+
if (a = await Ji(e.platform, "platform", e.nonInteractive, () => be({
|
|
2324
2307
|
message: "Software platform:",
|
|
2325
|
-
choices:
|
|
2308
|
+
choices: Ki.map((e) => ({
|
|
2326
2309
|
name: e,
|
|
2327
2310
|
value: e
|
|
2328
2311
|
}))
|
|
2329
|
-
})),
|
|
2312
|
+
})), !Ki.includes(a)) throw Error(`Unsupported --platform '${a}'. Only ${Ki.join(", ")} ${Ki.length === 1 ? "is" : "are"} supported at v1.`);
|
|
2330
2313
|
} else if (e.platform) throw Error("--platform was given but software is disabled (--no-software).");
|
|
2331
2314
|
return {
|
|
2332
2315
|
facadeName: `${t}/${n}.${r}`,
|
|
@@ -2337,34 +2320,33 @@ async function Ni(e) {
|
|
|
2337
2320
|
softwarePlatform: a
|
|
2338
2321
|
};
|
|
2339
2322
|
}
|
|
2340
|
-
async function
|
|
2341
|
-
let t = e.vars, n =
|
|
2323
|
+
async function Xi(e) {
|
|
2324
|
+
let t = e.vars, n = Fn(t), r = new Ne(e.blockPath), i = new Pe(e.templatesRoot), a = In({
|
|
2342
2325
|
blockVars: t,
|
|
2343
2326
|
modules: n,
|
|
2344
2327
|
isSdkInternal: !1,
|
|
2345
2328
|
version: 3,
|
|
2346
2329
|
dryRun: !1
|
|
2347
|
-
}), o =
|
|
2330
|
+
}), o = xr.filter(hr), s, c;
|
|
2348
2331
|
try {
|
|
2349
|
-
s = await
|
|
2332
|
+
s = await gr(o), c = await vr(wr);
|
|
2350
2333
|
} catch (e) {
|
|
2351
2334
|
throw Error(`init requires network access to resolve SDK catalog versions from npm, but the registry lookup failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
2352
2335
|
}
|
|
2353
|
-
return
|
|
2336
|
+
return En(Mi, r, a, {
|
|
2354
2337
|
templates: i,
|
|
2355
2338
|
initMode: !0,
|
|
2356
2339
|
registryLookup: s,
|
|
2357
2340
|
derivedPinLookup: c
|
|
2358
2341
|
}), e.log(`Initialised block '${t.facadeName}'${t.softwarePlatform ? ` (software: ${t.softwarePlatform})` : " (no software)"} at ${e.blockPath}`), t;
|
|
2359
2342
|
}
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
function Fi(e) {
|
|
2343
|
+
// src/cmd/structure/init.ts
|
|
2344
|
+
function Zi(e) {
|
|
2363
2345
|
let t = new m("init").description("Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.");
|
|
2364
|
-
return t.argument("[path]", "target directory (default: <short-name> under the current directory)"), t.option("--npm-org <org>", "npm org, e.g. @platforma-open"), t.option("--org-scope <scope>", "org scope, e.g. my-org"), t.option("--short-name <name>", "block short name, e.g. mixcr-clonotyping"), t.option("--with-software", "include a software module"), t.option("--no-software", "omit the software module"), t.addOption(new h("--platform <platform>", "software platform (single-valued)").choices([
|
|
2346
|
+
return t.argument("[path]", "target directory (default: <short-name> under the current directory)"), t.option("--npm-org <org>", "npm org, e.g. @platforma-open"), t.option("--org-scope <scope>", "org scope, e.g. my-org"), t.option("--short-name <name>", "block short name, e.g. mixcr-clonotyping"), t.option("--with-software", "include a software module"), t.option("--no-software", "omit the software module"), t.addOption(new h("--platform <platform>", "software platform (single-valued)").choices([...Ki])), t.option("--non-interactive", "error on any missing flag instead of prompting"), t.action(async (t, n) => {
|
|
2365
2347
|
let r = new b(), i = n.withSoftware === !0, a = n.software === !1;
|
|
2366
2348
|
if (i && a) throw Error("--with-software and --no-software are mutually exclusive.");
|
|
2367
|
-
let o = i ? !0 : a
|
|
2349
|
+
let o = i ? !0 : !a && void 0, s = await Yi({
|
|
2368
2350
|
npmOrg: n.npmOrg,
|
|
2369
2351
|
orgScope: n.orgScope,
|
|
2370
2352
|
shortName: n.shortName,
|
|
@@ -2372,7 +2354,7 @@ function Fi(e) {
|
|
|
2372
2354
|
platform: n.platform,
|
|
2373
2355
|
nonInteractive: n.nonInteractive
|
|
2374
2356
|
});
|
|
2375
|
-
await
|
|
2357
|
+
await Xi({
|
|
2376
2358
|
vars: s,
|
|
2377
2359
|
blockPath: t ? g.resolve(t) : g.resolve(process.cwd(), s.shortName),
|
|
2378
2360
|
templatesRoot: g.join(e, "src", "structure", "templates"),
|
|
@@ -2380,15 +2362,14 @@ function Fi(e) {
|
|
|
2380
2362
|
});
|
|
2381
2363
|
}), t;
|
|
2382
2364
|
}
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
var Ii = ["dev", "release"], Li = [
|
|
2365
|
+
// src/cmd/software/knobs.ts
|
|
2366
|
+
var Qi = ["dev", "release"], $i = [
|
|
2386
2367
|
"docker",
|
|
2387
2368
|
"binary",
|
|
2388
2369
|
"all",
|
|
2389
2370
|
"none"
|
|
2390
|
-
],
|
|
2391
|
-
function
|
|
2371
|
+
], ea = ["local", "remote"];
|
|
2372
|
+
function ta(e) {
|
|
2392
2373
|
if (e.usePublished) {
|
|
2393
2374
|
if (e.variant === "docker" || e.variant === "all") throw y.CLIError(`--use-published is binary-only and cannot be combined with --variant ${e.variant}`);
|
|
2394
2375
|
return { kind: "binary-existing" };
|
|
@@ -2400,35 +2381,34 @@ function zi(e) {
|
|
|
2400
2381
|
location: e.location
|
|
2401
2382
|
};
|
|
2402
2383
|
}
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
function Hi(e) {
|
|
2384
|
+
// src/cmd/software/ecr-login.ts
|
|
2385
|
+
var na = "public.ecr.aws", ra = "us-east-1";
|
|
2386
|
+
function ia(e) {
|
|
2407
2387
|
if (process.env.AWS_ACCESS_KEY_ID || process.env.AWS_PROFILE) return;
|
|
2408
|
-
let t = process.env.PL_AWS_PROFILE ??
|
|
2388
|
+
let t = process.env.PL_AWS_PROFILE ?? le.AWS_DEV_PROFILE;
|
|
2409
2389
|
process.env.AWS_PROFILE = t, e?.debug(`Using AWS profile '${t}' for dev push credentials`);
|
|
2410
2390
|
}
|
|
2411
|
-
function
|
|
2391
|
+
function aa(e) {
|
|
2412
2392
|
return new URL(`https://${e}`).hostname;
|
|
2413
2393
|
}
|
|
2414
|
-
function
|
|
2415
|
-
return ` aws sso login --profile ${process.env.AWS_PROFILE ?? process.env.PL_AWS_PROFILE ??
|
|
2394
|
+
function oa() {
|
|
2395
|
+
return ` aws sso login --profile ${process.env.AWS_PROFILE ?? process.env.PL_AWS_PROFILE ?? le.AWS_DEV_PROFILE}`;
|
|
2416
2396
|
}
|
|
2417
|
-
async function
|
|
2418
|
-
let n =
|
|
2419
|
-
if (n !==
|
|
2397
|
+
async function sa(e, t) {
|
|
2398
|
+
let n = aa(e);
|
|
2399
|
+
if (n !== na) throw y.CLIError(`automatic docker login is only supported for '${na}', not '${n}'.\nLog in manually, or drop the ecr:// scheme from the push target to opt out.`);
|
|
2420
2400
|
t?.info(`Logging in to ECR registry '${n}'...`);
|
|
2421
2401
|
let r, i;
|
|
2422
2402
|
try {
|
|
2423
|
-
let e = (await new
|
|
2403
|
+
let e = (await new Se({ region: ra }).send(new Ce({}))).authorizationData?.authorizationToken;
|
|
2424
2404
|
if (!e) throw Error("empty authorization token");
|
|
2425
2405
|
let t = Buffer.from(e, "base64").toString("utf8"), n = t.indexOf(":");
|
|
2426
2406
|
if (n < 0) throw Error("malformed authorization token (no ':' separator)");
|
|
2427
2407
|
r = t.slice(0, n), i = t.slice(n + 1);
|
|
2428
2408
|
} catch (e) {
|
|
2429
|
-
throw y.CLIError(`failed to obtain an ECR login token for '${n}': ${e instanceof Error ? e.message : String(e)}\nYour AWS/SSO session is likely expired or absent — log in and retry:\n` +
|
|
2409
|
+
throw y.CLIError(`failed to obtain an ECR login token for '${n}': ${e instanceof Error ? e.message : String(e)}\nYour AWS/SSO session is likely expired or absent — log in and retry:\n` + oa());
|
|
2430
2410
|
}
|
|
2431
|
-
let a =
|
|
2411
|
+
let a = xe("docker", [
|
|
2432
2412
|
"login",
|
|
2433
2413
|
"--username",
|
|
2434
2414
|
r,
|
|
@@ -2443,16 +2423,15 @@ async function Gi(e, t) {
|
|
|
2443
2423
|
],
|
|
2444
2424
|
env: {
|
|
2445
2425
|
...process.env,
|
|
2446
|
-
HOME: process.env.HOME ||
|
|
2426
|
+
HOME: process.env.HOME || _e.homedir()
|
|
2447
2427
|
}
|
|
2448
2428
|
});
|
|
2449
2429
|
if (a.error || a.status !== 0) throw y.CLIError(`'docker login ${n}' failed`);
|
|
2450
2430
|
}
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
async function Ki(e) {
|
|
2431
|
+
// src/cmd/software/run-build.ts
|
|
2432
|
+
async function ca(e) {
|
|
2454
2433
|
let { core: t, scenario: n, options: r = {}, logger: i } = e, a = r.ids;
|
|
2455
|
-
t.buildMode =
|
|
2434
|
+
t.buildMode = ua(n), la(n) || t.assertDockerCoverage();
|
|
2456
2435
|
let o = () => t.buildSoftwareArchives({
|
|
2457
2436
|
ids: a,
|
|
2458
2437
|
forceBuild: !!r.force,
|
|
@@ -2477,12 +2456,12 @@ async function Ki(e) {
|
|
|
2477
2456
|
});
|
|
2478
2457
|
break;
|
|
2479
2458
|
case "target": {
|
|
2480
|
-
let { channel: e, variant: s, location: c } = n, l = s !== "binary", u = s !== "docker", d = c === "remote", f =
|
|
2459
|
+
let { channel: e, variant: s, location: c } = n, l = s !== "binary", u = s !== "docker", d = c === "remote", f = pa(e, r);
|
|
2481
2460
|
l && t.buildDockerImages({
|
|
2482
2461
|
ids: a,
|
|
2483
2462
|
registry: f.pull,
|
|
2484
2463
|
strictPlatformMatching: v.isCI()
|
|
2485
|
-
}), u && await o(), d && e === "dev" && (l || u) &&
|
|
2464
|
+
}), u && await o(), d && e === "dev" && (l || u) && ia(i), l && d && (f.autoLogin && f.push && await sa(f.push, i), t.publishDockerImages({
|
|
2486
2465
|
ids: a,
|
|
2487
2466
|
pushTo: f.push,
|
|
2488
2467
|
strictPlatformMatching: v.isCI()
|
|
@@ -2497,46 +2476,44 @@ async function Ki(e) {
|
|
|
2497
2476
|
t.buildSwJsonFiles({
|
|
2498
2477
|
packageIds: a,
|
|
2499
2478
|
noSoftware: n.kind === "no-software",
|
|
2500
|
-
skipDockerCoverage:
|
|
2479
|
+
skipDockerCoverage: la(n)
|
|
2501
2480
|
});
|
|
2502
2481
|
}
|
|
2503
|
-
function
|
|
2482
|
+
function la(e) {
|
|
2504
2483
|
return e.kind === "no-software" || e.kind === "binary-existing";
|
|
2505
2484
|
}
|
|
2506
|
-
function
|
|
2485
|
+
function ua(e) {
|
|
2507
2486
|
return e.kind !== "target" || e.channel === "release" ? "release" : e.variant !== "docker" && e.location === "remote" ? "dev-remote" : "dev-local";
|
|
2508
2487
|
}
|
|
2509
|
-
function
|
|
2488
|
+
function da(e) {
|
|
2510
2489
|
if (!e.includes("://")) return e;
|
|
2511
2490
|
let t = new URL(e);
|
|
2512
2491
|
return t.host + t.pathname;
|
|
2513
2492
|
}
|
|
2514
|
-
function
|
|
2493
|
+
function fa(e) {
|
|
2515
2494
|
return {
|
|
2516
|
-
registry:
|
|
2495
|
+
registry: da(e),
|
|
2517
2496
|
autoLogin: e.startsWith("ecr://")
|
|
2518
2497
|
};
|
|
2519
2498
|
}
|
|
2520
|
-
function
|
|
2521
|
-
let n = e === "dev", r = process.env[n ? v.PL_DEV_DOCKER_PUSH_URL : v.PL_RELEASE_DOCKER_PUSH_URL], i = process.env[n ? v.PL_DEV_DOCKER_PULL_URL : v.PL_RELEASE_DOCKER_PULL_URL], a = t.dockerPushTo ?? r ?? (n ?
|
|
2499
|
+
function pa(e, t) {
|
|
2500
|
+
let n = e === "dev", r = process.env[n ? v.PL_DEV_DOCKER_PUSH_URL : v.PL_RELEASE_DOCKER_PUSH_URL], i = process.env[n ? v.PL_DEV_DOCKER_PULL_URL : v.PL_RELEASE_DOCKER_PULL_URL], a = t.dockerPushTo ?? r ?? (n ? le.DEV_DOCKER_PUSH_TARGET : void 0), o = a ? fa(a) : {
|
|
2522
2501
|
registry: void 0,
|
|
2523
2502
|
autoLogin: !1
|
|
2524
|
-
}, s = t.dockerRegistry ?? i ?? (n ? a :
|
|
2503
|
+
}, s = t.dockerRegistry ?? i ?? (n ? a : le.DOCKER_REGISTRY);
|
|
2525
2504
|
return {
|
|
2526
|
-
pull: s ?
|
|
2505
|
+
pull: s ? da(s) : void 0,
|
|
2527
2506
|
push: o.registry,
|
|
2528
2507
|
autoLogin: o.autoLogin
|
|
2529
2508
|
};
|
|
2530
2509
|
}
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
var Qi = "PL_BUILD_CHANNEL", $i = "PL_BUILD_VARIANT", ea = "PL_BUILD_LOCATION", ta = "PL_BUILD_USE_PUBLISHED";
|
|
2510
|
+
// src/cmd/software/env.ts
|
|
2511
|
+
var ma = "PL_BUILD_CHANNEL", ha = "PL_BUILD_VARIANT", ga = "PL_BUILD_LOCATION", _a = "PL_BUILD_USE_PUBLISHED";
|
|
2534
2512
|
v.PL_DOCKER_REGISTRY_PUSH_TO, v.PL_DEV_DOCKER_PUSH_URL, v.PL_DEV_DOCKER_PULL_URL, v.PL_DEV_BINARY_UPLOAD_URL, v.PL_RELEASE_DOCKER_PUSH_URL, v.PL_RELEASE_DOCKER_PULL_URL, v.PL_RELEASE_BINARY_UPLOAD_URL;
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
function na() {
|
|
2513
|
+
// src/cmd/software/build.ts
|
|
2514
|
+
function va() {
|
|
2538
2515
|
let e = new m("build").description("Build a software module for a target and write its .sw.json descriptor (build + push in one pass)");
|
|
2539
|
-
return e.addOption(new h("--channel <channel>", "registry channel to build for").choices([...
|
|
2516
|
+
return e.addOption(new h("--channel <channel>", "registry channel to build for").choices([...Qi]).env(ma)), e.addOption(new h("--variant <variant>", "artifact kind to build (default: all declared)").choices([...$i]).env(ha)), e.addOption(new h("--location <location>", "where the artifact lands (local = no push)").choices([...ea]).env(ga)), e.addOption(new h("--use-published", "do not build or push; emit a descriptor pointing at the already-published release artifact").env(_a)), e.addOption(new h("--log-level <level>", "logging level").choices([
|
|
2540
2517
|
"error",
|
|
2541
2518
|
"warn",
|
|
2542
2519
|
"info",
|
|
@@ -2544,12 +2521,12 @@ function na() {
|
|
|
2544
2521
|
]).default("info")), e.addOption(new h("--package-root <path>", "path to directory with package.json file")), e.addOption(new h("--force", "force action, ignoring automatic safety checks").default(!1)), e.addOption(new h("--version <value>", "override package version (ignore package.json)")), e.addOption(new h("--platform <os-arch>", "{os}-{arch} pair; no effect on cross-platform packages").choices([...y.AllPlatforms]).env(v.PL_PKG_OS)), e.addOption(new h("--all-platforms", "build for all supported platforms").default(!1)), e.addOption(new h("--full-dir-hash", "hash file contents (not metadata) for the dev content hash").env(v.PL_PKG_FULL_HASH).default(!1)), e.addOption(new h("--package-id <id...>", "act only on selected packages")), e.addOption(new h("--content-root <path>", "override software content root").env(v.PL_PKG_CONTENT_ROOT)), e.addOption(new h("--storage-url <url>", "override binary upload registry URL").env(v.PL_PKG_STORAGE_URL)), e.addOption(new h("--docker-registry <registry>", "docker pull registry embedded in the descriptor").env(v.PL_DOCKER_REGISTRY)), e.addOption(new h("--docker-push-to <registry>", "alternative registry for docker push").env(v.PL_DOCKER_REGISTRY_PUSH_TO)), e.addOption(new h("--docker-build", "build docker images").env(v.PL_DOCKER_BUILD).default(!1)), e.addOption(new h("--docker-no-build", "do not build docker images").env(v.PL_DOCKER_NO_BUILD).default(!1)), e.addOption(new h("--docker-autopush", "push docker images after build").env(v.PL_DOCKER_AUTOPUSH).default(!1)), e.addOption(new h("--docker-no-autopush", "do not push docker images").env(v.PL_DOCKER_NO_AUTOPUSH).default(!1)), e.addOption(new h("--conda-build", "build conda environment before packing").env(v.PL_CONDA_BUILD).default(!1)), e.addOption(new h("--conda-no-build", "do not build conda environment").env(v.PL_CONDA_NO_BUILD).default(!1)), e.action(async (e) => {
|
|
2545
2522
|
let t = y.createLogger(e.logLevel);
|
|
2546
2523
|
try {
|
|
2547
|
-
let n =
|
|
2524
|
+
let n = ta({
|
|
2548
2525
|
channel: e.channel,
|
|
2549
2526
|
variant: e.variant,
|
|
2550
2527
|
location: e.location,
|
|
2551
2528
|
usePublished: !!e.usePublished
|
|
2552
|
-
}), r =
|
|
2529
|
+
}), r = ce(t, { packageRoot: e.packageRoot });
|
|
2553
2530
|
r.version = e.version, r.targetPlatform = e.platform, r.allPlatforms = !!e.allPlatforms, r.fullDirHash = !!e.fullDirHash;
|
|
2554
2531
|
let i = y.shouldDoAction({
|
|
2555
2532
|
default: v.isCI(),
|
|
@@ -2560,12 +2537,12 @@ function na() {
|
|
|
2560
2537
|
enable: e.dockerAutopush,
|
|
2561
2538
|
disable: e.dockerNoAutopush
|
|
2562
2539
|
});
|
|
2563
|
-
n.kind === "bare" &&
|
|
2540
|
+
n.kind === "bare" && se({
|
|
2564
2541
|
buildDocker: i,
|
|
2565
2542
|
pushDocker: a,
|
|
2566
2543
|
pushDisabledExplicitly: !!e.dockerNoAutopush,
|
|
2567
2544
|
dockerPackageCount: r.selectedDockerPackages(e.packageId).length
|
|
2568
|
-
}), await
|
|
2545
|
+
}), await ca({
|
|
2569
2546
|
core: r,
|
|
2570
2547
|
scenario: n,
|
|
2571
2548
|
logger: t,
|
|
@@ -2590,24 +2567,21 @@ function na() {
|
|
|
2590
2567
|
}
|
|
2591
2568
|
}), e;
|
|
2592
2569
|
}
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
function ra() {
|
|
2570
|
+
// src/cmd/software/index.ts
|
|
2571
|
+
function ya() {
|
|
2596
2572
|
let e = new m("software").description("Build and publish a block's software modules");
|
|
2597
|
-
return e.addCommand(
|
|
2573
|
+
return e.addCommand(va()), e;
|
|
2598
2574
|
}
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
function ia(e = process.cwd()) {
|
|
2575
|
+
// src/cli.ts
|
|
2576
|
+
function ba(e = process.cwd()) {
|
|
2602
2577
|
let t = new m();
|
|
2603
|
-
t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(
|
|
2578
|
+
t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(we()), t.addCommand(Ee()), t.addCommand(De()), t.addCommand(Oe()), t.addCommand(Ae()), t.addCommand(je()), t.addCommand(Me()), t.addCommand(Ri(e)), t.addCommand(zi()), t.addCommand(Bi()), t.addCommand(Wi()), t.addCommand(ya());
|
|
2604
2579
|
let n = new m("structure").description("Manage block scaffolding against the canonical structure (check / init / refresh)");
|
|
2605
|
-
return n.addCommand(
|
|
2580
|
+
return n.addCommand(Gi(e)), n.addCommand(Zi(e)), n.addCommand(Li(e)), t.addCommand(n), t;
|
|
2606
2581
|
}
|
|
2607
|
-
async function
|
|
2608
|
-
await
|
|
2582
|
+
async function xa(e, t) {
|
|
2583
|
+
await ba(t).parseAsync(e);
|
|
2609
2584
|
}
|
|
2610
|
-
|
|
2611
|
-
export { ia as buildProgram, aa as run };
|
|
2585
|
+
export { ba as buildProgram, xa as run };
|
|
2612
2586
|
|
|
2613
2587
|
//# sourceMappingURL=cli.mjs.map
|