@platforma-sdk/block-tools 2.10.18 → 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 +9 -9
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +314 -288
- package/dist/cli.mjs.map +1 -1
- package/dist/structure/rules/shared/retired-deps.d.ts +7 -0
- package/dist/v2/registry/schema_public.d.ts +150 -150
- package/package.json +7 -7
- package/src/structure/CLAUDE.md +28 -0
- package/src/structure/rules/migrations.ts +15 -16
- package/src/structure/rules/model-package-json.ts +4 -5
- package/src/structure/rules/root-package-json.ts +8 -6
- package/src/structure/rules/root-pnpm-workspace.ts +4 -7
- 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 +15 -21
- package/src/structure/rules/workflow-package-json.ts +7 -3
- package/src/structure/rules/workflow.ts +17 -12
- 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
|
@@ -949,18 +949,18 @@ function Ot(e, t) {
|
|
|
949
949
|
function I(e, t) {
|
|
950
950
|
F(`scripts.${e}`, t);
|
|
951
951
|
}
|
|
952
|
-
function
|
|
952
|
+
function L(e) {
|
|
953
953
|
Ot(`scripts.${e}`);
|
|
954
954
|
}
|
|
955
|
-
var
|
|
955
|
+
var kt = [
|
|
956
956
|
"dependencies",
|
|
957
957
|
"devDependencies",
|
|
958
958
|
"peerDependencies",
|
|
959
959
|
"optionalDependencies"
|
|
960
960
|
];
|
|
961
|
-
function
|
|
961
|
+
function R(e, t, n, r) {
|
|
962
962
|
let i = M(e), a = i.obj, o = n === "sdk:" ? yt(n, wt(i, e).isSdkInternal) : n;
|
|
963
|
-
for (let e of
|
|
963
|
+
for (let e of kt) {
|
|
964
964
|
if (e === r) continue;
|
|
965
965
|
let n = a[e];
|
|
966
966
|
P(n) && t in n && delete n[t];
|
|
@@ -968,125 +968,125 @@ function L(e, t, n, r) {
|
|
|
968
968
|
let s = a[r], c = P(s) ? s : {};
|
|
969
969
|
c[t] = o, P(s) || (a[r] = c);
|
|
970
970
|
}
|
|
971
|
-
function R(e, t) {
|
|
972
|
-
L("ensureDep", e, t, "dependencies");
|
|
973
|
-
}
|
|
974
971
|
function z(e, t) {
|
|
975
|
-
|
|
972
|
+
R("ensureDep", e, t, "dependencies");
|
|
973
|
+
}
|
|
974
|
+
function B(e, t) {
|
|
975
|
+
R("ensureDevDep", e, t, "devDependencies");
|
|
976
976
|
}
|
|
977
|
-
function
|
|
978
|
-
|
|
977
|
+
function At(e, t) {
|
|
978
|
+
R("ensurePeerDep", e, t, "peerDependencies");
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function V(e) {
|
|
981
981
|
let t = M("removeDep").obj;
|
|
982
|
-
for (let n of
|
|
982
|
+
for (let n of kt) {
|
|
983
983
|
let r = t[n];
|
|
984
984
|
P(r) && e in r && delete r[e];
|
|
985
985
|
}
|
|
986
986
|
}
|
|
987
|
-
function V(e) {
|
|
988
|
-
for (let [t, n] of Object.entries(e)) z(t, n);
|
|
989
|
-
}
|
|
990
987
|
function H(e) {
|
|
991
|
-
for (let [t, n] of Object.entries(e))
|
|
988
|
+
for (let [t, n] of Object.entries(e)) B(t, n);
|
|
992
989
|
}
|
|
993
|
-
function
|
|
990
|
+
function U(e) {
|
|
991
|
+
for (let [t, n] of Object.entries(e)) At(t, n);
|
|
992
|
+
}
|
|
993
|
+
function jt(e, t, n) {
|
|
994
994
|
let r = wt(M(e), e);
|
|
995
|
-
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);
|
|
996
996
|
}
|
|
997
|
-
function
|
|
998
|
-
|
|
997
|
+
function W(e) {
|
|
998
|
+
jt("ensureWorkspaceScopeDeps", e, "dependencies");
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1000
|
+
function Mt(e) {
|
|
1001
1001
|
let t = M("pruneKeysMatching").obj;
|
|
1002
1002
|
for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1004
|
+
function Nt(e, t) {
|
|
1005
1005
|
let n = pt(e, t);
|
|
1006
1006
|
for (let t of Object.keys(e)) delete e[t];
|
|
1007
1007
|
for (let t of Object.keys(n)) e[t] = n[t];
|
|
1008
1008
|
}
|
|
1009
|
-
function
|
|
1010
|
-
|
|
1009
|
+
function G(e) {
|
|
1010
|
+
Nt(M("enforceFieldOrder").obj, e);
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1012
|
+
function Pt(e, t) {
|
|
1013
1013
|
let n = Object.keys(e).sort(), r = {};
|
|
1014
1014
|
for (let t of n) r[t] = e[t];
|
|
1015
1015
|
for (let t of Object.keys(e)) delete e[t];
|
|
1016
|
-
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);
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1018
|
+
function K(e = "", t = {}) {
|
|
1019
1019
|
let n = t.recursive ?? !1;
|
|
1020
1020
|
if (e === "" && !n) return;
|
|
1021
1021
|
let r = M("enforceAlphabeticalOrder").obj;
|
|
1022
1022
|
if (e === "") {
|
|
1023
|
-
|
|
1023
|
+
Pt(r, !0);
|
|
1024
1024
|
return;
|
|
1025
1025
|
}
|
|
1026
1026
|
let i = lt(r, e);
|
|
1027
|
-
P(i) &&
|
|
1027
|
+
P(i) && Pt(i, n);
|
|
1028
1028
|
}
|
|
1029
|
-
function
|
|
1029
|
+
function Ft() {
|
|
1030
1030
|
let e = N("ensureWorkspaceModulePaths"), t = wt(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
|
|
1031
1031
|
Array.isArray(n) && n.length === t.length && n.every((e, n) => e === t[n]) || e.doc.setIn(["packages"], t);
|
|
1032
1032
|
}
|
|
1033
|
-
function
|
|
1033
|
+
function It(e, t) {
|
|
1034
1034
|
let n = e.doc.getIn(["catalog", t]);
|
|
1035
1035
|
return typeof n == "string" ? n : void 0;
|
|
1036
1036
|
}
|
|
1037
|
-
function
|
|
1037
|
+
function Lt(e, t) {
|
|
1038
1038
|
let n = N("ensureCatalogVersion");
|
|
1039
|
-
|
|
1039
|
+
It(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1041
|
+
function Rt(e) {
|
|
1042
1042
|
let t = N("ensureCatalogLatest");
|
|
1043
1043
|
if (!t.getLatestVersion) return;
|
|
1044
1044
|
let n = t.getLatestVersion(e);
|
|
1045
|
-
n !== void 0 &&
|
|
1045
|
+
n !== void 0 && It(t, e) !== n && t.doc.setIn(["catalog", e], n);
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1047
|
+
function zt(e, t) {
|
|
1048
1048
|
let n = N("pinCatalogToDependencyOf");
|
|
1049
1049
|
if (!n.getDerivedDependencyPin) return;
|
|
1050
1050
|
let r = n.getDerivedDependencyPin(e);
|
|
1051
|
-
r !== void 0 &&
|
|
1051
|
+
r !== void 0 && It(n, e) !== r && n.doc.setIn(["catalog", e], r);
|
|
1052
1052
|
}
|
|
1053
|
-
function
|
|
1053
|
+
function Bt(e) {
|
|
1054
1054
|
let t = N("ensureCatalogAbsent");
|
|
1055
1055
|
t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function Vt(e) {
|
|
1058
1058
|
let t = Ct("ensureGitignoreEntries");
|
|
1059
1059
|
for (let n of e) vt(t.lines, n) || t.lines.push(n);
|
|
1060
1060
|
}
|
|
1061
1061
|
//#endregion
|
|
1062
1062
|
//#region src/structure/engine/parsers/yaml.ts
|
|
1063
|
-
function
|
|
1063
|
+
function Ht(e) {
|
|
1064
1064
|
return se(e);
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1066
|
+
function Ut(e) {
|
|
1067
1067
|
return e.toString();
|
|
1068
1068
|
}
|
|
1069
|
-
var
|
|
1070
|
-
function
|
|
1071
|
-
if (e < t) throw new
|
|
1069
|
+
var Wt = ".structure";
|
|
1070
|
+
function Gt(e, t = 0) {
|
|
1071
|
+
if (e < t) throw new Kt(e, t);
|
|
1072
1072
|
}
|
|
1073
|
-
var
|
|
1073
|
+
var Kt = class extends Error {
|
|
1074
1074
|
constructor(e, t) {
|
|
1075
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";
|
|
1076
1076
|
}
|
|
1077
1077
|
};
|
|
1078
|
-
function
|
|
1078
|
+
function qt(e, t = 1) {
|
|
1079
1079
|
let n = { version: t };
|
|
1080
|
-
e.write(
|
|
1080
|
+
e.write(Wt, JSON.stringify(n));
|
|
1081
1081
|
}
|
|
1082
1082
|
//#endregion
|
|
1083
1083
|
//#region src/structure/engine/runner.ts
|
|
1084
|
-
var
|
|
1084
|
+
var Jt = class extends Error {
|
|
1085
1085
|
constructor(e) {
|
|
1086
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";
|
|
1087
1087
|
}
|
|
1088
1088
|
};
|
|
1089
|
-
function
|
|
1089
|
+
function Yt(e, t, n, r) {
|
|
1090
1090
|
switch (e.kind) {
|
|
1091
1091
|
case "text": return e.value;
|
|
1092
1092
|
case "file":
|
|
@@ -1105,15 +1105,15 @@ function Xt(e, t, n, r) {
|
|
|
1105
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.`);
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
|
-
function
|
|
1108
|
+
function Xt(e, t, n, r, i) {
|
|
1109
1109
|
if (n.kind === "binary") {
|
|
1110
1110
|
if (!r) throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
|
|
1111
1111
|
e.writeBinary(t, r.staticReadBinary(n.path));
|
|
1112
1112
|
return;
|
|
1113
1113
|
}
|
|
1114
|
-
e.write(t,
|
|
1114
|
+
e.write(t, Yt(n, t, r, i));
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1116
|
+
function Zt(e, t, n, r, i, a) {
|
|
1117
1117
|
let o = e.split("/").pop() ?? e;
|
|
1118
1118
|
if (e.endsWith(".json")) {
|
|
1119
1119
|
let i = nt(t);
|
|
@@ -1121,12 +1121,12 @@ function Qt(e, t, n, r, i, a) {
|
|
|
1121
1121
|
return Tt(i, n, { triggerContext: r }), ct(i, { collapse: o !== "package.json" });
|
|
1122
1122
|
}
|
|
1123
1123
|
if (e.endsWith(".yaml") || e.endsWith(".yml")) {
|
|
1124
|
-
let e =
|
|
1124
|
+
let e = Ht(t);
|
|
1125
1125
|
return Et(e, n, {
|
|
1126
1126
|
triggerContext: r,
|
|
1127
1127
|
getLatestVersion: i,
|
|
1128
1128
|
getDerivedDependencyPin: a
|
|
1129
|
-
}),
|
|
1129
|
+
}), Ut(e);
|
|
1130
1130
|
}
|
|
1131
1131
|
if (o === ".gitignore" || o.endsWith(".gitignore")) {
|
|
1132
1132
|
let e = mt(t);
|
|
@@ -1134,7 +1134,7 @@ function Qt(e, t, n, r, i, a) {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`);
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1137
|
+
function Qt(e) {
|
|
1138
1138
|
let t = e.list(""), n = /* @__PURE__ */ new Set();
|
|
1139
1139
|
for (let e of t) {
|
|
1140
1140
|
n.add(e);
|
|
@@ -1143,16 +1143,16 @@ function $t(e) {
|
|
|
1143
1143
|
}
|
|
1144
1144
|
return n;
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1146
|
+
function $t(e, t) {
|
|
1147
1147
|
let n = t === "" ? t : t.endsWith("/") ? t.slice(0, -1) : t;
|
|
1148
1148
|
return e.has(n);
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1150
|
+
function en(e, t, n) {
|
|
1151
1151
|
return {
|
|
1152
1152
|
ctx: t,
|
|
1153
1153
|
version: t.version,
|
|
1154
|
-
pathExists: (t) =>
|
|
1155
|
-
pathMissing: (t) =>
|
|
1154
|
+
pathExists: (t) => $t(e, t),
|
|
1155
|
+
pathMissing: (t) => !$t(e, t),
|
|
1156
1156
|
filesMatch: (t) => {
|
|
1157
1157
|
let r = n ? `${n}/${t}` : t;
|
|
1158
1158
|
for (let t of e) if (ze(r, t)) return !0;
|
|
@@ -1160,20 +1160,20 @@ function tn(e, t, n) {
|
|
|
1160
1160
|
}
|
|
1161
1161
|
};
|
|
1162
1162
|
}
|
|
1163
|
-
function
|
|
1163
|
+
function tn(e, t) {
|
|
1164
1164
|
for (let n of e.triggers) if (!n(t)) return !1;
|
|
1165
1165
|
return !0;
|
|
1166
1166
|
}
|
|
1167
|
-
function
|
|
1167
|
+
function nn(e, t) {
|
|
1168
1168
|
return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
|
|
1169
1169
|
}
|
|
1170
|
-
function
|
|
1170
|
+
function rn(e, t) {
|
|
1171
1171
|
return e.filter((e) => e.modes.includes(t));
|
|
1172
1172
|
}
|
|
1173
|
-
function
|
|
1173
|
+
function an(e, t, n, r, i, a) {
|
|
1174
1174
|
let o = e.leaf;
|
|
1175
1175
|
if (o.kind === "fixed") {
|
|
1176
|
-
let i =
|
|
1176
|
+
let i = Yt(o.content, e.resolvedPath, r, a);
|
|
1177
1177
|
return t.exists(e.resolvedPath) ? t.read(e.resolvedPath) === i ? void 0 : (n || t.write(e.resolvedPath, i), {
|
|
1178
1178
|
scope: e.scope,
|
|
1179
1179
|
path: e.resolvedPath,
|
|
@@ -1186,13 +1186,13 @@ function on(e, t, n, r, i, a) {
|
|
|
1186
1186
|
action: "create"
|
|
1187
1187
|
});
|
|
1188
1188
|
}
|
|
1189
|
-
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), {
|
|
1190
1190
|
scope: e.scope,
|
|
1191
1191
|
path: e.resolvedPath,
|
|
1192
1192
|
primitive: "scaffold",
|
|
1193
1193
|
action: "create"
|
|
1194
1194
|
});
|
|
1195
|
-
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), {
|
|
1196
1196
|
scope: e.scope,
|
|
1197
1197
|
path: e.resolvedPath,
|
|
1198
1198
|
primitive: "seed",
|
|
@@ -1215,11 +1215,11 @@ function on(e, t, n, r, i, a) {
|
|
|
1215
1215
|
});
|
|
1216
1216
|
}
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1218
|
+
function on(e, t, n, r, i, a, o, s) {
|
|
1219
1219
|
if (e.leaf.kind !== "managed") return;
|
|
1220
1220
|
let c = e.leaf, l = e.resolvedPath, ee = t.exists(l), u, d = !1;
|
|
1221
|
-
ee ? u = t.read(l) : (u =
|
|
1222
|
-
let f =
|
|
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
1223
|
if (d) return n || t.write(l, f), {
|
|
1224
1224
|
scope: e.scope,
|
|
1225
1225
|
path: l,
|
|
@@ -1233,40 +1233,40 @@ function sn(e, t, n, r, i, a, o, s) {
|
|
|
1233
1233
|
action: "update"
|
|
1234
1234
|
};
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1237
|
-
let c =
|
|
1236
|
+
function sn(e, t, n, r, i, a, o, s) {
|
|
1237
|
+
let c = rn(e, nn(n, a)), l = [], ee = Qt(t);
|
|
1238
1238
|
for (let e of c) {
|
|
1239
|
-
if (e.leaf.kind === "managed" || !
|
|
1240
|
-
let o =
|
|
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
1241
|
o && l.push(o);
|
|
1242
1242
|
}
|
|
1243
|
-
let u =
|
|
1243
|
+
let u = Qt(t);
|
|
1244
1244
|
for (let e of c) {
|
|
1245
1245
|
if (e.leaf.kind !== "managed") continue;
|
|
1246
|
-
let a =
|
|
1247
|
-
if (!
|
|
1248
|
-
let c =
|
|
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
1249
|
c && l.push(c);
|
|
1250
1250
|
}
|
|
1251
1251
|
return l;
|
|
1252
1252
|
}
|
|
1253
|
-
function
|
|
1253
|
+
function cn(e, t, n, r = {}) {
|
|
1254
1254
|
return Ve(n, () => {
|
|
1255
|
-
let i = Pe(e, n), a = !!r.initMode, o =
|
|
1255
|
+
let i = Pe(e, n), a = !!r.initMode, o = sn(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
|
|
1256
1256
|
if (!n.dryRun && !n.updateDepsOnly && !a) {
|
|
1257
|
-
|
|
1257
|
+
qt(t);
|
|
1258
1258
|
let i = {
|
|
1259
1259
|
...r.rediscover ? r.rediscover(t) : n,
|
|
1260
1260
|
dryRun: !0
|
|
1261
|
-
}, a =
|
|
1262
|
-
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]);
|
|
1263
1263
|
}
|
|
1264
|
-
return a && !n.dryRun &&
|
|
1264
|
+
return a && !n.dryRun && qt(t), { changes: o };
|
|
1265
1265
|
});
|
|
1266
1266
|
}
|
|
1267
1267
|
//#endregion
|
|
1268
1268
|
//#region src/structure/engine/discovery.ts
|
|
1269
|
-
var
|
|
1269
|
+
var ln = [
|
|
1270
1270
|
"root",
|
|
1271
1271
|
"block",
|
|
1272
1272
|
"model",
|
|
@@ -1274,12 +1274,12 @@ var un = [
|
|
|
1274
1274
|
"workflow",
|
|
1275
1275
|
"test",
|
|
1276
1276
|
"software"
|
|
1277
|
-
],
|
|
1277
|
+
], un = class extends Error {
|
|
1278
1278
|
constructor(e, t) {
|
|
1279
1279
|
super(e), this.path = t, this.name = "DiscoveryError";
|
|
1280
1280
|
}
|
|
1281
1281
|
};
|
|
1282
|
-
function
|
|
1282
|
+
function dn(e) {
|
|
1283
1283
|
let t = /* @__PURE__ */ new Set();
|
|
1284
1284
|
for (let n of [
|
|
1285
1285
|
e.dependencies,
|
|
@@ -1289,17 +1289,17 @@ function fn(e) {
|
|
|
1289
1289
|
]) if (n) for (let e of Object.keys(n)) t.add(e);
|
|
1290
1290
|
return t;
|
|
1291
1291
|
}
|
|
1292
|
-
function
|
|
1292
|
+
function fn(e) {
|
|
1293
1293
|
return e === "" || e === ".";
|
|
1294
1294
|
}
|
|
1295
|
-
function
|
|
1295
|
+
function pn(e, t) {
|
|
1296
1296
|
let n = e.pkg["block-scope"];
|
|
1297
1297
|
if (typeof n == "string") {
|
|
1298
|
-
if (!
|
|
1298
|
+
if (!ln.includes(n)) throw new un(`package.json "block-scope" must be one of ${ln.join(", ")}, got '${n}'`, e.path);
|
|
1299
1299
|
return n;
|
|
1300
1300
|
}
|
|
1301
|
-
if (
|
|
1302
|
-
let r =
|
|
1301
|
+
if (fn(e.path)) return "root";
|
|
1302
|
+
let r = dn(e.pkg);
|
|
1303
1303
|
if (e.pkg["block-software"] !== void 0) return "software";
|
|
1304
1304
|
if (r.has("@platforma-sdk/package-builder")) {
|
|
1305
1305
|
for (let e of r) if (/^@platforma-open\/.*runenv/.test(e)) return "software";
|
|
@@ -1314,41 +1314,41 @@ function mn(e, t) {
|
|
|
1314
1314
|
if (r.has("@platforma-sdk/model") && e.pkg.main) return "model";
|
|
1315
1315
|
if (r.has("@platforma-sdk/test")) return "test";
|
|
1316
1316
|
}
|
|
1317
|
-
function
|
|
1317
|
+
function mn(e) {
|
|
1318
1318
|
let t = /* @__PURE__ */ new Set();
|
|
1319
1319
|
for (let n of e) typeof n.pkg.name == "string" && t.add(n.pkg.name);
|
|
1320
1320
|
let n = [];
|
|
1321
1321
|
for (let r of e) {
|
|
1322
|
-
let e =
|
|
1323
|
-
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);
|
|
1324
1324
|
n.push({
|
|
1325
1325
|
scope: e,
|
|
1326
1326
|
name: r.pkg.name ?? r.path,
|
|
1327
|
-
path:
|
|
1327
|
+
path: fn(r.path) ? "" : r.path
|
|
1328
1328
|
});
|
|
1329
1329
|
}
|
|
1330
1330
|
return n;
|
|
1331
1331
|
}
|
|
1332
1332
|
//#endregion
|
|
1333
1333
|
//#region src/structure/engine/ctx.ts
|
|
1334
|
-
function
|
|
1334
|
+
function q(e, t) {
|
|
1335
1335
|
return e.modules.filter((e) => e.scope === t);
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1338
|
-
let n =
|
|
1337
|
+
function hn(e, t) {
|
|
1338
|
+
let n = q(e, t);
|
|
1339
1339
|
if (n.length === 0) throw Error(`findModule: expected one '${t}' module, found none`);
|
|
1340
1340
|
if (n.length > 1) throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);
|
|
1341
1341
|
return n[0];
|
|
1342
1342
|
}
|
|
1343
|
-
function
|
|
1344
|
-
return { [
|
|
1343
|
+
function J(e, t) {
|
|
1344
|
+
return { [hn(e, t).name]: "workspace:*" };
|
|
1345
1345
|
}
|
|
1346
|
-
function
|
|
1346
|
+
function gn(e, t) {
|
|
1347
1347
|
let n = {};
|
|
1348
|
-
for (let r of
|
|
1348
|
+
for (let r of q(e, t)) n[r.name] = "workspace:*";
|
|
1349
1349
|
return n;
|
|
1350
1350
|
}
|
|
1351
|
-
function
|
|
1351
|
+
function _n(e) {
|
|
1352
1352
|
let t = e.facadeName, n = [
|
|
1353
1353
|
{
|
|
1354
1354
|
scope: "root",
|
|
@@ -1387,7 +1387,7 @@ function vn(e) {
|
|
|
1387
1387
|
path: "software"
|
|
1388
1388
|
}), n;
|
|
1389
1389
|
}
|
|
1390
|
-
function
|
|
1390
|
+
function vn(e) {
|
|
1391
1391
|
return {
|
|
1392
1392
|
isSdkInternal: e.isSdkInternal ?? !1,
|
|
1393
1393
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
@@ -1399,41 +1399,41 @@ function yn(e) {
|
|
|
1399
1399
|
}
|
|
1400
1400
|
//#endregion
|
|
1401
1401
|
//#region src/structure/engine/discovery-fs.ts
|
|
1402
|
-
var
|
|
1402
|
+
var Y = class extends Error {
|
|
1403
1403
|
constructor(e) {
|
|
1404
1404
|
super(e), this.name = "StructureCliError";
|
|
1405
1405
|
}
|
|
1406
1406
|
};
|
|
1407
|
-
function
|
|
1407
|
+
function yn(e, t) {
|
|
1408
1408
|
return e === "" ? t : `${e}/${t}`;
|
|
1409
1409
|
}
|
|
1410
|
-
function
|
|
1410
|
+
function bn(e, t) {
|
|
1411
1411
|
try {
|
|
1412
1412
|
return JSON.parse(e.read(t));
|
|
1413
1413
|
} catch {
|
|
1414
1414
|
return;
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1418
|
-
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.`);
|
|
1419
1419
|
let t = e.replace(/^\.\//, "").replace(/\/$/, "");
|
|
1420
1420
|
return t === "." ? "" : t;
|
|
1421
1421
|
}
|
|
1422
|
-
function
|
|
1422
|
+
function Sn(e) {
|
|
1423
1423
|
let t;
|
|
1424
1424
|
try {
|
|
1425
1425
|
t = e.read("pnpm-workspace.yaml");
|
|
1426
1426
|
} catch {
|
|
1427
|
-
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.");
|
|
1428
1428
|
}
|
|
1429
1429
|
let n = oe(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
|
|
1430
1430
|
for (let t of r) {
|
|
1431
|
-
let n =
|
|
1431
|
+
let n = xn(t);
|
|
1432
1432
|
(n === "" || e.exists(n)) && i.add(n);
|
|
1433
1433
|
}
|
|
1434
1434
|
let a = [];
|
|
1435
1435
|
for (let t of i) {
|
|
1436
|
-
let n =
|
|
1436
|
+
let n = bn(e, yn(t, "package.json"));
|
|
1437
1437
|
n && a.push({
|
|
1438
1438
|
path: t,
|
|
1439
1439
|
pkg: n
|
|
@@ -1441,7 +1441,7 @@ function Cn(e) {
|
|
|
1441
1441
|
}
|
|
1442
1442
|
return a;
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function Cn(e) {
|
|
1445
1445
|
let t = [], n = new Set([
|
|
1446
1446
|
"node_modules",
|
|
1447
1447
|
".turbo",
|
|
@@ -1453,7 +1453,7 @@ function wn(e) {
|
|
|
1453
1453
|
let o = e.listDir(i);
|
|
1454
1454
|
for (let s of o) {
|
|
1455
1455
|
if (!s.isDirectory || n.has(s.name)) continue;
|
|
1456
|
-
let o =
|
|
1456
|
+
let o = yn(i, s.name), c = bn(e, yn(o, "package.json"));
|
|
1457
1457
|
c && t.push({
|
|
1458
1458
|
path: o,
|
|
1459
1459
|
pkg: c
|
|
@@ -1462,11 +1462,11 @@ function wn(e) {
|
|
|
1462
1462
|
}
|
|
1463
1463
|
return r("", 1), t;
|
|
1464
1464
|
}
|
|
1465
|
-
function
|
|
1465
|
+
function wn(e) {
|
|
1466
1466
|
let t = e.indexOf("/");
|
|
1467
|
-
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'.`);
|
|
1468
1468
|
let n = e.slice(0, t), r = e.slice(t + 1), i = r.indexOf(".");
|
|
1469
|
-
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.`);
|
|
1470
1470
|
return {
|
|
1471
1471
|
facadeName: e,
|
|
1472
1472
|
baseName: r,
|
|
@@ -1475,23 +1475,23 @@ function Tn(e) {
|
|
|
1475
1475
|
shortName: r.slice(i + 1)
|
|
1476
1476
|
};
|
|
1477
1477
|
}
|
|
1478
|
-
function
|
|
1478
|
+
function Tn(e) {
|
|
1479
1479
|
try {
|
|
1480
|
-
let t = JSON.parse(e.read(
|
|
1480
|
+
let t = JSON.parse(e.read(Wt));
|
|
1481
1481
|
return typeof t.version == "number" ? t.version : 0;
|
|
1482
1482
|
} catch {
|
|
1483
1483
|
return 0;
|
|
1484
1484
|
}
|
|
1485
1485
|
}
|
|
1486
|
-
function
|
|
1487
|
-
let { fs: t, isSdkInternal: n } = e, r = n ?
|
|
1488
|
-
if (r.length === 0) throw new
|
|
1489
|
-
let i =
|
|
1490
|
-
|
|
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);
|
|
1491
1491
|
let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
|
|
1492
|
-
if (!o) throw new
|
|
1493
|
-
let s =
|
|
1494
|
-
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({
|
|
1495
1495
|
isSdkInternal: n,
|
|
1496
1496
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
1497
1497
|
modules: i,
|
|
@@ -1502,7 +1502,7 @@ function Dn(e) {
|
|
|
1502
1502
|
}
|
|
1503
1503
|
//#endregion
|
|
1504
1504
|
//#region src/structure/rules/shared/key-order.ts
|
|
1505
|
-
var
|
|
1505
|
+
var X = [
|
|
1506
1506
|
"name",
|
|
1507
1507
|
"version",
|
|
1508
1508
|
"private",
|
|
@@ -1526,7 +1526,7 @@ var Y = [
|
|
|
1526
1526
|
];
|
|
1527
1527
|
//#endregion
|
|
1528
1528
|
//#region src/structure/rules/root-package-json.ts
|
|
1529
|
-
function
|
|
1529
|
+
function Dn(e) {
|
|
1530
1530
|
return {
|
|
1531
1531
|
version: "1.0.0",
|
|
1532
1532
|
private: !0,
|
|
@@ -1543,7 +1543,7 @@ function On(e) {
|
|
|
1543
1543
|
changeset: "changeset",
|
|
1544
1544
|
"version-packages": "changeset version",
|
|
1545
1545
|
"update-sdk": "block-tools structure refresh --update-deps-only",
|
|
1546
|
-
|
|
1546
|
+
"upgrade-sdk": "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"
|
|
1547
1547
|
},
|
|
1548
1548
|
peerDependencies: {
|
|
1549
1549
|
oxlint: "*",
|
|
@@ -1559,95 +1559,109 @@ function On(e) {
|
|
|
1559
1559
|
packageManager: "pnpm@9.12.0"
|
|
1560
1560
|
};
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
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"),
|
|
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({
|
|
1564
1564
|
"@changesets/cli": "catalog:",
|
|
1565
1565
|
"@milaboratories/ts-builder": "sdk:",
|
|
1566
1566
|
"@platforma-sdk/block-tools": "sdk:",
|
|
1567
1567
|
shx: "catalog:",
|
|
1568
1568
|
turbo: "catalog:"
|
|
1569
|
-
}),
|
|
1569
|
+
}), U({
|
|
1570
1570
|
oxlint: "*",
|
|
1571
1571
|
oxfmt: "*"
|
|
1572
|
-
}),
|
|
1572
|
+
}), Mt((e, t) => {
|
|
1573
1573
|
if (!/^(\/\/|--)/.test(e) || typeof t != "object" || !t) return !1;
|
|
1574
1574
|
let n = t;
|
|
1575
1575
|
return n.pnpm !== void 0 || n.overrides !== void 0;
|
|
1576
|
-
}),
|
|
1576
|
+
}), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1577
1577
|
}
|
|
1578
1578
|
//#endregion
|
|
1579
1579
|
//#region src/structure/engine/registry-client.ts
|
|
1580
|
-
var
|
|
1581
|
-
function
|
|
1580
|
+
var kn = 2, An = 500, jn = 3e4;
|
|
1581
|
+
function Mn(e) {
|
|
1582
1582
|
if (!e) return null;
|
|
1583
1583
|
let t = Number(e);
|
|
1584
1584
|
if (Number.isFinite(t) && t > 0) return t * 1e3;
|
|
1585
1585
|
let n = Date.parse(e);
|
|
1586
1586
|
return Number.isNaN(n) ? null : Math.max(0, n - Date.now());
|
|
1587
1587
|
}
|
|
1588
|
-
async function
|
|
1588
|
+
async function Nn(e) {
|
|
1589
1589
|
for (let t = 1;; t++) {
|
|
1590
1590
|
let n;
|
|
1591
1591
|
try {
|
|
1592
|
-
n = await fetch(e, { signal: AbortSignal.timeout(
|
|
1592
|
+
n = await fetch(e, { signal: AbortSignal.timeout(jn) });
|
|
1593
1593
|
} catch (e) {
|
|
1594
|
-
if (t >
|
|
1595
|
-
await le(
|
|
1594
|
+
if (t > kn) throw e;
|
|
1595
|
+
await le(An * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1596
1596
|
continue;
|
|
1597
1597
|
}
|
|
1598
1598
|
if (n.ok) return n;
|
|
1599
|
-
if (!(n.status === 429 || n.status >= 500) || t >
|
|
1600
|
-
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"));
|
|
1601
1601
|
if (r != null) {
|
|
1602
1602
|
await le(r);
|
|
1603
1603
|
continue;
|
|
1604
1604
|
}
|
|
1605
|
-
await le(
|
|
1605
|
+
await le(An * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1606
1606
|
}
|
|
1607
1607
|
}
|
|
1608
|
-
function
|
|
1608
|
+
function Pn() {
|
|
1609
1609
|
return {
|
|
1610
1610
|
async getLatestVersion(e) {
|
|
1611
|
-
let t = (await (await
|
|
1611
|
+
let t = (await (await Nn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
|
|
1612
1612
|
if (!t) throw Error("no 'latest' dist-tag in registry response");
|
|
1613
1613
|
return t;
|
|
1614
1614
|
},
|
|
1615
1615
|
async getDeclaredDependency(e, t, n) {
|
|
1616
|
-
let r = await (await
|
|
1616
|
+
let r = await (await Nn(`https://registry.npmjs.org/${e}/${t}`)).json();
|
|
1617
1617
|
return r.dependencies?.[n] ?? r.peerDependencies?.[n];
|
|
1618
1618
|
}
|
|
1619
1619
|
};
|
|
1620
1620
|
}
|
|
1621
|
-
async function
|
|
1621
|
+
async function Fn(e, t) {
|
|
1622
1622
|
let n = await Promise.all(t.map(async (t) => [t, await e.getLatestVersion(t)]));
|
|
1623
1623
|
return new Map(n);
|
|
1624
1624
|
}
|
|
1625
|
-
function
|
|
1625
|
+
function In(e) {
|
|
1626
1626
|
return (t) => e.get(t);
|
|
1627
1627
|
}
|
|
1628
|
-
var
|
|
1629
|
-
function
|
|
1630
|
-
return
|
|
1628
|
+
var Ln = [/^@platforma-sdk\//, /^@milaboratories\//];
|
|
1629
|
+
function Rn(e) {
|
|
1630
|
+
return Ln.some((t) => t.test(e));
|
|
1631
1631
|
}
|
|
1632
|
-
async function
|
|
1633
|
-
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
1634
|
}
|
|
1635
|
-
function
|
|
1635
|
+
function Bn(e) {
|
|
1636
1636
|
return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
|
|
1637
1637
|
}
|
|
1638
|
-
async function
|
|
1638
|
+
async function Vn(e, t = Pn()) {
|
|
1639
1639
|
if (e.length === 0) return () => void 0;
|
|
1640
1640
|
let n = await Promise.all(e.map(async (e) => {
|
|
1641
1641
|
let n = await t.getDeclaredDependency(e.of, e.ofVersion ?? "latest", e.entry);
|
|
1642
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 (!
|
|
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
1644
|
return [e.entry, n];
|
|
1645
1645
|
})), r = new Map(n);
|
|
1646
1646
|
return (e) => r.get(e);
|
|
1647
1647
|
}
|
|
1648
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);
|
|
1661
|
+
}
|
|
1662
|
+
//#endregion
|
|
1649
1663
|
//#region src/structure/rules/root-pnpm-workspace.ts
|
|
1650
|
-
var
|
|
1664
|
+
var Z = [
|
|
1651
1665
|
"@platforma-sdk/model",
|
|
1652
1666
|
"@platforma-sdk/ui-vue",
|
|
1653
1667
|
"@platforma-sdk/workflow-tengo",
|
|
@@ -1657,31 +1671,32 @@ var X = [
|
|
|
1657
1671
|
"@platforma-sdk/package-builder",
|
|
1658
1672
|
"@milaboratories/ts-builder",
|
|
1659
1673
|
"@milaboratories/ts-configs"
|
|
1660
|
-
],
|
|
1661
|
-
for (let e of
|
|
1662
|
-
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 = {
|
|
1663
1677
|
turbo: "~2.8.11",
|
|
1664
1678
|
shx: "~0.4.0",
|
|
1665
1679
|
"@changesets/cli": "~2.29.8",
|
|
1666
1680
|
vitest: "~4.0.18"
|
|
1667
|
-
},
|
|
1681
|
+
}, Kn = [{
|
|
1668
1682
|
entry: "vue",
|
|
1669
1683
|
of: "@platforma-sdk/ui-vue"
|
|
1670
|
-
}],
|
|
1671
|
-
function
|
|
1684
|
+
}], qn = "@platforma-open/milaboratories.runenv-python-3", Jn = "1.8.2";
|
|
1685
|
+
function Yn(e) {
|
|
1672
1686
|
let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
|
|
1673
|
-
for (let e of
|
|
1674
|
-
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), {
|
|
1675
1689
|
packages: t,
|
|
1676
1690
|
catalog: n
|
|
1677
1691
|
};
|
|
1678
1692
|
}
|
|
1679
|
-
function
|
|
1680
|
-
|
|
1693
|
+
function Xn() {
|
|
1694
|
+
Ft();
|
|
1695
|
+
for (let e of Hn) Bt(e);
|
|
1681
1696
|
}
|
|
1682
1697
|
//#endregion
|
|
1683
1698
|
//#region src/structure/rules/root-gitignore.ts
|
|
1684
|
-
var
|
|
1699
|
+
var Zn = [
|
|
1685
1700
|
".test_auth.json",
|
|
1686
1701
|
"node_modules/",
|
|
1687
1702
|
"dist/",
|
|
@@ -1696,34 +1711,34 @@ var Xn = [
|
|
|
1696
1711
|
".vscode/sftp.json",
|
|
1697
1712
|
"test-dry-run.json"
|
|
1698
1713
|
];
|
|
1699
|
-
function
|
|
1700
|
-
|
|
1714
|
+
function Qn() {
|
|
1715
|
+
Vt(Zn);
|
|
1701
1716
|
}
|
|
1702
1717
|
//#endregion
|
|
1703
1718
|
//#region src/structure/rules/root.ts
|
|
1704
|
-
function
|
|
1719
|
+
function $n() {
|
|
1705
1720
|
b("root", () => {
|
|
1706
1721
|
x(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1707
|
-
C("turbo.json", D("root/turbo.json")), C(".vscode/settings.json", D("root/.vscode/settings.json")), w("package.json", O(() =>
|
|
1708
|
-
|
|
1709
|
-
}), w("pnpm-workspace.yaml", O(() =>
|
|
1710
|
-
|
|
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();
|
|
1711
1726
|
}), w(".gitignore", D("root/.gitignore"), () => {
|
|
1712
|
-
|
|
1727
|
+
Qn();
|
|
1713
1728
|
});
|
|
1714
1729
|
});
|
|
1715
1730
|
});
|
|
1716
1731
|
}
|
|
1717
1732
|
//#endregion
|
|
1718
1733
|
//#region src/structure/rules/block-package-json.ts
|
|
1719
|
-
function
|
|
1734
|
+
function er(e) {
|
|
1720
1735
|
let t = {};
|
|
1721
|
-
for (let n of
|
|
1722
|
-
for (let n of
|
|
1723
|
-
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`;
|
|
1724
1739
|
return t;
|
|
1725
1740
|
}
|
|
1726
|
-
function
|
|
1741
|
+
function tr(e) {
|
|
1727
1742
|
if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
|
|
1728
1743
|
let t = e.meta, n = [
|
|
1729
1744
|
["block.meta.title", t.title],
|
|
@@ -1735,13 +1750,13 @@ function er(e) {
|
|
|
1735
1750
|
];
|
|
1736
1751
|
for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
|
|
1737
1752
|
}
|
|
1738
|
-
function
|
|
1753
|
+
function nr(e) {
|
|
1739
1754
|
let t = e.blockVars, n = {
|
|
1740
|
-
...
|
|
1741
|
-
...
|
|
1742
|
-
...
|
|
1755
|
+
...J(e, "model"),
|
|
1756
|
+
...J(e, "ui"),
|
|
1757
|
+
...J(e, "workflow")
|
|
1743
1758
|
}, r = {
|
|
1744
|
-
components:
|
|
1759
|
+
components: er(e),
|
|
1745
1760
|
meta: {
|
|
1746
1761
|
title: t.shortName,
|
|
1747
1762
|
description: `${t.shortName} block`,
|
|
@@ -1753,7 +1768,7 @@ function tr(e) {
|
|
|
1753
1768
|
}
|
|
1754
1769
|
}
|
|
1755
1770
|
};
|
|
1756
|
-
return
|
|
1771
|
+
return tr(r), {
|
|
1757
1772
|
name: `${t.facadeName}.block`,
|
|
1758
1773
|
version: "1.0.0",
|
|
1759
1774
|
files: ["index.d.ts", "index.js"],
|
|
@@ -1771,24 +1786,24 @@ function tr(e) {
|
|
|
1771
1786
|
block: r
|
|
1772
1787
|
};
|
|
1773
1788
|
}
|
|
1774
|
-
function
|
|
1775
|
-
F("files", ["index.d.ts", "index.js"]), I("build", "shx rm -rf ./block-pack && block-tools pack"), I("mark-stable", "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("prepublishOnly", "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("do-pack", "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"),
|
|
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]);
|
|
1776
1791
|
}
|
|
1777
1792
|
//#endregion
|
|
1778
1793
|
//#region src/structure/rules/block.ts
|
|
1779
|
-
function
|
|
1794
|
+
function ir() {
|
|
1780
1795
|
b("block", () => {
|
|
1781
|
-
C("index.js", D("block/index.js")), C("index.d.ts", D("block/index.d.ts")), T("logos/block-logo.png", Qe("block/logos/block-logo.png")), T("logos/organization-logo.png", Qe("block/logos/organization-logo.png")), w("package.json", O(() =>
|
|
1782
|
-
|
|
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();
|
|
1783
1798
|
});
|
|
1784
1799
|
});
|
|
1785
1800
|
}
|
|
1786
1801
|
//#endregion
|
|
1787
1802
|
//#region src/structure/rules/shared/colocated-tests.ts
|
|
1788
|
-
var
|
|
1803
|
+
var Q = "src/**/*.test.ts";
|
|
1789
1804
|
//#endregion
|
|
1790
1805
|
//#region src/structure/rules/model-package-json.ts
|
|
1791
|
-
function
|
|
1806
|
+
function ar(e) {
|
|
1792
1807
|
return {
|
|
1793
1808
|
name: `${e.blockVars.facadeName}.model`,
|
|
1794
1809
|
version: "1.0.0",
|
|
@@ -1822,7 +1837,7 @@ function ir(e) {
|
|
|
1822
1837
|
}
|
|
1823
1838
|
};
|
|
1824
1839
|
}
|
|
1825
|
-
function
|
|
1840
|
+
function or() {
|
|
1826
1841
|
F("type", "module"), F("main", "dist/index.cjs"), F("module", "dist/index.js"), F("types", "dist/index.d.ts"), F("exports", {
|
|
1827
1842
|
".": {
|
|
1828
1843
|
types: "./dist/index.d.ts",
|
|
@@ -1830,29 +1845,29 @@ function ar() {
|
|
|
1830
1845
|
import: "./dist/index.js"
|
|
1831
1846
|
},
|
|
1832
1847
|
"./dist/*": "./dist/*"
|
|
1833
|
-
}), I("fmt", "ts-builder format"), I("watch", "ts-builder build --target block-model --watch"), I("build", "ts-builder build --target block-model && block-tools build-model"), I("check", "ts-builder check --target block-model"),
|
|
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({
|
|
1834
1849
|
"@milaboratories/ts-builder": "sdk:",
|
|
1835
1850
|
"@milaboratories/ts-configs": "sdk:",
|
|
1836
1851
|
"@platforma-sdk/block-tools": "sdk:"
|
|
1837
|
-
}),
|
|
1852
|
+
}), U({
|
|
1838
1853
|
"@types/node": "*",
|
|
1839
1854
|
typescript: "*"
|
|
1840
|
-
}), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(
|
|
1841
|
-
I("test", "vitest run --passWithNoTests"),
|
|
1842
|
-
}, () =>
|
|
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]);
|
|
1843
1858
|
}
|
|
1844
1859
|
//#endregion
|
|
1845
1860
|
//#region src/structure/rules/model.ts
|
|
1846
|
-
function
|
|
1861
|
+
function sr() {
|
|
1847
1862
|
b("model", () => {
|
|
1848
|
-
x(S(
|
|
1849
|
-
|
|
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();
|
|
1850
1865
|
});
|
|
1851
1866
|
});
|
|
1852
1867
|
}
|
|
1853
1868
|
//#endregion
|
|
1854
1869
|
//#region src/structure/rules/ui-package-json.ts
|
|
1855
|
-
function
|
|
1870
|
+
function cr(e) {
|
|
1856
1871
|
return {
|
|
1857
1872
|
name: `${e.blockVars.facadeName}.ui`,
|
|
1858
1873
|
version: "1.0.0",
|
|
@@ -1867,35 +1882,41 @@ function sr(e) {
|
|
|
1867
1882
|
dependencies: {
|
|
1868
1883
|
"@platforma-sdk/ui-vue": "sdk:",
|
|
1869
1884
|
vue: "catalog:",
|
|
1870
|
-
...
|
|
1885
|
+
...J(e, "model")
|
|
1871
1886
|
},
|
|
1872
1887
|
devDependencies: {
|
|
1873
1888
|
"@milaboratories/ts-builder": "sdk:",
|
|
1874
1889
|
"@milaboratories/ts-configs": "sdk:"
|
|
1875
1890
|
},
|
|
1876
|
-
peerDependencies: {
|
|
1891
|
+
peerDependencies: {
|
|
1892
|
+
"@types/node": "*",
|
|
1893
|
+
typescript: "*"
|
|
1894
|
+
}
|
|
1877
1895
|
};
|
|
1878
1896
|
}
|
|
1879
|
-
function
|
|
1880
|
-
F("type", "module"), I("fmt", "ts-builder format"), I("dev", "ts-builder serve --target block-ui"), I("watch", "ts-builder build --target block-ui --watch"), I("build", "ts-builder build --target block-ui"), I("check", "ts-builder check --target block-ui"),
|
|
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({
|
|
1881
1899
|
"@milaboratories/ts-builder": "sdk:",
|
|
1882
1900
|
"@milaboratories/ts-configs": "sdk:"
|
|
1883
|
-
}),
|
|
1884
|
-
|
|
1885
|
-
|
|
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]);
|
|
1886
1907
|
}
|
|
1887
1908
|
//#endregion
|
|
1888
1909
|
//#region src/structure/rules/ui.ts
|
|
1889
|
-
function
|
|
1910
|
+
function ur() {
|
|
1890
1911
|
b("ui", () => {
|
|
1891
|
-
x(S(
|
|
1892
|
-
|
|
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();
|
|
1893
1914
|
});
|
|
1894
1915
|
});
|
|
1895
1916
|
}
|
|
1896
1917
|
//#endregion
|
|
1897
1918
|
//#region src/structure/rules/workflow-package-json.ts
|
|
1898
|
-
function
|
|
1919
|
+
function dr(e) {
|
|
1899
1920
|
return {
|
|
1900
1921
|
name: `${e.blockVars.facadeName}.workflow`,
|
|
1901
1922
|
version: "1.0.0",
|
|
@@ -1907,7 +1928,7 @@ function ur(e) {
|
|
|
1907
1928
|
},
|
|
1908
1929
|
dependencies: {
|
|
1909
1930
|
"@platforma-sdk/workflow-tengo": "sdk:",
|
|
1910
|
-
...
|
|
1931
|
+
...gn(e, "software")
|
|
1911
1932
|
},
|
|
1912
1933
|
devDependencies: {
|
|
1913
1934
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
@@ -1916,34 +1937,39 @@ function ur(e) {
|
|
|
1916
1937
|
}
|
|
1917
1938
|
};
|
|
1918
1939
|
}
|
|
1919
|
-
function
|
|
1920
|
-
F("type", "module"), I("build", "shx rm -rf dist && pl-tengo build"), I("check", "pl-tengo check"), I("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(
|
|
1921
|
-
I("test", "vitest run --passWithNoTests"),
|
|
1922
|
-
}, () =>
|
|
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({
|
|
1923
1944
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1924
1945
|
"@platforma-sdk/test": "sdk:",
|
|
1925
1946
|
shx: "catalog:"
|
|
1926
|
-
}),
|
|
1947
|
+
}), Un(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1927
1948
|
}
|
|
1928
1949
|
//#endregion
|
|
1929
1950
|
//#region src/structure/rules/workflow.ts
|
|
1930
|
-
function
|
|
1951
|
+
function pr() {
|
|
1931
1952
|
b("workflow", () => {
|
|
1932
|
-
C("
|
|
1933
|
-
|
|
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();
|
|
1934
1959
|
});
|
|
1935
1960
|
});
|
|
1936
1961
|
}
|
|
1937
1962
|
//#endregion
|
|
1938
1963
|
//#region src/structure/rules/test-package-json.ts
|
|
1939
|
-
function
|
|
1964
|
+
function mr(e) {
|
|
1940
1965
|
return {
|
|
1941
1966
|
name: `${e.blockVars.facadeName}.test`,
|
|
1942
1967
|
version: "1.0.0",
|
|
1943
1968
|
private: !0,
|
|
1944
1969
|
type: "module",
|
|
1945
1970
|
scripts: {
|
|
1946
|
-
|
|
1971
|
+
fmt: "ts-builder format",
|
|
1972
|
+
check: "ts-builder check --target block-test",
|
|
1947
1973
|
test: "vitest run --passWithNoTests"
|
|
1948
1974
|
},
|
|
1949
1975
|
peerDependencies: { typescript: "*" },
|
|
@@ -1955,26 +1981,26 @@ function pr(e) {
|
|
|
1955
1981
|
}
|
|
1956
1982
|
};
|
|
1957
1983
|
}
|
|
1958
|
-
function
|
|
1959
|
-
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({
|
|
1960
1986
|
"@platforma-sdk/test": "sdk:",
|
|
1961
1987
|
"@milaboratories/ts-builder": "sdk:",
|
|
1962
1988
|
"@milaboratories/ts-configs": "sdk:",
|
|
1963
1989
|
vitest: "catalog:"
|
|
1964
|
-
}),
|
|
1990
|
+
}), U({ typescript: "*" }), V("@types/node"), Un(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
1965
1991
|
}
|
|
1966
1992
|
//#endregion
|
|
1967
1993
|
//#region src/structure/rules/test.ts
|
|
1968
|
-
function
|
|
1994
|
+
function gr() {
|
|
1969
1995
|
b("test", () => {
|
|
1970
|
-
C("tsconfig.json", D("test/tsconfig.json")), Ze("vitest.config.mts", D("test/vitest.config.mts")), T("src/demo.test.ts", $e("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), w("package.json", O(() =>
|
|
1971
|
-
|
|
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();
|
|
1972
1998
|
});
|
|
1973
1999
|
});
|
|
1974
2000
|
}
|
|
1975
2001
|
//#endregion
|
|
1976
2002
|
//#region src/structure/rules/software-package-json.ts
|
|
1977
|
-
function
|
|
2003
|
+
function _r() {
|
|
1978
2004
|
return { entrypoints: { main: { binary: {
|
|
1979
2005
|
artifact: {
|
|
1980
2006
|
type: "python",
|
|
@@ -1989,7 +2015,7 @@ function gr() {
|
|
|
1989
2015
|
cmd: ["python", "{pkg}/main.py"]
|
|
1990
2016
|
} } } };
|
|
1991
2017
|
}
|
|
1992
|
-
function
|
|
2018
|
+
function vr(e) {
|
|
1993
2019
|
return {
|
|
1994
2020
|
name: `${e.blockVars.facadeName}.software`,
|
|
1995
2021
|
version: "1.0.0",
|
|
@@ -2002,30 +2028,30 @@ function _r(e) {
|
|
|
2002
2028
|
changeset: "changeset",
|
|
2003
2029
|
"version-packages": "changeset version"
|
|
2004
2030
|
},
|
|
2005
|
-
"block-software":
|
|
2031
|
+
"block-software": _r(),
|
|
2006
2032
|
devDependencies: {
|
|
2007
2033
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
2008
2034
|
"@platforma-sdk/package-builder": "sdk:"
|
|
2009
2035
|
}
|
|
2010
2036
|
};
|
|
2011
2037
|
}
|
|
2012
|
-
function
|
|
2013
|
-
F("type", "module"), F("files", ["./dist/**/*"]), I("build", "pl-pkg build"), I("prepublishOnly", "pl-pkg prepublish"), I("changeset", "changeset"), I("version-packages", "changeset version"),
|
|
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({
|
|
2014
2040
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
2015
2041
|
"@platforma-sdk/package-builder": "sdk:"
|
|
2016
|
-
}),
|
|
2042
|
+
}), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
|
|
2017
2043
|
}
|
|
2018
2044
|
//#endregion
|
|
2019
2045
|
//#region src/structure/rules/software.ts
|
|
2020
|
-
var
|
|
2021
|
-
function
|
|
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() {
|
|
2022
2048
|
b("software", () => {
|
|
2023
|
-
T("src/main.py", $e(
|
|
2024
|
-
|
|
2049
|
+
T("src/main.py", $e(br)), T("src/requirements.txt", $e(xr)), w("package.json", O(() => vr(y())), () => {
|
|
2050
|
+
yr();
|
|
2025
2051
|
});
|
|
2026
2052
|
});
|
|
2027
2053
|
}
|
|
2028
|
-
function
|
|
2054
|
+
function Cr() {
|
|
2029
2055
|
b("model", () => {
|
|
2030
2056
|
E("eslint.config.mjs"), E("vite.config.mts");
|
|
2031
2057
|
}), b("ui", () => {
|
|
@@ -2033,25 +2059,25 @@ function Sr() {
|
|
|
2033
2059
|
}), b("test", () => {
|
|
2034
2060
|
E("eslint.config.mjs");
|
|
2035
2061
|
}), b("root", () => {
|
|
2036
|
-
E(".prettierrc"), w("package.json", O(() =>
|
|
2037
|
-
|
|
2062
|
+
E(".prettierrc"), w("package.json", O(() => Dn(y())), () => {
|
|
2063
|
+
L("pretty"), V("@platforma-sdk/blocks-deps-updater");
|
|
2038
2064
|
});
|
|
2039
2065
|
});
|
|
2040
2066
|
}
|
|
2041
2067
|
//#endregion
|
|
2042
2068
|
//#region src/structure/rules/root-catalog-bump.ts
|
|
2043
|
-
function
|
|
2069
|
+
function wr() {
|
|
2044
2070
|
Xe(() => {
|
|
2045
2071
|
b("root", () => {
|
|
2046
2072
|
x(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
2047
|
-
w("pnpm-workspace.yaml", O(() =>
|
|
2048
|
-
for (let e of
|
|
2049
|
-
for (let e of
|
|
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, {
|
|
2050
2076
|
of: e.of,
|
|
2051
2077
|
ofVersion: e.ofVersion
|
|
2052
2078
|
});
|
|
2053
|
-
for (let [e, t] of Object.entries(
|
|
2054
|
-
y().modules.some((e) => e.scope === "software") &&
|
|
2079
|
+
for (let [e, t] of Object.entries(Gn)) Lt(e, t);
|
|
2080
|
+
y().modules.some((e) => e.scope === "software") && Lt(qn, Jn);
|
|
2055
2081
|
});
|
|
2056
2082
|
});
|
|
2057
2083
|
});
|
|
@@ -2059,25 +2085,25 @@ function Cr() {
|
|
|
2059
2085
|
}
|
|
2060
2086
|
//#endregion
|
|
2061
2087
|
//#region src/structure/structure-definition.ts
|
|
2062
|
-
var
|
|
2063
|
-
|
|
2088
|
+
var Tr = Ue(() => {
|
|
2089
|
+
$n(), ir(), sr(), ur(), pr(), gr(), Sr(), Cr(), wr();
|
|
2064
2090
|
});
|
|
2065
2091
|
//#endregion
|
|
2066
2092
|
//#region src/structure/cli/run-structure.ts
|
|
2067
|
-
async function
|
|
2068
|
-
return
|
|
2093
|
+
async function Er() {
|
|
2094
|
+
return zn(Z.filter(Rn));
|
|
2069
2095
|
}
|
|
2070
|
-
async function
|
|
2071
|
-
let t = p.resolve(e.blockPath), n = e.mode === "check", r = new Oe(t), i = new ke(e.templatesRoot), a =
|
|
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({
|
|
2072
2098
|
fs: r,
|
|
2073
2099
|
isSdkInternal: e.isSdkInternal,
|
|
2074
2100
|
updateDepsOnly: e.updateDepsOnly,
|
|
2075
2101
|
dryRun: n
|
|
2076
2102
|
}), {
|
|
2077
2103
|
templates: i,
|
|
2078
|
-
registryLookup: e.updateDepsOnly ? await
|
|
2079
|
-
derivedPinLookup: e.updateDepsOnly ? await
|
|
2080
|
-
rediscover: () =>
|
|
2104
|
+
registryLookup: e.updateDepsOnly ? await Er() : void 0,
|
|
2105
|
+
derivedPinLookup: e.updateDepsOnly ? await Vn(Kn) : void 0,
|
|
2106
|
+
rediscover: () => En({
|
|
2081
2107
|
fs: r,
|
|
2082
2108
|
isSdkInternal: e.isSdkInternal,
|
|
2083
2109
|
updateDepsOnly: !1,
|
|
@@ -2089,14 +2115,14 @@ async function Er(e) {
|
|
|
2089
2115
|
changes: a.changes
|
|
2090
2116
|
};
|
|
2091
2117
|
}
|
|
2092
|
-
function
|
|
2118
|
+
function Or(e, t) {
|
|
2093
2119
|
if (t.length === 0) return ` ${e}: up to date (0 changes)`;
|
|
2094
2120
|
let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
|
|
2095
2121
|
return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
|
|
2096
2122
|
}
|
|
2097
2123
|
//#endregion
|
|
2098
2124
|
//#region src/cmd/structure/check.ts
|
|
2099
|
-
var
|
|
2125
|
+
var kr = class e extends d {
|
|
2100
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.";
|
|
2101
2127
|
static examples = ["<%= config.bin %> <%= command.id %> ./my-block", "<%= config.bin %> <%= command.id %> --sdk-internal etc/blocks/*"];
|
|
2102
2128
|
static strict = !1;
|
|
@@ -2104,7 +2130,7 @@ var Or = class e extends d {
|
|
|
2104
2130
|
async run() {
|
|
2105
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;
|
|
2106
2132
|
for (let e of r) {
|
|
2107
|
-
let t = await
|
|
2133
|
+
let t = await Dr({
|
|
2108
2134
|
blockPath: e,
|
|
2109
2135
|
isSdkInternal: n["sdk-internal"],
|
|
2110
2136
|
updateDepsOnly: !1,
|
|
@@ -2112,38 +2138,38 @@ var Or = class e extends d {
|
|
|
2112
2138
|
templatesRoot: i,
|
|
2113
2139
|
log: (e) => this.log(e)
|
|
2114
2140
|
});
|
|
2115
|
-
this.log(
|
|
2141
|
+
this.log(Or(e, t.changes)), t.changes.length > 0 && (a = !0);
|
|
2116
2142
|
}
|
|
2117
2143
|
a && this.error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.", { exit: 1 });
|
|
2118
2144
|
}
|
|
2119
|
-
},
|
|
2145
|
+
}, $ = ["python"], Ar = class extends Error {
|
|
2120
2146
|
constructor(e) {
|
|
2121
2147
|
super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
|
|
2122
2148
|
}
|
|
2123
2149
|
};
|
|
2124
|
-
async function
|
|
2150
|
+
async function jr(e, t, n, r) {
|
|
2125
2151
|
if (e !== void 0 && e !== "") return e;
|
|
2126
|
-
if (n) throw new
|
|
2152
|
+
if (n) throw new Ar(t);
|
|
2127
2153
|
return r();
|
|
2128
2154
|
}
|
|
2129
|
-
async function
|
|
2130
|
-
let t = await
|
|
2155
|
+
async function Mr(e) {
|
|
2156
|
+
let t = await jr(e.npmOrg, "npm-org", e.nonInteractive, () => de({
|
|
2131
2157
|
message: "npm org (e.g. @platforma-open):",
|
|
2132
2158
|
default: "@platforma-open"
|
|
2133
|
-
})), n = 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;
|
|
2134
2160
|
i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await ue({
|
|
2135
2161
|
message: "Include a software module?",
|
|
2136
2162
|
default: !1
|
|
2137
2163
|
}) : e.withSoftware;
|
|
2138
2164
|
let a;
|
|
2139
2165
|
if (i) {
|
|
2140
|
-
if (a = await
|
|
2166
|
+
if (a = await jr(e.platform, "platform", e.nonInteractive, () => fe({
|
|
2141
2167
|
message: "Software platform:",
|
|
2142
|
-
choices:
|
|
2168
|
+
choices: $.map((e) => ({
|
|
2143
2169
|
name: e,
|
|
2144
2170
|
value: e
|
|
2145
2171
|
}))
|
|
2146
|
-
})),
|
|
2172
|
+
})), !$.includes(a)) throw Error(`Unsupported --platform '${a}'. Only ${$.join(", ")} ${$.length === 1 ? "is" : "are"} supported at v1.`);
|
|
2147
2173
|
} else if (e.platform) throw Error("--platform was given but software is disabled (--no-software).");
|
|
2148
2174
|
return {
|
|
2149
2175
|
facadeName: `${t}/${n}.${r}`,
|
|
@@ -2154,20 +2180,20 @@ async function Ar(e) {
|
|
|
2154
2180
|
softwarePlatform: a
|
|
2155
2181
|
};
|
|
2156
2182
|
}
|
|
2157
|
-
async function
|
|
2158
|
-
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({
|
|
2159
2185
|
blockVars: t,
|
|
2160
2186
|
modules: n,
|
|
2161
2187
|
isSdkInternal: !1,
|
|
2162
2188
|
version: 1,
|
|
2163
2189
|
dryRun: !1
|
|
2164
|
-
}), o =
|
|
2190
|
+
}), o = Z.filter(Rn), s, c;
|
|
2165
2191
|
try {
|
|
2166
|
-
s = await
|
|
2192
|
+
s = await zn(o), c = await Vn(Kn);
|
|
2167
2193
|
} catch (e) {
|
|
2168
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)}`);
|
|
2169
2195
|
}
|
|
2170
|
-
return
|
|
2196
|
+
return cn(Tr, r, a, {
|
|
2171
2197
|
templates: i,
|
|
2172
2198
|
initMode: !0,
|
|
2173
2199
|
registryLookup: s,
|
|
@@ -2176,7 +2202,7 @@ async function jr(e) {
|
|
|
2176
2202
|
}
|
|
2177
2203
|
//#endregion
|
|
2178
2204
|
//#region src/cmd/index.ts
|
|
2179
|
-
var
|
|
2205
|
+
var Pr = {
|
|
2180
2206
|
"build-meta": pe,
|
|
2181
2207
|
"build-model": he,
|
|
2182
2208
|
"list-overview-snapshots": ge,
|
|
@@ -2187,7 +2213,7 @@ var Mr = {
|
|
|
2187
2213
|
"restore-overview-from-snapshot": Se,
|
|
2188
2214
|
"update-deps": Ce,
|
|
2189
2215
|
"upload-package-v1": De,
|
|
2190
|
-
"structure:check":
|
|
2216
|
+
"structure:check": kr,
|
|
2191
2217
|
"structure:init": class e extends d {
|
|
2192
2218
|
static description = "Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.";
|
|
2193
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"];
|
|
@@ -2200,14 +2226,14 @@ var Mr = {
|
|
|
2200
2226
|
"no-software": f.boolean({ description: "omit the software module" }),
|
|
2201
2227
|
platform: f.string({
|
|
2202
2228
|
description: "software platform (single-valued)",
|
|
2203
|
-
options: [
|
|
2229
|
+
options: [...$]
|
|
2204
2230
|
}),
|
|
2205
2231
|
"non-interactive": f.boolean({ description: "error on any missing flag instead of prompting" })
|
|
2206
2232
|
};
|
|
2207
2233
|
async run() {
|
|
2208
2234
|
let { args: t, flags: n } = await this.parse(e);
|
|
2209
2235
|
n["with-software"] && n["no-software"] && this.error("--with-software and --no-software are mutually exclusive.");
|
|
2210
|
-
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({
|
|
2211
2237
|
npmOrg: n["npm-org"],
|
|
2212
2238
|
orgScope: n["org-scope"],
|
|
2213
2239
|
shortName: n["short-name"],
|
|
@@ -2215,7 +2241,7 @@ var Mr = {
|
|
|
2215
2241
|
platform: n.platform,
|
|
2216
2242
|
nonInteractive: n["non-interactive"]
|
|
2217
2243
|
});
|
|
2218
|
-
await
|
|
2244
|
+
await Nr({
|
|
2219
2245
|
vars: i,
|
|
2220
2246
|
blockPath: t.path ? p.resolve(t.path) : p.resolve(process.cwd(), i.shortName),
|
|
2221
2247
|
templatesRoot: p.join(this.config.root, "src", "structure", "templates"),
|
|
@@ -2238,7 +2264,7 @@ var Mr = {
|
|
|
2238
2264
|
async run() {
|
|
2239
2265
|
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates");
|
|
2240
2266
|
for (let e of r) {
|
|
2241
|
-
let t = await
|
|
2267
|
+
let t = await Dr({
|
|
2242
2268
|
blockPath: e,
|
|
2243
2269
|
isSdkInternal: n["sdk-internal"],
|
|
2244
2270
|
updateDepsOnly: n["update-deps-only"],
|
|
@@ -2246,12 +2272,12 @@ var Mr = {
|
|
|
2246
2272
|
templatesRoot: i,
|
|
2247
2273
|
log: (e) => this.log(e)
|
|
2248
2274
|
});
|
|
2249
|
-
this.log(
|
|
2275
|
+
this.log(Or(e, t.changes));
|
|
2250
2276
|
}
|
|
2251
2277
|
}
|
|
2252
2278
|
}
|
|
2253
2279
|
};
|
|
2254
2280
|
//#endregion
|
|
2255
|
-
export {
|
|
2281
|
+
export { Pr as COMMANDS };
|
|
2256
2282
|
|
|
2257
2283
|
//# sourceMappingURL=cli.mjs.map
|