sv 0.15.0 → 0.15.2
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 +1 -1
- package/dist/{engine-CzIdz0uO.mjs → engine-DNw7p3EG.mjs} +86 -58
- package/dist/{engine-3mrtB4nw.d.mts → engine-DcLtEbd7.d.mts} +1 -1
- package/dist/src/index.d.mts +2 -2
- package/dist/src/index.mjs +1 -1
- package/dist/src/testing.d.mts +1 -1
- package/dist/src/testing.mjs +2 -2
- package/package.json +2 -2
package/dist/bin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { _ as name, a as detectPackageManager, d as program, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as Command, v as version } from "./engine-
|
|
2
|
+
import { _ as name, a as detectPackageManager, d as program, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as Command, v as version } from "./engine-DNw7p3EG.mjs";
|
|
3
3
|
import { color, resolveCommandArray } from "@sveltejs/sv-utils";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { execSync } from "node:child_process";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import { AGENTS, COMMANDS, Walker, color, constructCommand, createPrinter, dedent, detect, downloadJson, fileExists, isVersionUnsupportedBelow, js, loadFile, loadPackageJson, parse, pnpm, resolveCommand, resolveCommandArray, sanitizeName, saveFile,
|
|
2
|
+
import { AGENTS, COMMANDS, Walker, coerceVersion, color, constructCommand, createPrinter, dedent, detect, downloadJson, fileExists, isVersionUnsupportedBelow, js, loadFile, loadPackageJson, minVersion, parse, pnpm, resolveCommand, resolveCommandArray, sanitizeName, saveFile, svelte, transforms } from "@sveltejs/sv-utils";
|
|
3
3
|
import fs, { existsSync } from "node:fs";
|
|
4
4
|
import path, { delimiter, dirname, isAbsolute, join, normalize, resolve } from "node:path";
|
|
5
5
|
import process$1, { cwd, stdin, stdout } from "node:process";
|
|
@@ -44,7 +44,10 @@ const warned = /* @__PURE__ */ new Set();
|
|
|
44
44
|
function svDeprecated(message) {
|
|
45
45
|
if (warned.has(message)) return;
|
|
46
46
|
warned.add(message);
|
|
47
|
-
console.warn(
|
|
47
|
+
console.warn();
|
|
48
|
+
console.warn(` ${color.dim("[sv] Deprecated:")} ${message}`);
|
|
49
|
+
console.warn(` Still works. ${color.warning("Warn add-on's author about it.")}`);
|
|
50
|
+
console.warn();
|
|
48
51
|
}
|
|
49
52
|
//#endregion
|
|
50
53
|
//#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
@@ -1391,7 +1394,7 @@ ${r ? import_picocolors.default.cyan(x$1) : ""}
|
|
|
1391
1394
|
//#endregion
|
|
1392
1395
|
//#region package.json
|
|
1393
1396
|
var name = "sv";
|
|
1394
|
-
var version = "0.15.
|
|
1397
|
+
var version = "0.15.2";
|
|
1395
1398
|
//#endregion
|
|
1396
1399
|
//#region src/core/errors.ts
|
|
1397
1400
|
var UnsupportedError = class extends Error {
|
|
@@ -6094,6 +6097,7 @@ function createOptionBuilder(options) {
|
|
|
6094
6097
|
}
|
|
6095
6098
|
//#endregion
|
|
6096
6099
|
//#region src/addons/common.ts
|
|
6100
|
+
const ESLINT_VERSION = "^10.2.0";
|
|
6097
6101
|
const addEslintConfigPrettier = transforms.script(({ ast, js }) => {
|
|
6098
6102
|
const sveltePluginImport = ast.body.filter((n) => n.type === "ImportDeclaration").find((n) => n.type === "ImportDeclaration" && n.source.value === "eslint-plugin-svelte" && n.specifiers?.some((n) => n.type === "ImportDefaultSpecifier"));
|
|
6099
6103
|
let svelteImportName;
|
|
@@ -6188,7 +6192,8 @@ var better_auth_default = defineAddon({
|
|
|
6188
6192
|
runsAfter("tailwindcss");
|
|
6189
6193
|
},
|
|
6190
6194
|
run: ({ sv, language, options, directory, dependencyVersion, file }) => {
|
|
6191
|
-
const
|
|
6195
|
+
const svelteVersion = dependencyVersion("svelte");
|
|
6196
|
+
const svelte5 = !!svelteVersion && coerceVersion(svelteVersion).major === 5;
|
|
6192
6197
|
const [ts, s5] = createPrinter(language === "ts", svelte5);
|
|
6193
6198
|
const demoPassword = options.demo.includes("password");
|
|
6194
6199
|
const demoGithub = options.demo.includes("github");
|
|
@@ -6676,7 +6681,6 @@ var drizzle_default = defineAddon({
|
|
|
6676
6681
|
if (!isKit) return unsupported("Requires SvelteKit");
|
|
6677
6682
|
},
|
|
6678
6683
|
run: ({ sv, language, options, directory, dependencyVersion, cwd, cancel, file, packageManager }) => {
|
|
6679
|
-
if (options.database === "d1" && !dependencyVersion("@sveltejs/adapter-cloudflare")) return cancel("Cloudflare D1 requires @sveltejs/adapter-cloudflare - add the adapter first");
|
|
6680
6684
|
const [ts] = createPrinter(language === "ts");
|
|
6681
6685
|
const baseDBPath = path.resolve(cwd, directory.lib, "server", "db");
|
|
6682
6686
|
const paths = {
|
|
@@ -6695,7 +6699,7 @@ var drizzle_default = defineAddon({
|
|
|
6695
6699
|
if (options.sqlite === "better-sqlite3") {
|
|
6696
6700
|
sv.dependency("better-sqlite3", "^12.8.0");
|
|
6697
6701
|
sv.devDependency("@types/better-sqlite3", "^7.6.13");
|
|
6698
|
-
if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.
|
|
6702
|
+
if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.allowBuilds("better-sqlite3"));
|
|
6699
6703
|
}
|
|
6700
6704
|
if (options.sqlite === "libsql" || options.sqlite === "turso") sv.devDependency("@libsql/client", "^0.17.2");
|
|
6701
6705
|
sv.file(".env", generateEnv(options, false));
|
|
@@ -6971,9 +6975,14 @@ var drizzle_default = defineAddon({
|
|
|
6971
6975
|
});
|
|
6972
6976
|
}));
|
|
6973
6977
|
},
|
|
6974
|
-
nextSteps: ({ options, packageManager, cwd }) => {
|
|
6978
|
+
nextSteps: ({ options, packageManager, cwd, dependencyVersion }) => {
|
|
6975
6979
|
const steps = [];
|
|
6976
6980
|
if (options.database === "d1") {
|
|
6981
|
+
if (!dependencyVersion("@sveltejs/adapter-cloudflare")) steps.push(`Cloudflare D1 requires ${color.addon("@sveltejs/adapter-cloudflare")}. Run ${color.command(resolveCommandArray(packageManager, "execute", [
|
|
6982
|
+
"sv",
|
|
6983
|
+
"add",
|
|
6984
|
+
"sveltekit-adapter=adapter:cloudflare"
|
|
6985
|
+
]))} to add it`);
|
|
6977
6986
|
const ext = fileExists(cwd, "wrangler.toml") ? "toml" : "jsonc";
|
|
6978
6987
|
steps.push(`Add your ${color.env("CLOUDFLARE_ACCOUNT_ID")}, ${color.env("CLOUDFLARE_DATABASE_ID")}, and ${color.env("CLOUDFLARE_D1_TOKEN")} to ${color.path(".env")}`);
|
|
6979
6988
|
steps.push(`Run ${color.command(resolveCommandArray(packageManager, "run", [
|
|
@@ -7043,7 +7052,7 @@ var eslint_default = defineAddon({
|
|
|
7043
7052
|
run: ({ sv, language, dependencyVersion, file }) => {
|
|
7044
7053
|
const typescript = language === "ts";
|
|
7045
7054
|
const prettierInstalled = Boolean(dependencyVersion("prettier"));
|
|
7046
|
-
sv.devDependency("eslint",
|
|
7055
|
+
sv.devDependency("eslint", ESLINT_VERSION);
|
|
7047
7056
|
sv.devDependency("@eslint/compat", "^2.0.4");
|
|
7048
7057
|
sv.devDependency("eslint-plugin-svelte", "^3.17.0");
|
|
7049
7058
|
sv.devDependency("globals", "^17.4.0");
|
|
@@ -7549,8 +7558,8 @@ var playwright_default = defineAddon({
|
|
|
7549
7558
|
run: ({ sv, language, file, isKit, directory }) => {
|
|
7550
7559
|
sv.devDependency("@playwright/test", "^1.59.1");
|
|
7551
7560
|
sv.file(file.package, transforms.json(({ data, json }) => {
|
|
7552
|
-
json.packageScriptsUpsert(data, "prepare", "playwright install", { mode: "prepend" });
|
|
7553
7561
|
json.packageScriptsUpsert(data, "test:e2e", "playwright test");
|
|
7562
|
+
json.packageScriptsUpsert(data, "test:e2e", "playwright install", { mode: "prepend" });
|
|
7554
7563
|
json.packageScriptsUpsert(data, "test", "npm run test:e2e");
|
|
7555
7564
|
}));
|
|
7556
7565
|
sv.file(file.gitignore, transforms.text(({ content, text }) => {
|
|
@@ -7654,8 +7663,7 @@ var prettier_default = defineAddon({
|
|
|
7654
7663
|
}, { onError: () => {
|
|
7655
7664
|
R$1.warn(`A ${color.warning(".prettierrc")} config already exists and cannot be parsed as JSON. Skipping initialization.`);
|
|
7656
7665
|
} }));
|
|
7657
|
-
const
|
|
7658
|
-
const eslintInstalled = hasEslint(eslintVersion);
|
|
7666
|
+
const eslintInfo = checkEslint(dependencyVersion("eslint"));
|
|
7659
7667
|
sv.file(file.package, transforms.json(({ data, json }) => {
|
|
7660
7668
|
json.packageScriptsUpsert(data, "lint", "prettier --check .", { mode: "prepend" });
|
|
7661
7669
|
json.packageScriptsUpsert(data, "format", "prettier --write .");
|
|
@@ -7663,16 +7671,23 @@ var prettier_default = defineAddon({
|
|
|
7663
7671
|
sv.file(".vscode/extensions.json", transforms.json(({ data, json }) => {
|
|
7664
7672
|
json.arrayUpsert(data, "recommendations", "esbenp.prettier-vscode");
|
|
7665
7673
|
}));
|
|
7666
|
-
if (
|
|
7667
|
-
if (
|
|
7674
|
+
if (eslintInfo.installed && !eslintInfo.supported) R$1.warn(`An unsupported major version of ${color.warning("eslint")} was detected. Skipping ${color.warning("eslint-config-prettier")} installation.`);
|
|
7675
|
+
if (eslintInfo.supported) {
|
|
7668
7676
|
sv.devDependency("eslint-config-prettier", "^10.1.8");
|
|
7669
7677
|
sv.file("eslint.config.js", addEslintConfigPrettier);
|
|
7670
7678
|
}
|
|
7671
7679
|
}
|
|
7672
7680
|
});
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7681
|
+
function checkEslint(version) {
|
|
7682
|
+
if (!version) return {
|
|
7683
|
+
installed: false,
|
|
7684
|
+
supported: false
|
|
7685
|
+
};
|
|
7686
|
+
const supportedMajor = coerceVersion(ESLINT_VERSION).major;
|
|
7687
|
+
return {
|
|
7688
|
+
installed: true,
|
|
7689
|
+
supported: coerceVersion(version).major === supportedMajor
|
|
7690
|
+
};
|
|
7676
7691
|
}
|
|
7677
7692
|
//#endregion
|
|
7678
7693
|
//#region src/addons/storybook.ts
|
|
@@ -7823,12 +7838,10 @@ var sveltekit_adapter_default = defineAddon({
|
|
|
7823
7838
|
};
|
|
7824
7839
|
sv.file(`wrangler.${ext}`, ext === "toml" ? transforms.toml(({ data }) => applyWranglerConfig(data)) : transforms.json(({ data }) => applyWranglerConfig(data)));
|
|
7825
7840
|
if (file.typeConfig) {
|
|
7826
|
-
sv.file(file.gitignore, transforms.text(({ content }) => {
|
|
7827
|
-
if (content.length === 0) return false;
|
|
7828
|
-
return text.upsert(content, "/worker-configuration.d.ts", { comment: "Cloudflare Types" });
|
|
7829
|
-
}));
|
|
7830
7841
|
sv.file(file.package, transforms.json(({ data, json }) => {
|
|
7831
7842
|
json.packageScriptsUpsert(data, "gen", "wrangler types");
|
|
7843
|
+
json.packageScriptsUpsert(data, "check", "wrangler types --check", { mode: "prepend" });
|
|
7844
|
+
json.packageScriptsUpsert(data, "build", "wrangler types --check", { mode: "prepend" });
|
|
7832
7845
|
}));
|
|
7833
7846
|
sv.file(file.typeConfig, transforms.json(({ data }) => {
|
|
7834
7847
|
data.compilerOptions ??= {};
|
|
@@ -7881,7 +7894,7 @@ var tailwindcss_default = defineAddon({
|
|
|
7881
7894
|
const prettierInstalled = Boolean(dependencyVersion("prettier"));
|
|
7882
7895
|
sv.devDependency("tailwindcss", "^4.2.2");
|
|
7883
7896
|
sv.devDependency("@tailwindcss/vite", "^4.2.2");
|
|
7884
|
-
if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.
|
|
7897
|
+
if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.allowBuilds("@tailwindcss/oxide"));
|
|
7885
7898
|
if (prettierInstalled) sv.devDependency("prettier-plugin-tailwindcss", "^0.7.2");
|
|
7886
7899
|
for (const plugin of plugins) {
|
|
7887
7900
|
if (!options.plugins.includes(plugin.id)) continue;
|
|
@@ -7980,7 +7993,8 @@ const officialAddons$1 = {
|
|
|
7980
7993
|
run: ({ sv, file, language, directory, options, dependencyVersion }) => {
|
|
7981
7994
|
const unitTesting = options.usages.includes("unit");
|
|
7982
7995
|
const componentTesting = options.usages.includes("component");
|
|
7983
|
-
|
|
7996
|
+
const vitestVersion = dependencyVersion("vitest");
|
|
7997
|
+
if (vitestVersion) vitestV3Installed = coerceVersion(vitestVersion).major === 3;
|
|
7984
7998
|
sv.devDependency("vitest", "^4.1.3");
|
|
7985
7999
|
if (componentTesting) {
|
|
7986
8000
|
sv.devDependency("@vitest/browser-playwright", "^4.1.3");
|
|
@@ -10794,9 +10808,8 @@ function verifyPackage(addonPkg, specifier) {
|
|
|
10794
10808
|
const addonSvVersion = peerDeps["sv"];
|
|
10795
10809
|
if (!addonSvVersion) throw new Error(`Invalid add-on package specified: '${specifier}' is missing 'sv' in its 'peerDependencies'`);
|
|
10796
10810
|
if (Object.keys(deps).length > 0) throw new Error(`Invalid add-on package detected: '${specifier}'\nCommunity add-ons should not have any 'dependencies'. Use 'peerDependencies' for 'sv' and bundle everything else`);
|
|
10797
|
-
const
|
|
10798
|
-
|
|
10799
|
-
if (splitVersion(version).major !== addon_major) return `${color.addon(specifier)} was built for ${color.warning(`sv@${cleanedAddonVersion}`)} but you're running ${color.addon(`sv@${version}`)}.\nThis may cause compatibility issues. ${color.optional("Run it with the same sv version to avoid issues.")}`;
|
|
10811
|
+
const addon = coerceVersion(addonSvVersion);
|
|
10812
|
+
if (coerceVersion(version).major !== addon.major) return `${color.addon(specifier)} was built for ${color.warning(`sv@${addon.version ?? addonSvVersion}`)} but you're running ${color.addon(`sv@${version}`)}.\nThis may cause compatibility issues. ${color.optional("Run it with the same sv version to avoid issues.")}`;
|
|
10800
10813
|
}
|
|
10801
10814
|
/**
|
|
10802
10815
|
* Recursively copies a directory from source to destination
|
|
@@ -10977,12 +10990,12 @@ function getUserAgent() {
|
|
|
10977
10990
|
const name = pmSpec.substring(0, separatorPos);
|
|
10978
10991
|
return AGENTS.includes(name) ? name : void 0;
|
|
10979
10992
|
}
|
|
10980
|
-
function
|
|
10993
|
+
function addPnpmAllowBuilds(cwd, packageManager, ...packages) {
|
|
10981
10994
|
if (packageManager !== "pnpm" || packages.length === 0) return;
|
|
10982
10995
|
const found = up$1("pnpm-workspace.yaml", { cwd });
|
|
10983
10996
|
const filePath = found ?? path.join(cwd, "pnpm-workspace.yaml");
|
|
10984
10997
|
const content = found ? fs.readFileSync(found, "utf-8") : "";
|
|
10985
|
-
const newContent = pnpm.
|
|
10998
|
+
const newContent = pnpm.allowBuilds(...packages)(content);
|
|
10986
10999
|
if (newContent !== content) fs.writeFileSync(filePath, newContent, "utf-8");
|
|
10987
11000
|
}
|
|
10988
11001
|
//#endregion
|
|
@@ -11032,6 +11045,27 @@ function verifyUnsupportedAddons(addons, setupResults) {
|
|
|
11032
11045
|
}
|
|
11033
11046
|
//#endregion
|
|
11034
11047
|
//#region src/core/workspace.ts
|
|
11048
|
+
const deprecatedFiles = {
|
|
11049
|
+
prettierignore: ".prettierignore",
|
|
11050
|
+
prettierrc: ".prettierrc",
|
|
11051
|
+
eslintConfig: "eslint.config.js",
|
|
11052
|
+
vscodeSettings: ".vscode/settings.json",
|
|
11053
|
+
vscodeExtensions: ".vscode/extensions.json"
|
|
11054
|
+
};
|
|
11055
|
+
/**
|
|
11056
|
+
* Adds deprecated file properties as non-enumerable getters so they don't trigger on spread
|
|
11057
|
+
* Once we remove these deprecatedFiles, we can get rid of addDeprecatedFileProperties
|
|
11058
|
+
*/
|
|
11059
|
+
function addDeprecatedFileProperties(file) {
|
|
11060
|
+
for (const [key, value] of Object.entries(deprecatedFiles)) Object.defineProperty(file, key, {
|
|
11061
|
+
get() {
|
|
11062
|
+
svDeprecated(`use the string \`"${value}"\` instead of \`file.${key}\``);
|
|
11063
|
+
return value;
|
|
11064
|
+
},
|
|
11065
|
+
enumerable: false
|
|
11066
|
+
});
|
|
11067
|
+
return file;
|
|
11068
|
+
}
|
|
11035
11069
|
async function createWorkspace({ cwd, packageManager, override }) {
|
|
11036
11070
|
const resolvedCwd = path.resolve(cwd);
|
|
11037
11071
|
const typeConfig = any([filePaths.jsconfig, filePaths.tsconfig], { cwd });
|
|
@@ -11059,7 +11093,9 @@ async function createWorkspace({ cwd, packageManager, override }) {
|
|
|
11059
11093
|
directory = path.dirname(directory);
|
|
11060
11094
|
}
|
|
11061
11095
|
}
|
|
11062
|
-
for (const [key, value] of Object.entries(dependencies))
|
|
11096
|
+
for (const [key, value] of Object.entries(dependencies)) try {
|
|
11097
|
+
dependencies[key] = minVersion(value);
|
|
11098
|
+
} catch {}
|
|
11063
11099
|
const isKit = override?.isKit ?? !!dependencies["@sveltejs/kit"];
|
|
11064
11100
|
const directory = override?.directory ? override.directory : isKit ? {
|
|
11065
11101
|
src: "src",
|
|
@@ -11074,33 +11110,13 @@ async function createWorkspace({ cwd, packageManager, override }) {
|
|
|
11074
11110
|
cwd: resolvedCwd,
|
|
11075
11111
|
packageManager: packageManager ?? await detectPackageManager(cwd),
|
|
11076
11112
|
language: typescript ? "ts" : "js",
|
|
11077
|
-
file: {
|
|
11113
|
+
file: addDeprecatedFileProperties({
|
|
11078
11114
|
viteConfig,
|
|
11079
11115
|
svelteConfig,
|
|
11080
11116
|
typeConfig,
|
|
11081
11117
|
stylesheet,
|
|
11082
11118
|
package: "package.json",
|
|
11083
11119
|
gitignore: ".gitignore",
|
|
11084
|
-
get prettierignore() {
|
|
11085
|
-
svDeprecated("`workspace.file.prettierignore` is deprecated, use the string `.prettierignore` isntead.");
|
|
11086
|
-
return ".prettierignore";
|
|
11087
|
-
},
|
|
11088
|
-
get prettierrc() {
|
|
11089
|
-
svDeprecated("`workspace.file.prettierrc` is deprecated, use the string `.prettierrc` isntead.");
|
|
11090
|
-
return ".prettierrc";
|
|
11091
|
-
},
|
|
11092
|
-
get eslintConfig() {
|
|
11093
|
-
svDeprecated("`workspace.file.eslintConfig` is deprecated, use the string `eslint.config.js` isntead.");
|
|
11094
|
-
return "eslint.config.js";
|
|
11095
|
-
},
|
|
11096
|
-
get vscodeSettings() {
|
|
11097
|
-
svDeprecated("`workspace.file.vscodeSettings` is deprecated, use the string `.vscode/settings.json` isntead.");
|
|
11098
|
-
return ".vscode/settings.json";
|
|
11099
|
-
},
|
|
11100
|
-
get vscodeExtensions() {
|
|
11101
|
-
svDeprecated("`workspace.file.vscodeExtensions` is deprecated, use the string `.vscode/extensions.json` isntead.");
|
|
11102
|
-
return ".vscode/extensions.json";
|
|
11103
|
-
},
|
|
11104
11120
|
getRelative({ from, to }) {
|
|
11105
11121
|
from = from ?? "";
|
|
11106
11122
|
let relativePath = path.posix.relative(path.posix.dirname(from), to);
|
|
@@ -11113,7 +11129,7 @@ async function createWorkspace({ cwd, packageManager, override }) {
|
|
|
11113
11129
|
if (resolvedCwd.includes(".test-output") && !found.includes(".test-output")) return filename;
|
|
11114
11130
|
return path.relative(resolvedCwd, found);
|
|
11115
11131
|
}
|
|
11116
|
-
},
|
|
11132
|
+
}),
|
|
11117
11133
|
isKit,
|
|
11118
11134
|
directory,
|
|
11119
11135
|
dependencyVersion: (pkg) => dependencies[pkg]
|
|
@@ -11583,7 +11599,7 @@ async function createProject(cwd, options) {
|
|
|
11583
11599
|
updateAgent(directory, language, packageManager ?? "npm", loadedAddons);
|
|
11584
11600
|
if (packageManager) workspace.packageManager = packageManager;
|
|
11585
11601
|
const addOnNextSteps = getNextSteps(addOnSuccessfulAddons, workspace, answers, addonSetupResults);
|
|
11586
|
-
|
|
11602
|
+
addPnpmAllowBuilds(projectPath, packageManager, "esbuild");
|
|
11587
11603
|
if (packageManager) {
|
|
11588
11604
|
await installDependencies(packageManager, projectPath);
|
|
11589
11605
|
await formatFiles({
|
|
@@ -12047,12 +12063,14 @@ async function runAddonsApply({ answers, options, loadedAddons, setupResults, wo
|
|
|
12047
12063
|
canceledAddonIds.push(addonId);
|
|
12048
12064
|
}
|
|
12049
12065
|
const successfulAddons = loadedAddons.filter((a) => !canceledAddonIds.includes(a.addon.id));
|
|
12050
|
-
if (addonSuccess.length === 0)
|
|
12066
|
+
if (addonSuccess.length === 0) if (fromCommand === "create") R$1.warn("All selected add-ons were canceled.");
|
|
12067
|
+
else {
|
|
12051
12068
|
Pt("All selected add-ons were canceled.");
|
|
12052
12069
|
process$1.exit(1);
|
|
12053
|
-
}
|
|
12070
|
+
}
|
|
12071
|
+
else R$1.success(`Successfully setup add-ons: ${addonSuccess.map((c) => color.addon(c)).join(", ")}`);
|
|
12054
12072
|
const packageManager = options.install === false ? null : options.install === true ? await packageManagerPrompt(options.cwd) : options.install;
|
|
12055
|
-
|
|
12073
|
+
addPnpmAllowBuilds(workspace.cwd, packageManager, "esbuild");
|
|
12056
12074
|
const argsFormattedAddons = [];
|
|
12057
12075
|
for (const loaded of successfulAddons) {
|
|
12058
12076
|
const addonId = loaded.addon.id;
|
|
@@ -12311,9 +12329,16 @@ async function add({ addons, cwd, options, packageManager = "npm" }) {
|
|
|
12311
12329
|
async function applyAddons({ loadedAddons, workspace, setupResults, options }) {
|
|
12312
12330
|
const filesToFormat = /* @__PURE__ */ new Set();
|
|
12313
12331
|
const status = {};
|
|
12332
|
+
const canceledAddons = /* @__PURE__ */ new Set();
|
|
12314
12333
|
const ordered = orderAddons(loadedAddons.map((l) => l.addon), setupResults);
|
|
12315
12334
|
let hasFormatter = false;
|
|
12316
12335
|
for (const addon of ordered) {
|
|
12336
|
+
const canceledDeps = (setupResults[addon.id]?.dependsOn ?? []).filter((dep) => canceledAddons.has(dep));
|
|
12337
|
+
if (canceledDeps.length > 0) {
|
|
12338
|
+
canceledAddons.add(addon.id);
|
|
12339
|
+
status[addon.id] = canceledDeps.map((dep) => `Because dependency '${dep}' was canceled`);
|
|
12340
|
+
continue;
|
|
12341
|
+
}
|
|
12317
12342
|
const loaded = loadedAddons.find((l) => l.addon.id === addon.id);
|
|
12318
12343
|
const workspaceOptions = options[addon.id] || {};
|
|
12319
12344
|
const addonWorkspace = await createWorkspace({
|
|
@@ -12330,7 +12355,10 @@ async function applyAddons({ loadedAddons, workspace, setupResults, options }) {
|
|
|
12330
12355
|
});
|
|
12331
12356
|
files.forEach((f) => filesToFormat.add(f));
|
|
12332
12357
|
if (cancels.length === 0) status[addon.id] = "success";
|
|
12333
|
-
else
|
|
12358
|
+
else {
|
|
12359
|
+
canceledAddons.add(addon.id);
|
|
12360
|
+
status[addon.id] = cancels;
|
|
12361
|
+
}
|
|
12334
12362
|
}
|
|
12335
12363
|
return {
|
|
12336
12364
|
filesToFormat: hasFormatter ? Array.from(filesToFormat) : [],
|
|
@@ -12419,8 +12447,8 @@ async function runAddon({ addon, loaded, multiple, workspace, workspaceOptions }
|
|
|
12419
12447
|
});
|
|
12420
12448
|
},
|
|
12421
12449
|
pnpmBuildDependency: (pkg) => {
|
|
12422
|
-
svDeprecated("use `pnpm.
|
|
12423
|
-
|
|
12450
|
+
svDeprecated("use `pnpm.allowBuilds` from `@sveltejs/sv-utils` instead of `sv.pnpmBuildDependency`");
|
|
12451
|
+
addPnpmAllowBuilds(workspace.cwd, workspace.packageManager, pkg);
|
|
12424
12452
|
}
|
|
12425
12453
|
};
|
|
12426
12454
|
const cancels = [];
|
|
@@ -12452,4 +12480,4 @@ function orderAddons(addons, setupResults) {
|
|
|
12452
12480
|
});
|
|
12453
12481
|
}
|
|
12454
12482
|
//#endregion
|
|
12455
|
-
export { __toESM as S, name as _, detectPackageManager as a, __commonJSMin as b, defineAddonOptions as c, program as d, R as f, helpConfig as g, forwardExitCode as h,
|
|
12483
|
+
export { __toESM as S, name as _, detectPackageManager as a, __commonJSMin as b, defineAddonOptions as c, program as d, R as f, helpConfig as g, forwardExitCode as h, addPnpmAllowBuilds as i, from as l, create$1 as m, add$1 as n, officialAddons$1 as o, z as p, create as r, defineAddon as s, add as t, Command as u, version as v, __require as x, svDeprecated as y };
|
|
@@ -117,7 +117,7 @@ type Workspace = {
|
|
|
117
117
|
//#region src/core/config.d.ts
|
|
118
118
|
type ConditionDefinition = (Workspace: Workspace) => boolean;
|
|
119
119
|
type SvApi = {
|
|
120
|
-
/** @deprecated use `pnpm.
|
|
120
|
+
/** @deprecated use `pnpm.allowBuilds` from `@sveltejs/sv-utils` instead */pnpmBuildDependency: (pkg: string) => void; /** Add a package to the dependencies. */
|
|
121
121
|
dependency: (pkg: string, version: string) => void; /** Add a package to the dev dependencies. */
|
|
122
122
|
devDependency: (pkg: string, version: string) => void; /** Execute a command in the workspace. */
|
|
123
123
|
execute: (args: string[], stdio: "inherit" | "pipe") => Promise<void>;
|
package/dist/src/index.d.mts
CHANGED
|
@@ -1,4 +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-
|
|
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-DcLtEbd7.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/create/index.d.ts
|
|
4
4
|
type TemplateType = (typeof templateTypes)[number];
|
|
@@ -23,8 +23,8 @@ type FileType = {
|
|
|
23
23
|
};
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/index.d.ts
|
|
26
|
+
declare function create(options: Options): void;
|
|
26
27
|
/** @deprecated use `create({ cwd, ...options })` instead. */
|
|
27
28
|
declare function create(cwd: string, options: Omit<Options, "cwd">): void;
|
|
28
|
-
declare function create(options: Options): void;
|
|
29
29
|
//#endregion
|
|
30
30
|
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, create, defineAddon, defineAddonOptions, officialAddons };
|
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-DNw7p3EG.mjs";
|
|
2
2
|
//#region src/index.ts
|
|
3
3
|
function create(cwdOrOptions, legacyOptions) {
|
|
4
4
|
if (typeof cwdOrOptions === "string") {
|
package/dist/src/testing.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as OptionMap, t as AddonMap } from "../engine-
|
|
1
|
+
import { r as OptionMap, t as AddonMap } from "../engine-DcLtEbd7.mjs";
|
|
2
2
|
import * as _$_playwright_test0 from "@playwright/test";
|
|
3
3
|
import { Page } from "@playwright/test";
|
|
4
4
|
import * as _$vitest from "vitest";
|
package/dist/src/testing.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as __toESM, b as __commonJSMin, f as R, i as
|
|
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-DNw7p3EG.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process$1 from "node:process";
|
|
@@ -822,7 +822,7 @@ function createSetupTest(vitest, playwright) {
|
|
|
822
822
|
options: kind.options,
|
|
823
823
|
packageManager: "pnpm"
|
|
824
824
|
});
|
|
825
|
-
|
|
825
|
+
addPnpmAllowBuilds(cwd, "pnpm", "esbuild");
|
|
826
826
|
}
|
|
827
827
|
execSync("pnpm install", {
|
|
828
828
|
cwd: path.resolve(cwd, testName),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sv",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
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.2.
|
|
28
|
+
"@sveltejs/sv-utils": "0.2.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@clack/prompts": "1.0.0",
|