@storybook/react-native 8.3.8 → 8.3.10-alpha.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.
@@ -5,9 +5,35 @@ const { WebSocketServer } = require('ws');
5
5
 
6
6
  module.exports = (
7
7
  config,
8
- { configPath, enabled = true, websockets, useJs = false } = { enabled: true, useJs: false }
8
+ { configPath, enabled = true, websockets, useJs = false, onDisabledRemoveStorybook = false } = {
9
+ enabled: true,
10
+ useJs: false,
11
+ onDisabledRemoveStorybook: false,
12
+ }
9
13
  ) => {
10
14
  if (!enabled) {
15
+ if (onDisabledRemoveStorybook) {
16
+ return {
17
+ ...config,
18
+ resolver: {
19
+ ...config.resolver,
20
+ resolveRequest: (context, moduleName, platform) => {
21
+ const resolveFunction = config?.resolver?.resolveRequest
22
+ ? config?.resolver?.resolveRequest
23
+ : context.resolveRequest;
24
+
25
+ if (moduleName.startsWith('storybook') || moduleName.startsWith('@storybook')) {
26
+ return {
27
+ type: 'empty',
28
+ };
29
+ }
30
+
31
+ return resolveFunction(context, moduleName, platform);
32
+ },
33
+ },
34
+ };
35
+ }
36
+
11
37
  return config;
12
38
  }
13
39
 
@@ -56,12 +82,15 @@ module.exports = (
56
82
  const isStorybookModule =
57
83
  moduleName.startsWith('storybook') || moduleName.startsWith('@storybook');
58
84
 
59
- if (isStorybookModule) {
60
- context.unstable_enablePackageExports = true;
61
- context.unstable_conditionNames = ['import'];
62
- }
85
+ const theContext = isStorybookModule
86
+ ? {
87
+ ...context,
88
+ unstable_enablePackageExports: true,
89
+ unstable_conditionNames: ['import'],
90
+ }
91
+ : context;
63
92
 
64
- const resolveResult = resolveFunction(context, moduleName, platform);
93
+ const resolveResult = resolveFunction(theContext, moduleName, platform);
65
94
 
66
95
  // workaround for template files with invalid imports
67
96
  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": "8.3.8",
3
+ "version": "8.3.10-alpha.0",
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.8",
47
- "@storybook/react-native-ui": "^8.3.8",
46
+ "@storybook/react-native-theming": "^8.3.10-alpha.0",
47
+ "@storybook/react-native-ui": "^8.3.10-alpha.0",
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": "8c7d02652d29dc2ba84a26362e5a45851d77f1a4"
85
+ "gitHead": "7abe94ef9ccc96fb583d8653a193ae0f3ca7c8a0"
86
86
  }
package/readme.md CHANGED
@@ -1,12 +1,10 @@
1
1
  # Storybook for React Native
2
2
 
3
3
  > [!IMPORTANT]
4
- > This readme is in the process of being updated for v8 which is not yet released to stable, for v7 docs see the [v7.6 docs](https://github.com/storybookjs/react-native/tree/v7.6.20-stable).
4
+ > This readme is for v8, for v7 docs see the [v7.6 docs](https://github.com/storybookjs/react-native/tree/v7.6.20-stable).
5
5
 
6
6
  With Storybook for React Native you can design and develop individual React Native components without running your app.
7
7
 
8
- This readme is for the 8.3.1 version, you can find the 7.6 docs [here](https://github.com/storybookjs/react-native/tree/v7.6.20-stable).
9
-
10
8
  If you are migrating from 7.6 to 8.3 you can find the migration guide [here](https://github.com/storybookjs/react-native/blob/next/MIGRATION.md#from-version-76x-to-83x)
11
9
 
12
10
  For more information about storybook visit: [storybook.js.org](https://storybook.js.org)
@@ -330,6 +328,13 @@ module.exports = withStorybook(defaultConfig, {
330
328
  });
331
329
  ```
332
330
 
331
+ #### onDisabledRemoveStorybook
332
+
333
+ Type: `boolean`, default: `false`
334
+
335
+ If onDisabledRemoveStorybook `true` and `enabled` is `false`, the storybook package will be removed from the build.
336
+ This is useful if you want to remove storybook from your production build.
337
+
333
338
  #### useJs
334
339
 
335
340
  Type: `boolean`, default: `false`