@storybook/angular 10.1.0-alpha.1 → 10.1.0-alpha.11

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.
@@ -1,7 +1,6 @@
1
1
  import {
2
- __name,
3
2
  computesTemplateSourceFromComponent
4
- } from "../../_browser-chunks/chunk-L4GU2V72.js";
3
+ } from "../../_browser-chunks/chunk-6CHBWP5J.js";
5
4
 
6
5
  // src/client/docs/config.ts
7
6
  import { SourceType as SourceType2 } from "storybook/internal/docs-tools";
@@ -9,37 +8,21 @@ import { SourceType as SourceType2 } from "storybook/internal/docs-tools";
9
8
  // src/client/docs/sourceDecorator.ts
10
9
  import { SourceType } from "storybook/internal/docs-tools";
11
10
  import { useRef, emitTransformCode, useEffect } from "storybook/preview-api";
12
- var skipSourceRender = /* @__PURE__ */ __name((context) => {
13
- const sourceParams = context?.parameters.docs?.source;
14
- if (sourceParams?.type === SourceType.DYNAMIC) {
15
- return false;
16
- }
17
- return sourceParams?.code || sourceParams?.type === SourceType.CODE;
18
- }, "skipSourceRender");
19
- var sourceDecorator = /* @__PURE__ */ __name((storyFn, context) => {
20
- const story = storyFn();
21
- const source = useRef(void 0);
22
- useEffect(() => {
23
- if (skipSourceRender(context)) {
11
+ var skipSourceRender = (context) => {
12
+ let sourceParams = context?.parameters.docs?.source;
13
+ return sourceParams?.type === SourceType.DYNAMIC ? !1 : sourceParams?.code || sourceParams?.type === SourceType.CODE;
14
+ }, sourceDecorator = (storyFn, context) => {
15
+ let story = storyFn(), source = useRef(void 0);
16
+ return useEffect(() => {
17
+ if (skipSourceRender(context))
24
18
  return;
25
- }
26
- const { props, userDefinedTemplate } = story;
27
- const { component, argTypes, parameters: parameters2 } = context;
28
- const template = parameters2.docs?.source?.excludeDecorators ? context.originalStoryFn(context.args, context).template : story.template;
19
+ let { props, userDefinedTemplate } = story, { component, argTypes, parameters: parameters2 } = context, template = parameters2.docs?.source?.excludeDecorators ? context.originalStoryFn(context.args, context).template : story.template;
29
20
  if (component && !userDefinedTemplate) {
30
- const sourceFromComponent = computesTemplateSourceFromComponent(component, props, argTypes);
31
- const newSource = sourceFromComponent || template;
32
- if (newSource && newSource !== source.current) {
33
- emitTransformCode(newSource, context);
34
- source.current = newSource;
35
- }
36
- } else if (template && template !== source.current) {
37
- emitTransformCode(template, context);
38
- source.current = template;
39
- }
40
- });
41
- return story;
42
- }, "sourceDecorator");
21
+ let newSource = computesTemplateSourceFromComponent(component, props, argTypes) || template;
22
+ newSource && newSource !== source.current && (emitTransformCode(newSource, context), source.current = newSource);
23
+ } else template && template !== source.current && (emitTransformCode(template, context), source.current = template);
24
+ }), story;
25
+ };
43
26
 
44
27
  // src/client/docs/config.ts
45
28
  var parameters = {
@@ -49,8 +32,7 @@ var parameters = {
49
32
  language: "html"
50
33
  }
51
34
  }
52
- };
53
- var decorators = [sourceDecorator];
35
+ }, decorators = [sourceDecorator];
54
36
  export {
55
37
  decorators,
56
38
  parameters
@@ -4,9 +4,9 @@ import {
4
4
  componentWrapperDecorator,
5
5
  moduleMetadata,
6
6
  setProjectAnnotations
7
- } from "../_browser-chunks/chunk-CV6HSYTZ.js";
7
+ } from "../_browser-chunks/chunk-T32Z4CGF.js";
8
8
  import "../_browser-chunks/chunk-DAHG2CDK.js";
9
- import "../_browser-chunks/chunk-L4GU2V72.js";
9
+ import "../_browser-chunks/chunk-6CHBWP5J.js";
10
10
  export {
11
11
  applicationConfig,
12
12
  argsToTemplate,
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  componentWrapperDecorator,
5
5
  moduleMetadata,
6
6
  setProjectAnnotations
7
- } from "./_browser-chunks/chunk-CV6HSYTZ.js";
7
+ } from "./_browser-chunks/chunk-T32Z4CGF.js";
8
8
  import "./_browser-chunks/chunk-DAHG2CDK.js";
9
- import "./_browser-chunks/chunk-L4GU2V72.js";
9
+ import "./_browser-chunks/chunk-6CHBWP5J.js";
10
10
  export {
11
11
  applicationConfig,
12
12
  argsToTemplate,
@@ -1,23 +1,19 @@
1
- import CJS_COMPAT_NODE_URL_q2wnq1duol8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q2wnq1duol8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q2wnq1duol8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_rc26l1fdf7f from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_rc26l1fdf7f from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_rc26l1fdf7f from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q2wnq1duol8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q2wnq1duol8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q2wnq1duol8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_rc26l1fdf7f.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_rc26l1fdf7f.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_rc26l1fdf7f.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
- import {
13
- __name
14
- } from "../_node-chunks/chunk-33GAHH27.js";
15
12
 
16
13
  // src/node/index.ts
17
14
  function defineMain(config) {
18
15
  return config;
19
16
  }
20
- __name(defineMain, "defineMain");
21
17
  export {
22
18
  defineMain
23
19
  };
package/dist/preset.js CHANGED
@@ -1,59 +1,49 @@
1
- import CJS_COMPAT_NODE_URL_q2wnq1duol8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q2wnq1duol8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q2wnq1duol8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_rc26l1fdf7f from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_rc26l1fdf7f from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_rc26l1fdf7f from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q2wnq1duol8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q2wnq1duol8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q2wnq1duol8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_rc26l1fdf7f.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_rc26l1fdf7f.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_rc26l1fdf7f.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
- import {
13
- __name
14
- } from "./_node-chunks/chunk-33GAHH27.js";
15
12
 
16
13
  // src/preset.ts
17
14
  import { fileURLToPath } from "node:url";
18
15
  var addons = [
19
16
  fileURLToPath(import.meta.resolve("@storybook/angular/server/framework-preset-angular-cli")),
20
17
  fileURLToPath(import.meta.resolve("@storybook/angular/server/framework-preset-angular-ivy"))
21
- ];
22
- var previewAnnotations = /* @__PURE__ */ __name(async (entries = [], options) => {
23
- const config = fileURLToPath(import.meta.resolve("@storybook/angular/client/config"));
24
- const annotations = [...entries, config];
18
+ ], previewAnnotations = async (entries = [], options) => {
19
+ let config = fileURLToPath(import.meta.resolve("@storybook/angular/client/config")), annotations = [...entries, config];
25
20
  if (options.enableProdMode) {
26
- const previewProdPath = fileURLToPath(
21
+ let previewProdPath = fileURLToPath(
27
22
  import.meta.resolve("@storybook/angular/client/preview-prod")
28
23
  );
29
24
  annotations.unshift(previewProdPath);
30
25
  }
31
- const docsConfig = await options.presets.apply("docs", {}, options);
32
- const docsEnabled = Object.keys(docsConfig).length > 0;
33
- if (docsEnabled) {
34
- const docsConfigPath = fileURLToPath(
26
+ let docsConfig = await options.presets.apply("docs", {}, options);
27
+ if (Object.keys(docsConfig).length > 0) {
28
+ let docsConfigPath = fileURLToPath(
35
29
  import.meta.resolve("@storybook/angular/client/docs/config")
36
30
  );
37
31
  annotations.push(docsConfigPath);
38
32
  }
39
33
  return annotations;
40
- }, "previewAnnotations");
41
- var core = /* @__PURE__ */ __name(async (config, options) => {
42
- const framework = await options.presets.apply("framework");
34
+ }, core = async (config, options) => {
35
+ let framework = await options.presets.apply("framework");
43
36
  return {
44
37
  ...config,
45
38
  builder: {
46
39
  name: import.meta.resolve("@storybook/builder-webpack5"),
47
- options: typeof framework === "string" ? {} : framework.options.builder || {}
40
+ options: typeof framework == "string" ? {} : framework.options.builder || {}
48
41
  }
49
42
  };
50
- }, "core");
51
- var typescript = /* @__PURE__ */ __name(async (config) => {
52
- return {
53
- ...config,
54
- skipCompiler: true
55
- };
56
- }, "typescript");
43
+ }, typescript = async (config) => ({
44
+ ...config,
45
+ skipCompiler: !0
46
+ });
57
47
  export {
58
48
  addons,
59
49
  core,
@@ -1,20 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_q2wnq1duol8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q2wnq1duol8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q2wnq1duol8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_rc26l1fdf7f from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_rc26l1fdf7f from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_rc26l1fdf7f from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q2wnq1duol8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q2wnq1duol8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q2wnq1duol8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_rc26l1fdf7f.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_rc26l1fdf7f.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_rc26l1fdf7f.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  up
14
- } from "../_node-chunks/chunk-JXFH7WTW.js";
15
- import {
16
- __name
17
- } from "../_node-chunks/chunk-33GAHH27.js";
14
+ } from "../_node-chunks/chunk-QT7OK2VJ.js";
18
15
 
19
16
  // src/server/framework-preset-angular-cli.ts
20
17
  import { logger } from "storybook/internal/node-logger";
@@ -27,91 +24,65 @@ import { logging } from "@angular-devkit/core";
27
24
  import { createRequire } from "node:module";
28
25
 
29
26
  // src/server/plugins/storybook-normalize-angular-entry-plugin.js
30
- var PLUGIN_NAME = "storybook-normalize-angular-entry-plugin";
31
- var StorybookNormalizeAngularEntryPlugin = class {
32
- static {
33
- __name(this, "StorybookNormalizeAngularEntryPlugin");
34
- }
27
+ var PLUGIN_NAME = "storybook-normalize-angular-entry-plugin", StorybookNormalizeAngularEntryPlugin = class {
35
28
  constructor(options) {
36
29
  this.options = options;
37
30
  }
38
31
  apply(compiler) {
39
32
  compiler.hooks.environment.tap(PLUGIN_NAME, () => {
40
- const originalEntry = compiler.options.entry;
33
+ let originalEntry = compiler.options.entry;
41
34
  compiler.options.entry = async () => {
42
35
  let entryResult;
43
- if (typeof originalEntry === "function") {
36
+ if (typeof originalEntry == "function")
44
37
  try {
45
38
  entryResult = await originalEntry();
46
39
  } catch (error) {
47
- console.error("Failed to execute the entry function:", error);
48
- throw error;
40
+ throw console.error("Failed to execute the entry function:", error), error;
49
41
  }
50
- } else {
42
+ else
51
43
  entryResult = originalEntry;
52
- }
53
- if (entryResult && entryResult.main && entryResult.styles) {
54
- return {
55
- main: {
56
- import: Array.from(
57
- /* @__PURE__ */ new Set([...entryResult.main.import, ...entryResult.styles.import])
58
- )
59
- }
60
- };
61
- }
62
- return entryResult;
44
+ return entryResult && entryResult.main && entryResult.styles ? {
45
+ main: {
46
+ import: Array.from(
47
+ /* @__PURE__ */ new Set([...entryResult.main.import, ...entryResult.styles.import])
48
+ )
49
+ }
50
+ } : entryResult;
63
51
  };
64
- });
65
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
52
+ }), compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
66
53
  this.compilation = compilation;
67
54
  });
68
55
  }
69
56
  };
70
57
 
71
58
  // src/server/utils/filter-out-styling-rules.ts
72
- var isStylingRule = /* @__PURE__ */ __name((rule) => {
73
- const { test } = rule;
74
- if (!test) {
75
- return false;
76
- }
77
- if (!(test instanceof RegExp)) {
78
- return false;
79
- }
80
- return test.test(".css") || test.test(".scss") || test.test(".sass");
81
- }, "isStylingRule");
82
- var filterOutStylingRules = /* @__PURE__ */ __name((config) => {
83
- return config.module.rules.filter((rule) => !isStylingRule(rule));
84
- }, "filterOutStylingRules");
59
+ var isStylingRule = (rule) => {
60
+ let { test } = rule;
61
+ return !test || !(test instanceof RegExp) ? !1 : test.test(".css") || test.test(".scss") || test.test(".sass");
62
+ }, filterOutStylingRules = (config) => config.module.rules.filter((rule) => !isStylingRule(rule));
85
63
 
86
64
  // src/server/angular-cli-webpack.js
87
- var require2 = createRequire(import.meta.url);
88
- var {
65
+ var require2 = createRequire(import.meta.url), {
89
66
  generateI18nBrowserWebpackConfigFromContext
90
- } = require2("@angular-devkit/build-angular/src/utils/webpack-browser-config");
91
- var TsconfigPathsPlugin = require2("tsconfig-paths-webpack-plugin");
92
- var {
67
+ } = require2("@angular-devkit/build-angular/src/utils/webpack-browser-config"), TsconfigPathsPlugin = require2("tsconfig-paths-webpack-plugin"), {
93
68
  getCommonConfig,
94
69
  getStylesConfig,
95
70
  getDevServerConfig,
96
71
  getTypeScriptConfig
97
- } = require2("@angular-devkit/build-angular/src/tools/webpack/configs");
98
- var getWebpackConfig = /* @__PURE__ */ __name(async (baseConfig, { builderOptions, builderContext }) => {
72
+ } = require2("@angular-devkit/build-angular/src/tools/webpack/configs"), getWebpackConfig = async (baseConfig, { builderOptions, builderContext }) => {
99
73
  async function getCustomStylesConfig(wco) {
100
- const { root } = wco;
101
- const isTailwind4 = /* @__PURE__ */ __name(() => {
74
+ let { root } = wco;
75
+ if ((() => {
102
76
  try {
103
- const output = import.meta.resolve("@tailwindcss/postcss", root);
77
+ let output = import.meta.resolve("@tailwindcss/postcss", root);
104
78
  return isAbsolute(output);
105
79
  } catch {
106
- return false;
80
+ return !1;
107
81
  }
108
- }, "isTailwind4");
109
- if (isTailwind4()) {
110
- const fs = require2("node:fs/promises");
111
- const originalReaddir = fs.readdir;
82
+ })()) {
83
+ let fs = require2("node:fs/promises"), originalReaddir = fs.readdir;
112
84
  fs.readdir = async function(path, options) {
113
- const results = await originalReaddir.call(this, path, options);
114
- const tailwindFiles = [
85
+ let results = await originalReaddir.call(this, path, options), tailwindFiles = [
115
86
  "tailwind.config.js",
116
87
  "tailwind.config.cjs",
117
88
  "tailwind.config.mjs",
@@ -119,52 +90,45 @@ var getWebpackConfig = /* @__PURE__ */ __name(async (baseConfig, { builderOption
119
90
  ];
120
91
  return results.filter((file) => !tailwindFiles.includes(file));
121
92
  };
122
- const styleConfig = await getStylesConfig(wco);
93
+ let styleConfig = await getStylesConfig(wco);
123
94
  fs.readdir = originalReaddir;
124
- const tailwindPackagePath = import.meta.resolve("@tailwindcss/postcss", root);
125
- const tailwindPackage = await import(tailwindPackagePath);
126
- const extraPostcssPlugins = [
127
- typeof tailwindPackage === "function" ? tailwindPackage() : tailwindPackage.default()
95
+ let tailwindPackage = await import(import.meta.resolve("@tailwindcss/postcss", root)), extraPostcssPlugins = [
96
+ typeof tailwindPackage == "function" ? tailwindPackage() : tailwindPackage.default()
128
97
  ];
129
- styleConfig.module.rules.map((rule) => rule.rules).forEach((rule) => {
98
+ return styleConfig.module.rules.map((rule) => rule.rules).forEach((rule) => {
130
99
  rule.forEach((r) => {
131
- r.oneOf?.forEach?.((oneOfRule) => {
132
- return oneOfRule.use.forEach((use) => {
133
- if (use.loader.includes("postcss-loader") && use.options.postcssOptions) {
134
- const originalOptionsFn = use.options.postcssOptions;
135
- use.options.postcssOptions = (loaderOptions) => {
136
- const originalOptions = originalOptionsFn(loaderOptions);
137
- return {
138
- ...originalOptions,
139
- plugins: [...originalOptions.plugins, ...extraPostcssPlugins]
140
- };
100
+ r.oneOf?.forEach?.((oneOfRule) => oneOfRule.use.forEach((use) => {
101
+ if (use.loader.includes("postcss-loader") && use.options.postcssOptions) {
102
+ let originalOptionsFn = use.options.postcssOptions;
103
+ use.options.postcssOptions = (loaderOptions) => {
104
+ let originalOptions = originalOptionsFn(loaderOptions);
105
+ return {
106
+ ...originalOptions,
107
+ plugins: [...originalOptions.plugins, ...extraPostcssPlugins]
141
108
  };
142
- }
143
- });
144
- });
109
+ };
110
+ }
111
+ }));
145
112
  });
146
- });
147
- return styleConfig;
148
- } else {
113
+ }), styleConfig;
114
+ } else
149
115
  return getStylesConfig(wco);
150
- }
151
116
  }
152
- __name(getCustomStylesConfig, "getCustomStylesConfig");
153
- const { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext(
117
+ let { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext(
154
118
  {
155
119
  // Default options
156
120
  index: "noop-index",
157
121
  main: "noop-main",
158
122
  // Options provided by user
159
123
  ...builderOptions,
160
- styles: builderOptions.styles?.map((style) => typeof style === "string" ? style : style.input).filter((style) => typeof style === "string" || style.inject !== false),
161
- outputPath: typeof builderOptions.outputPath === "string" ? builderOptions.outputPath : builderOptions.outputPath?.base ?? "noop-out",
124
+ styles: builderOptions.styles?.map((style) => typeof style == "string" ? style : style.input).filter((style) => typeof style == "string" || style.inject !== !1),
125
+ outputPath: typeof builderOptions.outputPath == "string" ? builderOptions.outputPath : builderOptions.outputPath?.base ?? "noop-out",
162
126
  // Fixed options
163
- optimization: false,
164
- namedChunks: false,
165
- progress: false,
166
- buildOptimizer: false,
167
- aot: false
127
+ optimization: !1,
128
+ namedChunks: !1,
129
+ progress: !1,
130
+ buildOptimizer: !1,
131
+ aot: !1
168
132
  },
169
133
  builderContext,
170
134
  (wco) => [
@@ -173,26 +137,19 @@ var getWebpackConfig = /* @__PURE__ */ __name(async (baseConfig, { builderOption
173
137
  getTypeScriptConfig ? getTypeScriptConfig(wco) : getDevServerConfig(wco)
174
138
  ]
175
139
  );
176
- if (!builderOptions.experimentalZoneless && !cliConfig.entry.polyfills?.includes("zone.js")) {
177
- cliConfig.entry.polyfills ??= [];
178
- cliConfig.entry.polyfills.push("zone.js");
179
- }
180
- const entry = [
140
+ !builderOptions.experimentalZoneless && !cliConfig.entry.polyfills?.includes("zone.js") && (cliConfig.entry.polyfills ??= [], cliConfig.entry.polyfills.push("zone.js"));
141
+ let entry = [
181
142
  ...cliConfig.entry.polyfills ?? [],
182
143
  ...baseConfig.entry,
183
144
  ...cliConfig.entry.styles ?? []
184
- ];
185
- const rulesExcludingStyles = filterOutStylingRules(baseConfig);
186
- const module = {
145
+ ], rulesExcludingStyles = filterOutStylingRules(baseConfig), module = {
187
146
  ...baseConfig.module,
188
147
  rules: [...cliConfig.module.rules, ...rulesExcludingStyles]
189
- };
190
- const plugins = [
148
+ }, plugins = [
191
149
  ...cliConfig.plugins ?? [],
192
150
  ...baseConfig.plugins,
193
151
  new StorybookNormalizeAngularEntryPlugin()
194
- ];
195
- const resolve = {
152
+ ], resolve = {
196
153
  ...baseConfig.resolve,
197
154
  modules: Array.from(/* @__PURE__ */ new Set([...baseConfig.resolve.modules, ...cliConfig.resolve.modules])),
198
155
  plugins: [
@@ -210,19 +167,15 @@ var getWebpackConfig = /* @__PURE__ */ __name(async (baseConfig, { builderOption
210
167
  resolve,
211
168
  resolveLoader: cliConfig.resolveLoader
212
169
  };
213
- }, "getWebpackConfig");
170
+ };
214
171
 
215
172
  // src/server/framework-preset-angular-cli.ts
216
173
  import { getProjectRoot, resolvePackageDir } from "storybook/internal/common";
217
174
  async function webpackFinal(baseConfig, options) {
218
- if (!resolvePackageDir("@angular-devkit/build-angular")) {
219
- logger.info('=> Using base config because "@angular-devkit/build-angular" is not installed');
220
- return baseConfig;
221
- }
175
+ if (!resolvePackageDir("@angular-devkit/build-angular"))
176
+ return logger.info('=> Using base config because "@angular-devkit/build-angular" is not installed'), baseConfig;
222
177
  checkForLegacyBuildOptions(options);
223
- const builderContext = getBuilderContext(options);
224
- const builderOptions = await getBuilderOptions(options, builderContext);
225
- const webpackConfig = await getWebpackConfig(baseConfig, {
178
+ let builderContext = getBuilderContext(options), builderOptions = await getBuilderOptions(options, builderContext), webpackConfig = await getWebpackConfig(baseConfig, {
226
179
  builderOptions: {
227
180
  watch: options.configType === "DEVELOPMENT",
228
181
  ...builderOptions
@@ -230,14 +183,10 @@ async function webpackFinal(baseConfig, options) {
230
183
  builderContext
231
184
  });
232
185
  webpackConfig.plugins = webpackConfig.plugins ?? [];
233
- const miniCssPlugin = webpackConfig?.plugins?.find(
186
+ let miniCssPlugin = webpackConfig?.plugins?.find(
234
187
  (plugin) => plugin?.constructor?.name === "MiniCssExtractPlugin"
235
188
  );
236
- if (miniCssPlugin && "options" in miniCssPlugin) {
237
- miniCssPlugin.options.filename = "[name].[contenthash].css";
238
- miniCssPlugin.options.chunkFilename = "[name].iframe.[contenthash].css";
239
- }
240
- webpackConfig.plugins.push(
189
+ miniCssPlugin && "options" in miniCssPlugin && (miniCssPlugin.options.filename = "[name].[contenthash].css", miniCssPlugin.options.chunkFilename = "[name].iframe.[contenthash].css"), webpackConfig.plugins.push(
241
190
  new WebpackDefinePlugin({
242
191
  STORYBOOK_ANGULAR_OPTIONS: JSON.stringify({
243
192
  experimentalZoneless: builderOptions.experimentalZoneless
@@ -246,13 +195,12 @@ async function webpackFinal(baseConfig, options) {
246
195
  );
247
196
  try {
248
197
  resolvePackageDir("@angular/animations");
249
- } catch (e) {
198
+ } catch {
250
199
  webpackConfig.plugins.push(
251
200
  new WebpackIgnorePlugin({
252
201
  resourceRegExp: /@angular\/platform-browser\/animations$/
253
202
  })
254
- );
255
- webpackConfig.plugins.push(
203
+ ), webpackConfig.plugins.push(
256
204
  new WebpackIgnorePlugin({
257
205
  resourceRegExp: /@angular\/animations\/browser$/
258
206
  })
@@ -260,57 +208,38 @@ async function webpackFinal(baseConfig, options) {
260
208
  }
261
209
  return webpackConfig;
262
210
  }
263
- __name(webpackFinal, "webpackFinal");
264
211
  function getBuilderContext(options) {
265
212
  return options.angularBuilderContext ?? {
266
213
  target: { project: "noop-project", builder: "", options: {} },
267
214
  workspaceRoot: process.cwd(),
268
- getProjectMetadata: /* @__PURE__ */ __name(() => ({}), "getProjectMetadata"),
269
- getTargetOptions: /* @__PURE__ */ __name(() => ({}), "getTargetOptions"),
215
+ getProjectMetadata: () => ({}),
216
+ getTargetOptions: () => ({}),
270
217
  logger: new logging.Logger("Storybook")
271
218
  };
272
219
  }
273
- __name(getBuilderContext, "getBuilderContext");
274
220
  function deepMerge(target, source) {
275
- const result = { ...target };
276
- for (const key in source) {
277
- if (source[key] !== void 0 && source[key] !== null) {
278
- if (typeof source[key] === "object" && !Array.isArray(source[key]) && typeof target[key] === "object" && !Array.isArray(target[key]) && target[key] !== null) {
279
- result[key] = deepMerge(target[key], source[key]);
280
- } else {
281
- result[key] = source[key];
282
- }
283
- }
284
- }
221
+ let result = { ...target };
222
+ for (let key in source)
223
+ source[key] !== void 0 && source[key] !== null && (typeof source[key] == "object" && !Array.isArray(source[key]) && typeof target[key] == "object" && !Array.isArray(target[key]) && target[key] !== null ? result[key] = deepMerge(target[key], source[key]) : result[key] = source[key]);
285
224
  return result;
286
225
  }
287
- __name(deepMerge, "deepMerge");
288
226
  async function getBuilderOptions(options, builderContext) {
289
227
  let browserTargetOptions = {};
290
228
  if (options.angularBrowserTarget) {
291
- const browserTarget = targetFromTargetString(options.angularBrowserTarget);
229
+ let browserTarget = targetFromTargetString(options.angularBrowserTarget);
292
230
  logger.info(
293
231
  `=> Using angular browser target options from "${browserTarget.project}:${browserTarget.target}${browserTarget.configuration ? `:${browserTarget.configuration}` : ""}"`
294
- );
295
- browserTargetOptions = await builderContext.getTargetOptions(browserTarget);
232
+ ), browserTargetOptions = await builderContext.getTargetOptions(browserTarget);
296
233
  }
297
- const explicitAngularBuilderOptions = await builderContext.getTargetOptions(
234
+ let explicitAngularBuilderOptions = await builderContext.getTargetOptions(
298
235
  builderContext.target
299
- );
300
- const builderOptions = deepMerge(browserTargetOptions, explicitAngularBuilderOptions || {});
301
- builderOptions.tsConfig = options.tsConfig ?? up("tsconfig.json", { cwd: options.configDir, last: getProjectRoot() }) ?? browserTargetOptions.tsConfig;
302
- logger.info(`=> Using angular project with "tsConfig:${builderOptions.tsConfig}"`);
303
- builderOptions.experimentalZoneless = options.angularBuilderOptions?.experimentalZoneless;
304
- return builderOptions;
236
+ ), builderOptions = deepMerge(browserTargetOptions, explicitAngularBuilderOptions || {});
237
+ return builderOptions.tsConfig = options.tsConfig ?? up("tsconfig.json", { cwd: options.configDir, last: getProjectRoot() }) ?? browserTargetOptions.tsConfig, logger.info(`=> Using angular project with "tsConfig:${builderOptions.tsConfig}"`), builderOptions.experimentalZoneless = options.angularBuilderOptions?.experimentalZoneless, builderOptions;
305
238
  }
306
- __name(getBuilderOptions, "getBuilderOptions");
307
239
  function checkForLegacyBuildOptions(options) {
308
- if (options.angularBrowserTarget !== void 0) {
309
- return;
310
- }
311
- throw new AngularLegacyBuildOptionsError();
240
+ if (options.angularBrowserTarget === void 0)
241
+ throw new AngularLegacyBuildOptionsError();
312
242
  }
313
- __name(checkForLegacyBuildOptions, "checkForLegacyBuildOptions");
314
243
  export {
315
244
  deepMerge,
316
245
  getBuilderOptions,