@storybook/svelte 11.0.0-beta.0 → 11.0.0-beta.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.
Files changed (31) hide show
  1. package/dist/_browser-chunks/{chunk-SLNVXRXZ.js → chunk-D3HHTIN7.js} +5 -18
  2. package/dist/_browser-chunks/chunk-QPNLWHUT.js +84 -0
  3. package/dist/_node-chunks/{build-docgen-MSJ3SPME.js → build-docgen-7AHJE6KZ.js} +10 -10
  4. package/dist/_node-chunks/{chunk-MHATCRYC.js → chunk-66EAYIKL.js} +29 -18
  5. package/dist/_node-chunks/{chunk-XTPACDWA.js → chunk-BTI2FV5C.js} +76 -8
  6. package/dist/_node-chunks/{chunk-X4C3MPED.js → chunk-CYGU5LDL.js} +8 -8
  7. package/dist/_node-chunks/{chunk-CWKCHCWY.js → chunk-H5ZZRYXC.js} +16 -10
  8. package/dist/_node-chunks/{chunk-OZSDLXII.js → chunk-QRTOLIGT.js} +6 -6
  9. package/dist/_node-chunks/{chunk-S5NTL526.js → chunk-RB7ABCI3.js} +6 -6
  10. package/dist/_node-chunks/{chunk-EHBEHVES.js → chunk-T3JGM6K4.js} +6 -6
  11. package/dist/_node-chunks/{parsers-2O2L5JOB.js → parsers-MK4OQQPG.js} +6 -6
  12. package/dist/_node-chunks/{svelte-project-manager-U5Z7RBKO.js → svelte-project-manager-FOBYCND4.js} +7 -7
  13. package/dist/_node-chunks/walk-INTMVV36.js +17 -0
  14. package/dist/docgen/component-docgen/svelte2tsx/generate-docgen.js +7 -7
  15. package/dist/docgen/docgen-worker.js +9 -9
  16. package/dist/entry-preview-docs.js +6 -3
  17. package/dist/index.js +2 -1
  18. package/dist/preset.js +239 -153
  19. package/dist/svelte-csf/addon-check.js +6 -6
  20. package/dist/svelte-csf/compiler/transform.d.ts +1 -32
  21. package/dist/svelte-csf/compiler/transform.js +2257 -963
  22. package/dist/svelte-csf/indexer/index.js +8 -8
  23. package/dist/svelte-csf/runtime/component-helpers.js +10 -13
  24. package/package.json +5 -11
  25. package/template/cli/js/Button.stories.svelte +2 -2
  26. package/template/cli/js/Header.stories.svelte +2 -2
  27. package/template/cli/js/Page.stories.svelte +2 -2
  28. package/template/cli/ts/Button.stories.svelte +2 -2
  29. package/template/cli/ts/Header.stories.svelte +2 -2
  30. package/template/cli/ts/Page.stories.svelte +2 -2
  31. package/dist/_node-chunks/walk-OTIE5SYQ.js +0 -17
@@ -1,19 +1,9 @@
1
- import {
2
- __export
3
- } from "./chunk-4BE7D4DS.js";
4
-
5
- // src/entry-preview-docs.ts
6
- var entry_preview_docs_exports = {};
7
- __export(entry_preview_docs_exports, {
8
- decorators: () => decorators
9
- });
10
-
11
1
  // src/docs/sourceDecorator.ts
12
2
  import { SourceType } from "storybook/internal/docs-tools";
13
3
  import { emitTransformCode, useEffect, useRef } from "storybook/preview-api";
14
4
  var skipSourceRender = (context) => {
15
- let sourceParams = context?.parameters.docs?.source, isArgsStory = context?.parameters.__isArgsStory;
16
- return (context?.tags ?? []).some((tag) => tag.startsWith("svelte-csf")) ? !0 : sourceParams?.type === SourceType.DYNAMIC ? !1 : !isArgsStory || sourceParams?.code || sourceParams?.type === SourceType.CODE;
5
+ let sourceParams = context.parameters.docs?.source, isArgsStory = context.parameters.__isArgsStory;
6
+ return sourceParams?.type === SourceType.DYNAMIC ? !1 : !isArgsStory || sourceParams?.code || sourceParams?.type === SourceType.CODE;
17
7
  };
18
8
  function toSvelteProperty(key, value, argTypes) {
19
9
  if (value == null)
@@ -45,7 +35,7 @@ function getWrapperProperties(component) {
45
35
  )?.name } : { wrapper: !1 } : { wrapper: !1 };
46
36
  }
47
37
  var sourceDecorator = (storyFn, context) => {
48
- let skip = skipSourceRender(context), story = storyFn(), source = useRef(void 0);
38
+ let skip = context.tags.some((tag) => tag.startsWith("svelte-csf")) || skipSourceRender(context), story = storyFn(), source = useRef(void 0);
49
39
  return useEffect(() => {
50
40
  if (skip)
51
41
  return;
@@ -59,10 +49,7 @@ var sourceDecorator = (storyFn, context) => {
59
49
  }), story;
60
50
  };
61
51
 
62
- // src/entry-preview-docs.ts
63
- var decorators = globalThis.FEATURES?.docgenServer ? [] : [sourceDecorator];
64
-
65
52
  export {
66
- decorators,
67
- entry_preview_docs_exports
53
+ skipSourceRender,
54
+ sourceDecorator
68
55
  };
@@ -0,0 +1,84 @@
1
+ import {
2
+ sourceDecorator
3
+ } from "./chunk-D3HHTIN7.js";
4
+ import {
5
+ __export
6
+ } from "./chunk-4BE7D4DS.js";
7
+
8
+ // src/entry-preview-docs.ts
9
+ var entry_preview_docs_exports = {};
10
+ __export(entry_preview_docs_exports, {
11
+ decorators: () => decorators,
12
+ parameters: () => parameters
13
+ });
14
+
15
+ // src/docs/print-hole.ts
16
+ import { printValue, unknownHoleKind } from "storybook/internal/docs-tools";
17
+
18
+ // src/snippet-values.ts
19
+ var isPlain = (value) => !/[{}<>"\\&\r\n\t]/.test(value), escapeAttribute = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
20
+ function printProp(name, value) {
21
+ return value === void 0 ? "" : value === !0 ? name : value.string !== void 0 && isPlain(value.string) ? `${name}="${value.string}"` : `${name}={${value.code}}`;
22
+ }
23
+ var printAccessors = (keys) => keys.map((key) => /^[A-Za-z_$][\w$]*$/.test(key) ? `.${key}` : `[${JSON.stringify(key)}]`).join("");
24
+ function printWholeRead(place, arg, read, string) {
25
+ let text = string?.trim() ? string : void 0, code = `${place.before}${read}${place.after}`;
26
+ switch (place.kind) {
27
+ case "attrvalue":
28
+ return text !== void 0 && isPlain(text) ? `${place.name ?? arg}="${text}"` : code;
29
+ case "quoted":
30
+ return text !== void 0 && !/[{}]/.test(text) ? escapeAttribute(text) : code;
31
+ case "fragment":
32
+ return text !== void 0 && !/[{}<>"\\&]/.test(text) ? text : code;
33
+ case "code":
34
+ return code;
35
+ }
36
+ }
37
+
38
+ // src/docs/print-hole.ts
39
+ var printHole = (hole, value) => {
40
+ let arg = hole.arg ?? "";
41
+ switch (hole.kind) {
42
+ case "prop":
43
+ return printProp(arg, propValue(value, arg));
44
+ case "props":
45
+ return Object.entries(value).filter(([name]) => !hole.except.includes(name)).map(([name, item]) => printProp(name, propValue(item, name))).join(hole.separator);
46
+ case "value":
47
+ return printRead(value, arg, hole.path).code;
48
+ case "property":
49
+ return `${hole.name ?? arg}: ${printRead(value, arg).code}`;
50
+ case "attrvalue":
51
+ case "quoted":
52
+ case "fragment":
53
+ case "code": {
54
+ let { code, string } = printRead(value, arg, hole.path);
55
+ return printWholeRead(hole, arg, code, string);
56
+ }
57
+ default:
58
+ return unknownHoleKind(hole);
59
+ }
60
+ };
61
+ function printRead(value, arg, path = []) {
62
+ let rest = path;
63
+ for (; rest.length && isObject(value) && Object.hasOwn(value, rest[0]); )
64
+ value = value[rest[0]], rest = rest.slice(1);
65
+ let code = printValue(value, arg), number = typeof value == "number" && (value < 0 || rest.length > 0), wrapped = isObject(value) || number ? `(${code})` : code;
66
+ return rest.length ? { code: `${wrapped}${printAccessors(rest)}` } : { code: wrapped, ...typeof value == "string" && { string: value } };
67
+ }
68
+ var isObject = (value) => typeof value == "object" && value !== null && !Array.isArray(value);
69
+ function propValue(value, name) {
70
+ if (value !== void 0)
71
+ return value === !0 ? !0 : {
72
+ ...typeof value == "string" ? { string: value } : {},
73
+ code: printValue(value, name)
74
+ };
75
+ }
76
+
77
+ // src/entry-preview-docs.ts
78
+ var decorators = globalThis.FEATURES?.docgenServer ? [] : [sourceDecorator], parameters = globalThis.FEATURES?.docgenServer ? { docs: { source: { printHole } } } : {};
79
+
80
+ export {
81
+ decorators,
82
+ parameters,
83
+ entry_preview_docs_exports
84
+ };
@@ -1,26 +1,26 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  UNPRINTABLE_DEFAULT
14
- } from "./chunk-EHBEHVES.js";
14
+ } from "./chunk-T3JGM6K4.js";
15
15
  import {
16
16
  parseSvelteSource
17
- } from "./chunk-CWKCHCWY.js";
17
+ } from "./chunk-H5ZZRYXC.js";
18
18
  import {
19
19
  extractSvelteASTNodes,
20
20
  getDefineMetaComponentValue,
21
21
  getDefineMetaFirstArgumentObjectExpression
22
- } from "./chunk-X4C3MPED.js";
23
- import "./chunk-MHATCRYC.js";
22
+ } from "./chunk-CYGU5LDL.js";
23
+ import "./chunk-66EAYIKL.js";
24
24
 
25
25
  // src/docgen/component-docgen/build-docgen.ts
26
26
  import { realpathSync } from "node:fs";
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -96,9 +96,11 @@ var BASE_INITIAL_SNIPPET = dedent`
96
96
  const { Story } = defineMeta({});
97
97
  </script>
98
98
 
99
+ <Story name="Primary" />
100
+
99
101
  In a SvelteKit project, import defineMeta from "${StorybookSvelteCSFError.sveltekitImportSource}".
100
102
  With CSF factories, call preview.meta() in place of defineMeta(), with preview imported from '#.storybook/preview'.
101
- `, category = StorybookSvelteCSFError.CATEGORY.parserExtractSvelte, MissingModuleTagError = class extends StorybookSvelteCSFError {
103
+ `, STORIES_FILE_REQUIREMENTS = "A Svelte stories file needs a <script module> that calls defineMeta() and uses the Story component that it returns, like so:", category = StorybookSvelteCSFError.CATEGORY.parserExtractSvelte, MissingModuleTagError = class extends StorybookSvelteCSFError {
102
104
  constructor(filename) {
103
105
  super({
104
106
  name: "MissingModuleTagError",
@@ -107,9 +109,9 @@ With CSF factories, call preview.meta() in place of defineMeta(), with preview i
107
109
  documentation: DOCS.meta,
108
110
  message: dedent`
109
111
  The file '${filepathURL(filename)}'
110
- does not have a module context (<script module> ... </script>).
112
+ does not have a <script module>.
111
113
 
112
- defineMeta(...) or preview.meta(...) should be called inside a module script tag, like so:
114
+ ${STORIES_FILE_REQUIREMENTS}
113
115
 
114
116
  ${BASE_INITIAL_SNIPPET}
115
117
  `
@@ -142,9 +144,9 @@ With CSF factories, call preview.meta() in place of defineMeta(), with preview i
142
144
  documentation: DOCS.meta,
143
145
  message: dedent`
144
146
  The file '${filepathURL(filename)}'
145
- does not import defineMeta from ${StorybookSvelteCSFError.importSourcesText}, or the preview from .storybook/preview, inside the module context.
147
+ does not import defineMeta from ${StorybookSvelteCSFError.importSourcesText}, or preview from the preview file of Storybook, in its <script module>.
146
148
 
147
- Make sure to import defineMeta from the package and use it inside the module context like so:
149
+ ${STORIES_FILE_REQUIREMENTS}
148
150
 
149
151
  ${BASE_INITIAL_SNIPPET}
150
152
  `
@@ -223,9 +225,18 @@ With CSF factories, call preview.meta() in place of defineMeta(), with preview i
223
225
  `
224
226
  });
225
227
  }
226
- }, describeCause = (cause) => {
227
- if (cause instanceof Error)
228
- return logger.shouldLog("debug") && cause.stack ? cause.stack : `${cause.name}: ${cause.message}`;
228
+ }, describeSvelteLocation = (error, filename) => {
229
+ let { start, frame } = error;
230
+ return [start ? `${filepathURL(filename)}:${start.line}:${start.column + 1}` : void 0, frame].filter(Boolean).join(`
231
+
232
+ `);
233
+ }, describeCause = (cause, filename) => {
234
+ if (cause instanceof Error) {
235
+ let description = logger.shouldLog("debug") && cause.stack ? cause.stack : `${cause.name}: ${cause.message}`, location = describeSvelteLocation(cause, filename);
236
+ return location ? `${description}
237
+
238
+ ${location}` : description;
239
+ }
229
240
  if (typeof cause == "string")
230
241
  return cause;
231
242
  try {
@@ -243,7 +254,7 @@ With CSF factories, call preview.meta() in place of defineMeta(), with preview i
243
254
  message: dedent`
244
255
  Storybook stories indexer parser threw an unrecognized error while indexing the file '${filepathURL(filename)}':
245
256
 
246
- ${describeCause(cause)}
257
+ ${describeCause(cause, filename)}
247
258
 
248
259
  The indexer doesn't run Svelte preprocessors. It ignores the content of <style> blocks, but the rest of a stories file must be standard Svelte syntax.
249
260
 
@@ -303,7 +314,8 @@ With CSF factories, call preview.meta() in place of defineMeta(), with preview i
303
314
  };
304
315
 
305
316
  // src/svelte-csf/utils/import-source.ts
306
- import { isValidPreviewPath, unwrapExpression as unwrapExpression2 } from "storybook/internal/csf-tools";
317
+ import { isValidPreviewPath } from "storybook/internal/csf/csf-utils";
318
+ import { unwrapExpression as unwrapExpression2 } from "storybook/internal/csf-tools";
307
319
 
308
320
  // src/svelte-csf/utils/is-one-of.ts
309
321
  function isOneOf(values, value) {
@@ -730,8 +742,7 @@ function getArrayOfStringsValueFromAttribute(params) {
730
742
 
731
743
  // src/svelte-csf/utils/identifier-utils.ts
732
744
  import { sanitize } from "storybook/internal/csf";
733
- var storyIdToExportName = (storyId) => storyId.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
734
- var storyNameToId = (name) => (
745
+ var storyIdToExportName = (storyId) => storyId.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(""), storyNameToId = (name) => (
735
746
  // add a space before all caps and use utility from @storybook/csf to sanitize the resulting string
736
747
  sanitize(name.replace(/([A-Z])/g, " $1").trim())
737
748
  ), storyNameToExportName = (name) => storyIdToExportName(storyNameToId(name)), isValidVariableName = (str) => {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -13,13 +13,73 @@ import {
13
13
  extractDefineMetaPropertiesNodes,
14
14
  getDefineMetaComponentName,
15
15
  getDefineMetaComponentValue
16
- } from "./chunk-X4C3MPED.js";
16
+ } from "./chunk-CYGU5LDL.js";
17
17
  import {
18
18
  InvalidRenderValueError,
19
19
  InvalidStoryTemplateAttributeError,
20
20
  extractStoryAttributesNodes,
21
21
  extractStoryTemplateSnippetBlock
22
- } from "./chunk-MHATCRYC.js";
22
+ } from "./chunk-66EAYIKL.js";
23
+
24
+ // src/svelte-csf/parser/ast.ts
25
+ import { compile } from "svelte/compiler";
26
+ function getSvelteAST(options) {
27
+ let { filename, code } = options, { ast } = compile(code, {
28
+ filename,
29
+ modernAst: !0
30
+ });
31
+ return ast;
32
+ }
33
+ function createASTProperty(name, value) {
34
+ return {
35
+ type: "Property",
36
+ kind: "init",
37
+ computed: !1,
38
+ method: !1,
39
+ shorthand: !1,
40
+ key: {
41
+ type: "Identifier",
42
+ name
43
+ },
44
+ value
45
+ };
46
+ }
47
+ function createASTArrayExpression(elements = []) {
48
+ return {
49
+ type: "ArrayExpression",
50
+ elements
51
+ };
52
+ }
53
+ function createASTObjectExpression(properties = []) {
54
+ return {
55
+ type: "ObjectExpression",
56
+ properties
57
+ };
58
+ }
59
+ function appendASTProperty(node, property) {
60
+ node.properties = [...node.properties, property];
61
+ }
62
+ function createASTIdentifier(name) {
63
+ return {
64
+ type: "Identifier",
65
+ name
66
+ };
67
+ }
68
+ function createASTExportSpecifier({
69
+ local,
70
+ exported
71
+ }) {
72
+ return {
73
+ type: "ExportSpecifier",
74
+ local: createASTIdentifier(local),
75
+ exported: createASTIdentifier(exported ?? local)
76
+ };
77
+ }
78
+ function span(node) {
79
+ if ("start" in node && typeof node.start == "number" && "end" in node && typeof node.end == "number")
80
+ return { start: node.start, end: node.end };
81
+ throw new TypeError("Svelte AST node has no source positions");
82
+ }
23
83
 
24
84
  // src/svelte-csf/parser/extract/svelte/snippet-block.ts
25
85
  import { unwrapExpression as unwrapExpression2 } from "storybook/internal/csf-tools";
@@ -124,6 +184,14 @@ function getSnippetBlockBodyRawCode(originalCode, node) {
124
184
  }
125
185
 
126
186
  export {
187
+ getSvelteAST,
188
+ createASTProperty,
189
+ createASTArrayExpression,
190
+ createASTObjectExpression,
191
+ appendASTProperty,
192
+ createASTIdentifier,
193
+ createASTExportSpecifier,
194
+ span,
127
195
  findStoryAttributeTemplateSnippetBlock,
128
196
  findMetaRenderSnippetBlock,
129
197
  getStoryContentRawCode
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -22,7 +22,7 @@ import {
22
22
  hasMetaImport,
23
23
  isOneOf,
24
24
  skipTypeCalls
25
- } from "./chunk-MHATCRYC.js";
25
+ } from "./chunk-66EAYIKL.js";
26
26
 
27
27
  // src/svelte-csf/parser/extract/svelte/module-nodes.ts
28
28
  async function extractModuleNodes(options) {
@@ -49,7 +49,7 @@ async function extractModuleNodes(options) {
49
49
 
50
50
  // src/svelte-csf/parser/extract/svelte/fragment-nodes.ts
51
51
  async function extractFragmentNodes(params) {
52
- let { walk } = await import("./walk-OTIE5SYQ.js"), { fragment, moduleNodes } = params, { storyNames } = moduleNodes, latestComment, state = {
52
+ let { walk } = await import("./walk-INTMVV36.js"), { fragment, moduleNodes } = params, { storyNames } = moduleNodes, latestComment, state = {
53
53
  storyComponents: [],
54
54
  snippetBlocks: []
55
55
  };
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -32,7 +32,7 @@ import {
32
32
  getStoryIdentifiers,
33
33
  getStoryParents,
34
34
  hasMetaImport
35
- } from "./chunk-MHATCRYC.js";
35
+ } from "./chunk-66EAYIKL.js";
36
36
 
37
37
  // src/svelte-csf/indexer/parser.ts
38
38
  import fs from "node:fs/promises";
@@ -77,18 +77,24 @@ function parseSvelteSource(file) {
77
77
  function getIndexableAST(code) {
78
78
  try {
79
79
  return parse(code, { modern: !0 });
80
- } catch {
80
+ } catch (error) {
81
81
  let blanked = code.replace(
82
82
  styleBlocks,
83
83
  (match, open, content = "", close = "") => open === void 0 ? match : open + content.replace(/[^\r\n]/g, " ") + close
84
84
  );
85
- return parse(blanked, { modern: !0 });
85
+ if (blanked === code)
86
+ throw error;
87
+ try {
88
+ return parse(blanked, { modern: !0 });
89
+ } catch (blankedError) {
90
+ throw delete blankedError.frame, blankedError;
91
+ }
86
92
  }
87
93
  }
88
94
  async function parseForIndexer(filename) {
89
95
  let [file, { walk }] = await Promise.all([
90
96
  fs.readFile(filename, { encoding: "utf8" }),
91
- import("./walk-OTIE5SYQ.js")
97
+ import("./walk-INTMVV36.js")
92
98
  ]), { ast: svelteAST } = parseSvelteSource(file), results = {
93
99
  meta: {},
94
100
  stories: [],
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -17,7 +17,7 @@ import {
17
17
  inferredCommandLine,
18
18
  parseSvelteConfig,
19
19
  virtualFileName
20
- } from "./chunk-EHBEHVES.js";
20
+ } from "./chunk-T3JGM6K4.js";
21
21
 
22
22
  // src/docgen/component-docgen/component-meta/svelte-project-manager.ts
23
23
  import { statSync } from "node:fs";
@@ -0,0 +1,17 @@
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ walk
14
+ } from "./chunk-QRTOLIGT.js";
15
+ export {
16
+ walk
17
+ };
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -19,7 +19,7 @@ import {
19
19
  inferredCommandLine,
20
20
  parseSvelteConfig,
21
21
  virtualFileName
22
- } from "../../../_node-chunks/chunk-EHBEHVES.js";
22
+ } from "../../../_node-chunks/chunk-T3JGM6K4.js";
23
23
  export {
24
24
  UNPRINTABLE_DEFAULT,
25
25
  assertCompilerApi,
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_t3g1exktcfr from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_t3g1exktcfr from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_t3g1exktcfr from "node:module";
1
+ import CJS_COMPAT_NODE_URL_f7geiagcxxk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_f7geiagcxxk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_f7geiagcxxk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_t3g1exktcfr.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_t3g1exktcfr.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_t3g1exktcfr.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_f7geiagcxxk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_f7geiagcxxk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_f7geiagcxxk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  SVELTE_DOCGEN_STORY_FILE_TEST_REGEXP
14
- } from "../_node-chunks/chunk-S5NTL526.js";
14
+ } from "../_node-chunks/chunk-RB7ABCI3.js";
15
15
 
16
16
  // src/docgen/docgen-worker.ts
17
17
  import { createLazyDocgenMiddleware, loadTypeScriptCompilerApi } from "storybook/internal/common";
@@ -22,8 +22,8 @@ var createDocgenProvider = () => createLazyDocgenMiddleware({
22
22
  try {
23
23
  await loadTypeScriptCompilerApi(() => import("typescript"));
24
24
  let [{ SvelteComponentMetaManager }, { buildDocgenPayload }] = await Promise.all([
25
- import("../_node-chunks/svelte-project-manager-U5Z7RBKO.js"),
26
- import("../_node-chunks/build-docgen-MSJ3SPME.js")
25
+ import("../_node-chunks/svelte-project-manager-FOBYCND4.js"),
26
+ import("../_node-chunks/build-docgen-7AHJE6KZ.js")
27
27
  ]), componentMetaManager = new SvelteComponentMetaManager();
28
28
  return componentMetaManager.startWatching(), { componentMetaManager, buildDocgenPayload };
29
29
  } catch (error) {