@storybook/react 11.0.0-rc.0 → 11.0.0-rc.2
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/_browser-chunks/{chunk-XQNZ5YRO.js → chunk-GBFPEOJZ.js} +1 -36
- package/dist/_browser-chunks/chunk-KI7YBTX7.js +42 -0
- package/dist/_browser-chunks/{chunk-LK5PKCYS.js → chunk-LI5LRSL3.js} +2 -2
- package/dist/_browser-chunks/{chunk-I62VTYU3.js → chunk-MB4PPIXP.js} +2 -4
- package/dist/_node-chunks/{chunk-2I5WCK5H.js → chunk-E7AXB5JU.js} +18 -5
- package/dist/_node-chunks/chunk-PQZIOGBY.js +1 -1
- package/dist/_node-chunks/{chunk-ITCF7APG.js → chunk-VEMSK7QJ.js} +1 -1
- package/dist/_node-chunks/{chunk-LZBEMUVF.js → chunk-XPEWS4XG.js} +1 -1
- package/dist/_node-chunks/{extractArgTypesFromComponentFile-BBV3XDO4.js → extractArgTypesFromComponentFile-JKOCA6RX.js} +3 -3
- package/dist/docgen/docgen-worker.js +7 -3
- package/dist/docs/register-print-hole.js +2 -0
- package/dist/entry-preview-docs.js +2 -1
- package/dist/entry-preview.js +1 -1
- package/dist/index.js +5 -6
- package/dist/preset.js +21 -16
- package/dist/preview.js +4 -3
- package/package.json +4 -6
- package/template/cli/js/Button.jsx +0 -2
- package/template/cli/js/Header.jsx +0 -2
- package/template/cli/ts/Button.tsx +0 -2
- package/template/cli/ts/Header.tsx +0 -2
- package/template/components/index.js +0 -2
|
@@ -19,40 +19,6 @@ __export(entry_preview_docs_exports, {
|
|
|
19
19
|
});
|
|
20
20
|
import { getSourceSnippetRuntime } from "storybook/internal/docs-tools";
|
|
21
21
|
|
|
22
|
-
// src/docs/print-hole.ts
|
|
23
|
-
import { printValue, unknownHoleKind } from "storybook/internal/docs-tools";
|
|
24
|
-
|
|
25
|
-
// src/snippet-values.ts
|
|
26
|
-
var unmarked = (_, text) => text, isAttributeName = (name) => /^[A-Za-z_][A-Za-z0-9_:-]*$/.test(name), isAttributeText = (text) => !/["&\r\n]/.test(text), isChildText = (text) => !/[{}<>&\r\n]/.test(text), valueCode = (value) => value.kind === "boolean" ? String(value.value) : value.code, printAttribute = (name, value) => value.kind === "boolean" ? value.value ? name : `${name}={false}` : value.kind === "string" && isAttributeText(value.value) ? `${name}="${value.value}"` : `${name}={${value.code}}`, printAttributes = (args, mark = unmarked) => {
|
|
27
|
-
let unnamed = args.filter(([name]) => !isAttributeName(name)), attributes = args.filter(([name]) => isAttributeName(name)).map(([name, value]) => mark({ kind: "attr", arg: name }, printAttribute(name, value)));
|
|
28
|
-
if (unnamed.length !== 0) {
|
|
29
|
-
let members = unnamed.map(
|
|
30
|
-
([name, value]) => `${JSON.stringify(name)}: ${mark({ kind: "value", arg: name }, valueCode(value))}`
|
|
31
|
-
);
|
|
32
|
-
attributes.push(`{...{ ${members.join(", ")} }}`);
|
|
33
|
-
}
|
|
34
|
-
return attributes;
|
|
35
|
-
}, printChildren = (value) => value.kind === "string" && isChildText(value.value) ? value.value : value.kind === "jsx" ? value.code : `{${valueCode(value)}}`;
|
|
36
|
-
|
|
37
|
-
// src/docs/print-hole.ts
|
|
38
|
-
var printHole = (hole, value) => {
|
|
39
|
-
let arg = hole.arg ?? "";
|
|
40
|
-
switch (hole.kind) {
|
|
41
|
-
case "attr":
|
|
42
|
-
return value === void 0 ? "" : printAttribute(hole.name ?? arg, toJsxValue(arg, value));
|
|
43
|
-
case "text":
|
|
44
|
-
return value === void 0 ? "" : printChildren(toJsxValue(arg, value));
|
|
45
|
-
case "value":
|
|
46
|
-
return printValue(value, arg);
|
|
47
|
-
case "attrs":
|
|
48
|
-
return printAttributes(
|
|
49
|
-
Object.entries(value).filter(([name]) => !hole.except.includes(name)).map(([name, item]) => [name, toJsxValue(name, item)])
|
|
50
|
-
).map((attribute) => ` ${attribute}`).join("");
|
|
51
|
-
default:
|
|
52
|
-
return unknownHoleKind(hole);
|
|
53
|
-
}
|
|
54
|
-
}, toJsxValue = (name, value) => typeof value == "boolean" ? { kind: "boolean", value } : typeof value == "string" ? { kind: "string", value, code: printValue(value, name) } : { kind: "code", code: printValue(value, name) };
|
|
55
|
-
|
|
56
22
|
// src/docs/jsxDecorator.tsx
|
|
57
23
|
import React, { createElement, isValidElement } from "react";
|
|
58
24
|
import { logger } from "storybook/internal/client-logger";
|
|
@@ -166,8 +132,7 @@ var applyDecorators2 = (storyFn, decorators2) => {
|
|
|
166
132
|
// src/entry-preview-docs.ts
|
|
167
133
|
var snippetRuntime = getSourceSnippetRuntime(), useCompileTimeSnippets = "FEATURES" in globalThis && globalThis?.FEATURES?.experimentalCodeExamples, decorators = snippetRuntime === "preview" && !useCompileTimeSnippets ? [jsxDecorator] : [], parameters = {
|
|
168
134
|
docs: {
|
|
169
|
-
story: { inline: !0 }
|
|
170
|
-
...snippetRuntime === "server" ? { source: { printHole } } : {}
|
|
135
|
+
story: { inline: !0 }
|
|
171
136
|
}
|
|
172
137
|
};
|
|
173
138
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// src/docs/register-print-hole.ts
|
|
2
|
+
import { registerPrintHole } from "storybook/internal/docs-tools/snippets";
|
|
3
|
+
|
|
4
|
+
// src/docs/print-hole.ts
|
|
5
|
+
import {
|
|
6
|
+
printValue,
|
|
7
|
+
unknownHoleKind
|
|
8
|
+
} from "storybook/internal/docs-tools/snippets";
|
|
9
|
+
|
|
10
|
+
// src/snippet-values.ts
|
|
11
|
+
var unmarked = (_, text) => text, isAttributeName = (name) => /^[A-Za-z_][A-Za-z0-9_:-]*$/.test(name), isAttributeText = (text) => !/["&\r\n]/.test(text), isChildText = (text) => !/[{}<>&\r\n]/.test(text), valueCode = (value) => value.kind === "boolean" ? String(value.value) : value.code, printAttribute = (name, value) => value.kind === "boolean" ? value.value ? name : `${name}={false}` : value.kind === "string" && isAttributeText(value.value) ? `${name}="${value.value}"` : `${name}={${value.code}}`, printAttributes = (args, mark = unmarked) => {
|
|
12
|
+
let unnamed = args.filter(([name]) => !isAttributeName(name)), attributes = args.filter(([name]) => isAttributeName(name)).map(([name, value]) => mark({ kind: "attr", arg: name }, printAttribute(name, value)));
|
|
13
|
+
if (unnamed.length !== 0) {
|
|
14
|
+
let members = unnamed.map(
|
|
15
|
+
([name, value]) => `${JSON.stringify(name)}: ${mark({ kind: "value", arg: name }, valueCode(value))}`
|
|
16
|
+
);
|
|
17
|
+
attributes.push(`{...{ ${members.join(", ")} }}`);
|
|
18
|
+
}
|
|
19
|
+
return attributes;
|
|
20
|
+
}, printChildren = (value) => value.kind === "string" && isChildText(value.value) ? value.value : value.kind === "jsx" ? value.code : `{${valueCode(value)}}`;
|
|
21
|
+
|
|
22
|
+
// src/docs/print-hole.ts
|
|
23
|
+
var printHole = (hole, value) => {
|
|
24
|
+
let arg = hole.arg ?? "";
|
|
25
|
+
switch (hole.kind) {
|
|
26
|
+
case "attr":
|
|
27
|
+
return value === void 0 ? "" : printAttribute(hole.name ?? arg, toJsxValue(arg, value));
|
|
28
|
+
case "text":
|
|
29
|
+
return value === void 0 ? "" : printChildren(toJsxValue(arg, value));
|
|
30
|
+
case "value":
|
|
31
|
+
return printValue(value, arg);
|
|
32
|
+
case "attrs":
|
|
33
|
+
return printAttributes(
|
|
34
|
+
Object.entries(value).filter(([name]) => !hole.except.includes(name)).map(([name, item]) => [name, toJsxValue(name, item)])
|
|
35
|
+
).map((attribute) => ` ${attribute}`).join("");
|
|
36
|
+
default:
|
|
37
|
+
return unknownHoleKind(hole);
|
|
38
|
+
}
|
|
39
|
+
}, toJsxValue = (name, value) => typeof value == "boolean" ? { kind: "boolean", value } : typeof value == "string" ? { kind: "string", value, code: printValue(value, name) } : { kind: "code", code: printValue(value, name) };
|
|
40
|
+
|
|
41
|
+
// src/docs/register-print-hole.ts
|
|
42
|
+
registerPrintHole(printHole);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
entry_preview_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MB4PPIXP.js";
|
|
4
4
|
import {
|
|
5
5
|
entry_preview_argtypes_exports
|
|
6
6
|
} from "./chunk-WWHCZJWM.js";
|
|
7
7
|
import {
|
|
8
8
|
entry_preview_docs_exports
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GBFPEOJZ.js";
|
|
10
10
|
|
|
11
11
|
// src/preview.tsx
|
|
12
12
|
import { definePreview as definePreviewBase } from "storybook/internal/csf";
|
|
@@ -18,7 +18,6 @@ __export(entry_preview_exports, {
|
|
|
18
18
|
});
|
|
19
19
|
import * as React4 from "react";
|
|
20
20
|
import { Tag } from "storybook/internal/preview-api";
|
|
21
|
-
import { global as global2 } from "@storybook/global";
|
|
22
21
|
import { configure } from "storybook/test";
|
|
23
22
|
|
|
24
23
|
// src/act-compat.ts
|
|
@@ -102,8 +101,7 @@ var render = (args, context) => {
|
|
|
102
101
|
|
|
103
102
|
// src/renderToCanvas.tsx
|
|
104
103
|
import React3, { Fragment, Component as ReactComponent, StrictMode } from "react";
|
|
105
|
-
|
|
106
|
-
var { FRAMEWORK_OPTIONS } = global, ErrorBoundary = class extends ReactComponent {
|
|
104
|
+
var { FRAMEWORK_OPTIONS } = globalThis, ErrorBoundary = class extends ReactComponent {
|
|
107
105
|
constructor() {
|
|
108
106
|
super(...arguments);
|
|
109
107
|
this.state = { hasError: !1 };
|
|
@@ -181,7 +179,7 @@ var decorators = [
|
|
|
181
179
|
return React4.createElement(React4.Suspense, null, story());
|
|
182
180
|
},
|
|
183
181
|
(story, context) => {
|
|
184
|
-
if (context.tags?.includes(Tag.TEST_FN) && !
|
|
182
|
+
if (context.tags?.includes(Tag.TEST_FN) && !globalThis.FEATURES?.experimentalTestSyntax)
|
|
185
183
|
throw new Error(
|
|
186
184
|
"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"
|
|
187
185
|
);
|
|
@@ -5083,9 +5083,16 @@ var ComponentMetaProject = class extends ProgramBackedProject {
|
|
|
5083
5083
|
(s) => s,
|
|
5084
5084
|
// asScriptId - identity for React (no URI mapping needed)
|
|
5085
5085
|
projectHost
|
|
5086
|
-
);
|
|
5086
|
+
), getHostScriptVersion = languageServiceHost.getScriptVersion;
|
|
5087
5087
|
this.service = typescript.createLanguageService(
|
|
5088
|
-
Object.assign(languageServiceHost, {
|
|
5088
|
+
Object.assign(languageServiceHost, {
|
|
5089
|
+
// Like tsserver, read a referenced project's sources instead of its .d.ts output, so its
|
|
5090
|
+
// components stay in the program. The flag is internal on LanguageServiceHost's typings.
|
|
5091
|
+
useSourceOfProjectReferenceRedirect: () => !0,
|
|
5092
|
+
// The registry hands a file parsed by one project to another project that asks for the same
|
|
5093
|
+
// version. The host counts versions from 0 for each project, so the mtime tells them apart.
|
|
5094
|
+
getScriptVersion: (fileName) => `${getHostScriptVersion(fileName)}:${this.files.getScriptVersion(fileName)}`
|
|
5095
|
+
}),
|
|
5089
5096
|
this.documentRegistry
|
|
5090
5097
|
);
|
|
5091
5098
|
}
|
|
@@ -5219,6 +5226,7 @@ function createCompilerApiBackend(typescript, fsFileSnapshots) {
|
|
|
5219
5226
|
void 0,
|
|
5220
5227
|
documentRegistry
|
|
5221
5228
|
),
|
|
5229
|
+
sharesParsedFiles: !0,
|
|
5222
5230
|
dispose: () => fsFileSnapshots.clear()
|
|
5223
5231
|
} };
|
|
5224
5232
|
}
|
|
@@ -5227,8 +5235,13 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
|
5227
5235
|
* `recycleHeapPressureRatio` is the fraction of the V8 heap limit at which the shared program(s)
|
|
5228
5236
|
* are recycled; the memory regression gate passes `Infinity` to disable recycling and assert the
|
|
5229
5237
|
* OOM still happens without the fix.
|
|
5238
|
+
*
|
|
5239
|
+
* `keepParsedFilesOnRecycle` is for a manager that serves one request after another, like the
|
|
5240
|
+
* docgen worker. A recycle then keeps the parsed files of the projects the batch used, so the next
|
|
5241
|
+
* request does not parse them again. Without it a recycle frees them, which suits a caller that
|
|
5242
|
+
* extracts everything in one batch and needs the heap for other work afterwards.
|
|
5230
5243
|
*/
|
|
5231
|
-
constructor(typescript, recycleHeapPressureRatio) {
|
|
5244
|
+
constructor(typescript, recycleHeapPressureRatio, { keepParsedFilesOnRecycle = !1 } = {}) {
|
|
5232
5245
|
let fsFileSnapshots = /* @__PURE__ */ new Map(), { fileSystem, factory } = createComponentMetaBackend(typescript, {
|
|
5233
5246
|
compiler: (compilerApi) => createCompilerApiBackend(compilerApi, fsFileSnapshots),
|
|
5234
5247
|
native: (modules) => createNativeBackend(modules, NativeComponentMetaProject, {
|
|
@@ -5239,7 +5252,7 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
|
5239
5252
|
jsx: modules.sync.JsxEmit.ReactJSX
|
|
5240
5253
|
})
|
|
5241
5254
|
});
|
|
5242
|
-
super(fileSystem, factory, recycleHeapPressureRatio), this.fsFileSnapshots = fsFileSnapshots;
|
|
5255
|
+
super(fileSystem, factory, recycleHeapPressureRatio), this.fsFileSnapshots = fsFileSnapshots, this.keepParsedFilesOnRecycle = keepParsedFilesOnRecycle;
|
|
5243
5256
|
}
|
|
5244
5257
|
/**
|
|
5245
5258
|
* Batch-extract component props across all entries, grouping by tsconfig project so each project
|
|
@@ -5258,7 +5271,7 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
|
5258
5271
|
logger3.debug(`[reactComponentMeta] Batch extraction failed: ${err}`);
|
|
5259
5272
|
}
|
|
5260
5273
|
}
|
|
5261
|
-
this.recycleProjectsIfHeapPressured() && batchFiles?.clear();
|
|
5274
|
+
this.recycleProjectsIfHeapPressured(this.keepParsedFilesOnRecycle ? byProject.keys() : []) && batchFiles?.clear();
|
|
5262
5275
|
}
|
|
5263
5276
|
addBatchFiles(project, batchFiles) {
|
|
5264
5277
|
let files = batchFiles?.get(project) ?? [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRequire as
|
|
1
|
+
import { createRequire as CJS_COMPAT_CREATE_REQUIRE_4ivfdpbtpvp } from "node:module";var require = CJS_COMPAT_CREATE_REQUIRE_4ivfdpbtpvp(import.meta.url);
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSharedComponentMetaManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VEMSK7QJ.js";
|
|
4
4
|
import {
|
|
5
5
|
extractArgTypesFromComponentMeta
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-XPEWS4XG.js";
|
|
7
|
+
import "./chunk-E7AXB5JU.js";
|
|
8
8
|
import "./chunk-MYBSMCSW.js";
|
|
9
9
|
import "./chunk-CJ2XYAXX.js";
|
|
10
10
|
import "./chunk-SC3QXTHH.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildDocgenPayloads
|
|
3
|
-
} from "../_node-chunks/chunk-
|
|
3
|
+
} from "../_node-chunks/chunk-XPEWS4XG.js";
|
|
4
4
|
import {
|
|
5
5
|
ComponentMetaManager,
|
|
6
6
|
loadDocgenTypeScript
|
|
7
|
-
} from "../_node-chunks/chunk-
|
|
7
|
+
} from "../_node-chunks/chunk-E7AXB5JU.js";
|
|
8
8
|
import "../_node-chunks/chunk-MYBSMCSW.js";
|
|
9
9
|
import "../_node-chunks/chunk-CJ2XYAXX.js";
|
|
10
10
|
import "../_node-chunks/chunk-SC3QXTHH.js";
|
|
@@ -21,7 +21,11 @@ var createDocgenProvider = ({
|
|
|
21
21
|
} = {}) => createLazyDocgenMiddleware({
|
|
22
22
|
createManager: async () => {
|
|
23
23
|
try {
|
|
24
|
-
return new ComponentMetaManager(
|
|
24
|
+
return new ComponentMetaManager(
|
|
25
|
+
await loadDocgenTypeScript(typeScriptSpecifier),
|
|
26
|
+
void 0,
|
|
27
|
+
{ keepParsedFilesOnRecycle: !0 }
|
|
28
|
+
);
|
|
25
29
|
} catch (err) {
|
|
26
30
|
logger.warn(`React docgen is unavailable. ${err instanceof Error ? err.message : err}`);
|
|
27
31
|
return;
|
|
@@ -2,7 +2,8 @@ import {
|
|
|
2
2
|
applyDecorators,
|
|
3
3
|
decorators,
|
|
4
4
|
parameters
|
|
5
|
-
} from "./_browser-chunks/chunk-
|
|
5
|
+
} from "./_browser-chunks/chunk-GBFPEOJZ.js";
|
|
6
|
+
import "./_browser-chunks/chunk-KI7YBTX7.js";
|
|
6
7
|
import "./_browser-chunks/chunk-DDIRQRCA.js";
|
|
7
8
|
import "./_browser-chunks/chunk-B3FR4PBN.js";
|
|
8
9
|
import "./_browser-chunks/chunk-UAWMPV5J.js";
|
package/dist/entry-preview.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__definePreview
|
|
3
|
-
} from "./_browser-chunks/chunk-
|
|
3
|
+
} from "./_browser-chunks/chunk-LI5LRSL3.js";
|
|
4
4
|
import {
|
|
5
5
|
entry_preview_exports,
|
|
6
6
|
renderToCanvas
|
|
7
|
-
} from "./_browser-chunks/chunk-
|
|
7
|
+
} from "./_browser-chunks/chunk-MB4PPIXP.js";
|
|
8
8
|
import {
|
|
9
9
|
entry_preview_argtypes_exports
|
|
10
10
|
} from "./_browser-chunks/chunk-WWHCZJWM.js";
|
|
11
|
-
import "./_browser-chunks/chunk-
|
|
11
|
+
import "./_browser-chunks/chunk-GBFPEOJZ.js";
|
|
12
|
+
import "./_browser-chunks/chunk-KI7YBTX7.js";
|
|
12
13
|
import "./_browser-chunks/chunk-DDIRQRCA.js";
|
|
13
14
|
import "./_browser-chunks/chunk-B3FR4PBN.js";
|
|
14
15
|
import "./_browser-chunks/chunk-UAWMPV5J.js";
|
|
15
16
|
|
|
16
17
|
// src/globals.ts
|
|
17
|
-
|
|
18
|
-
var { window: globalWindow } = global;
|
|
19
|
-
globalWindow && (globalWindow.STORYBOOK_ENV = "react");
|
|
18
|
+
globalThis.STORYBOOK_ENV = "react";
|
|
20
19
|
|
|
21
20
|
// src/portable-stories.tsx
|
|
22
21
|
import * as React from "react";
|
package/dist/preset.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./_node-chunks/chunk-HRHJMJC7.js";
|
|
4
4
|
import {
|
|
5
5
|
getSharedComponentMetaManager
|
|
6
|
-
} from "./_node-chunks/chunk-
|
|
6
|
+
} from "./_node-chunks/chunk-VEMSK7QJ.js";
|
|
7
7
|
import {
|
|
8
8
|
buildReactComponentDocgenFromResolved,
|
|
9
9
|
buildStoryDocsFromResolved,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
join,
|
|
14
14
|
posix,
|
|
15
15
|
resolveStoryFileComponents
|
|
16
|
-
} from "./_node-chunks/chunk-
|
|
16
|
+
} from "./_node-chunks/chunk-E7AXB5JU.js";
|
|
17
17
|
import {
|
|
18
18
|
REACT_DOCGEN_TYPESCRIPT_APIS
|
|
19
19
|
} from "./_node-chunks/chunk-MYBSMCSW.js";
|
|
@@ -24,7 +24,7 @@ import "./_node-chunks/chunk-PQZIOGBY.js";
|
|
|
24
24
|
|
|
25
25
|
// src/preset.ts
|
|
26
26
|
import path2, { join as join3 } from "node:path";
|
|
27
|
-
import { fileURLToPath as
|
|
27
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
28
28
|
import {
|
|
29
29
|
getProjectRoot,
|
|
30
30
|
getTypeScriptSpecifierForDocgen as getTypeScriptSpecifierForDocgen3,
|
|
@@ -280,6 +280,7 @@ var experimental_docgenProvider = async (existing = [], options) => {
|
|
|
280
280
|
};
|
|
281
281
|
|
|
282
282
|
// src/docgen/story-docs-preset.ts
|
|
283
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
283
284
|
import { STORY_FILE_TEST_REGEXP, getStoryImportPathFromEntry as getStoryImportPathFromEntry3 } from "storybook/internal/common";
|
|
284
285
|
|
|
285
286
|
// src/docgen/build-story-docs.ts
|
|
@@ -318,14 +319,18 @@ var experimental_storyDocsProvider = async (nextStoryDocs, options) => {
|
|
|
318
319
|
"typescript",
|
|
319
320
|
{}
|
|
320
321
|
) ?? Promise.resolve({});
|
|
321
|
-
return
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
322
|
+
return {
|
|
323
|
+
...nextStoryDocs,
|
|
324
|
+
extract: async (input) => {
|
|
325
|
+
let storyImportPath = getStoryImportPathFromEntry3(input.entry);
|
|
326
|
+
if (!storyImportPath || !STORY_FILE_TEST_REGEXP.test(storyImportPath))
|
|
327
|
+
return nextStoryDocs.extract(input);
|
|
328
|
+
let ours = await buildStoryDocsPayload(input, {
|
|
329
|
+
typescriptOptions: await typescriptOptionsPromise
|
|
330
|
+
});
|
|
331
|
+
return ours ? { ...await nextStoryDocs.extract(input), ...ours } : nextStoryDocs.extract(input);
|
|
332
|
+
},
|
|
333
|
+
printHole: fileURLToPath3(import.meta.resolve("@storybook/react/internal/register-print-hole"))
|
|
329
334
|
};
|
|
330
335
|
};
|
|
331
336
|
|
|
@@ -345,12 +350,12 @@ var isDocgenProviderEnabled = async (_existing, options) => {
|
|
|
345
350
|
options.presets.apply("features", {}, options)
|
|
346
351
|
]), docsEnabled = Object.keys(docsConfig).length > 0, experimentalRSC = features2?.experimentalRSC;
|
|
347
352
|
return [].concat(input).concat([
|
|
348
|
-
|
|
349
|
-
|
|
353
|
+
fileURLToPath4(import.meta.resolve("@storybook/react/entry-preview")),
|
|
354
|
+
fileURLToPath4(import.meta.resolve("@storybook/react/entry-preview-argtypes"))
|
|
350
355
|
]).concat(
|
|
351
|
-
docsEnabled ? [
|
|
356
|
+
docsEnabled ? [fileURLToPath4(import.meta.resolve("@storybook/react/entry-preview-docs"))] : []
|
|
352
357
|
).concat(
|
|
353
|
-
experimentalRSC ? [
|
|
358
|
+
experimentalRSC ? [fileURLToPath4(import.meta.resolve("@storybook/react/entry-preview-rsc"))] : []
|
|
354
359
|
);
|
|
355
360
|
}, resolvedReact = async (existing) => {
|
|
356
361
|
try {
|
|
@@ -379,7 +384,7 @@ async function internal_getArgTypesData(_input, options) {
|
|
|
379
384
|
return null;
|
|
380
385
|
let absoluteComponentFilePath = path2.isAbsolute(componentFilePath) ? componentFilePath : join3(getProjectRoot(), componentFilePath);
|
|
381
386
|
if ((await presets?.apply("features", {}))?.docgenServer) {
|
|
382
|
-
let { extractArgTypesFromComponentFile } = await import("./_node-chunks/extractArgTypesFromComponentFile-
|
|
387
|
+
let { extractArgTypesFromComponentFile } = await import("./_node-chunks/extractArgTypesFromComponentFile-JKOCA6RX.js");
|
|
383
388
|
return extractArgTypesFromComponentFile({
|
|
384
389
|
componentFilePath: absoluteComponentFilePath,
|
|
385
390
|
componentExportName,
|
package/dist/preview.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__definePreview
|
|
3
|
-
} from "./_browser-chunks/chunk-
|
|
4
|
-
import "./_browser-chunks/chunk-
|
|
3
|
+
} from "./_browser-chunks/chunk-LI5LRSL3.js";
|
|
4
|
+
import "./_browser-chunks/chunk-MB4PPIXP.js";
|
|
5
5
|
import "./_browser-chunks/chunk-WWHCZJWM.js";
|
|
6
|
-
import "./_browser-chunks/chunk-
|
|
6
|
+
import "./_browser-chunks/chunk-GBFPEOJZ.js";
|
|
7
|
+
import "./_browser-chunks/chunk-KI7YBTX7.js";
|
|
7
8
|
import "./_browser-chunks/chunk-DDIRQRCA.js";
|
|
8
9
|
import "./_browser-chunks/chunk-B3FR4PBN.js";
|
|
9
10
|
import "./_browser-chunks/chunk-UAWMPV5J.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react",
|
|
3
|
-
"version": "11.0.0-rc.
|
|
3
|
+
"version": "11.0.0-rc.2",
|
|
4
4
|
"description": "Storybook React renderer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"default": "./dist/builder-docgen.js"
|
|
37
37
|
},
|
|
38
38
|
"./internal/docgen-worker": "./dist/docgen/docgen-worker.js",
|
|
39
|
+
"./internal/register-print-hole": "./dist/docs/register-print-hole.js",
|
|
39
40
|
"./package.json": "./package.json",
|
|
40
41
|
"./preset": "./dist/preset.js",
|
|
41
42
|
"./preview": {
|
|
@@ -52,11 +53,8 @@
|
|
|
52
53
|
"*.d.ts",
|
|
53
54
|
"!src/**/*"
|
|
54
55
|
],
|
|
55
|
-
"dependencies": {
|
|
56
|
-
"@storybook/global": "^5.0.0"
|
|
57
|
-
},
|
|
58
56
|
"devDependencies": {
|
|
59
|
-
"@storybook/component-meta-typescript": "11.0.0-rc.
|
|
57
|
+
"@storybook/component-meta-typescript": "11.0.0-rc.2",
|
|
60
58
|
"@types/babel-plugin-react-docgen": "^4.2.3",
|
|
61
59
|
"@types/escodegen": "^0.0.6",
|
|
62
60
|
"@types/estree": "^1.0.6",
|
|
@@ -90,7 +88,7 @@
|
|
|
90
88
|
"react-docgen": "^8.0.2",
|
|
91
89
|
"react-docgen-typescript": "^2.2.2",
|
|
92
90
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
93
|
-
"storybook": "^11.0.0-rc.
|
|
91
|
+
"storybook": "^11.0.0-rc.2",
|
|
94
92
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
|
|
95
93
|
},
|
|
96
94
|
"peerDependenciesMeta": {
|