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