sv 0.16.1 → 0.16.3
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/bin.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { _ as name, a as detectPackageManager, d as Command, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as program, v as version } from "./engine-
|
|
2
|
+
import { _ as name, a as detectPackageManager, d as Command, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as program, v as version } from "./engine-B1KphrBP.mjs";
|
|
3
3
|
import { color, resolveCommandArray } from "@sveltejs/sv-utils";
|
|
4
|
-
import
|
|
4
|
+
import V from "node:process";
|
|
5
5
|
import { execSync } from "node:child_process";
|
|
6
6
|
//#region src/cli/check.ts
|
|
7
|
-
const check = new Command("check").description("a CLI for checking your Svelte code").allowUnknownOption(true).allowExcessArguments(true).option("-C, --cwd <path>", "path to working directory",
|
|
7
|
+
const check = new Command("check").description("a CLI for checking your Svelte code").allowUnknownOption(true).allowExcessArguments(true).option("-C, --cwd <path>", "path to working directory", V.cwd()).helpOption(false).action(async (options, check) => {
|
|
8
8
|
const cwd = options.cwd;
|
|
9
9
|
const args = check.args;
|
|
10
10
|
await runCheck(cwd, args);
|
|
@@ -13,7 +13,7 @@ async function runCheck(cwd, args) {
|
|
|
13
13
|
const pm = await detectPackageManager(cwd);
|
|
14
14
|
if (!from(cwd, "svelte-check", true)) {
|
|
15
15
|
console.error(`'svelte-check' is not installed locally. Install it with: ${color.command(resolveCommandArray(pm, "add", ["-D", "svelte-check"]))}`);
|
|
16
|
-
|
|
16
|
+
V.exit(1);
|
|
17
17
|
}
|
|
18
18
|
if (args.includes("--help")) {
|
|
19
19
|
console.log(`All svelte-check [options] are available in sv check [options]`);
|
|
@@ -32,7 +32,7 @@ async function runCheck(cwd, args) {
|
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region src/cli/migrate.ts
|
|
35
|
-
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",
|
|
35
|
+
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", V.cwd()).action(async (migration, options) => {
|
|
36
36
|
await runMigrate(options.cwd, [migration]);
|
|
37
37
|
});
|
|
38
38
|
async function runMigrate(cwd, args) {
|
|
@@ -53,7 +53,7 @@ async function runMigrate(cwd, args) {
|
|
|
53
53
|
console.log();
|
|
54
54
|
program.name(name).version(version, "-v, --version").configureHelp(helpConfig);
|
|
55
55
|
program.addCommand(create).addCommand(add).addCommand(migrate).addCommand(check);
|
|
56
|
-
if (
|
|
56
|
+
if (V.argv.includes("--help") || V.argv.includes("-h")) program.addHelpText("after", () => "\n" + create.helpInformation());
|
|
57
57
|
program.parse();
|
|
58
58
|
//#endregion
|
|
59
59
|
export {};
|
|
@@ -3,9 +3,9 @@ import { AGENTS, COMMANDS, Walker, coerceVersion, color, constructCommand, creat
|
|
|
3
3
|
import fs, { closeSync, existsSync, openSync, readSync, statSync } from "node:fs";
|
|
4
4
|
import path, { basename, delimiter, dirname, isAbsolute, join, normalize, resolve } from "node:path";
|
|
5
5
|
import { promisify, stripVTControlCharacters, styleText } from "node:util";
|
|
6
|
-
import
|
|
6
|
+
import V, { cwd, stdin, stdout } from "node:process";
|
|
7
7
|
import * as b$1 from "node:readline";
|
|
8
|
-
import
|
|
8
|
+
import G from "node:readline";
|
|
9
9
|
import { ReadStream } from "node:tty";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import childProcess, { exec, spawn } from "node:child_process";
|
|
@@ -37,7 +37,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
37
37
|
value: mod,
|
|
38
38
|
enumerable: true
|
|
39
39
|
}) : target, mod));
|
|
40
|
-
var __require = /*
|
|
40
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/core/deprecated.ts
|
|
43
43
|
const warned = /* @__PURE__ */ new Set();
|
|
@@ -392,7 +392,7 @@ function f(r, t, s) {
|
|
|
392
392
|
return s[n].disabled ? f(n, t < 0 ? -1 : 1, s) : n;
|
|
393
393
|
}
|
|
394
394
|
const h$1 = {
|
|
395
|
-
actions: new Set([
|
|
395
|
+
actions: /* @__PURE__ */ new Set([
|
|
396
396
|
"up",
|
|
397
397
|
"down",
|
|
398
398
|
"left",
|
|
@@ -401,7 +401,7 @@ const h$1 = {
|
|
|
401
401
|
"enter",
|
|
402
402
|
"cancel"
|
|
403
403
|
]),
|
|
404
|
-
aliases: new Map([
|
|
404
|
+
aliases: /* @__PURE__ */ new Map([
|
|
405
405
|
["k", "up"],
|
|
406
406
|
["j", "down"],
|
|
407
407
|
["h", "left"],
|
|
@@ -561,7 +561,7 @@ var m = class {
|
|
|
561
561
|
this.state = "cancel", this.close();
|
|
562
562
|
}, { once: !0 });
|
|
563
563
|
}
|
|
564
|
-
this.rl =
|
|
564
|
+
this.rl = G.createInterface({
|
|
565
565
|
input: this.input,
|
|
566
566
|
tabSize: 2,
|
|
567
567
|
prompt: "",
|
|
@@ -680,12 +680,6 @@ var Z = class extends m {
|
|
|
680
680
|
});
|
|
681
681
|
}
|
|
682
682
|
};
|
|
683
|
-
new Set([
|
|
684
|
-
"up",
|
|
685
|
-
"down",
|
|
686
|
-
"left",
|
|
687
|
-
"right"
|
|
688
|
-
]);
|
|
689
683
|
let ut$1 = class extends m {
|
|
690
684
|
options;
|
|
691
685
|
cursor = 0;
|
|
@@ -784,7 +778,7 @@ var ct$1 = class extends m {
|
|
|
784
778
|
//#endregion
|
|
785
779
|
//#region ../../node_modules/.pnpm/@clack+prompts@1.5.0/node_modules/@clack/prompts/dist/index.mjs
|
|
786
780
|
function se() {
|
|
787
|
-
return
|
|
781
|
+
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";
|
|
788
782
|
}
|
|
789
783
|
const tt = se(), at = () => process.env.CI === "true", Tt = (t) => t.isTTY === !0, w$1 = (t, i) => tt ? t : i, _t = w$1("◆", "*"), ut = w$1("■", "x"), lt = w$1("▲", "x"), H = w$1("◇", "o"), ct = w$1("┌", "T"), $ = w$1("│", "|"), x$1 = w$1("└", "—"), z$1 = w$1("●", ">"), U = w$1("○", " "), et = w$1("◻", "[•]"), K = w$1("◼", "[+]"), Y = w$1("◻", "[ ]"), st = w$1("─", "-"), $t = w$1("╮", "+"), Mt = w$1("├", "+"), dt = w$1("╯", "+"), ht = w$1("╰", "+"), pt = w$1("●", "•"), mt = w$1("◆", "*"), gt = w$1("▲", "!"), yt = w$1("■", "x"), P$1 = (t) => {
|
|
790
784
|
switch (t) {
|
|
@@ -1031,7 +1025,7 @@ ${r ? styleText("cyan", x$1) : ""}
|
|
|
1031
1025
|
`), n = u.reduce((o, l) => Math.max(fastStringWidth(l), o), 0);
|
|
1032
1026
|
return wrapAnsi(t, i - (u.map(s).reduce((o, l) => Math.max(fastStringWidth(l), o), 0) - n), r);
|
|
1033
1027
|
}, Ce = (t = "", i = "", s) => {
|
|
1034
|
-
const r = s?.output ??
|
|
1028
|
+
const r = s?.output ?? V.stdout, u = s?.withGuide ?? h$1.withGuide, n = s?.format ?? be, a = [
|
|
1035
1029
|
"",
|
|
1036
1030
|
...Se(t, A(r) - 6, n).split(`
|
|
1037
1031
|
`).map(n),
|
|
@@ -1354,7 +1348,7 @@ ${i ? styleText("cyan", x$1) : ""}
|
|
|
1354
1348
|
//#endregion
|
|
1355
1349
|
//#region package.json
|
|
1356
1350
|
var name = "sv";
|
|
1357
|
-
var version = "0.16.
|
|
1351
|
+
var version = "0.16.3";
|
|
1358
1352
|
//#endregion
|
|
1359
1353
|
//#region src/core/errors.ts
|
|
1360
1354
|
var UnsupportedError = class extends Error {
|
|
@@ -1459,7 +1453,7 @@ async function runCommand(action) {
|
|
|
1459
1453
|
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."));
|
|
1460
1454
|
ye(`Welcome to the Svelte CLI! ${color.optional(`(v${version})`)}`);
|
|
1461
1455
|
const minimumVersion = "18.3.0";
|
|
1462
|
-
if (isVersionUnsupportedBelow(
|
|
1456
|
+
if (isVersionUnsupportedBelow(V.versions.node, minimumVersion)) R$1.warn(`You are using Node.js ${color.error(V.versions.node)}, please upgrade to Node.js ${color.success(minimumVersion)} or higher.`);
|
|
1463
1457
|
await action();
|
|
1464
1458
|
fe("You're all set!");
|
|
1465
1459
|
} catch (e) {
|
|
@@ -1480,8 +1474,8 @@ function getPadding(lines) {
|
|
|
1480
1474
|
return Math.max(...lengths);
|
|
1481
1475
|
}
|
|
1482
1476
|
function forwardExitCode(error) {
|
|
1483
|
-
if (error && typeof error === "object" && "status" in error && typeof error.status === "number")
|
|
1484
|
-
else
|
|
1477
|
+
if (error && typeof error === "object" && "status" in error && typeof error.status === "number") V.exit(error.status);
|
|
1478
|
+
else V.exit(1);
|
|
1485
1479
|
}
|
|
1486
1480
|
function parseAddonOptions(optionFlags) {
|
|
1487
1481
|
if (optionFlags === void 0 || optionFlags === "") return;
|
|
@@ -1527,7 +1521,7 @@ function errorAndExit(message) {
|
|
|
1527
1521
|
R$1.error(message);
|
|
1528
1522
|
R$1.message();
|
|
1529
1523
|
ge("Operation failed.");
|
|
1530
|
-
|
|
1524
|
+
V.exit(1);
|
|
1531
1525
|
}
|
|
1532
1526
|
const normalizePosix = (dir) => {
|
|
1533
1527
|
return path.posix.normalize(dir.replace(/\\/g, "/"));
|
|
@@ -1968,7 +1962,7 @@ var I = class {
|
|
|
1968
1962
|
if (this._streamErr) t.push(this._streamErr);
|
|
1969
1963
|
if (this._streamOut) t.push(this._streamOut);
|
|
1970
1964
|
const n = b(t);
|
|
1971
|
-
const r =
|
|
1965
|
+
const r = G.createInterface({ input: n });
|
|
1972
1966
|
for await (const e of r) yield e.toString();
|
|
1973
1967
|
await this._processClosed;
|
|
1974
1968
|
e.removeAllListeners();
|
|
@@ -3076,13 +3070,13 @@ var Command = class Command extends EventEmitter {
|
|
|
3076
3070
|
this._showSuggestionAfterError = true;
|
|
3077
3071
|
this._savedState = null;
|
|
3078
3072
|
this._outputConfiguration = {
|
|
3079
|
-
writeOut: (str) =>
|
|
3080
|
-
writeErr: (str) =>
|
|
3073
|
+
writeOut: (str) => V.stdout.write(str),
|
|
3074
|
+
writeErr: (str) => V.stderr.write(str),
|
|
3081
3075
|
outputError: (str, write) => write(str),
|
|
3082
|
-
getOutHelpWidth: () =>
|
|
3083
|
-
getErrHelpWidth: () =>
|
|
3084
|
-
getOutHasColors: () => useColor() ?? (
|
|
3085
|
-
getErrHasColors: () => useColor() ?? (
|
|
3076
|
+
getOutHelpWidth: () => V.stdout.isTTY ? V.stdout.columns : void 0,
|
|
3077
|
+
getErrHelpWidth: () => V.stderr.isTTY ? V.stderr.columns : void 0,
|
|
3078
|
+
getOutHasColors: () => useColor() ?? (V.stdout.isTTY && V.stdout.hasColors?.()),
|
|
3079
|
+
getErrHasColors: () => useColor() ?? (V.stderr.isTTY && V.stderr.hasColors?.()),
|
|
3086
3080
|
stripColor: (str) => stripVTControlCharacters(str)
|
|
3087
3081
|
};
|
|
3088
3082
|
this._hidden = false;
|
|
@@ -3451,7 +3445,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3451
3445
|
*/
|
|
3452
3446
|
_exit(exitCode, code, message) {
|
|
3453
3447
|
if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code, message));
|
|
3454
|
-
|
|
3448
|
+
V.exit(exitCode);
|
|
3455
3449
|
}
|
|
3456
3450
|
/**
|
|
3457
3451
|
* Register callback `fn` for the command.
|
|
@@ -3789,11 +3783,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3789
3783
|
if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
|
|
3790
3784
|
parseOptions = parseOptions || {};
|
|
3791
3785
|
if (argv === void 0 && parseOptions.from === void 0) {
|
|
3792
|
-
if (
|
|
3793
|
-
const execArgv =
|
|
3786
|
+
if (V.versions?.electron) parseOptions.from = "electron";
|
|
3787
|
+
const execArgv = V.execArgv ?? [];
|
|
3794
3788
|
if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) parseOptions.from = "eval";
|
|
3795
3789
|
}
|
|
3796
|
-
if (argv === void 0) argv =
|
|
3790
|
+
if (argv === void 0) argv = V.argv;
|
|
3797
3791
|
this.rawArgs = argv.slice();
|
|
3798
3792
|
let userArgs;
|
|
3799
3793
|
switch (parseOptions.from) {
|
|
@@ -3803,7 +3797,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3803
3797
|
userArgs = argv.slice(2);
|
|
3804
3798
|
break;
|
|
3805
3799
|
case "electron":
|
|
3806
|
-
if (
|
|
3800
|
+
if (V.defaultApp) {
|
|
3807
3801
|
this._scriptPath = argv[1];
|
|
3808
3802
|
userArgs = argv.slice(2);
|
|
3809
3803
|
} else userArgs = argv.slice(1);
|
|
@@ -3972,16 +3966,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3972
3966
|
}
|
|
3973
3967
|
const launchWithNode = sourceExt.includes(path.extname(executableFile));
|
|
3974
3968
|
let proc;
|
|
3975
|
-
if (
|
|
3969
|
+
if (V.platform !== "win32") if (launchWithNode) {
|
|
3976
3970
|
args.unshift(executableFile);
|
|
3977
|
-
args = incrementNodeInspectorPort(
|
|
3978
|
-
proc = childProcess.spawn(
|
|
3971
|
+
args = incrementNodeInspectorPort(V.execArgv).concat(args);
|
|
3972
|
+
proc = childProcess.spawn(V.argv[0], args, { stdio: "inherit" });
|
|
3979
3973
|
} else proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
|
|
3980
3974
|
else {
|
|
3981
3975
|
this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
3982
3976
|
args.unshift(executableFile);
|
|
3983
|
-
args = incrementNodeInspectorPort(
|
|
3984
|
-
proc = childProcess.spawn(
|
|
3977
|
+
args = incrementNodeInspectorPort(V.execArgv).concat(args);
|
|
3978
|
+
proc = childProcess.spawn(V.execPath, args, { stdio: "inherit" });
|
|
3985
3979
|
}
|
|
3986
3980
|
if (!proc.killed) [
|
|
3987
3981
|
"SIGUSR1",
|
|
@@ -3990,20 +3984,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3990
3984
|
"SIGINT",
|
|
3991
3985
|
"SIGHUP"
|
|
3992
3986
|
].forEach((signal) => {
|
|
3993
|
-
|
|
3987
|
+
V.on(signal, () => {
|
|
3994
3988
|
if (proc.killed === false && proc.exitCode === null) proc.kill(signal);
|
|
3995
3989
|
});
|
|
3996
3990
|
});
|
|
3997
3991
|
const exitCallback = this._exitCallback;
|
|
3998
3992
|
proc.on("close", (code) => {
|
|
3999
3993
|
code = code ?? 1;
|
|
4000
|
-
if (!exitCallback)
|
|
3994
|
+
if (!exitCallback) V.exit(code);
|
|
4001
3995
|
else exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
|
|
4002
3996
|
});
|
|
4003
3997
|
proc.on("error", (err) => {
|
|
4004
3998
|
if (err.code === "ENOENT") this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
4005
3999
|
else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
|
|
4006
|
-
if (!exitCallback)
|
|
4000
|
+
if (!exitCallback) V.exit(1);
|
|
4007
4001
|
else {
|
|
4008
4002
|
const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
|
|
4009
4003
|
wrappedError.nestedError = err;
|
|
@@ -4415,13 +4409,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4415
4409
|
*/
|
|
4416
4410
|
_parseOptionsEnv() {
|
|
4417
4411
|
this.options.forEach((option) => {
|
|
4418
|
-
if (option.envVar && option.envVar in
|
|
4412
|
+
if (option.envVar && option.envVar in V.env) {
|
|
4419
4413
|
const optionKey = option.attributeName();
|
|
4420
4414
|
if (this.getOptionValue(optionKey) === void 0 || [
|
|
4421
4415
|
"default",
|
|
4422
4416
|
"config",
|
|
4423
4417
|
"env"
|
|
4424
|
-
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`,
|
|
4418
|
+
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, V.env[option.envVar]);
|
|
4425
4419
|
else this.emit(`optionEnv:${option.name()}`);
|
|
4426
4420
|
}
|
|
4427
4421
|
});
|
|
@@ -4901,7 +4895,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4901
4895
|
*/
|
|
4902
4896
|
help(contextOptions) {
|
|
4903
4897
|
this.outputHelp(contextOptions);
|
|
4904
|
-
let exitCode = Number(
|
|
4898
|
+
let exitCode = Number(V.exitCode ?? 0);
|
|
4905
4899
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
|
|
4906
4900
|
this._exit(exitCode, "commander.help", "(outputHelp)");
|
|
4907
4901
|
}
|
|
@@ -4993,8 +4987,8 @@ function incrementNodeInspectorPort(args) {
|
|
|
4993
4987
|
* @package
|
|
4994
4988
|
*/
|
|
4995
4989
|
function useColor() {
|
|
4996
|
-
if (
|
|
4997
|
-
if (
|
|
4990
|
+
if (V.env.NO_COLOR || V.env.FORCE_COLOR === "0" || V.env.FORCE_COLOR === "false") return false;
|
|
4991
|
+
if (V.env.FORCE_COLOR || V.env.CLICOLOR_FORCE !== void 0) return true;
|
|
4998
4992
|
}
|
|
4999
4993
|
//#endregion
|
|
5000
4994
|
//#region ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/index.js
|
|
@@ -5731,6 +5725,61 @@ const addEslintConfigPrettier = transforms.script(({ ast, js }) => {
|
|
|
5731
5725
|
if (idx !== -1) elements.splice(idx + 1, 0, ...nodesToInsert);
|
|
5732
5726
|
else elements.push(...nodesToInsert);
|
|
5733
5727
|
});
|
|
5728
|
+
/**
|
|
5729
|
+
* Path of the prettier config file we generate. We always emit a `.js` file (with a JSDoc `@type`)
|
|
5730
|
+
* rather than `.ts`, since the VSCode prettier extension can't load a `.ts` config without a recent
|
|
5731
|
+
* enough Node in its extension host (see prettier/prettier-vscode#3989).
|
|
5732
|
+
*/
|
|
5733
|
+
function prettierConfigPath() {
|
|
5734
|
+
return "prettier.config.js";
|
|
5735
|
+
}
|
|
5736
|
+
/**
|
|
5737
|
+
* Creates a `prettier.config.js` file with our defaults. Bails (leaving the file untouched)
|
|
5738
|
+
* if a config is already defined.
|
|
5739
|
+
*/
|
|
5740
|
+
const createPrettierConfig = (opts) => transforms.script(({ ast, comments, js }) => {
|
|
5741
|
+
if (ast.body.some((node) => node.type === "ExportDefaultDeclaration")) {
|
|
5742
|
+
R$1.warn(`A ${color.warning("prettier")} config already exists. Skipping initialization.`);
|
|
5743
|
+
return false;
|
|
5744
|
+
}
|
|
5745
|
+
const plugins = ["prettier-plugin-svelte"];
|
|
5746
|
+
if (opts.tailwind) plugins.push("prettier-plugin-tailwindcss");
|
|
5747
|
+
const properties = [
|
|
5748
|
+
"useTabs: true",
|
|
5749
|
+
"singleQuote: true",
|
|
5750
|
+
`trailingComma: 'none'`,
|
|
5751
|
+
"printWidth: 100",
|
|
5752
|
+
`plugins: [${plugins.map((p) => `'${p}'`).join(", ")}]`,
|
|
5753
|
+
`overrides: [{ files: '*.svelte', options: { parser: 'svelte' } }]`
|
|
5754
|
+
];
|
|
5755
|
+
if (opts.tailwind && opts.stylesheet) properties.push(`tailwindStylesheet: '${opts.stylesheet}'`);
|
|
5756
|
+
js.common.appendFromString(ast, {
|
|
5757
|
+
comments,
|
|
5758
|
+
code: `
|
|
5759
|
+
/** @type {import("prettier").Config} */
|
|
5760
|
+
const config = { ${properties.join(", ")} };
|
|
5761
|
+
export default config;
|
|
5762
|
+
`
|
|
5763
|
+
});
|
|
5764
|
+
});
|
|
5765
|
+
/**
|
|
5766
|
+
* Augments an existing `prettier.config.js` config object with the tailwindcss plugin and
|
|
5767
|
+
* stylesheet. Used when prettier was added before tailwindcss.
|
|
5768
|
+
*/
|
|
5769
|
+
const addPrettierTailwind = (opts) => transforms.script(({ ast, js }) => {
|
|
5770
|
+
if (!ast.body.some((node) => node.type === "ExportDefaultDeclaration")) return false;
|
|
5771
|
+
const { value } = js.exports.createDefault(ast, { fallback: js.object.create({}) });
|
|
5772
|
+
if (value.type !== "ObjectExpression") return false;
|
|
5773
|
+
const plugins = js.object.property(value, {
|
|
5774
|
+
name: "plugins",
|
|
5775
|
+
fallback: js.array.create()
|
|
5776
|
+
});
|
|
5777
|
+
if (plugins.type === "ArrayExpression") js.array.append(plugins, "prettier-plugin-tailwindcss");
|
|
5778
|
+
if (!value.properties.some((p) => p.type === "Property" && p.key.type === "Identifier" && p.key.name === "tailwindStylesheet")) js.object.property(value, {
|
|
5779
|
+
name: "tailwindStylesheet",
|
|
5780
|
+
fallback: js.common.createLiteral(opts.stylesheet)
|
|
5781
|
+
});
|
|
5782
|
+
});
|
|
5734
5783
|
const addToDemoPage = (path, language) => transforms.svelteScript({ language }, ({ ast, js, svelte }) => {
|
|
5735
5784
|
for (const node of ast.fragment.nodes) if (node.type === "RegularElement") {
|
|
5736
5785
|
const hrefAttribute = node.attributes.find((x) => x.type === "Attribute" && x.name === "href");
|
|
@@ -5751,16 +5800,16 @@ const addToDemoPage = (path, language) => transforms.svelteScript({ language },
|
|
|
5751
5800
|
* the nearest `LTS` release version.
|
|
5752
5801
|
*/
|
|
5753
5802
|
function getNodeTypesVersion() {
|
|
5754
|
-
const nodeVersion =
|
|
5755
|
-
const isDenoOrBun = Boolean(
|
|
5803
|
+
const nodeVersion = V.versions.node;
|
|
5804
|
+
const isDenoOrBun = Boolean(V.versions.deno ?? V.versions.bun);
|
|
5756
5805
|
const [major] = nodeVersion.split(".");
|
|
5757
5806
|
const majorNum = Number(major);
|
|
5758
5807
|
const isEvenMajor = majorNum % 2 === 0;
|
|
5759
|
-
if (!!
|
|
5808
|
+
if (!!V.release.lts || isDenoOrBun && isEvenMajor) return `^${major}`;
|
|
5760
5809
|
return `^${isEvenMajor ? majorNum - 2 : majorNum - 1}`;
|
|
5761
5810
|
}
|
|
5762
5811
|
//#endregion
|
|
5763
|
-
//#region \0@oxc-project+runtime@0.
|
|
5812
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/taggedTemplateLiteral.js
|
|
5764
5813
|
function _taggedTemplateLiteral(e, t) {
|
|
5765
5814
|
return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } }));
|
|
5766
5815
|
}
|
|
@@ -5960,10 +6009,7 @@ var better_auth_default = defineAddon({
|
|
|
5960
6009
|
imports: [d1 ? "createAuth" : "auth"],
|
|
5961
6010
|
from: "$lib/server/auth"
|
|
5962
6011
|
});
|
|
5963
|
-
|
|
5964
|
-
imports: ["building"],
|
|
5965
|
-
from: "$app/environment"
|
|
5966
|
-
});
|
|
6012
|
+
env.importEnv(ast, js, ["building"]);
|
|
5967
6013
|
const handleContent = dedent`
|
|
5968
6014
|
async ({ event, resolve }) => {${d1 ? dedent`
|
|
5969
6015
|
if (!event.platform?.env?.DB) throw new Error('D1 binding "DB" not found - are you running with wrangler?');
|
|
@@ -6426,7 +6472,7 @@ var drizzle_default = defineAddon({
|
|
|
6426
6472
|
sv,
|
|
6427
6473
|
cwd
|
|
6428
6474
|
}, ({ override, js }) => {
|
|
6429
|
-
override({ typescript: { config: js.common.parseExpression(`(config) =>
|
|
6475
|
+
override({ typescript: { config: js.common.parseExpression(`(config) => { config.include.push('../drizzle.config.${language}')}`) } });
|
|
6430
6476
|
});
|
|
6431
6477
|
sv.file(paths["database schema"], transforms.script(({ ast, js }) => {
|
|
6432
6478
|
let taskSchemaExpression;
|
|
@@ -6624,7 +6670,7 @@ var drizzle_default = defineAddon({
|
|
|
6624
6670
|
]))} to add it`);
|
|
6625
6671
|
const ext = fileExists(cwd, "wrangler.toml") ? "toml" : "jsonc";
|
|
6626
6672
|
steps.push(`Add your ${color.env("CLOUDFLARE_ACCOUNT_ID")}, ${color.env("CLOUDFLARE_DATABASE_ID")}, and ${color.env("CLOUDFLARE_D1_TOKEN")} to ${color.path(".env")}`);
|
|
6627
|
-
steps.push(`Run ${color.command(resolveCommandArray(packageManager, "
|
|
6673
|
+
steps.push(`Run ${color.command(resolveCommandArray(packageManager, "execute-local", [
|
|
6628
6674
|
"wrangler",
|
|
6629
6675
|
"d1",
|
|
6630
6676
|
"create",
|
|
@@ -7118,9 +7164,14 @@ var paraglide_default = defineAddon({
|
|
|
7118
7164
|
setup: ({ isKit, unsupported }) => {
|
|
7119
7165
|
if (!isKit) unsupported("Requires SvelteKit");
|
|
7120
7166
|
},
|
|
7121
|
-
run: ({ sv, options, file, language, directory }) => {
|
|
7167
|
+
run: ({ sv, options, file, language, directory, cwd, dependencyVersion }) => {
|
|
7122
7168
|
const [ts] = createPrinter(language === "ts");
|
|
7123
7169
|
const paraglideOutDir = `${directory.lib}/paraglide`;
|
|
7170
|
+
const env = defineEnv({
|
|
7171
|
+
sv,
|
|
7172
|
+
cwd,
|
|
7173
|
+
dependencyVersion
|
|
7174
|
+
});
|
|
7124
7175
|
sv.devDependency("@inlang/paraglide-js", "^2.18.2");
|
|
7125
7176
|
sv.file(file.viteConfig, transforms.script(({ ast, js }) => {
|
|
7126
7177
|
const vitePluginName = "paraglideVitePlugin";
|
|
@@ -7129,9 +7180,10 @@ var paraglide_default = defineAddon({
|
|
|
7129
7180
|
from: "@inlang/paraglide-js"
|
|
7130
7181
|
});
|
|
7131
7182
|
js.vite.addPlugin(ast, { code: `${vitePluginName}({
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7183
|
+
project: './project.inlang',
|
|
7184
|
+
outdir: './${paraglideOutDir}',
|
|
7185
|
+
strategy: ['url']
|
|
7186
|
+
})` });
|
|
7135
7187
|
}));
|
|
7136
7188
|
sv.file(`src/hooks.${language}`, transforms.script(({ ast, comments, js }) => {
|
|
7137
7189
|
js.imports.addNamed(ast, {
|
|
@@ -7186,11 +7238,66 @@ var paraglide_default = defineAddon({
|
|
|
7186
7238
|
html.addAttribute(htmlNode, "lang", "%paraglide.lang%");
|
|
7187
7239
|
html.addAttribute(htmlNode, "dir", "%paraglide.dir%");
|
|
7188
7240
|
}));
|
|
7189
|
-
sv.file(
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7241
|
+
sv.file(`${directory.lib}/paraglide.svelte.${language}`, transforms.script(({ ast, js, comments }) => {
|
|
7242
|
+
js.imports.addNamed(ast, {
|
|
7243
|
+
imports: [
|
|
7244
|
+
"baseLocale",
|
|
7245
|
+
"localizeUrl",
|
|
7246
|
+
"overwriteGetLocale",
|
|
7247
|
+
"overwriteSetLocale",
|
|
7248
|
+
"toLocale"
|
|
7249
|
+
],
|
|
7250
|
+
from: "$lib/paraglide/runtime"
|
|
7251
|
+
});
|
|
7252
|
+
js.imports.addNamed(ast, {
|
|
7253
|
+
imports: ["page"],
|
|
7254
|
+
from: "$app/state"
|
|
7255
|
+
});
|
|
7256
|
+
js.imports.addNamed(ast, {
|
|
7257
|
+
imports: ["goto"],
|
|
7258
|
+
from: "$app/navigation"
|
|
7259
|
+
});
|
|
7260
|
+
env.importEnv(ast, js, ["browser"]);
|
|
7261
|
+
if (language === "ts") js.imports.addNamed(ast, {
|
|
7262
|
+
imports: { Locale: "_Locale" },
|
|
7263
|
+
from: "$lib/paraglide/runtime",
|
|
7264
|
+
isType: true
|
|
7265
|
+
});
|
|
7266
|
+
const codeBlock = dedent`
|
|
7267
|
+
export class Locale {
|
|
7268
|
+
#current${ts(": _Locale")} = $state(toLocale(browser && document.querySelector('html')?.lang) ?? baseLocale);
|
|
7269
|
+
constructor() {
|
|
7270
|
+
overwriteGetLocale(() => this.#current);
|
|
7271
|
+
overwriteSetLocale((locale) => {
|
|
7272
|
+
this.#current = locale;
|
|
7273
|
+
goto(localizeUrl(page.url.pathname, { locale }).href);
|
|
7274
|
+
});
|
|
7275
|
+
}
|
|
7276
|
+
}`;
|
|
7277
|
+
js.common.appendFromString(ast, {
|
|
7278
|
+
code: codeBlock,
|
|
7279
|
+
comments
|
|
7280
|
+
});
|
|
7281
|
+
}));
|
|
7282
|
+
sv.file(`src/hooks.client.${language}`, transforms.script(({ ast, comments, js }) => {
|
|
7283
|
+
js.imports.addNamed(ast, {
|
|
7284
|
+
imports: ["Locale"],
|
|
7285
|
+
from: "$lib/paraglide.svelte"
|
|
7286
|
+
});
|
|
7287
|
+
if (language === "ts") js.imports.addNamed(ast, {
|
|
7288
|
+
imports: ["ClientInit"],
|
|
7289
|
+
from: "@sveltejs/kit",
|
|
7290
|
+
isType: true
|
|
7291
|
+
});
|
|
7292
|
+
const init = dedent`
|
|
7293
|
+
export const init${ts(": ClientInit")} = () => {
|
|
7294
|
+
new Locale()
|
|
7295
|
+
}
|
|
7296
|
+
`;
|
|
7297
|
+
js.common.appendFromString(ast, {
|
|
7298
|
+
code: init,
|
|
7299
|
+
comments
|
|
7300
|
+
});
|
|
7194
7301
|
}));
|
|
7195
7302
|
sv.file("project.inlang/settings.json", transforms.json(({ data }) => {
|
|
7196
7303
|
if (Object.keys(data).length > 0) return false;
|
|
@@ -7327,11 +7434,11 @@ var playwright_default = defineAddon({
|
|
|
7327
7434
|
else R$1.warn("Unexpected playwright config for playwright add-on. Could not update.");
|
|
7328
7435
|
}));
|
|
7329
7436
|
},
|
|
7330
|
-
nextSteps: ({ isKit }) => {
|
|
7437
|
+
nextSteps: ({ isKit, packageManager }) => {
|
|
7331
7438
|
const steps = [];
|
|
7332
|
-
steps.push(`Run ${color.command("
|
|
7439
|
+
steps.push(`Run ${color.command(resolveCommandArray(packageManager, "execute-local", ["playwright", "install"]))} to download browsers`);
|
|
7333
7440
|
if (isKit) steps.push(`Visit ${color.route("/demo/playwright")} to see the demo page`);
|
|
7334
|
-
steps.push(`Run ${color.command("
|
|
7441
|
+
steps.push(`Run ${color.command(resolveCommandArray(packageManager, "run", ["test:e2e"]))} to execute the example tests`);
|
|
7335
7442
|
return steps;
|
|
7336
7443
|
}
|
|
7337
7444
|
});
|
|
@@ -7361,27 +7468,10 @@ var prettier_default = defineAddon({
|
|
|
7361
7468
|
/static/
|
|
7362
7469
|
`;
|
|
7363
7470
|
}));
|
|
7364
|
-
sv.file(
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
data.trailingComma = "none";
|
|
7369
|
-
data.printWidth = 100;
|
|
7370
|
-
}
|
|
7371
|
-
json.arrayUpsert(data, "plugins", "prettier-plugin-svelte");
|
|
7372
|
-
if (tailwindcssInstalled) {
|
|
7373
|
-
json.arrayUpsert(data, "plugins", "prettier-plugin-tailwindcss");
|
|
7374
|
-
data.tailwindStylesheet ??= file.getRelative({ to: file.stylesheet });
|
|
7375
|
-
}
|
|
7376
|
-
data.overrides ??= [];
|
|
7377
|
-
const overrides = data.overrides;
|
|
7378
|
-
if (!overrides.find((o) => o?.options?.parser === "svelte")) overrides.push({
|
|
7379
|
-
files: "*.svelte",
|
|
7380
|
-
options: { parser: "svelte" }
|
|
7381
|
-
});
|
|
7382
|
-
}, { onError: () => {
|
|
7383
|
-
R$1.warn(`A ${color.warning(".prettierrc")} config already exists and cannot be parsed as JSON. Skipping initialization.`);
|
|
7384
|
-
} }));
|
|
7471
|
+
sv.file(prettierConfigPath(), createPrettierConfig({
|
|
7472
|
+
tailwind: tailwindcssInstalled,
|
|
7473
|
+
stylesheet: tailwindcssInstalled ? file.getRelative({ to: file.stylesheet }) : void 0
|
|
7474
|
+
}));
|
|
7385
7475
|
const eslintInfo = checkEslint(dependencyVersion("eslint"));
|
|
7386
7476
|
sv.file(file.package, transforms.json(({ data, json }) => {
|
|
7387
7477
|
json.packageScriptsUpsert(data, "lint", "prettier --check .", { mode: "prepend" });
|
|
@@ -7425,7 +7515,7 @@ var storybook_default = defineAddon({
|
|
|
7425
7515
|
"--skip-install",
|
|
7426
7516
|
"--no-dev"
|
|
7427
7517
|
];
|
|
7428
|
-
if (
|
|
7518
|
+
if (V.env.NODE_ENV?.toLowerCase() === "test") args.push(...["--no-features", "--yes"]);
|
|
7429
7519
|
await sv.execute(args, "inherit");
|
|
7430
7520
|
sv.devDependency(`@types/node`, getNodeTypesVersion());
|
|
7431
7521
|
}
|
|
@@ -7671,10 +7761,7 @@ var tailwindcss_default = defineAddon({
|
|
|
7671
7761
|
sv.file(".vscode/extensions.json", transforms.json(({ data, json }) => {
|
|
7672
7762
|
json.arrayUpsert(data, "recommendations", "bradlc.vscode-tailwindcss");
|
|
7673
7763
|
}));
|
|
7674
|
-
if (prettierInstalled) sv.file(
|
|
7675
|
-
json.arrayUpsert(data, "plugins", "prettier-plugin-tailwindcss");
|
|
7676
|
-
data.tailwindStylesheet ??= file.getRelative({ to: file.stylesheet });
|
|
7677
|
-
}));
|
|
7764
|
+
if (prettierInstalled) sv.file(prettierConfigPath(), addPrettierTailwind({ stylesheet: file.getRelative({ to: file.stylesheet }) }));
|
|
7678
7765
|
}
|
|
7679
7766
|
});
|
|
7680
7767
|
//#endregion
|
|
@@ -10705,7 +10792,7 @@ agentOptions.unshift({
|
|
|
10705
10792
|
const installOption = new Option("--install <package-manager>", "installs dependencies with a specified package manager").choices(AGENT_NAMES);
|
|
10706
10793
|
async function packageManagerPrompt(cwd) {
|
|
10707
10794
|
const agent = (await detect({ cwd }))?.name ?? getUserAgent();
|
|
10708
|
-
if (!
|
|
10795
|
+
if (!V.stdout.isTTY) return agent;
|
|
10709
10796
|
const pm = await Ee({
|
|
10710
10797
|
message: "Which package manager do you want to install dependencies with?",
|
|
10711
10798
|
options: agentOptions,
|
|
@@ -10713,14 +10800,14 @@ async function packageManagerPrompt(cwd) {
|
|
|
10713
10800
|
});
|
|
10714
10801
|
if (R$2(pm)) {
|
|
10715
10802
|
ge("Operation cancelled.");
|
|
10716
|
-
|
|
10803
|
+
V.exit(1);
|
|
10717
10804
|
}
|
|
10718
10805
|
return pm;
|
|
10719
10806
|
}
|
|
10720
10807
|
async function installDependencies(agent, cwd) {
|
|
10721
10808
|
const task = Pe({
|
|
10722
10809
|
title: `Installing dependencies with ${color.command(agent)}...`,
|
|
10723
|
-
limit: Math.ceil(
|
|
10810
|
+
limit: Math.ceil(V.stdout.rows / 2),
|
|
10724
10811
|
spacing: 0,
|
|
10725
10812
|
retainLog: true
|
|
10726
10813
|
});
|
|
@@ -10750,13 +10837,13 @@ async function installDependencies(agent, cwd) {
|
|
|
10750
10837
|
}
|
|
10751
10838
|
task.error("Failed to install dependencies");
|
|
10752
10839
|
ge("Operation failed.");
|
|
10753
|
-
|
|
10840
|
+
V.exit(2);
|
|
10754
10841
|
}
|
|
10755
10842
|
async function detectPackageManager(cwd) {
|
|
10756
10843
|
return (await detect({ cwd }))?.name ?? getUserAgent() ?? "npm";
|
|
10757
10844
|
}
|
|
10758
10845
|
function getUserAgent() {
|
|
10759
|
-
const userAgent =
|
|
10846
|
+
const userAgent = V.env.npm_config_user_agent;
|
|
10760
10847
|
if (!userAgent) return void 0;
|
|
10761
10848
|
const pmSpec = userAgent.split(" ")[0];
|
|
10762
10849
|
const separatorPos = pmSpec.lastIndexOf("/");
|
|
@@ -10782,7 +10869,7 @@ function verifyCleanWorkingDirectory(cwd, gitCheck) {
|
|
|
10782
10869
|
const { stdout } = await promisify(exec)("git status --short", { cwd });
|
|
10783
10870
|
if (stdout) return {
|
|
10784
10871
|
success: false,
|
|
10785
|
-
message: "
|
|
10872
|
+
message: "Uncommited changes found"
|
|
10786
10873
|
};
|
|
10787
10874
|
return {
|
|
10788
10875
|
success: true,
|
|
@@ -11194,13 +11281,13 @@ const create = new Command("create").description("Scaffold a new project (--add
|
|
|
11194
11281
|
const options = parse$1(OptionsSchema$1, opts);
|
|
11195
11282
|
if (options.fromPlayground && !validatePlaygroundUrl(options.fromPlayground)) {
|
|
11196
11283
|
console.error(color.error(`Error: Invalid playground URL: ${options.fromPlayground}`));
|
|
11197
|
-
|
|
11284
|
+
V.exit(1);
|
|
11198
11285
|
}
|
|
11199
11286
|
runCommand(async () => {
|
|
11200
11287
|
const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options);
|
|
11201
11288
|
let i = 1;
|
|
11202
11289
|
const initialSteps = ["📁 Project steps", ""];
|
|
11203
|
-
const relative = path.relative(
|
|
11290
|
+
const relative = path.relative(V.cwd(), directory);
|
|
11204
11291
|
const pm = packageManager ?? await detectPackageManager(directory);
|
|
11205
11292
|
if (relative !== "") {
|
|
11206
11293
|
const pathHasSpaces = relative.includes(" ");
|
|
@@ -11225,7 +11312,7 @@ const create = new Command("create").description("Scaffold a new project (--add
|
|
|
11225
11312
|
});
|
|
11226
11313
|
}).showHelpAfterError(true);
|
|
11227
11314
|
async function createProject(cwd, options) {
|
|
11228
|
-
if (options.fromPlayground) R$1.warn("Svelte maintainers have not reviewed playgrounds for malicious code
|
|
11315
|
+
if (options.fromPlayground) R$1.warn("Svelte maintainers have not reviewed playgrounds for malicious code! Use at your discretion.");
|
|
11229
11316
|
const promptGroupResult = await pe({
|
|
11230
11317
|
directory: () => {
|
|
11231
11318
|
const defaultPath = "./";
|
|
@@ -11246,7 +11333,7 @@ async function createProject(cwd, options) {
|
|
|
11246
11333
|
});
|
|
11247
11334
|
if (R$2(force) || !force) {
|
|
11248
11335
|
ge("Exiting.");
|
|
11249
|
-
|
|
11336
|
+
V.exit(0);
|
|
11250
11337
|
}
|
|
11251
11338
|
},
|
|
11252
11339
|
template: () => {
|
|
@@ -11286,7 +11373,7 @@ async function createProject(cwd, options) {
|
|
|
11286
11373
|
}
|
|
11287
11374
|
}, { onCancel: () => {
|
|
11288
11375
|
ge("Operation cancelled.");
|
|
11289
|
-
|
|
11376
|
+
V.exit(0);
|
|
11290
11377
|
} });
|
|
11291
11378
|
const { directory, template } = promptGroupResult;
|
|
11292
11379
|
const language = promptGroupResult.language;
|
|
@@ -11306,7 +11393,7 @@ async function createProject(cwd, options) {
|
|
|
11306
11393
|
});
|
|
11307
11394
|
if (R$2(org)) {
|
|
11308
11395
|
ge("Operation cancelled.");
|
|
11309
|
-
|
|
11396
|
+
V.exit(0);
|
|
11310
11397
|
}
|
|
11311
11398
|
projectName = `${org}/${basename}`;
|
|
11312
11399
|
}
|
|
@@ -11410,7 +11497,7 @@ async function confirmExternalDependencies(dependencies) {
|
|
|
11410
11497
|
});
|
|
11411
11498
|
if (R$2(installDeps)) {
|
|
11412
11499
|
ge("Operation cancelled.");
|
|
11413
|
-
|
|
11500
|
+
V.exit(0);
|
|
11414
11501
|
}
|
|
11415
11502
|
return installDeps;
|
|
11416
11503
|
}
|
|
@@ -11699,7 +11786,7 @@ async function promptAddonQuestions({ options, loadedAddons, workspace }) {
|
|
|
11699
11786
|
});
|
|
11700
11787
|
if (R$2(selected)) {
|
|
11701
11788
|
ge("Operation cancelled.");
|
|
11702
|
-
|
|
11789
|
+
V.exit(1);
|
|
11703
11790
|
}
|
|
11704
11791
|
for (const id of selected) {
|
|
11705
11792
|
const addon = getAddonDetails(id);
|
|
@@ -11743,7 +11830,7 @@ async function promptAddonQuestions({ options, loadedAddons, workspace }) {
|
|
|
11743
11830
|
}
|
|
11744
11831
|
if (await le({ message: `The ${color.addon(addonId)} add-on requires ${color.addon(depId)} to also be setup. ${color.success("Include it?")}` }) !== true) {
|
|
11745
11832
|
ge("Operation cancelled.");
|
|
11746
|
-
|
|
11833
|
+
V.exit(1);
|
|
11747
11834
|
}
|
|
11748
11835
|
answers[depId] = {};
|
|
11749
11836
|
}
|
|
@@ -11772,7 +11859,7 @@ async function promptAddonQuestions({ options, loadedAddons, workspace }) {
|
|
|
11772
11859
|
});
|
|
11773
11860
|
if (R$2(force) || !force) {
|
|
11774
11861
|
ge("Operation cancelled.");
|
|
11775
|
-
|
|
11862
|
+
V.exit(1);
|
|
11776
11863
|
}
|
|
11777
11864
|
}
|
|
11778
11865
|
for (const loaded of addons) {
|
|
@@ -11811,7 +11898,7 @@ async function promptAddonQuestions({ options, loadedAddons, workspace }) {
|
|
|
11811
11898
|
}
|
|
11812
11899
|
if (R$2(answer)) {
|
|
11813
11900
|
ge("Operation cancelled.");
|
|
11814
|
-
|
|
11901
|
+
V.exit(1);
|
|
11815
11902
|
}
|
|
11816
11903
|
values[questionId] = answer;
|
|
11817
11904
|
}
|
|
@@ -11847,7 +11934,7 @@ async function runAddonsApply({ answers, options, loadedAddons, setupResults, wo
|
|
|
11847
11934
|
if (addonSuccess.length === 0) if (fromCommand === "create") R$1.warn("All selected add-ons were canceled.");
|
|
11848
11935
|
else {
|
|
11849
11936
|
ge("All selected add-ons were canceled.");
|
|
11850
|
-
|
|
11937
|
+
V.exit(1);
|
|
11851
11938
|
}
|
|
11852
11939
|
else R$1.success(`Successfully setup add-ons: ${addonSuccess.map((c) => color.addon(c)).join(", ")}`);
|
|
11853
11940
|
const packageManager = options.install === false ? null : options.install === true ? await packageManagerPrompt(options.cwd) : options.install;
|
|
@@ -11928,7 +12015,7 @@ function addonArgsHandler(acc, current) {
|
|
|
11928
12015
|
} catch (error) {
|
|
11929
12016
|
if (error instanceof Error) errorAndExit(error.message);
|
|
11930
12017
|
console.error(error);
|
|
11931
|
-
|
|
12018
|
+
V.exit(1);
|
|
11932
12019
|
}
|
|
11933
12020
|
return acc;
|
|
11934
12021
|
}
|
|
@@ -12032,7 +12119,7 @@ async function resolveNonOfficialAddons(refs, downloadCheck) {
|
|
|
12032
12119
|
}));
|
|
12033
12120
|
stop("Resolved community add-on packages");
|
|
12034
12121
|
for (const { warning } of pkgs) if (warning) R$1.warn(warning);
|
|
12035
|
-
R$1.warn("Svelte maintainers have not reviewed community add-ons for malicious code
|
|
12122
|
+
R$1.warn("Svelte maintainers have not reviewed community add-ons for malicious code! Use at your discretion.");
|
|
12036
12123
|
const paddingName = getPadding(pkgs.map(({ pkg }) => pkg.name));
|
|
12037
12124
|
const paddingVersion = getPadding(pkgs.map(({ pkg }) => `(v${pkg.version})`));
|
|
12038
12125
|
const packageInfos = pkgs.map(({ pkg, repo: _repo }) => {
|
|
@@ -12042,7 +12129,7 @@ async function resolveNonOfficialAddons(refs, downloadCheck) {
|
|
|
12042
12129
|
if (downloadCheck) {
|
|
12043
12130
|
if (await le({ message: "Would you like to continue?" }) !== true) {
|
|
12044
12131
|
ge("Operation cancelled.");
|
|
12045
|
-
|
|
12132
|
+
V.exit(1);
|
|
12046
12133
|
}
|
|
12047
12134
|
}
|
|
12048
12135
|
start("Downloading community add-on packages");
|
|
@@ -12071,7 +12158,7 @@ async function resolveNonOfficialAddons(refs, downloadCheck) {
|
|
|
12071
12158
|
}
|
|
12072
12159
|
//#endregion
|
|
12073
12160
|
//#region src/core/env.ts
|
|
12074
|
-
const TESTING =
|
|
12161
|
+
const TESTING = V.env.NODE_ENV?.toLowerCase() === "test";
|
|
12075
12162
|
//#endregion
|
|
12076
12163
|
//#region src/core/engine.ts
|
|
12077
12164
|
function alphabetizeRecord(obj) {
|
package/dist/shared.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"addon"
|
|
21
21
|
],
|
|
22
22
|
"exclude": [],
|
|
23
|
-
"contents": "# [sv](https://svelte.dev/docs/cli/overview) community add-on: [~SV-NAME-TODO~](https://github.com/~SV-NAME-TODO~)\n\n> [!IMPORTANT]\n> Svelte maintainers have not reviewed community add-ons for malicious code
|
|
23
|
+
"contents": "# [sv](https://svelte.dev/docs/cli/overview) community add-on: [~SV-NAME-TODO~](https://github.com/~SV-NAME-TODO~)\n\n> [!IMPORTANT]\n> Svelte maintainers have not reviewed community add-ons for malicious code! Use at your discretion.\n\n## Usage\n\nTo install the add-on, run:\n\n```shell\nnpx sv add ~SV-PROTOCOL-NAME-TODO~\n```\n\n## What you get [TO BE FILLED...]\n\n- A super cool stuff\n- Another one!\n\n## Options [TO BE FILLED...]\n\n### `who`\n\nThe name of the person to say hello to.\n\nDefault: `you`\n\n```shell\nnpx sv add ~SV-PROTOCOL-NAME-TODO~=\"who:your-name\"\n```\n"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"name": "jsconfig.json",
|
package/dist/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as defineAddonOptions, m as create$1, o as officialAddons, s as defineAddon, t as add, y as svDeprecated } from "../engine-
|
|
1
|
+
import { c as defineAddonOptions, m as create$1, o as officialAddons, s as defineAddon, t as add, y as svDeprecated } from "../engine-B1KphrBP.mjs";
|
|
2
2
|
//#region src/index.ts
|
|
3
3
|
function create(cwdOrOptions, legacyOptions) {
|
|
4
4
|
if (typeof cwdOrOptions === "string") {
|
package/dist/src/testing.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as __toESM, b as __commonJSMin, f as R, i as addPnpmAllowBuilds, m as create, p as z, t as add, x as __require } from "../engine-
|
|
1
|
+
import { S as __toESM, b as __commonJSMin, f as R, i as addPnpmAllowBuilds, m as create, p as z, t as add, x as __require } from "../engine-B1KphrBP.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import
|
|
4
|
+
import V from "node:process";
|
|
5
5
|
import { execSync } from "node:child_process";
|
|
6
6
|
//#region ../../node_modules/.pnpm/through@2.3.8/node_modules/through/index.js
|
|
7
7
|
var require_through = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -700,7 +700,7 @@ async function getProcessTree(pid) {
|
|
|
700
700
|
});
|
|
701
701
|
}
|
|
702
702
|
async function terminate(pid) {
|
|
703
|
-
if (
|
|
703
|
+
if (V.platform === "win32") {
|
|
704
704
|
await R("taskkill", [
|
|
705
705
|
"/PID",
|
|
706
706
|
`${pid}`,
|
|
@@ -718,7 +718,7 @@ async function terminate(pid) {
|
|
|
718
718
|
}
|
|
719
719
|
function kill(pid) {
|
|
720
720
|
try {
|
|
721
|
-
|
|
721
|
+
V.kill(pid);
|
|
722
722
|
} catch {}
|
|
723
723
|
}
|
|
724
724
|
function setupGlobal({ TEST_DIR, pre, post }) {
|
|
@@ -22,14 +22,15 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"sv": "^0.16.
|
|
25
|
+
"sv": "^0.16.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"sv": "^0.16.
|
|
29
|
-
"@sveltejs/sv-utils": "^0.3.
|
|
28
|
+
"sv": "^0.16.3",
|
|
29
|
+
"@sveltejs/sv-utils": "^0.3.1",
|
|
30
30
|
"@playwright/test": "^1.60.0",
|
|
31
31
|
"@types/node": "^25.9.1",
|
|
32
32
|
"tsdown": "^0.22.1",
|
|
33
|
+
"unrun": "^0.2.39",
|
|
33
34
|
"vitest": "^4.1.8"
|
|
34
35
|
},
|
|
35
36
|
"keywords": ["sv-add", "svelte", "sveltekit"]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sv",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A command line interface (CLI) for creating and maintaining Svelte applications",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sveltejs/sv-utils": "0.3.
|
|
28
|
+
"@sveltejs/sv-utils": "0.3.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@clack/prompts": "1.5.0",
|