sv 0.9.2 → 0.9.4
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-Ck_pRCRU.js → addons-DT8tgFSU.js} +138 -135
- package/dist/bin.js +23 -21
- package/dist/index.js +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Element, T, Tag, __commonJS, __export, __toESM
|
|
1
|
+
import { Element, T, Tag, __commonJS, __export, __toESM, __toESM$1, be, detect, esm_exports, getUserAgent, parseCss$1, parseHtml, parseHtml$1, parseJson$1, parseScript, parseScript$1, parseSvelte, require_picocolors, require_picocolors$1, resolveCommand, serializeScript, stripAst, up, walk, walk_exports } from "./package-manager-DO5R9a6p.js";
|
|
2
2
|
import fs, { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
3
3
|
import path, { dirname, join } from "node:path";
|
|
4
4
|
import process$1, { stdin, stdout } from "node:process";
|
|
@@ -889,7 +889,7 @@ const addPlugin = (ast, options$6) => {
|
|
|
889
889
|
|
|
890
890
|
//#endregion
|
|
891
891
|
//#region packages/cli/commands/add/utils.ts
|
|
892
|
-
var import_picocolors$5 = __toESM(require_picocolors(), 1);
|
|
892
|
+
var import_picocolors$5 = __toESM$1(require_picocolors$1(), 1);
|
|
893
893
|
function getPackageJson(cwd) {
|
|
894
894
|
const packageText = readFile(cwd, commonFilePaths.packageJson);
|
|
895
895
|
if (!packageText) {
|
|
@@ -1063,7 +1063,7 @@ function parseKitOptions(cwd) {
|
|
|
1063
1063
|
|
|
1064
1064
|
//#endregion
|
|
1065
1065
|
//#region packages/cli/lib/install.ts
|
|
1066
|
-
var import_picocolors$4 = __toESM(require_picocolors(), 1);
|
|
1066
|
+
var import_picocolors$4 = __toESM$1(require_picocolors$1(), 1);
|
|
1067
1067
|
async function installAddon({ addons, cwd, options: options$6, packageManager = "npm" }) {
|
|
1068
1068
|
const workspace = await createWorkspace({
|
|
1069
1069
|
cwd,
|
|
@@ -1173,7 +1173,7 @@ async function runAddon({ addon, multiple, workspace }) {
|
|
|
1173
1173
|
dev: true
|
|
1174
1174
|
});
|
|
1175
1175
|
},
|
|
1176
|
-
|
|
1176
|
+
pnpmBuildDependency: (pkg) => {
|
|
1177
1177
|
pnpmBuildDependencies.push(pkg);
|
|
1178
1178
|
}
|
|
1179
1179
|
};
|
|
@@ -1199,8 +1199,22 @@ function orderAddons(addons, setupResults) {
|
|
|
1199
1199
|
function defineAddon(config) {
|
|
1200
1200
|
return config;
|
|
1201
1201
|
}
|
|
1202
|
-
function defineAddonOptions(
|
|
1203
|
-
return
|
|
1202
|
+
function defineAddonOptions() {
|
|
1203
|
+
return createOptionBuilder({});
|
|
1204
|
+
}
|
|
1205
|
+
function createOptionBuilder(options$6) {
|
|
1206
|
+
return {
|
|
1207
|
+
add(key, question) {
|
|
1208
|
+
const newOptions = {
|
|
1209
|
+
...options$6,
|
|
1210
|
+
[key]: question
|
|
1211
|
+
};
|
|
1212
|
+
return createOptionBuilder(newOptions);
|
|
1213
|
+
},
|
|
1214
|
+
build() {
|
|
1215
|
+
return options$6;
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1204
1218
|
}
|
|
1205
1219
|
var require_src = __commonJS({ "node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
|
|
1206
1220
|
const ESC = "\x1B";
|
|
@@ -1256,8 +1270,8 @@ else if (y > 0) ret += `${CSI}${y}B`;
|
|
|
1256
1270
|
beep
|
|
1257
1271
|
};
|
|
1258
1272
|
} });
|
|
1259
|
-
var import_src$1 = __toESM
|
|
1260
|
-
var import_picocolors$3 = __toESM
|
|
1273
|
+
var import_src$1 = __toESM(require_src(), 1);
|
|
1274
|
+
var import_picocolors$3 = __toESM(require_picocolors(), 1);
|
|
1261
1275
|
function hu({ onlyFirst: e$1 = !1 } = {}) {
|
|
1262
1276
|
const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
1263
1277
|
return new RegExp(t, e$1 ? void 0 : "g");
|
|
@@ -1992,9 +2006,9 @@ B$1 = new WeakMap(), k$1 = new WeakMap(), I = new WeakMap(), v$1 = new WeakMap()
|
|
|
1992
2006
|
e$1 ? this.filteredOptions = D$1.filter((t) => x$1(this, I).call(this, e$1, t)) : this.filteredOptions = [...D$1], m(this, B$1, FD(this.focusedValue, this.filteredOptions)), this.focusedValue = this.filteredOptions[x$1(this, B$1)]?.value, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
1993
2007
|
}
|
|
1994
2008
|
};
|
|
1995
|
-
var import_picocolors$1 = __toESM
|
|
1996
|
-
var import_picocolors$2 = __toESM
|
|
1997
|
-
var import_src = __toESM
|
|
2009
|
+
var import_picocolors$1 = __toESM(require_picocolors(), 1);
|
|
2010
|
+
var import_picocolors$2 = __toESM(require_picocolors(), 1);
|
|
2011
|
+
var import_src = __toESM(require_src(), 1);
|
|
1998
2012
|
function Pe() {
|
|
1999
2013
|
return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
2000
2014
|
}
|
|
@@ -2694,7 +2708,7 @@ else return true;
|
|
|
2694
2708
|
if (version.patch === below.patch) return false;
|
|
2695
2709
|
return undefined;
|
|
2696
2710
|
}
|
|
2697
|
-
var import_picocolors = __toESM
|
|
2711
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
2698
2712
|
var colors = import_picocolors.default;
|
|
2699
2713
|
|
|
2700
2714
|
//#endregion
|
|
@@ -2778,87 +2792,81 @@ const PORTS = {
|
|
|
2778
2792
|
postgresql: "5432",
|
|
2779
2793
|
sqlite: ""
|
|
2780
2794
|
};
|
|
2781
|
-
const options$5 = defineAddonOptions({
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2795
|
+
const options$5 = defineAddonOptions().add("database", {
|
|
2796
|
+
question: "Which database would you like to use?",
|
|
2797
|
+
type: "select",
|
|
2798
|
+
default: "sqlite",
|
|
2799
|
+
options: [
|
|
2800
|
+
{
|
|
2801
|
+
value: "postgresql",
|
|
2802
|
+
label: "PostgreSQL"
|
|
2803
|
+
},
|
|
2804
|
+
{
|
|
2805
|
+
value: "mysql",
|
|
2806
|
+
label: "MySQL"
|
|
2807
|
+
},
|
|
2808
|
+
{
|
|
2809
|
+
value: "sqlite",
|
|
2810
|
+
label: "SQLite"
|
|
2811
|
+
}
|
|
2812
|
+
]
|
|
2813
|
+
}).add("postgresql", {
|
|
2814
|
+
question: "Which PostgreSQL client would you like to use?",
|
|
2815
|
+
type: "select",
|
|
2816
|
+
group: "client",
|
|
2817
|
+
default: "postgres.js",
|
|
2818
|
+
options: [{
|
|
2819
|
+
value: "postgres.js",
|
|
2820
|
+
label: "Postgres.JS",
|
|
2821
|
+
hint: "recommended for most users"
|
|
2822
|
+
}, {
|
|
2823
|
+
value: "neon",
|
|
2824
|
+
label: "Neon",
|
|
2825
|
+
hint: "popular hosted platform"
|
|
2826
|
+
}],
|
|
2827
|
+
condition: ({ database }) => database === "postgresql"
|
|
2828
|
+
}).add("mysql", {
|
|
2829
|
+
question: "Which MySQL client would you like to use?",
|
|
2830
|
+
type: "select",
|
|
2831
|
+
group: "client",
|
|
2832
|
+
default: "mysql2",
|
|
2833
|
+
options: [{
|
|
2834
|
+
value: "mysql2",
|
|
2835
|
+
hint: "recommended for most users"
|
|
2836
|
+
}, {
|
|
2837
|
+
value: "planetscale",
|
|
2838
|
+
label: "PlanetScale",
|
|
2839
|
+
hint: "popular hosted platform"
|
|
2840
|
+
}],
|
|
2841
|
+
condition: ({ database }) => database === "mysql"
|
|
2842
|
+
}).add("sqlite", {
|
|
2843
|
+
question: "Which SQLite client would you like to use?",
|
|
2844
|
+
type: "select",
|
|
2845
|
+
group: "client",
|
|
2846
|
+
default: "libsql",
|
|
2847
|
+
options: [
|
|
2848
|
+
{
|
|
2849
|
+
value: "better-sqlite3",
|
|
2850
|
+
hint: "for traditional Node environments"
|
|
2851
|
+
},
|
|
2852
|
+
{
|
|
2853
|
+
value: "libsql",
|
|
2854
|
+
label: "libSQL",
|
|
2855
|
+
hint: "for serverless environments"
|
|
2856
|
+
},
|
|
2857
|
+
{
|
|
2858
|
+
value: "turso",
|
|
2859
|
+
label: "Turso",
|
|
2828
2860
|
hint: "popular hosted platform"
|
|
2829
|
-
}
|
|
2830
|
-
|
|
2831
|
-
}
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
{
|
|
2839
|
-
value: "better-sqlite3",
|
|
2840
|
-
hint: "for traditional Node environments"
|
|
2841
|
-
},
|
|
2842
|
-
{
|
|
2843
|
-
value: "libsql",
|
|
2844
|
-
label: "libSQL",
|
|
2845
|
-
hint: "for serverless environments"
|
|
2846
|
-
},
|
|
2847
|
-
{
|
|
2848
|
-
value: "turso",
|
|
2849
|
-
label: "Turso",
|
|
2850
|
-
hint: "popular hosted platform"
|
|
2851
|
-
}
|
|
2852
|
-
],
|
|
2853
|
-
condition: ({ database }) => database === "sqlite"
|
|
2854
|
-
},
|
|
2855
|
-
docker: {
|
|
2856
|
-
question: "Do you want to run the database locally with docker-compose?",
|
|
2857
|
-
default: false,
|
|
2858
|
-
type: "boolean",
|
|
2859
|
-
condition: ({ database, mysql, postgresql }) => database === "mysql" && mysql === "mysql2" || database === "postgresql" && postgresql === "postgres.js"
|
|
2860
|
-
}
|
|
2861
|
-
});
|
|
2861
|
+
}
|
|
2862
|
+
],
|
|
2863
|
+
condition: ({ database }) => database === "sqlite"
|
|
2864
|
+
}).add("docker", {
|
|
2865
|
+
question: "Do you want to run the database locally with docker-compose?",
|
|
2866
|
+
default: false,
|
|
2867
|
+
type: "boolean",
|
|
2868
|
+
condition: ({ database, mysql, postgresql }) => database === "mysql" && mysql === "mysql2" || database === "postgresql" && postgresql === "postgres.js"
|
|
2869
|
+
}).build();
|
|
2862
2870
|
var drizzle_default = defineAddon({
|
|
2863
2871
|
id: "drizzle",
|
|
2864
2872
|
shortDescription: "database orm",
|
|
@@ -2878,7 +2886,7 @@ var drizzle_default = defineAddon({
|
|
|
2878
2886
|
},
|
|
2879
2887
|
run: ({ sv, typescript, options: options$6, kit, dependencyVersion }) => {
|
|
2880
2888
|
const ext = typescript ? "ts" : "js";
|
|
2881
|
-
sv.
|
|
2889
|
+
sv.devDependency("drizzle-orm", "^0.40.0");
|
|
2882
2890
|
sv.devDependency("drizzle-kit", "^0.30.2");
|
|
2883
2891
|
sv.devDependency("@types/node", getNodeTypesVersion());
|
|
2884
2892
|
if (options$6.mysql === "mysql2") sv.dependency("mysql2", "^3.12.0");
|
|
@@ -2888,9 +2896,9 @@ var drizzle_default = defineAddon({
|
|
|
2888
2896
|
if (options$6.sqlite === "better-sqlite3") {
|
|
2889
2897
|
sv.dependency("better-sqlite3", "^11.8.0");
|
|
2890
2898
|
sv.devDependency("@types/better-sqlite3", "^7.6.12");
|
|
2891
|
-
sv.
|
|
2899
|
+
sv.pnpmBuildDependency("better-sqlite3");
|
|
2892
2900
|
}
|
|
2893
|
-
if (options$6.sqlite === "libsql" || options$6.sqlite === "turso") sv.
|
|
2901
|
+
if (options$6.sqlite === "libsql" || options$6.sqlite === "turso") sv.devDependency("@libsql/client", "^0.14.0");
|
|
2894
2902
|
sv.file(".env", (content) => generateEnvFileContent(content, options$6));
|
|
2895
2903
|
sv.file(".env.example", (content) => generateEnvFileContent(content, options$6));
|
|
2896
2904
|
if (options$6.docker && (options$6.mysql === "mysql2" || options$6.postgresql === "postgres.js")) sv.file("docker-compose.yml", (content) => {
|
|
@@ -4343,11 +4351,11 @@ const TABLE_TYPE = {
|
|
|
4343
4351
|
};
|
|
4344
4352
|
let drizzleDialect;
|
|
4345
4353
|
let schemaPath;
|
|
4346
|
-
const options$4 = defineAddonOptions(
|
|
4354
|
+
const options$4 = defineAddonOptions().add("demo", {
|
|
4347
4355
|
type: "boolean",
|
|
4348
4356
|
default: true,
|
|
4349
4357
|
question: `Do you want to include a demo? ${colors.dim("(includes a login/register page)")}`
|
|
4350
|
-
}
|
|
4358
|
+
}).build();
|
|
4351
4359
|
var lucia_default = defineAddon({
|
|
4352
4360
|
id: "lucia",
|
|
4353
4361
|
shortDescription: "auth guide",
|
|
@@ -4360,8 +4368,8 @@ var lucia_default = defineAddon({
|
|
|
4360
4368
|
},
|
|
4361
4369
|
run: ({ sv, typescript, options: options$6, kit, dependencyVersion }) => {
|
|
4362
4370
|
const ext = typescript ? "ts" : "js";
|
|
4363
|
-
sv.
|
|
4364
|
-
sv.
|
|
4371
|
+
sv.devDependency("@oslojs/crypto", "^1.0.1");
|
|
4372
|
+
sv.devDependency("@oslojs/encoding", "^1.1.0");
|
|
4365
4373
|
if (options$6.demo) sv.dependency("@node-rs/argon2", "^2.0.2");
|
|
4366
4374
|
sv.file(`drizzle.config.${ext}`, (content) => {
|
|
4367
4375
|
const { ast, generateCode } = parseScript$1(content);
|
|
@@ -5016,32 +5024,29 @@ const DEFAULT_INLANG_PROJECT = {
|
|
|
5016
5024
|
modules: ["https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js", "https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js"],
|
|
5017
5025
|
"plugin.inlang.messageFormat": { pathPattern: "./messages/{locale}.json" }
|
|
5018
5026
|
};
|
|
5019
|
-
const options$3 = defineAddonOptions({
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
if (invalidLanguageTags.length > 0) if (invalidLanguageTags.length === 1) return `The input "${invalidLanguageTags[0]}" is not a valid IETF BCP 47 language tag`;
|
|
5027
|
+
const options$3 = defineAddonOptions().add("languageTags", {
|
|
5028
|
+
question: `Which languages would you like to support? ${colors.gray("(e.g. en,de-ch)")}`,
|
|
5029
|
+
type: "string",
|
|
5030
|
+
default: "en, es",
|
|
5031
|
+
validate(input) {
|
|
5032
|
+
if (!input) return;
|
|
5033
|
+
const { invalidLanguageTags, validLanguageTags } = parseLanguageTagInput(input);
|
|
5034
|
+
if (invalidLanguageTags.length > 0) if (invalidLanguageTags.length === 1) return `The input "${invalidLanguageTags[0]}" is not a valid IETF BCP 47 language tag`;
|
|
5028
5035
|
else {
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
}
|
|
5035
|
-
if (validLanguageTags.length === 0) return "Please enter at least one valid BCP47 language tag. Eg: en";
|
|
5036
|
-
return undefined;
|
|
5036
|
+
const listFormat = new Intl.ListFormat("en", {
|
|
5037
|
+
style: "long",
|
|
5038
|
+
type: "conjunction"
|
|
5039
|
+
});
|
|
5040
|
+
return `The inputs ${listFormat.format(invalidLanguageTags.map((x$2) => `"${x$2}"`))} are not valid BCP47 language tags`;
|
|
5037
5041
|
}
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
type: "boolean",
|
|
5041
|
-
default: true,
|
|
5042
|
-
question: "Do you want to include a demo?"
|
|
5042
|
+
if (validLanguageTags.length === 0) return "Please enter at least one valid BCP47 language tag. Eg: en";
|
|
5043
|
+
return undefined;
|
|
5043
5044
|
}
|
|
5044
|
-
})
|
|
5045
|
+
}).add("demo", {
|
|
5046
|
+
type: "boolean",
|
|
5047
|
+
default: true,
|
|
5048
|
+
question: "Do you want to include a demo?"
|
|
5049
|
+
}).build();
|
|
5045
5050
|
var paraglide_default = defineAddon({
|
|
5046
5051
|
id: "paraglide",
|
|
5047
5052
|
shortDescription: "i18n",
|
|
@@ -5054,7 +5059,7 @@ var paraglide_default = defineAddon({
|
|
|
5054
5059
|
const ext = typescript ? "ts" : "js";
|
|
5055
5060
|
if (!kit) throw new Error("SvelteKit is required");
|
|
5056
5061
|
const paraglideOutDir = "src/lib/paraglide";
|
|
5057
|
-
sv.
|
|
5062
|
+
sv.devDependency("@inlang/paraglide-js", "^2.0.0");
|
|
5058
5063
|
sv.file("project.inlang/settings.json", (content) => {
|
|
5059
5064
|
if (content) return content;
|
|
5060
5065
|
const { data, generateCode } = parseJson$1(content);
|
|
@@ -5390,16 +5395,16 @@ const adapters = [
|
|
|
5390
5395
|
version: "^5.0.0"
|
|
5391
5396
|
}
|
|
5392
5397
|
];
|
|
5393
|
-
const options$2 = defineAddonOptions(
|
|
5398
|
+
const options$2 = defineAddonOptions().add("adapter", {
|
|
5394
5399
|
type: "select",
|
|
5395
5400
|
question: "Which SvelteKit adapter would you like to use?",
|
|
5401
|
+
default: "auto",
|
|
5396
5402
|
options: adapters.map((p$1) => ({
|
|
5397
5403
|
value: p$1.id,
|
|
5398
5404
|
label: p$1.id,
|
|
5399
5405
|
hint: p$1.package
|
|
5400
|
-
}))
|
|
5401
|
-
|
|
5402
|
-
} });
|
|
5406
|
+
}))
|
|
5407
|
+
}).build();
|
|
5403
5408
|
var sveltekit_adapter_default = defineAddon({
|
|
5404
5409
|
id: "sveltekit-adapter",
|
|
5405
5410
|
alias: "adapter",
|
|
@@ -5456,15 +5461,13 @@ var sveltekit_adapter_default = defineAddon({
|
|
|
5456
5461
|
const plugins = [{
|
|
5457
5462
|
id: "typography",
|
|
5458
5463
|
package: "@tailwindcss/typography",
|
|
5459
|
-
version: "^0.5.15"
|
|
5460
|
-
identifier: "typography"
|
|
5464
|
+
version: "^0.5.15"
|
|
5461
5465
|
}, {
|
|
5462
5466
|
id: "forms",
|
|
5463
5467
|
package: "@tailwindcss/forms",
|
|
5464
|
-
version: "^0.5.9"
|
|
5465
|
-
identifier: "forms"
|
|
5468
|
+
version: "^0.5.9"
|
|
5466
5469
|
}];
|
|
5467
|
-
const options$1 = defineAddonOptions(
|
|
5470
|
+
const options$1 = defineAddonOptions().add("plugins", {
|
|
5468
5471
|
type: "multiselect",
|
|
5469
5472
|
question: "Which plugins would you like to add?",
|
|
5470
5473
|
options: plugins.map((p$1) => ({
|
|
@@ -5474,7 +5477,7 @@ const options$1 = defineAddonOptions({ plugins: {
|
|
|
5474
5477
|
})),
|
|
5475
5478
|
default: [],
|
|
5476
5479
|
required: false
|
|
5477
|
-
}
|
|
5480
|
+
}).build();
|
|
5478
5481
|
var tailwindcss_default = defineAddon({
|
|
5479
5482
|
id: "tailwindcss",
|
|
5480
5483
|
alias: "tailwind",
|
|
@@ -5559,7 +5562,7 @@ else sv.file(`${kit?.routesDirectory}/+layout.svelte`, (content) => {
|
|
|
5559
5562
|
|
|
5560
5563
|
//#endregion
|
|
5561
5564
|
//#region packages/addons/vitest-addon/index.ts
|
|
5562
|
-
const options = defineAddonOptions(
|
|
5565
|
+
const options = defineAddonOptions().add("usages", {
|
|
5563
5566
|
question: "What do you want to use vitest for?",
|
|
5564
5567
|
type: "multiselect",
|
|
5565
5568
|
default: ["unit", "component"],
|
|
@@ -5571,7 +5574,7 @@ const options = defineAddonOptions({ usages: {
|
|
|
5571
5574
|
label: "component testing"
|
|
5572
5575
|
}],
|
|
5573
5576
|
required: true
|
|
5574
|
-
}
|
|
5577
|
+
}).build();
|
|
5575
5578
|
var vitest_addon_default = defineAddon({
|
|
5576
5579
|
id: "vitest",
|
|
5577
5580
|
shortDescription: "unit testing",
|
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { AGENT_NAMES, Command, De, Fe, Ge, J, Ke, Option, T, Ue, Vu, We, __toESM$1 as __toESM, addPnpmBuildDependencies, create, detect, et, from, getUserAgent, installDependencies, installOption, ke, packageManagerPrompt, program, require_picocolors$1 as require_picocolors, resolveCommand, templates, up, ze } from "./package-manager-DO5R9a6p.js";
|
|
3
|
-
import { applyAddons, communityAddonIds, createWorkspace, formatFiles, getAddonDetails, getCommunityAddon, getHighlighter, isVersionUnsupportedBelow, officialAddons, setupAddons } from "./addons-
|
|
3
|
+
import { applyAddons, communityAddonIds, createWorkspace, formatFiles, getAddonDetails, getCommunityAddon, getHighlighter, isVersionUnsupportedBelow, officialAddons, setupAddons } from "./addons-DT8tgFSU.js";
|
|
4
4
|
import fs, { existsSync } from "node:fs";
|
|
5
5
|
import path, { dirname, join } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
@@ -12,7 +12,7 @@ import { pipeline } from "node:stream/promises";
|
|
|
12
12
|
|
|
13
13
|
//#region packages/cli/package.json
|
|
14
14
|
var name = "sv";
|
|
15
|
-
var version = "0.9.
|
|
15
|
+
var version = "0.9.4";
|
|
16
16
|
var type = "module";
|
|
17
17
|
var description = "A CLI for creating and updating SvelteKit projects";
|
|
18
18
|
var license = "MIT";
|
|
@@ -588,6 +588,16 @@ function forwardExitCode(error) {
|
|
|
588
588
|
if (error && typeof error === "object" && "status" in error && typeof error.status === "number") process.exit(error.status);
|
|
589
589
|
else process.exit(1);
|
|
590
590
|
}
|
|
591
|
+
function parseAddonOptions(optionFlags) {
|
|
592
|
+
if (optionFlags === undefined || optionFlags === "") return undefined;
|
|
593
|
+
const options$1 = optionFlags.split("+");
|
|
594
|
+
const malformed = options$1.filter((option) => !/.+:.*/.test(option));
|
|
595
|
+
if (malformed.length > 0) {
|
|
596
|
+
const message = `Malformed arguments: The following add-on options: ${malformed.map((o) => `'${o}'`).join(", ")} are missing their option name or value (e.g. 'addon=option1:value1+option2:value2').`;
|
|
597
|
+
throw new Error(message);
|
|
598
|
+
}
|
|
599
|
+
return options$1;
|
|
600
|
+
}
|
|
591
601
|
|
|
592
602
|
//#endregion
|
|
593
603
|
//#region packages/cli/commands/add/fetch-packages.ts
|
|
@@ -745,22 +755,16 @@ const add = new Command("add").description("applies specified add-ons into a pro
|
|
|
745
755
|
console.error(`Malformed arguments: Add-on '${addonId}' is repeated multiple times.`);
|
|
746
756
|
process.exit(1);
|
|
747
757
|
}
|
|
748
|
-
|
|
758
|
+
try {
|
|
759
|
+
const options$1 = parseAddonOptions(optionFlags);
|
|
749
760
|
prev.push({
|
|
750
761
|
id: addonId,
|
|
751
|
-
options:
|
|
762
|
+
options: options$1
|
|
752
763
|
});
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
if (optionFlags.length > 0 && !/.+:.*/.test(optionFlags)) {
|
|
756
|
-
console.error(`Malformed arguments: An add-on's option in '${value}' is missing it's option name or value (e.g. 'addon=option:value').`);
|
|
764
|
+
} catch (error) {
|
|
765
|
+
if (error instanceof Error) console.error(error.message);
|
|
757
766
|
process.exit(1);
|
|
758
767
|
}
|
|
759
|
-
const options$1 = optionFlags.match(/[^+]*:[^:]*(?=\+|$)/g) ?? [];
|
|
760
|
-
prev.push({
|
|
761
|
-
id: addonId,
|
|
762
|
-
options: options$1
|
|
763
|
-
});
|
|
764
768
|
return prev;
|
|
765
769
|
}).option("-C, --cwd <path>", "path to working directory", defaultCwd).option("--no-git-check", "even if some files are dirty, no prompt will be shown").option("--no-install", "skip installing dependencies").addOption(installOption).configureHelp({
|
|
766
770
|
...helpConfig,
|
|
@@ -955,10 +959,9 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
955
959
|
}
|
|
956
960
|
}
|
|
957
961
|
let workspace = await createWorkspace({ cwd: options$1.cwd });
|
|
958
|
-
const setups = selectedAddons.length ? selectedAddons.map(({ addon }) => addon) : officialAddons;
|
|
959
|
-
const addonSetupResults = setupAddons(setups, workspace);
|
|
960
962
|
if (selectedAddons.length === 0) {
|
|
961
|
-
const
|
|
963
|
+
const allSetupResults = setupAddons(officialAddons, workspace);
|
|
964
|
+
const addonOptions$1 = officialAddons.filter(({ id }) => allSetupResults[id].unsupported.length === 0).map(({ id, homepage: homepage$1, shortDescription }) => ({
|
|
962
965
|
label: id,
|
|
963
966
|
value: id,
|
|
964
967
|
hint: `${shortDescription} - ${homepage$1}`
|
|
@@ -982,7 +985,8 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
982
985
|
}
|
|
983
986
|
for (const { addon } of selectedAddons) {
|
|
984
987
|
workspace = await createWorkspace(workspace);
|
|
985
|
-
const
|
|
988
|
+
const setups = selectedAddons.map(({ addon: addon$1 }) => addon$1);
|
|
989
|
+
const setupResult = setupAddons(setups, workspace)[addon.id];
|
|
986
990
|
const missingDependencies = setupResult.dependsOn.filter((depId) => !selectedAddons.some((a) => a.addon.id === depId));
|
|
987
991
|
for (const depId of missingDependencies) {
|
|
988
992
|
const dependency = officialAddons.find((a) => a.id === depId);
|
|
@@ -999,6 +1003,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
999
1003
|
}
|
|
1000
1004
|
}
|
|
1001
1005
|
const addons = selectedAddons.map(({ addon }) => addon);
|
|
1006
|
+
const addonSetupResults = setupAddons(addons, workspace);
|
|
1002
1007
|
const verifications = [...verifyCleanWorkingDirectory(options$1.cwd, options$1.gitCheck), ...verifyUnsupportedAddons(addons, addonSetupResults)];
|
|
1003
1008
|
const fails = [];
|
|
1004
1009
|
for (const verification of verifications) {
|
|
@@ -1356,10 +1361,7 @@ async function createProject(cwd, options$1) {
|
|
|
1356
1361
|
|
|
1357
1362
|
//#endregion
|
|
1358
1363
|
//#region packages/cli/commands/migrate.ts
|
|
1359
|
-
const migrate = new Command("migrate").description("a CLI for migrating Svelte(Kit) codebases").argument("
|
|
1360
|
-
runMigrate(process.cwd(), ["--help"]);
|
|
1361
|
-
return "";
|
|
1362
|
-
} }).action((migration, options$1) => {
|
|
1364
|
+
const migrate = new Command("migrate").description("a CLI for migrating Svelte(Kit) codebases").argument("[migration]", "migration to run").option("-C, --cwd <path>", "path to working directory", process.cwd()).action((migration, options$1) => {
|
|
1363
1365
|
runMigrate(options$1.cwd, [migration]);
|
|
1364
1366
|
});
|
|
1365
1367
|
function runMigrate(cwd, args) {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sv",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A CLI for creating and updating SvelteKit projects",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"tinyexec": "^0.3.2",
|
|
38
38
|
"valibot": "^0.41.0",
|
|
39
39
|
"@sveltejs/addons": "0.0.0",
|
|
40
|
-
"@sveltejs/
|
|
41
|
-
"@sveltejs/
|
|
40
|
+
"@sveltejs/cli-core": "0.0.0",
|
|
41
|
+
"@sveltejs/create": "0.0.0"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"create",
|