sv 0.5.11 → 0.6.0

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 CHANGED
@@ -25,7 +25,7 @@ import require$$0$3 from 'events';
25
25
  import { t as templates, c as create$2 } from './index-A89HFWzv.js';
26
26
 
27
27
  var name = "sv";
28
- var version = "0.5.11";
28
+ var version = "0.6.0";
29
29
  var type = "module";
30
30
  var description = "A CLI for creating and updating SvelteKit projects";
31
31
  var license = "MIT";
@@ -38,8 +38,7 @@ var homepage = "https://svelte.dev";
38
38
  var scripts = {
39
39
  check: "tsc",
40
40
  format: "pnpm lint --write",
41
- lint: "prettier --check . --config ../../prettier.config.js --ignore-path ../../.gitignore --ignore-path .gitignore --ignore-path ../../.prettierignore",
42
- postpublish: "pnpm -F @sveltejs/create update-template-repo"
41
+ lint: "prettier --check . --config ../../prettier.config.js --ignore-path ../../.gitignore --ignore-path .gitignore --ignore-path ../../.prettierignore"
43
42
  };
44
43
  var files = [
45
44
  "dist"
@@ -3913,6 +3912,21 @@ var ValiError = class extends Error {
3913
3912
  }
3914
3913
  };
3915
3914
 
3915
+ // src/actions/transform/transform.ts
3916
+ function transform(operation) {
3917
+ return {
3918
+ kind: "transformation",
3919
+ type: "transform",
3920
+ reference: transform,
3921
+ async: false,
3922
+ operation,
3923
+ _run(dataset) {
3924
+ dataset.value = this.operation(dataset.value);
3925
+ return dataset;
3926
+ }
3927
+ };
3928
+ }
3929
+
3916
3930
  // src/methods/getDefault/getDefault.ts
3917
3931
  function getDefault(schema, dataset, config2) {
3918
3932
  return typeof schema.default === "function" ? (
@@ -4304,6 +4318,28 @@ function parse$8(schema, input, config2) {
4304
4318
  return dataset.value;
4305
4319
  }
4306
4320
 
4321
+ // src/methods/pipe/pipe.ts
4322
+ function pipe$1(...pipe2) {
4323
+ return {
4324
+ ...pipe2[0],
4325
+ pipe: pipe2,
4326
+ _run(dataset, config2) {
4327
+ for (const item of pipe2) {
4328
+ if (item.kind !== "metadata") {
4329
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
4330
+ dataset.typed = false;
4331
+ break;
4332
+ }
4333
+ if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
4334
+ dataset = item._run(dataset, config2);
4335
+ }
4336
+ }
4337
+ }
4338
+ return dataset;
4339
+ }
4340
+ };
4341
+ }
4342
+
4307
4343
  const require$1 = createRequire(import.meta.url);
4308
4344
  var St = Object.create;
4309
4345
  var $ = Object.defineProperty;
@@ -26856,7 +26892,7 @@ function parse$7(source, options2) {
26856
26892
  parse_1$1 = typescript$1.parse = parse$7;
26857
26893
  var main = {};
26858
26894
  var parser$1 = {};
26859
- var options$4 = {};
26895
+ var options$5 = {};
26860
26896
  var esprima$1 = {};
26861
26897
  var esprima = { exports: {} };
26862
26898
  var hasRequiredEsprima$1;
@@ -33082,10 +33118,10 @@ function requireEsprima() {
33082
33118
  }
33083
33119
  var hasRequiredOptions;
33084
33120
  function requireOptions() {
33085
- if (hasRequiredOptions) return options$4;
33121
+ if (hasRequiredOptions) return options$5;
33086
33122
  hasRequiredOptions = 1;
33087
- Object.defineProperty(options$4, "__esModule", { value: true });
33088
- options$4.normalize = void 0;
33123
+ Object.defineProperty(options$5, "__esModule", { value: true });
33124
+ options$5.normalize = void 0;
33089
33125
  var util_1 = requireUtil();
33090
33126
  var defaults = {
33091
33127
  parser: requireEsprima(),
@@ -33136,8 +33172,8 @@ function requireOptions() {
33136
33172
  tokens: !!get("tokens")
33137
33173
  };
33138
33174
  }
33139
- options$4.normalize = normalize;
33140
- return options$4;
33175
+ options$5.normalize = normalize;
33176
+ return options$5;
33141
33177
  }
33142
33178
  var lines = {};
33143
33179
  var mapping = {};
@@ -48276,7 +48312,7 @@ const PORTS = {
48276
48312
  postgresql: "5432",
48277
48313
  sqlite: ""
48278
48314
  };
48279
- const options$3 = defineAdderOptions({
48315
+ const options$4 = defineAdderOptions({
48280
48316
  database: {
48281
48317
  question: "Which database would you like to use?",
48282
48318
  type: "select",
@@ -48332,7 +48368,7 @@ var drizzle = defineAdder({
48332
48368
  id: "drizzle",
48333
48369
  environments: { svelte: false, kit: true },
48334
48370
  homepage: "https://orm.drizzle.team",
48335
- options: options$3,
48371
+ options: options$4,
48336
48372
  packages: [
48337
48373
  { name: "drizzle-orm", version: "^0.33.0", dev: false },
48338
48374
  { name: "drizzle-kit", version: "^0.22.0", dev: true },
@@ -50191,7 +50227,7 @@ const TABLE_TYPE = {
50191
50227
  };
50192
50228
  let drizzleDialect;
50193
50229
  let schemaPath;
50194
- const options$2 = defineAdderOptions({
50230
+ const options$3 = defineAdderOptions({
50195
50231
  demo: {
50196
50232
  type: "boolean",
50197
50233
  default: true,
@@ -50202,7 +50238,7 @@ var lucia = defineAdder({
50202
50238
  id: "lucia",
50203
50239
  environments: { svelte: false, kit: true },
50204
50240
  homepage: "https://lucia-auth.com",
50205
- options: options$2,
50241
+ options: options$3,
50206
50242
  packages: [
50207
50243
  { name: "@oslojs/crypto", version: "^1.0.1", dev: false },
50208
50244
  { name: "@oslojs/encoding", version: "^1.1.0", dev: false },
@@ -50361,11 +50397,14 @@ var lucia = defineAdder({
50361
50397
  imports.addNamespace(ast, "$lib/server/db/schema", "table");
50362
50398
  imports.addNamed(ast, "$lib/server/db", { db: "db" });
50363
50399
  imports.addNamed(ast, "@oslojs/encoding", {
50364
- encodeBase32LowerCaseNoPadding: "encodeBase32LowerCaseNoPadding",
50400
+ encodeBase64url: "encodeBase64url",
50365
50401
  encodeHexLowerCase: "encodeHexLowerCase"
50366
50402
  });
50367
50403
  imports.addNamed(ast, "@oslojs/crypto/sha2", { sha256: "sha256" });
50368
50404
  imports.addNamed(ast, "drizzle-orm", { eq: "eq" });
50405
+ if (typescript) {
50406
+ imports.addNamed(ast, "@sveltejs/kit", { RequestEvent: "RequestEvent" }, true);
50407
+ }
50369
50408
  const ms = new MagicString(generateCode().trim());
50370
50409
  const [ts] = utils.createPrinter(typescript);
50371
50410
  if (!ms.original.includes("const DAY_IN_MS")) {
@@ -50374,12 +50413,11 @@ var lucia = defineAdder({
50374
50413
  if (!ms.original.includes("export const sessionCookieName")) {
50375
50414
  ms.append("\n\nexport const sessionCookieName = 'auth-session';");
50376
50415
  }
50377
- if (!ms.original.includes("function generateSessionToken")) {
50416
+ if (!ms.original.includes("export function generateSessionToken")) {
50378
50417
  const generateSessionToken = dedent`
50379
- ${ts("", "/** @returns {string} */")}
50380
- function generateSessionToken()${ts(": string")} {
50381
- const bytes = crypto.getRandomValues(new Uint8Array(20));
50382
- const token = encodeBase32LowerCaseNoPadding(bytes);
50418
+ export function generateSessionToken() {
50419
+ const bytes = crypto.getRandomValues(new Uint8Array(18));
50420
+ const token = encodeBase64url(bytes);
50383
50421
  return token;
50384
50422
  }`;
50385
50423
  ms.append(`
@@ -50387,10 +50425,12 @@ var lucia = defineAdder({
50387
50425
  ${generateSessionToken}`);
50388
50426
  }
50389
50427
  if (!ms.original.includes("async function createSession")) {
50390
- const createSession = dedent`
50391
- ${ts("", "/** @param {string} userId */")}
50392
- export async function createSession(userId${ts(": string")})${ts(": Promise<table.Session>")} {
50393
- const token = generateSessionToken();
50428
+ const createSession = dedent`
50429
+ ${ts("", "/**")}
50430
+ ${ts("", " * @param {string} token")}
50431
+ ${ts("", " * @param {string} userId")}
50432
+ ${ts("", " */")}
50433
+ export async function createSession(token${ts(": string")}, userId${ts(": string")}) {
50394
50434
  const sessionId = encodeHexLowerCase(sha256(new TextEncoder().encode(token)));
50395
50435
  const session${ts(": table.Session")} = {
50396
50436
  id: sessionId,
@@ -50404,23 +50444,11 @@ ${generateSessionToken}`);
50404
50444
 
50405
50445
  ${createSession}`);
50406
50446
  }
50407
- if (!ms.original.includes("async function invalidateSession")) {
50408
- const invalidateSession = dedent`
50409
- ${ts("", "/**")}
50410
- ${ts("", " * @param {string} sessionId")}
50411
- ${ts("", " * @returns {Promise<void>}")}
50412
- ${ts("", " */")}
50413
- export async function invalidateSession(sessionId${ts(": string")})${ts(": Promise<void>")} {
50414
- await db.delete(table.session).where(eq(table.session.id, sessionId));
50415
- }`;
50416
- ms.append(`
50417
-
50418
- ${invalidateSession}`);
50419
- }
50420
- if (!ms.original.includes("async function validateSession")) {
50421
- const validateSession = dedent`
50422
- ${ts("", "/** @param {string} sessionId */")}
50423
- export async function validateSession(sessionId${ts(": string")}) {
50447
+ if (!ms.original.includes("async function validateSessionToken")) {
50448
+ const validateSessionToken = dedent`
50449
+ ${ts("", "/** @param {string} token */")}
50450
+ export async function validateSessionToken(token${ts(": string")}) {
50451
+ const sessionId = encodeHexLowerCase(sha256(new TextEncoder().encode(token)));
50424
50452
  const [result] = await db
50425
50453
  .select({
50426
50454
  // Adjust user table here to tweak returned data
@@ -50455,13 +50483,52 @@ ${invalidateSession}`);
50455
50483
  }`;
50456
50484
  ms.append(`
50457
50485
 
50458
- ${validateSession}`);
50486
+ ${validateSessionToken}`);
50459
50487
  }
50460
50488
  if (typescript && !ms.original.includes("export type SessionValidationResult")) {
50461
- const sessionType = "export type SessionValidationResult = Awaited<ReturnType<typeof validateSession>>;";
50489
+ const sessionType = "export type SessionValidationResult = Awaited<ReturnType<typeof validateSessionToken>>;";
50462
50490
  ms.append(`
50463
50491
 
50464
50492
  ${sessionType}`);
50493
+ }
50494
+ if (!ms.original.includes("async function invalidateSession")) {
50495
+ const invalidateSession = dedent`
50496
+ ${ts("", "/** @param {string} sessionId */")}
50497
+ export async function invalidateSession(sessionId${ts(": string")}) {
50498
+ await db.delete(table.session).where(eq(table.session.id, sessionId));
50499
+ }`;
50500
+ ms.append(`
50501
+
50502
+ ${invalidateSession}`);
50503
+ }
50504
+ if (!ms.original.includes("export function setSessionTokenCookie")) {
50505
+ const setSessionTokenCookie = dedent`
50506
+ ${ts("", "/**")}
50507
+ ${ts("", ' * @param {import("@sveltejs/kit").RequestEvent} event')}
50508
+ ${ts("", " * @param {string} token")}
50509
+ ${ts("", " * @param {Date} expiresAt")}
50510
+ ${ts("", " */")}
50511
+ export function setSessionTokenCookie(event${ts(": RequestEvent")}, token${ts(": string")}, expiresAt${ts(": Date")}) {
50512
+ event.cookies.set(sessionCookieName, token, {
50513
+ expires: expiresAt,
50514
+ path: '/'
50515
+ });
50516
+ }`;
50517
+ ms.append(`
50518
+
50519
+ ${setSessionTokenCookie}`);
50520
+ }
50521
+ if (!ms.original.includes("export function deleteSessionTokenCookie")) {
50522
+ const deleteSessionTokenCookie = dedent`
50523
+ ${ts("", '/** @param {import("@sveltejs/kit").RequestEvent} event */')}
50524
+ export function deleteSessionTokenCookie(event${ts(": RequestEvent")}) {
50525
+ event.cookies.delete(sessionCookieName, {
50526
+ path: '/'
50527
+ });
50528
+ }`;
50529
+ ms.append(`
50530
+
50531
+ ${deleteSessionTokenCookie}`);
50465
50532
  }
50466
50533
  return ms.toString();
50467
50534
  }
@@ -50491,7 +50558,6 @@ ${sessionType}`);
50491
50558
  content: ({ content, typescript }) => {
50492
50559
  const { ast, generateCode } = parseScript(content);
50493
50560
  imports.addNamespace(ast, "$lib/server/auth.js", "auth");
50494
- imports.addNamed(ast, "$app/environment", { dev: "dev" });
50495
50561
  kit.addHooksHandle(ast, typescript, "handleAuth", getAuthHandleContent());
50496
50562
  return generateCode();
50497
50563
  }
@@ -50515,10 +50581,9 @@ ${sessionType}`);
50515
50581
  const [ts] = utils.createPrinter(typescript);
50516
50582
  return dedent`
50517
50583
  import { hash, verify } from '@node-rs/argon2';
50518
- import { generateRandomString } from '@oslojs/crypto/random';
50584
+ import { encodeBase64url } from '@oslojs/encoding';
50519
50585
  import { fail, redirect } from '@sveltejs/kit';
50520
50586
  import { eq } from 'drizzle-orm';
50521
- import { dev } from '$app/environment';
50522
50587
  import * as auth from '$lib/server/auth';
50523
50588
  import { db } from '$lib/server/db';
50524
50589
  import * as table from '$lib/server/db/schema';
@@ -50564,14 +50629,9 @@ ${sessionType}`);
50564
50629
  return fail(400, { message: 'Incorrect username or password' });
50565
50630
  }
50566
50631
 
50567
- const session = await auth.createSession(existingUser.id);
50568
- event.cookies.set(auth.sessionCookieName, session.id, {
50569
- path: '/',
50570
- sameSite: 'lax',
50571
- httpOnly: true,
50572
- expires: session.expiresAt,
50573
- secure: !dev
50574
- });
50632
+ const sessionToken = auth.generateSessionToken();
50633
+ const session = await auth.createSession(sessionToken, existingUser.id);
50634
+ auth.setSessionTokenCookie(event, sessionToken, session.expiresAt);
50575
50635
 
50576
50636
  return redirect(302, '/demo/lucia');
50577
50637
  },
@@ -50599,14 +50659,9 @@ ${sessionType}`);
50599
50659
  try {
50600
50660
  await db.insert(table.user).values({ id: userId, username, passwordHash });
50601
50661
 
50602
- const session = await auth.createSession(userId);
50603
- event.cookies.set(auth.sessionCookieName, session.id, {
50604
- path: '/',
50605
- sameSite: 'lax',
50606
- httpOnly: true,
50607
- expires: session.expiresAt,
50608
- secure: !dev
50609
- });
50662
+ const sessionToken = auth.generateSessionToken();
50663
+ const session = await auth.createSession(sessionToken, userId);
50664
+ auth.setSessionTokenCookie(event, sessionToken, session.expiresAt);
50610
50665
  } catch (e) {
50611
50666
  return fail(500, { message: 'An error has occurred' });
50612
50667
  }
@@ -50614,10 +50669,11 @@ ${sessionType}`);
50614
50669
  },
50615
50670
  };
50616
50671
 
50617
- const alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_';
50618
-
50619
- function generateUserId(length = 21)${ts(": string")} {
50620
- return generateRandomString({ read: (bytes) => crypto.getRandomValues(bytes) }, alphabet, length);
50672
+ function generateUserId() {
50673
+ // ID with 120 bits of entropy, or about the same as UUID v4.
50674
+ const bytes = crypto.getRandomValues(new Uint8Array(15));
50675
+ const id = encodeBase64url(bytes);
50676
+ return id;
50621
50677
  }
50622
50678
 
50623
50679
  function validateUsername(username${ts(": unknown")})${ts(": username is string")} {
@@ -50683,7 +50739,7 @@ ${sessionType}`);
50683
50739
  return fail(401);
50684
50740
  }
50685
50741
  await auth.invalidateSession(event.locals.session.id);
50686
- event.cookies.delete(auth.sessionCookieName, { path: '/' });
50742
+ auth.deleteSessionTokenCookie(event);
50687
50743
 
50688
50744
  return redirect(302, '/demo/lucia/login');
50689
50745
  },
@@ -50750,24 +50806,18 @@ function createLuciaType(name) {
50750
50806
  function getAuthHandleContent() {
50751
50807
  return `
50752
50808
  async ({ event, resolve }) => {
50753
- const sessionId = event.cookies.get(auth.sessionCookieName);
50754
- if (!sessionId) {
50809
+ const sessionToken = event.cookies.get(auth.sessionCookieName);
50810
+ if (!sessionToken) {
50755
50811
  event.locals.user = null;
50756
50812
  event.locals.session = null;
50757
50813
  return resolve(event);
50758
50814
  }
50759
50815
 
50760
- const { session, user } = await auth.validateSession(sessionId);
50816
+ const { session, user } = await auth.validateSessionToken(sessionToken);
50761
50817
  if (session) {
50762
- event.cookies.set(auth.sessionCookieName, session.id, {
50763
- path: '/',
50764
- sameSite: 'lax',
50765
- httpOnly: true,
50766
- expires: session.expiresAt,
50767
- secure: !dev
50768
- });
50818
+ auth.setSessionTokenCookie(event, sessionToken, session.expiresAt);
50769
50819
  } else {
50770
- event.cookies.delete(auth.sessionCookieName, { path: '/' });
50820
+ auth.deleteSessionTokenCookie(event);
50771
50821
  }
50772
50822
 
50773
50823
  event.locals.user = user;
@@ -50823,9 +50873,6 @@ function element(tagName, attributes = {}) {
50823
50873
  element2.attribs = attributes;
50824
50874
  return element2;
50825
50875
  }
50826
- function insertElement(childNodes, elementToInsert) {
50827
- childNodes.splice(0, 0, elementToInsert);
50828
- }
50829
50876
  function appendElement(childNodes, elementToAppend) {
50830
50877
  childNodes.push(elementToAppend);
50831
50878
  }
@@ -50861,7 +50908,7 @@ const DEFAULT_INLANG_PROJECT = {
50861
50908
  pathPattern: "./messages/{languageTag}.json"
50862
50909
  }
50863
50910
  };
50864
- const options$1 = defineAdderOptions({
50911
+ const options$2 = defineAdderOptions({
50865
50912
  availableLanguageTags: {
50866
50913
  question: `Which languages would you like to support? ${picocolors.gray("(e.g. en,de-ch)")}`,
50867
50914
  type: "string",
@@ -50891,7 +50938,7 @@ var paraglide = defineAdder({
50891
50938
  id: "paraglide",
50892
50939
  environments: { svelte: false, kit: true },
50893
50940
  homepage: "https://inlang.com",
50894
- options: options$1,
50941
+ options: options$2,
50895
50942
  packages: [
50896
50943
  {
50897
50944
  name: "@inlang/paraglide-sveltekit",
@@ -51104,7 +51151,7 @@ ${links}
51104
51151
  `Edit your messages in ${highlighter.path("messages/en.json")}`,
51105
51152
  "Consider installing the Sherlock IDE Extension"
51106
51153
  ];
51107
- if (options$1.demo) {
51154
+ if (options$2.demo) {
51108
51155
  steps.push(`Visit ${highlighter.route("/demo/paraglide")} route to view the demo`);
51109
51156
  }
51110
51157
  return steps;
@@ -51291,81 +51338,6 @@ function hasEslint(dependencyVersion) {
51291
51338
  return !!version && version.startsWith(SUPPORTED_ESLINT_VERSION);
51292
51339
  }
51293
51340
 
51294
- var routify = defineAdder({
51295
- id: "routify",
51296
- environments: { svelte: true, kit: false },
51297
- homepage: "https://routify.dev",
51298
- options: {},
51299
- packages: [{ name: "@roxi/routify", version: "next", dev: true }],
51300
- files: [
51301
- {
51302
- name: ({ typescript }) => `vite.config.${typescript ? "ts" : "js"}`,
51303
- content: ({ content }) => {
51304
- const { ast, generateCode } = parseScript(content);
51305
- const vitePluginName = "routify";
51306
- imports.addDefault(ast, "@roxi/routify/vite-plugin", vitePluginName);
51307
- const { value: rootObject } = exports.defaultExport(
51308
- ast,
51309
- _function.call("defineConfig", [])
51310
- );
51311
- const param1 = _function.argumentByIndex(rootObject, 0, object.createEmpty());
51312
- const pluginsArray = object.property(param1, "plugins", array.createEmpty());
51313
- const pluginFunctionCall = _function.call(vitePluginName, []);
51314
- const pluginConfig = object.createEmpty();
51315
- _function.argumentByIndex(pluginFunctionCall, 0, pluginConfig);
51316
- array.push(pluginsArray, pluginFunctionCall);
51317
- return generateCode();
51318
- }
51319
- },
51320
- {
51321
- name: () => "src/App.svelte",
51322
- content: ({ content }) => {
51323
- const { script, template, generateCode } = parseSvelte(content);
51324
- imports.addNamed(script.ast, "@roxi/routify", {
51325
- Router: "Router",
51326
- createRouter: "createRouter"
51327
- });
51328
- imports.addDefault(script.ast, "../.routify/routes.default.js", "routes");
51329
- const routesObject = object.createEmpty();
51330
- const routesIdentifier = variables.identifier("routes");
51331
- object.property(routesObject, "routes", routesIdentifier);
51332
- const createRouterFunction = _function.call("createRouter", []);
51333
- createRouterFunction.arguments.push(routesObject);
51334
- const routerVariableDeclaration = variables.declaration(
51335
- script.ast,
51336
- "const",
51337
- "router",
51338
- createRouterFunction
51339
- );
51340
- exports.namedExport(script.ast, "router", routerVariableDeclaration);
51341
- const router = element("Router", { "{router}": "" });
51342
- insertElement(template.ast.childNodes, router);
51343
- return generateCode({ script: script.generateCode(), template: template.generateCode() });
51344
- }
51345
- },
51346
- {
51347
- name: () => "src/routes/index.svelte",
51348
- content: ({ content }) => {
51349
- const htmlString = `${routifyDemoHtml}<p>On index</p>`;
51350
- return content + htmlString;
51351
- }
51352
- },
51353
- {
51354
- name: () => "src/routes/demo.svelte",
51355
- content: ({ content }) => {
51356
- const htmlString = `${routifyDemoHtml}<p>On demo</p>`;
51357
- return content + htmlString;
51358
- }
51359
- }
51360
- ]
51361
- });
51362
- const routifyDemoHtml = `
51363
- <div class="routify-demo">
51364
- <a class="index" style="margin: 5px;" href="/">Index</a>
51365
- <a class="demo" style="margin: 5px;" href="/demo">Demo</a>
51366
- </div>
51367
- `;
51368
-
51369
51341
  var storybook = defineAdder({
51370
51342
  id: "storybook",
51371
51343
  environments: { kit: true, svelte: true },
@@ -51429,7 +51401,7 @@ const pluginPackages = plugins.map((x) => ({
51429
51401
  dev: true,
51430
51402
  condition: ({ options: options2 }) => options2.plugins.includes(x.id)
51431
51403
  }));
51432
- const options = defineAdderOptions({
51404
+ const options$1 = defineAdderOptions({
51433
51405
  plugins: {
51434
51406
  type: "multiselect",
51435
51407
  question: "Which plugins would you like to add?",
@@ -51442,7 +51414,7 @@ var tailwindcss = defineAdder({
51442
51414
  alias: "tailwind",
51443
51415
  environments: { svelte: true, kit: true },
51444
51416
  homepage: "https://tailwindcss.com",
51445
- options,
51417
+ options: options$1,
51446
51418
  packages: [
51447
51419
  { name: "tailwindcss", version: "^3.4.9", dev: true },
51448
51420
  { name: "autoprefixer", version: "^10.4.20", dev: true },
@@ -51650,8 +51622,7 @@ const officialAdders = [
51650
51622
  lucia,
51651
51623
  mdsvex,
51652
51624
  paraglide,
51653
- storybook,
51654
- routify
51625
+ storybook
51655
51626
  ];
51656
51627
  function getAdderDetails(id) {
51657
51628
  const details = officialAdders.find((a) => a.id === id);
@@ -51663,8 +51634,8 @@ function getAdderDetails(id) {
51663
51634
 
51664
51635
  function __variableDynamicImportRuntime0__(path) {
51665
51636
  switch (path) {
51666
- case '../../../community-adders/unocss.ts': return import('./unocss-BUQS5wKg.js');
51667
- case '../../../community-adders/unplugin-icons.ts': return import('./unplugin-icons-BietOpsP.js');
51637
+ case '../../../community-adders/unocss.ts': return import('./unocss-CQk-PWUl.js');
51638
+ case '../../../community-adders/unplugin-icons.ts': return import('./unplugin-icons-D6icB7Q_.js');
51668
51639
  default: return new Promise(function(resolve, reject) {
51669
51640
  (typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)(
51670
51641
  reject.bind(null, new Error("Unknown variable dynamic import: " + path))
@@ -51677,9 +51648,40 @@ const communityAdderIds = ["unocss","unplugin-icons"];async function getCommunit
51677
51648
  return details;
51678
51649
  }
51679
51650
 
51651
+ const NO_PREFIX = "--no-";
51652
+ let options = [];
51653
+ function getLongFlag(flags) {
51654
+ return flags.split(",").map((f) => f.trim()).find((f) => f.startsWith("--"));
51655
+ }
51680
51656
  const helpConfig = {
51681
51657
  argumentDescription: formatDescription,
51682
- optionDescription: formatDescription
51658
+ optionDescription: formatDescription,
51659
+ visibleOptions(cmd) {
51660
+ options = cmd.options;
51661
+ const visible = cmd.options.filter((o) => !o.hidden);
51662
+ const show = [];
51663
+ for (const option of visible) {
51664
+ const flag = getLongFlag(option.flags);
51665
+ if (flag?.startsWith(NO_PREFIX)) {
51666
+ const stripped = flag.slice(NO_PREFIX.length);
51667
+ const isNoVariant = visible.some((o) => getLongFlag(o.flags)?.startsWith(`--${stripped}`));
51668
+ if (isNoVariant) continue;
51669
+ }
51670
+ show.push(option);
51671
+ }
51672
+ return show;
51673
+ },
51674
+ optionTerm(option) {
51675
+ const longFlag = getLongFlag(option.flags);
51676
+ const flag = longFlag?.split(" ").at(0);
51677
+ if (!flag || !longFlag) return option.flags;
51678
+ const noVariant = `--no-${flag.slice(2)}`;
51679
+ const hasVariant = options.some((o) => getLongFlag(o.flags) === noVariant);
51680
+ if (hasVariant) {
51681
+ return `--[no-]${longFlag.slice(2)}`;
51682
+ }
51683
+ return option.flags;
51684
+ }
51683
51685
  };
51684
51686
  function formatDescription(arg) {
51685
51687
  let output = arg.description;
@@ -51703,10 +51705,10 @@ async function runCommand(action) {
51703
51705
  }
51704
51706
  }
51705
51707
  }
51706
- async function formatFiles(options) {
51707
- const args = ["prettier", "--write", "--ignore-unknown", ...options.paths];
51708
- const cmd = resolveCommand(options.packageManager, "execute-local", args);
51709
- await be(cmd.command, cmd.args, { nodeOptions: { cwd: options.cwd, stdio: "pipe" } });
51708
+ async function formatFiles(options2) {
51709
+ const args = ["prettier", "--write", "--ignore-unknown", ...options2.paths];
51710
+ const cmd = resolveCommand(options2.packageManager, "execute-local", args);
51711
+ await be(cmd.command, cmd.args, { nodeOptions: { cwd: options2.cwd, stdio: "pipe" } });
51710
51712
  }
51711
51713
  const agents = AGENTS.filter((agent) => !agent.includes("@"));
51712
51714
  const agentOptions = agents.map((pm) => ({ value: pm, label: pm }));
@@ -55235,7 +55237,7 @@ const addersOptions = getAdderOptionFlags();
55235
55237
  const communityDetails = [];
55236
55238
  const defaultPkgPath = up();
55237
55239
  const defaultCwd = defaultPkgPath ? path$3.dirname(defaultPkgPath) : void 0;
55238
- const add = new Command("add").description("applies specified integrations into a project").argument("[integration...]", "integrations to install").option("-C, --cwd <path>", "path to working directory", defaultCwd).option("--no-install", "skips installing dependencies").option("--no-preconditions", "skips validating preconditions").configureHelp(helpConfig).action((adderArgs, opts) => {
55240
+ 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((adderArgs, opts) => {
55239
55241
  if (opts.cwd === void 0) {
55240
55242
  console.error(
55241
55243
  "Invalid workspace: Please verify that you are inside of a Svelte project. You can also specify the working directory with `--cwd <path>`"
@@ -55437,7 +55439,7 @@ Available options: ${communityAdderIds.join(", ")}`
55437
55439
  );
55438
55440
  if (installed) continue;
55439
55441
  const install = await confirm({
55440
- message: `The ${pc.bold(pc.cyan(adder.id))} integration requires ${pc.bold(pc.cyan(depId))} to also be setup. ${pc.green("Include it?")}`
55442
+ message: `The ${pc.bold(pc.cyan(adder.id))} add-on requires ${pc.bold(pc.cyan(depId))} to also be setup. ${pc.green("Include it?")}`
55441
55443
  });
55442
55444
  if (install !== true) {
55443
55445
  cancel("Operation cancelled.");
@@ -55528,7 +55530,7 @@ Available options: ${communityAdderIds.join(", ")}`
55528
55530
  packageManager = await packageManagerPrompt(options.cwd);
55529
55531
  }
55530
55532
  const filesToFormat = await runAdders({ cwd: options.cwd, packageManager, official, community });
55531
- log$1.success("Successfully setup integrations");
55533
+ log$1.success("Successfully setup add-ons");
55532
55534
  if (packageManager && options.install) {
55533
55535
  await installDependencies(packageManager, options.cwd);
55534
55536
  }
@@ -55634,7 +55636,7 @@ function getAdderOptionFlags() {
55634
55636
  const preset = defaults.join(", ") || "none";
55635
55637
  const option = new Option(
55636
55638
  `--${id} [options...]`,
55637
- `${id} integration options ${pc.dim(`(preset: ${preset})`)}
55639
+ `${id} add-on options ${pc.dim(`(preset: ${preset})`)}
55638
55640
  ${choices}`
55639
55641
  ).preset(preset).argParser((value, prev) => {
55640
55642
  prev ?? (prev = []);
@@ -55686,24 +55688,32 @@ function getPadding(lines) {
55686
55688
  return Math.max(...lengths);
55687
55689
  }
55688
55690
 
55689
- const langs = ["typescript", "checkjs", "none"];
55691
+ const langs = ["ts", "jsdoc"];
55692
+ const langMap = {
55693
+ ts: "typescript",
55694
+ jsdoc: "checkjs",
55695
+ false: "none"
55696
+ };
55690
55697
  const templateChoices = templates.map((t) => t.name);
55691
- const langOption = new Option("--check-types <lang>", "add type checking").choices(langs);
55698
+ const langOption = new Option("--types <lang>", "add type checking").choices(langs);
55692
55699
  const templateOption = new Option("--template <type>", "template to scaffold").choices(
55693
55700
  templateChoices
55694
55701
  );
55695
55702
  const ProjectPathSchema = string();
55696
55703
  const OptionsSchema = strictObject({
55697
- checkTypes: optional(picklist(langs)),
55698
- integrations: boolean(),
55704
+ types: pipe$1(
55705
+ optional(union([picklist(langs), boolean()])),
55706
+ transform((lang) => langMap[String(lang)])
55707
+ ),
55708
+ addOns: boolean(),
55699
55709
  install: boolean(),
55700
55710
  template: optional(picklist(templateChoices))
55701
55711
  });
55702
- const create = new Command("create").description("scaffolds a new SvelteKit project").argument("[path]", "where the project will be created", process$1$1.cwd()).addOption(langOption).addOption(templateOption).option("--no-integrations", "skips interactive integration installer").option("--no-install", "skips installing dependencies").configureHelp(helpConfig).action((projectPath, opts) => {
55712
+ const create = new Command("create").description("scaffolds a new SvelteKit project").argument("[path]", "where the project will be created", process$1$1.cwd()).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) => {
55703
55713
  const cwd = parse$8(ProjectPathSchema, projectPath);
55704
55714
  const options = parse$8(OptionsSchema, opts);
55705
55715
  runCommand(async () => {
55706
- const { directory, integrationNextSteps, packageManager } = await createProject(cwd, options);
55716
+ const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options);
55707
55717
  const highlight = (str) => pc.bold(pc.cyan(str));
55708
55718
  let i = 1;
55709
55719
  const initialSteps = [];
@@ -55729,7 +55739,7 @@ const create = new Command("create").description("scaffolds a new SvelteKit proj
55729
55739
  `Stuck? Visit us at ${pc.cyan("https://svelte.dev/chat")}`
55730
55740
  ];
55731
55741
  box(steps.join("\n"), "Project next steps");
55732
- if (integrationNextSteps) box(integrationNextSteps, "Integration next steps");
55742
+ if (addOnNextSteps) box(addOnNextSteps, "Add-on next steps");
55733
55743
  });
55734
55744
  });
55735
55745
  async function createProject(cwd, options) {
@@ -55766,7 +55776,7 @@ async function createProject(cwd, options) {
55766
55776
  });
55767
55777
  },
55768
55778
  language: () => {
55769
- if (options.checkTypes) return Promise.resolve(options.checkTypes);
55779
+ if (options.types) return Promise.resolve(options.types);
55770
55780
  return select({
55771
55781
  message: "Add type checking with Typescript?",
55772
55782
  initialValue: "typescript",
@@ -55793,25 +55803,25 @@ async function createProject(cwd, options) {
55793
55803
  });
55794
55804
  log$1.success("Project created");
55795
55805
  let packageManager;
55796
- let integrationNextSteps;
55806
+ let addOnNextSteps;
55797
55807
  const installDeps = async () => {
55798
55808
  packageManager = await packageManagerPrompt(projectPath);
55799
55809
  if (packageManager) await installDependencies(packageManager, projectPath);
55800
55810
  };
55801
- if (options.integrations) {
55811
+ if (options.addOns) {
55802
55812
  const { nextSteps, packageManager: pm } = await runAddCommand(
55803
55813
  { cwd: projectPath, install: options.install, preconditions: true, community: [] },
55804
55814
  []
55805
55815
  );
55806
55816
  packageManager = pm;
55807
- integrationNextSteps = nextSteps;
55817
+ addOnNextSteps = nextSteps;
55808
55818
  } else if (options.install) {
55809
55819
  await installDeps();
55810
55820
  }
55811
55821
  if (packageManager === null && options.install) {
55812
55822
  await installDeps();
55813
55823
  }
55814
- return { directory: projectPath, integrationNextSteps, packageManager };
55824
+ return { directory: projectPath, addOnNextSteps, packageManager };
55815
55825
  }
55816
55826
 
55817
55827
  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$1.cwd()).configureHelp({