@syncline-design/cli 0.1.0-sandbox.42 → 0.1.0-sandbox.44
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/README.md +8 -0
- package/bin.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/{run-BkY-ZvBm.js → run-DJcpz49c.js} +568 -528
|
@@ -5,7 +5,7 @@ import { createHash as m } from "node:crypto";
|
|
|
5
5
|
import { spawn as h } from "node:child_process";
|
|
6
6
|
import { createInterface as g } from "node:readline";
|
|
7
7
|
//#region src/build-info.ts
|
|
8
|
-
var _ = "https://sandbox.syncline.design", v = "0.1.0-sandbox.
|
|
8
|
+
var _ = "https://sandbox.syncline.design", v = "0.1.0-sandbox.44";
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region ../../node_modules/zod/v4/core/util.js
|
|
11
11
|
function y(e) {
|
|
@@ -13593,7 +13593,7 @@ var Fb = B({
|
|
|
13593
13593
|
name: F(),
|
|
13594
13594
|
email: F()
|
|
13595
13595
|
})
|
|
13596
|
-
}), Ib = "@syncline-design/cli",
|
|
13596
|
+
}), Ib = B({ enabled: R() }), Lb = "@syncline-design/cli", Rb = B({ error: B({
|
|
13597
13597
|
code: H([
|
|
13598
13598
|
"bad_request",
|
|
13599
13599
|
"unauthorized",
|
|
@@ -13612,19 +13612,19 @@ var Fb = B({
|
|
|
13612
13612
|
})).optional()
|
|
13613
13613
|
}) });
|
|
13614
13614
|
B({ id: vs() });
|
|
13615
|
-
var
|
|
13615
|
+
var zb = F().regex(/^[\w.-]+\/[\w.-]+$/), Bb = /^\w[\w .-]{0,59}$/, Vb = /^[A-Za-z0-9:;_-]{1,100}$/, Hb = /^[^\u0000-\u001f\u007f]{1,160}$/, Ub = B({
|
|
13616
13616
|
logo: B({
|
|
13617
|
-
componentId: F().regex(
|
|
13618
|
-
variantId: F().regex(
|
|
13617
|
+
componentId: F().regex(Vb),
|
|
13618
|
+
variantId: F().regex(Vb).optional()
|
|
13619
13619
|
}).optional(),
|
|
13620
|
-
colorToken: F().regex(
|
|
13621
|
-
surfaceToken: F().regex(
|
|
13622
|
-
}),
|
|
13620
|
+
colorToken: F().regex(Hb).optional(),
|
|
13621
|
+
surfaceToken: F().regex(Hb).optional()
|
|
13622
|
+
}), Wb = B({
|
|
13623
13623
|
framework: U("react"),
|
|
13624
13624
|
styling: U("styled-components"),
|
|
13625
|
-
libraryName: F().regex(
|
|
13625
|
+
libraryName: F().regex(Bb),
|
|
13626
13626
|
installDependencies: R().default(!1),
|
|
13627
|
-
brand:
|
|
13627
|
+
brand: Ub.optional()
|
|
13628
13628
|
});
|
|
13629
13629
|
Ys("state", [
|
|
13630
13630
|
B({
|
|
@@ -13649,7 +13649,7 @@ Ys("state", [
|
|
|
13649
13649
|
]);
|
|
13650
13650
|
//#endregion
|
|
13651
13651
|
//#region ../core/src/schema/design-payload.ts
|
|
13652
|
-
var
|
|
13652
|
+
var Gb = Sc(() => qs([
|
|
13653
13653
|
L(),
|
|
13654
13654
|
F(),
|
|
13655
13655
|
R(),
|
|
@@ -13663,7 +13663,7 @@ var Wb = Sc(() => qs([
|
|
|
13663
13663
|
type: U("VARIABLE_ALIAS"),
|
|
13664
13664
|
id: F()
|
|
13665
13665
|
})
|
|
13666
|
-
])),
|
|
13666
|
+
])), Kb = B({
|
|
13667
13667
|
id: F(),
|
|
13668
13668
|
name: F(),
|
|
13669
13669
|
resolvedType: H([
|
|
@@ -13672,19 +13672,19 @@ var Wb = Sc(() => qs([
|
|
|
13672
13672
|
"FLOAT",
|
|
13673
13673
|
"STRING"
|
|
13674
13674
|
]),
|
|
13675
|
-
valuesByMode: V(F(),
|
|
13675
|
+
valuesByMode: V(F(), Gb),
|
|
13676
13676
|
description: F().nullish(),
|
|
13677
13677
|
scopes: z(F()).nullish(),
|
|
13678
13678
|
hiddenFromPublishing: R().nullish()
|
|
13679
|
-
}),
|
|
13679
|
+
}), qb = B({
|
|
13680
13680
|
id: F(),
|
|
13681
13681
|
name: F(),
|
|
13682
13682
|
modes: z(B({
|
|
13683
13683
|
modeId: F(),
|
|
13684
13684
|
name: F()
|
|
13685
13685
|
})),
|
|
13686
|
-
variables: z(
|
|
13687
|
-
}),
|
|
13686
|
+
variables: z(Kb)
|
|
13687
|
+
}), Jb = Ys("unit", [
|
|
13688
13688
|
B({ unit: U("AUTO") }),
|
|
13689
13689
|
B({
|
|
13690
13690
|
unit: U("PIXELS"),
|
|
@@ -13694,19 +13694,19 @@ var Wb = Sc(() => qs([
|
|
|
13694
13694
|
unit: U("PERCENT"),
|
|
13695
13695
|
value: L()
|
|
13696
13696
|
})
|
|
13697
|
-
]),
|
|
13697
|
+
]), Yb = Ys("unit", [B({
|
|
13698
13698
|
unit: U("PIXELS"),
|
|
13699
13699
|
value: L()
|
|
13700
13700
|
}), B({
|
|
13701
13701
|
unit: U("PERCENT"),
|
|
13702
13702
|
value: L()
|
|
13703
|
-
})]),
|
|
13703
|
+
})]), Xb = H([
|
|
13704
13704
|
"UPPER",
|
|
13705
13705
|
"LOWER",
|
|
13706
13706
|
"TITLE",
|
|
13707
13707
|
"SMALL_CAPS",
|
|
13708
13708
|
"SMALL_CAPS_FORCED"
|
|
13709
|
-
]),
|
|
13709
|
+
]), Zb = H(["UNDERLINE", "STRIKETHROUGH"]), Qb = B({
|
|
13710
13710
|
fontSize: B({
|
|
13711
13711
|
type: U("VARIABLE_ALIAS"),
|
|
13712
13712
|
id: F()
|
|
@@ -13726,27 +13726,27 @@ var Wb = Sc(() => qs([
|
|
|
13726
13726
|
}).catchall(B({
|
|
13727
13727
|
type: U("VARIABLE_ALIAS"),
|
|
13728
13728
|
id: F()
|
|
13729
|
-
})),
|
|
13729
|
+
})), $b = B({
|
|
13730
13730
|
fontFamily: F(),
|
|
13731
13731
|
fontWeight: L().int().min(100).max(900),
|
|
13732
13732
|
fontStyle: H(["italic", "oblique"]).optional(),
|
|
13733
13733
|
fontSize: L(),
|
|
13734
|
-
lineHeight:
|
|
13735
|
-
letterSpacing:
|
|
13736
|
-
textTransform:
|
|
13737
|
-
textDecoration:
|
|
13738
|
-
}),
|
|
13734
|
+
lineHeight: Jb,
|
|
13735
|
+
letterSpacing: Yb,
|
|
13736
|
+
textTransform: Xb.optional(),
|
|
13737
|
+
textDecoration: Zb.optional()
|
|
13738
|
+
}), ex = $b.extend({
|
|
13739
13739
|
id: F(),
|
|
13740
13740
|
name: F(),
|
|
13741
13741
|
description: F().optional(),
|
|
13742
|
-
boundVariables:
|
|
13743
|
-
}),
|
|
13742
|
+
boundVariables: Qb.optional()
|
|
13743
|
+
}), tx = V(F(), qs([B({
|
|
13744
13744
|
type: U("VARIABLE_ALIAS"),
|
|
13745
13745
|
id: F()
|
|
13746
13746
|
}), z(B({
|
|
13747
13747
|
type: U("VARIABLE_ALIAS"),
|
|
13748
13748
|
id: F()
|
|
13749
|
-
}))])),
|
|
13749
|
+
}))])), nx = B({
|
|
13750
13750
|
layoutMode: H(["HORIZONTAL", "VERTICAL"]),
|
|
13751
13751
|
paddingTop: L(),
|
|
13752
13752
|
paddingRight: L(),
|
|
@@ -13773,16 +13773,16 @@ var Wb = Sc(() => qs([
|
|
|
13773
13773
|
layoutWrap: U("WRAP"),
|
|
13774
13774
|
counterAxisSpacing: L(),
|
|
13775
13775
|
fillHeight: H(["grow", "stretch"])
|
|
13776
|
-
}).partial().extend({ layoutMode: H(["HORIZONTAL", "VERTICAL"]) }),
|
|
13776
|
+
}).partial().extend({ layoutMode: H(["HORIZONTAL", "VERTICAL"]) }), rx = B({
|
|
13777
13777
|
type: H(["COMPONENT", "COMPONENT_SET"]),
|
|
13778
13778
|
key: F()
|
|
13779
|
-
}),
|
|
13779
|
+
}), ix = B({
|
|
13780
13780
|
allowPreferredValuesOnly: R().optional(),
|
|
13781
13781
|
minChildren: L().nullable().optional(),
|
|
13782
13782
|
maxChildren: L().nullable().optional(),
|
|
13783
13783
|
stretchChildOnInsert: R().optional(),
|
|
13784
13784
|
displayEmptyByDefault: R().optional()
|
|
13785
|
-
}),
|
|
13785
|
+
}), ax = V(F(), B({
|
|
13786
13786
|
type: H([
|
|
13787
13787
|
"BOOLEAN",
|
|
13788
13788
|
"INSTANCE_SWAP",
|
|
@@ -13792,14 +13792,14 @@ var Wb = Sc(() => qs([
|
|
|
13792
13792
|
]),
|
|
13793
13793
|
defaultValue: qs([F(), R()]).catch(""),
|
|
13794
13794
|
variantOptions: z(F()).optional(),
|
|
13795
|
-
preferredValues: z(
|
|
13796
|
-
slotSettings:
|
|
13795
|
+
preferredValues: z(rx).nullish(),
|
|
13796
|
+
slotSettings: ix.nullish(),
|
|
13797
13797
|
description: F().nullish()
|
|
13798
|
-
})),
|
|
13798
|
+
})), ox = H([
|
|
13799
13799
|
"FIXED",
|
|
13800
13800
|
"HUG",
|
|
13801
13801
|
"FILL"
|
|
13802
|
-
]),
|
|
13802
|
+
]), sx = V(F(), B({
|
|
13803
13803
|
type: H([
|
|
13804
13804
|
"BOOLEAN",
|
|
13805
13805
|
"INSTANCE_SWAP",
|
|
@@ -13808,28 +13808,28 @@ var Wb = Sc(() => qs([
|
|
|
13808
13808
|
"VARIANT"
|
|
13809
13809
|
]),
|
|
13810
13810
|
value: qs([F(), R()]).catch("")
|
|
13811
|
-
})),
|
|
13811
|
+
})), cx = B({
|
|
13812
13812
|
horizontal: F(),
|
|
13813
13813
|
vertical: F()
|
|
13814
|
-
}),
|
|
13814
|
+
}), lx = Sc(() => B({
|
|
13815
13815
|
id: F(),
|
|
13816
13816
|
name: F(),
|
|
13817
13817
|
type: F(),
|
|
13818
13818
|
visible: R(),
|
|
13819
|
-
boundVariables:
|
|
13819
|
+
boundVariables: tx.optional(),
|
|
13820
13820
|
width: L().optional(),
|
|
13821
13821
|
height: L().optional(),
|
|
13822
|
-
layoutSizingHorizontal:
|
|
13823
|
-
layoutSizingVertical:
|
|
13824
|
-
autoLayout:
|
|
13822
|
+
layoutSizingHorizontal: ox.optional(),
|
|
13823
|
+
layoutSizingVertical: ox.optional(),
|
|
13824
|
+
autoLayout: nx.nullable().optional(),
|
|
13825
13825
|
clipsContent: R().optional(),
|
|
13826
13826
|
layoutPositioning: H(["ABSOLUTE", "AUTO"]).optional(),
|
|
13827
13827
|
x: L().optional(),
|
|
13828
13828
|
y: L().optional(),
|
|
13829
|
-
constraints:
|
|
13829
|
+
constraints: cx.optional(),
|
|
13830
13830
|
characters: F().optional(),
|
|
13831
13831
|
textStyleId: F().optional(),
|
|
13832
|
-
typography:
|
|
13832
|
+
typography: $b.optional(),
|
|
13833
13833
|
textAlignHorizontal: H([
|
|
13834
13834
|
"LEFT",
|
|
13835
13835
|
"CENTER",
|
|
@@ -13846,19 +13846,19 @@ var Wb = Sc(() => qs([
|
|
|
13846
13846
|
componentId: F().optional(),
|
|
13847
13847
|
externalComponent: R().optional(),
|
|
13848
13848
|
externalName: F().optional(),
|
|
13849
|
-
componentProperties:
|
|
13849
|
+
componentProperties: sx.optional(),
|
|
13850
13850
|
componentPropertyReferences: V(F(), F()).optional(),
|
|
13851
13851
|
isExposedInstance: R().optional(),
|
|
13852
13852
|
instanceColor: B({
|
|
13853
13853
|
variableId: F().optional(),
|
|
13854
13854
|
paint: V(F(), Vs()).optional()
|
|
13855
13855
|
}).optional(),
|
|
13856
|
-
children: z(
|
|
13857
|
-
})),
|
|
13856
|
+
children: z(lx).optional()
|
|
13857
|
+
})), ux = B({
|
|
13858
13858
|
id: F(),
|
|
13859
13859
|
name: F(),
|
|
13860
|
-
boundVariables:
|
|
13861
|
-
inferredAutoLayout:
|
|
13860
|
+
boundVariables: tx,
|
|
13861
|
+
inferredAutoLayout: nx.nullable(),
|
|
13862
13862
|
size: B({
|
|
13863
13863
|
width: L(),
|
|
13864
13864
|
height: L()
|
|
@@ -13869,18 +13869,18 @@ var Wb = Sc(() => qs([
|
|
|
13869
13869
|
effects: z(V(F(), Vs())).optional(),
|
|
13870
13870
|
strokes: z(V(F(), Vs())).optional(),
|
|
13871
13871
|
strokeWeight: L().optional(),
|
|
13872
|
-
children: z(
|
|
13872
|
+
children: z(lx),
|
|
13873
13873
|
svgAssetPath: F().optional()
|
|
13874
|
-
}),
|
|
13874
|
+
}), dx = B({
|
|
13875
13875
|
id: F(),
|
|
13876
13876
|
name: F(),
|
|
13877
13877
|
type: U("COMPONENT_SET"),
|
|
13878
13878
|
key: F().optional(),
|
|
13879
13879
|
pageName: F().optional(),
|
|
13880
13880
|
description: F().optional(),
|
|
13881
|
-
componentPropertyDefinitions:
|
|
13882
|
-
variants: z(
|
|
13883
|
-
}),
|
|
13881
|
+
componentPropertyDefinitions: ax,
|
|
13882
|
+
variants: z(ux)
|
|
13883
|
+
}), fx = B({
|
|
13884
13884
|
meta: B({
|
|
13885
13885
|
extractedAt: Ec(),
|
|
13886
13886
|
pageId: F().optional(),
|
|
@@ -13890,17 +13890,17 @@ var Wb = Sc(() => qs([
|
|
|
13890
13890
|
name: F()
|
|
13891
13891
|
})).optional()
|
|
13892
13892
|
}),
|
|
13893
|
-
variables: B({ collections: z(
|
|
13894
|
-
textStyles: z(
|
|
13895
|
-
components: z(
|
|
13896
|
-
}),
|
|
13893
|
+
variables: B({ collections: z(qb) }),
|
|
13894
|
+
textStyles: z(ex),
|
|
13895
|
+
components: z(dx)
|
|
13896
|
+
}), px = B({
|
|
13897
13897
|
role: F().optional(),
|
|
13898
13898
|
"aria-label": F().optional(),
|
|
13899
13899
|
"aria-describedby": F().optional(),
|
|
13900
13900
|
"aria-expanded": R().optional(),
|
|
13901
13901
|
"aria-haspopup": R().optional(),
|
|
13902
13902
|
"aria-disabled": R().optional()
|
|
13903
|
-
}),
|
|
13903
|
+
}), mx = /* @__PURE__ */ "button.a.input.div.span.section.article.nav.header.footer.aside.ul.ol.li.label.img.svg.form.fieldset.p.h1.h2.h3.h4.h5.h6".split("."), hx = [
|
|
13904
13904
|
"div",
|
|
13905
13905
|
"span",
|
|
13906
13906
|
"ul",
|
|
@@ -13920,10 +13920,10 @@ var Wb = Sc(() => qs([
|
|
|
13920
13920
|
"nav",
|
|
13921
13921
|
"aside",
|
|
13922
13922
|
"label"
|
|
13923
|
-
],
|
|
13923
|
+
], gx = B({
|
|
13924
13924
|
path: z(F()),
|
|
13925
|
-
htmlTag: H(
|
|
13926
|
-
}),
|
|
13925
|
+
htmlTag: H(hx)
|
|
13926
|
+
}), _x = [
|
|
13927
13927
|
"input",
|
|
13928
13928
|
"progress",
|
|
13929
13929
|
"select",
|
|
@@ -13943,7 +13943,7 @@ var Wb = Sc(() => qs([
|
|
|
13943
13943
|
"dateinput",
|
|
13944
13944
|
"calendarday",
|
|
13945
13945
|
"calendar"
|
|
13946
|
-
],
|
|
13946
|
+
], vx = [..._x, "datepicker"], yx = [
|
|
13947
13947
|
"text",
|
|
13948
13948
|
"search",
|
|
13949
13949
|
"email",
|
|
@@ -13951,14 +13951,14 @@ var Wb = Sc(() => qs([
|
|
|
13951
13951
|
"number",
|
|
13952
13952
|
"tel",
|
|
13953
13953
|
"url"
|
|
13954
|
-
],
|
|
13955
|
-
htmlTag: H(
|
|
13956
|
-
elements: z(
|
|
13957
|
-
archetype: H(
|
|
13954
|
+
], bx = B({
|
|
13955
|
+
htmlTag: H(mx),
|
|
13956
|
+
elements: z(gx).optional(),
|
|
13957
|
+
archetype: H(vx).optional(),
|
|
13958
13958
|
archetypePlaceholder: z(F()).optional(),
|
|
13959
|
-
inputType: H(
|
|
13959
|
+
inputType: H(yx).optional(),
|
|
13960
13960
|
jsDocDescription: F(),
|
|
13961
|
-
suggestedAriaAttributes:
|
|
13961
|
+
suggestedAriaAttributes: px,
|
|
13962
13962
|
enrichmentConfidence: H([
|
|
13963
13963
|
"high",
|
|
13964
13964
|
"medium",
|
|
@@ -13966,43 +13966,43 @@ var Wb = Sc(() => qs([
|
|
|
13966
13966
|
]),
|
|
13967
13967
|
notes: F().optional()
|
|
13968
13968
|
});
|
|
13969
|
-
B({ enrichments: z(
|
|
13970
|
-
var
|
|
13969
|
+
B({ enrichments: z(bx) });
|
|
13970
|
+
var xx = B({
|
|
13971
13971
|
id: F().min(1),
|
|
13972
13972
|
name: F(),
|
|
13973
13973
|
properties: V(F(), Vs()),
|
|
13974
13974
|
outline: F().max(5e4).optional(),
|
|
13975
|
-
archetypes: z(H(
|
|
13975
|
+
archetypes: z(H(_x)).max(_x.length).optional()
|
|
13976
13976
|
});
|
|
13977
13977
|
B({
|
|
13978
13978
|
factsVersion: L().int().positive(),
|
|
13979
|
-
components: z(
|
|
13979
|
+
components: z(xx).min(1).max(10)
|
|
13980
13980
|
});
|
|
13981
|
-
var
|
|
13981
|
+
var Sx = B({
|
|
13982
13982
|
id: F(),
|
|
13983
|
-
htmlTag: H(
|
|
13984
|
-
}),
|
|
13983
|
+
htmlTag: H(hx)
|
|
13984
|
+
}), Cx = bx.omit({
|
|
13985
13985
|
elements: !0,
|
|
13986
13986
|
archetype: !0,
|
|
13987
13987
|
archetypePlaceholder: !0,
|
|
13988
13988
|
inputType: !0
|
|
13989
13989
|
}).extend({
|
|
13990
|
-
elements: z(
|
|
13991
|
-
archetype: H(
|
|
13992
|
-
inputType: H(
|
|
13990
|
+
elements: z(Sx).optional(),
|
|
13991
|
+
archetype: H(_x).optional(),
|
|
13992
|
+
inputType: H(yx).optional(),
|
|
13993
13993
|
placeholderId: F().optional()
|
|
13994
|
-
}),
|
|
13994
|
+
}), wx = Ys("ok", [B({
|
|
13995
13995
|
ok: U(!0),
|
|
13996
13996
|
id: F(),
|
|
13997
|
-
enrichment:
|
|
13997
|
+
enrichment: Cx
|
|
13998
13998
|
}), B({
|
|
13999
13999
|
ok: U(!1),
|
|
14000
14000
|
id: F(),
|
|
14001
14001
|
error: F()
|
|
14002
|
-
})]),
|
|
14002
|
+
})]), Tx = B({
|
|
14003
14003
|
promptVersion: F(),
|
|
14004
|
-
results: z(
|
|
14005
|
-
}),
|
|
14004
|
+
results: z(wx)
|
|
14005
|
+
}), Ex = B({
|
|
14006
14006
|
promptVersion: F(),
|
|
14007
14007
|
factsVersions: z(L().int().positive()).min(1)
|
|
14008
14008
|
});
|
|
@@ -14010,60 +14010,60 @@ B({
|
|
|
14010
14010
|
component: F(),
|
|
14011
14011
|
stories: F()
|
|
14012
14012
|
}), B({ stories: F() });
|
|
14013
|
-
var
|
|
14013
|
+
var Dx = H(["generate", "storybook-build"]), Ox = {
|
|
14014
14014
|
summary: 300,
|
|
14015
14015
|
log: 6e4,
|
|
14016
14016
|
excerpt: 4e3
|
|
14017
14017
|
};
|
|
14018
14018
|
B({
|
|
14019
|
-
step:
|
|
14020
|
-
summary: F().min(1).max(
|
|
14021
|
-
log: F().max(
|
|
14019
|
+
step: Dx,
|
|
14020
|
+
summary: F().min(1).max(Ox.summary),
|
|
14021
|
+
log: F().max(Ox.log),
|
|
14022
14022
|
excerpt: B({
|
|
14023
14023
|
path: F().min(1).max(300),
|
|
14024
14024
|
startLine: L().int().min(1),
|
|
14025
|
-
text: F().max(
|
|
14025
|
+
text: F().max(Ox.excerpt)
|
|
14026
14026
|
}).optional(),
|
|
14027
14027
|
cliVersion: F().max(60).optional(),
|
|
14028
14028
|
runUrl: bs().max(300).optional()
|
|
14029
14029
|
});
|
|
14030
|
-
var
|
|
14030
|
+
var kx = B({
|
|
14031
14031
|
recorded: U(!0),
|
|
14032
14032
|
issueUrl: bs().optional()
|
|
14033
|
-
}),
|
|
14034
|
-
step:
|
|
14033
|
+
}), Ax = B({
|
|
14034
|
+
step: Dx,
|
|
14035
14035
|
summary: F(),
|
|
14036
14036
|
reported: R(),
|
|
14037
14037
|
resolution: U("fixed").optional()
|
|
14038
14038
|
});
|
|
14039
14039
|
B({ status: U("ok") });
|
|
14040
|
-
var
|
|
14040
|
+
var jx = 6e4, Mx = F().max(jx), Nx = B({
|
|
14041
14041
|
path: F().min(1).max(300),
|
|
14042
|
-
base:
|
|
14043
|
-
current:
|
|
14044
|
-
generated:
|
|
14042
|
+
base: Mx,
|
|
14043
|
+
current: Mx,
|
|
14044
|
+
generated: Mx
|
|
14045
14045
|
});
|
|
14046
14046
|
B({
|
|
14047
14047
|
factsVersion: L().int().positive(),
|
|
14048
|
-
files: z(
|
|
14048
|
+
files: z(Nx).min(1).max(5)
|
|
14049
14049
|
});
|
|
14050
|
-
var
|
|
14050
|
+
var Px = Ys("ok", [B({
|
|
14051
14051
|
ok: U(!0),
|
|
14052
14052
|
path: F(),
|
|
14053
|
-
merged:
|
|
14053
|
+
merged: Mx
|
|
14054
14054
|
}), B({
|
|
14055
14055
|
ok: U(!1),
|
|
14056
14056
|
path: F(),
|
|
14057
14057
|
error: F()
|
|
14058
|
-
})]),
|
|
14058
|
+
})]), Fx = B({
|
|
14059
14059
|
promptVersion: F(),
|
|
14060
|
-
results: z(
|
|
14061
|
-
}),
|
|
14060
|
+
results: z(Px)
|
|
14061
|
+
}), Ix = {
|
|
14062
14062
|
maxFiles: 3e3,
|
|
14063
14063
|
maxFileBytes: 26214400,
|
|
14064
14064
|
maxTotalBytes: 314572800,
|
|
14065
14065
|
maxArchiveBytes: 104857600
|
|
14066
|
-
},
|
|
14066
|
+
}, Lx = {
|
|
14067
14067
|
html: "text/html; charset=utf-8",
|
|
14068
14068
|
htm: "text/html; charset=utf-8",
|
|
14069
14069
|
js: "text/javascript; charset=utf-8",
|
|
@@ -14090,26 +14090,26 @@ var Nx = Ys("ok", [B({
|
|
|
14090
14090
|
mp4: "video/mp4",
|
|
14091
14091
|
webm: "video/webm"
|
|
14092
14092
|
};
|
|
14093
|
-
function
|
|
14094
|
-
return
|
|
14093
|
+
function Rx(e) {
|
|
14094
|
+
return Lx[e.slice(e.lastIndexOf(".") + 1).toLowerCase()] ?? "application/octet-stream";
|
|
14095
14095
|
}
|
|
14096
|
-
var
|
|
14097
|
-
function
|
|
14098
|
-
return e.length > 0 && e.length <= 300 && e.split("/").every((e) => e !== ".." &&
|
|
14096
|
+
var zx = /^[A-Za-z0-9_@+()=,~][A-Za-z0-9 _.@+()=,~-]*$/;
|
|
14097
|
+
function Bx(e) {
|
|
14098
|
+
return e.length > 0 && e.length <= 300 && e.split("/").every((e) => e !== ".." && zx.test(e));
|
|
14099
14099
|
}
|
|
14100
|
-
var
|
|
14101
|
-
path: F().refine(
|
|
14102
|
-
size: L().int().min(0).max(
|
|
14100
|
+
var Vx = B({
|
|
14101
|
+
path: F().refine(Bx, "Not a plain relative file path"),
|
|
14102
|
+
size: L().int().min(0).max(Ix.maxFileBytes),
|
|
14103
14103
|
contentType: F().max(100).regex(/^[\w.+-]+\/[\w.+-]+(?:\s*;\s*[\w-]+=[\w.-]+)*$/)
|
|
14104
|
-
}),
|
|
14105
|
-
size: L().int().min(1).max(
|
|
14104
|
+
}), Hx = B({
|
|
14105
|
+
size: L().int().min(1).max(Ix.maxArchiveBytes),
|
|
14106
14106
|
contentHash: F().regex(/^[0-9a-f]{64}$/)
|
|
14107
14107
|
});
|
|
14108
14108
|
B({
|
|
14109
|
-
files: z(
|
|
14110
|
-
archive:
|
|
14109
|
+
files: z(Vx).min(1).max(Ix.maxFiles),
|
|
14110
|
+
archive: Hx.optional()
|
|
14111
14111
|
});
|
|
14112
|
-
var
|
|
14112
|
+
var Ux = B({
|
|
14113
14113
|
uploads: z(B({
|
|
14114
14114
|
path: F(),
|
|
14115
14115
|
url: bs(),
|
|
@@ -14117,22 +14117,22 @@ var Hx = B({
|
|
|
14117
14117
|
})),
|
|
14118
14118
|
expiresAt: L()
|
|
14119
14119
|
});
|
|
14120
|
-
B({ contentHash:
|
|
14121
|
-
var
|
|
14120
|
+
B({ contentHash: Hx.shape.contentHash.optional() });
|
|
14121
|
+
var Wx = B({ storybookUrl: bs() });
|
|
14122
14122
|
B({
|
|
14123
14123
|
repos: z(B({
|
|
14124
14124
|
installationId: L().int(),
|
|
14125
|
-
fullName:
|
|
14125
|
+
fullName: zb,
|
|
14126
14126
|
defaultBranch: F(),
|
|
14127
14127
|
private: R()
|
|
14128
14128
|
})),
|
|
14129
14129
|
installUrl: bs().optional()
|
|
14130
14130
|
});
|
|
14131
|
-
var
|
|
14131
|
+
var Gx = B({
|
|
14132
14132
|
id: vs(),
|
|
14133
14133
|
figmaFileKey: F().min(1),
|
|
14134
14134
|
installationId: L().int(),
|
|
14135
|
-
repo:
|
|
14135
|
+
repo: zb,
|
|
14136
14136
|
baseBranch: F(),
|
|
14137
14137
|
outputPath: F(),
|
|
14138
14138
|
plan: H(["free", "pro"]).optional(),
|
|
@@ -14141,10 +14141,10 @@ var Wx = B({
|
|
|
14141
14141
|
B({
|
|
14142
14142
|
figmaFileKey: F().min(1),
|
|
14143
14143
|
installationId: L().int(),
|
|
14144
|
-
repo:
|
|
14144
|
+
repo: zb,
|
|
14145
14145
|
baseBranch: F().min(1),
|
|
14146
14146
|
outputPath: F().default("")
|
|
14147
|
-
}), B({ figmaFileKey: F().min(1) }), B({ links: z(
|
|
14147
|
+
}), B({ figmaFileKey: F().min(1) }), B({ links: z(Gx) }), B({ components: z(B({
|
|
14148
14148
|
id: F().min(1).max(100),
|
|
14149
14149
|
name: F().max(200),
|
|
14150
14150
|
pageName: F().max(200).optional(),
|
|
@@ -14155,20 +14155,20 @@ B({
|
|
|
14155
14155
|
options: z(F().max(100)).max(12)
|
|
14156
14156
|
})).max(12),
|
|
14157
14157
|
layers: z(F().max(120)).max(30),
|
|
14158
|
-
offered: z(H(
|
|
14158
|
+
offered: z(H(_x)).min(1).max(_x.length)
|
|
14159
14159
|
})).min(1).max(20) });
|
|
14160
|
-
var
|
|
14161
|
-
archetype: H(
|
|
14160
|
+
var Kx = B({
|
|
14161
|
+
archetype: H(_x).optional(),
|
|
14162
14162
|
confidence: H([
|
|
14163
14163
|
"high",
|
|
14164
14164
|
"medium",
|
|
14165
14165
|
"low"
|
|
14166
14166
|
]),
|
|
14167
14167
|
reason: F().max(300)
|
|
14168
|
-
}),
|
|
14168
|
+
}), qx = Ys("ok", [B({
|
|
14169
14169
|
ok: U(!0),
|
|
14170
14170
|
id: F(),
|
|
14171
|
-
suggestion:
|
|
14171
|
+
suggestion: Kx
|
|
14172
14172
|
}), B({
|
|
14173
14173
|
ok: U(!1),
|
|
14174
14174
|
id: F(),
|
|
@@ -14176,9 +14176,9 @@ var Gx = B({
|
|
|
14176
14176
|
})]);
|
|
14177
14177
|
B({
|
|
14178
14178
|
promptVersion: F(),
|
|
14179
|
-
results: z(
|
|
14179
|
+
results: z(qx)
|
|
14180
14180
|
});
|
|
14181
|
-
var
|
|
14181
|
+
var Jx = H([
|
|
14182
14182
|
"uploading",
|
|
14183
14183
|
"queued",
|
|
14184
14184
|
"diffing",
|
|
@@ -14191,7 +14191,7 @@ var qx = H([
|
|
|
14191
14191
|
]);
|
|
14192
14192
|
B({
|
|
14193
14193
|
linkId: vs(),
|
|
14194
|
-
config:
|
|
14194
|
+
config: Wb.optional(),
|
|
14195
14195
|
annotations: Nb.optional()
|
|
14196
14196
|
}), B({ syncId: vs() }), B({ seq: Dc().int().min(0).max(999).default(0) }), B({ assets: z(B({
|
|
14197
14197
|
path: F().min(1),
|
|
@@ -14200,16 +14200,16 @@ B({
|
|
|
14200
14200
|
bytes: L().int().nonnegative(),
|
|
14201
14201
|
sha256: F().regex(/^[a-f0-9]{64}$/)
|
|
14202
14202
|
}), B({ designSha256: F().regex(/^[a-f0-9]{64}$/) });
|
|
14203
|
-
var
|
|
14203
|
+
var Yx = B({
|
|
14204
14204
|
id: vs(),
|
|
14205
14205
|
linkId: vs(),
|
|
14206
|
-
status:
|
|
14206
|
+
status: Jx,
|
|
14207
14207
|
pr: B({
|
|
14208
14208
|
number: L().int(),
|
|
14209
14209
|
url: bs()
|
|
14210
14210
|
}).optional(),
|
|
14211
14211
|
storybookUrl: bs().optional(),
|
|
14212
|
-
ciFailure:
|
|
14212
|
+
ciFailure: Ax.optional(),
|
|
14213
14213
|
changes: B({
|
|
14214
14214
|
added: L().int(),
|
|
14215
14215
|
modified: L().int(),
|
|
@@ -14220,33 +14220,33 @@ var Jx = B({
|
|
|
14220
14220
|
createdAt: Ec(),
|
|
14221
14221
|
updatedAt: Ec()
|
|
14222
14222
|
});
|
|
14223
|
-
B({ sync:
|
|
14223
|
+
B({ sync: Yx }), B({
|
|
14224
14224
|
linkId: vs(),
|
|
14225
14225
|
limit: Dc().int().min(1).max(50).default(20),
|
|
14226
14226
|
scope: H(["mine", "all"]).default("all"),
|
|
14227
14227
|
state: H(["open", "all"]).default("all")
|
|
14228
14228
|
}), B({
|
|
14229
|
-
syncs: z(
|
|
14230
|
-
openByOthers: z(
|
|
14229
|
+
syncs: z(Yx),
|
|
14230
|
+
openByOthers: z(Yx).optional()
|
|
14231
14231
|
});
|
|
14232
14232
|
//#endregion
|
|
14233
14233
|
//#region src/enrich/bridge-client.ts
|
|
14234
|
-
var
|
|
14234
|
+
var Xx = class extends Error {
|
|
14235
14235
|
constructor(e, t, n) {
|
|
14236
14236
|
super(n), this.status = e, this.code = t, this.name = "BridgeError";
|
|
14237
14237
|
}
|
|
14238
|
-
},
|
|
14239
|
-
function
|
|
14238
|
+
}, Zx = 3, Qx = 500, $x = 75e3;
|
|
14239
|
+
function eS(e) {
|
|
14240
14240
|
let [t, ...n] = e.issues ?? [];
|
|
14241
14241
|
return t ? `${e.message} ${t.path}: ${t.message}${n.length ? ` (+${n.length} more)` : ""}` : e.message;
|
|
14242
14242
|
}
|
|
14243
|
-
var
|
|
14244
|
-
function
|
|
14245
|
-
let t = e.fetch ?? fetch, n = e.sleep ??
|
|
14243
|
+
var tS = (e) => new Promise((t) => setTimeout(t, e));
|
|
14244
|
+
function nS(e) {
|
|
14245
|
+
let t = e.fetch ?? fetch, n = e.sleep ?? tS, r = e.maxAttempts ?? Zx, i = e.baseUrl.replace(/\/$/, ""), a = (e) => `/previews/${e}`;
|
|
14246
14246
|
async function o(a, o, s = {}) {
|
|
14247
14247
|
let c;
|
|
14248
14248
|
for (let l = 0; l < r; l++) {
|
|
14249
|
-
l > 0 && await n(
|
|
14249
|
+
l > 0 && await n(Qx * 2 ** (l - 1));
|
|
14250
14250
|
let r;
|
|
14251
14251
|
try {
|
|
14252
14252
|
r = await t(`${i}/api${a}`, {
|
|
@@ -14255,46 +14255,47 @@ function tS(e) {
|
|
|
14255
14255
|
...s.body ? { "content-type": "application/json" } : {},
|
|
14256
14256
|
authorization: `Bearer ${e.token}`
|
|
14257
14257
|
},
|
|
14258
|
-
signal: AbortSignal.timeout(
|
|
14258
|
+
signal: AbortSignal.timeout($x)
|
|
14259
14259
|
});
|
|
14260
14260
|
} catch (e) {
|
|
14261
|
-
c = new
|
|
14261
|
+
c = new Xx(0, "network", `Could not reach the bridge: ${e instanceof Error ? e.message : e}`);
|
|
14262
14262
|
continue;
|
|
14263
14263
|
}
|
|
14264
14264
|
if (r.ok) {
|
|
14265
14265
|
let e = o.safeParse(await r.json().catch(() => null));
|
|
14266
14266
|
if (e.success) return e.data;
|
|
14267
|
-
throw new
|
|
14267
|
+
throw new Xx(r.status, "invalid_response", `The bridge answered with something this CLI does not understand; update ${Lb}`);
|
|
14268
14268
|
}
|
|
14269
|
-
let u =
|
|
14269
|
+
let u = Rb.safeParse(await r.json().catch(() => null)), d = new Xx(r.status, u.success ? u.data.error.code : `http_${r.status}`, u.success ? eS(u.data.error) : `HTTP ${r.status}`);
|
|
14270
14270
|
if (r.status < 500) throw d;
|
|
14271
14271
|
c = d;
|
|
14272
14272
|
}
|
|
14273
14273
|
throw c;
|
|
14274
14274
|
}
|
|
14275
14275
|
return {
|
|
14276
|
-
version: () => o("/enrich-design/version",
|
|
14277
|
-
enrich: (e) => o("/enrich-design",
|
|
14276
|
+
version: () => o("/enrich-design/version", Ex),
|
|
14277
|
+
enrich: (e) => o("/enrich-design", Tx, {
|
|
14278
14278
|
method: "POST",
|
|
14279
14279
|
body: JSON.stringify(e)
|
|
14280
14280
|
}),
|
|
14281
|
-
mergeResync: (e) => o("/merge-resync",
|
|
14281
|
+
mergeResync: (e) => o("/merge-resync", Fx, {
|
|
14282
14282
|
method: "POST",
|
|
14283
14283
|
body: JSON.stringify(e)
|
|
14284
14284
|
}),
|
|
14285
|
-
createPreviewUpload: (e) => o(a("uploads"),
|
|
14285
|
+
createPreviewUpload: (e) => o(a("uploads"), Ux, {
|
|
14286
14286
|
method: "POST",
|
|
14287
14287
|
body: JSON.stringify(e)
|
|
14288
14288
|
}),
|
|
14289
|
+
getPreviewAccess: () => o("/ci/preview-access", Ib),
|
|
14289
14290
|
createPushToken: () => o("/ci/push-token", Fb, {
|
|
14290
14291
|
method: "POST",
|
|
14291
14292
|
body: "{}"
|
|
14292
14293
|
}),
|
|
14293
|
-
reportFailure: (e) => o("/ci/failures",
|
|
14294
|
+
reportFailure: (e) => o("/ci/failures", kx, {
|
|
14294
14295
|
method: "POST",
|
|
14295
14296
|
body: JSON.stringify(e)
|
|
14296
14297
|
}),
|
|
14297
|
-
completePreview: (e = {}) => o(a("complete"),
|
|
14298
|
+
completePreview: (e = {}) => o(a("complete"), Wx, {
|
|
14298
14299
|
method: "POST",
|
|
14299
14300
|
body: JSON.stringify(e)
|
|
14300
14301
|
})
|
|
@@ -14302,7 +14303,7 @@ function tS(e) {
|
|
|
14302
14303
|
}
|
|
14303
14304
|
//#endregion
|
|
14304
14305
|
//#region src/enrich/token.ts
|
|
14305
|
-
async function
|
|
14306
|
+
async function rS(e) {
|
|
14306
14307
|
let t = e.env ?? process.env, n = t.SYNCLINE_TOKEN;
|
|
14307
14308
|
if (n) return {
|
|
14308
14309
|
ok: !0,
|
|
@@ -14337,21 +14338,50 @@ async function nS(e) {
|
|
|
14337
14338
|
}
|
|
14338
14339
|
}
|
|
14339
14340
|
//#endregion
|
|
14341
|
+
//#region src/ci/preview-access.ts
|
|
14342
|
+
async function iS(t) {
|
|
14343
|
+
let { io: n } = t, r = t.env ?? process.env, i = (t) => {
|
|
14344
|
+
let i = `enabled=${t.enabled}\n`, a = r.GITHUB_OUTPUT;
|
|
14345
|
+
return a ? e(a, i) : n.out(i), t.reason ? n.err(`Preview skipped: ${t.reason}.\n`) : t.enabled || n.err("Preview skipped: it is not part of this account’s plan.\n"), t;
|
|
14346
|
+
}, a = (e) => i({
|
|
14347
|
+
enabled: !1,
|
|
14348
|
+
reason: e
|
|
14349
|
+
});
|
|
14350
|
+
if (!t.bridgeUrl) return a("no bridge configured (set enrich.bridgeUrl or SYNCLINE_URL)");
|
|
14351
|
+
let o = t.bridgeUrl.replace(/\/$/, ""), s = await rS({
|
|
14352
|
+
audience: t.audience ?? o,
|
|
14353
|
+
env: r,
|
|
14354
|
+
fetch: t.fetch
|
|
14355
|
+
});
|
|
14356
|
+
if (s.ok === !1) return a(s.reason);
|
|
14357
|
+
try {
|
|
14358
|
+
let { enabled: e } = await nS({
|
|
14359
|
+
baseUrl: o,
|
|
14360
|
+
token: s.token,
|
|
14361
|
+
fetch: t.fetch,
|
|
14362
|
+
sleep: t.sleep
|
|
14363
|
+
}).getPreviewAccess();
|
|
14364
|
+
return i({ enabled: e });
|
|
14365
|
+
} catch (e) {
|
|
14366
|
+
return a(e instanceof Error ? e.message : String(e));
|
|
14367
|
+
}
|
|
14368
|
+
}
|
|
14369
|
+
//#endregion
|
|
14340
14370
|
//#region src/ci/push-token.ts
|
|
14341
|
-
async function
|
|
14371
|
+
async function aS(t) {
|
|
14342
14372
|
let { io: n } = t, r = t.env ?? process.env, i = (e) => (n.err(`Push token unavailable: ${e}. The job pushes with its own token instead.\n`), {
|
|
14343
14373
|
status: "unavailable",
|
|
14344
14374
|
reason: e
|
|
14345
14375
|
});
|
|
14346
14376
|
if (!t.bridgeUrl) return i("no bridge configured (set enrich.bridgeUrl or SYNCLINE_URL)");
|
|
14347
|
-
let a = t.bridgeUrl.replace(/\/$/, ""), o = await
|
|
14377
|
+
let a = t.bridgeUrl.replace(/\/$/, ""), o = await rS({
|
|
14348
14378
|
audience: t.audience ?? a,
|
|
14349
14379
|
env: r,
|
|
14350
14380
|
fetch: t.fetch
|
|
14351
14381
|
});
|
|
14352
14382
|
if (o.ok === !1) return i(o.reason);
|
|
14353
14383
|
try {
|
|
14354
|
-
let i = await
|
|
14384
|
+
let i = await nS({
|
|
14355
14385
|
baseUrl: a,
|
|
14356
14386
|
token: o.token,
|
|
14357
14387
|
fetch: t.fetch,
|
|
@@ -14366,22 +14396,22 @@ async function rS(t) {
|
|
|
14366
14396
|
email: i.committer.email
|
|
14367
14397
|
};
|
|
14368
14398
|
} catch (e) {
|
|
14369
|
-
return i(e instanceof
|
|
14399
|
+
return i(e instanceof Xx || e instanceof Error ? e.message : String(e));
|
|
14370
14400
|
}
|
|
14371
14401
|
}
|
|
14372
14402
|
//#endregion
|
|
14373
14403
|
//#region src/ci/report-failure.ts
|
|
14374
|
-
var
|
|
14375
|
-
function
|
|
14404
|
+
var oS = 15, sS = /\u001b\[[0-9;]*[A-Za-z]|\u001b\]8;;[^\u0007]*\u0007/g, cS = 600, lS = (e) => e.length > cS ? `${e.slice(0, cS)}…` : e, uS = (e) => lS(e).replace(sS, "").replace(/^[\s│■▲●◇]*/, "").trimEnd();
|
|
14405
|
+
function dS(e, t = {}) {
|
|
14376
14406
|
let n = e.replace(/\bgh[pousr]_[A-Za-z0-9]{20,}\b/g, "[token]").replace(/\bgithub_pat_[A-Za-z0-9_]{20,}\b/g, "[token]").replace(/x-access-token:[^@\s]+/g, "x-access-token:[token]").replace(/\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]{8,}/gi, "$1 [token]").replace(/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]*/g, "[jwt]").replace(/(https?:\/\/[^\s"'<>?#]+)\?[^\s"'<>#]*/g, "$1?…");
|
|
14377
14407
|
for (let [e, r] of Object.entries(t)) !r || r.length < 8 || /(TOKEN|SECRET|KEY|PASSWORD|CREDENTIAL)/i.test(e) && (n = n.split(r).join("[secret]"));
|
|
14378
14408
|
return n;
|
|
14379
14409
|
}
|
|
14380
|
-
function
|
|
14381
|
-
let n =
|
|
14382
|
-
return n.length >
|
|
14410
|
+
function fS(e, t) {
|
|
14411
|
+
let n = dS(e.replace(sS, "").split(/\r?\n/).slice(-200).map(lS).join("\n"), t);
|
|
14412
|
+
return n.length > Ox.log ? n.slice(n.length - Ox.log) : n;
|
|
14383
14413
|
}
|
|
14384
|
-
var
|
|
14414
|
+
var pS = [
|
|
14385
14415
|
/does not parse/i,
|
|
14386
14416
|
/Could not resolve/i,
|
|
14387
14417
|
/\bMissing\b/,
|
|
@@ -14389,70 +14419,70 @@ var dS = [
|
|
|
14389
14419
|
/\berror\b/i,
|
|
14390
14420
|
/\bfailed\b/i
|
|
14391
14421
|
];
|
|
14392
|
-
function
|
|
14393
|
-
let t = e.split(/\r?\n/).map(
|
|
14394
|
-
for (let e of
|
|
14422
|
+
function mS(e) {
|
|
14423
|
+
let t = e.split(/\r?\n/).map(uS).filter(Boolean);
|
|
14424
|
+
for (let e of pS) {
|
|
14395
14425
|
let n = t.findIndex((t) => e.test(t));
|
|
14396
14426
|
if (n === -1) continue;
|
|
14397
14427
|
let r = t[n];
|
|
14398
|
-
return /\bfrom$/.test(r) && t[n + 1] && (r = `${r} ${t[n + 1]}`), r.slice(0,
|
|
14428
|
+
return /\bfrom$/.test(r) && t[n + 1] && (r = `${r} ${t[n + 1]}`), r.slice(0, Ox.summary);
|
|
14399
14429
|
}
|
|
14400
|
-
return (t[t.length - 1] ?? "The step failed").slice(0,
|
|
14430
|
+
return (t[t.length - 1] ?? "The step failed").slice(0, Ox.summary);
|
|
14401
14431
|
}
|
|
14402
|
-
var
|
|
14403
|
-
function
|
|
14404
|
-
let a = e.split(/\r?\n/).map(
|
|
14432
|
+
var hS = /((?:\.\/)?(?:[\w@.+-]+\/)+[\w@.+-]+\.(?:tsx?|jsx?|mdx?|json))(?!\/)/, gS = /\((\d+):\d+\)/;
|
|
14433
|
+
function _S(e, n, r = (e) => t(e) ? i(e, "utf8") : null) {
|
|
14434
|
+
let a = e.split(/\r?\n/).map(uS);
|
|
14405
14435
|
for (let e = 0; e < a.length; e++) {
|
|
14406
|
-
let t =
|
|
14436
|
+
let t = hS.exec(a[e]);
|
|
14407
14437
|
if (!t || t[1].includes("node_modules")) continue;
|
|
14408
14438
|
let i = t[1].replace(/^\.\//, ""), o = d(n), s = d(o, i);
|
|
14409
14439
|
if (!s.startsWith(`${o}/`)) continue;
|
|
14410
14440
|
let c = r(s);
|
|
14411
14441
|
if (c === null) continue;
|
|
14412
|
-
let l = a.slice(e, e + 4).join("\n"), u = Number(
|
|
14442
|
+
let l = a.slice(e, e + 4).join("\n"), u = Number(gS.exec(l)?.[1] ?? 1), f = c.split("\n"), p = Math.max(1, u - oS);
|
|
14413
14443
|
return {
|
|
14414
14444
|
path: i,
|
|
14415
14445
|
startLine: p,
|
|
14416
|
-
text: f.slice(p - 1, u +
|
|
14446
|
+
text: f.slice(p - 1, u + oS).map((e, t) => `${p + t}: ${e}`).join("\n").slice(0, Ox.excerpt)
|
|
14417
14447
|
};
|
|
14418
14448
|
}
|
|
14419
14449
|
}
|
|
14420
|
-
function
|
|
14450
|
+
function vS(e) {
|
|
14421
14451
|
let { GITHUB_SERVER_URL: t, GITHUB_REPOSITORY: n, GITHUB_RUN_ID: r } = e;
|
|
14422
14452
|
return t && n && r ? `${t}/${n}/actions/runs/${r}` : void 0;
|
|
14423
14453
|
}
|
|
14424
|
-
function
|
|
14425
|
-
let t = e.env ?? process.env, n =
|
|
14454
|
+
function yS(e) {
|
|
14455
|
+
let t = e.env ?? process.env, n = _S(e.log, e.cwd, e.read), r = vS(t);
|
|
14426
14456
|
return {
|
|
14427
14457
|
step: e.step,
|
|
14428
|
-
summary:
|
|
14429
|
-
log:
|
|
14458
|
+
summary: dS(mS(e.log), t) || "The step failed",
|
|
14459
|
+
log: fS(e.log, t),
|
|
14430
14460
|
...n && { excerpt: {
|
|
14431
14461
|
...n,
|
|
14432
|
-
text:
|
|
14462
|
+
text: dS(n.text, t)
|
|
14433
14463
|
} },
|
|
14434
14464
|
cliVersion: v,
|
|
14435
14465
|
...r && { runUrl: r }
|
|
14436
14466
|
};
|
|
14437
14467
|
}
|
|
14438
|
-
async function
|
|
14468
|
+
async function bS(e) {
|
|
14439
14469
|
let { io: n } = e, r = e.env ?? process.env, a = (e) => (n.err(`Failure not reported: ${e}.\n`), { reported: !1 });
|
|
14440
14470
|
if (!e.bridgeUrl) return a("no bridge configured (set enrich.bridgeUrl or SYNCLINE_URL)");
|
|
14441
14471
|
let o = e.bridgeUrl.replace(/\/$/, ""), s = d(e.cwd, e.logPath);
|
|
14442
14472
|
if (!t(s)) return a(`no log at ${e.logPath}`);
|
|
14443
|
-
let c = await
|
|
14473
|
+
let c = await rS({
|
|
14444
14474
|
audience: e.audience ?? o,
|
|
14445
14475
|
env: r,
|
|
14446
14476
|
fetch: e.fetch
|
|
14447
14477
|
});
|
|
14448
14478
|
if (c.ok === !1) return a(c.reason);
|
|
14449
14479
|
try {
|
|
14450
|
-
let t =
|
|
14480
|
+
let t = yS({
|
|
14451
14481
|
step: e.step,
|
|
14452
14482
|
log: i(s, "utf8"),
|
|
14453
14483
|
cwd: e.cwd,
|
|
14454
14484
|
env: r
|
|
14455
|
-
}), a = await
|
|
14485
|
+
}), a = await nS({
|
|
14456
14486
|
baseUrl: o,
|
|
14457
14487
|
token: c.token,
|
|
14458
14488
|
fetch: e.fetch,
|
|
@@ -14463,17 +14493,17 @@ async function vS(e) {
|
|
|
14463
14493
|
issueUrl: a.issueUrl
|
|
14464
14494
|
};
|
|
14465
14495
|
} catch (e) {
|
|
14466
|
-
return a(e instanceof
|
|
14496
|
+
return a(e instanceof Xx || e instanceof Error ? e.message : String(e));
|
|
14467
14497
|
}
|
|
14468
14498
|
}
|
|
14469
14499
|
//#endregion
|
|
14470
14500
|
//#region src/enrich/bridge-url.ts
|
|
14471
|
-
function
|
|
14501
|
+
function xS({ env: e, configured: t, baked: n }) {
|
|
14472
14502
|
return e.SYNCLINE_URL || t || n || void 0;
|
|
14473
14503
|
}
|
|
14474
14504
|
//#endregion
|
|
14475
14505
|
//#region src/commands/ci.ts
|
|
14476
|
-
var
|
|
14506
|
+
var SS = `Usage: syncline ci <push-token|report-failure|preview-access> [options]
|
|
14477
14507
|
|
|
14478
14508
|
For the workflow a Figma sync adds to your repository. Asks the bridge for a
|
|
14479
14509
|
short-lived token that lets the job push the generated files to the sync's pull
|
|
@@ -14487,6 +14517,12 @@ tells the bridge that a step of the workflow failed (the tail of its log, with
|
|
|
14487
14517
|
credentials removed, and the lines around the error). Best effort: it never
|
|
14488
14518
|
fails the run, which has already failed.
|
|
14489
14519
|
|
|
14520
|
+
syncline ci preview-access asks the bridge whether the Storybook preview is
|
|
14521
|
+
available to this repository's account and writes enabled=true|false to
|
|
14522
|
+
GITHUB_OUTPUT (elsewhere it prints it). The workflow's preview job runs its
|
|
14523
|
+
build only when it is true. It never fails the run: anything but a clear yes
|
|
14524
|
+
(no bridge, no credentials, an old bridge, an outage) is false.
|
|
14525
|
+
|
|
14490
14526
|
Options:
|
|
14491
14527
|
--step <name> report-failure: the step that failed
|
|
14492
14528
|
--log <file> report-failure: the step's captured output
|
|
@@ -14494,12 +14530,12 @@ Options:
|
|
|
14494
14530
|
--cwd <dir> Project root (default: the current directory)
|
|
14495
14531
|
-h, --help Show this help
|
|
14496
14532
|
`;
|
|
14497
|
-
function
|
|
14533
|
+
function CS(e) {
|
|
14498
14534
|
let t = { help: !1 };
|
|
14499
14535
|
for (let n = 0; n < e.length; n++) {
|
|
14500
14536
|
let r = (t) => {
|
|
14501
14537
|
let r = e[++n];
|
|
14502
|
-
if (r === void 0 || r.startsWith("-")) throw Error(`${t} needs a value\n\n${
|
|
14538
|
+
if (r === void 0 || r.startsWith("-")) throw Error(`${t} needs a value\n\n${SS}`);
|
|
14503
14539
|
return r;
|
|
14504
14540
|
};
|
|
14505
14541
|
switch (e[n]) {
|
|
@@ -14520,20 +14556,20 @@ function xS(e) {
|
|
|
14520
14556
|
t.help = !0;
|
|
14521
14557
|
break;
|
|
14522
14558
|
default:
|
|
14523
|
-
if (e[n].startsWith("-")) throw Error(`Unknown option: ${e[n]}\n\n${
|
|
14524
|
-
if (t.action !== void 0) throw Error(`Unexpected argument: ${e[n]}\n\n${
|
|
14559
|
+
if (e[n].startsWith("-")) throw Error(`Unknown option: ${e[n]}\n\n${SS}`);
|
|
14560
|
+
if (t.action !== void 0) throw Error(`Unexpected argument: ${e[n]}\n\n${SS}`);
|
|
14525
14561
|
t.action = e[n];
|
|
14526
14562
|
}
|
|
14527
14563
|
}
|
|
14528
14564
|
return t;
|
|
14529
14565
|
}
|
|
14530
|
-
var
|
|
14566
|
+
var wS = {
|
|
14531
14567
|
name: "ci",
|
|
14532
|
-
summary: "Helpers for the generation workflow (push token, failure report)",
|
|
14568
|
+
summary: "Helpers for the generation workflow (push token, failure report, preview access)",
|
|
14533
14569
|
async run({ args: e, io: n }) {
|
|
14534
|
-
let r =
|
|
14535
|
-
if (r.help || r.action === void 0) return n.out(
|
|
14536
|
-
if (r.action !== "push-token" && r.action !== "report-failure") return n.err(`Unknown ci command: ${r.action}\n\n${
|
|
14570
|
+
let r = CS(e);
|
|
14571
|
+
if (r.help || r.action === void 0) return n.out(SS), +!r.help;
|
|
14572
|
+
if (r.action !== "push-token" && r.action !== "report-failure" && r.action !== "preview-access") return n.err(`Unknown ci command: ${r.action}\n\n${SS}`), 1;
|
|
14537
14573
|
let a = d(r.cwd ?? process.cwd()), o = d(a, r.config ?? "syncline.config.json"), s = {};
|
|
14538
14574
|
if (t(o)) try {
|
|
14539
14575
|
s = JSON.parse(i(o, "utf-8"));
|
|
@@ -14542,14 +14578,14 @@ var SS = {
|
|
|
14542
14578
|
}
|
|
14543
14579
|
let c = Ab.safeParse(s);
|
|
14544
14580
|
if (!c.success) return n.err(`Invalid config ${o}:\n${Mb(c.error)}\n`), 1;
|
|
14545
|
-
let l =
|
|
14581
|
+
let l = xS({
|
|
14546
14582
|
env: process.env,
|
|
14547
14583
|
configured: c.data.enrich.bridgeUrl,
|
|
14548
14584
|
baked: _
|
|
14549
14585
|
});
|
|
14550
14586
|
if (r.action === "report-failure") {
|
|
14551
|
-
let e =
|
|
14552
|
-
return !e.success || !r.log ? (n.err(`report-failure needs --step and --log\n\n${
|
|
14587
|
+
let e = Dx.safeParse(r.step);
|
|
14588
|
+
return !e.success || !r.log ? (n.err(`report-failure needs --step and --log\n\n${SS}`), 1) : (await bS({
|
|
14553
14589
|
step: e.data,
|
|
14554
14590
|
logPath: r.log,
|
|
14555
14591
|
cwd: a,
|
|
@@ -14558,16 +14594,20 @@ var SS = {
|
|
|
14558
14594
|
io: n
|
|
14559
14595
|
}), 0);
|
|
14560
14596
|
}
|
|
14561
|
-
return await
|
|
14597
|
+
return r.action === "preview-access" ? (await iS({
|
|
14562
14598
|
bridgeUrl: l,
|
|
14563
14599
|
audience: c.data.enrich.audience,
|
|
14564
14600
|
io: n
|
|
14565
|
-
}), 0
|
|
14601
|
+
}), 0) : (await aS({
|
|
14602
|
+
bridgeUrl: l,
|
|
14603
|
+
audience: c.data.enrich.audience,
|
|
14604
|
+
io: n
|
|
14605
|
+
}), 0);
|
|
14566
14606
|
}
|
|
14567
14607
|
};
|
|
14568
14608
|
//#endregion
|
|
14569
14609
|
//#region ../core/src/node/fs.ts
|
|
14570
|
-
function
|
|
14610
|
+
function TS(e) {
|
|
14571
14611
|
return {
|
|
14572
14612
|
read(n) {
|
|
14573
14613
|
let r = u(e, n);
|
|
@@ -14576,7 +14616,7 @@ function CS(e) {
|
|
|
14576
14616
|
exists: (n) => t(u(e, n))
|
|
14577
14617
|
};
|
|
14578
14618
|
}
|
|
14579
|
-
function
|
|
14619
|
+
function ES(e, n) {
|
|
14580
14620
|
let a = {
|
|
14581
14621
|
written: [],
|
|
14582
14622
|
kept: [],
|
|
@@ -14596,20 +14636,20 @@ function wS(e, n) {
|
|
|
14596
14636
|
}
|
|
14597
14637
|
return a;
|
|
14598
14638
|
}
|
|
14599
|
-
var
|
|
14639
|
+
var DS = 1e5, OS = {
|
|
14600
14640
|
".svg": "image/svg+xml",
|
|
14601
14641
|
".png": "image/png",
|
|
14602
14642
|
".jpg": "image/jpeg",
|
|
14603
14643
|
".jpeg": "image/jpeg",
|
|
14604
14644
|
".webp": "image/webp"
|
|
14605
14645
|
};
|
|
14606
|
-
function
|
|
14607
|
-
let n =
|
|
14646
|
+
function kS(e) {
|
|
14647
|
+
let n = OS[l(e).toLowerCase()];
|
|
14608
14648
|
if (!n || !t(e)) return;
|
|
14609
14649
|
let r = i(e);
|
|
14610
|
-
if (!(r.length >
|
|
14650
|
+
if (!(r.length > DS)) return `data:${n};base64,${r.toString("base64")}`;
|
|
14611
14651
|
}
|
|
14612
|
-
function
|
|
14652
|
+
function AS(e) {
|
|
14613
14653
|
if (!t(e)) return {
|
|
14614
14654
|
ok: !0,
|
|
14615
14655
|
overlay: void 0
|
|
@@ -14623,8 +14663,8 @@ function OS(e) {
|
|
|
14623
14663
|
overlay: n.overlay
|
|
14624
14664
|
};
|
|
14625
14665
|
}
|
|
14626
|
-
function
|
|
14627
|
-
let { root: n } = e, r =
|
|
14666
|
+
function jS(e) {
|
|
14667
|
+
let { root: n } = e, r = fx.safeParse(JSON.parse(i(u(n, e.designPath), "utf-8")));
|
|
14628
14668
|
if (!r.success) return {
|
|
14629
14669
|
ok: !1,
|
|
14630
14670
|
error: `design.json failed validation: ${JSON.stringify(r.error.format())}`
|
|
@@ -14640,7 +14680,7 @@ function kS(e) {
|
|
|
14640
14680
|
}
|
|
14641
14681
|
let l;
|
|
14642
14682
|
if (e.annotationsPath) {
|
|
14643
|
-
let t =
|
|
14683
|
+
let t = AS(u(n, e.annotationsPath));
|
|
14644
14684
|
if (t.ok === !1) return {
|
|
14645
14685
|
ok: !1,
|
|
14646
14686
|
error: t.error
|
|
@@ -14654,25 +14694,25 @@ function kS(e) {
|
|
|
14654
14694
|
enrichment: o,
|
|
14655
14695
|
assets: s,
|
|
14656
14696
|
annotations: l,
|
|
14657
|
-
brandImageDataUri: e.brandImage ?
|
|
14697
|
+
brandImageDataUri: e.brandImage ? kS(u(n, e.brandImage)) : void 0
|
|
14658
14698
|
}
|
|
14659
14699
|
};
|
|
14660
14700
|
}
|
|
14661
14701
|
//#endregion
|
|
14662
14702
|
//#region src/enrich/enrich-design.ts
|
|
14663
|
-
var
|
|
14664
|
-
function
|
|
14703
|
+
var MS = 3, NS = 2;
|
|
14704
|
+
function PS(e, t) {
|
|
14665
14705
|
return m("sha256").update(JSON.stringify([t, e])).digest("hex");
|
|
14666
14706
|
}
|
|
14667
|
-
var
|
|
14668
|
-
async function
|
|
14707
|
+
var FS = (e, t) => Array.from({ length: Math.ceil(e.length / t) }, (n, r) => e.slice(r * t, (r + 1) * t));
|
|
14708
|
+
async function IS(e, t, n) {
|
|
14669
14709
|
let r = 0;
|
|
14670
14710
|
await Promise.all(Array.from({ length: Math.min(t, e.length) }, async () => {
|
|
14671
14711
|
for (; r < e.length;) await n(e[r++]);
|
|
14672
14712
|
}));
|
|
14673
14713
|
}
|
|
14674
|
-
function
|
|
14675
|
-
return e instanceof
|
|
14714
|
+
function LS(e) {
|
|
14715
|
+
return e instanceof Xx ? {
|
|
14676
14716
|
status: "skipped",
|
|
14677
14717
|
reason: e.status === 401 ? "the bridge did not accept the credentials" : e.message
|
|
14678
14718
|
} : {
|
|
@@ -14680,25 +14720,25 @@ function FS(e) {
|
|
|
14680
14720
|
reason: e instanceof Error ? e.message : String(e)
|
|
14681
14721
|
};
|
|
14682
14722
|
}
|
|
14683
|
-
async function
|
|
14723
|
+
async function RS(e, t, n = {}) {
|
|
14684
14724
|
let { facts: r, local: i, elementPaths: a, fieldPaths: o, diagnostics: s } = $d(n.factsDesign ?? e, n.normalize), c = s.map((e) => `enrichment: ${e}`), l;
|
|
14685
14725
|
try {
|
|
14686
14726
|
let e = await t.version();
|
|
14687
14727
|
if (!e.factsVersions.includes(3)) return {
|
|
14688
14728
|
status: "skipped",
|
|
14689
|
-
reason: `the bridge does not accept this CLI's facts format (v3); update ${
|
|
14729
|
+
reason: `the bridge does not accept this CLI's facts format (v3); update ${Lb}`
|
|
14690
14730
|
};
|
|
14691
14731
|
l = e.promptVersion;
|
|
14692
14732
|
} catch (e) {
|
|
14693
|
-
return
|
|
14733
|
+
return LS(e);
|
|
14694
14734
|
}
|
|
14695
|
-
let u = new Map(r.map((e) => [e.id,
|
|
14735
|
+
let u = new Map(r.map((e) => [e.id, PS(e, l)])), d = new Map((n.previous?.components ?? []).flatMap((e) => e.enrichment && e.enrichmentHash ? [[e.id, e]] : [])), f = (e) => {
|
|
14696
14736
|
let t = d.get(e);
|
|
14697
14737
|
if (t) return t.enrichmentHash === u.get(e) ? t.enrichment : void 0;
|
|
14698
14738
|
}, p = /* @__PURE__ */ new Map(), m = r.filter((e) => !f(e.id)), h = m.length, g;
|
|
14699
|
-
for (let e = 0; e <
|
|
14739
|
+
for (let e = 0; e < NS && m.length > 0 && !g; e++) {
|
|
14700
14740
|
let e = [];
|
|
14701
|
-
await
|
|
14741
|
+
await IS(FS(m, 10), n.concurrency ?? MS, async (n) => {
|
|
14702
14742
|
if (g) {
|
|
14703
14743
|
e.push(...n);
|
|
14704
14744
|
return;
|
|
@@ -14710,7 +14750,7 @@ async function IS(e, t, n = {}) {
|
|
|
14710
14750
|
components: n
|
|
14711
14751
|
})).results;
|
|
14712
14752
|
} catch (t) {
|
|
14713
|
-
t instanceof
|
|
14753
|
+
t instanceof Xx && (t.code === "rate_limited" || t.code === "forbidden" || t.status === 401) ? g = t.message : c.push(`enrichment: a batch of ${n.length} failed (${t.message})`), e.push(...n);
|
|
14714
14754
|
return;
|
|
14715
14755
|
}
|
|
14716
14756
|
let i = new Map(r.map((e) => [e.id, e]));
|
|
@@ -14754,14 +14794,14 @@ async function IS(e, t, n = {}) {
|
|
|
14754
14794
|
}
|
|
14755
14795
|
//#endregion
|
|
14756
14796
|
//#region src/enrich/client.ts
|
|
14757
|
-
function
|
|
14797
|
+
function zS(e) {
|
|
14758
14798
|
return async () => {
|
|
14759
14799
|
if (!e.bridgeUrl) return {
|
|
14760
14800
|
ok: !1,
|
|
14761
14801
|
reason: "no bridge configured (set enrich.bridgeUrl or SYNCLINE_URL)",
|
|
14762
14802
|
quiet: !0
|
|
14763
14803
|
};
|
|
14764
|
-
let t = e.bridgeUrl.replace(/\/$/, ""), n = await
|
|
14804
|
+
let t = e.bridgeUrl.replace(/\/$/, ""), n = await rS({
|
|
14765
14805
|
audience: e.audience ?? t,
|
|
14766
14806
|
env: e.env,
|
|
14767
14807
|
fetch: e.fetch
|
|
@@ -14771,7 +14811,7 @@ function LS(e) {
|
|
|
14771
14811
|
reason: n.reason
|
|
14772
14812
|
} : {
|
|
14773
14813
|
ok: !0,
|
|
14774
|
-
client:
|
|
14814
|
+
client: nS({
|
|
14775
14815
|
baseUrl: t,
|
|
14776
14816
|
token: n.token,
|
|
14777
14817
|
fetch: e.fetch,
|
|
@@ -14782,21 +14822,21 @@ function LS(e) {
|
|
|
14782
14822
|
}
|
|
14783
14823
|
//#endregion
|
|
14784
14824
|
//#region src/enrich/step.ts
|
|
14785
|
-
function
|
|
14825
|
+
function BS(e) {
|
|
14786
14826
|
try {
|
|
14787
14827
|
return JSON.parse(i(e, "utf-8"));
|
|
14788
14828
|
} catch {
|
|
14789
14829
|
return;
|
|
14790
14830
|
}
|
|
14791
14831
|
}
|
|
14792
|
-
function
|
|
14832
|
+
function VS(e, n) {
|
|
14793
14833
|
return t(e) ? n ? `${e} failed validation: ${JSON.stringify(n.format())}` : `${e} is not valid JSON` : `${e} does not exist`;
|
|
14794
14834
|
}
|
|
14795
|
-
async function
|
|
14796
|
-
let { io: n } = e, r =
|
|
14835
|
+
async function HS(e) {
|
|
14836
|
+
let { io: n } = e, r = BS(e.designPath), a = fx.safeParse(r);
|
|
14797
14837
|
if (!a.success) return {
|
|
14798
14838
|
status: "no-design",
|
|
14799
|
-
reason:
|
|
14839
|
+
reason: VS(e.designPath, r === void 0 ? void 0 : a.error)
|
|
14800
14840
|
};
|
|
14801
14841
|
let o = (r, i = !1) => {
|
|
14802
14842
|
let a = `Enrichment skipped: ${r}. Generating without it${t(e.enrichedPath) ? " (keeping the enrichments from an earlier run)" : ""}.\n`;
|
|
@@ -14804,10 +14844,10 @@ async function BS(e) {
|
|
|
14804
14844
|
status: "skipped",
|
|
14805
14845
|
reason: r
|
|
14806
14846
|
};
|
|
14807
|
-
}, c = await (e.provider ??
|
|
14847
|
+
}, c = await (e.provider ?? zS(e))();
|
|
14808
14848
|
if (c.ok === !1) return o(c.reason, c.quiet);
|
|
14809
|
-
let l = e.annotationsPath ?
|
|
14810
|
-
previous:
|
|
14849
|
+
let l = e.annotationsPath ? AS(e.annotationsPath) : void 0, u = l?.ok === !0 && l.overlay ? xd(a.data, l.overlay) : void 0, d = await RS(a.data, c.client, {
|
|
14850
|
+
previous: BS(e.enrichedPath),
|
|
14811
14851
|
...u && {
|
|
14812
14852
|
factsDesign: u.design,
|
|
14813
14853
|
normalize: { iconPages: u.iconPages }
|
|
@@ -14825,7 +14865,7 @@ async function BS(e) {
|
|
|
14825
14865
|
}
|
|
14826
14866
|
//#endregion
|
|
14827
14867
|
//#region src/dependencies.ts
|
|
14828
|
-
var
|
|
14868
|
+
var US = (e, t, n) => new Promise((r) => {
|
|
14829
14869
|
let i = h(e, t, {
|
|
14830
14870
|
cwd: n,
|
|
14831
14871
|
shell: process.platform === "win32"
|
|
@@ -14838,7 +14878,7 @@ var VS = (e, t, n) => new Promise((r) => {
|
|
|
14838
14878
|
output: a
|
|
14839
14879
|
}));
|
|
14840
14880
|
});
|
|
14841
|
-
function
|
|
14881
|
+
function WS(e) {
|
|
14842
14882
|
let n = [], r = d(e);
|
|
14843
14883
|
for (;;) {
|
|
14844
14884
|
if (n.push(r), t(u(r, ".git"))) return n;
|
|
@@ -14847,7 +14887,7 @@ function HS(e) {
|
|
|
14847
14887
|
r = e;
|
|
14848
14888
|
}
|
|
14849
14889
|
}
|
|
14850
|
-
function
|
|
14890
|
+
function GS(e) {
|
|
14851
14891
|
try {
|
|
14852
14892
|
let t = JSON.parse(i(u(e, "package.json"), "utf8"));
|
|
14853
14893
|
return t && typeof t == "object" ? t : null;
|
|
@@ -14855,10 +14895,10 @@ function US(e) {
|
|
|
14855
14895
|
return null;
|
|
14856
14896
|
}
|
|
14857
14897
|
}
|
|
14858
|
-
function
|
|
14898
|
+
function KS(e) {
|
|
14859
14899
|
let t = /* @__PURE__ */ new Set();
|
|
14860
|
-
for (let n of
|
|
14861
|
-
let e =
|
|
14900
|
+
for (let n of WS(e)) {
|
|
14901
|
+
let e = GS(n);
|
|
14862
14902
|
if (e) for (let n of [
|
|
14863
14903
|
"dependencies",
|
|
14864
14904
|
"devDependencies",
|
|
@@ -14871,22 +14911,22 @@ function WS(e) {
|
|
|
14871
14911
|
}
|
|
14872
14912
|
return t;
|
|
14873
14913
|
}
|
|
14874
|
-
function
|
|
14875
|
-
let n =
|
|
14914
|
+
function qS(e, t) {
|
|
14915
|
+
let n = KS(e);
|
|
14876
14916
|
return t.filter((e) => !n.has(e.name));
|
|
14877
14917
|
}
|
|
14878
|
-
function
|
|
14879
|
-
for (let n of
|
|
14918
|
+
function JS(e) {
|
|
14919
|
+
for (let n of WS(e)) {
|
|
14880
14920
|
if (t(u(n, "yarn.lock"))) return "yarn";
|
|
14881
14921
|
if (t(u(n, "pnpm-lock.yaml"))) return "pnpm";
|
|
14882
14922
|
if (t(u(n, "package-lock.json"))) return "npm";
|
|
14883
14923
|
}
|
|
14884
14924
|
return "npm";
|
|
14885
14925
|
}
|
|
14886
|
-
function
|
|
14887
|
-
for (let n of
|
|
14926
|
+
function YS(e) {
|
|
14927
|
+
for (let n of WS(e)) {
|
|
14888
14928
|
if (t(u(n, ".yarnrc.yml"))) return !0;
|
|
14889
|
-
let e =
|
|
14929
|
+
let e = GS(n)?.packageManager;
|
|
14890
14930
|
if (typeof e == "string" && /^yarn@([2-9]|\d{2,})/.test(e)) return !0;
|
|
14891
14931
|
try {
|
|
14892
14932
|
if (/^__metadata:/m.test(i(u(n, "yarn.lock"), "utf8"))) return !0;
|
|
@@ -14894,7 +14934,7 @@ function qS(e) {
|
|
|
14894
14934
|
}
|
|
14895
14935
|
return !1;
|
|
14896
14936
|
}
|
|
14897
|
-
var
|
|
14937
|
+
var XS = (e, t) => e === "npm" ? [
|
|
14898
14938
|
"install",
|
|
14899
14939
|
"--save-dev",
|
|
14900
14940
|
"--no-audit",
|
|
@@ -14904,9 +14944,9 @@ var JS = (e, t) => e === "npm" ? [
|
|
|
14904
14944
|
"add",
|
|
14905
14945
|
"-D",
|
|
14906
14946
|
...t
|
|
14907
|
-
],
|
|
14908
|
-
async function
|
|
14909
|
-
let c =
|
|
14947
|
+
], ZS = "--legacy-peer-deps", QS = (e) => e.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[-._]+|[-._]+$/g, "") || "design-system";
|
|
14948
|
+
async function $S({ cwd: e, required: n, install: r, libraryName: i, io: a, run: o = US }) {
|
|
14949
|
+
let c = qS(e, n);
|
|
14910
14950
|
if (c.length === 0) return;
|
|
14911
14951
|
let l = c.map((e) => e.name).join(", ");
|
|
14912
14952
|
if (!r) {
|
|
@@ -14914,13 +14954,13 @@ async function ZS({ cwd: e, required: n, install: r, libraryName: i, io: a, run:
|
|
|
14914
14954
|
`);
|
|
14915
14955
|
return;
|
|
14916
14956
|
}
|
|
14917
|
-
|
|
14918
|
-
name:
|
|
14957
|
+
WS(e).some((e) => GS(e)) || (s(u(e, "package.json"), `${JSON.stringify({
|
|
14958
|
+
name: QS(i),
|
|
14919
14959
|
version: "0.0.0",
|
|
14920
14960
|
private: !0
|
|
14921
|
-
}, null, 2)}\n`),
|
|
14922
|
-
let f =
|
|
14923
|
-
if (p === "yarn" &&
|
|
14961
|
+
}, null, 2)}\n`), WS(e).some((e) => t(u(e, ".gitignore"))) || s(u(e, ".gitignore"), "node_modules\nstorybook-static\n"));
|
|
14962
|
+
let f = WS(e).find((e) => GS(e) !== null) ?? d(e), p = JS(e);
|
|
14963
|
+
if (p === "yarn" && YS(e)) {
|
|
14924
14964
|
let e = await o("yarn", ["--version"], f);
|
|
14925
14965
|
if (e.code !== 0 || /^1\./.test(e.output.trim())) {
|
|
14926
14966
|
a.err(`Could not install ${l}: this repository uses Yarn Berry but "yarn" resolves to Yarn 1. Add "packageManager": "yarn@<version>" to package.json and run "corepack enable", then add the packages yourself.
|
|
@@ -14929,12 +14969,12 @@ async function ZS({ cwd: e, required: n, install: r, libraryName: i, io: a, run:
|
|
|
14929
14969
|
}
|
|
14930
14970
|
}
|
|
14931
14971
|
a.out(`Installing ${l} with ${p}…\n`);
|
|
14932
|
-
let m =
|
|
14933
|
-
h.code !== 0 && p === "npm" && (a.out(`npm could not resolve the dependency tree; trying again with ${
|
|
14972
|
+
let m = XS(p, c.map((e) => `${e.name}@${e.range}`)), h = await o(p, m, f);
|
|
14973
|
+
h.code !== 0 && p === "npm" && (a.out(`npm could not resolve the dependency tree; trying again with ${ZS}…\n`), h = await o(p, [...m, ZS], f)), h.code !== 0 && a.err(`Could not install ${l} (${p} exited with ${h.code}). Add them yourself.\n${h.output.trim().split("\n").slice(-10).join("\n")}\n`);
|
|
14934
14974
|
}
|
|
14935
14975
|
//#endregion
|
|
14936
14976
|
//#region src/format.ts
|
|
14937
|
-
var
|
|
14977
|
+
var eC = /* @__PURE__ */ new Set([
|
|
14938
14978
|
".ts",
|
|
14939
14979
|
".tsx",
|
|
14940
14980
|
".mts",
|
|
@@ -14947,9 +14987,9 @@ var QS = /* @__PURE__ */ new Set([
|
|
|
14947
14987
|
".mdx",
|
|
14948
14988
|
".css"
|
|
14949
14989
|
]);
|
|
14950
|
-
async function
|
|
14990
|
+
async function tC(e, t, n) {
|
|
14951
14991
|
return Promise.all(t.map(async (t) => {
|
|
14952
|
-
if (!
|
|
14992
|
+
if (!eC.has(l(t.path).toLowerCase())) return t;
|
|
14953
14993
|
let r = u(e, t.path);
|
|
14954
14994
|
try {
|
|
14955
14995
|
let e = await p(r) ?? {};
|
|
@@ -14965,7 +15005,7 @@ async function $S(e, t, n) {
|
|
|
14965
15005
|
}
|
|
14966
15006
|
}));
|
|
14967
15007
|
}
|
|
14968
|
-
async function
|
|
15008
|
+
async function nC(e, t, n) {
|
|
14969
15009
|
let r = u(e, t), i = await p(r) ?? {};
|
|
14970
15010
|
return f(n, {
|
|
14971
15011
|
...i,
|
|
@@ -14974,7 +15014,7 @@ async function eC(e, t, n) {
|
|
|
14974
15014
|
}
|
|
14975
15015
|
//#endregion
|
|
14976
15016
|
//#region ../core/src/merge/component-files.ts
|
|
14977
|
-
function
|
|
15017
|
+
function rC(e, t) {
|
|
14978
15018
|
if (e.policy !== "overwrite") return !1;
|
|
14979
15019
|
let n = tf(e.path);
|
|
14980
15020
|
if (tf(n) !== t.replace(/\/+$/, "")) return !1;
|
|
@@ -14983,7 +15023,7 @@ function tC(e, t) {
|
|
|
14983
15023
|
}
|
|
14984
15024
|
//#endregion
|
|
14985
15025
|
//#region ../../node_modules/node-diff3/dist/diff3.mjs
|
|
14986
|
-
function
|
|
15026
|
+
function iC(e, t) {
|
|
14987
15027
|
let n = Object.create(null);
|
|
14988
15028
|
for (let e = 0; e < t.length; e++) {
|
|
14989
15029
|
let r = t[e];
|
|
@@ -15012,8 +15052,8 @@ function nC(e, t) {
|
|
|
15012
15052
|
}
|
|
15013
15053
|
return r[r.length - 1];
|
|
15014
15054
|
}
|
|
15015
|
-
function
|
|
15016
|
-
let n =
|
|
15055
|
+
function aC(e, t) {
|
|
15056
|
+
let n = iC(e, t), r = [], i = e.length, a = t.length;
|
|
15017
15057
|
for (let o = n; o !== null; o = o.chain) {
|
|
15018
15058
|
let n = i - o.buffer1index - 1, s = a - o.buffer2index - 1;
|
|
15019
15059
|
i = o.buffer1index, a = o.buffer2index, (n || s) && r.push({
|
|
@@ -15025,7 +15065,7 @@ function rC(e, t) {
|
|
|
15025
15065
|
}
|
|
15026
15066
|
return r.reverse(), r;
|
|
15027
15067
|
}
|
|
15028
|
-
function
|
|
15068
|
+
function oC(e, t, n) {
|
|
15029
15069
|
let r = [];
|
|
15030
15070
|
function i(e, t) {
|
|
15031
15071
|
r.push({
|
|
@@ -15036,7 +15076,7 @@ function iC(e, t, n) {
|
|
|
15036
15076
|
abLength: e.buffer2[1]
|
|
15037
15077
|
});
|
|
15038
15078
|
}
|
|
15039
|
-
|
|
15079
|
+
aC(t, e).forEach((e) => i(e, "a")), aC(t, n).forEach((e) => i(e, "b")), r.sort((e, t) => e.oStart - t.oStart);
|
|
15040
15080
|
let a = [], o = 0;
|
|
15041
15081
|
function s(e) {
|
|
15042
15082
|
e > o && (a.push({
|
|
@@ -15103,12 +15143,12 @@ function iC(e, t, n) {
|
|
|
15103
15143
|
}
|
|
15104
15144
|
return s(t.length), a;
|
|
15105
15145
|
}
|
|
15106
|
-
function
|
|
15146
|
+
function sC(e, t, n, r) {
|
|
15107
15147
|
r = Object.assign({
|
|
15108
15148
|
excludeFalseConflicts: !0,
|
|
15109
15149
|
stringSeparator: /\s+/
|
|
15110
15150
|
}, r), typeof e == "string" && (e = e.split(r.stringSeparator)), typeof t == "string" && (t = t.split(r.stringSeparator)), typeof n == "string" && (n = n.split(r.stringSeparator));
|
|
15111
|
-
let i = [], a =
|
|
15151
|
+
let i = [], a = oC(e, t, n), o = [];
|
|
15112
15152
|
function s() {
|
|
15113
15153
|
o.length && i.push({ ok: o }), o = [];
|
|
15114
15154
|
}
|
|
@@ -15128,13 +15168,13 @@ function aC(e, t, n, r) {
|
|
|
15128
15168
|
} }));
|
|
15129
15169
|
}), s(), i;
|
|
15130
15170
|
}
|
|
15131
|
-
function
|
|
15171
|
+
function cC(e, t, n, r) {
|
|
15132
15172
|
r = Object.assign({
|
|
15133
15173
|
excludeFalseConflicts: !0,
|
|
15134
15174
|
stringSeparator: /\s+/,
|
|
15135
15175
|
label: {}
|
|
15136
15176
|
}, r);
|
|
15137
|
-
let i = "<<<<<<<" + (r.label.a ? ` ${r.label.a}` : ""), a = ">>>>>>>" + (r.label.b ? ` ${r.label.b}` : ""), o =
|
|
15177
|
+
let i = "<<<<<<<" + (r.label.a ? ` ${r.label.a}` : ""), a = ">>>>>>>" + (r.label.b ? ` ${r.label.b}` : ""), o = sC(e, t, n, r), s = !1, c = [];
|
|
15138
15178
|
return o.forEach((e) => {
|
|
15139
15179
|
e.ok ? c = c.concat(e.ok) : e.conflict && (s = !0, c = c.concat([i], e.conflict.a, ["======="], e.conflict.b, [a]));
|
|
15140
15180
|
}), {
|
|
@@ -15144,10 +15184,10 @@ function oC(e, t, n, r) {
|
|
|
15144
15184
|
}
|
|
15145
15185
|
//#endregion
|
|
15146
15186
|
//#region ../core/src/merge/merge-file.ts
|
|
15147
|
-
function
|
|
15187
|
+
function lC({ base: e, current: t, generated: n }) {
|
|
15148
15188
|
if (t === null || e === null || t === n || t === e) return { kind: "take-generated" };
|
|
15149
15189
|
if (n === e) return { kind: "keep-current" };
|
|
15150
|
-
let r =
|
|
15190
|
+
let r = cC(t.split("\n"), e.split("\n"), n.split("\n"), { excludeFalseConflicts: !0 });
|
|
15151
15191
|
return r.conflict ? { kind: "conflict" } : {
|
|
15152
15192
|
kind: "merged",
|
|
15153
15193
|
contents: r.result.join("\n")
|
|
@@ -15155,19 +15195,19 @@ function sC({ base: e, current: t, generated: n }) {
|
|
|
15155
15195
|
}
|
|
15156
15196
|
//#endregion
|
|
15157
15197
|
//#region ../core/src/merge/verify.ts
|
|
15158
|
-
var
|
|
15159
|
-
function
|
|
15160
|
-
return [...e.matchAll(
|
|
15198
|
+
var uC = /^(?:<{7}|={7}|>{7})(?:\s|$)/m, dC = /\bexport\s+(?:declare\s+)?(?:async\s+)?(?:function|const|let|class|interface|type|enum)\s+([A-Za-z_$][\w$]*)/g;
|
|
15199
|
+
function fC(e) {
|
|
15200
|
+
return [...e.matchAll(dC)].map((e) => e[1]);
|
|
15161
15201
|
}
|
|
15162
|
-
function
|
|
15163
|
-
if (
|
|
15164
|
-
let n = new Set(
|
|
15202
|
+
function pC(e, t) {
|
|
15203
|
+
if (uC.test(t)) return "it contains conflict markers";
|
|
15204
|
+
let n = new Set(fC(t)), r = fC(e).filter((e) => !n.has(e));
|
|
15165
15205
|
return r.length > 0 ? `it no longer exports ${r.join(", ")}` : null;
|
|
15166
15206
|
}
|
|
15167
15207
|
//#endregion
|
|
15168
15208
|
//#region src/merge/apply.ts
|
|
15169
|
-
var
|
|
15170
|
-
async function
|
|
15209
|
+
var mC = (e, t) => `${e.replace(/\/+$/, "")}/${t}.base`;
|
|
15210
|
+
async function hC(e) {
|
|
15171
15211
|
let { cwd: t, existing: n, componentsDir: r, baseDir: i } = e, a = new Set(e.accept ?? []), o = {
|
|
15172
15212
|
files: [],
|
|
15173
15213
|
bases: [],
|
|
@@ -15175,14 +15215,14 @@ async function pC(e) {
|
|
|
15175
15215
|
resolved: [],
|
|
15176
15216
|
conflicts: []
|
|
15177
15217
|
}, s = [], c = (e, t) => o.bases.push({
|
|
15178
|
-
path:
|
|
15218
|
+
path: mC(i, e),
|
|
15179
15219
|
contents: t,
|
|
15180
15220
|
policy: "overwrite"
|
|
15181
15221
|
});
|
|
15182
15222
|
for (let l of e.files) {
|
|
15183
15223
|
let e = o.files.push(l) - 1;
|
|
15184
|
-
if (!
|
|
15185
|
-
let u = n.read(l.path), d = n.read(
|
|
15224
|
+
if (!rC(l, r)) continue;
|
|
15225
|
+
let u = n.read(l.path), d = n.read(mC(i, l.path));
|
|
15186
15226
|
if (a.has(l.path) && u !== null) {
|
|
15187
15227
|
o.files[e] = {
|
|
15188
15228
|
...l,
|
|
@@ -15190,7 +15230,7 @@ async function pC(e) {
|
|
|
15190
15230
|
}, c(l.path, l.contents);
|
|
15191
15231
|
continue;
|
|
15192
15232
|
}
|
|
15193
|
-
let f =
|
|
15233
|
+
let f = lC({
|
|
15194
15234
|
base: d,
|
|
15195
15235
|
current: u,
|
|
15196
15236
|
generated: l.contents
|
|
@@ -15206,7 +15246,7 @@ async function pC(e) {
|
|
|
15206
15246
|
};
|
|
15207
15247
|
break;
|
|
15208
15248
|
case "merged": {
|
|
15209
|
-
let n = await
|
|
15249
|
+
let n = await gC(t, l, f.contents);
|
|
15210
15250
|
n.ok === !1 ? (o.files[e] = {
|
|
15211
15251
|
...l,
|
|
15212
15252
|
contents: u
|
|
@@ -15236,11 +15276,11 @@ async function pC(e) {
|
|
|
15236
15276
|
});
|
|
15237
15277
|
}
|
|
15238
15278
|
}
|
|
15239
|
-
return e.resolver && s.length > 0 && await
|
|
15279
|
+
return e.resolver && s.length > 0 && await _C(e, o, s), o;
|
|
15240
15280
|
}
|
|
15241
|
-
async function
|
|
15281
|
+
async function gC(e, t, n) {
|
|
15242
15282
|
try {
|
|
15243
|
-
let r = await
|
|
15283
|
+
let r = await nC(e, t.path, n), i = pC(t.contents, r);
|
|
15244
15284
|
return i ? {
|
|
15245
15285
|
ok: !1,
|
|
15246
15286
|
reason: `the merge was rejected: ${i}`
|
|
@@ -15255,7 +15295,7 @@ async function mC(e, t, n) {
|
|
|
15255
15295
|
};
|
|
15256
15296
|
}
|
|
15257
15297
|
}
|
|
15258
|
-
async function
|
|
15298
|
+
async function _C(e, t, n) {
|
|
15259
15299
|
let r = (e, n) => {
|
|
15260
15300
|
let r = t.conflicts.find((t) => t.path === e);
|
|
15261
15301
|
r && (r.reason = n);
|
|
@@ -15264,7 +15304,7 @@ async function hC(e, t, n) {
|
|
|
15264
15304
|
e.base,
|
|
15265
15305
|
e.current,
|
|
15266
15306
|
e.generated
|
|
15267
|
-
].some((e) => e.length >
|
|
15307
|
+
].some((e) => e.length > jx);
|
|
15268
15308
|
return t && r(e.path, "too large to send to the merge model"), !t;
|
|
15269
15309
|
});
|
|
15270
15310
|
for (let n = 0; n < i.length; n += 5) {
|
|
@@ -15279,7 +15319,7 @@ async function hC(e, t, n) {
|
|
|
15279
15319
|
r(i.path, "the merge model could not resolve it");
|
|
15280
15320
|
continue;
|
|
15281
15321
|
}
|
|
15282
|
-
let s = await
|
|
15322
|
+
let s = await gC(e.cwd, {
|
|
15283
15323
|
path: i.path,
|
|
15284
15324
|
contents: i.generated,
|
|
15285
15325
|
policy: "overwrite"
|
|
@@ -15292,7 +15332,7 @@ async function hC(e, t, n) {
|
|
|
15292
15332
|
...t.files[n],
|
|
15293
15333
|
contents: s.contents
|
|
15294
15334
|
}, t.conflicts = t.conflicts.filter((e) => e.path !== i.path), t.resolved.push(i.path), t.bases.push({
|
|
15295
|
-
path:
|
|
15335
|
+
path: mC(e.baseDir, i.path),
|
|
15296
15336
|
contents: i.generated,
|
|
15297
15337
|
policy: "overwrite"
|
|
15298
15338
|
});
|
|
@@ -15301,8 +15341,8 @@ async function hC(e, t, n) {
|
|
|
15301
15341
|
}
|
|
15302
15342
|
//#endregion
|
|
15303
15343
|
//#region src/merge/resolver.ts
|
|
15304
|
-
function
|
|
15305
|
-
let { io: t } = e, n = e.provider ??
|
|
15344
|
+
function vC(e) {
|
|
15345
|
+
let { io: t } = e, n = e.provider ?? zS(e), r, i;
|
|
15306
15346
|
return async (e) => {
|
|
15307
15347
|
if (r) return null;
|
|
15308
15348
|
let a = (e) => (r = e, t.err(`Merge skipped: ${e}. Conflicts stay as you left them.\n`), null);
|
|
@@ -15317,20 +15357,20 @@ function gC(e) {
|
|
|
15317
15357
|
files: e
|
|
15318
15358
|
})).results;
|
|
15319
15359
|
} catch (e) {
|
|
15320
|
-
return a(e instanceof
|
|
15360
|
+
return a(e instanceof Xx ? e.message : "the service call failed");
|
|
15321
15361
|
}
|
|
15322
15362
|
};
|
|
15323
15363
|
}
|
|
15324
15364
|
//#endregion
|
|
15325
15365
|
//#region src/generate.ts
|
|
15326
|
-
async function
|
|
15366
|
+
async function yC({ cwd: e, config: t, check: n, verbose: r = !1, noEnrich: i = !1, ci: a = !1, accept: o, enrich: s, provider: c, runner: l }, d) {
|
|
15327
15367
|
if (!n && !i) {
|
|
15328
15368
|
let n = s?.env ?? process.env;
|
|
15329
|
-
await
|
|
15369
|
+
await HS({
|
|
15330
15370
|
designPath: u(e, t.inputs.design),
|
|
15331
15371
|
enrichedPath: u(e, t.inputs.enriched),
|
|
15332
15372
|
annotationsPath: u(e, t.inputs.annotations),
|
|
15333
|
-
bridgeUrl:
|
|
15373
|
+
bridgeUrl: xS({
|
|
15334
15374
|
env: n,
|
|
15335
15375
|
configured: t.enrich.bridgeUrl,
|
|
15336
15376
|
baked: _
|
|
@@ -15343,7 +15383,7 @@ async function _C({ cwd: e, config: t, check: n, verbose: r = !1, noEnrich: i =
|
|
|
15343
15383
|
sleep: s?.sleep
|
|
15344
15384
|
});
|
|
15345
15385
|
}
|
|
15346
|
-
let f =
|
|
15386
|
+
let f = jS({
|
|
15347
15387
|
root: e,
|
|
15348
15388
|
designPath: t.inputs.design,
|
|
15349
15389
|
enrichedPath: t.inputs.enriched,
|
|
@@ -15352,12 +15392,12 @@ async function _C({ cwd: e, config: t, check: n, verbose: r = !1, noEnrich: i =
|
|
|
15352
15392
|
brandImage: t.theme.brand?.image
|
|
15353
15393
|
});
|
|
15354
15394
|
if (f.ok === !1) return d.err(`${f.error}\n`), 1;
|
|
15355
|
-
let p =
|
|
15395
|
+
let p = TS(e), m = await kb({
|
|
15356
15396
|
...f.input,
|
|
15357
15397
|
existing: p
|
|
15358
15398
|
}, t);
|
|
15359
|
-
|
|
15360
|
-
let h = [], g = await
|
|
15399
|
+
CC(m.diagnostics, r, d);
|
|
15400
|
+
let h = [], g = await tC(e, m.files, (e, t) => h.push({
|
|
15361
15401
|
path: e,
|
|
15362
15402
|
message: t
|
|
15363
15403
|
}));
|
|
@@ -15368,15 +15408,15 @@ async function _C({ cwd: e, config: t, check: n, verbose: r = !1, noEnrich: i =
|
|
|
15368
15408
|
let v = g, y = [], b;
|
|
15369
15409
|
if (t.merge.enabled) {
|
|
15370
15410
|
let r = s?.env ?? process.env;
|
|
15371
|
-
b = await
|
|
15411
|
+
b = await hC({
|
|
15372
15412
|
cwd: e,
|
|
15373
15413
|
files: g,
|
|
15374
15414
|
existing: p,
|
|
15375
15415
|
componentsDir: t.paths.components,
|
|
15376
15416
|
baseDir: t.merge.baseDir,
|
|
15377
15417
|
accept: o,
|
|
15378
|
-
resolver: !n && !i && t.merge.llm && t.merge.sendSource ?
|
|
15379
|
-
bridgeUrl:
|
|
15418
|
+
resolver: !n && !i && t.merge.llm && t.merge.sendSource ? vC({
|
|
15419
|
+
bridgeUrl: xS({
|
|
15380
15420
|
env: r,
|
|
15381
15421
|
configured: t.enrich.bridgeUrl,
|
|
15382
15422
|
baked: _
|
|
@@ -15396,11 +15436,11 @@ async function _C({ cwd: e, config: t, check: n, verbose: r = !1, noEnrich: i =
|
|
|
15396
15436
|
let t = p.read(e.path);
|
|
15397
15437
|
return t === null || e.policy === "overwrite" && t !== e.contents;
|
|
15398
15438
|
}), t = b?.conflicts ?? [];
|
|
15399
|
-
return t.length > 0 && d.err(
|
|
15439
|
+
return t.length > 0 && d.err(xC(t, !0)), e.length === 0 && t.length === 0 ? (d.out(`Up to date (${v.length} file(s) checked).\n`), 0) : (e.length === 0 || d.err(`${e.length} generated file(s) are out of date:\n${e.slice(0, 20).map((e) => ` ${e.path}`).join("\n")}${e.length > 20 ? `\n …and ${e.length - 20} more` : ""}\nRun \`syncline generate\` and commit the result.
|
|
15400
15440
|
`), 1);
|
|
15401
15441
|
}
|
|
15402
|
-
let x =
|
|
15403
|
-
return d.out(`Generated ${v.length} file(s): ${x.written.length -
|
|
15442
|
+
let x = ES(e, [...v, ...y]);
|
|
15443
|
+
return d.out(`Generated ${v.length} file(s): ${x.written.length - bC(x.written, y)} written, ${x.unchanged.length} unchanged, ${x.kept.length} kept (hand-editable).\n`), b && SC(b, d), await $S({
|
|
15404
15444
|
cwd: e,
|
|
15405
15445
|
required: Nc(t),
|
|
15406
15446
|
install: t.dependencies.install,
|
|
@@ -15409,14 +15449,14 @@ async function _C({ cwd: e, config: t, check: n, verbose: r = !1, noEnrich: i =
|
|
|
15409
15449
|
run: l
|
|
15410
15450
|
}), 0;
|
|
15411
15451
|
}
|
|
15412
|
-
var
|
|
15413
|
-
function
|
|
15452
|
+
var bC = (e, t) => t.filter((t) => e.includes(t.path)).length;
|
|
15453
|
+
function xC(e, t) {
|
|
15414
15454
|
return `${e.length} component(s) have hand edits that could not be merged${t ? " (and are out of date)" : " (left as you wrote them)"}:\n` + e.map((e) => ` ${e.path}: ${e.reason}`).join("\n") + "\nResolve each by hand, then run `syncline generate --accept <path>` to record it.\n";
|
|
15415
15455
|
}
|
|
15416
|
-
function
|
|
15417
|
-
e.merged.length > 0 && t.out(`Merged your edits into ${e.merged.length} component(s).\n`), e.resolved.length > 0 && t.out(`Resolved ${e.resolved.length} conflict(s) with the merge service.\n`), e.conflicts.length > 0 && t.err(
|
|
15456
|
+
function SC(e, t) {
|
|
15457
|
+
e.merged.length > 0 && t.out(`Merged your edits into ${e.merged.length} component(s).\n`), e.resolved.length > 0 && t.out(`Resolved ${e.resolved.length} conflict(s) with the merge service.\n`), e.conflicts.length > 0 && t.err(xC(e.conflicts, !1));
|
|
15418
15458
|
}
|
|
15419
|
-
function
|
|
15459
|
+
function CC(e, t, n) {
|
|
15420
15460
|
if (e.length === 0) return;
|
|
15421
15461
|
if (t) {
|
|
15422
15462
|
for (let t of e) n.err(`warning [${t.phase}]${t.scope ? ` ${t.scope}` : ""}: ${t.message}\n`);
|
|
@@ -15428,7 +15468,7 @@ function xC(e, t, n) {
|
|
|
15428
15468
|
}
|
|
15429
15469
|
//#endregion
|
|
15430
15470
|
//#region src/load-config.ts
|
|
15431
|
-
function
|
|
15471
|
+
function wC(e, n) {
|
|
15432
15472
|
let r = d(e, n ?? "syncline.config.json"), a = {};
|
|
15433
15473
|
if (t(r)) try {
|
|
15434
15474
|
a = JSON.parse(i(r, "utf-8"));
|
|
@@ -15453,7 +15493,7 @@ function SC(e, n) {
|
|
|
15453
15493
|
}
|
|
15454
15494
|
//#endregion
|
|
15455
15495
|
//#region src/commands/generate.ts
|
|
15456
|
-
var
|
|
15496
|
+
var TC = `Usage: syncline generate [options]
|
|
15457
15497
|
|
|
15458
15498
|
Generates the component library from the Figma export under .figma/.
|
|
15459
15499
|
|
|
@@ -15467,7 +15507,7 @@ Options:
|
|
|
15467
15507
|
--accept <path> Record a component you resolved by hand after a merge conflict (repeatable)
|
|
15468
15508
|
-h, --help Show this help
|
|
15469
15509
|
`;
|
|
15470
|
-
function
|
|
15510
|
+
function EC(e) {
|
|
15471
15511
|
let t = {
|
|
15472
15512
|
check: !1,
|
|
15473
15513
|
verbose: !1,
|
|
@@ -15508,19 +15548,19 @@ function wC(e) {
|
|
|
15508
15548
|
case "--help":
|
|
15509
15549
|
t.help = !0;
|
|
15510
15550
|
break;
|
|
15511
|
-
default: throw Error(`Unknown option: ${e[n]}\n\n${
|
|
15551
|
+
default: throw Error(`Unknown option: ${e[n]}\n\n${TC}`);
|
|
15512
15552
|
}
|
|
15513
15553
|
}
|
|
15514
15554
|
return t;
|
|
15515
15555
|
}
|
|
15516
|
-
var
|
|
15556
|
+
var DC = {
|
|
15517
15557
|
name: "generate",
|
|
15518
15558
|
summary: "Generate the component library from .figma/design.json",
|
|
15519
15559
|
async run({ args: e, io: t }) {
|
|
15520
|
-
let n =
|
|
15521
|
-
if (n.help) return t.out(
|
|
15522
|
-
let r = d(n.cwd ?? process.cwd()), i =
|
|
15523
|
-
return i.ok === !1 ? (t.err(`${i.error}\n`), 1) :
|
|
15560
|
+
let n = EC(e);
|
|
15561
|
+
if (n.help) return t.out(TC), 0;
|
|
15562
|
+
let r = d(n.cwd ?? process.cwd()), i = wC(r, n.config);
|
|
15563
|
+
return i.ok === !1 ? (t.err(`${i.error}\n`), 1) : yC({
|
|
15524
15564
|
cwd: r,
|
|
15525
15565
|
config: i.config,
|
|
15526
15566
|
check: n.check,
|
|
@@ -15530,14 +15570,14 @@ var TC = {
|
|
|
15530
15570
|
accept: n.accept
|
|
15531
15571
|
}, t);
|
|
15532
15572
|
}
|
|
15533
|
-
},
|
|
15573
|
+
}, OC = 8, kC = 40, AC = (e) => ({ text: JSON.stringify(e, null, 2) }), jC = (e) => ({
|
|
15534
15574
|
text: e,
|
|
15535
15575
|
isError: !0
|
|
15536
15576
|
});
|
|
15537
|
-
function
|
|
15577
|
+
function MC(e) {
|
|
15538
15578
|
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
15539
15579
|
}
|
|
15540
|
-
function
|
|
15580
|
+
function NC(e) {
|
|
15541
15581
|
return {
|
|
15542
15582
|
name: e.name,
|
|
15543
15583
|
...e.group && { group: e.group },
|
|
@@ -15545,7 +15585,7 @@ function jC(e) {
|
|
|
15545
15585
|
...e.archetype && { widget: e.archetype.kind }
|
|
15546
15586
|
};
|
|
15547
15587
|
}
|
|
15548
|
-
function
|
|
15588
|
+
function PC(e, t, n) {
|
|
15549
15589
|
let r = e.toLowerCase().split(/\s+/).filter(Boolean), i = t.toLowerCase(), a = n.filter(Boolean).join(" ").toLowerCase(), o = 0;
|
|
15550
15590
|
for (let e of r) if (i === e) o += 10;
|
|
15551
15591
|
else if (i.includes(e)) o += 5;
|
|
@@ -15553,7 +15593,7 @@ function MC(e, t, n) {
|
|
|
15553
15593
|
else return 0;
|
|
15554
15594
|
return o;
|
|
15555
15595
|
}
|
|
15556
|
-
var
|
|
15596
|
+
var FC = [
|
|
15557
15597
|
{
|
|
15558
15598
|
name: "list_components",
|
|
15559
15599
|
description: "List the library’s components (name, group, one-line description), optionally one group. Start here when you do not know what exists.",
|
|
@@ -15565,10 +15605,10 @@ var NC = [
|
|
|
15565
15605
|
} }
|
|
15566
15606
|
},
|
|
15567
15607
|
call({ manifest: e }, t) {
|
|
15568
|
-
let n =
|
|
15569
|
-
return
|
|
15608
|
+
let n = MC(t.group)?.toLowerCase(), r = e.components.filter((e) => !n || e.group?.toLowerCase() === n);
|
|
15609
|
+
return AC({
|
|
15570
15610
|
groups: [...new Set(e.components.map((e) => e.group ?? "Components"))],
|
|
15571
|
-
components: r.map(
|
|
15611
|
+
components: r.map(NC)
|
|
15572
15612
|
});
|
|
15573
15613
|
}
|
|
15574
15614
|
},
|
|
@@ -15581,21 +15621,21 @@ var NC = [
|
|
|
15581
15621
|
required: ["query"]
|
|
15582
15622
|
},
|
|
15583
15623
|
call({ manifest: e }, t) {
|
|
15584
|
-
let n =
|
|
15585
|
-
if (!n) return
|
|
15624
|
+
let n = MC(t.query);
|
|
15625
|
+
if (!n) return jC("query is required");
|
|
15586
15626
|
let r = e.components.map((e) => ({
|
|
15587
15627
|
component: e,
|
|
15588
|
-
score:
|
|
15628
|
+
score: PC(n, e.name, [
|
|
15589
15629
|
e.description,
|
|
15590
15630
|
e.group,
|
|
15591
15631
|
e.archetype?.kind,
|
|
15592
15632
|
e.archetype?.summary,
|
|
15593
15633
|
...e.props.map((e) => e.name)
|
|
15594
15634
|
])
|
|
15595
|
-
})).filter((e) => e.score > 0).sort((e, t) => t.score - e.score || e.component.name.localeCompare(t.component.name)).slice(0,
|
|
15596
|
-
return
|
|
15635
|
+
})).filter((e) => e.score > 0).sort((e, t) => t.score - e.score || e.component.name.localeCompare(t.component.name)).slice(0, OC);
|
|
15636
|
+
return AC({
|
|
15597
15637
|
query: n,
|
|
15598
|
-
matches: r.map((e) =>
|
|
15638
|
+
matches: r.map((e) => NC(e.component)),
|
|
15599
15639
|
hint: r.length ? "Call get_component for the full contract of one of these." : "No match: try list_components, or build it from existing components and tokens."
|
|
15600
15640
|
});
|
|
15601
15641
|
}
|
|
@@ -15609,15 +15649,15 @@ var NC = [
|
|
|
15609
15649
|
required: ["name"]
|
|
15610
15650
|
},
|
|
15611
15651
|
call({ manifest: e }, t) {
|
|
15612
|
-
let n =
|
|
15613
|
-
if (!n) return
|
|
15652
|
+
let n = MC(t.name);
|
|
15653
|
+
if (!n) return jC("name is required");
|
|
15614
15654
|
let r = e.components.find((e) => e.name.toLowerCase() === n.toLowerCase());
|
|
15615
15655
|
if (!r) {
|
|
15616
15656
|
let t = e.components.filter((e) => e.name.toLowerCase().includes(n.toLowerCase())).map((e) => e.name).slice(0, 5);
|
|
15617
|
-
return
|
|
15657
|
+
return jC(`No component named "${n}".${t.length ? ` Did you mean: ${t.join(", ")}?` : " Use search_components."}`);
|
|
15618
15658
|
}
|
|
15619
15659
|
let i = Object.fromEntries(r.props.flatMap((t) => t.enum ? [[t.enum, e.enums[t.enum]]] : []));
|
|
15620
|
-
return
|
|
15660
|
+
return AC({
|
|
15621
15661
|
import: `import { ${r.name} } from '${e.library.package ?? "<package>"}'`,
|
|
15622
15662
|
component: r,
|
|
15623
15663
|
enums: i,
|
|
@@ -15649,28 +15689,28 @@ var NC = [
|
|
|
15649
15689
|
}
|
|
15650
15690
|
},
|
|
15651
15691
|
call({ tokens: e }, t) {
|
|
15652
|
-
let n =
|
|
15692
|
+
let n = MC(t.query), r = MC(t.kind), i = e.tokens.filter((e) => !r || e.kind === r).map((e) => ({
|
|
15653
15693
|
token: e,
|
|
15654
|
-
score: n ?
|
|
15694
|
+
score: n ? PC(n, e.name, [
|
|
15655
15695
|
e.description,
|
|
15656
15696
|
e.collection,
|
|
15657
15697
|
e.kind
|
|
15658
15698
|
]) : 1
|
|
15659
15699
|
})).filter((e) => e.score > 0).sort((e, t) => t.score - e.score || e.token.name.localeCompare(t.token.name));
|
|
15660
|
-
return
|
|
15700
|
+
return AC({
|
|
15661
15701
|
total: i.length,
|
|
15662
15702
|
modes: e.modes,
|
|
15663
|
-
tokens: i.slice(0,
|
|
15664
|
-
...i.length >
|
|
15703
|
+
tokens: i.slice(0, kC).map((e) => e.token),
|
|
15704
|
+
...i.length > kC && { hint: `Showing ${kC} of ${i.length}; narrow with query or kind.` }
|
|
15665
15705
|
});
|
|
15666
15706
|
}
|
|
15667
15707
|
}
|
|
15668
|
-
],
|
|
15708
|
+
], IC = "2025-06-18", LC = "Design-system lookup. Before writing UI, call search_components or list_components; use get_component for exact props and a compiling example; use search_tokens for colours, spacing and type instead of raw values. Read each component’s `archetype.notCovered` before assuming a feature.", RC = {
|
|
15669
15709
|
parse: -32700,
|
|
15670
15710
|
method: -32601,
|
|
15671
15711
|
params: -32602
|
|
15672
15712
|
};
|
|
15673
|
-
function
|
|
15713
|
+
function zC(e) {
|
|
15674
15714
|
let t = (e, t) => JSON.stringify({
|
|
15675
15715
|
jsonrpc: "2.0",
|
|
15676
15716
|
id: e,
|
|
@@ -15688,29 +15728,29 @@ function LC(e) {
|
|
|
15688
15728
|
try {
|
|
15689
15729
|
i = JSON.parse(r);
|
|
15690
15730
|
} catch {
|
|
15691
|
-
return n(null,
|
|
15731
|
+
return n(null, RC.parse, "Parse error");
|
|
15692
15732
|
}
|
|
15693
|
-
if (typeof i != "object" || !i) return n(null,
|
|
15733
|
+
if (typeof i != "object" || !i) return n(null, RC.parse, "Parse error");
|
|
15694
15734
|
let { id: a, method: o, params: s = {} } = i, c = a === void 0;
|
|
15695
15735
|
switch (o) {
|
|
15696
15736
|
case "initialize": return t(a, {
|
|
15697
|
-
protocolVersion: typeof s.protocolVersion == "string" ? s.protocolVersion :
|
|
15737
|
+
protocolVersion: typeof s.protocolVersion == "string" ? s.protocolVersion : IC,
|
|
15698
15738
|
capabilities: { tools: {} },
|
|
15699
15739
|
serverInfo: {
|
|
15700
15740
|
name: "syncline",
|
|
15701
15741
|
version: v
|
|
15702
15742
|
},
|
|
15703
|
-
instructions:
|
|
15743
|
+
instructions: LC
|
|
15704
15744
|
});
|
|
15705
15745
|
case "ping": return t(a, {});
|
|
15706
|
-
case "tools/list": return t(a, { tools:
|
|
15746
|
+
case "tools/list": return t(a, { tools: FC.map(({ name: e, description: t, inputSchema: n }) => ({
|
|
15707
15747
|
name: e,
|
|
15708
15748
|
description: t,
|
|
15709
15749
|
inputSchema: n
|
|
15710
15750
|
})) });
|
|
15711
15751
|
case "tools/call": {
|
|
15712
|
-
let r =
|
|
15713
|
-
if (!r) return n(a,
|
|
15752
|
+
let r = FC.find((e) => e.name === s.name);
|
|
15753
|
+
if (!r) return n(a, RC.params, `Unknown tool: ${String(s.name)}`);
|
|
15714
15754
|
let i = typeof s.arguments == "object" && s.arguments !== null ? s.arguments : {};
|
|
15715
15755
|
try {
|
|
15716
15756
|
let n = r.call(e, i);
|
|
@@ -15731,13 +15771,13 @@ function LC(e) {
|
|
|
15731
15771
|
});
|
|
15732
15772
|
}
|
|
15733
15773
|
}
|
|
15734
|
-
default: return c ? null : n(a,
|
|
15774
|
+
default: return c ? null : n(a, RC.method, `Method not found: ${String(o)}`);
|
|
15735
15775
|
}
|
|
15736
15776
|
} };
|
|
15737
15777
|
}
|
|
15738
15778
|
//#endregion
|
|
15739
15779
|
//#region src/commands/mcp.ts
|
|
15740
|
-
var
|
|
15780
|
+
var BC = `Usage: syncline mcp [options]
|
|
15741
15781
|
|
|
15742
15782
|
Serves the design system to an AI agent over MCP (stdio): search and read
|
|
15743
15783
|
components, search tokens. Reads what \`syncline generate\` wrote when \`agent.enabled\`
|
|
@@ -15749,24 +15789,24 @@ Options:
|
|
|
15749
15789
|
--config <file> Config file (default: ${jb})
|
|
15750
15790
|
--cwd <dir> Project root (default: the current directory)
|
|
15751
15791
|
-h, --help Show this help
|
|
15752
|
-
`,
|
|
15792
|
+
`, VC = {
|
|
15753
15793
|
name: "mcp",
|
|
15754
15794
|
summary: "Serve the design system to an AI agent (MCP, stdio)",
|
|
15755
15795
|
async run({ args: e, io: n }) {
|
|
15756
15796
|
let r = process.cwd(), a;
|
|
15757
15797
|
for (let t = 0; t < e.length; t++) {
|
|
15758
|
-
if (e[t] === "-h" || e[t] === "--help") return n.out(
|
|
15798
|
+
if (e[t] === "-h" || e[t] === "--help") return n.out(BC), 0;
|
|
15759
15799
|
if (e[t] === "--cwd" && e[t + 1]) r = d(e[++t]);
|
|
15760
15800
|
else if (e[t] === "--config" && e[t + 1]) a = e[++t];
|
|
15761
|
-
else return n.err(`Unknown option: ${e[t]}\n\n${
|
|
15801
|
+
else return n.err(`Unknown option: ${e[t]}\n\n${BC}`), 1;
|
|
15762
15802
|
}
|
|
15763
|
-
let o =
|
|
15803
|
+
let o = wC(r, a);
|
|
15764
15804
|
if (o.ok === !1) return n.err(`${o.error}\n`), 1;
|
|
15765
15805
|
let s = u(r, o.config.agent.dir), c = u(s, "components.json"), l = u(s, "tokens.json");
|
|
15766
15806
|
if (!t(c) || !t(l)) return n.err(`No agent files in ${s}. Set "agent": { "enabled": true } in ${jb} and run \`syncline generate\`.\n`), 1;
|
|
15767
15807
|
let f;
|
|
15768
15808
|
try {
|
|
15769
|
-
f =
|
|
15809
|
+
f = zC({
|
|
15770
15810
|
manifest: JSON.parse(i(c, "utf-8")),
|
|
15771
15811
|
tokens: JSON.parse(i(l, "utf-8"))
|
|
15772
15812
|
});
|
|
@@ -15780,7 +15820,7 @@ Options:
|
|
|
15780
15820
|
t !== null && n.out(`${t}\n`);
|
|
15781
15821
|
}), await new Promise((e) => p.on("close", e)), 0;
|
|
15782
15822
|
}
|
|
15783
|
-
},
|
|
15823
|
+
}, HC = Uint8Array, UC = Uint16Array, WC = Int32Array, GC = new HC([
|
|
15784
15824
|
0,
|
|
15785
15825
|
0,
|
|
15786
15826
|
0,
|
|
@@ -15813,7 +15853,7 @@ Options:
|
|
|
15813
15853
|
0,
|
|
15814
15854
|
0,
|
|
15815
15855
|
0
|
|
15816
|
-
]),
|
|
15856
|
+
]), KC = new HC([
|
|
15817
15857
|
0,
|
|
15818
15858
|
0,
|
|
15819
15859
|
0,
|
|
@@ -15846,7 +15886,7 @@ Options:
|
|
|
15846
15886
|
13,
|
|
15847
15887
|
0,
|
|
15848
15888
|
0
|
|
15849
|
-
]),
|
|
15889
|
+
]), qC = new HC([
|
|
15850
15890
|
16,
|
|
15851
15891
|
17,
|
|
15852
15892
|
18,
|
|
@@ -15866,42 +15906,42 @@ Options:
|
|
|
15866
15906
|
14,
|
|
15867
15907
|
1,
|
|
15868
15908
|
15
|
|
15869
|
-
]),
|
|
15870
|
-
for (var n = new
|
|
15871
|
-
for (var i = new
|
|
15909
|
+
]), JC = function(e, t) {
|
|
15910
|
+
for (var n = new UC(31), r = 0; r < 31; ++r) n[r] = t += 1 << e[r - 1];
|
|
15911
|
+
for (var i = new WC(n[30]), r = 1; r < 30; ++r) for (var a = n[r]; a < n[r + 1]; ++a) i[a] = a - n[r] << 5 | r;
|
|
15872
15912
|
return {
|
|
15873
15913
|
b: n,
|
|
15874
15914
|
r: i
|
|
15875
15915
|
};
|
|
15876
|
-
},
|
|
15877
|
-
|
|
15878
|
-
var
|
|
15879
|
-
|
|
15880
|
-
for (var
|
|
15881
|
-
var
|
|
15882
|
-
|
|
15883
|
-
}
|
|
15884
|
-
for (var
|
|
15885
|
-
for (var r = e.length, i = 0, a = new
|
|
15886
|
-
var o = new
|
|
15916
|
+
}, YC = JC(GC, 2), XC = YC.b, ZC = YC.r;
|
|
15917
|
+
XC[28] = 258, ZC[258] = 28;
|
|
15918
|
+
var QC = JC(KC, 0);
|
|
15919
|
+
QC.b;
|
|
15920
|
+
for (var $C = QC.r, ew = new UC(32768), Q = 0; Q < 32768; ++Q) {
|
|
15921
|
+
var tw = (Q & 43690) >> 1 | (Q & 21845) << 1;
|
|
15922
|
+
tw = (tw & 52428) >> 2 | (tw & 13107) << 2, tw = (tw & 61680) >> 4 | (tw & 3855) << 4, ew[Q] = ((tw & 65280) >> 8 | (tw & 255) << 8) >> 1;
|
|
15923
|
+
}
|
|
15924
|
+
for (var nw = (function(e, t, n) {
|
|
15925
|
+
for (var r = e.length, i = 0, a = new UC(t); i < r; ++i) e[i] && ++a[e[i] - 1];
|
|
15926
|
+
var o = new UC(t);
|
|
15887
15927
|
for (i = 1; i < t; ++i) o[i] = o[i - 1] + a[i - 1] << 1;
|
|
15888
15928
|
var s;
|
|
15889
15929
|
if (n) {
|
|
15890
|
-
s = new
|
|
15930
|
+
s = new UC(1 << t);
|
|
15891
15931
|
var c = 15 - t;
|
|
15892
|
-
for (i = 0; i < r; ++i) if (e[i]) for (var l = i << 4 | e[i], u = t - e[i], d = o[e[i] - 1]++ << u, f = d | (1 << u) - 1; d <= f; ++d) s[
|
|
15893
|
-
} else for (s = new
|
|
15932
|
+
for (i = 0; i < r; ++i) if (e[i]) for (var l = i << 4 | e[i], u = t - e[i], d = o[e[i] - 1]++ << u, f = d | (1 << u) - 1; d <= f; ++d) s[ew[d] >> c] = l;
|
|
15933
|
+
} else for (s = new UC(r), i = 0; i < r; ++i) e[i] && (s[i] = ew[o[e[i] - 1]++] >> 15 - e[i]);
|
|
15894
15934
|
return s;
|
|
15895
|
-
}),
|
|
15896
|
-
for (var Q = 144; Q < 256; ++Q)
|
|
15897
|
-
for (var Q = 256; Q < 280; ++Q)
|
|
15898
|
-
for (var Q = 280; Q < 288; ++Q)
|
|
15899
|
-
for (var
|
|
15900
|
-
var
|
|
15935
|
+
}), rw = new HC(288), Q = 0; Q < 144; ++Q) rw[Q] = 8;
|
|
15936
|
+
for (var Q = 144; Q < 256; ++Q) rw[Q] = 9;
|
|
15937
|
+
for (var Q = 256; Q < 280; ++Q) rw[Q] = 7;
|
|
15938
|
+
for (var Q = 280; Q < 288; ++Q) rw[Q] = 8;
|
|
15939
|
+
for (var iw = new HC(32), Q = 0; Q < 32; ++Q) iw[Q] = 5;
|
|
15940
|
+
var aw = /*#__PURE__*/ nw(rw, 9, 0), ow = /*#__PURE__*/ nw(iw, 5, 0), sw = function(e) {
|
|
15901
15941
|
return (e + 7) / 8 | 0;
|
|
15902
|
-
},
|
|
15903
|
-
return (t == null || t < 0) && (t = 0), (n == null || n > e.length) && (n = e.length), new
|
|
15904
|
-
},
|
|
15942
|
+
}, cw = function(e, t, n) {
|
|
15943
|
+
return (t == null || t < 0) && (t = 0), (n == null || n > e.length) && (n = e.length), new HC(e.subarray(t, n));
|
|
15944
|
+
}, lw = [
|
|
15905
15945
|
"unexpected EOF",
|
|
15906
15946
|
"invalid block type",
|
|
15907
15947
|
"invalid length/literal",
|
|
@@ -15916,30 +15956,30 @@ var rw = /*#__PURE__*/ ew(tw, 9, 0), iw = /*#__PURE__*/ ew(nw, 5, 0), aw = funct
|
|
|
15916
15956
|
"filename too long",
|
|
15917
15957
|
"stream finishing",
|
|
15918
15958
|
"invalid zip data"
|
|
15919
|
-
],
|
|
15920
|
-
var r = Error(t ||
|
|
15921
|
-
if (r.code = e, Error.captureStackTrace && Error.captureStackTrace(r,
|
|
15959
|
+
], uw = function(e, t, n) {
|
|
15960
|
+
var r = Error(t || lw[e]);
|
|
15961
|
+
if (r.code = e, Error.captureStackTrace && Error.captureStackTrace(r, uw), !n) throw r;
|
|
15922
15962
|
return r;
|
|
15923
|
-
},
|
|
15963
|
+
}, dw = function(e, t, n) {
|
|
15924
15964
|
n <<= t & 7;
|
|
15925
15965
|
var r = t / 8 | 0;
|
|
15926
15966
|
e[r] |= n, e[r + 1] |= n >> 8;
|
|
15927
|
-
},
|
|
15967
|
+
}, fw = function(e, t, n) {
|
|
15928
15968
|
n <<= t & 7;
|
|
15929
15969
|
var r = t / 8 | 0;
|
|
15930
15970
|
e[r] |= n, e[r + 1] |= n >> 8, e[r + 2] |= n >> 16;
|
|
15931
|
-
},
|
|
15971
|
+
}, pw = function(e, t) {
|
|
15932
15972
|
for (var n = [], r = 0; r < e.length; ++r) e[r] && n.push({
|
|
15933
15973
|
s: r,
|
|
15934
15974
|
f: e[r]
|
|
15935
15975
|
});
|
|
15936
15976
|
var i = n.length, a = n.slice();
|
|
15937
15977
|
if (!i) return {
|
|
15938
|
-
t:
|
|
15978
|
+
t: bw,
|
|
15939
15979
|
l: 0
|
|
15940
15980
|
};
|
|
15941
15981
|
if (i == 1) {
|
|
15942
|
-
var o = new
|
|
15982
|
+
var o = new HC(n[0].s + 1);
|
|
15943
15983
|
return o[n[0].s] = 1, {
|
|
15944
15984
|
t: o,
|
|
15945
15985
|
l: 1
|
|
@@ -15964,7 +16004,7 @@ var rw = /*#__PURE__*/ ew(tw, 9, 0), iw = /*#__PURE__*/ ew(nw, 5, 0), aw = funct
|
|
|
15964
16004
|
r: c
|
|
15965
16005
|
};
|
|
15966
16006
|
for (var f = a[0].s, r = 1; r < i; ++r) a[r].s > f && (f = a[r].s);
|
|
15967
|
-
var p = new
|
|
16007
|
+
var p = new UC(f + 1), m = mw(n[u - 1], p, 0);
|
|
15968
16008
|
if (m > t) {
|
|
15969
16009
|
var r = 0, h = 0, g = m - t, _ = 1 << g;
|
|
15970
16010
|
for (a.sort(function(e, t) {
|
|
@@ -15985,14 +16025,14 @@ var rw = /*#__PURE__*/ ew(tw, 9, 0), iw = /*#__PURE__*/ ew(nw, 5, 0), aw = funct
|
|
|
15985
16025
|
m = t;
|
|
15986
16026
|
}
|
|
15987
16027
|
return {
|
|
15988
|
-
t: new
|
|
16028
|
+
t: new HC(p),
|
|
15989
16029
|
l: m
|
|
15990
16030
|
};
|
|
15991
|
-
},
|
|
15992
|
-
return e.s == -1 ? Math.max(
|
|
15993
|
-
},
|
|
16031
|
+
}, mw = function(e, t, n) {
|
|
16032
|
+
return e.s == -1 ? Math.max(mw(e.l, t, n + 1), mw(e.r, t, n + 1)) : t[e.s] = n;
|
|
16033
|
+
}, hw = function(e) {
|
|
15994
16034
|
for (var t = e.length; t && !e[--t];);
|
|
15995
|
-
for (var n = new
|
|
16035
|
+
for (var n = new UC(++t), r = 0, i = e[0], a = 1, o = function(e) {
|
|
15996
16036
|
n[r++] = e;
|
|
15997
16037
|
}, s = 1; s <= t; ++s) if (e[s] == i && s != t) ++a;
|
|
15998
16038
|
else {
|
|
@@ -16010,44 +16050,44 @@ var rw = /*#__PURE__*/ ew(tw, 9, 0), iw = /*#__PURE__*/ ew(nw, 5, 0), aw = funct
|
|
|
16010
16050
|
c: n.subarray(0, r),
|
|
16011
16051
|
n: t
|
|
16012
16052
|
};
|
|
16013
|
-
},
|
|
16053
|
+
}, gw = function(e, t) {
|
|
16014
16054
|
for (var n = 0, r = 0; r < t.length; ++r) n += e[r] * t[r];
|
|
16015
16055
|
return n;
|
|
16016
|
-
},
|
|
16017
|
-
var r = n.length, i =
|
|
16056
|
+
}, _w = function(e, t, n) {
|
|
16057
|
+
var r = n.length, i = sw(t + 2);
|
|
16018
16058
|
e[i] = r & 255, e[i + 1] = r >> 8, e[i + 2] = e[i] ^ 255, e[i + 3] = e[i + 1] ^ 255;
|
|
16019
16059
|
for (var a = 0; a < r; ++a) e[i + a + 4] = n[a];
|
|
16020
16060
|
return (i + 4 + r) * 8;
|
|
16021
|
-
},
|
|
16022
|
-
|
|
16023
|
-
for (var d =
|
|
16061
|
+
}, vw = function(e, t, n, r, i, a, o, s, c, l, u) {
|
|
16062
|
+
dw(t, u++, n), ++i[256];
|
|
16063
|
+
for (var d = pw(i, 15), f = d.t, p = d.l, m = pw(a, 15), h = m.t, g = m.l, _ = hw(f), v = _.c, y = _.n, b = hw(h), x = b.c, S = b.n, C = new UC(19), w = 0; w < v.length; ++w) ++C[v[w] & 31];
|
|
16024
16064
|
for (var w = 0; w < x.length; ++w) ++C[x[w] & 31];
|
|
16025
|
-
for (var T =
|
|
16026
|
-
var re = l + 5 << 3, ie =
|
|
16027
|
-
if (c >= 0 && re <= ie && re <= E) return
|
|
16065
|
+
for (var T = pw(C, 7), ee = T.t, te = T.l, ne = 19; ne > 4 && !ee[qC[ne - 1]]; --ne);
|
|
16066
|
+
var re = l + 5 << 3, ie = gw(i, rw) + gw(a, iw) + o, E = gw(i, f) + gw(a, h) + o + 14 + 3 * ne + gw(C, ee) + 2 * C[16] + 3 * C[17] + 7 * C[18];
|
|
16067
|
+
if (c >= 0 && re <= ie && re <= E) return _w(t, u, e.subarray(c, c + l));
|
|
16028
16068
|
var ae, oe, D, se;
|
|
16029
|
-
if (
|
|
16030
|
-
ae =
|
|
16031
|
-
var ce =
|
|
16032
|
-
|
|
16033
|
-
for (var w = 0; w < ne; ++w)
|
|
16069
|
+
if (dw(t, u, 1 + (E < ie)), u += 2, E < ie) {
|
|
16070
|
+
ae = nw(f, p, 0), oe = f, D = nw(h, g, 0), se = h;
|
|
16071
|
+
var ce = nw(ee, te, 0);
|
|
16072
|
+
dw(t, u, y - 257), dw(t, u + 5, S - 1), dw(t, u + 10, ne - 4), u += 14;
|
|
16073
|
+
for (var w = 0; w < ne; ++w) dw(t, u + 3 * w, ee[qC[w]]);
|
|
16034
16074
|
u += 3 * ne;
|
|
16035
16075
|
for (var le = [v, x], ue = 0; ue < 2; ++ue) for (var de = le[ue], w = 0; w < de.length; ++w) {
|
|
16036
16076
|
var fe = de[w] & 31;
|
|
16037
|
-
|
|
16077
|
+
dw(t, u, ce[fe]), u += ee[fe], fe > 15 && (dw(t, u, de[w] >> 5 & 127), u += de[w] >> 12);
|
|
16038
16078
|
}
|
|
16039
|
-
} else ae =
|
|
16079
|
+
} else ae = aw, oe = rw, D = ow, se = iw;
|
|
16040
16080
|
for (var w = 0; w < s; ++w) {
|
|
16041
16081
|
var pe = r[w];
|
|
16042
16082
|
if (pe > 255) {
|
|
16043
16083
|
var fe = pe >> 18 & 31;
|
|
16044
|
-
|
|
16084
|
+
fw(t, u, ae[fe + 257]), u += oe[fe + 257], fe > 7 && (dw(t, u, pe >> 23 & 31), u += GC[fe]);
|
|
16045
16085
|
var me = pe & 31;
|
|
16046
|
-
|
|
16047
|
-
} else
|
|
16086
|
+
fw(t, u, D[me]), u += se[me], me > 3 && (fw(t, u, pe >> 5 & 8191), u += KC[me]);
|
|
16087
|
+
} else fw(t, u, ae[pe]), u += oe[pe];
|
|
16048
16088
|
}
|
|
16049
|
-
return
|
|
16050
|
-
},
|
|
16089
|
+
return fw(t, u, ae[256]), u + oe[256];
|
|
16090
|
+
}, yw = /*#__PURE__*/ new WC([
|
|
16051
16091
|
65540,
|
|
16052
16092
|
131080,
|
|
16053
16093
|
131088,
|
|
@@ -16057,18 +16097,18 @@ var rw = /*#__PURE__*/ ew(tw, 9, 0), iw = /*#__PURE__*/ ew(nw, 5, 0), aw = funct
|
|
|
16057
16097
|
1048832,
|
|
16058
16098
|
2114560,
|
|
16059
16099
|
2117632
|
|
16060
|
-
]),
|
|
16061
|
-
var o = a.z || e.length, s = new
|
|
16100
|
+
]), bw = /*#__PURE__*/ new HC(0), xw = function(e, t, n, r, i, a) {
|
|
16101
|
+
var o = a.z || e.length, s = new HC(r + o + 5 * (1 + Math.ceil(o / 7e3)) + i), c = s.subarray(r, s.length - i), l = a.l, u = (a.r || 0) & 7;
|
|
16062
16102
|
if (t) {
|
|
16063
16103
|
u && (c[0] = a.r >> 3);
|
|
16064
|
-
for (var d =
|
|
16104
|
+
for (var d = yw[t - 1], f = d >> 13, p = d & 8191, m = (1 << n) - 1, h = a.p || new UC(32768), g = a.h || new UC(m + 1), _ = Math.ceil(n / 3), v = 2 * _, y = function(t) {
|
|
16065
16105
|
return (e[t] ^ e[t + 1] << _ ^ e[t + 2] << v) & m;
|
|
16066
|
-
}, b = new
|
|
16106
|
+
}, b = new WC(25e3), x = new UC(288), S = new UC(32), C = 0, w = 0, T = a.i || 0, ee = 0, te = a.w || 0, ne = 0; T + 2 < o; ++T) {
|
|
16067
16107
|
var re = y(T), ie = T & 32767, E = g[re];
|
|
16068
16108
|
if (h[ie] = E, g[re] = ie, te <= T) {
|
|
16069
16109
|
var ae = o - T;
|
|
16070
16110
|
if ((C > 7e3 || ee > 24576) && (ae > 423 || !l)) {
|
|
16071
|
-
u =
|
|
16111
|
+
u = vw(e, c, 0, b, x, S, w, ee, ne, T - ne, u), ee = C = w = 0, ne = T;
|
|
16072
16112
|
for (var oe = 0; oe < 286; ++oe) x[oe] = 0;
|
|
16073
16113
|
for (var oe = 0; oe < 30; ++oe) S[oe] = 0;
|
|
16074
16114
|
}
|
|
@@ -16087,46 +16127,46 @@ var rw = /*#__PURE__*/ ew(tw, 9, 0), iw = /*#__PURE__*/ ew(nw, 5, 0), aw = funct
|
|
|
16087
16127
|
ie = E, E = h[ie], le += ie - E & 32767;
|
|
16088
16128
|
}
|
|
16089
16129
|
if (se) {
|
|
16090
|
-
b[ee++] = 268435456 |
|
|
16091
|
-
var ve =
|
|
16092
|
-
w +=
|
|
16130
|
+
b[ee++] = 268435456 | ZC[D] << 18 | $C[se];
|
|
16131
|
+
var ve = ZC[D] & 31, O = $C[se] & 31;
|
|
16132
|
+
w += GC[ve] + KC[O], ++x[257 + ve], ++S[O], te = T + D, ++C;
|
|
16093
16133
|
} else b[ee++] = e[T], ++x[e[T]];
|
|
16094
16134
|
}
|
|
16095
16135
|
}
|
|
16096
16136
|
for (T = Math.max(T, te); T < o; ++T) b[ee++] = e[T], ++x[e[T]];
|
|
16097
|
-
u =
|
|
16137
|
+
u = vw(e, c, l, b, x, S, w, ee, ne, T - ne, u), l || (a.r = u & 7 | c[u / 8 | 0] << 3, u -= 7, a.h = g, a.p = h, a.i = T, a.w = te);
|
|
16098
16138
|
} else {
|
|
16099
16139
|
for (var T = a.w || 0; T < o + l; T += 65535) {
|
|
16100
16140
|
var ye = T + 65535;
|
|
16101
|
-
ye >= o && (c[u / 8 | 0] = l, ye = o), u =
|
|
16141
|
+
ye >= o && (c[u / 8 | 0] = l, ye = o), u = _w(c, u + 1, e.subarray(T, ye));
|
|
16102
16142
|
}
|
|
16103
16143
|
a.i = o;
|
|
16104
16144
|
}
|
|
16105
|
-
return
|
|
16106
|
-
},
|
|
16145
|
+
return cw(s, 0, r + sw(u) + i);
|
|
16146
|
+
}, Sw = /*#__PURE__*/ (function() {
|
|
16107
16147
|
for (var e = /* @__PURE__ */ new Int32Array(256), t = 0; t < 256; ++t) {
|
|
16108
16148
|
for (var n = t, r = 9; --r;) n = (n & 1 && -306674912) ^ n >>> 1;
|
|
16109
16149
|
e[t] = n;
|
|
16110
16150
|
}
|
|
16111
16151
|
return e;
|
|
16112
|
-
})(),
|
|
16152
|
+
})(), Cw = function() {
|
|
16113
16153
|
var e = -1;
|
|
16114
16154
|
return {
|
|
16115
16155
|
p: function(t) {
|
|
16116
|
-
for (var n = e, r = 0; r < t.length; ++r) n =
|
|
16156
|
+
for (var n = e, r = 0; r < t.length; ++r) n = Sw[n & 255 ^ t[r]] ^ n >>> 8;
|
|
16117
16157
|
e = n;
|
|
16118
16158
|
},
|
|
16119
16159
|
d: function() {
|
|
16120
16160
|
return ~e;
|
|
16121
16161
|
}
|
|
16122
16162
|
};
|
|
16123
|
-
},
|
|
16163
|
+
}, ww = function(e, t, n, r, i) {
|
|
16124
16164
|
if (!i && (i = { l: 1 }, t.dictionary)) {
|
|
16125
|
-
var a = t.dictionary.subarray(-32768), o = new
|
|
16165
|
+
var a = t.dictionary.subarray(-32768), o = new HC(a.length + e.length);
|
|
16126
16166
|
o.set(a), o.set(e, a.length), e = o, i.w = a.length;
|
|
16127
16167
|
}
|
|
16128
|
-
return
|
|
16129
|
-
},
|
|
16168
|
+
return xw(e, t.level == null ? 6 : t.level, t.mem == null ? i.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(e.length))) * 1.5) : 20 : 12 + t.mem, n, r, i);
|
|
16169
|
+
}, Tw = function(e, t) {
|
|
16130
16170
|
var n = {};
|
|
16131
16171
|
for (var r in e) n[r] = e[r];
|
|
16132
16172
|
for (var r in t) n[r] = t[r];
|
|
@@ -16134,65 +16174,65 @@ var rw = /*#__PURE__*/ ew(tw, 9, 0), iw = /*#__PURE__*/ ew(nw, 5, 0), aw = funct
|
|
|
16134
16174
|
}, $ = function(e, t, n) {
|
|
16135
16175
|
for (; n; ++t) e[t] = n, n >>>= 8;
|
|
16136
16176
|
};
|
|
16137
|
-
function
|
|
16138
|
-
return
|
|
16177
|
+
function Ew(e, t) {
|
|
16178
|
+
return ww(e, t || {}, 0, 0);
|
|
16139
16179
|
}
|
|
16140
|
-
var
|
|
16180
|
+
var Dw = function(e, t, n, r) {
|
|
16141
16181
|
for (var i in e) {
|
|
16142
16182
|
var a = e[i], o = t + i, s = r;
|
|
16143
|
-
Array.isArray(a) && (s =
|
|
16183
|
+
Array.isArray(a) && (s = Tw(r, a[1]), a = a[0]), ArrayBuffer.isView(a) ? n[o] = [a, s] : (n[o += "/"] = [new HC(0), s], Dw(a, o, n, r));
|
|
16144
16184
|
}
|
|
16145
|
-
},
|
|
16185
|
+
}, Ow = typeof TextEncoder < "u" && /*#__PURE__*/ new TextEncoder(), kw = typeof TextDecoder < "u" && /*#__PURE__*/ new TextDecoder();
|
|
16146
16186
|
try {
|
|
16147
|
-
|
|
16187
|
+
kw.decode(bw, { stream: !0 });
|
|
16148
16188
|
} catch {}
|
|
16149
|
-
function
|
|
16189
|
+
function Aw(e, t) {
|
|
16150
16190
|
if (t) {
|
|
16151
|
-
for (var n = new
|
|
16191
|
+
for (var n = new HC(e.length), r = 0; r < e.length; ++r) n[r] = e.charCodeAt(r);
|
|
16152
16192
|
return n;
|
|
16153
16193
|
}
|
|
16154
|
-
if (
|
|
16155
|
-
for (var i = e.length, a = new
|
|
16194
|
+
if (Ow) return Ow.encode(e);
|
|
16195
|
+
for (var i = e.length, a = new HC(e.length + (e.length >> 1)), o = 0, s = function(e) {
|
|
16156
16196
|
a[o++] = e;
|
|
16157
16197
|
}, r = 0; r < i; ++r) {
|
|
16158
16198
|
if (o + 5 > a.length) {
|
|
16159
|
-
var c = new
|
|
16199
|
+
var c = new HC(o + 8 + (i - r << 1));
|
|
16160
16200
|
c.set(a), a = c;
|
|
16161
16201
|
}
|
|
16162
16202
|
var l = e.charCodeAt(r);
|
|
16163
16203
|
l < 128 || t ? s(l) : l < 2048 ? (s(192 | l >> 6), s(128 | l & 63)) : l > 55295 && l < 57344 ? (l = 65536 + (l & 1047552) | e.charCodeAt(++r) & 1023, s(240 | l >> 18), s(128 | l >> 12 & 63), s(128 | l >> 6 & 63), s(128 | l & 63)) : (s(224 | l >> 12), s(128 | l >> 6 & 63), s(128 | l & 63));
|
|
16164
16204
|
}
|
|
16165
|
-
return
|
|
16205
|
+
return cw(a, 0, o);
|
|
16166
16206
|
}
|
|
16167
|
-
var
|
|
16207
|
+
var jw = function(e) {
|
|
16168
16208
|
var t = 0;
|
|
16169
16209
|
if (e) for (var n in e) {
|
|
16170
16210
|
var r = e[n].length;
|
|
16171
|
-
r > 65535 &&
|
|
16211
|
+
r > 65535 && uw(9), t += r + 4;
|
|
16172
16212
|
}
|
|
16173
16213
|
return t;
|
|
16174
|
-
},
|
|
16175
|
-
var c = r.length, l = n.extra, u = s && s.length, d =
|
|
16214
|
+
}, Mw = function(e, t, n, r, i, a, o, s) {
|
|
16215
|
+
var c = r.length, l = n.extra, u = s && s.length, d = jw(l);
|
|
16176
16216
|
$(e, t, o == null ? 67324752 : 33639248), t += 4, o != null && (e[t++] = 20, e[t++] = n.os), e[t] = 20, t += 2, e[t++] = n.flag << 1 | (a < 0 && 8), e[t++] = i && 8, e[t++] = n.compression & 255, e[t++] = n.compression >> 8;
|
|
16177
16217
|
var f = new Date(n.mtime == null ? Date.now() : n.mtime), p = f.getFullYear() - 1980;
|
|
16178
|
-
if ((p < 0 || p > 119) &&
|
|
16218
|
+
if ((p < 0 || p > 119) && uw(10), $(e, t, p << 25 | f.getMonth() + 1 << 21 | f.getDate() << 16 | f.getHours() << 11 | f.getMinutes() << 5 | f.getSeconds() >> 1), t += 4, a != -1 && ($(e, t, n.crc), $(e, t + 4, a < 0 ? -a - 2 : a), $(e, t + 8, n.size)), $(e, t + 12, c), $(e, t + 14, d), t += 16, o != null && ($(e, t, u), $(e, t + 6, n.attrs), $(e, t + 10, o), t += 14), e.set(r, t), t += c, d) for (var m in l) {
|
|
16179
16219
|
var h = l[m], g = h.length;
|
|
16180
16220
|
$(e, t, +m), $(e, t + 2, g), e.set(h, t + 4), t += 4 + g;
|
|
16181
16221
|
}
|
|
16182
16222
|
return u && (e.set(s, t), t += u), t;
|
|
16183
|
-
},
|
|
16223
|
+
}, Nw = function(e, t, n, r, i) {
|
|
16184
16224
|
$(e, t, 101010256), $(e, t + 8, n), $(e, t + 10, n), $(e, t + 12, r), $(e, t + 16, i);
|
|
16185
16225
|
};
|
|
16186
|
-
function
|
|
16226
|
+
function Pw(e, t) {
|
|
16187
16227
|
t ||= {};
|
|
16188
16228
|
var n = {}, r = [];
|
|
16189
|
-
|
|
16229
|
+
Dw(e, "", n, t);
|
|
16190
16230
|
var i = 0, a = 0;
|
|
16191
16231
|
for (var o in n) {
|
|
16192
|
-
var s = n[o], c = s[0], l = s[1], u = l.level == 0 ? 0 : 8, d =
|
|
16193
|
-
f > 65535 &&
|
|
16194
|
-
var _ = u ?
|
|
16195
|
-
y.p(c), r.push(
|
|
16232
|
+
var s = n[o], c = s[0], l = s[1], u = l.level == 0 ? 0 : 8, d = Aw(o), f = d.length, p = l.comment, m = p && Aw(p), h = m && m.length, g = jw(l.extra);
|
|
16233
|
+
f > 65535 && uw(11);
|
|
16234
|
+
var _ = u ? Ew(c, l) : c, v = _.length, y = Cw();
|
|
16235
|
+
y.p(c), r.push(Tw(l, {
|
|
16196
16236
|
size: c.length,
|
|
16197
16237
|
crc: y.d(),
|
|
16198
16238
|
c: _,
|
|
@@ -16203,17 +16243,17 @@ function Mw(e, t) {
|
|
|
16203
16243
|
compression: u
|
|
16204
16244
|
})), i += 30 + f + g + v, a += 76 + 2 * (f + g) + (h || 0) + v;
|
|
16205
16245
|
}
|
|
16206
|
-
for (var b = new
|
|
16246
|
+
for (var b = new HC(a + 22), x = i, S = a - i, C = 0; C < r.length; ++C) {
|
|
16207
16247
|
var d = r[C];
|
|
16208
|
-
|
|
16209
|
-
var w = 30 + d.f.length +
|
|
16210
|
-
b.set(d.c, d.o + w),
|
|
16248
|
+
Mw(b, d.o, d, d.f, d.u, d.c.length);
|
|
16249
|
+
var w = 30 + d.f.length + jw(d.extra);
|
|
16250
|
+
b.set(d.c, d.o + w), Mw(b, i, d, d.f, d.u, d.c.length, d.o, d.m), i += 16 + w + (d.m ? d.m.length : 0);
|
|
16211
16251
|
}
|
|
16212
|
-
return
|
|
16252
|
+
return Nw(b, i, r.length, S, x), b;
|
|
16213
16253
|
}
|
|
16214
16254
|
//#endregion
|
|
16215
16255
|
//#region src/preview/archive.ts
|
|
16216
|
-
var
|
|
16256
|
+
var Fw = /* @__PURE__ */ new Set([
|
|
16217
16257
|
"png",
|
|
16218
16258
|
"jpg",
|
|
16219
16259
|
"jpeg",
|
|
@@ -16224,32 +16264,32 @@ var Nw = /* @__PURE__ */ new Set([
|
|
|
16224
16264
|
"woff2",
|
|
16225
16265
|
"mp4",
|
|
16226
16266
|
"webm"
|
|
16227
|
-
]),
|
|
16228
|
-
function
|
|
16267
|
+
]), Iw = Date.UTC(2e3, 0, 1);
|
|
16268
|
+
function Lw(e) {
|
|
16229
16269
|
let t = [...e].sort((e, t) => e.path < t.path ? -1 : +(e.path > t.path)), n = {}, r = m("sha256");
|
|
16230
16270
|
for (let e of t) {
|
|
16231
16271
|
let t = i(e.absolutePath), a = e.path.slice(e.path.lastIndexOf(".") + 1);
|
|
16232
16272
|
n[e.path] = [new Uint8Array(t), {
|
|
16233
|
-
level:
|
|
16234
|
-
mtime:
|
|
16273
|
+
level: Fw.has(a.toLowerCase()) ? 0 : 6,
|
|
16274
|
+
mtime: Iw
|
|
16235
16275
|
}], r.update(`${e.path}\0${m("sha256").update(t).digest("hex")}\n`);
|
|
16236
16276
|
}
|
|
16237
16277
|
return {
|
|
16238
|
-
zip:
|
|
16278
|
+
zip: Pw(n),
|
|
16239
16279
|
contentHash: r.digest("hex")
|
|
16240
16280
|
};
|
|
16241
16281
|
}
|
|
16242
16282
|
//#endregion
|
|
16243
16283
|
//#region src/preview/collect.ts
|
|
16244
|
-
var
|
|
16245
|
-
function
|
|
16284
|
+
var Rw = Rx;
|
|
16285
|
+
function zw(e) {
|
|
16246
16286
|
let t = [], r = [], i = (e, o) => {
|
|
16247
16287
|
for (let s of a(e, { withFileTypes: !0 })) {
|
|
16248
16288
|
let a = u(e, s.name), c = o ? `${o}/${s.name}` : s.name, l = n(a);
|
|
16249
|
-
l.isSymbolicLink() || (l.isDirectory() ? i(a, c) : l.isFile() && (
|
|
16289
|
+
l.isSymbolicLink() || (l.isDirectory() ? i(a, c) : l.isFile() && (Bx(c) ? t.push({
|
|
16250
16290
|
path: c,
|
|
16251
16291
|
size: l.size,
|
|
16252
|
-
contentType:
|
|
16292
|
+
contentType: Rw(c),
|
|
16253
16293
|
absolutePath: a
|
|
16254
16294
|
}) : r.push(c)));
|
|
16255
16295
|
}
|
|
@@ -16270,19 +16310,19 @@ function Lw(e) {
|
|
|
16270
16310
|
ok: !1,
|
|
16271
16311
|
reason: `${e} has no index.html at its root`
|
|
16272
16312
|
};
|
|
16273
|
-
if (t.length >
|
|
16313
|
+
if (t.length > Ix.maxFiles) return {
|
|
16274
16314
|
ok: !1,
|
|
16275
|
-
reason: `${t.length} files; the limit is ${
|
|
16315
|
+
reason: `${t.length} files; the limit is ${Ix.maxFiles}`
|
|
16276
16316
|
};
|
|
16277
|
-
let o = t.find((e) => e.size >
|
|
16317
|
+
let o = t.find((e) => e.size > Ix.maxFileBytes);
|
|
16278
16318
|
if (o) return {
|
|
16279
16319
|
ok: !1,
|
|
16280
|
-
reason: `${o.path} is ${Math.ceil(o.size / 1024 / 1024)} MB; the limit per file is ${
|
|
16320
|
+
reason: `${o.path} is ${Math.ceil(o.size / 1024 / 1024)} MB; the limit per file is ${Ix.maxFileBytes / 1024 / 1024} MB`
|
|
16281
16321
|
};
|
|
16282
16322
|
let s = t.reduce((e, t) => e + t.size, 0);
|
|
16283
|
-
return s >
|
|
16323
|
+
return s > Ix.maxTotalBytes ? {
|
|
16284
16324
|
ok: !1,
|
|
16285
|
-
reason: `the build is ${Math.ceil(s / 1024 / 1024)} MB; the limit is ${
|
|
16325
|
+
reason: `the build is ${Math.ceil(s / 1024 / 1024)} MB; the limit is ${Ix.maxTotalBytes / 1024 / 1024} MB`
|
|
16286
16326
|
} : {
|
|
16287
16327
|
ok: !0,
|
|
16288
16328
|
files: t
|
|
@@ -16290,9 +16330,9 @@ function Lw(e) {
|
|
|
16290
16330
|
}
|
|
16291
16331
|
//#endregion
|
|
16292
16332
|
//#region src/preview/publish.ts
|
|
16293
|
-
var
|
|
16294
|
-
async function
|
|
16295
|
-
let { io: t } = e, n = e.fetch ?? fetch, r = e.sleep ??
|
|
16333
|
+
var Bw = 3, Vw = 500, Hw = (e) => new Promise((t) => setTimeout(t, e));
|
|
16334
|
+
async function Uw(e) {
|
|
16335
|
+
let { io: t } = e, n = e.fetch ?? fetch, r = e.sleep ?? Hw, i = zw(e.dir);
|
|
16296
16336
|
if (i.ok === !1) return {
|
|
16297
16337
|
status: "invalid-build",
|
|
16298
16338
|
reason: i.reason
|
|
@@ -16305,23 +16345,23 @@ async function Vw(e) {
|
|
|
16305
16345
|
};
|
|
16306
16346
|
};
|
|
16307
16347
|
if (!e.bridgeUrl) return a("no bridge configured (set enrich.bridgeUrl or SYNCLINE_URL)", !0);
|
|
16308
|
-
let o = e.bridgeUrl.replace(/\/$/, ""), s = await
|
|
16348
|
+
let o = e.bridgeUrl.replace(/\/$/, ""), s = await rS({
|
|
16309
16349
|
audience: e.audience ?? o,
|
|
16310
16350
|
env: e.env,
|
|
16311
16351
|
fetch: e.fetch
|
|
16312
16352
|
});
|
|
16313
16353
|
if (s.ok === !1) return a(s.reason);
|
|
16314
|
-
let c =
|
|
16354
|
+
let c = nS({
|
|
16315
16355
|
baseUrl: o,
|
|
16316
16356
|
token: s.token,
|
|
16317
16357
|
fetch: e.fetch,
|
|
16318
16358
|
sleep: e.sleep
|
|
16319
16359
|
});
|
|
16320
16360
|
try {
|
|
16321
|
-
let { zip: e, contentHash: o } =
|
|
16322
|
-
if (e.length >
|
|
16361
|
+
let { zip: e, contentHash: o } = Lw(i.files);
|
|
16362
|
+
if (e.length > Ix.maxArchiveBytes) return {
|
|
16323
16363
|
status: "invalid-build",
|
|
16324
|
-
reason: `the archive is ${Math.ceil(e.length / 1024 / 1024)} MB; the limit is ${
|
|
16364
|
+
reason: `the archive is ${Math.ceil(e.length / 1024 / 1024)} MB; the limit is ${Ix.maxArchiveBytes / 1024 / 1024} MB`
|
|
16325
16365
|
};
|
|
16326
16366
|
let { uploads: s } = await c.createPreviewUpload({
|
|
16327
16367
|
files: i.files.map(({ path: e, size: t, contentType: n }) => ({
|
|
@@ -16335,7 +16375,7 @@ async function Vw(e) {
|
|
|
16335
16375
|
}
|
|
16336
16376
|
});
|
|
16337
16377
|
for (let t of s) {
|
|
16338
|
-
let i = await
|
|
16378
|
+
let i = await Ww(n, r, t.url, t.headers, e);
|
|
16339
16379
|
if (i) return a(`the archive could not be uploaded (${i})`);
|
|
16340
16380
|
}
|
|
16341
16381
|
let { storybookUrl: l } = await c.completePreview({ contentHash: o });
|
|
@@ -16345,13 +16385,13 @@ async function Vw(e) {
|
|
|
16345
16385
|
files: i.files.length
|
|
16346
16386
|
};
|
|
16347
16387
|
} catch (e) {
|
|
16348
|
-
return e instanceof
|
|
16388
|
+
return e instanceof Xx ? a(e.message) : a(e instanceof Error ? e.message : String(e));
|
|
16349
16389
|
}
|
|
16350
16390
|
}
|
|
16351
|
-
async function
|
|
16391
|
+
async function Ww(e, t, n, r, i) {
|
|
16352
16392
|
let a = "unknown error";
|
|
16353
|
-
for (let o = 0; o <
|
|
16354
|
-
o > 0 && await t(
|
|
16393
|
+
for (let o = 0; o < Bw; o++) {
|
|
16394
|
+
o > 0 && await t(Vw * 2 ** (o - 1));
|
|
16355
16395
|
try {
|
|
16356
16396
|
let t = await e(n, {
|
|
16357
16397
|
method: "PUT",
|
|
@@ -16369,7 +16409,7 @@ async function Hw(e, t, n, r, i) {
|
|
|
16369
16409
|
}
|
|
16370
16410
|
//#endregion
|
|
16371
16411
|
//#region src/commands/preview.ts
|
|
16372
|
-
var
|
|
16412
|
+
var Gw = `Usage: syncline preview publish [options]
|
|
16373
16413
|
|
|
16374
16414
|
Uploads a built Storybook to the bridge, which hosts it until the pull request
|
|
16375
16415
|
closes and shows the link next to the sync in the Figma plugin (paid feature).
|
|
@@ -16382,12 +16422,12 @@ Options:
|
|
|
16382
16422
|
--cwd <dir> Project root (default: the current directory)
|
|
16383
16423
|
-h, --help Show this help
|
|
16384
16424
|
`;
|
|
16385
|
-
function
|
|
16425
|
+
function Kw(e) {
|
|
16386
16426
|
let t = { help: !1 };
|
|
16387
16427
|
for (let n = 0; n < e.length; n++) {
|
|
16388
16428
|
let r = (t) => {
|
|
16389
16429
|
let r = e[++n];
|
|
16390
|
-
if (r === void 0 || r.startsWith("-")) throw Error(`${t} needs a value\n\n${
|
|
16430
|
+
if (r === void 0 || r.startsWith("-")) throw Error(`${t} needs a value\n\n${Gw}`);
|
|
16391
16431
|
return r;
|
|
16392
16432
|
};
|
|
16393
16433
|
switch (e[n]) {
|
|
@@ -16405,8 +16445,8 @@ function Ww(e) {
|
|
|
16405
16445
|
t.help = !0;
|
|
16406
16446
|
break;
|
|
16407
16447
|
default:
|
|
16408
|
-
if (e[n].startsWith("-")) throw Error(`Unknown option: ${e[n]}\n\n${
|
|
16409
|
-
if (t.action !== void 0) throw Error(`Unexpected argument: ${e[n]}\n\n${
|
|
16448
|
+
if (e[n].startsWith("-")) throw Error(`Unknown option: ${e[n]}\n\n${Gw}`);
|
|
16449
|
+
if (t.action !== void 0) throw Error(`Unexpected argument: ${e[n]}\n\n${Gw}`);
|
|
16410
16450
|
t.action = e[n];
|
|
16411
16451
|
}
|
|
16412
16452
|
}
|
|
@@ -16414,15 +16454,15 @@ function Ww(e) {
|
|
|
16414
16454
|
}
|
|
16415
16455
|
//#endregion
|
|
16416
16456
|
//#region src/commands/index.ts
|
|
16417
|
-
var
|
|
16418
|
-
|
|
16457
|
+
var qw = [
|
|
16458
|
+
DC,
|
|
16419
16459
|
{
|
|
16420
16460
|
name: "preview",
|
|
16421
16461
|
summary: "Publish a built Storybook as a pull request preview (paid)",
|
|
16422
16462
|
async run({ args: n, io: r }) {
|
|
16423
|
-
let a =
|
|
16424
|
-
if (a.help || a.action === void 0) return r.out(
|
|
16425
|
-
if (a.action !== "publish") return r.err(`Unknown preview command: ${a.action}\n\n${
|
|
16463
|
+
let a = Kw(n);
|
|
16464
|
+
if (a.help || a.action === void 0) return r.out(Gw), +!a.help;
|
|
16465
|
+
if (a.action !== "publish") return r.err(`Unknown preview command: ${a.action}\n\n${Gw}`), 1;
|
|
16426
16466
|
let o = d(a.cwd ?? process.cwd()), s = d(o, a.config ?? "syncline.config.json"), c = {};
|
|
16427
16467
|
if (t(s)) try {
|
|
16428
16468
|
c = JSON.parse(i(s, "utf-8"));
|
|
@@ -16432,28 +16472,28 @@ var Gw = [
|
|
|
16432
16472
|
let l = Ab.safeParse(c);
|
|
16433
16473
|
if (!l.success) return r.err(`Invalid config ${s}:\n${Mb(l.error)}\n`), 1;
|
|
16434
16474
|
let u = {
|
|
16435
|
-
bridgeUrl:
|
|
16475
|
+
bridgeUrl: xS({
|
|
16436
16476
|
env: process.env,
|
|
16437
16477
|
configured: l.data.enrich.bridgeUrl,
|
|
16438
16478
|
baked: _
|
|
16439
16479
|
}),
|
|
16440
16480
|
audience: l.data.enrich.audience,
|
|
16441
16481
|
io: r
|
|
16442
|
-
}, f = await
|
|
16482
|
+
}, f = await Uw({
|
|
16443
16483
|
dir: d(o, a.dir ?? "storybook-static"),
|
|
16444
16484
|
...u
|
|
16445
16485
|
});
|
|
16446
16486
|
return f.status === "published" && process.env.GITHUB_OUTPUT && e(process.env.GITHUB_OUTPUT, `url=${f.url}\n`), f.status === "invalid-build" ? (r.err(`Preview: ${f.reason}\n`), 1) : 0;
|
|
16447
16487
|
}
|
|
16448
16488
|
},
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
],
|
|
16452
|
-
function
|
|
16489
|
+
wS,
|
|
16490
|
+
VC
|
|
16491
|
+
], Jw = "syncline";
|
|
16492
|
+
function Yw(e) {
|
|
16453
16493
|
return [
|
|
16454
|
-
`${
|
|
16494
|
+
`${Jw} v${v}`,
|
|
16455
16495
|
"",
|
|
16456
|
-
`Usage: ${
|
|
16496
|
+
`Usage: ${Jw} <command> [options]`,
|
|
16457
16497
|
"",
|
|
16458
16498
|
"Commands:",
|
|
16459
16499
|
...e.length ? e.map((e) => ` ${e.name.padEnd(14)}${e.summary}`) : [" (none yet)"],
|
|
@@ -16464,12 +16504,12 @@ function qw(e) {
|
|
|
16464
16504
|
""
|
|
16465
16505
|
].join("\n");
|
|
16466
16506
|
}
|
|
16467
|
-
async function
|
|
16507
|
+
async function Xw(e, t, n = qw) {
|
|
16468
16508
|
let [r, ...i] = e;
|
|
16469
|
-
if (r === void 0 || r === "-h" || r === "--help") return t.out(
|
|
16509
|
+
if (r === void 0 || r === "-h" || r === "--help") return t.out(Yw(n)), 0;
|
|
16470
16510
|
if (r === "-v" || r === "--version") return t.out(`${v}\n`), 0;
|
|
16471
16511
|
let a = n.find((e) => e.name === r);
|
|
16472
|
-
if (!a) return t.err(`Unknown command: ${r}\n\n${
|
|
16512
|
+
if (!a) return t.err(`Unknown command: ${r}\n\n${Yw(n)}`), 1;
|
|
16473
16513
|
try {
|
|
16474
16514
|
return await a.run({
|
|
16475
16515
|
args: i,
|
|
@@ -16480,4 +16520,4 @@ async function Jw(e, t, n = Gw) {
|
|
|
16480
16520
|
}
|
|
16481
16521
|
}
|
|
16482
16522
|
//#endregion
|
|
16483
|
-
export {
|
|
16523
|
+
export { yC as a, zS as c, rS as d, Xx as f, v as g, jb as h, wC as i, RS as l, Ab as m, Yw as n, tC as o, nS as p, Xw as r, HS as s, Jw as t, PS as u };
|