@storybook/react 10.4.0-alpha.5 → 10.4.0-alpha.7

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.
Files changed (2) hide show
  1. package/dist/preset.js +25 -14
  2. package/package.json +3 -3
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_0bnjfut7ujqe from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_0bnjfut7ujqe from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_0bnjfut7ujqe from "node:module";
1
+ import CJS_COMPAT_NODE_URL_jlc3z147d6d from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_jlc3z147d6d from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_jlc3z147d6d from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_0bnjfut7ujqe.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_0bnjfut7ujqe.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_0bnjfut7ujqe.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_jlc3z147d6d.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_jlc3z147d6d.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_jlc3z147d6d.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -14119,8 +14119,15 @@ var memoStore = /* @__PURE__ */ new WeakMap(), asyncMemoStore = /* @__PURE__ */
14119
14119
  { name: "cachedReadTextFile" }
14120
14120
  ), cachedFindUp = cached(up2, { name: "findUp" }), cachedResolveImport = cached(resolveImport, {
14121
14121
  name: "resolveImport"
14122
- }), findTsconfigPath = cached(
14123
- (cwd2) => up2("tsconfig.json", { cwd: cwd2, last: getProjectRoot() }),
14122
+ }), TSCONFIG_CANDIDATES = ["tsconfig.json", "tsconfig.base.json", "tsconfig.app.json"], findTsconfigPath = cached(
14123
+ (cwd2) => {
14124
+ let projectRoot = getProjectRoot();
14125
+ for (let candidate of TSCONFIG_CANDIDATES) {
14126
+ let found = up2(candidate, { cwd: cwd2, last: projectRoot });
14127
+ if (found)
14128
+ return found;
14129
+ }
14130
+ },
14124
14131
  { name: "findTsconfigPath" }
14125
14132
  );
14126
14133
 
@@ -14596,7 +14603,7 @@ import { recast as recast2 } from "storybook/internal/babel";
14596
14603
  import { Tag } from "storybook/internal/core-server";
14597
14604
  import { storyNameFromExport } from "storybook/internal/csf";
14598
14605
  import { extractDescription, loadCsf } from "storybook/internal/csf-tools";
14599
- import { logger as logger7 } from "storybook/internal/node-logger";
14606
+ import { logger as logger8 } from "storybook/internal/node-logger";
14600
14607
 
14601
14608
  // src/componentManifest/componentMeta/ComponentMetaManager.ts
14602
14609
  import { logger as logger5 } from "storybook/internal/node-logger";
@@ -16119,10 +16126,11 @@ function pathForNode(program, target) {
16119
16126
  // src/componentManifest/getComponentImports.ts
16120
16127
  import { dirname as dirname8 } from "node:path";
16121
16128
  import { babelParse as babelParse2, recast, types as t3 } from "storybook/internal/babel";
16122
- import { logger as logger6 } from "storybook/internal/node-logger";
16129
+ import { logger as logger7 } from "storybook/internal/node-logger";
16123
16130
 
16124
16131
  // src/componentManifest/reactDocgenTypescript.ts
16125
16132
  import { dirname as dirname7 } from "node:path";
16133
+ import { logger as logger6 } from "storybook/internal/node-logger";
16126
16134
  var typeScriptPromise, reactDocgenTypescriptPromise, loadTypeScript = () => typeScriptPromise ??= import("typescript"), loadReactDocgenTypescript = () => reactDocgenTypescriptPromise ??= import("react-docgen-typescript"), LARGE_NON_USER_SOURCE_THRESHOLD = 30, getPropSource = (prop) => prop.parent?.fileName ?? prop.declarations?.[0]?.fileName, getLargeNonUserPropSources = (props) => {
16127
16135
  let countBySource = /* @__PURE__ */ new Map();
16128
16136
  for (let prop of Object.values(props)) {
@@ -16185,7 +16193,10 @@ async function getParser5(userOptions) {
16185
16193
  dirname7(configPath)
16186
16194
  );
16187
16195
  cachedCompilerOptions = { ...parsed.options, noErrorTruncation: !0 }, cachedFileNames = parsed.fileNames;
16188
- }
16196
+ } else
16197
+ logger6.warn(
16198
+ "No tsconfig.json (or tsconfig.base.json / tsconfig.app.json) found. TypeScript component props will not be documented by react-docgen-typescript. Create a tsconfig.json in your project root to enable automatic controls."
16199
+ );
16189
16200
  let program = typescript.createProgram(
16190
16201
  cachedFileNames ?? [],
16191
16202
  cachedCompilerOptions,
@@ -16361,7 +16372,7 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, isType
16361
16372
  basedir: dirname8(storyFilePath)
16362
16373
  }));
16363
16374
  } catch (e) {
16364
- logger6.debug(e);
16375
+ logger7.debug(e);
16365
16376
  }
16366
16377
  try {
16367
16378
  component.importId && !component.importId.startsWith(".") && storyFilePath && (cachedResolveImport(component.importId, { basedir: dirname8(storyFilePath) }), isPackage = !0);
@@ -16376,7 +16387,7 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, isType
16376
16387
  reactDocgenTypescript = matchComponentDoc(docs, component), reactDocgenTypescript || (reactDocgenTypescriptError = getReactDocgenTypescriptError(path5, component, docs));
16377
16388
  } catch (e) {
16378
16389
  let message = e instanceof Error ? e.message : String(e);
16379
- logger6.debug(`react-docgen-typescript failed for ${path5}: ${message}`), reactDocgenTypescriptError = {
16390
+ logger7.debug(`react-docgen-typescript failed for ${path5}: ${message}`), reactDocgenTypescriptError = {
16380
16391
  name: "react-docgen-typescript parse error",
16381
16392
  message: `File: ${path5}
16382
16393
  ${message}`
@@ -16559,7 +16570,7 @@ async function createComponentMetaManager(watch2) {
16559
16570
  let ts = await import("typescript"), manager = new ComponentMetaManager(ts);
16560
16571
  return watch2 && (componentMetaManager = manager), manager;
16561
16572
  } catch {
16562
- logger7.debug(
16573
+ logger8.debug(
16563
16574
  "[reactComponentMeta] TypeScript not available, skipping component meta extraction"
16564
16575
  );
16565
16576
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react",
3
- "version": "10.4.0-alpha.5",
3
+ "version": "10.4.0-alpha.7",
4
4
  "description": "Storybook React renderer",
5
5
  "keywords": [
6
6
  "storybook"
@@ -53,7 +53,7 @@
53
53
  ],
54
54
  "dependencies": {
55
55
  "@storybook/global": "^5.0.0",
56
- "@storybook/react-dom-shim": "10.4.0-alpha.5",
56
+ "@storybook/react-dom-shim": "10.4.0-alpha.7",
57
57
  "react-docgen": "^8.0.2",
58
58
  "react-docgen-typescript": "^2.2.2"
59
59
  },
@@ -83,7 +83,7 @@
83
83
  "peerDependencies": {
84
84
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
85
85
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
86
- "storybook": "^10.4.0-alpha.5",
86
+ "storybook": "^10.4.0-alpha.7",
87
87
  "typescript": ">= 4.9.x"
88
88
  },
89
89
  "peerDependenciesMeta": {