sv 1.0.0-next.7 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{addons-DWX20ipF.mjs → addons-So36TZLY.mjs} +299 -230
- package/dist/bin.d.mts +1 -1
- package/dist/bin.mjs +145 -95
- package/dist/{engine-BKdrqoIo.d.mts → engine-D2x5kvrf.d.mts} +146 -135
- package/dist/{engine-w0Kq5hjN.mjs → engine-Do1htOYy.mjs} +131 -91
- package/dist/shared.json +2 -2
- package/dist/src/index.d.mts +3 -7
- package/dist/src/index.mjs +2 -2
- package/dist/src/testing.d.mts +26 -37
- package/dist/src/testing.mjs +48 -34
- package/dist/templates/addon/package.json +3 -3
- package/dist/templates/demo/files.types=checkjs.json +1 -1
- package/dist/templates/demo/files.types=none.json +1 -1
- package/dist/templates/demo/files.types=typescript.json +1 -1
- package/dist/templates/demo/package.json +3 -3
- package/dist/templates/library/package.json +3 -3
- package/dist/templates/minimal/package.json +3 -3
- package/package.json +14 -3
- package/dist/templates/demo/assets/src/lib/images/svelte-welcome.webp +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import fs, { closeSync, existsSync, openSync, readSync, statSync } from "node:fs";
|
|
3
3
|
import path, { basename, delimiter, dirname, isAbsolute, join, normalize, resolve } from "node:path";
|
|
4
|
-
import { AGENTS, color, detect, fileExists, isRangeWithin, isVersionUnsupportedBelow, js, loadFile, loadPackageJson, minVersion, minimizeDiff, pnpm, resolveCommand, resolveCommandArray, sanitizeName, saveFile, svelteConfig, transforms } from "@sveltejs/sv-utils";
|
|
4
|
+
import { AGENTS, color, commandExists, detect, fileExists, isRangeWithin, isVersionUnsupportedBelow, js, loadFile, loadPackageJson, minVersion, minimizeDiff, pnpm, resolveCommand, resolveCommandArray, sanitizeName, saveFile, svelteConfig, transforms } from "@sveltejs/sv-utils";
|
|
5
5
|
import V, { cwd, stdin, stdout } from "node:process";
|
|
6
6
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
7
7
|
import * as b from "node:readline";
|
|
@@ -30,7 +30,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
30
30
|
}
|
|
31
31
|
return to;
|
|
32
32
|
};
|
|
33
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
34
34
|
value: mod,
|
|
35
35
|
enumerable: true
|
|
36
36
|
}) : target, mod));
|
|
@@ -441,7 +441,8 @@ function Y$1(r, t) {
|
|
|
441
441
|
numLines: i
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
|
-
const q
|
|
444
|
+
const q = globalThis.process.platform.startsWith("win");
|
|
445
|
+
const k = Symbol("clack:cancel");
|
|
445
446
|
function R$1(r) {
|
|
446
447
|
return r === k;
|
|
447
448
|
}
|
|
@@ -475,10 +476,11 @@ function W({ input: r = stdin, output: t = stdout, overwrite: s = !0, hideCursor
|
|
|
475
476
|
});
|
|
476
477
|
};
|
|
477
478
|
return e && t.write(import_src.cursor.hide), r.once("keypress", n), () => {
|
|
478
|
-
r.off("keypress", n), e && t.write(import_src.cursor.show), r instanceof ReadStream && r.isTTY && !q
|
|
479
|
+
r.off("keypress", n), e && t.write(import_src.cursor.show), r instanceof ReadStream && r.isTTY && !q && r.setRawMode(!1), i.terminal = !1, i.close();
|
|
479
480
|
};
|
|
480
481
|
}
|
|
481
|
-
const A = (r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80
|
|
482
|
+
const A = (r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80;
|
|
483
|
+
const L = (r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20;
|
|
482
484
|
function B(r, t, s, e = s, i = s, n) {
|
|
483
485
|
return wrapAnsi(t, A(r ?? stdout) - s.length, {
|
|
484
486
|
hard: !0,
|
|
@@ -704,9 +706,7 @@ let ut$1 = class extends m {
|
|
|
704
706
|
case "right":
|
|
705
707
|
this.cursor = f(this.cursor, 1, this.options);
|
|
706
708
|
break;
|
|
707
|
-
case "space":
|
|
708
|
-
this.toggleValue();
|
|
709
|
-
break;
|
|
709
|
+
case "space": this.toggleValue();
|
|
710
710
|
}
|
|
711
711
|
});
|
|
712
712
|
}
|
|
@@ -730,9 +730,7 @@ var ht$1 = class extends m {
|
|
|
730
730
|
this.cursor = f(this.cursor, -1, this.options);
|
|
731
731
|
break;
|
|
732
732
|
case "down":
|
|
733
|
-
case "right":
|
|
734
|
-
this.cursor = f(this.cursor, 1, this.options);
|
|
735
|
-
break;
|
|
733
|
+
case "right": this.cursor = f(this.cursor, 1, this.options);
|
|
736
734
|
}
|
|
737
735
|
this.changeValue();
|
|
738
736
|
});
|
|
@@ -765,7 +763,32 @@ var ct$1 = class extends m {
|
|
|
765
763
|
function se() {
|
|
766
764
|
return V.platform !== "win32" ? V.env.TERM !== "linux" : !!V.env.CI || !!V.env.WT_SESSION || !!V.env.TERMINUS_SUBLIME || V.env.ConEmuTask === "{cmd::Cmder}" || V.env.TERM_PROGRAM === "Terminus-Sublime" || V.env.TERM_PROGRAM === "vscode" || V.env.TERM === "xterm-256color" || V.env.TERM === "alacritty" || V.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
767
765
|
}
|
|
768
|
-
const tt = se()
|
|
766
|
+
const tt = se();
|
|
767
|
+
const at = () => process.env.CI === "true";
|
|
768
|
+
const Tt = (t) => t.isTTY === !0;
|
|
769
|
+
const w = (t, i) => tt ? t : i;
|
|
770
|
+
const _t = w("◆", "*");
|
|
771
|
+
const ut = w("■", "x");
|
|
772
|
+
const lt = w("▲", "x");
|
|
773
|
+
const H = w("◇", "o");
|
|
774
|
+
const ct = w("┌", "T");
|
|
775
|
+
const $ = w("│", "|");
|
|
776
|
+
const x$1 = w("└", "—");
|
|
777
|
+
const z = w("●", ">");
|
|
778
|
+
const U = w("○", " ");
|
|
779
|
+
const et = w("◻", "[•]");
|
|
780
|
+
const K = w("◼", "[+]");
|
|
781
|
+
const Y = w("◻", "[ ]");
|
|
782
|
+
const st = w("─", "-");
|
|
783
|
+
const $t = w("╮", "+");
|
|
784
|
+
const Mt = w("├", "+");
|
|
785
|
+
const dt = w("╯", "+");
|
|
786
|
+
const ht = w("╰", "+");
|
|
787
|
+
const pt = w("●", "•");
|
|
788
|
+
const mt = w("◆", "*");
|
|
789
|
+
const gt = w("▲", "!");
|
|
790
|
+
const yt = w("■", "x");
|
|
791
|
+
const P = (t) => {
|
|
769
792
|
switch (t) {
|
|
770
793
|
case "initial":
|
|
771
794
|
case "active": return styleText("cyan", _t);
|
|
@@ -773,7 +796,8 @@ const tt = se(), at = () => process.env.CI === "true", Tt = (t) => t.isTTY === !
|
|
|
773
796
|
case "error": return styleText("yellow", lt);
|
|
774
797
|
case "submit": return styleText("green", H);
|
|
775
798
|
}
|
|
776
|
-
}
|
|
799
|
+
};
|
|
800
|
+
const ft = (t) => {
|
|
777
801
|
switch (t) {
|
|
778
802
|
case "initial":
|
|
779
803
|
case "active": return styleText("cyan", $);
|
|
@@ -781,7 +805,8 @@ const tt = se(), at = () => process.env.CI === "true", Tt = (t) => t.isTTY === !
|
|
|
781
805
|
case "error": return styleText("yellow", $);
|
|
782
806
|
case "submit": return styleText("green", $);
|
|
783
807
|
}
|
|
784
|
-
}
|
|
808
|
+
};
|
|
809
|
+
const Pt = (t, i, s, r, u, n = !1) => {
|
|
785
810
|
let a = i, c = 0;
|
|
786
811
|
if (n) for (let o = r - 1; o >= s && (a -= t[o].length, c++, !(a <= u)); o--);
|
|
787
812
|
else for (let o = s; o < r && (a -= t[o].length, c++, !(a <= u)); o++);
|
|
@@ -789,7 +814,8 @@ const tt = se(), at = () => process.env.CI === "true", Tt = (t) => t.isTTY === !
|
|
|
789
814
|
lineCount: a,
|
|
790
815
|
removals: c
|
|
791
816
|
};
|
|
792
|
-
}
|
|
817
|
+
};
|
|
818
|
+
const F = ({ cursor: t, options: i, style: s, output: r = process.stdout, maxItems: u = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: a = 4 }) => {
|
|
793
819
|
const c = A(r) - n, o = L(r), l = styleText("dim", "..."), d = Math.max(o - a, 0), g = Math.max(Math.min(u, d), 5);
|
|
794
820
|
let p = 0;
|
|
795
821
|
t >= g - 3 && (p = Math.max(Math.min(t - g + 3, i.length - g), 0));
|
|
@@ -846,7 +872,8 @@ ${d}
|
|
|
846
872
|
}
|
|
847
873
|
}
|
|
848
874
|
}).prompt();
|
|
849
|
-
}
|
|
875
|
+
};
|
|
876
|
+
const pe = async (t, i) => {
|
|
850
877
|
const s = {}, r = Object.keys(t);
|
|
851
878
|
for (const u of r) {
|
|
852
879
|
const n = t[u], a = await n({ results: s })?.catch((c) => {
|
|
@@ -859,7 +886,8 @@ ${d}
|
|
|
859
886
|
s[u] = a;
|
|
860
887
|
}
|
|
861
888
|
return s;
|
|
862
|
-
}
|
|
889
|
+
};
|
|
890
|
+
const R = {
|
|
863
891
|
message: (t = [], { symbol: i = styleText("gray", $), secondarySymbol: s = styleText("gray", $), output: r = process.stdout, spacing: u = 1, withGuide: n } = {}) => {
|
|
864
892
|
const a = [], c = n ?? h.withGuide, o = c ? s : "", l = c ? `${i} ` : "", d = c ? `${s} ` : "";
|
|
865
893
|
for (let p = 0; p < u; p++) a.push(o);
|
|
@@ -907,24 +935,29 @@ ${d}
|
|
|
907
935
|
symbol: styleText("red", yt)
|
|
908
936
|
});
|
|
909
937
|
}
|
|
910
|
-
}
|
|
938
|
+
};
|
|
939
|
+
const ge = (t = "", i) => {
|
|
911
940
|
const s = i?.output ?? process.stdout, r = i?.withGuide ?? h.withGuide ? `${styleText("gray", x$1)} ` : "";
|
|
912
941
|
s.write(`${r}${styleText("red", t)}
|
|
913
942
|
|
|
914
943
|
`);
|
|
915
|
-
}
|
|
944
|
+
};
|
|
945
|
+
const ye = (t = "", i) => {
|
|
916
946
|
const s = i?.output ?? process.stdout, r = i?.withGuide ?? h.withGuide ? `${styleText("gray", ct)} ` : "";
|
|
917
947
|
s.write(`${r}${t}
|
|
918
948
|
`);
|
|
919
|
-
}
|
|
949
|
+
};
|
|
950
|
+
const fe = (t = "", i) => {
|
|
920
951
|
const s = i?.output ?? process.stdout, r = i?.withGuide ?? h.withGuide ? `${styleText("gray", $)}
|
|
921
952
|
${styleText("gray", x$1)} ` : "";
|
|
922
953
|
s.write(`${r}${t}
|
|
923
954
|
|
|
924
955
|
`);
|
|
925
|
-
}
|
|
956
|
+
};
|
|
957
|
+
const Q = (t, i) => t.split(`
|
|
926
958
|
`).map((s) => i(s)).join(`
|
|
927
|
-
`)
|
|
959
|
+
`);
|
|
960
|
+
const we = (t) => {
|
|
928
961
|
const i = (r, u) => {
|
|
929
962
|
const n = r.label ?? String(r.value);
|
|
930
963
|
return u === "disabled" ? `${styleText("gray", Y)} ${Q(n, (a) => styleText(["strikethrough", "gray"], a))}${r.hint ? ` ${styleText("dim", `(${r.hint ?? "disabled"})`)}` : ""}` : u === "active" ? `${styleText("cyan", et)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "selected" ? `${styleText("green", K)} ${Q(n, (a) => styleText("dim", a))}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "cancelled" ? `${Q(n, (a) => styleText(["strikethrough", "dim"], a))}` : u === "active-selected" ? `${styleText("green", K)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "submitted" ? `${Q(n, (a) => styleText("dim", a))}` : `${styleText("dim", Y)} ${Q(n, (a) => styleText("dim", a))}`;
|
|
@@ -1002,14 +1035,17 @@ ${r ? styleText("cyan", x$1) : ""}
|
|
|
1002
1035
|
}
|
|
1003
1036
|
}
|
|
1004
1037
|
}).prompt();
|
|
1005
|
-
}
|
|
1038
|
+
};
|
|
1039
|
+
const be = (t) => styleText("dim", t);
|
|
1040
|
+
const Se = (t, i, s) => {
|
|
1006
1041
|
const r = {
|
|
1007
1042
|
hard: !0,
|
|
1008
1043
|
trim: !1
|
|
1009
1044
|
}, u = wrapAnsi(t, i, r).split(`
|
|
1010
1045
|
`), n = u.reduce((o, l) => Math.max(fastStringWidth(l), o), 0);
|
|
1011
1046
|
return wrapAnsi(t, i - (u.map(s).reduce((o, l) => Math.max(fastStringWidth(l), o), 0) - n), r);
|
|
1012
|
-
}
|
|
1047
|
+
};
|
|
1048
|
+
const Ce = (t = "", i = "", s) => {
|
|
1013
1049
|
const r = s?.output ?? V.stdout, u = s?.withGuide ?? h.withGuide, n = s?.format ?? be, a = [
|
|
1014
1050
|
"",
|
|
1015
1051
|
...Se(t, A(r) - 6, n).split(`
|
|
@@ -1025,7 +1061,9 @@ ${r ? styleText("cyan", x$1) : ""}
|
|
|
1025
1061
|
${l}
|
|
1026
1062
|
${styleText("gray", g + st.repeat(o + 2) + dt)}
|
|
1027
1063
|
`);
|
|
1028
|
-
}
|
|
1064
|
+
};
|
|
1065
|
+
const _e = (t) => styleText("magenta", t);
|
|
1066
|
+
const vt = ({ indicator: t = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u, frames: n = tt ? [
|
|
1029
1067
|
"◒",
|
|
1030
1068
|
"◐",
|
|
1031
1069
|
"◓",
|
|
@@ -1100,10 +1138,12 @@ ${styleText("gray", g + st.repeat(o + 2) + dt)}
|
|
|
1100
1138
|
return f;
|
|
1101
1139
|
}
|
|
1102
1140
|
};
|
|
1103
|
-
}
|
|
1141
|
+
};
|
|
1142
|
+
const it = (t, i) => t.includes(`
|
|
1104
1143
|
`) ? t.split(`
|
|
1105
1144
|
`).map((s) => i(s)).join(`
|
|
1106
|
-
`) : i(t)
|
|
1145
|
+
`) : i(t);
|
|
1146
|
+
const Ee = (t) => {
|
|
1107
1147
|
const i = (s, r) => {
|
|
1108
1148
|
const u = s.label ?? String(s.value);
|
|
1109
1149
|
switch (r) {
|
|
@@ -1153,30 +1193,10 @@ ${o}
|
|
|
1153
1193
|
}
|
|
1154
1194
|
}
|
|
1155
1195
|
}).prompt();
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
let s = 3;
|
|
1161
|
-
for await (let r of t) {
|
|
1162
|
-
r = r.replace(/\n/g, `
|
|
1163
|
-
${Bt}`), r.includes(`
|
|
1164
|
-
`) && (s = 3 + stripVTControlCharacters(r.slice(r.lastIndexOf(`
|
|
1165
|
-
`))).length);
|
|
1166
|
-
const u = stripVTControlCharacters(r).length;
|
|
1167
|
-
s + u < process.stdout.columns ? (s += u, process.stdout.write(r)) : (process.stdout.write(`
|
|
1168
|
-
${Bt}${r.trimStart()}`), s = 3 + stripVTControlCharacters(r.trimStart()).length);
|
|
1169
|
-
}
|
|
1170
|
-
process.stdout.write(`
|
|
1171
|
-
`);
|
|
1172
|
-
},
|
|
1173
|
-
info: (t) => q.message(t, { symbol: styleText("blue", pt) }),
|
|
1174
|
-
success: (t) => q.message(t, { symbol: styleText("green", mt) }),
|
|
1175
|
-
step: (t) => q.message(t, { symbol: styleText("green", H) }),
|
|
1176
|
-
warn: (t) => q.message(t, { symbol: styleText("yellow", gt) }),
|
|
1177
|
-
warning: (t) => q.warn(t),
|
|
1178
|
-
error: (t) => q.message(t, { symbol: styleText("red", yt) })
|
|
1179
|
-
}, Oe = (t) => t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), Pe = (t) => {
|
|
1196
|
+
};
|
|
1197
|
+
`${styleText("gray", $)}`;
|
|
1198
|
+
const Oe = (t) => t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, "");
|
|
1199
|
+
const Pe = (t) => {
|
|
1180
1200
|
const i = t.output ?? process.stdout, s = A(i), r = styleText("gray", $), u = t.spacing ?? 1, n = 3, a = t.retainLog === !0, c = !at() && Tt(i);
|
|
1181
1201
|
i.write(`${r}
|
|
1182
1202
|
`), i.write(`${styleText("green", H)} ${t.title}
|
|
@@ -1295,7 +1315,8 @@ ${m.value}` : m.value;
|
|
|
1295
1315
|
}), y?.showLog === !0 && p(), o.splice(1, o.length - 1), o[0].value = "", o[0].full = "";
|
|
1296
1316
|
}
|
|
1297
1317
|
};
|
|
1298
|
-
}
|
|
1318
|
+
};
|
|
1319
|
+
const Re = (t) => new ct$1({
|
|
1299
1320
|
validate: t.validate,
|
|
1300
1321
|
placeholder: t.placeholder,
|
|
1301
1322
|
defaultValue: t.defaultValue,
|
|
@@ -1395,7 +1416,6 @@ var Argument = class {
|
|
|
1395
1416
|
default:
|
|
1396
1417
|
this.required = true;
|
|
1397
1418
|
this._name = name;
|
|
1398
|
-
break;
|
|
1399
1419
|
}
|
|
1400
1420
|
if (this._name.endsWith("...")) {
|
|
1401
1421
|
this.variadic = true;
|
|
@@ -2850,16 +2870,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2850
2870
|
const oldValue = this.getOptionValue(name);
|
|
2851
2871
|
if (val !== null && option.parseArg) val = this._callParseArg(option, val, oldValue, invalidValueMessage);
|
|
2852
2872
|
else if (val !== null && option.variadic) val = option._collectValue(val, oldValue);
|
|
2853
|
-
if (val == null)
|
|
2854
|
-
|
|
2855
|
-
|
|
2873
|
+
if (val == null) {
|
|
2874
|
+
if (option.negate) val = false;
|
|
2875
|
+
else if (option.isBoolean() || option.optional) val = true;
|
|
2876
|
+
else val = "";
|
|
2877
|
+
}
|
|
2856
2878
|
this.setOptionValueWithSource(name, val, valueSource);
|
|
2857
2879
|
};
|
|
2858
2880
|
this.on("option:" + oname, (val) => {
|
|
2859
|
-
|
|
2881
|
+
const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;
|
|
2882
|
+
handleOptionValue(val, invalidValueMessage, "cli");
|
|
2860
2883
|
});
|
|
2861
2884
|
if (option.envVar) this.on("optionEnv:" + oname, (val) => {
|
|
2862
|
-
|
|
2885
|
+
const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;
|
|
2886
|
+
handleOptionValue(val, invalidValueMessage, "env");
|
|
2863
2887
|
});
|
|
2864
2888
|
return this;
|
|
2865
2889
|
}
|
|
@@ -3254,12 +3278,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3254
3278
|
}
|
|
3255
3279
|
const launchWithNode = sourceExt.includes(path.extname(executableFile));
|
|
3256
3280
|
let proc;
|
|
3257
|
-
if (V.platform !== "win32")
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3281
|
+
if (V.platform !== "win32") {
|
|
3282
|
+
if (launchWithNode) {
|
|
3283
|
+
args.unshift(executableFile);
|
|
3284
|
+
args = incrementNodeInspectorPort(V.execArgv).concat(args);
|
|
3285
|
+
proc = childProcess.spawn(V.argv[0], args, { stdio: "inherit" });
|
|
3286
|
+
} else proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
|
|
3287
|
+
} else {
|
|
3263
3288
|
this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
3264
3289
|
args.unshift(executableFile);
|
|
3265
3290
|
args = incrementNodeInspectorPort(V.execArgv).concat(args);
|
|
@@ -3703,8 +3728,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3703
3728
|
"default",
|
|
3704
3729
|
"config",
|
|
3705
3730
|
"env"
|
|
3706
|
-
].includes(this.getOptionValueSource(optionKey)))
|
|
3707
|
-
|
|
3731
|
+
].includes(this.getOptionValueSource(optionKey))) {
|
|
3732
|
+
if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, V.env[option.envVar]);
|
|
3733
|
+
else this.emit(`optionEnv:${option.name()}`);
|
|
3734
|
+
}
|
|
3708
3735
|
}
|
|
3709
3736
|
});
|
|
3710
3737
|
}
|
|
@@ -4993,7 +5020,12 @@ function safeParse(schema, input, config$1) {
|
|
|
4993
5020
|
//#endregion
|
|
4994
5021
|
//#region package.json
|
|
4995
5022
|
var name = "sv";
|
|
4996
|
-
var version = "1.0.0
|
|
5023
|
+
var version = "1.0.0";
|
|
5024
|
+
var engines = { "runtime": {
|
|
5025
|
+
"name": "node",
|
|
5026
|
+
"version": "^22.18.0",
|
|
5027
|
+
"onFail": "download"
|
|
5028
|
+
} };
|
|
4997
5029
|
//#endregion
|
|
4998
5030
|
//#region src/core/errors.ts
|
|
4999
5031
|
var UnsupportedError = class extends Error {
|
|
@@ -5022,7 +5054,7 @@ const PackageJSONSchema = /* @__PURE__ */ looseObject({
|
|
|
5022
5054
|
]))
|
|
5023
5055
|
});
|
|
5024
5056
|
const cliOptions = {
|
|
5025
|
-
noDownloadCheck: new Option("--no-download-check", "
|
|
5057
|
+
noDownloadCheck: new Option("--no-download-check", "do not warn about downloads from community add-ons"),
|
|
5026
5058
|
noInstall: new Option("--no-install", "skip installing dependencies")
|
|
5027
5059
|
};
|
|
5028
5060
|
const RX_IMPORT_ONLY = /^\s*@\S+\s*$/;
|
|
@@ -5117,7 +5149,7 @@ async function runCommand(action) {
|
|
|
5117
5149
|
try {
|
|
5118
5150
|
console.log(color.hidden("HINT: Run \"sv --help\" to get the full list of commands, add-ons, and examples to one-shot and skip interactive prompts."));
|
|
5119
5151
|
ye(`Welcome to the Svelte CLI! ${color.optional(`(v${version})`)}`);
|
|
5120
|
-
const minimumVersion =
|
|
5152
|
+
const minimumVersion = minVersion(engines.runtime.version);
|
|
5121
5153
|
if (isVersionUnsupportedBelow(V.versions.node, minimumVersion)) R.warn(`You are using Node.js ${color.error(V.versions.node)}, please upgrade to Node.js ${color.success(minimumVersion)} or higher.`);
|
|
5122
5154
|
await action();
|
|
5123
5155
|
fe("You're all set!");
|
|
@@ -5250,7 +5282,8 @@ async function runAndValidateVerifications(verifications) {
|
|
|
5250
5282
|
});
|
|
5251
5283
|
}
|
|
5252
5284
|
if (fails.length > 0) {
|
|
5253
|
-
|
|
5285
|
+
const message = fails.map(({ name, message }) => color.warning(`${name} (${message})`)).join("\n- ");
|
|
5286
|
+
Ce(`- ${message}`, "Verifications not met", { format: (line) => line });
|
|
5254
5287
|
const force = await le({
|
|
5255
5288
|
message: "Verifications failed. Do you wish to continue?",
|
|
5256
5289
|
initialValue: false
|
|
@@ -5371,8 +5404,10 @@ function write_common_files(cwd, options, name) {
|
|
|
5371
5404
|
sort_files(files).forEach((file) => {
|
|
5372
5405
|
const include = file.include.every((condition) => matches_condition(condition, options));
|
|
5373
5406
|
if (file.exclude.some((condition) => matches_condition(condition, options)) || !include) return;
|
|
5374
|
-
if (file.name === filePaths.packageJson)
|
|
5375
|
-
|
|
5407
|
+
if (file.name === filePaths.packageJson) {
|
|
5408
|
+
const new_pkg = JSON.parse(file.contents);
|
|
5409
|
+
merge(pkg, new_pkg);
|
|
5410
|
+
} else {
|
|
5376
5411
|
const dest = path.join(cwd, file.name);
|
|
5377
5412
|
mkdirp(path.dirname(dest));
|
|
5378
5413
|
fs.writeFileSync(dest, replace(file.contents, kv(name)));
|
|
@@ -5895,7 +5930,8 @@ function absolute(input, root) {
|
|
|
5895
5930
|
}
|
|
5896
5931
|
function from(root, ident, silent) {
|
|
5897
5932
|
try {
|
|
5898
|
-
|
|
5933
|
+
let r = root instanceof URL || root.startsWith("file://") ? join(fileURLToPath(root), "noop.js") : join(absolute(root), "noop.js");
|
|
5934
|
+
return createRequire(r).resolve(ident);
|
|
5899
5935
|
} catch (err) {
|
|
5900
5936
|
if (!silent) throw err;
|
|
5901
5937
|
}
|
|
@@ -5959,12 +5995,13 @@ const installOption = new Option("--install <package-manager>", "installs depend
|
|
|
5959
5995
|
async function packageManagerPrompt(cwd) {
|
|
5960
5996
|
const agent = (await detect({ cwd }))?.name ?? getUserAgent();
|
|
5961
5997
|
if (!V.stdout.isTTY) return agent;
|
|
5998
|
+
const agentOptions = [{
|
|
5999
|
+
label: "None",
|
|
6000
|
+
value: void 0
|
|
6001
|
+
}, ...AGENT_NAMES.filter(isInstalled).map((agent) => ({ value: agent }))];
|
|
5962
6002
|
const pm = await Ee({
|
|
5963
6003
|
message: "Detected package managers. Which one should we use to install dependencies?",
|
|
5964
|
-
options:
|
|
5965
|
-
label: "None",
|
|
5966
|
-
value: void 0
|
|
5967
|
-
}, ...AGENT_NAMES.filter(isInstalled).map((agent) => ({ value: agent }))],
|
|
6004
|
+
options: agentOptions,
|
|
5968
6005
|
initialValue: agent
|
|
5969
6006
|
});
|
|
5970
6007
|
if (R$1(pm)) {
|
|
@@ -6023,24 +6060,27 @@ function getUserAgent() {
|
|
|
6023
6060
|
}
|
|
6024
6061
|
const installedCache = /* @__PURE__ */ new Map();
|
|
6025
6062
|
function isInstalled(agent) {
|
|
6026
|
-
|
|
6027
|
-
if (
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
installed = true;
|
|
6031
|
-
} catch {
|
|
6032
|
-
installed = false;
|
|
6033
|
-
}
|
|
6034
|
-
installedCache.set(agent, installed);
|
|
6035
|
-
}
|
|
6063
|
+
const cached = installedCache.get(agent);
|
|
6064
|
+
if (cached !== void 0) return cached;
|
|
6065
|
+
const installed = commandExists(agent);
|
|
6066
|
+
installedCache.set(agent, installed);
|
|
6036
6067
|
return installed;
|
|
6037
6068
|
}
|
|
6038
|
-
|
|
6039
|
-
|
|
6069
|
+
/**
|
|
6070
|
+
* `pnpm.allowBuilds` only transforms content. Add-ons get the read/write for free through
|
|
6071
|
+
* `sv.file`, but the CLI itself runs outside that pipeline, so it locates (or creates)
|
|
6072
|
+
* `pnpm-workspace.yaml` by hand.
|
|
6073
|
+
*/
|
|
6074
|
+
function addAllowBuildsIfPnpm(options) {
|
|
6075
|
+
const { cwd, packageManager, packages } = options;
|
|
6076
|
+
if (packageManager !== "pnpm") return;
|
|
6040
6077
|
const found = up("pnpm-workspace.yaml", { cwd });
|
|
6041
6078
|
const filePath = found ?? path.join(cwd, "pnpm-workspace.yaml");
|
|
6042
6079
|
const content = found ? fs.readFileSync(found, "utf-8") : "";
|
|
6043
|
-
const newContent = pnpm.allowBuilds(
|
|
6080
|
+
const newContent = pnpm.allowBuilds({
|
|
6081
|
+
cwd,
|
|
6082
|
+
packages
|
|
6083
|
+
})(content);
|
|
6044
6084
|
if (newContent && newContent !== content) fs.writeFileSync(filePath, newContent, "utf-8");
|
|
6045
6085
|
}
|
|
6046
6086
|
//#endregion
|
|
@@ -6440,4 +6480,4 @@ function orderAddons(addons, setupResults) {
|
|
|
6440
6480
|
return ordered;
|
|
6441
6481
|
}
|
|
6442
6482
|
//#endregion
|
|
6443
|
-
export { pipe as $, filePaths as A, updateAgent as B, templates as C, buildAndLogArgs as D, PackageJSONSchema as E, isNodeError as F, version as G, updateReadme as H, normalizePosix as I, literal as J, array as K, parseAddonOptions as L, getHelpSections as M, getPadding as N, cliOptions as O, helpConfig as P, picklist as Q, runAndValidateVerifications as R, create as S, getSharedFiles as T, UnsupportedError as U, updateLibraryBuild as V, name as W, optional as X, nonEmpty as Y, parse$1 as Z, defineAddon as _, we as _t, setupAddons as a, union as at, exec as b, __require as bt, AGENT_NAMES as c, Option as ct, installDependencies as d, R as dt, record as et, installOption as f, Re as ft, createLoadedAddon as g, vt as gt, from as h, pe as ht, prepareSvApi as i, transform as it, forwardExitCode as j, errorAndExit as k,
|
|
6483
|
+
export { pipe as $, filePaths as A, updateAgent as B, templates as C, buildAndLogArgs as D, PackageJSONSchema as E, isNodeError as F, version as G, updateReadme as H, normalizePosix as I, literal as J, array as K, parseAddonOptions as L, getHelpSections as M, getPadding as N, cliOptions as O, helpConfig as P, picklist as Q, runAndValidateVerifications as R, create as S, getSharedFiles as T, UnsupportedError as U, updateLibraryBuild as V, name as W, optional as X, nonEmpty as Y, parse$1 as Z, defineAddon as _, we as _t, setupAddons as a, union as at, exec as b, __require as bt, AGENT_NAMES as c, Option as ct, installDependencies as d, R as dt, record as et, installOption as f, Re as ft, createLoadedAddon as g, vt as gt, from as h, pe as ht, prepareSvApi as i, transform as it, forwardExitCode as j, errorAndExit as k, addAllowBuildsIfPnpm as l, Ce as lt, up as m, le as mt, applyAddons as n, strictObject as nt, createWorkspace as o, program as ot, packageManagerPrompt as p, ge as pt, boolean as q, orderAddons as r, string as rt, findWorkspaceRoot as s, Command as st, add as t, safeParse as tt, detectPackageManager as u, Ee as ut, defineAddonOptions as v, R$1 as vt, dist as w, execSync as x, __toESM as xt, getErrorHint as y, __commonJSMin as yt, runCommand as z };
|
package/dist/shared.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "README.md",
|
|
5
5
|
"include": [],
|
|
6
6
|
"exclude": [],
|
|
7
|
-
"contents": "# sv\n\nEverything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).\n\n## Creating a project\n\nIf you're seeing this, you've probably already done this step. Congrats!\n\n```sh\n# create a new project\nnpx sv create my-app\n```\n\n## Developing\n\nOnce you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:\n\n```sh\nnpm run dev\n\n# or start the server and open the app in a new browser tab\nnpm run dev -- --open\n```\n\n## Building\n\nTo create a production version of your app:\n\n```sh\nnpm run build\n```\n\nYou can preview the production build with `npm run preview`.\n\n> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.\n"
|
|
7
|
+
"contents": "# sv\n\nEverything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).\n\n## Creating a project\n\nIf you're seeing this, you've probably already done this step. Congrats!\n\n```sh\n# create a new project\nnpx sv create my-app\n```\n\n## Adding features\n\nAdd features to your project with `sv add`:\n\n```sh\nnpx sv add\n```\n\nFor example, to add Tailwind CSS:\n\n```sh\nnpx sv add tailwindcss\n```\n\n## Developing\n\nOnce you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:\n\n```sh\nnpm run dev\n\n# or start the server and open the app in a new browser tab\nnpm run dev -- --open\n```\n\n## Building\n\nTo create a production version of your app:\n\n```sh\nnpm run build\n```\n\nYou can preview the production build with `npm run preview`.\n\n> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.\n"
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"name": "CONTRIBUTING.md",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"library"
|
|
53
53
|
],
|
|
54
54
|
"exclude": [],
|
|
55
|
-
"contents": "# Svelte library\n\nEverything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).\n\nRead more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).\n\n## Creating a project\n\nIf you're seeing this, you've probably already done this step. Congrats!\n\n```sh\n# create a new project in the current directory\nnpx sv create\n\n# create a new project in my-app\nnpx sv create my-app\n```\n\n## Developing\n\nOnce you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:\n\n```sh\nnpm run dev\n\n# or start the server and open the app in a new browser tab\nnpm run dev -- --open\n```\n\nEverything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.\n\n## Building\n\nTo build your library:\n\n```sh\nnpm pack\n```\n\nTo create a production version of your showcase app:\n\n```sh\nnpm run build\n```\n\nYou can preview the production build with `npm run preview`.\n\n> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.\n\n## Publishing\n\nGo into the `package.json` and give your package the desired name through the `\"name\"` option. Also consider adding a `\"license\"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).\n\nTo publish your library to [npm](https://www.npmjs.com):\n\n```sh\nnpm publish\n```\n"
|
|
55
|
+
"contents": "# Svelte library\n\nEverything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).\n\nRead more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).\n\n## Creating a project\n\nIf you're seeing this, you've probably already done this step. Congrats!\n\n```sh\n# create a new project in the current directory\nnpx sv create\n\n# create a new project in my-app\nnpx sv create my-app\n```\n\n## Adding features\n\nAdd features to your project with `sv add`:\n\n```sh\nnpx sv add\n```\n\nFor example, to add Tailwind CSS:\n\n```sh\nnpx sv add tailwindcss\n```\n\n## Developing\n\nOnce you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:\n\n```sh\nnpm run dev\n\n# or start the server and open the app in a new browser tab\nnpm run dev -- --open\n```\n\nEverything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.\n\n## Building\n\nTo build your library:\n\n```sh\nnpm pack\n```\n\nTo create a production version of your showcase app:\n\n```sh\nnpm run build\n```\n\nYou can preview the production build with `npm run preview`.\n\n> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.\n\n## Publishing\n\nGo into the `package.json` and give your package the desired name through the `\"name\"` option. Also consider adding a `\"license\"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).\n\nTo publish your library to [npm](https://www.npmjs.com):\n\n```sh\nnpm publish\n```\n"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"name": "AGENTS.md",
|
package/dist/src/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { A as StringQuestion, C as BooleanQuestion, D as OptionValues, E as OptionDefinition, O as Question, S as BaseQuestion, T as NumberQuestion, _ as SvApi, a as Addon, b as Workspace, c as AddonReference, d as ConditionDefinition, f as ConfiguredAddon, g as SetupResult, h as PreparedAddon, i as add, j as officialAddons, k as SelectQuestion, l as AddonResult, m as OptionBuilder, n as InstallOptions, o as AddonDefinition, p as LoadedAddon, r as OptionMap, s as AddonInput, t as AddonMap, u as AddonSource, v as defineAddon, w as MultiSelectQuestion, x as WorkspaceOptions, y as defineAddonOptions } from "../engine-
|
|
2
|
-
|
|
1
|
+
import { A as StringQuestion, C as BooleanQuestion, D as OptionValues, E as OptionDefinition, O as Question, S as BaseQuestion, T as NumberQuestion, _ as SvApi, a as Addon, b as Workspace, c as AddonReference, d as ConditionDefinition, f as ConfiguredAddon, g as SetupResult, h as PreparedAddon, i as add, j as officialAddons, k as SelectQuestion, l as AddonResult, m as OptionBuilder, n as InstallOptions, o as AddonDefinition, p as LoadedAddon, r as OptionMap, s as AddonInput, t as AddonMap, u as AddonSource, v as defineAddon, w as MultiSelectQuestion, x as WorkspaceOptions, y as defineAddonOptions } from "../engine-D2x5kvrf.mjs";
|
|
3
2
|
//#region src/create/index.d.ts
|
|
4
3
|
type TemplateType = (typeof templateTypes)[number];
|
|
5
4
|
type LanguageType = (typeof languageTypes)[number];
|
|
@@ -11,10 +10,7 @@ type Options = {
|
|
|
11
10
|
template: TemplateType;
|
|
12
11
|
types: LanguageType;
|
|
13
12
|
};
|
|
14
|
-
declare function create({
|
|
15
|
-
cwd,
|
|
16
|
-
...options
|
|
17
|
-
}: Options): void;
|
|
13
|
+
export declare function create({ cwd, ...options }: Options): void;
|
|
18
14
|
//#endregion
|
|
19
15
|
//#region src/core/processors.d.ts
|
|
20
16
|
type FileEditor = Workspace & {
|
|
@@ -26,4 +22,4 @@ type FileType = {
|
|
|
26
22
|
content: (editor: FileEditor) => string;
|
|
27
23
|
};
|
|
28
24
|
//#endregion
|
|
29
|
-
export { type Addon, type AddonDefinition, type AddonInput, type AddonMap, type AddonReference, type AddonResult, type AddonSource, type BaseQuestion, type BooleanQuestion, type ConfiguredAddon, type FileEditor, type FileType, type InstallOptions, type LanguageType, type LoadedAddon, type MultiSelectQuestion, type NumberQuestion, type OptionBuilder, type OptionDefinition, type OptionMap, type OptionValues, type PreparedAddon, type Question, type SelectQuestion, type SetupResult, type StringQuestion, type SvApi, type TemplateType, type Workspace, type WorkspaceOptions, add,
|
|
25
|
+
export { type Addon, type AddonDefinition, type AddonInput, type AddonMap, type AddonReference, type AddonResult, type AddonSource, type BaseQuestion, type BooleanQuestion, type ConfiguredAddon, type FileEditor, type FileType, type InstallOptions, type LanguageType, type LoadedAddon, type MultiSelectQuestion, type NumberQuestion, type OptionBuilder, type OptionDefinition, type OptionMap, type OptionValues, type PreparedAddon, type Question, type SelectQuestion, type SetupResult, type StringQuestion, type SvApi, type TemplateType, type Workspace, type WorkspaceOptions, add, defineAddon, defineAddonOptions, officialAddons };
|
package/dist/src/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as create, _ as defineAddon, t as add, v as defineAddonOptions } from "../engine-
|
|
2
|
-
import { n as officialAddons } from "../addons-
|
|
1
|
+
import { S as create, _ as defineAddon, t as add, v as defineAddonOptions } from "../engine-Do1htOYy.mjs";
|
|
2
|
+
import { n as officialAddons } from "../addons-So36TZLY.mjs";
|
|
3
3
|
export { add, create, defineAddon, defineAddonOptions, officialAddons };
|
package/dist/src/testing.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { r as OptionMap, t as AddonMap } from "../engine-
|
|
1
|
+
import { r as OptionMap, t as AddonMap } from "../engine-D2x5kvrf.mjs";
|
|
2
2
|
import { Page } from "@playwright/test";
|
|
3
3
|
import { TestProject } from "vitest/node";
|
|
4
|
-
|
|
5
4
|
//#region src/testing.d.ts
|
|
6
|
-
type ProjectVariant = "kit-js" | "kit-ts" | "vite-js" | "vite-ts";
|
|
7
|
-
declare const variants: ProjectVariant[];
|
|
8
|
-
type CreateProject = (options: {
|
|
5
|
+
export type ProjectVariant = "kit-js" | "kit-ts" | "vite-js" | "vite-ts";
|
|
6
|
+
export declare const variants: ProjectVariant[];
|
|
7
|
+
export type CreateProject = (options: {
|
|
9
8
|
testId: string;
|
|
10
|
-
variant: ProjectVariant;
|
|
9
|
+
variant: ProjectVariant;
|
|
10
|
+
/** @default true */
|
|
11
11
|
clean?: boolean;
|
|
12
12
|
}) => string;
|
|
13
13
|
declare module "vitest" {
|
|
@@ -17,29 +17,23 @@ declare module "vitest" {
|
|
|
17
17
|
variants: ProjectVariant[];
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
declare function setupGlobal({
|
|
21
|
-
TEST_DIR,
|
|
22
|
-
pre,
|
|
23
|
-
post
|
|
24
|
-
}: {
|
|
20
|
+
export declare function setupGlobal({ TEST_DIR, pre, post }: {
|
|
25
21
|
TEST_DIR: string;
|
|
26
22
|
pre?: () => Promise<void>;
|
|
27
23
|
post?: () => Promise<void>;
|
|
28
|
-
}): ({
|
|
29
|
-
|
|
30
|
-
}: TestProject) => Promise<() => Promise<void>>;
|
|
31
|
-
type Fixtures = {
|
|
24
|
+
}): ({ provide }: TestProject) => Promise<() => Promise<void>>;
|
|
25
|
+
export type Fixtures = {
|
|
32
26
|
page: Page;
|
|
33
27
|
cwd(addonTestCase: AddonTestCase<any>): string;
|
|
34
28
|
};
|
|
35
|
-
type AddonTestCase<Addons extends AddonMap> = {
|
|
29
|
+
export type AddonTestCase<Addons extends AddonMap> = {
|
|
36
30
|
variant: ProjectVariant;
|
|
37
31
|
kind: {
|
|
38
32
|
type: string;
|
|
39
33
|
options: OptionMap<Addons>;
|
|
40
34
|
};
|
|
41
35
|
};
|
|
42
|
-
type SetupTestOptions<Addons extends AddonMap> = {
|
|
36
|
+
export type SetupTestOptions<Addons extends AddonMap> = {
|
|
43
37
|
kinds: Array<AddonTestCase<Addons>["kind"]>;
|
|
44
38
|
filter?: (addonTestCase: AddonTestCase<Addons>) => boolean;
|
|
45
39
|
browser?: boolean;
|
|
@@ -48,35 +42,30 @@ type SetupTestOptions<Addons extends AddonMap> = {
|
|
|
48
42
|
cwd: string;
|
|
49
43
|
}) => Promise<void> | void;
|
|
50
44
|
};
|
|
51
|
-
type PrepareServerOptions = {
|
|
45
|
+
export type PrepareServerOptions = {
|
|
52
46
|
cwd: string;
|
|
53
|
-
page: Page;
|
|
54
|
-
|
|
47
|
+
page: Page;
|
|
48
|
+
/** @default 'pnpm build' */
|
|
49
|
+
buildCommand?: string;
|
|
50
|
+
/** @default 'pnpm preview' */
|
|
55
51
|
previewCommand?: string;
|
|
56
52
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
* Vitest's `expect`, injected by `createSetupTest`. Used to make a Vitest-counted
|
|
54
|
+
* assertion that the preview loaded, which also satisfies `requireAssertions` for
|
|
55
|
+
* tests that otherwise only assert through Playwright's (untracked) `expect`.
|
|
56
|
+
*/
|
|
61
57
|
expect?: VitestContext["expect"];
|
|
62
58
|
};
|
|
63
|
-
type PrepareServerReturn = {
|
|
59
|
+
export type PrepareServerReturn = {
|
|
64
60
|
url: string;
|
|
65
61
|
close: () => Promise<void>;
|
|
66
62
|
};
|
|
67
|
-
declare function prepareServer({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
previewCommand,
|
|
72
|
-
expect
|
|
73
|
-
}: PrepareServerOptions): Promise<PrepareServerReturn>;
|
|
74
|
-
type PlaywrightContext = Pick<typeof import("@playwright/test"), "chromium">;
|
|
75
|
-
type VitestContext = Pick<typeof import("vitest"), "inject" | "test" | "beforeAll" | "beforeEach" | "expect">;
|
|
76
|
-
declare function createSetupTest(vitest: VitestContext, playwright?: PlaywrightContext): <Addons extends AddonMap>(addons: Addons, options?: SetupTestOptions<Addons>) => {
|
|
63
|
+
export declare function prepareServer({ cwd, page, buildCommand, previewCommand, expect }: PrepareServerOptions): Promise<PrepareServerReturn>;
|
|
64
|
+
export type PlaywrightContext = Pick<typeof import("@playwright/test"), "chromium">;
|
|
65
|
+
export type VitestContext = Pick<typeof import("vitest"), "inject" | "test" | "beforeAll" | "beforeEach" | "expect">;
|
|
66
|
+
export declare function createSetupTest(vitest: VitestContext, playwright?: PlaywrightContext): <Addons extends AddonMap>(addons: Addons, options?: SetupTestOptions<Addons>) => {
|
|
77
67
|
test: import("vitest").TestAPI<Fixtures>;
|
|
78
68
|
testCases: Array<AddonTestCase<AddonMap>>;
|
|
79
69
|
prepareServer: typeof prepareServer;
|
|
80
70
|
};
|
|
81
|
-
//#endregion
|
|
82
|
-
export { AddonTestCase, CreateProject, Fixtures, PlaywrightContext, PrepareServerOptions, PrepareServerReturn, ProjectVariant, SetupTestOptions, VitestContext, createSetupTest, prepareServer, setupGlobal, variants };
|
|
71
|
+
//#endregion
|