@storybook/vue3 11.0.0-rc.2 → 11.0.0-rc.3

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.
@@ -2,8 +2,9 @@ import {
2
2
  indent
3
3
  } from "./chunk-B2AO4N3K.js";
4
4
  import {
5
- collectComponentMetaSources
6
- } from "./chunk-7WHIMGTJ.js";
5
+ collectComponentMetaSources,
6
+ relative
7
+ } from "./chunk-PJYH2H5M.js";
7
8
 
8
9
  // src/docgen/component-docgen/arg-types/extractArgTypes.ts
9
10
  import { convert, extractComponentProps, hasDocgen } from "storybook/internal/docs-tools";
@@ -422,7 +423,7 @@ async function extractVueComponentDocgen(context, resolvedComponent, { metaJsDoc
422
423
  return {
423
424
  error: {
424
425
  name: "No docgen found",
425
- message: `vue-component-meta extracted no component metadata for the "${declaredExport.exportName}" export of ${declaredExport.path}${errorContext}.`
426
+ message: `vue-component-meta extracted no component metadata for the "${declaredExport.exportName}" export of ${relative(process.cwd(), declaredExport.path)}${errorContext}.`
426
427
  }
427
428
  };
428
429
  let { description, summary, jsDocTags } = extractComponentDescription(
@@ -1,11 +1,78 @@
1
1
  // src/docgen/component-docgen/component-meta/component-meta.ts
2
2
  import { readFile, stat } from "node:fs/promises";
3
- import { join, parse } from "node:path";
3
+ import { join as join2, parse as parse2 } from "node:path";
4
4
  import { getProjectRoot } from "storybook/internal/common";
5
5
  import {
6
6
  extractComponentJsDocInfo,
7
7
  resolveExportedSymbol
8
8
  } from "storybook/internal/component-meta";
9
+
10
+ // ../../../node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
11
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
12
+ function normalizeWindowsPath(input = "") {
13
+ return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
14
+ }
15
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
16
+ var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
17
+ function cwd() {
18
+ return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
19
+ }
20
+ var resolve = function(...arguments_) {
21
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
22
+ let resolvedPath = "", resolvedAbsolute = !1;
23
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
24
+ let path = index >= 0 ? arguments_[index] : cwd();
25
+ !path || path.length === 0 || (resolvedPath = `${path}/${resolvedPath}`, resolvedAbsolute = isAbsolute(path));
26
+ }
27
+ return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
28
+ };
29
+ function normalizeString(path, allowAboveRoot) {
30
+ let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
31
+ for (let index = 0; index <= path.length; ++index) {
32
+ if (index < path.length)
33
+ char = path[index];
34
+ else {
35
+ if (char === "/")
36
+ break;
37
+ char = "/";
38
+ }
39
+ if (char === "/") {
40
+ if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
41
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
42
+ if (res.length > 2) {
43
+ let lastSlashIndex = res.lastIndexOf("/");
44
+ lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
45
+ continue;
46
+ } else if (res.length > 0) {
47
+ res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
48
+ continue;
49
+ }
50
+ }
51
+ allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
52
+ } else
53
+ res.length > 0 ? res += `/${path.slice(lastSlash + 1, index)}` : res = path.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
54
+ lastSlash = index, dots = 0;
55
+ } else char === "." && dots !== -1 ? ++dots : dots = -1;
56
+ }
57
+ return res;
58
+ }
59
+ var isAbsolute = function(p) {
60
+ return _IS_ABSOLUTE_RE.test(p);
61
+ };
62
+ var relative = function(from, to) {
63
+ let _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/"), _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
64
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0])
65
+ return _to.join("/");
66
+ let _fromCopy = [..._from];
67
+ for (let segment of _fromCopy) {
68
+ if (_to[0] !== segment)
69
+ break;
70
+ _from.shift(), _to.shift();
71
+ }
72
+ return [..._from.map(() => ".."), ..._to].join("/");
73
+ };
74
+
75
+ // src/docgen/component-docgen/component-meta/component-meta.ts
9
76
  import {
10
77
  TypeMeta,
11
78
  createChecker,
@@ -22,7 +89,7 @@ var CHECKER_OPTIONS = {
22
89
  schema: !0
23
90
  };
24
91
  async function createVueComponentMetaChecker(tsconfigPath = "tsconfig.json") {
25
- let projectRoot = getProjectRoot(), projectTsConfigPath = join(projectRoot, tsconfigPath), defaultChecker = createCheckerByJson(projectRoot, { include: ["**/*"] }, CHECKER_OPTIONS);
92
+ let projectRoot = getProjectRoot(), projectTsConfigPath = join2(projectRoot, tsconfigPath), defaultChecker = createCheckerByJson(projectRoot, { include: ["**/*"] }, CHECKER_OPTIONS);
26
93
  return await fileExists(projectTsConfigPath) ? (await getTsConfigReferences(projectTsConfigPath)).length > 0 ? defaultChecker : createChecker(projectTsConfigPath, CHECKER_OPTIONS) : defaultChecker;
27
94
  }
28
95
  async function collectComponentMetaSources(checker, id, typescript) {
@@ -74,7 +141,7 @@ async function collectComponentMetaSources(checker, id, typescript) {
74
141
  description: jsDocInfo?.description,
75
142
  jsDocTags: jsDocInfo?.jsDocTags,
76
143
  exposed: exposed.filter(isDocumented),
77
- sourceFiles: id
144
+ sourceFiles: relative(process.cwd(), id)
78
145
  })
79
146
  );
80
147
  }), metaSources;
@@ -104,7 +171,7 @@ function extractVueComponentJsDocInfo(typescript, checker, id, exportName) {
104
171
  return extractComponentJsDocInfo(typescript, typeChecker, symbol);
105
172
  }
106
173
  function getFilenameWithoutExtension(filename) {
107
- return parse(filename).name;
174
+ return parse2(filename).name;
108
175
  }
109
176
  function lowercaseFirstLetter(string) {
110
177
  return string.charAt(0).toLowerCase() + string.slice(1);
@@ -229,6 +296,7 @@ function removeNestedSchemas(schema) {
229
296
  }
230
297
 
231
298
  export {
299
+ relative,
232
300
  CHECKER_OPTIONS,
233
301
  createVueComponentMetaChecker,
234
302
  collectComponentMetaSources,
@@ -3,7 +3,7 @@ import {
3
3
  applyVueDocgenApiTempFixes,
4
4
  collectComponentMetaSources,
5
5
  createVueComponentMetaChecker
6
- } from "./chunk-7WHIMGTJ.js";
6
+ } from "./chunk-PJYH2H5M.js";
7
7
  export {
8
8
  CHECKER_OPTIONS,
9
9
  applyVueDocgenApiTempFixes,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  buildDocgenPayload
3
- } from "../_node-chunks/chunk-P5M6CRJS.js";
3
+ } from "../_node-chunks/chunk-GZZJQ4KA.js";
4
4
  import "../_node-chunks/chunk-B2AO4N3K.js";
5
5
  import {
6
6
  CHECKER_OPTIONS
7
- } from "../_node-chunks/chunk-7WHIMGTJ.js";
7
+ } from "../_node-chunks/chunk-PJYH2H5M.js";
8
8
 
9
9
  // src/docgen/docgen-worker.ts
10
10
  import { createLazyDocgenMiddleware, loadTypeScriptCompilerApi } from "storybook/internal/common";
@@ -6,13 +6,13 @@ import {
6
6
  buildDocgenPayload,
7
7
  createNamedTypeDetailResolver,
8
8
  extractArgTypes
9
- } from "../_node-chunks/chunk-P5M6CRJS.js";
9
+ } from "../_node-chunks/chunk-GZZJQ4KA.js";
10
10
  import "../_node-chunks/chunk-B2AO4N3K.js";
11
11
  import {
12
12
  CHECKER_OPTIONS,
13
13
  applyVueDocgenApiTempFixes,
14
14
  collectComponentMetaSources
15
- } from "../_node-chunks/chunk-7WHIMGTJ.js";
15
+ } from "../_node-chunks/chunk-PJYH2H5M.js";
16
16
 
17
17
  // src/docgen/story-docs/source-decorator/sourceDecorator.ts
18
18
  import { SourceType } from "storybook/internal/docs-tools";
package/dist/preset.js CHANGED
@@ -38,7 +38,7 @@ var experimental_storyDocsProvider = createWorkerGatedStoryDocsProvider({
38
38
 
39
39
  // src/docgen/engine.ts
40
40
  var experimental_vueDocgenEngine = async () => ({
41
- componentMeta: () => import("./_node-chunks/component-meta-FWIOHTOX.js"),
41
+ componentMeta: () => import("./_node-chunks/component-meta-2QQVU6VA.js"),
42
42
  vueDocgenApi: () => import("./_node-chunks/vue-docgen-api-IRJAMTGH.js")
43
43
  });
44
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/vue3",
3
- "version": "11.0.0-rc.2",
3
+ "version": "11.0.0-rc.3",
4
4
  "description": "Storybook Vue 3 renderer: Develop, document, and test UI components in isolation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -71,7 +71,7 @@
71
71
  "vue-tsc": "latest"
72
72
  },
73
73
  "peerDependencies": {
74
- "storybook": "^11.0.0-rc.2",
74
+ "storybook": "^11.0.0-rc.3",
75
75
  "typescript": "^5.9.0 || ^6.0.0 || ^7.0.0",
76
76
  "vue": "^3.0.0"
77
77
  },