@platforma-sdk/block-tools 2.10.17 → 2.10.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +13 -13
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +574 -541
- package/dist/cli.mjs.map +1 -1
- package/dist/structure/engine/api.d.ts +1 -1
- package/dist/structure/engine/content-rules.d.ts +17 -0
- package/dist/structure/engine/registry-client.d.ts +30 -2
- package/dist/structure/engine/runner.d.ts +6 -0
- package/dist/structure/rules/root-pnpm-workspace.d.ts +13 -0
- package/dist/v2/registry/schema_public.d.ts +3600 -3600
- package/package.json +6 -6
- package/src/structure/__tests__/model-package-json.snapshot.test.ts +1 -2
- package/src/structure/cli/run-structure.ts +12 -2
- package/src/structure/engine/__tests__/content-rules/pin-catalog-to-dependency-of.test.ts +65 -0
- package/src/structure/engine/__tests__/derived-pin-lookup.test.ts +54 -0
- package/src/structure/engine/api.ts +1 -0
- package/src/structure/engine/content-rules.ts +29 -0
- package/src/structure/engine/registry-client.ts +116 -2
- package/src/structure/engine/runner.ts +18 -2
- package/src/structure/init-block-constructor.ts +16 -3
- package/src/structure/rules/model-package-json.ts +35 -16
- package/src/structure/rules/root-catalog-bump.ts +12 -1
- package/src/structure/rules/root-package-json.ts +7 -5
- package/src/structure/rules/root-pnpm-workspace.ts +24 -8
- package/src/structure/rules/ui-package-json.ts +27 -13
- package/src/structure/rules/workflow-package-json.ts +25 -11
- package/src/structure/rules/workflow.ts +21 -2
package/dist/cli.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { H as e, K as t, O as n, U as r, _ as i, _t as a, b as o, et as s, n as c, p as
|
|
2
|
-
import { Args as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { BlockPackManifest as
|
|
6
|
-
import { OclifLoggerAdapter as
|
|
7
|
-
import
|
|
8
|
-
import { setTimeout as
|
|
9
|
-
import { confirm as
|
|
1
|
+
import { H as e, K as t, O as n, U as r, _ as i, _t as a, b as o, et as s, n as c, p as l, rt as ee } from "./config-DpfTzcgG.mjs";
|
|
2
|
+
import { Args as u, Command as d, Flags as f } from "@oclif/core";
|
|
3
|
+
import p from "node:path";
|
|
4
|
+
import m from "node:fs";
|
|
5
|
+
import { BlockPackManifest as te, StableChannel as ne, overrideDescriptionVersion as re, overrideManifestVersion as ie } from "@milaboratories/pl-model-middle-layer";
|
|
6
|
+
import { OclifLoggerAdapter as h } from "@milaboratories/ts-helpers-oclif";
|
|
7
|
+
import ae, { parse as oe, parseDocument as se, stringify as ce } from "yaml";
|
|
8
|
+
import { setTimeout as le } from "node:timers/promises";
|
|
9
|
+
import { confirm as ue, input as de, select as fe } from "@inquirer/prompts";
|
|
10
10
|
//#region src/cmd/build-meta.ts
|
|
11
|
-
var
|
|
11
|
+
var pe = class e extends d {
|
|
12
12
|
static description = "Extracts meta information from blocks package.json and outputs meta.json with embedded binary and textual information linked from the meta section.";
|
|
13
13
|
static flags = {
|
|
14
|
-
modulePath:
|
|
14
|
+
modulePath: f.string({
|
|
15
15
|
char: "i",
|
|
16
16
|
summary: "input module path",
|
|
17
17
|
helpValue: "<path>",
|
|
18
18
|
default: "."
|
|
19
19
|
}),
|
|
20
|
-
destination:
|
|
20
|
+
destination: f.string({
|
|
21
21
|
char: "o",
|
|
22
22
|
summary: "output meta.json file",
|
|
23
23
|
helpValue: "<path>",
|
|
@@ -25,36 +25,36 @@ var me = class e extends u {
|
|
|
25
25
|
})
|
|
26
26
|
};
|
|
27
27
|
async run() {
|
|
28
|
-
let { flags: t } = await this.parse(e), n =
|
|
29
|
-
await
|
|
28
|
+
let { flags: t } = await this.parse(e), n = p.resolve(t.modulePath), i = await s(await ee((await r(n)).meta, n));
|
|
29
|
+
await m.promises.writeFile(p.resolve(t.destination), JSON.stringify(i));
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/cmd/build-model.ts
|
|
34
|
-
async function
|
|
34
|
+
async function me(e) {
|
|
35
35
|
try {
|
|
36
|
-
return await
|
|
36
|
+
return await m.promises.readFile(e, "utf8");
|
|
37
37
|
} catch (e) {
|
|
38
38
|
if (e instanceof Error && "code" in e && e.code === "ENOENT") return;
|
|
39
39
|
throw e;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
var
|
|
42
|
+
var he = class e extends d {
|
|
43
43
|
static description = "Extracts and outputs block model JSON from pre-built block model module";
|
|
44
44
|
static flags = {
|
|
45
|
-
modulePath:
|
|
45
|
+
modulePath: f.string({
|
|
46
46
|
char: "i",
|
|
47
47
|
summary: "input module path",
|
|
48
48
|
helpValue: "<path>",
|
|
49
49
|
default: "."
|
|
50
50
|
}),
|
|
51
|
-
sourceBundle:
|
|
51
|
+
sourceBundle: f.string({
|
|
52
52
|
char: "b",
|
|
53
53
|
summary: "bundled model code to embed into the model for callback-based rendering to work",
|
|
54
54
|
helpValue: "<path>",
|
|
55
55
|
default: "./dist/bundle.js"
|
|
56
56
|
}),
|
|
57
|
-
destination:
|
|
57
|
+
destination: f.string({
|
|
58
58
|
char: "o",
|
|
59
59
|
summary: "output model file",
|
|
60
60
|
helpValue: "<path>",
|
|
@@ -62,34 +62,34 @@ var ge = class e extends u {
|
|
|
62
62
|
})
|
|
63
63
|
};
|
|
64
64
|
async run() {
|
|
65
|
-
let { flags: t } = await this.parse(e), { model: n, platforma: r } = a(
|
|
65
|
+
let { flags: t } = await this.parse(e), { model: n, platforma: r } = a(p.resolve(t.modulePath));
|
|
66
66
|
if (n ||= r, !n) throw Error("\"model\" export not found");
|
|
67
67
|
let { config: i } = n;
|
|
68
68
|
if (!i) throw Error("Malformed \"model\" object, check it is created with \"BlockModel\" and \".done()\" is executed as the call in the chain.");
|
|
69
69
|
if (!("outputs" in i) || !("sections" in i)) throw Error("\"config\" has unexpected structure");
|
|
70
|
-
let o = await
|
|
70
|
+
let o = await me(t.sourceBundle);
|
|
71
71
|
o !== void 0 && (i.code = {
|
|
72
72
|
type: "plain",
|
|
73
73
|
content: o
|
|
74
|
-
}), await
|
|
74
|
+
}), await m.promises.writeFile(p.resolve(t.destination), JSON.stringify(i));
|
|
75
75
|
}
|
|
76
|
-
},
|
|
76
|
+
}, ge = class e extends d {
|
|
77
77
|
static description = "List all available global overview snapshots in the registry";
|
|
78
78
|
static flags = {
|
|
79
|
-
registry:
|
|
79
|
+
registry: f.string({
|
|
80
80
|
char: "r",
|
|
81
81
|
summary: "full address of the registry",
|
|
82
82
|
helpValue: "<address>",
|
|
83
83
|
env: "PL_REGISTRY",
|
|
84
84
|
required: !0
|
|
85
85
|
}),
|
|
86
|
-
json:
|
|
86
|
+
json: f.boolean({
|
|
87
87
|
summary: "output in JSON format",
|
|
88
88
|
default: !1
|
|
89
89
|
})
|
|
90
90
|
};
|
|
91
91
|
async run() {
|
|
92
|
-
let { flags: t } = await this.parse(e), n = await new o(i(t.registry), new
|
|
92
|
+
let { flags: t } = await this.parse(e), n = await new o(i(t.registry), new h(this)).listGlobalOverviewSnapshots();
|
|
93
93
|
if (t.json) this.log(JSON.stringify(n, null, 2));
|
|
94
94
|
else if (n.length === 0) this.log("No snapshots found.");
|
|
95
95
|
else {
|
|
@@ -97,60 +97,60 @@ var ge = class e extends u {
|
|
|
97
97
|
for (let e of n) this.log(` ${e.timestamp}`), this.log(` Path: ${e.path}`), this.log("");
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
},
|
|
100
|
+
}, _e = class e extends d {
|
|
101
101
|
static description = "Mark target block stable";
|
|
102
102
|
static flags = {
|
|
103
|
-
modulePath:
|
|
103
|
+
modulePath: f.string({
|
|
104
104
|
char: "i",
|
|
105
105
|
summary: "input module path",
|
|
106
106
|
helpValue: "<path>",
|
|
107
107
|
default: "."
|
|
108
108
|
}),
|
|
109
|
-
channel:
|
|
109
|
+
channel: f.string({
|
|
110
110
|
char: "c",
|
|
111
111
|
hidden: !0,
|
|
112
112
|
summary: "custom channel",
|
|
113
113
|
helpValue: "<channel name>",
|
|
114
|
-
default:
|
|
114
|
+
default: ne
|
|
115
115
|
}),
|
|
116
|
-
"version-override":
|
|
116
|
+
"version-override": f.file({
|
|
117
117
|
char: "v",
|
|
118
118
|
summary: "override package version"
|
|
119
119
|
}),
|
|
120
|
-
registry:
|
|
120
|
+
registry: f.string({
|
|
121
121
|
char: "r",
|
|
122
122
|
summary: "full address of the registry",
|
|
123
123
|
helpValue: "<address>",
|
|
124
124
|
env: "PL_REGISTRY",
|
|
125
125
|
required: !0
|
|
126
126
|
}),
|
|
127
|
-
refresh:
|
|
127
|
+
refresh: f.boolean({
|
|
128
128
|
summary: "refresh repository after adding the package",
|
|
129
129
|
default: !0,
|
|
130
130
|
allowNo: !0,
|
|
131
131
|
env: "PL_REGISTRY_REFRESH"
|
|
132
132
|
}),
|
|
133
|
-
unmark:
|
|
133
|
+
unmark: f.boolean({
|
|
134
134
|
summary: "reverses meaning of this command, flag can be used to remove \"stable\" flag from the package",
|
|
135
135
|
default: !1
|
|
136
136
|
})
|
|
137
137
|
};
|
|
138
138
|
async run() {
|
|
139
|
-
let { flags: t } = await this.parse(e), n = await r(
|
|
140
|
-
t["version-override"] && (n =
|
|
141
|
-
let a = new o(i(t.registry), new
|
|
139
|
+
let { flags: t } = await this.parse(e), n = await r(p.resolve(t.modulePath));
|
|
140
|
+
t["version-override"] && (n = re(n, t["version-override"]));
|
|
141
|
+
let a = new o(i(t.registry), new h(this));
|
|
142
142
|
t.unmark ? await a.removePackageFromChannel(n.id, t.channel) : await a.addPackageToChannel(n.id, t.channel), t.refresh && await a.updateIfNeeded();
|
|
143
143
|
}
|
|
144
|
-
},
|
|
144
|
+
}, ve = class n extends d {
|
|
145
145
|
static description = "Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder";
|
|
146
146
|
static flags = {
|
|
147
|
-
modulePath:
|
|
147
|
+
modulePath: f.string({
|
|
148
148
|
char: "i",
|
|
149
149
|
summary: "input module path",
|
|
150
150
|
helpValue: "<path>",
|
|
151
151
|
default: "."
|
|
152
152
|
}),
|
|
153
|
-
destinationPath:
|
|
153
|
+
destinationPath: f.string({
|
|
154
154
|
char: "o",
|
|
155
155
|
summary: "output folder",
|
|
156
156
|
helpValue: "<path>",
|
|
@@ -159,67 +159,67 @@ var ge = class e extends u {
|
|
|
159
159
|
};
|
|
160
160
|
async run() {
|
|
161
161
|
let { flags: r } = await this.parse(n);
|
|
162
|
-
await t(await e(
|
|
162
|
+
await t(await e(p.resolve(r.modulePath)), p.resolve(r.destinationPath));
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
165
|
//#endregion
|
|
166
166
|
//#region src/cmd/publish.ts
|
|
167
|
-
function
|
|
167
|
+
function ye(e, t) {
|
|
168
168
|
let n = { ...e };
|
|
169
|
-
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] =
|
|
169
|
+
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] = ye(n[e], t[e]) : n[e] = t[e];
|
|
170
170
|
return n;
|
|
171
171
|
}
|
|
172
|
-
var
|
|
172
|
+
var be = class e extends d {
|
|
173
173
|
static description = "Publishes the block package and refreshes the registry (for v2 block-pack schema)";
|
|
174
174
|
static flags = {
|
|
175
|
-
registry:
|
|
175
|
+
registry: f.string({
|
|
176
176
|
char: "r",
|
|
177
177
|
summary: "full address of the registry",
|
|
178
178
|
helpValue: "<address>",
|
|
179
179
|
env: "PL_REGISTRY",
|
|
180
180
|
required: !0
|
|
181
181
|
}),
|
|
182
|
-
manifest:
|
|
182
|
+
manifest: f.file({
|
|
183
183
|
char: "m",
|
|
184
184
|
summary: "manifest file path",
|
|
185
185
|
exists: !0,
|
|
186
186
|
default: `./block-pack/${n}`
|
|
187
187
|
}),
|
|
188
|
-
"version-override":
|
|
188
|
+
"version-override": f.file({
|
|
189
189
|
char: "v",
|
|
190
190
|
summary: "override package version"
|
|
191
191
|
}),
|
|
192
|
-
refresh:
|
|
192
|
+
refresh: f.boolean({
|
|
193
193
|
summary: "refresh repository after adding the package",
|
|
194
194
|
default: !0,
|
|
195
195
|
allowNo: !0,
|
|
196
196
|
env: "PL_REGISTRY_REFRESH"
|
|
197
197
|
}),
|
|
198
|
-
unstable:
|
|
198
|
+
unstable: f.boolean({
|
|
199
199
|
summary: "do not add the published package to stable channel",
|
|
200
200
|
default: !1,
|
|
201
201
|
env: "PL_PUBLISH_UNSTABLE"
|
|
202
202
|
})
|
|
203
203
|
};
|
|
204
204
|
async run() {
|
|
205
|
-
let { flags: t } = await this.parse(e), n =
|
|
206
|
-
a =
|
|
207
|
-
let s =
|
|
208
|
-
this.log(`Manifest root = ${s}`), t["version-override"] && (a =
|
|
209
|
-
let c = new o(i(t.registry), new
|
|
210
|
-
await c.publishPackage(a, async (e) => Buffer.from(await
|
|
211
|
-
}
|
|
212
|
-
},
|
|
205
|
+
let { flags: t } = await this.parse(e), n = p.resolve(t.manifest), r = JSON.parse(await m.promises.readFile(n, { encoding: "utf-8" })), a = te.parse(r);
|
|
206
|
+
a = ye(r, a);
|
|
207
|
+
let s = p.dirname(n);
|
|
208
|
+
this.log(`Manifest root = ${s}`), t["version-override"] && (a = ie(a, t["version-override"]));
|
|
209
|
+
let c = new o(i(t.registry), new h(this));
|
|
210
|
+
await c.publishPackage(a, async (e) => Buffer.from(await m.promises.readFile(p.resolve(s, e)))), t.unstable || (this.log(`Adding package to ${ne} channel...`), await c.addPackageToChannel(a.description.id, ne)), t.refresh && await c.updateIfNeeded();
|
|
211
|
+
}
|
|
212
|
+
}, xe = class e extends d {
|
|
213
213
|
static description = "Refresh overview files based on published but not proecessed artefacts";
|
|
214
214
|
static flags = {
|
|
215
|
-
registry:
|
|
215
|
+
registry: f.string({
|
|
216
216
|
char: "r",
|
|
217
217
|
summary: "full address of the registry",
|
|
218
218
|
helpValue: "<address>",
|
|
219
219
|
env: "PL_REGISTRY",
|
|
220
220
|
required: !0
|
|
221
221
|
}),
|
|
222
|
-
mode:
|
|
222
|
+
mode: f.string({
|
|
223
223
|
char: "m",
|
|
224
224
|
summary: "refresh mode (allowed valiues: \"force\", \"normal\", \"dry-run\")",
|
|
225
225
|
helpValue: "<mode>",
|
|
@@ -234,31 +234,31 @@ var xe = class e extends u {
|
|
|
234
234
|
};
|
|
235
235
|
async run() {
|
|
236
236
|
let { flags: t } = await this.parse(e);
|
|
237
|
-
await new o(i(t.registry), new
|
|
237
|
+
await new o(i(t.registry), new h(this)).updateIfNeeded(t.mode);
|
|
238
238
|
}
|
|
239
|
-
},
|
|
239
|
+
}, Se = class e extends d {
|
|
240
240
|
static description = "Restore global overview from a snapshot";
|
|
241
241
|
static flags = {
|
|
242
|
-
registry:
|
|
242
|
+
registry: f.string({
|
|
243
243
|
char: "r",
|
|
244
244
|
summary: "full address of the registry",
|
|
245
245
|
helpValue: "<address>",
|
|
246
246
|
env: "PL_REGISTRY",
|
|
247
247
|
required: !0
|
|
248
248
|
}),
|
|
249
|
-
snapshot:
|
|
249
|
+
snapshot: f.string({
|
|
250
250
|
char: "s",
|
|
251
251
|
summary: "snapshot timestamp ID to restore from",
|
|
252
252
|
helpValue: "<timestamp>",
|
|
253
253
|
required: !0
|
|
254
254
|
}),
|
|
255
|
-
"skip-confirmation":
|
|
255
|
+
"skip-confirmation": f.boolean({
|
|
256
256
|
summary: "skip confirmation prompt (use with caution)",
|
|
257
257
|
default: !1
|
|
258
258
|
})
|
|
259
259
|
};
|
|
260
260
|
async run() {
|
|
261
|
-
let { flags: t } = await this.parse(e), n = new o(i(t.registry), new
|
|
261
|
+
let { flags: t } = await this.parse(e), n = new o(i(t.registry), new h(this)), r = await n.listGlobalOverviewSnapshots();
|
|
262
262
|
if (r.find((e) => e.timestamp === t.snapshot) || this.error(`Snapshot '${t.snapshot}' not found. Available snapshots:\n${r.map((e) => ` - ${e.timestamp}`).join("\n") || " (none)"}`), !t["skip-confirmation"]) {
|
|
263
263
|
let e = (await import("node:readline")).createInterface({
|
|
264
264
|
input: process.stdin,
|
|
@@ -277,7 +277,7 @@ var xe = class e extends u {
|
|
|
277
277
|
this.error(`Failed to restore from snapshot: ${String(e)}`);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
},
|
|
280
|
+
}, Ce = class extends d {
|
|
281
281
|
static description = "[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.";
|
|
282
282
|
static examples = ["<%= config.bin %> <%= command.id %>"];
|
|
283
283
|
async run() {
|
|
@@ -286,7 +286,7 @@ var xe = class e extends u {
|
|
|
286
286
|
};
|
|
287
287
|
//#endregion
|
|
288
288
|
//#region src/registry_v1/flags.ts
|
|
289
|
-
function
|
|
289
|
+
function we(e) {
|
|
290
290
|
let t = e.match(/(?<destName>[^/\\]+)=(?<src>.*)/);
|
|
291
291
|
if (t) {
|
|
292
292
|
let { src: e, destName: n } = t.groups;
|
|
@@ -296,54 +296,54 @@ function Te(e) {
|
|
|
296
296
|
};
|
|
297
297
|
} else return {
|
|
298
298
|
src: e,
|
|
299
|
-
destName:
|
|
299
|
+
destName: p.basename(e)
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
|
-
var
|
|
302
|
+
var Te = f.custom({
|
|
303
303
|
summary: "target files to upload",
|
|
304
304
|
helpValue: "file_path | package_name=file_path",
|
|
305
|
-
parse: async (e) =>
|
|
306
|
-
}),
|
|
305
|
+
parse: async (e) => we(e)
|
|
306
|
+
}), Ee = [
|
|
307
307
|
"registry",
|
|
308
308
|
"organization",
|
|
309
309
|
"package",
|
|
310
310
|
"version"
|
|
311
|
-
],
|
|
311
|
+
], De = class e extends d {
|
|
312
312
|
static description = "Uploads V1 package and refreshes the registry";
|
|
313
313
|
static flags = {
|
|
314
|
-
registry:
|
|
314
|
+
registry: f.string({
|
|
315
315
|
char: "r",
|
|
316
316
|
summary: "full address of the registry or alias from .pl.reg",
|
|
317
317
|
helpValue: "<address|alias>",
|
|
318
318
|
env: "PL_REGISTRY"
|
|
319
319
|
}),
|
|
320
|
-
organization:
|
|
320
|
+
organization: f.string({
|
|
321
321
|
char: "o",
|
|
322
322
|
summary: "target organisation",
|
|
323
323
|
env: "PL_PACKAGE_ORGANIZATION"
|
|
324
324
|
}),
|
|
325
|
-
package:
|
|
325
|
+
package: f.string({
|
|
326
326
|
char: "p",
|
|
327
327
|
summary: "target package",
|
|
328
328
|
env: "PL_PACKAGE_NAME"
|
|
329
329
|
}),
|
|
330
|
-
version:
|
|
330
|
+
version: f.string({
|
|
331
331
|
char: "v",
|
|
332
332
|
summary: "target version",
|
|
333
333
|
env: "PL_PACKAGE_VERSION"
|
|
334
334
|
}),
|
|
335
|
-
meta:
|
|
335
|
+
meta: f.file({
|
|
336
336
|
char: "m",
|
|
337
337
|
summary: "json file containing meta information to associate with tha package",
|
|
338
338
|
exists: !0
|
|
339
339
|
}),
|
|
340
|
-
file:
|
|
340
|
+
file: Te({
|
|
341
341
|
char: "f",
|
|
342
342
|
summary: "package files",
|
|
343
343
|
multiple: !0,
|
|
344
344
|
default: []
|
|
345
345
|
}),
|
|
346
|
-
refresh:
|
|
346
|
+
refresh: f.boolean({
|
|
347
347
|
summary: "refresh repository after adding the package",
|
|
348
348
|
default: !0,
|
|
349
349
|
allowNo: !0,
|
|
@@ -351,41 +351,41 @@ var Ee = d.custom({
|
|
|
351
351
|
})
|
|
352
352
|
};
|
|
353
353
|
async run() {
|
|
354
|
-
let { flags: t } = await this.parse(e), n =
|
|
355
|
-
for (let e of
|
|
356
|
-
t.meta && (t.meta.endsWith(".json") ? n.meta = JSON.parse(await
|
|
354
|
+
let { flags: t } = await this.parse(e), n = l.parse({});
|
|
355
|
+
for (let e of Ee) t[e] && (n[e] = t[e]);
|
|
356
|
+
t.meta && (t.meta.endsWith(".json") ? n.meta = JSON.parse(await m.promises.readFile(t.meta, { encoding: "utf-8" })) : t.meta.endsWith(".yaml") && (n.meta = ae.parse(await m.promises.readFile(t.meta, { encoding: "utf-8" }))));
|
|
357
357
|
for (let e of t.file) n.files[e.destName] = e.src;
|
|
358
358
|
let r = await c(n);
|
|
359
|
-
this.log(
|
|
360
|
-
let i = r.createRegistry(new
|
|
359
|
+
this.log(ae.stringify(r.conf));
|
|
360
|
+
let i = r.createRegistry(new h(this)), a = r.fullPackageName, o = i.constructNewPackage(a);
|
|
361
361
|
for (let [e, t] of Object.entries(r.conf.files)) {
|
|
362
362
|
this.log(`Uploading ${t} -> ${e} ...`);
|
|
363
|
-
let n = await
|
|
363
|
+
let n = await m.promises.readFile(t);
|
|
364
364
|
await o.addFile(e, n);
|
|
365
365
|
}
|
|
366
366
|
this.log("Uploading meta information..."), await o.writeMeta(r.conf.meta), await o.finish(), t.refresh && await i.updateIfNeeded();
|
|
367
367
|
}
|
|
368
|
-
},
|
|
368
|
+
}, Oe = class {
|
|
369
369
|
constructor(e) {
|
|
370
370
|
this.root = e;
|
|
371
371
|
}
|
|
372
372
|
abs(e) {
|
|
373
|
-
return
|
|
373
|
+
return p.resolve(this.root, e);
|
|
374
374
|
}
|
|
375
375
|
read(e) {
|
|
376
|
-
return
|
|
376
|
+
return m.readFileSync(this.abs(e), "utf-8");
|
|
377
377
|
}
|
|
378
378
|
write(e, t) {
|
|
379
379
|
let n = this.abs(e);
|
|
380
|
-
|
|
380
|
+
m.mkdirSync(p.dirname(n), { recursive: !0 }), m.writeFileSync(n, t, "utf-8");
|
|
381
381
|
}
|
|
382
382
|
writeBinary(e, t) {
|
|
383
383
|
let n = this.abs(e);
|
|
384
|
-
|
|
384
|
+
m.mkdirSync(p.dirname(n), { recursive: !0 }), m.writeFileSync(n, t);
|
|
385
385
|
}
|
|
386
386
|
exists(e) {
|
|
387
387
|
try {
|
|
388
|
-
return
|
|
388
|
+
return m.statSync(this.abs(e)), !0;
|
|
389
389
|
} catch {
|
|
390
390
|
return !1;
|
|
391
391
|
}
|
|
@@ -393,15 +393,15 @@ var Ee = d.custom({
|
|
|
393
393
|
list(e) {
|
|
394
394
|
let t = this.abs(e);
|
|
395
395
|
try {
|
|
396
|
-
if (!
|
|
396
|
+
if (!m.statSync(t).isDirectory()) return [];
|
|
397
397
|
} catch {
|
|
398
398
|
return [];
|
|
399
399
|
}
|
|
400
400
|
let n = [];
|
|
401
401
|
function r(e, t) {
|
|
402
|
-
let i =
|
|
402
|
+
let i = m.readdirSync(t, { withFileTypes: !0 });
|
|
403
403
|
for (let a of i) {
|
|
404
|
-
let i = e ? `${e}/${a.name}` : a.name, o =
|
|
404
|
+
let i = e ? `${e}/${a.name}` : a.name, o = p.join(t, a.name);
|
|
405
405
|
a.isDirectory() ? r(i, o) : a.isFile() && n.push(i);
|
|
406
406
|
}
|
|
407
407
|
}
|
|
@@ -410,7 +410,7 @@ var Ee = d.custom({
|
|
|
410
410
|
listDir(e) {
|
|
411
411
|
let t = this.abs(e), n;
|
|
412
412
|
try {
|
|
413
|
-
n =
|
|
413
|
+
n = m.readdirSync(t, { withFileTypes: !0 });
|
|
414
414
|
} catch {
|
|
415
415
|
return [];
|
|
416
416
|
}
|
|
@@ -421,48 +421,48 @@ var Ee = d.custom({
|
|
|
421
421
|
}
|
|
422
422
|
move(e, t) {
|
|
423
423
|
let n = this.abs(e), r = this.abs(t);
|
|
424
|
-
|
|
424
|
+
m.mkdirSync(p.dirname(r), { recursive: !0 }), m.renameSync(n, r);
|
|
425
425
|
}
|
|
426
426
|
delete(e) {
|
|
427
|
-
|
|
427
|
+
m.rmSync(this.abs(e), {
|
|
428
428
|
recursive: !0,
|
|
429
429
|
force: !0
|
|
430
430
|
});
|
|
431
431
|
}
|
|
432
|
-
},
|
|
432
|
+
}, ke = class {
|
|
433
433
|
constructor(e) {
|
|
434
434
|
this.root = e;
|
|
435
435
|
}
|
|
436
436
|
staticRead(e) {
|
|
437
|
-
return
|
|
437
|
+
return m.readFileSync(p.resolve(this.root, "static", e), "utf-8");
|
|
438
438
|
}
|
|
439
439
|
staticReadBinary(e) {
|
|
440
|
-
return
|
|
440
|
+
return m.readFileSync(p.resolve(this.root, "static", e));
|
|
441
441
|
}
|
|
442
442
|
textRead(e) {
|
|
443
|
-
return
|
|
443
|
+
return m.readFileSync(p.resolve(this.root, "text", e), "utf-8");
|
|
444
444
|
}
|
|
445
445
|
};
|
|
446
|
-
function
|
|
446
|
+
function Ae(e, t) {
|
|
447
447
|
return e.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (e, n) => t[n] ?? `\${${n}}`);
|
|
448
448
|
}
|
|
449
449
|
//#endregion
|
|
450
450
|
//#region src/structure/engine/flatten.ts
|
|
451
|
-
var
|
|
452
|
-
function
|
|
451
|
+
var je = ["default", "init"];
|
|
452
|
+
function Me(e, t) {
|
|
453
453
|
if (!e) return t;
|
|
454
454
|
if (!t) return e;
|
|
455
455
|
let n = e.endsWith("/") ? e.slice(0, -1) : e, r = t.startsWith("/") ? t.slice(1) : t;
|
|
456
456
|
return r ? `${n}/${r}` : n;
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function Ne(e, t) {
|
|
459
459
|
return e.filter((e) => e.scope === t).slice().sort((e, t) => e.path.localeCompare(t.path));
|
|
460
460
|
}
|
|
461
|
-
function
|
|
461
|
+
function Pe(e, t) {
|
|
462
462
|
let n = [];
|
|
463
463
|
function r(e, i, a, o, s) {
|
|
464
464
|
if (e.kind === "scope") {
|
|
465
|
-
let n =
|
|
465
|
+
let n = Ne(t.modules, e.scope);
|
|
466
466
|
for (let t of n) for (let n of e.children) r(n, e.scope, t.path, o, s);
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
@@ -475,14 +475,14 @@ function Fe(e, t) {
|
|
|
475
475
|
for (let t of e.children) r(t, i, a, o, e.modes);
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
|
-
if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${
|
|
478
|
+
if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${Ie(e)}' is not inside a scope() frame`);
|
|
479
479
|
if (e.kind === "rename") {
|
|
480
480
|
n.push({
|
|
481
481
|
leaf: e,
|
|
482
482
|
scope: i,
|
|
483
483
|
modulePath: a,
|
|
484
|
-
resolvedPath:
|
|
485
|
-
resolvedTo:
|
|
484
|
+
resolvedPath: Me(a, e.from),
|
|
485
|
+
resolvedTo: Me(a, e.to),
|
|
486
486
|
triggers: o,
|
|
487
487
|
modes: s
|
|
488
488
|
});
|
|
@@ -492,15 +492,15 @@ function Fe(e, t) {
|
|
|
492
492
|
leaf: e,
|
|
493
493
|
scope: i,
|
|
494
494
|
modulePath: a,
|
|
495
|
-
resolvedPath:
|
|
495
|
+
resolvedPath: Me(a, Fe(e)),
|
|
496
496
|
triggers: o,
|
|
497
497
|
modes: s
|
|
498
498
|
});
|
|
499
499
|
}
|
|
500
|
-
for (let t of e.children) r(t, void 0, void 0, [],
|
|
500
|
+
for (let t of e.children) r(t, void 0, void 0, [], je);
|
|
501
501
|
return n;
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function Fe(e) {
|
|
504
504
|
switch (e.kind) {
|
|
505
505
|
case "fixed":
|
|
506
506
|
case "managed":
|
|
@@ -510,67 +510,67 @@ function Ie(e) {
|
|
|
510
510
|
case "rename": return e.from;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
function
|
|
513
|
+
function Ie(e) {
|
|
514
514
|
return e.kind === "rename" ? `rename ${e.from} -> ${e.to}` : `${e.kind} ${e.path}`;
|
|
515
515
|
}
|
|
516
516
|
//#endregion
|
|
517
517
|
//#region src/structure/engine/glob.ts
|
|
518
|
-
var
|
|
519
|
-
function
|
|
518
|
+
var Le = /[.+^${}()|[\]\\]/g;
|
|
519
|
+
function Re(e) {
|
|
520
520
|
let t = "";
|
|
521
521
|
for (let n = 0; n < e.length; n++) {
|
|
522
522
|
let r = e[n];
|
|
523
|
-
r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : r === "?" ? t += "[^/]" : t += r.replace(
|
|
523
|
+
r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : r === "?" ? t += "[^/]" : t += r.replace(Le, "\\$&");
|
|
524
524
|
}
|
|
525
525
|
return RegExp(`^${t}$`);
|
|
526
526
|
}
|
|
527
|
-
function
|
|
528
|
-
return
|
|
527
|
+
function ze(e, t) {
|
|
528
|
+
return Re(e).test(t);
|
|
529
529
|
}
|
|
530
530
|
//#endregion
|
|
531
531
|
//#region src/structure/engine/builders.ts
|
|
532
|
-
var
|
|
533
|
-
function
|
|
534
|
-
if (!
|
|
535
|
-
return
|
|
532
|
+
var g, _;
|
|
533
|
+
function Be(e) {
|
|
534
|
+
if (!g) throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);
|
|
535
|
+
return g;
|
|
536
536
|
}
|
|
537
|
-
function
|
|
538
|
-
let n =
|
|
537
|
+
function v(e, t) {
|
|
538
|
+
let n = Be(e);
|
|
539
539
|
n.stack[n.stack.length - 1].push(t);
|
|
540
540
|
}
|
|
541
|
-
function
|
|
542
|
-
let n =
|
|
543
|
-
|
|
541
|
+
function Ve(e, t) {
|
|
542
|
+
let n = _;
|
|
543
|
+
_ = e;
|
|
544
544
|
try {
|
|
545
545
|
return t();
|
|
546
546
|
} finally {
|
|
547
|
-
|
|
547
|
+
_ = n;
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
|
-
function
|
|
551
|
-
return
|
|
550
|
+
function He() {
|
|
551
|
+
return _;
|
|
552
552
|
}
|
|
553
|
-
function
|
|
554
|
-
if (!
|
|
555
|
-
return
|
|
553
|
+
function y() {
|
|
554
|
+
if (!_) throw Error("getActiveRunContext() called outside engine.run(). Generators only see the run context during a run.");
|
|
555
|
+
return _;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
558
|
-
if (
|
|
557
|
+
function Ue(e) {
|
|
558
|
+
if (g) throw Error("defineStructure() cannot be called from inside another defineStructure().");
|
|
559
559
|
let t = [], n = {
|
|
560
560
|
root: t,
|
|
561
561
|
stack: [t],
|
|
562
562
|
inScope: !1
|
|
563
563
|
};
|
|
564
|
-
|
|
564
|
+
g = n;
|
|
565
565
|
try {
|
|
566
566
|
if (e(), n.stack.length !== 1) throw Error(`defineStructure: builder body left ${n.stack.length - 1} unclosed group frame(s)`);
|
|
567
567
|
let r = { children: t };
|
|
568
|
-
return
|
|
568
|
+
return We(r), r;
|
|
569
569
|
} finally {
|
|
570
|
-
|
|
570
|
+
g = void 0;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function We(e) {
|
|
574
574
|
let t = /* @__PURE__ */ new Map();
|
|
575
575
|
function n(e, r) {
|
|
576
576
|
if (e.kind === "scope") {
|
|
@@ -593,8 +593,8 @@ function Ge(e) {
|
|
|
593
593
|
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.`);
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
|
-
function
|
|
597
|
-
let n =
|
|
596
|
+
function b(e, t) {
|
|
597
|
+
let n = Be("scope");
|
|
598
598
|
if (n.inScope) throw Error("scope() cannot nest. Already inside a scope.");
|
|
599
599
|
let r = {
|
|
600
600
|
kind: "scope",
|
|
@@ -608,22 +608,22 @@ function y(e, t) {
|
|
|
608
608
|
n.stack.pop(), n.inScope = !1;
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
|
-
var
|
|
612
|
-
function
|
|
613
|
-
|
|
611
|
+
var Ge;
|
|
612
|
+
function Ke(e) {
|
|
613
|
+
Ge = e;
|
|
614
614
|
}
|
|
615
|
-
function
|
|
616
|
-
|
|
615
|
+
function x(e, t, n) {
|
|
616
|
+
qe(e, t), n && qe((t) => !e(t), n);
|
|
617
617
|
}
|
|
618
|
-
function
|
|
619
|
-
if (
|
|
620
|
-
|
|
618
|
+
function qe(e, t) {
|
|
619
|
+
if (g) {
|
|
620
|
+
Je(e, t);
|
|
621
621
|
return;
|
|
622
622
|
}
|
|
623
|
-
if (!(
|
|
623
|
+
if (!(Ge?.(e, t) ?? !1)) throw Error("when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.");
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
let n =
|
|
625
|
+
function Je(e, t) {
|
|
626
|
+
let n = g, r = {
|
|
627
627
|
kind: "when",
|
|
628
628
|
trigger: e,
|
|
629
629
|
children: []
|
|
@@ -635,11 +635,11 @@ function Ye(e, t) {
|
|
|
635
635
|
n.stack.pop();
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function S(e) {
|
|
639
639
|
return (t) => t.filesMatch(e);
|
|
640
640
|
}
|
|
641
|
-
function
|
|
642
|
-
let r =
|
|
641
|
+
function Ye(e, t, n) {
|
|
642
|
+
let r = Be(e), i = {
|
|
643
643
|
kind: "mode",
|
|
644
644
|
modes: t,
|
|
645
645
|
children: []
|
|
@@ -651,144 +651,144 @@ function Xe(e, t, n) {
|
|
|
651
651
|
r.stack.pop();
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
function
|
|
655
|
-
|
|
654
|
+
function Xe(e) {
|
|
655
|
+
Ye("onInitOrUpdate", ["init", "updateDeps"], e);
|
|
656
656
|
}
|
|
657
|
-
function
|
|
658
|
-
|
|
657
|
+
function C(e, t) {
|
|
658
|
+
v("fixed", {
|
|
659
659
|
kind: "fixed",
|
|
660
660
|
path: e,
|
|
661
661
|
content: t
|
|
662
662
|
});
|
|
663
663
|
}
|
|
664
|
-
function
|
|
665
|
-
|
|
664
|
+
function w(e, t, n) {
|
|
665
|
+
v("managed", {
|
|
666
666
|
kind: "managed",
|
|
667
667
|
path: e,
|
|
668
668
|
initial: t,
|
|
669
669
|
body: n
|
|
670
670
|
});
|
|
671
671
|
}
|
|
672
|
-
function
|
|
673
|
-
|
|
672
|
+
function Ze(e, t) {
|
|
673
|
+
v("scaffold", {
|
|
674
674
|
kind: "scaffold",
|
|
675
675
|
path: e,
|
|
676
676
|
initial: t
|
|
677
677
|
});
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
|
|
679
|
+
function T(e, t) {
|
|
680
|
+
v("seed", {
|
|
681
681
|
kind: "seed",
|
|
682
682
|
path: e,
|
|
683
683
|
initial: t
|
|
684
684
|
});
|
|
685
685
|
}
|
|
686
|
-
function
|
|
687
|
-
|
|
686
|
+
function E(e) {
|
|
687
|
+
v("remove", {
|
|
688
688
|
kind: "remove",
|
|
689
689
|
path: e
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function D(e) {
|
|
693
693
|
return {
|
|
694
694
|
kind: "file",
|
|
695
695
|
path: e
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function Qe(e) {
|
|
699
699
|
return {
|
|
700
700
|
kind: "binary",
|
|
701
701
|
path: e
|
|
702
702
|
};
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function $e(e) {
|
|
705
705
|
return {
|
|
706
706
|
kind: "text",
|
|
707
707
|
value: e
|
|
708
708
|
};
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function et(e, t) {
|
|
711
711
|
return {
|
|
712
712
|
kind: "tpl",
|
|
713
713
|
path: e,
|
|
714
714
|
vars: t
|
|
715
715
|
};
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function O(e) {
|
|
718
718
|
return {
|
|
719
719
|
kind: "generate",
|
|
720
720
|
fn: e
|
|
721
721
|
};
|
|
722
722
|
}
|
|
723
|
-
function
|
|
724
|
-
if (!
|
|
725
|
-
return
|
|
723
|
+
function tt() {
|
|
724
|
+
if (!_) throw Error("blockVars() called outside engine.run(). Generators and managed bodies only see BlockVars during a run.");
|
|
725
|
+
return _.blockVars;
|
|
726
726
|
}
|
|
727
727
|
//#endregion
|
|
728
728
|
//#region src/structure/engine/parsers/json.ts
|
|
729
|
-
function
|
|
729
|
+
function nt(e) {
|
|
730
730
|
return JSON.parse(e);
|
|
731
731
|
}
|
|
732
|
-
var
|
|
733
|
-
function
|
|
734
|
-
return e.length === 0 ? "[]" : "[" + e.map(
|
|
732
|
+
var rt = 100, it = 2;
|
|
733
|
+
function at(e) {
|
|
734
|
+
return e.length === 0 ? "[]" : "[" + e.map(ot).join(", ") + "]";
|
|
735
735
|
}
|
|
736
|
-
function
|
|
737
|
-
if (Array.isArray(e)) return
|
|
738
|
-
if (
|
|
736
|
+
function ot(e) {
|
|
737
|
+
if (Array.isArray(e)) return at(e);
|
|
738
|
+
if (A(e)) {
|
|
739
739
|
let t = Object.entries(e);
|
|
740
|
-
return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${
|
|
740
|
+
return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${ot(t)}`).join(", ") + " }";
|
|
741
741
|
}
|
|
742
742
|
return JSON.stringify(e);
|
|
743
743
|
}
|
|
744
|
-
function
|
|
745
|
-
let i = t +
|
|
744
|
+
function st(e, t, n, r) {
|
|
745
|
+
let i = t + it, a = " ".repeat(i);
|
|
746
746
|
if (Array.isArray(e)) {
|
|
747
|
-
let o =
|
|
748
|
-
if (n + o.length + r <=
|
|
747
|
+
let o = at(e);
|
|
748
|
+
if (n + o.length + r <= rt) return o;
|
|
749
749
|
let s = e.length - 1;
|
|
750
|
-
return "[\n" + e.map((e, t) => a +
|
|
750
|
+
return "[\n" + e.map((e, t) => a + st(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
|
|
751
751
|
}
|
|
752
|
-
if (
|
|
752
|
+
if (A(e)) {
|
|
753
753
|
let n = Object.entries(e);
|
|
754
754
|
if (n.length === 0) return "{}";
|
|
755
755
|
let r = n.length - 1;
|
|
756
756
|
return "{\n" + n.map(([e, t], n) => {
|
|
757
757
|
let o = `${a}${JSON.stringify(e)}: `;
|
|
758
|
-
return o +
|
|
758
|
+
return o + st(t, i, o.length, n === r ? 0 : 1);
|
|
759
759
|
}).join(",\n") + "\n" + " ".repeat(t) + "}";
|
|
760
760
|
}
|
|
761
761
|
return JSON.stringify(e);
|
|
762
762
|
}
|
|
763
|
-
function
|
|
764
|
-
return t?.collapse ?
|
|
763
|
+
function ct(e, t) {
|
|
764
|
+
return t?.collapse ? st(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function k(e) {
|
|
767
767
|
return e === "" || e === void 0 ? [] : e.split(".");
|
|
768
768
|
}
|
|
769
|
-
function
|
|
769
|
+
function A(e) {
|
|
770
770
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
771
771
|
}
|
|
772
|
-
function
|
|
773
|
-
let n =
|
|
772
|
+
function lt(e, t) {
|
|
773
|
+
let n = k(t), r = e;
|
|
774
774
|
for (let e of n) {
|
|
775
|
-
if (!
|
|
775
|
+
if (!A(r)) return;
|
|
776
776
|
r = r[e];
|
|
777
777
|
}
|
|
778
778
|
return r;
|
|
779
779
|
}
|
|
780
|
-
function
|
|
781
|
-
let n =
|
|
780
|
+
function ut(e, t) {
|
|
781
|
+
let n = k(t);
|
|
782
782
|
if (n.length === 0) return !0;
|
|
783
783
|
let r = e;
|
|
784
784
|
for (let e = 0; e < n.length - 1; e++) {
|
|
785
|
-
if (!
|
|
785
|
+
if (!A(r)) return !1;
|
|
786
786
|
r = r[n[e]];
|
|
787
787
|
}
|
|
788
|
-
return
|
|
788
|
+
return A(r) ? n[n.length - 1] in r : !1;
|
|
789
789
|
}
|
|
790
|
-
function
|
|
791
|
-
let r =
|
|
790
|
+
function dt(e, t, n) {
|
|
791
|
+
let r = k(t);
|
|
792
792
|
if (r.length === 0) throw Error("setAtPath: jsonPath must be non-empty");
|
|
793
793
|
let i = e;
|
|
794
794
|
for (let e = 0; e < r.length - 1; e++) {
|
|
@@ -796,22 +796,22 @@ function ft(e, t, n) {
|
|
|
796
796
|
if (n === void 0) {
|
|
797
797
|
let e = {};
|
|
798
798
|
i[t] = e, i = e;
|
|
799
|
-
} else if (
|
|
799
|
+
} else if (A(n)) i = n;
|
|
800
800
|
else throw Error(`setAtPath: cannot descend into non-object at '${r.slice(0, e + 1).join(".")}'`);
|
|
801
801
|
}
|
|
802
802
|
i[r[r.length - 1]] = n;
|
|
803
803
|
}
|
|
804
|
-
function
|
|
805
|
-
let n =
|
|
804
|
+
function ft(e, t) {
|
|
805
|
+
let n = k(t);
|
|
806
806
|
if (n.length === 0) throw Error("deleteAtPath: jsonPath must be non-empty");
|
|
807
807
|
let r = e;
|
|
808
808
|
for (let e = 0; e < n.length - 1; e++) {
|
|
809
|
-
if (!
|
|
809
|
+
if (!A(r)) return;
|
|
810
810
|
r = r[n[e]];
|
|
811
811
|
}
|
|
812
|
-
|
|
812
|
+
A(r) && delete r[n[n.length - 1]];
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function pt(e, t) {
|
|
815
815
|
let n = new Set(t), r = Object.keys(e), i = /* @__PURE__ */ new Map();
|
|
816
816
|
i.set("", []);
|
|
817
817
|
let a = "";
|
|
@@ -826,63 +826,63 @@ function mt(e, t) {
|
|
|
826
826
|
}
|
|
827
827
|
//#endregion
|
|
828
828
|
//#region src/structure/engine/parsers/lines.ts
|
|
829
|
-
function
|
|
829
|
+
function mt(e) {
|
|
830
830
|
let t = e.split("\n");
|
|
831
831
|
return t.length > 0 && t[t.length - 1] === "" && t.pop(), t;
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function ht(e) {
|
|
834
834
|
return e.join("\n") + "\n";
|
|
835
835
|
}
|
|
836
|
-
function
|
|
836
|
+
function gt(e) {
|
|
837
837
|
return e.replace(/(^|\s)#.*$/, "$1").trim();
|
|
838
838
|
}
|
|
839
|
-
function
|
|
840
|
-
let n =
|
|
839
|
+
function _t(e, t) {
|
|
840
|
+
let n = gt(e);
|
|
841
841
|
return n === "" ? !1 : n === t.trim();
|
|
842
842
|
}
|
|
843
|
-
function
|
|
844
|
-
for (let n of e) if (
|
|
843
|
+
function vt(e, t) {
|
|
844
|
+
for (let n of e) if (_t(n, t)) return !0;
|
|
845
845
|
return !1;
|
|
846
846
|
}
|
|
847
847
|
//#endregion
|
|
848
848
|
//#region src/structure/engine/content-rules.ts
|
|
849
|
-
function
|
|
849
|
+
function yt(e, t) {
|
|
850
850
|
return e === "sdk:" ? t ? "workspace:*" : "catalog:" : e;
|
|
851
851
|
}
|
|
852
|
-
var
|
|
852
|
+
var bt = [
|
|
853
853
|
"dependencies",
|
|
854
854
|
"devDependencies",
|
|
855
855
|
"peerDependencies",
|
|
856
856
|
"optionalDependencies"
|
|
857
857
|
];
|
|
858
|
-
function
|
|
859
|
-
if (P(e)) for (let n of
|
|
858
|
+
function xt(e, t) {
|
|
859
|
+
if (P(e)) for (let n of bt) {
|
|
860
860
|
let r = e[n];
|
|
861
861
|
if (P(r)) for (let e of Object.keys(r)) r[e] === "sdk:" && (r[e] = t ? "workspace:*" : "catalog:");
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
|
-
var
|
|
865
|
-
function
|
|
866
|
-
if (!
|
|
867
|
-
return
|
|
864
|
+
var j;
|
|
865
|
+
function St(e) {
|
|
866
|
+
if (!j) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
|
|
867
|
+
return j;
|
|
868
868
|
}
|
|
869
869
|
function M(e) {
|
|
870
|
-
let t =
|
|
870
|
+
let t = St(e);
|
|
871
871
|
if (t.kind !== "json") throw Error(`${e}() requires a JSON-managed body; got '${t.kind}'.`);
|
|
872
872
|
return t;
|
|
873
873
|
}
|
|
874
874
|
function N(e) {
|
|
875
|
-
let t =
|
|
875
|
+
let t = St(e);
|
|
876
876
|
if (t.kind !== "yaml") throw Error(`${e}() requires a YAML-managed body; got '${t.kind}'.`);
|
|
877
877
|
return t;
|
|
878
878
|
}
|
|
879
879
|
function Ct(e) {
|
|
880
|
-
let t =
|
|
880
|
+
let t = St(e);
|
|
881
881
|
if (t.kind !== "lines") throw Error(`${e}() requires a lines-managed body; got '${t.kind}'.`);
|
|
882
882
|
return t;
|
|
883
883
|
}
|
|
884
884
|
function wt(e, t) {
|
|
885
|
-
let n = e.ctx ??
|
|
885
|
+
let n = e.ctx ?? He();
|
|
886
886
|
if (!n) throw Error(`${t}() needs a RunContext but none is active. Pass { ctx } via the with-managed-* helper or run inside engine.run(...).`);
|
|
887
887
|
return n;
|
|
888
888
|
}
|
|
@@ -890,8 +890,8 @@ function P(e) {
|
|
|
890
890
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
891
891
|
}
|
|
892
892
|
function Tt(e, t, n = {}) {
|
|
893
|
-
if (
|
|
894
|
-
|
|
893
|
+
if (j) throw Error("Nested managed(...) body — engine bug.");
|
|
894
|
+
j = {
|
|
895
895
|
kind: "json",
|
|
896
896
|
obj: e,
|
|
897
897
|
ctx: n.ctx,
|
|
@@ -900,27 +900,28 @@ function Tt(e, t, n = {}) {
|
|
|
900
900
|
try {
|
|
901
901
|
return t(), e;
|
|
902
902
|
} finally {
|
|
903
|
-
|
|
903
|
+
j = void 0;
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
906
|
function Et(e, t, n = {}) {
|
|
907
|
-
if (
|
|
908
|
-
|
|
907
|
+
if (j) throw Error("Nested managed(...) body — engine bug.");
|
|
908
|
+
j = {
|
|
909
909
|
kind: "yaml",
|
|
910
910
|
doc: e,
|
|
911
911
|
ctx: n.ctx,
|
|
912
912
|
triggerContext: n.triggerContext,
|
|
913
|
-
getLatestVersion: n.getLatestVersion
|
|
913
|
+
getLatestVersion: n.getLatestVersion,
|
|
914
|
+
getDerivedDependencyPin: n.getDerivedDependencyPin
|
|
914
915
|
};
|
|
915
916
|
try {
|
|
916
917
|
return t(), e;
|
|
917
918
|
} finally {
|
|
918
|
-
|
|
919
|
+
j = void 0;
|
|
919
920
|
}
|
|
920
921
|
}
|
|
921
922
|
function Dt(e, t, n = {}) {
|
|
922
|
-
if (
|
|
923
|
-
|
|
923
|
+
if (j) throw Error("Nested managed(...) body — engine bug.");
|
|
924
|
+
j = {
|
|
924
925
|
kind: "lines",
|
|
925
926
|
lines: e,
|
|
926
927
|
ctx: n.ctx,
|
|
@@ -929,21 +930,21 @@ function Dt(e, t, n = {}) {
|
|
|
929
930
|
try {
|
|
930
931
|
return t(), e;
|
|
931
932
|
} finally {
|
|
932
|
-
|
|
933
|
+
j = void 0;
|
|
933
934
|
}
|
|
934
935
|
}
|
|
935
|
-
|
|
936
|
-
if (!
|
|
937
|
-
let n =
|
|
936
|
+
Ke((e, t) => {
|
|
937
|
+
if (!j) return !1;
|
|
938
|
+
let n = j.triggerContext;
|
|
938
939
|
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.");
|
|
939
940
|
return e(n) && t(), !0;
|
|
940
941
|
});
|
|
941
942
|
function F(e, t) {
|
|
942
|
-
|
|
943
|
+
dt(M("ensureField").obj, e, t);
|
|
943
944
|
}
|
|
944
945
|
function Ot(e, t) {
|
|
945
946
|
let n = M("removeField").obj;
|
|
946
|
-
|
|
947
|
+
ut(n, e) && (t && !t(lt(n, e)) || ft(n, e));
|
|
947
948
|
}
|
|
948
949
|
function I(e, t) {
|
|
949
950
|
F(`scripts.${e}`, t);
|
|
@@ -958,7 +959,7 @@ var At = [
|
|
|
958
959
|
"optionalDependencies"
|
|
959
960
|
];
|
|
960
961
|
function L(e, t, n, r) {
|
|
961
|
-
let i = M(e), a = i.obj, o = n === "sdk:" ?
|
|
962
|
+
let i = M(e), a = i.obj, o = n === "sdk:" ? yt(n, wt(i, e).isSdkInternal) : n;
|
|
962
963
|
for (let e of At) {
|
|
963
964
|
if (e === r) continue;
|
|
964
965
|
let n = a[e];
|
|
@@ -1001,7 +1002,7 @@ function Nt(e) {
|
|
|
1001
1002
|
for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
|
|
1002
1003
|
}
|
|
1003
1004
|
function Pt(e, t) {
|
|
1004
|
-
let n =
|
|
1005
|
+
let n = pt(e, t);
|
|
1005
1006
|
for (let t of Object.keys(e)) delete e[t];
|
|
1006
1007
|
for (let t of Object.keys(n)) e[t] = n[t];
|
|
1007
1008
|
}
|
|
@@ -1022,7 +1023,7 @@ function G(e = "", t = {}) {
|
|
|
1022
1023
|
Ft(r, !0);
|
|
1023
1024
|
return;
|
|
1024
1025
|
}
|
|
1025
|
-
let i =
|
|
1026
|
+
let i = lt(r, e);
|
|
1026
1027
|
P(i) && Ft(i, n);
|
|
1027
1028
|
}
|
|
1028
1029
|
function It() {
|
|
@@ -1043,39 +1044,49 @@ function zt(e) {
|
|
|
1043
1044
|
let n = t.getLatestVersion(e);
|
|
1044
1045
|
n !== void 0 && Lt(t, e) !== n && t.doc.setIn(["catalog", e], n);
|
|
1045
1046
|
}
|
|
1046
|
-
function Bt(e) {
|
|
1047
|
+
function Bt(e, t) {
|
|
1048
|
+
let n = N("pinCatalogToDependencyOf");
|
|
1049
|
+
if (!n.getDerivedDependencyPin) return;
|
|
1050
|
+
let r = n.getDerivedDependencyPin(e);
|
|
1051
|
+
r !== void 0 && Lt(n, e) !== r && n.doc.setIn(["catalog", e], r);
|
|
1052
|
+
}
|
|
1053
|
+
function Vt(e) {
|
|
1054
|
+
let t = N("ensureCatalogAbsent");
|
|
1055
|
+
t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
|
|
1056
|
+
}
|
|
1057
|
+
function Ht(e) {
|
|
1047
1058
|
let t = Ct("ensureGitignoreEntries");
|
|
1048
|
-
for (let n of e)
|
|
1059
|
+
for (let n of e) vt(t.lines, n) || t.lines.push(n);
|
|
1049
1060
|
}
|
|
1050
1061
|
//#endregion
|
|
1051
1062
|
//#region src/structure/engine/parsers/yaml.ts
|
|
1052
|
-
function
|
|
1053
|
-
return
|
|
1063
|
+
function Ut(e) {
|
|
1064
|
+
return se(e);
|
|
1054
1065
|
}
|
|
1055
|
-
function
|
|
1066
|
+
function Wt(e) {
|
|
1056
1067
|
return e.toString();
|
|
1057
1068
|
}
|
|
1058
|
-
var
|
|
1059
|
-
function
|
|
1060
|
-
if (e < t) throw new
|
|
1069
|
+
var Gt = ".structure";
|
|
1070
|
+
function Kt(e, t = 0) {
|
|
1071
|
+
if (e < t) throw new qt(e, t);
|
|
1061
1072
|
}
|
|
1062
|
-
var
|
|
1073
|
+
var qt = class extends Error {
|
|
1063
1074
|
constructor(e, t) {
|
|
1064
1075
|
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";
|
|
1065
1076
|
}
|
|
1066
1077
|
};
|
|
1067
|
-
function
|
|
1078
|
+
function Jt(e, t = 1) {
|
|
1068
1079
|
let n = { version: t };
|
|
1069
|
-
e.write(
|
|
1080
|
+
e.write(Gt, JSON.stringify(n));
|
|
1070
1081
|
}
|
|
1071
1082
|
//#endregion
|
|
1072
1083
|
//#region src/structure/engine/runner.ts
|
|
1073
|
-
var
|
|
1084
|
+
var Yt = class extends Error {
|
|
1074
1085
|
constructor(e) {
|
|
1075
1086
|
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";
|
|
1076
1087
|
}
|
|
1077
1088
|
};
|
|
1078
|
-
function
|
|
1089
|
+
function Xt(e, t, n, r) {
|
|
1079
1090
|
switch (e.kind) {
|
|
1080
1091
|
case "text": return e.value;
|
|
1081
1092
|
case "file":
|
|
@@ -1083,46 +1094,47 @@ function Jt(e, t, n, r) {
|
|
|
1083
1094
|
return n.staticRead(e.path);
|
|
1084
1095
|
case "tpl":
|
|
1085
1096
|
if (!n) throw Error(`tpl('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
|
|
1086
|
-
return
|
|
1097
|
+
return Ae(n.textRead(e.path), typeof e.vars == "function" ? e.vars() : e.vars);
|
|
1087
1098
|
case "generate": {
|
|
1088
1099
|
let n = e.fn();
|
|
1089
|
-
if (t.endsWith(".json")) return
|
|
1090
|
-
if (t.endsWith(".yaml") || t.endsWith(".yml")) return
|
|
1100
|
+
if (t.endsWith(".json")) return xt(n, r), ct(n, { collapse: !t.endsWith("package.json") });
|
|
1101
|
+
if (t.endsWith(".yaml") || t.endsWith(".yml")) return ce(n);
|
|
1091
1102
|
if (typeof n != "string") throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);
|
|
1092
1103
|
return n;
|
|
1093
1104
|
}
|
|
1094
1105
|
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.`);
|
|
1095
1106
|
}
|
|
1096
1107
|
}
|
|
1097
|
-
function
|
|
1108
|
+
function Zt(e, t, n, r, i) {
|
|
1098
1109
|
if (n.kind === "binary") {
|
|
1099
1110
|
if (!r) throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
|
|
1100
1111
|
e.writeBinary(t, r.staticReadBinary(n.path));
|
|
1101
1112
|
return;
|
|
1102
1113
|
}
|
|
1103
|
-
e.write(t,
|
|
1114
|
+
e.write(t, Xt(n, t, r, i));
|
|
1104
1115
|
}
|
|
1105
|
-
function
|
|
1106
|
-
let
|
|
1116
|
+
function Qt(e, t, n, r, i, a) {
|
|
1117
|
+
let o = e.split("/").pop() ?? e;
|
|
1107
1118
|
if (e.endsWith(".json")) {
|
|
1108
|
-
let i =
|
|
1119
|
+
let i = nt(t);
|
|
1109
1120
|
if (typeof i != "object" || !i || Array.isArray(i)) throw Error(`managed: parsed value at '${e}' is not a JSON object`);
|
|
1110
|
-
return Tt(i, n, { triggerContext: r }),
|
|
1121
|
+
return Tt(i, n, { triggerContext: r }), ct(i, { collapse: o !== "package.json" });
|
|
1111
1122
|
}
|
|
1112
1123
|
if (e.endsWith(".yaml") || e.endsWith(".yml")) {
|
|
1113
|
-
let e =
|
|
1124
|
+
let e = Ut(t);
|
|
1114
1125
|
return Et(e, n, {
|
|
1115
1126
|
triggerContext: r,
|
|
1116
|
-
getLatestVersion: i
|
|
1117
|
-
|
|
1127
|
+
getLatestVersion: i,
|
|
1128
|
+
getDerivedDependencyPin: a
|
|
1129
|
+
}), Wt(e);
|
|
1118
1130
|
}
|
|
1119
|
-
if (
|
|
1120
|
-
let e =
|
|
1121
|
-
return Dt(e, n, { triggerContext: r }),
|
|
1131
|
+
if (o === ".gitignore" || o.endsWith(".gitignore")) {
|
|
1132
|
+
let e = mt(t);
|
|
1133
|
+
return Dt(e, n, { triggerContext: r }), ht(e);
|
|
1122
1134
|
}
|
|
1123
1135
|
throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`);
|
|
1124
1136
|
}
|
|
1125
|
-
function
|
|
1137
|
+
function $t(e) {
|
|
1126
1138
|
let t = e.list(""), n = /* @__PURE__ */ new Set();
|
|
1127
1139
|
for (let e of t) {
|
|
1128
1140
|
n.add(e);
|
|
@@ -1131,37 +1143,37 @@ function Zt(e) {
|
|
|
1131
1143
|
}
|
|
1132
1144
|
return n;
|
|
1133
1145
|
}
|
|
1134
|
-
function
|
|
1146
|
+
function en(e, t) {
|
|
1135
1147
|
let n = t === "" ? t : t.endsWith("/") ? t.slice(0, -1) : t;
|
|
1136
1148
|
return e.has(n);
|
|
1137
1149
|
}
|
|
1138
|
-
function
|
|
1150
|
+
function tn(e, t, n) {
|
|
1139
1151
|
return {
|
|
1140
1152
|
ctx: t,
|
|
1141
1153
|
version: t.version,
|
|
1142
|
-
pathExists: (t) =>
|
|
1143
|
-
pathMissing: (t) => !
|
|
1154
|
+
pathExists: (t) => en(e, t),
|
|
1155
|
+
pathMissing: (t) => !en(e, t),
|
|
1144
1156
|
filesMatch: (t) => {
|
|
1145
1157
|
let r = n ? `${n}/${t}` : t;
|
|
1146
|
-
for (let t of e) if (
|
|
1158
|
+
for (let t of e) if (ze(r, t)) return !0;
|
|
1147
1159
|
return !1;
|
|
1148
1160
|
}
|
|
1149
1161
|
};
|
|
1150
1162
|
}
|
|
1151
|
-
function
|
|
1163
|
+
function nn(e, t) {
|
|
1152
1164
|
for (let n of e.triggers) if (!n(t)) return !1;
|
|
1153
1165
|
return !0;
|
|
1154
1166
|
}
|
|
1155
|
-
function
|
|
1167
|
+
function rn(e, t) {
|
|
1156
1168
|
return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
|
|
1157
1169
|
}
|
|
1158
|
-
function
|
|
1170
|
+
function an(e, t) {
|
|
1159
1171
|
return e.filter((e) => e.modes.includes(t));
|
|
1160
1172
|
}
|
|
1161
|
-
function
|
|
1173
|
+
function on(e, t, n, r, i, a) {
|
|
1162
1174
|
let o = e.leaf;
|
|
1163
1175
|
if (o.kind === "fixed") {
|
|
1164
|
-
let i =
|
|
1176
|
+
let i = Xt(o.content, e.resolvedPath, r, a);
|
|
1165
1177
|
return t.exists(e.resolvedPath) ? t.read(e.resolvedPath) === i ? void 0 : (n || t.write(e.resolvedPath, i), {
|
|
1166
1178
|
scope: e.scope,
|
|
1167
1179
|
path: e.resolvedPath,
|
|
@@ -1174,13 +1186,13 @@ function rn(e, t, n, r, i, a) {
|
|
|
1174
1186
|
action: "create"
|
|
1175
1187
|
});
|
|
1176
1188
|
}
|
|
1177
|
-
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
1189
|
+
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || Zt(t, e.resolvedPath, o.initial, r, a), {
|
|
1178
1190
|
scope: e.scope,
|
|
1179
1191
|
path: e.resolvedPath,
|
|
1180
1192
|
primitive: "scaffold",
|
|
1181
1193
|
action: "create"
|
|
1182
1194
|
});
|
|
1183
|
-
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
1195
|
+
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || Zt(t, e.resolvedPath, o.initial, r, a), {
|
|
1184
1196
|
scope: e.scope,
|
|
1185
1197
|
path: e.resolvedPath,
|
|
1186
1198
|
primitive: "seed",
|
|
@@ -1203,58 +1215,58 @@ function rn(e, t, n, r, i, a) {
|
|
|
1203
1215
|
});
|
|
1204
1216
|
}
|
|
1205
1217
|
}
|
|
1206
|
-
function
|
|
1218
|
+
function sn(e, t, n, r, i, a, o, s) {
|
|
1207
1219
|
if (e.leaf.kind !== "managed") return;
|
|
1208
|
-
let
|
|
1209
|
-
ee ?
|
|
1210
|
-
let
|
|
1211
|
-
if (
|
|
1220
|
+
let c = e.leaf, l = e.resolvedPath, ee = t.exists(l), u, d = !1;
|
|
1221
|
+
ee ? u = t.read(l) : (u = Xt(c.initial, l, i, s), d = !0);
|
|
1222
|
+
let f = Qt(l, u, c.body, r, a, o);
|
|
1223
|
+
if (d) return n || t.write(l, f), {
|
|
1212
1224
|
scope: e.scope,
|
|
1213
|
-
path:
|
|
1225
|
+
path: l,
|
|
1214
1226
|
primitive: "managed",
|
|
1215
1227
|
action: "create"
|
|
1216
1228
|
};
|
|
1217
|
-
if (
|
|
1229
|
+
if (f !== u) return n || t.write(l, f), {
|
|
1218
1230
|
scope: e.scope,
|
|
1219
|
-
path:
|
|
1231
|
+
path: l,
|
|
1220
1232
|
primitive: "managed",
|
|
1221
1233
|
action: "update"
|
|
1222
1234
|
};
|
|
1223
1235
|
}
|
|
1224
|
-
function
|
|
1225
|
-
let
|
|
1226
|
-
for (let e of
|
|
1227
|
-
if (e.leaf.kind === "managed" || !
|
|
1228
|
-
let o =
|
|
1229
|
-
o &&
|
|
1236
|
+
function cn(e, t, n, r, i, a, o, s) {
|
|
1237
|
+
let c = an(e, rn(n, a)), l = [], ee = $t(t);
|
|
1238
|
+
for (let e of c) {
|
|
1239
|
+
if (e.leaf.kind === "managed" || !nn(e, tn(ee, n, e.modulePath))) continue;
|
|
1240
|
+
let o = on(e, t, r, i, a, n.isSdkInternal);
|
|
1241
|
+
o && l.push(o);
|
|
1230
1242
|
}
|
|
1231
|
-
let
|
|
1232
|
-
for (let e of
|
|
1243
|
+
let u = $t(t);
|
|
1244
|
+
for (let e of c) {
|
|
1233
1245
|
if (e.leaf.kind !== "managed") continue;
|
|
1234
|
-
let a =
|
|
1235
|
-
if (!
|
|
1236
|
-
let
|
|
1237
|
-
|
|
1246
|
+
let a = tn(u, n, e.modulePath);
|
|
1247
|
+
if (!nn(e, a)) continue;
|
|
1248
|
+
let c = sn(e, t, r, a, i, o, s, n.isSdkInternal);
|
|
1249
|
+
c && l.push(c);
|
|
1238
1250
|
}
|
|
1239
|
-
return
|
|
1251
|
+
return l;
|
|
1240
1252
|
}
|
|
1241
|
-
function
|
|
1242
|
-
return
|
|
1243
|
-
let i =
|
|
1253
|
+
function ln(e, t, n, r = {}) {
|
|
1254
|
+
return Ve(n, () => {
|
|
1255
|
+
let i = Pe(e, n), a = !!r.initMode, o = cn(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
|
|
1244
1256
|
if (!n.dryRun && !n.updateDepsOnly && !a) {
|
|
1245
|
-
|
|
1257
|
+
Jt(t);
|
|
1246
1258
|
let i = {
|
|
1247
1259
|
...r.rediscover ? r.rediscover(t) : n,
|
|
1248
1260
|
dryRun: !0
|
|
1249
|
-
}, a =
|
|
1250
|
-
if (a.length > 0) throw new
|
|
1261
|
+
}, a = cn(Pe(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== Gt);
|
|
1262
|
+
if (a.length > 0) throw new Yt(a[0]);
|
|
1251
1263
|
}
|
|
1252
|
-
return a && !n.dryRun &&
|
|
1264
|
+
return a && !n.dryRun && Jt(t), { changes: o };
|
|
1253
1265
|
});
|
|
1254
1266
|
}
|
|
1255
1267
|
//#endregion
|
|
1256
1268
|
//#region src/structure/engine/discovery.ts
|
|
1257
|
-
var
|
|
1269
|
+
var un = [
|
|
1258
1270
|
"root",
|
|
1259
1271
|
"block",
|
|
1260
1272
|
"model",
|
|
@@ -1262,12 +1274,12 @@ var cn = [
|
|
|
1262
1274
|
"workflow",
|
|
1263
1275
|
"test",
|
|
1264
1276
|
"software"
|
|
1265
|
-
],
|
|
1277
|
+
], dn = class extends Error {
|
|
1266
1278
|
constructor(e, t) {
|
|
1267
1279
|
super(e), this.path = t, this.name = "DiscoveryError";
|
|
1268
1280
|
}
|
|
1269
1281
|
};
|
|
1270
|
-
function
|
|
1282
|
+
function fn(e) {
|
|
1271
1283
|
let t = /* @__PURE__ */ new Set();
|
|
1272
1284
|
for (let n of [
|
|
1273
1285
|
e.dependencies,
|
|
@@ -1277,17 +1289,17 @@ function un(e) {
|
|
|
1277
1289
|
]) if (n) for (let e of Object.keys(n)) t.add(e);
|
|
1278
1290
|
return t;
|
|
1279
1291
|
}
|
|
1280
|
-
function
|
|
1292
|
+
function pn(e) {
|
|
1281
1293
|
return e === "" || e === ".";
|
|
1282
1294
|
}
|
|
1283
|
-
function
|
|
1295
|
+
function mn(e, t) {
|
|
1284
1296
|
let n = e.pkg["block-scope"];
|
|
1285
1297
|
if (typeof n == "string") {
|
|
1286
|
-
if (!
|
|
1298
|
+
if (!un.includes(n)) throw new dn(`package.json "block-scope" must be one of ${un.join(", ")}, got '${n}'`, e.path);
|
|
1287
1299
|
return n;
|
|
1288
1300
|
}
|
|
1289
|
-
if (
|
|
1290
|
-
let r =
|
|
1301
|
+
if (pn(e.path)) return "root";
|
|
1302
|
+
let r = fn(e.pkg);
|
|
1291
1303
|
if (e.pkg["block-software"] !== void 0) return "software";
|
|
1292
1304
|
if (r.has("@platforma-sdk/package-builder")) {
|
|
1293
1305
|
for (let e of r) if (/^@platforma-open\/.*runenv/.test(e)) return "software";
|
|
@@ -1302,17 +1314,17 @@ function fn(e, t) {
|
|
|
1302
1314
|
if (r.has("@platforma-sdk/model") && e.pkg.main) return "model";
|
|
1303
1315
|
if (r.has("@platforma-sdk/test")) return "test";
|
|
1304
1316
|
}
|
|
1305
|
-
function
|
|
1317
|
+
function hn(e) {
|
|
1306
1318
|
let t = /* @__PURE__ */ new Set();
|
|
1307
1319
|
for (let n of e) typeof n.pkg.name == "string" && t.add(n.pkg.name);
|
|
1308
1320
|
let n = [];
|
|
1309
1321
|
for (let r of e) {
|
|
1310
|
-
let e =
|
|
1311
|
-
if (!e) throw new
|
|
1322
|
+
let e = mn(r, t);
|
|
1323
|
+
if (!e) throw new dn(`Unclassified workspace package at '${r.path}'. Add a top-level "block-scope" string to its package.json.`, r.path);
|
|
1312
1324
|
n.push({
|
|
1313
1325
|
scope: e,
|
|
1314
1326
|
name: r.pkg.name ?? r.path,
|
|
1315
|
-
path:
|
|
1327
|
+
path: pn(r.path) ? "" : r.path
|
|
1316
1328
|
});
|
|
1317
1329
|
}
|
|
1318
1330
|
return n;
|
|
@@ -1322,21 +1334,21 @@ function pn(e) {
|
|
|
1322
1334
|
function K(e, t) {
|
|
1323
1335
|
return e.modules.filter((e) => e.scope === t);
|
|
1324
1336
|
}
|
|
1325
|
-
function
|
|
1337
|
+
function gn(e, t) {
|
|
1326
1338
|
let n = K(e, t);
|
|
1327
1339
|
if (n.length === 0) throw Error(`findModule: expected one '${t}' module, found none`);
|
|
1328
1340
|
if (n.length > 1) throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);
|
|
1329
1341
|
return n[0];
|
|
1330
1342
|
}
|
|
1331
1343
|
function q(e, t) {
|
|
1332
|
-
return { [
|
|
1344
|
+
return { [gn(e, t).name]: "workspace:*" };
|
|
1333
1345
|
}
|
|
1334
|
-
function
|
|
1346
|
+
function _n(e, t) {
|
|
1335
1347
|
let n = {};
|
|
1336
1348
|
for (let r of K(e, t)) n[r.name] = "workspace:*";
|
|
1337
1349
|
return n;
|
|
1338
1350
|
}
|
|
1339
|
-
function
|
|
1351
|
+
function vn(e) {
|
|
1340
1352
|
let t = e.facadeName, n = [
|
|
1341
1353
|
{
|
|
1342
1354
|
scope: "root",
|
|
@@ -1375,7 +1387,7 @@ function gn(e) {
|
|
|
1375
1387
|
path: "software"
|
|
1376
1388
|
}), n;
|
|
1377
1389
|
}
|
|
1378
|
-
function
|
|
1390
|
+
function yn(e) {
|
|
1379
1391
|
return {
|
|
1380
1392
|
isSdkInternal: e.isSdkInternal ?? !1,
|
|
1381
1393
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
@@ -1392,36 +1404,36 @@ var J = class extends Error {
|
|
|
1392
1404
|
super(e), this.name = "StructureCliError";
|
|
1393
1405
|
}
|
|
1394
1406
|
};
|
|
1395
|
-
function
|
|
1407
|
+
function bn(e, t) {
|
|
1396
1408
|
return e === "" ? t : `${e}/${t}`;
|
|
1397
1409
|
}
|
|
1398
|
-
function
|
|
1410
|
+
function xn(e, t) {
|
|
1399
1411
|
try {
|
|
1400
1412
|
return JSON.parse(e.read(t));
|
|
1401
1413
|
} catch {
|
|
1402
1414
|
return;
|
|
1403
1415
|
}
|
|
1404
1416
|
}
|
|
1405
|
-
function
|
|
1417
|
+
function Sn(e) {
|
|
1406
1418
|
if (e.includes("*")) throw new J(`pnpm-workspace.yaml 'packages:' entry '${e}' contains a glob. The structurer requires literal package paths — replace the glob with one entry per package directory.`);
|
|
1407
1419
|
let t = e.replace(/^\.\//, "").replace(/\/$/, "");
|
|
1408
1420
|
return t === "." ? "" : t;
|
|
1409
1421
|
}
|
|
1410
|
-
function
|
|
1422
|
+
function Cn(e) {
|
|
1411
1423
|
let t;
|
|
1412
1424
|
try {
|
|
1413
1425
|
t = e.read("pnpm-workspace.yaml");
|
|
1414
1426
|
} catch {
|
|
1415
1427
|
throw new J("No pnpm-workspace.yaml found. This directory is empty or unrecognisable as a block — run 'block-tools structure init' instead, or pass --sdk-internal for an in-monorepo block.");
|
|
1416
1428
|
}
|
|
1417
|
-
let n =
|
|
1429
|
+
let n = oe(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
|
|
1418
1430
|
for (let t of r) {
|
|
1419
|
-
let n =
|
|
1431
|
+
let n = Sn(t);
|
|
1420
1432
|
(n === "" || e.exists(n)) && i.add(n);
|
|
1421
1433
|
}
|
|
1422
1434
|
let a = [];
|
|
1423
1435
|
for (let t of i) {
|
|
1424
|
-
let n =
|
|
1436
|
+
let n = xn(e, bn(t, "package.json"));
|
|
1425
1437
|
n && a.push({
|
|
1426
1438
|
path: t,
|
|
1427
1439
|
pkg: n
|
|
@@ -1429,7 +1441,7 @@ function xn(e) {
|
|
|
1429
1441
|
}
|
|
1430
1442
|
return a;
|
|
1431
1443
|
}
|
|
1432
|
-
function
|
|
1444
|
+
function wn(e) {
|
|
1433
1445
|
let t = [], n = new Set([
|
|
1434
1446
|
"node_modules",
|
|
1435
1447
|
".turbo",
|
|
@@ -1441,7 +1453,7 @@ function Sn(e) {
|
|
|
1441
1453
|
let o = e.listDir(i);
|
|
1442
1454
|
for (let s of o) {
|
|
1443
1455
|
if (!s.isDirectory || n.has(s.name)) continue;
|
|
1444
|
-
let o =
|
|
1456
|
+
let o = bn(i, s.name), c = xn(e, bn(o, "package.json"));
|
|
1445
1457
|
c && t.push({
|
|
1446
1458
|
path: o,
|
|
1447
1459
|
pkg: c
|
|
@@ -1450,7 +1462,7 @@ function Sn(e) {
|
|
|
1450
1462
|
}
|
|
1451
1463
|
return r("", 1), t;
|
|
1452
1464
|
}
|
|
1453
|
-
function
|
|
1465
|
+
function Tn(e) {
|
|
1454
1466
|
let t = e.indexOf("/");
|
|
1455
1467
|
if (!e.startsWith("@") || t < 0) throw new J(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
|
|
1456
1468
|
let n = e.slice(0, t), r = e.slice(t + 1), i = r.indexOf(".");
|
|
@@ -1463,23 +1475,23 @@ function Cn(e) {
|
|
|
1463
1475
|
shortName: r.slice(i + 1)
|
|
1464
1476
|
};
|
|
1465
1477
|
}
|
|
1466
|
-
function
|
|
1478
|
+
function En(e) {
|
|
1467
1479
|
try {
|
|
1468
|
-
let t = JSON.parse(e.read(
|
|
1480
|
+
let t = JSON.parse(e.read(Gt));
|
|
1469
1481
|
return typeof t.version == "number" ? t.version : 0;
|
|
1470
1482
|
} catch {
|
|
1471
1483
|
return 0;
|
|
1472
1484
|
}
|
|
1473
1485
|
}
|
|
1474
|
-
function
|
|
1475
|
-
let { fs: t, isSdkInternal: n } = e, r = n ?
|
|
1486
|
+
function Dn(e) {
|
|
1487
|
+
let { fs: t, isSdkInternal: n } = e, r = n ? wn(t) : Cn(t);
|
|
1476
1488
|
if (r.length === 0) throw new J("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
|
|
1477
|
-
let i =
|
|
1478
|
-
|
|
1489
|
+
let i = hn(r), a = En(t);
|
|
1490
|
+
Kt(a, 0);
|
|
1479
1491
|
let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
|
|
1480
1492
|
if (!o) throw new J("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
|
|
1481
|
-
let s =
|
|
1482
|
-
return
|
|
1493
|
+
let s = Tn(o.name);
|
|
1494
|
+
return yn({
|
|
1483
1495
|
isSdkInternal: n,
|
|
1484
1496
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
1485
1497
|
modules: i,
|
|
@@ -1514,7 +1526,7 @@ var Y = [
|
|
|
1514
1526
|
];
|
|
1515
1527
|
//#endregion
|
|
1516
1528
|
//#region src/structure/rules/root-package-json.ts
|
|
1517
|
-
function
|
|
1529
|
+
function On(e) {
|
|
1518
1530
|
return {
|
|
1519
1531
|
version: "1.0.0",
|
|
1520
1532
|
private: !0,
|
|
@@ -1531,7 +1543,7 @@ function En(e) {
|
|
|
1531
1543
|
changeset: "changeset",
|
|
1532
1544
|
"version-packages": "changeset version",
|
|
1533
1545
|
"update-sdk": "block-tools structure refresh --update-deps-only",
|
|
1534
|
-
update: "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm fmt"
|
|
1546
|
+
update: "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"
|
|
1535
1547
|
},
|
|
1536
1548
|
peerDependencies: {
|
|
1537
1549
|
oxlint: "*",
|
|
@@ -1547,8 +1559,8 @@ function En(e) {
|
|
|
1547
1559
|
packageManager: "pnpm@9.12.0"
|
|
1548
1560
|
};
|
|
1549
1561
|
}
|
|
1550
|
-
function
|
|
1551
|
-
F("packageManager", "pnpm@9.12.0"), Ot("name"), I("fmt", "turbo run fmt"), I("check", "turbo run check"), I("build", "turbo run build"), I("build:dev", "env PL_PKG_DEV=local turbo run build"), I("test", "env PL_PKG_DEV=local turbo run test --concurrency 1"), I("test:dry-run", "env PL_PKG_DEV=local turbo run test --dry-run=json"), I("mark-stable", "turbo run mark-stable"), I("do-pack", "turbo run do-pack"), I("watch", "turbo watch build"), I("changeset", "changeset"), I("version-packages", "changeset version"), I("update-sdk", "block-tools structure refresh --update-deps-only"), I("update", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm fmt"), V({
|
|
1562
|
+
function kn() {
|
|
1563
|
+
F("packageManager", "pnpm@9.12.0"), Ot("name"), I("fmt", "turbo run fmt"), I("check", "turbo run check"), I("build", "turbo run build"), I("build:dev", "env PL_PKG_DEV=local turbo run build"), I("test", "env PL_PKG_DEV=local turbo run test --concurrency 1"), I("test:dry-run", "env PL_PKG_DEV=local turbo run test --dry-run=json"), I("mark-stable", "turbo run mark-stable"), I("do-pack", "turbo run do-pack"), I("watch", "turbo watch build"), I("changeset", "changeset"), I("version-packages", "changeset version"), I("update-sdk", "block-tools structure refresh --update-deps-only"), I("update", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), V({
|
|
1552
1564
|
"@changesets/cli": "catalog:",
|
|
1553
1565
|
"@milaboratories/ts-builder": "sdk:",
|
|
1554
1566
|
"@platforma-sdk/block-tools": "sdk:",
|
|
@@ -1565,54 +1577,73 @@ function Dn() {
|
|
|
1565
1577
|
}
|
|
1566
1578
|
//#endregion
|
|
1567
1579
|
//#region src/structure/engine/registry-client.ts
|
|
1568
|
-
var
|
|
1569
|
-
function
|
|
1580
|
+
var An = 2, jn = 500, Mn = 3e4;
|
|
1581
|
+
function Nn(e) {
|
|
1570
1582
|
if (!e) return null;
|
|
1571
1583
|
let t = Number(e);
|
|
1572
1584
|
if (Number.isFinite(t) && t > 0) return t * 1e3;
|
|
1573
1585
|
let n = Date.parse(e);
|
|
1574
1586
|
return Number.isNaN(n) ? null : Math.max(0, n - Date.now());
|
|
1575
1587
|
}
|
|
1576
|
-
async function
|
|
1588
|
+
async function Pn(e) {
|
|
1577
1589
|
for (let t = 1;; t++) {
|
|
1578
1590
|
let n;
|
|
1579
1591
|
try {
|
|
1580
|
-
n = await fetch(e, { signal: AbortSignal.timeout(
|
|
1592
|
+
n = await fetch(e, { signal: AbortSignal.timeout(Mn) });
|
|
1581
1593
|
} catch (e) {
|
|
1582
|
-
if (t >
|
|
1583
|
-
await
|
|
1594
|
+
if (t > An) throw e;
|
|
1595
|
+
await le(jn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1584
1596
|
continue;
|
|
1585
1597
|
}
|
|
1586
1598
|
if (n.ok) return n;
|
|
1587
|
-
if (!(n.status === 429 || n.status >= 500) || t >
|
|
1588
|
-
let r =
|
|
1599
|
+
if (!(n.status === 429 || n.status >= 500) || t > An) throw Error(`registry returned HTTP ${n.status}`);
|
|
1600
|
+
let r = Nn(n.headers.get("retry-after"));
|
|
1589
1601
|
if (r != null) {
|
|
1590
|
-
await
|
|
1602
|
+
await le(r);
|
|
1591
1603
|
continue;
|
|
1592
1604
|
}
|
|
1593
|
-
await
|
|
1605
|
+
await le(jn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1594
1606
|
}
|
|
1595
1607
|
}
|
|
1596
|
-
function
|
|
1597
|
-
return {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1608
|
+
function Fn() {
|
|
1609
|
+
return {
|
|
1610
|
+
async getLatestVersion(e) {
|
|
1611
|
+
let t = (await (await Pn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
|
|
1612
|
+
if (!t) throw Error("no 'latest' dist-tag in registry response");
|
|
1613
|
+
return t;
|
|
1614
|
+
},
|
|
1615
|
+
async getDeclaredDependency(e, t, n) {
|
|
1616
|
+
let r = await (await Pn(`https://registry.npmjs.org/${e}/${t}`)).json();
|
|
1617
|
+
return r.dependencies?.[n] ?? r.peerDependencies?.[n];
|
|
1618
|
+
}
|
|
1619
|
+
};
|
|
1602
1620
|
}
|
|
1603
|
-
async function
|
|
1621
|
+
async function In(e, t) {
|
|
1604
1622
|
let n = await Promise.all(t.map(async (t) => [t, await e.getLatestVersion(t)]));
|
|
1605
1623
|
return new Map(n);
|
|
1606
1624
|
}
|
|
1607
|
-
function
|
|
1625
|
+
function Ln(e) {
|
|
1608
1626
|
return (t) => e.get(t);
|
|
1609
1627
|
}
|
|
1610
|
-
var
|
|
1611
|
-
function
|
|
1612
|
-
return
|
|
1628
|
+
var Rn = [/^@platforma-sdk\//, /^@milaboratories\//];
|
|
1629
|
+
function zn(e) {
|
|
1630
|
+
return Rn.some((t) => t.test(e));
|
|
1631
|
+
}
|
|
1632
|
+
async function Bn(e, t = Fn()) {
|
|
1633
|
+
return e.length === 0 ? () => void 0 : Ln(await In(t, e));
|
|
1634
|
+
}
|
|
1635
|
+
function Vn(e) {
|
|
1636
|
+
return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
|
|
1613
1637
|
}
|
|
1614
|
-
async function
|
|
1615
|
-
|
|
1638
|
+
async function Hn(e, t = Fn()) {
|
|
1639
|
+
if (e.length === 0) return () => void 0;
|
|
1640
|
+
let n = await Promise.all(e.map(async (e) => {
|
|
1641
|
+
let n = await t.getDeclaredDependency(e.of, e.ofVersion ?? "latest", e.entry);
|
|
1642
|
+
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.`);
|
|
1643
|
+
if (!Vn(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.`);
|
|
1644
|
+
return [e.entry, n];
|
|
1645
|
+
})), r = new Map(n);
|
|
1646
|
+
return (e) => r.get(e);
|
|
1616
1647
|
}
|
|
1617
1648
|
//#endregion
|
|
1618
1649
|
//#region src/structure/rules/root-pnpm-workspace.ts
|
|
@@ -1626,29 +1657,31 @@ var X = [
|
|
|
1626
1657
|
"@platforma-sdk/package-builder",
|
|
1627
1658
|
"@milaboratories/ts-builder",
|
|
1628
1659
|
"@milaboratories/ts-configs"
|
|
1629
|
-
],
|
|
1630
|
-
for (let e of X) if (!
|
|
1631
|
-
var
|
|
1660
|
+
], Un = "0.0.0-init-must-fetch";
|
|
1661
|
+
for (let e of X) if (!zn(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.`);
|
|
1662
|
+
var Wn = {
|
|
1632
1663
|
turbo: "~2.8.11",
|
|
1633
1664
|
shx: "~0.4.0",
|
|
1634
1665
|
"@changesets/cli": "~2.29.8",
|
|
1635
|
-
vitest: "~4.0.18"
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1666
|
+
vitest: "~4.0.18"
|
|
1667
|
+
}, Gn = [{
|
|
1668
|
+
entry: "vue",
|
|
1669
|
+
of: "@platforma-sdk/ui-vue"
|
|
1670
|
+
}], Kn = "@platforma-open/milaboratories.runenv-python-3", qn = "1.8.2";
|
|
1671
|
+
function Jn(e) {
|
|
1639
1672
|
let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
|
|
1640
|
-
for (let e of X) n[e] =
|
|
1641
|
-
return Object.assign(n,
|
|
1673
|
+
for (let e of X) n[e] = Un;
|
|
1674
|
+
return Object.assign(n, Wn), e.modules.some((e) => e.scope === "software") && (n[Kn] = qn), {
|
|
1642
1675
|
packages: t,
|
|
1643
1676
|
catalog: n
|
|
1644
1677
|
};
|
|
1645
1678
|
}
|
|
1646
|
-
function
|
|
1647
|
-
It();
|
|
1679
|
+
function Yn() {
|
|
1680
|
+
It(), Vt("vite"), Vt("tsup"), Vt("vue-tsc");
|
|
1648
1681
|
}
|
|
1649
1682
|
//#endregion
|
|
1650
1683
|
//#region src/structure/rules/root-gitignore.ts
|
|
1651
|
-
var
|
|
1684
|
+
var Xn = [
|
|
1652
1685
|
".test_auth.json",
|
|
1653
1686
|
"node_modules/",
|
|
1654
1687
|
"dist/",
|
|
@@ -1663,34 +1696,34 @@ var Gn = [
|
|
|
1663
1696
|
".vscode/sftp.json",
|
|
1664
1697
|
"test-dry-run.json"
|
|
1665
1698
|
];
|
|
1666
|
-
function
|
|
1667
|
-
|
|
1699
|
+
function Zn() {
|
|
1700
|
+
Ht(Xn);
|
|
1668
1701
|
}
|
|
1669
1702
|
//#endregion
|
|
1670
1703
|
//#region src/structure/rules/root.ts
|
|
1671
|
-
function
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
}),
|
|
1677
|
-
|
|
1678
|
-
}),
|
|
1679
|
-
|
|
1704
|
+
function Qn() {
|
|
1705
|
+
b("root", () => {
|
|
1706
|
+
x(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1707
|
+
C("turbo.json", D("root/turbo.json")), C(".vscode/settings.json", D("root/.vscode/settings.json")), w("package.json", O(() => On(y())), () => {
|
|
1708
|
+
kn();
|
|
1709
|
+
}), w("pnpm-workspace.yaml", O(() => Jn(y())), () => {
|
|
1710
|
+
Yn();
|
|
1711
|
+
}), w(".gitignore", D("root/.gitignore"), () => {
|
|
1712
|
+
Zn();
|
|
1680
1713
|
});
|
|
1681
1714
|
});
|
|
1682
1715
|
});
|
|
1683
1716
|
}
|
|
1684
1717
|
//#endregion
|
|
1685
1718
|
//#region src/structure/rules/block-package-json.ts
|
|
1686
|
-
function
|
|
1719
|
+
function $n(e) {
|
|
1687
1720
|
let t = {};
|
|
1688
1721
|
for (let n of K(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
|
|
1689
1722
|
for (let n of K(e, "model")) t.model = `${n.name}/dist/model.json`;
|
|
1690
1723
|
for (let n of K(e, "ui")) t.ui = `${n.name}/dist`;
|
|
1691
1724
|
return t;
|
|
1692
1725
|
}
|
|
1693
|
-
function
|
|
1726
|
+
function er(e) {
|
|
1694
1727
|
if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
|
|
1695
1728
|
let t = e.meta, n = [
|
|
1696
1729
|
["block.meta.title", t.title],
|
|
@@ -1702,13 +1735,13 @@ function Yn(e) {
|
|
|
1702
1735
|
];
|
|
1703
1736
|
for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
|
|
1704
1737
|
}
|
|
1705
|
-
function
|
|
1738
|
+
function tr(e) {
|
|
1706
1739
|
let t = e.blockVars, n = {
|
|
1707
1740
|
...q(e, "model"),
|
|
1708
1741
|
...q(e, "ui"),
|
|
1709
1742
|
...q(e, "workflow")
|
|
1710
1743
|
}, r = {
|
|
1711
|
-
components:
|
|
1744
|
+
components: $n(e),
|
|
1712
1745
|
meta: {
|
|
1713
1746
|
title: t.shortName,
|
|
1714
1747
|
description: `${t.shortName} block`,
|
|
@@ -1720,7 +1753,7 @@ function Xn(e) {
|
|
|
1720
1753
|
}
|
|
1721
1754
|
}
|
|
1722
1755
|
};
|
|
1723
|
-
return
|
|
1756
|
+
return er(r), {
|
|
1724
1757
|
name: `${t.facadeName}.block`,
|
|
1725
1758
|
version: "1.0.0",
|
|
1726
1759
|
files: ["index.d.ts", "index.js"],
|
|
@@ -1738,15 +1771,15 @@ function Xn(e) {
|
|
|
1738
1771
|
block: r
|
|
1739
1772
|
};
|
|
1740
1773
|
}
|
|
1741
|
-
function
|
|
1742
|
-
F("files", ["index.d.ts", "index.js"]), I("build", "shx rm -rf ./block-pack && block-tools pack"), I("mark-stable", "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("prepublishOnly", "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("do-pack", "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"), U("model"), U("ui"), U("workflow"), z("@platforma-sdk/block-tools", "sdk:"), z("shx", "catalog:"), F("block.components",
|
|
1774
|
+
function nr() {
|
|
1775
|
+
F("files", ["index.d.ts", "index.js"]), I("build", "shx rm -rf ./block-pack && block-tools pack"), I("mark-stable", "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("prepublishOnly", "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("do-pack", "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"), U("model"), U("ui"), U("workflow"), z("@platforma-sdk/block-tools", "sdk:"), z("shx", "catalog:"), F("block.components", $n(y())), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1743
1776
|
}
|
|
1744
1777
|
//#endregion
|
|
1745
1778
|
//#region src/structure/rules/block.ts
|
|
1746
|
-
function
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1779
|
+
function rr() {
|
|
1780
|
+
b("block", () => {
|
|
1781
|
+
C("index.js", D("block/index.js")), C("index.d.ts", D("block/index.d.ts")), T("logos/block-logo.png", Qe("block/logos/block-logo.png")), T("logos/organization-logo.png", Qe("block/logos/organization-logo.png")), w("package.json", O(() => tr(y())), () => {
|
|
1782
|
+
nr();
|
|
1750
1783
|
});
|
|
1751
1784
|
});
|
|
1752
1785
|
}
|
|
@@ -1755,7 +1788,7 @@ function Qn() {
|
|
|
1755
1788
|
var Z = "src/**/*.test.ts";
|
|
1756
1789
|
//#endregion
|
|
1757
1790
|
//#region src/structure/rules/model-package-json.ts
|
|
1758
|
-
function
|
|
1791
|
+
function ir(e) {
|
|
1759
1792
|
return {
|
|
1760
1793
|
name: `${e.blockVars.facadeName}.model`,
|
|
1761
1794
|
version: "1.0.0",
|
|
@@ -1781,8 +1814,7 @@ function $n(e) {
|
|
|
1781
1814
|
devDependencies: {
|
|
1782
1815
|
"@milaboratories/ts-builder": "sdk:",
|
|
1783
1816
|
"@milaboratories/ts-configs": "sdk:",
|
|
1784
|
-
"@platforma-sdk/block-tools": "sdk:"
|
|
1785
|
-
vitest: "catalog:"
|
|
1817
|
+
"@platforma-sdk/block-tools": "sdk:"
|
|
1786
1818
|
},
|
|
1787
1819
|
peerDependencies: {
|
|
1788
1820
|
"@types/node": "*",
|
|
@@ -1790,7 +1822,7 @@ function $n(e) {
|
|
|
1790
1822
|
}
|
|
1791
1823
|
};
|
|
1792
1824
|
}
|
|
1793
|
-
function
|
|
1825
|
+
function ar() {
|
|
1794
1826
|
F("type", "module"), F("main", "dist/index.cjs"), F("module", "dist/index.js"), F("types", "dist/index.d.ts"), F("exports", {
|
|
1795
1827
|
".": {
|
|
1796
1828
|
types: "./dist/index.d.ts",
|
|
@@ -1801,27 +1833,26 @@ function er() {
|
|
|
1801
1833
|
}), I("fmt", "ts-builder format"), I("watch", "ts-builder build --target block-model --watch"), I("build", "ts-builder build --target block-model && block-tools build-model"), I("check", "ts-builder check --target block-model"), R("@platforma-sdk/model", "sdk:"), V({
|
|
1802
1834
|
"@milaboratories/ts-builder": "sdk:",
|
|
1803
1835
|
"@milaboratories/ts-configs": "sdk:",
|
|
1804
|
-
"@platforma-sdk/block-tools": "sdk:"
|
|
1805
|
-
vitest: "catalog:"
|
|
1836
|
+
"@platforma-sdk/block-tools": "sdk:"
|
|
1806
1837
|
}), H({
|
|
1807
1838
|
"@types/node": "*",
|
|
1808
1839
|
typescript: "*"
|
|
1809
|
-
}),
|
|
1810
|
-
I("test", "vitest run --passWithNoTests"), z("@types/node", "*");
|
|
1811
|
-
}), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1840
|
+
}), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Z), () => {
|
|
1841
|
+
I("test", "vitest run --passWithNoTests"), z("vitest", "catalog:"), z("@types/node", "*");
|
|
1842
|
+
}, () => B("vitest"))), B("tsup"), B("vite"), Ot("tsup"), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1812
1843
|
}
|
|
1813
1844
|
//#endregion
|
|
1814
1845
|
//#region src/structure/rules/model.ts
|
|
1815
|
-
function
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1846
|
+
function or() {
|
|
1847
|
+
b("model", () => {
|
|
1848
|
+
x(S(Z), () => C("tsconfig.json", D("model/tsconfig.node.json")), () => C("tsconfig.json", D("model/tsconfig.json"))), C(".oxlintrc.json", D("model/.oxlintrc.json")), C(".oxfmtrc.json", D("model/.oxfmtrc.json")), T("src/index.ts", D("model/src/index.ts")), w("package.json", O(() => ir(y())), () => {
|
|
1849
|
+
ar();
|
|
1819
1850
|
});
|
|
1820
1851
|
});
|
|
1821
1852
|
}
|
|
1822
1853
|
//#endregion
|
|
1823
1854
|
//#region src/structure/rules/ui-package-json.ts
|
|
1824
|
-
function
|
|
1855
|
+
function sr(e) {
|
|
1825
1856
|
return {
|
|
1826
1857
|
name: `${e.blockVars.facadeName}.ui`,
|
|
1827
1858
|
version: "1.0.0",
|
|
@@ -1840,33 +1871,31 @@ function nr(e) {
|
|
|
1840
1871
|
},
|
|
1841
1872
|
devDependencies: {
|
|
1842
1873
|
"@milaboratories/ts-builder": "sdk:",
|
|
1843
|
-
"@milaboratories/ts-configs": "sdk:"
|
|
1844
|
-
vitest: "catalog:"
|
|
1874
|
+
"@milaboratories/ts-configs": "sdk:"
|
|
1845
1875
|
},
|
|
1846
1876
|
peerDependencies: { typescript: "*" }
|
|
1847
1877
|
};
|
|
1848
1878
|
}
|
|
1849
|
-
function
|
|
1879
|
+
function cr() {
|
|
1850
1880
|
F("type", "module"), I("fmt", "ts-builder format"), I("dev", "ts-builder serve --target block-ui"), I("watch", "ts-builder build --target block-ui --watch"), I("build", "ts-builder build --target block-ui"), I("check", "ts-builder check --target block-ui"), R("@platforma-sdk/ui-vue", "sdk:"), R("vue", "catalog:"), U("model"), V({
|
|
1851
1881
|
"@milaboratories/ts-builder": "sdk:",
|
|
1852
|
-
"@milaboratories/ts-configs": "sdk:"
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
}), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1882
|
+
"@milaboratories/ts-configs": "sdk:"
|
|
1883
|
+
}), B("vue-tsc"), B("vite"), kt("preview"), H({ typescript: "*" }), B("@types/node"), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Z), () => {
|
|
1884
|
+
I("test", "vitest run --passWithNoTests"), z("vitest", "catalog:"), z("@types/node", "*");
|
|
1885
|
+
}, () => B("vitest"))), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1857
1886
|
}
|
|
1858
1887
|
//#endregion
|
|
1859
1888
|
//#region src/structure/rules/ui.ts
|
|
1860
|
-
function
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1889
|
+
function lr() {
|
|
1890
|
+
b("ui", () => {
|
|
1891
|
+
x(S(Z), () => C("tsconfig.json", D("ui/tsconfig.node.json")), () => C("tsconfig.json", D("ui/tsconfig.json"))), C(".oxlintrc.json", D("ui/.oxlintrc.json")), C(".oxfmtrc.json", D("ui/.oxfmtrc.json")), Ze("index.html", D("ui/index.html")), T("src/main.ts", D("ui/src/main.ts")), T("src/app.ts", et("ui/src/app.tpl.ts", () => ({ modelPkg: `${tt().facadeName}.model` }))), T("src/MainPage.vue", et("ui/src/MainPage.tpl.vue", () => ({ shortName: tt().shortName }))), w("package.json", O(() => sr(y())), () => {
|
|
1892
|
+
cr();
|
|
1864
1893
|
});
|
|
1865
1894
|
});
|
|
1866
1895
|
}
|
|
1867
1896
|
//#endregion
|
|
1868
1897
|
//#region src/structure/rules/workflow-package-json.ts
|
|
1869
|
-
function
|
|
1898
|
+
function ur(e) {
|
|
1870
1899
|
return {
|
|
1871
1900
|
name: `${e.blockVars.facadeName}.workflow`,
|
|
1872
1901
|
version: "1.0.0",
|
|
@@ -1878,38 +1907,36 @@ function ar(e) {
|
|
|
1878
1907
|
},
|
|
1879
1908
|
dependencies: {
|
|
1880
1909
|
"@platforma-sdk/workflow-tengo": "sdk:",
|
|
1881
|
-
...
|
|
1910
|
+
..._n(e, "software")
|
|
1882
1911
|
},
|
|
1883
1912
|
devDependencies: {
|
|
1884
1913
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1885
1914
|
"@platforma-sdk/test": "sdk:",
|
|
1886
|
-
vitest: "catalog:",
|
|
1887
1915
|
shx: "catalog:"
|
|
1888
1916
|
}
|
|
1889
1917
|
};
|
|
1890
1918
|
}
|
|
1891
|
-
function
|
|
1892
|
-
F("type", "module"), I("build", "shx rm -rf dist && pl-tengo build"), I("check", "pl-tengo check"), I("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"),
|
|
1893
|
-
I("test", "vitest run --passWithNoTests");
|
|
1894
|
-
}), R("@platforma-sdk/workflow-tengo", "sdk:"), U("software"), V({
|
|
1919
|
+
function dr() {
|
|
1920
|
+
F("type", "module"), I("build", "shx rm -rf dist && pl-tengo build"), I("check", "pl-tengo check"), I("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Z), () => {
|
|
1921
|
+
I("test", "vitest run --passWithNoTests"), V({ vitest: "catalog:" });
|
|
1922
|
+
}, () => B("vitest"))), R("@platforma-sdk/workflow-tengo", "sdk:"), U("software"), V({
|
|
1895
1923
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1896
1924
|
"@platforma-sdk/test": "sdk:",
|
|
1897
|
-
vitest: "catalog:",
|
|
1898
1925
|
shx: "catalog:"
|
|
1899
1926
|
}), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1900
1927
|
}
|
|
1901
1928
|
//#endregion
|
|
1902
1929
|
//#region src/structure/rules/workflow.ts
|
|
1903
|
-
function
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1930
|
+
function fr() {
|
|
1931
|
+
b("workflow", () => {
|
|
1932
|
+
C("tsconfig.json", D("workflow/tsconfig.json")), C("format.el", D("workflow/format.el")), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Z), () => Ze("vitest.config.mts", D("workflow/vitest.config.mts")), () => E("vitest.config.mts"))), E("index.js"), E("index.d.ts"), T("src/main.tpl.tengo", et("workflow/src/main.tpl.tengo", () => ({ shortName: tt().shortName }))), w("package.json", O(() => ur(y())), () => {
|
|
1933
|
+
dr();
|
|
1907
1934
|
});
|
|
1908
1935
|
});
|
|
1909
1936
|
}
|
|
1910
1937
|
//#endregion
|
|
1911
1938
|
//#region src/structure/rules/test-package-json.ts
|
|
1912
|
-
function
|
|
1939
|
+
function pr(e) {
|
|
1913
1940
|
return {
|
|
1914
1941
|
name: `${e.blockVars.facadeName}.test`,
|
|
1915
1942
|
version: "1.0.0",
|
|
@@ -1928,7 +1955,7 @@ function cr(e) {
|
|
|
1928
1955
|
}
|
|
1929
1956
|
};
|
|
1930
1957
|
}
|
|
1931
|
-
function
|
|
1958
|
+
function mr() {
|
|
1932
1959
|
F("type", "module"), I("check", "ts-builder type-check --target block-test"), I("test", "vitest run --passWithNoTests"), V({
|
|
1933
1960
|
"@platforma-sdk/test": "sdk:",
|
|
1934
1961
|
"@milaboratories/ts-builder": "sdk:",
|
|
@@ -1938,16 +1965,16 @@ function lr() {
|
|
|
1938
1965
|
}
|
|
1939
1966
|
//#endregion
|
|
1940
1967
|
//#region src/structure/rules/test.ts
|
|
1941
|
-
function
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1968
|
+
function hr() {
|
|
1969
|
+
b("test", () => {
|
|
1970
|
+
C("tsconfig.json", D("test/tsconfig.json")), Ze("vitest.config.mts", D("test/vitest.config.mts")), T("src/demo.test.ts", $e("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), w("package.json", O(() => pr(y())), () => {
|
|
1971
|
+
mr();
|
|
1945
1972
|
});
|
|
1946
1973
|
});
|
|
1947
1974
|
}
|
|
1948
1975
|
//#endregion
|
|
1949
1976
|
//#region src/structure/rules/software-package-json.ts
|
|
1950
|
-
function
|
|
1977
|
+
function gr() {
|
|
1951
1978
|
return { entrypoints: { main: { binary: {
|
|
1952
1979
|
artifact: {
|
|
1953
1980
|
type: "python",
|
|
@@ -1962,7 +1989,7 @@ function dr() {
|
|
|
1962
1989
|
cmd: ["python", "{pkg}/main.py"]
|
|
1963
1990
|
} } } };
|
|
1964
1991
|
}
|
|
1965
|
-
function
|
|
1992
|
+
function _r(e) {
|
|
1966
1993
|
return {
|
|
1967
1994
|
name: `${e.blockVars.facadeName}.software`,
|
|
1968
1995
|
version: "1.0.0",
|
|
@@ -1975,14 +2002,14 @@ function fr(e) {
|
|
|
1975
2002
|
changeset: "changeset",
|
|
1976
2003
|
"version-packages": "changeset version"
|
|
1977
2004
|
},
|
|
1978
|
-
"block-software":
|
|
2005
|
+
"block-software": gr(),
|
|
1979
2006
|
devDependencies: {
|
|
1980
2007
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
1981
2008
|
"@platforma-sdk/package-builder": "sdk:"
|
|
1982
2009
|
}
|
|
1983
2010
|
};
|
|
1984
2011
|
}
|
|
1985
|
-
function
|
|
2012
|
+
function vr() {
|
|
1986
2013
|
F("type", "module"), F("files", ["./dist/**/*"]), I("build", "pl-pkg build"), I("prepublishOnly", "pl-pkg prepublish"), I("changeset", "changeset"), I("version-packages", "changeset version"), V({
|
|
1987
2014
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
1988
2015
|
"@platforma-sdk/package-builder": "sdk:"
|
|
@@ -1990,37 +2017,41 @@ function pr() {
|
|
|
1990
2017
|
}
|
|
1991
2018
|
//#endregion
|
|
1992
2019
|
//#region src/structure/rules/software.ts
|
|
1993
|
-
var
|
|
1994
|
-
function
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2020
|
+
var yr = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", br = "# No dependencies specified for this script\n";
|
|
2021
|
+
function xr() {
|
|
2022
|
+
b("software", () => {
|
|
2023
|
+
T("src/main.py", $e(yr)), T("src/requirements.txt", $e(br)), w("package.json", O(() => _r(y())), () => {
|
|
2024
|
+
vr();
|
|
1998
2025
|
});
|
|
1999
2026
|
});
|
|
2000
2027
|
}
|
|
2001
|
-
function
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
}),
|
|
2005
|
-
|
|
2006
|
-
}),
|
|
2007
|
-
|
|
2008
|
-
}),
|
|
2009
|
-
|
|
2028
|
+
function Sr() {
|
|
2029
|
+
b("model", () => {
|
|
2030
|
+
E("eslint.config.mjs"), E("vite.config.mts");
|
|
2031
|
+
}), b("ui", () => {
|
|
2032
|
+
E("eslint.config.mjs"), E("vite.config.ts"), E("tsconfig.app.json"), E("tsconfig.node.json");
|
|
2033
|
+
}), b("test", () => {
|
|
2034
|
+
E("eslint.config.mjs");
|
|
2035
|
+
}), b("root", () => {
|
|
2036
|
+
E(".prettierrc"), w("package.json", O(() => On(y())), () => {
|
|
2010
2037
|
kt("pretty"), B("@platforma-sdk/blocks-deps-updater");
|
|
2011
2038
|
});
|
|
2012
2039
|
});
|
|
2013
2040
|
}
|
|
2014
2041
|
//#endregion
|
|
2015
2042
|
//#region src/structure/rules/root-catalog-bump.ts
|
|
2016
|
-
function
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2043
|
+
function Cr() {
|
|
2044
|
+
Xe(() => {
|
|
2045
|
+
b("root", () => {
|
|
2046
|
+
x(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
2047
|
+
w("pnpm-workspace.yaml", O(() => Jn(y())), () => {
|
|
2021
2048
|
for (let e of X) zt(e);
|
|
2022
|
-
for (let
|
|
2023
|
-
|
|
2049
|
+
for (let e of Gn) Bt(e.entry, {
|
|
2050
|
+
of: e.of,
|
|
2051
|
+
ofVersion: e.ofVersion
|
|
2052
|
+
});
|
|
2053
|
+
for (let [e, t] of Object.entries(Wn)) Rt(e, t);
|
|
2054
|
+
y().modules.some((e) => e.scope === "software") && Rt(Kn, qn);
|
|
2024
2055
|
});
|
|
2025
2056
|
});
|
|
2026
2057
|
});
|
|
@@ -2028,24 +2059,25 @@ function vr() {
|
|
|
2028
2059
|
}
|
|
2029
2060
|
//#endregion
|
|
2030
2061
|
//#region src/structure/structure-definition.ts
|
|
2031
|
-
var
|
|
2032
|
-
|
|
2062
|
+
var wr = Ue(() => {
|
|
2063
|
+
Qn(), rr(), or(), lr(), fr(), hr(), xr(), Sr(), Cr();
|
|
2033
2064
|
});
|
|
2034
2065
|
//#endregion
|
|
2035
2066
|
//#region src/structure/cli/run-structure.ts
|
|
2036
|
-
async function
|
|
2037
|
-
return
|
|
2067
|
+
async function Tr() {
|
|
2068
|
+
return Bn(X.filter(zn));
|
|
2038
2069
|
}
|
|
2039
|
-
async function
|
|
2040
|
-
let t =
|
|
2070
|
+
async function Er(e) {
|
|
2071
|
+
let t = p.resolve(e.blockPath), n = e.mode === "check", r = new Oe(t), i = new ke(e.templatesRoot), a = ln(wr, r, Dn({
|
|
2041
2072
|
fs: r,
|
|
2042
2073
|
isSdkInternal: e.isSdkInternal,
|
|
2043
2074
|
updateDepsOnly: e.updateDepsOnly,
|
|
2044
2075
|
dryRun: n
|
|
2045
2076
|
}), {
|
|
2046
2077
|
templates: i,
|
|
2047
|
-
registryLookup: e.updateDepsOnly ? await
|
|
2048
|
-
|
|
2078
|
+
registryLookup: e.updateDepsOnly ? await Tr() : void 0,
|
|
2079
|
+
derivedPinLookup: e.updateDepsOnly ? await Hn(Gn) : void 0,
|
|
2080
|
+
rediscover: () => Dn({
|
|
2049
2081
|
fs: r,
|
|
2050
2082
|
isSdkInternal: e.isSdkInternal,
|
|
2051
2083
|
updateDepsOnly: !1,
|
|
@@ -2057,22 +2089,22 @@ async function xr(e) {
|
|
|
2057
2089
|
changes: a.changes
|
|
2058
2090
|
};
|
|
2059
2091
|
}
|
|
2060
|
-
function
|
|
2092
|
+
function Dr(e, t) {
|
|
2061
2093
|
if (t.length === 0) return ` ${e}: up to date (0 changes)`;
|
|
2062
2094
|
let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
|
|
2063
2095
|
return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
|
|
2064
2096
|
}
|
|
2065
2097
|
//#endregion
|
|
2066
2098
|
//#region src/cmd/structure/check.ts
|
|
2067
|
-
var
|
|
2099
|
+
var Or = class e extends d {
|
|
2068
2100
|
static description = "Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.";
|
|
2069
2101
|
static examples = ["<%= config.bin %> <%= command.id %> ./my-block", "<%= config.bin %> <%= command.id %> --sdk-internal etc/blocks/*"];
|
|
2070
2102
|
static strict = !1;
|
|
2071
|
-
static flags = { "sdk-internal":
|
|
2103
|
+
static flags = { "sdk-internal": f.boolean({ description: "block(s) live inside the SDK monorepo; skip root-scope rules" }) };
|
|
2072
2104
|
async run() {
|
|
2073
|
-
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i =
|
|
2105
|
+
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates"), a = !1;
|
|
2074
2106
|
for (let e of r) {
|
|
2075
|
-
let t = await
|
|
2107
|
+
let t = await Er({
|
|
2076
2108
|
blockPath: e,
|
|
2077
2109
|
isSdkInternal: n["sdk-internal"],
|
|
2078
2110
|
updateDepsOnly: !1,
|
|
@@ -2080,32 +2112,32 @@ var Cr = class e extends u {
|
|
|
2080
2112
|
templatesRoot: i,
|
|
2081
2113
|
log: (e) => this.log(e)
|
|
2082
2114
|
});
|
|
2083
|
-
this.log(
|
|
2115
|
+
this.log(Dr(e, t.changes)), t.changes.length > 0 && (a = !0);
|
|
2084
2116
|
}
|
|
2085
2117
|
a && this.error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.", { exit: 1 });
|
|
2086
2118
|
}
|
|
2087
|
-
}, Q = ["python"],
|
|
2119
|
+
}, Q = ["python"], kr = class extends Error {
|
|
2088
2120
|
constructor(e) {
|
|
2089
2121
|
super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
|
|
2090
2122
|
}
|
|
2091
2123
|
};
|
|
2092
2124
|
async function $(e, t, n, r) {
|
|
2093
2125
|
if (e !== void 0 && e !== "") return e;
|
|
2094
|
-
if (n) throw new
|
|
2126
|
+
if (n) throw new kr(t);
|
|
2095
2127
|
return r();
|
|
2096
2128
|
}
|
|
2097
|
-
async function
|
|
2098
|
-
let t = await $(e.npmOrg, "npm-org", e.nonInteractive, () =>
|
|
2129
|
+
async function Ar(e) {
|
|
2130
|
+
let t = await $(e.npmOrg, "npm-org", e.nonInteractive, () => de({
|
|
2099
2131
|
message: "npm org (e.g. @platforma-open):",
|
|
2100
2132
|
default: "@platforma-open"
|
|
2101
|
-
})), n = await $(e.orgScope, "org-scope", e.nonInteractive, () =>
|
|
2102
|
-
i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await
|
|
2133
|
+
})), n = await $(e.orgScope, "org-scope", e.nonInteractive, () => de({ message: "org scope (e.g. my-org):" })), r = await $(e.shortName, "short-name", e.nonInteractive, () => de({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
|
|
2134
|
+
i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await ue({
|
|
2103
2135
|
message: "Include a software module?",
|
|
2104
2136
|
default: !1
|
|
2105
2137
|
}) : e.withSoftware;
|
|
2106
2138
|
let a;
|
|
2107
2139
|
if (i) {
|
|
2108
|
-
if (a = await $(e.platform, "platform", e.nonInteractive, () =>
|
|
2140
|
+
if (a = await $(e.platform, "platform", e.nonInteractive, () => fe({
|
|
2109
2141
|
message: "Software platform:",
|
|
2110
2142
|
choices: Q.map((e) => ({
|
|
2111
2143
|
name: e,
|
|
@@ -2122,59 +2154,60 @@ async function Tr(e) {
|
|
|
2122
2154
|
softwarePlatform: a
|
|
2123
2155
|
};
|
|
2124
2156
|
}
|
|
2125
|
-
async function
|
|
2126
|
-
let t = e.vars, n =
|
|
2157
|
+
async function jr(e) {
|
|
2158
|
+
let t = e.vars, n = vn(t), r = new Oe(e.blockPath), i = new ke(e.templatesRoot), a = yn({
|
|
2127
2159
|
blockVars: t,
|
|
2128
2160
|
modules: n,
|
|
2129
2161
|
isSdkInternal: !1,
|
|
2130
2162
|
version: 1,
|
|
2131
2163
|
dryRun: !1
|
|
2132
|
-
}), o = X.filter(
|
|
2164
|
+
}), o = X.filter(zn), s, c;
|
|
2133
2165
|
try {
|
|
2134
|
-
s = await
|
|
2166
|
+
s = await Bn(o), c = await Hn(Gn);
|
|
2135
2167
|
} catch (e) {
|
|
2136
2168
|
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)}`);
|
|
2137
2169
|
}
|
|
2138
|
-
return
|
|
2170
|
+
return ln(wr, r, a, {
|
|
2139
2171
|
templates: i,
|
|
2140
2172
|
initMode: !0,
|
|
2141
|
-
registryLookup: s
|
|
2173
|
+
registryLookup: s,
|
|
2174
|
+
derivedPinLookup: c
|
|
2142
2175
|
}), e.log(`Initialised block '${t.facadeName}'${t.softwarePlatform ? ` (software: ${t.softwarePlatform})` : " (no software)"} at ${e.blockPath}`), t;
|
|
2143
2176
|
}
|
|
2144
2177
|
//#endregion
|
|
2145
2178
|
//#region src/cmd/index.ts
|
|
2146
|
-
var
|
|
2147
|
-
"build-meta":
|
|
2148
|
-
"build-model":
|
|
2149
|
-
"list-overview-snapshots":
|
|
2150
|
-
"mark-stable":
|
|
2151
|
-
pack:
|
|
2152
|
-
publish:
|
|
2153
|
-
"refresh-registry":
|
|
2154
|
-
"restore-overview-from-snapshot":
|
|
2155
|
-
"update-deps":
|
|
2156
|
-
"upload-package-v1":
|
|
2157
|
-
"structure:check":
|
|
2158
|
-
"structure:init": class e extends
|
|
2179
|
+
var Mr = {
|
|
2180
|
+
"build-meta": pe,
|
|
2181
|
+
"build-model": he,
|
|
2182
|
+
"list-overview-snapshots": ge,
|
|
2183
|
+
"mark-stable": _e,
|
|
2184
|
+
pack: ve,
|
|
2185
|
+
publish: be,
|
|
2186
|
+
"refresh-registry": xe,
|
|
2187
|
+
"restore-overview-from-snapshot": Se,
|
|
2188
|
+
"update-deps": Ce,
|
|
2189
|
+
"upload-package-v1": De,
|
|
2190
|
+
"structure:check": Or,
|
|
2191
|
+
"structure:init": class e extends d {
|
|
2159
2192
|
static description = "Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.";
|
|
2160
2193
|
static examples = ["<%= config.bin %> <%= command.id %> --npm-org @platforma-open --org-scope my-org --short-name demo --no-software --non-interactive", "<%= config.bin %> <%= command.id %> ./demo --npm-org @platforma-open --org-scope my-org --short-name demo --with-software --platform python --non-interactive"];
|
|
2161
|
-
static args = { path:
|
|
2194
|
+
static args = { path: u.string({ description: "target directory (default: <short-name> under the current directory)" }) };
|
|
2162
2195
|
static flags = {
|
|
2163
|
-
"npm-org":
|
|
2164
|
-
"org-scope":
|
|
2165
|
-
"short-name":
|
|
2166
|
-
"with-software":
|
|
2167
|
-
"no-software":
|
|
2168
|
-
platform:
|
|
2196
|
+
"npm-org": f.string({ description: "npm org, e.g. @platforma-open" }),
|
|
2197
|
+
"org-scope": f.string({ description: "org scope, e.g. my-org" }),
|
|
2198
|
+
"short-name": f.string({ description: "block short name, e.g. mixcr-clonotyping" }),
|
|
2199
|
+
"with-software": f.boolean({ description: "include a software module" }),
|
|
2200
|
+
"no-software": f.boolean({ description: "omit the software module" }),
|
|
2201
|
+
platform: f.string({
|
|
2169
2202
|
description: "software platform (single-valued)",
|
|
2170
2203
|
options: [...Q]
|
|
2171
2204
|
}),
|
|
2172
|
-
"non-interactive":
|
|
2205
|
+
"non-interactive": f.boolean({ description: "error on any missing flag instead of prompting" })
|
|
2173
2206
|
};
|
|
2174
2207
|
async run() {
|
|
2175
2208
|
let { args: t, flags: n } = await this.parse(e);
|
|
2176
2209
|
n["with-software"] && n["no-software"] && this.error("--with-software and --no-software are mutually exclusive.");
|
|
2177
|
-
let r = n["with-software"] ? !0 : n["no-software"] ? !1 : void 0, i = await
|
|
2210
|
+
let r = n["with-software"] ? !0 : n["no-software"] ? !1 : void 0, i = await Ar({
|
|
2178
2211
|
npmOrg: n["npm-org"],
|
|
2179
2212
|
orgScope: n["org-scope"],
|
|
2180
2213
|
shortName: n["short-name"],
|
|
@@ -2182,15 +2215,15 @@ var Dr = {
|
|
|
2182
2215
|
platform: n.platform,
|
|
2183
2216
|
nonInteractive: n["non-interactive"]
|
|
2184
2217
|
});
|
|
2185
|
-
await
|
|
2218
|
+
await jr({
|
|
2186
2219
|
vars: i,
|
|
2187
|
-
blockPath: t.path ?
|
|
2188
|
-
templatesRoot:
|
|
2220
|
+
blockPath: t.path ? p.resolve(t.path) : p.resolve(process.cwd(), i.shortName),
|
|
2221
|
+
templatesRoot: p.join(this.config.root, "src", "structure", "templates"),
|
|
2189
2222
|
log: (e) => this.log(e)
|
|
2190
2223
|
});
|
|
2191
2224
|
}
|
|
2192
2225
|
},
|
|
2193
|
-
"structure:refresh": class e extends
|
|
2226
|
+
"structure:refresh": class e extends d {
|
|
2194
2227
|
static 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).";
|
|
2195
2228
|
static examples = [
|
|
2196
2229
|
"<%= config.bin %> <%= command.id %> ./my-block",
|
|
@@ -2199,13 +2232,13 @@ var Dr = {
|
|
|
2199
2232
|
];
|
|
2200
2233
|
static strict = !1;
|
|
2201
2234
|
static flags = {
|
|
2202
|
-
"sdk-internal":
|
|
2203
|
-
"update-deps-only":
|
|
2235
|
+
"sdk-internal": f.boolean({ description: "block(s) live inside the SDK monorepo; skip root-scope rules" }),
|
|
2236
|
+
"update-deps-only": f.boolean({ description: "fire ONLY catalog-bump rules (npm network). Follow with `pnpm install` then a plain refresh." })
|
|
2204
2237
|
};
|
|
2205
2238
|
async run() {
|
|
2206
|
-
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i =
|
|
2239
|
+
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates");
|
|
2207
2240
|
for (let e of r) {
|
|
2208
|
-
let t = await
|
|
2241
|
+
let t = await Er({
|
|
2209
2242
|
blockPath: e,
|
|
2210
2243
|
isSdkInternal: n["sdk-internal"],
|
|
2211
2244
|
updateDepsOnly: n["update-deps-only"],
|
|
@@ -2213,12 +2246,12 @@ var Dr = {
|
|
|
2213
2246
|
templatesRoot: i,
|
|
2214
2247
|
log: (e) => this.log(e)
|
|
2215
2248
|
});
|
|
2216
|
-
this.log(
|
|
2249
|
+
this.log(Dr(e, t.changes));
|
|
2217
2250
|
}
|
|
2218
2251
|
}
|
|
2219
2252
|
}
|
|
2220
2253
|
};
|
|
2221
2254
|
//#endregion
|
|
2222
|
-
export {
|
|
2255
|
+
export { Mr as COMMANDS };
|
|
2223
2256
|
|
|
2224
2257
|
//# sourceMappingURL=cli.mjs.map
|