@storybook/react-native 10.5.0-canary-20260606223917 → 10.5.0
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/{channelServer-MfmENTPk.js → channelServer-D-IaG_dn.js} +195 -7
- package/dist/{env-tools-CQ0w1x0Z.js → env-tools-Bo-isXVU.js} +5 -5
- package/dist/{index-Dwx6-0Rh.d.ts → index-BJ1RN0YK.d.ts} +1 -0
- package/dist/index.d.ts +21 -31
- package/dist/index.js +18 -11
- package/dist/metro/withStorybook.d.ts +27 -19
- package/dist/metro/withStorybook.js +10 -7
- package/dist/node.d.ts +2 -14
- package/dist/node.js +3 -4
- package/dist/preview.d.ts +0 -1
- package/dist/preview.js +4 -4
- package/dist/repack/withStorybook.d.ts +1 -2
- package/dist/repack/withStorybook.js +6 -5
- package/dist/{chunk-Ble4zEEl.js → rolldown-runtime-Bd6kNlEP.js} +8 -1
- package/dist/{storyInstructions-FLR5G1Xm.js → storyInstructions-m8S0KLFH.js} +1 -1
- package/dist/stub.js +1 -1
- package/dist/withStorybook.d.ts +1 -2
- package/dist/withStorybook.js +5 -5
- package/package.json +18 -17
- package/dist/buildIndex-l9rzAl79.js +0 -197
|
@@ -1,9 +1,185 @@
|
|
|
1
|
-
require("./
|
|
2
|
-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Bd6kNlEP.js");
|
|
2
|
+
let storybook_internal_preview_api = require("storybook/internal/preview-api");
|
|
3
|
+
let storybook_internal_csf = require("storybook/internal/csf");
|
|
4
|
+
let path = require("path");
|
|
5
|
+
path = require_rolldown_runtime.__toESM(path);
|
|
6
|
+
let storybook_internal_common = require("storybook/internal/common");
|
|
3
7
|
let ws = require("ws");
|
|
4
8
|
let node_http = require("node:http");
|
|
5
9
|
let node_https = require("node:https");
|
|
10
|
+
let node_fs = require("node:fs");
|
|
11
|
+
let glob = require("glob");
|
|
12
|
+
let storybook_internal_csf_tools = require("storybook/internal/csf-tools");
|
|
6
13
|
let node_stream_consumers = require("node:stream/consumers");
|
|
14
|
+
//#region scripts/common.js
|
|
15
|
+
var require_common = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
|
|
16
|
+
const { globToRegexp } = require("storybook/internal/common");
|
|
17
|
+
const path$2 = require("path");
|
|
18
|
+
const fs = require("fs");
|
|
19
|
+
const cwd = process.cwd();
|
|
20
|
+
const toRequireContext = (specifier) => {
|
|
21
|
+
const { directory, files } = specifier;
|
|
22
|
+
const match = globToRegexp(`./${files}`);
|
|
23
|
+
return {
|
|
24
|
+
path: directory,
|
|
25
|
+
recursive: files.includes("**") || files.split("/").length > 1,
|
|
26
|
+
match
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
const supportedExtensions = [
|
|
30
|
+
"js",
|
|
31
|
+
"jsx",
|
|
32
|
+
"ts",
|
|
33
|
+
"tsx",
|
|
34
|
+
"cjs",
|
|
35
|
+
"mjs"
|
|
36
|
+
];
|
|
37
|
+
function getFilePathExtension({ configPath }, fileName) {
|
|
38
|
+
for (const ext of supportedExtensions) {
|
|
39
|
+
const filePath = path$2.resolve(cwd, configPath, `${fileName}.${ext}`);
|
|
40
|
+
if (fs.existsSync(filePath)) return ext;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
function getFilePathWithExtension({ configPath }, fileName) {
|
|
45
|
+
for (const ext of supportedExtensions) {
|
|
46
|
+
const filePath = path$2.resolve(cwd, configPath, `${fileName}.${ext}`);
|
|
47
|
+
if (fs.existsSync(filePath)) return filePath;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function ensureRelativePathHasDot(relativePath) {
|
|
52
|
+
return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
53
|
+
}
|
|
54
|
+
function getPreviewExists({ configPath }) {
|
|
55
|
+
return !!getFilePathExtension({ configPath }, "preview");
|
|
56
|
+
}
|
|
57
|
+
function resolveAddonFile(addon, file, extensions = [
|
|
58
|
+
"js",
|
|
59
|
+
"mjs",
|
|
60
|
+
"ts"
|
|
61
|
+
], configPath) {
|
|
62
|
+
if (!addon || typeof addon !== "string") return null;
|
|
63
|
+
const resolvePaths = { paths: [cwd] };
|
|
64
|
+
try {
|
|
65
|
+
const basePath = `${addon}/${file}`;
|
|
66
|
+
require.resolve(basePath, resolvePaths);
|
|
67
|
+
return basePath;
|
|
68
|
+
} catch (_error) {}
|
|
69
|
+
for (const ext of extensions) try {
|
|
70
|
+
const filePath = `${addon}/${file}.${ext}`;
|
|
71
|
+
require.resolve(filePath, resolvePaths);
|
|
72
|
+
return filePath;
|
|
73
|
+
} catch (_error) {}
|
|
74
|
+
if (addon.startsWith("./") || addon.startsWith("../")) try {
|
|
75
|
+
if (getFilePathExtension({ configPath }, `${addon}/${file}`)) return `${addon}/${file}`;
|
|
76
|
+
} catch (_error) {}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
function getAddonName(addon) {
|
|
80
|
+
if (typeof addon === "string") return addon;
|
|
81
|
+
if (typeof addon === "object" && addon.name && typeof addon.name === "string") return addon.name;
|
|
82
|
+
console.error("Invalid addon configuration", addon);
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
module.exports = {
|
|
86
|
+
toRequireContext,
|
|
87
|
+
getFilePathExtension,
|
|
88
|
+
ensureRelativePathHasDot,
|
|
89
|
+
getPreviewExists,
|
|
90
|
+
resolveAddonFile,
|
|
91
|
+
getAddonName,
|
|
92
|
+
getFilePathWithExtension
|
|
93
|
+
};
|
|
94
|
+
}));
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/metro/buildIndex.ts
|
|
97
|
+
var import_common = require_common();
|
|
98
|
+
const cwd = process.cwd();
|
|
99
|
+
const makeTitle = (fileName, specifier, userTitle) => {
|
|
100
|
+
const title = (0, storybook_internal_preview_api.userOrAutoTitleFromSpecifier)(fileName, specifier, userTitle);
|
|
101
|
+
if (title) return title.replace("./", "");
|
|
102
|
+
else if (userTitle) return userTitle.replace("./", "");
|
|
103
|
+
else {
|
|
104
|
+
console.error("Could not generate title!!");
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
function ensureRelativePathHasDot(relativePath) {
|
|
109
|
+
return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
110
|
+
}
|
|
111
|
+
async function buildIndex({ configPath }) {
|
|
112
|
+
const main = await (0, storybook_internal_common.loadMainConfig)({
|
|
113
|
+
configDir: configPath,
|
|
114
|
+
cwd
|
|
115
|
+
});
|
|
116
|
+
if (!main.stories || !Array.isArray(main.stories)) throw new Error("No stories found");
|
|
117
|
+
const storiesSpecifiers = (0, storybook_internal_common.normalizeStories)(main.stories, {
|
|
118
|
+
configDir: configPath,
|
|
119
|
+
workingDir: cwd
|
|
120
|
+
});
|
|
121
|
+
const csfStories = storiesSpecifiers.map((specifier) => {
|
|
122
|
+
return (0, glob.sync)(specifier.files, {
|
|
123
|
+
cwd: path.default.resolve(process.cwd(), specifier.directory),
|
|
124
|
+
absolute: true,
|
|
125
|
+
ignore: ["**/node_modules"]
|
|
126
|
+
}).map((storyPath) => {
|
|
127
|
+
const normalizePathForWindows = (str) => path.default.sep === "\\" ? str.replace(/\\/g, "/") : str;
|
|
128
|
+
return normalizePathForWindows(storyPath);
|
|
129
|
+
});
|
|
130
|
+
}).reduce((acc, specifierStoryPathList, specifierIndex) => {
|
|
131
|
+
const paths = specifierStoryPathList.map((storyPath) => {
|
|
132
|
+
const code = (0, node_fs.readFileSync)(storyPath, { encoding: "utf-8" }).toString();
|
|
133
|
+
const relativePath = ensureRelativePathHasDot(path.default.posix.relative(cwd, storyPath));
|
|
134
|
+
return {
|
|
135
|
+
result: (0, storybook_internal_csf_tools.loadCsf)(code, {
|
|
136
|
+
fileName: storyPath,
|
|
137
|
+
makeTitle: (userTitle) => makeTitle(relativePath, storiesSpecifiers[specifierIndex], userTitle)
|
|
138
|
+
}).parse(),
|
|
139
|
+
specifier: storiesSpecifiers[specifierIndex],
|
|
140
|
+
fileName: relativePath
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
return [...acc, ...paths];
|
|
144
|
+
}, new Array());
|
|
145
|
+
const index = {
|
|
146
|
+
v: 5,
|
|
147
|
+
entries: {}
|
|
148
|
+
};
|
|
149
|
+
for (const { result, specifier, fileName } of csfStories) {
|
|
150
|
+
const { meta, stories } = result;
|
|
151
|
+
if (stories && stories.length > 0) for (const story of stories) {
|
|
152
|
+
const id = story.id ?? (0, storybook_internal_csf.toId)(meta.title, story.name);
|
|
153
|
+
if (!id) throw new Error(`Failed to generate id for story ${story.name} in file ${fileName}`);
|
|
154
|
+
index.entries[id] = {
|
|
155
|
+
type: "story",
|
|
156
|
+
subtype: "story",
|
|
157
|
+
id,
|
|
158
|
+
name: story.name,
|
|
159
|
+
title: meta.title,
|
|
160
|
+
importPath: `${specifier.directory}/${path.default.posix.relative(specifier.directory, fileName)}`,
|
|
161
|
+
tags: ["story"]
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
else console.log(`No stories found for ${fileName}`);
|
|
165
|
+
}
|
|
166
|
+
try {
|
|
167
|
+
const storySort = (0, storybook_internal_csf_tools.getStorySortParameter)((0, node_fs.readFileSync)((0, import_common.getFilePathWithExtension)({ configPath }, "preview"), { encoding: "utf-8" }).toString());
|
|
168
|
+
const sortableStories = Object.values(index.entries);
|
|
169
|
+
(0, storybook_internal_preview_api.sortStoriesV7)(sortableStories, storySort, sortableStories.map((entry) => entry.importPath));
|
|
170
|
+
return {
|
|
171
|
+
v: 5,
|
|
172
|
+
entries: sortableStories.reduce((acc, item) => {
|
|
173
|
+
acc[item.id] = item;
|
|
174
|
+
return acc;
|
|
175
|
+
}, {})
|
|
176
|
+
};
|
|
177
|
+
} catch {
|
|
178
|
+
console.warn("Failed to sort stories, using unordered index");
|
|
179
|
+
return index;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//#endregion
|
|
7
183
|
//#region src/metro/mcpServer.ts
|
|
8
184
|
/**
|
|
9
185
|
* Converts Node.js IncomingHttpHeaders to a format compatible with the Web Headers API.
|
|
@@ -72,20 +248,20 @@ function createMcpHandler(configPath, wss) {
|
|
|
72
248
|
}
|
|
73
249
|
initPromise = (async () => {
|
|
74
250
|
try {
|
|
75
|
-
const [{ McpServer }, { ValibotJsonSchemaAdapter }, { HttpTransport }, { addListAllDocumentationTool, addGetDocumentationTool, addGetStoryDocumentationTool }, { storyInstructions },
|
|
251
|
+
const [{ McpServer }, { ValibotJsonSchemaAdapter }, { HttpTransport }, { addListAllDocumentationTool, addGetDocumentationTool, addGetStoryDocumentationTool }, { storyInstructions }, valibot, { experimental_manifests }] = await Promise.all([
|
|
76
252
|
import("tmcp"),
|
|
77
253
|
import("@tmcp/adapter-valibot"),
|
|
78
254
|
import("@tmcp/transport-http"),
|
|
79
255
|
import("@storybook/mcp"),
|
|
80
|
-
Promise.resolve().then(() => require("./storyInstructions-
|
|
81
|
-
Promise.resolve().then(() => require("./buildIndex-l9rzAl79.js")).then((n) => n.buildIndex_exports),
|
|
256
|
+
Promise.resolve().then(() => require("./storyInstructions-m8S0KLFH.js")),
|
|
82
257
|
import("valibot"),
|
|
83
258
|
import("@storybook/react/preset")
|
|
84
259
|
]);
|
|
85
260
|
const manifestProvider = async (_request, manifestPath) => {
|
|
86
261
|
if (manifestPath.includes("docs.json")) throw new Error("Docs manifest not available in React Native Storybook");
|
|
87
262
|
const index = await buildIndex({ configPath });
|
|
88
|
-
const
|
|
263
|
+
const entries = Object.values(index.entries);
|
|
264
|
+
const manifest = await experimental_manifests({}, { manifestEntries: entries });
|
|
89
265
|
return JSON.stringify(manifest.components);
|
|
90
266
|
};
|
|
91
267
|
const server = new McpServer({
|
|
@@ -364,7 +540,7 @@ function createChannelServer({ port = 7007, host = void 0, configPath, experimen
|
|
|
364
540
|
}
|
|
365
541
|
if (req.method === "GET" && requestUrl.pathname === "/index.json") {
|
|
366
542
|
try {
|
|
367
|
-
const index = await
|
|
543
|
+
const index = await buildIndex({ configPath });
|
|
368
544
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
369
545
|
res.end(JSON.stringify(index));
|
|
370
546
|
} catch (error) {
|
|
@@ -466,9 +642,21 @@ function createChannelServer({ port = 7007, host = void 0, configPath, experimen
|
|
|
466
642
|
return wss;
|
|
467
643
|
}
|
|
468
644
|
//#endregion
|
|
645
|
+
Object.defineProperty(exports, "buildIndex", {
|
|
646
|
+
enumerable: true,
|
|
647
|
+
get: function() {
|
|
648
|
+
return buildIndex;
|
|
649
|
+
}
|
|
650
|
+
});
|
|
469
651
|
Object.defineProperty(exports, "createChannelServer", {
|
|
470
652
|
enumerable: true,
|
|
471
653
|
get: function() {
|
|
472
654
|
return createChannelServer;
|
|
473
655
|
}
|
|
474
656
|
});
|
|
657
|
+
Object.defineProperty(exports, "require_common", {
|
|
658
|
+
enumerable: true,
|
|
659
|
+
get: function() {
|
|
660
|
+
return require_common;
|
|
661
|
+
}
|
|
662
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Bd6kNlEP.js");
|
|
2
|
+
const require_channelServer = require("./channelServer-D-IaG_dn.js");
|
|
3
3
|
//#region scripts/require-interop.js
|
|
4
|
-
var require_require_interop = /* @__PURE__ */
|
|
4
|
+
var require_require_interop = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
|
|
5
5
|
let registered = false;
|
|
6
6
|
function interopRequireDefault(filePath) {
|
|
7
7
|
const hasEsbuildBeenRegistered = !!require("module")._extensions[".ts"];
|
|
@@ -28,8 +28,8 @@ var require_require_interop = /* @__PURE__ */ require_chunk.__commonJSMin(((expo
|
|
|
28
28
|
}));
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region scripts/generate.js
|
|
31
|
-
var require_generate = /* @__PURE__ */
|
|
32
|
-
const { toRequireContext, ensureRelativePathHasDot, getPreviewExists, resolveAddonFile, getAddonName } =
|
|
31
|
+
var require_generate = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
|
|
32
|
+
const { toRequireContext, ensureRelativePathHasDot, getPreviewExists, resolveAddonFile, getAddonName } = require_channelServer.require_common();
|
|
33
33
|
const { normalizeStories, globToRegexp, loadMainConfig, getInterpretedFile } = require("storybook/internal/common");
|
|
34
34
|
const { interopRequireDefault } = require_require_interop();
|
|
35
35
|
const fs = require("fs");
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import * as _$storybook_internal_types0 from "storybook/internal/types";
|
|
2
1
|
import { Addon_StorySortParameterV7, ModuleExports, NormalizedProjectAnnotations, NormalizedStoriesSpecifier, PreparedStory, StoryIndex, StorybookConfig as StorybookConfig$1 } from "storybook/internal/types";
|
|
3
2
|
import { ArgTypes, Args, Decorator, Loader, Meta, Parameters, Preview, ReactRenderer, StoryFn, StoryObj } from "@storybook/react";
|
|
4
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
3
|
import { Theme, Theme as Theme$1, darkTheme, theme } from "@storybook/react-native-theming";
|
|
6
4
|
import { SBUI } from "@storybook/react-native-ui-common";
|
|
7
5
|
import { Channel } from "storybook/internal/channels";
|
|
8
6
|
import { StoryContext } from "storybook/internal/csf";
|
|
9
7
|
import { PreviewWithSelection, SelectionStore } from "storybook/internal/preview-api";
|
|
10
|
-
|
|
11
8
|
//#region src/View.d.ts
|
|
12
9
|
interface Storage {
|
|
13
10
|
getItem: (key: string) => Promise<string | null> | string | null;
|
|
@@ -25,7 +22,7 @@ type InitialSelection = `${StoryKind}--${StoryName}` | {
|
|
|
25
22
|
*/
|
|
26
23
|
name: StoryName;
|
|
27
24
|
};
|
|
28
|
-
type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]
|
|
25
|
+
type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T;
|
|
29
26
|
type ThemePartial = DeepPartial<Theme$1>;
|
|
30
27
|
type Params = {
|
|
31
28
|
onDeviceUI?: boolean;
|
|
@@ -40,14 +37,20 @@ type Params = {
|
|
|
40
37
|
* default: automatically enabled when a websocket config is injected via storybook.requires (i.e. when STORYBOOK_WS_HOST is set), otherwise false
|
|
41
38
|
*/
|
|
42
39
|
enableWebsockets?: boolean;
|
|
43
|
-
query?: string;
|
|
44
|
-
|
|
40
|
+
query?: string;
|
|
41
|
+
/** The host for the websocket server. default: localhost */
|
|
42
|
+
host?: string;
|
|
43
|
+
/** The port for the websocket server. default: 7007 */
|
|
45
44
|
port?: number;
|
|
46
|
-
secured?: boolean;
|
|
47
|
-
|
|
45
|
+
secured?: boolean;
|
|
46
|
+
/** The initial story */
|
|
47
|
+
initialSelection?: InitialSelection;
|
|
48
|
+
/** Whether to persist story selection. default: true */
|
|
48
49
|
shouldPersistSelection?: boolean;
|
|
49
|
-
theme: ThemePartial;
|
|
50
|
-
|
|
50
|
+
theme: ThemePartial;
|
|
51
|
+
/** Used for persisting story selection. required. */
|
|
52
|
+
storage?: Storage;
|
|
53
|
+
/** The custom UI component to use instead of the default UI */
|
|
51
54
|
CustomUIComponent?: SBUI;
|
|
52
55
|
};
|
|
53
56
|
declare class View {
|
|
@@ -64,23 +67,17 @@ declare class View {
|
|
|
64
67
|
_idToPrepared: Record<string, PreparedStory<ReactRenderer>>;
|
|
65
68
|
constructor(preview: PreviewWithSelection<ReactRenderer>, channel: Channel, options: any);
|
|
66
69
|
_storyIdExists: (storyId: string) => boolean;
|
|
67
|
-
_selectInitialStory: ({
|
|
68
|
-
selectionSpecifier,
|
|
69
|
-
storyIdFromUrl
|
|
70
|
-
}: {
|
|
70
|
+
_selectInitialStory: ({ selectionSpecifier, storyIdFromUrl }: {
|
|
71
71
|
selectionSpecifier: NonNullable<SelectionStore["selectionSpecifier"]>;
|
|
72
72
|
storyIdFromUrl?: string | null;
|
|
73
73
|
}) => Promise<void>;
|
|
74
|
-
_getInitialStory: ({
|
|
75
|
-
initialSelection,
|
|
76
|
-
shouldPersistSelection
|
|
77
|
-
}?: Partial<Params>) => Promise<NonNullable<SelectionStore["selectionSpecifier"]>>;
|
|
74
|
+
_getInitialStory: ({ initialSelection, shouldPersistSelection }?: Partial<Params>) => Promise<NonNullable<SelectionStore["selectionSpecifier"]>>;
|
|
78
75
|
_getHost: (params?: Partial<Params>) => any;
|
|
79
76
|
__getPort: (params?: Partial<Params>) => any;
|
|
80
77
|
_isSecureConnection: (params?: Partial<Params>) => any;
|
|
81
78
|
_getServerChannel: (params?: Partial<Params>) => Channel;
|
|
82
79
|
createPreparedStoryMapping: () => Promise<void>;
|
|
83
|
-
getStorybookUI: (params?: Partial<Params>) => () =>
|
|
80
|
+
getStorybookUI: (params?: Partial<Params>) => () => import("react/jsx-runtime").JSX.Element;
|
|
84
81
|
}
|
|
85
82
|
//#endregion
|
|
86
83
|
//#region src/prepareStories.d.ts
|
|
@@ -91,11 +88,7 @@ interface ReactNativeOptions {
|
|
|
91
88
|
*/
|
|
92
89
|
playFn?: boolean;
|
|
93
90
|
}
|
|
94
|
-
declare function prepareStories({
|
|
95
|
-
storyEntries,
|
|
96
|
-
options,
|
|
97
|
-
storySort
|
|
98
|
-
}: {
|
|
91
|
+
declare function prepareStories({ storyEntries, options, storySort }: {
|
|
99
92
|
storyEntries: (NormalizedStoriesSpecifier & {
|
|
100
93
|
req: any;
|
|
101
94
|
})[];
|
|
@@ -104,7 +97,7 @@ declare function prepareStories({
|
|
|
104
97
|
}): {
|
|
105
98
|
index: {
|
|
106
99
|
v: number;
|
|
107
|
-
entries: Record<string,
|
|
100
|
+
entries: Record<string, import("storybook/internal/types").IndexEntry>;
|
|
108
101
|
};
|
|
109
102
|
importMap: Record<string, any>;
|
|
110
103
|
};
|
|
@@ -117,11 +110,7 @@ type StoryEntry = NormalizedStoriesSpecifier & {
|
|
|
117
110
|
};
|
|
118
111
|
};
|
|
119
112
|
declare const getProjectAnnotations: (view: View, annotations: ModuleExports[]) => () => Promise<NormalizedProjectAnnotations<ReactRenderer>>;
|
|
120
|
-
declare function start({
|
|
121
|
-
annotations,
|
|
122
|
-
storyEntries,
|
|
123
|
-
options
|
|
124
|
-
}: {
|
|
113
|
+
declare function start({ annotations, storyEntries, options }: {
|
|
125
114
|
storyEntries: StoryEntry[];
|
|
126
115
|
annotations: ModuleExports[];
|
|
127
116
|
options?: ReactNativeOptions;
|
|
@@ -138,7 +127,8 @@ declare const STORYBOOK_STORY_ID_PARAM = "STORYBOOK_STORY_ID";
|
|
|
138
127
|
//#endregion
|
|
139
128
|
//#region src/index.d.ts
|
|
140
129
|
type Features = {
|
|
141
|
-
/** Enable the built-in on-device backgrounds addon panel. */
|
|
130
|
+
/** Enable the built-in on-device backgrounds addon panel. */
|
|
131
|
+
ondeviceBackgrounds?: boolean;
|
|
142
132
|
};
|
|
143
133
|
type Addon = string | {
|
|
144
134
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Bd6kNlEP.js");
|
|
3
3
|
let _storybook_react_native_theming = require("@storybook/react-native-theming");
|
|
4
4
|
let react_native = require("react-native");
|
|
5
5
|
let storybook_internal_preview_api = require("storybook/internal/preview-api");
|
|
@@ -7,12 +7,12 @@ let storybook_manager_api = require("storybook/manager-api");
|
|
|
7
7
|
let storybook_internal_channels = require("storybook/internal/channels");
|
|
8
8
|
let _storybook_react_native_ui_common = require("@storybook/react-native-ui-common");
|
|
9
9
|
let dedent = require("dedent");
|
|
10
|
-
dedent =
|
|
10
|
+
dedent = require_rolldown_runtime.__toESM(dedent);
|
|
11
11
|
let deepmerge = require("deepmerge");
|
|
12
|
-
deepmerge =
|
|
12
|
+
deepmerge = require_rolldown_runtime.__toESM(deepmerge);
|
|
13
13
|
let react = require("react");
|
|
14
|
-
let react$1 =
|
|
15
|
-
react =
|
|
14
|
+
let react$1 = require_rolldown_runtime.__toESM(react, 1);
|
|
15
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
16
16
|
let react_native_safe_area_context = require("react-native-safe-area-context");
|
|
17
17
|
let storybook_internal_core_events = require("storybook/internal/core-events");
|
|
18
18
|
let storybook_internal_csf = require("storybook/internal/csf");
|
|
@@ -104,6 +104,12 @@ function returnAtomValue(atomState) {
|
|
|
104
104
|
function isPromiseLike$1(p) {
|
|
105
105
|
return typeof (p == null ? void 0 : p.then) === "function";
|
|
106
106
|
}
|
|
107
|
+
function shouldThrowSynchronously(error) {
|
|
108
|
+
if (!(error instanceof Error)) return false;
|
|
109
|
+
const name = error.name;
|
|
110
|
+
const message = error.message.toLowerCase();
|
|
111
|
+
return (name === "RangeError" || name === "InternalError") && (message.includes("call stack") || message.includes("too much recursion") || message.includes("stack overflow"));
|
|
112
|
+
}
|
|
107
113
|
function addPendingPromiseToDependency(atom, promise, dependencyAtomState) {
|
|
108
114
|
if (!dependencyAtomState.p.has(atom)) {
|
|
109
115
|
dependencyAtomState.p.add(atom);
|
|
@@ -351,6 +357,7 @@ const BUILDING_BLOCK_readAtomState = (buildingBlocks, store, atom) => {
|
|
|
351
357
|
atomState.m = storeEpochNumber;
|
|
352
358
|
return atomState;
|
|
353
359
|
} catch (error) {
|
|
360
|
+
if (shouldThrowSynchronously(error)) throw error;
|
|
354
361
|
delete atomState.v;
|
|
355
362
|
atomState.e = error;
|
|
356
363
|
++atomState.n;
|
|
@@ -1357,7 +1364,7 @@ function prepareStories({ storyEntries, options, storySort }) {
|
|
|
1357
1364
|
//#endregion
|
|
1358
1365
|
//#region src/backgrounds/Swatch.tsx
|
|
1359
1366
|
var PressableSwatch, ColorSwatch, ValueContainer, NameText, ValueText, Swatch;
|
|
1360
|
-
var init_Swatch =
|
|
1367
|
+
var init_Swatch = require_rolldown_runtime.__esmMin((() => {
|
|
1361
1368
|
PressableSwatch = _storybook_react_native_theming.styled.TouchableOpacity(({ theme }) => ({
|
|
1362
1369
|
marginBottom: 10,
|
|
1363
1370
|
borderWidth: 1,
|
|
@@ -1401,7 +1408,7 @@ var init_Swatch = require_chunk.__esmMin((() => {
|
|
|
1401
1408
|
//#endregion
|
|
1402
1409
|
//#region src/backgrounds/constants.ts
|
|
1403
1410
|
var PARAM_KEY, ADDON_ID, PANEL_ID;
|
|
1404
|
-
var init_constants =
|
|
1411
|
+
var init_constants = require_rolldown_runtime.__esmMin((() => {
|
|
1405
1412
|
PARAM_KEY = "backgrounds";
|
|
1406
1413
|
ADDON_ID = "storybook-addon-background";
|
|
1407
1414
|
PANEL_ID = `${ADDON_ID}/background-panel`;
|
|
@@ -1409,7 +1416,7 @@ var init_constants = require_chunk.__esmMin((() => {
|
|
|
1409
1416
|
//#endregion
|
|
1410
1417
|
//#region src/backgrounds/BackgroundPanel.tsx
|
|
1411
1418
|
var codeSample, ThemedText, TitleText, ParagraphText, LockedText, Instructions, BackgroundPanel;
|
|
1412
|
-
var init_BackgroundPanel =
|
|
1419
|
+
var init_BackgroundPanel = require_rolldown_runtime.__esmMin((() => {
|
|
1413
1420
|
init_Swatch();
|
|
1414
1421
|
init_constants();
|
|
1415
1422
|
codeSample = `
|
|
@@ -1484,7 +1491,7 @@ export default preview;
|
|
|
1484
1491
|
}));
|
|
1485
1492
|
//#endregion
|
|
1486
1493
|
//#region src/backgrounds/register.tsx
|
|
1487
|
-
var register_exports = /* @__PURE__ */
|
|
1494
|
+
var register_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({ registerBackgroundsAddon: () => registerBackgroundsAddon });
|
|
1488
1495
|
function registerBackgroundsAddon() {
|
|
1489
1496
|
storybook_manager_api.addons.register(ADDON_ID, (api) => {
|
|
1490
1497
|
const channel = storybook_manager_api.addons.getChannel();
|
|
@@ -1500,7 +1507,7 @@ function registerBackgroundsAddon() {
|
|
|
1500
1507
|
});
|
|
1501
1508
|
});
|
|
1502
1509
|
}
|
|
1503
|
-
var init_register =
|
|
1510
|
+
var init_register = require_rolldown_runtime.__esmMin((() => {
|
|
1504
1511
|
init_BackgroundPanel();
|
|
1505
1512
|
init_constants();
|
|
1506
1513
|
}));
|
|
@@ -1547,7 +1554,7 @@ function start({ annotations, storyEntries, options }) {
|
|
|
1547
1554
|
storybook_manager_api.addons.setChannel(channel);
|
|
1548
1555
|
storybook_internal_preview_api.addons.setChannel(channel);
|
|
1549
1556
|
if (globalThis.FEATURES?.ondeviceBackgrounds) {
|
|
1550
|
-
const { registerBackgroundsAddon } = (init_register(),
|
|
1557
|
+
const { registerBackgroundsAddon } = (init_register(), require_rolldown_runtime.__toCommonJS(register_exports));
|
|
1551
1558
|
registerBackgroundsAddon();
|
|
1552
1559
|
}
|
|
1553
1560
|
const previewView = {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { t as WebsocketsOptions } from "../index-
|
|
1
|
+
import { t as WebsocketsOptions } from "../index-BJ1RN0YK.js";
|
|
2
2
|
import { HandleFunction, IncomingMessage, Server } from "connect";
|
|
3
3
|
import EventEmitter from "events";
|
|
4
4
|
import { Readable } from "stream";
|
|
5
5
|
import { IncomingMessage as IncomingMessage$1, ServerResponse } from "http";
|
|
6
|
-
|
|
7
|
-
//#region \0rolldown/runtime.js
|
|
8
6
|
//#endregion
|
|
9
7
|
//#region ../../node_modules/metro-cache/src/types.d.ts
|
|
10
8
|
/**
|
|
@@ -21,7 +19,7 @@ import { IncomingMessage as IncomingMessage$1, ServerResponse } from "http";
|
|
|
21
19
|
* Original file: packages/metro-cache/src/types.js
|
|
22
20
|
* To regenerate, run:
|
|
23
21
|
* js1 build metro-ts-defs (internal) OR
|
|
24
|
-
* yarn run build-ts-defs (OSS)
|
|
22
|
+
* yarn run build-ts-defs (OSS)
|
|
25
23
|
*/
|
|
26
24
|
interface CacheStore<T> {
|
|
27
25
|
name?: string;
|
|
@@ -60,7 +58,7 @@ declare class Cache<T> {
|
|
|
60
58
|
* Original file: packages/metro-cache/src/stableHash.js
|
|
61
59
|
* To regenerate, run:
|
|
62
60
|
* js1 build metro-ts-defs (internal) OR
|
|
63
|
-
* yarn run build-ts-defs (OSS)
|
|
61
|
+
* yarn run build-ts-defs (OSS)
|
|
64
62
|
*/
|
|
65
63
|
declare function stableHash(value: unknown): Buffer;
|
|
66
64
|
//#endregion
|
|
@@ -79,7 +77,7 @@ declare function stableHash(value: unknown): Buffer;
|
|
|
79
77
|
* Original file: packages/metro-cache/src/stores/FileStore.js
|
|
80
78
|
* To regenerate, run:
|
|
81
79
|
* js1 build metro-ts-defs (internal) OR
|
|
82
|
-
* yarn run build-ts-defs (OSS)
|
|
80
|
+
* yarn run build-ts-defs (OSS)
|
|
83
81
|
*/
|
|
84
82
|
type Options$3 = Readonly<{
|
|
85
83
|
root: string;
|
|
@@ -125,7 +123,7 @@ declare class AutoCleanFileStore<T> extends FileStore<T> {
|
|
|
125
123
|
* Original file: packages/metro-cache/src/stores/HttpError.js
|
|
126
124
|
* To regenerate, run:
|
|
127
125
|
* js1 build metro-ts-defs (internal) OR
|
|
128
|
-
* yarn run build-ts-defs (OSS)
|
|
126
|
+
* yarn run build-ts-defs (OSS)
|
|
129
127
|
*/
|
|
130
128
|
declare class HttpError extends Error {
|
|
131
129
|
code: number;
|
|
@@ -146,7 +144,7 @@ declare class HttpError extends Error {
|
|
|
146
144
|
* Original file: packages/metro-cache/src/stores/NetworkError.js
|
|
147
145
|
* To regenerate, run:
|
|
148
146
|
* js1 build metro-ts-defs (internal) OR
|
|
149
|
-
* yarn run build-ts-defs (OSS)
|
|
147
|
+
* yarn run build-ts-defs (OSS)
|
|
150
148
|
*/
|
|
151
149
|
declare class NetworkError extends Error {
|
|
152
150
|
code: string;
|
|
@@ -698,7 +696,7 @@ type MixedSourceMap = IndexMap | BasicSourceMap;
|
|
|
698
696
|
* Original file: packages/metro/src/lib/CountingSet.js
|
|
699
697
|
* To regenerate, run:
|
|
700
698
|
* js1 build metro-ts-defs (internal) OR
|
|
701
|
-
* yarn run build-ts-defs (OSS)
|
|
699
|
+
* yarn run build-ts-defs (OSS)
|
|
702
700
|
*/
|
|
703
701
|
interface ReadOnlyCountingSet<T> extends Iterable<T> {
|
|
704
702
|
has(item: T): boolean;
|
|
@@ -894,10 +892,14 @@ type JsTransformerConfig = Readonly<{
|
|
|
894
892
|
unstable_dependencyMapReservedName: null | undefined | string;
|
|
895
893
|
unstable_disableModuleWrapping: boolean;
|
|
896
894
|
unstable_disableNormalizePseudoGlobals: boolean;
|
|
897
|
-
unstable_compactOutput: boolean;
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
895
|
+
unstable_compactOutput: boolean;
|
|
896
|
+
/** Enable `require.context` statements which can be used to import multiple files in a directory. */
|
|
897
|
+
unstable_allowRequireContext: boolean;
|
|
898
|
+
/** With inlineRequires, enable a module-scope memo var and inline as (v || v=require('foo')) */
|
|
899
|
+
unstable_memoizeInlineRequires?: boolean;
|
|
900
|
+
/** With inlineRequires, do not memoize these module specifiers */
|
|
901
|
+
unstable_nonMemoizedInlineRequires?: ReadonlyArray<string>;
|
|
902
|
+
/** Whether to rename scoped `require` functions to `_$$_REQUIRE`, usually an extraneous operation when serializing to iife (default). */
|
|
901
903
|
unstable_renameRequire?: boolean;
|
|
902
904
|
}>;
|
|
903
905
|
type JsTransformOptions = Readonly<{
|
|
@@ -1002,7 +1004,8 @@ type ContextFilter = Readonly<{
|
|
|
1002
1004
|
}>;
|
|
1003
1005
|
type RequireContextParams = Readonly<{
|
|
1004
1006
|
recursive: boolean;
|
|
1005
|
-
filter: Readonly<ContextFilter>;
|
|
1007
|
+
filter: Readonly<ContextFilter>;
|
|
1008
|
+
/** Mode for resolving dynamic dependencies. Defaults to `sync` */
|
|
1006
1009
|
mode: ContextMode;
|
|
1007
1010
|
}>;
|
|
1008
1011
|
type DynamicRequiresBehavior = 'throwAtRuntime' | 'reject';
|
|
@@ -1010,8 +1013,10 @@ type DynamicRequiresBehavior = 'throwAtRuntime' | 'reject';
|
|
|
1010
1013
|
//#region ../../node_modules/metro/src/lib/contextModule.d.ts
|
|
1011
1014
|
type RequireContext = Readonly<{
|
|
1012
1015
|
recursive: boolean;
|
|
1013
|
-
filter: RegExp;
|
|
1014
|
-
|
|
1016
|
+
filter: RegExp;
|
|
1017
|
+
/** Mode for resolving dynamic dependencies. Defaults to `sync` */
|
|
1018
|
+
mode: ContextMode;
|
|
1019
|
+
/** Absolute path of the directory to search in */
|
|
1015
1020
|
from: string;
|
|
1016
1021
|
}>;
|
|
1017
1022
|
//#endregion
|
|
@@ -1048,7 +1053,8 @@ type TransformResultDependency = Readonly<{
|
|
|
1048
1053
|
* The dependency is enclosed in a try/catch block.
|
|
1049
1054
|
*/
|
|
1050
1055
|
isOptional?: boolean;
|
|
1051
|
-
locs: ReadonlyArray<ReadonlySourceLocation>;
|
|
1056
|
+
locs: ReadonlyArray<ReadonlySourceLocation>;
|
|
1057
|
+
/** Context for requiring a collection of modules. */
|
|
1052
1058
|
contextParams?: RequireContextParams;
|
|
1053
1059
|
}>;
|
|
1054
1060
|
}>;
|
|
@@ -1231,7 +1237,8 @@ type ResolutionContext = Readonly<{
|
|
|
1231
1237
|
doesFileExist: DoesFileExist;
|
|
1232
1238
|
extraNodeModules: null | undefined | {
|
|
1233
1239
|
[$$Key$$: string]: string;
|
|
1234
|
-
};
|
|
1240
|
+
};
|
|
1241
|
+
/** Is resolving for a development bundle. */
|
|
1235
1242
|
dev: boolean;
|
|
1236
1243
|
/**
|
|
1237
1244
|
* Get the parsed contents of the specified `package.json` file.
|
|
@@ -2081,7 +2088,8 @@ type MetalConfigT = {
|
|
|
2081
2088
|
};
|
|
2082
2089
|
type CacheStoresConfigT = ReadonlyArray<CacheStore<TransformResult>>;
|
|
2083
2090
|
type ServerConfigT = {
|
|
2084
|
-
/** @deprecated */
|
|
2091
|
+
/** @deprecated */
|
|
2092
|
+
enhanceMiddleware: ($$PARAM_0$$: Middleware, $$PARAM_1$$: Server$1) => Middleware | Server;
|
|
2085
2093
|
forwardClientLogs: boolean;
|
|
2086
2094
|
port: number;
|
|
2087
2095
|
rewriteRequestUrl: ($$PARAM_0$$: string) => string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
const require_rolldown_runtime = require("../rolldown-runtime-Bd6kNlEP.js");
|
|
3
|
+
const require_channelServer = require("../channelServer-D-IaG_dn.js");
|
|
4
|
+
const require_env_tools = require("../env-tools-Bo-isXVU.js");
|
|
5
5
|
let path = require("path");
|
|
6
|
-
path =
|
|
6
|
+
path = require_rolldown_runtime.__toESM(path);
|
|
7
7
|
let storybook_internal_common = require("storybook/internal/common");
|
|
8
8
|
let storybook_internal_telemetry = require("storybook/internal/telemetry");
|
|
9
9
|
//#region src/metro/withStorybook.ts
|
|
@@ -86,7 +86,9 @@ function withStorybook(config, options = {
|
|
|
86
86
|
configPath: path.resolve(process.cwd(), "./.rnstorybook")
|
|
87
87
|
}) {
|
|
88
88
|
const { configPath = path.resolve(process.cwd(), "./.rnstorybook"), websockets, useJs = false, enabled = true, docTools = true, liteMode = false, experimental_mcp = false } = options;
|
|
89
|
-
|
|
89
|
+
const disableTelemetry = (0, storybook_internal_common.optionalEnvToBoolean)(process.env.STORYBOOK_DISABLE_TELEMETRY);
|
|
90
|
+
const server = require_env_tools.envVariableToBoolean(process.env.STORYBOOK_SERVER, true);
|
|
91
|
+
if (!disableTelemetry && enabled) (0, storybook_internal_telemetry.telemetry)("dev", {}).catch((e) => {});
|
|
90
92
|
if (!enabled) return {
|
|
91
93
|
...config,
|
|
92
94
|
resolver: {
|
|
@@ -112,12 +114,13 @@ function withStorybook(config, options = {
|
|
|
112
114
|
const generateHost = resolvedWs.host ?? (websockets === "auto" && !process.env.STORYBOOK_WS_HOST ? "auto" : void 0);
|
|
113
115
|
const port = resolvedWs.port ?? 7007;
|
|
114
116
|
const secured = resolvedWs.secured;
|
|
115
|
-
|
|
117
|
+
const channelWebsocketsEnabled = Boolean(websockets) || Boolean(process.env.STORYBOOK_WS_HOST) || Boolean(resolvedWs.host);
|
|
118
|
+
if (server) require_channelServer.createChannelServer({
|
|
116
119
|
port,
|
|
117
120
|
host: bindHost,
|
|
118
121
|
configPath,
|
|
119
122
|
experimental_mcp,
|
|
120
|
-
websockets:
|
|
123
|
+
websockets: channelWebsocketsEnabled,
|
|
121
124
|
secured,
|
|
122
125
|
ssl: websockets && websockets !== "auto" ? {
|
|
123
126
|
key: websockets.key,
|
package/dist/node.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { StoryIndex } from "storybook/internal/types";
|
|
2
2
|
import { WebSocketServer } from "ws";
|
|
3
|
-
|
|
4
3
|
//#region src/metro/channelServer.d.ts
|
|
5
4
|
interface ChannelServerSecureOptions {
|
|
6
5
|
ca?: string | Buffer | Array<string | Buffer>;
|
|
@@ -70,21 +69,10 @@ interface ChannelServerOptions {
|
|
|
70
69
|
* @param options.keepAlive - Whether the channel server should keep the Node.js process alive.
|
|
71
70
|
* @returns The created WebSocketServer instance, or null when websockets are disabled.
|
|
72
71
|
*/
|
|
73
|
-
declare function createChannelServer({
|
|
74
|
-
port,
|
|
75
|
-
host,
|
|
76
|
-
configPath,
|
|
77
|
-
experimental_mcp,
|
|
78
|
-
websockets,
|
|
79
|
-
secured,
|
|
80
|
-
ssl,
|
|
81
|
-
keepNodeProcessAlive
|
|
82
|
-
}: ChannelServerOptions): WebSocketServer | null;
|
|
72
|
+
declare function createChannelServer({ port, host, configPath, experimental_mcp, websockets, secured, ssl, keepNodeProcessAlive }: ChannelServerOptions): WebSocketServer | null;
|
|
83
73
|
//#endregion
|
|
84
74
|
//#region src/metro/buildIndex.d.ts
|
|
85
|
-
declare function buildIndex({
|
|
86
|
-
configPath
|
|
87
|
-
}: {
|
|
75
|
+
declare function buildIndex({ configPath }: {
|
|
88
76
|
configPath: string;
|
|
89
77
|
}): Promise<StoryIndex>;
|
|
90
78
|
//#endregion
|
package/dist/node.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
exports.buildIndex = require_buildIndex.buildIndex;
|
|
2
|
+
require("./rolldown-runtime-Bd6kNlEP.js");
|
|
3
|
+
const require_channelServer = require("./channelServer-D-IaG_dn.js");
|
|
4
|
+
exports.buildIndex = require_channelServer.buildIndex;
|
|
6
5
|
exports.createChannelServer = require_channelServer.createChannelServer;
|
package/dist/preview.d.ts
CHANGED
package/dist/preview.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
require("./
|
|
1
|
+
require("./rolldown-runtime-Bd6kNlEP.js");
|
|
2
2
|
let react_native = require("react-native");
|
|
3
|
-
let
|
|
3
|
+
let _storybook_react_entry_preview_argtypes = require("@storybook/react/entry-preview-argtypes");
|
|
4
4
|
//#region src/preview.ts
|
|
5
5
|
if (react_native.Platform.OS === "web") {
|
|
6
6
|
globalThis.ProgressTransitionRegister = {};
|
|
7
7
|
globalThis.UpdatePropsManager = {};
|
|
8
8
|
}
|
|
9
9
|
const preview = {
|
|
10
|
-
argTypesEnhancers:
|
|
11
|
-
parameters: { docs: { extractArgTypes:
|
|
10
|
+
argTypesEnhancers: _storybook_react_entry_preview_argtypes.argTypesEnhancers,
|
|
11
|
+
parameters: { docs: { extractArgTypes: _storybook_react_entry_preview_argtypes.parameters.docs.extractArgTypes } }
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
14
14
|
module.exports = preview;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
const require_rolldown_runtime = require("../rolldown-runtime-Bd6kNlEP.js");
|
|
3
|
+
const require_channelServer = require("../channelServer-D-IaG_dn.js");
|
|
4
|
+
const require_env_tools = require("../env-tools-Bo-isXVU.js");
|
|
5
5
|
let path = require("path");
|
|
6
|
-
path =
|
|
6
|
+
path = require_rolldown_runtime.__toESM(path);
|
|
7
7
|
let storybook_internal_telemetry = require("storybook/internal/telemetry");
|
|
8
8
|
//#region src/repack/withStorybook.ts
|
|
9
9
|
var import_generate = require_env_tools.require_generate();
|
|
@@ -73,12 +73,13 @@ var StorybookPlugin = class {
|
|
|
73
73
|
*/
|
|
74
74
|
applyEnabled(compiler, { configPath, websockets, useJs, docTools, liteMode, experimental_mcp }) {
|
|
75
75
|
const resolvedWs = require_env_tools.loadWebsocketEnvOverrides(websockets);
|
|
76
|
+
const server = require_env_tools.envVariableToBoolean(process.env.STORYBOOK_SERVER, true);
|
|
76
77
|
const bindHost = websockets === "auto" && !process.env.STORYBOOK_WS_HOST ? void 0 : resolvedWs.host;
|
|
77
78
|
const generateHost = resolvedWs.host ?? (websockets === "auto" && !process.env.STORYBOOK_WS_HOST ? "auto" : void 0);
|
|
78
79
|
const port = resolvedWs.port ?? 7007;
|
|
79
80
|
const secured = resolvedWs.secured;
|
|
80
81
|
const channelWebsocketsEnabled = Boolean(websockets) || Boolean(process.env.STORYBOOK_WS_HOST) || Boolean(resolvedWs.host);
|
|
81
|
-
if ((experimental_mcp || websockets != null || process.env.STORYBOOK_WS_HOST) && !this.serverStarted) {
|
|
82
|
+
if ((experimental_mcp || websockets != null || process.env.STORYBOOK_WS_HOST) && !this.serverStarted && server) {
|
|
82
83
|
this.serverStarted = true;
|
|
83
84
|
require_channelServer.createChannelServer({
|
|
84
85
|
port,
|
|
@@ -5,7 +5,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __esmMin = (fn, res) => () =>
|
|
8
|
+
var __esmMin = (fn, res, err) => () => {
|
|
9
|
+
if (err) throw err[0];
|
|
10
|
+
try {
|
|
11
|
+
return fn && (res = fn(fn = 0)), res;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
throw err = [e], e;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
9
16
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
17
|
var __exportAll = (all, no_symbols) => {
|
|
11
18
|
let target = {};
|
package/dist/stub.js
CHANGED
package/dist/withStorybook.d.ts
CHANGED
package/dist/withStorybook.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Bd6kNlEP.js");
|
|
3
|
+
const require_channelServer = require("./channelServer-D-IaG_dn.js");
|
|
4
|
+
const require_env_tools = require("./env-tools-Bo-isXVU.js");
|
|
5
5
|
let path = require("path");
|
|
6
|
-
path =
|
|
6
|
+
path = require_rolldown_runtime.__toESM(path);
|
|
7
7
|
let fs = require("fs");
|
|
8
|
-
fs =
|
|
8
|
+
fs = require_rolldown_runtime.__toESM(fs);
|
|
9
9
|
let storybook_internal_telemetry = require("storybook/internal/telemetry");
|
|
10
10
|
//#region src/enhanceMetroConfig.ts
|
|
11
11
|
function enhanceMetroConfig(config, options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "10.5.0
|
|
3
|
+
"version": "10.5.0",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"metro/**/*"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@storybook/mcp": "^0.
|
|
48
|
-
"@storybook/react": "^10.
|
|
49
|
-
"@storybook/react-native-theming": "10.5.0
|
|
50
|
-
"@storybook/react-native-ui": "10.5.0
|
|
51
|
-
"@storybook/react-native-ui-common": "10.5.0
|
|
52
|
-
"@tmcp/adapter-valibot": "^0.1.
|
|
53
|
-
"@tmcp/transport-http": "^0.8.
|
|
47
|
+
"@storybook/mcp": "^0.8.0",
|
|
48
|
+
"@storybook/react": "^10.5.0",
|
|
49
|
+
"@storybook/react-native-theming": "^10.5.0",
|
|
50
|
+
"@storybook/react-native-ui": "^10.5.0",
|
|
51
|
+
"@storybook/react-native-ui-common": "^10.5.0",
|
|
52
|
+
"@tmcp/adapter-valibot": "^0.1.6",
|
|
53
|
+
"@tmcp/transport-http": "^0.8.6",
|
|
54
54
|
"commander": "^14.0.2",
|
|
55
55
|
"dedent": "^1.7.2",
|
|
56
56
|
"deepmerge": "^4.3.1",
|
|
@@ -58,25 +58,26 @@
|
|
|
58
58
|
"glob": "^13.0.0",
|
|
59
59
|
"react-native-url-polyfill": "^3.0.0",
|
|
60
60
|
"setimmediate": "^1.0.5",
|
|
61
|
-
"tmcp": "^1.19.
|
|
62
|
-
"valibot": "^1.
|
|
63
|
-
"ws": "^8.
|
|
61
|
+
"tmcp": "^1.19.4",
|
|
62
|
+
"valibot": "^1.4.2",
|
|
63
|
+
"ws": "^8.21.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
+
"@babel/core": "^7.29.7",
|
|
66
67
|
"@react-native/jest-preset": "0.85.3",
|
|
67
68
|
"@types/jest": "^29.5.13",
|
|
68
69
|
"@types/react": "~19.2.14",
|
|
69
70
|
"babel-jest": "^29.7.0",
|
|
70
|
-
"babel-preset-expo": "^
|
|
71
|
+
"babel-preset-expo": "^57.0.2",
|
|
71
72
|
"jest": "^29.7.0",
|
|
72
|
-
"jest-expo": "~
|
|
73
|
-
"jotai": "^2.
|
|
73
|
+
"jest-expo": "~57.0.1",
|
|
74
|
+
"jotai": "^2.20.1",
|
|
74
75
|
"react": "19.2.3",
|
|
75
|
-
"react-native": "0.
|
|
76
|
-
"storybook": "^10.
|
|
76
|
+
"react-native": "0.86.0",
|
|
77
|
+
"storybook": "^10.5.0",
|
|
77
78
|
"sucrase": "^3.35.1",
|
|
78
79
|
"test-renderer": "^0.15.0",
|
|
79
|
-
"tsdown": "^0.22.
|
|
80
|
+
"tsdown": "^0.22.4",
|
|
80
81
|
"typescript": "~6.0.3"
|
|
81
82
|
},
|
|
82
83
|
"peerDependencies": {
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
const require_chunk = require("./chunk-Ble4zEEl.js");
|
|
2
|
-
let storybook_internal_preview_api = require("storybook/internal/preview-api");
|
|
3
|
-
let storybook_internal_csf = require("storybook/internal/csf");
|
|
4
|
-
let path = require("path");
|
|
5
|
-
path = require_chunk.__toESM(path);
|
|
6
|
-
let storybook_internal_common = require("storybook/internal/common");
|
|
7
|
-
let node_fs = require("node:fs");
|
|
8
|
-
let glob = require("glob");
|
|
9
|
-
let storybook_internal_csf_tools = require("storybook/internal/csf-tools");
|
|
10
|
-
//#region scripts/common.js
|
|
11
|
-
var require_common = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
|
|
12
|
-
const { globToRegexp } = require("storybook/internal/common");
|
|
13
|
-
const path$2 = require("path");
|
|
14
|
-
const fs = require("fs");
|
|
15
|
-
const cwd = process.cwd();
|
|
16
|
-
const toRequireContext = (specifier) => {
|
|
17
|
-
const { directory, files } = specifier;
|
|
18
|
-
const match = globToRegexp(`./${files}`);
|
|
19
|
-
return {
|
|
20
|
-
path: directory,
|
|
21
|
-
recursive: files.includes("**") || files.split("/").length > 1,
|
|
22
|
-
match
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
const supportedExtensions = [
|
|
26
|
-
"js",
|
|
27
|
-
"jsx",
|
|
28
|
-
"ts",
|
|
29
|
-
"tsx",
|
|
30
|
-
"cjs",
|
|
31
|
-
"mjs"
|
|
32
|
-
];
|
|
33
|
-
function getFilePathExtension({ configPath }, fileName) {
|
|
34
|
-
for (const ext of supportedExtensions) {
|
|
35
|
-
const filePath = path$2.resolve(cwd, configPath, `${fileName}.${ext}`);
|
|
36
|
-
if (fs.existsSync(filePath)) return ext;
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
function getFilePathWithExtension({ configPath }, fileName) {
|
|
41
|
-
for (const ext of supportedExtensions) {
|
|
42
|
-
const filePath = path$2.resolve(cwd, configPath, `${fileName}.${ext}`);
|
|
43
|
-
if (fs.existsSync(filePath)) return filePath;
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
function ensureRelativePathHasDot(relativePath) {
|
|
48
|
-
return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
49
|
-
}
|
|
50
|
-
function getPreviewExists({ configPath }) {
|
|
51
|
-
return !!getFilePathExtension({ configPath }, "preview");
|
|
52
|
-
}
|
|
53
|
-
function resolveAddonFile(addon, file, extensions = [
|
|
54
|
-
"js",
|
|
55
|
-
"mjs",
|
|
56
|
-
"ts"
|
|
57
|
-
], configPath) {
|
|
58
|
-
if (!addon || typeof addon !== "string") return null;
|
|
59
|
-
const resolvePaths = { paths: [cwd] };
|
|
60
|
-
try {
|
|
61
|
-
const basePath = `${addon}/${file}`;
|
|
62
|
-
require.resolve(basePath, resolvePaths);
|
|
63
|
-
return basePath;
|
|
64
|
-
} catch (_error) {}
|
|
65
|
-
for (const ext of extensions) try {
|
|
66
|
-
const filePath = `${addon}/${file}.${ext}`;
|
|
67
|
-
require.resolve(filePath, resolvePaths);
|
|
68
|
-
return filePath;
|
|
69
|
-
} catch (_error) {}
|
|
70
|
-
if (addon.startsWith("./") || addon.startsWith("../")) try {
|
|
71
|
-
if (getFilePathExtension({ configPath }, `${addon}/${file}`)) return `${addon}/${file}`;
|
|
72
|
-
} catch (_error) {}
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
function getAddonName(addon) {
|
|
76
|
-
if (typeof addon === "string") return addon;
|
|
77
|
-
if (typeof addon === "object" && addon.name && typeof addon.name === "string") return addon.name;
|
|
78
|
-
console.error("Invalid addon configuration", addon);
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
module.exports = {
|
|
82
|
-
toRequireContext,
|
|
83
|
-
getFilePathExtension,
|
|
84
|
-
ensureRelativePathHasDot,
|
|
85
|
-
getPreviewExists,
|
|
86
|
-
resolveAddonFile,
|
|
87
|
-
getAddonName,
|
|
88
|
-
getFilePathWithExtension
|
|
89
|
-
};
|
|
90
|
-
}));
|
|
91
|
-
//#endregion
|
|
92
|
-
//#region src/metro/buildIndex.ts
|
|
93
|
-
var buildIndex_exports = /* @__PURE__ */ require_chunk.__exportAll({ buildIndex: () => buildIndex });
|
|
94
|
-
var import_common = require_common();
|
|
95
|
-
const cwd = process.cwd();
|
|
96
|
-
const makeTitle = (fileName, specifier, userTitle) => {
|
|
97
|
-
const title = (0, storybook_internal_preview_api.userOrAutoTitleFromSpecifier)(fileName, specifier, userTitle);
|
|
98
|
-
if (title) return title.replace("./", "");
|
|
99
|
-
else if (userTitle) return userTitle.replace("./", "");
|
|
100
|
-
else {
|
|
101
|
-
console.error("Could not generate title!!");
|
|
102
|
-
process.exit(1);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
function ensureRelativePathHasDot(relativePath) {
|
|
106
|
-
return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
107
|
-
}
|
|
108
|
-
async function buildIndex({ configPath }) {
|
|
109
|
-
const main = await (0, storybook_internal_common.loadMainConfig)({
|
|
110
|
-
configDir: configPath,
|
|
111
|
-
cwd
|
|
112
|
-
});
|
|
113
|
-
if (!main.stories || !Array.isArray(main.stories)) throw new Error("No stories found");
|
|
114
|
-
const storiesSpecifiers = (0, storybook_internal_common.normalizeStories)(main.stories, {
|
|
115
|
-
configDir: configPath,
|
|
116
|
-
workingDir: cwd
|
|
117
|
-
});
|
|
118
|
-
const csfStories = storiesSpecifiers.map((specifier) => {
|
|
119
|
-
return (0, glob.sync)(specifier.files, {
|
|
120
|
-
cwd: path.default.resolve(process.cwd(), specifier.directory),
|
|
121
|
-
absolute: true,
|
|
122
|
-
ignore: ["**/node_modules"]
|
|
123
|
-
}).map((storyPath) => {
|
|
124
|
-
const normalizePathForWindows = (str) => path.default.sep === "\\" ? str.replace(/\\/g, "/") : str;
|
|
125
|
-
return normalizePathForWindows(storyPath);
|
|
126
|
-
});
|
|
127
|
-
}).reduce((acc, specifierStoryPathList, specifierIndex) => {
|
|
128
|
-
const paths = specifierStoryPathList.map((storyPath) => {
|
|
129
|
-
const code = (0, node_fs.readFileSync)(storyPath, { encoding: "utf-8" }).toString();
|
|
130
|
-
const relativePath = ensureRelativePathHasDot(path.default.posix.relative(cwd, storyPath));
|
|
131
|
-
return {
|
|
132
|
-
result: (0, storybook_internal_csf_tools.loadCsf)(code, {
|
|
133
|
-
fileName: storyPath,
|
|
134
|
-
makeTitle: (userTitle) => makeTitle(relativePath, storiesSpecifiers[specifierIndex], userTitle)
|
|
135
|
-
}).parse(),
|
|
136
|
-
specifier: storiesSpecifiers[specifierIndex],
|
|
137
|
-
fileName: relativePath
|
|
138
|
-
};
|
|
139
|
-
});
|
|
140
|
-
return [...acc, ...paths];
|
|
141
|
-
}, new Array());
|
|
142
|
-
const index = {
|
|
143
|
-
v: 5,
|
|
144
|
-
entries: {}
|
|
145
|
-
};
|
|
146
|
-
for (const { result, specifier, fileName } of csfStories) {
|
|
147
|
-
const { meta, stories } = result;
|
|
148
|
-
if (stories && stories.length > 0) for (const story of stories) {
|
|
149
|
-
const id = story.id ?? (0, storybook_internal_csf.toId)(meta.title, story.name);
|
|
150
|
-
if (!id) throw new Error(`Failed to generate id for story ${story.name} in file ${fileName}`);
|
|
151
|
-
index.entries[id] = {
|
|
152
|
-
type: "story",
|
|
153
|
-
subtype: "story",
|
|
154
|
-
id,
|
|
155
|
-
name: story.name,
|
|
156
|
-
title: meta.title,
|
|
157
|
-
importPath: `${specifier.directory}/${path.default.posix.relative(specifier.directory, fileName)}`,
|
|
158
|
-
tags: ["story"]
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
else console.log(`No stories found for ${fileName}`);
|
|
162
|
-
}
|
|
163
|
-
try {
|
|
164
|
-
const storySort = (0, storybook_internal_csf_tools.getStorySortParameter)((0, node_fs.readFileSync)((0, import_common.getFilePathWithExtension)({ configPath }, "preview"), { encoding: "utf-8" }).toString());
|
|
165
|
-
const sortableStories = Object.values(index.entries);
|
|
166
|
-
(0, storybook_internal_preview_api.sortStoriesV7)(sortableStories, storySort, sortableStories.map((entry) => entry.importPath));
|
|
167
|
-
return {
|
|
168
|
-
v: 5,
|
|
169
|
-
entries: sortableStories.reduce((acc, item) => {
|
|
170
|
-
acc[item.id] = item;
|
|
171
|
-
return acc;
|
|
172
|
-
}, {})
|
|
173
|
-
};
|
|
174
|
-
} catch {
|
|
175
|
-
console.warn("Failed to sort stories, using unordered index");
|
|
176
|
-
return index;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
//#endregion
|
|
180
|
-
Object.defineProperty(exports, "buildIndex", {
|
|
181
|
-
enumerable: true,
|
|
182
|
-
get: function() {
|
|
183
|
-
return buildIndex;
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
Object.defineProperty(exports, "buildIndex_exports", {
|
|
187
|
-
enumerable: true,
|
|
188
|
-
get: function() {
|
|
189
|
-
return buildIndex_exports;
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
Object.defineProperty(exports, "require_common", {
|
|
193
|
-
enumerable: true,
|
|
194
|
-
get: function() {
|
|
195
|
-
return require_common;
|
|
196
|
-
}
|
|
197
|
-
});
|