@chrishrb/storybook-addon-vue-manifest 0.1.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 ADDED
@@ -0,0 +1,115 @@
1
+ # storybook-addon-vue-manifest
2
+
3
+ Generates a Storybook **component manifest** for Vue 3 projects using
4
+ [vue-component-meta](https://github.com/vuejs/language-tools/tree/master/packages/component-meta)
5
+ (Vue language tools / Volar). The manifest contains structured component documentation —
6
+ props, events, slots, descriptions, import statements and per-story Vue template snippets —
7
+ and is the data source for the [Storybook MCP server](https://github.com/storybookjs/mcp),
8
+ enabling AI-assisted workflows for Vue projects.
9
+
10
+ ## Requirements
11
+
12
+ - Storybook ≥ 10.5 (the experimental component manifest infrastructure lives in Storybook core)
13
+ - `@storybook/vue3-vite`
14
+ - Vue 3 with TypeScript
15
+
16
+ ## Usage
17
+
18
+ ```bash
19
+ npm install --save-dev storybook-addon-vue-manifest
20
+ ```
21
+
22
+ ```ts
23
+ // .storybook/main.ts
24
+ const config: StorybookConfig = {
25
+ framework: '@storybook/vue3-vite',
26
+ addons: [
27
+ // ...
28
+ 'storybook-addon-vue-manifest',
29
+ ],
30
+ features: {
31
+ // required: enables the manifest routes and build output in Storybook core
32
+ componentsManifest: true,
33
+ // optional: also injects generated Vue snippets into docs source blocks
34
+ experimentalCodeExamples: true,
35
+ },
36
+ };
37
+ ```
38
+
39
+ ### Generating the manifest into a file
40
+
41
+ Run a static build — Storybook core writes every manifest to disk:
42
+
43
+ ```bash
44
+ storybook build
45
+ # -> storybook-static/manifests/components.json
46
+ ```
47
+
48
+ During `storybook dev` the same manifest is served live at
49
+ `http://localhost:6006/manifests/components.json`, plus an HTML debugger at
50
+ `/manifests/components.html`.
51
+
52
+ With `@storybook/addon-docs` installed, unattached MDX docs additionally produce
53
+ `manifests/docs.json`; attached MDX is embedded into `components.json` per component
54
+ (both handled by addon-docs, not this addon).
55
+
56
+ ## Options
57
+
58
+ ```ts
59
+ addons: [
60
+ {
61
+ name: 'storybook-addon-vue-manifest',
62
+ options: {
63
+ // tsconfig used by the vue-component-meta checker (relative to the project root).
64
+ // Defaults to the vue3-vite framework `docgen.tsconfig` option, then 'tsconfig.json'.
65
+ tsconfig: 'tsconfig.app.json',
66
+ },
67
+ },
68
+ ],
69
+ ```
70
+
71
+ ## Output shape
72
+
73
+ ```jsonc
74
+ // manifests/components.json
75
+ {
76
+ "v": 0,
77
+ "components": {
78
+ "example-button": {
79
+ "id": "example-button",
80
+ "name": "Button",
81
+ "path": "./src/stories/Button.stories.ts",
82
+ "import": "import Button from './Button.vue';",
83
+ "description": "Primary UI component for user interaction",
84
+ "summary": "A simple button",
85
+ "jsDocTags": { "summary": ["A simple button"] },
86
+ "stories": [
87
+ {
88
+ "id": "example-button--primary",
89
+ "name": "Primary",
90
+ "snippet": "<Button primary @click=\"onClick\" label=\"Button\" />"
91
+ }
92
+ ],
93
+ // raw vue-component-meta data (props/events/slots/exposed, schemas stripped)
94
+ "vueComponentMeta": { "props": [/* ... */], "events": [/* ... */] }
95
+ }
96
+ },
97
+ "meta": { "docgen": "vue-component-meta", "durationMs": 875 }
98
+ }
99
+ ```
100
+
101
+ ## Notes & limitations
102
+
103
+ - Only stories tagged `manifest` are included — Storybook adds that tag to every story by
104
+ default, so usually everything is in.
105
+ - Stories whose `meta.component` is defined inline (not imported from a file) produce an
106
+ error entry instead of docgen data.
107
+ - tsconfig **project references** are not supported by vue-component-meta
108
+ ([vuejs/language-tools#3896](https://github.com/vuejs/language-tools/issues/3896)); the
109
+ checker falls back to a referenceless project over the package root. Point the `tsconfig`
110
+ option at a non-referencing config (e.g. `tsconfig.app.json`) for alias resolution.
111
+ - The first manifest request in dev builds a TypeScript program and can take a few seconds;
112
+ subsequent requests reuse the checker.
113
+ - `experimentalCodeExamples` snippet injection works best on Storybook versions where the
114
+ csf-plugin passes the story file path to enrichers; on older versions snippets fall back to
115
+ heuristics (`on*` args treated as events) instead of vue-component-meta classification.
@@ -0,0 +1,22 @@
1
+ import { ComponentMeta } from "vue-component-meta";
2
+ import { ComponentManifest, IndexEntry, PresetPropertyFn, StorybookConfigRaw } from "storybook/internal/types";
3
+
4
+ //#region src/componentManifest/generator.d.ts
5
+ /** Vue-specific extension of ComponentManifest with the raw vue-component-meta data attached. */
6
+ interface VueComponentManifest extends ComponentManifest {
7
+ vueComponentMeta?: ComponentMeta;
8
+ [key: string]: unknown;
9
+ }
10
+ /**
11
+ * Main manifest generator for Vue (vite).
12
+ *
13
+ * Implements the `experimental_manifests` preset property. Uses vue-component-meta (Volar) to
14
+ * extract component metadata server-side, then iterates over manifest-tagged IndexEntries to build
15
+ * ComponentManifest objects.
16
+ */
17
+ declare const manifests: PresetPropertyFn<'experimental_manifests', StorybookConfigRaw, {
18
+ manifestEntries: IndexEntry[];
19
+ watch?: boolean;
20
+ }>;
21
+ //#endregion
22
+ export { manifests as n, VueComponentManifest as t };
@@ -0,0 +1,22 @@
1
+ import { ComponentManifest, IndexEntry, PresetPropertyFn, StorybookConfigRaw } from "storybook/internal/types";
2
+ import { ComponentMeta } from "vue-component-meta";
3
+
4
+ //#region src/componentManifest/generator.d.ts
5
+ /** Vue-specific extension of ComponentManifest with the raw vue-component-meta data attached. */
6
+ interface VueComponentManifest extends ComponentManifest {
7
+ vueComponentMeta?: ComponentMeta;
8
+ [key: string]: unknown;
9
+ }
10
+ /**
11
+ * Main manifest generator for Vue (vite).
12
+ *
13
+ * Implements the `experimental_manifests` preset property. Uses vue-component-meta (Volar) to
14
+ * extract component metadata server-side, then iterates over manifest-tagged IndexEntries to build
15
+ * ComponentManifest objects.
16
+ */
17
+ declare const manifests: PresetPropertyFn<'experimental_manifests', StorybookConfigRaw, {
18
+ manifestEntries: IndexEntry[];
19
+ watch?: boolean;
20
+ }>;
21
+ //#endregion
22
+ export { manifests as n, VueComponentManifest as t };
package/dist/index.cjs ADDED
File without changes
@@ -0,0 +1,14 @@
1
+ import { t as VueComponentManifest } from "./generator-LLlHZWAz.cjs";
2
+
3
+ //#region src/options.d.ts
4
+ /** Options accepted by this addon (via the `addons` entry in `.storybook/main.ts`). */
5
+ interface VueManifestAddonOptions {
6
+ /**
7
+ * Path to the tsconfig used by the vue-component-meta checker, relative to the project root.
8
+ * Falls back to the `docgen.tsconfig` framework option of `@storybook/vue3-vite`, then to
9
+ * `tsconfig.json`.
10
+ */
11
+ tsconfig?: string;
12
+ }
13
+ //#endregion
14
+ export { type VueComponentManifest, type VueManifestAddonOptions };
@@ -0,0 +1,14 @@
1
+ import { t as VueComponentManifest } from "./generator-CRQjXF8w.js";
2
+
3
+ //#region src/options.d.ts
4
+ /** Options accepted by this addon (via the `addons` entry in `.storybook/main.ts`). */
5
+ interface VueManifestAddonOptions {
6
+ /**
7
+ * Path to the tsconfig used by the vue-component-meta checker, relative to the project root.
8
+ * Falls back to the `docgen.tsconfig` framework option of `@storybook/vue3-vite`, then to
9
+ * `tsconfig.json`.
10
+ */
11
+ tsconfig?: string;
12
+ }
13
+ //#endregion
14
+ export { type VueComponentManifest, type VueManifestAddonOptions };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { };