@storybook/react-native 9.0.0-beta.10 → 9.0.0-beta.12
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/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/metro/withStorybook.d.ts +5 -0
- package/dist/metro/withStorybook.js +18 -8
- package/package.json +5 -5
- package/scripts/generate.js +7 -3
- package/scripts/handle-args.js +1 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1109,6 +1109,8 @@ var View3 = class {
|
|
|
1109
1109
|
story,
|
|
1110
1110
|
storyHash,
|
|
1111
1111
|
setStory: (newStoryId) => self._channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId }),
|
|
1112
|
+
storage,
|
|
1113
|
+
theme: appliedTheme,
|
|
1112
1114
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StoryView_default, {})
|
|
1113
1115
|
}
|
|
1114
1116
|
);
|
|
@@ -37,6 +37,10 @@ interface WithStorybookOptions {
|
|
|
37
37
|
* If enabled is false and onDisabledRemoveStorybook is true, we will attempt to remove storybook from the js bundle.
|
|
38
38
|
*/
|
|
39
39
|
onDisabledRemoveStorybook?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to include doc tools in the storybook.requires file. Defaults to true.
|
|
42
|
+
*/
|
|
43
|
+
docTools?: boolean;
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
42
46
|
* Configures Metro bundler to work with Storybook in React Native.
|
|
@@ -59,6 +63,7 @@ interface WithStorybookOptions {
|
|
|
59
63
|
* configPath: path.resolve(projectRoot, './.rnstorybook'),
|
|
60
64
|
* websockets: { port: 7007, host: 'localhost' },
|
|
61
65
|
* useJs: false,
|
|
66
|
+
* docTools: true,
|
|
62
67
|
* onDisabledRemoveStorybook: true,
|
|
63
68
|
* });
|
|
64
69
|
*/
|
|
@@ -132,7 +132,12 @@ var require_generate = __commonJS({
|
|
|
132
132
|
var fs = require("fs");
|
|
133
133
|
var path2 = require("path");
|
|
134
134
|
var cwd = process.cwd();
|
|
135
|
-
function generate2({
|
|
135
|
+
function generate2({
|
|
136
|
+
configPath,
|
|
137
|
+
/* absolute = false, */
|
|
138
|
+
useJs = false,
|
|
139
|
+
docTools = true
|
|
140
|
+
}) {
|
|
136
141
|
const storybookRequiresLocation = path2.resolve(
|
|
137
142
|
cwd,
|
|
138
143
|
configPath,
|
|
@@ -170,8 +175,11 @@ var require_generate = __commonJS({
|
|
|
170
175
|
`;
|
|
171
176
|
}
|
|
172
177
|
}
|
|
173
|
-
const
|
|
174
|
-
const enhancers = [
|
|
178
|
+
const docToolsAnnotation = 'require("@storybook/react-native/preview")';
|
|
179
|
+
const enhancers = [];
|
|
180
|
+
if (docTools) {
|
|
181
|
+
enhancers.push(docToolsAnnotation);
|
|
182
|
+
}
|
|
175
183
|
for (const addon of main.addons) {
|
|
176
184
|
const previewPath = resolveAddonFile(
|
|
177
185
|
getAddonName(addon),
|
|
@@ -254,14 +262,16 @@ var import_ws = require("ws");
|
|
|
254
262
|
function withStorybook(config, options = {
|
|
255
263
|
enabled: true,
|
|
256
264
|
useJs: false,
|
|
257
|
-
onDisabledRemoveStorybook: false
|
|
265
|
+
onDisabledRemoveStorybook: false,
|
|
266
|
+
docTools: true
|
|
258
267
|
}) {
|
|
259
268
|
const {
|
|
260
269
|
configPath,
|
|
261
270
|
enabled = true,
|
|
262
271
|
websockets,
|
|
263
272
|
useJs = false,
|
|
264
|
-
onDisabledRemoveStorybook = false
|
|
273
|
+
onDisabledRemoveStorybook = false,
|
|
274
|
+
docTools = true
|
|
265
275
|
} = options;
|
|
266
276
|
if (!enabled) {
|
|
267
277
|
if (onDisabledRemoveStorybook) {
|
|
@@ -302,7 +312,8 @@ function withStorybook(config, options = {
|
|
|
302
312
|
}
|
|
303
313
|
(0, import_generate.generate)({
|
|
304
314
|
configPath: configPath ?? path.resolve(process.cwd(), "./.rnstorybook"),
|
|
305
|
-
useJs
|
|
315
|
+
useJs,
|
|
316
|
+
docTools
|
|
306
317
|
});
|
|
307
318
|
return {
|
|
308
319
|
...config,
|
|
@@ -317,8 +328,7 @@ function withStorybook(config, options = {
|
|
|
317
328
|
const isStorybookModule = moduleName.startsWith("storybook") || moduleName.startsWith("@storybook");
|
|
318
329
|
const theContext = isStorybookModule ? {
|
|
319
330
|
...context,
|
|
320
|
-
unstable_enablePackageExports: true
|
|
321
|
-
unstable_conditionNames: ["import"]
|
|
331
|
+
unstable_enablePackageExports: true
|
|
322
332
|
} : context;
|
|
323
333
|
const resolveResult = resolveFunction(theContext, moduleName, platform);
|
|
324
334
|
if (resolveResult?.filePath?.includes?.("@storybook/react/template/cli")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "9.0.0-beta.
|
|
3
|
+
"version": "9.0.0-beta.12",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@storybook/csf": "^0.1.13",
|
|
50
50
|
"@storybook/global": "^5.0.0",
|
|
51
51
|
"@storybook/react": "9.0.0-beta.10",
|
|
52
|
-
"@storybook/react-native-theming": "^9.0.0-beta.
|
|
53
|
-
"@storybook/react-native-ui": "^9.0.0-beta.
|
|
52
|
+
"@storybook/react-native-theming": "^9.0.0-beta.12",
|
|
53
|
+
"@storybook/react-native-ui": "^9.0.0-beta.12",
|
|
54
54
|
"commander": "^8.2.0",
|
|
55
55
|
"dedent": "^1.5.1",
|
|
56
56
|
"deepmerge": "^4.3.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"babel-jest": "^29.7.0",
|
|
67
67
|
"babel-preset-expo": "^12.0.9",
|
|
68
68
|
"jest": "^29.7.0",
|
|
69
|
-
"jest-expo": "~53.0.
|
|
69
|
+
"jest-expo": "~53.0.5",
|
|
70
70
|
"jotai": "^2.6.2",
|
|
71
71
|
"react": "19.0.0",
|
|
72
72
|
"react-native": "0.79.2",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "17adc32f6748dc2db35bfaa0b7662ba784c78a95"
|
|
93
93
|
}
|
package/scripts/generate.js
CHANGED
|
@@ -13,7 +13,7 @@ const path = require('path');
|
|
|
13
13
|
|
|
14
14
|
const cwd = process.cwd();
|
|
15
15
|
|
|
16
|
-
function generate({ configPath, absolute = false, useJs = false }) {
|
|
16
|
+
function generate({ configPath, /* absolute = false, */ useJs = false, docTools = true }) {
|
|
17
17
|
const storybookRequiresLocation = path.resolve(
|
|
18
18
|
cwd,
|
|
19
19
|
configPath,
|
|
@@ -63,9 +63,13 @@ function generate({ configPath, absolute = false, useJs = false }) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
const
|
|
66
|
+
const docToolsAnnotation = 'require("@storybook/react-native/preview")';
|
|
67
67
|
|
|
68
|
-
const enhancers = [
|
|
68
|
+
const enhancers = [];
|
|
69
|
+
|
|
70
|
+
if (docTools) {
|
|
71
|
+
enhancers.push(docToolsAnnotation);
|
|
72
|
+
}
|
|
69
73
|
|
|
70
74
|
for (const addon of main.addons) {
|
|
71
75
|
const previewPath = resolveAddonFile(
|
package/scripts/handle-args.js
CHANGED
|
@@ -9,6 +9,7 @@ function getArguments() {
|
|
|
9
9
|
'./.rnstorybook'
|
|
10
10
|
)
|
|
11
11
|
.option('-js, --use-js', 'Use a js file for storybook.requires')
|
|
12
|
+
.option('-D, --no-doc-tools', 'Do not include doc tools in the storybook.requires file')
|
|
12
13
|
.option('-a, --absolute', 'Use absolute paths for story imports');
|
|
13
14
|
|
|
14
15
|
program.parse();
|