@platforma-sdk/block-tools 2.10.16 → 2.10.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +13 -13
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +404 -373
- package/dist/cli.mjs.map +1 -1
- package/dist/structure/engine/api.d.ts +1 -1
- package/dist/structure/engine/builders.d.ts +9 -9
- 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/package.json +5 -5
- package/src/structure/__tests__/model-package-json.snapshot.test.ts +1 -2
- package/src/structure/__tests__/tsconfig-idempotency.test.ts +94 -0
- 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__/content-rules/when-inner.test.ts +30 -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/builders.ts +38 -23
- package/src/structure/engine/content-rules.ts +29 -0
- package/src/structure/engine/registry-client.ts +116 -2
- package/src/structure/engine/runner.ts +18 -2
- package/src/structure/init-block-constructor.ts +16 -3
- package/src/structure/rules/model-package-json.ts +35 -16
- package/src/structure/rules/model.ts +11 -35
- package/src/structure/rules/root-catalog-bump.ts +12 -1
- package/src/structure/rules/root-package-json.ts +7 -5
- package/src/structure/rules/root-pnpm-workspace.ts +24 -8
- package/src/structure/rules/ui-package-json.ts +34 -13
- package/src/structure/rules/ui.ts +10 -22
- package/src/structure/rules/workflow-package-json.ts +25 -11
- package/src/structure/rules/workflow.ts +21 -2
- package/src/structure/templates/static/model/tsconfig.node.json +7 -0
- package/src/structure/templates/static/ui/tsconfig.node.json +7 -0
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
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
2
|
import { Args as u, Command as d, Flags as f } from "@oclif/core";
|
|
3
3
|
import p from "node:path";
|
|
4
4
|
import m from "node:fs";
|
|
@@ -25,7 +25,7 @@ var pe = class e extends d {
|
|
|
25
25
|
})
|
|
26
26
|
};
|
|
27
27
|
async run() {
|
|
28
|
-
let { flags: t } = await this.parse(e), n = p.resolve(t.modulePath), i = await s(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
29
|
await m.promises.writeFile(p.resolve(t.destination), JSON.stringify(i));
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -351,7 +351,7 @@ var Te = f.custom({
|
|
|
351
351
|
})
|
|
352
352
|
};
|
|
353
353
|
async run() {
|
|
354
|
-
let { flags: t } = await this.parse(e), n =
|
|
354
|
+
let { flags: t } = await this.parse(e), n = l.parse({});
|
|
355
355
|
for (let e of Ee) t[e] && (n[e] = t[e]);
|
|
356
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;
|
|
@@ -612,27 +612,33 @@ var Ge;
|
|
|
612
612
|
function Ke(e) {
|
|
613
613
|
Ge = e;
|
|
614
614
|
}
|
|
615
|
-
function x(e, t) {
|
|
615
|
+
function x(e, t, n) {
|
|
616
|
+
qe(e, t), n && qe((t) => !e(t), n);
|
|
617
|
+
}
|
|
618
|
+
function qe(e, t) {
|
|
616
619
|
if (g) {
|
|
617
|
-
|
|
618
|
-
kind: "when",
|
|
619
|
-
trigger: e,
|
|
620
|
-
children: []
|
|
621
|
-
};
|
|
622
|
-
n.stack[n.stack.length - 1].push(r), n.stack.push(r.children);
|
|
623
|
-
try {
|
|
624
|
-
t();
|
|
625
|
-
} finally {
|
|
626
|
-
n.stack.pop();
|
|
627
|
-
}
|
|
620
|
+
Je(e, t);
|
|
628
621
|
return;
|
|
629
622
|
}
|
|
630
|
-
if (!(Ge
|
|
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
|
+
}
|
|
625
|
+
function Je(e, t) {
|
|
626
|
+
let n = g, r = {
|
|
627
|
+
kind: "when",
|
|
628
|
+
trigger: e,
|
|
629
|
+
children: []
|
|
630
|
+
};
|
|
631
|
+
n.stack[n.stack.length - 1].push(r), n.stack.push(r.children);
|
|
632
|
+
try {
|
|
633
|
+
t();
|
|
634
|
+
} finally {
|
|
635
|
+
n.stack.pop();
|
|
636
|
+
}
|
|
631
637
|
}
|
|
632
638
|
function S(e) {
|
|
633
639
|
return (t) => t.filesMatch(e);
|
|
634
640
|
}
|
|
635
|
-
function
|
|
641
|
+
function Ye(e, t, n) {
|
|
636
642
|
let r = Be(e), i = {
|
|
637
643
|
kind: "mode",
|
|
638
644
|
modes: t,
|
|
@@ -645,8 +651,8 @@ function qe(e, t, n) {
|
|
|
645
651
|
r.stack.pop();
|
|
646
652
|
}
|
|
647
653
|
}
|
|
648
|
-
function
|
|
649
|
-
|
|
654
|
+
function Xe(e) {
|
|
655
|
+
Ye("onInitOrUpdate", ["init", "updateDeps"], e);
|
|
650
656
|
}
|
|
651
657
|
function C(e, t) {
|
|
652
658
|
v("fixed", {
|
|
@@ -663,7 +669,7 @@ function w(e, t, n) {
|
|
|
663
669
|
body: n
|
|
664
670
|
});
|
|
665
671
|
}
|
|
666
|
-
function
|
|
672
|
+
function Ze(e, t) {
|
|
667
673
|
v("scaffold", {
|
|
668
674
|
kind: "scaffold",
|
|
669
675
|
path: e,
|
|
@@ -689,19 +695,19 @@ function D(e) {
|
|
|
689
695
|
path: e
|
|
690
696
|
};
|
|
691
697
|
}
|
|
692
|
-
function
|
|
698
|
+
function Qe(e) {
|
|
693
699
|
return {
|
|
694
700
|
kind: "binary",
|
|
695
701
|
path: e
|
|
696
702
|
};
|
|
697
703
|
}
|
|
698
|
-
function
|
|
704
|
+
function $e(e) {
|
|
699
705
|
return {
|
|
700
706
|
kind: "text",
|
|
701
707
|
value: e
|
|
702
708
|
};
|
|
703
709
|
}
|
|
704
|
-
function
|
|
710
|
+
function et(e, t) {
|
|
705
711
|
return {
|
|
706
712
|
kind: "tpl",
|
|
707
713
|
path: e,
|
|
@@ -714,34 +720,34 @@ function O(e) {
|
|
|
714
720
|
fn: e
|
|
715
721
|
};
|
|
716
722
|
}
|
|
717
|
-
function
|
|
723
|
+
function tt() {
|
|
718
724
|
if (!_) throw Error("blockVars() called outside engine.run(). Generators and managed bodies only see BlockVars during a run.");
|
|
719
725
|
return _.blockVars;
|
|
720
726
|
}
|
|
721
727
|
//#endregion
|
|
722
728
|
//#region src/structure/engine/parsers/json.ts
|
|
723
|
-
function
|
|
729
|
+
function nt(e) {
|
|
724
730
|
return JSON.parse(e);
|
|
725
731
|
}
|
|
726
|
-
var
|
|
727
|
-
function
|
|
728
|
-
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(", ") + "]";
|
|
729
735
|
}
|
|
730
|
-
function
|
|
731
|
-
if (Array.isArray(e)) return
|
|
736
|
+
function ot(e) {
|
|
737
|
+
if (Array.isArray(e)) return at(e);
|
|
732
738
|
if (A(e)) {
|
|
733
739
|
let t = Object.entries(e);
|
|
734
|
-
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(", ") + " }";
|
|
735
741
|
}
|
|
736
742
|
return JSON.stringify(e);
|
|
737
743
|
}
|
|
738
|
-
function
|
|
739
|
-
let i = t +
|
|
744
|
+
function st(e, t, n, r) {
|
|
745
|
+
let i = t + it, a = " ".repeat(i);
|
|
740
746
|
if (Array.isArray(e)) {
|
|
741
|
-
let o =
|
|
742
|
-
if (n + o.length + r <=
|
|
747
|
+
let o = at(e);
|
|
748
|
+
if (n + o.length + r <= rt) return o;
|
|
743
749
|
let s = e.length - 1;
|
|
744
|
-
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) + "]";
|
|
745
751
|
}
|
|
746
752
|
if (A(e)) {
|
|
747
753
|
let n = Object.entries(e);
|
|
@@ -749,13 +755,13 @@ function at(e, t, n, r) {
|
|
|
749
755
|
let r = n.length - 1;
|
|
750
756
|
return "{\n" + n.map(([e, t], n) => {
|
|
751
757
|
let o = `${a}${JSON.stringify(e)}: `;
|
|
752
|
-
return o +
|
|
758
|
+
return o + st(t, i, o.length, n === r ? 0 : 1);
|
|
753
759
|
}).join(",\n") + "\n" + " ".repeat(t) + "}";
|
|
754
760
|
}
|
|
755
761
|
return JSON.stringify(e);
|
|
756
762
|
}
|
|
757
|
-
function
|
|
758
|
-
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";
|
|
759
765
|
}
|
|
760
766
|
function k(e) {
|
|
761
767
|
return e === "" || e === void 0 ? [] : e.split(".");
|
|
@@ -763,7 +769,7 @@ function k(e) {
|
|
|
763
769
|
function A(e) {
|
|
764
770
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
765
771
|
}
|
|
766
|
-
function
|
|
772
|
+
function lt(e, t) {
|
|
767
773
|
let n = k(t), r = e;
|
|
768
774
|
for (let e of n) {
|
|
769
775
|
if (!A(r)) return;
|
|
@@ -771,7 +777,7 @@ function st(e, t) {
|
|
|
771
777
|
}
|
|
772
778
|
return r;
|
|
773
779
|
}
|
|
774
|
-
function
|
|
780
|
+
function ut(e, t) {
|
|
775
781
|
let n = k(t);
|
|
776
782
|
if (n.length === 0) return !0;
|
|
777
783
|
let r = e;
|
|
@@ -781,7 +787,7 @@ function ct(e, t) {
|
|
|
781
787
|
}
|
|
782
788
|
return A(r) ? n[n.length - 1] in r : !1;
|
|
783
789
|
}
|
|
784
|
-
function
|
|
790
|
+
function dt(e, t, n) {
|
|
785
791
|
let r = k(t);
|
|
786
792
|
if (r.length === 0) throw Error("setAtPath: jsonPath must be non-empty");
|
|
787
793
|
let i = e;
|
|
@@ -795,7 +801,7 @@ function lt(e, t, n) {
|
|
|
795
801
|
}
|
|
796
802
|
i[r[r.length - 1]] = n;
|
|
797
803
|
}
|
|
798
|
-
function
|
|
804
|
+
function ft(e, t) {
|
|
799
805
|
let n = k(t);
|
|
800
806
|
if (n.length === 0) throw Error("deleteAtPath: jsonPath must be non-empty");
|
|
801
807
|
let r = e;
|
|
@@ -805,7 +811,7 @@ function ut(e, t) {
|
|
|
805
811
|
}
|
|
806
812
|
A(r) && delete r[n[n.length - 1]];
|
|
807
813
|
}
|
|
808
|
-
function
|
|
814
|
+
function pt(e, t) {
|
|
809
815
|
let n = new Set(t), r = Object.keys(e), i = /* @__PURE__ */ new Map();
|
|
810
816
|
i.set("", []);
|
|
811
817
|
let a = "";
|
|
@@ -820,70 +826,70 @@ function dt(e, t) {
|
|
|
820
826
|
}
|
|
821
827
|
//#endregion
|
|
822
828
|
//#region src/structure/engine/parsers/lines.ts
|
|
823
|
-
function
|
|
829
|
+
function mt(e) {
|
|
824
830
|
let t = e.split("\n");
|
|
825
831
|
return t.length > 0 && t[t.length - 1] === "" && t.pop(), t;
|
|
826
832
|
}
|
|
827
|
-
function
|
|
833
|
+
function ht(e) {
|
|
828
834
|
return e.join("\n") + "\n";
|
|
829
835
|
}
|
|
830
|
-
function
|
|
836
|
+
function gt(e) {
|
|
831
837
|
return e.replace(/(^|\s)#.*$/, "$1").trim();
|
|
832
838
|
}
|
|
833
|
-
function
|
|
834
|
-
let n =
|
|
839
|
+
function _t(e, t) {
|
|
840
|
+
let n = gt(e);
|
|
835
841
|
return n === "" ? !1 : n === t.trim();
|
|
836
842
|
}
|
|
837
|
-
function
|
|
838
|
-
for (let n of e) if (
|
|
843
|
+
function vt(e, t) {
|
|
844
|
+
for (let n of e) if (_t(n, t)) return !0;
|
|
839
845
|
return !1;
|
|
840
846
|
}
|
|
841
847
|
//#endregion
|
|
842
848
|
//#region src/structure/engine/content-rules.ts
|
|
843
|
-
function
|
|
849
|
+
function yt(e, t) {
|
|
844
850
|
return e === "sdk:" ? t ? "workspace:*" : "catalog:" : e;
|
|
845
851
|
}
|
|
846
|
-
var
|
|
852
|
+
var bt = [
|
|
847
853
|
"dependencies",
|
|
848
854
|
"devDependencies",
|
|
849
855
|
"peerDependencies",
|
|
850
856
|
"optionalDependencies"
|
|
851
857
|
];
|
|
852
|
-
function
|
|
853
|
-
if (
|
|
858
|
+
function xt(e, t) {
|
|
859
|
+
if (P(e)) for (let n of bt) {
|
|
854
860
|
let r = e[n];
|
|
855
|
-
if (
|
|
861
|
+
if (P(r)) for (let e of Object.keys(r)) r[e] === "sdk:" && (r[e] = t ? "workspace:*" : "catalog:");
|
|
856
862
|
}
|
|
857
863
|
}
|
|
858
864
|
var j;
|
|
859
|
-
function
|
|
865
|
+
function St(e) {
|
|
860
866
|
if (!j) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
|
|
861
867
|
return j;
|
|
862
868
|
}
|
|
863
869
|
function M(e) {
|
|
864
|
-
let t =
|
|
870
|
+
let t = St(e);
|
|
865
871
|
if (t.kind !== "json") throw Error(`${e}() requires a JSON-managed body; got '${t.kind}'.`);
|
|
866
872
|
return t;
|
|
867
873
|
}
|
|
868
|
-
function
|
|
869
|
-
let t =
|
|
874
|
+
function N(e) {
|
|
875
|
+
let t = St(e);
|
|
870
876
|
if (t.kind !== "yaml") throw Error(`${e}() requires a YAML-managed body; got '${t.kind}'.`);
|
|
871
877
|
return t;
|
|
872
878
|
}
|
|
873
|
-
function
|
|
874
|
-
let t =
|
|
879
|
+
function Ct(e) {
|
|
880
|
+
let t = St(e);
|
|
875
881
|
if (t.kind !== "lines") throw Error(`${e}() requires a lines-managed body; got '${t.kind}'.`);
|
|
876
882
|
return t;
|
|
877
883
|
}
|
|
878
|
-
function
|
|
884
|
+
function wt(e, t) {
|
|
879
885
|
let n = e.ctx ?? He();
|
|
880
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(...).`);
|
|
881
887
|
return n;
|
|
882
888
|
}
|
|
883
|
-
function
|
|
889
|
+
function P(e) {
|
|
884
890
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
885
891
|
}
|
|
886
|
-
function
|
|
892
|
+
function Tt(e, t, n = {}) {
|
|
887
893
|
if (j) throw Error("Nested managed(...) body — engine bug.");
|
|
888
894
|
j = {
|
|
889
895
|
kind: "json",
|
|
@@ -897,14 +903,15 @@ function wt(e, t, n = {}) {
|
|
|
897
903
|
j = void 0;
|
|
898
904
|
}
|
|
899
905
|
}
|
|
900
|
-
function
|
|
906
|
+
function Et(e, t, n = {}) {
|
|
901
907
|
if (j) throw Error("Nested managed(...) body — engine bug.");
|
|
902
908
|
j = {
|
|
903
909
|
kind: "yaml",
|
|
904
910
|
doc: e,
|
|
905
911
|
ctx: n.ctx,
|
|
906
912
|
triggerContext: n.triggerContext,
|
|
907
|
-
getLatestVersion: n.getLatestVersion
|
|
913
|
+
getLatestVersion: n.getLatestVersion,
|
|
914
|
+
getDerivedDependencyPin: n.getDerivedDependencyPin
|
|
908
915
|
};
|
|
909
916
|
try {
|
|
910
917
|
return t(), e;
|
|
@@ -912,7 +919,7 @@ function Tt(e, t, n = {}) {
|
|
|
912
919
|
j = void 0;
|
|
913
920
|
}
|
|
914
921
|
}
|
|
915
|
-
function
|
|
922
|
+
function Dt(e, t, n = {}) {
|
|
916
923
|
if (j) throw Error("Nested managed(...) body — engine bug.");
|
|
917
924
|
j = {
|
|
918
925
|
kind: "lines",
|
|
@@ -932,34 +939,34 @@ Ke((e, t) => {
|
|
|
932
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.");
|
|
933
940
|
return e(n) && t(), !0;
|
|
934
941
|
});
|
|
935
|
-
function P(e, t) {
|
|
936
|
-
lt(M("ensureField").obj, e, t);
|
|
937
|
-
}
|
|
938
942
|
function F(e, t) {
|
|
943
|
+
dt(M("ensureField").obj, e, t);
|
|
944
|
+
}
|
|
945
|
+
function Ot(e, t) {
|
|
939
946
|
let n = M("removeField").obj;
|
|
940
|
-
|
|
947
|
+
ut(n, e) && (t && !t(lt(n, e)) || ft(n, e));
|
|
941
948
|
}
|
|
942
949
|
function I(e, t) {
|
|
943
|
-
|
|
950
|
+
F(`scripts.${e}`, t);
|
|
944
951
|
}
|
|
945
|
-
function
|
|
946
|
-
|
|
952
|
+
function kt(e) {
|
|
953
|
+
Ot(`scripts.${e}`);
|
|
947
954
|
}
|
|
948
|
-
var
|
|
955
|
+
var At = [
|
|
949
956
|
"dependencies",
|
|
950
957
|
"devDependencies",
|
|
951
958
|
"peerDependencies",
|
|
952
959
|
"optionalDependencies"
|
|
953
960
|
];
|
|
954
961
|
function L(e, t, n, r) {
|
|
955
|
-
let i = M(e), a = i.obj, o = n === "sdk:" ?
|
|
956
|
-
for (let e of
|
|
962
|
+
let i = M(e), a = i.obj, o = n === "sdk:" ? yt(n, wt(i, e).isSdkInternal) : n;
|
|
963
|
+
for (let e of At) {
|
|
957
964
|
if (e === r) continue;
|
|
958
965
|
let n = a[e];
|
|
959
|
-
|
|
966
|
+
P(n) && t in n && delete n[t];
|
|
960
967
|
}
|
|
961
|
-
let s = a[r], c =
|
|
962
|
-
c[t] = o,
|
|
968
|
+
let s = a[r], c = P(s) ? s : {};
|
|
969
|
+
c[t] = o, P(s) || (a[r] = c);
|
|
963
970
|
}
|
|
964
971
|
function R(e, t) {
|
|
965
972
|
L("ensureDep", e, t, "dependencies");
|
|
@@ -967,109 +974,119 @@ function R(e, t) {
|
|
|
967
974
|
function z(e, t) {
|
|
968
975
|
L("ensureDevDep", e, t, "devDependencies");
|
|
969
976
|
}
|
|
970
|
-
function
|
|
977
|
+
function jt(e, t) {
|
|
971
978
|
L("ensurePeerDep", e, t, "peerDependencies");
|
|
972
979
|
}
|
|
973
|
-
function
|
|
980
|
+
function B(e) {
|
|
974
981
|
let t = M("removeDep").obj;
|
|
975
|
-
for (let n of
|
|
982
|
+
for (let n of At) {
|
|
976
983
|
let r = t[n];
|
|
977
|
-
|
|
984
|
+
P(r) && e in r && delete r[e];
|
|
978
985
|
}
|
|
979
986
|
}
|
|
980
|
-
function
|
|
987
|
+
function V(e) {
|
|
981
988
|
for (let [t, n] of Object.entries(e)) z(t, n);
|
|
982
989
|
}
|
|
983
|
-
function
|
|
984
|
-
for (let [t, n] of Object.entries(e))
|
|
990
|
+
function H(e) {
|
|
991
|
+
for (let [t, n] of Object.entries(e)) jt(t, n);
|
|
985
992
|
}
|
|
986
|
-
function
|
|
987
|
-
let r =
|
|
993
|
+
function Mt(e, t, n) {
|
|
994
|
+
let r = wt(M(e), e);
|
|
988
995
|
for (let i of r.modules) i.scope === t && L(e, i.name, "workspace:*", n);
|
|
989
996
|
}
|
|
990
|
-
function
|
|
991
|
-
|
|
997
|
+
function U(e) {
|
|
998
|
+
Mt("ensureWorkspaceScopeDeps", e, "dependencies");
|
|
992
999
|
}
|
|
993
|
-
function
|
|
1000
|
+
function Nt(e) {
|
|
994
1001
|
let t = M("pruneKeysMatching").obj;
|
|
995
1002
|
for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
|
|
996
1003
|
}
|
|
997
|
-
function
|
|
998
|
-
let n =
|
|
1004
|
+
function Pt(e, t) {
|
|
1005
|
+
let n = pt(e, t);
|
|
999
1006
|
for (let t of Object.keys(e)) delete e[t];
|
|
1000
1007
|
for (let t of Object.keys(n)) e[t] = n[t];
|
|
1001
1008
|
}
|
|
1002
|
-
function
|
|
1003
|
-
|
|
1009
|
+
function W(e) {
|
|
1010
|
+
Pt(M("enforceFieldOrder").obj, e);
|
|
1004
1011
|
}
|
|
1005
|
-
function
|
|
1012
|
+
function Ft(e, t) {
|
|
1006
1013
|
let n = Object.keys(e).sort(), r = {};
|
|
1007
1014
|
for (let t of n) r[t] = e[t];
|
|
1008
1015
|
for (let t of Object.keys(e)) delete e[t];
|
|
1009
|
-
for (let i of n) e[i] = r[i], t &&
|
|
1016
|
+
for (let i of n) e[i] = r[i], t && P(e[i]) && Ft(e[i], !0);
|
|
1010
1017
|
}
|
|
1011
|
-
function
|
|
1018
|
+
function G(e = "", t = {}) {
|
|
1012
1019
|
let n = t.recursive ?? !1;
|
|
1013
1020
|
if (e === "" && !n) return;
|
|
1014
1021
|
let r = M("enforceAlphabeticalOrder").obj;
|
|
1015
1022
|
if (e === "") {
|
|
1016
|
-
|
|
1023
|
+
Ft(r, !0);
|
|
1017
1024
|
return;
|
|
1018
1025
|
}
|
|
1019
|
-
let i =
|
|
1020
|
-
|
|
1026
|
+
let i = lt(r, e);
|
|
1027
|
+
P(i) && Ft(i, n);
|
|
1021
1028
|
}
|
|
1022
|
-
function
|
|
1023
|
-
let e =
|
|
1029
|
+
function It() {
|
|
1030
|
+
let e = N("ensureWorkspaceModulePaths"), t = wt(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
|
|
1024
1031
|
Array.isArray(n) && n.length === t.length && n.every((e, n) => e === t[n]) || e.doc.setIn(["packages"], t);
|
|
1025
1032
|
}
|
|
1026
|
-
function
|
|
1033
|
+
function Lt(e, t) {
|
|
1027
1034
|
let n = e.doc.getIn(["catalog", t]);
|
|
1028
1035
|
return typeof n == "string" ? n : void 0;
|
|
1029
1036
|
}
|
|
1030
|
-
function
|
|
1031
|
-
let n =
|
|
1032
|
-
|
|
1037
|
+
function Rt(e, t) {
|
|
1038
|
+
let n = N("ensureCatalogVersion");
|
|
1039
|
+
Lt(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
|
|
1033
1040
|
}
|
|
1034
|
-
function
|
|
1035
|
-
let t =
|
|
1041
|
+
function zt(e) {
|
|
1042
|
+
let t = N("ensureCatalogLatest");
|
|
1036
1043
|
if (!t.getLatestVersion) return;
|
|
1037
1044
|
let n = t.getLatestVersion(e);
|
|
1038
|
-
n !== void 0 &&
|
|
1045
|
+
n !== void 0 && Lt(t, e) !== n && t.doc.setIn(["catalog", e], n);
|
|
1039
1046
|
}
|
|
1040
|
-
function
|
|
1041
|
-
let
|
|
1042
|
-
|
|
1047
|
+
function Bt(e, t) {
|
|
1048
|
+
let n = N("pinCatalogToDependencyOf");
|
|
1049
|
+
if (!n.getDerivedDependencyPin) return;
|
|
1050
|
+
let r = n.getDerivedDependencyPin(e);
|
|
1051
|
+
r !== void 0 && Lt(n, e) !== r && n.doc.setIn(["catalog", e], r);
|
|
1052
|
+
}
|
|
1053
|
+
function Vt(e) {
|
|
1054
|
+
let t = N("ensureCatalogAbsent");
|
|
1055
|
+
t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
|
|
1056
|
+
}
|
|
1057
|
+
function Ht(e) {
|
|
1058
|
+
let t = Ct("ensureGitignoreEntries");
|
|
1059
|
+
for (let n of e) vt(t.lines, n) || t.lines.push(n);
|
|
1043
1060
|
}
|
|
1044
1061
|
//#endregion
|
|
1045
1062
|
//#region src/structure/engine/parsers/yaml.ts
|
|
1046
|
-
function
|
|
1063
|
+
function Ut(e) {
|
|
1047
1064
|
return se(e);
|
|
1048
1065
|
}
|
|
1049
|
-
function
|
|
1066
|
+
function Wt(e) {
|
|
1050
1067
|
return e.toString();
|
|
1051
1068
|
}
|
|
1052
|
-
var
|
|
1053
|
-
function
|
|
1054
|
-
if (e < t) throw new
|
|
1069
|
+
var Gt = ".structure";
|
|
1070
|
+
function Kt(e, t = 0) {
|
|
1071
|
+
if (e < t) throw new qt(e, t);
|
|
1055
1072
|
}
|
|
1056
|
-
var
|
|
1073
|
+
var qt = class extends Error {
|
|
1057
1074
|
constructor(e, t) {
|
|
1058
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";
|
|
1059
1076
|
}
|
|
1060
1077
|
};
|
|
1061
|
-
function
|
|
1078
|
+
function Jt(e, t = 1) {
|
|
1062
1079
|
let n = { version: t };
|
|
1063
|
-
e.write(
|
|
1080
|
+
e.write(Gt, JSON.stringify(n));
|
|
1064
1081
|
}
|
|
1065
1082
|
//#endregion
|
|
1066
1083
|
//#region src/structure/engine/runner.ts
|
|
1067
|
-
var
|
|
1084
|
+
var Yt = class extends Error {
|
|
1068
1085
|
constructor(e) {
|
|
1069
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";
|
|
1070
1087
|
}
|
|
1071
1088
|
};
|
|
1072
|
-
function
|
|
1089
|
+
function Xt(e, t, n, r) {
|
|
1073
1090
|
switch (e.kind) {
|
|
1074
1091
|
case "text": return e.value;
|
|
1075
1092
|
case "file":
|
|
@@ -1080,7 +1097,7 @@ function Kt(e, t, n, r) {
|
|
|
1080
1097
|
return Ae(n.textRead(e.path), typeof e.vars == "function" ? e.vars() : e.vars);
|
|
1081
1098
|
case "generate": {
|
|
1082
1099
|
let n = e.fn();
|
|
1083
|
-
if (t.endsWith(".json")) return
|
|
1100
|
+
if (t.endsWith(".json")) return xt(n, r), ct(n, { collapse: !t.endsWith("package.json") });
|
|
1084
1101
|
if (t.endsWith(".yaml") || t.endsWith(".yml")) return ce(n);
|
|
1085
1102
|
if (typeof n != "string") throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);
|
|
1086
1103
|
return n;
|
|
@@ -1088,35 +1105,36 @@ function Kt(e, t, n, r) {
|
|
|
1088
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.`);
|
|
1089
1106
|
}
|
|
1090
1107
|
}
|
|
1091
|
-
function
|
|
1108
|
+
function Zt(e, t, n, r, i) {
|
|
1092
1109
|
if (n.kind === "binary") {
|
|
1093
1110
|
if (!r) throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
|
|
1094
1111
|
e.writeBinary(t, r.staticReadBinary(n.path));
|
|
1095
1112
|
return;
|
|
1096
1113
|
}
|
|
1097
|
-
e.write(t,
|
|
1114
|
+
e.write(t, Xt(n, t, r, i));
|
|
1098
1115
|
}
|
|
1099
|
-
function
|
|
1100
|
-
let
|
|
1116
|
+
function Qt(e, t, n, r, i, a) {
|
|
1117
|
+
let o = e.split("/").pop() ?? e;
|
|
1101
1118
|
if (e.endsWith(".json")) {
|
|
1102
|
-
let i =
|
|
1119
|
+
let i = nt(t);
|
|
1103
1120
|
if (typeof i != "object" || !i || Array.isArray(i)) throw Error(`managed: parsed value at '${e}' is not a JSON object`);
|
|
1104
|
-
return
|
|
1121
|
+
return Tt(i, n, { triggerContext: r }), ct(i, { collapse: o !== "package.json" });
|
|
1105
1122
|
}
|
|
1106
1123
|
if (e.endsWith(".yaml") || e.endsWith(".yml")) {
|
|
1107
|
-
let e =
|
|
1108
|
-
return
|
|
1124
|
+
let e = Ut(t);
|
|
1125
|
+
return Et(e, n, {
|
|
1109
1126
|
triggerContext: r,
|
|
1110
|
-
getLatestVersion: i
|
|
1111
|
-
|
|
1127
|
+
getLatestVersion: i,
|
|
1128
|
+
getDerivedDependencyPin: a
|
|
1129
|
+
}), Wt(e);
|
|
1112
1130
|
}
|
|
1113
|
-
if (
|
|
1114
|
-
let e =
|
|
1115
|
-
return
|
|
1131
|
+
if (o === ".gitignore" || o.endsWith(".gitignore")) {
|
|
1132
|
+
let e = mt(t);
|
|
1133
|
+
return Dt(e, n, { triggerContext: r }), ht(e);
|
|
1116
1134
|
}
|
|
1117
1135
|
throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`);
|
|
1118
1136
|
}
|
|
1119
|
-
function
|
|
1137
|
+
function $t(e) {
|
|
1120
1138
|
let t = e.list(""), n = /* @__PURE__ */ new Set();
|
|
1121
1139
|
for (let e of t) {
|
|
1122
1140
|
n.add(e);
|
|
@@ -1125,16 +1143,16 @@ function Yt(e) {
|
|
|
1125
1143
|
}
|
|
1126
1144
|
return n;
|
|
1127
1145
|
}
|
|
1128
|
-
function
|
|
1146
|
+
function en(e, t) {
|
|
1129
1147
|
let n = t === "" ? t : t.endsWith("/") ? t.slice(0, -1) : t;
|
|
1130
1148
|
return e.has(n);
|
|
1131
1149
|
}
|
|
1132
|
-
function
|
|
1150
|
+
function tn(e, t, n) {
|
|
1133
1151
|
return {
|
|
1134
1152
|
ctx: t,
|
|
1135
1153
|
version: t.version,
|
|
1136
|
-
pathExists: (t) =>
|
|
1137
|
-
pathMissing: (t) => !
|
|
1154
|
+
pathExists: (t) => en(e, t),
|
|
1155
|
+
pathMissing: (t) => !en(e, t),
|
|
1138
1156
|
filesMatch: (t) => {
|
|
1139
1157
|
let r = n ? `${n}/${t}` : t;
|
|
1140
1158
|
for (let t of e) if (ze(r, t)) return !0;
|
|
@@ -1142,20 +1160,20 @@ function Zt(e, t, n) {
|
|
|
1142
1160
|
}
|
|
1143
1161
|
};
|
|
1144
1162
|
}
|
|
1145
|
-
function
|
|
1163
|
+
function nn(e, t) {
|
|
1146
1164
|
for (let n of e.triggers) if (!n(t)) return !1;
|
|
1147
1165
|
return !0;
|
|
1148
1166
|
}
|
|
1149
|
-
function
|
|
1167
|
+
function rn(e, t) {
|
|
1150
1168
|
return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
|
|
1151
1169
|
}
|
|
1152
|
-
function
|
|
1170
|
+
function an(e, t) {
|
|
1153
1171
|
return e.filter((e) => e.modes.includes(t));
|
|
1154
1172
|
}
|
|
1155
|
-
function
|
|
1173
|
+
function on(e, t, n, r, i, a) {
|
|
1156
1174
|
let o = e.leaf;
|
|
1157
1175
|
if (o.kind === "fixed") {
|
|
1158
|
-
let i =
|
|
1176
|
+
let i = Xt(o.content, e.resolvedPath, r, a);
|
|
1159
1177
|
return t.exists(e.resolvedPath) ? t.read(e.resolvedPath) === i ? void 0 : (n || t.write(e.resolvedPath, i), {
|
|
1160
1178
|
scope: e.scope,
|
|
1161
1179
|
path: e.resolvedPath,
|
|
@@ -1168,13 +1186,13 @@ function tn(e, t, n, r, i, a) {
|
|
|
1168
1186
|
action: "create"
|
|
1169
1187
|
});
|
|
1170
1188
|
}
|
|
1171
|
-
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
1189
|
+
if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || Zt(t, e.resolvedPath, o.initial, r, a), {
|
|
1172
1190
|
scope: e.scope,
|
|
1173
1191
|
path: e.resolvedPath,
|
|
1174
1192
|
primitive: "scaffold",
|
|
1175
1193
|
action: "create"
|
|
1176
1194
|
});
|
|
1177
|
-
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n ||
|
|
1195
|
+
if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || Zt(t, e.resolvedPath, o.initial, r, a), {
|
|
1178
1196
|
scope: e.scope,
|
|
1179
1197
|
path: e.resolvedPath,
|
|
1180
1198
|
primitive: "seed",
|
|
@@ -1197,58 +1215,58 @@ function tn(e, t, n, r, i, a) {
|
|
|
1197
1215
|
});
|
|
1198
1216
|
}
|
|
1199
1217
|
}
|
|
1200
|
-
function
|
|
1218
|
+
function sn(e, t, n, r, i, a, o, s) {
|
|
1201
1219
|
if (e.leaf.kind !== "managed") return;
|
|
1202
|
-
let
|
|
1203
|
-
ee ?
|
|
1204
|
-
let
|
|
1205
|
-
if (
|
|
1220
|
+
let c = e.leaf, l = e.resolvedPath, ee = t.exists(l), u, d = !1;
|
|
1221
|
+
ee ? u = t.read(l) : (u = Xt(c.initial, l, i, s), d = !0);
|
|
1222
|
+
let f = Qt(l, u, c.body, r, a, o);
|
|
1223
|
+
if (d) return n || t.write(l, f), {
|
|
1206
1224
|
scope: e.scope,
|
|
1207
|
-
path:
|
|
1225
|
+
path: l,
|
|
1208
1226
|
primitive: "managed",
|
|
1209
1227
|
action: "create"
|
|
1210
1228
|
};
|
|
1211
|
-
if (
|
|
1229
|
+
if (f !== u) return n || t.write(l, f), {
|
|
1212
1230
|
scope: e.scope,
|
|
1213
|
-
path:
|
|
1231
|
+
path: l,
|
|
1214
1232
|
primitive: "managed",
|
|
1215
1233
|
action: "update"
|
|
1216
1234
|
};
|
|
1217
1235
|
}
|
|
1218
|
-
function
|
|
1219
|
-
let
|
|
1220
|
-
for (let e of
|
|
1221
|
-
if (e.leaf.kind === "managed" || !
|
|
1222
|
-
let o =
|
|
1223
|
-
o &&
|
|
1236
|
+
function cn(e, t, n, r, i, a, o, s) {
|
|
1237
|
+
let c = an(e, rn(n, a)), l = [], ee = $t(t);
|
|
1238
|
+
for (let e of c) {
|
|
1239
|
+
if (e.leaf.kind === "managed" || !nn(e, tn(ee, n, e.modulePath))) continue;
|
|
1240
|
+
let o = on(e, t, r, i, a, n.isSdkInternal);
|
|
1241
|
+
o && l.push(o);
|
|
1224
1242
|
}
|
|
1225
|
-
let
|
|
1226
|
-
for (let e of
|
|
1243
|
+
let u = $t(t);
|
|
1244
|
+
for (let e of c) {
|
|
1227
1245
|
if (e.leaf.kind !== "managed") continue;
|
|
1228
|
-
let a =
|
|
1229
|
-
if (!
|
|
1230
|
-
let
|
|
1231
|
-
|
|
1246
|
+
let a = tn(u, n, e.modulePath);
|
|
1247
|
+
if (!nn(e, a)) continue;
|
|
1248
|
+
let c = sn(e, t, r, a, i, o, s, n.isSdkInternal);
|
|
1249
|
+
c && l.push(c);
|
|
1232
1250
|
}
|
|
1233
|
-
return
|
|
1251
|
+
return l;
|
|
1234
1252
|
}
|
|
1235
|
-
function
|
|
1253
|
+
function ln(e, t, n, r = {}) {
|
|
1236
1254
|
return Ve(n, () => {
|
|
1237
|
-
let i = Pe(e, n), a = !!r.initMode, o =
|
|
1255
|
+
let i = Pe(e, n), a = !!r.initMode, o = cn(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
|
|
1238
1256
|
if (!n.dryRun && !n.updateDepsOnly && !a) {
|
|
1239
|
-
|
|
1257
|
+
Jt(t);
|
|
1240
1258
|
let i = {
|
|
1241
1259
|
...r.rediscover ? r.rediscover(t) : n,
|
|
1242
1260
|
dryRun: !0
|
|
1243
|
-
}, a =
|
|
1244
|
-
if (a.length > 0) throw new
|
|
1261
|
+
}, a = cn(Pe(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== Gt);
|
|
1262
|
+
if (a.length > 0) throw new Yt(a[0]);
|
|
1245
1263
|
}
|
|
1246
|
-
return a && !n.dryRun &&
|
|
1264
|
+
return a && !n.dryRun && Jt(t), { changes: o };
|
|
1247
1265
|
});
|
|
1248
1266
|
}
|
|
1249
1267
|
//#endregion
|
|
1250
1268
|
//#region src/structure/engine/discovery.ts
|
|
1251
|
-
var
|
|
1269
|
+
var un = [
|
|
1252
1270
|
"root",
|
|
1253
1271
|
"block",
|
|
1254
1272
|
"model",
|
|
@@ -1256,12 +1274,12 @@ var on = [
|
|
|
1256
1274
|
"workflow",
|
|
1257
1275
|
"test",
|
|
1258
1276
|
"software"
|
|
1259
|
-
],
|
|
1277
|
+
], dn = class extends Error {
|
|
1260
1278
|
constructor(e, t) {
|
|
1261
1279
|
super(e), this.path = t, this.name = "DiscoveryError";
|
|
1262
1280
|
}
|
|
1263
1281
|
};
|
|
1264
|
-
function
|
|
1282
|
+
function fn(e) {
|
|
1265
1283
|
let t = /* @__PURE__ */ new Set();
|
|
1266
1284
|
for (let n of [
|
|
1267
1285
|
e.dependencies,
|
|
@@ -1271,17 +1289,17 @@ function cn(e) {
|
|
|
1271
1289
|
]) if (n) for (let e of Object.keys(n)) t.add(e);
|
|
1272
1290
|
return t;
|
|
1273
1291
|
}
|
|
1274
|
-
function
|
|
1292
|
+
function pn(e) {
|
|
1275
1293
|
return e === "" || e === ".";
|
|
1276
1294
|
}
|
|
1277
|
-
function
|
|
1295
|
+
function mn(e, t) {
|
|
1278
1296
|
let n = e.pkg["block-scope"];
|
|
1279
1297
|
if (typeof n == "string") {
|
|
1280
|
-
if (!
|
|
1298
|
+
if (!un.includes(n)) throw new dn(`package.json "block-scope" must be one of ${un.join(", ")}, got '${n}'`, e.path);
|
|
1281
1299
|
return n;
|
|
1282
1300
|
}
|
|
1283
|
-
if (
|
|
1284
|
-
let r =
|
|
1301
|
+
if (pn(e.path)) return "root";
|
|
1302
|
+
let r = fn(e.pkg);
|
|
1285
1303
|
if (e.pkg["block-software"] !== void 0) return "software";
|
|
1286
1304
|
if (r.has("@platforma-sdk/package-builder")) {
|
|
1287
1305
|
for (let e of r) if (/^@platforma-open\/.*runenv/.test(e)) return "software";
|
|
@@ -1296,17 +1314,17 @@ function un(e, t) {
|
|
|
1296
1314
|
if (r.has("@platforma-sdk/model") && e.pkg.main) return "model";
|
|
1297
1315
|
if (r.has("@platforma-sdk/test")) return "test";
|
|
1298
1316
|
}
|
|
1299
|
-
function
|
|
1317
|
+
function hn(e) {
|
|
1300
1318
|
let t = /* @__PURE__ */ new Set();
|
|
1301
1319
|
for (let n of e) typeof n.pkg.name == "string" && t.add(n.pkg.name);
|
|
1302
1320
|
let n = [];
|
|
1303
1321
|
for (let r of e) {
|
|
1304
|
-
let e =
|
|
1305
|
-
if (!e) throw new
|
|
1322
|
+
let e = mn(r, t);
|
|
1323
|
+
if (!e) throw new dn(`Unclassified workspace package at '${r.path}'. Add a top-level "block-scope" string to its package.json.`, r.path);
|
|
1306
1324
|
n.push({
|
|
1307
1325
|
scope: e,
|
|
1308
1326
|
name: r.pkg.name ?? r.path,
|
|
1309
|
-
path:
|
|
1327
|
+
path: pn(r.path) ? "" : r.path
|
|
1310
1328
|
});
|
|
1311
1329
|
}
|
|
1312
1330
|
return n;
|
|
@@ -1316,21 +1334,21 @@ function dn(e) {
|
|
|
1316
1334
|
function K(e, t) {
|
|
1317
1335
|
return e.modules.filter((e) => e.scope === t);
|
|
1318
1336
|
}
|
|
1319
|
-
function
|
|
1337
|
+
function gn(e, t) {
|
|
1320
1338
|
let n = K(e, t);
|
|
1321
1339
|
if (n.length === 0) throw Error(`findModule: expected one '${t}' module, found none`);
|
|
1322
1340
|
if (n.length > 1) throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);
|
|
1323
1341
|
return n[0];
|
|
1324
1342
|
}
|
|
1325
1343
|
function q(e, t) {
|
|
1326
|
-
return { [
|
|
1344
|
+
return { [gn(e, t).name]: "workspace:*" };
|
|
1327
1345
|
}
|
|
1328
|
-
function
|
|
1346
|
+
function _n(e, t) {
|
|
1329
1347
|
let n = {};
|
|
1330
1348
|
for (let r of K(e, t)) n[r.name] = "workspace:*";
|
|
1331
1349
|
return n;
|
|
1332
1350
|
}
|
|
1333
|
-
function
|
|
1351
|
+
function vn(e) {
|
|
1334
1352
|
let t = e.facadeName, n = [
|
|
1335
1353
|
{
|
|
1336
1354
|
scope: "root",
|
|
@@ -1369,7 +1387,7 @@ function mn(e) {
|
|
|
1369
1387
|
path: "software"
|
|
1370
1388
|
}), n;
|
|
1371
1389
|
}
|
|
1372
|
-
function
|
|
1390
|
+
function yn(e) {
|
|
1373
1391
|
return {
|
|
1374
1392
|
isSdkInternal: e.isSdkInternal ?? !1,
|
|
1375
1393
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
@@ -1386,22 +1404,22 @@ var J = class extends Error {
|
|
|
1386
1404
|
super(e), this.name = "StructureCliError";
|
|
1387
1405
|
}
|
|
1388
1406
|
};
|
|
1389
|
-
function
|
|
1407
|
+
function bn(e, t) {
|
|
1390
1408
|
return e === "" ? t : `${e}/${t}`;
|
|
1391
1409
|
}
|
|
1392
|
-
function
|
|
1410
|
+
function xn(e, t) {
|
|
1393
1411
|
try {
|
|
1394
1412
|
return JSON.parse(e.read(t));
|
|
1395
1413
|
} catch {
|
|
1396
1414
|
return;
|
|
1397
1415
|
}
|
|
1398
1416
|
}
|
|
1399
|
-
function
|
|
1417
|
+
function Sn(e) {
|
|
1400
1418
|
if (e.includes("*")) throw new J(`pnpm-workspace.yaml 'packages:' entry '${e}' contains a glob. The structurer requires literal package paths — replace the glob with one entry per package directory.`);
|
|
1401
1419
|
let t = e.replace(/^\.\//, "").replace(/\/$/, "");
|
|
1402
1420
|
return t === "." ? "" : t;
|
|
1403
1421
|
}
|
|
1404
|
-
function
|
|
1422
|
+
function Cn(e) {
|
|
1405
1423
|
let t;
|
|
1406
1424
|
try {
|
|
1407
1425
|
t = e.read("pnpm-workspace.yaml");
|
|
@@ -1410,12 +1428,12 @@ function yn(e) {
|
|
|
1410
1428
|
}
|
|
1411
1429
|
let n = oe(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
|
|
1412
1430
|
for (let t of r) {
|
|
1413
|
-
let n =
|
|
1431
|
+
let n = Sn(t);
|
|
1414
1432
|
(n === "" || e.exists(n)) && i.add(n);
|
|
1415
1433
|
}
|
|
1416
1434
|
let a = [];
|
|
1417
1435
|
for (let t of i) {
|
|
1418
|
-
let n =
|
|
1436
|
+
let n = xn(e, bn(t, "package.json"));
|
|
1419
1437
|
n && a.push({
|
|
1420
1438
|
path: t,
|
|
1421
1439
|
pkg: n
|
|
@@ -1423,7 +1441,7 @@ function yn(e) {
|
|
|
1423
1441
|
}
|
|
1424
1442
|
return a;
|
|
1425
1443
|
}
|
|
1426
|
-
function
|
|
1444
|
+
function wn(e) {
|
|
1427
1445
|
let t = [], n = new Set([
|
|
1428
1446
|
"node_modules",
|
|
1429
1447
|
".turbo",
|
|
@@ -1435,7 +1453,7 @@ function bn(e) {
|
|
|
1435
1453
|
let o = e.listDir(i);
|
|
1436
1454
|
for (let s of o) {
|
|
1437
1455
|
if (!s.isDirectory || n.has(s.name)) continue;
|
|
1438
|
-
let o =
|
|
1456
|
+
let o = bn(i, s.name), c = xn(e, bn(o, "package.json"));
|
|
1439
1457
|
c && t.push({
|
|
1440
1458
|
path: o,
|
|
1441
1459
|
pkg: c
|
|
@@ -1444,7 +1462,7 @@ function bn(e) {
|
|
|
1444
1462
|
}
|
|
1445
1463
|
return r("", 1), t;
|
|
1446
1464
|
}
|
|
1447
|
-
function
|
|
1465
|
+
function Tn(e) {
|
|
1448
1466
|
let t = e.indexOf("/");
|
|
1449
1467
|
if (!e.startsWith("@") || t < 0) throw new J(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
|
|
1450
1468
|
let n = e.slice(0, t), r = e.slice(t + 1), i = r.indexOf(".");
|
|
@@ -1457,23 +1475,23 @@ function xn(e) {
|
|
|
1457
1475
|
shortName: r.slice(i + 1)
|
|
1458
1476
|
};
|
|
1459
1477
|
}
|
|
1460
|
-
function
|
|
1478
|
+
function En(e) {
|
|
1461
1479
|
try {
|
|
1462
|
-
let t = JSON.parse(e.read(
|
|
1480
|
+
let t = JSON.parse(e.read(Gt));
|
|
1463
1481
|
return typeof t.version == "number" ? t.version : 0;
|
|
1464
1482
|
} catch {
|
|
1465
1483
|
return 0;
|
|
1466
1484
|
}
|
|
1467
1485
|
}
|
|
1468
|
-
function
|
|
1469
|
-
let { fs: t, isSdkInternal: n } = e, r = n ?
|
|
1486
|
+
function Dn(e) {
|
|
1487
|
+
let { fs: t, isSdkInternal: n } = e, r = n ? wn(t) : Cn(t);
|
|
1470
1488
|
if (r.length === 0) throw new J("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
|
|
1471
|
-
let i =
|
|
1472
|
-
|
|
1489
|
+
let i = hn(r), a = En(t);
|
|
1490
|
+
Kt(a, 0);
|
|
1473
1491
|
let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
|
|
1474
1492
|
if (!o) throw new J("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
|
|
1475
|
-
let s =
|
|
1476
|
-
return
|
|
1493
|
+
let s = Tn(o.name);
|
|
1494
|
+
return yn({
|
|
1477
1495
|
isSdkInternal: n,
|
|
1478
1496
|
updateDepsOnly: e.updateDepsOnly ?? !1,
|
|
1479
1497
|
modules: i,
|
|
@@ -1508,7 +1526,7 @@ var Y = [
|
|
|
1508
1526
|
];
|
|
1509
1527
|
//#endregion
|
|
1510
1528
|
//#region src/structure/rules/root-package-json.ts
|
|
1511
|
-
function
|
|
1529
|
+
function On(e) {
|
|
1512
1530
|
return {
|
|
1513
1531
|
version: "1.0.0",
|
|
1514
1532
|
private: !0,
|
|
@@ -1525,7 +1543,7 @@ function wn(e) {
|
|
|
1525
1543
|
changeset: "changeset",
|
|
1526
1544
|
"version-packages": "changeset version",
|
|
1527
1545
|
"update-sdk": "block-tools structure refresh --update-deps-only",
|
|
1528
|
-
update: "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm fmt"
|
|
1546
|
+
update: "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"
|
|
1529
1547
|
},
|
|
1530
1548
|
peerDependencies: {
|
|
1531
1549
|
oxlint: "*",
|
|
@@ -1541,72 +1559,91 @@ function wn(e) {
|
|
|
1541
1559
|
packageManager: "pnpm@9.12.0"
|
|
1542
1560
|
};
|
|
1543
1561
|
}
|
|
1544
|
-
function
|
|
1545
|
-
|
|
1562
|
+
function kn() {
|
|
1563
|
+
F("packageManager", "pnpm@9.12.0"), Ot("name"), I("fmt", "turbo run fmt"), I("check", "turbo run check"), I("build", "turbo run build"), I("build:dev", "env PL_PKG_DEV=local turbo run build"), I("test", "env PL_PKG_DEV=local turbo run test --concurrency 1"), I("test:dry-run", "env PL_PKG_DEV=local turbo run test --dry-run=json"), I("mark-stable", "turbo run mark-stable"), I("do-pack", "turbo run do-pack"), I("watch", "turbo watch build"), I("changeset", "changeset"), I("version-packages", "changeset version"), I("update-sdk", "block-tools structure refresh --update-deps-only"), I("update", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), V({
|
|
1546
1564
|
"@changesets/cli": "catalog:",
|
|
1547
1565
|
"@milaboratories/ts-builder": "sdk:",
|
|
1548
1566
|
"@platforma-sdk/block-tools": "sdk:",
|
|
1549
1567
|
shx: "catalog:",
|
|
1550
1568
|
turbo: "catalog:"
|
|
1551
|
-
}),
|
|
1569
|
+
}), H({
|
|
1552
1570
|
oxlint: "*",
|
|
1553
1571
|
oxfmt: "*"
|
|
1554
|
-
}),
|
|
1572
|
+
}), Nt((e, t) => {
|
|
1555
1573
|
if (!/^(\/\/|--)/.test(e) || typeof t != "object" || !t) return !1;
|
|
1556
1574
|
let n = t;
|
|
1557
1575
|
return n.pnpm !== void 0 || n.overrides !== void 0;
|
|
1558
|
-
}),
|
|
1576
|
+
}), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1559
1577
|
}
|
|
1560
1578
|
//#endregion
|
|
1561
1579
|
//#region src/structure/engine/registry-client.ts
|
|
1562
|
-
var
|
|
1563
|
-
function
|
|
1580
|
+
var An = 2, jn = 500, Mn = 3e4;
|
|
1581
|
+
function Nn(e) {
|
|
1564
1582
|
if (!e) return null;
|
|
1565
1583
|
let t = Number(e);
|
|
1566
1584
|
if (Number.isFinite(t) && t > 0) return t * 1e3;
|
|
1567
1585
|
let n = Date.parse(e);
|
|
1568
1586
|
return Number.isNaN(n) ? null : Math.max(0, n - Date.now());
|
|
1569
1587
|
}
|
|
1570
|
-
async function
|
|
1588
|
+
async function Pn(e) {
|
|
1571
1589
|
for (let t = 1;; t++) {
|
|
1572
1590
|
let n;
|
|
1573
1591
|
try {
|
|
1574
|
-
n = await fetch(e, { signal: AbortSignal.timeout(
|
|
1592
|
+
n = await fetch(e, { signal: AbortSignal.timeout(Mn) });
|
|
1575
1593
|
} catch (e) {
|
|
1576
|
-
if (t >
|
|
1577
|
-
await le(
|
|
1594
|
+
if (t > An) throw e;
|
|
1595
|
+
await le(jn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1578
1596
|
continue;
|
|
1579
1597
|
}
|
|
1580
1598
|
if (n.ok) return n;
|
|
1581
|
-
if (!(n.status === 429 || n.status >= 500) || t >
|
|
1582
|
-
let r =
|
|
1599
|
+
if (!(n.status === 429 || n.status >= 500) || t > An) throw Error(`registry returned HTTP ${n.status}`);
|
|
1600
|
+
let r = Nn(n.headers.get("retry-after"));
|
|
1583
1601
|
if (r != null) {
|
|
1584
1602
|
await le(r);
|
|
1585
1603
|
continue;
|
|
1586
1604
|
}
|
|
1587
|
-
await le(
|
|
1605
|
+
await le(jn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
|
|
1588
1606
|
}
|
|
1589
1607
|
}
|
|
1590
|
-
function
|
|
1591
|
-
return {
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1608
|
+
function Fn() {
|
|
1609
|
+
return {
|
|
1610
|
+
async getLatestVersion(e) {
|
|
1611
|
+
let t = (await (await Pn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
|
|
1612
|
+
if (!t) throw Error("no 'latest' dist-tag in registry response");
|
|
1613
|
+
return t;
|
|
1614
|
+
},
|
|
1615
|
+
async getDeclaredDependency(e, t, n) {
|
|
1616
|
+
let r = await (await Pn(`https://registry.npmjs.org/${e}/${t}`)).json();
|
|
1617
|
+
return r.dependencies?.[n] ?? r.peerDependencies?.[n];
|
|
1618
|
+
}
|
|
1619
|
+
};
|
|
1596
1620
|
}
|
|
1597
|
-
async function
|
|
1621
|
+
async function In(e, t) {
|
|
1598
1622
|
let n = await Promise.all(t.map(async (t) => [t, await e.getLatestVersion(t)]));
|
|
1599
1623
|
return new Map(n);
|
|
1600
1624
|
}
|
|
1601
|
-
function
|
|
1625
|
+
function Ln(e) {
|
|
1602
1626
|
return (t) => e.get(t);
|
|
1603
1627
|
}
|
|
1604
|
-
var
|
|
1605
|
-
function
|
|
1606
|
-
return
|
|
1628
|
+
var Rn = [/^@platforma-sdk\//, /^@milaboratories\//];
|
|
1629
|
+
function zn(e) {
|
|
1630
|
+
return Rn.some((t) => t.test(e));
|
|
1607
1631
|
}
|
|
1608
|
-
async function
|
|
1609
|
-
return e.length === 0 ? () => void 0 :
|
|
1632
|
+
async function Bn(e, t = Fn()) {
|
|
1633
|
+
return e.length === 0 ? () => void 0 : Ln(await In(t, e));
|
|
1634
|
+
}
|
|
1635
|
+
function Vn(e) {
|
|
1636
|
+
return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
|
|
1637
|
+
}
|
|
1638
|
+
async function Hn(e, t = Fn()) {
|
|
1639
|
+
if (e.length === 0) return () => void 0;
|
|
1640
|
+
let n = await Promise.all(e.map(async (e) => {
|
|
1641
|
+
let n = await t.getDeclaredDependency(e.of, e.ofVersion ?? "latest", e.entry);
|
|
1642
|
+
if (n === void 0) throw Error(`derived catalog pin '${e.entry}': package '${e.of}'${e.ofVersion ? `@${e.ofVersion}` : " (latest)"} declares no dependency '${e.entry}'. A derived pin requires the source to declare the dep as an exact version.`);
|
|
1643
|
+
if (!Vn(n)) throw Error(`derived catalog pin '${e.entry}': package '${e.of}'${e.ofVersion ? `@${e.ofVersion}` : " (latest)"} declares '${e.entry}: ${n}', which is not an exact version. A derived pin requires an exact ('x.y.z') source dependency so the catalog can pin to it precisely.`);
|
|
1644
|
+
return [e.entry, n];
|
|
1645
|
+
})), r = new Map(n);
|
|
1646
|
+
return (e) => r.get(e);
|
|
1610
1647
|
}
|
|
1611
1648
|
//#endregion
|
|
1612
1649
|
//#region src/structure/rules/root-pnpm-workspace.ts
|
|
@@ -1620,29 +1657,31 @@ var X = [
|
|
|
1620
1657
|
"@platforma-sdk/package-builder",
|
|
1621
1658
|
"@milaboratories/ts-builder",
|
|
1622
1659
|
"@milaboratories/ts-configs"
|
|
1623
|
-
],
|
|
1624
|
-
for (let e of X) if (!
|
|
1625
|
-
var
|
|
1660
|
+
], Un = "0.0.0-init-must-fetch";
|
|
1661
|
+
for (let e of X) if (!zn(e)) throw Error(`SDK_CATALOG_PACKAGES entry '${e}' matches no catalog bump pattern; its placeholder would never be resolved to npm latest on init. Add it to CATALOG_BUMP_PATTERNS or move it to the infra floor.`);
|
|
1662
|
+
var Wn = {
|
|
1626
1663
|
turbo: "~2.8.11",
|
|
1627
1664
|
shx: "~0.4.0",
|
|
1628
1665
|
"@changesets/cli": "~2.29.8",
|
|
1629
|
-
vitest: "~4.0.18"
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1666
|
+
vitest: "~4.0.18"
|
|
1667
|
+
}, Gn = [{
|
|
1668
|
+
entry: "vue",
|
|
1669
|
+
of: "@platforma-sdk/ui-vue"
|
|
1670
|
+
}], Kn = "@platforma-open/milaboratories.runenv-python-3", qn = "1.8.2";
|
|
1671
|
+
function Jn(e) {
|
|
1633
1672
|
let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
|
|
1634
|
-
for (let e of X) n[e] =
|
|
1635
|
-
return Object.assign(n,
|
|
1673
|
+
for (let e of X) n[e] = Un;
|
|
1674
|
+
return Object.assign(n, Wn), e.modules.some((e) => e.scope === "software") && (n[Kn] = qn), {
|
|
1636
1675
|
packages: t,
|
|
1637
1676
|
catalog: n
|
|
1638
1677
|
};
|
|
1639
1678
|
}
|
|
1640
|
-
function
|
|
1641
|
-
|
|
1679
|
+
function Yn() {
|
|
1680
|
+
It(), Vt("vite"), Vt("tsup"), Vt("vue-tsc");
|
|
1642
1681
|
}
|
|
1643
1682
|
//#endregion
|
|
1644
1683
|
//#region src/structure/rules/root-gitignore.ts
|
|
1645
|
-
var
|
|
1684
|
+
var Xn = [
|
|
1646
1685
|
".test_auth.json",
|
|
1647
1686
|
"node_modules/",
|
|
1648
1687
|
"dist/",
|
|
@@ -1657,34 +1696,34 @@ var Un = [
|
|
|
1657
1696
|
".vscode/sftp.json",
|
|
1658
1697
|
"test-dry-run.json"
|
|
1659
1698
|
];
|
|
1660
|
-
function
|
|
1661
|
-
|
|
1699
|
+
function Zn() {
|
|
1700
|
+
Ht(Xn);
|
|
1662
1701
|
}
|
|
1663
1702
|
//#endregion
|
|
1664
1703
|
//#region src/structure/rules/root.ts
|
|
1665
|
-
function
|
|
1704
|
+
function Qn() {
|
|
1666
1705
|
b("root", () => {
|
|
1667
1706
|
x(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
1668
|
-
C("turbo.json", D("root/turbo.json")), C(".vscode/settings.json", D("root/.vscode/settings.json")), w("package.json", O(() =>
|
|
1669
|
-
|
|
1670
|
-
}), w("pnpm-workspace.yaml", O(() =>
|
|
1671
|
-
|
|
1707
|
+
C("turbo.json", D("root/turbo.json")), C(".vscode/settings.json", D("root/.vscode/settings.json")), w("package.json", O(() => On(y())), () => {
|
|
1708
|
+
kn();
|
|
1709
|
+
}), w("pnpm-workspace.yaml", O(() => Jn(y())), () => {
|
|
1710
|
+
Yn();
|
|
1672
1711
|
}), w(".gitignore", D("root/.gitignore"), () => {
|
|
1673
|
-
|
|
1712
|
+
Zn();
|
|
1674
1713
|
});
|
|
1675
1714
|
});
|
|
1676
1715
|
});
|
|
1677
1716
|
}
|
|
1678
1717
|
//#endregion
|
|
1679
1718
|
//#region src/structure/rules/block-package-json.ts
|
|
1680
|
-
function
|
|
1719
|
+
function $n(e) {
|
|
1681
1720
|
let t = {};
|
|
1682
1721
|
for (let n of K(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
|
|
1683
1722
|
for (let n of K(e, "model")) t.model = `${n.name}/dist/model.json`;
|
|
1684
1723
|
for (let n of K(e, "ui")) t.ui = `${n.name}/dist`;
|
|
1685
1724
|
return t;
|
|
1686
1725
|
}
|
|
1687
|
-
function
|
|
1726
|
+
function er(e) {
|
|
1688
1727
|
if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
|
|
1689
1728
|
let t = e.meta, n = [
|
|
1690
1729
|
["block.meta.title", t.title],
|
|
@@ -1696,13 +1735,13 @@ function qn(e) {
|
|
|
1696
1735
|
];
|
|
1697
1736
|
for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
|
|
1698
1737
|
}
|
|
1699
|
-
function
|
|
1738
|
+
function tr(e) {
|
|
1700
1739
|
let t = e.blockVars, n = {
|
|
1701
1740
|
...q(e, "model"),
|
|
1702
1741
|
...q(e, "ui"),
|
|
1703
1742
|
...q(e, "workflow")
|
|
1704
1743
|
}, r = {
|
|
1705
|
-
components:
|
|
1744
|
+
components: $n(e),
|
|
1706
1745
|
meta: {
|
|
1707
1746
|
title: t.shortName,
|
|
1708
1747
|
description: `${t.shortName} block`,
|
|
@@ -1714,7 +1753,7 @@ function Jn(e) {
|
|
|
1714
1753
|
}
|
|
1715
1754
|
}
|
|
1716
1755
|
};
|
|
1717
|
-
return
|
|
1756
|
+
return er(r), {
|
|
1718
1757
|
name: `${t.facadeName}.block`,
|
|
1719
1758
|
version: "1.0.0",
|
|
1720
1759
|
files: ["index.d.ts", "index.js"],
|
|
@@ -1732,15 +1771,15 @@ function Jn(e) {
|
|
|
1732
1771
|
block: r
|
|
1733
1772
|
};
|
|
1734
1773
|
}
|
|
1735
|
-
function
|
|
1736
|
-
|
|
1774
|
+
function nr() {
|
|
1775
|
+
F("files", ["index.d.ts", "index.js"]), I("build", "shx rm -rf ./block-pack && block-tools pack"), I("mark-stable", "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("prepublishOnly", "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("do-pack", "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"), U("model"), U("ui"), U("workflow"), z("@platforma-sdk/block-tools", "sdk:"), z("shx", "catalog:"), F("block.components", $n(y())), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1737
1776
|
}
|
|
1738
1777
|
//#endregion
|
|
1739
1778
|
//#region src/structure/rules/block.ts
|
|
1740
|
-
function
|
|
1779
|
+
function rr() {
|
|
1741
1780
|
b("block", () => {
|
|
1742
|
-
C("index.js", D("block/index.js")), C("index.d.ts", D("block/index.d.ts")), T("logos/block-logo.png",
|
|
1743
|
-
|
|
1781
|
+
C("index.js", D("block/index.js")), C("index.d.ts", D("block/index.d.ts")), T("logos/block-logo.png", Qe("block/logos/block-logo.png")), T("logos/organization-logo.png", Qe("block/logos/organization-logo.png")), w("package.json", O(() => tr(y())), () => {
|
|
1782
|
+
nr();
|
|
1744
1783
|
});
|
|
1745
1784
|
});
|
|
1746
1785
|
}
|
|
@@ -1749,7 +1788,7 @@ function Xn() {
|
|
|
1749
1788
|
var Z = "src/**/*.test.ts";
|
|
1750
1789
|
//#endregion
|
|
1751
1790
|
//#region src/structure/rules/model-package-json.ts
|
|
1752
|
-
function
|
|
1791
|
+
function ir(e) {
|
|
1753
1792
|
return {
|
|
1754
1793
|
name: `${e.blockVars.facadeName}.model`,
|
|
1755
1794
|
version: "1.0.0",
|
|
@@ -1775,8 +1814,7 @@ function Zn(e) {
|
|
|
1775
1814
|
devDependencies: {
|
|
1776
1815
|
"@milaboratories/ts-builder": "sdk:",
|
|
1777
1816
|
"@milaboratories/ts-configs": "sdk:",
|
|
1778
|
-
"@platforma-sdk/block-tools": "sdk:"
|
|
1779
|
-
vitest: "catalog:"
|
|
1817
|
+
"@platforma-sdk/block-tools": "sdk:"
|
|
1780
1818
|
},
|
|
1781
1819
|
peerDependencies: {
|
|
1782
1820
|
"@types/node": "*",
|
|
@@ -1784,42 +1822,37 @@ function Zn(e) {
|
|
|
1784
1822
|
}
|
|
1785
1823
|
};
|
|
1786
1824
|
}
|
|
1787
|
-
function
|
|
1788
|
-
|
|
1825
|
+
function ar() {
|
|
1826
|
+
F("type", "module"), F("main", "dist/index.cjs"), F("module", "dist/index.js"), F("types", "dist/index.d.ts"), F("exports", {
|
|
1789
1827
|
".": {
|
|
1790
1828
|
types: "./dist/index.d.ts",
|
|
1791
1829
|
sources: "./src/index.ts",
|
|
1792
1830
|
import: "./dist/index.js"
|
|
1793
1831
|
},
|
|
1794
1832
|
"./dist/*": "./dist/*"
|
|
1795
|
-
}), I("fmt", "ts-builder format"), I("watch", "ts-builder build --target block-model --watch"), I("build", "ts-builder build --target block-model && block-tools build-model"), I("check", "ts-builder check --target block-model"), R("@platforma-sdk/model", "sdk:"),
|
|
1833
|
+
}), I("fmt", "ts-builder format"), I("watch", "ts-builder build --target block-model --watch"), I("build", "ts-builder build --target block-model && block-tools build-model"), I("check", "ts-builder check --target block-model"), R("@platforma-sdk/model", "sdk:"), V({
|
|
1796
1834
|
"@milaboratories/ts-builder": "sdk:",
|
|
1797
1835
|
"@milaboratories/ts-configs": "sdk:",
|
|
1798
|
-
"@platforma-sdk/block-tools": "sdk:"
|
|
1799
|
-
|
|
1800
|
-
}), V({
|
|
1836
|
+
"@platforma-sdk/block-tools": "sdk:"
|
|
1837
|
+
}), H({
|
|
1801
1838
|
"@types/node": "*",
|
|
1802
1839
|
typescript: "*"
|
|
1803
|
-
}), x(S(Z), () => {
|
|
1804
|
-
I("test", "vitest run --passWithNoTests"), z("@types/node", "*");
|
|
1805
|
-
}),
|
|
1840
|
+
}), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Z), () => {
|
|
1841
|
+
I("test", "vitest run --passWithNoTests"), z("vitest", "catalog:"), z("@types/node", "*");
|
|
1842
|
+
}, () => B("vitest"))), B("tsup"), B("vite"), Ot("tsup"), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1806
1843
|
}
|
|
1807
1844
|
//#endregion
|
|
1808
1845
|
//#region src/structure/rules/model.ts
|
|
1809
|
-
function
|
|
1846
|
+
function or() {
|
|
1810
1847
|
b("model", () => {
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
P("compilerOptions.types", ["node"]);
|
|
1814
|
-
}), P("include", ["src/**/*"]), Mt((e) => e !== "extends" && e !== "include" && e !== "compilerOptions");
|
|
1815
|
-
}), 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(() => Zn(y())), () => {
|
|
1816
|
-
Qn();
|
|
1848
|
+
x(S(Z), () => C("tsconfig.json", D("model/tsconfig.node.json")), () => C("tsconfig.json", D("model/tsconfig.json"))), C(".oxlintrc.json", D("model/.oxlintrc.json")), C(".oxfmtrc.json", D("model/.oxfmtrc.json")), T("src/index.ts", D("model/src/index.ts")), w("package.json", O(() => ir(y())), () => {
|
|
1849
|
+
ar();
|
|
1817
1850
|
});
|
|
1818
1851
|
});
|
|
1819
1852
|
}
|
|
1820
1853
|
//#endregion
|
|
1821
1854
|
//#region src/structure/rules/ui-package-json.ts
|
|
1822
|
-
function
|
|
1855
|
+
function sr(e) {
|
|
1823
1856
|
return {
|
|
1824
1857
|
name: `${e.blockVars.facadeName}.ui`,
|
|
1825
1858
|
version: "1.0.0",
|
|
@@ -1838,37 +1871,31 @@ function er(e) {
|
|
|
1838
1871
|
},
|
|
1839
1872
|
devDependencies: {
|
|
1840
1873
|
"@milaboratories/ts-builder": "sdk:",
|
|
1841
|
-
"@milaboratories/ts-configs": "sdk:"
|
|
1842
|
-
vitest: "catalog:"
|
|
1874
|
+
"@milaboratories/ts-configs": "sdk:"
|
|
1843
1875
|
},
|
|
1844
1876
|
peerDependencies: { typescript: "*" }
|
|
1845
1877
|
};
|
|
1846
1878
|
}
|
|
1847
|
-
function
|
|
1848
|
-
|
|
1879
|
+
function cr() {
|
|
1880
|
+
F("type", "module"), I("fmt", "ts-builder format"), I("dev", "ts-builder serve --target block-ui"), I("watch", "ts-builder build --target block-ui --watch"), I("build", "ts-builder build --target block-ui"), I("check", "ts-builder check --target block-ui"), R("@platforma-sdk/ui-vue", "sdk:"), R("vue", "catalog:"), U("model"), V({
|
|
1849
1881
|
"@milaboratories/ts-builder": "sdk:",
|
|
1850
|
-
"@milaboratories/ts-configs": "sdk:"
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
}), W("dependencies"), W("devDependencies"), W("peerDependencies"), W("optionalDependencies"), U([...Y]);
|
|
1882
|
+
"@milaboratories/ts-configs": "sdk:"
|
|
1883
|
+
}), B("vue-tsc"), B("vite"), kt("preview"), H({ typescript: "*" }), B("@types/node"), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Z), () => {
|
|
1884
|
+
I("test", "vitest run --passWithNoTests"), z("vitest", "catalog:"), z("@types/node", "*");
|
|
1885
|
+
}, () => B("vitest"))), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1855
1886
|
}
|
|
1856
1887
|
//#endregion
|
|
1857
1888
|
//#region src/structure/rules/ui.ts
|
|
1858
|
-
function
|
|
1889
|
+
function lr() {
|
|
1859
1890
|
b("ui", () => {
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
P("compilerOptions.types", ["node"]);
|
|
1863
|
-
}), P("include", ["src/**/*"]), Mt((e) => e !== "extends" && e !== "include" && e !== "compilerOptions");
|
|
1864
|
-
}), C(".oxlintrc.json", D("ui/.oxlintrc.json")), C(".oxfmtrc.json", D("ui/.oxfmtrc.json")), Ye("index.html", D("ui/index.html")), T("src/main.ts", D("ui/src/main.ts")), T("src/app.ts", Qe("ui/src/app.tpl.ts", () => ({ modelPkg: `${$e().facadeName}.model` }))), T("src/MainPage.vue", Qe("ui/src/MainPage.tpl.vue", () => ({ shortName: $e().shortName }))), w("package.json", O(() => er(y())), () => {
|
|
1865
|
-
tr();
|
|
1891
|
+
x(S(Z), () => C("tsconfig.json", D("ui/tsconfig.node.json")), () => C("tsconfig.json", D("ui/tsconfig.json"))), C(".oxlintrc.json", D("ui/.oxlintrc.json")), C(".oxfmtrc.json", D("ui/.oxfmtrc.json")), Ze("index.html", D("ui/index.html")), T("src/main.ts", D("ui/src/main.ts")), T("src/app.ts", et("ui/src/app.tpl.ts", () => ({ modelPkg: `${tt().facadeName}.model` }))), T("src/MainPage.vue", et("ui/src/MainPage.tpl.vue", () => ({ shortName: tt().shortName }))), w("package.json", O(() => sr(y())), () => {
|
|
1892
|
+
cr();
|
|
1866
1893
|
});
|
|
1867
1894
|
});
|
|
1868
1895
|
}
|
|
1869
1896
|
//#endregion
|
|
1870
1897
|
//#region src/structure/rules/workflow-package-json.ts
|
|
1871
|
-
function
|
|
1898
|
+
function ur(e) {
|
|
1872
1899
|
return {
|
|
1873
1900
|
name: `${e.blockVars.facadeName}.workflow`,
|
|
1874
1901
|
version: "1.0.0",
|
|
@@ -1880,38 +1907,36 @@ function rr(e) {
|
|
|
1880
1907
|
},
|
|
1881
1908
|
dependencies: {
|
|
1882
1909
|
"@platforma-sdk/workflow-tengo": "sdk:",
|
|
1883
|
-
...
|
|
1910
|
+
..._n(e, "software")
|
|
1884
1911
|
},
|
|
1885
1912
|
devDependencies: {
|
|
1886
1913
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1887
1914
|
"@platforma-sdk/test": "sdk:",
|
|
1888
|
-
vitest: "catalog:",
|
|
1889
1915
|
shx: "catalog:"
|
|
1890
1916
|
}
|
|
1891
1917
|
};
|
|
1892
1918
|
}
|
|
1893
|
-
function
|
|
1894
|
-
|
|
1895
|
-
I("test", "vitest run --passWithNoTests");
|
|
1896
|
-
}), R("@platforma-sdk/workflow-tengo", "sdk:"),
|
|
1919
|
+
function dr() {
|
|
1920
|
+
F("type", "module"), I("build", "shx rm -rf dist && pl-tengo build"), I("check", "pl-tengo check"), I("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Z), () => {
|
|
1921
|
+
I("test", "vitest run --passWithNoTests"), V({ vitest: "catalog:" });
|
|
1922
|
+
}, () => B("vitest"))), R("@platforma-sdk/workflow-tengo", "sdk:"), U("software"), V({
|
|
1897
1923
|
"@platforma-sdk/tengo-builder": "sdk:",
|
|
1898
1924
|
"@platforma-sdk/test": "sdk:",
|
|
1899
|
-
vitest: "catalog:",
|
|
1900
1925
|
shx: "catalog:"
|
|
1901
|
-
}),
|
|
1926
|
+
}), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1902
1927
|
}
|
|
1903
1928
|
//#endregion
|
|
1904
1929
|
//#region src/structure/rules/workflow.ts
|
|
1905
|
-
function
|
|
1930
|
+
function fr() {
|
|
1906
1931
|
b("workflow", () => {
|
|
1907
|
-
C("tsconfig.json", D("workflow/tsconfig.json")), C("format.el", D("workflow/format.el")),
|
|
1908
|
-
|
|
1932
|
+
C("tsconfig.json", D("workflow/tsconfig.json")), C("format.el", D("workflow/format.el")), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Z), () => Ze("vitest.config.mts", D("workflow/vitest.config.mts")), () => E("vitest.config.mts"))), E("index.js"), E("index.d.ts"), T("src/main.tpl.tengo", et("workflow/src/main.tpl.tengo", () => ({ shortName: tt().shortName }))), w("package.json", O(() => ur(y())), () => {
|
|
1933
|
+
dr();
|
|
1909
1934
|
});
|
|
1910
1935
|
});
|
|
1911
1936
|
}
|
|
1912
1937
|
//#endregion
|
|
1913
1938
|
//#region src/structure/rules/test-package-json.ts
|
|
1914
|
-
function
|
|
1939
|
+
function pr(e) {
|
|
1915
1940
|
return {
|
|
1916
1941
|
name: `${e.blockVars.facadeName}.test`,
|
|
1917
1942
|
version: "1.0.0",
|
|
@@ -1930,26 +1955,26 @@ function or(e) {
|
|
|
1930
1955
|
}
|
|
1931
1956
|
};
|
|
1932
1957
|
}
|
|
1933
|
-
function
|
|
1934
|
-
|
|
1958
|
+
function mr() {
|
|
1959
|
+
F("type", "module"), I("check", "ts-builder type-check --target block-test"), I("test", "vitest run --passWithNoTests"), V({
|
|
1935
1960
|
"@platforma-sdk/test": "sdk:",
|
|
1936
1961
|
"@milaboratories/ts-builder": "sdk:",
|
|
1937
1962
|
"@milaboratories/ts-configs": "sdk:",
|
|
1938
1963
|
vitest: "catalog:"
|
|
1939
|
-
}),
|
|
1964
|
+
}), H({ typescript: "*" }), B("@types/node"), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1940
1965
|
}
|
|
1941
1966
|
//#endregion
|
|
1942
1967
|
//#region src/structure/rules/test.ts
|
|
1943
|
-
function
|
|
1968
|
+
function hr() {
|
|
1944
1969
|
b("test", () => {
|
|
1945
|
-
C("tsconfig.json", D("test/tsconfig.json")),
|
|
1946
|
-
|
|
1970
|
+
C("tsconfig.json", D("test/tsconfig.json")), Ze("vitest.config.mts", D("test/vitest.config.mts")), T("src/demo.test.ts", $e("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), w("package.json", O(() => pr(y())), () => {
|
|
1971
|
+
mr();
|
|
1947
1972
|
});
|
|
1948
1973
|
});
|
|
1949
1974
|
}
|
|
1950
1975
|
//#endregion
|
|
1951
1976
|
//#region src/structure/rules/software-package-json.ts
|
|
1952
|
-
function
|
|
1977
|
+
function gr() {
|
|
1953
1978
|
return { entrypoints: { main: { binary: {
|
|
1954
1979
|
artifact: {
|
|
1955
1980
|
type: "python",
|
|
@@ -1964,7 +1989,7 @@ function lr() {
|
|
|
1964
1989
|
cmd: ["python", "{pkg}/main.py"]
|
|
1965
1990
|
} } } };
|
|
1966
1991
|
}
|
|
1967
|
-
function
|
|
1992
|
+
function _r(e) {
|
|
1968
1993
|
return {
|
|
1969
1994
|
name: `${e.blockVars.facadeName}.software`,
|
|
1970
1995
|
version: "1.0.0",
|
|
@@ -1977,30 +2002,30 @@ function ur(e) {
|
|
|
1977
2002
|
changeset: "changeset",
|
|
1978
2003
|
"version-packages": "changeset version"
|
|
1979
2004
|
},
|
|
1980
|
-
"block-software":
|
|
2005
|
+
"block-software": gr(),
|
|
1981
2006
|
devDependencies: {
|
|
1982
2007
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
1983
2008
|
"@platforma-sdk/package-builder": "sdk:"
|
|
1984
2009
|
}
|
|
1985
2010
|
};
|
|
1986
2011
|
}
|
|
1987
|
-
function
|
|
1988
|
-
|
|
2012
|
+
function vr() {
|
|
2013
|
+
F("type", "module"), F("files", ["./dist/**/*"]), I("build", "pl-pkg build"), I("prepublishOnly", "pl-pkg prepublish"), I("changeset", "changeset"), I("version-packages", "changeset version"), V({
|
|
1989
2014
|
"@platforma-open/milaboratories.runenv-python-3": "catalog:",
|
|
1990
2015
|
"@platforma-sdk/package-builder": "sdk:"
|
|
1991
|
-
}),
|
|
2016
|
+
}), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
|
|
1992
2017
|
}
|
|
1993
2018
|
//#endregion
|
|
1994
2019
|
//#region src/structure/rules/software.ts
|
|
1995
|
-
var
|
|
1996
|
-
function
|
|
2020
|
+
var yr = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", br = "# No dependencies specified for this script\n";
|
|
2021
|
+
function xr() {
|
|
1997
2022
|
b("software", () => {
|
|
1998
|
-
T("src/main.py",
|
|
1999
|
-
|
|
2023
|
+
T("src/main.py", $e(yr)), T("src/requirements.txt", $e(br)), w("package.json", O(() => _r(y())), () => {
|
|
2024
|
+
vr();
|
|
2000
2025
|
});
|
|
2001
2026
|
});
|
|
2002
2027
|
}
|
|
2003
|
-
function
|
|
2028
|
+
function Sr() {
|
|
2004
2029
|
b("model", () => {
|
|
2005
2030
|
E("eslint.config.mjs"), E("vite.config.mts");
|
|
2006
2031
|
}), b("ui", () => {
|
|
@@ -2008,21 +2033,25 @@ function hr() {
|
|
|
2008
2033
|
}), b("test", () => {
|
|
2009
2034
|
E("eslint.config.mjs");
|
|
2010
2035
|
}), b("root", () => {
|
|
2011
|
-
E(".prettierrc"), w("package.json", O(() =>
|
|
2012
|
-
|
|
2036
|
+
E(".prettierrc"), w("package.json", O(() => On(y())), () => {
|
|
2037
|
+
kt("pretty"), B("@platforma-sdk/blocks-deps-updater");
|
|
2013
2038
|
});
|
|
2014
2039
|
});
|
|
2015
2040
|
}
|
|
2016
2041
|
//#endregion
|
|
2017
2042
|
//#region src/structure/rules/root-catalog-bump.ts
|
|
2018
|
-
function
|
|
2019
|
-
|
|
2043
|
+
function Cr() {
|
|
2044
|
+
Xe(() => {
|
|
2020
2045
|
b("root", () => {
|
|
2021
2046
|
x(({ ctx: e }) => !e.isSdkInternal, () => {
|
|
2022
|
-
w("pnpm-workspace.yaml", O(() =>
|
|
2023
|
-
for (let e of X)
|
|
2024
|
-
for (let
|
|
2025
|
-
|
|
2047
|
+
w("pnpm-workspace.yaml", O(() => Jn(y())), () => {
|
|
2048
|
+
for (let e of X) zt(e);
|
|
2049
|
+
for (let e of Gn) Bt(e.entry, {
|
|
2050
|
+
of: e.of,
|
|
2051
|
+
ofVersion: e.ofVersion
|
|
2052
|
+
});
|
|
2053
|
+
for (let [e, t] of Object.entries(Wn)) Rt(e, t);
|
|
2054
|
+
y().modules.some((e) => e.scope === "software") && Rt(Kn, qn);
|
|
2026
2055
|
});
|
|
2027
2056
|
});
|
|
2028
2057
|
});
|
|
@@ -2030,24 +2059,25 @@ function gr() {
|
|
|
2030
2059
|
}
|
|
2031
2060
|
//#endregion
|
|
2032
2061
|
//#region src/structure/structure-definition.ts
|
|
2033
|
-
var
|
|
2034
|
-
|
|
2062
|
+
var wr = Ue(() => {
|
|
2063
|
+
Qn(), rr(), or(), lr(), fr(), hr(), xr(), Sr(), Cr();
|
|
2035
2064
|
});
|
|
2036
2065
|
//#endregion
|
|
2037
2066
|
//#region src/structure/cli/run-structure.ts
|
|
2038
|
-
async function
|
|
2039
|
-
return
|
|
2067
|
+
async function Tr() {
|
|
2068
|
+
return Bn(X.filter(zn));
|
|
2040
2069
|
}
|
|
2041
|
-
async function
|
|
2042
|
-
let t = p.resolve(e.blockPath), n = e.mode === "check", r = new Oe(t), i = new ke(e.templatesRoot), a =
|
|
2070
|
+
async function Er(e) {
|
|
2071
|
+
let t = p.resolve(e.blockPath), n = e.mode === "check", r = new Oe(t), i = new ke(e.templatesRoot), a = ln(wr, r, Dn({
|
|
2043
2072
|
fs: r,
|
|
2044
2073
|
isSdkInternal: e.isSdkInternal,
|
|
2045
2074
|
updateDepsOnly: e.updateDepsOnly,
|
|
2046
2075
|
dryRun: n
|
|
2047
2076
|
}), {
|
|
2048
2077
|
templates: i,
|
|
2049
|
-
registryLookup: e.updateDepsOnly ? await
|
|
2050
|
-
|
|
2078
|
+
registryLookup: e.updateDepsOnly ? await Tr() : void 0,
|
|
2079
|
+
derivedPinLookup: e.updateDepsOnly ? await Hn(Gn) : void 0,
|
|
2080
|
+
rediscover: () => Dn({
|
|
2051
2081
|
fs: r,
|
|
2052
2082
|
isSdkInternal: e.isSdkInternal,
|
|
2053
2083
|
updateDepsOnly: !1,
|
|
@@ -2059,14 +2089,14 @@ async function yr(e) {
|
|
|
2059
2089
|
changes: a.changes
|
|
2060
2090
|
};
|
|
2061
2091
|
}
|
|
2062
|
-
function
|
|
2092
|
+
function Dr(e, t) {
|
|
2063
2093
|
if (t.length === 0) return ` ${e}: up to date (0 changes)`;
|
|
2064
2094
|
let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
|
|
2065
2095
|
return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
|
|
2066
2096
|
}
|
|
2067
2097
|
//#endregion
|
|
2068
2098
|
//#region src/cmd/structure/check.ts
|
|
2069
|
-
var
|
|
2099
|
+
var Or = class e extends d {
|
|
2070
2100
|
static description = "Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.";
|
|
2071
2101
|
static examples = ["<%= config.bin %> <%= command.id %> ./my-block", "<%= config.bin %> <%= command.id %> --sdk-internal etc/blocks/*"];
|
|
2072
2102
|
static strict = !1;
|
|
@@ -2074,7 +2104,7 @@ var xr = class e extends d {
|
|
|
2074
2104
|
async run() {
|
|
2075
2105
|
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates"), a = !1;
|
|
2076
2106
|
for (let e of r) {
|
|
2077
|
-
let t = await
|
|
2107
|
+
let t = await Er({
|
|
2078
2108
|
blockPath: e,
|
|
2079
2109
|
isSdkInternal: n["sdk-internal"],
|
|
2080
2110
|
updateDepsOnly: !1,
|
|
@@ -2082,21 +2112,21 @@ var xr = class e extends d {
|
|
|
2082
2112
|
templatesRoot: i,
|
|
2083
2113
|
log: (e) => this.log(e)
|
|
2084
2114
|
});
|
|
2085
|
-
this.log(
|
|
2115
|
+
this.log(Dr(e, t.changes)), t.changes.length > 0 && (a = !0);
|
|
2086
2116
|
}
|
|
2087
2117
|
a && this.error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.", { exit: 1 });
|
|
2088
2118
|
}
|
|
2089
|
-
}, Q = ["python"],
|
|
2119
|
+
}, Q = ["python"], kr = class extends Error {
|
|
2090
2120
|
constructor(e) {
|
|
2091
2121
|
super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
|
|
2092
2122
|
}
|
|
2093
2123
|
};
|
|
2094
2124
|
async function $(e, t, n, r) {
|
|
2095
2125
|
if (e !== void 0 && e !== "") return e;
|
|
2096
|
-
if (n) throw new
|
|
2126
|
+
if (n) throw new kr(t);
|
|
2097
2127
|
return r();
|
|
2098
2128
|
}
|
|
2099
|
-
async function
|
|
2129
|
+
async function Ar(e) {
|
|
2100
2130
|
let t = await $(e.npmOrg, "npm-org", e.nonInteractive, () => de({
|
|
2101
2131
|
message: "npm org (e.g. @platforma-open):",
|
|
2102
2132
|
default: "@platforma-open"
|
|
@@ -2124,28 +2154,29 @@ async function Cr(e) {
|
|
|
2124
2154
|
softwarePlatform: a
|
|
2125
2155
|
};
|
|
2126
2156
|
}
|
|
2127
|
-
async function
|
|
2128
|
-
let t = e.vars, n =
|
|
2157
|
+
async function jr(e) {
|
|
2158
|
+
let t = e.vars, n = vn(t), r = new Oe(e.blockPath), i = new ke(e.templatesRoot), a = yn({
|
|
2129
2159
|
blockVars: t,
|
|
2130
2160
|
modules: n,
|
|
2131
2161
|
isSdkInternal: !1,
|
|
2132
2162
|
version: 1,
|
|
2133
2163
|
dryRun: !1
|
|
2134
|
-
}), o = X.filter(
|
|
2164
|
+
}), o = X.filter(zn), s, c;
|
|
2135
2165
|
try {
|
|
2136
|
-
s = await
|
|
2166
|
+
s = await Bn(o), c = await Hn(Gn);
|
|
2137
2167
|
} catch (e) {
|
|
2138
2168
|
throw Error(`init requires network access to resolve SDK catalog versions from npm, but the registry lookup failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
2139
2169
|
}
|
|
2140
|
-
return
|
|
2170
|
+
return ln(wr, r, a, {
|
|
2141
2171
|
templates: i,
|
|
2142
2172
|
initMode: !0,
|
|
2143
|
-
registryLookup: s
|
|
2173
|
+
registryLookup: s,
|
|
2174
|
+
derivedPinLookup: c
|
|
2144
2175
|
}), e.log(`Initialised block '${t.facadeName}'${t.softwarePlatform ? ` (software: ${t.softwarePlatform})` : " (no software)"} at ${e.blockPath}`), t;
|
|
2145
2176
|
}
|
|
2146
2177
|
//#endregion
|
|
2147
2178
|
//#region src/cmd/index.ts
|
|
2148
|
-
var
|
|
2179
|
+
var Mr = {
|
|
2149
2180
|
"build-meta": pe,
|
|
2150
2181
|
"build-model": he,
|
|
2151
2182
|
"list-overview-snapshots": ge,
|
|
@@ -2156,7 +2187,7 @@ var Tr = {
|
|
|
2156
2187
|
"restore-overview-from-snapshot": Se,
|
|
2157
2188
|
"update-deps": Ce,
|
|
2158
2189
|
"upload-package-v1": De,
|
|
2159
|
-
"structure:check":
|
|
2190
|
+
"structure:check": Or,
|
|
2160
2191
|
"structure:init": class e extends d {
|
|
2161
2192
|
static description = "Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.";
|
|
2162
2193
|
static examples = ["<%= config.bin %> <%= command.id %> --npm-org @platforma-open --org-scope my-org --short-name demo --no-software --non-interactive", "<%= config.bin %> <%= command.id %> ./demo --npm-org @platforma-open --org-scope my-org --short-name demo --with-software --platform python --non-interactive"];
|
|
@@ -2176,7 +2207,7 @@ var Tr = {
|
|
|
2176
2207
|
async run() {
|
|
2177
2208
|
let { args: t, flags: n } = await this.parse(e);
|
|
2178
2209
|
n["with-software"] && n["no-software"] && this.error("--with-software and --no-software are mutually exclusive.");
|
|
2179
|
-
let r = n["with-software"] ? !0 : n["no-software"] ? !1 : void 0, i = await
|
|
2210
|
+
let r = n["with-software"] ? !0 : n["no-software"] ? !1 : void 0, i = await Ar({
|
|
2180
2211
|
npmOrg: n["npm-org"],
|
|
2181
2212
|
orgScope: n["org-scope"],
|
|
2182
2213
|
shortName: n["short-name"],
|
|
@@ -2184,7 +2215,7 @@ var Tr = {
|
|
|
2184
2215
|
platform: n.platform,
|
|
2185
2216
|
nonInteractive: n["non-interactive"]
|
|
2186
2217
|
});
|
|
2187
|
-
await
|
|
2218
|
+
await jr({
|
|
2188
2219
|
vars: i,
|
|
2189
2220
|
blockPath: t.path ? p.resolve(t.path) : p.resolve(process.cwd(), i.shortName),
|
|
2190
2221
|
templatesRoot: p.join(this.config.root, "src", "structure", "templates"),
|
|
@@ -2207,7 +2238,7 @@ var Tr = {
|
|
|
2207
2238
|
async run() {
|
|
2208
2239
|
let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates");
|
|
2209
2240
|
for (let e of r) {
|
|
2210
|
-
let t = await
|
|
2241
|
+
let t = await Er({
|
|
2211
2242
|
blockPath: e,
|
|
2212
2243
|
isSdkInternal: n["sdk-internal"],
|
|
2213
2244
|
updateDepsOnly: n["update-deps-only"],
|
|
@@ -2215,12 +2246,12 @@ var Tr = {
|
|
|
2215
2246
|
templatesRoot: i,
|
|
2216
2247
|
log: (e) => this.log(e)
|
|
2217
2248
|
});
|
|
2218
|
-
this.log(
|
|
2249
|
+
this.log(Dr(e, t.changes));
|
|
2219
2250
|
}
|
|
2220
2251
|
}
|
|
2221
2252
|
}
|
|
2222
2253
|
};
|
|
2223
2254
|
//#endregion
|
|
2224
|
-
export {
|
|
2255
|
+
export { Mr as COMMANDS };
|
|
2225
2256
|
|
|
2226
2257
|
//# sourceMappingURL=cli.mjs.map
|