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