@storybook-astro/framework 1.2.0 → 1.3.0-canary.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 (87) hide show
  1. package/dist/{base-IRZo3zgK.d.ts → base-DT67T5pi.d.ts} +1 -0
  2. package/dist/{chunk-T7NWIO5S.js → chunk-2EABPTOY.js} +5 -5
  3. package/dist/{chunk-PJEDXZVN.js → chunk-7YBE4TTI.js} +2 -1
  4. package/dist/chunk-7YBE4TTI.js.map +1 -0
  5. package/dist/{chunk-POHTFYST.js → chunk-AYYMNFI6.js} +104 -6
  6. package/dist/chunk-AYYMNFI6.js.map +1 -0
  7. package/dist/{chunk-OUEDTRBO.js → chunk-B454DGX6.js} +259 -67
  8. package/dist/chunk-B454DGX6.js.map +1 -0
  9. package/dist/chunk-B5HHF6FC.js +116 -0
  10. package/dist/chunk-B5HHF6FC.js.map +1 -0
  11. package/dist/chunk-CU57AJUW.js +1402 -0
  12. package/dist/chunk-CU57AJUW.js.map +1 -0
  13. package/dist/{chunk-DNGQBPT7.js → chunk-PUTCAN6X.js} +5 -2
  14. package/dist/{chunk-DNGQBPT7.js.map → chunk-PUTCAN6X.js.map} +1 -1
  15. package/dist/{chunk-4SWPVM6R.js → chunk-WUTCMEF5.js} +2 -2
  16. package/dist/index.d.ts +17 -7
  17. package/dist/index.js +6 -5
  18. package/dist/index.js.map +1 -1
  19. package/dist/integrations/index.d.ts +2 -1
  20. package/dist/integrations/index.js +1 -1
  21. package/dist/middleware.js +18 -131
  22. package/dist/middleware.js.map +1 -1
  23. package/dist/{types-C-jan6Px.d.ts → preset-BvgHg2of.d.ts} +8 -11
  24. package/dist/preset.d.ts +2 -10
  25. package/dist/preset.js +5 -4
  26. package/dist/renderer/renderer-dev.js +62 -0
  27. package/dist/renderer/renderer-dev.js.map +1 -0
  28. package/dist/renderer/renderer-server.js +92 -0
  29. package/dist/renderer/renderer-server.js.map +1 -0
  30. package/dist/renderer/renderer-static.js +54 -0
  31. package/dist/renderer/renderer-static.js.map +1 -0
  32. package/dist/testing.js +12 -11
  33. package/dist/testing.js.map +1 -1
  34. package/dist/{viteStorybookAstroMiddlewarePlugin-2EFKTECT.js → viteStorybookAstroMiddlewarePlugin-UB6ZLJ4B.js} +4 -3
  35. package/dist/vitest/global-setup.js +6 -5
  36. package/dist/vitest/global-setup.js.map +1 -1
  37. package/dist/vitest/index.d.ts +1 -1
  38. package/dist/vitest/index.js +3 -3
  39. package/package.json +14 -43
  40. package/src/astroImageService.ts +57 -0
  41. package/src/astroRenderHandler.ts +205 -0
  42. package/src/importAstroConfig.ts +1 -1
  43. package/src/index.ts +2 -0
  44. package/src/integrations/alpine.ts +1 -0
  45. package/src/integrations/base.ts +6 -0
  46. package/src/lib/revive-dates.test.ts +106 -0
  47. package/src/lib/revive-dates.ts +51 -0
  48. package/src/middleware.ts +29 -200
  49. package/src/module-mocks.ts +153 -5
  50. package/src/preset.ts +38 -8
  51. package/src/productionRenderRuntime.ts +187 -0
  52. package/src/rules.test.ts +52 -4
  53. package/src/rules.ts +54 -7
  54. package/src/server/index.ts +101 -31
  55. package/src/storyRulesRuntime.ts +34 -0
  56. package/src/storySsrVite.ts +240 -0
  57. package/src/types.ts +0 -9
  58. package/src/virtual.d.ts +17 -3
  59. package/src/vite/{astroFilesVirtualModulePlugin.ts → astroFilesPlugin.ts} +4 -4
  60. package/src/vite/sanitizeConfigPlugin.ts +18 -0
  61. package/src/vite/{storybookAstroServerAuthConfigVirtualModulePlugin.test.ts → serverAuthPlugin.test.ts} +7 -10
  62. package/src/vite/{storybookAstroServerAuthConfigVirtualModulePlugin.ts → serverAuthPlugin.ts} +6 -9
  63. package/src/vite/serverRuntimePlugin.ts +109 -0
  64. package/src/vite/{storybookAstroRulesConfigVirtualModulePlugin.ts → storyRulesPlugin.ts} +6 -7
  65. package/src/vite/{createVirtualModulePlugin.test.ts → virtualModulePlugin.test.ts} +5 -5
  66. package/src/vite/{createVirtualModulePlugin.ts → virtualModulePlugin.ts} +2 -2
  67. package/src/viteAstroContainerRenderersPlugin.ts +72 -2
  68. package/src/vitePluginAstroBuildPrerender.ts +75 -646
  69. package/src/vitePluginAstroBuildServer.ts +217 -165
  70. package/src/vitePluginAstroBuildShared.test.ts +87 -0
  71. package/src/vitePluginAstroBuildShared.ts +465 -0
  72. package/src/vitePluginStoryModuleMocks.ts +29 -0
  73. package/src/viteStorybookAstroMiddlewarePlugin.ts +8 -0
  74. package/src/viteStorybookAstroRendererPlugin.ts +13 -6
  75. package/src/viteStorybookRendererFallbackPlugin.ts +2 -2
  76. package/dist/chunk-OUEDTRBO.js.map +0 -1
  77. package/dist/chunk-PBISP7PA.js +0 -1137
  78. package/dist/chunk-PBISP7PA.js.map +0 -1
  79. package/dist/chunk-PJEDXZVN.js.map +0 -1
  80. package/dist/chunk-POHTFYST.js.map +0 -1
  81. package/dist/node/index.d.ts +0 -10
  82. package/dist/node/index.js +0 -10
  83. package/dist/node/index.js.map +0 -1
  84. package/src/vite/storybookAstroSanitizationConfigVirtualModulePlugin.ts +0 -21
  85. /package/dist/{chunk-T7NWIO5S.js.map → chunk-2EABPTOY.js.map} +0 -0
  86. /package/dist/{chunk-4SWPVM6R.js.map → chunk-WUTCMEF5.js.map} +0 -0
  87. /package/dist/{viteStorybookAstroMiddlewarePlugin-2EFKTECT.js.map → viteStorybookAstroMiddlewarePlugin-UB6ZLJ4B.js.map} +0 -0
@@ -12,6 +12,7 @@ type RendererDeclaration = {
12
12
  };
13
13
  declare abstract class Integration {
14
14
  abstract readonly name: string;
15
+ readonly factoryName?: string;
15
16
  abstract readonly dependencies: string[];
16
17
  abstract readonly options: Record<string | number | symbol, unknown>;
17
18
  abstract readonly renderer: RendererDeclaration;
@@ -1,10 +1,10 @@
1
+ import {
2
+ resolveTestingIntegrationsForRoot
3
+ } from "./chunk-WUTCMEF5.js";
1
4
  import {
2
5
  createViteServer,
3
6
  ssrLoadModuleWithFsFallback
4
- } from "./chunk-POHTFYST.js";
5
- import {
6
- resolveTestingIntegrationsForRoot
7
- } from "./chunk-4SWPVM6R.js";
7
+ } from "./chunk-AYYMNFI6.js";
8
8
 
9
9
  // src/testing/renderer-daemon.ts
10
10
  import { createServer as createHttpServer } from "http";
@@ -217,4 +217,4 @@ export {
217
217
  startTestingRendererDaemon,
218
218
  renderViaTestingRendererDaemon
219
219
  };
220
- //# sourceMappingURL=chunk-T7NWIO5S.js.map
220
+ //# sourceMappingURL=chunk-2EABPTOY.js.map
@@ -36,6 +36,7 @@ async function importModule(moduleName, resolveFrom2 = process.cwd()) {
36
36
  // src/integrations/alpine.ts
37
37
  var AlpineIntegration = class {
38
38
  name = "alpine";
39
+ factoryName = "alpinejs";
39
40
  dependencies = [
40
41
  "@astrojs/alpinejs",
41
42
  "alpinejs"
@@ -237,4 +238,4 @@ export {
237
238
  svelte,
238
239
  vue
239
240
  };
240
- //# sourceMappingURL=chunk-PJEDXZVN.js.map
241
+ //# sourceMappingURL=chunk-7YBE4TTI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/integrations/moduleResolver.ts","../src/integrations/alpine.ts","../src/integrations/preact.ts","../src/integrations/react.ts","../src/integrations/solid.ts","../src/integrations/svelte.ts","../src/integrations/vue.ts","../src/integrations/index.ts"],"sourcesContent":["import path from 'node:path';\nimport { createRequire } from 'node:module';\nimport { pathToFileURL } from 'node:url';\n\nfunction toFileHref(filePath: string): string {\n return pathToFileURL(filePath).href;\n}\n\nexport function resolveFrom(moduleName: string, fromDirectory: string): string {\n const fromFile = path.join(fromDirectory, '__storybook_astro_resolve__.js');\n\n return createRequire(toFileHref(fromFile)).resolve(moduleName);\n}\n\nfunction resolveFromCandidates(moduleName: string, primaryDirectory: string): string {\n const directories = [primaryDirectory, process.env.INIT_CWD].filter(\n (value): value is string => Boolean(value)\n );\n const visited = new Set<string>();\n let lastError: unknown;\n\n for (const directory of directories) {\n if (visited.has(directory)) {\n continue;\n }\n\n visited.add(directory);\n\n try {\n return resolveFrom(moduleName, directory);\n } catch (error) {\n lastError = error;\n }\n }\n\n throw lastError;\n}\n\nexport async function importModule<T = unknown>(moduleName: string, resolveFrom = process.cwd()): Promise<T> {\n const resolvedPath = resolveFromCandidates(moduleName, resolveFrom);\n\n return import(toFileHref(resolvedPath)) as Promise<T>;\n}\n","import type { Integration } from './base.ts';\nimport { importModule } from './moduleResolver.ts';\n\nexport type Options = Record<string, unknown>;\n\nexport class AlpineIntegration implements Integration {\n readonly name = 'alpine';\n readonly factoryName = 'alpinejs';\n readonly dependencies = [\n '@astrojs/alpinejs',\n 'alpinejs'\n ];\n readonly options: Options;\n readonly renderer = {};\n\n constructor(options: Options = {}) {\n this.options = options;\n }\n\n resolveClient(_moduleName: string): undefined {}\n\n async loadIntegration(resolveFrom = process.cwd()) {\n const framework = await importModule<{\n default: (options: Options) => Awaited<ReturnType<Integration['loadIntegration']>>;\n }>('@astrojs/alpinejs', resolveFrom);\n\n return framework.default(this.options);\n }\n}\n","import type { Integration } from './base.ts';\nimport type { PreactPluginOptions } from '@preact/preset-vite';\nimport { importModule } from './moduleResolver.ts';\n\nexport type Options = Pick<PreactPluginOptions, 'include' | 'exclude'> & {\n compat?: boolean;\n devtools?: boolean;\n};\n\nexport class PreactIntegration implements Integration {\n readonly name = 'preact';\n readonly dependencies = ['@astrojs/preact', '@storybook/preact-vite', 'preact'];\n readonly options: Options;\n readonly storybookEntryPreview = '@storybook/preact/entry-preview';\n \n readonly renderer = {\n server: {\n name: '@astrojs/preact',\n entrypoint: '@astrojs/preact/server.js'\n },\n client: {\n name: '@astrojs/preact',\n entrypoint: '@astrojs/preact/client.js'\n }\n };\n\n constructor(options: Options = {}) {\n this.options = options;\n }\n\n resolveClient(moduleName: string): string | undefined {\n if (moduleName.startsWith('@astrojs/preact/client')) {\n return `/@id/${moduleName}`;\n }\n }\n\n async loadIntegration(resolveFrom = process.cwd()) {\n const framework = await importModule<{\n default: (options: Options) => Awaited<ReturnType<Integration['loadIntegration']>>;\n }>('@astrojs/preact', resolveFrom);\n\n return framework.default(this.options);\n }\n}\n","import type { Integration } from './base.ts';\nimport type { Options as ViteReactPluginOptions } from '@vitejs/plugin-react';\nimport { importModule } from './moduleResolver.ts';\n\nexport type Options = Pick<ViteReactPluginOptions, 'include' | 'exclude'>;\n\nexport class ReactIntegration implements Integration {\n readonly name = 'react';\n readonly dependencies = ['@astrojs/react', '@storybook/react', 'react', 'react-dom'];\n readonly options: Options;\n readonly storybookEntryPreview = '@storybook/react/entry-preview';\n\n readonly renderer = {\n server: {\n name: '@astrojs/react',\n entrypoint: '@astrojs/react/server.js'\n },\n client: {\n name: '@astrojs/react',\n entrypoint: '@astrojs/react/client.js'\n }\n };\n\n constructor(options: Options = {}) {\n this.options = options;\n }\n\n resolveClient(moduleName: string): string | undefined {\n if (moduleName.startsWith('@astrojs/react/client')) {\n return `/@id/${moduleName}`;\n }\n }\n\n async loadIntegration(resolveFrom = process.cwd()) {\n const framework = await importModule<{\n default: (options: Options) => Awaited<ReturnType<Integration['loadIntegration']>>;\n }>('@astrojs/react', resolveFrom);\n\n return framework.default(this.options);\n }\n}\n","import type { Integration } from './base.ts';\nimport type { Options as ViteSolidPluginOptions } from 'vite-plugin-solid';\nimport { importModule } from './moduleResolver.ts';\n\nexport type Options = Pick<ViteSolidPluginOptions, 'include' | 'exclude'>;\n\nexport class SolidIntegration implements Integration {\n readonly name = 'solid';\n readonly dependencies = ['@astrojs/solid-js', 'storybook-solidjs-vite', 'solid-js'];\n readonly options: Options;\n readonly storybookEntryPreview = 'storybook-solidjs-vite/renderer/entry-preview';\n readonly renderer = {\n server: {\n name: '@astrojs/solid-js',\n entrypoint: '@astrojs/solid-js/server.js'\n },\n client: {\n name: '@astrojs/solid-js',\n entrypoint: '@astrojs/solid-js/client.js'\n }\n };\n\n constructor(options: Options = {}) {\n this.options = options;\n }\n\n resolveClient(moduleName: string): string | undefined {\n if (moduleName.startsWith('@astrojs/solid-js/client')) {\n return `/@id/${moduleName}`;\n }\n }\n\n async loadIntegration(resolveFrom = process.cwd()) {\n const framework = await importModule<{\n default: (options: Options) => Awaited<ReturnType<Integration['loadIntegration']>>;\n }>('@astrojs/solid-js', resolveFrom);\n\n return framework.default(this.options);\n }\n}\n","import type { Integration } from './base.ts';\nimport type { Options as _foo, PluginOptions, SvelteConfig } from '@sveltejs/vite-plugin-svelte';\nimport { importModule } from './moduleResolver.ts';\n\n// Using Omit with empty string to preserve index signature\n// capabilities while maintaining the structure of the original types\nexport type Options = Omit<PluginOptions, ''> & Omit<SvelteConfig, 'vitePlugin'>;\n\nconst DEFAULT_OPTIONS: Options = {\n extensions: ['.svelte']\n};\n\nexport class SvelteIntegration implements Integration {\n readonly name = 'svelte';\n readonly dependencies = ['@astrojs/svelte', '@storybook/svelte', 'svelte'];\n readonly options: Options;\n readonly storybookEntryPreview = '@storybook/svelte/entry-preview';\n readonly renderer = {\n server: {\n entrypoint: '@astrojs/svelte/server.js',\n name: '@astrojs/svelte'\n },\n client: {\n name: '@astrojs/svelte',\n entrypoint: '@astrojs/svelte/client.js'\n }\n };\n\n constructor(options: Options = DEFAULT_OPTIONS) {\n this.options = options;\n }\n\n resolveClient(moduleName: string): string | undefined {\n if (moduleName.startsWith('@astrojs/svelte/client')) {\n return `/@id/${moduleName}`;\n }\n }\n\n async loadIntegration(resolveFrom = process.cwd()) {\n const framework = await importModule<{\n default: (options: Options) => Awaited<ReturnType<Integration['loadIntegration']>>;\n }>('@astrojs/svelte', resolveFrom);\n\n return framework.default(this.options);\n }\n}\n","import type { Integration } from './base.ts';\nimport type { Options as VueOptions } from '@vitejs/plugin-vue';\nimport type { Options as VueJsxOptions } from '@vitejs/plugin-vue-jsx';\nimport { importModule } from './moduleResolver.ts';\n\nexport type Options = Pick<VueOptions, 'include' | 'exclude'> & {\n jsx?: boolean | VueJsxOptions;\n};\n\nconst DEFAULT_OPTIONS: Options = {\n include: ['**/*.vue']\n};\n\nexport class VueIntegration implements Integration {\n readonly name = 'vue';\n readonly dependencies = ['@astrojs/vue', '@storybook/vue3', 'vue'];\n readonly options: Options;\n readonly storybookEntryPreview = '@storybook/vue3/entry-preview';\n\n readonly renderer = {\n server: {\n name: '@astrojs/vue',\n entrypoint: '@astrojs/vue/server.js'\n },\n client: {\n name: '@astrojs/vue',\n entrypoint: '@astrojs/vue/client.js'\n }\n };\n\n constructor(options: Options = DEFAULT_OPTIONS) {\n this.options = options;\n }\n\n resolveClient(moduleName: string): string | undefined {\n if (moduleName.startsWith('@astrojs/vue/client')) {\n return `/@id/${moduleName}`;\n }\n }\n\n async loadIntegration(resolveFrom = process.cwd()) {\n const framework = await importModule<{\n default: (options: Options) => Awaited<ReturnType<Integration['loadIntegration']>>;\n }>('@astrojs/vue', resolveFrom);\n\n return framework.default(this.options);\n }\n}\n","import { AlpineIntegration, type Options as AlpineOptions } from './alpine.ts';\nimport { PreactIntegration, type Options as PreactOptions } from './preact.ts';\nimport { ReactIntegration, type Options as ReactOptions } from './react.ts';\nimport { SolidIntegration, type Options as SolidOptions } from './solid.ts';\nimport { SvelteIntegration, type Options as SvelteOptions } from './svelte.ts';\nimport { VueIntegration, type Options as VueOptions } from './vue.ts';\n\n\nexport function alpinejs(options?: AlpineOptions) {\n return new AlpineIntegration(options);\n}\n\nexport function preact(options?: PreactOptions) {\n return new PreactIntegration(options);\n}\n\nexport function react(options?: ReactOptions) {\n return new ReactIntegration(options);\n}\n\nexport function solid(options?: SolidOptions) {\n return new SolidIntegration(options);\n}\n\nexport function svelte(options?: SvelteOptions) {\n return new SvelteIntegration(options);\n}\n\nexport function vue(options?: VueOptions) {\n return new VueIntegration(options);\n}\n\nexport type { Integration } from './base.ts';\n"],"mappings":";AAAA,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAE9B,SAAS,WAAW,UAA0B;AAC5C,SAAO,cAAc,QAAQ,EAAE;AACjC;AAEO,SAAS,YAAY,YAAoB,eAA+B;AAC7E,QAAM,WAAW,KAAK,KAAK,eAAe,gCAAgC;AAE1E,SAAO,cAAc,W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A,EACA,wBAAwB;AAAA,EAExB,WAAW;AAAA,IAClB,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,YAAY;AAAA,IACd;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,YAAY;AAAA,IACd;AAAA,EACF;AAAA,EAEA,YAAY,UAAmBA,kBAAiB;AAC9C,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,cAAc,YAAwC;AACpD,QAAI,WAAW,WAAW,qBAAqB,GAAG;AAChD,aAAO,QAAQ,UAAU;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,MAAM,gBAAgBC,eAAc,QAAQ,IAAI,GAAG;AACjD,UAAM,YAAY,MAAM,aAErB,gBAAgBA,YAAW;AAE9B,WAAO,UAAU,QAAQ,KAAK,OAAO;AAAA,EACvC;AACF;;;ACvCO,SAAS,SAAS,SAAyB;AAChD,SAAO,IAAI,kBAAkB,OAAO;AACtC;AAEO,SAAS,OAAO,SAAyB;AAC9C,SAAO,IAAI,kBAAkB,OAAO;AACtC;AAEO,SAAS,MAAM,SAAwB;AAC5C,SAAO,IAAI,iBAAiB,OAAO;AACrC;AAEO,SAAS,MAAM,SAAwB;AAC5C,SAAO,IAAI,iBAAiB,OAAO;AACrC;AAEO,SAAS,OAAO,SAAyB;AAC9C,SAAO,IAAI,kBAAkB,OAAO;AACtC;AAEO,SAAS,IAAI,SAAsB;AACxC,SAAO,IAAI,eAAe,OAAO;AACnC;","names":["resolveFrom","resolveFrom","resolveFrom","resolveFrom","resolveFrom","resolveFrom","DEFAULT_OPTIONS","resolveFrom"]}
@@ -1,14 +1,19 @@
1
1
  import {
2
2
  importAstroConfig
3
- } from "./chunk-DNGQBPT7.js";
3
+ } from "./chunk-PUTCAN6X.js";
4
+ import {
5
+ STORYBOOK_ASTRO_INLINE_MODULE_PREFIX,
6
+ loadStoryInlineModule,
7
+ resolveStoryModuleMock
8
+ } from "./chunk-B5HHF6FC.js";
4
9
 
5
10
  // src/viteStorybookAstroMiddlewarePlugin.ts
6
11
  import { createRequire } from "module";
7
12
  import { fileURLToPath } from "url";
8
13
  import { createServer, createLogger } from "vite";
9
14
 
10
- // src/vite/createVirtualModulePlugin.ts
11
- function createVirtualModulePlugin(options) {
15
+ // src/vite/virtualModulePlugin.ts
16
+ function createVirtualModule(options) {
12
17
  const resolvedVirtualModuleId = `\0${options.virtualModuleId}`;
13
18
  return {
14
19
  name: options.pluginName,
@@ -30,22 +35,26 @@ function viteAstroContainerRenderersPlugin(integrations, options = {}) {
30
35
  const safeIntegrations = integrations ?? [];
31
36
  const mode = options.mode ?? "development";
32
37
  const staticModuleMap = options.staticModuleMap ?? {};
33
- return createVirtualModulePlugin({
38
+ return createVirtualModule({
34
39
  pluginName: "storybook-astro:container-renderers",
35
40
  virtualModuleId: "virtual:astro-container-renderers",
36
41
  load() {
37
42
  const importStatements = buildImportStatements(safeIntegrations);
43
+ const browserModuleResolverHelpers = mode === "development" ? buildBrowserModuleResolverHelpers() : "";
44
+ const clientModuleEntrypoints = mode === "development" ? buildClientModuleEntrypoints(safeIntegrations) : "[]";
38
45
  const clientResolvers = mode === "development" ? safeIntegrations.filter((integration) => typeof integration.resolveClient === "function").map(
39
46
  (integration) => integration.resolveClient.toString().replace(/^resolveClient/, "function")
40
47
  ).join(",\n") : "";
41
48
  return `
42
49
  ${importStatements}
50
+ ${browserModuleResolverHelpers}
43
51
 
44
52
  export function addRenderers(container) {
45
53
  ${safeIntegrations.map((integration) => buildServerRenderer(integration) + "\n" + buildClientRenderer(integration)).join("\n")}
46
54
  }
47
55
 
48
56
  const staticClientModules = ${JSON.stringify(staticModuleMap, null, 2)};
57
+ const clientModuleEntrypoints = ${clientModuleEntrypoints};
49
58
 
50
59
  const clientModulesResolvers = [
51
60
  ${clientResolvers}
@@ -62,6 +71,12 @@ function viteAstroContainerRenderersPlugin(integrations, options = {}) {
62
71
  return staticClientModules[normalizedSpecifier];
63
72
  }
64
73
 
74
+ for (const entrypoint of clientModuleEntrypoints) {
75
+ if (normalizedSpecifier === entrypoint || normalizedSpecifier.startsWith(entrypoint)) {
76
+ return storybookAstroResolveBrowserModulePath(normalizedSpecifier);
77
+ }
78
+ }
79
+
65
80
  for (const resolver of clientModulesResolvers) {
66
81
  const resolution = resolver(specifier);
67
82
 
@@ -74,6 +89,60 @@ function viteAstroContainerRenderersPlugin(integrations, options = {}) {
74
89
  }
75
90
  });
76
91
  }
92
+ function buildClientModuleEntrypoints(integrations) {
93
+ return JSON.stringify(
94
+ Array.from(
95
+ new Set(
96
+ integrations.map((integration) => integration.renderer.client?.entrypoint).filter((entrypoint) => Boolean(entrypoint))
97
+ )
98
+ )
99
+ );
100
+ }
101
+ function buildBrowserModuleResolverHelpers() {
102
+ return `
103
+ import path from 'node:path';
104
+ import { createRequire } from 'node:module';
105
+ import { pathToFileURL } from 'node:url';
106
+
107
+ function storybookAstroToFileHref(filePath) {
108
+ return pathToFileURL(filePath).href;
109
+ }
110
+
111
+ function storybookAstroResolveFrom(moduleName, fromDirectory) {
112
+ const fromFile = path.join(fromDirectory, '__storybook_astro_resolve__.js');
113
+
114
+ return createRequire(storybookAstroToFileHref(fromFile)).resolve(moduleName);
115
+ }
116
+
117
+ function storybookAstroResolveFromCandidates(moduleName, primaryDirectory) {
118
+ const directories = [primaryDirectory, process.env.INIT_CWD].filter(Boolean);
119
+ const visited = new Set();
120
+ let lastError;
121
+
122
+ for (const directory of directories) {
123
+ if (visited.has(directory)) {
124
+ continue;
125
+ }
126
+
127
+ visited.add(directory);
128
+
129
+ try {
130
+ return storybookAstroResolveFrom(moduleName, directory);
131
+ } catch (error) {
132
+ lastError = error;
133
+ }
134
+ }
135
+
136
+ throw lastError;
137
+ }
138
+
139
+ function storybookAstroResolveBrowserModulePath(moduleName, resolveFrom = process.cwd()) {
140
+ const resolvedPath = storybookAstroResolveFromCandidates(moduleName, resolveFrom).replace(/\\\\/g, '/');
141
+
142
+ return '/@fs/' + resolvedPath;
143
+ }
144
+ `;
145
+ }
77
146
  function buildImportStatements(integrations) {
78
147
  return integrations.filter((integration) => integration.renderer.server).map(
79
148
  (integration) => `import ${integration.name}Renderer from '${integration.renderer.server?.entrypoint}';`
@@ -231,6 +300,27 @@ function vitePluginAstroRoutesFallback() {
231
300
  };
232
301
  }
233
302
 
303
+ // src/vitePluginStoryModuleMocks.ts
304
+ function vitePluginStoryModuleMocks() {
305
+ return {
306
+ name: "storybook-astro:story-module-mocks",
307
+ enforce: "pre",
308
+ resolveId(id) {
309
+ if (id.startsWith(STORYBOOK_ASTRO_INLINE_MODULE_PREFIX)) {
310
+ return `\0${id}`;
311
+ }
312
+ const mockedModule = resolveStoryModuleMock(id);
313
+ if (mockedModule) {
314
+ return mockedModule;
315
+ }
316
+ return null;
317
+ },
318
+ load(id) {
319
+ return loadStoryInlineModule(id);
320
+ }
321
+ };
322
+ }
323
+
234
324
  // src/lib/ssr-load-module-with-fs-fallback.ts
235
325
  async function ssrLoadModuleWithFsFallback(viteServer, id, options) {
236
326
  const ids = [id];
@@ -321,6 +411,9 @@ async function vitePluginStorybookAstroMiddleware(options) {
321
411
  sanitization: options.sanitization,
322
412
  rulesConfigFilePath: storyRulesConfigFilePath,
323
413
  resolveRulesConfigModule: () => loadRulesConfigModule(viteServer, storyRulesConfigFilePath),
414
+ invalidateModuleGraph: () => {
415
+ viteServer?.moduleGraph.invalidateAll();
416
+ },
324
417
  loadModule: (id) => ssrLoadModuleWithFsFallback(viteServer, id, {
325
418
  fixStacktrace: true
326
419
  })
@@ -332,6 +425,9 @@ async function vitePluginStorybookAstroMiddleware(options) {
332
425
  server.watcher.on("add", resetHandler);
333
426
  server.watcher.on("change", resetHandler);
334
427
  server.watcher.on("unlink", resetHandler);
428
+ viteServer.watcher.on("add", resetHandler);
429
+ viteServer.watcher.on("change", resetHandler);
430
+ viteServer.watcher.on("unlink", resetHandler);
335
431
  server.ws.on("astro:render:request", async (data) => {
336
432
  try {
337
433
  const handler = await handlerPromise;
@@ -420,6 +516,7 @@ async function createViteServer(integrations, resolveFrom = process.cwd()) {
420
516
  vitePluginAstroIntegrationOptsFallback(),
421
517
  vitePluginAstroVueFallback(),
422
518
  vitePluginAstroRoutesFallback(),
519
+ vitePluginStoryModuleMocks(),
423
520
  ...config.plugins?.filter(Boolean) ?? [],
424
521
  viteAstroContainerRenderersPlugin(safeIntegrations)
425
522
  ]
@@ -463,15 +560,16 @@ async function loadRulesConfigModule(viteServer, configFilePath) {
463
560
  }
464
561
 
465
562
  export {
466
- createVirtualModulePlugin,
563
+ createVirtualModule,
467
564
  viteAstroContainerRenderersPlugin,
468
565
  vitePluginAstroFontsFallback,
469
566
  vitePluginAstroIntegrationOptsFallback,
470
567
  vitePluginAstroVueFallback,
471
568
  vitePluginAstroRoutesFallback,
569
+ vitePluginStoryModuleMocks,
472
570
  ssrLoadModuleWithFsFallback,
473
571
  resolveRulesConfigFilePath,
474
572
  vitePluginStorybookAstroMiddleware,
475
573
  createViteServer
476
574
  };
477
- //# sourceMappingURL=chunk-POHTFYST.js.map
575
+ //# sourceMappingURL=chunk-AYYMNFI6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/viteStorybookAstroMiddlewarePlugin.ts","../src/vite/virtualModulePlugin.ts","../src/viteAstroContainerRenderersPlugin.ts","../src/vitePluginAstroFontsFallback.ts","../src/vitePluginAstroIntegrationOptsFallback.ts","../src/vitePluginAstroVueFallback.ts","../src/vitePluginAstroRoutesFallback.ts","../src/vitePluginStoryModuleMocks.ts","../src/lib/ssr-load-module-with-fs-fallback.ts","../src/rules-options.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { fileURLToPath } from 'node:url';\nimport type { ServerResponse } from 'node:http';\nimport { createServer, createLogger, type Connect, type PluginOption, type ViteDevServer } from 'vite';\nimport type { RenderRequestMessage, RenderResponseMessage } from '@storybook-astro/renderer/types';\nimport type { FrameworkOptions } from './types.ts';\nimport type { Integration } from './integrations/index.ts';\nimport { importAstroConfig } from './importAstroConfig.ts';\nimport { viteAstroContainerRenderersPlugin } from './viteAstroContainerRenderersPlugin.ts';\nimport { vitePluginAstroFontsFallback } from './vitePluginAstroFontsFallback.ts';\nimport { vitePluginAstroIntegrationOptsFallback } from './vitePluginAstroIntegrationOptsFallback.ts';\nimport { vitePluginAstroVueFallback } from './vitePluginAstroVueFallback.ts';\nimport { vitePluginAstroRoutesFallback } from './vitePluginAstroRoutesFallback.ts';\nimport { vitePluginStoryModuleMocks } from './vitePluginStoryModuleMocks.ts';\nimport { ssrLoadModuleWithFsFallback } from './lib/ssr-load-module-with-fs-fallback.ts';\nimport { resolveRulesConfigFilePath } from './rules-options.ts';\n\nexport async function vitePluginStorybookAstroMiddleware(options: FrameworkOptions) {\n // The internal Vite server is created lazily inside configureServer (dev-only).\n // During builds, configureServer never fires, so no server is created.\n let viteServer: ViteDevServer | null = null;\n\n const resolveFrom = options.resolveFrom ?? process.cwd();\n\n const vitePlugin = {\n name: 'storybook-astro-middleware-plugin',\n async configureServer(server) {\n viteServer = await createViteServer(options.integrations ?? [], resolveFrom);\n const storyRulesConfigFilePath = resolveRulesConfigFilePath(options.storyRules, resolveFrom);\n\n const filePath = fileURLToPath(new URL('./middleware', import.meta.url));\n const middleware = await viteServer.ssrLoadModule(filePath, {\n fixStacktrace: true\n });\n\n const createHandler = () => middleware.handlerFactory(options.integrations ?? [], {\n sanitization: options.sanitization,\n rulesConfigFilePath: storyRulesConfigFilePath,\n resolveRulesConfigModule: () =>\n loadRulesConfigModule(viteServer!, storyRulesConfigFilePath),\n invalidateModuleGraph: () => {\n viteServer?.moduleGraph.invalidateAll();\n },\n loadModule: (id: string) =>\n ssrLoadModuleWithFsFallback(viteServer!, id, {\n fixStacktrace: true\n })\n });\n\n let handlerPromise = createHandler();\n\n const resetHandler = () => {\n handlerPromise = createHandler();\n };\n\n server.watcher.on('add', resetHandler);\n server.watcher.on('change', resetHandler);\n server.watcher.on('unlink', resetHandler);\n viteServer.watcher.on('add', resetHandler);\n viteServer.watcher.on('change', resetHandler);\n viteServer.watcher.on('unlink', resetHandler);\n\n server.ws.on('astro:render:request', async (data: RenderRequestMessage['data']) => {\n try {\n const handler = await handlerPromise;\n const html = await handler(data);\n\n server.ws.send('astro:render:response', {\n html,\n id: data.id\n } satisfies RenderResponseMessage['data']);\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : String(err);\n const errorStack = err instanceof Error ? err.stack : '';\n\n console.error('[storybook-astro] Render error:', errorMessage);\n if (errorStack) {console.error(errorStack);}\n server.ws.send('astro:render:response', {\n id: data.id,\n html:\n '<div style=\"background: #d73838; padding: 12px; color: #f0f0f0; font-family: monospace; border-radius: 4px\">' +\n '<strong>Error rendering Astro component</strong><br/>' +\n '<pre style=\"white-space: pre-wrap; margin-top: 8px; font-size: 12px\">' +\n errorMessage.replace(/</g, '&lt;').replace(/>/g, '&gt;') +\n '</pre></div>'\n } satisfies RenderResponseMessage['data']);\n }\n });\n }\n } satisfies PluginOption;\n\n // Create asset serving plugin (only active in dev when viteServer exists)\n const assetServingPlugin = {\n name: 'storybook-astro-assets',\n configureServer(server: ViteDevServer) {\n server.middlewares.use('/_image', (req: Connect.IncomingMessage, res: ServerResponse, next: Connect.NextFunction) => {\n if (!viteServer) {\n next();\n\n return;\n }\n // Forward the request to the Astro vite server\n viteServer.middlewares.handle(req, res, (err?: unknown) => {\n if (err) {\n console.error('Asset serving error:', err);\n next();\n }\n });\n });\n }\n };\n\n // The extracted CSS plugins from Astro's internal Vite server cause Vue SFC\n // <style> blocks to be double-processed (once by these plugins, once by\n // Storybook's built-in CSS plugins), resulting in PostCSS errors.\n //\n // Solution: Don't extract Astro's CSS plugins. Storybook's built-in CSS\n // plugins handle both Vue styles AND Astro style sub-modules (which are\n // standard CSS imports like `Component.astro?astro&type=style&index=0&lang.css`).\n //\n // The Astro internal server's CSS plugins are only needed for SSR rendering\n // within that server - they don't need to be shared with Storybook's server.\n return {\n vitePlugin,\n viteConfig: {\n plugins: [\n assetServingPlugin\n ].filter(Boolean)\n }\n };\n}\n\n/**\n * Creates a Vite logger that silences known benign warnings emitted by Astro's\n * Vite plugin in the SSR server context:\n * - \"Missing pages directory\" — Storybook and test contexts have no src/pages.\n * - \"points to missing source files\" — Sourcemap gaps in the `entities` package.\n */\nfunction createSsrServerLogger() {\n const logger = createLogger();\n const originalWarn = logger.warn.bind(logger);\n\n logger.warn = (msg, options) => {\n if (\n msg.includes('Missing pages directory') ||\n msg.includes('points to missing source files') ||\n msg.includes('Failed to load source map for')\n ) {\n return;\n }\n\n originalWarn(msg, options);\n };\n\n return logger;\n}\n\nexport async function createViteServer(integrations: Integration[], resolveFrom = process.cwd()) {\n const { getViteConfig, passthroughImageService } = await importAstroConfig(resolveFrom);\n const safeIntegrations = integrations ?? [];\n const projectAstroResolutionPlugin = createProjectAstroResolutionPlugin(resolveFrom);\n\n const config = await getViteConfig(\n { root: resolveFrom },\n {\n configFile: false,\n integrations: await Promise.all(\n safeIntegrations.map((integration) => integration.loadIntegration(resolveFrom))\n ),\n // Use the passthrough image service so nested components that use <Image>\n // from astro:assets render as plain <img> tags without triggering image\n // optimization (which fails in the Storybook SSR context).\n image: { service: passthroughImageService() }\n }\n )({ mode: 'development', command: 'serve' });\n\n const viteServer = await createServer({\n configFile: false,\n ...config,\n customLogger: createSsrServerLogger(),\n plugins: [\n projectAstroResolutionPlugin,\n // Fallbacks must come first to intercept before Astro's plugins\n vitePluginAstroFontsFallback(),\n vitePluginAstroIntegrationOptsFallback(),\n vitePluginAstroVueFallback(),\n vitePluginAstroRoutesFallback(),\n vitePluginStoryModuleMocks(),\n ...(config.plugins?.filter(Boolean) ?? []),\n viteAstroContainerRenderersPlugin(safeIntegrations)\n ]\n });\n\n // Initialize the server's plugin container to ensure all plugins are ready.\n // Without this, some plugins (like vite:css) may have uninitialized state\n // when ssrLoadModule is called.\n await viteServer.pluginContainer.buildStart({});\n\n return viteServer;\n}\n\nfunction createProjectAstroResolutionPlugin(resolveFrom: string): PluginOption {\n const require = createRequire(import.meta.url);\n\n return {\n name: 'storybook-astro:resolve-project-astro',\n enforce: 'pre',\n resolveId(id: string) {\n if (id !== 'astro' && !id.startsWith('astro/')) {\n return null;\n }\n\n try {\n return require.resolve(id, {\n paths: [resolveFrom]\n });\n } catch {\n return null;\n }\n }\n } satisfies PluginOption;\n}\n\nasync function loadRulesConfigModule(viteServer: ViteDevServer, configFilePath?: string) {\n if (!configFilePath) {\n return undefined;\n }\n\n try {\n return await ssrLoadModuleWithFsFallback(viteServer, configFilePath, {\n fixStacktrace: true\n });\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n\n throw new Error(\n `Unable to load framework.options.storyRules config module at ${configFilePath}: ${reason}`\n );\n }\n}\n","import type { Plugin } from 'vite';\n\ntype CreateVirtualModuleOptions = {\n pluginName: string;\n virtualModuleId: string;\n load: (id: string) => string | Promise<string> | undefined;\n};\n\nexport function createVirtualModule(options: CreateVirtualModuleOptions): Plugin {\n const resolvedVirtualModuleId = `\\0${options.virtualModuleId}`;\n\n return {\n name: options.pluginName,\n resolveId(id) {\n if (id === options.virtualModuleId) {\n return resolvedVirtualModuleId;\n }\n },\n async load(id) {\n if (id === resolvedVirtualModuleId) {\n return options.load(id);\n }\n }\n } satisfies Plugin;\n}\n","import type { Integration } from './integrations/index.ts';\nimport { createVirtualModule } from './vite/virtualModulePlugin.ts';\n\ntype PluginOptions = {\n mode?: 'development' | 'production';\n staticModuleMap?: Record<string, string>;\n};\n\nexport function viteAstroContainerRenderersPlugin(\n integrations: Integration[],\n options: PluginOptions = {}\n) {\n const safeIntegrations = integrations ?? [];\n const mode = options.mode ?? 'development';\n const staticModuleMap = options.staticModuleMap ?? {};\n\n return createVirtualModule({\n pluginName: 'storybook-astro:container-renderers',\n virtualModuleId: 'virtual:astro-container-renderers',\n load() {\n const importStatements = buildImportStatements(safeIntegrations);\n const browserModuleResolverHelpers =\n mode === 'development' ? buildBrowserModuleResolverHelpers() : '';\n const clientModuleEntrypoints =\n mode === 'development' ? buildClientModuleEntrypoints(safeIntegrations) : '[]';\n const clientResolvers =\n mode === 'development'\n ? safeIntegrations\n .filter((integration) => typeof integration.resolveClient === 'function')\n .map((integration) =>\n integration.resolveClient.toString().replace(/^resolveClient/, 'function')\n )\n .join(',\\n')\n : '';\n\n return `\n ${importStatements}\n ${browserModuleResolverHelpers}\n\n export function addRenderers(container) {\n ${safeIntegrations.map((integration) => buildServerRenderer(integration) + '\\n' + buildClientRenderer(integration)).join('\\n')}\n }\n\n const staticClientModules = ${JSON.stringify(staticModuleMap, null, 2)};\n const clientModuleEntrypoints = ${clientModuleEntrypoints};\n\n const clientModulesResolvers = [\n ${clientResolvers}\n ];\n\n export function resolveClientModules(specifier) {\n if (Object.hasOwn(staticClientModules, specifier)) {\n return staticClientModules[specifier];\n }\n\n const normalizedSpecifier = specifier.replace(/\\\\\\\\/g, '/').replace(/\\\\?.*$/, '');\n\n if (Object.hasOwn(staticClientModules, normalizedSpecifier)) {\n return staticClientModules[normalizedSpecifier];\n }\n\n for (const entrypoint of clientModuleEntrypoints) {\n if (normalizedSpecifier === entrypoint || normalizedSpecifier.startsWith(entrypoint)) {\n return storybookAstroResolveBrowserModulePath(normalizedSpecifier);\n }\n }\n\n for (const resolver of clientModulesResolvers) {\n const resolution = resolver(specifier);\n\n if (resolution) {\n return resolution;\n }\n }\n }\n `;\n }\n });\n}\n\nfunction buildClientModuleEntrypoints(integrations: Integration[]) {\n return JSON.stringify(\n Array.from(\n new Set(\n integrations\n .map((integration) => integration.renderer.client?.entrypoint)\n .filter((entrypoint): entrypoint is string => Boolean(entrypoint))\n )\n )\n );\n}\n\nfunction buildBrowserModuleResolverHelpers() {\n return `\n import path from 'node:path';\n import { createRequire } from 'node:module';\n import { pathToFileURL } from 'node:url';\n\n function storybookAstroToFileHref(filePath) {\n return pathToFileURL(filePath).href;\n }\n\n function storybookAstroResolveFrom(moduleName, fromDirectory) {\n const fromFile = path.join(fromDirectory, '__storybook_astro_resolve__.js');\n\n return createRequire(storybookAstroToFileHref(fromFile)).resolve(moduleName);\n }\n\n function storybookAstroResolveFromCandidates(moduleName, primaryDirectory) {\n const directories = [primaryDirectory, process.env.INIT_CWD].filter(Boolean);\n const visited = new Set();\n let lastError;\n\n for (const directory of directories) {\n if (visited.has(directory)) {\n continue;\n }\n\n visited.add(directory);\n\n try {\n return storybookAstroResolveFrom(moduleName, directory);\n } catch (error) {\n lastError = error;\n }\n }\n\n throw lastError;\n }\n\n function storybookAstroResolveBrowserModulePath(moduleName, resolveFrom = process.cwd()) {\n const resolvedPath = storybookAstroResolveFromCandidates(moduleName, resolveFrom).replace(/\\\\\\\\/g, '/');\n\n return '/@fs/' + resolvedPath;\n }\n `;\n}\n\nfunction buildImportStatements(integrations: Integration[]) {\n return integrations\n .filter((integration) => integration.renderer.server)\n .map(\n (integration) =>\n `import ${integration.name}Renderer from '${integration.renderer.server?.entrypoint}';`\n )\n .join('\\n');\n}\n\nfunction buildServerRenderer(integration: Integration) {\n const serverRenderer = integration.renderer.server;\n\n if (!serverRenderer) {\n return '';\n }\n\n if (integration.name === 'solid') {\n return `\n container.addServerRenderer({\n name: '${serverRenderer.name}',\n renderer: {\n ...${integration.name}Renderer,\n name: '${serverRenderer.name}'\n }\n });\n `;\n }\n\n return `\n container.addServerRenderer({\n name: '${serverRenderer.name}',\n renderer: ${integration.name}Renderer\n });\n `;\n}\n\nfunction buildClientRenderer(integration: Integration) {\n const clientRenderer = integration.renderer.client;\n\n if (clientRenderer) {\n return `\n container.addClientRenderer({\n name: '${clientRenderer.name}',\n entrypoint: '${clientRenderer.entrypoint}'\n });\n `;\n }\n\n return '';\n}\n","import type { Plugin } from 'vite';\n\nconst FONTS_RUNTIME_STUB = `\nexport const fontData = {};\nexport function createGetFontData(fontsMod) {\n return fontsMod?.fontDataByCssVariable ?? {};\n}\n`;\n\nconst FONTS_INTERNAL_STUB = `\nexport const componentDataByCssVariable = new Map();\nexport const fontDataByCssVariable = {};\n`;\n\n/**\n * Provides fallback resolution for Astro's font-related virtual modules\n * and package import paths in Storybook's SSR Vite server.\n *\n * In Astro 6, the `astro:assets` virtual module depends on font-related\n * modules through virtual modules and a bare `astro/assets/fonts/runtime`\n * import. In the Storybook SSR context:\n *\n * 1. The fonts plugin's filter-based `resolveId` may not trigger for\n * the virtual module IDs.\n * 2. A Vite transform rewrites the `astro:assets` module to import\n * `createGetFontData` from `astro/assets/fonts/runtime` (without\n * `.js`), which fails against Astro's package.json exports map.\n * 3. The `createGetFontData` function is injected by a runtime Vite\n * transform that doesn't run in our SSR context.\n *\n * This plugin stubs all three font module paths with no-op exports,\n * since Storybook doesn't need Astro's font system.\n */\nexport function vitePluginAstroFontsFallback(): Plugin {\n const VIRTUAL_ID = 'virtual:astro:assets/fonts/internal';\n const RUNTIME_VIRTUAL_ID = 'virtual:astro:assets/fonts/runtime';\n const RESOLVED_VIRTUAL_ID = '\\0' + VIRTUAL_ID;\n const RESOLVED_RUNTIME_VIRTUAL_ID = '\\0' + RUNTIME_VIRTUAL_ID;\n const RESOLVED_FONTS_RUNTIME_ID = '\\0storybook:astro-fonts-runtime';\n\n return {\n name: 'storybook-astro-fonts-fallback',\n // Must run before vite:resolve to intercept virtual modules\n // before Vite tries to resolve them as Node package imports\n enforce: 'pre',\n\n resolveId(id) {\n if (id === VIRTUAL_ID) {\n return RESOLVED_VIRTUAL_ID;\n }\n if (id === RUNTIME_VIRTUAL_ID) {\n return RESOLVED_RUNTIME_VIRTUAL_ID;\n }\n // Intercept the bare package import (without .js) and the .js variant\n if (id === 'astro/assets/fonts/runtime' || id === 'astro/assets/fonts/runtime.js') {\n return RESOLVED_FONTS_RUNTIME_ID;\n }\n },\n\n load(id) {\n if (id === RESOLVED_VIRTUAL_ID) {\n return { code: FONTS_INTERNAL_STUB };\n }\n if (id === RESOLVED_RUNTIME_VIRTUAL_ID || id === RESOLVED_FONTS_RUNTIME_ID) {\n return { code: FONTS_RUNTIME_STUB };\n }\n }\n };\n}\n","import type { Plugin } from 'vite';\n\nconst OPTS_STUB = 'export default {}';\n\nconst VIRTUAL_IDS = ['astro:react:opts', 'astro:preact:opts'];\n\nexport function vitePluginAstroIntegrationOptsFallback(): Plugin {\n const resolvedIds = new Map(VIRTUAL_IDS.map((id) => [id, `\\0${id}`]));\n const resolvedIdSet = new Set(resolvedIds.values());\n\n return {\n name: 'storybook-astro-integration-opts-fallback',\n enforce: 'pre',\n\n resolveId(id) {\n return resolvedIds.get(id);\n },\n\n load(id) {\n if (resolvedIdSet.has(id)) {\n return { code: OPTS_STUB };\n }\n }\n };\n}\n","import type { Plugin } from 'vite';\n\nconst VUE_APP_STUB = `\nexport const setup = () => {};\n`;\n\n// Different versions of @astrojs/vue use different virtual module names\nconst VIRTUAL_IDS = ['virtual:astro:vue-app', 'virtual:@astrojs/vue/app'];\n\n/**\n * Provides fallback resolution for @astrojs/vue's virtual module\n * in Storybook's SSR Vite server.\n *\n * @astrojs/vue's server.js imports a virtual module to get a setup function\n * for configuring the Vue app instance. The virtual module name varies by version:\n * - v6.0.0-beta.1: \"virtual:astro:vue-app\"\n * - Later versions: \"virtual:@astrojs/vue/app\"\n *\n * The Vite plugin that normally creates this virtual module may not run in\n * Storybook's SSR context, so this plugin stubs it with a no-op setup function\n * (the default behavior when no appEntrypoint is configured).\n */\nexport function vitePluginAstroVueFallback(): Plugin {\n const resolvedIds = new Map(VIRTUAL_IDS.map((id) => [id, '\\0' + id]));\n const resolvedIdSet = new Set(resolvedIds.values());\n\n return {\n name: 'storybook-astro-vue-fallback',\n // Must run before vite:resolve to intercept virtual modules\n // before Vite tries to resolve them as Node package imports\n enforce: 'pre',\n\n resolveId(id) {\n const resolved = resolvedIds.get(id);\n\n if (resolved) {\n return resolved;\n }\n },\n\n load(id) {\n if (resolvedIdSet.has(id)) {\n return { code: VUE_APP_STUB };\n }\n }\n };\n}\n","import type { Plugin } from 'vite';\n\nconst ROUTES_STUB = `\nexport const routes = [];\n`;\n\n/**\n * Provides fallback resolution for Astro's routes virtual module\n * in Storybook's SSR Vite server.\n *\n * In Astro 6, the manifest and app entrypoints import from \"virtual:astro:routes\"\n * to get route data. In Storybook's context, there are no routes, so this plugin\n * stubs the virtual module with an empty routes array.\n */\nexport function vitePluginAstroRoutesFallback(): Plugin {\n const VIRTUAL_ID = 'virtual:astro:routes';\n const RESOLVED_VIRTUAL_ID = '\\0' + VIRTUAL_ID;\n\n return {\n name: 'storybook-astro-routes-fallback',\n // Must run before vite:resolve to intercept virtual modules\n // before Vite tries to resolve them as Node package imports\n enforce: 'pre',\n\n resolveId(id) {\n if (id === VIRTUAL_ID) {\n return RESOLVED_VIRTUAL_ID;\n }\n },\n\n load(id) {\n if (id === RESOLVED_VIRTUAL_ID) {\n return { code: ROUTES_STUB };\n }\n }\n };\n}\n","import type { PluginOption } from 'vite';\nimport {\n loadStoryInlineModule,\n resolveStoryModuleMock,\n STORYBOOK_ASTRO_INLINE_MODULE_PREFIX\n} from './module-mocks.ts';\n\nexport function vitePluginStoryModuleMocks(): PluginOption {\n return {\n name: 'storybook-astro:story-module-mocks',\n enforce: 'pre',\n resolveId(id) {\n if (id.startsWith(STORYBOOK_ASTRO_INLINE_MODULE_PREFIX)) {\n return `\\0${id}`;\n }\n\n const mockedModule = resolveStoryModuleMock(id);\n\n if (mockedModule) {\n return mockedModule;\n }\n\n return null;\n },\n load(id) {\n return loadStoryInlineModule(id);\n }\n } satisfies PluginOption;\n}\n","import type { ViteDevServer } from 'vite';\n\ntype SsrLoadModuleOptions = {\n fixStacktrace?: boolean;\n};\n\nexport async function ssrLoadModuleWithFsFallback<TModule = unknown>(\n viteServer: Pick<ViteDevServer, 'ssrLoadModule'>,\n id: string,\n options?: SsrLoadModuleOptions\n) {\n const ids = [id];\n\n if (id.startsWith('/') && !id.startsWith('/@fs/')) {\n ids.push(`/@fs${id}`);\n }\n\n let lastError: unknown;\n\n for (const candidate of ids) {\n try {\n return await viteServer.ssrLoadModule(candidate, options) as TModule;\n } catch (error) {\n lastError = error;\n }\n }\n\n throw lastError;\n}\n","import { existsSync, statSync } from 'node:fs';\nimport { extname, resolve } from 'node:path';\n\nexport type StoryRulesOptions =\n | string\n | {\n configFile: string;\n };\n\nexport function resolveRulesConfigFilePath(\n options?: StoryRulesOptions,\n resolveFrom = process.cwd()\n): string | undefined {\n if (options === undefined) {\n return undefined;\n }\n\n const configFile = normalizeConfigFileOption(options);\n const resolvedConfigFilePath = resolve(resolveFrom, configFile);\n const normalizedConfigFilePath = resolveConfigFilePath(resolvedConfigFilePath);\n\n if (!normalizedConfigFilePath) {\n throw new Error(\n `framework.options.storyRules config file was not found: ${resolvedConfigFilePath}. ` +\n 'Provide an existing path in framework.options.storyRules.'\n );\n }\n\n return normalizedConfigFilePath;\n}\n\nfunction normalizeConfigFileOption(options: StoryRulesOptions): string {\n const configFile =\n typeof options === 'string'\n ? options\n : typeof options === 'object' && options !== null\n ? options.configFile\n : undefined;\n\n if (typeof configFile !== 'string') {\n throw new Error(\n 'framework.options.storyRules must be either a string path or an object with a string configFile.'\n );\n }\n\n const normalizedConfigFile = configFile.trim();\n\n if (!normalizedConfigFile) {\n throw new Error('framework.options.storyRules config file path cannot be empty.');\n }\n\n return normalizedConfigFile;\n}\n\nfunction resolveConfigFilePath(filePath: string): string | undefined {\n if (existsSync(filePath)) {\n const fileStats = statSync(filePath);\n\n if (fileStats.isFile()) {\n return filePath;\n }\n }\n\n if (extname(filePath)) {\n return undefined;\n }\n\n const extensions = ['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs'];\n\n for (const extension of extensions) {\n const candidateFilePath = `${filePath}${extension}`;\n\n if (existsSync(candidateFilePath)) {\n return candidateFilePath;\n }\n }\n\n for (const extension of extensions) {\n const candidateFilePath = resolve(filePath, `index${extension}`);\n\n if (existsSync(candidateFilePath)) {\n return candidateFilePath;\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAE9B,SAAS,cAAc,oBAAyE;;;ACKzF,SAAS,oBAAoB,SAA6C;AAC/E,QAAM,0BAA0B,KAAK,QAAQ,eAAe;AAE5D,SAAO;AAAA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