@storybook/react-native 10.4.5 → 10.4.6
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-D4z8ZcuA.js} +193 -6
- package/dist/{env-tools-CQ0w1x0Z.js → env-tools-D5ChBsme.js} +5 -5
- package/dist/index.d.ts +2 -4
- package/dist/index.js +18 -11
- package/dist/metro/withStorybook.d.ts +1 -1
- package/dist/metro/withStorybook.js +4 -4
- package/dist/node.js +3 -4
- package/dist/preview.js +1 -1
- package/dist/repack/withStorybook.d.ts +1 -1
- package/dist/repack/withStorybook.js +4 -4
- 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 -1
- package/dist/withStorybook.js +5 -5
- package/package.json +14 -14
- package/dist/buildIndex-l9rzAl79.js +0 -197
- /package/dist/{index-Dwx6-0Rh.d.ts → index-BX3DD1iT.d.ts} +0 -0
|
@@ -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,13 +248,12 @@ 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
|
]);
|
|
@@ -364,7 +539,7 @@ function createChannelServer({ port = 7007, host = void 0, configPath, experimen
|
|
|
364
539
|
}
|
|
365
540
|
if (req.method === "GET" && requestUrl.pathname === "/index.json") {
|
|
366
541
|
try {
|
|
367
|
-
const index = await
|
|
542
|
+
const index = await buildIndex({ configPath });
|
|
368
543
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
369
544
|
res.end(JSON.stringify(index));
|
|
370
545
|
} catch (error) {
|
|
@@ -466,9 +641,21 @@ function createChannelServer({ port = 7007, host = void 0, configPath, experimen
|
|
|
466
641
|
return wss;
|
|
467
642
|
}
|
|
468
643
|
//#endregion
|
|
644
|
+
Object.defineProperty(exports, "buildIndex", {
|
|
645
|
+
enumerable: true,
|
|
646
|
+
get: function() {
|
|
647
|
+
return buildIndex;
|
|
648
|
+
}
|
|
649
|
+
});
|
|
469
650
|
Object.defineProperty(exports, "createChannelServer", {
|
|
470
651
|
enumerable: true,
|
|
471
652
|
get: function() {
|
|
472
653
|
return createChannelServer;
|
|
473
654
|
}
|
|
474
655
|
});
|
|
656
|
+
Object.defineProperty(exports, "require_common", {
|
|
657
|
+
enumerable: true,
|
|
658
|
+
get: function() {
|
|
659
|
+
return require_common;
|
|
660
|
+
}
|
|
661
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Bd6kNlEP.js");
|
|
2
|
+
const require_channelServer = require("./channelServer-D4z8ZcuA.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,7 +1,5 @@
|
|
|
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";
|
|
@@ -80,7 +78,7 @@ declare class View {
|
|
|
80
78
|
_isSecureConnection: (params?: Partial<Params>) => any;
|
|
81
79
|
_getServerChannel: (params?: Partial<Params>) => Channel;
|
|
82
80
|
createPreparedStoryMapping: () => Promise<void>;
|
|
83
|
-
getStorybookUI: (params?: Partial<Params>) => () =>
|
|
81
|
+
getStorybookUI: (params?: Partial<Params>) => () => import("react/jsx-runtime").JSX.Element;
|
|
84
82
|
}
|
|
85
83
|
//#endregion
|
|
86
84
|
//#region src/prepareStories.d.ts
|
|
@@ -104,7 +102,7 @@ declare function prepareStories({
|
|
|
104
102
|
}): {
|
|
105
103
|
index: {
|
|
106
104
|
v: number;
|
|
107
|
-
entries: Record<string,
|
|
105
|
+
entries: Record<string, import("storybook/internal/types").IndexEntry>;
|
|
108
106
|
};
|
|
109
107
|
importMap: Record<string, any>;
|
|
110
108
|
};
|
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,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-D4z8ZcuA.js");
|
|
4
|
+
const require_env_tools = require("../env-tools-D5ChBsme.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
|
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-D4z8ZcuA.js");
|
|
4
|
+
exports.buildIndex = require_channelServer.buildIndex;
|
|
6
5
|
exports.createChannelServer = require_channelServer.createChannelServer;
|
package/dist/preview.js
CHANGED
|
@@ -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-D4z8ZcuA.js");
|
|
4
|
+
const require_env_tools = require("../env-tools-D5ChBsme.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();
|
|
@@ -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-D4z8ZcuA.js");
|
|
4
|
+
const require_env_tools = require("./env-tools-D5ChBsme.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.4.
|
|
3
|
+
"version": "10.4.6",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@storybook/mcp": "^0.7.0",
|
|
48
|
-
"@storybook/react": "^10.4.
|
|
49
|
-
"@storybook/react-native-theming": "^10.4.
|
|
50
|
-
"@storybook/react-native-ui": "^10.4.
|
|
51
|
-
"@storybook/react-native-ui-common": "^10.4.
|
|
52
|
-
"@tmcp/adapter-valibot": "^0.1.
|
|
53
|
-
"@tmcp/transport-http": "^0.8.
|
|
48
|
+
"@storybook/react": "^10.4.6",
|
|
49
|
+
"@storybook/react-native-theming": "^10.4.6",
|
|
50
|
+
"@storybook/react-native-ui": "^10.4.6",
|
|
51
|
+
"@storybook/react-native-ui-common": "^10.4.6",
|
|
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,25 @@
|
|
|
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.1",
|
|
63
|
+
"ws": "^8.21.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@react-native/jest-preset": "0.85.3",
|
|
67
67
|
"@types/jest": "^29.5.13",
|
|
68
68
|
"@types/react": "~19.2.14",
|
|
69
69
|
"babel-jest": "^29.7.0",
|
|
70
|
-
"babel-preset-expo": "^55.0.
|
|
70
|
+
"babel-preset-expo": "^55.0.22",
|
|
71
71
|
"jest": "^29.7.0",
|
|
72
72
|
"jest-expo": "~56.0.5",
|
|
73
|
-
"jotai": "^2.
|
|
73
|
+
"jotai": "^2.20.1",
|
|
74
74
|
"react": "19.2.3",
|
|
75
75
|
"react-native": "0.85.3",
|
|
76
|
-
"storybook": "^10.4.
|
|
76
|
+
"storybook": "^10.4.6",
|
|
77
77
|
"sucrase": "^3.35.1",
|
|
78
78
|
"test-renderer": "^0.15.0",
|
|
79
|
-
"tsdown": "^0.22.
|
|
79
|
+
"tsdown": "^0.22.3",
|
|
80
80
|
"typescript": "~6.0.3"
|
|
81
81
|
},
|
|
82
82
|
"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
|
-
});
|
|
File without changes
|