@storybook/react-native 8.0.0-alpha.0 → 8.0.0-alpha.1

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.
@@ -1079,6 +1079,7 @@ interface CLIOptions {
1079
1079
  test?: boolean;
1080
1080
  debugWebpack?: boolean;
1081
1081
  webpackStatsJson?: string | boolean;
1082
+ statsJson?: string | boolean;
1082
1083
  outputDir?: string;
1083
1084
  }
1084
1085
  interface BuilderOptions {
@@ -1210,10 +1211,6 @@ interface StorybookConfigRaw {
1210
1211
  * Filter args with a "target" on the type from the render function (EXPERIMENTAL)
1211
1212
  */
1212
1213
  argTypeTargetsV7?: boolean;
1213
- /**
1214
- * Use legacy MDX1, to help smooth migration to 7.0
1215
- */
1216
- legacyMdx1?: boolean;
1217
1214
  /**
1218
1215
  * Apply decorators from preview.js before decorators from addons or frameworks
1219
1216
  */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as StoryIndex, P as PreparedStory, N as NormalizedStoriesSpecifier, a as StorybookConfig$1 } from './index.d-b039fbf0.js';
1
+ import { S as StoryIndex, P as PreparedStory, N as NormalizedStoriesSpecifier, a as StorybookConfig$1 } from './index.d-ab512c60.js';
2
2
  import { Theme } from '@storybook/react-native-theming';
3
3
  export { Theme, darkTheme, theme } from '@storybook/react-native-theming';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
package/dist/index.js CHANGED
@@ -1248,12 +1248,26 @@ var ErrorBoundary = class extends import_react4.default.Component {
1248
1248
  static getDerivedStateFromError(_error) {
1249
1249
  return { hasError: true };
1250
1250
  }
1251
- componentDidCatch(error, errorInfo) {
1252
- console.warn(error, errorInfo);
1251
+ componentDidCatch(error, info) {
1252
+ this.props.onError(error, info.componentStack);
1253
1253
  }
1254
1254
  render() {
1255
1255
  if (this.state.hasError) {
1256
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { children: "Something went wrong rendering your story" });
1256
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1257
+ import_react_native3.View,
1258
+ {
1259
+ style: {
1260
+ margin: 16,
1261
+ padding: 16,
1262
+ borderColor: "red",
1263
+ borderWidth: 2,
1264
+ alignItems: "center",
1265
+ justifyContent: "center",
1266
+ borderRadius: 4
1267
+ },
1268
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: { fontWeight: "bold" }, children: "Something went wrong rendering your story" })
1269
+ }
1270
+ );
1257
1271
  }
1258
1272
  return this.props.children;
1259
1273
  }
@@ -1277,7 +1291,15 @@ var StoryView = () => {
1277
1291
  style: { flex: 1, backgroundColor },
1278
1292
  testID: id,
1279
1293
  onStartShouldSetResponder: dismissOnStartResponder,
1280
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorBoundary, { children: StoryComponent && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StoryComponent, { ...context }) })
1294
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1295
+ ErrorBoundary,
1296
+ {
1297
+ onError: () => {
1298
+ console.log(`Error rendering story for ${context.title} ${context.name}`);
1299
+ },
1300
+ children: StoryComponent && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StoryComponent, { ...context })
1301
+ }
1302
+ )
1281
1303
  },
1282
1304
  id
1283
1305
  );
@@ -1995,7 +2017,7 @@ function getHost(hostname) {
1995
2017
  // src/View.tsx
1996
2018
  var import_jsx_runtime16 = require("react/jsx-runtime");
1997
2019
  var STORAGE_KEY = "lastOpenedStory";
1998
- var View10 = class {
2020
+ var View11 = class {
1999
2021
  _storyIndex;
2000
2022
  _setStory = () => {
2001
2023
  };
@@ -2065,7 +2087,6 @@ var View10 = class {
2065
2087
  this._idToPrepared[storyId] = await this._preview.loadStory({ storyId });
2066
2088
  })
2067
2089
  );
2068
- console.log("Storybook: Finished building story index");
2069
2090
  };
2070
2091
  getStorybookUI = (params = {}) => {
2071
2092
  const {
@@ -2272,6 +2293,7 @@ function start({
2272
2293
  },
2273
2294
  showStoryDuringRender: () => {
2274
2295
  }
2296
+ // TODO what happened to this type?
2275
2297
  };
2276
2298
  const selectionStore = {
2277
2299
  selection: null,
@@ -2305,7 +2327,7 @@ function start({
2305
2327
  selectionStore,
2306
2328
  previewView
2307
2329
  );
2308
- const view = new View10(preview, channel);
2330
+ const view = new View11(preview, channel);
2309
2331
  if (global) {
2310
2332
  global.__STORYBOOK_ADDONS_CHANNEL__ = channel;
2311
2333
  global.__STORYBOOK_PREVIEW__ = preview;
package/dist/preview.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _storybook_docs_tools from '@storybook/docs-tools';
2
- import { R as Renderer, b as StoryContextForEnhancers, A as Args, c as StrictArgTypes } from './index.d-b039fbf0.js';
2
+ import { R as Renderer, b as StoryContextForEnhancers, A as Args, c as StrictArgTypes } from './index.d-ab512c60.js';
3
3
  import 'file-system-cache';
4
4
  import 'http';
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native",
3
- "version": "8.0.0-alpha.0",
3
+ "version": "8.0.0-alpha.1",
4
4
  "description": "A better way to develop React Native Components for your app",
5
5
  "keywords": [
6
6
  "react",
@@ -34,7 +34,8 @@
34
34
  "scripts": {
35
35
  "dev": "ts-node ./buildscripts/gentsdev.ts && tsup --watch",
36
36
  "prepare": "rm -rf dist/ && tsup",
37
- "test": "jest"
37
+ "test": "jest",
38
+ "test:ci": "jest"
38
39
  },
39
40
  "jest": {
40
41
  "modulePathIgnorePatterns": [
@@ -51,17 +52,17 @@
51
52
  "preset": "react-native"
52
53
  },
53
54
  "dependencies": {
54
- "@storybook/channels": "8.0.0-alpha.15",
55
- "@storybook/client-logger": "8.0.0-alpha.15",
56
- "@storybook/core-common": "8.0.0-alpha.15",
57
- "@storybook/core-events": "8.0.0-alpha.15",
55
+ "@storybook/channels": "8.0.0-rc.1",
56
+ "@storybook/client-logger": "8.0.0-rc.1",
57
+ "@storybook/core-common": "8.0.0-rc.1",
58
+ "@storybook/core-events": "8.0.0-rc.1",
58
59
  "@storybook/csf": "^0.1.1",
59
- "@storybook/docs-tools": "8.0.0-alpha.15",
60
+ "@storybook/docs-tools": "8.0.0-rc.1",
60
61
  "@storybook/global": "^5.0.0",
61
- "@storybook/manager-api": "8.0.0-alpha.15",
62
- "@storybook/preview-api": "8.0.0-alpha.15",
63
- "@storybook/react": "8.0.0-alpha.15",
64
- "@storybook/react-native-theming": "^8.0.0-alpha.0",
62
+ "@storybook/manager-api": "8.0.0-rc.1",
63
+ "@storybook/preview-api": "8.0.0-rc.1",
64
+ "@storybook/react": "8.0.0-rc.1",
65
+ "@storybook/react-native-theming": "^8.0.0-alpha.1",
65
66
  "chokidar": "^3.5.1",
66
67
  "commander": "^8.2.0",
67
68
  "dedent": "^1.5.1",
@@ -73,11 +74,11 @@
73
74
  "util": "^0.12.4"
74
75
  },
75
76
  "devDependencies": {
76
- "@storybook/types": "8.0.0-alpha.15",
77
+ "@storybook/types": "8.0.0-rc.1",
77
78
  "@types/jest": "^29.4.3",
78
79
  "@types/react": "~18.2.14",
79
80
  "babel-jest": "^29.4.3",
80
- "jest": "^29.4.3",
81
+ "jest": "^29.7.0",
81
82
  "jotai": "^2.6.2",
82
83
  "react-test-renderer": "18.2.0",
83
84
  "ts-node": "^10.9.1",
@@ -95,5 +96,5 @@
95
96
  "publishConfig": {
96
97
  "access": "public"
97
98
  },
98
- "gitHead": "14ffe40751c45e03046117bec794fb4e34c56418"
99
+ "gitHead": "1865884a1c866ff61bacd82d02fdc18e845e4132"
99
100
  }
@@ -9,12 +9,7 @@ function getArguments() {
9
9
  './.storybook'
10
10
  )
11
11
  .option('-js, --use-js', 'Use a js file for storybook.requires')
12
- .option('-a, --absolute', 'Use absolute paths for story imports')
13
- .option('-v6, --v6-store', 'Use v6 store, for storiesof compatibility')
14
- .option(
15
- '-rc, --v6-require-context',
16
- 'When using v6 store should use require.context to load stories'
17
- );
12
+ .option('-a, --absolute', 'Use absolute paths for story imports');
18
13
 
19
14
  program.parse();
20
15
 
@@ -6,6 +6,15 @@ const { writeRequires, getMain, getFilePathExtension } = require('./loader');
6
6
  const { getArguments } = require('./handle-args');
7
7
 
8
8
  const args = getArguments();
9
+
10
+ if (!args.v6Store) {
11
+ console.log(
12
+ "in v7 you don't need the watcher anymore, if you are using v6 compat mode then pass the -v6 flag"
13
+ );
14
+
15
+ process.exit(0);
16
+ }
17
+
9
18
  const log = console.log.bind(console);
10
19
 
11
20
  const mainExt = getFilePathExtension(args, 'main');
@@ -17,6 +26,8 @@ if (previewExt) {
17
26
  watchPaths.push(`./preview.${previewExt}`);
18
27
  }
19
28
 
29
+ console.log(watchPaths);
30
+
20
31
  const updateRequires = (event, watchPath) => {
21
32
  if (typeof watchPath === 'string') {
22
33
  log(`event ${event} for file ${path.basename(watchPath)}`);
@@ -25,6 +36,14 @@ const updateRequires = (event, watchPath) => {
25
36
  };
26
37
 
27
38
  const globs = getMain(args).stories;
39
+ // directory
40
+ // files
41
+ const globsStrings = globs.map((g) => {
42
+ if (typeof g === 'string') return g;
43
+ if (g.directory && g.files) {
44
+ return `${g.directory}/${g.files}`;
45
+ }
46
+ });
28
47
 
29
48
  chokidar
30
49
  .watch(watchPaths, { cwd: args.configPath })
@@ -33,7 +52,7 @@ chokidar
33
52
  let isReady = false;
34
53
 
35
54
  chokidar
36
- .watch(globs, { cwd: args.configPath })
55
+ .watch(globsStrings, { cwd: args.configPath })
37
56
  .on('ready', () => {
38
57
  log('Watcher is ready, performing initial write');
39
58
  writeRequires(args);