@storybook/angular 8.2.0-alpha.3 → 8.2.0-alpha.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.
@@ -130,7 +130,11 @@ PropertyExtractor.analyzeDecorators = (component) => {
130
130
  const isDirective = decorators.some((d) => _a.isDecoratorInstanceOf(d, 'Directive'));
131
131
  const isPipe = decorators.some((d) => _a.isDecoratorInstanceOf(d, 'Pipe'));
132
132
  const isDeclarable = isComponent || isDirective || isPipe;
133
- const isStandalone = (isComponent || isDirective) && decorators.some((d) => d.standalone);
133
+ // Check if the hierarchically lowest Component or Directive decorator (the only relevant for importing dependencies) is standalone.
134
+ const isStandalone = !!((isComponent || isDirective) &&
135
+ [...decorators]
136
+ .reverse() // reflectionCapabilities returns decorators in a hierarchically top-down order
137
+ .find((d) => _a.isDecoratorInstanceOf(d, 'Component') || _a.isDecoratorInstanceOf(d, 'Directive'))?.standalone);
134
138
  return { isDeclarable, isStandalone };
135
139
  };
136
140
  PropertyExtractor.isDecoratorInstanceOf = (decorator, name) => {
@@ -19,6 +19,12 @@ const StandaloneTestComponent = (0, core_1.Component)({ standalone: true })(clas
19
19
  });
20
20
  const StandaloneTestDirective = (0, core_1.Directive)({ standalone: true })(class {
21
21
  });
22
+ const MixedTestComponent1 = (0, core_1.Component)({ standalone: true })(class extends StandaloneTestComponent {
23
+ });
24
+ const MixedTestComponent2 = (0, core_1.Component)({})(class extends MixedTestComponent1 {
25
+ });
26
+ const MixedTestComponent3 = (0, core_1.Component)({ standalone: true })(class extends MixedTestComponent2 {
27
+ });
22
28
  const TestModuleWithDeclarations = (0, core_1.NgModule)({ declarations: [TestComponent1] })(class {
23
29
  });
24
30
  const TestModuleWithImportsAndProviders = (0, core_1.NgModule)({
@@ -135,6 +141,18 @@ const extractApplicationProviders = (metadata, component) => {
135
141
  const { isStandalone } = PropertyExtractor_1.PropertyExtractor.analyzeDecorators(StandaloneTestComponent);
136
142
  (0, vitest_1.expect)(isStandalone).toBe(true);
137
143
  });
144
+ (0, vitest_1.it)('isStandalone should be true', () => {
145
+ const { isStandalone } = PropertyExtractor_1.PropertyExtractor.analyzeDecorators(MixedTestComponent1);
146
+ (0, vitest_1.expect)(isStandalone).toBe(true);
147
+ });
148
+ (0, vitest_1.it)('isStandalone should be false', () => {
149
+ const { isStandalone } = PropertyExtractor_1.PropertyExtractor.analyzeDecorators(MixedTestComponent2);
150
+ (0, vitest_1.expect)(isStandalone).toBe(false);
151
+ });
152
+ (0, vitest_1.it)('isStandalone should be true', () => {
153
+ const { isStandalone } = PropertyExtractor_1.PropertyExtractor.analyzeDecorators(MixedTestComponent3);
154
+ (0, vitest_1.expect)(isStandalone).toBe(true);
155
+ });
138
156
  });
139
157
  (0, vitest_1.describe)('extractProviders', () => {
140
158
  (0, vitest_1.it)('should return an array of providers', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "8.2.0-alpha.3",
3
+ "version": "8.2.0-alpha.5",
4
4
  "description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -37,18 +37,18 @@
37
37
  "prep": "rimraf dist && node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/tsc.ts"
38
38
  },
39
39
  "dependencies": {
40
- "@storybook/builder-webpack5": "8.2.0-alpha.3",
41
- "@storybook/client-logger": "8.2.0-alpha.3",
42
- "@storybook/core-common": "8.2.0-alpha.3",
43
- "@storybook/core-events": "8.2.0-alpha.3",
44
- "@storybook/core-server": "8.2.0-alpha.3",
45
- "@storybook/core-webpack": "8.2.0-alpha.3",
46
- "@storybook/docs-tools": "8.2.0-alpha.3",
40
+ "@storybook/builder-webpack5": "8.2.0-alpha.5",
41
+ "@storybook/client-logger": "8.2.0-alpha.5",
42
+ "@storybook/core-common": "8.2.0-alpha.5",
43
+ "@storybook/core-events": "8.2.0-alpha.5",
44
+ "@storybook/core-server": "8.2.0-alpha.5",
45
+ "@storybook/core-webpack": "8.2.0-alpha.5",
46
+ "@storybook/docs-tools": "8.2.0-alpha.5",
47
47
  "@storybook/global": "^5.0.0",
48
- "@storybook/node-logger": "8.2.0-alpha.3",
49
- "@storybook/preview-api": "8.2.0-alpha.3",
50
- "@storybook/telemetry": "8.2.0-alpha.3",
51
- "@storybook/types": "8.2.0-alpha.3",
48
+ "@storybook/node-logger": "8.2.0-alpha.5",
49
+ "@storybook/preview-api": "8.2.0-alpha.5",
50
+ "@storybook/telemetry": "8.2.0-alpha.5",
51
+ "@storybook/types": "8.2.0-alpha.5",
52
52
  "@types/node": "^18.0.0",
53
53
  "@types/react": "^18.0.37",
54
54
  "@types/react-dom": "^18.0.11",