sv 0.15.1 → 0.15.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 +1 -1
- package/dist/{engine-Cq2kv_P1.mjs → engine-DSL32Woe.mjs} +85 -47
- 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-DSL32Woe.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";
|
|
@@ -1394,7 +1394,7 @@ ${r ? import_picocolors.default.cyan(x$1) : ""}
|
|
|
1394
1394
|
//#endregion
|
|
1395
1395
|
//#region package.json
|
|
1396
1396
|
var name = "sv";
|
|
1397
|
-
var version = "0.15.
|
|
1397
|
+
var version = "0.15.3";
|
|
1398
1398
|
//#endregion
|
|
1399
1399
|
//#region src/core/errors.ts
|
|
1400
1400
|
var UnsupportedError = class extends Error {
|
|
@@ -6097,6 +6097,7 @@ function createOptionBuilder(options) {
|
|
|
6097
6097
|
}
|
|
6098
6098
|
//#endregion
|
|
6099
6099
|
//#region src/addons/common.ts
|
|
6100
|
+
const ESLINT_VERSION = "^10.2.0";
|
|
6100
6101
|
const addEslintConfigPrettier = transforms.script(({ ast, js }) => {
|
|
6101
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"));
|
|
6102
6103
|
let svelteImportName;
|
|
@@ -6191,7 +6192,8 @@ var better_auth_default = defineAddon({
|
|
|
6191
6192
|
runsAfter("tailwindcss");
|
|
6192
6193
|
},
|
|
6193
6194
|
run: ({ sv, language, options, directory, dependencyVersion, file }) => {
|
|
6194
|
-
const
|
|
6195
|
+
const svelteVersion = dependencyVersion("svelte");
|
|
6196
|
+
const svelte5 = !!svelteVersion && coerceVersion(svelteVersion).major === 5;
|
|
6195
6197
|
const [ts, s5] = createPrinter(language === "ts", svelte5);
|
|
6196
6198
|
const demoPassword = options.demo.includes("password");
|
|
6197
6199
|
const demoGithub = options.demo.includes("github");
|
|
@@ -6679,7 +6681,6 @@ var drizzle_default = defineAddon({
|
|
|
6679
6681
|
if (!isKit) return unsupported("Requires SvelteKit");
|
|
6680
6682
|
},
|
|
6681
6683
|
run: ({ sv, language, options, directory, dependencyVersion, cwd, cancel, file, packageManager }) => {
|
|
6682
|
-
if (options.database === "d1" && !dependencyVersion("@sveltejs/adapter-cloudflare")) return cancel("Cloudflare D1 requires @sveltejs/adapter-cloudflare - add the adapter first");
|
|
6683
6684
|
const [ts] = createPrinter(language === "ts");
|
|
6684
6685
|
const baseDBPath = path.resolve(cwd, directory.lib, "server", "db");
|
|
6685
6686
|
const paths = {
|
|
@@ -6698,7 +6699,7 @@ var drizzle_default = defineAddon({
|
|
|
6698
6699
|
if (options.sqlite === "better-sqlite3") {
|
|
6699
6700
|
sv.dependency("better-sqlite3", "^12.8.0");
|
|
6700
6701
|
sv.devDependency("@types/better-sqlite3", "^7.6.13");
|
|
6701
|
-
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"));
|
|
6702
6703
|
}
|
|
6703
6704
|
if (options.sqlite === "libsql" || options.sqlite === "turso") sv.devDependency("@libsql/client", "^0.17.2");
|
|
6704
6705
|
sv.file(".env", generateEnv(options, false));
|
|
@@ -6974,9 +6975,14 @@ var drizzle_default = defineAddon({
|
|
|
6974
6975
|
});
|
|
6975
6976
|
}));
|
|
6976
6977
|
},
|
|
6977
|
-
nextSteps: ({ options, packageManager, cwd }) => {
|
|
6978
|
+
nextSteps: ({ options, packageManager, cwd, dependencyVersion }) => {
|
|
6978
6979
|
const steps = [];
|
|
6979
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`);
|
|
6980
6986
|
const ext = fileExists(cwd, "wrangler.toml") ? "toml" : "jsonc";
|
|
6981
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")}`);
|
|
6982
6988
|
steps.push(`Run ${color.command(resolveCommandArray(packageManager, "run", [
|
|
@@ -7046,7 +7052,7 @@ var eslint_default = defineAddon({
|
|
|
7046
7052
|
run: ({ sv, language, dependencyVersion, file }) => {
|
|
7047
7053
|
const typescript = language === "ts";
|
|
7048
7054
|
const prettierInstalled = Boolean(dependencyVersion("prettier"));
|
|
7049
|
-
sv.devDependency("eslint",
|
|
7055
|
+
sv.devDependency("eslint", ESLINT_VERSION);
|
|
7050
7056
|
sv.devDependency("@eslint/compat", "^2.0.4");
|
|
7051
7057
|
sv.devDependency("eslint-plugin-svelte", "^3.17.0");
|
|
7052
7058
|
sv.devDependency("globals", "^17.4.0");
|
|
@@ -7552,8 +7558,8 @@ var playwright_default = defineAddon({
|
|
|
7552
7558
|
run: ({ sv, language, file, isKit, directory }) => {
|
|
7553
7559
|
sv.devDependency("@playwright/test", "^1.59.1");
|
|
7554
7560
|
sv.file(file.package, transforms.json(({ data, json }) => {
|
|
7555
|
-
json.packageScriptsUpsert(data, "prepare", "playwright install", { mode: "prepend" });
|
|
7556
7561
|
json.packageScriptsUpsert(data, "test:e2e", "playwright test");
|
|
7562
|
+
json.packageScriptsUpsert(data, "test:e2e", "playwright install", { mode: "prepend" });
|
|
7557
7563
|
json.packageScriptsUpsert(data, "test", "npm run test:e2e");
|
|
7558
7564
|
}));
|
|
7559
7565
|
sv.file(file.gitignore, transforms.text(({ content, text }) => {
|
|
@@ -7657,8 +7663,7 @@ var prettier_default = defineAddon({
|
|
|
7657
7663
|
}, { onError: () => {
|
|
7658
7664
|
R$1.warn(`A ${color.warning(".prettierrc")} config already exists and cannot be parsed as JSON. Skipping initialization.`);
|
|
7659
7665
|
} }));
|
|
7660
|
-
const
|
|
7661
|
-
const eslintInstalled = hasEslint(eslintVersion);
|
|
7666
|
+
const eslintInfo = checkEslint(dependencyVersion("eslint"));
|
|
7662
7667
|
sv.file(file.package, transforms.json(({ data, json }) => {
|
|
7663
7668
|
json.packageScriptsUpsert(data, "lint", "prettier --check .", { mode: "prepend" });
|
|
7664
7669
|
json.packageScriptsUpsert(data, "format", "prettier --write .");
|
|
@@ -7666,16 +7671,23 @@ var prettier_default = defineAddon({
|
|
|
7666
7671
|
sv.file(".vscode/extensions.json", transforms.json(({ data, json }) => {
|
|
7667
7672
|
json.arrayUpsert(data, "recommendations", "esbenp.prettier-vscode");
|
|
7668
7673
|
}));
|
|
7669
|
-
if (
|
|
7670
|
-
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) {
|
|
7671
7676
|
sv.devDependency("eslint-config-prettier", "^10.1.8");
|
|
7672
7677
|
sv.file("eslint.config.js", addEslintConfigPrettier);
|
|
7673
7678
|
}
|
|
7674
7679
|
}
|
|
7675
7680
|
});
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
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
|
+
};
|
|
7679
7691
|
}
|
|
7680
7692
|
//#endregion
|
|
7681
7693
|
//#region src/addons/storybook.ts
|
|
@@ -7764,7 +7776,7 @@ var sveltekit_adapter_default = defineAddon({
|
|
|
7764
7776
|
setup: ({ isKit, unsupported }) => {
|
|
7765
7777
|
if (!isKit) unsupported("Requires SvelteKit");
|
|
7766
7778
|
},
|
|
7767
|
-
run: ({ sv, options, file, cwd }) => {
|
|
7779
|
+
run: ({ sv, options, packageManager, file, cwd }) => {
|
|
7768
7780
|
const adapter = adapters.find((a) => a.id === options.adapter);
|
|
7769
7781
|
sv.file(file.package, transforms.json(({ data }) => {
|
|
7770
7782
|
const devDeps = data["devDependencies"];
|
|
@@ -7803,6 +7815,7 @@ var sveltekit_adapter_default = defineAddon({
|
|
|
7803
7815
|
}));
|
|
7804
7816
|
if (adapter.package === "@sveltejs/adapter-cloudflare") {
|
|
7805
7817
|
sv.devDependency("wrangler", "^4.81.0");
|
|
7818
|
+
if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.allowBuilds("workerd", "sharp"));
|
|
7806
7819
|
const ext = fileExists(cwd, "wrangler.toml") ? "toml" : "jsonc";
|
|
7807
7820
|
const applyWranglerConfig = (data) => {
|
|
7808
7821
|
if (ext === "jsonc") data.$schema ??= "./node_modules/wrangler/config-schema.json";
|
|
@@ -7882,7 +7895,7 @@ var tailwindcss_default = defineAddon({
|
|
|
7882
7895
|
const prettierInstalled = Boolean(dependencyVersion("prettier"));
|
|
7883
7896
|
sv.devDependency("tailwindcss", "^4.2.2");
|
|
7884
7897
|
sv.devDependency("@tailwindcss/vite", "^4.2.2");
|
|
7885
|
-
if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.
|
|
7898
|
+
if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.allowBuilds("@tailwindcss/oxide"));
|
|
7886
7899
|
if (prettierInstalled) sv.devDependency("prettier-plugin-tailwindcss", "^0.7.2");
|
|
7887
7900
|
for (const plugin of plugins) {
|
|
7888
7901
|
if (!options.plugins.includes(plugin.id)) continue;
|
|
@@ -7981,7 +7994,8 @@ const officialAddons$1 = {
|
|
|
7981
7994
|
run: ({ sv, file, language, directory, options, dependencyVersion }) => {
|
|
7982
7995
|
const unitTesting = options.usages.includes("unit");
|
|
7983
7996
|
const componentTesting = options.usages.includes("component");
|
|
7984
|
-
|
|
7997
|
+
const vitestVersion = dependencyVersion("vitest");
|
|
7998
|
+
if (vitestVersion) vitestV3Installed = coerceVersion(vitestVersion).major === 3;
|
|
7985
7999
|
sv.devDependency("vitest", "^4.1.3");
|
|
7986
8000
|
if (componentTesting) {
|
|
7987
8001
|
sv.devDependency("@vitest/browser-playwright", "^4.1.3");
|
|
@@ -10795,9 +10809,8 @@ function verifyPackage(addonPkg, specifier) {
|
|
|
10795
10809
|
const addonSvVersion = peerDeps["sv"];
|
|
10796
10810
|
if (!addonSvVersion) throw new Error(`Invalid add-on package specified: '${specifier}' is missing 'sv' in its 'peerDependencies'`);
|
|
10797
10811
|
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`);
|
|
10798
|
-
const
|
|
10799
|
-
|
|
10800
|
-
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.")}`;
|
|
10812
|
+
const addon = coerceVersion(addonSvVersion);
|
|
10813
|
+
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.")}`;
|
|
10801
10814
|
}
|
|
10802
10815
|
/**
|
|
10803
10816
|
* Recursively copies a directory from source to destination
|
|
@@ -10950,22 +10963,33 @@ async function installDependencies(agent, cwd) {
|
|
|
10950
10963
|
spacing: 0,
|
|
10951
10964
|
retainLog: true
|
|
10952
10965
|
});
|
|
10966
|
+
const { command, args } = constructCommand(COMMANDS[agent].install, []);
|
|
10967
|
+
const proc = z(command, args, {
|
|
10968
|
+
nodeOptions: {
|
|
10969
|
+
cwd,
|
|
10970
|
+
stdio: "pipe"
|
|
10971
|
+
},
|
|
10972
|
+
throwOnError: false
|
|
10973
|
+
});
|
|
10974
|
+
const output = [];
|
|
10953
10975
|
try {
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
throwOnError: true
|
|
10961
|
-
});
|
|
10962
|
-
for await (const line of proc) task.message(line);
|
|
10976
|
+
for await (const line of proc) {
|
|
10977
|
+
output.push(line);
|
|
10978
|
+
task.message(line);
|
|
10979
|
+
}
|
|
10980
|
+
} catch {}
|
|
10981
|
+
if ((proc.exitCode ?? 0) === 0) {
|
|
10963
10982
|
task.success(`Successfully installed dependencies with ${color.command(agent)}`);
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10983
|
+
return;
|
|
10984
|
+
}
|
|
10985
|
+
if (agent === "pnpm" && output.join("\n").includes("ERR_PNPM_IGNORED_BUILDS")) {
|
|
10986
|
+
task.success(`Installed dependencies with ${color.command(agent)}`);
|
|
10987
|
+
R$1.warn(`Some build scripts were skipped. Run ${color.command(`${agent} approve-builds`)} to approve them.`);
|
|
10988
|
+
return;
|
|
10968
10989
|
}
|
|
10990
|
+
task.error("Failed to install dependencies");
|
|
10991
|
+
Pt("Operation failed.");
|
|
10992
|
+
process$1.exit(2);
|
|
10969
10993
|
}
|
|
10970
10994
|
async function detectPackageManager(cwd) {
|
|
10971
10995
|
return (await detect({ cwd }))?.name ?? getUserAgent() ?? "npm";
|
|
@@ -10978,12 +11002,12 @@ function getUserAgent() {
|
|
|
10978
11002
|
const name = pmSpec.substring(0, separatorPos);
|
|
10979
11003
|
return AGENTS.includes(name) ? name : void 0;
|
|
10980
11004
|
}
|
|
10981
|
-
function
|
|
11005
|
+
function addPnpmAllowBuilds(cwd, packageManager, ...packages) {
|
|
10982
11006
|
if (packageManager !== "pnpm" || packages.length === 0) return;
|
|
10983
11007
|
const found = up$1("pnpm-workspace.yaml", { cwd });
|
|
10984
11008
|
const filePath = found ?? path.join(cwd, "pnpm-workspace.yaml");
|
|
10985
11009
|
const content = found ? fs.readFileSync(found, "utf-8") : "";
|
|
10986
|
-
const newContent = pnpm.
|
|
11010
|
+
const newContent = pnpm.allowBuilds(...packages)(content);
|
|
10987
11011
|
if (newContent !== content) fs.writeFileSync(filePath, newContent, "utf-8");
|
|
10988
11012
|
}
|
|
10989
11013
|
//#endregion
|
|
@@ -11081,7 +11105,9 @@ async function createWorkspace({ cwd, packageManager, override }) {
|
|
|
11081
11105
|
directory = path.dirname(directory);
|
|
11082
11106
|
}
|
|
11083
11107
|
}
|
|
11084
|
-
for (const [key, value] of Object.entries(dependencies))
|
|
11108
|
+
for (const [key, value] of Object.entries(dependencies)) try {
|
|
11109
|
+
dependencies[key] = minVersion(value);
|
|
11110
|
+
} catch {}
|
|
11085
11111
|
const isKit = override?.isKit ?? !!dependencies["@sveltejs/kit"];
|
|
11086
11112
|
const directory = override?.directory ? override.directory : isKit ? {
|
|
11087
11113
|
src: "src",
|
|
@@ -11550,6 +11576,8 @@ async function createProject(cwd, options) {
|
|
|
11550
11576
|
});
|
|
11551
11577
|
if (options.fromPlayground) await createProjectFromPlayground(options.fromPlayground, projectPath);
|
|
11552
11578
|
R$1.success("Project created");
|
|
11579
|
+
const packageManager = options.install === false ? null : options.install === true ? await packageManagerPrompt(projectPath) : options.install;
|
|
11580
|
+
if (packageManager) workspace.packageManager = packageManager;
|
|
11553
11581
|
let argsFormattedAddons = [];
|
|
11554
11582
|
let addOnFilesToFormat = [];
|
|
11555
11583
|
let addOnSuccessfulAddons = [];
|
|
@@ -11574,7 +11602,6 @@ async function createProject(cwd, options) {
|
|
|
11574
11602
|
addOnSuccessfulAddons = successfulAddons;
|
|
11575
11603
|
addonSetupResults = setupResults;
|
|
11576
11604
|
}
|
|
11577
|
-
const packageManager = options.install === false ? null : options.install === true ? await packageManagerPrompt(projectPath) : options.install;
|
|
11578
11605
|
const argsFormatted = [];
|
|
11579
11606
|
argsFormatted.push("--template", template);
|
|
11580
11607
|
if (language === "typescript") argsFormatted.push("--types", "ts");
|
|
@@ -11583,9 +11610,8 @@ async function createProject(cwd, options) {
|
|
|
11583
11610
|
if (argsFormattedAddons.length > 0) argsFormatted.push("--add", ...argsFormattedAddons);
|
|
11584
11611
|
updateReadme(directory, buildAndLogArgs(packageManager, "create", argsFormatted, [directory]));
|
|
11585
11612
|
updateAgent(directory, language, packageManager ?? "npm", loadedAddons);
|
|
11586
|
-
if (packageManager) workspace.packageManager = packageManager;
|
|
11587
11613
|
const addOnNextSteps = getNextSteps(addOnSuccessfulAddons, workspace, answers, addonSetupResults);
|
|
11588
|
-
|
|
11614
|
+
addPnpmAllowBuilds(projectPath, packageManager, "esbuild");
|
|
11589
11615
|
if (packageManager) {
|
|
11590
11616
|
await installDependencies(packageManager, projectPath);
|
|
11591
11617
|
await formatFiles({
|
|
@@ -12049,12 +12075,14 @@ async function runAddonsApply({ answers, options, loadedAddons, setupResults, wo
|
|
|
12049
12075
|
canceledAddonIds.push(addonId);
|
|
12050
12076
|
}
|
|
12051
12077
|
const successfulAddons = loadedAddons.filter((a) => !canceledAddonIds.includes(a.addon.id));
|
|
12052
|
-
if (addonSuccess.length === 0)
|
|
12078
|
+
if (addonSuccess.length === 0) if (fromCommand === "create") R$1.warn("All selected add-ons were canceled.");
|
|
12079
|
+
else {
|
|
12053
12080
|
Pt("All selected add-ons were canceled.");
|
|
12054
12081
|
process$1.exit(1);
|
|
12055
|
-
}
|
|
12082
|
+
}
|
|
12083
|
+
else R$1.success(`Successfully setup add-ons: ${addonSuccess.map((c) => color.addon(c)).join(", ")}`);
|
|
12056
12084
|
const packageManager = options.install === false ? null : options.install === true ? await packageManagerPrompt(options.cwd) : options.install;
|
|
12057
|
-
|
|
12085
|
+
addPnpmAllowBuilds(workspace.cwd, packageManager, "esbuild");
|
|
12058
12086
|
const argsFormattedAddons = [];
|
|
12059
12087
|
for (const loaded of successfulAddons) {
|
|
12060
12088
|
const addonId = loaded.addon.id;
|
|
@@ -12313,9 +12341,16 @@ async function add({ addons, cwd, options, packageManager = "npm" }) {
|
|
|
12313
12341
|
async function applyAddons({ loadedAddons, workspace, setupResults, options }) {
|
|
12314
12342
|
const filesToFormat = /* @__PURE__ */ new Set();
|
|
12315
12343
|
const status = {};
|
|
12344
|
+
const canceledAddons = /* @__PURE__ */ new Set();
|
|
12316
12345
|
const ordered = orderAddons(loadedAddons.map((l) => l.addon), setupResults);
|
|
12317
12346
|
let hasFormatter = false;
|
|
12318
12347
|
for (const addon of ordered) {
|
|
12348
|
+
const canceledDeps = (setupResults[addon.id]?.dependsOn ?? []).filter((dep) => canceledAddons.has(dep));
|
|
12349
|
+
if (canceledDeps.length > 0) {
|
|
12350
|
+
canceledAddons.add(addon.id);
|
|
12351
|
+
status[addon.id] = canceledDeps.map((dep) => `Because dependency '${dep}' was canceled`);
|
|
12352
|
+
continue;
|
|
12353
|
+
}
|
|
12319
12354
|
const loaded = loadedAddons.find((l) => l.addon.id === addon.id);
|
|
12320
12355
|
const workspaceOptions = options[addon.id] || {};
|
|
12321
12356
|
const addonWorkspace = await createWorkspace({
|
|
@@ -12332,7 +12367,10 @@ async function applyAddons({ loadedAddons, workspace, setupResults, options }) {
|
|
|
12332
12367
|
});
|
|
12333
12368
|
files.forEach((f) => filesToFormat.add(f));
|
|
12334
12369
|
if (cancels.length === 0) status[addon.id] = "success";
|
|
12335
|
-
else
|
|
12370
|
+
else {
|
|
12371
|
+
canceledAddons.add(addon.id);
|
|
12372
|
+
status[addon.id] = cancels;
|
|
12373
|
+
}
|
|
12336
12374
|
}
|
|
12337
12375
|
return {
|
|
12338
12376
|
filesToFormat: hasFormatter ? Array.from(filesToFormat) : [],
|
|
@@ -12421,8 +12459,8 @@ async function runAddon({ addon, loaded, multiple, workspace, workspaceOptions }
|
|
|
12421
12459
|
});
|
|
12422
12460
|
},
|
|
12423
12461
|
pnpmBuildDependency: (pkg) => {
|
|
12424
|
-
svDeprecated("use `pnpm.
|
|
12425
|
-
|
|
12462
|
+
svDeprecated("use `pnpm.allowBuilds` from `@sveltejs/sv-utils` instead of `sv.pnpmBuildDependency`");
|
|
12463
|
+
addPnpmAllowBuilds(workspace.cwd, workspace.packageManager, pkg);
|
|
12426
12464
|
}
|
|
12427
12465
|
};
|
|
12428
12466
|
const cancels = [];
|
|
@@ -12454,4 +12492,4 @@ function orderAddons(addons, setupResults) {
|
|
|
12454
12492
|
});
|
|
12455
12493
|
}
|
|
12456
12494
|
//#endregion
|
|
12457
|
-
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,
|
|
12495
|
+
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-DSL32Woe.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-DSL32Woe.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.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.2.
|
|
28
|
+
"@sveltejs/sv-utils": "0.2.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@clack/prompts": "1.0.0",
|