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