@storybook/vue3-vite 9.2.0-alpha.2 → 10.0.0-beta.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 +3 -1
- package/dist/_node-chunks/chunk-LJJ3IO2Q.js +33 -0
- package/dist/_node-chunks/chunk-TF3SOP6Y.js +17 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/node/index.d.ts +48 -6
- package/dist/node/index.js +23 -1
- package/dist/preset.js +272 -3
- package/dist/vite-plugin.js +25 -1
- package/package.json +21 -41
- package/preset.js +1 -1
- package/dist/index.mjs +0 -1
- package/dist/node/index.mjs +0 -3
- package/dist/preset.d.ts +0 -11
- package/dist/vite-plugin.d.ts +0 -5
- package/dist/vite-plugin.mjs +0 -3
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
# Storybook for Vue and Vite
|
|
2
2
|
|
|
3
|
-
See [documentation](https://storybook.js.org/docs/get-started/frameworks/vue3-vite?renderer=vue) for installation instructions, usage examples, APIs, and more.
|
|
3
|
+
See [documentation](https://storybook.js.org/docs/get-started/frameworks/vue3-vite?renderer=vue&ref=readme) for installation instructions, usage examples, APIs, and more.
|
|
4
|
+
|
|
5
|
+
Learn more about Storybook at [storybook.js.org](https://storybook.js.org/?ref=readme).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bonbf6ys4jm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bonbf6ys4jm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bonbf6ys4jm from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bonbf6ys4jm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bonbf6ys4jm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bonbf6ys4jm.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
__name
|
|
14
|
+
} from "./chunk-TF3SOP6Y.js";
|
|
15
|
+
|
|
16
|
+
// src/plugins/vue-template.ts
|
|
17
|
+
async function templateCompilation() {
|
|
18
|
+
return {
|
|
19
|
+
name: "storybook:vue-template-compilation",
|
|
20
|
+
config: /* @__PURE__ */ __name(() => ({
|
|
21
|
+
resolve: {
|
|
22
|
+
alias: {
|
|
23
|
+
vue: "vue/dist/vue.esm-bundler.js"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}), "config")
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
__name(templateCompilation, "templateCompilation");
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
templateCompilation
|
|
33
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bonbf6ys4jm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bonbf6ys4jm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bonbf6ys4jm from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bonbf6ys4jm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bonbf6ys4jm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bonbf6ys4jm.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
__name
|
|
17
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -64,4 +64,4 @@ type VueDocgenInfo<T extends VueDocgenPlugin> = T extends 'vue-component-meta' ?
|
|
|
64
64
|
*/
|
|
65
65
|
type VueDocgenInfoEntry<T extends VueDocgenPlugin, TKey extends 'props' | 'events' | 'slots' | 'exposed' | 'expose' = 'props' | 'events' | 'slots' | 'exposed' | 'expose'> = ArrayElement<T extends 'vue-component-meta' ? VueDocgenInfo<'vue-component-meta'>[Exclude<TKey, 'expose'>] : VueDocgenInfo<'vue-docgen-api'>[Exclude<TKey, 'exposed'>]>;
|
|
66
66
|
|
|
67
|
-
export { FrameworkOptions, StorybookConfig, VueDocgenInfo, VueDocgenInfoEntry, VueDocgenPlugin };
|
|
67
|
+
export type { FrameworkOptions, StorybookConfig, VueDocgenInfo, VueDocgenInfoEntry, VueDocgenPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
// src/index.ts
|
|
2
|
+
export * from "@storybook/vue3";
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,9 +1,51 @@
|
|
|
1
|
-
import { StorybookConfig } from '
|
|
2
|
-
import '@storybook/
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { StorybookConfig as StorybookConfig$1, CompatibleString } from 'storybook/internal/types';
|
|
2
|
+
import { StorybookConfigVite, BuilderOptions } from '@storybook/builder-vite';
|
|
3
|
+
|
|
4
|
+
type FrameworkName = CompatibleString<'@storybook/vue3-vite'>;
|
|
5
|
+
type BuilderName = CompatibleString<'@storybook/builder-vite'>;
|
|
6
|
+
/** Available docgen plugins for vue. */
|
|
7
|
+
type VueDocgenPlugin = 'vue-docgen-api' | 'vue-component-meta';
|
|
8
|
+
type FrameworkOptions = {
|
|
9
|
+
builder?: BuilderOptions;
|
|
10
|
+
/**
|
|
11
|
+
* Plugin to use for generation docs for component props, events, slots and exposes. Since
|
|
12
|
+
* Storybook 8, the official vue plugin "vue-component-meta" (Volar) can be used which supports
|
|
13
|
+
* more complex types, better type docs, support for js(x)/ts(x) components and more.
|
|
14
|
+
*
|
|
15
|
+
* "vue-component-meta" will become the new default in the future and "vue-docgen-api" will be
|
|
16
|
+
* removed.
|
|
17
|
+
*
|
|
18
|
+
* @default 'vue-docgen-api'
|
|
19
|
+
*/
|
|
20
|
+
docgen?: VueDocgenPlugin | {
|
|
21
|
+
plugin: 'vue-component-meta';
|
|
22
|
+
/**
|
|
23
|
+
* Tsconfig filename to use. Should be set if your main `tsconfig.json` includes references
|
|
24
|
+
* to other tsconfig files like `tsconfig.app.json`. Otherwise docgen might not be generated
|
|
25
|
+
* correctly (e.g. import aliases are not resolved).
|
|
26
|
+
*
|
|
27
|
+
* For further information, see our
|
|
28
|
+
* [docs](https://storybook.js.org/docs/get-started/vue3-vite#override-the-default-configuration).
|
|
29
|
+
*
|
|
30
|
+
* @default 'tsconfig.json'
|
|
31
|
+
*/
|
|
32
|
+
tsconfig: `tsconfig${string}.json`;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
type StorybookConfigFramework = {
|
|
36
|
+
framework: FrameworkName | {
|
|
37
|
+
name: FrameworkName;
|
|
38
|
+
options: FrameworkOptions;
|
|
39
|
+
};
|
|
40
|
+
core?: StorybookConfig$1['core'] & {
|
|
41
|
+
builder?: BuilderName | {
|
|
42
|
+
name: BuilderName;
|
|
43
|
+
options: BuilderOptions;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/** The interface for Storybook configuration in `main.ts` files. */
|
|
48
|
+
type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigVite | keyof StorybookConfigFramework> & StorybookConfigVite & StorybookConfigFramework;
|
|
7
49
|
|
|
8
50
|
declare function defineMain(config: StorybookConfig): StorybookConfig;
|
|
9
51
|
|
package/dist/node/index.js
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bonbf6ys4jm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bonbf6ys4jm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bonbf6ys4jm from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bonbf6ys4jm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bonbf6ys4jm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bonbf6ys4jm.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
__name
|
|
14
|
+
} from "../_node-chunks/chunk-TF3SOP6Y.js";
|
|
15
|
+
|
|
16
|
+
// src/node/index.ts
|
|
17
|
+
function defineMain(config) {
|
|
18
|
+
return config;
|
|
19
|
+
}
|
|
20
|
+
__name(defineMain, "defineMain");
|
|
21
|
+
export {
|
|
22
|
+
defineMain
|
|
23
|
+
};
|
package/dist/preset.js
CHANGED
|
@@ -1,3 +1,272 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bonbf6ys4jm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bonbf6ys4jm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bonbf6ys4jm from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bonbf6ys4jm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bonbf6ys4jm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bonbf6ys4jm.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
templateCompilation
|
|
14
|
+
} from "./_node-chunks/chunk-LJJ3IO2Q.js";
|
|
15
|
+
import {
|
|
16
|
+
__name
|
|
17
|
+
} from "./_node-chunks/chunk-TF3SOP6Y.js";
|
|
18
|
+
|
|
19
|
+
// src/plugins/vue-component-meta.ts
|
|
20
|
+
import { readFile, stat } from "node:fs/promises";
|
|
21
|
+
import { join, parse } from "node:path";
|
|
22
|
+
import { getProjectRoot } from "storybook/internal/common";
|
|
23
|
+
import MagicString from "magic-string";
|
|
24
|
+
import {
|
|
25
|
+
TypeMeta,
|
|
26
|
+
createChecker,
|
|
27
|
+
createCheckerByJson
|
|
28
|
+
} from "vue-component-meta";
|
|
29
|
+
import { parseMulti } from "vue-docgen-api";
|
|
30
|
+
async function vueComponentMeta(tsconfigPath = "tsconfig.json") {
|
|
31
|
+
const { createFilter } = await import("vite");
|
|
32
|
+
const exclude = /\.stories\.(ts|tsx|js|jsx)$|^\0\/virtual:|^\/virtual:|\.storybook\/.*\.(ts|js)$/;
|
|
33
|
+
const include = /\.(vue|ts|js|tsx|jsx)$/;
|
|
34
|
+
const filter = createFilter(include, exclude);
|
|
35
|
+
const checker = await createVueComponentMetaChecker(tsconfigPath);
|
|
36
|
+
return {
|
|
37
|
+
name: "storybook:vue-component-meta-plugin",
|
|
38
|
+
async transform(src, id) {
|
|
39
|
+
if (!filter(id)) {
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const exportNames = checker.getExportNames(id);
|
|
44
|
+
let componentsMeta = exportNames.map((name) => checker.getComponentMeta(id, name));
|
|
45
|
+
componentsMeta = await applyTempFixForEventDescriptions(id, componentsMeta);
|
|
46
|
+
const metaSources = [];
|
|
47
|
+
componentsMeta.forEach((meta, index) => {
|
|
48
|
+
const isEmpty = !meta.props.length && !meta.events.length && !meta.slots.length && !meta.exposed.length;
|
|
49
|
+
if (isEmpty || meta.type === TypeMeta.Unknown) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const exportName = exportNames[index];
|
|
53
|
+
["props", "events", "slots", "exposed"].forEach((key) => {
|
|
54
|
+
meta[key].forEach((value) => {
|
|
55
|
+
if (Array.isArray(value.schema)) {
|
|
56
|
+
value.schema.forEach((eventSchema) => removeNestedSchemas(eventSchema));
|
|
57
|
+
} else {
|
|
58
|
+
removeNestedSchemas(value.schema);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
const exposed = (
|
|
63
|
+
// the meta also includes duplicated entries in the "exposed" array with "on"
|
|
64
|
+
// prefix (e.g. onClick instead of click), so we need to filter them out here
|
|
65
|
+
meta.exposed.filter((expose) => {
|
|
66
|
+
let nameWithoutOnPrefix = expose.name;
|
|
67
|
+
if (nameWithoutOnPrefix.startsWith("on")) {
|
|
68
|
+
nameWithoutOnPrefix = lowercaseFirstLetter(expose.name.replace("on", ""));
|
|
69
|
+
}
|
|
70
|
+
const hasEvent = meta.events.find((event) => event.name === nameWithoutOnPrefix);
|
|
71
|
+
return !hasEvent;
|
|
72
|
+
}).filter((expose) => {
|
|
73
|
+
if (expose.name === "$slots") {
|
|
74
|
+
const slotNames = meta.slots.map((slot) => slot.name);
|
|
75
|
+
return !slotNames.every((slotName) => expose.type.includes(slotName));
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
})
|
|
79
|
+
);
|
|
80
|
+
metaSources.push({
|
|
81
|
+
exportName,
|
|
82
|
+
displayName: exportName === "default" ? getFilenameWithoutExtension(id) : exportName,
|
|
83
|
+
...meta,
|
|
84
|
+
exposed,
|
|
85
|
+
sourceFiles: id
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
if (metaSources.length === 0) {
|
|
89
|
+
return void 0;
|
|
90
|
+
}
|
|
91
|
+
const s = new MagicString(src);
|
|
92
|
+
metaSources.forEach((meta) => {
|
|
93
|
+
const isDefaultExport = meta.exportName === "default";
|
|
94
|
+
const name = isDefaultExport ? "_sfc_main" : meta.exportName;
|
|
95
|
+
if (new RegExp(`export {.*${name}.*}`).test(src) || new RegExp(`export \\* from ['"]\\S*${name}['"]`).test(src) || // when using re-exports, some exports might be resolved via checker.getExportNames
|
|
96
|
+
// but are not directly exported inside the current file so we need to ignore them too
|
|
97
|
+
!src.includes(name)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (!id.endsWith(".vue") && isDefaultExport) {
|
|
101
|
+
s.replace("export default ", "const _sfc_main = ");
|
|
102
|
+
s.append("\nexport default _sfc_main;");
|
|
103
|
+
}
|
|
104
|
+
s.append(`
|
|
105
|
+
;${name}.__docgenInfo = ${JSON.stringify(meta)}`);
|
|
106
|
+
});
|
|
107
|
+
return {
|
|
108
|
+
code: s.toString(),
|
|
109
|
+
map: s.generateMap({ hires: true, source: id })
|
|
110
|
+
};
|
|
111
|
+
} catch (e) {
|
|
112
|
+
return void 0;
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
// handle hot updates to update the component meta on file changes
|
|
116
|
+
async handleHotUpdate({ file, read, server, modules, timestamp }) {
|
|
117
|
+
const content = await read();
|
|
118
|
+
checker.updateFile(file, content);
|
|
119
|
+
const invalidatedModules = /* @__PURE__ */ new Set();
|
|
120
|
+
for (const mod of modules) {
|
|
121
|
+
server.moduleGraph.invalidateModule(mod, invalidatedModules, timestamp, true);
|
|
122
|
+
}
|
|
123
|
+
server.ws.send({ type: "full-reload" });
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
__name(vueComponentMeta, "vueComponentMeta");
|
|
129
|
+
async function createVueComponentMetaChecker(tsconfigPath = "tsconfig.json") {
|
|
130
|
+
const checkerOptions = {
|
|
131
|
+
forceUseTs: true,
|
|
132
|
+
noDeclarations: true,
|
|
133
|
+
printer: { newLine: 1 }
|
|
134
|
+
};
|
|
135
|
+
const projectRoot = getProjectRoot();
|
|
136
|
+
const projectTsConfigPath = join(projectRoot, tsconfigPath);
|
|
137
|
+
const defaultChecker = createCheckerByJson(projectRoot, { include: ["**/*"] }, checkerOptions);
|
|
138
|
+
if (await fileExists(projectTsConfigPath)) {
|
|
139
|
+
const references = await getTsConfigReferences(projectTsConfigPath);
|
|
140
|
+
if (references.length > 0) {
|
|
141
|
+
return defaultChecker;
|
|
142
|
+
}
|
|
143
|
+
return createChecker(projectTsConfigPath, checkerOptions);
|
|
144
|
+
}
|
|
145
|
+
return defaultChecker;
|
|
146
|
+
}
|
|
147
|
+
__name(createVueComponentMetaChecker, "createVueComponentMetaChecker");
|
|
148
|
+
function getFilenameWithoutExtension(filename) {
|
|
149
|
+
return parse(filename).name;
|
|
150
|
+
}
|
|
151
|
+
__name(getFilenameWithoutExtension, "getFilenameWithoutExtension");
|
|
152
|
+
function lowercaseFirstLetter(string) {
|
|
153
|
+
return string.charAt(0).toLowerCase() + string.slice(1);
|
|
154
|
+
}
|
|
155
|
+
__name(lowercaseFirstLetter, "lowercaseFirstLetter");
|
|
156
|
+
async function fileExists(fullPath) {
|
|
157
|
+
try {
|
|
158
|
+
await stat(fullPath);
|
|
159
|
+
return true;
|
|
160
|
+
} catch {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
__name(fileExists, "fileExists");
|
|
165
|
+
async function applyTempFixForEventDescriptions(filename, componentMeta) {
|
|
166
|
+
const hasEvents = componentMeta.some((meta) => meta.events.length);
|
|
167
|
+
if (!hasEvents) {
|
|
168
|
+
return componentMeta;
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
const parsedComponentDocs = await parseMulti(filename);
|
|
172
|
+
componentMeta.map((meta, index) => {
|
|
173
|
+
const eventsWithDescription = parsedComponentDocs[index].events;
|
|
174
|
+
if (!meta.events.length || !eventsWithDescription?.length) {
|
|
175
|
+
return meta;
|
|
176
|
+
}
|
|
177
|
+
meta.events = meta.events.map((event) => {
|
|
178
|
+
const description = eventsWithDescription.find((i) => i.name === event.name)?.description;
|
|
179
|
+
if (description) {
|
|
180
|
+
event.description = description;
|
|
181
|
+
}
|
|
182
|
+
return event;
|
|
183
|
+
});
|
|
184
|
+
return meta;
|
|
185
|
+
});
|
|
186
|
+
} catch {
|
|
187
|
+
}
|
|
188
|
+
return componentMeta;
|
|
189
|
+
}
|
|
190
|
+
__name(applyTempFixForEventDescriptions, "applyTempFixForEventDescriptions");
|
|
191
|
+
async function getTsConfigReferences(tsConfigPath) {
|
|
192
|
+
try {
|
|
193
|
+
const content = JSON.parse(await readFile(tsConfigPath, "utf-8"));
|
|
194
|
+
if (!("references" in content) || !Array.isArray(content.references)) {
|
|
195
|
+
return [];
|
|
196
|
+
}
|
|
197
|
+
return content.references;
|
|
198
|
+
} catch {
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
__name(getTsConfigReferences, "getTsConfigReferences");
|
|
203
|
+
function removeNestedSchemas(schema) {
|
|
204
|
+
if (typeof schema !== "object") {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (schema.kind === "enum") {
|
|
208
|
+
schema.schema?.forEach((enumSchema) => removeNestedSchemas(enumSchema));
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
delete schema.schema;
|
|
212
|
+
}
|
|
213
|
+
__name(removeNestedSchemas, "removeNestedSchemas");
|
|
214
|
+
|
|
215
|
+
// src/plugins/vue-docgen.ts
|
|
216
|
+
import MagicString2 from "magic-string";
|
|
217
|
+
import { parse as parse2 } from "vue-docgen-api";
|
|
218
|
+
async function vueDocgen() {
|
|
219
|
+
const { createFilter } = await import("vite");
|
|
220
|
+
const include = /\.(vue)$/;
|
|
221
|
+
const filter = createFilter(include);
|
|
222
|
+
return {
|
|
223
|
+
name: "storybook:vue-docgen-plugin",
|
|
224
|
+
async transform(src, id) {
|
|
225
|
+
if (!filter(id)) {
|
|
226
|
+
return void 0;
|
|
227
|
+
}
|
|
228
|
+
const metaData = await parse2(id);
|
|
229
|
+
const s = new MagicString2(src);
|
|
230
|
+
s.append(`;_sfc_main.__docgenInfo = ${JSON.stringify(metaData)}`);
|
|
231
|
+
return {
|
|
232
|
+
code: s.toString(),
|
|
233
|
+
map: s.generateMap({ hires: true, source: id })
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
__name(vueDocgen, "vueDocgen");
|
|
239
|
+
|
|
240
|
+
// src/preset.ts
|
|
241
|
+
var core = {
|
|
242
|
+
builder: import.meta.resolve("@storybook/builder-vite"),
|
|
243
|
+
renderer: import.meta.resolve("@storybook/vue3/preset")
|
|
244
|
+
};
|
|
245
|
+
var viteFinal = /* @__PURE__ */ __name(async (config, options) => {
|
|
246
|
+
const plugins = [await templateCompilation()];
|
|
247
|
+
const framework = await options.presets.apply("framework");
|
|
248
|
+
const frameworkOptions = typeof framework === "string" ? {} : framework.options ?? {};
|
|
249
|
+
const docgen = resolveDocgenOptions(frameworkOptions.docgen);
|
|
250
|
+
if (docgen.plugin === "vue-component-meta") {
|
|
251
|
+
plugins.push(await vueComponentMeta(docgen.tsconfig));
|
|
252
|
+
} else {
|
|
253
|
+
plugins.push(await vueDocgen());
|
|
254
|
+
}
|
|
255
|
+
const { mergeConfig } = await import("vite");
|
|
256
|
+
return mergeConfig(config, {
|
|
257
|
+
plugins
|
|
258
|
+
});
|
|
259
|
+
}, "viteFinal");
|
|
260
|
+
var resolveDocgenOptions = /* @__PURE__ */ __name((docgen) => {
|
|
261
|
+
if (!docgen) {
|
|
262
|
+
return { plugin: "vue-docgen-api" };
|
|
263
|
+
}
|
|
264
|
+
if (typeof docgen === "string") {
|
|
265
|
+
return { plugin: docgen };
|
|
266
|
+
}
|
|
267
|
+
return docgen;
|
|
268
|
+
}, "resolveDocgenOptions");
|
|
269
|
+
export {
|
|
270
|
+
core,
|
|
271
|
+
viteFinal
|
|
272
|
+
};
|
package/dist/vite-plugin.js
CHANGED
|
@@ -1 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bonbf6ys4jm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bonbf6ys4jm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bonbf6ys4jm from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bonbf6ys4jm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bonbf6ys4jm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bonbf6ys4jm.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
templateCompilation
|
|
14
|
+
} from "./_node-chunks/chunk-LJJ3IO2Q.js";
|
|
15
|
+
import {
|
|
16
|
+
__name
|
|
17
|
+
} from "./_node-chunks/chunk-TF3SOP6Y.js";
|
|
18
|
+
|
|
19
|
+
// src/vite-plugin.ts
|
|
20
|
+
var storybookVuePlugin = /* @__PURE__ */ __name(() => {
|
|
21
|
+
return [templateCompilation()];
|
|
22
|
+
}, "storybookVuePlugin");
|
|
23
|
+
export {
|
|
24
|
+
storybookVuePlugin
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/vue3-vite",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Storybook for Vue3 and Vite: Develop
|
|
3
|
+
"version": "10.0.0-beta.0",
|
|
4
|
+
"description": "Storybook for Vue3 and Vite: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"storybook"
|
|
6
|
+
"storybook",
|
|
7
|
+
"storybook-framework",
|
|
8
|
+
"vue3",
|
|
9
|
+
"vite",
|
|
10
|
+
"component",
|
|
11
|
+
"components"
|
|
7
12
|
],
|
|
8
13
|
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/frameworks/vue3-vite",
|
|
9
14
|
"bugs": {
|
|
@@ -19,33 +24,20 @@
|
|
|
19
24
|
"url": "https://opencollective.com/storybook"
|
|
20
25
|
},
|
|
21
26
|
"license": "MIT",
|
|
27
|
+
"type": "module",
|
|
22
28
|
"exports": {
|
|
23
29
|
".": {
|
|
24
30
|
"types": "./dist/index.d.ts",
|
|
25
|
-
"
|
|
26
|
-
"import": "./dist/index.mjs",
|
|
27
|
-
"require": "./dist/index.js"
|
|
28
|
-
},
|
|
29
|
-
"./preset": {
|
|
30
|
-
"types": "./dist/preset.d.ts",
|
|
31
|
-
"require": "./dist/preset.js"
|
|
32
|
-
},
|
|
33
|
-
"./vite-plugin": {
|
|
34
|
-
"types": "./dist/vite-plugin.d.ts",
|
|
35
|
-
"require": "./dist/vite-plugin.js",
|
|
36
|
-
"import": "./dist/vite-plugin.mjs"
|
|
31
|
+
"default": "./dist/index.js"
|
|
37
32
|
},
|
|
38
33
|
"./node": {
|
|
39
34
|
"types": "./dist/node/index.d.ts",
|
|
40
|
-
"
|
|
41
|
-
"import": "./dist/node/index.mjs",
|
|
42
|
-
"require": "./dist/node/index.js"
|
|
35
|
+
"default": "./dist/node/index.js"
|
|
43
36
|
},
|
|
44
|
-
"./package.json": "./package.json"
|
|
37
|
+
"./package.json": "./package.json",
|
|
38
|
+
"./preset": "./dist/preset.js",
|
|
39
|
+
"./vite-plugin": "./dist/vite-plugin.js"
|
|
45
40
|
},
|
|
46
|
-
"main": "dist/index.js",
|
|
47
|
-
"module": "dist/index.mjs",
|
|
48
|
-
"types": "dist/index.d.ts",
|
|
49
41
|
"files": [
|
|
50
42
|
"dist/**/*",
|
|
51
43
|
"template/**/*",
|
|
@@ -55,12 +47,12 @@
|
|
|
55
47
|
"!src/**/*"
|
|
56
48
|
],
|
|
57
49
|
"scripts": {
|
|
58
|
-
"check": "jiti ../../../scripts/
|
|
59
|
-
"prep": "jiti ../../../scripts/
|
|
50
|
+
"check": "jiti ../../../scripts/check/check-package.ts",
|
|
51
|
+
"prep": "jiti ../../../scripts/build/build-package.ts"
|
|
60
52
|
},
|
|
61
53
|
"dependencies": {
|
|
62
|
-
"@storybook/builder-vite": "
|
|
63
|
-
"@storybook/vue3": "
|
|
54
|
+
"@storybook/builder-vite": "10.0.0-beta.0",
|
|
55
|
+
"@storybook/vue3": "10.0.0-beta.0",
|
|
64
56
|
"find-package-json": "^1.2.0",
|
|
65
57
|
"magic-string": "^0.30.0",
|
|
66
58
|
"typescript": "^5.8.3",
|
|
@@ -71,26 +63,14 @@
|
|
|
71
63
|
"@types/find-package-json": "^1.2.6",
|
|
72
64
|
"@types/node": "^22.0.0",
|
|
73
65
|
"typescript": "^5.8.3",
|
|
74
|
-
"vite": "^
|
|
66
|
+
"vite": "^7.0.4"
|
|
75
67
|
},
|
|
76
68
|
"peerDependencies": {
|
|
77
|
-
"storybook": "^
|
|
69
|
+
"storybook": "^10.0.0-beta.0",
|
|
78
70
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
79
71
|
},
|
|
80
|
-
"engines": {
|
|
81
|
-
"node": ">=20.0.0"
|
|
82
|
-
},
|
|
83
72
|
"publishConfig": {
|
|
84
73
|
"access": "public"
|
|
85
74
|
},
|
|
86
|
-
"
|
|
87
|
-
"entries": [
|
|
88
|
-
"./src/index.ts",
|
|
89
|
-
"./src/preset.ts",
|
|
90
|
-
"./src/vite-plugin.ts",
|
|
91
|
-
"./src/node/index.ts"
|
|
92
|
-
],
|
|
93
|
-
"platform": "node"
|
|
94
|
-
},
|
|
95
|
-
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae16"
|
|
75
|
+
"gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae16"
|
|
96
76
|
}
|
package/preset.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export * from './dist/preset.js';
|
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@storybook/vue3';
|
package/dist/node/index.mjs
DELETED
package/dist/preset.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PresetProperty } from 'storybook/internal/types';
|
|
2
|
-
import { StorybookConfig } from './index.js';
|
|
3
|
-
import '@storybook/vue3';
|
|
4
|
-
import '@storybook/builder-vite';
|
|
5
|
-
import 'vue-component-meta';
|
|
6
|
-
import 'vue-docgen-api';
|
|
7
|
-
|
|
8
|
-
declare const core: PresetProperty<'core'>;
|
|
9
|
-
declare const viteFinal: StorybookConfig['viteFinal'];
|
|
10
|
-
|
|
11
|
-
export { core, viteFinal };
|
package/dist/vite-plugin.d.ts
DELETED
package/dist/vite-plugin.mjs
DELETED