sv 0.11.2 → 0.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/add-BWQarWDB.mjs +7000 -0
  2. package/dist/add-nRRWTjzp.d.mts +35 -0
  3. package/dist/bin.mjs +25 -1845
  4. package/dist/{index-7xp7FWpU.d.mts → core-CnPhgWST.d.mts} +294 -46
  5. package/dist/lib/core.d.mts +2 -0
  6. package/dist/lib/core.mjs +3 -0
  7. package/dist/lib/index.d.mts +16 -0
  8. package/dist/lib/index.mjs +4 -4
  9. package/dist/lib/testing.d.mts +108 -0
  10. package/dist/lib/testing.mjs +970 -927
  11. package/dist/{package-manager-CySZrSUa.mjs → package-manager-DkCPtZM1.mjs} +219 -1328
  12. package/dist/shared.json +30 -4
  13. package/dist/templates/addon/assets/DOT-gitignore +27 -0
  14. package/dist/templates/addon/assets/src/index.js +52 -0
  15. package/dist/templates/addon/assets/tests/addon.test.js +50 -0
  16. package/dist/templates/addon/assets/tests/setup/global.js +14 -0
  17. package/dist/templates/addon/assets/tests/setup/suite.js +130 -0
  18. package/dist/templates/addon/assets/vitest.config.js +16 -0
  19. package/dist/templates/addon/files.types=checkjs.json +1 -0
  20. package/dist/templates/addon/files.types=none.json +1 -0
  21. package/dist/templates/addon/files.types=typescript.json +1 -0
  22. package/dist/templates/addon/meta.json +4 -0
  23. package/dist/templates/addon/package.json +32 -0
  24. package/dist/templates/demo/files.types=checkjs.json +5 -5
  25. package/dist/templates/demo/files.types=none.json +5 -5
  26. package/dist/templates/demo/files.types=typescript.json +5 -5
  27. package/dist/templates/demo/package.json +1 -1
  28. package/dist/templates/library/package.json +1 -1
  29. package/dist/templates/minimal/package.json +1 -1
  30. package/dist/{core-D715tamU.mjs → utils-DjBRIDJG.mjs} +26494 -25089
  31. package/package.json +7 -7
  32. package/dist/index.d.mts +0 -2
  33. package/dist/index2.d.mts +0 -65
  34. package/dist/lib/core/index.mjs +0 -4
  35. package/dist/official-P5OKi7QM.mjs +0 -2586
  36. package/dist/testing.d.mts +0 -50
@@ -1,10 +1,13 @@
1
1
  import { log } from "@clack/prompts";
2
- import colors from "picocolors";
3
2
  import dedent from "dedent";
4
3
  import * as Walker from "zimmerframe";
4
+ import { AgentName } from "package-manager-detector";
5
+ import { resolveCommand } from "package-manager-detector/commands";
5
6
  import * as estree from "estree";
6
7
  import { BaseNode as BaseNode$1 } from "estree";
7
8
  import { AST as SvelteAst } from "svelte/compiler";
9
+ import * as yaml from "yaml";
10
+ import { TomlTable } from "smol-toml";
8
11
 
9
12
  //#region lib/core/addon/options.d.ts
10
13
  type BooleanQuestion = {
@@ -68,7 +71,8 @@ type Workspace = {
68
71
  * @returns the dependency version with any leading characters such as ^ or ~ removed
69
72
  */
70
73
  dependencyVersion: (pkg: string) => string | undefined;
71
- typescript: boolean;
74
+ /** to know if the workspace is using typescript or javascript */
75
+ language: "ts" | "js";
72
76
  files: {
73
77
  viteConfig: "vite.config.js" | "vite.config.ts";
74
78
  svelteConfig: "svelte.config.js" | "svelte.config.ts";
@@ -89,14 +93,34 @@ type Workspace = {
89
93
  to: string;
90
94
  }) => string;
91
95
  };
96
+ /** If we are in a kit project, this object will contain the lib and routes directories */
92
97
  kit: {
93
98
  libDirectory: string;
94
99
  routesDirectory: string;
95
100
  } | undefined;
101
+ /** The package manager used to install dependencies */
96
102
  packageManager: PackageManager;
97
103
  };
98
104
  type PackageManager = "npm" | "yarn" | "pnpm" | "bun" | "deno";
99
105
  //#endregion
106
+ //#region lib/addons/_config/official.d.ts
107
+ type OfficialAddons = {
108
+ prettier: Addon<any>;
109
+ eslint: Addon<any>;
110
+ vitest: Addon<any>;
111
+ playwright: Addon<any>;
112
+ tailwindcss: Addon<any>;
113
+ sveltekitAdapter: Addon<any>;
114
+ devtoolsJson: Addon<any>;
115
+ drizzle: Addon<any>;
116
+ lucia: Addon<any>;
117
+ mdsvex: Addon<any>;
118
+ paraglide: Addon<any>;
119
+ storybook: Addon<any>;
120
+ mcp: Addon<any>;
121
+ };
122
+ declare const officialAddons: OfficialAddons;
123
+ //#endregion
100
124
  //#region lib/core/addon/config.d.ts
101
125
  type ConditionDefinition = (Workspace: Workspace) => boolean;
102
126
  type PackageDefinition = {
@@ -112,10 +136,15 @@ type Scripts = {
112
136
  condition?: ConditionDefinition;
113
137
  };
114
138
  type SvApi = {
139
+ /** Add a package to the pnpm build dependencies. */
115
140
  pnpmBuildDependency: (pkg: string) => void;
141
+ /** Add a package to the dependencies. */
116
142
  dependency: (pkg: string, version: string) => void;
143
+ /** Add a package to the dev dependencies. */
117
144
  devDependency: (pkg: string, version: string) => void;
145
+ /** Execute a command in the workspace. */
118
146
  execute: (args: string[], stdio: "inherit" | "pipe") => Promise<void>;
147
+ /** Edit a file in the workspace. (will create it if it doesn't exist) */
119
148
  file: (path: string, edit: (content: string) => string) => void;
120
149
  };
121
150
  type Addon<Args extends OptionDefinition> = {
@@ -124,38 +153,107 @@ type Addon<Args extends OptionDefinition> = {
124
153
  shortDescription?: string;
125
154
  homepage?: string;
126
155
  options: Args;
156
+ /** Setup the addon. Will be called before the addon is run. */
127
157
  setup?: (workspace: Workspace & {
128
- dependsOn: (name: string) => void;
158
+ /** On what official addons does this addon depend on? */
159
+ dependsOn: (name: keyof typeof officialAddons) => void;
160
+ /** Why is this addon not supported?
161
+ *
162
+ * @example
163
+ * if (!kit) unsupported('Requires SvelteKit');
164
+ */
129
165
  unsupported: (reason: string) => void;
130
- runsAfter: (addonName: string) => void;
166
+ /** On what official addons does this addon run after? */
167
+ runsAfter: (name: keyof typeof officialAddons) => void;
131
168
  }) => MaybePromise<void>;
169
+ /** Run the addon. The actual execution of the addon... Add files, edit files, etc. */
132
170
  run: (workspace: Workspace & {
171
+ /** Add-on options */
133
172
  options: WorkspaceOptions<Args>;
173
+ /** Api to interact with the workspace. */
134
174
  sv: SvApi;
175
+ /** Cancel the addon at any time!
176
+ * @example
177
+ * return cancel('There is a problem with...');
178
+ */
135
179
  cancel: (reason: string) => void;
136
180
  }) => MaybePromise<void>;
137
- nextSteps?: (data: {
138
- highlighter: Highlighter;
139
- } & Workspace & {
181
+ /** Next steps to display after the addon is run. */
182
+ nextSteps?: (data: Workspace & {
140
183
  options: WorkspaceOptions<Args>;
141
184
  }) => string[];
142
185
  };
143
- type Highlighter = {
144
- addon: (str: string) => string;
145
- path: (str: string) => string;
146
- command: (str: string) => string;
147
- website: (str: string) => string;
148
- route: (str: string) => string;
149
- env: (str: string) => string;
150
- optional: (str: string) => string;
151
- };
186
+ /**
187
+ * The entry point for your addon, It will hold every thing! (options, setup, run, nextSteps, ...)
188
+ */
152
189
  declare function defineAddon<Args extends OptionDefinition>(config: Addon<Args>): Addon<Args>;
153
- type AddonSetupResult = {
190
+ /**
191
+ * Stage 1: Raw CLI input - what the user typed
192
+ */
193
+ type AddonInput = {
194
+ readonly specifier: string;
195
+ readonly options: string[];
196
+ };
197
+ /**
198
+ * Stage 2: Classified source - knows where addon comes from
199
+ */
200
+ type AddonSource = {
201
+ readonly kind: "official";
202
+ readonly id: string;
203
+ } | {
204
+ readonly kind: "file";
205
+ readonly path: string;
206
+ } | {
207
+ readonly kind: "npm";
208
+ readonly packageName: string;
209
+ readonly npmUrl: string;
210
+ readonly registryUrl: string;
211
+ readonly tag: string;
212
+ };
213
+ type AddonReference = {
214
+ readonly specifier: string;
215
+ readonly options: string[];
216
+ readonly source: AddonSource;
217
+ };
218
+ /**
219
+ * Stage 3: Code loaded - addon definition is always present
220
+ */
221
+ type LoadedAddon = {
222
+ readonly reference: AddonReference;
223
+ readonly addon: AddonDefinition;
224
+ };
225
+ /**
226
+ * Stage 4: Setup done - has dependency info
227
+ */
228
+ type PreparedAddon = LoadedAddon & {
229
+ readonly setupResult: SetupResult;
230
+ };
231
+ /**
232
+ * Stage 5: User configured - has answers to questions
233
+ */
234
+ type ConfiguredAddon = PreparedAddon & {
235
+ readonly answers: OptionValues<any>;
236
+ };
237
+ /**
238
+ * Stage 6: Execution result
239
+ */
240
+ type AddonResult = {
241
+ readonly id: string;
242
+ readonly status: "success" | {
243
+ canceled: string[];
244
+ };
245
+ readonly files: string[];
246
+ };
247
+ /**
248
+ * Generates an inline error hint based on the addon source
249
+ */
250
+ declare function getErrorHint(source: AddonSource): string;
251
+ type SetupResult = {
154
252
  dependsOn: string[];
155
253
  unsupported: string[];
156
254
  runsAfter: string[];
157
255
  };
158
- type AddonWithoutExplicitArgs = Addon<Record<string, Question<any>>>;
256
+ type AddonDefinition = Addon<Record<string, Question<any>>>;
159
257
  type Tests = {
160
258
  expectProperty: (selector: string, property: string, expectedValue: string) => Promise<void>;
161
259
  elementExists: (selector: string) => Promise<void>;
@@ -177,34 +275,75 @@ type Verification = {
177
275
  };
178
276
  type Prettify<T> = { [K in keyof T]: T[K] } & unknown;
179
277
  type OptionBuilder<T extends OptionDefinition> = {
278
+ /**
279
+ * This type is a bit complex, but in usage, it's quite simple!
280
+ *
281
+ * The idea is to `add()` options one by one, with the key and the question.
282
+ *
283
+ * ```ts
284
+ * .add('demo', {
285
+ * question: 'Do you want to add a demo?',
286
+ * type: 'boolean', // string, number, select, multiselect
287
+ * default: true,
288
+ * // condition: (o) => o.previousOption === 'ok',
289
+ * })
290
+ * ```
291
+ */
180
292
  add<K$1 extends string, const Q extends Question<T & Record<K$1, Q>>>(key: K$1, question: Q): OptionBuilder<T & Record<K$1, Q>>;
293
+ /** Finalize all options of your `add-on`. */
181
294
  build(): Prettify<T>;
182
295
  };
296
+ /**
297
+ * Options for an addon.
298
+ *
299
+ * Will be prompted to the user if there are not answered by args when calling the cli.
300
+ *
301
+ * ```ts
302
+ * const options = defineAddonOptions()
303
+ * .add('demo', {
304
+ * question: `demo? ${color.optional('(a cool one!)')}`
305
+ * type: string | boolean | number | select | multiselect,
306
+ * default: true,
307
+ * })
308
+ * .build();
309
+ * ```
310
+ *
311
+ * To define by args, you can do
312
+ * ```sh
313
+ * npx sv add <addon>=<option1>:<value1>+<option2>:<value2>
314
+ * ```
315
+ */
183
316
  declare function defineAddonOptions(): OptionBuilder<{}>;
184
- declare namespace utils_d_exports {
185
- export { createPrinter };
186
- }
187
- type Printer = (content: string, alt?: string) => string;
188
- declare function createPrinter(...conditions: boolean[]): Printer[];
189
317
  //#endregion
190
- //#region lib/core/common.d.ts
191
- type Version = {
192
- major?: number;
193
- minor?: number;
194
- patch?: number;
318
+ //#region lib/cli/add/utils.d.ts
319
+ declare function fileExists(cwd: string, filePath: string): boolean;
320
+ declare const color: {
321
+ addon: (str: string) => string;
322
+ command: (str: string) => string;
323
+ env: (str: string) => string;
324
+ path: (str: string) => string;
325
+ route: (str: string) => string;
326
+ website: (str: string) => string;
327
+ optional: (str: string) => string;
328
+ warning: (str: string) => string;
195
329
  };
196
- declare function splitVersion(str: string): Version;
330
+ //#endregion
331
+ //#region lib/core/common.d.ts
197
332
  declare function isVersionUnsupportedBelow(versionStr: string, belowStr: string): boolean | undefined;
198
333
  //#endregion
199
- //#region lib/core/addon/processors.d.ts
200
- type FileEditor = Workspace & {
201
- content: string;
202
- };
203
- type FileType = {
204
- name: (options: Workspace) => string;
205
- condition?: ConditionDefinition;
206
- content: (editor: FileEditor) => string;
207
- };
334
+ //#region lib/addons/common.d.ts
335
+ declare function addToDemoPage(existingContent: string, path: string, language: "ts" | "js"): string;
336
+ /**
337
+ * Returns the corresponding `@types/node` version for the version of Node.js running in the current process.
338
+ *
339
+ * If the installed version of Node.js is from a `Current` release, then the major is decremented to
340
+ * the nearest `LTS` release version.
341
+ */
342
+ declare function getNodeTypesVersion(): string;
343
+ //#endregion
344
+ //#region lib/core/utils.d.ts
345
+ type Printer = (content: string, alt?: string) => string;
346
+ declare function createPrinter(...conditions: boolean[]): Printer[];
208
347
  //#endregion
209
348
  //#region lib/core/tooling/js/ts-estree.d.ts
210
349
  declare module "estree" {
@@ -304,6 +443,7 @@ declare module "estree" {
304
443
  }
305
444
  //#endregion
306
445
  //#region lib/core/tooling/index.d.ts
446
+ declare function parseYaml$1(content: string): ReturnType<typeof yaml.parseDocument>;
307
447
  type CommentType = {
308
448
  type: "Line" | "Block";
309
449
  value: string;
@@ -318,6 +458,24 @@ declare class Comments {
318
458
  }): void;
319
459
  remove(predicate: (comment: estree.Comment) => boolean | undefined | null): void;
320
460
  }
461
+ declare namespace index_d_exports$3 {
462
+ export { addAtRule, addDeclaration, addImports, addRule };
463
+ }
464
+ declare function addRule(node: SvelteAst.CSS.StyleSheet, options: {
465
+ selector: string;
466
+ }): SvelteAst.CSS.Rule;
467
+ declare function addDeclaration(node: SvelteAst.CSS.Rule, options: {
468
+ property: string;
469
+ value: string;
470
+ }): void;
471
+ declare function addImports(node: SvelteAst.CSS.StyleSheet, options: {
472
+ imports: string[];
473
+ }): void;
474
+ declare function addAtRule(node: SvelteAst.CSS.StyleSheet, options: {
475
+ name: string;
476
+ params: string;
477
+ append: boolean;
478
+ }): SvelteAst.CSS.Atrule;
321
479
  declare namespace array_d_exports {
322
480
  export { append, create$1 as create, prepend };
323
481
  }
@@ -466,7 +624,7 @@ declare function addGlobalAppInterface(node: estree.TSProgram, options: {
466
624
  name: "Error" | "Locals" | "PageData" | "PageState" | "Platform";
467
625
  }): estree.TSInterfaceDeclaration;
468
626
  declare function addHooksHandle(node: estree.Program, options: {
469
- typescript: boolean;
627
+ language: "ts" | "js";
470
628
  newHandleName: string;
471
629
  handleContent: string;
472
630
  }): void;
@@ -479,28 +637,118 @@ declare const addPlugin: (ast: estree.Program, options: {
479
637
  mode?: "append" | "prepend";
480
638
  }) => void;
481
639
  declare const getConfig: (ast: estree.Program) => estree.ObjectExpression;
482
- declare namespace index_d_exports {
640
+ declare namespace index_d_exports$2 {
483
641
  export { estree as AstTypes, Comments, array_d_exports as array, common_d_exports as common, exports_d_exports as exports, function_d_exports as functions, imports_d_exports as imports, kit_d_exports as kit, object_d_exports as object, variables_d_exports as variables, vite_d_exports as vite };
484
642
  }
485
643
  declare namespace index_d_exports$1 {
486
- export { SvelteAst, addSlot, ensureScript, toFragment };
644
+ export { addAttribute, addFromRawHtml, appendElement, createElement, insertElement };
645
+ }
646
+ declare function createElement(tagName: string, attributes?: Record<string, string>): SvelteAst.RegularElement;
647
+ declare function addAttribute(element: SvelteAst.RegularElement, name: string, value: string): void;
648
+ declare function insertElement(fragment: SvelteAst.Fragment, elementToInsert: SvelteAst.Fragment["nodes"][0]): void;
649
+ declare function appendElement(fragment: SvelteAst.Fragment, elementToAppend: SvelteAst.Fragment["nodes"][0]): void;
650
+ declare function addFromRawHtml(fragment: SvelteAst.Fragment, html: string): void;
651
+ declare namespace json_d_exports {
652
+ export { arrayUpsert, packageScriptsUpsert };
487
653
  }
654
+ declare function arrayUpsert(data: any, key: string, value: any, options?: {
655
+ /** default: `append` */
656
+ mode?: "append" | "prepend";
657
+ }): void;
658
+ declare function packageScriptsUpsert(data: any, key: string, value: any): void;
659
+ declare namespace index_d_exports {
660
+ export { addFragment, addSlot, ensureScript };
661
+ }
662
+ type RootWithInstance = SvelteAst.Root & {
663
+ instance: SvelteAst.Script;
664
+ };
488
665
  declare function ensureScript(ast: SvelteAst.Root, options?: {
489
- langTs?: boolean;
490
- }): estree.Program;
666
+ language?: "ts" | "js";
667
+ }): asserts ast is RootWithInstance;
491
668
  declare function addSlot(ast: SvelteAst.Root, options: {
492
669
  svelteVersion: string;
493
- langTs?: boolean;
670
+ language?: "ts" | "js";
671
+ }): void;
672
+ declare function addFragment(ast: SvelteAst.Root, content: string, options?: {
673
+ mode?: "append" | "prepend";
494
674
  }): void;
495
- declare function toFragment(content: string): SvelteAst.Fragment["nodes"];
496
675
  //#endregion
497
676
  //#region lib/core/tooling/parsers.d.ts
498
677
  type ParseBase = {
499
678
  source: string;
679
+ /**
680
+ * Generate the code after manipulating the `ast`.
681
+ *
682
+ * ```ts
683
+ * import { svelte } from 'sv/core';
684
+ * const { ast, generateCode } = parse.svelte(content);
685
+ *
686
+ * svelte.addFragment(ast, '<p>Hello World</p>');
687
+ *
688
+ * const code = generateCode();
689
+ * ```
690
+ */
500
691
  generateCode(): string;
501
692
  };
693
+ declare function parseScript(source: string): {
694
+ ast: estree.Program;
695
+ comments: Comments;
696
+ } & ParseBase;
697
+ declare function parseCss(source: string): {
698
+ ast: SvelteAst.CSS.StyleSheet;
699
+ } & ParseBase;
700
+ declare function parseHtml(source: string): {
701
+ ast: SvelteAst.Fragment;
702
+ } & ParseBase;
703
+ declare function parseJson(source: string): {
704
+ data: any;
705
+ } & ParseBase;
706
+ declare function parseYaml(source: string): {
707
+ data: ReturnType<typeof parseYaml$1>;
708
+ } & ParseBase;
502
709
  declare function parseSvelte(source: string): {
503
710
  ast: SvelteAst.Root;
504
711
  } & ParseBase;
712
+ declare function parseToml(source: string): {
713
+ data: TomlTable;
714
+ } & ParseBase;
715
+ //#endregion
716
+ //#region lib/core/addon/processors.d.ts
717
+ type FileEditor = Workspace & {
718
+ content: string;
719
+ };
720
+ type FileType = {
721
+ name: (options: Workspace) => string;
722
+ condition?: ConditionDefinition;
723
+ content: (editor: FileEditor) => string;
724
+ };
725
+ //#endregion
726
+ //#region lib/core.d.ts
727
+ /**
728
+ * Will help you `parse` code into an `ast` from all supported languages.
729
+ * Then manipulate the `ast` as you want,
730
+ * and finally `generateCode()` to write it back to the file.
731
+ *
732
+ * ```ts
733
+ * import { parse } from 'sv/core';
734
+ *
735
+ * const { ast, generateCode } = parse.css('body { color: red; }');
736
+ * const { ast, generateCode } = parse.html('<div>Hello, world!</div>');
737
+ * const { ast, generateCode } = parse.json('{ "name": "John", "age": 30 }');
738
+ * const { ast, generateCode } = parse.script('function add(a, b) { return a + b; }');
739
+ * const { ast, generateCode } = parse.svelte('<div>Hello, world!</div>');
740
+ * const { ast, generateCode } = parse.toml('name = "John"');
741
+ * const { ast, generateCode } = parse.yaml('name: John');
742
+ * ```
743
+ */
744
+ declare const parse: {
745
+ css: typeof parseCss;
746
+ html: typeof parseHtml;
747
+ json: typeof parseJson;
748
+ script: typeof parseScript;
749
+ svelte: typeof parseSvelte;
750
+ toml: typeof parseToml;
751
+ yaml: typeof parseYaml;
752
+ };
505
753
  //#endregion
506
- export { BaseQuestion as A, Tests as C, PackageManager as D, defineAddonOptions as E, OptionValues as F, Question as I, SelectQuestion as L, MultiSelectQuestion as M, NumberQuestion as N, Workspace as O, OptionDefinition as P, StringQuestion as R, TestDefinition as S, defineAddon as T, Highlighter as _, index_d_exports$1 as a, Scripts as b, FileEditor as c, splitVersion as d, utils_d_exports as f, ConditionDefinition as g, AddonWithoutExplicitArgs as h, parseSvelte as i, BooleanQuestion as j, WorkspaceOptions as k, FileType as l, AddonSetupResult as m, dedent as n, index_d_exports as o, Addon as p, log as r, Walker as s, colors as t, isVersionUnsupportedBelow as u, OptionBuilder as v, Verification as w, SvApi as x, PackageDefinition as y };
754
+ export { Question as $, LoadedAddon as A, defineAddon as B, AddonDefinition as C, AddonSource as D, AddonResult as E, SetupResult as F, Workspace as G, getErrorHint as H, SvApi as I, BooleanQuestion as J, WorkspaceOptions as K, TestDefinition as L, PackageDefinition as M, PreparedAddon as N, ConditionDefinition as O, Scripts as P, OptionValues as Q, Tests as R, Addon as S, AddonReference as T, officialAddons as U, defineAddonOptions as V, PackageManager as W, NumberQuestion as X, MultiSelectQuestion as Y, OptionDefinition as Z, addToDemoPage as _, resolveCommand as a, color as b, index_d_exports as c, index_d_exports$2 as d, SelectQuestion as et, index_d_exports$3 as f, createPrinter as g, estree as h, parse as i, OptionBuilder as j, ConfiguredAddon as k, json_d_exports as l, SvelteAst as m, dedent as n, FileEditor as o, Comments as p, BaseQuestion as q, log as r, FileType as s, Walker as t, StringQuestion as tt, index_d_exports$1 as u, getNodeTypesVersion as v, AddonInput as w, fileExists as x, isVersionUnsupportedBelow as y, Verification as z };
@@ -0,0 +1,2 @@
1
+ import { $ as Question, A as LoadedAddon, B as defineAddon, C as AddonDefinition, D as AddonSource, E as AddonResult, F as SetupResult, G as Workspace, H as getErrorHint, I as SvApi, J as BooleanQuestion, K as WorkspaceOptions, L as TestDefinition, M as PackageDefinition, N as PreparedAddon, O as ConditionDefinition, P as Scripts, Q as OptionValues, R as Tests, S as Addon, T as AddonReference, V as defineAddonOptions, W as PackageManager, X as NumberQuestion, Y as MultiSelectQuestion, Z as OptionDefinition, _ as addToDemoPage, a as resolveCommand, b as color, c as index_d_exports$3, d as index_d_exports$2, et as SelectQuestion, f as index_d_exports, g as createPrinter, h as estree, i as parse, j as OptionBuilder, k as ConfiguredAddon, l as json_d_exports, m as SvelteAst, n as dedent, o as FileEditor, p as Comments, q as BaseQuestion, r as log, s as FileType, t as Walker, tt as StringQuestion, u as index_d_exports$1, v as getNodeTypesVersion, w as AddonInput, x as fileExists, y as isVersionUnsupportedBelow, z as Verification } from "../core-CnPhgWST.mjs";
2
+ export { Addon, AddonDefinition, AddonInput, AddonReference, AddonResult, AddonSource, estree as AstTypes, BaseQuestion, BooleanQuestion, Comments, ConditionDefinition, ConfiguredAddon, FileEditor, FileType, LoadedAddon, MultiSelectQuestion, NumberQuestion, OptionBuilder, OptionDefinition, OptionValues, PackageDefinition, PackageManager, PreparedAddon, Question, Scripts, SelectQuestion, SetupResult, StringQuestion, SvApi, SvelteAst, TestDefinition, Tests, Verification, Walker, Workspace, WorkspaceOptions, addToDemoPage, color, createPrinter, index_d_exports as css, dedent, defineAddon, defineAddonOptions, fileExists, getErrorHint, getNodeTypesVersion, index_d_exports$1 as html, isVersionUnsupportedBelow, index_d_exports$2 as js, json_d_exports as json, log, parse, resolveCommand, index_d_exports$3 as svelte };
@@ -0,0 +1,3 @@
1
+ import { $ as getNodeTypesVersion, K as svelte_exports, Q as addToDemoPage, X as createPrinter, Y as css_exports, d as json_exports, et as isVersionUnsupportedBelow, ft as resolveCommand, h as js_exports, l as parse, m as html_exports, nt as defineAddon, ot as walk_exports, r as fileExists, rt as defineAddonOptions, st as dedent_default, t as color, vt as T } from "../utils-DjBRIDJG.mjs";
2
+
3
+ export { walk_exports as Walker, addToDemoPage, color, createPrinter, css_exports as css, dedent_default as dedent, defineAddon, defineAddonOptions, fileExists, getNodeTypesVersion, html_exports as html, isVersionUnsupportedBelow, js_exports as js, json_exports as json, T as log, parse, resolveCommand, svelte_exports as svelte };
@@ -0,0 +1,16 @@
1
+ import { U as officialAddons } from "../core-CnPhgWST.mjs";
2
+ import { i as add, n as InstallOptions, r as OptionMap, t as AddonMap } from "../add-nRRWTjzp.mjs";
3
+
4
+ //#region lib/create/index.d.ts
5
+ type TemplateType = (typeof templateTypes)[number];
6
+ type LanguageType = (typeof languageTypes)[number];
7
+ declare const templateTypes: readonly ["minimal", "demo", "library", "addon"];
8
+ declare const languageTypes: readonly ["typescript", "checkjs", "none"];
9
+ type Options = {
10
+ name: string;
11
+ template: TemplateType;
12
+ types: LanguageType;
13
+ };
14
+ declare function create(cwd: string, options: Options): void;
15
+ //#endregion
16
+ export { type AddonMap, type InstallOptions, type LanguageType, type OptionMap, type TemplateType, add, create, officialAddons };
@@ -1,5 +1,5 @@
1
- import { p as create } from "../package-manager-CySZrSUa.mjs";
2
- import "../core-D715tamU.mjs";
3
- import { i as installAddon, n as officialAddons } from "../official-P5OKi7QM.mjs";
1
+ import { p as create } from "../package-manager-DkCPtZM1.mjs";
2
+ import "../utils-DjBRIDJG.mjs";
3
+ import { c as officialAddons, t as add } from "../add-BWQarWDB.mjs";
4
4
 
5
- export { create, installAddon, officialAddons };
5
+ export { add, create, officialAddons };
@@ -0,0 +1,108 @@
1
+ import "../core-CnPhgWST.mjs";
2
+ import { r as OptionMap, t as AddonMap } from "../add-nRRWTjzp.mjs";
3
+ import { AgentName } from "package-manager-detector";
4
+ import { TestProject } from "vitest/node";
5
+ import { Page } from "@playwright/test";
6
+
7
+ //#region lib/cli/utils/package-manager.d.ts
8
+ declare function addPnpmBuildDependencies(cwd: string, packageManager: AgentName | null | undefined, allowedPackages: string[]): Promise<void>;
9
+ //#endregion
10
+ //#region lib/testing.d.ts
11
+ type ProjectVariant = "kit-js" | "kit-ts" | "vite-js" | "vite-ts";
12
+ declare const variants: ProjectVariant[];
13
+ type CreateProject = (options: {
14
+ testId: string;
15
+ variant: ProjectVariant;
16
+ /** @default true */
17
+ clean?: boolean;
18
+ }) => string;
19
+ type SetupOptions = {
20
+ cwd: string;
21
+ variants: readonly ProjectVariant[];
22
+ /** @default false */
23
+ clean?: boolean;
24
+ };
25
+ declare function setup({
26
+ cwd,
27
+ clean,
28
+ variants
29
+ }: SetupOptions): Promise<{
30
+ templatesDir: string;
31
+ }>;
32
+ type CreateOptions = {
33
+ cwd: string;
34
+ testName: string;
35
+ templatesDir: string;
36
+ };
37
+ declare function createProject({
38
+ cwd,
39
+ testName,
40
+ templatesDir
41
+ }: CreateOptions): CreateProject;
42
+ type PreviewOptions = {
43
+ cwd: string;
44
+ command?: string;
45
+ };
46
+ declare function startPreview({
47
+ cwd,
48
+ command
49
+ }: PreviewOptions): Promise<{
50
+ url: string;
51
+ close: () => Promise<void>;
52
+ }>;
53
+ declare module "vitest" {
54
+ interface ProvidedContext {
55
+ testDir: string;
56
+ templatesDir: string;
57
+ variants: ProjectVariant[];
58
+ }
59
+ }
60
+ declare function setupGlobal({
61
+ TEST_DIR,
62
+ pre,
63
+ post
64
+ }: {
65
+ TEST_DIR: string;
66
+ pre?: () => Promise<void>;
67
+ post?: () => Promise<void>;
68
+ }): ({
69
+ provide
70
+ }: TestProject) => Promise<() => Promise<void>>;
71
+ type Fixtures = {
72
+ page: Page;
73
+ cwd(addonTestCase: AddonTestCase<any>): string;
74
+ };
75
+ type AddonTestCase<Addons extends AddonMap> = {
76
+ variant: ProjectVariant;
77
+ kind: {
78
+ type: string;
79
+ options: OptionMap<Addons>;
80
+ };
81
+ };
82
+ type SetupTestOptions<Addons extends AddonMap> = {
83
+ kinds: Array<AddonTestCase<Addons>["kind"]>;
84
+ filter?: (addonTestCase: AddonTestCase<Addons>) => boolean;
85
+ browser?: boolean;
86
+ preAdd?: (o: {
87
+ addonTestCase: AddonTestCase<Addons>;
88
+ cwd: string;
89
+ }) => Promise<void> | void;
90
+ };
91
+ type PrepareServerOptions = {
92
+ cwd: string;
93
+ page: Page;
94
+ buildCommand?: string;
95
+ previewCommand?: string;
96
+ };
97
+ type PrepareServerReturn = {
98
+ url: string;
99
+ close: () => Promise<void>;
100
+ };
101
+ declare function prepareServer({
102
+ cwd,
103
+ page,
104
+ buildCommand,
105
+ previewCommand
106
+ }: PrepareServerOptions): Promise<PrepareServerReturn>;
107
+ //#endregion
108
+ export { AddonTestCase, CreateProject, Fixtures, PrepareServerOptions, PrepareServerReturn, ProjectVariant, SetupTestOptions, addPnpmBuildDependencies, createProject, prepareServer, setup, setupGlobal, startPreview, variants };