sv 0.6.21 → 0.6.22
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 +211 -149
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -12,7 +12,7 @@ import { promisify } from "node:util";
|
|
|
12
12
|
|
|
13
13
|
//#region packages/cli/package.json
|
|
14
14
|
var name = "sv";
|
|
15
|
-
var version = "0.6.
|
|
15
|
+
var version = "0.6.22";
|
|
16
16
|
var type = "module";
|
|
17
17
|
var description = "A CLI for creating and updating SvelteKit projects";
|
|
18
18
|
var license = "MIT";
|
|
@@ -913,11 +913,11 @@ var require_option = __commonJS({ "node_modules/.pnpm/commander@13.0.0/node_modu
|
|
|
913
913
|
/**
|
|
914
914
|
* @param {Option[]} options
|
|
915
915
|
*/
|
|
916
|
-
constructor(options$
|
|
916
|
+
constructor(options$6) {
|
|
917
917
|
this.positiveOptions = new Map();
|
|
918
918
|
this.negativeOptions = new Map();
|
|
919
919
|
this.dualOptions = new Set();
|
|
920
|
-
options$
|
|
920
|
+
options$6.forEach((option) => {
|
|
921
921
|
if (option.negate) this.negativeOptions.set(option.attributeName(), option);
|
|
922
922
|
else this.positiveOptions.set(option.attributeName(), option);
|
|
923
923
|
});
|
|
@@ -3201,14 +3201,14 @@ function optional(wrapped, ...args) {
|
|
|
3201
3201
|
if (0 in args) schema.default = args[0];
|
|
3202
3202
|
return schema;
|
|
3203
3203
|
}
|
|
3204
|
-
function picklist(options$
|
|
3204
|
+
function picklist(options$6, message) {
|
|
3205
3205
|
return {
|
|
3206
3206
|
kind: "schema",
|
|
3207
3207
|
type: "picklist",
|
|
3208
3208
|
reference: picklist,
|
|
3209
|
-
expects: _joinExpects(options$
|
|
3209
|
+
expects: _joinExpects(options$6.map(_stringify), "|"),
|
|
3210
3210
|
async: false,
|
|
3211
|
-
options: options$
|
|
3211
|
+
options: options$6,
|
|
3212
3212
|
message,
|
|
3213
3213
|
_run(dataset, config2) {
|
|
3214
3214
|
if (this.options.includes(dataset.value)) dataset.typed = true;
|
|
@@ -3302,14 +3302,14 @@ function _subIssues(datasets) {
|
|
|
3302
3302
|
else issues = dataset.issues;
|
|
3303
3303
|
return issues;
|
|
3304
3304
|
}
|
|
3305
|
-
function union(options$
|
|
3305
|
+
function union(options$6, message) {
|
|
3306
3306
|
return {
|
|
3307
3307
|
kind: "schema",
|
|
3308
3308
|
type: "union",
|
|
3309
3309
|
reference: union,
|
|
3310
|
-
expects: _joinExpects(options$
|
|
3310
|
+
expects: _joinExpects(options$6.map((option) => option.expects), "|"),
|
|
3311
3311
|
async: false,
|
|
3312
|
-
options: options$
|
|
3312
|
+
options: options$6,
|
|
3313
3313
|
message,
|
|
3314
3314
|
_run(dataset, config2) {
|
|
3315
3315
|
let validDataset;
|
|
@@ -3367,8 +3367,8 @@ function pipe$1(...pipe2) {
|
|
|
3367
3367
|
|
|
3368
3368
|
//#endregion
|
|
3369
3369
|
//#region node_modules/.pnpm/empathic@1.0.0/node_modules/empathic/package.mjs
|
|
3370
|
-
function up$1(options$
|
|
3371
|
-
return up("package.json", options$
|
|
3370
|
+
function up$1(options$6) {
|
|
3371
|
+
return up("package.json", options$6);
|
|
3372
3372
|
}
|
|
3373
3373
|
|
|
3374
3374
|
//#endregion
|
|
@@ -3376,8 +3376,8 @@ function up$1(options$5) {
|
|
|
3376
3376
|
function defineAddon(config) {
|
|
3377
3377
|
return config;
|
|
3378
3378
|
}
|
|
3379
|
-
function defineAddonOptions(options$
|
|
3380
|
-
return options$
|
|
3379
|
+
function defineAddonOptions(options$6) {
|
|
3380
|
+
return options$6;
|
|
3381
3381
|
}
|
|
3382
3382
|
var __create$1 = Object.create;
|
|
3383
3383
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -4044,7 +4044,7 @@ const PORTS = {
|
|
|
4044
4044
|
postgresql: "5432",
|
|
4045
4045
|
sqlite: ""
|
|
4046
4046
|
};
|
|
4047
|
-
const options$
|
|
4047
|
+
const options$5 = defineAddonOptions({
|
|
4048
4048
|
database: {
|
|
4049
4049
|
question: "Which database would you like to use?",
|
|
4050
4050
|
type: "select",
|
|
@@ -4129,39 +4129,39 @@ var drizzle_default = defineAddon({
|
|
|
4129
4129
|
id: "drizzle",
|
|
4130
4130
|
shortDescription: "database orm",
|
|
4131
4131
|
homepage: "https://orm.drizzle.team",
|
|
4132
|
-
options: options$
|
|
4132
|
+
options: options$5,
|
|
4133
4133
|
setup: ({ kit, unsupported }) => {
|
|
4134
4134
|
if (!kit) unsupported("Requires SvelteKit");
|
|
4135
4135
|
},
|
|
4136
|
-
run: ({ sv, typescript, options: options$
|
|
4136
|
+
run: ({ sv, typescript, options: options$6, kit }) => {
|
|
4137
4137
|
const ext = typescript ? "ts" : "js";
|
|
4138
|
-
sv.dependency("drizzle-orm", "^0.
|
|
4138
|
+
sv.dependency("drizzle-orm", "^0.40.0");
|
|
4139
4139
|
sv.devDependency("drizzle-kit", "^0.30.2");
|
|
4140
|
-
if (options$
|
|
4141
|
-
if (options$
|
|
4142
|
-
if (options$
|
|
4143
|
-
if (options$
|
|
4144
|
-
if (options$
|
|
4140
|
+
if (options$6.mysql === "mysql2") sv.dependency("mysql2", "^3.12.0");
|
|
4141
|
+
if (options$6.mysql === "planetscale") sv.dependency("@planetscale/database", "^1.19.0");
|
|
4142
|
+
if (options$6.postgresql === "neon") sv.dependency("@neondatabase/serverless", "^0.10.4");
|
|
4143
|
+
if (options$6.postgresql === "postgres.js") sv.dependency("postgres", "^3.4.5");
|
|
4144
|
+
if (options$6.sqlite === "better-sqlite3") {
|
|
4145
4145
|
sv.dependency("better-sqlite3", "^11.8.0");
|
|
4146
4146
|
sv.devDependency("@types/better-sqlite3", "^7.6.12");
|
|
4147
4147
|
sv.pnpmBuildDependendency("better-sqlite3");
|
|
4148
4148
|
}
|
|
4149
|
-
if (options$
|
|
4150
|
-
sv.file(".env", (content) => generateEnvFileContent(content, options$
|
|
4151
|
-
sv.file(".env.example", (content) => generateEnvFileContent(content, options$
|
|
4152
|
-
if (options$
|
|
4149
|
+
if (options$6.sqlite === "libsql" || options$6.sqlite === "turso") sv.dependency("@libsql/client", "^0.14.0");
|
|
4150
|
+
sv.file(".env", (content) => generateEnvFileContent(content, options$6));
|
|
4151
|
+
sv.file(".env.example", (content) => generateEnvFileContent(content, options$6));
|
|
4152
|
+
if (options$6.docker && (options$6.mysql === "mysql2" || options$6.postgresql === "postgres.js")) sv.file("docker-compose.yml", (content) => {
|
|
4153
4153
|
if (content.length > 0) return content;
|
|
4154
|
-
const imageName = options$
|
|
4155
|
-
const port = PORTS[options$
|
|
4154
|
+
const imageName = options$6.database === "mysql" ? "mysql" : "postgres";
|
|
4155
|
+
const port = PORTS[options$6.database];
|
|
4156
4156
|
const USER = "root";
|
|
4157
4157
|
const PASSWORD = "mysecretpassword";
|
|
4158
4158
|
const DB_NAME = "local";
|
|
4159
4159
|
let dbSpecificContent = "";
|
|
4160
|
-
if (options$
|
|
4160
|
+
if (options$6.mysql === "mysql2") dbSpecificContent = `
|
|
4161
4161
|
MYSQL_ROOT_PASSWORD: ${PASSWORD}
|
|
4162
4162
|
MYSQL_DATABASE: ${DB_NAME}
|
|
4163
4163
|
`;
|
|
4164
|
-
if (options$
|
|
4164
|
+
if (options$6.postgresql === "postgres.js") dbSpecificContent = `
|
|
4165
4165
|
POSTGRES_USER: ${USER}
|
|
4166
4166
|
POSTGRES_PASSWORD: ${PASSWORD}
|
|
4167
4167
|
POSTGRES_DB: ${DB_NAME}
|
|
@@ -4181,13 +4181,13 @@ var drizzle_default = defineAddon({
|
|
|
4181
4181
|
const { data, generateCode } = parseJson(content);
|
|
4182
4182
|
data.scripts ??= {};
|
|
4183
4183
|
const scripts$1 = data.scripts;
|
|
4184
|
-
if (options$
|
|
4184
|
+
if (options$6.docker) scripts$1["db:start"] ??= "docker compose up";
|
|
4185
4185
|
scripts$1["db:push"] ??= "drizzle-kit push";
|
|
4186
4186
|
scripts$1["db:migrate"] ??= "drizzle-kit migrate";
|
|
4187
4187
|
scripts$1["db:studio"] ??= "drizzle-kit studio";
|
|
4188
4188
|
return generateCode();
|
|
4189
4189
|
});
|
|
4190
|
-
if (options$
|
|
4190
|
+
if (options$6.database === "sqlite") sv.file(".gitignore", (content) => {
|
|
4191
4191
|
if (content.length === 0) return content;
|
|
4192
4192
|
if (!content.includes("\n*.db")) content = content.trimEnd() + "\n\n# SQLite\n*.db";
|
|
4193
4193
|
return content;
|
|
@@ -4202,7 +4202,7 @@ var drizzle_default = defineAddon({
|
|
|
4202
4202
|
if (exportDefault.type !== "CallExpression") return content;
|
|
4203
4203
|
const objExpression = exportDefault.arguments?.[0];
|
|
4204
4204
|
if (!objExpression || objExpression.type !== "ObjectExpression") return content;
|
|
4205
|
-
const authToken = options$
|
|
4205
|
+
const authToken = options$6.sqlite === "turso" ? common_exports.expressionFromString("process.env.DATABASE_AUTH_TOKEN") : undefined;
|
|
4206
4206
|
object_exports.properties(objExpression, {
|
|
4207
4207
|
schema: common_exports.createLiteral(`./src/lib/server/db/schema.${typescript ? "ts" : "js"}`),
|
|
4208
4208
|
dbCredentials: object_exports.create({
|
|
@@ -4218,15 +4218,15 @@ var drizzle_default = defineAddon({
|
|
|
4218
4218
|
value: true
|
|
4219
4219
|
}
|
|
4220
4220
|
});
|
|
4221
|
-
const dialect = options$
|
|
4221
|
+
const dialect = options$6.sqlite === "turso" ? "turso" : options$6.database;
|
|
4222
4222
|
object_exports.overrideProperties(objExpression, { dialect: common_exports.createLiteral(dialect) });
|
|
4223
|
-
if (options$
|
|
4223
|
+
if (options$6.database !== "sqlite") object_exports.removeProperty(objExpression, "driver");
|
|
4224
4224
|
return generateCode();
|
|
4225
4225
|
});
|
|
4226
4226
|
sv.file(`${kit?.libDirectory}/server/db/schema.${ext}`, (content) => {
|
|
4227
4227
|
const { ast, generateCode } = parseScript(content);
|
|
4228
4228
|
let userSchemaExpression;
|
|
4229
|
-
if (options$
|
|
4229
|
+
if (options$6.database === "sqlite") {
|
|
4230
4230
|
imports_exports.addNamed(ast, "drizzle-orm/sqlite-core", {
|
|
4231
4231
|
sqliteTable: "sqliteTable",
|
|
4232
4232
|
text: "text",
|
|
@@ -4237,7 +4237,7 @@ var drizzle_default = defineAddon({
|
|
|
4237
4237
|
age: integer('age')
|
|
4238
4238
|
})`);
|
|
4239
4239
|
}
|
|
4240
|
-
if (options$
|
|
4240
|
+
if (options$6.database === "mysql") {
|
|
4241
4241
|
imports_exports.addNamed(ast, "drizzle-orm/mysql-core", {
|
|
4242
4242
|
mysqlTable: "mysqlTable",
|
|
4243
4243
|
serial: "serial",
|
|
@@ -4249,7 +4249,7 @@ var drizzle_default = defineAddon({
|
|
|
4249
4249
|
age: int('age'),
|
|
4250
4250
|
})`);
|
|
4251
4251
|
}
|
|
4252
|
-
if (options$
|
|
4252
|
+
if (options$6.database === "postgresql") {
|
|
4253
4253
|
imports_exports.addNamed(ast, "drizzle-orm/pg-core", {
|
|
4254
4254
|
pgTable: "pgTable",
|
|
4255
4255
|
serial: "serial",
|
|
@@ -4272,37 +4272,37 @@ var drizzle_default = defineAddon({
|
|
|
4272
4272
|
const dbURLCheck = common_exports.statementFromString("if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');");
|
|
4273
4273
|
common_exports.addStatement(ast, dbURLCheck);
|
|
4274
4274
|
let clientExpression;
|
|
4275
|
-
if (options$
|
|
4275
|
+
if (options$6.sqlite === "better-sqlite3") {
|
|
4276
4276
|
imports_exports.addDefault(ast, "better-sqlite3", "Database");
|
|
4277
4277
|
imports_exports.addNamed(ast, "drizzle-orm/better-sqlite3", { drizzle: "drizzle" });
|
|
4278
4278
|
clientExpression = common_exports.expressionFromString("new Database(env.DATABASE_URL)");
|
|
4279
4279
|
}
|
|
4280
|
-
if (options$
|
|
4280
|
+
if (options$6.sqlite === "libsql" || options$6.sqlite === "turso") {
|
|
4281
4281
|
imports_exports.addNamed(ast, "@libsql/client", { createClient: "createClient" });
|
|
4282
4282
|
imports_exports.addNamed(ast, "drizzle-orm/libsql", { drizzle: "drizzle" });
|
|
4283
|
-
if (options$
|
|
4283
|
+
if (options$6.sqlite === "turso") {
|
|
4284
4284
|
imports_exports.addNamed(ast, "$app/environment", { dev: "dev" });
|
|
4285
4285
|
const authTokenCheck = common_exports.statementFromString("if (!dev && !env.DATABASE_AUTH_TOKEN) throw new Error('DATABASE_AUTH_TOKEN is not set');");
|
|
4286
4286
|
common_exports.addStatement(ast, authTokenCheck);
|
|
4287
4287
|
clientExpression = common_exports.expressionFromString("createClient({ url: env.DATABASE_URL, authToken: env.DATABASE_AUTH_TOKEN })");
|
|
4288
4288
|
} else clientExpression = common_exports.expressionFromString("createClient({ url: env.DATABASE_URL })");
|
|
4289
4289
|
}
|
|
4290
|
-
if (options$
|
|
4290
|
+
if (options$6.mysql === "mysql2") {
|
|
4291
4291
|
imports_exports.addDefault(ast, "mysql2/promise", "mysql");
|
|
4292
4292
|
imports_exports.addNamed(ast, "drizzle-orm/mysql2", { drizzle: "drizzle" });
|
|
4293
4293
|
clientExpression = common_exports.expressionFromString("await mysql.createConnection(env.DATABASE_URL)");
|
|
4294
4294
|
}
|
|
4295
|
-
if (options$
|
|
4295
|
+
if (options$6.mysql === "planetscale") {
|
|
4296
4296
|
imports_exports.addNamed(ast, "@planetscale/database", { Client: "Client" });
|
|
4297
4297
|
imports_exports.addNamed(ast, "drizzle-orm/planetscale-serverless", { drizzle: "drizzle" });
|
|
4298
4298
|
clientExpression = common_exports.expressionFromString("new Client({ url: env.DATABASE_URL })");
|
|
4299
4299
|
}
|
|
4300
|
-
if (options$
|
|
4300
|
+
if (options$6.postgresql === "neon") {
|
|
4301
4301
|
imports_exports.addNamed(ast, "@neondatabase/serverless", { neon: "neon" });
|
|
4302
4302
|
imports_exports.addNamed(ast, "drizzle-orm/neon-http", { drizzle: "drizzle" });
|
|
4303
4303
|
clientExpression = common_exports.expressionFromString("neon(env.DATABASE_URL)");
|
|
4304
4304
|
}
|
|
4305
|
-
if (options$
|
|
4305
|
+
if (options$6.postgresql === "postgres.js") {
|
|
4306
4306
|
imports_exports.addDefault(ast, "postgres", "postgres");
|
|
4307
4307
|
imports_exports.addNamed(ast, "drizzle-orm/postgres-js", { drizzle: "drizzle" });
|
|
4308
4308
|
clientExpression = common_exports.expressionFromString("postgres(env.DATABASE_URL)");
|
|
@@ -4316,9 +4316,10 @@ var drizzle_default = defineAddon({
|
|
|
4316
4316
|
return generateCode();
|
|
4317
4317
|
});
|
|
4318
4318
|
},
|
|
4319
|
-
nextSteps: ({ options: options$
|
|
4319
|
+
nextSteps: ({ options: options$6, highlighter, packageManager }) => {
|
|
4320
4320
|
const steps = [`You will need to set ${highlighter.env("DATABASE_URL")} in your production environment`];
|
|
4321
|
-
if (options$
|
|
4321
|
+
if (options$6.docker) steps.push(`Run ${highlighter.command(`${packageManager} run db:start`)} to start the docker container`);
|
|
4322
|
+
else steps.push(`Check ${highlighter.env("DATABASE_URL")} in ${highlighter.path(".env")} and adjust it to your needs`);
|
|
4322
4323
|
steps.push(`Run ${highlighter.command(`${packageManager} run db:push`)} to update your database schema`);
|
|
4323
4324
|
return steps;
|
|
4324
4325
|
}
|
|
@@ -4408,6 +4409,8 @@ var eslint_default = defineAddon({
|
|
|
4408
4409
|
sv.devDependency("eslint", "^9.18.0");
|
|
4409
4410
|
sv.devDependency("@eslint/compat", "^1.2.5");
|
|
4410
4411
|
sv.devDependency("globals", "^15.14.0");
|
|
4412
|
+
sv.devDependency("eslint-plugin-svelte", "^3.0.0");
|
|
4413
|
+
sv.devDependency("globals", "^16.0.0");
|
|
4411
4414
|
sv.devDependency("eslint-plugin-svelte", "^2.46.1");
|
|
4412
4415
|
sv.devDependency("@eslint/js", "^9.18.0");
|
|
4413
4416
|
if (typescript) sv.devDependency("typescript-eslint", "^8.20.0");
|
|
@@ -4431,6 +4434,7 @@ var eslint_default = defineAddon({
|
|
|
4431
4434
|
sv.file("eslint.config.js", (content) => {
|
|
4432
4435
|
const { ast, generateCode } = parseScript(content);
|
|
4433
4436
|
const eslintConfigs = [];
|
|
4437
|
+
imports_exports.addDefault(ast, "./svelte.config.js", "svelteConfig");
|
|
4434
4438
|
const gitIgnorePathStatement = common_exports.statementFromString("\nconst gitignorePath = fileURLToPath(new URL(\"./.gitignore\", import.meta.url));");
|
|
4435
4439
|
common_exports.addStatement(ast, gitIgnorePathStatement);
|
|
4436
4440
|
const ignoresConfig = common_exports.expressionFromString("includeIgnoreFile(gitignorePath)");
|
|
@@ -4441,7 +4445,7 @@ var eslint_default = defineAddon({
|
|
|
4441
4445
|
const tsConfig = common_exports.expressionFromString("ts.configs.recommended");
|
|
4442
4446
|
eslintConfigs.push(common_exports.createSpreadElement(tsConfig));
|
|
4443
4447
|
}
|
|
4444
|
-
const svelteConfig = common_exports.expressionFromString("svelte.configs
|
|
4448
|
+
const svelteConfig = common_exports.expressionFromString("svelte.configs.recommended");
|
|
4445
4449
|
eslintConfigs.push(common_exports.createSpreadElement(svelteConfig));
|
|
4446
4450
|
const globalsBrowser = common_exports.createSpreadElement(common_exports.expressionFromString("globals.browser"));
|
|
4447
4451
|
const globalsNode = common_exports.createSpreadElement(common_exports.expressionFromString("globals.node"));
|
|
@@ -4451,8 +4455,20 @@ var eslint_default = defineAddon({
|
|
|
4451
4455
|
eslintConfigs.push(globalsConfig);
|
|
4452
4456
|
if (typescript) {
|
|
4453
4457
|
const svelteTSParserConfig = object_exports.create({
|
|
4454
|
-
files: common_exports.expressionFromString("[\"**/*.svelte\"]"),
|
|
4455
|
-
|
|
4458
|
+
files: common_exports.expressionFromString("[\"**/*.svelte\", \"**/*.svelte.ts\", \"**/*.svelte.js\"]"),
|
|
4459
|
+
ignores: common_exports.expressionFromString("[\"eslint.config.js\", \"svelte.config.js\"]"),
|
|
4460
|
+
languageOptions: object_exports.create({ parserOptions: object_exports.create({
|
|
4461
|
+
projectService: common_exports.expressionFromString("true"),
|
|
4462
|
+
extraFileExtensions: common_exports.expressionFromString("['.svelte']"),
|
|
4463
|
+
parser: common_exports.expressionFromString("ts.parser"),
|
|
4464
|
+
svelteConfig: common_exports.expressionFromString("svelteConfig")
|
|
4465
|
+
}) })
|
|
4466
|
+
});
|
|
4467
|
+
eslintConfigs.push(svelteTSParserConfig);
|
|
4468
|
+
} else {
|
|
4469
|
+
const svelteTSParserConfig = object_exports.create({
|
|
4470
|
+
files: common_exports.expressionFromString("[\"**/*.svelte\", \"**/*.svelte.js\"]"),
|
|
4471
|
+
languageOptions: object_exports.create({ parserOptions: object_exports.create({ svelteConfig: common_exports.expressionFromString("svelteConfig") }) })
|
|
4456
4472
|
});
|
|
4457
4473
|
eslintConfigs.push(svelteTSParserConfig);
|
|
4458
4474
|
}
|
|
@@ -4487,6 +4503,11 @@ var eslint_default = defineAddon({
|
|
|
4487
4503
|
//#endregion
|
|
4488
4504
|
//#region packages/addons/sveltekit-adapter/index.ts
|
|
4489
4505
|
const adapters = [
|
|
4506
|
+
{
|
|
4507
|
+
id: "auto",
|
|
4508
|
+
package: "@sveltejs/adapter-auto",
|
|
4509
|
+
version: "^4.0.0"
|
|
4510
|
+
},
|
|
4490
4511
|
{
|
|
4491
4512
|
id: "node",
|
|
4492
4513
|
package: "@sveltejs/adapter-node",
|
|
@@ -4518,7 +4539,7 @@ const adapters = [
|
|
|
4518
4539
|
version: "^4.4.0"
|
|
4519
4540
|
}
|
|
4520
4541
|
];
|
|
4521
|
-
const options$
|
|
4542
|
+
const options$4 = defineAddonOptions({ adapter: {
|
|
4522
4543
|
type: "select",
|
|
4523
4544
|
question: "Which SvelteKit adapter would you like to use?",
|
|
4524
4545
|
options: adapters.map((p) => ({
|
|
@@ -4526,19 +4547,19 @@ const options$3 = defineAddonOptions({ adapter: {
|
|
|
4526
4547
|
label: p.id,
|
|
4527
4548
|
hint: p.package
|
|
4528
4549
|
})),
|
|
4529
|
-
default: "
|
|
4550
|
+
default: "auto"
|
|
4530
4551
|
} });
|
|
4531
4552
|
var sveltekit_adapter_default = defineAddon({
|
|
4532
4553
|
id: "sveltekit-adapter",
|
|
4533
4554
|
alias: "adapter",
|
|
4534
4555
|
shortDescription: "deployment",
|
|
4535
4556
|
homepage: "https://svelte.dev/docs/kit/adapters",
|
|
4536
|
-
options: options$
|
|
4557
|
+
options: options$4,
|
|
4537
4558
|
setup: ({ kit, unsupported }) => {
|
|
4538
4559
|
if (!kit) unsupported("Requires SvelteKit");
|
|
4539
4560
|
},
|
|
4540
|
-
run: ({ sv, options: options$
|
|
4541
|
-
const adapter = adapters.find((a) => a.id === options$
|
|
4561
|
+
run: ({ sv, options: options$6 }) => {
|
|
4562
|
+
const adapter = adapters.find((a) => a.id === options$6.adapter);
|
|
4542
4563
|
sv.file("package.json", (content) => {
|
|
4543
4564
|
const { data, generateCode } = parseJson(content);
|
|
4544
4565
|
const devDeps = data["devDependencies"];
|
|
@@ -4969,7 +4990,7 @@ const warned = {
|
|
|
4969
4990
|
storeName: false
|
|
4970
4991
|
};
|
|
4971
4992
|
var MagicString = class MagicString {
|
|
4972
|
-
constructor(string$1, options$
|
|
4993
|
+
constructor(string$1, options$6 = {}) {
|
|
4973
4994
|
const chunk = new Chunk(0, string$1.length, string$1);
|
|
4974
4995
|
Object.defineProperties(this, {
|
|
4975
4996
|
original: {
|
|
@@ -5006,11 +5027,11 @@ var MagicString = class MagicString {
|
|
|
5006
5027
|
},
|
|
5007
5028
|
filename: {
|
|
5008
5029
|
writable: true,
|
|
5009
|
-
value: options$
|
|
5030
|
+
value: options$6.filename
|
|
5010
5031
|
},
|
|
5011
5032
|
indentExclusionRanges: {
|
|
5012
5033
|
writable: true,
|
|
5013
|
-
value: options$
|
|
5034
|
+
value: options$6.indentExclusionRanges
|
|
5014
5035
|
},
|
|
5015
5036
|
sourcemapLocations: {
|
|
5016
5037
|
writable: true,
|
|
@@ -5026,11 +5047,11 @@ var MagicString = class MagicString {
|
|
|
5026
5047
|
},
|
|
5027
5048
|
ignoreList: {
|
|
5028
5049
|
writable: true,
|
|
5029
|
-
value: options$
|
|
5050
|
+
value: options$6.ignoreList
|
|
5030
5051
|
},
|
|
5031
5052
|
offset: {
|
|
5032
5053
|
writable: true,
|
|
5033
|
-
value: options$
|
|
5054
|
+
value: options$6.offset || 0
|
|
5034
5055
|
}
|
|
5035
5056
|
});
|
|
5036
5057
|
this.byStart[0] = chunk;
|
|
@@ -5088,11 +5109,11 @@ else this.outro += content;
|
|
|
5088
5109
|
cloned.outro = this.outro;
|
|
5089
5110
|
return cloned;
|
|
5090
5111
|
}
|
|
5091
|
-
generateDecodedMap(options$
|
|
5092
|
-
options$
|
|
5112
|
+
generateDecodedMap(options$6) {
|
|
5113
|
+
options$6 = options$6 || {};
|
|
5093
5114
|
const sourceIndex = 0;
|
|
5094
5115
|
const names = Object.keys(this.storedNames);
|
|
5095
|
-
const mappings = new Mappings(options$
|
|
5116
|
+
const mappings = new Mappings(options$6.hires);
|
|
5096
5117
|
const locate = getLocator(this.original);
|
|
5097
5118
|
if (this.intro) mappings.advance(this.intro);
|
|
5098
5119
|
this.firstChunk.eachNext((chunk) => {
|
|
@@ -5103,16 +5124,16 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
|
|
|
5103
5124
|
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
5104
5125
|
});
|
|
5105
5126
|
return {
|
|
5106
|
-
file: options$
|
|
5107
|
-
sources: [options$
|
|
5108
|
-
sourcesContent: options$
|
|
5127
|
+
file: options$6.file ? options$6.file.split(/[/\\]/).pop() : undefined,
|
|
5128
|
+
sources: [options$6.source ? getRelativePath(options$6.file || "", options$6.source) : options$6.file || ""],
|
|
5129
|
+
sourcesContent: options$6.includeContent ? [this.original] : undefined,
|
|
5109
5130
|
names,
|
|
5110
5131
|
mappings: mappings.raw,
|
|
5111
5132
|
x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined
|
|
5112
5133
|
};
|
|
5113
5134
|
}
|
|
5114
|
-
generateMap(options$
|
|
5115
|
-
return new SourceMap(this.generateDecodedMap(options$
|
|
5135
|
+
generateMap(options$6) {
|
|
5136
|
+
return new SourceMap(this.generateDecodedMap(options$6));
|
|
5116
5137
|
}
|
|
5117
5138
|
_ensureindentStr() {
|
|
5118
5139
|
if (this.indentStr === undefined) this.indentStr = guessIndent(this.original);
|
|
@@ -5125,10 +5146,10 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
|
|
|
5125
5146
|
this._ensureindentStr();
|
|
5126
5147
|
return this.indentStr === null ? " " : this.indentStr;
|
|
5127
5148
|
}
|
|
5128
|
-
indent(indentStr, options$
|
|
5149
|
+
indent(indentStr, options$6) {
|
|
5129
5150
|
const pattern = /^[^\r\n]/gm;
|
|
5130
5151
|
if (isObject(indentStr)) {
|
|
5131
|
-
options$
|
|
5152
|
+
options$6 = indentStr;
|
|
5132
5153
|
indentStr = undefined;
|
|
5133
5154
|
}
|
|
5134
5155
|
if (indentStr === undefined) {
|
|
@@ -5136,15 +5157,15 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
|
|
|
5136
5157
|
indentStr = this.indentStr || " ";
|
|
5137
5158
|
}
|
|
5138
5159
|
if (indentStr === "") return this;
|
|
5139
|
-
options$
|
|
5160
|
+
options$6 = options$6 || {};
|
|
5140
5161
|
const isExcluded = {};
|
|
5141
|
-
if (options$
|
|
5142
|
-
const exclusions = typeof options$
|
|
5162
|
+
if (options$6.exclude) {
|
|
5163
|
+
const exclusions = typeof options$6.exclude[0] === "number" ? [options$6.exclude] : options$6.exclude;
|
|
5143
5164
|
exclusions.forEach((exclusion) => {
|
|
5144
5165
|
for (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded[i] = true;
|
|
5145
5166
|
});
|
|
5146
5167
|
}
|
|
5147
|
-
let shouldIndentNextCharacter = options$
|
|
5168
|
+
let shouldIndentNextCharacter = options$6.indentStart !== false;
|
|
5148
5169
|
const replacer = (match) => {
|
|
5149
5170
|
if (shouldIndentNextCharacter) return `${indentStr}${match}`;
|
|
5150
5171
|
shouldIndentNextCharacter = true;
|
|
@@ -5232,14 +5253,14 @@ else {
|
|
|
5232
5253
|
if (!newRight) this.lastChunk = last;
|
|
5233
5254
|
return this;
|
|
5234
5255
|
}
|
|
5235
|
-
overwrite(start, end, content, options$
|
|
5236
|
-
options$
|
|
5256
|
+
overwrite(start, end, content, options$6) {
|
|
5257
|
+
options$6 = options$6 || {};
|
|
5237
5258
|
return this.update(start, end, content, {
|
|
5238
|
-
...options$
|
|
5239
|
-
overwrite: !options$
|
|
5259
|
+
...options$6,
|
|
5260
|
+
overwrite: !options$6.contentOnly
|
|
5240
5261
|
});
|
|
5241
5262
|
}
|
|
5242
|
-
update(start, end, content, options$
|
|
5263
|
+
update(start, end, content, options$6) {
|
|
5243
5264
|
start = start + this.offset;
|
|
5244
5265
|
end = end + this.offset;
|
|
5245
5266
|
if (typeof content !== "string") throw new TypeError("replacement content must be a string");
|
|
@@ -5251,15 +5272,15 @@ else {
|
|
|
5251
5272
|
if (start === end) throw new Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");
|
|
5252
5273
|
this._split(start);
|
|
5253
5274
|
this._split(end);
|
|
5254
|
-
if (options$
|
|
5275
|
+
if (options$6 === true) {
|
|
5255
5276
|
if (!warned.storeName) {
|
|
5256
5277
|
console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string");
|
|
5257
5278
|
warned.storeName = true;
|
|
5258
5279
|
}
|
|
5259
|
-
options$
|
|
5280
|
+
options$6 = { storeName: true };
|
|
5260
5281
|
}
|
|
5261
|
-
const storeName = options$
|
|
5262
|
-
const overwrite = options$
|
|
5282
|
+
const storeName = options$6 !== undefined ? options$6.storeName : false;
|
|
5283
|
+
const overwrite = options$6 !== undefined ? options$6.overwrite : false;
|
|
5263
5284
|
if (storeName) {
|
|
5264
5285
|
const original = this.original.slice(start, end);
|
|
5265
5286
|
Object.defineProperty(this.storedNames, original, {
|
|
@@ -5590,7 +5611,7 @@ const TABLE_TYPE = {
|
|
|
5590
5611
|
};
|
|
5591
5612
|
let drizzleDialect;
|
|
5592
5613
|
let schemaPath;
|
|
5593
|
-
const options$
|
|
5614
|
+
const options$3 = defineAddonOptions({ demo: {
|
|
5594
5615
|
type: "boolean",
|
|
5595
5616
|
default: true,
|
|
5596
5617
|
question: `Do you want to include a demo? ${colors.dim("(includes a login/register page)")}`
|
|
@@ -5599,16 +5620,16 @@ var lucia_default = defineAddon({
|
|
|
5599
5620
|
id: "lucia",
|
|
5600
5621
|
shortDescription: "auth guide",
|
|
5601
5622
|
homepage: "https://lucia-auth.com",
|
|
5602
|
-
options: options$
|
|
5623
|
+
options: options$3,
|
|
5603
5624
|
setup: ({ kit, dependencyVersion, unsupported, dependsOn }) => {
|
|
5604
5625
|
if (!kit) unsupported("Requires SvelteKit");
|
|
5605
5626
|
if (!dependencyVersion("drizzle-orm")) dependsOn("drizzle");
|
|
5606
5627
|
},
|
|
5607
|
-
run: ({ sv, typescript, options: options$
|
|
5628
|
+
run: ({ sv, typescript, options: options$6, kit, dependencyVersion }) => {
|
|
5608
5629
|
const ext = typescript ? "ts" : "js";
|
|
5609
5630
|
sv.dependency("@oslojs/crypto", "^1.0.1");
|
|
5610
5631
|
sv.dependency("@oslojs/encoding", "^1.1.0");
|
|
5611
|
-
if (options$
|
|
5632
|
+
if (options$6.demo) sv.dependency("@node-rs/argon2", "^2.0.2");
|
|
5612
5633
|
sv.file(`drizzle.config.${ext}`, (content) => {
|
|
5613
5634
|
const { ast, generateCode } = parseScript(content);
|
|
5614
5635
|
const isProp = (name$1, node) => node.key.type === "Identifier" && node.key.name === name$1;
|
|
@@ -5642,7 +5663,7 @@ var lucia_default = defineAddon({
|
|
|
5642
5663
|
integer: "integer"
|
|
5643
5664
|
});
|
|
5644
5665
|
object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("text('id').primaryKey()") });
|
|
5645
|
-
if (options$
|
|
5666
|
+
if (options$6.demo) object_exports.overrideProperties(userAttributes, {
|
|
5646
5667
|
username: common_exports.expressionFromString("text('username').notNull().unique()"),
|
|
5647
5668
|
passwordHash: common_exports.expressionFromString("text('password_hash').notNull()")
|
|
5648
5669
|
});
|
|
@@ -5659,7 +5680,7 @@ var lucia_default = defineAddon({
|
|
|
5659
5680
|
datetime: "datetime"
|
|
5660
5681
|
});
|
|
5661
5682
|
object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("varchar('id', { length: 255 }).primaryKey()") });
|
|
5662
|
-
if (options$
|
|
5683
|
+
if (options$6.demo) object_exports.overrideProperties(userAttributes, {
|
|
5663
5684
|
username: common_exports.expressionFromString("varchar('username', { length: 32 }).notNull().unique()"),
|
|
5664
5685
|
passwordHash: common_exports.expressionFromString("varchar('password_hash', { length: 255 }).notNull()")
|
|
5665
5686
|
});
|
|
@@ -5676,7 +5697,7 @@ var lucia_default = defineAddon({
|
|
|
5676
5697
|
timestamp: "timestamp"
|
|
5677
5698
|
});
|
|
5678
5699
|
object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("text('id').primaryKey()") });
|
|
5679
|
-
if (options$
|
|
5700
|
+
if (options$6.demo) object_exports.overrideProperties(userAttributes, {
|
|
5680
5701
|
username: common_exports.expressionFromString("text('username').notNull().unique()"),
|
|
5681
5702
|
passwordHash: common_exports.expressionFromString("text('password_hash').notNull()")
|
|
5682
5703
|
});
|
|
@@ -5829,7 +5850,7 @@ var lucia_default = defineAddon({
|
|
|
5829
5850
|
kit_exports.addHooksHandle(ast, typescript, "handleAuth", getAuthHandleContent());
|
|
5830
5851
|
return generateCode();
|
|
5831
5852
|
});
|
|
5832
|
-
if (options$
|
|
5853
|
+
if (options$6.demo) {
|
|
5833
5854
|
sv.file(`${kit?.routesDirectory}/demo/+page.svelte`, (content) => {
|
|
5834
5855
|
return addToDemoPage(content, "lucia");
|
|
5835
5856
|
});
|
|
@@ -6040,9 +6061,9 @@ var lucia_default = defineAddon({
|
|
|
6040
6061
|
});
|
|
6041
6062
|
}
|
|
6042
6063
|
},
|
|
6043
|
-
nextSteps: ({ highlighter, options: options$
|
|
6064
|
+
nextSteps: ({ highlighter, options: options$6, packageManager }) => {
|
|
6044
6065
|
const steps = [`Run ${highlighter.command(`${packageManager} run db:push`)} to update your database schema`];
|
|
6045
|
-
if (options$
|
|
6066
|
+
if (options$6.demo) steps.push(`Visit ${highlighter.route("/demo/lucia")} route to view the demo`);
|
|
6046
6067
|
return steps;
|
|
6047
6068
|
}
|
|
6048
6069
|
});
|
|
@@ -6181,7 +6202,7 @@ const DEFAULT_INLANG_PROJECT = {
|
|
|
6181
6202
|
],
|
|
6182
6203
|
"plugin.inlang.messageFormat": { pathPattern: "./messages/{languageTag}.json" }
|
|
6183
6204
|
};
|
|
6184
|
-
const options$
|
|
6205
|
+
const options$2 = defineAddonOptions({
|
|
6185
6206
|
availableLanguageTags: {
|
|
6186
6207
|
question: `Which languages would you like to support? ${colors.gray("(e.g. en,de-ch)")}`,
|
|
6187
6208
|
type: "string",
|
|
@@ -6210,11 +6231,11 @@ var paraglide_default = defineAddon({
|
|
|
6210
6231
|
id: "paraglide",
|
|
6211
6232
|
shortDescription: "i18n",
|
|
6212
6233
|
homepage: "https://inlang.com",
|
|
6213
|
-
options: options$
|
|
6234
|
+
options: options$2,
|
|
6214
6235
|
setup: ({ kit, unsupported }) => {
|
|
6215
6236
|
if (!kit) unsupported("Requires SvelteKit");
|
|
6216
6237
|
},
|
|
6217
|
-
run: ({ sv, options: options$
|
|
6238
|
+
run: ({ sv, options: options$6, typescript, kit, dependencyVersion }) => {
|
|
6218
6239
|
const ext = typescript ? "ts" : "js";
|
|
6219
6240
|
if (!kit) throw new Error("SvelteKit is required");
|
|
6220
6241
|
const paraglideOutDir = "src/lib/paraglide";
|
|
@@ -6223,7 +6244,7 @@ var paraglide_default = defineAddon({
|
|
|
6223
6244
|
if (content) return content;
|
|
6224
6245
|
const { data, generateCode } = parseJson(content);
|
|
6225
6246
|
for (const key in DEFAULT_INLANG_PROJECT) data[key] = DEFAULT_INLANG_PROJECT[key];
|
|
6226
|
-
const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$
|
|
6247
|
+
const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$6.availableLanguageTags);
|
|
6227
6248
|
const sourceLanguageTag = validLanguageTags$1[0];
|
|
6228
6249
|
data.sourceLanguageTag = sourceLanguageTag;
|
|
6229
6250
|
data.languageTags = validLanguageTags$1;
|
|
@@ -6311,7 +6332,7 @@ var paraglide_default = defineAddon({
|
|
|
6311
6332
|
if (!content.includes(`\n${paraglideOutDir}`)) content = content.trimEnd() + `\n\n# Paraglide\n${paraglideOutDir}`;
|
|
6312
6333
|
return content;
|
|
6313
6334
|
});
|
|
6314
|
-
if (options$
|
|
6335
|
+
if (options$6.demo) {
|
|
6315
6336
|
sv.file(`${kit.routesDirectory}/demo/+page.svelte`, (content) => {
|
|
6316
6337
|
return addToDemoPage(content, "paraglide");
|
|
6317
6338
|
});
|
|
@@ -6340,7 +6361,7 @@ var paraglide_default = defineAddon({
|
|
|
6340
6361
|
}
|
|
6341
6362
|
const templateCode = new MagicString(template.source);
|
|
6342
6363
|
templateCode.append("\n\n<h1>{m.hello_world({ name: 'SvelteKit User' })}</h1>\n");
|
|
6343
|
-
const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$
|
|
6364
|
+
const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$6.availableLanguageTags);
|
|
6344
6365
|
const links = validLanguageTags$1.map((x) => `${templateCode.getIndentString()}<button onclick={() => switchToLanguage('${x}')}>${x}</button>`).join("\n");
|
|
6345
6366
|
templateCode.append(`<div>\n${links}\n</div>`);
|
|
6346
6367
|
return generateCode({
|
|
@@ -6349,7 +6370,7 @@ var paraglide_default = defineAddon({
|
|
|
6349
6370
|
});
|
|
6350
6371
|
});
|
|
6351
6372
|
}
|
|
6352
|
-
const { validLanguageTags } = parseLanguageTagInput(options$
|
|
6373
|
+
const { validLanguageTags } = parseLanguageTagInput(options$6.availableLanguageTags);
|
|
6353
6374
|
for (const languageTag of validLanguageTags) sv.file(`messages/${languageTag}.json`, (content) => {
|
|
6354
6375
|
const { data, generateCode } = parseJson(content);
|
|
6355
6376
|
data["$schema"] = "https://inlang.com/schema/inlang-message-format";
|
|
@@ -6359,7 +6380,7 @@ var paraglide_default = defineAddon({
|
|
|
6359
6380
|
},
|
|
6360
6381
|
nextSteps: ({ highlighter }) => {
|
|
6361
6382
|
const steps = [`Edit your messages in ${highlighter.path("messages/en.json")}`, "Consider installing the Sherlock IDE Extension"];
|
|
6362
|
-
if (options$
|
|
6383
|
+
if (options$2.demo) steps.push(`Visit ${highlighter.route("/demo/paraglide")} route to view the demo`);
|
|
6363
6384
|
return steps;
|
|
6364
6385
|
}
|
|
6365
6386
|
});
|
|
@@ -6463,8 +6484,8 @@ var prettier_default = defineAddon({
|
|
|
6463
6484
|
}
|
|
6464
6485
|
data.plugins ??= [];
|
|
6465
6486
|
data.overrides ??= [];
|
|
6466
|
-
const plugins = data.plugins;
|
|
6467
|
-
if (!plugins.includes("prettier-plugin-svelte")) data.plugins.unshift("prettier-plugin-svelte");
|
|
6487
|
+
const plugins$1 = data.plugins;
|
|
6488
|
+
if (!plugins$1.includes("prettier-plugin-svelte")) data.plugins.unshift("prettier-plugin-svelte");
|
|
6468
6489
|
const overrides = data.overrides;
|
|
6469
6490
|
const override = overrides.find((o) => o?.options?.parser === "svelte");
|
|
6470
6491
|
if (!override) overrides.push({
|
|
@@ -6533,21 +6554,58 @@ else ast.prepend(rule);
|
|
|
6533
6554
|
});
|
|
6534
6555
|
return nodes;
|
|
6535
6556
|
}
|
|
6557
|
+
function addAtRule(ast, name$1, params, append = false) {
|
|
6558
|
+
const atRules = ast.nodes.filter((x) => x.type == "atrule");
|
|
6559
|
+
let atRule = atRules.find((x) => x.name == name$1 && x.params == params);
|
|
6560
|
+
if (atRule) return atRule;
|
|
6561
|
+
atRule = new AtRule({
|
|
6562
|
+
name: name$1,
|
|
6563
|
+
params
|
|
6564
|
+
});
|
|
6565
|
+
if (!append) ast.prepend(atRule);
|
|
6566
|
+
else ast.append(atRule);
|
|
6567
|
+
return atRule;
|
|
6568
|
+
}
|
|
6536
6569
|
|
|
6537
6570
|
//#endregion
|
|
6538
6571
|
//#region packages/addons/tailwindcss/index.ts
|
|
6572
|
+
const plugins = [{
|
|
6573
|
+
id: "typography",
|
|
6574
|
+
package: "@tailwindcss/typography",
|
|
6575
|
+
version: "^0.5.15",
|
|
6576
|
+
identifier: "typography"
|
|
6577
|
+
}, {
|
|
6578
|
+
id: "forms",
|
|
6579
|
+
package: "@tailwindcss/forms",
|
|
6580
|
+
version: "^0.5.9",
|
|
6581
|
+
identifier: "forms"
|
|
6582
|
+
}];
|
|
6583
|
+
const options$1 = defineAddonOptions({ plugins: {
|
|
6584
|
+
type: "multiselect",
|
|
6585
|
+
question: "Which plugins would you like to add?",
|
|
6586
|
+
options: plugins.map((p) => ({
|
|
6587
|
+
value: p.id,
|
|
6588
|
+
label: p.id,
|
|
6589
|
+
hint: p.package
|
|
6590
|
+
})),
|
|
6591
|
+
default: []
|
|
6592
|
+
} });
|
|
6539
6593
|
var tailwindcss_default = defineAddon({
|
|
6540
6594
|
id: "tailwindcss",
|
|
6541
6595
|
alias: "tailwind",
|
|
6542
6596
|
shortDescription: "css framework",
|
|
6543
6597
|
homepage: "https://tailwindcss.com",
|
|
6544
|
-
options:
|
|
6545
|
-
run: ({ sv, typescript, kit, dependencyVersion }) => {
|
|
6598
|
+
options: options$1,
|
|
6599
|
+
run: ({ sv, options: options$6, typescript, kit, dependencyVersion }) => {
|
|
6546
6600
|
const ext = typescript ? "ts" : "js";
|
|
6547
6601
|
const prettierInstalled = Boolean(dependencyVersion("prettier"));
|
|
6548
6602
|
sv.devDependency("tailwindcss", "^4.0.0");
|
|
6549
6603
|
sv.devDependency("@tailwindcss/vite", "^4.0.0");
|
|
6550
6604
|
if (prettierInstalled) sv.devDependency("prettier-plugin-tailwindcss", "^0.6.11");
|
|
6605
|
+
for (const plugin of plugins) {
|
|
6606
|
+
if (!options$6.plugins.includes(plugin.id)) continue;
|
|
6607
|
+
sv.devDependency(plugin.package, plugin.version);
|
|
6608
|
+
}
|
|
6551
6609
|
sv.file(`vite.config.${ext}`, (content) => {
|
|
6552
6610
|
const { ast, generateCode } = parseScript(content);
|
|
6553
6611
|
const vitePluginName = "tailwindcss";
|
|
@@ -6564,6 +6622,10 @@ var tailwindcss_default = defineAddon({
|
|
|
6564
6622
|
const { ast, generateCode } = parseCss(content);
|
|
6565
6623
|
const originalFirst = ast.first;
|
|
6566
6624
|
const nodes = addImports(ast, ["'tailwindcss'"]);
|
|
6625
|
+
for (const plugin of plugins) {
|
|
6626
|
+
if (!options$6.plugins.includes(plugin.id)) continue;
|
|
6627
|
+
addAtRule(ast, "plugin", `'${plugin.package}'`, true);
|
|
6628
|
+
}
|
|
6567
6629
|
if (originalFirst !== ast.first && originalFirst?.type === "atrule" && originalFirst.name === "import") originalFirst.raws.before = "\n";
|
|
6568
6630
|
nodes.shift();
|
|
6569
6631
|
nodes.forEach((n$1) => n$1.raws.before = "\n");
|
|
@@ -6591,8 +6653,8 @@ else sv.file(`${kit?.routesDirectory}/+layout.svelte`, (content) => {
|
|
|
6591
6653
|
const { data, generateCode } = parseJson(content);
|
|
6592
6654
|
const PLUGIN_NAME = "prettier-plugin-tailwindcss";
|
|
6593
6655
|
data.plugins ??= [];
|
|
6594
|
-
const plugins = data.plugins;
|
|
6595
|
-
if (!plugins.includes(PLUGIN_NAME)) plugins.push(PLUGIN_NAME);
|
|
6656
|
+
const plugins$1 = data.plugins;
|
|
6657
|
+
if (!plugins$1.includes(PLUGIN_NAME)) plugins$1.push(PLUGIN_NAME);
|
|
6596
6658
|
return generateCode();
|
|
6597
6659
|
});
|
|
6598
6660
|
}
|
|
@@ -6610,7 +6672,7 @@ var vitest_addon_default = defineAddon({
|
|
|
6610
6672
|
sv.devDependency("vitest", "^3.0.0");
|
|
6611
6673
|
sv.devDependency("@testing-library/svelte", "^5.2.4");
|
|
6612
6674
|
sv.devDependency("@testing-library/jest-dom", "^6.6.3");
|
|
6613
|
-
sv.devDependency("jsdom", "^
|
|
6675
|
+
sv.devDependency("jsdom", "^26.0.0");
|
|
6614
6676
|
sv.file("package.json", (content) => {
|
|
6615
6677
|
const { data, generateCode } = parseJson(content);
|
|
6616
6678
|
data.scripts ??= {};
|
|
@@ -9542,14 +9604,14 @@ function verifyPackage(pkg, specifier) {
|
|
|
9542
9604
|
throw new Error(`Invalid add-on package detected: '${specifier}'\nCommunity addons should not have any external 'dependencies' besides '@sveltejs/cli-core'. Consider bundling your dependencies if they are necessary`);
|
|
9543
9605
|
}
|
|
9544
9606
|
}
|
|
9545
|
-
async function downloadPackage(options$
|
|
9546
|
-
const { pkg } = options$
|
|
9547
|
-
if (options$
|
|
9607
|
+
async function downloadPackage(options$6) {
|
|
9608
|
+
const { pkg } = options$6;
|
|
9609
|
+
if (options$6.path) {
|
|
9548
9610
|
const dest = path.join(NODE_MODULES, pkg.name.split("/").join(path.sep));
|
|
9549
9611
|
if (fs.existsSync(dest)) fs.rmSync(dest);
|
|
9550
9612
|
const dir = path.dirname(dest);
|
|
9551
9613
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
9552
|
-
fs.symlinkSync(options$
|
|
9614
|
+
fs.symlinkSync(options$6.path, dest);
|
|
9553
9615
|
const { default: details$1 } = await import(pkg.name);
|
|
9554
9616
|
return details$1;
|
|
9555
9617
|
}
|
|
@@ -9672,7 +9734,7 @@ const add = new Command("add").description("applies specified add-ons into a pro
|
|
|
9672
9734
|
process$1.exit(1);
|
|
9673
9735
|
}
|
|
9674
9736
|
const specifiedAddons = parse(AddonsSchema, addonArgs);
|
|
9675
|
-
const options$
|
|
9737
|
+
const options$6 = parse(OptionsSchema$1, opts);
|
|
9676
9738
|
const addonIds = officialAddons.map((addon) => addon.id);
|
|
9677
9739
|
const invalidAddons = specifiedAddons.filter((a) => !addonIds.includes(a) && !aliases.includes(a));
|
|
9678
9740
|
if (invalidAddons.length > 0) {
|
|
@@ -9681,12 +9743,12 @@ const add = new Command("add").description("applies specified add-ons into a pro
|
|
|
9681
9743
|
}
|
|
9682
9744
|
const selectedAddons = transformAliases(specifiedAddons);
|
|
9683
9745
|
runCommand(async () => {
|
|
9684
|
-
const { nextSteps } = await runAddCommand(options$
|
|
9746
|
+
const { nextSteps } = await runAddCommand(options$6, selectedAddons);
|
|
9685
9747
|
if (nextSteps) box(nextSteps, "Next steps");
|
|
9686
9748
|
});
|
|
9687
9749
|
});
|
|
9688
9750
|
for (const option of addonsOptions) add.addOption(option);
|
|
9689
|
-
async function runAddCommand(options$
|
|
9751
|
+
async function runAddCommand(options$6, selectedAddonIds) {
|
|
9690
9752
|
const selectedAddons = selectedAddonIds.map((id) => ({
|
|
9691
9753
|
type: "official",
|
|
9692
9754
|
addon: getAddonDetails(id)
|
|
@@ -9696,7 +9758,7 @@ async function runAddCommand(options$5, selectedAddonIds) {
|
|
|
9696
9758
|
for (const addonOption of addonsOptions) {
|
|
9697
9759
|
const addonId = addonOption.name();
|
|
9698
9760
|
const aliased = addonOption.attributeName();
|
|
9699
|
-
const specifiedOptions = options$
|
|
9761
|
+
const specifiedOptions = options$6[addonId] || options$6[aliased];
|
|
9700
9762
|
if (!specifiedOptions) continue;
|
|
9701
9763
|
const details$1 = getAddonDetails(addonId);
|
|
9702
9764
|
if (!selectedAddons.find((d) => d.addon === details$1)) selectedAddons.push({
|
|
@@ -9726,7 +9788,7 @@ async function runAddCommand(options$5, selectedAddonIds) {
|
|
|
9726
9788
|
for (const [id, question] of Object.entries(details$1.options)) if (question.condition?.(official[addonId]) !== false) official[addonId][id] ??= question.default;
|
|
9727
9789
|
else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--${addonId}' option specified: '${official[addonId][id]}'`);
|
|
9728
9790
|
}
|
|
9729
|
-
if (options$
|
|
9791
|
+
if (options$6.community === true) {
|
|
9730
9792
|
const communityAddons = await Promise.all(communityAddonIds.map(async (id) => await getCommunityAddon(id)));
|
|
9731
9793
|
const promptOptions = communityAddons.map((addon) => ({
|
|
9732
9794
|
value: addon.id,
|
|
@@ -9745,10 +9807,10 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
|
|
|
9745
9807
|
cancel("No add-ons selected. Exiting.");
|
|
9746
9808
|
process$1.exit(1);
|
|
9747
9809
|
}
|
|
9748
|
-
options$
|
|
9810
|
+
options$6.community = selected;
|
|
9749
9811
|
}
|
|
9750
|
-
if (Array.isArray(options$
|
|
9751
|
-
const addons = options$
|
|
9812
|
+
if (Array.isArray(options$6.community) && options$6.community.length > 0) {
|
|
9813
|
+
const addons = options$6.community.map((id) => {
|
|
9752
9814
|
const hasDirective = Object.values(Directive).some((directive) => id.startsWith(directive));
|
|
9753
9815
|
if (hasDirective) return id;
|
|
9754
9816
|
const validAddon = communityAddonIds.includes(id);
|
|
@@ -9760,7 +9822,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
|
|
|
9760
9822
|
start("Resolving community add-on packages");
|
|
9761
9823
|
const pkgs = await Promise.all(addons.map(async (id) => {
|
|
9762
9824
|
return await getPackageJSON({
|
|
9763
|
-
cwd: options$
|
|
9825
|
+
cwd: options$6.cwd,
|
|
9764
9826
|
packageName: id
|
|
9765
9827
|
});
|
|
9766
9828
|
}));
|
|
@@ -9797,7 +9859,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
|
|
|
9797
9859
|
throw err;
|
|
9798
9860
|
}
|
|
9799
9861
|
}
|
|
9800
|
-
let workspace = createWorkspace({ cwd: options$
|
|
9862
|
+
let workspace = createWorkspace({ cwd: options$6.cwd });
|
|
9801
9863
|
const addonSetupResults = setupAddons(officialAddons, workspace);
|
|
9802
9864
|
if (selectedAddons.length === 0) {
|
|
9803
9865
|
const addonOptions = officialAddons.filter(({ id }) => addonSetupResults[id].unsupported.length === 0).map(({ id, homepage: homepage$1, shortDescription }) => ({
|
|
@@ -9840,9 +9902,9 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
|
|
|
9840
9902
|
});
|
|
9841
9903
|
}
|
|
9842
9904
|
}
|
|
9843
|
-
if (options$
|
|
9905
|
+
if (options$6.preconditions && selectedAddons.length > 0) {
|
|
9844
9906
|
const addons = selectedAddons.map(({ addon }) => addon);
|
|
9845
|
-
const { preconditions } = getGlobalPreconditions(options$
|
|
9907
|
+
const { preconditions } = getGlobalPreconditions(options$6.cwd, addons, addonSetupResults);
|
|
9846
9908
|
const fails = [];
|
|
9847
9909
|
for (const condition of preconditions) {
|
|
9848
9910
|
const { message, success } = await condition.run();
|
|
@@ -9925,12 +9987,12 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
|
|
|
9925
9987
|
});
|
|
9926
9988
|
log.success("Successfully setup add-ons");
|
|
9927
9989
|
let packageManager;
|
|
9928
|
-
if (options$
|
|
9929
|
-
packageManager = await packageManagerPrompt(options$
|
|
9990
|
+
if (options$6.install) {
|
|
9991
|
+
packageManager = await packageManagerPrompt(options$6.cwd);
|
|
9930
9992
|
if (packageManager) {
|
|
9931
9993
|
workspace.packageManager = packageManager;
|
|
9932
9994
|
addPnpmBuildDependendencies(workspace.cwd, packageManager, ["esbuild", ...addonPnpmBuildDependencies]);
|
|
9933
|
-
await installDependencies(packageManager, options$
|
|
9995
|
+
await installDependencies(packageManager, options$6.cwd);
|
|
9934
9996
|
}
|
|
9935
9997
|
}
|
|
9936
9998
|
workspace = createWorkspace(workspace);
|
|
@@ -9940,7 +10002,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
|
|
|
9940
10002
|
try {
|
|
9941
10003
|
await formatFiles({
|
|
9942
10004
|
packageManager,
|
|
9943
|
-
cwd: options$
|
|
10005
|
+
cwd: options$6.cwd,
|
|
9944
10006
|
paths: filesToFormat
|
|
9945
10007
|
});
|
|
9946
10008
|
stop("Successfully formatted modified files");
|
|
@@ -9978,7 +10040,7 @@ function transformAliases(ids) {
|
|
|
9978
10040
|
return Array.from(set);
|
|
9979
10041
|
}
|
|
9980
10042
|
function getAddonOptionFlags() {
|
|
9981
|
-
const options$
|
|
10043
|
+
const options$6 = [];
|
|
9982
10044
|
for (const addon of officialAddons) {
|
|
9983
10045
|
const id = addon.id;
|
|
9984
10046
|
const details = getAddonDetails(id);
|
|
@@ -9991,36 +10053,36 @@ function getAddonOptionFlags() {
|
|
|
9991
10053
|
prev = prev.concat(value.split(/\s|,/));
|
|
9992
10054
|
return prev;
|
|
9993
10055
|
});
|
|
9994
|
-
options$
|
|
10056
|
+
options$6.push(option);
|
|
9995
10057
|
}
|
|
9996
|
-
return options$
|
|
10058
|
+
return options$6;
|
|
9997
10059
|
}
|
|
9998
10060
|
function getOptionChoices(details) {
|
|
9999
10061
|
const choices = [];
|
|
10000
10062
|
const defaults = [];
|
|
10001
10063
|
const groups = {};
|
|
10002
|
-
const options$
|
|
10064
|
+
const options$6 = {};
|
|
10003
10065
|
for (const [id, question] of Object.entries(details.options)) {
|
|
10004
10066
|
let values = [];
|
|
10005
|
-
const applyDefault = question.condition?.(options$
|
|
10067
|
+
const applyDefault = question.condition?.(options$6) !== false;
|
|
10006
10068
|
if (question.type === "boolean") {
|
|
10007
10069
|
values = [id, `no-${id}`];
|
|
10008
10070
|
if (applyDefault) {
|
|
10009
|
-
options$
|
|
10071
|
+
options$6[id] = question.default;
|
|
10010
10072
|
defaults.push(question.default ? values[0] : values[1]);
|
|
10011
10073
|
}
|
|
10012
10074
|
}
|
|
10013
10075
|
if (question.type === "select") {
|
|
10014
10076
|
values = question.options.map((o) => o.value);
|
|
10015
10077
|
if (applyDefault) {
|
|
10016
|
-
options$
|
|
10078
|
+
options$6[id] = question.default;
|
|
10017
10079
|
defaults.push(question.default);
|
|
10018
10080
|
}
|
|
10019
10081
|
}
|
|
10020
10082
|
if (question.type === "multiselect") {
|
|
10021
10083
|
values = question.options.map((o) => o.value);
|
|
10022
10084
|
if (applyDefault) {
|
|
10023
|
-
options$
|
|
10085
|
+
options$6[id] = question.default;
|
|
10024
10086
|
defaults.push(...question.default);
|
|
10025
10087
|
}
|
|
10026
10088
|
}
|
|
@@ -10057,9 +10119,9 @@ const OptionsSchema = strictObject({
|
|
|
10057
10119
|
});
|
|
10058
10120
|
const create$1 = new Command("create").description("scaffolds a new SvelteKit project").argument("[path]", "where the project will be created").addOption(templateOption).addOption(langOption).option("--no-types").option("--no-add-ons", "skips interactive add-on installer").option("--no-install", "skip installing dependencies").configureHelp(helpConfig).action((projectPath, opts) => {
|
|
10059
10121
|
const cwd = parse(ProjectPathSchema, projectPath);
|
|
10060
|
-
const options$
|
|
10122
|
+
const options$6 = parse(OptionsSchema, opts);
|
|
10061
10123
|
runCommand(async () => {
|
|
10062
|
-
const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$
|
|
10124
|
+
const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$6);
|
|
10063
10125
|
const highlight = (str) => import_picocolors$1.default.bold(import_picocolors$1.default.cyan(str));
|
|
10064
10126
|
let i = 1;
|
|
10065
10127
|
const initialSteps = [];
|
|
@@ -10088,7 +10150,7 @@ const create$1 = new Command("create").description("scaffolds a new SvelteKit pr
|
|
|
10088
10150
|
if (addOnNextSteps) box(addOnNextSteps, "Add-on next steps");
|
|
10089
10151
|
});
|
|
10090
10152
|
});
|
|
10091
|
-
async function createProject(cwd, options$
|
|
10153
|
+
async function createProject(cwd, options$6) {
|
|
10092
10154
|
const { directory, template, language } = await group({
|
|
10093
10155
|
directory: () => {
|
|
10094
10156
|
if (cwd) return Promise.resolve(path.resolve(cwd));
|
|
@@ -10112,7 +10174,7 @@ async function createProject(cwd, options$5) {
|
|
|
10112
10174
|
}
|
|
10113
10175
|
},
|
|
10114
10176
|
template: () => {
|
|
10115
|
-
if (options$
|
|
10177
|
+
if (options$6.template) return Promise.resolve(options$6.template);
|
|
10116
10178
|
return select({
|
|
10117
10179
|
message: "Which template would you like?",
|
|
10118
10180
|
initialValue: "minimal",
|
|
@@ -10124,7 +10186,7 @@ async function createProject(cwd, options$5) {
|
|
|
10124
10186
|
});
|
|
10125
10187
|
},
|
|
10126
10188
|
language: () => {
|
|
10127
|
-
if (options$
|
|
10189
|
+
if (options$6.types) return Promise.resolve(options$6.types);
|
|
10128
10190
|
return select({
|
|
10129
10191
|
message: "Add type checking with Typescript?",
|
|
10130
10192
|
initialValue: "typescript",
|
|
@@ -10162,17 +10224,17 @@ async function createProject(cwd, options$5) {
|
|
|
10162
10224
|
addPnpmBuildDependendencies(projectPath, packageManager, ["esbuild"]);
|
|
10163
10225
|
if (packageManager) await installDependencies(packageManager, projectPath);
|
|
10164
10226
|
};
|
|
10165
|
-
if (options$
|
|
10227
|
+
if (options$6.addOns) {
|
|
10166
10228
|
const { nextSteps, packageManager: pm } = await runAddCommand({
|
|
10167
10229
|
cwd: projectPath,
|
|
10168
|
-
install: options$
|
|
10230
|
+
install: options$6.install,
|
|
10169
10231
|
preconditions: false,
|
|
10170
10232
|
community: []
|
|
10171
10233
|
}, []);
|
|
10172
10234
|
packageManager = pm;
|
|
10173
10235
|
addOnNextSteps = nextSteps;
|
|
10174
|
-
} else if (options$
|
|
10175
|
-
if (packageManager === null && options$
|
|
10236
|
+
} else if (options$6.install) await installDeps();
|
|
10237
|
+
if (packageManager === null && options$6.install) await installDeps();
|
|
10176
10238
|
return {
|
|
10177
10239
|
directory: projectPath,
|
|
10178
10240
|
addOnNextSteps,
|
|
@@ -10185,8 +10247,8 @@ async function createProject(cwd, options$5) {
|
|
|
10185
10247
|
const migrate = new Command("migrate").description("a CLI for migrating Svelte(Kit) codebases").argument("<migration>", "migration to run").option("-C, --cwd <path>", "path to working directory", process$1.cwd()).configureHelp({ formatHelp() {
|
|
10186
10248
|
runMigrate(process$1.cwd(), ["--help"]);
|
|
10187
10249
|
return "";
|
|
10188
|
-
} }).action((migration, options$
|
|
10189
|
-
runMigrate(options$
|
|
10250
|
+
} }).action((migration, options$6) => {
|
|
10251
|
+
runMigrate(options$6.cwd, [migration]);
|
|
10190
10252
|
});
|
|
10191
10253
|
function runMigrate(cwd, args) {
|
|
10192
10254
|
const pm = getUserAgent() ?? "npm";
|
|
@@ -10209,8 +10271,8 @@ var import_picocolors = __toESM(require_picocolors(), 1);
|
|
|
10209
10271
|
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", process$1.cwd()).configureHelp({ formatHelp() {
|
|
10210
10272
|
runCheck(process$1.cwd(), ["--help"]);
|
|
10211
10273
|
return "";
|
|
10212
|
-
} }).action((options$
|
|
10213
|
-
const cwd = options$
|
|
10274
|
+
} }).action((options$6, check$1) => {
|
|
10275
|
+
const cwd = options$6.cwd;
|
|
10214
10276
|
const args = check$1.args;
|
|
10215
10277
|
runCheck(cwd, args);
|
|
10216
10278
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sv",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A CLI for creating and updating SvelteKit projects",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"tinyexec": "^0.3.1",
|
|
39
39
|
"valibot": "^0.41.0",
|
|
40
40
|
"@sveltejs/addons": "0.0.0",
|
|
41
|
+
"@sveltejs/cli-core": "0.0.0",
|
|
41
42
|
"@sveltejs/clack-prompts": "0.9.1",
|
|
42
|
-
"@sveltejs/create": "0.0.0"
|
|
43
|
-
"@sveltejs/cli-core": "0.0.0"
|
|
43
|
+
"@sveltejs/create": "0.0.0"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
46
46
|
"create",
|