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