@platforma-sdk/block-tools 2.10.17 → 2.10.19
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 +674 -615
- 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/structure/rules/shared/retired-deps.d.ts +7 -0
- package/dist/v2/registry/schema_public.d.ts +6177 -6177
- package/package.json +8 -8
- package/src/structure/CLAUDE.md +28 -0
- 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/migrations.ts +15 -16
- package/src/structure/rules/model-package-json.ts +34 -16
- package/src/structure/rules/root-catalog-bump.ts +12 -1
- package/src/structure/rules/root-package-json.ts +15 -11
- package/src/structure/rules/root-pnpm-workspace.ts +21 -8
- package/src/structure/rules/root.ts +0 -1
- package/src/structure/rules/shared/retired-deps.ts +42 -0
- package/src/structure/rules/test-package-json.ts +12 -9
- package/src/structure/rules/test.ts +4 -0
- package/src/structure/rules/ui-package-json.ts +33 -25
- package/src/structure/rules/workflow-package-json.ts +32 -14
- package/src/structure/rules/workflow.ts +32 -8
- package/src/structure/templates/static/test/.oxfmtrc.json +4 -0
- package/src/structure/templates/static/test/.oxlintrc.json +3 -0
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,37 +930,37 @@ 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);
|
|
950
951
|
}
|
|
951
|
-
function
|
|
952
|
+
function L(e) {
|
|
952
953
|
Ot(`scripts.${e}`);
|
|
953
954
|
}
|
|
954
|
-
var
|
|
955
|
+
var kt = [
|
|
955
956
|
"dependencies",
|
|
956
957
|
"devDependencies",
|
|
957
958
|
"peerDependencies",
|
|
958
959
|
"optionalDependencies"
|
|
959
960
|
];
|
|
960
|
-
function
|
|
961
|
-
let i = M(e), a = i.obj, o = n === "sdk:" ?
|
|
962
|
-
for (let e of
|
|
961
|
+
function R(e, t, n, r) {
|
|
962
|
+
let i = M(e), a = i.obj, o = n === "sdk:" ? yt(n, wt(i, e).isSdkInternal) : n;
|
|
963
|
+
for (let e of kt) {
|
|
963
964
|
if (e === r) continue;
|
|
964
965
|
let n = a[e];
|
|
965
966
|
P(n) && t in n && delete n[t];
|
|
@@ -967,115 +968,125 @@ function L(e, t, n, r) {
|
|
|
967
968
|
let s = a[r], c = P(s) ? s : {};
|
|
968
969
|
c[t] = o, P(s) || (a[r] = c);
|
|
969
970
|
}
|
|
970
|
-
function R(e, t) {
|
|
971
|
-
L("ensureDep", e, t, "dependencies");
|
|
972
|
-
}
|
|
973
971
|
function z(e, t) {
|
|
974
|
-
|
|
972
|
+
R("ensureDep", e, t, "dependencies");
|
|
973
|
+
}
|
|
974
|
+
function B(e, t) {
|
|
975
|
+
R("ensureDevDep", e, t, "devDependencies");
|
|
975
976
|
}
|
|
976
|
-
function
|
|
977
|
-
|
|
977
|
+
function At(e, t) {
|
|
978
|
+
R("ensurePeerDep", e, t, "peerDependencies");
|
|
978
979
|
}
|
|
979
|
-
function
|
|
980
|
+
function V(e) {
|
|
980
981
|
let t = M("removeDep").obj;
|
|
981
|
-
for (let n of
|
|
982
|
+
for (let n of kt) {
|
|
982
983
|
let r = t[n];
|
|
983
984
|
P(r) && e in r && delete r[e];
|
|
984
985
|
}
|
|
985
986
|
}
|
|
986
|
-
function V(e) {
|
|
987
|
-
for (let [t, n] of Object.entries(e)) z(t, n);
|
|
988
|
-
}
|
|
989
987
|
function H(e) {
|
|
990
|
-
for (let [t, n] of Object.entries(e))
|
|
988
|
+
for (let [t, n] of Object.entries(e)) B(t, n);
|
|
989
|
+
}
|
|
990
|
+
function U(e) {
|
|
991
|
+
for (let [t, n] of Object.entries(e)) At(t, n);
|
|
991
992
|
}
|
|
992
|
-
function
|
|
993
|
+
function jt(e, t, n) {
|
|
993
994
|
let r = wt(M(e), e);
|
|
994
|
-
for (let i of r.modules) i.scope === t &&
|
|
995
|
+
for (let i of r.modules) i.scope === t && R(e, i.name, "workspace:*", n);
|
|
995
996
|
}
|
|
996
|
-
function
|
|
997
|
-
|
|
997
|
+
function W(e) {
|
|
998
|
+
jt("ensureWorkspaceScopeDeps", e, "dependencies");
|
|
998
999
|
}
|
|
999
|
-
function
|
|
1000
|
+
function Mt(e) {
|
|
1000
1001
|
let t = M("pruneKeysMatching").obj;
|
|
1001
1002
|
for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
|
|
1002
1003
|
}
|
|
1003
|
-
function
|
|
1004
|
-
let n =
|
|
1004
|
+
function Nt(e, t) {
|
|
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
|
}
|
|
1008
|
-
function
|
|
1009
|
-
|
|
1009
|
+
function G(e) {
|
|
1010
|
+
Nt(M("enforceFieldOrder").obj, e);
|
|
1010
1011
|
}
|
|
1011
|
-
function
|
|
1012
|
+
function Pt(e, t) {
|
|
1012
1013
|
let n = Object.keys(e).sort(), r = {};
|
|
1013
1014
|
for (let t of n) r[t] = e[t];
|
|
1014
1015
|
for (let t of Object.keys(e)) delete e[t];
|
|
1015
|
-
for (let i of n) e[i] = r[i], t && P(e[i]) &&
|
|
1016
|
+
for (let i of n) e[i] = r[i], t && P(e[i]) && Pt(e[i], !0);
|
|
1016
1017
|
}
|
|
1017
|
-
function
|
|
1018
|
+
function K(e = "", t = {}) {
|
|
1018
1019
|
let n = t.recursive ?? !1;
|
|
1019
1020
|
if (e === "" && !n) return;
|
|
1020
1021
|
let r = M("enforceAlphabeticalOrder").obj;
|
|
1021
1022
|
if (e === "") {
|
|
1022
|
-
|
|
1023
|
+
Pt(r, !0);
|
|
1023
1024
|
return;
|
|
1024
1025
|
}
|
|
1025
|
-
let i =
|
|
1026
|
-
P(i) &&
|
|
1026
|
+
let i = lt(r, e);
|
|
1027
|
+
P(i) && Pt(i, n);
|
|
1027
1028
|
}
|
|
1028
|
-
function
|
|
1029
|
+
function Ft() {
|
|
1029
1030
|
let e = N("ensureWorkspaceModulePaths"), t = wt(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
|
|
1030
1031
|
Array.isArray(n) && n.length === t.length && n.every((e, n) => e === t[n]) || e.doc.setIn(["packages"], t);
|
|
1031
1032
|
}
|
|
1032
|
-
function
|
|
1033
|
+
function It(e, t) {
|
|
1033
1034
|
let n = e.doc.getIn(["catalog", t]);
|
|
1034
1035
|
return typeof n == "string" ? n : void 0;
|
|
1035
1036
|
}
|
|
1036
|
-
function
|
|
1037
|
+
function Lt(e, t) {
|
|
1037
1038
|
let n = N("ensureCatalogVersion");
|
|
1038
|
-
|
|
1039
|
+
It(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
|
|
1039
1040
|
}
|
|
1040
|
-
function
|
|
1041
|
+
function Rt(e) {
|
|
1041
1042
|
let t = N("ensureCatalogLatest");
|
|
1042
1043
|
if (!t.getLatestVersion) return;
|
|
1043
1044
|
let n = t.getLatestVersion(e);
|
|
1044
|
-
n !== void 0 &&
|
|
1045
|
+
n !== void 0 && It(t, e) !== n && t.doc.setIn(["catalog", e], n);
|
|
1046
|
+
}
|
|
1047
|
+
function zt(e, t) {
|
|
1048
|
+
let n = N("pinCatalogToDependencyOf");
|
|
1049
|
+
if (!n.getDerivedDependencyPin) return;
|
|
1050
|
+
let r = n.getDerivedDependencyPin(e);
|
|
1051
|
+
r !== void 0 && It(n, e) !== r && n.doc.setIn(["catalog", e], r);
|
|
1045
1052
|
}
|
|
1046
1053
|
function Bt(e) {
|
|
1054
|
+
let t = N("ensureCatalogAbsent");
|
|
1055
|
+
t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
|
|
1056
|
+
}
|
|
1057
|
+
function Vt(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 Vt(e) {
|
|
1053
|
-
return ce(e);
|
|
1054
|
-
}
|
|
1055
1063
|
function Ht(e) {
|
|
1064
|
+
return se(e);
|
|
1065
|
+
}
|
|
1066
|
+
function Ut(e) {
|
|
1056
1067
|
return e.toString();
|
|
1057
1068
|
}
|
|
1058
|
-
var
|
|
1059
|
-
function
|
|
1060
|
-
if (e < t) throw new
|
|
1069
|
+
var Wt = ".structure";
|
|
1070
|
+
function Gt(e, t = 0) {
|
|
1071
|
+
if (e < t) throw new Kt(e, t);
|
|
1061
1072
|
}
|
|
1062
|
-
var
|
|
1073
|
+
var Kt = 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 qt(e, t = 1) {
|
|
1068
1079
|
let n = { version: t };
|
|
1069
|
-
e.write(
|
|
1080
|
+
e.write(Wt, JSON.stringify(n));
|
|
1070
1081
|
}
|
|
1071
1082
|
//#endregion
|
|
1072
1083
|
//#region src/structure/engine/runner.ts
|
|
1073
|
-
var
|
|
1084
|
+
var Jt = 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 Yt(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 Xt(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, Yt(n, t, r, i));
|
|
1104
1115
|
}
|
|
1105
|
-
function
|
|
1106
|
-
let
|
|
1116
|
+
function Zt(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 = Ht(t);
|
|
1114
1125
|
return Et(e, n, {
|
|
1115
1126
|
triggerContext: r,
|
|
1116
|
-
getLatestVersion: i
|
|
1117
|
-
|
|
1127
|
+
getLatestVersion: i,
|
|
1128
|
+
getDerivedDependencyPin: a
|
|
1129
|
+
}), Ut(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 Qt(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 $t(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 en(e, t, n) {
|
|
1139
1151
|
return {
|
|
1140
1152
|
ctx: t,
|
|
1141
1153
|
version: t.version,
|
|
1142
|
-
pathExists: (t) =>
|
|
1143
|
-
pathMissing: (t) =>
|
|
1154
|
+
pathExists: (t) => $t(e, t),
|
|
1155
|
+
pathMissing: (t) => !$t(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 tn(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 nn(e, t) {
|
|
1156
1168
|
return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
|
|
1157
1169
|
}
|
|
1158
|
-
function
|
|
1170
|
+
function rn(e, t) {
|
|
1159
1171
|
return e.filter((e) => e.modes.includes(t));
|
|
1160
1172
|
}
|
|
1161
|
-
function
|
|
1173
|
+
function an(e, t, n, r, i, a) {
|
|
1162
1174
|
let o = e.leaf;
|
|
1163
1175
|
if (o.kind === "fixed") {
|
|
1164
|
-
let i =
|
|
1176
|
+
let i = Yt(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 || Xt(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 || Xt(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 on(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 = Yt(c.initial, l, i, s), d = !0);
|
|
1222
|
+
let f = Zt(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 sn(e, t, n, r, i, a, o, s) {
|
|
1237
|
+
let c = rn(e, nn(n, a)), l = [], ee = Qt(t);
|
|
1238
|
+
for (let e of c) {
|
|
1239
|
+
if (e.leaf.kind === "managed" || !tn(e, en(ee, n, e.modulePath))) continue;
|
|
1240
|
+
let o = an(e, t, r, i, a, n.isSdkInternal);
|
|
1241
|
+
o && l.push(o);
|
|
1230
1242
|
}
|
|
1231
|
-
let
|
|
1232
|
-
for (let e of
|
|
1243
|
+
let u = Qt(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 = en(u, n, e.modulePath);
|
|
1247
|
+
if (!tn(e, a)) continue;
|
|
1248
|
+
let c = on(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 cn(e, t, n, r = {}) {
|
|
1254
|
+
return Ve(n, () => {
|
|
1255
|
+
let i = Pe(e, n), a = !!r.initMode, o = sn(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
|
|
1244
1256
|
if (!n.dryRun && !n.updateDepsOnly && !a) {
|
|
1245
|
-
|
|
1257
|
+
qt(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 = sn(Pe(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== Wt);
|
|
1262
|
+
if (a.length > 0) throw new Jt(a[0]);
|
|
1251
1263
|
}
|
|
1252
|
-
return a && !n.dryRun &&
|
|
1264
|
+
return a && !n.dryRun && qt(t), { changes: o };
|
|
1253
1265
|
});
|
|
1254
1266
|
}
|
|
1255
1267
|
//#endregion
|
|
1256
1268
|
//#region src/structure/engine/discovery.ts
|
|
1257
|
-
var
|
|
1269
|
+
var ln = [
|
|
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
|
+
], un = 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 dn(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 fn(e) {
|
|
1281
1293
|
return e === "" || e === ".";
|
|
1282
1294
|
}
|
|
1283
|
-
function
|
|
1295
|
+
function pn(e, t) {
|
|
1284
1296
|
let n = e.pkg["block-scope"];
|
|
1285
1297
|
if (typeof n == "string") {
|
|
1286
|
-
if (!
|
|
1298
|
+
if (!ln.includes(n)) throw new un(`package.json "block-scope" must be one of ${ln.join(", ")}, got '${n}'`, e.path);
|
|
1287
1299
|
return n;
|
|
1288
1300
|
}
|
|
1289
|
-
if (
|
|
1290
|
-
let r =
|
|
1301
|
+
if (fn(e.path)) return "root";
|
|
1302
|
+
let r = dn(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,41 +1314,41 @@ 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 mn(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 = pn(r, t);
|
|
1323
|
+
if (!e) throw new un(`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: fn(r.path) ? "" : r.path
|
|
1316
1328
|
});
|
|
1317
1329
|
}
|
|
1318
1330
|
return n;
|
|
1319
1331
|
}
|
|
1320
1332
|
//#endregion
|
|
1321
1333
|
//#region src/structure/engine/ctx.ts
|
|
1322
|
-
function
|
|
1334
|
+
function q(e, t) {
|
|
1323
1335
|
return e.modules.filter((e) => e.scope === t);
|
|
1324
1336
|
}
|
|
1325
|
-
function
|
|
1326
|
-
let n =
|
|
1337
|
+
function hn(e, t) {
|
|
1338
|
+
let n = q(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
|
-
function
|
|
1332
|
-
return { [
|
|
1343
|
+
function J(e, t) {
|
|
1344
|
+
return { [hn(e, t).name]: "workspace:*" };
|
|
1333
1345
|
}
|
|
1334
|
-
function
|
|
1346
|
+
function gn(e, t) {
|
|
1335
1347
|
let n = {};
|
|
1336
|
-
for (let r of
|
|
1348
|
+
for (let r of q(e, t)) n[r.name] = "workspace:*";
|
|
1337
1349
|
return n;
|
|
1338
1350
|
}
|
|
1339
|
-
function
|
|
1351
|
+
function _n(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 vn(e) {
|
|
1379
1391
|
return {
|
|
1380
1392
|
isSdkInternal: e.isSdkInternal ?? !1,
|
|
1381
1393
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
@@ -1387,41 +1399,41 @@ function _n(e) {
|
|
|
1387
1399
|
}
|
|
1388
1400
|
//#endregion
|
|
1389
1401
|
//#region src/structure/engine/discovery-fs.ts
|
|
1390
|
-
var
|
|
1402
|
+
var Y = class extends Error {
|
|
1391
1403
|
constructor(e) {
|
|
1392
1404
|
super(e), this.name = "StructureCliError";
|
|
1393
1405
|
}
|
|
1394
1406
|
};
|
|
1395
|
-
function
|
|
1407
|
+
function yn(e, t) {
|
|
1396
1408
|
return e === "" ? t : `${e}/${t}`;
|
|
1397
1409
|
}
|
|
1398
|
-
function
|
|
1410
|
+
function bn(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
|
|
1406
|
-
if (e.includes("*")) throw new
|
|
1417
|
+
function xn(e) {
|
|
1418
|
+
if (e.includes("*")) throw new Y(`pnpm-workspace.yaml 'packages:' entry '${e}' contains a glob. The structurer requires literal package paths — replace the glob with one entry per package directory.`);
|
|
1407
1419
|
let t = e.replace(/^\.\//, "").replace(/\/$/, "");
|
|
1408
1420
|
return t === "." ? "" : t;
|
|
1409
1421
|
}
|
|
1410
|
-
function
|
|
1422
|
+
function Sn(e) {
|
|
1411
1423
|
let t;
|
|
1412
1424
|
try {
|
|
1413
1425
|
t = e.read("pnpm-workspace.yaml");
|
|
1414
1426
|
} catch {
|
|
1415
|
-
throw new
|
|
1427
|
+
throw new Y("No pnpm-workspace.yaml found. This directory is empty or unrecognisable as a block — run 'block-tools structure init' instead, or pass --sdk-internal for an in-monorepo block.");
|
|
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 = xn(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 = bn(e, yn(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 Cn(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 = yn(i, s.name), c = bn(e, yn(o, "package.json"));
|
|
1445
1457
|
c && t.push({
|
|
1446
1458
|
path: o,
|
|
1447
1459
|
pkg: c
|
|
@@ -1450,11 +1462,11 @@ function Sn(e) {
|
|
|
1450
1462
|
}
|
|
1451
1463
|
return r("", 1), t;
|
|
1452
1464
|
}
|
|
1453
|
-
function
|
|
1465
|
+
function wn(e) {
|
|
1454
1466
|
let t = e.indexOf("/");
|
|
1455
|
-
if (!e.startsWith("@") || t < 0) throw new
|
|
1467
|
+
if (!e.startsWith("@") || t < 0) throw new Y(`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(".");
|
|
1457
|
-
if (i < 0) throw new
|
|
1469
|
+
if (i < 0) throw new Y(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
|
|
1458
1470
|
return {
|
|
1459
1471
|
facadeName: e,
|
|
1460
1472
|
baseName: r,
|
|
@@ -1463,23 +1475,23 @@ function Cn(e) {
|
|
|
1463
1475
|
shortName: r.slice(i + 1)
|
|
1464
1476
|
};
|
|
1465
1477
|
}
|
|
1466
|
-
function
|
|
1478
|
+
function Tn(e) {
|
|
1467
1479
|
try {
|
|
1468
|
-
let t = JSON.parse(e.read(
|
|
1480
|
+
let t = JSON.parse(e.read(Wt));
|
|
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 ?
|
|
1476
|
-
if (r.length === 0) throw new
|
|
1477
|
-
let i =
|
|
1478
|
-
|
|
1486
|
+
function En(e) {
|
|
1487
|
+
let { fs: t, isSdkInternal: n } = e, r = n ? Cn(t) : Sn(t);
|
|
1488
|
+
if (r.length === 0) throw new Y("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
|
|
1489
|
+
let i = mn(r), a = Tn(t);
|
|
1490
|
+
Gt(a, 0);
|
|
1479
1491
|
let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
|
|
1480
|
-
if (!o) throw new
|
|
1481
|
-
let s =
|
|
1482
|
-
return
|
|
1492
|
+
if (!o) throw new Y("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
|
|
1493
|
+
let s = wn(o.name);
|
|
1494
|
+
return vn({
|
|
1483
1495
|
isSdkInternal: n,
|
|
1484
1496
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
1485
1497
|
modules: i,
|
|
@@ -1490,7 +1502,7 @@ function Tn(e) {
|
|
|
1490
1502
|
}
|
|
1491
1503
|
//#endregion
|
|
1492
1504
|
//#region src/structure/rules/shared/key-order.ts
|
|
1493
|
-
var
|
|
1505
|
+
var X = [
|
|
1494
1506
|
"name",
|
|
1495
1507
|
"version",
|
|
1496
1508
|
"private",
|
|
@@ -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 Dn(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
|
-
|
|
1546
|
+
"upgrade-sdk": "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,76 +1559,109 @@ 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"),
|
|
1562
|
+
function On() {
|
|
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"), L("update"), I("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), H({
|
|
1552
1564
|
"@changesets/cli": "catalog:",
|
|
1553
1565
|
"@milaboratories/ts-builder": "sdk:",
|
|
1554
1566
|
"@platforma-sdk/block-tools": "sdk:",
|
|
1555
1567
|
shx: "catalog:",
|
|
1556
1568
|
turbo: "catalog:"
|
|
1557
|
-
}),
|
|
1569
|
+
}), U({
|
|
1558
1570
|
oxlint: "*",
|
|
1559
1571
|
oxfmt: "*"
|
|
1560
|
-
}),
|
|
1572
|
+
}), Mt((e, t) => {
|
|
1561
1573
|
if (!/^(\/\/|--)/.test(e) || typeof t != "object" || !t) return !1;
|
|
1562
1574
|
let n = t;
|
|
1563
1575
|
return n.pnpm !== void 0 || n.overrides !== void 0;
|
|
1564
|
-
}),
|
|
1576
|
+
}), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1565
1577
|
}
|
|
1566
1578
|
//#endregion
|
|
1567
1579
|
//#region src/structure/engine/registry-client.ts
|
|
1568
|
-
var
|
|
1569
|
-
function
|
|
1580
|
+
var kn = 2, An = 500, jn = 3e4;
|
|
1581
|
+
function Mn(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 Nn(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(jn) });
|
|
1581
1593
|
} catch (e) {
|
|
1582
|
-
if (t >
|
|
1583
|
-
await
|
|
1594
|
+
if (t > kn) throw e;
|
|
1595
|
+
await le(An * 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 > kn) throw Error(`registry returned HTTP ${n.status}`);
|
|
1600
|
+
let r = Mn(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(An * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1594
1606
|
}
|
|
1595
1607
|
}
|
|
1596
|
-
function
|
|
1597
|
-
return {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1608
|
+
function Pn() {
|
|
1609
|
+
return {
|
|
1610
|
+
async getLatestVersion(e) {
|
|
1611
|
+
let t = (await (await Nn(`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 Nn(`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 Fn(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 In(e) {
|
|
1608
1626
|
return (t) => e.get(t);
|
|
1609
1627
|
}
|
|
1610
|
-
var
|
|
1611
|
-
function
|
|
1612
|
-
return
|
|
1628
|
+
var Ln = [/^@platforma-sdk\//, /^@milaboratories\//];
|
|
1629
|
+
function Rn(e) {
|
|
1630
|
+
return Ln.some((t) => t.test(e));
|
|
1613
1631
|
}
|
|
1614
|
-
async function
|
|
1615
|
-
return e.length === 0 ? () => void 0 :
|
|
1632
|
+
async function zn(e, t = Pn()) {
|
|
1633
|
+
return e.length === 0 ? () => void 0 : In(await Fn(t, e));
|
|
1634
|
+
}
|
|
1635
|
+
function Bn(e) {
|
|
1636
|
+
return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
|
|
1637
|
+
}
|
|
1638
|
+
async function Vn(e, t = Pn()) {
|
|
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 (!Bn(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);
|
|
1647
|
+
}
|
|
1648
|
+
//#endregion
|
|
1649
|
+
//#region src/structure/rules/shared/retired-deps.ts
|
|
1650
|
+
// @vitejs/plugin-vue — bundled by ts-builder's internal vite config.
|
|
1651
|
+
var Hn = [
|
|
1652
|
+
"vite",
|
|
1653
|
+
"tsup",
|
|
1654
|
+
"vue-tsc",
|
|
1655
|
+
"@vitejs/plugin-vue",
|
|
1656
|
+
"vite-plugin-dts",
|
|
1657
|
+
"@platforma-sdk/eslint-config"
|
|
1658
|
+
];
|
|
1659
|
+
function Un() {
|
|
1660
|
+
for (let e of Hn) V(e);
|
|
1616
1661
|
}
|
|
1617
1662
|
//#endregion
|
|
1618
1663
|
//#region src/structure/rules/root-pnpm-workspace.ts
|
|
1619
|
-
var
|
|
1664
|
+
var Z = [
|
|
1620
1665
|
"@platforma-sdk/model",
|
|
1621
1666
|
"@platforma-sdk/ui-vue",
|
|
1622
1667
|
"@platforma-sdk/workflow-tengo",
|
|
@@ -1626,29 +1671,32 @@ var X = [
|
|
|
1626
1671
|
"@platforma-sdk/package-builder",
|
|
1627
1672
|
"@milaboratories/ts-builder",
|
|
1628
1673
|
"@milaboratories/ts-configs"
|
|
1629
|
-
],
|
|
1630
|
-
for (let e of
|
|
1631
|
-
var
|
|
1674
|
+
], Wn = "0.0.0-init-must-fetch";
|
|
1675
|
+
for (let e of Z) if (!Rn(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.`);
|
|
1676
|
+
var Gn = {
|
|
1632
1677
|
turbo: "~2.8.11",
|
|
1633
1678
|
shx: "~0.4.0",
|
|
1634
1679
|
"@changesets/cli": "~2.29.8",
|
|
1635
|
-
vitest: "~4.0.18"
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1680
|
+
vitest: "~4.0.18"
|
|
1681
|
+
}, Kn = [{
|
|
1682
|
+
entry: "vue",
|
|
1683
|
+
of: "@platforma-sdk/ui-vue"
|
|
1684
|
+
}], qn = "@platforma-open/milaboratories.runenv-python-3", Jn = "1.8.2";
|
|
1685
|
+
function Yn(e) {
|
|
1639
1686
|
let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
|
|
1640
|
-
for (let e of
|
|
1641
|
-
return Object.assign(n,
|
|
1687
|
+
for (let e of Z) n[e] = Wn;
|
|
1688
|
+
return Object.assign(n, Gn), e.modules.some((e) => e.scope === "software") && (n[qn] = Jn), {
|
|
1642
1689
|
packages: t,
|
|
1643
1690
|
catalog: n
|
|
1644
1691
|
};
|
|
1645
1692
|
}
|
|
1646
|
-
function
|
|
1647
|
-
|
|
1693
|
+
function Xn() {
|
|
1694
|
+
Ft();
|
|
1695
|
+
for (let e of Hn) Bt(e);
|
|
1648
1696
|
}
|
|
1649
1697
|
//#endregion
|
|
1650
1698
|
//#region src/structure/rules/root-gitignore.ts
|
|
1651
|
-
var
|
|
1699
|
+
var Zn = [
|
|
1652
1700
|
".test_auth.json",
|
|
1653
1701
|
"node_modules/",
|
|
1654
1702
|
"dist/",
|
|
@@ -1663,34 +1711,34 @@ var Gn = [
|
|
|
1663
1711
|
".vscode/sftp.json",
|
|
1664
1712
|
"test-dry-run.json"
|
|
1665
1713
|
];
|
|
1666
|
-
function
|
|
1667
|
-
|
|
1714
|
+
function Qn() {
|
|
1715
|
+
Vt(Zn);
|
|
1668
1716
|
}
|
|
1669
1717
|
//#endregion
|
|
1670
1718
|
//#region src/structure/rules/root.ts
|
|
1671
|
-
function
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
}),
|
|
1677
|
-
|
|
1678
|
-
}),
|
|
1679
|
-
|
|
1719
|
+
function $n() {
|
|
1720
|
+
b("root", () => {
|
|
1721
|
+
x(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1722
|
+
C("turbo.json", D("root/turbo.json")), C(".vscode/settings.json", D("root/.vscode/settings.json")), w("package.json", O(() => Dn(y())), () => {
|
|
1723
|
+
On();
|
|
1724
|
+
}), w("pnpm-workspace.yaml", O(() => Yn(y())), () => {
|
|
1725
|
+
Xn();
|
|
1726
|
+
}), w(".gitignore", D("root/.gitignore"), () => {
|
|
1727
|
+
Qn();
|
|
1680
1728
|
});
|
|
1681
1729
|
});
|
|
1682
1730
|
});
|
|
1683
1731
|
}
|
|
1684
1732
|
//#endregion
|
|
1685
1733
|
//#region src/structure/rules/block-package-json.ts
|
|
1686
|
-
function
|
|
1734
|
+
function er(e) {
|
|
1687
1735
|
let t = {};
|
|
1688
|
-
for (let n of
|
|
1689
|
-
for (let n of
|
|
1690
|
-
for (let n of
|
|
1736
|
+
for (let n of q(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
|
|
1737
|
+
for (let n of q(e, "model")) t.model = `${n.name}/dist/model.json`;
|
|
1738
|
+
for (let n of q(e, "ui")) t.ui = `${n.name}/dist`;
|
|
1691
1739
|
return t;
|
|
1692
1740
|
}
|
|
1693
|
-
function
|
|
1741
|
+
function tr(e) {
|
|
1694
1742
|
if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
|
|
1695
1743
|
let t = e.meta, n = [
|
|
1696
1744
|
["block.meta.title", t.title],
|
|
@@ -1702,13 +1750,13 @@ function Yn(e) {
|
|
|
1702
1750
|
];
|
|
1703
1751
|
for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
|
|
1704
1752
|
}
|
|
1705
|
-
function
|
|
1753
|
+
function nr(e) {
|
|
1706
1754
|
let t = e.blockVars, n = {
|
|
1707
|
-
...
|
|
1708
|
-
...
|
|
1709
|
-
...
|
|
1755
|
+
...J(e, "model"),
|
|
1756
|
+
...J(e, "ui"),
|
|
1757
|
+
...J(e, "workflow")
|
|
1710
1758
|
}, r = {
|
|
1711
|
-
components:
|
|
1759
|
+
components: er(e),
|
|
1712
1760
|
meta: {
|
|
1713
1761
|
title: t.shortName,
|
|
1714
1762
|
description: `${t.shortName} block`,
|
|
@@ -1720,7 +1768,7 @@ function Xn(e) {
|
|
|
1720
1768
|
}
|
|
1721
1769
|
}
|
|
1722
1770
|
};
|
|
1723
|
-
return
|
|
1771
|
+
return tr(r), {
|
|
1724
1772
|
name: `${t.facadeName}.block`,
|
|
1725
1773
|
version: "1.0.0",
|
|
1726
1774
|
files: ["index.d.ts", "index.js"],
|
|
@@ -1738,24 +1786,24 @@ function Xn(e) {
|
|
|
1738
1786
|
block: r
|
|
1739
1787
|
};
|
|
1740
1788
|
}
|
|
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"),
|
|
1789
|
+
function rr() {
|
|
1790
|
+
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"), W("model"), W("ui"), W("workflow"), B("@platforma-sdk/block-tools", "sdk:"), B("shx", "catalog:"), F("block.components", er(y())), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1743
1791
|
}
|
|
1744
1792
|
//#endregion
|
|
1745
1793
|
//#region src/structure/rules/block.ts
|
|
1746
|
-
function
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1794
|
+
function ir() {
|
|
1795
|
+
b("block", () => {
|
|
1796
|
+
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(() => nr(y())), () => {
|
|
1797
|
+
rr();
|
|
1750
1798
|
});
|
|
1751
1799
|
});
|
|
1752
1800
|
}
|
|
1753
1801
|
//#endregion
|
|
1754
1802
|
//#region src/structure/rules/shared/colocated-tests.ts
|
|
1755
|
-
var
|
|
1803
|
+
var Q = "src/**/*.test.ts";
|
|
1756
1804
|
//#endregion
|
|
1757
1805
|
//#region src/structure/rules/model-package-json.ts
|
|
1758
|
-
function
|
|
1806
|
+
function ar(e) {
|
|
1759
1807
|
return {
|
|
1760
1808
|
name: `${e.blockVars.facadeName}.model`,
|
|
1761
1809
|
version: "1.0.0",
|
|
@@ -1781,8 +1829,7 @@ function $n(e) {
|
|
|
1781
1829
|
devDependencies: {
|
|
1782
1830
|
"@milaboratories/ts-builder": "sdk:",
|
|
1783
1831
|
"@milaboratories/ts-configs": "sdk:",
|
|
1784
|
-
"@platforma-sdk/block-tools": "sdk:"
|
|
1785
|
-
vitest: "catalog:"
|
|
1832
|
+
"@platforma-sdk/block-tools": "sdk:"
|
|
1786
1833
|
},
|
|
1787
1834
|
peerDependencies: {
|
|
1788
1835
|
"@types/node": "*",
|
|
@@ -1790,7 +1837,7 @@ function $n(e) {
|
|
|
1790
1837
|
}
|
|
1791
1838
|
};
|
|
1792
1839
|
}
|
|
1793
|
-
function
|
|
1840
|
+
function or() {
|
|
1794
1841
|
F("type", "module"), F("main", "dist/index.cjs"), F("module", "dist/index.js"), F("types", "dist/index.d.ts"), F("exports", {
|
|
1795
1842
|
".": {
|
|
1796
1843
|
types: "./dist/index.d.ts",
|
|
@@ -1798,30 +1845,29 @@ function er() {
|
|
|
1798
1845
|
import: "./dist/index.js"
|
|
1799
1846
|
},
|
|
1800
1847
|
"./dist/*": "./dist/*"
|
|
1801
|
-
}), 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"),
|
|
1848
|
+
}), 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"), z("@platforma-sdk/model", "sdk:"), H({
|
|
1802
1849
|
"@milaboratories/ts-builder": "sdk:",
|
|
1803
1850
|
"@milaboratories/ts-configs": "sdk:",
|
|
1804
|
-
"@platforma-sdk/block-tools": "sdk:"
|
|
1805
|
-
|
|
1806
|
-
}), H({
|
|
1851
|
+
"@platforma-sdk/block-tools": "sdk:"
|
|
1852
|
+
}), U({
|
|
1807
1853
|
"@types/node": "*",
|
|
1808
1854
|
typescript: "*"
|
|
1809
|
-
}),
|
|
1810
|
-
I("test", "vitest run --passWithNoTests"),
|
|
1811
|
-
}),
|
|
1855
|
+
}), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
|
|
1856
|
+
I("test", "vitest run --passWithNoTests"), B("vitest", "catalog:"), B("@types/node", "*");
|
|
1857
|
+
}, () => V("vitest"))), Un(), Ot("tsup"), L("lint"), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1812
1858
|
}
|
|
1813
1859
|
//#endregion
|
|
1814
1860
|
//#region src/structure/rules/model.ts
|
|
1815
|
-
function
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1861
|
+
function sr() {
|
|
1862
|
+
b("model", () => {
|
|
1863
|
+
x(S(Q), () => 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(() => ar(y())), () => {
|
|
1864
|
+
or();
|
|
1819
1865
|
});
|
|
1820
1866
|
});
|
|
1821
1867
|
}
|
|
1822
1868
|
//#endregion
|
|
1823
1869
|
//#region src/structure/rules/ui-package-json.ts
|
|
1824
|
-
function
|
|
1870
|
+
function cr(e) {
|
|
1825
1871
|
return {
|
|
1826
1872
|
name: `${e.blockVars.facadeName}.ui`,
|
|
1827
1873
|
version: "1.0.0",
|
|
@@ -1836,37 +1882,41 @@ function nr(e) {
|
|
|
1836
1882
|
dependencies: {
|
|
1837
1883
|
"@platforma-sdk/ui-vue": "sdk:",
|
|
1838
1884
|
vue: "catalog:",
|
|
1839
|
-
...
|
|
1885
|
+
...J(e, "model")
|
|
1840
1886
|
},
|
|
1841
1887
|
devDependencies: {
|
|
1842
1888
|
"@milaboratories/ts-builder": "sdk:",
|
|
1843
|
-
"@milaboratories/ts-configs": "sdk:"
|
|
1844
|
-
vitest: "catalog:"
|
|
1889
|
+
"@milaboratories/ts-configs": "sdk:"
|
|
1845
1890
|
},
|
|
1846
|
-
peerDependencies: {
|
|
1891
|
+
peerDependencies: {
|
|
1892
|
+
"@types/node": "*",
|
|
1893
|
+
typescript: "*"
|
|
1894
|
+
}
|
|
1847
1895
|
};
|
|
1848
1896
|
}
|
|
1849
|
-
function
|
|
1850
|
-
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"),
|
|
1897
|
+
function lr() {
|
|
1898
|
+
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"), z("@platforma-sdk/ui-vue", "sdk:"), z("vue", "catalog:"), W("model"), H({
|
|
1851
1899
|
"@milaboratories/ts-builder": "sdk:",
|
|
1852
|
-
"@milaboratories/ts-configs": "sdk:"
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
}),
|
|
1900
|
+
"@milaboratories/ts-configs": "sdk:"
|
|
1901
|
+
}), Un(), L("preview"), L("lint"), U({
|
|
1902
|
+
"@types/node": "*",
|
|
1903
|
+
typescript: "*"
|
|
1904
|
+
}), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
|
|
1905
|
+
I("test", "vitest run --passWithNoTests"), B("vitest", "catalog:"), B("@types/node", "*");
|
|
1906
|
+
}, () => V("vitest"))), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1857
1907
|
}
|
|
1858
1908
|
//#endregion
|
|
1859
1909
|
//#region src/structure/rules/ui.ts
|
|
1860
|
-
function
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1910
|
+
function ur() {
|
|
1911
|
+
b("ui", () => {
|
|
1912
|
+
x(S(Q), () => 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(() => cr(y())), () => {
|
|
1913
|
+
lr();
|
|
1864
1914
|
});
|
|
1865
1915
|
});
|
|
1866
1916
|
}
|
|
1867
1917
|
//#endregion
|
|
1868
1918
|
//#region src/structure/rules/workflow-package-json.ts
|
|
1869
|
-
function
|
|
1919
|
+
function dr(e) {
|
|
1870
1920
|
return {
|
|
1871
1921
|
name: `${e.blockVars.facadeName}.workflow`,
|
|
1872
1922
|
version: "1.0.0",
|
|
@@ -1878,45 +1928,48 @@ function ar(e) {
|
|
|
1878
1928
|
},
|
|
1879
1929
|
dependencies: {
|
|
1880
1930
|
"@platforma-sdk/workflow-tengo": "sdk:",
|
|
1881
|
-
...
|
|
1931
|
+
...gn(e, "software")
|
|
1882
1932
|
},
|
|
1883
1933
|
devDependencies: {
|
|
1884
1934
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1885
1935
|
"@platforma-sdk/test": "sdk:",
|
|
1886
|
-
vitest: "catalog:",
|
|
1887
1936
|
shx: "catalog:"
|
|
1888
1937
|
}
|
|
1889
1938
|
};
|
|
1890
1939
|
}
|
|
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
|
-
}),
|
|
1940
|
+
function fr() {
|
|
1941
|
+
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(Q), () => {
|
|
1942
|
+
I("test", "vitest run --passWithNoTests"), H({ vitest: "catalog:" });
|
|
1943
|
+
}, () => V("vitest"))), z("@platforma-sdk/workflow-tengo", "sdk:"), W("software"), H({
|
|
1895
1944
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1896
1945
|
"@platforma-sdk/test": "sdk:",
|
|
1897
|
-
vitest: "catalog:",
|
|
1898
1946
|
shx: "catalog:"
|
|
1899
|
-
}),
|
|
1947
|
+
}), Un(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1900
1948
|
}
|
|
1901
1949
|
//#endregion
|
|
1902
1950
|
//#region src/structure/rules/workflow.ts
|
|
1903
|
-
function
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1951
|
+
function pr() {
|
|
1952
|
+
b("workflow", () => {
|
|
1953
|
+
C("format.el", D("workflow/format.el")), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
|
|
1954
|
+
C("tsconfig.json", D("workflow/tsconfig.json")), Ze("vitest.config.mts", D("workflow/vitest.config.mts"));
|
|
1955
|
+
}, () => {
|
|
1956
|
+
E("tsconfig.json"), E("vitest.config.mts");
|
|
1957
|
+
})), 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(() => dr(y())), () => {
|
|
1958
|
+
fr();
|
|
1907
1959
|
});
|
|
1908
1960
|
});
|
|
1909
1961
|
}
|
|
1910
1962
|
//#endregion
|
|
1911
1963
|
//#region src/structure/rules/test-package-json.ts
|
|
1912
|
-
function
|
|
1964
|
+
function mr(e) {
|
|
1913
1965
|
return {
|
|
1914
1966
|
name: `${e.blockVars.facadeName}.test`,
|
|
1915
1967
|
version: "1.0.0",
|
|
1916
1968
|
private: !0,
|
|
1917
1969
|
type: "module",
|
|
1918
1970
|
scripts: {
|
|
1919
|
-
|
|
1971
|
+
fmt: "ts-builder format",
|
|
1972
|
+
check: "ts-builder check --target block-test",
|
|
1920
1973
|
test: "vitest run --passWithNoTests"
|
|
1921
1974
|
},
|
|
1922
1975
|
peerDependencies: { typescript: "*" },
|
|
@@ -1928,26 +1981,26 @@ function cr(e) {
|
|
|
1928
1981
|
}
|
|
1929
1982
|
};
|
|
1930
1983
|
}
|
|
1931
|
-
function
|
|
1932
|
-
F("type", "module"), I("check", "ts-builder
|
|
1984
|
+
function hr() {
|
|
1985
|
+
F("type", "module"), I("fmt", "ts-builder format"), I("check", "ts-builder check --target block-test"), I("test", "vitest run --passWithNoTests"), L("lint"), H({
|
|
1933
1986
|
"@platforma-sdk/test": "sdk:",
|
|
1934
1987
|
"@milaboratories/ts-builder": "sdk:",
|
|
1935
1988
|
"@milaboratories/ts-configs": "sdk:",
|
|
1936
1989
|
vitest: "catalog:"
|
|
1937
|
-
}),
|
|
1990
|
+
}), U({ typescript: "*" }), V("@types/node"), Un(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1938
1991
|
}
|
|
1939
1992
|
//#endregion
|
|
1940
1993
|
//#region src/structure/rules/test.ts
|
|
1941
|
-
function
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1994
|
+
function gr() {
|
|
1995
|
+
b("test", () => {
|
|
1996
|
+
C("tsconfig.json", D("test/tsconfig.json")), C(".oxlintrc.json", D("test/.oxlintrc.json")), C(".oxfmtrc.json", D("test/.oxfmtrc.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(() => mr(y())), () => {
|
|
1997
|
+
hr();
|
|
1945
1998
|
});
|
|
1946
1999
|
});
|
|
1947
2000
|
}
|
|
1948
2001
|
//#endregion
|
|
1949
2002
|
//#region src/structure/rules/software-package-json.ts
|
|
1950
|
-
function
|
|
2003
|
+
function _r() {
|
|
1951
2004
|
return { entrypoints: { main: { binary: {
|
|
1952
2005
|
artifact: {
|
|
1953
2006
|
type: "python",
|
|
@@ -1962,7 +2015,7 @@ function dr() {
|
|
|
1962
2015
|
cmd: ["python", "{pkg}/main.py"]
|
|
1963
2016
|
} } } };
|
|
1964
2017
|
}
|
|
1965
|
-
function
|
|
2018
|
+
function vr(e) {
|
|
1966
2019
|
return {
|
|
1967
2020
|
name: `${e.blockVars.facadeName}.software`,
|
|
1968
2021
|
version: "1.0.0",
|
|
@@ -1975,52 +2028,56 @@ function fr(e) {
|
|
|
1975
2028
|
changeset: "changeset",
|
|
1976
2029
|
"version-packages": "changeset version"
|
|
1977
2030
|
},
|
|
1978
|
-
"block-software":
|
|
2031
|
+
"block-software": _r(),
|
|
1979
2032
|
devDependencies: {
|
|
1980
2033
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
1981
2034
|
"@platforma-sdk/package-builder": "sdk:"
|
|
1982
2035
|
}
|
|
1983
2036
|
};
|
|
1984
2037
|
}
|
|
1985
|
-
function
|
|
1986
|
-
F("type", "module"), F("files", ["./dist/**/*"]), I("build", "pl-pkg build"), I("prepublishOnly", "pl-pkg prepublish"), I("changeset", "changeset"), I("version-packages", "changeset version"),
|
|
2038
|
+
function yr() {
|
|
2039
|
+
F("type", "module"), F("files", ["./dist/**/*"]), I("build", "pl-pkg build"), I("prepublishOnly", "pl-pkg prepublish"), I("changeset", "changeset"), I("version-packages", "changeset version"), H({
|
|
1987
2040
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
1988
2041
|
"@platforma-sdk/package-builder": "sdk:"
|
|
1989
|
-
}),
|
|
2042
|
+
}), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1990
2043
|
}
|
|
1991
2044
|
//#endregion
|
|
1992
2045
|
//#region src/structure/rules/software.ts
|
|
1993
|
-
var
|
|
1994
|
-
function
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2046
|
+
var br = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", xr = "# No dependencies specified for this script\n";
|
|
2047
|
+
function Sr() {
|
|
2048
|
+
b("software", () => {
|
|
2049
|
+
T("src/main.py", $e(br)), T("src/requirements.txt", $e(xr)), w("package.json", O(() => vr(y())), () => {
|
|
2050
|
+
yr();
|
|
1998
2051
|
});
|
|
1999
2052
|
});
|
|
2000
2053
|
}
|
|
2001
|
-
function
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
}),
|
|
2005
|
-
|
|
2006
|
-
}),
|
|
2007
|
-
|
|
2008
|
-
}),
|
|
2009
|
-
|
|
2010
|
-
|
|
2054
|
+
function Cr() {
|
|
2055
|
+
b("model", () => {
|
|
2056
|
+
E("eslint.config.mjs"), E("vite.config.mts");
|
|
2057
|
+
}), b("ui", () => {
|
|
2058
|
+
E("eslint.config.mjs"), E("vite.config.ts"), E("tsconfig.app.json"), E("tsconfig.node.json");
|
|
2059
|
+
}), b("test", () => {
|
|
2060
|
+
E("eslint.config.mjs");
|
|
2061
|
+
}), b("root", () => {
|
|
2062
|
+
E(".prettierrc"), w("package.json", O(() => Dn(y())), () => {
|
|
2063
|
+
L("pretty"), V("@platforma-sdk/blocks-deps-updater");
|
|
2011
2064
|
});
|
|
2012
2065
|
});
|
|
2013
2066
|
}
|
|
2014
2067
|
//#endregion
|
|
2015
2068
|
//#region src/structure/rules/root-catalog-bump.ts
|
|
2016
|
-
function
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
for (let e of
|
|
2022
|
-
for (let
|
|
2023
|
-
|
|
2069
|
+
function wr() {
|
|
2070
|
+
Xe(() => {
|
|
2071
|
+
b("root", () => {
|
|
2072
|
+
x(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
2073
|
+
w("pnpm-workspace.yaml", O(() => Yn(y())), () => {
|
|
2074
|
+
for (let e of Z) Rt(e);
|
|
2075
|
+
for (let e of Kn) zt(e.entry, {
|
|
2076
|
+
of: e.of,
|
|
2077
|
+
ofVersion: e.ofVersion
|
|
2078
|
+
});
|
|
2079
|
+
for (let [e, t] of Object.entries(Gn)) Lt(e, t);
|
|
2080
|
+
y().modules.some((e) => e.scope === "software") && Lt(qn, Jn);
|
|
2024
2081
|
});
|
|
2025
2082
|
});
|
|
2026
2083
|
});
|
|
@@ -2028,24 +2085,25 @@ function vr() {
|
|
|
2028
2085
|
}
|
|
2029
2086
|
//#endregion
|
|
2030
2087
|
//#region src/structure/structure-definition.ts
|
|
2031
|
-
var
|
|
2032
|
-
|
|
2088
|
+
var Tr = Ue(() => {
|
|
2089
|
+
$n(), ir(), sr(), ur(), pr(), gr(), Sr(), Cr(), wr();
|
|
2033
2090
|
});
|
|
2034
2091
|
//#endregion
|
|
2035
2092
|
//#region src/structure/cli/run-structure.ts
|
|
2036
|
-
async function
|
|
2037
|
-
return
|
|
2093
|
+
async function Er() {
|
|
2094
|
+
return zn(Z.filter(Rn));
|
|
2038
2095
|
}
|
|
2039
|
-
async function
|
|
2040
|
-
let t =
|
|
2096
|
+
async function Dr(e) {
|
|
2097
|
+
let t = p.resolve(e.blockPath), n = e.mode === "check", r = new Oe(t), i = new ke(e.templatesRoot), a = cn(Tr, r, En({
|
|
2041
2098
|
fs: r,
|
|
2042
2099
|
isSdkInternal: e.isSdkInternal,
|
|
2043
2100
|
updateDepsOnly: e.updateDepsOnly,
|
|
2044
2101
|
dryRun: n
|
|
2045
2102
|
}), {
|
|
2046
2103
|
templates: i,
|
|
2047
|
-
registryLookup: e.updateDepsOnly ? await
|
|
2048
|
-
|
|
2104
|
+
registryLookup: e.updateDepsOnly ? await Er() : void 0,
|
|
2105
|
+
derivedPinLookup: e.updateDepsOnly ? await Vn(Kn) : void 0,
|
|
2106
|
+
rediscover: () => En({
|
|
2049
2107
|
fs: r,
|
|
2050
2108
|
isSdkInternal: e.isSdkInternal,
|
|
2051
2109
|
updateDepsOnly: !1,
|
|
@@ -2057,22 +2115,22 @@ async function xr(e) {
|
|
|
2057
2115
|
changes: a.changes
|
|
2058
2116
|
};
|
|
2059
2117
|
}
|
|
2060
|
-
function
|
|
2118
|
+
function Or(e, t) {
|
|
2061
2119
|
if (t.length === 0) return ` ${e}: up to date (0 changes)`;
|
|
2062
2120
|
let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
|
|
2063
2121
|
return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
|
|
2064
2122
|
}
|
|
2065
2123
|
//#endregion
|
|
2066
2124
|
//#region src/cmd/structure/check.ts
|
|
2067
|
-
var
|
|
2125
|
+
var kr = class e extends d {
|
|
2068
2126
|
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
2127
|
static examples = ["<%= config.bin %> <%= command.id %> ./my-block", "<%= config.bin %> <%= command.id %> --sdk-internal etc/blocks/*"];
|
|
2070
2128
|
static strict = !1;
|
|
2071
|
-
static flags = { "sdk-internal":
|
|
2129
|
+
static flags = { "sdk-internal": f.boolean({ description: "block(s) live inside the SDK monorepo; skip root-scope rules" }) };
|
|
2072
2130
|
async run() {
|
|
2073
|
-
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i =
|
|
2131
|
+
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
2132
|
for (let e of r) {
|
|
2075
|
-
let t = await
|
|
2133
|
+
let t = await Dr({
|
|
2076
2134
|
blockPath: e,
|
|
2077
2135
|
isSdkInternal: n["sdk-internal"],
|
|
2078
2136
|
updateDepsOnly: !1,
|
|
@@ -2080,38 +2138,38 @@ var Cr = class e extends u {
|
|
|
2080
2138
|
templatesRoot: i,
|
|
2081
2139
|
log: (e) => this.log(e)
|
|
2082
2140
|
});
|
|
2083
|
-
this.log(
|
|
2141
|
+
this.log(Or(e, t.changes)), t.changes.length > 0 && (a = !0);
|
|
2084
2142
|
}
|
|
2085
2143
|
a && this.error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.", { exit: 1 });
|
|
2086
2144
|
}
|
|
2087
|
-
},
|
|
2145
|
+
}, $ = ["python"], Ar = class extends Error {
|
|
2088
2146
|
constructor(e) {
|
|
2089
2147
|
super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
|
|
2090
2148
|
}
|
|
2091
2149
|
};
|
|
2092
|
-
async function
|
|
2150
|
+
async function jr(e, t, n, r) {
|
|
2093
2151
|
if (e !== void 0 && e !== "") return e;
|
|
2094
|
-
if (n) throw new
|
|
2152
|
+
if (n) throw new Ar(t);
|
|
2095
2153
|
return r();
|
|
2096
2154
|
}
|
|
2097
|
-
async function
|
|
2098
|
-
let t = await
|
|
2155
|
+
async function Mr(e) {
|
|
2156
|
+
let t = await jr(e.npmOrg, "npm-org", e.nonInteractive, () => de({
|
|
2099
2157
|
message: "npm org (e.g. @platforma-open):",
|
|
2100
2158
|
default: "@platforma-open"
|
|
2101
|
-
})), n = await
|
|
2102
|
-
i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await
|
|
2159
|
+
})), n = await jr(e.orgScope, "org-scope", e.nonInteractive, () => de({ message: "org scope (e.g. my-org):" })), r = await jr(e.shortName, "short-name", e.nonInteractive, () => de({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
|
|
2160
|
+
i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await ue({
|
|
2103
2161
|
message: "Include a software module?",
|
|
2104
2162
|
default: !1
|
|
2105
2163
|
}) : e.withSoftware;
|
|
2106
2164
|
let a;
|
|
2107
2165
|
if (i) {
|
|
2108
|
-
if (a = await
|
|
2166
|
+
if (a = await jr(e.platform, "platform", e.nonInteractive, () => fe({
|
|
2109
2167
|
message: "Software platform:",
|
|
2110
|
-
choices:
|
|
2168
|
+
choices: $.map((e) => ({
|
|
2111
2169
|
name: e,
|
|
2112
2170
|
value: e
|
|
2113
2171
|
}))
|
|
2114
|
-
})),
|
|
2172
|
+
})), !$.includes(a)) throw Error(`Unsupported --platform '${a}'. Only ${$.join(", ")} ${$.length === 1 ? "is" : "are"} supported at v1.`);
|
|
2115
2173
|
} else if (e.platform) throw Error("--platform was given but software is disabled (--no-software).");
|
|
2116
2174
|
return {
|
|
2117
2175
|
facadeName: `${t}/${n}.${r}`,
|
|
@@ -2122,59 +2180,60 @@ async function Tr(e) {
|
|
|
2122
2180
|
softwarePlatform: a
|
|
2123
2181
|
};
|
|
2124
2182
|
}
|
|
2125
|
-
async function
|
|
2126
|
-
let t = e.vars, n =
|
|
2183
|
+
async function Nr(e) {
|
|
2184
|
+
let t = e.vars, n = _n(t), r = new Oe(e.blockPath), i = new ke(e.templatesRoot), a = vn({
|
|
2127
2185
|
blockVars: t,
|
|
2128
2186
|
modules: n,
|
|
2129
2187
|
isSdkInternal: !1,
|
|
2130
2188
|
version: 1,
|
|
2131
2189
|
dryRun: !1
|
|
2132
|
-
}), o =
|
|
2190
|
+
}), o = Z.filter(Rn), s, c;
|
|
2133
2191
|
try {
|
|
2134
|
-
s = await
|
|
2192
|
+
s = await zn(o), c = await Vn(Kn);
|
|
2135
2193
|
} catch (e) {
|
|
2136
2194
|
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
2195
|
}
|
|
2138
|
-
return
|
|
2196
|
+
return cn(Tr, r, a, {
|
|
2139
2197
|
templates: i,
|
|
2140
2198
|
initMode: !0,
|
|
2141
|
-
registryLookup: s
|
|
2199
|
+
registryLookup: s,
|
|
2200
|
+
derivedPinLookup: c
|
|
2142
2201
|
}), e.log(`Initialised block '${t.facadeName}'${t.softwarePlatform ? ` (software: ${t.softwarePlatform})` : " (no software)"} at ${e.blockPath}`), t;
|
|
2143
2202
|
}
|
|
2144
2203
|
//#endregion
|
|
2145
2204
|
//#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
|
|
2205
|
+
var Pr = {
|
|
2206
|
+
"build-meta": pe,
|
|
2207
|
+
"build-model": he,
|
|
2208
|
+
"list-overview-snapshots": ge,
|
|
2209
|
+
"mark-stable": _e,
|
|
2210
|
+
pack: ve,
|
|
2211
|
+
publish: be,
|
|
2212
|
+
"refresh-registry": xe,
|
|
2213
|
+
"restore-overview-from-snapshot": Se,
|
|
2214
|
+
"update-deps": Ce,
|
|
2215
|
+
"upload-package-v1": De,
|
|
2216
|
+
"structure:check": kr,
|
|
2217
|
+
"structure:init": class e extends d {
|
|
2159
2218
|
static description = "Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.";
|
|
2160
2219
|
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:
|
|
2220
|
+
static args = { path: u.string({ description: "target directory (default: <short-name> under the current directory)" }) };
|
|
2162
2221
|
static flags = {
|
|
2163
|
-
"npm-org":
|
|
2164
|
-
"org-scope":
|
|
2165
|
-
"short-name":
|
|
2166
|
-
"with-software":
|
|
2167
|
-
"no-software":
|
|
2168
|
-
platform:
|
|
2222
|
+
"npm-org": f.string({ description: "npm org, e.g. @platforma-open" }),
|
|
2223
|
+
"org-scope": f.string({ description: "org scope, e.g. my-org" }),
|
|
2224
|
+
"short-name": f.string({ description: "block short name, e.g. mixcr-clonotyping" }),
|
|
2225
|
+
"with-software": f.boolean({ description: "include a software module" }),
|
|
2226
|
+
"no-software": f.boolean({ description: "omit the software module" }),
|
|
2227
|
+
platform: f.string({
|
|
2169
2228
|
description: "software platform (single-valued)",
|
|
2170
|
-
options: [
|
|
2229
|
+
options: [...$]
|
|
2171
2230
|
}),
|
|
2172
|
-
"non-interactive":
|
|
2231
|
+
"non-interactive": f.boolean({ description: "error on any missing flag instead of prompting" })
|
|
2173
2232
|
};
|
|
2174
2233
|
async run() {
|
|
2175
2234
|
let { args: t, flags: n } = await this.parse(e);
|
|
2176
2235
|
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
|
|
2236
|
+
let r = n["with-software"] ? !0 : n["no-software"] ? !1 : void 0, i = await Mr({
|
|
2178
2237
|
npmOrg: n["npm-org"],
|
|
2179
2238
|
orgScope: n["org-scope"],
|
|
2180
2239
|
shortName: n["short-name"],
|
|
@@ -2182,15 +2241,15 @@ var Dr = {
|
|
|
2182
2241
|
platform: n.platform,
|
|
2183
2242
|
nonInteractive: n["non-interactive"]
|
|
2184
2243
|
});
|
|
2185
|
-
await
|
|
2244
|
+
await Nr({
|
|
2186
2245
|
vars: i,
|
|
2187
|
-
blockPath: t.path ?
|
|
2188
|
-
templatesRoot:
|
|
2246
|
+
blockPath: t.path ? p.resolve(t.path) : p.resolve(process.cwd(), i.shortName),
|
|
2247
|
+
templatesRoot: p.join(this.config.root, "src", "structure", "templates"),
|
|
2189
2248
|
log: (e) => this.log(e)
|
|
2190
2249
|
});
|
|
2191
2250
|
}
|
|
2192
2251
|
},
|
|
2193
|
-
"structure:refresh": class e extends
|
|
2252
|
+
"structure:refresh": class e extends d {
|
|
2194
2253
|
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
2254
|
static examples = [
|
|
2196
2255
|
"<%= config.bin %> <%= command.id %> ./my-block",
|
|
@@ -2199,13 +2258,13 @@ var Dr = {
|
|
|
2199
2258
|
];
|
|
2200
2259
|
static strict = !1;
|
|
2201
2260
|
static flags = {
|
|
2202
|
-
"sdk-internal":
|
|
2203
|
-
"update-deps-only":
|
|
2261
|
+
"sdk-internal": f.boolean({ description: "block(s) live inside the SDK monorepo; skip root-scope rules" }),
|
|
2262
|
+
"update-deps-only": f.boolean({ description: "fire ONLY catalog-bump rules (npm network). Follow with `pnpm install` then a plain refresh." })
|
|
2204
2263
|
};
|
|
2205
2264
|
async run() {
|
|
2206
|
-
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i =
|
|
2265
|
+
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates");
|
|
2207
2266
|
for (let e of r) {
|
|
2208
|
-
let t = await
|
|
2267
|
+
let t = await Dr({
|
|
2209
2268
|
blockPath: e,
|
|
2210
2269
|
isSdkInternal: n["sdk-internal"],
|
|
2211
2270
|
updateDepsOnly: n["update-deps-only"],
|
|
@@ -2213,12 +2272,12 @@ var Dr = {
|
|
|
2213
2272
|
templatesRoot: i,
|
|
2214
2273
|
log: (e) => this.log(e)
|
|
2215
2274
|
});
|
|
2216
|
-
this.log(
|
|
2275
|
+
this.log(Or(e, t.changes));
|
|
2217
2276
|
}
|
|
2218
2277
|
}
|
|
2219
2278
|
}
|
|
2220
2279
|
};
|
|
2221
2280
|
//#endregion
|
|
2222
|
-
export {
|
|
2281
|
+
export { Pr as COMMANDS };
|
|
2223
2282
|
|
|
2224
2283
|
//# sourceMappingURL=cli.mjs.map
|