@storybook-astro/framework 1.2.0 → 1.3.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{base-IRZo3zgK.d.ts → base-DT67T5pi.d.ts} +1 -0
- package/dist/{chunk-T7NWIO5S.js → chunk-2EABPTOY.js} +5 -5
- package/dist/{chunk-PJEDXZVN.js → chunk-7YBE4TTI.js} +2 -1
- package/dist/chunk-7YBE4TTI.js.map +1 -0
- package/dist/{chunk-POHTFYST.js → chunk-AYYMNFI6.js} +104 -6
- package/dist/chunk-AYYMNFI6.js.map +1 -0
- package/dist/chunk-B5HHF6FC.js +116 -0
- package/dist/chunk-B5HHF6FC.js.map +1 -0
- package/dist/chunk-H3XZHW6Z.js +1402 -0
- package/dist/chunk-H3XZHW6Z.js.map +1 -0
- package/dist/{chunk-DNGQBPT7.js → chunk-PUTCAN6X.js} +5 -2
- package/dist/{chunk-DNGQBPT7.js.map → chunk-PUTCAN6X.js.map} +1 -1
- package/dist/{chunk-OUEDTRBO.js → chunk-TWAO2IQW.js} +229 -67
- package/dist/chunk-TWAO2IQW.js.map +1 -0
- package/dist/{chunk-4SWPVM6R.js → chunk-WUTCMEF5.js} +2 -2
- package/dist/index.d.ts +17 -7
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/integrations/index.d.ts +2 -1
- package/dist/integrations/index.js +1 -1
- package/dist/middleware.js +18 -131
- package/dist/middleware.js.map +1 -1
- package/dist/{types-C-jan6Px.d.ts → preset-BvgHg2of.d.ts} +8 -11
- package/dist/preset.d.ts +2 -10
- package/dist/preset.js +5 -4
- package/dist/renderer/renderer-dev.js +62 -0
- package/dist/renderer/renderer-dev.js.map +1 -0
- package/dist/renderer/renderer-server.js +92 -0
- package/dist/renderer/renderer-server.js.map +1 -0
- package/dist/renderer/renderer-static.js +54 -0
- package/dist/renderer/renderer-static.js.map +1 -0
- package/dist/testing.js +12 -11
- package/dist/testing.js.map +1 -1
- package/dist/{viteStorybookAstroMiddlewarePlugin-2EFKTECT.js → viteStorybookAstroMiddlewarePlugin-UB6ZLJ4B.js} +4 -3
- package/dist/vitest/global-setup.js +6 -5
- package/dist/vitest/global-setup.js.map +1 -1
- package/dist/vitest/index.d.ts +1 -1
- package/dist/vitest/index.js +3 -3
- package/package.json +14 -43
- package/src/astroImageService.ts +57 -0
- package/src/astroRenderHandler.ts +203 -0
- package/src/importAstroConfig.ts +1 -1
- package/src/index.ts +2 -0
- package/src/integrations/alpine.ts +1 -0
- package/src/integrations/base.ts +6 -0
- package/src/middleware.ts +29 -200
- package/src/module-mocks.ts +153 -5
- package/src/preset.ts +38 -8
- package/src/productionRenderRuntime.ts +187 -0
- package/src/rules.test.ts +52 -4
- package/src/rules.ts +54 -7
- package/src/server/index.ts +101 -31
- package/src/storyRulesRuntime.ts +34 -0
- package/src/storySsrVite.ts +240 -0
- package/src/types.ts +0 -9
- package/src/virtual.d.ts +17 -3
- package/src/vite/{astroFilesVirtualModulePlugin.ts → astroFilesPlugin.ts} +4 -4
- package/src/vite/sanitizeConfigPlugin.ts +18 -0
- package/src/vite/{storybookAstroServerAuthConfigVirtualModulePlugin.test.ts → serverAuthPlugin.test.ts} +7 -10
- package/src/vite/{storybookAstroServerAuthConfigVirtualModulePlugin.ts → serverAuthPlugin.ts} +6 -9
- package/src/vite/serverRuntimePlugin.ts +109 -0
- package/src/vite/{storybookAstroRulesConfigVirtualModulePlugin.ts → storyRulesPlugin.ts} +6 -7
- package/src/vite/{createVirtualModulePlugin.test.ts → virtualModulePlugin.test.ts} +5 -5
- package/src/vite/{createVirtualModulePlugin.ts → virtualModulePlugin.ts} +2 -2
- package/src/viteAstroContainerRenderersPlugin.ts +72 -2
- package/src/vitePluginAstroBuildPrerender.ts +75 -646
- package/src/vitePluginAstroBuildServer.ts +217 -165
- package/src/vitePluginAstroBuildShared.test.ts +87 -0
- package/src/vitePluginAstroBuildShared.ts +465 -0
- package/src/vitePluginStoryModuleMocks.ts +29 -0
- package/src/viteStorybookAstroMiddlewarePlugin.ts +8 -0
- package/src/viteStorybookAstroRendererPlugin.ts +13 -6
- package/src/viteStorybookRendererFallbackPlugin.ts +2 -2
- package/dist/chunk-OUEDTRBO.js.map +0 -1
- package/dist/chunk-PBISP7PA.js +0 -1137
- package/dist/chunk-PBISP7PA.js.map +0 -1
- package/dist/chunk-PJEDXZVN.js.map +0 -1
- package/dist/chunk-POHTFYST.js.map +0 -1
- package/dist/node/index.d.ts +0 -10
- package/dist/node/index.js +0 -10
- package/dist/node/index.js.map +0 -1
- package/src/vite/storybookAstroSanitizationConfigVirtualModulePlugin.ts +0 -21
- /package/dist/{chunk-T7NWIO5S.js.map → chunk-2EABPTOY.js.map} +0 -0
- /package/dist/{chunk-4SWPVM6R.js.map → chunk-WUTCMEF5.js.map} +0 -0
- /package/dist/{viteStorybookAstroMiddlewarePlugin-2EFKTECT.js.map → viteStorybookAstroMiddlewarePlugin-UB6ZLJ4B.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rules.ts","../src/lib/sanitization.ts","../src/storyRulesRuntime.ts","../src/astroRenderHandler.ts","../src/astroImageService.ts"],"sourcesContent":["import { dirname, isAbsolute, resolve } from 'node:path';\nimport {\n createInlineStoryModuleMock,\n createPathStoryModuleMock,\n type StoryModuleMockEntry,\n type StoryModuleMockFactoryResult\n} from './module-mocks.ts';\nimport type { RenderStoryInput } from './types.ts';\n\nexport type StoryRuleCleanup = () => void | Promise<void>;\ntype StoryRuleUseResult = void | StoryRuleCleanup | Promise<void | StoryRuleCleanup>;\n\nexport type StoryRuleMockFactory =\n () => StoryModuleMockFactoryResult | Promise<StoryModuleMockFactoryResult>;\n\nexport type StoryRuleMock = {\n (specifier: string, replacement: string): void;\n (specifier: string, factory: StoryRuleMockFactory): void;\n};\n\nexport type StoryRuleUseContext = {\n story: StoryRuleStory;\n mock: StoryRuleMock;\n};\n\nexport type StoryRuleUse = (context: StoryRuleUseContext) => StoryRuleUseResult;\n\nexport type StoryRule = {\n match: string | string[];\n use: StoryRuleUse | StoryRuleUse[];\n};\n\nexport type StoryRulesConfig = {\n rules: StoryRule[];\n};\n\nexport type StoryRuleStory = {\n id: string;\n title?: string;\n name?: string;\n keys: string[];\n};\n\nexport type StoryRuleSelectionInput = {\n configModule: unknown;\n configFilePath?: string;\n story?: RenderStoryInput;\n};\n\nexport type StoryRuleSelection = {\n moduleMocks: Map<string, StoryModuleMockEntry>;\n cleanups: StoryRuleCleanup[];\n};\n\ntype MutableStoryRuleSelection = {\n moduleMocks: Map<string, StoryModuleMockEntry>;\n cleanups: StoryRuleCleanup[];\n};\n\nexport function defineStoryRules(config: StoryRulesConfig): StoryRulesConfig {\n return config;\n}\n\nexport async function selectStoryRules(\n input: StoryRuleSelectionInput\n): Promise<StoryRuleSelection> {\n const config = normalizeRulesConfig(input.configModule);\n const story = normalizeStory(input.story);\n const selection = createEmptySelection();\n\n for (const rule of config.rules) {\n if (!isStoryRuleMatch(rule.match, story)) {\n continue;\n }\n\n const uses = Array.isArray(rule.use) ? rule.use : [rule.use];\n\n for (const use of uses) {\n const pendingModuleMocks: Promise<void>[] = [];\n\n if (typeof use !== 'function') {\n throw new Error('Each story rule \"use\" entry must be a function.');\n }\n\n const cleanup = await use({\n story,\n mock: ((specifier, replacementOrFactory) => {\n const normalizedSpecifier = normalizeMockSpecifier(specifier);\n\n if (typeof replacementOrFactory === 'function') {\n pendingModuleMocks.push(\n Promise.resolve(replacementOrFactory()).then((exportsObject) => {\n selection.moduleMocks.set(\n normalizedSpecifier,\n createInlineStoryModuleMock(normalizeMockFactoryResult(exportsObject))\n );\n\n return undefined;\n })\n );\n\n return;\n }\n\n const normalizedReplacement = normalizeMockReplacement(\n replacementOrFactory,\n input.configFilePath\n );\n\n selection.moduleMocks.set(normalizedSpecifier, createPathStoryModuleMock(normalizedReplacement));\n }) as StoryRuleMock\n });\n\n if (pendingModuleMocks.length > 0) {\n await Promise.all(pendingModuleMocks);\n }\n\n if (cleanup !== undefined) {\n if (typeof cleanup !== 'function') {\n throw new Error('Story rule \"use\" must return either nothing or a cleanup function.');\n }\n\n selection.cleanups.push(cleanup);\n }\n }\n }\n\n return selection;\n}\n\nexport async function withStoryRuleCleanups<T>(\n cleanups: StoryRuleCleanup[],\n callback: () => Promise<T>\n): Promise<T> {\n let result: T | undefined;\n let callbackError: unknown;\n\n try {\n result = await callback();\n } catch (error) {\n callbackError = error;\n }\n\n try {\n await runStoryRuleCleanups(cleanups);\n } catch (cleanupError) {\n if (callbackError) {\n throw new AggregateError(\n [callbackError, cleanupError],\n 'Story rule execution and cleanup both failed.'\n );\n }\n\n throw cleanupError;\n }\n\n if (callbackError) {\n throw callbackError;\n }\n\n return result as T;\n}\n\nexport async function runStoryRuleCleanups(cleanups: StoryRuleCleanup[]): Promise<void> {\n const errors: unknown[] = [];\n\n for (let index = cleanups.length - 1; index >= 0; index -= 1) {\n try {\n await cleanups[index]();\n } catch (error) {\n errors.push(error);\n }\n }\n\n if (errors.length === 1) {\n throw errors[0];\n }\n\n if (errors.length > 1) {\n throw new AggregateError(errors, 'Story rule cleanup failed.');\n }\n}\n\nfunction normalizeRulesConfig(configModule: unknown): StoryRulesConfig {\n const configExport = getRulesConfigExport(configModule);\n\n if (configExport === undefined || configExport === null) {\n return {\n rules: []\n };\n }\n\n if (!isRecord(configExport)) {\n throw new Error(\n 'Story rules config must export an object with a \"rules\" array via a default export or named export.'\n );\n }\n\n const rules = configExport.rules;\n\n if (rules === undefined) {\n return {\n rules: []\n };\n }\n\n if (!Array.isArray(rules)) {\n throw new Error('Story rules config \"rules\" must be an array.');\n }\n\n return {\n rules: rules as StoryRule[]\n };\n}\n\nfunction getRulesConfigExport(configModule: unknown): unknown {\n if (!isRecord(configModule)) {\n return configModule;\n }\n\n if ('default' in configModule && configModule.default !== undefined) {\n return configModule.default;\n }\n\n if ('rules' in configModule) {\n return {\n rules: configModule.rules\n };\n }\n\n return undefined;\n}\n\nfunction normalizeStory(story?: RenderStoryInput): StoryRuleStory {\n const id = normalizeStoryId(story?.id);\n const title = normalizeOptionalString(story?.title);\n const name = normalizeOptionalString(story?.name);\n const keys = Array.from(resolveStoryKeys({ id, title, name }));\n\n return {\n id,\n title,\n name,\n keys\n };\n}\n\nfunction resolveStoryKeys(story: { id: string; title?: string; name?: string }) {\n const keys = new Set<string>();\n\n keys.add('');\n\n const storyId = story.id;\n const idPath = storyId ? storyId.replaceAll('--', '/') : '';\n\n if (storyId) {\n keys.add(storyId);\n keys.add(`/story/${storyId}`);\n }\n\n if (idPath) {\n keys.add(idPath);\n keys.add(`/story/${idPath}`);\n }\n\n const titlePath = story.title\n ? story.title\n .split('/')\n .map((segment) => slugify(segment))\n .filter(Boolean)\n .join('/')\n : '';\n\n const storyNamePath = story.name ? slugify(story.name) : '';\n\n if (titlePath && storyNamePath) {\n const composedPath = `${titlePath}/${storyNamePath}`;\n\n keys.add(composedPath);\n keys.add(`/story/${composedPath}`);\n }\n\n return keys;\n}\n\nfunction isStoryRuleMatch(match: string | string[], story: StoryRuleStory): boolean {\n const patterns = Array.isArray(match) ? match : [match];\n\n return patterns.some((pattern) => {\n if (typeof pattern !== 'string') {\n throw new Error('Story rule \"match\" must be a string or an array of strings.');\n }\n\n const normalizedPattern = pattern.trim();\n\n if (!normalizedPattern) {\n throw new Error('Story rule \"match\" cannot be empty.');\n }\n\n return story.keys.some((key) => isWildcardMatch(normalizedPattern, key));\n });\n}\n\nfunction isWildcardMatch(pattern: string, candidate: string): boolean {\n const escapedPattern = escapeRegExp(pattern).replaceAll('*', '.*');\n const regex = new RegExp(`^${escapedPattern}$`);\n\n return regex.test(candidate);\n}\n\nfunction normalizeStoryId(id?: string): string {\n const value = normalizeOptionalString(id) ?? '';\n\n if (!value) {\n return '';\n }\n\n return value.startsWith('/story/') ? value.slice('/story/'.length) : value;\n}\n\nfunction normalizeOptionalString(value: unknown): string | undefined {\n if (typeof value !== 'string') {\n return undefined;\n }\n\n const normalizedValue = value.trim();\n\n return normalizedValue || undefined;\n}\n\nfunction normalizeMockSpecifier(value: unknown): string {\n if (typeof value !== 'string') {\n throw new Error('Story rule mock specifier must be a string.');\n }\n\n const normalizedValue = value.trim();\n\n if (!normalizedValue) {\n throw new Error('Story rule mock specifier cannot be empty.');\n }\n\n return normalizedValue;\n}\n\nfunction normalizeMockReplacement(value: unknown, configFilePath?: string): string {\n if (typeof value !== 'string') {\n throw new Error('Story rule mock replacement must be a string.');\n }\n\n const normalizedValue = value.trim();\n\n if (!normalizedValue) {\n throw new Error('Story rule mock replacement cannot be empty.');\n }\n\n if (isAbsolute(normalizedValue)) {\n return toPosixPath(normalizedValue);\n }\n\n if (normalizedValue.startsWith('.')) {\n if (!configFilePath) {\n throw new Error(\n 'Story rule mock replacement uses a relative path, but rules config path is unavailable.'\n );\n }\n\n return toPosixPath(resolve(dirname(configFilePath), normalizedValue));\n }\n\n return normalizedValue;\n}\n\nfunction normalizeMockFactoryResult(value: unknown): StoryModuleMockFactoryResult {\n if (!isRecord(value)) {\n throw new Error('Story rule mock factory must return an object of module exports.');\n }\n\n return value;\n}\n\nfunction slugify(input: string): string {\n return input\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n}\n\nfunction createEmptySelection(): MutableStoryRuleSelection {\n return {\n moduleMocks: new Map(),\n cleanups: []\n };\n}\n\nfunction toPosixPath(input: string): string {\n return input.replaceAll('\\\\', '/');\n}\n\nfunction escapeRegExp(input: string) {\n return input.replace(/[|\\\\{}()[\\]^$+?.]/g, '\\\\$&');\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n\n return !Array.isArray(value);\n}\n","import sanitizeHtml from 'sanitize-html';\nimport type { IOptions } from 'sanitize-html';\n\ntype SanitizationPayload = {\n args: Record<string, unknown>;\n slots: Record<string, unknown>;\n};\n\nexport type SanitizationOptions = {\n enabled?: boolean;\n args?: string[];\n slots?: string[];\n sanitizeHtml?: IOptions;\n};\n\nexport type ResolvedSanitizationOptions = {\n enabled: boolean;\n args: string[];\n slots: string[];\n sanitizeHtml: IOptions;\n};\n\nconst DEFAULT_SANITIZE_HTML_OPTIONS: IOptions = {\n allowedTags: [\n 'a',\n 'abbr',\n 'b',\n 'blockquote',\n 'br',\n 'caption',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'dd',\n 'details',\n 'dfn',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'figure',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'hr',\n 'i',\n 'img',\n 'kbd',\n 'li',\n 'mark',\n 'ol',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'tr',\n 'u',\n 'ul',\n 'var',\n 'wbr'\n ],\n allowedAttributes: {\n '*': [\n 'aria-describedby',\n 'aria-hidden',\n 'aria-label',\n 'aria-labelledby',\n 'class',\n 'id',\n 'lang',\n 'role',\n 'title'\n ],\n a: ['href', 'name', 'target', 'rel'],\n img: ['src', 'srcset', 'alt', 'title', 'width', 'height', 'loading', 'decoding'],\n td: ['colspan', 'rowspan'],\n th: ['colspan', 'rowspan', 'scope'],\n time: ['datetime']\n },\n allowedSchemes: ['http', 'https', 'mailto', 'tel', 'data'],\n allowedSchemesByTag: {\n a: ['http', 'https', 'mailto', 'tel'],\n img: ['http', 'https', 'data']\n },\n allowedSchemesAppliedToAttributes: ['href', 'src', 'cite', 'srcset'],\n allowProtocolRelative: false,\n disallowedTagsMode: 'discard',\n enforceHtmlBoundary: true,\n parseStyleAttributes: false\n};\n\nexport function resolveSanitizationOptions(options?: SanitizationOptions): ResolvedSanitizationOptions {\n if (!options) {\n return {\n enabled: true,\n args: [],\n slots: ['**'],\n sanitizeHtml: mergeSanitizeHtmlOptions()\n };\n }\n\n const enabled = options.enabled ?? true;\n const args = normalizePathList(options.args, 'framework.options.sanitization.args');\n const slots =\n options.slots === undefined\n ? ['**']\n : normalizePathList(options.slots, 'framework.options.sanitization.slots');\n\n return {\n enabled,\n args,\n slots,\n sanitizeHtml: mergeSanitizeHtmlOptions(options.sanitizeHtml)\n };\n}\n\nexport function sanitizeRenderPayload(\n payload: SanitizationPayload,\n options: ResolvedSanitizationOptions\n): SanitizationPayload {\n if (!options.enabled) {\n return payload;\n }\n\n const sanitizedArgs =\n options.args.length > 0\n ? sanitizeRecord(payload.args, options.args, options.sanitizeHtml)\n : payload.args;\n\n const sanitizedSlots =\n options.slots.length > 0\n ? sanitizeRecord(payload.slots, options.slots, options.sanitizeHtml)\n : payload.slots;\n\n return {\n args: sanitizedArgs,\n slots: sanitizedSlots\n };\n}\n\nexport function serializeSanitizationOptions(options?: SanitizationOptions): string {\n if (!options) {\n return 'undefined';\n }\n\n assertNoFunctions(options.sanitizeHtml, 'framework.options.sanitization.sanitizeHtml');\n\n const state = {\n seen: new WeakSet<object>()\n };\n\n return serializeValue(options, 'framework.options.sanitization', state);\n}\n\nfunction mergeSanitizeHtmlOptions(userOptions?: IOptions): IOptions {\n const merged: IOptions = {\n ...DEFAULT_SANITIZE_HTML_OPTIONS,\n ...userOptions\n };\n\n if (\n isRecord(DEFAULT_SANITIZE_HTML_OPTIONS.allowedAttributes) &&\n isRecord(userOptions?.allowedAttributes)\n ) {\n merged.allowedAttributes = {\n ...DEFAULT_SANITIZE_HTML_OPTIONS.allowedAttributes,\n ...userOptions.allowedAttributes\n };\n }\n\n if (isRecord(userOptions?.allowedClasses)) {\n merged.allowedClasses = {\n ...(isRecord(DEFAULT_SANITIZE_HTML_OPTIONS.allowedClasses)\n ? DEFAULT_SANITIZE_HTML_OPTIONS.allowedClasses\n : {}),\n ...userOptions.allowedClasses\n };\n }\n\n if (isRecord(userOptions?.allowedStyles)) {\n merged.allowedStyles = {\n ...(isRecord(DEFAULT_SANITIZE_HTML_OPTIONS.allowedStyles)\n ? DEFAULT_SANITIZE_HTML_OPTIONS.allowedStyles\n : {}),\n ...userOptions.allowedStyles\n };\n }\n\n return merged;\n}\n\nfunction normalizePathList(value: unknown, path: string): string[] {\n if (value === undefined) {\n return [];\n }\n\n if (!Array.isArray(value)) {\n throw new Error(`${path} must be an array of dot-path patterns.`);\n }\n\n const unique = new Set<string>();\n\n value.forEach((entry, index) => {\n if (typeof entry !== 'string') {\n throw new Error(`${path}[${index}] must be a string.`);\n }\n\n const normalized = entry.trim();\n\n if (!normalized) {\n throw new Error(`${path}[${index}] cannot be an empty string.`);\n }\n\n unique.add(normalized);\n });\n\n return Array.from(unique);\n}\n\nfunction sanitizeRecord(\n record: Record<string, unknown>,\n patterns: string[],\n options: IOptions\n): Record<string, unknown> {\n const sanitized: Record<string, unknown> = {};\n\n Object.entries(record).forEach(([key, value]) => {\n sanitized[key] = sanitizeValue(value, key, patterns, options);\n });\n\n return sanitized;\n}\n\nfunction sanitizeValue(\n value: unknown,\n currentPath: string,\n patterns: string[],\n options: IOptions\n): unknown {\n if (typeof value === 'string') {\n if (shouldSanitizePath(currentPath, patterns)) {\n return sanitizeHtml(value, options);\n }\n\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map((item, index) => {\n const nextPath = `${currentPath}.${index}`;\n\n return sanitizeValue(item, nextPath, patterns, options);\n });\n }\n\n if (isRecord(value)) {\n const sanitized: Record<string, unknown> = {};\n\n Object.entries(value).forEach(([key, nestedValue]) => {\n const nextPath = `${currentPath}.${key}`;\n\n sanitized[key] = sanitizeValue(nestedValue, nextPath, patterns, options);\n });\n\n return sanitized;\n }\n\n return value;\n}\n\nfunction shouldSanitizePath(path: string, patterns: string[]): boolean {\n return patterns.some((pattern) => matchesPathPattern(path, pattern));\n}\n\nfunction matchesPathPattern(path: string, pattern: string): boolean {\n const pathSegments = path.split('.');\n const patternSegments = pattern.split('.');\n\n return matchSegments(pathSegments, patternSegments);\n}\n\nfunction serializeValue(value: unknown, path: string, state: { seen: WeakSet<object> }): string {\n if (value === null) {\n return 'null';\n }\n\n if (value === undefined) {\n return 'undefined';\n }\n\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n return JSON.stringify(value);\n }\n\n if (value instanceof RegExp) {\n return value.toString();\n }\n\n if (Array.isArray(value)) {\n const serializedItems = value.map((item, index) =>\n serializeValue(item, `${path}[${index}]`, state)\n );\n\n return `[${serializedItems.join(', ')}]`;\n }\n\n if (isRecord(value)) {\n if (state.seen.has(value)) {\n throw new Error(`${path} contains a circular reference.`);\n }\n\n state.seen.add(value);\n\n const serializedEntries = Object.entries(value)\n .filter(([, nestedValue]) => nestedValue !== undefined)\n .map(([key, nestedValue]) => {\n const serializedNestedValue = serializeValue(nestedValue, `${path}.${key}`, state);\n\n return `${JSON.stringify(key)}: ${serializedNestedValue}`;\n });\n\n return `{ ${serializedEntries.join(', ')} }`;\n }\n\n throw new Error(\n `${path} contains an unsupported value of type ${typeof value}. ` +\n 'Only plain objects, arrays, primitives, and regular expressions are supported.'\n );\n}\n\nfunction assertNoFunctions(value: unknown, path: string): void {\n const state = {\n seen: new WeakSet<object>()\n };\n\n assertNoFunctionsRecursive(value, path, state);\n}\n\nfunction assertNoFunctionsRecursive(\n value: unknown,\n path: string,\n state: { seen: WeakSet<object> }\n): void {\n if (typeof value === 'function') {\n throw new Error(\n `${path} cannot contain functions. ` +\n 'Function-valued sanitization hooks are not supported in framework options.'\n );\n }\n\n if (Array.isArray(value)) {\n value.forEach((item, index) => {\n assertNoFunctionsRecursive(item, `${path}[${index}]`, state);\n });\n\n return;\n }\n\n if (isRecord(value)) {\n if (state.seen.has(value)) {\n return;\n }\n\n state.seen.add(value);\n\n Object.entries(value).forEach(([key, nestedValue]) => {\n assertNoFunctionsRecursive(nestedValue, `${path}.${key}`, state);\n });\n }\n}\n\nfunction matchSegments(pathSegments: string[], patternSegments: string[]): boolean {\n if (patternSegments.length === 0) {\n return pathSegments.length === 0;\n }\n\n const [patternHead, ...patternTail] = patternSegments;\n\n if (patternHead === '**') {\n if (patternTail.length === 0) {\n return true;\n }\n\n for (let index = 0; index <= pathSegments.length; index += 1) {\n const remainingPath = pathSegments.slice(index);\n\n if (matchSegments(remainingPath, patternTail)) {\n return true;\n }\n }\n\n return false;\n }\n\n if (pathSegments.length === 0) {\n return false;\n }\n\n const [pathHead, ...pathTail] = pathSegments;\n\n if (patternHead === '*' || patternHead === pathHead) {\n return matchSegments(pathTail, patternTail);\n }\n\n return false;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n\n if (Array.isArray(value) || value instanceof RegExp) {\n return false;\n }\n\n const prototype = Object.getPrototypeOf(value);\n\n return prototype === Object.prototype || prototype === null;\n}\n","import { withStoryModuleMocks } from './module-mocks.ts';\nimport { selectStoryRules, withStoryRuleCleanups, type StoryRuleSelection } from './rules.ts';\nimport type { RenderStoryInput } from './types.ts';\n\nexport type ResolveRulesConfigModule = () => unknown | Promise<unknown>;\n\ntype RunWithStoryRulesOptions = {\n story?: RenderStoryInput;\n rulesConfigFilePath?: string;\n resolveRulesConfigModule?: ResolveRulesConfigModule;\n invalidateModuleGraph?: () => void;\n};\n\nexport async function runWithStoryRules<T>(\n options: RunWithStoryRulesOptions,\n callback: (selection: StoryRuleSelection) => Promise<T>\n): Promise<T> {\n const rulesConfigModule = options.resolveRulesConfigModule\n ? await options.resolveRulesConfigModule()\n : undefined;\n const selectedRules = await selectStoryRules({\n configModule: rulesConfigModule,\n configFilePath: options.rulesConfigFilePath,\n story: options.story\n });\n\n if (selectedRules.moduleMocks.size > 0) {\n options.invalidateModuleGraph?.();\n }\n\n return withStoryRuleCleanups(selectedRules.cleanups, async () => {\n return withStoryModuleMocks(selectedRules.moduleMocks, async () => callback(selectedRules));\n });\n}\n","import type { experimental_AstroContainer as AstroContainer } from 'astro/container';\nimport type { SanitizationOptions } from './lib/sanitization.ts';\nimport { resolveSanitizationOptions, sanitizeRenderPayload } from './lib/sanitization.ts';\nimport { runWithStoryRules, type ResolveRulesConfigModule } from './storyRulesRuntime.ts';\nimport type { RenderStoryInput } from './types.ts';\n\ntype AstroCreateResult = {\n createAstro?: (...args: unknown[]) => unknown;\n};\n\ntype AstroComponentFactory = ((\n result: AstroCreateResult,\n props: unknown,\n slots: unknown\n) => unknown) & {\n isAstroComponentFactory?: boolean;\n moduleId?: string;\n propagation?: unknown;\n};\n\nexport type HandlerProps = {\n component: string;\n args?: Record<string, unknown>;\n slots?: Record<string, unknown>;\n story?: RenderStoryInput;\n};\n\ntype CreateAstroRenderHandlerOptions = {\n container: Awaited<ReturnType<typeof AstroContainer.create>>;\n sanitization?: SanitizationOptions;\n rulesConfigFilePath?: string;\n resolveRulesConfigModule?: ResolveRulesConfigModule;\n loadModule: (id: string) => Promise<{ default: unknown }>;\n invalidateModuleGraph?: () => void;\n};\n\nexport function createAstroRenderHandler(options: CreateAstroRenderHandlerOptions) {\n const sanitizationOptions = resolveSanitizationOptions(options.sanitization);\n const componentCache = new Map<string, Promise<AstroComponentFactory>>();\n let renderQueue = Promise.resolve<void>(undefined);\n\n async function loadPatchedComponent(componentId: string, useCache = true) {\n if (!useCache) {\n const { default: component } = await options.loadModule(componentId);\n\n return patchCreateAstroCompat(component);\n }\n\n if (!componentCache.has(componentId)) {\n componentCache.set(\n componentId,\n (async () => {\n const { default: component } = await options.loadModule(componentId);\n\n return patchCreateAstroCompat(component);\n })()\n );\n }\n\n const cachedComponent = componentCache.get(componentId);\n\n if (!cachedComponent) {\n throw new Error(`Failed to load Astro component: ${componentId}`);\n }\n\n try {\n return await cachedComponent;\n } catch (error) {\n componentCache.delete(componentId);\n throw error;\n }\n }\n\n return async function handler(data: HandlerProps) {\n const executeRender = async () => {\n return runWithStoryRules(\n {\n story: data.story,\n rulesConfigFilePath: options.rulesConfigFilePath,\n resolveRulesConfigModule: options.resolveRulesConfigModule,\n invalidateModuleGraph: options.invalidateModuleGraph\n },\n async (selectedRules) => {\n const patchedComponent = await loadPatchedComponent(\n data.component,\n selectedRules.moduleMocks.size === 0\n );\n const processedArgs = await processImageMetadata(data.args ?? {});\n const sanitizedPayload = sanitizeRenderPayload(\n {\n args: processedArgs,\n slots: data.slots ?? {}\n },\n sanitizationOptions\n );\n\n return options.container.renderToString(\n patchedComponent as Parameters<typeof options.container.renderToString>[0],\n {\n props: sanitizedPayload.args,\n slots: sanitizedPayload.slots\n }\n );\n }\n );\n };\n\n const resultPromise = renderQueue.then(executeRender, executeRender);\n\n renderQueue = resultPromise.then(\n () => undefined,\n () => undefined\n );\n\n return resultPromise;\n };\n}\n\nexport function patchCreateAstroCompat(component: unknown): AstroComponentFactory {\n if (typeof component !== 'function') {\n throw new Error('Expected Astro component factory to be a function.');\n }\n\n const originalComponent = component as AstroComponentFactory;\n const wrapped = ((result: AstroCreateResult, props: unknown, slots: unknown) => {\n if (result && typeof result.createAstro === 'function') {\n const originalCreateAstro = result.createAstro;\n const runtimeExpectsAstroGlobal = originalCreateAstro.length >= 3;\n\n result.createAstro = (...args: unknown[]) => {\n if (args.length === 3 && !runtimeExpectsAstroGlobal) {\n return originalCreateAstro(args[1], args[2]);\n }\n\n return originalCreateAstro(...args);\n };\n }\n\n return originalComponent(result, props, slots);\n }) as AstroComponentFactory;\n\n wrapped.isAstroComponentFactory = originalComponent.isAstroComponentFactory;\n wrapped.moduleId = originalComponent.moduleId;\n wrapped.propagation = originalComponent.propagation;\n\n return wrapped;\n}\n\nasync function processImageMetadata(\n args: Record<string, unknown>\n): Promise<Record<string, unknown>> {\n const processed: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(args)) {\n if (isImageMetadata(value)) {\n // Keep ImageMetadata as an object so Astro's image pipeline still\n // recognizes it as an imported image and skips local path validation.\n processed[key] = value;\n\n continue;\n }\n\n if (Array.isArray(value)) {\n processed[key] = await Promise.all(\n value.map(async (item) => {\n if (isImageMetadata(item)) {\n return item;\n }\n\n if (isRecord(item)) {\n return processImageMetadata(item);\n }\n\n return item;\n })\n );\n\n continue;\n }\n\n if (isRecord(value)) {\n processed[key] = await processImageMetadata(value);\n\n continue;\n }\n\n processed[key] = value;\n }\n\n return processed;\n}\n\nfunction isImageMetadata(value: unknown): value is Record<string, unknown> {\n return (\n isRecord(value) &&\n typeof value.src === 'string' &&\n ('width' in value || 'height' in value || 'format' in value)\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n","export function ensureAstroPassthroughImageService() {\n if (!globalThis.astroAsset) {\n (globalThis as Record<string, unknown>).astroAsset = {};\n }\n\n (globalThis.astroAsset as Record<string, unknown>).imageService = {\n propertiesToHash: ['src'],\n validateOptions(options: Record<string, unknown>) {\n return options;\n },\n getURL(options: { src: unknown }) {\n const src = options.src;\n\n if (\n src != null &&\n typeof src === 'object' &&\n 'src' in src &&\n typeof (src as Record<string, unknown>).src === 'string'\n ) {\n return (src as Record<string, unknown>).src as string;\n }\n\n return typeof src === 'string' ? src : '';\n },\n getHTMLAttributes(options: Record<string, unknown>) {\n const {\n src,\n width,\n height,\n format,\n quality,\n densities,\n widths,\n formats,\n layout,\n priority,\n fit,\n position,\n background,\n ...attrs\n } = options;\n const srcObject =\n src != null && typeof src === 'object' ? (src as Record<string, unknown>) : null;\n\n return {\n ...attrs,\n width: width ?? srcObject?.width,\n height: height ?? srcObject?.height,\n loading: (attrs.loading as string | undefined) ?? 'lazy',\n decoding: (attrs.decoding as string | undefined) ?? 'async'\n };\n },\n getSrcSet() {\n return [];\n }\n };\n}\n"],"mappings":";;;;;;;AAAA,SAAS,SAAS,YAAY,eAAe;AA2DtC,SAAS,iBAAiB,QAA4C;AAC3E,SAAO;AACT;AAEA,eAAsB,iBACpB,OAC6B;AAC7B,QAAM,SAAS,qBAAqB,MAAM,YAAY;AACtD,QAAM,QAAQ,eAAe,MAAM,KAAK;AACxC,QAAM,YAAY,qBAAqB;AAEvC,aAAW,QAAQ,OAAO,OAAO;AAC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,GAAG;AAAA,MACL,IAAI;AACJ,YAAM,YACJ,OAAO,QAAQ,OAAO,QAAQ,WAAY,MAAkC;AAE9E,aAAO;AAAA,QACL,GAAG;AAAA,QACH,OAAO,SAAS,WAAW;AAAA,QAC3B,QAAQ,UAAU,WAAW;AAAA,QAC7B,SAAU,MAAM,WAAkC;AAAA,QAClD,UAAW,MAAM,YAAmC;AAAA,MACtD;AAAA,IACF;AAAA,IACA,YAAY;AACV,aAAO,CAAC;AAAA,IACV;AAAA,EACF;AACF;","names":["isRecord","isRecord"]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
solid,
|
|
6
6
|
svelte,
|
|
7
7
|
vue
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7YBE4TTI.js";
|
|
9
9
|
|
|
10
10
|
// src/testing/integration-config.ts
|
|
11
11
|
import { resolve as resolvePath } from "path";
|
|
@@ -93,4 +93,4 @@ export {
|
|
|
93
93
|
registerTestingIntegrationsForRoot,
|
|
94
94
|
resolveTestingIntegrationsForRoot
|
|
95
95
|
};
|
|
96
|
-
//# sourceMappingURL=chunk-
|
|
96
|
+
//# sourceMappingURL=chunk-WUTCMEF5.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -3,19 +3,29 @@ export { ArgTypes, Args, Parameters, ProjectAnnotations, StrictArgs } from 'stor
|
|
|
3
3
|
import { PreviewAddon, Preview as Preview$1, InferTypes } from 'storybook/internal/csf';
|
|
4
4
|
import { A as AstroRenderer } from './portable-stories-DXT_GOf6.js';
|
|
5
5
|
export { c as composeStories, a as composeStory, s as setProjectAnnotations } from './portable-stories-DXT_GOf6.js';
|
|
6
|
-
import { R as RenderStoryInput } from './
|
|
7
|
-
export { F as FrameworkOptions, a as RenderMode, S as SanitizationOptions, b as ServerBuildOptions, c as StoryRulesOptions, d as StorybookConfig } from './
|
|
8
|
-
export { core, viteFinal } from './preset.js';
|
|
6
|
+
import { R as RenderStoryInput } from './preset-BvgHg2of.js';
|
|
7
|
+
export { F as FrameworkOptions, a as RenderMode, S as SanitizationOptions, b as ServerBuildOptions, c as StoryRulesOptions, d as StorybookConfig, e as core, v as viteFinal } from './preset-BvgHg2of.js';
|
|
9
8
|
import 'vite';
|
|
10
|
-
import './base-
|
|
9
|
+
import './base-DT67T5pi.js';
|
|
11
10
|
import 'astro';
|
|
12
11
|
import 'sanitize-html';
|
|
13
12
|
|
|
13
|
+
type StoryModuleMockEntry = {
|
|
14
|
+
replacement: string;
|
|
15
|
+
inlineModuleId?: string;
|
|
16
|
+
};
|
|
17
|
+
type StoryModuleMockFactoryResult = Record<string, unknown>;
|
|
18
|
+
|
|
14
19
|
type StoryRuleCleanup = () => void | Promise<void>;
|
|
15
20
|
type StoryRuleUseResult = void | StoryRuleCleanup | Promise<void | StoryRuleCleanup>;
|
|
21
|
+
type StoryRuleMockFactory = () => StoryModuleMockFactoryResult | Promise<StoryModuleMockFactoryResult>;
|
|
22
|
+
type StoryRuleMock = {
|
|
23
|
+
(specifier: string, replacement: string): void;
|
|
24
|
+
(specifier: string, factory: StoryRuleMockFactory): void;
|
|
25
|
+
};
|
|
16
26
|
type StoryRuleUseContext = {
|
|
17
27
|
story: StoryRuleStory;
|
|
18
|
-
mock:
|
|
28
|
+
mock: StoryRuleMock;
|
|
19
29
|
};
|
|
20
30
|
type StoryRuleUse = (context: StoryRuleUseContext) => StoryRuleUseResult;
|
|
21
31
|
type StoryRule = {
|
|
@@ -37,7 +47,7 @@ type StoryRuleSelectionInput = {
|
|
|
37
47
|
story?: RenderStoryInput;
|
|
38
48
|
};
|
|
39
49
|
type StoryRuleSelection = {
|
|
40
|
-
moduleMocks: Map<string,
|
|
50
|
+
moduleMocks: Map<string, StoryModuleMockEntry>;
|
|
41
51
|
cleanups: StoryRuleCleanup[];
|
|
42
52
|
};
|
|
43
53
|
declare function defineStoryRules(config: StoryRulesConfig): StoryRulesConfig;
|
|
@@ -59,4 +69,4 @@ declare function definePreview<Addons extends PreviewAddon<never>[] = []>(input:
|
|
|
59
69
|
addons?: Addons;
|
|
60
70
|
}): Preview$1<AstroRenderer & InferTypes<Addons>>;
|
|
61
71
|
|
|
62
|
-
export { AstroRenderer, type Preview, RenderStoryInput, type StoryRule, type StoryRuleCleanup, type StoryRuleSelection, type StoryRuleSelectionInput, type StoryRuleStory, type StoryRuleUse, type StoryRuleUseContext, type StoryRulesConfig, definePreview, defineStoryRules };
|
|
72
|
+
export { AstroRenderer, type Preview, RenderStoryInput, type StoryRule, type StoryRuleCleanup, type StoryRuleMock, type StoryRuleMockFactory, type StoryRuleSelection, type StoryRuleSelectionInput, type StoryRuleStory, type StoryRuleUse, type StoryRuleUseContext, type StoryRulesConfig, definePreview, defineStoryRules };
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
core,
|
|
3
3
|
viteFinal
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-H3XZHW6Z.js";
|
|
5
|
+
import "./chunk-E4LB75JN.js";
|
|
5
6
|
import {
|
|
6
7
|
defineStoryRules
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TWAO2IQW.js";
|
|
8
9
|
import {
|
|
9
10
|
composeStories,
|
|
10
11
|
composeStory,
|
|
11
12
|
setProjectAnnotations
|
|
12
13
|
} from "./chunk-KXAAX3GN.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-AYYMNFI6.js";
|
|
15
|
+
import "./chunk-PUTCAN6X.js";
|
|
16
|
+
import "./chunk-B5HHF6FC.js";
|
|
16
17
|
import "./chunk-G3PMV62Z.js";
|
|
17
18
|
|
|
18
19
|
// src/index.ts
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Re-export types from storybook internal\nexport type {\n Args,\n ArgTypes,\n Parameters,\n ProjectAnnotations,\n StrictArgs\n} from 'storybook/internal/types';\n\nimport { definePreview as definePreviewBase, type PreviewAddon, type InferTypes, type Preview as CsfPreview } from 'storybook/internal/csf';\nimport type { ProjectAnnotations } from 'storybook/internal/types';\nimport type { AstroRenderer } from './portable-stories.ts';\n\n/**\n * Preview configuration type for `.storybook/preview.ts` in Astro projects.\n * Reflects the full type returned by `definePreview`, including addon type extensions.\n * Use this to annotate your preview module when needed:\n *\n * ```ts\n * import type { Preview } from '@storybook-astro/framework';\n * const preview: Preview = { ... };\n * export default preview;\n * ```\n */\nexport type Preview<Addons extends PreviewAddon<never>[] = []> = CsfPreview<AstroRenderer & InferTypes<Addons>>;\n\n// Export portable stories functionality\nexport {\n composeStories,\n composeStory,\n setProjectAnnotations,\n type AstroRenderer\n} from './portable-stories.ts';\n\n// Export framework types\nexport type {\n FrameworkOptions,\n RenderMode,\n RenderStoryInput,\n ServerBuildOptions,\n SanitizationOptions,\n StoryRulesOptions,\n StorybookConfig\n} from './types.ts';\nexport type {\n StoryRuleCleanup,\n StoryRule,\n StoryRulesConfig,\n StoryRuleSelection,\n StoryRuleSelectionInput,\n StoryRuleStory,\n StoryRuleUse,\n StoryRuleUseContext\n} from './rules.ts';\nexport { defineStoryRules } from './rules.ts';\n\n// Re-export preset functionality for framework usage\nexport { core, viteFinal } from './preset.ts';\n\n// Preview configuration helper\nexport function definePreview<Addons extends PreviewAddon<never>[] = []>(\n input: ProjectAnnotations<AstroRenderer> & { addons?: Addons }\n): CsfPreview<AstroRenderer & InferTypes<Addons>> {\n return definePreviewBase<AstroRenderer, Addons>(input);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Re-export types from storybook internal\nexport type {\n Args,\n ArgTypes,\n Parameters,\n ProjectAnnotations,\n StrictArgs\n} from 'storybook/internal/types';\n\nimport { definePreview as definePreviewBase, type PreviewAddon, type InferTypes, type Preview as CsfPreview } from 'storybook/internal/csf';\nimport type { ProjectAnnotations } from 'storybook/internal/types';\nimport type { AstroRenderer } from './portable-stories.ts';\n\n/**\n * Preview configuration type for `.storybook/preview.ts` in Astro projects.\n * Reflects the full type returned by `definePreview`, including addon type extensions.\n * Use this to annotate your preview module when needed:\n *\n * ```ts\n * import type { Preview } from '@storybook-astro/framework';\n * const preview: Preview = { ... };\n * export default preview;\n * ```\n */\nexport type Preview<Addons extends PreviewAddon<never>[] = []> = CsfPreview<AstroRenderer & InferTypes<Addons>>;\n\n// Export portable stories functionality\nexport {\n composeStories,\n composeStory,\n setProjectAnnotations,\n type AstroRenderer\n} from './portable-stories.ts';\n\n// Export framework types\nexport type {\n FrameworkOptions,\n RenderMode,\n RenderStoryInput,\n ServerBuildOptions,\n SanitizationOptions,\n StoryRulesOptions,\n StorybookConfig\n} from './types.ts';\nexport type {\n StoryRuleCleanup,\n StoryRuleMock,\n StoryRuleMockFactory,\n StoryRule,\n StoryRulesConfig,\n StoryRuleSelection,\n StoryRuleSelectionInput,\n StoryRuleStory,\n StoryRuleUse,\n StoryRuleUseContext\n} from './rules.ts';\nexport { defineStoryRules } from './rules.ts';\n\n// Re-export preset functionality for framework usage\nexport { core, viteFinal } from './preset.ts';\n\n// Preview configuration helper\nexport function definePreview<Addons extends PreviewAddon<never>[] = []>(\n input: ProjectAnnotations<AstroRenderer> & { addons?: Addons }\n): CsfPreview<AstroRenderer & InferTypes<Addons>> {\n return definePreviewBase<AstroRenderer, Addons>(input);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AASA,SAAS,iBAAiB,yBAAyF;AAqD5G,SAAS,cACd,OACgD;AAChD,SAAO,kBAAyC,KAAK;AACvD;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as astro from 'astro';
|
|
2
|
-
import { I as Integration } from '../base-
|
|
2
|
+
import { I as Integration } from '../base-DT67T5pi.js';
|
|
3
3
|
import { PreactPluginOptions } from '@preact/preset-vite';
|
|
4
4
|
import { Options as Options$6 } from '@vitejs/plugin-react';
|
|
5
5
|
import { Options as Options$7 } from 'vite-plugin-solid';
|
|
@@ -10,6 +10,7 @@ import { Options as Options$9 } from '@vitejs/plugin-vue-jsx';
|
|
|
10
10
|
type Options$5 = Record<string, unknown>;
|
|
11
11
|
declare class AlpineIntegration implements Integration {
|
|
12
12
|
readonly name = "alpine";
|
|
13
|
+
readonly factoryName = "alpinejs";
|
|
13
14
|
readonly dependencies: string[];
|
|
14
15
|
readonly options: Options$5;
|
|
15
16
|
readonly renderer: {};
|
package/dist/middleware.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
withStoryRuleCleanups
|
|
9
|
-
} from "./chunk-OUEDTRBO.js";
|
|
2
|
+
createAstroRenderHandler,
|
|
3
|
+
ensureAstroPassthroughImageService
|
|
4
|
+
} from "./chunk-TWAO2IQW.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveStoryModuleMock
|
|
7
|
+
} from "./chunk-B5HHF6FC.js";
|
|
10
8
|
import "./chunk-G3PMV62Z.js";
|
|
11
9
|
|
|
12
10
|
// src/middleware.ts
|
|
@@ -14,14 +12,17 @@ import { pathToFileURL } from "url";
|
|
|
14
12
|
import { experimental_AstroContainer as AstroContainer } from "astro/container";
|
|
15
13
|
import { addRenderers, resolveClientModules } from "virtual:astro-container-renderers";
|
|
16
14
|
async function handlerFactory(_integrations, options) {
|
|
17
|
-
|
|
15
|
+
ensureAstroPassthroughImageService();
|
|
18
16
|
const container = await AstroContainer.create({
|
|
19
|
-
// Somewhat hacky way to force client-side Storybook's Vite to resolve modules properly
|
|
20
17
|
resolve: async (specifier) => {
|
|
21
18
|
const mockedModule = resolveStoryModuleMock(specifier);
|
|
22
19
|
if (mockedModule) {
|
|
23
20
|
return mockedModule;
|
|
24
21
|
}
|
|
22
|
+
const customResolution = options?.resolveModule?.(specifier);
|
|
23
|
+
if (customResolution) {
|
|
24
|
+
return customResolution;
|
|
25
|
+
}
|
|
25
26
|
if (specifier.startsWith("astro:scripts")) {
|
|
26
27
|
return `/@id/${specifier}`;
|
|
27
28
|
}
|
|
@@ -33,7 +34,6 @@ async function handlerFactory(_integrations, options) {
|
|
|
33
34
|
}
|
|
34
35
|
});
|
|
35
36
|
addRenderers(container);
|
|
36
|
-
const sanitizationOptions = resolveSanitizationOptions(options?.sanitization);
|
|
37
37
|
const loadModule = options?.loadModule ?? ((id) => {
|
|
38
38
|
const normalizedId = /^[a-zA-Z]:[/\\]/.test(id) ? pathToFileURL(id).href : id;
|
|
39
39
|
return import(
|
|
@@ -41,127 +41,14 @@ async function handlerFactory(_integrations, options) {
|
|
|
41
41
|
normalizedId
|
|
42
42
|
);
|
|
43
43
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (!componentCache.has(componentId)) {
|
|
52
|
-
componentCache.set(componentId, (async () => {
|
|
53
|
-
const { default: component } = await loadModule(componentId);
|
|
54
|
-
return patchCreateAstroCompat(component);
|
|
55
|
-
})());
|
|
56
|
-
}
|
|
57
|
-
const cachedComponent = componentCache.get(componentId);
|
|
58
|
-
if (!cachedComponent) {
|
|
59
|
-
throw new Error(`Failed to load Astro component: ${componentId}`);
|
|
60
|
-
}
|
|
61
|
-
try {
|
|
62
|
-
return await cachedComponent;
|
|
63
|
-
} catch (error) {
|
|
64
|
-
componentCache.delete(componentId);
|
|
65
|
-
throw error;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return async function handler(data) {
|
|
69
|
-
const executeRender = async () => {
|
|
70
|
-
const rulesConfigModule = options?.resolveRulesConfigModule ? await options.resolveRulesConfigModule() : void 0;
|
|
71
|
-
const selectedRules = await selectStoryRules({
|
|
72
|
-
configModule: rulesConfigModule,
|
|
73
|
-
configFilePath: options?.rulesConfigFilePath,
|
|
74
|
-
story: data.story
|
|
75
|
-
});
|
|
76
|
-
return withStoryRuleCleanups(selectedRules.cleanups, async () => {
|
|
77
|
-
return withStoryModuleMocks(selectedRules.moduleMocks, async () => {
|
|
78
|
-
const patchedComponent = await loadPatchedComponent(
|
|
79
|
-
data.component,
|
|
80
|
-
selectedRules.moduleMocks.size === 0
|
|
81
|
-
);
|
|
82
|
-
const processedArgs = await processImageMetadata(data.args ?? {});
|
|
83
|
-
const sanitizedPayload = sanitizeRenderPayload(
|
|
84
|
-
{
|
|
85
|
-
args: processedArgs,
|
|
86
|
-
slots: data.slots ?? {}
|
|
87
|
-
},
|
|
88
|
-
sanitizationOptions
|
|
89
|
-
);
|
|
90
|
-
return container.renderToString(
|
|
91
|
-
patchedComponent,
|
|
92
|
-
{
|
|
93
|
-
props: sanitizedPayload.args,
|
|
94
|
-
slots: sanitizedPayload.slots
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
const resultPromise = renderQueue.then(executeRender, executeRender);
|
|
101
|
-
renderQueue = resultPromise.then(
|
|
102
|
-
() => void 0,
|
|
103
|
-
() => void 0
|
|
104
|
-
);
|
|
105
|
-
return resultPromise;
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function patchCreateAstroCompat(component) {
|
|
109
|
-
if (typeof component !== "function") {
|
|
110
|
-
throw new Error("Expected Astro component factory to be a function.");
|
|
111
|
-
}
|
|
112
|
-
const originalComponent = component;
|
|
113
|
-
const wrapped = ((result, props, slots) => {
|
|
114
|
-
if (result && typeof result.createAstro === "function") {
|
|
115
|
-
const originalCreateAstro = result.createAstro;
|
|
116
|
-
const runtimeExpectsAstroGlobal = originalCreateAstro.length >= 3;
|
|
117
|
-
result.createAstro = (...args) => {
|
|
118
|
-
if (args.length === 3 && !runtimeExpectsAstroGlobal) {
|
|
119
|
-
return originalCreateAstro(args[1], args[2]);
|
|
120
|
-
}
|
|
121
|
-
return originalCreateAstro(...args);
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
return originalComponent(result, props, slots);
|
|
44
|
+
return createAstroRenderHandler({
|
|
45
|
+
container,
|
|
46
|
+
sanitization: options?.sanitization,
|
|
47
|
+
rulesConfigFilePath: options?.rulesConfigFilePath,
|
|
48
|
+
resolveRulesConfigModule: options?.resolveRulesConfigModule,
|
|
49
|
+
loadModule,
|
|
50
|
+
invalidateModuleGraph: options?.invalidateModuleGraph
|
|
125
51
|
});
|
|
126
|
-
wrapped.isAstroComponentFactory = originalComponent.isAstroComponentFactory;
|
|
127
|
-
wrapped.moduleId = originalComponent.moduleId;
|
|
128
|
-
wrapped.propagation = originalComponent.propagation;
|
|
129
|
-
return wrapped;
|
|
130
|
-
}
|
|
131
|
-
async function processImageMetadata(args) {
|
|
132
|
-
const processed = {};
|
|
133
|
-
for (const [key, value] of Object.entries(args)) {
|
|
134
|
-
if (isImageMetadata(value)) {
|
|
135
|
-
processed[key] = value;
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
if (Array.isArray(value)) {
|
|
139
|
-
processed[key] = await Promise.all(
|
|
140
|
-
value.map(async (item) => {
|
|
141
|
-
if (isImageMetadata(item)) {
|
|
142
|
-
return item;
|
|
143
|
-
}
|
|
144
|
-
if (isRecord(item)) {
|
|
145
|
-
return processImageMetadata(item);
|
|
146
|
-
}
|
|
147
|
-
return item;
|
|
148
|
-
})
|
|
149
|
-
);
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
if (isRecord(value)) {
|
|
153
|
-
processed[key] = await processImageMetadata(value);
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
processed[key] = value;
|
|
157
|
-
}
|
|
158
|
-
return processed;
|
|
159
|
-
}
|
|
160
|
-
function isImageMetadata(value) {
|
|
161
|
-
return isRecord(value) && typeof value.src === "string" && ("width" in value || "height" in value || "format" in value);
|
|
162
|
-
}
|
|
163
|
-
function isRecord(value) {
|
|
164
|
-
return typeof value === "object" && value !== null;
|
|
165
52
|
}
|
|
166
53
|
export {
|
|
167
54
|
handlerFactory
|
package/dist/middleware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/middleware.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url';\nimport { experimental_AstroContainer as AstroContainer } from 'astro/container';\nimport type { Integration } from './integrations/index.ts';\nimport { installPassthroughImageService } from './lib/passthrough-image-service.ts';\nimport type { SanitizationOptions } from './lib/sanitization.ts';\nimport { resolveSanitizationOptions, sanitizeRenderPayload } from './lib/sanitization.ts';\nimport { resolveStoryModuleMock, withStoryModuleMocks } from './module-mocks.ts';\nimport { selectStoryRules, withStoryRuleCleanups } from './rules.ts';\nimport type { RenderStoryInput } from './types.ts';\nimport { addRenderers, resolveClientModules } from 'virtual:astro-container-renderers';\n\ntype ResolveRulesConfigModule = () => unknown | Promise<unknown>;\n\ntype AstroCreateResult = {\n createAstro?: (...args: unknown[]) => unknown;\n};\n\ntype AstroComponentFactory = ((\n result: AstroCreateResult,\n props: unknown,\n slots: unknown\n) => unknown) & {\n isAstroComponentFactory?: boolean;\n moduleId?: string;\n propagation?: unknown;\n};\n\nexport type HandlerProps = {\n component: string;\n args?: Record<string, unknown>;\n slots?: Record<string, unknown>;\n story?: RenderStoryInput;\n};\n\ntype HandlerFactoryOptions = {\n sanitization?: SanitizationOptions;\n rulesConfigFilePath?: string;\n resolveRulesConfigModule?: ResolveRulesConfigModule;\n loadModule?: (id: string) => Promise<{ default: unknown }>;\n};\n\nexport async function handlerFactory(_integrations: Integration[], options?: HandlerFactoryOptions) {\n // Inject a passthrough image service before any component renders. See\n // `lib/passthrough-image-service.ts` for why this is necessary.\n installPassthroughImageService();\n\n const container = await AstroContainer.create({\n // Somewhat hacky way to force client-side Storybook's Vite to resolve modules properly\n resolve: async (specifier) => {\n const mockedModule = resolveStoryModuleMock(specifier);\n\n if (mockedModule) {\n return mockedModule;\n }\n\n if (specifier.startsWith('astro:scripts')) {\n return `/@id/${specifier}`;\n }\n\n const resolution = resolveClientModules(specifier);\n\n if (resolution) {\n return resolution;\n }\n\n return specifier;\n }\n });\n\n addRenderers(container);\n const sanitizationOptions = resolveSanitizationOptions(options?.sanitization);\n const loadModule =\n options?.loadModule ??\n ((id: string) => {\n const normalizedId = /^[a-zA-Z]:[/\\\\]/.test(id) ? pathToFileURL(id).href : id;\n\n return import(/* @vite-ignore */ normalizedId);\n });\n const componentCache = new Map<string, Promise<AstroComponentFactory>>();\n let renderQueue = Promise.resolve<void>(undefined);\n\n async function loadPatchedComponent(componentId: string, useCache = true) {\n if (!useCache) {\n const { default: component } = await loadModule(componentId);\n\n return patchCreateAstroCompat(component);\n }\n\n if (!componentCache.has(componentId)) {\n componentCache.set(componentId, (async () => {\n const { default: component } = await loadModule(componentId);\n\n return patchCreateAstroCompat(component);\n })());\n }\n\n const cachedComponent = componentCache.get(componentId);\n\n if (!cachedComponent) {\n throw new Error(`Failed to load Astro component: ${componentId}`);\n }\n\n try {\n return await cachedComponent;\n } catch (error) {\n // Drop failed entries so transient/module errors can recover on the next request.\n componentCache.delete(componentId);\n throw error;\n }\n }\n\n return async function handler(data: HandlerProps) {\n const executeRender = async () => {\n const rulesConfigModule = options?.resolveRulesConfigModule\n ? await options.resolveRulesConfigModule()\n : undefined;\n\n const selectedRules = await selectStoryRules({\n configModule: rulesConfigModule,\n configFilePath: options?.rulesConfigFilePath,\n story: data.story\n });\n\n return withStoryRuleCleanups(selectedRules.cleanups, async () => {\n return withStoryModuleMocks(selectedRules.moduleMocks, async () => {\n const patchedComponent = await loadPatchedComponent(\n data.component,\n selectedRules.moduleMocks.size === 0\n );\n const processedArgs = await processImageMetadata(data.args ?? {});\n const sanitizedPayload = sanitizeRenderPayload(\n {\n args: processedArgs,\n slots: data.slots ?? {}\n },\n sanitizationOptions\n );\n\n return container.renderToString(\n patchedComponent as Parameters<typeof container.renderToString>[0],\n {\n props: sanitizedPayload.args,\n slots: sanitizedPayload.slots\n }\n );\n });\n });\n };\n\n const resultPromise = renderQueue.then(executeRender, executeRender);\n\n renderQueue = resultPromise.then(\n () => undefined,\n () => undefined\n );\n\n return resultPromise;\n };\n}\n\nfunction patchCreateAstroCompat(component: unknown): AstroComponentFactory {\n if (typeof component !== 'function') {\n throw new Error('Expected Astro component factory to be a function.');\n }\n\n const originalComponent = component as AstroComponentFactory;\n const wrapped = ((result: AstroCreateResult, props: unknown, slots: unknown) => {\n if (result && typeof result.createAstro === 'function') {\n const originalCreateAstro = result.createAstro;\n const runtimeExpectsAstroGlobal = originalCreateAstro.length >= 3;\n\n result.createAstro = (...args: unknown[]) => {\n if (args.length === 3 && !runtimeExpectsAstroGlobal) {\n return originalCreateAstro(args[1], args[2]);\n }\n\n return originalCreateAstro(...args);\n };\n }\n\n return originalComponent(result, props, slots);\n }) as AstroComponentFactory;\n\n wrapped.isAstroComponentFactory = originalComponent.isAstroComponentFactory;\n wrapped.moduleId = originalComponent.moduleId;\n wrapped.propagation = originalComponent.propagation;\n\n return wrapped;\n}\n\nasync function processImageMetadata(\n args: Record<string, unknown>\n): Promise<Record<string, unknown>> {\n const processed: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(args)) {\n if (isImageMetadata(value)) {\n // Keep ImageMetadata as a plain object — Astro's image service checks\n // isESMImportedImage (typeof src === 'object') and skips the /@fs/ string\n // validation that throws LocalImageUsedWrongly. Converting to a URL string\n // causes that error when the string starts with /@fs/.\n processed[key] = value;\n\n continue;\n }\n\n if (Array.isArray(value)) {\n processed[key] = await Promise.all(\n value.map(async (item) => {\n if (isImageMetadata(item)) {\n return item;\n }\n\n if (isRecord(item)) {\n return processImageMetadata(item);\n }\n\n return item;\n })\n );\n\n continue;\n }\n\n if (isRecord(value)) {\n processed[key] = await processImageMetadata(value);\n\n continue;\n }\n\n processed[key] = value;\n }\n\n return processed;\n}\n\nfunction isImageMetadata(value: unknown): value is Record<string, unknown> {\n return (\n isRecord(value) &&\n typeof value.src === 'string' &&\n ('width' in value || 'height' in value || 'format' in value)\n );\n}\n\n\nfunction isRecord(value: unknown): value is Record<string,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D;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/middleware.ts"],"sourcesContent":["/// <reference path=\"./virtual.d.ts\" />\n\nimport { pathToFileURL } from 'node:url';\nimport { experimental_AstroContainer as AstroContainer } from 'astro/container';\nimport { ensureAstroPassthroughImageService } from './astroImageService.ts';\nimport { createAstroRenderHandler, type HandlerProps } from './astroRenderHandler.ts';\nimport type { Integration } from './integrations/index.ts';\nimport type { SanitizationOptions } from './lib/sanitization.ts';\nimport { resolveStoryModuleMock } from './module-mocks.ts';\nimport { addRenderers, resolveClientModules } from 'virtual:astro-container-renderers';\n\ntype ResolveRulesConfigModule = () => unknown | Promise<unknown>;\n\ntype HandlerFactoryOptions = {\n sanitization?: SanitizationOptions;\n rulesConfigFilePath?: string;\n resolveRulesConfigModule?: ResolveRulesConfigModule;\n loadModule?: (id: string) => Promise<{ default: unknown }>;\n invalidateModuleGraph?: () => void;\n resolveModule?: (specifier: string) => string | undefined;\n};\n\nexport type { HandlerProps };\n\nexport async function handlerFactory(\n _integrations: Integration[],\n options?: HandlerFactoryOptions\n) {\n ensureAstroPassthroughImageService();\n\n const container = await AstroContainer.create({\n resolve: async (specifier) => {\n const mockedModule = resolveStoryModuleMock(specifier);\n\n if (mockedModule) {\n return mockedModule;\n }\n\n const customResolution = options?.resolveModule?.(specifier);\n\n if (customResolution) {\n return customResolution;\n }\n\n if (specifier.startsWith('astro:scripts')) {\n return `/@id/${specifier}`;\n }\n\n const resolution = resolveClientModules(specifier);\n\n if (resolution) {\n return resolution;\n }\n\n return specifier;\n }\n });\n\n addRenderers(container);\n\n const loadModule =\n options?.loadModule ??\n ((id: string) => {\n const normalizedId = /^[a-zA-Z]:[/\\\\]/.test(id) ? pathToFileURL(id).href : id;\n\n return import(/* @vite-ignore */ normalizedId);\n });\n\n return createAstroRenderHandler({\n container,\n sanitization: options?.sanitization,\n rulesConfigFilePath: options?.rulesConfigFilePath,\n resolveRulesConfigModule: options?.resolveRulesConfigModule,\n loadModule,\n invalidateModuleGraph: options?.invalidateModuleGraph\n });\n}\n"],"mappings":";;;;;;;;;;AAEA,SAAS,qBAAqB;AAC9B,SAAS,+BAA+B,sBAAsB;AAM9D,SAAS,cAAc,4BAA4B;AAenD,eAAsB,eACpB,eACA,SACA;AACA,qCAAmC;AAEnC,QAAM,YAAY,MAAM,eAAe,OAAO;AAAA,IAC5C,SAAS,OAAO,cAAc;AAC5B,YAAM,eAAe,uBAAuB,SAAS;AAErD,UAAI,cAAc;AAChB,eAAO;AAAA,MACT;AAEA,YAAM,mBAAmB,SAAS,gBAAgB,SAAS;AAE3D,UAAI,kBAAkB;AACpB,eAAO;AAAA,MACT;AAEA,UAAI,UAAU,WAAW,eAAe,GAAG;AACzC,eAAO,QAAQ,SAAS;AAAA,MAC1B;AAEA,YAAM,aAAa,qBAAqB,SAAS;AAEjD,UAAI,YAAY;AACd,eAAO;AAAA,MACT;AAEA,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AAED,eAAa,SAAS;AAEtB,QAAM,aACJ,SAAS,eACR,CAAC,OAAe;AACf,UAAM,eAAe,kBAAkB,KAAK,EAAE,IAAI,cAAc,EAAE,EAAE,OAAO;AAE3E,WAAO;AAAA;AAAA,MAA0B;AAAA;AAAA,EACnC;AAEF,SAAO,yBAAyB;AAAA,IAC9B;AAAA,IACA,cAAc,SAAS;AAAA,IACvB,qBAAqB,SAAS;AAAA,IAC9B,0BAA0B,SAAS;AAAA,IACnC;AAAA,IACA,uBAAuB,SAAS;AAAA,EAClC,CAAC;AACH;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StorybookConfig as StorybookConfig$1, CompatibleString, Options } from 'storybook/internal/types';
|
|
2
2
|
import { InlineConfig } from 'vite';
|
|
3
|
-
import { I as Integration } from './base-
|
|
3
|
+
import { I as Integration } from './base-DT67T5pi.js';
|
|
4
4
|
import { IOptions } from 'sanitize-html';
|
|
5
5
|
|
|
6
6
|
type SanitizationOptions = {
|
|
@@ -41,15 +41,6 @@ type StaticFrameworkOptions = BaseFrameworkOptions & {
|
|
|
41
41
|
renderMode: 'static';
|
|
42
42
|
storyRules?: StoryRulesOptions;
|
|
43
43
|
server?: never;
|
|
44
|
-
/**
|
|
45
|
-
* Additional source directories (relative to `resolveFrom`) to scan for
|
|
46
|
-
* hydratable client components (JSX/TSX/Vue/Svelte). Use this when stories
|
|
47
|
-
* reference components that live outside the default `src/components` scan
|
|
48
|
-
* root — for example, workspace packages included in the `stories` globs.
|
|
49
|
-
*
|
|
50
|
-
* @example ['../../packages/components/src']
|
|
51
|
-
*/
|
|
52
|
-
componentRoots?: string[];
|
|
53
44
|
};
|
|
54
45
|
type FrameworkOptions = ServerFrameworkOptions | StaticFrameworkOptions;
|
|
55
46
|
type StorybookConfigFramework = {
|
|
@@ -64,4 +55,10 @@ type StorybookConfigVite = {
|
|
|
64
55
|
};
|
|
65
56
|
type StorybookConfig = Omit<StorybookConfig$1, 'framework'> & StorybookConfigFramework & StorybookConfigVite;
|
|
66
57
|
|
|
67
|
-
|
|
58
|
+
declare const core: {
|
|
59
|
+
builder: string;
|
|
60
|
+
renderer: string;
|
|
61
|
+
};
|
|
62
|
+
declare const viteFinal: StorybookConfigVite['viteFinal'];
|
|
63
|
+
|
|
64
|
+
export { type FrameworkOptions as F, type RenderStoryInput as R, type SanitizationOptions as S, type RenderMode as a, type ServerBuildOptions as b, type StoryRulesOptions as c, type StorybookConfig as d, core as e, viteFinal as v };
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
export { e as core, v as viteFinal } from './preset-BvgHg2of.js';
|
|
2
2
|
import 'storybook/internal/types';
|
|
3
3
|
import 'vite';
|
|
4
|
-
import './base-
|
|
4
|
+
import './base-DT67T5pi.js';
|
|
5
5
|
import 'astro';
|
|
6
6
|
import 'sanitize-html';
|
|
7
|
-
|
|
8
|
-
declare const core: {
|
|
9
|
-
builder: string;
|
|
10
|
-
renderer: string;
|
|
11
|
-
};
|
|
12
|
-
declare const viteFinal: StorybookConfigVite['viteFinal'];
|
|
13
|
-
|
|
14
|
-
export { core, viteFinal };
|
package/dist/preset.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
core,
|
|
3
3
|
viteFinal
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-OUEDTRBO.js";
|
|
6
|
-
import "./chunk-POHTFYST.js";
|
|
4
|
+
} from "./chunk-H3XZHW6Z.js";
|
|
7
5
|
import "./chunk-E4LB75JN.js";
|
|
8
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-TWAO2IQW.js";
|
|
7
|
+
import "./chunk-AYYMNFI6.js";
|
|
8
|
+
import "./chunk-PUTCAN6X.js";
|
|
9
|
+
import "./chunk-B5HHF6FC.js";
|
|
9
10
|
import "./chunk-G3PMV62Z.js";
|
|
10
11
|
export {
|
|
11
12
|
core,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import "../chunk-G3PMV62Z.js";
|
|
2
|
+
|
|
3
|
+
// src/renderer/renderer-dev.ts
|
|
4
|
+
var pendingMessages = /* @__PURE__ */ new Map();
|
|
5
|
+
var ASTRO_SERVER_UNAVAILABLE_ERROR_NAME = "AstroRenderServerUnavailableError";
|
|
6
|
+
async function render(data, timeoutMs = 5e3) {
|
|
7
|
+
const id = crypto.randomUUID();
|
|
8
|
+
const promise = new Promise((resolve, reject) => {
|
|
9
|
+
const timeoutId = setTimeout(() => {
|
|
10
|
+
pendingMessages.delete(id);
|
|
11
|
+
const error = new Error(
|
|
12
|
+
`Unable to reach Astro rendering server. No render response was received within ${timeoutMs}ms.`
|
|
13
|
+
);
|
|
14
|
+
error.name = ASTRO_SERVER_UNAVAILABLE_ERROR_NAME;
|
|
15
|
+
reject(error);
|
|
16
|
+
}, timeoutMs);
|
|
17
|
+
pendingMessages.set(id, { resolve, reject, timeoutId });
|
|
18
|
+
});
|
|
19
|
+
import.meta.hot?.send("astro:render:request", {
|
|
20
|
+
...data,
|
|
21
|
+
id
|
|
22
|
+
});
|
|
23
|
+
return promise;
|
|
24
|
+
}
|
|
25
|
+
function init() {
|
|
26
|
+
import.meta.hot?.on("vite:afterUpdate", (payload) => {
|
|
27
|
+
if (payload.updates.some((update) => isAstroStyleUpdate(update.path))) {
|
|
28
|
+
applyStyles();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
import.meta.hot?.on("astro:render:response", (data) => {
|
|
32
|
+
if (!data.id || !pendingMessages.has(data.id)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const pendingMessage = pendingMessages.get(data.id);
|
|
36
|
+
if (!pendingMessage) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
clearTimeout(pendingMessage.timeoutId);
|
|
40
|
+
pendingMessages.delete(data.id);
|
|
41
|
+
pendingMessage.resolve(data);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function applyStyles() {
|
|
45
|
+
Array.from(document.querySelectorAll("style[data-vite-dev-id]")).filter((element) => /__vite__updateStyle/.test(element.innerHTML)).forEach((element) => {
|
|
46
|
+
const script = document.createElement("script");
|
|
47
|
+
script.type = "module";
|
|
48
|
+
const safeScriptContent = element.innerHTML.replaceAll("import.meta.hot.accept(", "import.meta.hot?.accept(").replaceAll("import.meta.hot.prune(", "import.meta.hot?.prune(");
|
|
49
|
+
script.appendChild(document.createTextNode(safeScriptContent));
|
|
50
|
+
document.head.appendChild(script);
|
|
51
|
+
document.head.removeChild(script);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function isAstroStyleUpdate(path) {
|
|
55
|
+
return /\.astro\?astro&type=style&index=\d+&lang\.(css|scss|sass|less|stylus)$/.test(path);
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
applyStyles,
|
|
59
|
+
init,
|
|
60
|
+
render
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=renderer-dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/renderer/renderer-dev.ts"],"sourcesContent":["import type {\n RenderComponentInput,\n RenderPromise,\n RenderResponseMessage\n} from '@storybook-astro/renderer/types';\n\nconst pendingMessages = new Map<string, RenderPromise>();\nconst ASTRO_SERVER_UNAVAILABLE_ERROR_NAME = 'AstroRenderServerUnavailableError';\n\nexport async function render(data: RenderComponentInput, timeoutMs = 5000) {\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n const id = crypto.randomUUID();\n\n const promise = new Promise<RenderResponseMessage['data']>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n pendingMessages.delete(id);\n\n const error = new Error(\n `Unable to reach Astro rendering server. No render response was received within ${timeoutMs}ms.`\n );\n\n error.name = ASTRO_SERVER_UNAVAILABLE_ERROR_NAME;\n\n reject(error);\n }, timeoutMs);\n\n pendingMessages.set(id, { resolve, reject, timeoutId });\n });\n\n import.meta.hot?.send('astro:render:request', {\n ...data,\n id\n });\n\n return promise;\n}\n\nexport function init() {\n import.meta.hot?.on('vite:afterUpdate', (payload) => {\n if (payload.updates.some((update) => isAstroStyleUpdate(update.path))) {\n applyStyles();\n }\n });\n\n import.meta.hot?.on('astro:render:response', (data: RenderResponseMessage['data']) => {\n if (!data.id || !pendingMessages.has(data.id)) {\n return;\n }\n\n const pendingMessage = pendingMessages.get(data.id);\n\n if (!pendingMessage) {\n return;\n }\n\n clearTimeout(pendingMessage.timeoutId);\n pendingMessages.delete(data.id);\n pendingMessage.resolve(data);\n });\n}\n\nexport function applyStyles() {\n Array.from(document.querySelectorAll('style[data-vite-dev-id]'))\n .filter((element) => /__vite__updateStyle/.test(element.innerHTML))\n .forEach((element) => {\n const script = document.createElement('script');\n\n script.type = 'module';\n\n const safeScriptContent = element.innerHTML\n .replaceAll('import.meta.hot.accept(', 'import.meta.hot?.accept(')\n .replaceAll('import.meta.hot.prune(', 'import.meta.hot?.prune(');\n\n script.appendChild(document.createTextNode(safeScriptContent));\n document.head.appendChild(script);\n document.head.removeChild(script);\n });\n}\n\nfunction isAstroStyleUpdate(path: string): boolean {\n return /\\.astro\\?astro&type=style&index=\\d+&lang\\.(css|scss|sass|less|stylus)$/.test(path);\n}\n"],"mappings":";;;AAMA,IAAM,kBAAkB,oBAAI,IAA2B;AACvD,IAAM,sCAAsC;AAE5C,eAAsB,OAAO,MAA4B,YAAY,KAAM;AAEzE,QAAM,KAAK,OAAO,WAAW;AAE7B,QAAM,UAAU,IAAI,QAAuC,CAAC,SAAS,WAAW;AAC9E,UAAM,YAAY,WAAW,MAAM;AACjC,sBAAgB,OAAO,EAAE;AAEzB,YAAM,QAAQ,IAAI;AAAA,QAChB,kFAAkF,SAAS;AAAA,MAC7F;AAEA,YAAM,OAAO;AAEb,aAAO,KAAK;AAAA,IACd,GAAG,SAAS;AAEZ,oBAAgB,IAAI,IAAI,EAAE,SAAS,QAAQ,UAAU,CAAC;AAAA,EACxD,CAAC;AAED,cAAY,KAAK,KAAK,wBAAwB;AAAA,IAC5C,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAEO,SAAS,OAAO;AACrB,cAAY,KAAK,GAAG,oBAAoB,CAAC,YAAY;AACnD,QAAI,QAAQ,QAAQ,KAAK,CAAC,WAAW,mBAAmB,OAAO,IAAI,CAAC,GAAG;AACrE,kBAAY;AAAA,IACd;AAAA,EACF,CAAC;AAED,cAAY,KAAK,GAAG,yBAAyB,CAAC,SAAwC;AACpF,QAAI,CAAC,KAAK,MAAM,CAAC,gBAAgB,IAAI,KAAK,EAAE,GAAG;AAC7C;AAAA,IACF;AAEA,UAAM,iBAAiB,gBAAgB,IAAI,KAAK,EAAE;AAElD,QAAI,CAAC,gBAAgB;AACnB;AAAA,IACF;AAEA,iBAAa,eAAe,SAAS;AACrC,oBAAgB,OAAO,KAAK,EAAE;AAC9B,mBAAe,QAAQ,IAAI;AAAA,EAC7B,CAAC;AACH;AAEO,SAAS,cAAc;AAC5B,QAAM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