@storybook/react-native 8.3.10-alpha.0 → 8.3.10-alpha.2
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.js +2 -1
- package/metro/withStorybook.d.ts +72 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { InputConfigT } from 'metro-config';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for configuring WebSockets used for syncing storybook instances or sending events to storybook.
|
|
5
|
+
*/
|
|
6
|
+
interface WebsocketsOptions {
|
|
7
|
+
/**
|
|
8
|
+
* The port WebSocket server will listen on. Defaults to 7007.
|
|
9
|
+
*/
|
|
10
|
+
port?: number;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The host WebSocket server will bind to. Defaults to 'localhost'.
|
|
14
|
+
*/
|
|
15
|
+
host?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Options for configuring Storybook with React Native.
|
|
20
|
+
*/
|
|
21
|
+
interface WithStorybookOptions {
|
|
22
|
+
/**
|
|
23
|
+
* The path to the Storybook config folder. Defaults to './.storybook'.
|
|
24
|
+
*/
|
|
25
|
+
configPath?: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Whether Storybook is enabled. Defaults to true.
|
|
29
|
+
*/
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* WebSocket configuration for syncing storybook instances or sending events to storybook.
|
|
34
|
+
*/
|
|
35
|
+
websockets?: WebsocketsOptions;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Whether to use JavaScript files for Storybook configuration instead of TypeScript. Defaults to false.
|
|
39
|
+
*/
|
|
40
|
+
useJs?: boolean;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* If enabled is false and onDisabledRemoveStorybook is true, we will attempt to remove storybook from the js bundle.
|
|
44
|
+
*/
|
|
45
|
+
onDisabledRemoveStorybook?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Configures Metro bundler to work with Storybook in React Native.
|
|
50
|
+
* This function wraps a Metro configuration to enable Storybook usage.
|
|
51
|
+
*
|
|
52
|
+
* @param config - The Metro bundler configuration to be modified.
|
|
53
|
+
* @param options - Options to customize the Storybook configuration.
|
|
54
|
+
* @returns The modified Metro configuration.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* const { getDefaultConfig } = require('expo/metro-config');
|
|
58
|
+
* const withStorybook = require('@storybook/react-native/metro/withStorybook');
|
|
59
|
+
* const path = require('path');
|
|
60
|
+
*
|
|
61
|
+
* const projectRoot = __dirname;
|
|
62
|
+
* const config = getDefaultConfig(projectRoot);
|
|
63
|
+
*
|
|
64
|
+
* module.exports = withStorybook(config, {
|
|
65
|
+
* enabled: true,
|
|
66
|
+
* configPath: path.resolve(projectRoot, './.storybook'),
|
|
67
|
+
* websockets: { port: 7007, host: 'localhost' },
|
|
68
|
+
* useJs: false,
|
|
69
|
+
* onDisabledRemoveStorybook: true,
|
|
70
|
+
* });
|
|
71
|
+
*/
|
|
72
|
+
export function withStorybook(config: InputConfigT, options?: WithStorybookOptions): InputConfigT;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "8.3.10-alpha.
|
|
3
|
+
"version": "8.3.10-alpha.2",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@storybook/csf": "^0.1.1",
|
|
44
44
|
"@storybook/global": "^5.0.0",
|
|
45
45
|
"@storybook/react": "^8.3.5",
|
|
46
|
-
"@storybook/react-native-theming": "^8.3.10-alpha.
|
|
47
|
-
"@storybook/react-native-ui": "^8.3.10-alpha.
|
|
46
|
+
"@storybook/react-native-theming": "^8.3.10-alpha.2",
|
|
47
|
+
"@storybook/react-native-ui": "^8.3.10-alpha.2",
|
|
48
48
|
"chokidar": "^3.5.1",
|
|
49
49
|
"commander": "^8.2.0",
|
|
50
50
|
"dedent": "^1.5.1",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "2567b9a4d11a77d9b5bf74dd699ad49fb47afa5b"
|
|
86
86
|
}
|