33exports [` loader writeRequires when there are different file extensions writes the story imports 1` ] = `
44"
55 /* do not change this file, it is auto generated by storybook. */
6-
7- import { start } from '@storybook/react-native';
6+
7+ import { start , prepareStories , getProjectAnnotations } from '@storybook/react-native';
88
99 import "@storybook/addon-ondevice-notes/register";
1010import "@storybook/addon-ondevice-controls/register";
@@ -18,23 +18,48 @@ import "@storybook/addon-ondevice-actions/register";
1818 importPathMatcher : / ^ \\ . [\\\\ /] (?:FakeStory\\ . stories\\ . tsx)$ / ,
1919 // @ts-ignore
2020 req : require .context (' ./' , false , / ^ \\ . [\\\\ /] (?:FakeStory\\ . stories\\ . tsx)$ / )
21- } ]
21+ } ];
2222
23- // @ts-ignore
24- global.STORIES = normalizedStories;
23+
24+ declare global {
25+ var view : ReturnType < typeof start > ;
26+ var STORIES : typeof normalizedStories ;
27+ }
28+
29+
30+ const annotations = [require('./preview'),require("@storybook/react-native/dist/preview"), require('@storybook/addon-actions/preview')];
2531
26- export const view = start({
27- annotations : [require (' ./preview' ),require (" @storybook/react-native/dist/preview" ), require (' @storybook/addon-actions/preview' )],
28- storyEntries : normalizedStories
29- } );
32+ global.STORIES = normalizedStories;
33+
34+ // @ts-ignore
35+ module?.hot?.accept?.();
36+
37+ if (!global.view) {
38+ global .view = start ({
39+ annotations ,
40+ storyEntries: normalizedStories
41+ });
42+ } else {
43+ const { importMap } = prepareStories ({ storyEntries: normalizedStories });
44+
45+ global .view ._preview .onStoriesChanged ({
46+ importFn : async (importPath : string ) => importMap [importPath ],
47+ });
48+
49+ global .view ._preview .onGetProjectAnnotationsChanged ({
50+ getProjectAnnotations: getProjectAnnotations (global .view , annotations ),
51+ });
52+ }
53+
54+ export const view = global.view;
3055"
3156` ;
3257
3358exports [` loader writeRequires when there is a configuration object writes the story imports 1` ] = `
3459"
3560 /* do not change this file, it is auto generated by storybook. */
36-
37- import { start } from '@storybook/react-native';
61+
62+ import { start , prepareStories , getProjectAnnotations } from '@storybook/react-native';
3863
3964 import "@storybook/addon-ondevice-notes/register";
4065import "@storybook/addon-ondevice-controls/register";
@@ -48,23 +73,48 @@ import "@storybook/addon-ondevice-actions/register";
4873 importPathMatcher : / ^ \\ . (?:(?:^ | \\ /| (?:(?:(?!(?:^ | \\ /)\\ . ). )*? )\\ /)(?!\\ . )(?=. )[^ /] *? \\ . stories\\ . tsx)$ / ,
4974 // @ts-ignore
5075 req : require .context (' ./components' , true , / ^ \\ . (?:(?:^ | \\ /| (?:(?:(?!(?:^ | \\ /)\\ . ). )*? )\\ /)(?!\\ . )(?=. )[^ /] *? \\ . stories\\ . tsx)$ / )
51- } ]
76+ } ];
5277
53- // @ts-ignore
54- global.STORIES = normalizedStories;
78+
79+ declare global {
80+ var view : ReturnType < typeof start > ;
81+ var STORIES : typeof normalizedStories ;
82+ }
83+
84+
85+ const annotations = [require('./preview'),require("@storybook/react-native/dist/preview"), require('@storybook/addon-actions/preview')];
5586
56- export const view = start({
57- annotations : [require (' ./preview' ),require (" @storybook/react-native/dist/preview" ), require (' @storybook/addon-actions/preview' )],
58- storyEntries : normalizedStories
59- } );
87+ global.STORIES = normalizedStories;
88+
89+ // @ts-ignore
90+ module?.hot?.accept?.();
91+
92+ if (!global.view) {
93+ global .view = start ({
94+ annotations ,
95+ storyEntries: normalizedStories
96+ });
97+ } else {
98+ const { importMap } = prepareStories ({ storyEntries: normalizedStories });
99+
100+ global .view ._preview .onStoriesChanged ({
101+ importFn : async (importPath : string ) => importMap [importPath ],
102+ });
103+
104+ global .view ._preview .onGetProjectAnnotationsChanged ({
105+ getProjectAnnotations: getProjectAnnotations (global .view , annotations ),
106+ });
107+ }
108+
109+ export const view = global.view;
60110"
61111` ;
62112
63113exports [` loader writeRequires when there is a story glob writes the story imports 1` ] = `
64114"
65115 /* do not change this file, it is auto generated by storybook. */
66-
67- import { start } from '@storybook/react-native';
116+
117+ import { start , prepareStories , getProjectAnnotations } from '@storybook/react-native';
68118
69119 import "@storybook/addon-ondevice-notes/register";
70120import "@storybook/addon-ondevice-controls/register";
@@ -78,23 +128,48 @@ import "@storybook/addon-ondevice-actions/register";
78128 importPathMatcher : / ^ \\ . [\\\\ /] (?:FakeStory\\ . stories\\ . tsx)$ / ,
79129 // @ts-ignore
80130 req : require .context (' ./' , false , / ^ \\ . [\\\\ /] (?:FakeStory\\ . stories\\ . tsx)$ / )
81- } ]
131+ } ];
82132
83- // @ts-ignore
84- global.STORIES = normalizedStories;
133+
134+ declare global {
135+ var view : ReturnType < typeof start > ;
136+ var STORIES : typeof normalizedStories ;
137+ }
138+
139+
140+ const annotations = [require('./preview'),require("@storybook/react-native/dist/preview"), require('@storybook/addon-actions/preview')];
85141
86- export const view = start({
87- annotations : [require (' ./preview' ),require (" @storybook/react-native/dist/preview" ), require (' @storybook/addon-actions/preview' )],
88- storyEntries : normalizedStories
89- } );
142+ global.STORIES = normalizedStories;
143+
144+ // @ts-ignore
145+ module?.hot?.accept?.();
146+
147+ if (!global.view) {
148+ global .view = start ({
149+ annotations ,
150+ storyEntries: normalizedStories
151+ });
152+ } else {
153+ const { importMap } = prepareStories ({ storyEntries: normalizedStories });
154+
155+ global .view ._preview .onStoriesChanged ({
156+ importFn : async (importPath : string ) => importMap [importPath ],
157+ });
158+
159+ global .view ._preview .onGetProjectAnnotationsChanged ({
160+ getProjectAnnotations: getProjectAnnotations (global .view , annotations ),
161+ });
162+ }
163+
164+ export const view = global.view;
90165"
91166` ;
92167
93168exports [` loader writeRequires when there is no preview does not add preview related stuff 1` ] = `
94169"
95170 /* do not change this file, it is auto generated by storybook. */
96-
97- import { start } from '@storybook/react-native';
171+
172+ import { start , prepareStories , getProjectAnnotations } from '@storybook/react-native';
98173
99174 import "@storybook/addon-ondevice-notes/register";
100175import "@storybook/addon-ondevice-controls/register";
@@ -108,14 +183,39 @@ import "@storybook/addon-ondevice-actions/register";
108183 importPathMatcher : / ^ \\ . [\\\\ /] (?:FakeStory\\ . stories\\ . tsx)$ / ,
109184 // @ts-ignore
110185 req : require .context (' ./' , false , / ^ \\ . [\\\\ /] (?:FakeStory\\ . stories\\ . tsx)$ / )
111- } ]
186+ } ];
112187
113- // @ts-ignore
114- global.STORIES = normalizedStories;
188+
189+ declare global {
190+ var view : ReturnType < typeof start > ;
191+ var STORIES : typeof normalizedStories ;
192+ }
193+
194+
195+ const annotations = [require("@storybook/react-native/dist/preview"), require('@storybook/addon-actions/preview')];
115196
116- export const view = start({
117- annotations : [require (" @storybook/react-native/dist/preview" ), require (' @storybook/addon-actions/preview' )],
118- storyEntries : normalizedStories
119- } );
197+ global.STORIES = normalizedStories;
198+
199+ // @ts-ignore
200+ module?.hot?.accept?.();
201+
202+ if (!global.view) {
203+ global .view = start ({
204+ annotations ,
205+ storyEntries: normalizedStories
206+ });
207+ } else {
208+ const { importMap } = prepareStories ({ storyEntries: normalizedStories });
209+
210+ global .view ._preview .onStoriesChanged ({
211+ importFn : async (importPath : string ) => importMap [importPath ],
212+ });
213+
214+ global .view ._preview .onGetProjectAnnotationsChanged ({
215+ getProjectAnnotations: getProjectAnnotations (global .view , annotations ),
216+ });
217+ }
218+
219+ export const view = global.view;
120220"
121221` ;
0 commit comments