@storybook-astro/framework 0.1.0-beta.8 → 1.0.0
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/README.md +38 -0
- package/dist/base-IRZo3zgK.d.ts +23 -0
- package/dist/chunk-4SWPVM6R.js +96 -0
- package/dist/chunk-4SWPVM6R.js.map +1 -0
- package/dist/chunk-5EF25G5S.js +69 -0
- package/dist/chunk-5EF25G5S.js.map +1 -0
- package/dist/chunk-7GHEQUPV.js +439 -0
- package/dist/chunk-7GHEQUPV.js.map +1 -0
- package/dist/chunk-C5OH4VBR.js +492 -0
- package/dist/chunk-C5OH4VBR.js.map +1 -0
- package/dist/chunk-DNGQBPT7.js +15 -0
- package/dist/chunk-DNGQBPT7.js.map +1 -0
- package/dist/chunk-E4LB75JN.js +89 -0
- package/dist/chunk-E4LB75JN.js.map +1 -0
- package/dist/chunk-PJEDXZVN.js +240 -0
- package/dist/chunk-PJEDXZVN.js.map +1 -0
- package/dist/chunk-UK43WNEA.js +657 -0
- package/dist/chunk-UK43WNEA.js.map +1 -0
- package/dist/dist-HJOEPVRQ.js +15574 -0
- package/dist/dist-HJOEPVRQ.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +13 -64
- package/dist/index.js.map +1 -1
- package/dist/integrations/index.d.ts +138 -0
- package/dist/integrations/index.js +8 -196
- package/dist/integrations/index.js.map +1 -1
- package/dist/middleware.d.ts +26 -0
- package/dist/middleware.js +179 -0
- package/dist/middleware.js.map +1 -0
- package/dist/portable-stories-BvdaQigq.d.ts +83 -0
- package/dist/preset.d.ts +14 -0
- package/dist/preset.js +5 -1
- package/dist/testing.d.ts +27 -0
- package/dist/testing.js +324 -15539
- package/dist/testing.js.map +1 -1
- package/dist/types-CHTsRtA7.d.ts +42 -0
- package/dist/viteStorybookAstroMiddlewarePlugin-NP2E52IC.js +11 -0
- package/dist/viteStorybookAstroMiddlewarePlugin-NP2E52IC.js.map +1 -0
- package/dist/vitest/index.d.ts +19 -0
- package/dist/vitest/index.js +229 -0
- package/dist/vitest/index.js.map +1 -0
- package/package.json +31 -17
- package/src/importAstroConfig.ts +11 -0
- package/src/index.ts +20 -6
- package/src/integrations/alpine.ts +5 -2
- package/src/integrations/base.ts +2 -2
- package/src/integrations/moduleResolver.ts +43 -0
- package/src/integrations/preact.ts +5 -2
- package/src/integrations/react.ts +5 -2
- package/src/integrations/solid.ts +5 -2
- package/src/integrations/svelte.ts +5 -2
- package/src/integrations/vue.ts +5 -2
- package/src/lib/sanitization.test.ts +232 -0
- package/src/lib/sanitization.ts +338 -0
- package/src/lib/ssr-load-module-with-fs-fallback.ts +29 -0
- package/src/middleware.test.ts +48 -0
- package/src/middleware.ts +204 -96
- package/src/module-mocks.ts +16 -0
- package/src/msw-helpers.ts +1 -0
- package/src/msw.ts +58 -0
- package/src/preset.ts +38 -3
- package/src/rules-options.test.ts +71 -0
- package/src/rules-options.ts +87 -0
- package/src/rules.test.ts +183 -0
- package/src/rules.ts +314 -0
- package/src/testing/astro-runtime.ts +219 -0
- package/src/testing/component-utils.ts +32 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/integration-config.ts +121 -0
- package/src/testing/project-root.ts +185 -0
- package/src/testing/renderer-daemon.ts +269 -0
- package/src/testing/story-composition.ts +33 -0
- package/src/testing/types.ts +14 -0
- package/src/testing/working-directory.ts +28 -0
- package/src/testing.ts +1 -254
- package/src/types.ts +16 -4
- package/src/virtual.d.ts +2 -1
- package/src/vite/createVirtualModulePlugin.test.ts +80 -0
- package/src/vite/createVirtualModulePlugin.ts +25 -0
- package/src/viteAstroContainerRenderersPlugin.ts +60 -26
- package/src/vitePluginAstro.ts +12 -5
- package/src/vitePluginAstroBuildPrerender.ts +665 -204
- package/src/vitePluginAstroRoutesFallback.ts +37 -0
- package/src/vitePluginAstroVueFallback.ts +47 -0
- package/src/viteStorybookAstroMiddlewarePlugin.ts +88 -12
- package/src/viteStorybookRendererFallbackPlugin.ts +13 -23
- package/src/vitest/config.ts +95 -0
- package/src/vitest/global-setup.ts +16 -0
- package/src/vitest/index.ts +2 -0
- package/src/vitest/vite-plugins.ts +187 -0
- package/dist/chunk-SAOPE6SA.js +0 -557
- package/dist/chunk-SAOPE6SA.js.map +0 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ProjectAnnotations } from 'storybook/internal/types';
|
|
2
|
+
export { ArgTypes, Args, Parameters, ProjectAnnotations, StrictArgs } from 'storybook/internal/types';
|
|
3
|
+
import { A as AstroRenderer } from './portable-stories-BvdaQigq.js';
|
|
4
|
+
export { c as composeStories, a as composeStory, s as setProjectAnnotations } from './portable-stories-BvdaQigq.js';
|
|
5
|
+
export { F as FrameworkOptions, S as SanitizationOptions, a as StoryRulesOptions, b as StorybookConfig } from './types-CHTsRtA7.js';
|
|
6
|
+
import { RequestHandler } from 'msw';
|
|
7
|
+
export { core, viteFinal } from './preset.js';
|
|
8
|
+
import 'vite';
|
|
9
|
+
import './base-IRZo3zgK.js';
|
|
10
|
+
import 'astro';
|
|
11
|
+
import 'sanitize-html';
|
|
12
|
+
|
|
13
|
+
type StoryMode = 'development' | 'production';
|
|
14
|
+
type StoryRuleUseResult = void | Promise<void>;
|
|
15
|
+
type StoryRuleUseContext = {
|
|
16
|
+
mode: StoryMode;
|
|
17
|
+
story: StoryRuleStory;
|
|
18
|
+
msw: {
|
|
19
|
+
use: (...handlers: RequestHandler[]) => void;
|
|
20
|
+
};
|
|
21
|
+
mock: (specifier: string, replacement: string) => void;
|
|
22
|
+
};
|
|
23
|
+
type StoryRuleUse = (context: StoryRuleUseContext) => StoryRuleUseResult;
|
|
24
|
+
type StoryRule = {
|
|
25
|
+
match: string | string[];
|
|
26
|
+
use: StoryRuleUse | StoryRuleUse[];
|
|
27
|
+
};
|
|
28
|
+
type StoryRulesConfig = {
|
|
29
|
+
rules: StoryRule[];
|
|
30
|
+
};
|
|
31
|
+
type StoryRuleStory = {
|
|
32
|
+
id: string;
|
|
33
|
+
title?: string;
|
|
34
|
+
name?: string;
|
|
35
|
+
keys: string[];
|
|
36
|
+
};
|
|
37
|
+
declare function defineStoryRules(config: StoryRulesConfig): StoryRulesConfig;
|
|
38
|
+
|
|
39
|
+
/** Preview configuration type for `.storybook/preview.ts` in Astro projects. */
|
|
40
|
+
type Preview = ProjectAnnotations<AstroRenderer>;
|
|
41
|
+
|
|
42
|
+
export { AstroRenderer, type Preview, type StoryRule, type StoryRuleUse, type StoryRuleUseContext, type StoryRulesConfig, defineStoryRules };
|
package/dist/index.js
CHANGED
|
@@ -1,75 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
core,
|
|
3
3
|
viteFinal
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-G3PMV62Z.js";
|
|
6
|
-
|
|
7
|
-
// src/portable-stories.ts
|
|
4
|
+
} from "./chunk-UK43WNEA.js";
|
|
8
5
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
if (!Component) {
|
|
22
|
-
throw new Error(`Unable to render story ${id} as the component annotation is missing from the default export`);
|
|
23
|
-
}
|
|
24
|
-
if (typeof Component === "function" && Component.isAstroComponentFactory) {
|
|
25
|
-
return Component;
|
|
26
|
-
}
|
|
27
|
-
if (typeof Component === "function") {
|
|
28
|
-
if (renderer && !brokenRenderers.includes(renderer)) {
|
|
29
|
-
return Component;
|
|
30
|
-
}
|
|
31
|
-
if (!renderer) {
|
|
32
|
-
throw new Error(
|
|
33
|
-
`Component appears to be a framework component but no renderer is specified. Add 'parameters: { renderer: "framework-name" }' to your story configuration.`
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
component: Component,
|
|
39
|
-
args,
|
|
40
|
-
renderer: renderer || "astro"
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
function setProjectAnnotations(projectAnnotations) {
|
|
44
|
-
return originalSetProjectAnnotations(projectAnnotations);
|
|
45
|
-
}
|
|
46
|
-
function composeStory(story, componentAnnotations, projectAnnotations, exportsName) {
|
|
47
|
-
const mergedProjectAnnotations = projectAnnotations ? {
|
|
48
|
-
...projectAnnotations,
|
|
49
|
-
render: projectAnnotations.render || render
|
|
50
|
-
} : {
|
|
51
|
-
render
|
|
52
|
-
};
|
|
53
|
-
return originalComposeStory(
|
|
54
|
-
story,
|
|
55
|
-
componentAnnotations,
|
|
56
|
-
mergedProjectAnnotations,
|
|
57
|
-
exportsName
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
function composeStories(storiesImport, projectAnnotations) {
|
|
61
|
-
const mergedProjectAnnotations = projectAnnotations ? {
|
|
62
|
-
...projectAnnotations,
|
|
63
|
-
render: projectAnnotations.render || render
|
|
64
|
-
} : {
|
|
65
|
-
render
|
|
66
|
-
};
|
|
67
|
-
return originalComposeStories(storiesImport, mergedProjectAnnotations);
|
|
68
|
-
}
|
|
6
|
+
defineStoryRules
|
|
7
|
+
} from "./chunk-C5OH4VBR.js";
|
|
8
|
+
import {
|
|
9
|
+
composeStories,
|
|
10
|
+
composeStory,
|
|
11
|
+
setProjectAnnotations
|
|
12
|
+
} from "./chunk-5EF25G5S.js";
|
|
13
|
+
import "./chunk-E4LB75JN.js";
|
|
14
|
+
import "./chunk-7GHEQUPV.js";
|
|
15
|
+
import "./chunk-DNGQBPT7.js";
|
|
16
|
+
import "./chunk-G3PMV62Z.js";
|
|
69
17
|
export {
|
|
70
18
|
composeStories,
|
|
71
19
|
composeStory,
|
|
72
20
|
core,
|
|
21
|
+
defineStoryRules,
|
|
73
22
|
setProjectAnnotations,
|
|
74
23
|
viteFinal
|
|
75
24
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import * as astro from 'astro';
|
|
2
|
+
import { I as Integration } from '../base-IRZo3zgK.js';
|
|
3
|
+
import { PreactPluginOptions } from '@preact/preset-vite';
|
|
4
|
+
import { Options as Options$6 } from '@vitejs/plugin-react';
|
|
5
|
+
import { Options as Options$7 } from 'vite-plugin-solid';
|
|
6
|
+
import { PluginOptions, SvelteConfig } from '@sveltejs/vite-plugin-svelte';
|
|
7
|
+
import { Options as Options$8 } from '@vitejs/plugin-vue';
|
|
8
|
+
import { Options as Options$9 } from '@vitejs/plugin-vue-jsx';
|
|
9
|
+
|
|
10
|
+
type Options$5 = Record<string, unknown>;
|
|
11
|
+
declare class AlpineIntegration implements Integration {
|
|
12
|
+
readonly name = "alpine";
|
|
13
|
+
readonly dependencies: string[];
|
|
14
|
+
readonly options: Options$5;
|
|
15
|
+
readonly renderer: {};
|
|
16
|
+
constructor(options?: Options$5);
|
|
17
|
+
resolveClient(_moduleName: string): undefined;
|
|
18
|
+
loadIntegration(resolveFrom?: string): Promise<astro.AstroIntegration>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type Options$4 = Pick<PreactPluginOptions, 'include' | 'exclude'> & {
|
|
22
|
+
compat?: boolean;
|
|
23
|
+
devtools?: boolean;
|
|
24
|
+
};
|
|
25
|
+
declare class PreactIntegration implements Integration {
|
|
26
|
+
readonly name = "preact";
|
|
27
|
+
readonly dependencies: string[];
|
|
28
|
+
readonly options: Options$4;
|
|
29
|
+
readonly storybookEntryPreview = "@storybook/preact/entry-preview";
|
|
30
|
+
readonly renderer: {
|
|
31
|
+
server: {
|
|
32
|
+
name: string;
|
|
33
|
+
entrypoint: string;
|
|
34
|
+
};
|
|
35
|
+
client: {
|
|
36
|
+
name: string;
|
|
37
|
+
entrypoint: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
constructor(options?: Options$4);
|
|
41
|
+
resolveClient(moduleName: string): string | undefined;
|
|
42
|
+
loadIntegration(resolveFrom?: string): Promise<astro.AstroIntegration>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type Options$3 = Pick<Options$6, 'include' | 'exclude'>;
|
|
46
|
+
declare class ReactIntegration implements Integration {
|
|
47
|
+
readonly name = "react";
|
|
48
|
+
readonly dependencies: string[];
|
|
49
|
+
readonly options: Options$3;
|
|
50
|
+
readonly storybookEntryPreview = "@storybook/react/entry-preview";
|
|
51
|
+
readonly renderer: {
|
|
52
|
+
server: {
|
|
53
|
+
name: string;
|
|
54
|
+
entrypoint: string;
|
|
55
|
+
};
|
|
56
|
+
client: {
|
|
57
|
+
name: string;
|
|
58
|
+
entrypoint: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
constructor(options?: Options$3);
|
|
62
|
+
resolveClient(moduleName: string): string | undefined;
|
|
63
|
+
loadIntegration(resolveFrom?: string): Promise<astro.AstroIntegration>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type Options$2 = Pick<Options$7, 'include' | 'exclude'>;
|
|
67
|
+
declare class SolidIntegration implements Integration {
|
|
68
|
+
readonly name = "solid";
|
|
69
|
+
readonly dependencies: string[];
|
|
70
|
+
readonly options: Options$2;
|
|
71
|
+
readonly storybookEntryPreview = "storybook-solidjs-vite/renderer/entry-preview";
|
|
72
|
+
readonly renderer: {
|
|
73
|
+
server: {
|
|
74
|
+
name: string;
|
|
75
|
+
entrypoint: string;
|
|
76
|
+
};
|
|
77
|
+
client: {
|
|
78
|
+
name: string;
|
|
79
|
+
entrypoint: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
constructor(options?: Options$2);
|
|
83
|
+
resolveClient(moduleName: string): string | undefined;
|
|
84
|
+
loadIntegration(resolveFrom?: string): Promise<astro.AstroIntegration>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
type Options$1 = Omit<PluginOptions, ''> & Omit<SvelteConfig, 'vitePlugin'>;
|
|
88
|
+
declare class SvelteIntegration implements Integration {
|
|
89
|
+
readonly name = "svelte";
|
|
90
|
+
readonly dependencies: string[];
|
|
91
|
+
readonly options: Options$1;
|
|
92
|
+
readonly storybookEntryPreview = "@storybook/svelte/entry-preview";
|
|
93
|
+
readonly renderer: {
|
|
94
|
+
server: {
|
|
95
|
+
entrypoint: string;
|
|
96
|
+
name: string;
|
|
97
|
+
};
|
|
98
|
+
client: {
|
|
99
|
+
name: string;
|
|
100
|
+
entrypoint: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
constructor(options?: Options$1);
|
|
104
|
+
resolveClient(moduleName: string): string | undefined;
|
|
105
|
+
loadIntegration(resolveFrom?: string): Promise<astro.AstroIntegration>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
type Options = Pick<Options$8, 'include' | 'exclude'> & {
|
|
109
|
+
jsx?: boolean | Options$9;
|
|
110
|
+
};
|
|
111
|
+
declare class VueIntegration implements Integration {
|
|
112
|
+
readonly name = "vue";
|
|
113
|
+
readonly dependencies: string[];
|
|
114
|
+
readonly options: Options;
|
|
115
|
+
readonly storybookEntryPreview = "@storybook/vue3/entry-preview";
|
|
116
|
+
readonly renderer: {
|
|
117
|
+
server: {
|
|
118
|
+
name: string;
|
|
119
|
+
entrypoint: string;
|
|
120
|
+
};
|
|
121
|
+
client: {
|
|
122
|
+
name: string;
|
|
123
|
+
entrypoint: string;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
constructor(options?: Options);
|
|
127
|
+
resolveClient(moduleName: string): string | undefined;
|
|
128
|
+
loadIntegration(resolveFrom?: string): Promise<astro.AstroIntegration>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
declare function alpinejs(options?: Options$5): AlpineIntegration;
|
|
132
|
+
declare function preact(options?: Options$4): PreactIntegration;
|
|
133
|
+
declare function react(options?: Options$3): ReactIntegration;
|
|
134
|
+
declare function solid(options?: Options$2): SolidIntegration;
|
|
135
|
+
declare function svelte(options?: Options$1): SvelteIntegration;
|
|
136
|
+
declare function vue(options?: Options): VueIntegration;
|
|
137
|
+
|
|
138
|
+
export { Integration, alpinejs, preact, react, solid, svelte, vue };
|
|
@@ -1,200 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
alpinejs,
|
|
3
|
+
preact,
|
|
4
|
+
react,
|
|
5
|
+
solid,
|
|
6
|
+
svelte,
|
|
7
|
+
vue
|
|
8
|
+
} from "../chunk-PJEDXZVN.js";
|
|
1
9
|
import "../chunk-G3PMV62Z.js";
|
|
2
|
-
|
|
3
|
-
// src/integrations/alpine.ts
|
|
4
|
-
var AlpineIntegration = class {
|
|
5
|
-
name = "alpine";
|
|
6
|
-
dependencies = [
|
|
7
|
-
"@astrojs/alpinejs",
|
|
8
|
-
"alpinejs"
|
|
9
|
-
];
|
|
10
|
-
options;
|
|
11
|
-
renderer = {};
|
|
12
|
-
constructor(options = {}) {
|
|
13
|
-
this.options = options;
|
|
14
|
-
}
|
|
15
|
-
resolveClient(_moduleName) {
|
|
16
|
-
}
|
|
17
|
-
async loadIntegration() {
|
|
18
|
-
const framework = await import("@astrojs/alpinejs");
|
|
19
|
-
return framework.default(this.options);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// src/integrations/preact.ts
|
|
24
|
-
var PreactIntegration = class {
|
|
25
|
-
name = "preact";
|
|
26
|
-
dependencies = ["@astrojs/preact", "@storybook/preact-vite", "preact"];
|
|
27
|
-
options;
|
|
28
|
-
storybookEntryPreview = "@storybook/preact/entry-preview";
|
|
29
|
-
renderer = {
|
|
30
|
-
server: {
|
|
31
|
-
name: "@astrojs/preact",
|
|
32
|
-
entrypoint: "@astrojs/preact/server.js"
|
|
33
|
-
},
|
|
34
|
-
client: {
|
|
35
|
-
name: "@astrojs/preact",
|
|
36
|
-
entrypoint: "@astrojs/preact/client.js"
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
constructor(options = {}) {
|
|
40
|
-
this.options = options;
|
|
41
|
-
}
|
|
42
|
-
resolveClient(moduleName) {
|
|
43
|
-
if (moduleName.startsWith("@astrojs/preact/client")) {
|
|
44
|
-
return `/@id/${moduleName}`;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
async loadIntegration() {
|
|
48
|
-
const framework = await import("@astrojs/preact");
|
|
49
|
-
return framework.default(this.options);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// src/integrations/react.ts
|
|
54
|
-
var ReactIntegration = class {
|
|
55
|
-
name = "react";
|
|
56
|
-
dependencies = ["@astrojs/react", "@storybook/react", "react", "react-dom"];
|
|
57
|
-
options;
|
|
58
|
-
storybookEntryPreview = "@storybook/react/entry-preview";
|
|
59
|
-
renderer = {
|
|
60
|
-
server: {
|
|
61
|
-
name: "@astrojs/react",
|
|
62
|
-
entrypoint: "@astrojs/react/server.js"
|
|
63
|
-
},
|
|
64
|
-
client: {
|
|
65
|
-
name: "@astrojs/react",
|
|
66
|
-
entrypoint: "@astrojs/react/client.js"
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
constructor(options = {}) {
|
|
70
|
-
this.options = options;
|
|
71
|
-
}
|
|
72
|
-
resolveClient(moduleName) {
|
|
73
|
-
if (moduleName.startsWith("@astrojs/react/client")) {
|
|
74
|
-
return `/@id/${moduleName}`;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
async loadIntegration() {
|
|
78
|
-
const framework = await import("@astrojs/react");
|
|
79
|
-
return framework.default(this.options);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// src/integrations/solid.ts
|
|
84
|
-
var SolidIntegration = class {
|
|
85
|
-
name = "solid";
|
|
86
|
-
dependencies = ["@astrojs/solid-js", "storybook-solidjs-vite", "solid-js"];
|
|
87
|
-
options;
|
|
88
|
-
storybookEntryPreview = "storybook-solidjs-vite/renderer/entry-preview";
|
|
89
|
-
renderer = {
|
|
90
|
-
server: {
|
|
91
|
-
name: "@astrojs/solid-js",
|
|
92
|
-
entrypoint: "@astrojs/solid-js/server.js"
|
|
93
|
-
},
|
|
94
|
-
client: {
|
|
95
|
-
name: "@astrojs/solid-js",
|
|
96
|
-
entrypoint: "@astrojs/solid-js/client.js"
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
constructor(options = {}) {
|
|
100
|
-
this.options = options;
|
|
101
|
-
}
|
|
102
|
-
resolveClient(moduleName) {
|
|
103
|
-
if (moduleName.startsWith("@astrojs/solid-js/client")) {
|
|
104
|
-
return `/@id/${moduleName}`;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
async loadIntegration() {
|
|
108
|
-
const framework = await import("@astrojs/solid-js");
|
|
109
|
-
return framework.default(this.options);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
// src/integrations/svelte.ts
|
|
114
|
-
var DEFAULT_OPTIONS = {
|
|
115
|
-
extensions: [".svelte"]
|
|
116
|
-
};
|
|
117
|
-
var SvelteIntegration = class {
|
|
118
|
-
name = "svelte";
|
|
119
|
-
dependencies = ["@astrojs/svelte", "@storybook/svelte", "svelte"];
|
|
120
|
-
options;
|
|
121
|
-
storybookEntryPreview = "@storybook/svelte/entry-preview";
|
|
122
|
-
renderer = {
|
|
123
|
-
server: {
|
|
124
|
-
entrypoint: "@astrojs/svelte/server.js",
|
|
125
|
-
name: "@astrojs/svelte"
|
|
126
|
-
},
|
|
127
|
-
client: {
|
|
128
|
-
name: "@astrojs/svelte",
|
|
129
|
-
entrypoint: "@astrojs/svelte/client.js"
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
constructor(options = DEFAULT_OPTIONS) {
|
|
133
|
-
this.options = options;
|
|
134
|
-
}
|
|
135
|
-
resolveClient(moduleName) {
|
|
136
|
-
if (moduleName.startsWith("@astrojs/svelte/client")) {
|
|
137
|
-
return `/@id/${moduleName}`;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
async loadIntegration() {
|
|
141
|
-
const framework = await import("@astrojs/svelte");
|
|
142
|
-
return framework.default(this.options);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
// src/integrations/vue.ts
|
|
147
|
-
var DEFAULT_OPTIONS2 = {
|
|
148
|
-
include: ["**/*.vue"]
|
|
149
|
-
};
|
|
150
|
-
var VueIntegration = class {
|
|
151
|
-
name = "vue";
|
|
152
|
-
dependencies = ["@astrojs/vue", "@storybook/vue3", "vue"];
|
|
153
|
-
options;
|
|
154
|
-
storybookEntryPreview = "@storybook/vue3/entry-preview";
|
|
155
|
-
renderer = {
|
|
156
|
-
server: {
|
|
157
|
-
name: "@astrojs/vue",
|
|
158
|
-
entrypoint: "@astrojs/vue/server.js"
|
|
159
|
-
},
|
|
160
|
-
client: {
|
|
161
|
-
name: "@astrojs/vue",
|
|
162
|
-
entrypoint: "@astrojs/vue/client.js"
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
constructor(options = DEFAULT_OPTIONS2) {
|
|
166
|
-
this.options = options;
|
|
167
|
-
}
|
|
168
|
-
resolveClient(moduleName) {
|
|
169
|
-
if (moduleName.startsWith("@astrojs/vue/client")) {
|
|
170
|
-
return `/@id/${moduleName}`;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
async loadIntegration() {
|
|
174
|
-
const framework = await import("@astrojs/vue");
|
|
175
|
-
return framework.default(this.options);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
// src/integrations/index.ts
|
|
180
|
-
function alpinejs(options) {
|
|
181
|
-
return new AlpineIntegration(options);
|
|
182
|
-
}
|
|
183
|
-
function preact(options) {
|
|
184
|
-
return new PreactIntegration(options);
|
|
185
|
-
}
|
|
186
|
-
function react(options) {
|
|
187
|
-
return new ReactIntegration(options);
|
|
188
|
-
}
|
|
189
|
-
function solid(options) {
|
|
190
|
-
return new SolidIntegration(options);
|
|
191
|
-
}
|
|
192
|
-
function svelte(options) {
|
|
193
|
-
return new SvelteIntegration(options);
|
|
194
|
-
}
|
|
195
|
-
function vue(options) {
|
|
196
|
-
return new VueIntegration(options);
|
|
197
|
-
}
|
|
198
10
|
export {
|
|
199
11
|
alpinejs,
|
|
200
12
|
preact,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../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 type { Integration } from './base.ts';\n\nexport type Options = Record<string, unknown>;\n\nexport class AlpineIntegration implements Integration {\n readonly name = 'alpine';\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() {\n const framework = await import('@astrojs/alpinejs');\n\n return framework.default(this.options);\n }\n}\n","import type { Integration } from './base.ts';\nimport type { PreactPluginOptions } from '@preact/preset-vite';\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() {\n const framework = await import('@astrojs/preact');\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';\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() {\n const framework = await import('@astrojs/react');\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';\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() {\n const framework = await import('@astrojs/solid-js');\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';\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() {\n const framework = await import('@astrojs/svelte');\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';\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() {\n const framework = await import('@astrojs/vue');\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":";;;AAIO,IAAM,oBAAN,MAA+C;AAAA,EAC3C,OAAO;AAAA,EACP,eAAe;AAAA,IACtB;AAAA,IACA;AAAA,EACF;AAAA,EACS;AAAA,EACA,WAAW,CAAC;AAAA,EAErB,YAAY,UAAmB,CAAC,GAAG;AACjC,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,cAAc,aAAgC;AAAA,EAAC;AAAA,EAE/C,MAAM,kBAAkB;AACtB,UAAM,YAAY,MAAM,OAAO,mBAAmB;AAElD,WAAO,UAAU,QAAQ,KAAK,OAAO;AAAA,EACvC;AACF;;;AChBO,IAAM,oBAAN,MAA+C;AAAA,EAC3C,OAAO;AAAA,EACP,eAAe,CAAC,mBAAmB,0BAA0B,QAAQ;AAAA,EACrE;AAAA,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,UAAmB,CAAC,GAAG;AACjC,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,cAAc,YAAwC;AACpD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W,qBAAqB,GAAG;AAChD,aAAO,QAAQ,UAAU;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,MAAM,kBAAkB;AACtB,UAAM,YAAY,MAAM,OAAO,cAAc;AAE7C,WAAO,UAAU,QAAQ,KAAK,OAAO;AAAA,EACvC;AACF;;;ACpCO,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":["DEFAULT_OPTIONS"]}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { I as Integration } from './base-IRZo3zgK.js';
|
|
2
|
+
import { R as RenderStoryInput, S as SanitizationOptions } from './types-CHTsRtA7.js';
|
|
3
|
+
import 'astro';
|
|
4
|
+
import 'storybook/internal/types';
|
|
5
|
+
import 'vite';
|
|
6
|
+
import 'sanitize-html';
|
|
7
|
+
|
|
8
|
+
type ResolveRulesConfigModule = () => unknown | Promise<unknown>;
|
|
9
|
+
type HandlerProps = {
|
|
10
|
+
component: string;
|
|
11
|
+
args?: Record<string, unknown>;
|
|
12
|
+
slots?: Record<string, unknown>;
|
|
13
|
+
story?: RenderStoryInput;
|
|
14
|
+
};
|
|
15
|
+
type HandlerFactoryOptions = {
|
|
16
|
+
mode?: 'development' | 'production';
|
|
17
|
+
sanitization?: SanitizationOptions;
|
|
18
|
+
rulesConfigFilePath?: string;
|
|
19
|
+
resolveRulesConfigModule?: ResolveRulesConfigModule;
|
|
20
|
+
loadModule?: (id: string) => Promise<{
|
|
21
|
+
default: unknown;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
declare function handlerFactory(_integrations: Integration[], options?: HandlerFactoryOptions): Promise<(data: HandlerProps) => Promise<string>>;
|
|
25
|
+
|
|
26
|
+
export { type HandlerProps, handlerFactory };
|