@storybook/react-native 8.4.4 → 8.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/index.d.ts +4 -1
- package/dist/metro/withStorybook.js +16 -4
- package/package.json +4 -4
- package/scripts/common.js +13 -0
- package/scripts/generate.js +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -90,7 +90,10 @@ declare function updateView(viewInstance: View, annotations: any[], normalizedSt
|
|
|
90
90
|
|
|
91
91
|
interface StorybookConfig {
|
|
92
92
|
stories: StorybookConfig$1['stories'];
|
|
93
|
-
addons: string
|
|
93
|
+
addons: Array<string | {
|
|
94
|
+
name: string;
|
|
95
|
+
options?: Record<string, any>;
|
|
96
|
+
}>;
|
|
94
97
|
reactNative?: ReactNativeOptions;
|
|
95
98
|
}
|
|
96
99
|
|
|
@@ -69,6 +69,8 @@ var require_common = __commonJS({
|
|
|
69
69
|
return !!getFilePathExtension({ configPath }, "preview");
|
|
70
70
|
}
|
|
71
71
|
function resolveAddonFile(addon, file, extensions = ["js", "mjs", "ts"], configPath) {
|
|
72
|
+
if (!addon || typeof addon !== "string")
|
|
73
|
+
return null;
|
|
72
74
|
try {
|
|
73
75
|
const basePath = `${addon}/${file}`;
|
|
74
76
|
require.resolve(basePath);
|
|
@@ -94,6 +96,14 @@ var require_common = __commonJS({
|
|
|
94
96
|
}
|
|
95
97
|
return null;
|
|
96
98
|
}
|
|
99
|
+
function getAddonName(addon) {
|
|
100
|
+
if (typeof addon === "string")
|
|
101
|
+
return addon;
|
|
102
|
+
if (typeof addon === "object" && addon.name && typeof addon.name === "string")
|
|
103
|
+
return addon.name;
|
|
104
|
+
console.error("Invalid addon configuration", addon);
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
97
107
|
module2.exports = {
|
|
98
108
|
toRequireContext,
|
|
99
109
|
requireUncached,
|
|
@@ -101,7 +111,8 @@ var require_common = __commonJS({
|
|
|
101
111
|
getMain,
|
|
102
112
|
ensureRelativePathHasDot,
|
|
103
113
|
getPreviewExists,
|
|
104
|
-
resolveAddonFile
|
|
114
|
+
resolveAddonFile,
|
|
115
|
+
getAddonName
|
|
105
116
|
};
|
|
106
117
|
}
|
|
107
118
|
});
|
|
@@ -114,7 +125,8 @@ var require_generate = __commonJS({
|
|
|
114
125
|
ensureRelativePathHasDot,
|
|
115
126
|
getMain,
|
|
116
127
|
getPreviewExists,
|
|
117
|
-
resolveAddonFile
|
|
128
|
+
resolveAddonFile,
|
|
129
|
+
getAddonName
|
|
118
130
|
} = require_common();
|
|
119
131
|
var { normalizeStories, globToRegexp } = require("@storybook/core/common");
|
|
120
132
|
var fs = require("fs");
|
|
@@ -149,7 +161,7 @@ var require_generate = __commonJS({
|
|
|
149
161
|
let registerAddons = "";
|
|
150
162
|
for (const addon of main.addons) {
|
|
151
163
|
const registerPath = resolveAddonFile(
|
|
152
|
-
addon,
|
|
164
|
+
getAddonName(addon),
|
|
153
165
|
"register",
|
|
154
166
|
["js", "mjs", "jsx", "ts", "tsx"],
|
|
155
167
|
configPath
|
|
@@ -163,7 +175,7 @@ var require_generate = __commonJS({
|
|
|
163
175
|
const enhancers = [docTools];
|
|
164
176
|
for (const addon of main.addons) {
|
|
165
177
|
const previewPath = resolveAddonFile(
|
|
166
|
-
addon,
|
|
178
|
+
getAddonName(addon),
|
|
167
179
|
"preview",
|
|
168
180
|
["js", "mjs", "jsx", "ts", "tsx"],
|
|
169
181
|
configPath
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.0",
|
|
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.1",
|
|
50
50
|
"@storybook/global": "^5.0.0",
|
|
51
51
|
"@storybook/react": "^8.4.2",
|
|
52
|
-
"@storybook/react-native-theming": "^8.
|
|
53
|
-
"@storybook/react-native-ui": "^8.
|
|
52
|
+
"@storybook/react-native-theming": "^8.5.0",
|
|
53
|
+
"@storybook/react-native-ui": "^8.5.0",
|
|
54
54
|
"chokidar": "^3.5.1",
|
|
55
55
|
"commander": "^8.2.0",
|
|
56
56
|
"dedent": "^1.5.1",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "5292e1959c39de86d179f1341dd9941efe549b76"
|
|
95
95
|
}
|
package/scripts/common.js
CHANGED
|
@@ -59,6 +59,8 @@ function getPreviewExists({ configPath }) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
function resolveAddonFile(addon, file, extensions = ['js', 'mjs', 'ts'], configPath) {
|
|
62
|
+
if (!addon || typeof addon !== 'string') return null;
|
|
63
|
+
|
|
62
64
|
try {
|
|
63
65
|
const basePath = `${addon}/${file}`;
|
|
64
66
|
|
|
@@ -91,6 +93,16 @@ function resolveAddonFile(addon, file, extensions = ['js', 'mjs', 'ts'], configP
|
|
|
91
93
|
return null;
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
function getAddonName(addon) {
|
|
97
|
+
if (typeof addon === 'string') return addon;
|
|
98
|
+
|
|
99
|
+
if (typeof addon === 'object' && addon.name && typeof addon.name === 'string') return addon.name;
|
|
100
|
+
|
|
101
|
+
console.error('Invalid addon configuration', addon);
|
|
102
|
+
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
94
106
|
module.exports = {
|
|
95
107
|
toRequireContext,
|
|
96
108
|
requireUncached,
|
|
@@ -99,4 +111,5 @@ module.exports = {
|
|
|
99
111
|
ensureRelativePathHasDot,
|
|
100
112
|
getPreviewExists,
|
|
101
113
|
resolveAddonFile,
|
|
114
|
+
getAddonName,
|
|
102
115
|
};
|
package/scripts/generate.js
CHANGED
|
@@ -4,6 +4,7 @@ const {
|
|
|
4
4
|
getMain,
|
|
5
5
|
getPreviewExists,
|
|
6
6
|
resolveAddonFile,
|
|
7
|
+
getAddonName,
|
|
7
8
|
} = require('./common');
|
|
8
9
|
const { normalizeStories, globToRegexp } = require('@storybook/core/common');
|
|
9
10
|
const fs = require('fs');
|
|
@@ -51,7 +52,7 @@ function generate({ configPath, absolute = false, useJs = false }) {
|
|
|
51
52
|
|
|
52
53
|
for (const addon of main.addons) {
|
|
53
54
|
const registerPath = resolveAddonFile(
|
|
54
|
-
addon,
|
|
55
|
+
getAddonName(addon),
|
|
55
56
|
'register',
|
|
56
57
|
['js', 'mjs', 'jsx', 'ts', 'tsx'],
|
|
57
58
|
configPath
|
|
@@ -68,7 +69,7 @@ function generate({ configPath, absolute = false, useJs = false }) {
|
|
|
68
69
|
|
|
69
70
|
for (const addon of main.addons) {
|
|
70
71
|
const previewPath = resolveAddonFile(
|
|
71
|
-
addon,
|
|
72
|
+
getAddonName(addon),
|
|
72
73
|
'preview',
|
|
73
74
|
['js', 'mjs', 'jsx', 'ts', 'tsx'],
|
|
74
75
|
configPath
|