sv 0.12.0 → 0.12.2

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.
@@ -1,14 +1,186 @@
1
+ import { TomlTable } from "smol-toml";
2
+ import * as estree from "estree";
3
+ import { BaseNode as BaseNode$1 } from "estree";
4
+ import { AST as SvelteAst } from "svelte/compiler";
5
+ import * as yaml from "yaml";
1
6
  import { log } from "@clack/prompts";
2
7
  import dedent from "dedent";
3
8
  import * as Walker from "zimmerframe";
4
9
  import { AgentName } from "package-manager-detector";
5
10
  import { resolveCommand } from "package-manager-detector/commands";
6
- import * as estree from "estree";
7
- import { BaseNode as BaseNode$1 } from "estree";
8
- import { AST as SvelteAst } from "svelte/compiler";
9
- import * as yaml from "yaml";
10
- import { TomlTable } from "smol-toml";
11
11
 
12
+ //#region lib/core/tooling/js/ts-estree.d.ts
13
+ declare module "estree" {
14
+ interface TSTypeAnnotation {
15
+ type: "TSTypeAnnotation";
16
+ typeAnnotation: TSStringKeyword | TSTypeReference | TSUnionType | TSIndexedAccessType;
17
+ }
18
+ interface TSStringKeyword {
19
+ type: "TSStringKeyword";
20
+ }
21
+ interface TSNullKeyword {
22
+ type: "TSNullKeyword";
23
+ }
24
+ interface TSTypeReference {
25
+ type: "TSTypeReference";
26
+ typeName: Identifier;
27
+ }
28
+ interface TSAsExpression extends BaseNode {
29
+ type: "TSAsExpression";
30
+ expression: Expression;
31
+ typeAnnotation: TSTypeAnnotation["typeAnnotation"];
32
+ }
33
+ interface TSModuleDeclaration extends BaseNode {
34
+ type: "TSModuleDeclaration";
35
+ global: boolean;
36
+ declare: boolean;
37
+ id: Identifier;
38
+ body: TSModuleBlock;
39
+ }
40
+ interface TSModuleBlock extends BaseNode {
41
+ type: "TSModuleBlock";
42
+ body: Array<TSModuleDeclaration | TSInterfaceDeclaration>;
43
+ }
44
+ interface TSInterfaceDeclaration extends BaseNode {
45
+ type: "TSInterfaceDeclaration";
46
+ id: Identifier;
47
+ body: TSInterfaceBody;
48
+ }
49
+ interface TSInterfaceBody extends BaseNode {
50
+ type: "TSInterfaceBody";
51
+ body: TSPropertySignature[];
52
+ }
53
+ interface TSPropertySignature extends BaseNode {
54
+ type: "TSPropertySignature";
55
+ computed: boolean;
56
+ key: Identifier;
57
+ optional?: boolean;
58
+ typeAnnotation: TSTypeAnnotation;
59
+ }
60
+ interface TSProgram extends Omit<Program, "body"> {
61
+ body: Array<Directive | Statement | ModuleDeclaration | TSModuleDeclaration>;
62
+ }
63
+ interface TSUnionType {
64
+ type: "TSUnionType";
65
+ types: Array<TSNullKeyword | TSTypeReference | TSImportType>;
66
+ }
67
+ interface TSImportType {
68
+ type: "TSImportType";
69
+ argument: Literal;
70
+ qualifier: Identifier;
71
+ }
72
+ interface TSIndexedAccessType {
73
+ type: "TSIndexedAccessType";
74
+ objectType: TSImportType;
75
+ indexType: TSLiteralType;
76
+ }
77
+ interface TSLiteralType {
78
+ type: "TSLiteralType";
79
+ literal: Literal;
80
+ }
81
+ interface TSSatisfiesExpression extends BaseNode {
82
+ type: "TSSatisfiesExpression";
83
+ expression: Expression;
84
+ typeAnnotation: TSTypeAnnotation["typeAnnotation"];
85
+ }
86
+ interface BaseNodeWithoutComments {
87
+ type: string;
88
+ loc?: SourceLocation | null | undefined;
89
+ range?: [number, number] | undefined;
90
+ start?: number;
91
+ end?: number;
92
+ }
93
+ interface Identifier {
94
+ typeAnnotation?: TSTypeAnnotation;
95
+ }
96
+ interface ExpressionMap {
97
+ TSAsExpression: TSAsExpression;
98
+ TSSatisfiesExpression: TSSatisfiesExpression;
99
+ }
100
+ interface NodeMap {
101
+ TSModuleDeclaration: TSModuleDeclaration;
102
+ TSInterfaceDeclaration: TSInterfaceDeclaration;
103
+ }
104
+ interface ImportDeclaration {
105
+ importKind: "type" | "value";
106
+ }
107
+ }
108
+ //#endregion
109
+ //#region lib/core/tooling/index.d.ts
110
+ declare function parseYaml$1(content: string): ReturnType<typeof yaml.parseDocument>;
111
+ type CommentType = {
112
+ type: "Line" | "Block";
113
+ value: string;
114
+ };
115
+ declare class Comments {
116
+ private original;
117
+ private leading;
118
+ private trailing;
119
+ constructor();
120
+ add(node: BaseNode$1, comment: CommentType, options?: {
121
+ position?: "leading" | "trailing";
122
+ }): void;
123
+ remove(predicate: (comment: estree.Comment) => boolean | undefined | null): void;
124
+ }
125
+ //#endregion
126
+ //#region lib/core/tooling/parsers.d.ts
127
+ type ParseBase = {
128
+ source: string;
129
+ /**
130
+ * Generate the code after manipulating the `ast`.
131
+ *
132
+ * ```ts
133
+ * import { svelte } from 'sv/core';
134
+ * const { ast, generateCode } = parse.svelte(content);
135
+ *
136
+ * svelte.addFragment(ast, '<p>Hello World</p>');
137
+ *
138
+ * const code = generateCode();
139
+ * ```
140
+ */
141
+ generateCode(): string;
142
+ };
143
+ declare function parseScript(source: string): {
144
+ ast: estree.Program;
145
+ comments: Comments;
146
+ } & ParseBase;
147
+ declare function parseCss(source: string): {
148
+ ast: Omit<SvelteAst.CSS.StyleSheetBase, "attributes" | "content">;
149
+ } & ParseBase;
150
+ declare function parseHtml(source: string): {
151
+ ast: SvelteAst.Fragment;
152
+ } & ParseBase;
153
+ declare function parseJson(source: string): {
154
+ data: any;
155
+ } & ParseBase;
156
+ declare function parseYaml(source: string): {
157
+ data: ReturnType<typeof parseYaml$1>;
158
+ } & ParseBase;
159
+ declare function parseSvelte(source: string): {
160
+ ast: SvelteAst.Root;
161
+ } & ParseBase;
162
+ declare function parseToml(source: string): {
163
+ data: TomlTable;
164
+ } & ParseBase;
165
+ //#endregion
166
+ //#region lib/addons/_engine/official.d.ts
167
+ type OfficialAddons = {
168
+ prettier: Addon<any>;
169
+ eslint: Addon<any>;
170
+ vitest: Addon<any>;
171
+ playwright: Addon<any>;
172
+ tailwindcss: Addon<any>;
173
+ sveltekitAdapter: Addon<any>;
174
+ devtoolsJson: Addon<any>;
175
+ drizzle: Addon<any>;
176
+ betterAuth: Addon<any>;
177
+ mdsvex: Addon<any>;
178
+ paraglide: Addon<any>;
179
+ storybook: Addon<any>;
180
+ mcp: Addon<any>;
181
+ };
182
+ declare const officialAddons: OfficialAddons;
183
+ //#endregion
12
184
  //#region lib/core/addon/options.d.ts
13
185
  type BooleanQuestion = {
14
186
  type: "boolean";
@@ -103,24 +275,6 @@ type Workspace = {
103
275
  };
104
276
  type PackageManager = "npm" | "yarn" | "pnpm" | "bun" | "deno";
105
277
  //#endregion
106
- //#region lib/addons/_engine/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
- betterAuth: 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
124
278
  //#region lib/core/addon/config.d.ts
125
279
  type ConditionDefinition = (Workspace: Workspace) => boolean;
126
280
  type PackageDefinition = {
@@ -349,134 +503,20 @@ declare function getNodeTypesVersion(): string;
349
503
  //#region lib/core/utils.d.ts
350
504
  type Printer = (content: string, alt?: string) => string;
351
505
  declare function createPrinter(...conditions: boolean[]): Printer[];
352
- //#endregion
353
- //#region lib/core/tooling/js/ts-estree.d.ts
354
- declare module "estree" {
355
- interface TSTypeAnnotation {
356
- type: "TSTypeAnnotation";
357
- typeAnnotation: TSStringKeyword | TSTypeReference | TSUnionType | TSIndexedAccessType;
358
- }
359
- interface TSStringKeyword {
360
- type: "TSStringKeyword";
361
- }
362
- interface TSNullKeyword {
363
- type: "TSNullKeyword";
364
- }
365
- interface TSTypeReference {
366
- type: "TSTypeReference";
367
- typeName: Identifier;
368
- }
369
- interface TSAsExpression extends BaseNode {
370
- type: "TSAsExpression";
371
- expression: Expression;
372
- typeAnnotation: TSTypeAnnotation["typeAnnotation"];
373
- }
374
- interface TSModuleDeclaration extends BaseNode {
375
- type: "TSModuleDeclaration";
376
- global: boolean;
377
- declare: boolean;
378
- id: Identifier;
379
- body: TSModuleBlock;
380
- }
381
- interface TSModuleBlock extends BaseNode {
382
- type: "TSModuleBlock";
383
- body: Array<TSModuleDeclaration | TSInterfaceDeclaration>;
384
- }
385
- interface TSInterfaceDeclaration extends BaseNode {
386
- type: "TSInterfaceDeclaration";
387
- id: Identifier;
388
- body: TSInterfaceBody;
389
- }
390
- interface TSInterfaceBody extends BaseNode {
391
- type: "TSInterfaceBody";
392
- body: TSPropertySignature[];
393
- }
394
- interface TSPropertySignature extends BaseNode {
395
- type: "TSPropertySignature";
396
- computed: boolean;
397
- key: Identifier;
398
- optional?: boolean;
399
- typeAnnotation: TSTypeAnnotation;
400
- }
401
- interface TSProgram extends Omit<Program, "body"> {
402
- body: Array<Directive | Statement | ModuleDeclaration | TSModuleDeclaration>;
403
- }
404
- interface TSUnionType {
405
- type: "TSUnionType";
406
- types: Array<TSNullKeyword | TSTypeReference | TSImportType>;
407
- }
408
- interface TSImportType {
409
- type: "TSImportType";
410
- argument: Literal;
411
- qualifier: Identifier;
412
- }
413
- interface TSIndexedAccessType {
414
- type: "TSIndexedAccessType";
415
- objectType: TSImportType;
416
- indexType: TSLiteralType;
417
- }
418
- interface TSLiteralType {
419
- type: "TSLiteralType";
420
- literal: Literal;
421
- }
422
- interface TSSatisfiesExpression extends BaseNode {
423
- type: "TSSatisfiesExpression";
424
- expression: Expression;
425
- typeAnnotation: TSTypeAnnotation["typeAnnotation"];
426
- }
427
- interface BaseNodeWithoutComments {
428
- type: string;
429
- loc?: SourceLocation | null | undefined;
430
- range?: [number, number] | undefined;
431
- start?: number;
432
- end?: number;
433
- }
434
- interface Identifier {
435
- typeAnnotation?: TSTypeAnnotation;
436
- }
437
- interface ExpressionMap {
438
- TSAsExpression: TSAsExpression;
439
- TSSatisfiesExpression: TSSatisfiesExpression;
440
- }
441
- interface NodeMap {
442
- TSModuleDeclaration: TSModuleDeclaration;
443
- TSInterfaceDeclaration: TSInterfaceDeclaration;
444
- }
445
- interface ImportDeclaration {
446
- importKind: "type" | "value";
447
- }
448
- }
449
- //#endregion
450
- //#region lib/core/tooling/index.d.ts
451
- declare function parseYaml$1(content: string): ReturnType<typeof yaml.parseDocument>;
452
- type CommentType = {
453
- type: "Line" | "Block";
454
- value: string;
455
- };
456
- declare class Comments {
457
- private original;
458
- private leading;
459
- private trailing;
460
- constructor();
461
- add(node: BaseNode$1, comment: CommentType, options?: {
462
- position?: "leading" | "trailing";
463
- }): void;
464
- remove(predicate: (comment: estree.Comment) => boolean | undefined | null): void;
465
- }
466
506
  declare namespace index_d_exports$3 {
467
507
  export { addAtRule, addDeclaration, addImports, addRule };
468
508
  }
469
- declare function addRule(node: SvelteAst.CSS.StyleSheet, options: {
509
+ declare function addRule(node: SvelteAst.CSS.StyleSheetBase, options: {
470
510
  selector: string;
471
511
  }): SvelteAst.CSS.Rule;
472
512
  declare function addDeclaration(node: SvelteAst.CSS.Rule, options: {
473
513
  property: string;
474
514
  value: string;
475
515
  }): void;
476
- declare function addImports(node: SvelteAst.CSS.StyleSheet, options: {
516
+ declare function addImports(node: SvelteAst.CSS.StyleSheetBase, options: {
477
517
  imports: string[];
478
518
  }): void;
479
- declare function addAtRule(node: SvelteAst.CSS.StyleSheet, options: {
519
+ declare function addAtRule(node: SvelteAst.CSS.StyleSheetBase, options: {
480
520
  name: string;
481
521
  params: string;
482
522
  append: boolean;
@@ -504,7 +544,7 @@ declare function propertyNode<T extends estree.Expression | estree.Identifier>(n
504
544
  declare function create(properties: ObjectMap): estree.ObjectExpression;
505
545
  declare function overrideProperties(objectExpression: estree.ObjectExpression, properties: ObjectMap): void;
506
546
  declare namespace common_d_exports {
507
- export { addJsDocComment, addJsDocTypeComment, appendFromString, appendStatement, areNodesEqual, contains, createBlockStatement, createExpressionStatement, createLiteral, createSatisfies, createSpread, hasTypeProperty, parseExpression, parseFromString, parseStatement, typeAnnotate };
547
+ export { addJsDocComment, addJsDocTypeComment, appendFromString, appendStatement, areNodesEqual, contains, createBlockStatement, createExpressionStatement, createLiteral, createSatisfies, createSpread, createTypeProperty, hasTypeProperty, parseExpression, parseFromString, parseStatement, typeAnnotate };
508
548
  }
509
549
  declare function addJsDocTypeComment(node: estree.Node, comments: Comments, options: {
510
550
  type: string;
@@ -541,6 +581,7 @@ declare function contains(node: estree.Node, targetNode: estree.Node): boolean;
541
581
  declare function hasTypeProperty(node: estree.TSInterfaceDeclaration["body"]["body"][number], options: {
542
582
  name: string;
543
583
  }): boolean;
584
+ declare function createTypeProperty(name: string, value: string, optional?: boolean): estree.TSInterfaceBody["body"][number];
544
585
  declare namespace function_d_exports {
545
586
  export { createArrow, createCall, getArgument };
546
587
  }
@@ -706,46 +747,6 @@ declare function addFragment(ast: SvelteAst.Root, content: string, options?: {
706
747
  mode?: "append" | "prepend";
707
748
  }): void;
708
749
  //#endregion
709
- //#region lib/core/tooling/parsers.d.ts
710
- type ParseBase = {
711
- source: string;
712
- /**
713
- * Generate the code after manipulating the `ast`.
714
- *
715
- * ```ts
716
- * import { svelte } from 'sv/core';
717
- * const { ast, generateCode } = parse.svelte(content);
718
- *
719
- * svelte.addFragment(ast, '<p>Hello World</p>');
720
- *
721
- * const code = generateCode();
722
- * ```
723
- */
724
- generateCode(): string;
725
- };
726
- declare function parseScript(source: string): {
727
- ast: estree.Program;
728
- comments: Comments;
729
- } & ParseBase;
730
- declare function parseCss(source: string): {
731
- ast: SvelteAst.CSS.StyleSheet;
732
- } & ParseBase;
733
- declare function parseHtml(source: string): {
734
- ast: SvelteAst.Fragment;
735
- } & ParseBase;
736
- declare function parseJson(source: string): {
737
- data: any;
738
- } & ParseBase;
739
- declare function parseYaml(source: string): {
740
- data: ReturnType<typeof parseYaml$1>;
741
- } & ParseBase;
742
- declare function parseSvelte(source: string): {
743
- ast: SvelteAst.Root;
744
- } & ParseBase;
745
- declare function parseToml(source: string): {
746
- data: TomlTable;
747
- } & ParseBase;
748
- //#endregion
749
750
  //#region lib/core/addon/processors.d.ts
750
751
  type FileEditor = Workspace & {
751
752
  content: string;
@@ -784,4 +785,4 @@ declare const parse: {
784
785
  yaml: typeof parseYaml;
785
786
  };
786
787
  //#endregion
787
- export { OptionValues as $, ConfiguredAddon as A, Verification as B, Addon as C, AddonResult as D, AddonReference as E, Scripts as F, PackageManager as G, defineAddonOptions as H, SetupResult as I, BaseQuestion as J, Workspace as K, SvApi as L, OptionBuilder as M, PackageDefinition as N, AddonSource as O, PreparedAddon as P, OptionDefinition as Q, TestDefinition as R, fileExists as S, AddonInput as T, getErrorHint as U, defineAddon as V, officialAddons as W, MultiSelectQuestion as X, BooleanQuestion as Y, NumberQuestion as Z, createPrinter as _, resolveCommand as a, isVersionUnsupportedBelow as b, index_d_exports as c, index_d_exports$1 as d, Question as et, index_d_exports$2 as f, estree as g, SvelteAst as h, parse as i, LoadedAddon as j, ConditionDefinition as k, json_d_exports as l, Comments as m, dedent as n, StringQuestion as nt, FileEditor as o, index_d_exports$3 as p, WorkspaceOptions as q, log as r, FileType as s, Walker as t, SelectQuestion as tt, text_d_exports as u, addToDemoPage as v, AddonDefinition as w, color as x, getNodeTypesVersion as y, Tests as z };
788
+ export { officialAddons as $, PackageDefinition as A, getErrorHint as B, AddonReference as C, ConfiguredAddon as D, ConditionDefinition as E, TestDefinition as F, BooleanQuestion as G, Workspace as H, Tests as I, OptionDefinition as J, MultiSelectQuestion as K, Verification as L, Scripts as M, SetupResult as N, LoadedAddon as O, SvApi as P, StringQuestion as Q, defineAddon as R, AddonInput as S, AddonSource as T, WorkspaceOptions as U, PackageManager as V, BaseQuestion as W, Question as X, OptionValues as Y, SelectQuestion as Z, isVersionUnsupportedBelow as _, resolveCommand as a, Addon as b, index_d_exports as c, index_d_exports$1 as d, Comments as et, index_d_exports$2 as f, getNodeTypesVersion as g, addToDemoPage as h, parse as i, PreparedAddon as j, OptionBuilder as k, json_d_exports as l, createPrinter as m, dedent as n, estree as nt, FileEditor as o, index_d_exports$3 as p, NumberQuestion as q, log as r, FileType as s, Walker as t, SvelteAst as tt, text_d_exports as u, color as v, AddonResult as w, AddonDefinition as x, fileExists as y, defineAddonOptions as z };
@@ -1,2 +1,2 @@
1
- import { $ as OptionValues, A as ConfiguredAddon, B as Verification, C as Addon, D as AddonResult, E as AddonReference, F as Scripts, G as PackageManager, H as defineAddonOptions, I as SetupResult, J as BaseQuestion, K as Workspace, L as SvApi, M as OptionBuilder, N as PackageDefinition, O as AddonSource, P as PreparedAddon, Q as OptionDefinition, R as TestDefinition, S as fileExists, T as AddonInput, U as getErrorHint, V as defineAddon, X as MultiSelectQuestion, Y as BooleanQuestion, Z as NumberQuestion, _ as createPrinter, a as resolveCommand, b as isVersionUnsupportedBelow, c as index_d_exports$3, d as index_d_exports$1, et as Question, f as index_d_exports$2, g as estree, h as SvelteAst, i as parse, j as LoadedAddon, k as ConditionDefinition, l as json_d_exports, m as Comments, n as dedent, nt as StringQuestion, o as FileEditor, p as index_d_exports, q as WorkspaceOptions, r as log, s as FileType, t as Walker, tt as SelectQuestion, u as text_d_exports, v as addToDemoPage, w as AddonDefinition, x as color, y as getNodeTypesVersion, z as Tests } from "../core-DjIj3YV4.mjs";
1
+ import { A as PackageDefinition, B as getErrorHint, C as AddonReference, D as ConfiguredAddon, E as ConditionDefinition, F as TestDefinition, G as BooleanQuestion, H as Workspace, I as Tests, J as OptionDefinition, K as MultiSelectQuestion, L as Verification, M as Scripts, N as SetupResult, O as LoadedAddon, P as SvApi, Q as StringQuestion, R as defineAddon, S as AddonInput, T as AddonSource, U as WorkspaceOptions, V as PackageManager, W as BaseQuestion, X as Question, Y as OptionValues, Z as SelectQuestion, _ as isVersionUnsupportedBelow, a as resolveCommand, b as Addon, c as index_d_exports$3, d as index_d_exports$1, et as Comments, f as index_d_exports$2, g as getNodeTypesVersion, h as addToDemoPage, i as parse, j as PreparedAddon, k as OptionBuilder, l as json_d_exports, m as createPrinter, n as dedent, nt as estree, o as FileEditor, p as index_d_exports, q as NumberQuestion, r as log, s as FileType, t as Walker, tt as SvelteAst, u as text_d_exports, v as color, w as AddonResult, x as AddonDefinition, y as fileExists, z as defineAddonOptions } from "../core-VSHdSalh.mjs";
2
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, text_d_exports as text };
package/dist/lib/core.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as createPrinter, Q as css_exports, St as R, X as svelte_exports, _ as js_exports, at as defineAddon, d as json_exports, g as html_exports, ht as resolveCommand, l as parse, lt as walk_exports, nt as getNodeTypesVersion, ot as defineAddonOptions, p as text_exports, r as fileExists, rt as isVersionUnsupportedBelow, t as color, tt as addToDemoPage, ut as dedent_default } from "../utils-CnfD6Z1s.mjs";
1
+ import { $ as svelte_exports, B as css_exports, Ct as R, G as isVersionUnsupportedBelow, J as defineAddonOptions, U as addToDemoPage, V as createPrinter, W as getNodeTypesVersion, _ as js_exports, d as json_exports, dt as walk_exports, g as html_exports, gt as resolveCommand, l as parse, lt as dedent_default, p as text_exports, q as defineAddon, r as fileExists, t as color } from "../utils-D-OWcBXG.mjs";
2
2
 
3
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, R as log, parse, resolveCommand, svelte_exports as svelte, text_exports as text };
@@ -1,5 +1,5 @@
1
- import { W as officialAddons } from "../core-DjIj3YV4.mjs";
2
- import { i as add, n as InstallOptions, r as OptionMap, t as AddonMap } from "../add-DbK6niIm.mjs";
1
+ import { $ as officialAddons } from "../core-VSHdSalh.mjs";
2
+ import { i as add, n as InstallOptions, r as OptionMap, t as AddonMap } from "../add-BP-WJ6Sw.mjs";
3
3
 
4
4
  //#region lib/create/index.d.ts
5
5
  type TemplateType = (typeof templateTypes)[number];
@@ -1,5 +1,5 @@
1
- import { p as create } from "../package-manager-DYfxv5nk.mjs";
2
- import "../utils-CnfD6Z1s.mjs";
3
- import { c as officialAddons, t as add } from "../add-CrUK5jc7.mjs";
1
+ import "../utils-D-OWcBXG.mjs";
2
+ import { p as create } from "../package-manager-B3sMOeTk.mjs";
3
+ import { c as officialAddons, t as add } from "../add-RNKqR0_d.mjs";
4
4
 
5
5
  export { add, create, officialAddons };
@@ -1,8 +1,8 @@
1
- import "../core-DjIj3YV4.mjs";
2
- import { r as OptionMap, t as AddonMap } from "../add-DbK6niIm.mjs";
1
+ import "../core-VSHdSalh.mjs";
2
+ import { r as OptionMap, t as AddonMap } from "../add-BP-WJ6Sw.mjs";
3
3
  import { AgentName } from "package-manager-detector";
4
- import { TestProject } from "vitest/node";
5
4
  import { Page } from "@playwright/test";
5
+ import { TestProject } from "vitest/node";
6
6
 
7
7
  //#region lib/cli/utils/package-manager.d.ts
8
8
 
@@ -1,6 +1,6 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "../chunk-BcJDCUAU.mjs";
2
- import { n as addPnpmBuildDependencies, p as create } from "../package-manager-DYfxv5nk.mjs";
3
- import { dt as K, ft as q } from "../utils-CnfD6Z1s.mjs";
2
+ import { ft as K, pt as q } from "../utils-D-OWcBXG.mjs";
3
+ import { n as addPnpmBuildDependencies, p as create } from "../package-manager-B3sMOeTk.mjs";
4
4
  import fs from "node:fs";
5
5
  import path from "node:path";
6
6
  import process$1 from "node:process";
@@ -1,64 +1,12 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-BcJDCUAU.mjs";
2
- import { Dt as zt, Et as qt, Ot as Ct, bt as Pt, ft as q, l as parse, mt as constructCommand, n as commonFilePaths, pt as COMMANDS, rt as isVersionUnsupportedBelow, t as color } from "./utils-CnfD6Z1s.mjs";
2
+ import { Dt as qt, G as isVersionUnsupportedBelow, Ot as zt, ht as constructCommand, kt as Ct, l as parse, mt as COMMANDS, n as commonFilePaths, pt as q, t as color, xt as Pt } from "./utils-D-OWcBXG.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import fs, { existsSync } from "node:fs";
5
5
  import path, { dirname, isAbsolute, join, resolve } from "node:path";
6
- import { fileURLToPath } from "node:url";
7
6
  import process from "node:process";
8
7
  import fs$1 from "node:fs/promises";
8
+ import { fileURLToPath } from "node:url";
9
9
 
10
- //#region lib/create/utils.ts
11
- function mkdirp(dir) {
12
- try {
13
- fs.mkdirSync(dir, { recursive: true });
14
- } catch (err) {
15
- const e = err;
16
- if (e.code === "EEXIST") return;
17
- throw e;
18
- }
19
- }
20
- function identity(x) {
21
- return x;
22
- }
23
- function replace(contents, kv$1) {
24
- for (const [key, value] of Object.entries(kv$1)) contents = contents.replaceAll(key, value);
25
- return contents;
26
- }
27
- function kv(name) {
28
- const protocolName = name.startsWith("@") ? name.split("/")[0] : name;
29
- return {
30
- "~SV-PROTOCOL-NAME-TODO~": protocolName,
31
- "~SV-NAME-TODO~": name
32
- };
33
- }
34
- const withReplaceExtensions = [
35
- ".md",
36
- ".js",
37
- ".ts",
38
- ".json"
39
- ];
40
- function copy(from$1, to, rename = identity, kv$1 = {}) {
41
- if (!fs.existsSync(from$1)) return;
42
- if (fs.statSync(from$1).isDirectory()) fs.readdirSync(from$1).forEach((file) => {
43
- copy(path.join(from$1, file), path.join(to, rename(file)), rename, kv$1);
44
- });
45
- else {
46
- mkdirp(path.dirname(to));
47
- if (withReplaceExtensions.some((ext) => from$1.endsWith(ext))) fs.writeFileSync(to, replace(fs.readFileSync(from$1, "utf-8"), kv$1));
48
- else fs.copyFileSync(from$1, to);
49
- }
50
- }
51
- function dist(path$2) {
52
- const insideDistFolder = import.meta.url.includes("dist");
53
- return fileURLToPath(new URL(`./${!insideDistFolder ? "dist/" : ""}${path$2}`, import.meta.url).href);
54
- }
55
- function getSharedFiles() {
56
- const shared = dist("shared.json");
57
- const { files } = JSON.parse(fs.readFileSync(shared, "utf-8"));
58
- return files;
59
- }
60
-
61
- //#endregion
62
10
  //#region ../../node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/constants.mjs
63
11
  const AGENTS = [
64
12
  "npm",
@@ -215,6 +163,58 @@ function isMetadataYarnClassic(metadataPath) {
215
163
  return metadataPath.endsWith(".yarn_integrity");
216
164
  }
217
165
 
166
+ //#endregion
167
+ //#region lib/create/utils.ts
168
+ function mkdirp(dir) {
169
+ try {
170
+ fs.mkdirSync(dir, { recursive: true });
171
+ } catch (err) {
172
+ const e = err;
173
+ if (e.code === "EEXIST") return;
174
+ throw e;
175
+ }
176
+ }
177
+ function identity(x) {
178
+ return x;
179
+ }
180
+ function replace(contents, kv$1) {
181
+ for (const [key, value] of Object.entries(kv$1)) contents = contents.replaceAll(key, value);
182
+ return contents;
183
+ }
184
+ function kv(name) {
185
+ const protocolName = name.startsWith("@") ? name.split("/")[0] : name;
186
+ return {
187
+ "~SV-PROTOCOL-NAME-TODO~": protocolName,
188
+ "~SV-NAME-TODO~": name
189
+ };
190
+ }
191
+ const withReplaceExtensions = [
192
+ ".md",
193
+ ".js",
194
+ ".ts",
195
+ ".json"
196
+ ];
197
+ function copy(from$1, to, rename = identity, kv$1 = {}) {
198
+ if (!fs.existsSync(from$1)) return;
199
+ if (fs.statSync(from$1).isDirectory()) fs.readdirSync(from$1).forEach((file) => {
200
+ copy(path.join(from$1, file), path.join(to, rename(file)), rename, kv$1);
201
+ });
202
+ else {
203
+ mkdirp(path.dirname(to));
204
+ if (withReplaceExtensions.some((ext) => from$1.endsWith(ext))) fs.writeFileSync(to, replace(fs.readFileSync(from$1, "utf-8"), kv$1));
205
+ else fs.copyFileSync(from$1, to);
206
+ }
207
+ }
208
+ function dist(path$2) {
209
+ const insideDistFolder = import.meta.url.includes("dist");
210
+ return fileURLToPath(new URL(`./${!insideDistFolder ? "dist/" : ""}${path$2}`, import.meta.url).href);
211
+ }
212
+ function getSharedFiles() {
213
+ const shared = dist("shared.json");
214
+ const { files } = JSON.parse(fs.readFileSync(shared, "utf-8"));
215
+ return files;
216
+ }
217
+
218
218
  //#endregion
219
219
  //#region lib/core/sanitize.ts
220
220
  /**
@@ -1,7 +1,6 @@
1
1
  import { expect } from '@playwright/test';
2
2
  import fs from 'node:fs';
3
3
  import path from 'node:path';
4
-
5
4
  import addon from '../src/index.js';
6
5
  import { setupTest } from './setup/suite.js';
7
6
 
@@ -1,11 +1,10 @@
1
+ import { chromium } from '@playwright/test';
2
+ import { execSync } from 'node:child_process';
1
3
  import fs from 'node:fs';
2
4
  import path from 'node:path';
3
- import { execSync } from 'node:child_process';
4
- import { inject, test as vitestTest, beforeAll, beforeEach } from 'vitest';
5
- import { chromium } from '@playwright/test';
6
-
7
5
  import { add } from 'sv';
8
6
  import { createProject, addPnpmBuildDependencies, prepareServer } from 'sv/testing';
7
+ import { inject, test as vitestTest, beforeAll, beforeEach } from 'vitest';
9
8
 
10
9
  const cwd = inject('testDir');
11
10
  const templatesDir = inject('templatesDir');
@@ -50,7 +49,7 @@ export function setupTest(addons, options) {
50
49
  }
51
50
  /** @type {string} */
52
51
  let testName;
53
- beforeAll(async ({ name }) => {
52
+ test.beforeAll(async ({ name }) => {
54
53
  testName = path.dirname(name).split('/').at(-1) ?? '';
55
54
 
56
55
  // constructs a builder to create test projects
@@ -33,7 +33,7 @@
33
33
  },
34
34
  {
35
35
  "name": "src/routes/sverdle/+page.server.ts",
36
- "contents": "import { fail } from '@sveltejs/kit';\n\nimport type { Actions, PageServerLoad } from './$types';\nimport { Game } from './game.ts';\n\nexport const load = (({ cookies }) => {\n\tconst game = new Game(cookies.get('sverdle'));\n\n\treturn {\n\t\t/**\n\t\t * The player's guessed words so far\n\t\t */\n\t\tguesses: game.guesses,\n\n\t\t/**\n\t\t * An array of strings like '__x_c' corresponding to the guesses, where 'x' means\n\t\t * an exact match, and 'c' means a close match (right letter, wrong place)\n\t\t */\n\t\tanswers: game.answers,\n\n\t\t/**\n\t\t * The correct answer, revealed if the game is over\n\t\t */\n\t\tanswer: game.answers.length >= 6 ? game.answer : null\n\t};\n}) satisfies PageServerLoad;\n\nexport const actions = {\n\t/**\n\t * Modify game state in reaction to a keypress. If client-side JavaScript\n\t * is available, this will happen in the browser instead of here\n\t */\n\tupdate: async ({ request, cookies }) => {\n\t\tconst game = new Game(cookies.get('sverdle'));\n\n\t\tconst data = await request.formData();\n\t\tconst key = data.get('key');\n\n\t\tconst i = game.answers.length;\n\n\t\tif (key === 'backspace') {\n\t\t\tgame.guesses[i] = game.guesses[i].slice(0, -1);\n\t\t} else {\n\t\t\tgame.guesses[i] += key;\n\t\t}\n\n\t\tcookies.set('sverdle', game.toString(), { path: '/' });\n\t},\n\n\t/**\n\t * Modify game state in reaction to a guessed word. This logic always runs on\n\t * the server, so that people can't cheat by peeking at the JavaScript\n\t */\n\tenter: async ({ request, cookies }) => {\n\t\tconst game = new Game(cookies.get('sverdle'));\n\n\t\tconst data = await request.formData();\n\t\tconst guess = data.getAll('guess') as string[];\n\n\t\tif (!game.enter(guess)) {\n\t\t\treturn fail(400, { badGuess: true });\n\t\t}\n\n\t\tcookies.set('sverdle', game.toString(), { path: '/' });\n\t},\n\n\trestart: async ({ cookies }) => {\n\t\tcookies.delete('sverdle', { path: '/' });\n\t}\n} satisfies Actions;\n"
36
+ "contents": "import { fail } from '@sveltejs/kit';\nimport type { Actions, PageServerLoad } from './$types';\nimport { Game } from './game.ts';\n\nexport const load = (({ cookies }) => {\n\tconst game = new Game(cookies.get('sverdle'));\n\n\treturn {\n\t\t/**\n\t\t * The player's guessed words so far\n\t\t */\n\t\tguesses: game.guesses,\n\n\t\t/**\n\t\t * An array of strings like '__x_c' corresponding to the guesses, where 'x' means\n\t\t * an exact match, and 'c' means a close match (right letter, wrong place)\n\t\t */\n\t\tanswers: game.answers,\n\n\t\t/**\n\t\t * The correct answer, revealed if the game is over\n\t\t */\n\t\tanswer: game.answers.length >= 6 ? game.answer : null\n\t};\n}) satisfies PageServerLoad;\n\nexport const actions = {\n\t/**\n\t * Modify game state in reaction to a keypress. If client-side JavaScript\n\t * is available, this will happen in the browser instead of here\n\t */\n\tupdate: async ({ request, cookies }) => {\n\t\tconst game = new Game(cookies.get('sverdle'));\n\n\t\tconst data = await request.formData();\n\t\tconst key = data.get('key');\n\n\t\tconst i = game.answers.length;\n\n\t\tif (key === 'backspace') {\n\t\t\tgame.guesses[i] = game.guesses[i].slice(0, -1);\n\t\t} else {\n\t\t\tgame.guesses[i] += key;\n\t\t}\n\n\t\tcookies.set('sverdle', game.toString(), { path: '/' });\n\t},\n\n\t/**\n\t * Modify game state in reaction to a guessed word. This logic always runs on\n\t * the server, so that people can't cheat by peeking at the JavaScript\n\t */\n\tenter: async ({ request, cookies }) => {\n\t\tconst game = new Game(cookies.get('sverdle'));\n\n\t\tconst data = await request.formData();\n\t\tconst guess = data.getAll('guess') as string[];\n\n\t\tif (!game.enter(guess)) {\n\t\t\treturn fail(400, { badGuess: true });\n\t\t}\n\n\t\tcookies.set('sverdle', game.toString(), { path: '/' });\n\t},\n\n\trestart: async ({ cookies }) => {\n\t\tcookies.delete('sverdle', { path: '/' });\n\t}\n} satisfies Actions;\n"
37
37
  },
38
38
  {
39
39
  "name": "src/routes/sverdle/+page.svelte",
@@ -15,7 +15,7 @@
15
15
  "@sveltejs/adapter-auto": "^7.0.0",
16
16
  "@sveltejs/kit": "^2.50.2",
17
17
  "@sveltejs/vite-plugin-svelte": "^6.2.4",
18
- "svelte": "^5.49.2",
18
+ "svelte": "^5.51.0",
19
19
  "vite": "^7.3.1"
20
20
  }
21
21
  }