@storybook/angular 8.6.0-beta.3 → 8.6.0-beta.5

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.
@@ -96,6 +96,7 @@ class AbstractRenderer {
96
96
  this.storyProps$ = newStoryProps$;
97
97
  this.initAngularRootElement(targetDOMNode, targetSelector);
98
98
  const analyzedMetadata = new PropertyExtractor_1.PropertyExtractor(storyFnAngular.moduleMetadata, component);
99
+ await analyzedMetadata.init();
99
100
  const storyUid = this.generateStoryUIdFromRawStoryUid(targetDOMNode.getAttribute(exports.STORY_UID_ATTRIBUTE));
100
101
  const componentSelector = storyUid !== null ? `${targetSelector}[${storyUid}]` : targetSelector;
101
102
  if (storyUid !== null) {
@@ -74,6 +74,7 @@ const PropertyExtractor_1 = require("./utils/PropertyExtractor");
74
74
  localFunction: () => 'localFunction',
75
75
  };
76
76
  const analyzedMetadata = new PropertyExtractor_1.PropertyExtractor({}, FooComponent);
77
+ await analyzedMetadata.init();
77
78
  const application = (0, StorybookModule_1.getApplication)({
78
79
  storyFnAngular: { props },
79
80
  component: FooComponent,
@@ -102,6 +103,7 @@ const PropertyExtractor_1 = require("./utils/PropertyExtractor");
102
103
  },
103
104
  };
104
105
  const analyzedMetadata = new PropertyExtractor_1.PropertyExtractor({}, FooComponent);
106
+ await analyzedMetadata.init();
105
107
  const application = (0, StorybookModule_1.getApplication)({
106
108
  storyFnAngular: { props },
107
109
  component: FooComponent,
@@ -125,6 +127,7 @@ const PropertyExtractor_1 = require("./utils/PropertyExtractor");
125
127
  };
126
128
  const storyProps$ = new rxjs_1.BehaviorSubject(initialProps);
127
129
  const analyzedMetadata = new PropertyExtractor_1.PropertyExtractor({}, FooComponent);
130
+ await analyzedMetadata.init();
128
131
  const application = (0, StorybookModule_1.getApplication)({
129
132
  storyFnAngular: { props: initialProps },
130
133
  component: FooComponent,
@@ -165,6 +168,7 @@ const PropertyExtractor_1 = require("./utils/PropertyExtractor");
165
168
  };
166
169
  const storyProps$ = new rxjs_1.BehaviorSubject(initialProps);
167
170
  const analyzedMetadata = new PropertyExtractor_1.PropertyExtractor({}, FooComponent);
171
+ await analyzedMetadata.init();
168
172
  const application = (0, StorybookModule_1.getApplication)({
169
173
  storyFnAngular: { props: initialProps },
170
174
  component: FooComponent,
@@ -200,6 +204,7 @@ const PropertyExtractor_1 = require("./utils/PropertyExtractor");
200
204
  };
201
205
  const storyProps$ = new rxjs_1.BehaviorSubject(initialProps);
202
206
  const analyzedMetadata = new PropertyExtractor_1.PropertyExtractor({}, FooComponent);
207
+ await analyzedMetadata.init();
203
208
  const application = (0, StorybookModule_1.getApplication)({
204
209
  storyFnAngular: {
205
210
  props: initialProps,
@@ -231,6 +236,7 @@ const PropertyExtractor_1 = require("./utils/PropertyExtractor");
231
236
  };
232
237
  const storyProps$ = new rxjs_1.BehaviorSubject(initialProps);
233
238
  const analyzedMetadata = new PropertyExtractor_1.PropertyExtractor({}, FooComponent);
239
+ await analyzedMetadata.init();
234
240
  const application = (0, StorybookModule_1.getApplication)({
235
241
  storyFnAngular: { props: initialProps },
236
242
  component: FooComponent,
@@ -262,6 +268,7 @@ const PropertyExtractor_1 = require("./utils/PropertyExtractor");
262
268
  (0, vitest_1.it)('should display the component', async () => {
263
269
  const props = {};
264
270
  const analyzedMetadata = new PropertyExtractor_1.PropertyExtractor({ entryComponents: [WithoutSelectorComponent] }, WithoutSelectorComponent);
271
+ await analyzedMetadata.init();
265
272
  const application = (0, StorybookModule_1.getApplication)({
266
273
  storyFnAngular: {
267
274
  props,
@@ -289,6 +296,7 @@ const PropertyExtractor_1 = require("./utils/PropertyExtractor");
289
296
  })
290
297
  ], FooComponent);
291
298
  const analyzedMetadata = new PropertyExtractor_1.PropertyExtractor({}, FooComponent);
299
+ await analyzedMetadata.init();
292
300
  const application = (0, StorybookModule_1.getApplication)({
293
301
  storyFnAngular: { template: '' },
294
302
  component: FooComponent,
@@ -12,7 +12,7 @@ export declare class PropertyExtractor implements NgModuleMetadata {
12
12
  applicationProviders?: Array<Provider | ReturnType<typeof importProvidersFrom>>;
13
13
  constructor(metadata: NgModuleMetadata, component?: any | undefined);
14
14
  static warnImportsModuleWithProviders(propertyExtractor: PropertyExtractor): void;
15
- private init;
15
+ init(): Promise<void>;
16
16
  /**
17
17
  * Analyze NgModule Metadata
18
18
  *
@@ -21,7 +21,7 @@ export declare class PropertyExtractor implements NgModuleMetadata {
21
21
  * - Returns a new NgModuleMetadata object
22
22
  */
23
23
  private analyzeMetadata;
24
- static analyzeRestricted: (ngModule: NgModule) => [boolean] | [boolean, Provider];
24
+ static analyzeRestricted: (ngModule: NgModule) => Promise<[boolean] | [boolean, Provider]>;
25
25
  static analyzeDecorators: (component: any) => {
26
26
  isDeclarable: boolean;
27
27
  isStandalone: any;
@@ -1,11 +1,43 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var _a;
3
36
  Object.defineProperty(exports, "__esModule", { value: true });
4
37
  exports.PropertyExtractor = exports.uniqueArray = exports.REMOVED_MODULES = exports.reflectionCapabilities = void 0;
5
38
  const common_1 = require("@angular/common");
6
39
  const core_1 = require("@angular/core");
7
40
  const platform_browser_1 = require("@angular/platform-browser");
8
- const animations_1 = require("@angular/platform-browser/animations");
9
41
  const ts_dedent_1 = require("ts-dedent");
10
42
  const NgModulesAnalyzer_1 = require("./NgModulesAnalyzer");
11
43
  exports.reflectionCapabilities = new core_1.ɵReflectionCapabilities();
@@ -31,24 +63,20 @@ class PropertyExtractor {
31
63
  * - Extracts providers from ModuleWithProviders
32
64
  * - Returns a new NgModuleMetadata object
33
65
  */
34
- this.analyzeMetadata = (metadata) => {
66
+ this.analyzeMetadata = async (metadata) => {
35
67
  const declarations = [...(metadata?.declarations || [])];
36
68
  const providers = [...(metadata?.providers || [])];
37
69
  const applicationProviders = [];
38
- const imports = [...(metadata?.imports || [])].reduce((acc, imported) => {
39
- // remove ngModule and use only its providers if it is restricted
40
- // (e.g. BrowserModule, BrowserAnimationsModule, NoopAnimationsModule, ...etc)
41
- const [isRestricted, restrictedProviders] = _a.analyzeRestricted(imported);
70
+ const imports = await Promise.all([...(metadata?.imports || [])].map(async (imported) => {
71
+ const [isRestricted, restrictedProviders] = await _a.analyzeRestricted(imported);
42
72
  if (isRestricted) {
43
73
  applicationProviders.unshift(restrictedProviders || []);
44
- return acc;
74
+ return null;
45
75
  }
46
- acc.push(imported);
47
- return acc;
48
- }, []);
76
+ return imported;
77
+ })).then((results) => results.filter(Boolean));
49
78
  return { ...metadata, imports, providers, applicationProviders, declarations };
50
79
  };
51
- this.init();
52
80
  }
53
81
  // With the new way of mounting standalone components to the DOM via bootstrapApplication API,
54
82
  // we should now pass ModuleWithProviders to the providers array of the bootstrapApplication function.
@@ -64,8 +92,8 @@ class PropertyExtractor {
64
92
  `));
65
93
  }
66
94
  }
67
- init() {
68
- const analyzed = this.analyzeMetadata(this.metadata);
95
+ async init() {
96
+ const analyzed = await this.analyzeMetadata(this.metadata);
69
97
  this.imports = (0, exports.uniqueArray)([common_1.CommonModule, analyzed.imports]);
70
98
  this.providers = (0, exports.uniqueArray)(analyzed.providers);
71
99
  this.applicationProviders = (0, exports.uniqueArray)(analyzed.applicationProviders);
@@ -84,7 +112,7 @@ class PropertyExtractor {
84
112
  }
85
113
  exports.PropertyExtractor = PropertyExtractor;
86
114
  _a = PropertyExtractor;
87
- PropertyExtractor.analyzeRestricted = (ngModule) => {
115
+ PropertyExtractor.analyzeRestricted = async (ngModule) => {
88
116
  if (ngModule === platform_browser_1.BrowserModule) {
89
117
  console.warn((0, ts_dedent_1.dedent) `
90
118
  Storybook Warning:
@@ -95,27 +123,33 @@ PropertyExtractor.analyzeRestricted = (ngModule) => {
95
123
  `);
96
124
  return [true];
97
125
  }
98
- if (ngModule === animations_1.BrowserAnimationsModule) {
99
- console.warn((0, ts_dedent_1.dedent) `
100
- Storybook Warning:
101
- You have added the "BrowserAnimationsModule" to the list of "imports" in your moduleMetadata definition of your Story.
102
- In Storybook 7.0 we use Angular's new 'bootstrapApplication' API to mount the component to the DOM, which accepts a list of providers to set up application-wide providers.
103
- Use the 'applicationConfig' decorator from '@storybook/angular' and add the "provideAnimations" function to the list of "providers".
104
- If your Angular version does not support "provide-like" functions, use the helper function importProvidersFrom instead to set up animations. For this case, please add "importProvidersFrom(BrowserAnimationsModule)" to the list of providers of your applicationConfig definition.
105
- Please visit https://angular.io/guide/standalone-components#configuring-dependency-injection for more information.
106
- `);
107
- return [true, (0, animations_1.provideAnimations)()];
126
+ try {
127
+ const animations = await Promise.resolve().then(() => __importStar(require('@angular/platform-browser/animations')));
128
+ if (ngModule === animations.BrowserAnimationsModule) {
129
+ console.warn((0, ts_dedent_1.dedent) `
130
+ Storybook Warning:
131
+ You have added the "BrowserAnimationsModule" to the list of "imports" in your moduleMetadata definition of your Story.
132
+ In Storybook 7.0 we use Angular's new 'bootstrapApplication' API to mount the component to the DOM, which accepts a list of providers to set up application-wide providers.
133
+ Use the 'applicationConfig' decorator from '@storybook/angular' and add the "provideAnimations" function to the list of "providers".
134
+ If your Angular version does not support "provide-like" functions, use the helper function importProvidersFrom instead to set up animations. For this case, please add "importProvidersFrom(BrowserAnimationsModule)" to the list of providers of your applicationConfig definition.
135
+ Please visit https://angular.io/guide/standalone-components#configuring-dependency-injection for more information.
136
+ `);
137
+ return [true, animations.provideAnimations()];
138
+ }
139
+ if (ngModule === animations.NoopAnimationsModule) {
140
+ console.warn((0, ts_dedent_1.dedent) `
141
+ Storybook Warning:
142
+ You have added the "NoopAnimationsModule" to the list of "imports" in your moduleMetadata definition of your Story.
143
+ In Storybook v7.0 we are using Angular's new bootstrapApplication API to mount an Angular application to the DOM, which accepts a list of providers to set up application-wide providers.
144
+ Use the 'applicationConfig' decorator from '@storybook/angular' and add the "provideNoopAnimations" function to the list of "providers".
145
+ If your Angular version does not support "provide-like" functions, use the helper function importProvidersFrom instead to set up noop animations and to extract all necessary providers from NoopAnimationsModule. For this case, please add "importProvidersFrom(NoopAnimationsModule)" to the list of providers of your applicationConfig definition.
146
+ Please visit https://angular.io/guide/standalone-components#configuring-dependency-injection for more information.
147
+ `);
148
+ return [true, animations.provideNoopAnimations()];
149
+ }
108
150
  }
109
- if (ngModule === animations_1.NoopAnimationsModule) {
110
- console.warn((0, ts_dedent_1.dedent) `
111
- Storybook Warning:
112
- You have added the "NoopAnimationsModule" to the list of "imports" in your moduleMetadata definition of your Story.
113
- In Storybook v7.0 we are using Angular's new bootstrapApplication API to mount an Angular application to the DOM, which accepts a list of providers to set up application-wide providers.
114
- Use the 'applicationConfig' decorator from '@storybook/angular' and add the "provideNoopAnimations" function to the list of "providers".
115
- If your Angular version does not support "provide-like" functions, use the helper function importProvidersFrom instead to set up noop animations and to extract all necessary providers from NoopAnimationsModule. For this case, please add "importProvidersFrom(NoopAnimationsModule)" to the list of providers of your applicationConfig definition.
116
- Please visit https://angular.io/guide/standalone-components#configuring-dependency-injection for more information.
117
- `);
118
- return [true, (0, animations_1.provideNoopAnimations)()];
151
+ catch (e) {
152
+ return [false];
119
153
  }
120
154
  return [false];
121
155
  };
@@ -32,81 +32,87 @@ const TestModuleWithImportsAndProviders = (0, core_1.NgModule)({
32
32
  providers: [TestTokenProvider],
33
33
  })(class {
34
34
  });
35
- const analyzeMetadata = (metadata, component) => {
36
- return new PropertyExtractor_1.PropertyExtractor(metadata, component);
35
+ const analyzeMetadata = async (metadata, component) => {
36
+ const propertyExtractor = new PropertyExtractor_1.PropertyExtractor(metadata, component);
37
+ await propertyExtractor.init();
38
+ return propertyExtractor;
37
39
  };
38
- const extractImports = (metadata, component) => {
39
- const { imports } = new PropertyExtractor_1.PropertyExtractor(metadata, component);
40
- return imports;
40
+ const extractImports = async (metadata, component) => {
41
+ const propertyExtractor = new PropertyExtractor_1.PropertyExtractor(metadata, component);
42
+ await propertyExtractor.init();
43
+ return propertyExtractor.imports;
41
44
  };
42
- const extractDeclarations = (metadata, component) => {
43
- const { declarations } = new PropertyExtractor_1.PropertyExtractor(metadata, component);
44
- return declarations;
45
+ const extractDeclarations = async (metadata, component) => {
46
+ const propertyExtractor = new PropertyExtractor_1.PropertyExtractor(metadata, component);
47
+ await propertyExtractor.init();
48
+ return propertyExtractor.declarations;
45
49
  };
46
- const extractProviders = (metadata, component) => {
47
- const { providers } = new PropertyExtractor_1.PropertyExtractor(metadata, component);
48
- return providers;
50
+ const extractProviders = async (metadata, component) => {
51
+ const propertyExtractor = new PropertyExtractor_1.PropertyExtractor(metadata, component);
52
+ await propertyExtractor.init();
53
+ return propertyExtractor.providers;
49
54
  };
50
- const extractApplicationProviders = (metadata, component) => {
51
- const { applicationProviders } = new PropertyExtractor_1.PropertyExtractor(metadata, component);
52
- return applicationProviders;
55
+ const extractApplicationProviders = async (metadata, component) => {
56
+ const propertyExtractor = new PropertyExtractor_1.PropertyExtractor(metadata, component);
57
+ await propertyExtractor.init();
58
+ return propertyExtractor.applicationProviders;
53
59
  };
54
60
  (0, vitest_1.describe)('PropertyExtractor', () => {
55
61
  vitest_1.vi.spyOn(console, 'warn').mockImplementation(() => { });
56
62
  (0, vitest_1.describe)('analyzeMetadata', () => {
57
- (0, vitest_1.it)('should remove BrowserModule', () => {
63
+ (0, vitest_1.it)('should remove BrowserModule', async () => {
58
64
  const metadata = {
59
65
  imports: [platform_browser_1.BrowserModule],
60
66
  };
61
- const { imports, providers, applicationProviders } = analyzeMetadata(metadata);
67
+ const { imports, providers, applicationProviders } = await analyzeMetadata(metadata);
62
68
  (0, vitest_1.expect)(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
63
69
  (0, vitest_1.expect)(providers.flat(Number.MAX_VALUE)).toEqual([]);
64
70
  (0, vitest_1.expect)(applicationProviders.flat(Number.MAX_VALUE)).toEqual([]);
65
71
  });
66
- (0, vitest_1.it)('should remove BrowserAnimationsModule and use its providers instead', () => {
72
+ (0, vitest_1.it)('should remove BrowserAnimationsModule and use its providers instead', async () => {
67
73
  const metadata = {
68
74
  imports: [animations_1.BrowserAnimationsModule],
69
75
  };
70
- const { imports, providers, applicationProviders } = analyzeMetadata(metadata);
76
+ const { imports, providers, applicationProviders } = await analyzeMetadata(metadata);
71
77
  (0, vitest_1.expect)(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
72
78
  (0, vitest_1.expect)(providers.flat(Number.MAX_VALUE)).toEqual([]);
73
79
  (0, vitest_1.expect)(applicationProviders.flat(Number.MAX_VALUE)).toEqual((0, animations_1.provideAnimations)());
74
80
  });
75
- (0, vitest_1.it)('should remove NoopAnimationsModule and use its providers instead', () => {
81
+ (0, vitest_1.it)('should remove NoopAnimationsModule and use its providers instead', async () => {
76
82
  const metadata = {
77
83
  imports: [animations_1.NoopAnimationsModule],
78
84
  };
79
- const { imports, providers, applicationProviders } = analyzeMetadata(metadata);
85
+ const { imports, providers, applicationProviders } = await analyzeMetadata(metadata);
80
86
  (0, vitest_1.expect)(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
81
87
  (0, vitest_1.expect)(providers.flat(Number.MAX_VALUE)).toEqual([]);
82
88
  (0, vitest_1.expect)(applicationProviders.flat(Number.MAX_VALUE)).toEqual((0, animations_1.provideNoopAnimations)());
83
89
  });
84
- (0, vitest_1.it)('should remove Browser/Animations modules recursively', () => {
90
+ (0, vitest_1.it)('should remove Browser/Animations modules recursively', async () => {
85
91
  const metadata = {
86
92
  imports: [animations_1.BrowserAnimationsModule, platform_browser_1.BrowserModule],
87
93
  };
88
- const { imports, providers, applicationProviders } = analyzeMetadata(metadata);
94
+ const { imports, providers, applicationProviders } = await analyzeMetadata(metadata);
89
95
  (0, vitest_1.expect)(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
90
96
  (0, vitest_1.expect)(providers.flat(Number.MAX_VALUE)).toEqual([]);
91
97
  (0, vitest_1.expect)(applicationProviders.flat(Number.MAX_VALUE)).toEqual((0, animations_1.provideAnimations)());
92
98
  });
93
- (0, vitest_1.it)('should not destructure Angular official module', () => {
99
+ (0, vitest_1.it)('should not destructure Angular official module', async () => {
94
100
  const metadata = {
95
101
  imports: [test_module_1.WithOfficialModule],
96
102
  };
97
- const { imports, providers, applicationProviders } = analyzeMetadata(metadata);
103
+ const { imports, providers, applicationProviders } = await analyzeMetadata(metadata);
98
104
  (0, vitest_1.expect)(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule, test_module_1.WithOfficialModule]);
99
105
  (0, vitest_1.expect)(providers.flat(Number.MAX_VALUE)).toEqual([]);
100
106
  (0, vitest_1.expect)(applicationProviders.flat(Number.MAX_VALUE)).toEqual([]);
101
107
  });
102
108
  });
103
109
  (0, vitest_1.describe)('extractImports', () => {
104
- (0, vitest_1.it)('should return Angular official modules', () => {
105
- const imports = extractImports({ imports: [TestModuleWithImportsAndProviders] });
110
+ (0, vitest_1.it)('should return Angular official modules', async () => {
111
+ const imports = await extractImports({ imports: [TestModuleWithImportsAndProviders] });
106
112
  (0, vitest_1.expect)(imports).toEqual([common_1.CommonModule, TestModuleWithImportsAndProviders]);
107
113
  });
108
- (0, vitest_1.it)('should return standalone components', () => {
109
- const imports = extractImports({
114
+ (0, vitest_1.it)('should return standalone components', async () => {
115
+ const imports = await extractImports({
110
116
  imports: [TestModuleWithImportsAndProviders],
111
117
  }, StandaloneTestComponent);
112
118
  (0, vitest_1.expect)(imports).toEqual([
@@ -115,8 +121,8 @@ const extractApplicationProviders = (metadata, component) => {
115
121
  StandaloneTestComponent,
116
122
  ]);
117
123
  });
118
- (0, vitest_1.it)('should return standalone directives', () => {
119
- const imports = extractImports({
124
+ (0, vitest_1.it)('should return standalone directives', async () => {
125
+ const imports = await extractImports({
120
126
  imports: [TestModuleWithImportsAndProviders],
121
127
  }, StandaloneTestDirective);
122
128
  (0, vitest_1.expect)(imports).toEqual([
@@ -127,8 +133,8 @@ const extractApplicationProviders = (metadata, component) => {
127
133
  });
128
134
  });
129
135
  (0, vitest_1.describe)('extractDeclarations', () => {
130
- (0, vitest_1.it)('should return an array of declarations that contains `storyComponent`', () => {
131
- const declarations = extractDeclarations({ declarations: [TestComponent1] }, TestComponent2);
136
+ (0, vitest_1.it)('should return an array of declarations that contains `storyComponent`', async () => {
137
+ const declarations = await extractDeclarations({ declarations: [TestComponent1] }, TestComponent2);
132
138
  (0, vitest_1.expect)(declarations).toEqual([TestComponent1, TestComponent2]);
133
139
  });
134
140
  });
@@ -155,14 +161,14 @@ const extractApplicationProviders = (metadata, component) => {
155
161
  });
156
162
  });
157
163
  (0, vitest_1.describe)('extractProviders', () => {
158
- (0, vitest_1.it)('should return an array of providers', () => {
159
- const providers = extractProviders({
164
+ (0, vitest_1.it)('should return an array of providers', async () => {
165
+ const providers = await extractProviders({
160
166
  providers: [TestService],
161
167
  });
162
168
  (0, vitest_1.expect)(providers).toEqual([TestService]);
163
169
  });
164
- (0, vitest_1.it)('should return an array of singletons extracted', () => {
165
- const singeltons = extractApplicationProviders({
170
+ (0, vitest_1.it)('should return an array of singletons extracted', async () => {
171
+ const singeltons = await extractApplicationProviders({
166
172
  imports: [animations_1.BrowserAnimationsModule],
167
173
  });
168
174
  (0, vitest_1.expect)(singeltons).toEqual((0, animations_1.provideAnimations)());
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.webpackFinal = webpackFinal;
4
37
  const node_logger_1 = require("storybook/internal/node-logger");
@@ -30,6 +63,14 @@ async function webpackFinal(baseConfig, options) {
30
63
  experimentalZoneless: builderOptions.experimentalZoneless,
31
64
  }),
32
65
  }));
66
+ try {
67
+ await Promise.resolve().then(() => __importStar(require('@angular/platform-browser/animations')));
68
+ }
69
+ catch (e) {
70
+ webpackConfig.plugins.push(new builder_webpack5_1.WebpackIgnorePlugin({
71
+ resourceRegExp: /@angular\/platform-browser\/animations$/,
72
+ }));
73
+ }
33
74
  return webpackConfig;
34
75
  }
35
76
  /** Get Builder Context If storybook is not start by angular builder create dumb BuilderContext */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "8.6.0-beta.3",
3
+ "version": "8.6.0-beta.5",
4
4
  "description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -53,13 +53,13 @@
53
53
  "prep": "rimraf dist && jiti ../../../scripts/prepare/tsc.ts"
54
54
  },
55
55
  "dependencies": {
56
- "@storybook/builder-webpack5": "8.6.0-beta.3",
57
- "@storybook/components": "8.6.0-beta.3",
58
- "@storybook/core-webpack": "8.6.0-beta.3",
56
+ "@storybook/builder-webpack5": "8.6.0-beta.5",
57
+ "@storybook/components": "8.6.0-beta.5",
58
+ "@storybook/core-webpack": "8.6.0-beta.5",
59
59
  "@storybook/global": "^5.0.0",
60
- "@storybook/manager-api": "8.6.0-beta.3",
61
- "@storybook/preview-api": "8.6.0-beta.3",
62
- "@storybook/theming": "8.6.0-beta.3",
60
+ "@storybook/manager-api": "8.6.0-beta.5",
61
+ "@storybook/preview-api": "8.6.0-beta.5",
62
+ "@storybook/theming": "8.6.0-beta.5",
63
63
  "@types/react": "^18.0.37",
64
64
  "@types/react-dom": "^18.0.11",
65
65
  "@types/semver": "^7.3.4",
@@ -101,6 +101,7 @@
101
101
  "@angular-devkit/architect": ">=0.1500.0 < 0.2000.0",
102
102
  "@angular-devkit/build-angular": ">=15.0.0 < 20.0.0",
103
103
  "@angular-devkit/core": ">=15.0.0 < 20.0.0",
104
+ "@angular/animations": ">=15.0.0 < 20.0.0",
104
105
  "@angular/cli": ">=15.0.0 < 20.0.0",
105
106
  "@angular/common": ">=15.0.0 < 20.0.0",
106
107
  "@angular/compiler": ">=15.0.0 < 20.0.0",
@@ -110,11 +111,14 @@
110
111
  "@angular/platform-browser": ">=15.0.0 < 20.0.0",
111
112
  "@angular/platform-browser-dynamic": ">=15.0.0 < 20.0.0",
112
113
  "rxjs": "^6.0.0 || ^7.4.0",
113
- "storybook": "^8.6.0-beta.3",
114
+ "storybook": "^8.6.0-beta.5",
114
115
  "typescript": "^4.0.0 || ^5.0.0",
115
116
  "zone.js": ">= 0.11.1 < 1.0.0"
116
117
  },
117
118
  "peerDependenciesMeta": {
119
+ "@angular/animations": {
120
+ "optional": true
121
+ },
118
122
  "@angular/cli": {
119
123
  "optional": true
120
124
  },