@storybook/react 10.2.0-alpha.11 → 10.2.0-alpha.13

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  entry_preview_exports
3
- } from "./chunk-GLRRNWDU.js";
3
+ } from "./chunk-L3JF7GGZ.js";
4
4
  import {
5
5
  entry_preview_argtypes_exports
6
6
  } from "./chunk-DX2KEMQY.js";
@@ -17,6 +17,7 @@ __export(entry_preview_exports, {
17
17
  renderToCanvas: () => renderToCanvas
18
18
  });
19
19
  import * as React4 from "react";
20
+ import { Tag } from "storybook/internal/preview-api";
20
21
  import { global as global2 } from "@storybook/global";
21
22
  import { configure } from "storybook/test";
22
23
 
@@ -156,7 +157,7 @@ var decorators = [
156
157
  return React4.createElement(React4.Suspense, null, story());
157
158
  },
158
159
  (story, context) => {
159
- if (context.tags?.includes("test-fn") && !global2.FEATURES?.experimentalTestSyntax)
160
+ if (context.tags?.includes(Tag.TEST_FN) && !global2.FEATURES?.experimentalTestSyntax)
160
161
  throw new Error(
161
162
  "To use the experimental test function, you must enable the experimentalTestSyntax feature flag. See https://storybook.js.org/docs/api/main-config/main-config-features#experimentaltestsyntax"
162
163
  );
@@ -5,7 +5,7 @@ import {
5
5
  parameters,
6
6
  render,
7
7
  renderToCanvas
8
- } from "./_browser-chunks/chunk-GLRRNWDU.js";
8
+ } from "./_browser-chunks/chunk-L3JF7GGZ.js";
9
9
  import {
10
10
  applyDecorators
11
11
  } from "./_browser-chunks/chunk-DDIRQRCA.js";
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  __definePreview
3
- } from "./_browser-chunks/chunk-BMWJYMA6.js";
3
+ } from "./_browser-chunks/chunk-HWOFIGZP.js";
4
4
  import {
5
5
  entry_preview_exports,
6
6
  renderToCanvas
7
- } from "./_browser-chunks/chunk-GLRRNWDU.js";
7
+ } from "./_browser-chunks/chunk-L3JF7GGZ.js";
8
8
  import {
9
9
  entry_preview_argtypes_exports
10
10
  } from "./_browser-chunks/chunk-DX2KEMQY.js";
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_cwt6ul3kdah from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_cwt6ul3kdah from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_cwt6ul3kdah from "node:module";
1
+ import CJS_COMPAT_NODE_URL_b6udcllya2j from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_b6udcllya2j from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_b6udcllya2j from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_cwt6ul3kdah.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_cwt6ul3kdah.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_cwt6ul3kdah.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_b6udcllya2j.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_b6udcllya2j.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_b6udcllya2j.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -2835,6 +2835,7 @@ var importMetaResolve = (...args) => typeof import.meta.resolve != "function" &&
2835
2835
 
2836
2836
  // src/componentManifest/generator.ts
2837
2837
  import { recast as recast2 } from "storybook/internal/babel";
2838
+ import { Tag } from "storybook/internal/core-server";
2838
2839
  import { extractDescription, loadCsf } from "storybook/internal/csf-tools";
2839
2840
  import { logger as logger4 } from "storybook/internal/node-logger";
2840
2841
 
@@ -4097,10 +4098,17 @@ function extractComponentDescription(csf, docgen) {
4097
4098
  var manifests = async (existingManifests = {}, { manifestEntries }) => {
4098
4099
  invalidateCache();
4099
4100
  let startPerformance = performance.now(), components = uniqBy(
4100
- manifestEntries.filter((entry) => entry.type === "story" && entry.subtype === "story"),
4101
+ manifestEntries.filter(
4102
+ (entry) => entry.type === "story" && entry.subtype === "story" || // addon-docs will add docs entries to these manifest entries afterwards
4103
+ // Docs entries have importPath pointing to MDX file, but storiesImports[0] points to the story file
4104
+ entry.type === "docs" && entry.tags?.includes(Tag.ATTACHED_MDX) && entry.storiesImports.length > 0
4105
+ ),
4101
4106
  (entry) => entry.id.split("--")[0]
4102
4107
  ).map((entry) => {
4103
- let absoluteImportPath = path.join(process.cwd(), entry.importPath), storyFile = cachedReadFileSync(absoluteImportPath, "utf-8"), csf = loadCsf(storyFile, { makeTitle: (title2) => title2 ?? "No title" }).parse(), componentName = csf._meta?.component, id = entry.id.split("--")[0], title = entry.title.split("/").at(-1).replace(/\s+/g, ""), allComponents = getComponents({ csf, storyFilePath: absoluteImportPath }), component = findMatchingComponent(
4108
+ let storyFilePath = entry.type === "story" ? entry.importPath : (
4109
+ // For attached docs entries, storiesImports[0] points to the stories file being attached to
4110
+ entry.storiesImports[0]
4111
+ ), absoluteImportPath = path.join(process.cwd(), storyFilePath), storyFile = cachedReadFileSync(absoluteImportPath, "utf-8"), csf = loadCsf(storyFile, { makeTitle: (title2) => title2 ?? "No title" }).parse(), componentName = csf._meta?.component, id = entry.id.split("--")[0], title = entry.title.split("/").at(-1).replace(/\s+/g, ""), allComponents = getComponents({ csf, storyFilePath: absoluteImportPath }), component = findMatchingComponent(
4104
4112
  allComponents,
4105
4113
  componentName,
4106
4114
  entry.title.replace(/\s+/g, "")
@@ -4108,7 +4116,7 @@ var manifests = async (existingManifests = {}, { manifestEntries }) => {
4108
4116
  `).trim() || fallbackImport, stories = extractStories(csf, component?.componentName, manifestEntries), base = {
4109
4117
  id,
4110
4118
  name: componentName ?? title,
4111
- path: entry.importPath,
4119
+ path: storyFilePath,
4112
4120
  stories,
4113
4121
  import: imports,
4114
4122
  jsDocTags: {}
package/dist/preview.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __definePreview
3
- } from "./_browser-chunks/chunk-BMWJYMA6.js";
4
- import "./_browser-chunks/chunk-GLRRNWDU.js";
3
+ } from "./_browser-chunks/chunk-HWOFIGZP.js";
4
+ import "./_browser-chunks/chunk-L3JF7GGZ.js";
5
5
  import "./_browser-chunks/chunk-DX2KEMQY.js";
6
6
  import "./_browser-chunks/chunk-CMP5DLKH.js";
7
7
  import "./_browser-chunks/chunk-DDIRQRCA.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react",
3
- "version": "10.2.0-alpha.11",
3
+ "version": "10.2.0-alpha.13",
4
4
  "description": "Storybook React renderer",
5
5
  "keywords": [
6
6
  "storybook"
@@ -50,7 +50,7 @@
50
50
  ],
51
51
  "dependencies": {
52
52
  "@storybook/global": "^5.0.0",
53
- "@storybook/react-dom-shim": "10.2.0-alpha.11",
53
+ "@storybook/react-dom-shim": "10.2.0-alpha.13",
54
54
  "react-docgen": "^8.0.2"
55
55
  },
56
56
  "devDependencies": {
@@ -77,7 +77,7 @@
77
77
  "peerDependencies": {
78
78
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
79
79
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
80
- "storybook": "^10.2.0-alpha.11",
80
+ "storybook": "^10.2.0-alpha.13",
81
81
  "typescript": ">= 4.9.x"
82
82
  },
83
83
  "peerDependenciesMeta": {