@storybook/vue3 10.4.0-alpha.9 → 10.4.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/dist/_node-chunks/parsers-FYRANYJ7.js +75 -0
- package/dist/preset.js +10 -6
- package/package.json +2 -2
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_m7p44h8ftzo from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_m7p44h8ftzo from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_m7p44h8ftzo from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_m7p44h8ftzo.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_m7p44h8ftzo.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_m7p44h8ftzo.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// src/parsers/vueImportParser.ts
|
|
14
|
+
import {
|
|
15
|
+
ChangeDetectionFailureError
|
|
16
|
+
} from "storybook/internal/core-server";
|
|
17
|
+
var compilerSfcPromise;
|
|
18
|
+
async function getCompilerSfc() {
|
|
19
|
+
return compilerSfcPromise || (compilerSfcPromise = import("vue/compiler-sfc").catch((error) => {
|
|
20
|
+
throw compilerSfcPromise = void 0, new ChangeDetectionFailureError(
|
|
21
|
+
`Failed to load 'vue/compiler-sfc'. Original error: ${error instanceof Error ? error.message : String(error)}`,
|
|
22
|
+
error instanceof Error ? { cause: error } : void 0
|
|
23
|
+
);
|
|
24
|
+
})), compilerSfcPromise;
|
|
25
|
+
}
|
|
26
|
+
function virtualExtensionForLang(lang) {
|
|
27
|
+
switch (lang) {
|
|
28
|
+
case "ts":
|
|
29
|
+
return "ts";
|
|
30
|
+
case "tsx":
|
|
31
|
+
return "tsx";
|
|
32
|
+
case "jsx":
|
|
33
|
+
return "jsx";
|
|
34
|
+
default:
|
|
35
|
+
return "js";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
var vueImportParser = {
|
|
39
|
+
extensions: [".vue"],
|
|
40
|
+
async parse({ filePath, source }, ctx) {
|
|
41
|
+
let sfc = await getCompilerSfc(), parsed;
|
|
42
|
+
try {
|
|
43
|
+
parsed = sfc.parse(source, { filename: filePath });
|
|
44
|
+
} catch (error) {
|
|
45
|
+
throw new ChangeDetectionFailureError(
|
|
46
|
+
`vue/compiler-sfc failed to parse ${filePath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
47
|
+
error instanceof Error ? { cause: error } : void 0
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
if (parsed.errors.length > 0) {
|
|
51
|
+
let first = parsed.errors[0], message = first instanceof Error ? first.message : String(first);
|
|
52
|
+
throw new ChangeDetectionFailureError(
|
|
53
|
+
`vue/compiler-sfc reported errors for ${filePath}: ${message}`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
let { descriptor } = parsed, blocks = [];
|
|
57
|
+
if (descriptor.script && descriptor.script.content.length > 0 && blocks.push({ content: descriptor.script.content, lang: descriptor.script.lang }), descriptor.scriptSetup && descriptor.scriptSetup.content.length > 0 && blocks.push({
|
|
58
|
+
content: descriptor.scriptSetup.content,
|
|
59
|
+
lang: descriptor.scriptSetup.lang
|
|
60
|
+
}), blocks.length === 0)
|
|
61
|
+
return [];
|
|
62
|
+
let edges = [], seen = /* @__PURE__ */ new Set();
|
|
63
|
+
for (let block of blocks) {
|
|
64
|
+
let ext = virtualExtensionForLang(block.lang), virtualFilePath = `${filePath}.script.${ext}`, scriptEdges = await ctx.parseScriptWithOxc(block.content, virtualFilePath);
|
|
65
|
+
for (let edge of scriptEdges) {
|
|
66
|
+
let key = `${edge.kind}:${edge.specifier}`;
|
|
67
|
+
seen.has(key) || (seen.add(key), edges.push(edge));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return edges;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
vueImportParser
|
|
75
|
+
};
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_m7p44h8ftzo from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_m7p44h8ftzo from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_m7p44h8ftzo from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_m7p44h8ftzo.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_m7p44h8ftzo.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_m7p44h8ftzo.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -17,7 +17,11 @@ var previewAnnotations = async (input = [], options) => {
|
|
|
17
17
|
return [].concat(input).concat([fileURLToPath(import.meta.resolve("@storybook/vue3/entry-preview"))]).concat(
|
|
18
18
|
docsEnabled ? [fileURLToPath(import.meta.resolve("@storybook/vue3/entry-preview-docs"))] : []
|
|
19
19
|
);
|
|
20
|
+
}, experimental_importParsers = async (input = []) => {
|
|
21
|
+
let { vueImportParser } = await import("./_node-chunks/parsers-FYRANYJ7.js");
|
|
22
|
+
return [...input, vueImportParser];
|
|
20
23
|
};
|
|
21
24
|
export {
|
|
25
|
+
experimental_importParsers,
|
|
22
26
|
previewAnnotations
|
|
23
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/vue3",
|
|
3
|
-
"version": "10.4.0-
|
|
3
|
+
"version": "10.4.0-beta.0",
|
|
4
4
|
"description": "Storybook Vue 3 renderer: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"vue-tsc": "latest"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"storybook": "^10.4.0-
|
|
64
|
+
"storybook": "^10.4.0-beta.0",
|
|
65
65
|
"vue": "^3.0.0"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|