@storybook/angular 8.2.0-alpha.0 → 8.2.0-alpha.10

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.
@@ -13,6 +13,7 @@ export type StorybookBuilderOptions = JsonObject & {
13
13
  enableProdMode?: boolean;
14
14
  styles?: StyleElement[];
15
15
  stylePreprocessorOptions?: StylePreprocessorOptions;
16
+ preserveSymlinks?: boolean;
16
17
  assets?: AssetPattern[];
17
18
  sourceMap?: SourceMapUnion;
18
19
  } & Pick<CLIOptions, 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'test' | 'webpackStatsJson' | 'statsJson' | 'disableTelemetry' | 'debugWebpack' | 'previewUrl'>;
@@ -29,6 +30,7 @@ declare const _default: import("@angular-devkit/architect/src/internal").Builder
29
30
  enableProdMode?: boolean | undefined;
30
31
  styles?: StyleElement[] | undefined;
31
32
  stylePreprocessorOptions?: StylePreprocessorOptions | undefined;
33
+ preserveSymlinks?: boolean | undefined;
32
34
  assets?: AssetPattern[] | undefined;
33
35
  sourceMap?: SourceMapUnion | undefined;
34
36
  } & Pick<CLIOptions, "statsJson" | "outputDir" | "configDir" | "loglevel" | "quiet" | "test" | "webpackStatsJson" | "disableTelemetry" | "debugWebpack" | "previewUrl">>;
@@ -24,7 +24,7 @@ const commandBuilder = (options, context) => {
24
24
  outputDir: 'SBCONFIG_OUTPUT_DIR',
25
25
  configDir: 'SBCONFIG_CONFIG_DIR',
26
26
  });
27
- const { browserTarget, stylePreprocessorOptions, styles, configDir, docs, loglevel, test, outputDir, quiet, enableProdMode = true, webpackStatsJson, statsJson, debugWebpack, disableTelemetry, assets, previewUrl, sourceMap = false, } = options;
27
+ const { browserTarget, stylePreprocessorOptions, styles, configDir, docs, loglevel, test, outputDir, quiet, enableProdMode = true, webpackStatsJson, statsJson, debugWebpack, disableTelemetry, assets, previewUrl, sourceMap = false, preserveSymlinks = false, } = options;
28
28
  const standaloneOptions = {
29
29
  packageJson: (0, read_pkg_up_1.sync)({ cwd: __dirname }).packageJson,
30
30
  configDir,
@@ -42,6 +42,7 @@ const commandBuilder = (options, context) => {
42
42
  ...(styles ? { styles } : {}),
43
43
  ...(assets ? { assets } : {}),
44
44
  sourceMap,
45
+ preserveSymlinks,
45
46
  },
46
47
  tsConfig,
47
48
  webpackStatsJson,
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- /*
3
- * @vitest-environment node
4
- */
5
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
3
  if (k2 === undefined) k2 = k;
7
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -19,6 +19,11 @@
19
19
  "description": "Directory where to store built files.",
20
20
  "default": "storybook-static"
21
21
  },
22
+ "preserveSymlinks": {
23
+ "type": "boolean",
24
+ "description": "Do not use the real path when resolving modules. If true, symlinks are resolved to their real path, if false, symlinks are resolved to their symlinked path.",
25
+ "default": false
26
+ },
22
27
  "configDir": {
23
28
  "type": "string",
24
29
  "description": "Directory where to load Storybook configurations from.",
@@ -12,6 +12,7 @@ export type StorybookBuilderOptions = JsonObject & {
12
12
  styles?: StyleElement[];
13
13
  stylePreprocessorOptions?: StylePreprocessorOptions;
14
14
  assets?: AssetPattern[];
15
+ preserveSymlinks?: boolean;
15
16
  sourceMap?: SourceMapUnion;
16
17
  } & Pick<CLIOptions, 'port' | 'host' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'disableTelemetry' | 'initialPath' | 'open' | 'docs' | 'debugWebpack' | 'webpackStatsJson' | 'statsJson' | 'loglevel' | 'previewUrl'>;
17
18
  export type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
@@ -24,6 +25,7 @@ declare const _default: import("@angular-devkit/architect/src/internal").Builder
24
25
  styles?: StyleElement[] | undefined;
25
26
  stylePreprocessorOptions?: StylePreprocessorOptions | undefined;
26
27
  assets?: AssetPattern[] | undefined;
28
+ preserveSymlinks?: boolean | undefined;
27
29
  sourceMap?: SourceMapUnion | undefined;
28
30
  } & Pick<CLIOptions, "docs" | "statsJson" | "configDir" | "loglevel" | "quiet" | "webpackStatsJson" | "disableTelemetry" | "debugWebpack" | "previewUrl" | "port" | "host" | "initialPath" | "https" | "sslCa" | "sslCert" | "sslKey" | "smokeTest" | "open" | "ci">>;
29
31
  export default _default;
@@ -30,7 +30,7 @@ const commandBuilder = (options, context) => {
30
30
  ci: 'CI',
31
31
  });
32
32
  options.port = parseInt(`${options.port}`, 10);
33
- const { browserTarget, stylePreprocessorOptions, styles, ci, configDir, docs, host, https, port, quiet, enableProdMode = false, smokeTest, sslCa, sslCert, sslKey, disableTelemetry, assets, initialPath, open, debugWebpack, loglevel, webpackStatsJson, statsJson, previewUrl, sourceMap = false, } = options;
33
+ const { browserTarget, stylePreprocessorOptions, styles, ci, configDir, docs, host, https, port, quiet, enableProdMode = false, smokeTest, sslCa, sslCert, sslKey, disableTelemetry, assets, initialPath, open, debugWebpack, loglevel, webpackStatsJson, statsJson, previewUrl, sourceMap = false, preserveSymlinks = false, } = options;
34
34
  const standaloneOptions = {
35
35
  packageJson: (0, read_pkg_up_1.sync)({ cwd: __dirname }).packageJson,
36
36
  ci,
@@ -52,6 +52,7 @@ const commandBuilder = (options, context) => {
52
52
  ...(stylePreprocessorOptions ? { stylePreprocessorOptions } : {}),
53
53
  ...(styles ? { styles } : {}),
54
54
  ...(assets ? { assets } : {}),
55
+ preserveSymlinks,
55
56
  sourceMap,
56
57
  },
57
58
  tsConfig,
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- /*
3
- * @vitest-environment node
4
- */
5
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
3
  if (k2 === undefined) k2 = k;
7
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -19,6 +19,11 @@
19
19
  "type": "string",
20
20
  "description": "The full path for the TypeScript configuration file, relative to the current workspace."
21
21
  },
22
+ "preserveSymlinks": {
23
+ "type": "boolean",
24
+ "description": "Do not use the real path when resolving modules. If true, symlinks are resolved to their real path, if false, symlinks are resolved to their symlinked path.",
25
+ "default": false
26
+ },
22
27
  "port": {
23
28
  "type": "number",
24
29
  "description": "Port to listen on.",
@@ -10,6 +10,7 @@ export type StandaloneOptions = CLIOptions & LoadOptions & BuilderOptions & {
10
10
  stylePreprocessorOptions?: StylePreprocessorOptions;
11
11
  assets?: AssetPattern[];
12
12
  sourceMap?: SourceMapUnion;
13
+ preserveSymlinks?: boolean;
13
14
  };
14
15
  angularBuilderContext?: BuilderContext | null;
15
16
  tsConfig?: string;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @vitest-environment happy-dom
2
3
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
4
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
5
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @vitest-environment happy-dom
2
3
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
4
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
5
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -10,6 +10,6 @@ export declare const createStorybookWrapperComponent: ({ selector, template, sto
10
10
  storyComponent: Type<unknown> | undefined;
11
11
  styles: string[];
12
12
  moduleMetadata: NgModuleMetadata;
13
- initialProps?: ICollection | undefined;
13
+ initialProps?: ICollection;
14
14
  analyzedMetadata: PropertyExtractor;
15
15
  }) => Type<any>;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @vitest-environment happy-dom
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const rxjs_1 = require("rxjs");
4
5
  const vitest_1 = require("vitest");
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @vitest-environment happy-dom
2
3
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
4
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
5
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -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', () => {
@@ -11,4 +11,4 @@ export declare function applicationConfig<TArgs = any>(
11
11
  * Set of config options available during the application bootstrap operation.
12
12
  */
13
13
  config: ApplicationConfig): DecoratorFunction<AngularRenderer, TArgs>;
14
- export declare const componentWrapperDecorator: <TArgs = any>(element: Type<unknown> | ((story: string) => string), props?: ICollection | ((storyContext: StoryContext<AngularRenderer, TArgs>) => ICollection) | undefined) => DecoratorFunction<AngularRenderer, TArgs>;
14
+ export declare const componentWrapperDecorator: <TArgs = any>(element: Type<unknown> | ((story: string) => string), props?: ICollection | ((storyContext: StoryContext<AngularRenderer, TArgs>) => ICollection)) => DecoratorFunction<AngularRenderer, TArgs>;
@@ -49,6 +49,9 @@ exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext }
49
49
  styles: builderOptions.styles
50
50
  ?.map((style) => (typeof style === 'string' ? style : style.input))
51
51
  .filter((style) => typeof style === 'string' || style.inject !== false),
52
+ outputPath: typeof builderOptions.outputPath === 'string'
53
+ ? builderOptions.outputPath
54
+ : builderOptions.outputPath?.base,
52
55
  // Fixed options
53
56
  optimization: false,
54
57
  namedChunks: false,
package/dist/types.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { StorybookConfig as StorybookConfigBase, TypescriptOptions as TypescriptOptionsReact } from '@storybook/core-webpack';
2
2
  import { StorybookConfigWebpack, BuilderOptions, TypescriptOptions as TypescriptOptionsBuilder } from '@storybook/builder-webpack5';
3
- type FrameworkName = '@storybook/angular';
4
- type BuilderName = '@storybook/builder-webpack5';
3
+ import { CompatibleString } from '@storybook/types';
4
+ type FrameworkName = CompatibleString<'@storybook/angular'>;
5
+ type BuilderName = CompatibleString<'@storybook/builder-webpack5'>;
5
6
  export type FrameworkOptions = AngularOptions & {
6
7
  builder?: BuilderOptions;
7
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "8.2.0-alpha.0",
3
+ "version": "8.2.0-alpha.10",
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.0",
41
- "@storybook/client-logger": "8.2.0-alpha.0",
42
- "@storybook/core-common": "8.2.0-alpha.0",
43
- "@storybook/core-events": "8.2.0-alpha.0",
44
- "@storybook/core-server": "8.2.0-alpha.0",
45
- "@storybook/core-webpack": "8.2.0-alpha.0",
46
- "@storybook/docs-tools": "8.2.0-alpha.0",
40
+ "@storybook/builder-webpack5": "8.2.0-alpha.10",
41
+ "@storybook/client-logger": "8.2.0-alpha.10",
42
+ "@storybook/core-common": "8.2.0-alpha.10",
43
+ "@storybook/core-events": "8.2.0-alpha.10",
44
+ "@storybook/core-server": "8.2.0-alpha.10",
45
+ "@storybook/core-webpack": "8.2.0-alpha.10",
46
+ "@storybook/docs-tools": "8.2.0-alpha.10",
47
47
  "@storybook/global": "^5.0.0",
48
- "@storybook/node-logger": "8.2.0-alpha.0",
49
- "@storybook/preview-api": "8.2.0-alpha.0",
50
- "@storybook/telemetry": "8.2.0-alpha.0",
51
- "@storybook/types": "8.2.0-alpha.0",
48
+ "@storybook/node-logger": "8.2.0-alpha.10",
49
+ "@storybook/preview-api": "8.2.0-alpha.10",
50
+ "@storybook/telemetry": "8.2.0-alpha.10",
51
+ "@storybook/types": "8.2.0-alpha.10",
52
52
  "@types/node": "^18.0.0",
53
53
  "@types/react": "^18.0.37",
54
54
  "@types/react-dom": "^18.0.11",
@@ -80,24 +80,23 @@
80
80
  "@types/cross-spawn": "^6.0.2",
81
81
  "@types/tmp": "^0.2.3",
82
82
  "cross-spawn": "^7.0.3",
83
- "jsdom": "^23.0.1",
84
83
  "tmp": "^0.2.1",
85
84
  "typescript": "^5.3.2",
86
85
  "webpack": "5",
87
86
  "zone.js": "^0.14.2"
88
87
  },
89
88
  "peerDependencies": {
90
- "@angular-devkit/architect": ">=0.1500.0 < 0.1800.0",
91
- "@angular-devkit/build-angular": ">=15.0.0 < 18.0.0",
92
- "@angular-devkit/core": ">=15.0.0 < 18.0.0",
93
- "@angular/cli": ">=15.0.0 < 18.0.0",
94
- "@angular/common": ">=15.0.0 < 18.0.0",
95
- "@angular/compiler": ">=15.0.0 < 18.0.0",
96
- "@angular/compiler-cli": ">=15.0.0 < 18.0.0",
97
- "@angular/core": ">=15.0.0 < 18.0.0",
98
- "@angular/forms": ">=15.0.0 < 18.0.0",
99
- "@angular/platform-browser": ">=15.0.0 < 18.0.0",
100
- "@angular/platform-browser-dynamic": ">=15.0.0 < 18.0.0",
89
+ "@angular-devkit/architect": ">=0.1500.0 < 0.1900.0",
90
+ "@angular-devkit/build-angular": ">=15.0.0 < 19.0.0",
91
+ "@angular-devkit/core": ">=15.0.0 < 19.0.0",
92
+ "@angular/cli": ">=15.0.0 < 19.0.0",
93
+ "@angular/common": ">=15.0.0 < 19.0.0",
94
+ "@angular/compiler": ">=15.0.0 < 19.0.0",
95
+ "@angular/compiler-cli": ">=15.0.0 < 19.0.0",
96
+ "@angular/core": ">=15.0.0 < 19.0.0",
97
+ "@angular/forms": ">=15.0.0 < 19.0.0",
98
+ "@angular/platform-browser": ">=15.0.0 < 19.0.0",
99
+ "@angular/platform-browser-dynamic": ">=15.0.0 < 19.0.0",
101
100
  "rxjs": "^6.0.0 || ^7.4.0",
102
101
  "typescript": "^4.0.0 || ^5.0.0",
103
102
  "zone.js": ">= 0.11.1 < 1.0.0"
@@ -118,5 +117,5 @@
118
117
  "post": "./scripts/postbuild.js",
119
118
  "tsConfig": "tsconfig.build.json"
120
119
  },
121
- "gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17"
120
+ "gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae16"
122
121
  }