storybook 10.2.0-alpha.13 → 10.2.0-alpha.15
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-3PJE6VLG.js → chunk-ASKQZAOS.js} +1 -12
- package/dist/_browser-chunks/{chunk-BGSDJMFM.js → chunk-NVLTWT3B.js} +18 -6
- package/dist/_node-chunks/{builder-manager-YTW4R3NB.js → builder-manager-SOKYB5NF.js} +12 -12
- package/dist/_node-chunks/{camelcase-ALOK3DTL.js → camelcase-SXQWF7PW.js} +7 -7
- package/dist/_node-chunks/{chunk-QV7LTTOW.js → chunk-274OMYGE.js} +20 -20
- package/dist/_node-chunks/{chunk-B3NH4IRY.js → chunk-2BHD5YKF.js} +6 -6
- package/dist/_node-chunks/{chunk-FCBELYHM.js → chunk-2FQAOAQ6.js} +12 -12
- package/dist/_node-chunks/{chunk-NGFKU3PK.js → chunk-45UIB4YF.js} +7 -7
- package/dist/_node-chunks/{chunk-TWCN75ID.js → chunk-4GKVZO2T.js} +9 -9
- package/dist/_node-chunks/{chunk-KXFFKIVX.js → chunk-5KEIALUH.js} +6 -6
- package/dist/_node-chunks/{chunk-AOMUVL33.js → chunk-6SIUW3HU.js} +12 -12
- package/dist/_node-chunks/{chunk-L4JVY7CQ.js → chunk-AIIQJ6UR.js} +7 -7
- package/dist/_node-chunks/{chunk-5CARBEGS.js → chunk-BOY3TNPC.js} +9 -9
- package/dist/_node-chunks/{chunk-TOLCEUYZ.js → chunk-BRW7NFUP.js} +7 -7
- package/dist/_node-chunks/{chunk-ZSUT22UW.js → chunk-E3Y5MHXD.js} +7 -7
- package/dist/_node-chunks/{chunk-QMDFRT4S.js → chunk-ENNDE4GC.js} +10 -10
- package/dist/_node-chunks/{chunk-NL75DTGM.js → chunk-FKBWQGIF.js} +6 -6
- package/dist/_node-chunks/{chunk-NRCGIPSW.js → chunk-HFKM7JHQ.js} +6 -6
- package/dist/_node-chunks/{chunk-OOTLIMKW.js → chunk-K4YVLJRS.js} +6 -6
- package/dist/_node-chunks/{chunk-WKDY7YZY.js → chunk-KNGN3UEO.js} +7 -7
- package/dist/_node-chunks/{chunk-AE6TGTGX.js → chunk-MD52RVZX.js} +7 -7
- package/dist/_node-chunks/chunk-MM7Z4SG7.js +23 -0
- package/dist/_node-chunks/{chunk-XX6B7MPS.js → chunk-MQZLLJRG.js} +8 -8
- package/dist/_node-chunks/{chunk-OWZXELHP.js → chunk-PI7P5HFH.js} +13 -13
- package/dist/_node-chunks/{chunk-VOVBTC53.js → chunk-Q6WUEJ4S.js} +6 -6
- package/dist/_node-chunks/{chunk-2VHYFREG.js → chunk-QPKBPYOY.js} +7 -7
- package/dist/_node-chunks/chunk-RGWB6DD7.js +20 -0
- package/dist/_node-chunks/{chunk-BIJENBOW.js → chunk-SZWIX5YC.js} +9 -9
- package/dist/_node-chunks/{chunk-X2PNK4N4.js → chunk-T57UCO67.js} +7 -7
- package/dist/_node-chunks/{chunk-5E6TIJW7.js → chunk-TN3Q52LO.js} +6 -6
- package/dist/_node-chunks/chunk-TYSSQECX.js +61 -0
- package/dist/_node-chunks/chunk-YP34ARUD.js +18 -0
- package/dist/_node-chunks/{globby-RG2TFVNI.js → globby-LGQ5P2JB.js} +9 -9
- package/dist/_node-chunks/{lib-E2AGGQV3.js → lib-5LBLULG3.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-SGUMZ4YL.js → mdx-N42X6CFJ-TAPL5IEO.js} +8 -8
- package/dist/_node-chunks/{p-limit-J4UZO65T.js → p-limit-GTMOHYQF.js} +7 -7
- package/dist/babel/index.js +10 -10
- package/dist/bin/core.js +12 -12
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +9 -9
- package/dist/cli/index.d.ts +176 -176
- package/dist/cli/index.js +18 -18
- package/dist/common/index.js +19 -19
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +167 -166
- package/dist/core-events/index.d.ts +4 -4
- package/dist/core-server/index.d.ts +11 -1
- package/dist/core-server/index.js +217 -76
- package/dist/core-server/presets/common-manager.js +176 -134
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +27 -26
- package/dist/csf/index.d.ts +8 -6
- package/dist/csf/index.js +1 -1
- package/dist/csf-tools/index.js +10 -10
- package/dist/docs-tools/index.d.ts +2 -2
- package/dist/manager/globals-runtime.js +97 -94
- package/dist/manager/runtime.js +1755 -985
- package/dist/manager-api/index.d.ts +1 -1
- package/dist/manager-api/index.js +10 -8
- package/dist/mocking-utils/index.js +8 -8
- package/dist/node-logger/index.js +9 -9
- package/dist/preview/runtime.js +18 -6
- package/dist/preview-api/index.js +1 -1
- package/dist/server-errors.js +11 -11
- package/dist/telemetry/index.js +22 -22
- package/dist/types/index.d.ts +12 -6
- package/dist/viewport/index.d.ts +5 -3
- package/dist/viewport/index.js +12 -3
- package/package.json +2 -2
- package/dist/_node-chunks/chunk-5U7IR6W2.js +0 -61
- package/dist/_node-chunks/chunk-JUCUYWH2.js +0 -23
- package/dist/_node-chunks/chunk-KTAHXSER.js +0 -18
- package/dist/_node-chunks/chunk-XQU357NR.js +0 -20
- package/dist/_node-chunks/dist-I4XBT6AL.js +0 -121
|
@@ -135,8 +135,8 @@ interface InputType {
|
|
|
135
135
|
category?: string;
|
|
136
136
|
/** @see https://storybook.js.org/docs/api/arg-types#tabledefaultvalue */
|
|
137
137
|
defaultValue?: {
|
|
138
|
-
summary?: string;
|
|
139
|
-
detail?: string;
|
|
138
|
+
summary?: string | undefined;
|
|
139
|
+
detail?: string | undefined;
|
|
140
140
|
};
|
|
141
141
|
/** @see https://storybook.js.org/docs/api/arg-types#tabledisable */
|
|
142
142
|
disable?: boolean;
|
|
@@ -144,8 +144,8 @@ interface InputType {
|
|
|
144
144
|
subcategory?: string;
|
|
145
145
|
/** @see https://storybook.js.org/docs/api/arg-types#tabletype */
|
|
146
146
|
type?: {
|
|
147
|
-
summary?: string;
|
|
148
|
-
detail?: string;
|
|
147
|
+
summary?: string | undefined;
|
|
148
|
+
detail?: string | undefined;
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
151
|
/** @see https://storybook.js.org/docs/api/arg-types#type */
|
|
@@ -272,6 +272,16 @@ declare function loadStorybook(options: CLIOptions & LoadOptions & BuilderOption
|
|
|
272
272
|
previewConfigPath?: string;
|
|
273
273
|
}): Promise<Options>;
|
|
274
274
|
|
|
275
|
+
declare const analyze: (code: string) => Promise<{
|
|
276
|
+
title: any;
|
|
277
|
+
of: any;
|
|
278
|
+
name: any;
|
|
279
|
+
summary: any;
|
|
280
|
+
isTemplate: any;
|
|
281
|
+
metaTags: any;
|
|
282
|
+
imports: any;
|
|
283
|
+
}>;
|
|
284
|
+
|
|
275
285
|
type EnvironmentType = (typeof UniversalStore.Environment)[keyof typeof UniversalStore.Environment];
|
|
276
286
|
type StatusType = (typeof UniversalStore.Status)[keyof typeof UniversalStore.Status];
|
|
277
287
|
type StateUpdater<TState> = (prevState: TState) => TState;
|
|
@@ -1334,4 +1344,4 @@ declare const fullTestProviderStore: {
|
|
|
1334
1344
|
declare const getTestProviderStoreById: (testProviderId: TestProviderId) => TestProviderStoreById;
|
|
1335
1345
|
declare const universalTestProviderStore: UniversalStore<TestProviderStateByProviderId, TestProviderStoreEvent>;
|
|
1336
1346
|
|
|
1337
|
-
export { type BuildIndexOptions, type BuildStaticStandaloneOptions, StoryIndexGenerator, Tag, build, buildDevStandalone, buildIndex, buildIndexStandalone, buildStaticStandalone, MockUniversalStore as experimental_MockUniversalStore, UniversalStore as experimental_UniversalStore, getStatusStoreByTypeId as experimental_getStatusStore, getTestProviderStoreById as experimental_getTestProviderStore, loadStorybook as experimental_loadStorybook, getErrorLevel, fullStatusStore as internal_fullStatusStore, fullTestProviderStore as internal_fullTestProviderStore, universalStatusStore as internal_universalStatusStore, universalTestProviderStore as internal_universalTestProviderStore, isTelemetryEnabled, mapStaticDir, sendTelemetryError, withTelemetry };
|
|
1347
|
+
export { type BuildIndexOptions, type BuildStaticStandaloneOptions, StoryIndexGenerator, Tag, analyze as analyzeMdx, build, buildDevStandalone, buildIndex, buildIndexStandalone, buildStaticStandalone, MockUniversalStore as experimental_MockUniversalStore, UniversalStore as experimental_UniversalStore, getStatusStoreByTypeId as experimental_getStatusStore, getTestProviderStoreById as experimental_getTestProviderStore, loadStorybook as experimental_loadStorybook, getErrorLevel, fullStatusStore as internal_fullStatusStore, fullTestProviderStore as internal_fullTestProviderStore, universalStatusStore as internal_universalStatusStore, universalTestProviderStore as internal_universalTestProviderStore, isTelemetryEnabled, mapStaticDir, sendTelemetryError, withTelemetry };
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ekkdwuux1sk from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ekkdwuux1sk from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ekkdwuux1sk from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ekkdwuux1sk.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ekkdwuux1sk.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ekkdwuux1sk.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
toEstree
|
|
14
|
+
} from "../_node-chunks/chunk-KNGN3UEO.js";
|
|
12
15
|
import {
|
|
13
16
|
StatusTypeIdMismatchError
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-ENNDE4GC.js";
|
|
15
18
|
import {
|
|
16
19
|
debounce,
|
|
17
20
|
getErrorLevel,
|
|
@@ -21,68 +24,68 @@ import {
|
|
|
21
24
|
sendTelemetryError,
|
|
22
25
|
useStatics,
|
|
23
26
|
withTelemetry
|
|
24
|
-
} from "../_node-chunks/chunk-
|
|
27
|
+
} from "../_node-chunks/chunk-PI7P5HFH.js";
|
|
25
28
|
import {
|
|
26
29
|
detectPnp
|
|
27
|
-
} from "../_node-chunks/chunk-
|
|
28
|
-
import "../_node-chunks/chunk-
|
|
30
|
+
} from "../_node-chunks/chunk-MM7Z4SG7.js";
|
|
31
|
+
import "../_node-chunks/chunk-BRW7NFUP.js";
|
|
29
32
|
import {
|
|
30
33
|
StorybookError
|
|
31
|
-
} from "../_node-chunks/chunk-
|
|
34
|
+
} from "../_node-chunks/chunk-TN3Q52LO.js";
|
|
32
35
|
import {
|
|
33
36
|
telemetry
|
|
34
|
-
} from "../_node-chunks/chunk-
|
|
35
|
-
import "../_node-chunks/chunk-
|
|
37
|
+
} from "../_node-chunks/chunk-6SIUW3HU.js";
|
|
38
|
+
import "../_node-chunks/chunk-YP34ARUD.js";
|
|
36
39
|
import {
|
|
37
40
|
optionalEnvToBoolean,
|
|
38
41
|
require_cross_spawn,
|
|
39
42
|
resolveImport,
|
|
40
43
|
supportedExtensions,
|
|
41
44
|
userOrAutoTitleFromSpecifier
|
|
42
|
-
} from "../_node-chunks/chunk-
|
|
43
|
-
import "../_node-chunks/chunk-
|
|
44
|
-
import "../_node-chunks/chunk-
|
|
45
|
+
} from "../_node-chunks/chunk-274OMYGE.js";
|
|
46
|
+
import "../_node-chunks/chunk-TYSSQECX.js";
|
|
47
|
+
import "../_node-chunks/chunk-AIIQJ6UR.js";
|
|
45
48
|
import {
|
|
46
49
|
require_pretty_hrtime
|
|
47
|
-
} from "../_node-chunks/chunk-
|
|
48
|
-
import "../_node-chunks/chunk-
|
|
50
|
+
} from "../_node-chunks/chunk-MQZLLJRG.js";
|
|
51
|
+
import "../_node-chunks/chunk-4GKVZO2T.js";
|
|
49
52
|
import {
|
|
50
53
|
invariant,
|
|
51
54
|
up2 as up
|
|
52
|
-
} from "../_node-chunks/chunk-
|
|
53
|
-
import "../_node-chunks/chunk-
|
|
55
|
+
} from "../_node-chunks/chunk-Q6WUEJ4S.js";
|
|
56
|
+
import "../_node-chunks/chunk-HFKM7JHQ.js";
|
|
54
57
|
import {
|
|
55
58
|
importModule,
|
|
56
59
|
resolvePackageDir
|
|
57
|
-
} from "../_node-chunks/chunk-
|
|
60
|
+
} from "../_node-chunks/chunk-E3Y5MHXD.js";
|
|
58
61
|
import {
|
|
59
62
|
dirname,
|
|
60
63
|
join,
|
|
61
64
|
relative,
|
|
62
65
|
resolve
|
|
63
|
-
} from "../_node-chunks/chunk-
|
|
64
|
-
import "../_node-chunks/chunk-
|
|
66
|
+
} from "../_node-chunks/chunk-FKBWQGIF.js";
|
|
67
|
+
import "../_node-chunks/chunk-MD52RVZX.js";
|
|
65
68
|
import {
|
|
66
69
|
slash
|
|
67
|
-
} from "../_node-chunks/chunk-
|
|
70
|
+
} from "../_node-chunks/chunk-RGWB6DD7.js";
|
|
68
71
|
import {
|
|
69
72
|
Tag
|
|
70
|
-
} from "../_node-chunks/chunk-
|
|
73
|
+
} from "../_node-chunks/chunk-2BHD5YKF.js";
|
|
71
74
|
import {
|
|
72
75
|
require_dist
|
|
73
|
-
} from "../_node-chunks/chunk-
|
|
76
|
+
} from "../_node-chunks/chunk-QPKBPYOY.js";
|
|
74
77
|
import {
|
|
75
78
|
require_lib,
|
|
76
79
|
require_src
|
|
77
|
-
} from "../_node-chunks/chunk-
|
|
80
|
+
} from "../_node-chunks/chunk-45UIB4YF.js";
|
|
78
81
|
import {
|
|
79
82
|
require_picocolors
|
|
80
|
-
} from "../_node-chunks/chunk-
|
|
83
|
+
} from "../_node-chunks/chunk-T57UCO67.js";
|
|
81
84
|
import {
|
|
82
85
|
__commonJS,
|
|
83
86
|
__require,
|
|
84
87
|
__toESM
|
|
85
|
-
} from "../_node-chunks/chunk-
|
|
88
|
+
} from "../_node-chunks/chunk-5KEIALUH.js";
|
|
86
89
|
|
|
87
90
|
// ../../node_modules/glob-to-regexp/index.js
|
|
88
91
|
var require_glob_to_regexp = __commonJS({
|
|
@@ -4539,7 +4542,7 @@ function print(p) {
|
|
|
4539
4542
|
// src/core-server/utils/get-builders.ts
|
|
4540
4543
|
import { MissingBuilderError } from "storybook/internal/server-errors";
|
|
4541
4544
|
async function getManagerBuilder() {
|
|
4542
|
-
return await import("../_node-chunks/builder-manager-
|
|
4545
|
+
return await import("../_node-chunks/builder-manager-SOKYB5NF.js");
|
|
4543
4546
|
}
|
|
4544
4547
|
async function getPreviewBuilder(resolvedPreviewBuilder) {
|
|
4545
4548
|
return await importModule(resolvedPreviewBuilder);
|
|
@@ -4603,7 +4606,7 @@ function watchStorySpecifiers(specifiers, options, onInvalidate) {
|
|
|
4603
4606
|
// files can be e.g. '**/foo/*/*.js' so we just want the last bit,
|
|
4604
4607
|
// because the directory could already be within the files part (e.g. './x/foo/bar')
|
|
4605
4608
|
basename(specifier.files)
|
|
4606
|
-
), { globby } = await import("../_node-chunks/globby-
|
|
4609
|
+
), { globby } = await import("../_node-chunks/globby-LGQ5P2JB.js");
|
|
4607
4610
|
(await globby(slash(dirGlob), commonGlobOptions(dirGlob))).forEach((filePath) => {
|
|
4608
4611
|
let fileImportPath = toImportPath(filePath);
|
|
4609
4612
|
specifier.importPathMatcher.exec(fileImportPath) && onInvalidate(fileImportPath, removed);
|
|
@@ -5522,6 +5525,115 @@ import { combineTags, storyNameFromExport, toId } from "storybook/internal/csf";
|
|
|
5522
5525
|
import { getStorySortParameter, loadConfig } from "storybook/internal/csf-tools";
|
|
5523
5526
|
import { logger as logger4, once } from "storybook/internal/node-logger";
|
|
5524
5527
|
import { isExampleStoryId } from "storybook/internal/telemetry";
|
|
5528
|
+
|
|
5529
|
+
// ../../node_modules/@storybook/docs-mdx/dist/index.js
|
|
5530
|
+
var getAttr = (elt, what) => elt.attributes.find((n) => n.type === "JSXAttribute" && n.name.name === what), getAttrValue = (elt, what) => getAttr(elt, what)?.value, getAttrLiteral = (elt, what) => {
|
|
5531
|
+
let attrValue = getAttrValue(elt, what);
|
|
5532
|
+
if (attrValue) {
|
|
5533
|
+
if (attrValue.type === "Literal")
|
|
5534
|
+
return attrValue.value;
|
|
5535
|
+
throw new Error(`Expected string literal ${what}, received ${attrValue.type}`);
|
|
5536
|
+
}
|
|
5537
|
+
}, getOf = (elt, varToImport) => {
|
|
5538
|
+
let ofAttrValue = getAttrValue(elt, "of");
|
|
5539
|
+
if (ofAttrValue)
|
|
5540
|
+
if (ofAttrValue.type === "JSXExpressionContainer") {
|
|
5541
|
+
let of = ofAttrValue.expression;
|
|
5542
|
+
if (of?.type === "Identifier") {
|
|
5543
|
+
let importName = varToImport[of.name];
|
|
5544
|
+
if (importName)
|
|
5545
|
+
return importName;
|
|
5546
|
+
throw new Error(`Unknown identifier ${of.name}`);
|
|
5547
|
+
} else
|
|
5548
|
+
throw new Error(`Expected identifier, received ${of.type}`);
|
|
5549
|
+
} else
|
|
5550
|
+
throw new Error(`Expected JSX expression, received ${ofAttrValue.type}`);
|
|
5551
|
+
}, getTags = (elt) => {
|
|
5552
|
+
let tagsAttr = getAttr(elt, "tags");
|
|
5553
|
+
if (!tagsAttr)
|
|
5554
|
+
return;
|
|
5555
|
+
let tagsContainer = tagsAttr.value;
|
|
5556
|
+
if (tagsContainer.type === "JSXExpressionContainer") {
|
|
5557
|
+
let tagsArray = tagsContainer.expression;
|
|
5558
|
+
if (tagsArray.type === "ArrayExpression")
|
|
5559
|
+
return tagsArray.elements.map((tag) => {
|
|
5560
|
+
if (tag.type === "Literal" && typeof tag.value == "string")
|
|
5561
|
+
return tag.value;
|
|
5562
|
+
throw new Error(`Expected string literal tag, received ${tag.type}`);
|
|
5563
|
+
});
|
|
5564
|
+
throw new Error(`Expected tags array, received ${tagsArray.type}`);
|
|
5565
|
+
} else
|
|
5566
|
+
throw new Error(`Expected JSX expression tags, received ${tagsContainer.type}`);
|
|
5567
|
+
}, getIsTemplate = (elt) => {
|
|
5568
|
+
let isTemplateAttr = getAttr(elt, "isTemplate");
|
|
5569
|
+
if (!isTemplateAttr)
|
|
5570
|
+
return !1;
|
|
5571
|
+
let isTemplate = isTemplateAttr.value;
|
|
5572
|
+
if (isTemplate == null)
|
|
5573
|
+
return !0;
|
|
5574
|
+
if (isTemplate.type === "JSXExpressionContainer") {
|
|
5575
|
+
let expression = isTemplate.expression;
|
|
5576
|
+
if (expression.type === "Literal" && typeof expression.value == "boolean")
|
|
5577
|
+
return expression.value;
|
|
5578
|
+
throw new Error(`Expected boolean isTemplate, received ${typeof expression.value}`);
|
|
5579
|
+
} else
|
|
5580
|
+
throw new Error(`Expected expression isTemplate, received ${isTemplate.type}`);
|
|
5581
|
+
}, extractTitle = (root, varToImport) => {
|
|
5582
|
+
let result = {
|
|
5583
|
+
title: void 0,
|
|
5584
|
+
of: void 0,
|
|
5585
|
+
name: void 0,
|
|
5586
|
+
summary: void 0,
|
|
5587
|
+
isTemplate: !1
|
|
5588
|
+
}, fragments = root.body.filter(
|
|
5589
|
+
(child) => child.type === "ExpressionStatement" && child.expression.type === "JSXFragment"
|
|
5590
|
+
);
|
|
5591
|
+
if (fragments.length > 1)
|
|
5592
|
+
throw new Error("duplicate contents");
|
|
5593
|
+
return fragments.length === 0 || fragments[0].expression.children.forEach((child) => {
|
|
5594
|
+
if (child.type === "JSXElement") {
|
|
5595
|
+
let { openingElement } = child;
|
|
5596
|
+
if (openingElement.name.name === "Meta") {
|
|
5597
|
+
if (result.title || result.name || result.of)
|
|
5598
|
+
throw new Error("Meta can only be declared once");
|
|
5599
|
+
result.title = getAttrLiteral(openingElement, "title"), result.name = getAttrLiteral(openingElement, "name"), result.summary = getAttrLiteral(openingElement, "summary"), result.of = getOf(openingElement, varToImport), result.isTemplate = getIsTemplate(openingElement), result.metaTags = getTags(openingElement);
|
|
5600
|
+
}
|
|
5601
|
+
} else if (child.type !== "JSXExpressionContainer")
|
|
5602
|
+
throw new Error(`Unexpected JSX child: ${child.type}`);
|
|
5603
|
+
}), result;
|
|
5604
|
+
}, extractImports = (root) => {
|
|
5605
|
+
let varToImport = {};
|
|
5606
|
+
return root.body.forEach((child) => {
|
|
5607
|
+
if (child.type === "ImportDeclaration") {
|
|
5608
|
+
let { source, specifiers } = child;
|
|
5609
|
+
if (source.type === "Literal")
|
|
5610
|
+
specifiers.forEach((s) => {
|
|
5611
|
+
varToImport[s.local.name] = source.value.toString();
|
|
5612
|
+
});
|
|
5613
|
+
else
|
|
5614
|
+
throw new Error("MDX: unexpected import source");
|
|
5615
|
+
}
|
|
5616
|
+
}), varToImport;
|
|
5617
|
+
}, plugin = (store) => (root) => {
|
|
5618
|
+
let estree = toEstree(root), varToImport = extractImports(estree), { title, of, name, summary, isTemplate, metaTags } = extractTitle(estree, varToImport);
|
|
5619
|
+
return store.title = title, store.of = of, store.name = name, store.summary = summary, store.isTemplate = isTemplate, store.metaTags = metaTags, store.imports = Array.from(new Set(Object.values(varToImport))), root;
|
|
5620
|
+
}, analyze = async (code) => {
|
|
5621
|
+
let store = {
|
|
5622
|
+
title: void 0,
|
|
5623
|
+
of: void 0,
|
|
5624
|
+
name: void 0,
|
|
5625
|
+
isTemplate: !1,
|
|
5626
|
+
metaTags: void 0,
|
|
5627
|
+
imports: void 0
|
|
5628
|
+
}, { compile } = await import("../_node-chunks/mdx-N42X6CFJ-TAPL5IEO.js");
|
|
5629
|
+
await compile(code, {
|
|
5630
|
+
rehypePlugins: [[plugin, store]]
|
|
5631
|
+
});
|
|
5632
|
+
let { title, of, name, summary, isTemplate, metaTags, imports = [] } = store;
|
|
5633
|
+
return { title, of, name, summary, isTemplate, metaTags, imports };
|
|
5634
|
+
};
|
|
5635
|
+
|
|
5636
|
+
// src/core-server/utils/StoryIndexGenerator.ts
|
|
5525
5637
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
5526
5638
|
var import_ts_dedent2 = __toESM(require_dist(), 1), TsconfigPaths = __toESM(require_lib3(), 1);
|
|
5527
5639
|
|
|
@@ -5658,7 +5770,7 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
5658
5770
|
let cacheKey = this.getFindMatchingFilesCacheKey(specifier, workingDir, ignoreWarnings), cached = this.findMatchingFilesCache.get(cacheKey);
|
|
5659
5771
|
if (cached)
|
|
5660
5772
|
return cached;
|
|
5661
|
-
let pathToSubIndex = {}, globCwd = slash(resolve3(workingDir, specifier.directory)), globPattern = specifier.files.startsWith("!") ? `./${specifier.files}` : specifier.files, { globby } = await import("../_node-chunks/globby-
|
|
5773
|
+
let pathToSubIndex = {}, globCwd = slash(resolve3(workingDir, specifier.directory)), globPattern = specifier.files.startsWith("!") ? `./${specifier.files}` : specifier.files, { globby } = await import("../_node-chunks/globby-LGQ5P2JB.js"), files = await globby(globPattern, {
|
|
5662
5774
|
absolute: !0,
|
|
5663
5775
|
cwd: globCwd,
|
|
5664
5776
|
...commonGlobOptions2(globPattern)
|
|
@@ -5845,7 +5957,7 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
5845
5957
|
async extractDocs(specifier, absolutePath, projectTags = []) {
|
|
5846
5958
|
let relativePath = relative4(this.options.workingDir, absolutePath);
|
|
5847
5959
|
try {
|
|
5848
|
-
let normalizedPath = normalizeStoryPath(relativePath), importPath = slash(normalizedPath), content = await readFile(absolutePath, { encoding: "utf8" }),
|
|
5960
|
+
let normalizedPath = normalizeStoryPath(relativePath), importPath = slash(normalizedPath), content = await readFile(absolutePath, { encoding: "utf8" }), result = await analyze(content);
|
|
5849
5961
|
if (result.isTemplate)
|
|
5850
5962
|
return !1;
|
|
5851
5963
|
let absoluteImports = result.imports.map(
|
|
@@ -6218,7 +6330,7 @@ import {
|
|
|
6218
6330
|
validateFrameworkName,
|
|
6219
6331
|
versions
|
|
6220
6332
|
} from "storybook/internal/common";
|
|
6221
|
-
import { deprecate, logger as
|
|
6333
|
+
import { deprecate, logger as logger14, prompt } from "storybook/internal/node-logger";
|
|
6222
6334
|
import { MissingBuilderError as MissingBuilderError3, NoStatsForViteDevError } from "storybook/internal/server-errors";
|
|
6223
6335
|
import { oneWayHash, telemetry as telemetry4 } from "storybook/internal/telemetry";
|
|
6224
6336
|
import { global as global3 } from "@storybook/global";
|
|
@@ -6226,7 +6338,7 @@ var import_ts_dedent8 = __toESM(require_dist(), 1);
|
|
|
6226
6338
|
|
|
6227
6339
|
// src/core-server/dev-server.ts
|
|
6228
6340
|
import { logConfig as logConfig2, normalizeStories as normalizeStories2 } from "storybook/internal/common";
|
|
6229
|
-
import { logger as
|
|
6341
|
+
import { logger as logger10 } from "storybook/internal/node-logger";
|
|
6230
6342
|
import { MissingBuilderError as MissingBuilderError2 } from "storybook/internal/server-errors";
|
|
6231
6343
|
|
|
6232
6344
|
// ../../node_modules/@polka/compression/build.mjs
|
|
@@ -6883,33 +6995,57 @@ async function getMiddleware(configDir) {
|
|
|
6883
6995
|
|
|
6884
6996
|
// src/core-server/utils/open-browser/open-in-browser.ts
|
|
6885
6997
|
var import_ts_dedent4 = __toESM(require_dist(), 1);
|
|
6886
|
-
import { logger as
|
|
6998
|
+
import { logger as logger7 } from "storybook/internal/node-logger";
|
|
6887
6999
|
import open2 from "open";
|
|
6888
7000
|
|
|
6889
7001
|
// src/core-server/utils/open-browser/opener.ts
|
|
6890
7002
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1), import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
6891
7003
|
import { execSync } from "node:child_process";
|
|
6892
7004
|
import { join as join6 } from "node:path";
|
|
7005
|
+
import { logger as logger6 } from "storybook/internal/node-logger";
|
|
6893
7006
|
import open from "open";
|
|
6894
|
-
var OSX_CHROME = "google chrome"
|
|
6895
|
-
NONE: 0,
|
|
6896
|
-
BROWSER: 1,
|
|
6897
|
-
SCRIPT: 2
|
|
6898
|
-
});
|
|
7007
|
+
var OSX_CHROME = "google chrome";
|
|
6899
7008
|
function getBrowserEnv() {
|
|
6900
|
-
let value = process.env.BROWSER, args = process.env.BROWSER_ARGS ? process.env.BROWSER_ARGS.split(" ") : []
|
|
6901
|
-
return value ? value.toLowerCase().endsWith(".js") ? action
|
|
7009
|
+
let value = process.env.BROWSER, args = process.env.BROWSER_ARGS ? process.env.BROWSER_ARGS.split(" ") : [];
|
|
7010
|
+
return value ? value.toLowerCase() === "none" ? { action: 0 /* NONE */ } : value.toLowerCase().endsWith(".js") || value.toLowerCase().endsWith(".mjs") || value.toLowerCase().endsWith(".cjs") || value.toLowerCase().endsWith(".ts") ? { action: 2 /* SCRIPT */, value, args } : value.toLowerCase().endsWith(".sh") ? { action: 3 /* SHELL_SCRIPT */, value, args } : { action: 1 /* BROWSER */, value, args } : { action: 1 /* BROWSER */, args };
|
|
6902
7011
|
}
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
7012
|
+
var BrowserEnvError = class extends StorybookError {
|
|
7013
|
+
constructor(message) {
|
|
7014
|
+
super({
|
|
7015
|
+
category: "CORE_SERVER",
|
|
7016
|
+
code: 1,
|
|
7017
|
+
message,
|
|
7018
|
+
name: "BrowserEnvError"
|
|
7019
|
+
});
|
|
7020
|
+
}
|
|
7021
|
+
};
|
|
7022
|
+
function attachEventHandlers(child, scriptPath) {
|
|
7023
|
+
child.on("error", (error) => {
|
|
7024
|
+
logger6.error(
|
|
7025
|
+
`Failed to run script specified in BROWSER.
|
|
7026
|
+
${import_picocolors5.default.cyan(scriptPath)}: ${error.message}`
|
|
7027
|
+
);
|
|
7028
|
+
}), child.on("close", (code) => {
|
|
6908
7029
|
if (code !== 0) {
|
|
6909
|
-
|
|
7030
|
+
logger6.error(
|
|
7031
|
+
`The script specified as BROWSER environment variable failed.
|
|
7032
|
+
${import_picocolors5.default.cyan(scriptPath)} exited with code ${code}.`
|
|
7033
|
+
);
|
|
6910
7034
|
return;
|
|
6911
7035
|
}
|
|
6912
|
-
})
|
|
7036
|
+
});
|
|
7037
|
+
}
|
|
7038
|
+
function executeNodeScript(scriptPath, url) {
|
|
7039
|
+
let extraArgs = process.argv.slice(2), child = (0, import_cross_spawn.default)(process.execPath, [scriptPath, ...extraArgs, url], {
|
|
7040
|
+
stdio: "inherit"
|
|
7041
|
+
});
|
|
7042
|
+
return attachEventHandlers(child, scriptPath), !0;
|
|
7043
|
+
}
|
|
7044
|
+
function executeShellScript(scriptPath, url) {
|
|
7045
|
+
let extraArgs = process.argv.slice(2), child = (0, import_cross_spawn.default)("sh", [scriptPath, ...extraArgs, url], {
|
|
7046
|
+
stdio: "inherit"
|
|
7047
|
+
});
|
|
7048
|
+
return attachEventHandlers(child, scriptPath), !0;
|
|
6913
7049
|
}
|
|
6914
7050
|
function startBrowserProcess(browser, url, args) {
|
|
6915
7051
|
if (process.platform === "darwin" && (typeof browser != "string" || browser === OSX_CHROME)) {
|
|
@@ -6950,19 +7086,23 @@ function startBrowserProcess(browser, url, args) {
|
|
|
6950
7086
|
}
|
|
6951
7087
|
}
|
|
6952
7088
|
function openBrowser(url) {
|
|
6953
|
-
let { action, value, args } = getBrowserEnv();
|
|
7089
|
+
let { action, value, args } = getBrowserEnv(), canRunShell = process.platform !== "win32", browserTarget = value;
|
|
6954
7090
|
switch (action) {
|
|
6955
|
-
case
|
|
7091
|
+
case 0 /* NONE */:
|
|
6956
7092
|
return !1;
|
|
6957
|
-
case
|
|
6958
|
-
if (!value)
|
|
6959
|
-
throw new Error("BROWSER environment variable is not set.");
|
|
7093
|
+
case 2 /* SCRIPT */:
|
|
6960
7094
|
return executeNodeScript(value, url);
|
|
7095
|
+
case 3 /* SHELL_SCRIPT */: {
|
|
7096
|
+
if (canRunShell)
|
|
7097
|
+
return executeShellScript(value, url);
|
|
7098
|
+
throw new BrowserEnvError(
|
|
7099
|
+
"Shell scripts are not supported on Windows PowerShell. Use WSL instead."
|
|
7100
|
+
);
|
|
6961
7101
|
}
|
|
6962
|
-
case
|
|
6963
|
-
return startBrowserProcess(
|
|
7102
|
+
case 1 /* BROWSER */:
|
|
7103
|
+
return startBrowserProcess(browserTarget, url, args);
|
|
6964
7104
|
default:
|
|
6965
|
-
throw new
|
|
7105
|
+
throw new BrowserEnvError("Not implemented.");
|
|
6966
7106
|
}
|
|
6967
7107
|
}
|
|
6968
7108
|
|
|
@@ -6979,7 +7119,7 @@ async function openInBrowser(address) {
|
|
|
6979
7119
|
} catch {
|
|
6980
7120
|
errorOccured = !0;
|
|
6981
7121
|
}
|
|
6982
|
-
errorOccured &&
|
|
7122
|
+
errorOccured && logger7.error(import_ts_dedent4.dedent`
|
|
6983
7123
|
Could not open ${address} inside a browser. If you're running this command inside a
|
|
6984
7124
|
docker container or on a CI, you need to pass the '--ci' flag to prevent opening a
|
|
6985
7125
|
browser by default.
|
|
@@ -6989,7 +7129,7 @@ async function openInBrowser(address) {
|
|
|
6989
7129
|
// src/core-server/utils/server-address.ts
|
|
6990
7130
|
var import_detect_port = __toESM(require_detect_port2(), 1);
|
|
6991
7131
|
import os from "node:os";
|
|
6992
|
-
import { logger as
|
|
7132
|
+
import { logger as logger8 } from "storybook/internal/node-logger";
|
|
6993
7133
|
function getServerAddresses(port, host, proto, initialPath) {
|
|
6994
7134
|
let address = new URL(`${proto}://localhost:${port}/`), networkAddress = new URL(`${proto}://${host || getLocalIp()}:${port}/`);
|
|
6995
7135
|
if (initialPath) {
|
|
@@ -7004,7 +7144,7 @@ function getServerAddresses(port, host, proto, initialPath) {
|
|
|
7004
7144
|
};
|
|
7005
7145
|
}
|
|
7006
7146
|
var getServerPort = (port, { exactPort } = {}) => (0, import_detect_port.default)(port).then((freePort) => (freePort !== port && exactPort && process.exit(-1), freePort)).catch((error) => {
|
|
7007
|
-
|
|
7147
|
+
logger8.error(error), process.exit(-1);
|
|
7008
7148
|
}), getServerChannelUrl = (port, { https: https2 }) => `${https2 ? "wss" : "ws"}://localhost:${port}/storybook-server-channel`, getLocalIp = () => {
|
|
7009
7149
|
let allFilteredIps = Object.values(os.networkInterfaces()).flat().filter((ip) => ip && ip.family === "IPv4" && !ip.internal);
|
|
7010
7150
|
return allFilteredIps.length ? allFilteredIps[0]?.address : "0.0.0.0";
|
|
@@ -7012,13 +7152,13 @@ var getServerPort = (port, { exactPort } = {}) => (0, import_detect_port.default
|
|
|
7012
7152
|
|
|
7013
7153
|
// src/core-server/utils/server-init.ts
|
|
7014
7154
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
7015
|
-
import { logger as
|
|
7155
|
+
import { logger as logger9 } from "storybook/internal/node-logger";
|
|
7016
7156
|
import http2 from "http";
|
|
7017
7157
|
import https from "https";
|
|
7018
7158
|
async function getServer(options) {
|
|
7019
7159
|
if (!options.https)
|
|
7020
7160
|
return http2.createServer();
|
|
7021
|
-
options.sslCert || (
|
|
7161
|
+
options.sslCert || (logger9.error("Error: --ssl-cert is required with --https"), process.exit(-1)), options.sslKey || (logger9.error("Error: --ssl-key is required with --https"), process.exit(-1));
|
|
7022
7162
|
let sslOptions = {
|
|
7023
7163
|
ca: await Promise.all((options.sslCa || []).map((ca) => readFile2(ca, { encoding: "utf8" }))),
|
|
7024
7164
|
cert: await readFile2(options.sslCert, { encoding: "utf8" }),
|
|
@@ -7062,14 +7202,14 @@ async function storybookDevServer(options) {
|
|
|
7062
7202
|
server,
|
|
7063
7203
|
channel: serverChannel
|
|
7064
7204
|
}), previewResult = await Promise.resolve();
|
|
7065
|
-
options.ignorePreview || (
|
|
7205
|
+
options.ignorePreview || (logger10.debug("Starting preview.."), previewResult = await previewBuilder.start({
|
|
7066
7206
|
startTime: process.hrtime(),
|
|
7067
7207
|
options,
|
|
7068
7208
|
router: app,
|
|
7069
7209
|
server,
|
|
7070
7210
|
channel: serverChannel
|
|
7071
7211
|
}).catch(async (e) => {
|
|
7072
|
-
throw
|
|
7212
|
+
throw logger10.error("Failed to build the preview"), process.exitCode = 1, await managerBuilder?.bail().catch(), await previewBuilder?.bail().catch(), e;
|
|
7073
7213
|
}));
|
|
7074
7214
|
let listening = new Promise((resolve4, reject) => {
|
|
7075
7215
|
server.once("error", reject), app.listen({ port, host }, resolve4);
|
|
@@ -7102,7 +7242,7 @@ async function storybookDevServer(options) {
|
|
|
7102
7242
|
|
|
7103
7243
|
// src/core-server/utils/output-startup-information.ts
|
|
7104
7244
|
var import_picocolors7 = __toESM(require_picocolors(), 1), import_pretty_hrtime = __toESM(require_pretty_hrtime(), 1), import_ts_dedent6 = __toESM(require_dist(), 1);
|
|
7105
|
-
import { CLI_COLORS, logger as
|
|
7245
|
+
import { CLI_COLORS, logger as logger11 } from "storybook/internal/node-logger";
|
|
7106
7246
|
|
|
7107
7247
|
// src/core-server/utils/update-check.ts
|
|
7108
7248
|
var import_picocolors6 = __toESM(require_picocolors(), 1), import_ts_dedent5 = __toESM(require_dist(), 1);
|
|
@@ -7150,7 +7290,7 @@ function outputStartupInformation(options) {
|
|
|
7150
7290
|
`- Local: ${address}`,
|
|
7151
7291
|
`- On your network: ${networkAddress}`
|
|
7152
7292
|
];
|
|
7153
|
-
|
|
7293
|
+
logger11.logBox(
|
|
7154
7294
|
import_ts_dedent6.dedent`
|
|
7155
7295
|
Storybook ready!
|
|
7156
7296
|
|
|
@@ -7169,16 +7309,16 @@ ${updateMessage}` : ""}
|
|
|
7169
7309
|
managerTotalTime && `${import_picocolors7.default.underline((0, import_pretty_hrtime.default)(managerTotalTime))} for manager`,
|
|
7170
7310
|
previewTotalTime && `${import_picocolors7.default.underline((0, import_pretty_hrtime.default)(previewTotalTime))} for preview`
|
|
7171
7311
|
].filter(Boolean).join(" and ");
|
|
7172
|
-
|
|
7312
|
+
logger11.info(timeStatement);
|
|
7173
7313
|
}
|
|
7174
7314
|
|
|
7175
7315
|
// src/core-server/utils/warnOnIncompatibleAddons.ts
|
|
7176
|
-
import { logger as
|
|
7316
|
+
import { logger as logger13 } from "storybook/internal/node-logger";
|
|
7177
7317
|
|
|
7178
7318
|
// ../lib/cli-storybook/src/doctor/getIncompatibleStorybookPackages.ts
|
|
7179
7319
|
var import_picocolors8 = __toESM(require_picocolors(), 1);
|
|
7180
7320
|
import { versions as storybookCorePackages } from "storybook/internal/common";
|
|
7181
|
-
import { logger as
|
|
7321
|
+
import { logger as logger12 } from "storybook/internal/node-logger";
|
|
7182
7322
|
import semver2 from "semver";
|
|
7183
7323
|
|
|
7184
7324
|
// ../lib/cli-storybook/src/automigrate/helpers/consolidated-packages.ts
|
|
@@ -7238,7 +7378,7 @@ var checkPackageCompatibility = async (dependency, context) => {
|
|
|
7238
7378
|
availableCoreUpdate
|
|
7239
7379
|
};
|
|
7240
7380
|
} catch (err) {
|
|
7241
|
-
return skipErrors ||
|
|
7381
|
+
return skipErrors || logger12.log(
|
|
7242
7382
|
`Error checking compatibility for ${dependency}, please report an issue:
|
|
7243
7383
|
` + String(err)
|
|
7244
7384
|
), { packageName: dependency };
|
|
@@ -7308,7 +7448,7 @@ var warnOnIncompatibleAddons = async (currentStorybookVersion, packageManager) =
|
|
|
7308
7448
|
incompatiblePackagesList,
|
|
7309
7449
|
currentStorybookVersion
|
|
7310
7450
|
);
|
|
7311
|
-
incompatiblePackagesMessage &&
|
|
7451
|
+
incompatiblePackagesMessage && logger13.warn(incompatiblePackagesMessage);
|
|
7312
7452
|
};
|
|
7313
7453
|
|
|
7314
7454
|
// src/core-server/utils/warnWhenUsingArgTypesRegex.ts
|
|
@@ -7381,7 +7521,7 @@ async function buildDevStandalone(options) {
|
|
|
7381
7521
|
try {
|
|
7382
7522
|
await warnOnIncompatibleAddons(storybookVersion, packageManager);
|
|
7383
7523
|
} catch (e) {
|
|
7384
|
-
|
|
7524
|
+
logger14.warn("Storybook failed to check addon compatibility"), logger14.debug(`${e instanceof Error ? e.stack : String(e)}`);
|
|
7385
7525
|
}
|
|
7386
7526
|
try {
|
|
7387
7527
|
await warnWhenUsingArgTypesRegex(previewConfigPath, config);
|
|
@@ -7451,7 +7591,7 @@ async function buildDevStandalone(options) {
|
|
|
7451
7591
|
let problems = warnings.filter((warning) => !warning.message.includes("export 'useInsertionEffect'")).filter((warning) => !warning.message.includes("compilation but it's unused")).filter(
|
|
7452
7592
|
(warning) => !warning.message.includes("Conflicting values for 'process.env.NODE_ENV'")
|
|
7453
7593
|
);
|
|
7454
|
-
|
|
7594
|
+
logger14.log(problems.map((p) => p.stack).join(`
|
|
7455
7595
|
`)), process.exit(problems.length > 0 ? 1 : 0);
|
|
7456
7596
|
} else {
|
|
7457
7597
|
let name = frameworkName.split("@storybook/").length > 1 ? frameworkName.split("@storybook/")[1] : frameworkName;
|
|
@@ -7471,7 +7611,7 @@ async function buildDevStandalone(options) {
|
|
|
7471
7611
|
// src/core-server/build-index.ts
|
|
7472
7612
|
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
7473
7613
|
import { normalizeStories as normalizeStories3 } from "storybook/internal/common";
|
|
7474
|
-
import { logger as
|
|
7614
|
+
import { logger as logger15 } from "storybook/internal/node-logger";
|
|
7475
7615
|
|
|
7476
7616
|
// src/core-server/load.ts
|
|
7477
7617
|
import {
|
|
@@ -7533,7 +7673,7 @@ var buildIndex = async (options) => {
|
|
|
7533
7673
|
return await generator.initialize(), generator.getIndex();
|
|
7534
7674
|
}, buildIndexStandalone = async (options) => {
|
|
7535
7675
|
let index = await buildIndex(options);
|
|
7536
|
-
|
|
7676
|
+
logger15.info(`Writing index to ${options.outputFile}`), await writeFile4(options.outputFile, JSON.stringify(index));
|
|
7537
7677
|
};
|
|
7538
7678
|
|
|
7539
7679
|
// src/core-server/standalone.ts
|
|
@@ -7831,6 +7971,7 @@ var testProviderStore = createTestProviderStore({
|
|
|
7831
7971
|
export {
|
|
7832
7972
|
StoryIndexGenerator,
|
|
7833
7973
|
Tag,
|
|
7974
|
+
analyze as analyzeMdx,
|
|
7834
7975
|
standalone_default as build,
|
|
7835
7976
|
buildDevStandalone,
|
|
7836
7977
|
buildIndex,
|