sv 0.6.6 → 0.6.8
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.js +90 -17
- package/dist/bin.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{install-ClR4mYH4.js → install-BNk1yMP2.js} +170 -119
- package/dist/install-BNk1yMP2.js.map +1 -0
- package/dist/templates/demo/package.json +1 -0
- package/dist/templates/minimal/package.json +1 -0
- package/package.json +2 -2
- package/dist/install-ClR4mYH4.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -4,7 +4,7 @@ import require$$1, { execSync } from 'node:child_process';
|
|
|
4
4
|
import path$2 from 'node:path';
|
|
5
5
|
import fs$3 from 'node:fs';
|
|
6
6
|
import process$1$1 from 'node:process';
|
|
7
|
-
import { u as up$1, d as dedent, p as parseJson, a as parseScript, b as imports, c as common, e as exports$1, o as object$1, v as variables, _ as _function, f as parseSvelte, g as array$1, w as walk$1, k as kit, h as addFromString, E as Element, j as index, l as parseHtml, m as parseHtml$1, A as AtRule2, n as parseCss, q as pc, r as intro, s as outro, t as log$1, x as cancel, y as box, z as multiselect, B as isCancel, C as confirm, D as createWorkspace, F as setupAddons, G as note, H as select, I as text, J as packageManagerPrompt, K as applyAddons, L as installDependencies, M as formatFiles, N as spinner, O as getHighlighter, P as detectSync, Q as getUserAgent, R as group, S as resolveCommand, T as from$1 } from './install-
|
|
7
|
+
import { u as up$1, d as dedent, p as parseJson, a as parseScript, b as imports, c as common, e as exports$1, o as object$1, v as variables, _ as _function, f as parseSvelte, g as array$1, w as walk$1, k as kit, h as addFromString, E as Element, j as index, l as parseHtml, m as parseHtml$1, A as AtRule2, n as parseCss, q as pc, r as intro, s as outro, t as log$1, x as cancel, y as box, z as multiselect, B as isCancel, C as confirm, D as createWorkspace, F as setupAddons, G as note, H as select, I as text, J as packageManagerPrompt, K as applyAddons, L as installDependencies, M as formatFiles, N as spinner, O as getHighlighter, P as detectSync, Q as getUserAgent, R as group, S as resolveCommand, T as from$1 } from './install-BNk1yMP2.js';
|
|
8
8
|
import 'node:readline';
|
|
9
9
|
import 'node:tty';
|
|
10
10
|
import { createGunzip } from 'node:zlib';
|
|
@@ -24,7 +24,7 @@ import 'stream';
|
|
|
24
24
|
import 'readline';
|
|
25
25
|
|
|
26
26
|
var name = "sv";
|
|
27
|
-
var version = "0.6.
|
|
27
|
+
var version = "0.6.8";
|
|
28
28
|
var type = "module";
|
|
29
29
|
var description = "A CLI for creating and updating SvelteKit projects";
|
|
30
30
|
var license = "MIT";
|
|
@@ -64,7 +64,7 @@ var devDependencies = {
|
|
|
64
64
|
commander: "^12.1.0",
|
|
65
65
|
degit: "^2.8.4",
|
|
66
66
|
empathic: "^1.0.0",
|
|
67
|
-
"package-manager-detector": "^0.2.
|
|
67
|
+
"package-manager-detector": "^0.2.7",
|
|
68
68
|
picocolors: "^1.1.0",
|
|
69
69
|
"ps-tree": "^1.2.0",
|
|
70
70
|
"tar-fs": "^3.0.6",
|
|
@@ -4880,7 +4880,7 @@ const PORTS = {
|
|
|
4880
4880
|
postgresql: "5432",
|
|
4881
4881
|
sqlite: ""
|
|
4882
4882
|
};
|
|
4883
|
-
const options$
|
|
4883
|
+
const options$5 = defineAddonOptions({
|
|
4884
4884
|
database: {
|
|
4885
4885
|
question: "Which database would you like to use?",
|
|
4886
4886
|
type: "select",
|
|
@@ -4936,7 +4936,7 @@ var drizzle = defineAddon({
|
|
|
4936
4936
|
id: "drizzle",
|
|
4937
4937
|
shortDescription: "database orm",
|
|
4938
4938
|
homepage: "https://orm.drizzle.team",
|
|
4939
|
-
options: options$
|
|
4939
|
+
options: options$5,
|
|
4940
4940
|
setup: ({ kit, unsupported }) => {
|
|
4941
4941
|
if (!kit) unsupported("Requires SvelteKit");
|
|
4942
4942
|
},
|
|
@@ -5360,6 +5360,77 @@ var eslint = defineAddon({
|
|
|
5360
5360
|
}
|
|
5361
5361
|
});
|
|
5362
5362
|
|
|
5363
|
+
const adapters = [
|
|
5364
|
+
{ id: "node", package: "@sveltejs/adapter-node", version: "^5.2.9" },
|
|
5365
|
+
{ id: "static", package: "@sveltejs/adapter-static", version: "^3.0.6" },
|
|
5366
|
+
{ id: "vercel", package: "@sveltejs/adapter-vercel", version: "^5.5.0" },
|
|
5367
|
+
{ id: "cloudflare-pages", package: "@sveltejs/adapter-cloudflare", version: "^4.8.0" },
|
|
5368
|
+
{ id: "cloudflare-workers", package: "@sveltejs/adapter-cloudflare-workers", version: "^2.6.0" },
|
|
5369
|
+
{ id: "netlify", package: "@sveltejs/adapter-netlify", version: "^4.4.0" }
|
|
5370
|
+
];
|
|
5371
|
+
const options$4 = defineAddonOptions({
|
|
5372
|
+
adapter: {
|
|
5373
|
+
type: "select",
|
|
5374
|
+
question: "Which SvelteKit adapter would you like to use?",
|
|
5375
|
+
options: adapters.map((p) => ({ value: p.id, label: p.id, hint: p.package })),
|
|
5376
|
+
default: "node"
|
|
5377
|
+
}
|
|
5378
|
+
});
|
|
5379
|
+
var sveltekitAdapter = defineAddon({
|
|
5380
|
+
id: "sveltekit-adapter",
|
|
5381
|
+
alias: "adapter",
|
|
5382
|
+
shortDescription: "deployment",
|
|
5383
|
+
homepage: "https://svelte.dev/docs/kit/adapters",
|
|
5384
|
+
options: options$4,
|
|
5385
|
+
setup: ({ kit, unsupported }) => {
|
|
5386
|
+
if (!kit) unsupported("Requires SvelteKit");
|
|
5387
|
+
},
|
|
5388
|
+
run: ({ sv, options: options2 }) => {
|
|
5389
|
+
const adapter = adapters.find((a) => a.id === options2.adapter);
|
|
5390
|
+
sv.file("package.json", (content) => {
|
|
5391
|
+
const { data, generateCode } = parseJson(content);
|
|
5392
|
+
const devDeps = data["devDependencies"];
|
|
5393
|
+
for (const pkg of Object.keys(devDeps)) {
|
|
5394
|
+
if (pkg.startsWith("@sveltejs/adapter-")) {
|
|
5395
|
+
delete devDeps[pkg];
|
|
5396
|
+
}
|
|
5397
|
+
}
|
|
5398
|
+
return generateCode();
|
|
5399
|
+
});
|
|
5400
|
+
sv.devDependency(adapter.package, adapter.version);
|
|
5401
|
+
sv.file("svelte.config.js", (content) => {
|
|
5402
|
+
const { ast, generateCode } = parseScript(content);
|
|
5403
|
+
const importDecls = ast.body.filter((n) => n.type === "ImportDeclaration");
|
|
5404
|
+
const adapterImportDecl = importDecls.find(
|
|
5405
|
+
(importDecl) => typeof importDecl.source.value === "string" && importDecl.source.value.startsWith("@sveltejs/adapter-") && importDecl.importKind === "value"
|
|
5406
|
+
);
|
|
5407
|
+
let adapterName = "adapter";
|
|
5408
|
+
if (adapterImportDecl) {
|
|
5409
|
+
adapterImportDecl.source.value = adapter.package;
|
|
5410
|
+
adapterName = adapterImportDecl.specifiers?.find((s) => s.type === "ImportDefaultSpecifier")?.local?.name;
|
|
5411
|
+
} else {
|
|
5412
|
+
imports.addDefault(ast, adapter.package, adapterName);
|
|
5413
|
+
}
|
|
5414
|
+
const { value: config } = exports$1.defaultExport(ast, object$1.createEmpty());
|
|
5415
|
+
const kitConfig = config.properties.find(
|
|
5416
|
+
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "kit"
|
|
5417
|
+
);
|
|
5418
|
+
if (kitConfig && kitConfig.value.type === "ObjectExpression") {
|
|
5419
|
+
object$1.overrideProperties(kitConfig.value, {
|
|
5420
|
+
adapter: _function.callByIdentifier(adapterName, [])
|
|
5421
|
+
});
|
|
5422
|
+
} else {
|
|
5423
|
+
object$1.properties(config, {
|
|
5424
|
+
kit: object$1.create({
|
|
5425
|
+
adapter: _function.callByIdentifier(adapterName, [])
|
|
5426
|
+
})
|
|
5427
|
+
});
|
|
5428
|
+
}
|
|
5429
|
+
return generateCode();
|
|
5430
|
+
});
|
|
5431
|
+
}
|
|
5432
|
+
});
|
|
5433
|
+
|
|
5363
5434
|
const comma = ','.charCodeAt(0);
|
|
5364
5435
|
const semicolon = ';'.charCodeAt(0);
|
|
5365
5436
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
@@ -7528,7 +7599,7 @@ ${paraglideOutDir}`;
|
|
|
7528
7599
|
scriptCode.append("\n\n");
|
|
7529
7600
|
scriptCode.append(dedent`
|
|
7530
7601
|
${ts("", "/**")}
|
|
7531
|
-
${ts("", '* @param import("$lib/paraglide/runtime").AvailableLanguageTag newLanguage')}
|
|
7602
|
+
${ts("", '* @param {import("$lib/paraglide/runtime").AvailableLanguageTag} newLanguage')}
|
|
7532
7603
|
${ts("", "*/")}
|
|
7533
7604
|
function switchToLanguage(newLanguage${ts(": AvailableLanguageTag")}) {
|
|
7534
7605
|
const canonicalPath = i18n.route($page.url.pathname);
|
|
@@ -7957,6 +8028,7 @@ const officialAddons = [
|
|
|
7957
8028
|
vitest,
|
|
7958
8029
|
playwright,
|
|
7959
8030
|
tailwindcss,
|
|
8031
|
+
sveltekitAdapter,
|
|
7960
8032
|
drizzle,
|
|
7961
8033
|
lucia,
|
|
7962
8034
|
mdsvex,
|
|
@@ -11351,13 +11423,16 @@ function getGlobalPreconditions(cwd, addons, addonSetupResult) {
|
|
|
11351
11423
|
};
|
|
11352
11424
|
}
|
|
11353
11425
|
|
|
11426
|
+
const aliases = officialAddons.map((c) => c.alias).filter((v2) => v2 !== void 0);
|
|
11427
|
+
const addonsOptions = getAddonOptionFlags();
|
|
11428
|
+
const communityDetails = [];
|
|
11429
|
+
const OptionFlagSchema = optional(array(string()));
|
|
11430
|
+
const addonOptionFlags = addonsOptions.reduce(
|
|
11431
|
+
(flags, opt) => Object.assign(flags, { [opt.attributeName()]: OptionFlagSchema }),
|
|
11432
|
+
{}
|
|
11433
|
+
);
|
|
11354
11434
|
const AddonsSchema = array(string());
|
|
11355
|
-
const AddonOptionFlagsSchema = object(
|
|
11356
|
-
tailwindcss: optional(array(string())),
|
|
11357
|
-
drizzle: optional(array(string())),
|
|
11358
|
-
lucia: optional(array(string())),
|
|
11359
|
-
paraglide: optional(array(string()))
|
|
11360
|
-
});
|
|
11435
|
+
const AddonOptionFlagsSchema = object(addonOptionFlags);
|
|
11361
11436
|
const OptionsSchema$1 = strictObject({
|
|
11362
11437
|
cwd: string(),
|
|
11363
11438
|
install: boolean(),
|
|
@@ -11365,9 +11440,6 @@ const OptionsSchema$1 = strictObject({
|
|
|
11365
11440
|
community: optional(union([AddonsSchema, boolean()])),
|
|
11366
11441
|
...AddonOptionFlagsSchema.entries
|
|
11367
11442
|
});
|
|
11368
|
-
const aliases = officialAddons.map((c) => c.alias).filter((v2) => v2 !== void 0);
|
|
11369
|
-
const addonsOptions = getAddonOptionFlags();
|
|
11370
|
-
const communityDetails = [];
|
|
11371
11443
|
const defaultPkgPath = up();
|
|
11372
11444
|
const defaultCwd = defaultPkgPath ? path$2.dirname(defaultPkgPath) : void 0;
|
|
11373
11445
|
const add = new Command("add").description("applies specified add-ons into a project").argument("[add-on...]", "add-ons to install").option("-C, --cwd <path>", "path to working directory", defaultCwd).option("--no-install", "skip installing dependencies").option("--no-preconditions", "skip validating preconditions").configureHelp(helpConfig).action((addonArgs, opts) => {
|
|
@@ -11410,8 +11482,9 @@ async function runAddCommand(options, selectedAddonIds) {
|
|
|
11410
11482
|
const official = {};
|
|
11411
11483
|
const community = {};
|
|
11412
11484
|
for (const addonOption of addonsOptions) {
|
|
11413
|
-
const addonId = addonOption.
|
|
11414
|
-
const
|
|
11485
|
+
const addonId = addonOption.name();
|
|
11486
|
+
const aliased = addonOption.attributeName();
|
|
11487
|
+
const specifiedOptions = options[addonId] || options[aliased];
|
|
11415
11488
|
if (!specifiedOptions) continue;
|
|
11416
11489
|
const details2 = getAddonDetails(addonId);
|
|
11417
11490
|
if (!selectedAddons.find((d) => d.addon === details2)) {
|