@storybook/react-native 7.6.17 → 7.6.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native",
3
- "version": "7.6.17",
3
+ "version": "7.6.18",
4
4
  "description": "A better way to develop React Native Components for your app",
5
5
  "keywords": [
6
6
  "react",
@@ -32,7 +32,7 @@
32
32
  "template/**/*"
33
33
  ],
34
34
  "scripts": {
35
- "dev": "ts-node ./buildscripts/gentsdev.ts && tsup --watch",
35
+ "dev": "ts-node ./buildscripts/gendtsdev.ts && tsup --watch",
36
36
  "prepare": "rm -rf dist/ && tsup",
37
37
  "test": "jest",
38
38
  "test:ci": "jest"
@@ -64,7 +64,7 @@
64
64
  "@storybook/preview-api": "^7.6.13",
65
65
  "@storybook/preview-web": "^7.6.13",
66
66
  "@storybook/react": "^7.6.13",
67
- "@storybook/react-native-theming": "^7.6.17",
67
+ "@storybook/react-native-theming": "^7.6.18",
68
68
  "chokidar": "^3.5.1",
69
69
  "commander": "^8.2.0",
70
70
  "dedent": "^1.5.1",
@@ -98,5 +98,5 @@
98
98
  "publishConfig": {
99
99
  "access": "public"
100
100
  },
101
- "gitHead": "eabc8e9dfc361faa0a7b1c7f08fe85b8cf37725b"
101
+ "gitHead": "00cfaa848e74361513c0ea2275f58eed267c35f1"
102
102
  }
@@ -219,3 +219,53 @@ import "@storybook/addon-ondevice-actions/register";
219
219
  export const view = global.view;
220
220
  "
221
221
  `;
222
+
223
+ exports[`loader writeRequires when using js writes the story imports without types 1`] = `
224
+ "
225
+ /* do not change this file, it is auto generated by storybook. */
226
+
227
+ import { start, prepareStories, getProjectAnnotations } from '@storybook/react-native';
228
+
229
+ import "@storybook/addon-ondevice-notes/register";
230
+ import "@storybook/addon-ondevice-controls/register";
231
+ import "@storybook/addon-ondevice-backgrounds/register";
232
+ import "@storybook/addon-ondevice-actions/register";
233
+
234
+ const normalizedStories = [{
235
+ titlePrefix: "",
236
+ directory: "./scripts/mocks/all-config-files",
237
+ files: "FakeStory.stories.tsx",
238
+ importPathMatcher: /^\\.[\\\\/](?:FakeStory\\.stories\\.tsx)$/,
239
+
240
+ req: require.context('./', false, /^\\.[\\\\/](?:FakeStory\\.stories\\.tsx)$/)
241
+ }];
242
+
243
+
244
+
245
+ const annotations = [require('./preview'),require("@storybook/react-native/dist/preview"), require('@storybook/addon-actions/preview')];
246
+
247
+ global.STORIES = normalizedStories;
248
+
249
+
250
+ module?.hot?.accept?.();
251
+
252
+ if (!global.view) {
253
+ global.view = start({
254
+ annotations,
255
+ storyEntries: normalizedStories
256
+ });
257
+ } else {
258
+ const { importMap } = prepareStories({ storyEntries: normalizedStories });
259
+
260
+ global.view._preview.onStoriesChanged({
261
+ importFn: async (importPath) => importMap[importPath],
262
+ });
263
+
264
+ global.view._preview.onGetProjectAnnotationsChanged({
265
+ getProjectAnnotations: getProjectAnnotations(global.view, annotations),
266
+ });
267
+ }
268
+
269
+ export const view = global.view;
270
+ "
271
+ `;
@@ -41,7 +41,7 @@ function generate({ configPath, absolute = false, useJs = false }) {
41
41
  directory: "${specifier.directory}",
42
42
  files: "${specifier.files}",
43
43
  importPathMatcher: /${reg.source}/,
44
- // @ts-ignore
44
+ ${useJs ? '' : '// @ts-ignore'}
45
45
  req: require.context('${pathToStory}', ${r}, ${m})
46
46
  }`;
47
47
  });
@@ -81,7 +81,7 @@ function generate({ configPath, absolute = false, useJs = false }) {
81
81
 
82
82
  global.STORIES = normalizedStories;
83
83
 
84
- // @ts-ignore
84
+ ${useJs ? '' : '// @ts-ignore'}
85
85
  module?.hot?.accept?.();
86
86
 
87
87
  if (!global.view) {
@@ -93,7 +93,7 @@ function generate({ configPath, absolute = false, useJs = false }) {
93
93
  const { importMap } = prepareStories({ storyEntries: normalizedStories });
94
94
 
95
95
  global.view._preview.onStoriesChanged({
96
- importFn: async (importPath: string) => importMap[importPath],
96
+ importFn: async (importPath${useJs ? '' : ': string'}) => importMap[importPath],
97
97
  });
98
98
 
99
99
  global.view._preview.onGetProjectAnnotationsChanged({
@@ -30,6 +30,16 @@ describe('loader', () => {
30
30
  });
31
31
  });
32
32
 
33
+ describe('when using js', () => {
34
+ it('writes the story imports without types', () => {
35
+ generate({ configPath: 'scripts/mocks/all-config-files', useJs: true });
36
+ expect(pathMock).toEqual(
37
+ path.resolve(__dirname, 'mocks/all-config-files/storybook.requires.js')
38
+ );
39
+ expect(fileContentMock).toMatchSnapshot();
40
+ });
41
+ });
42
+
33
43
  describe('when there are different file extensions', () => {
34
44
  it('writes the story imports', () => {
35
45
  generate({ configPath: 'scripts/mocks/file-extensions' });