@storybook/angular 9.0.0-alpha.11 → 9.0.0-alpha.13

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.
@@ -4,28 +4,7 @@ const { generateI18nBrowserWebpackConfigFromContext, } = require('@angular-devki
4
4
  const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
5
5
  const { filterOutStylingRules } = require('./utils/filter-out-styling-rules');
6
6
  const { default: StorybookNormalizeAngularEntryPlugin, } = require('./plugins/storybook-normalize-angular-entry-plugin');
7
- const getAngularWebpackUtils = () => {
8
- try {
9
- // Angular < 16.1.0
10
- const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig, } = require('@angular-devkit/build-angular/src/webpack/configs');
11
- return {
12
- getCommonConfig,
13
- getStylesConfig,
14
- getDevServerConfig,
15
- getTypeScriptConfig,
16
- };
17
- }
18
- catch (e) {
19
- // Angular > 16.1.0
20
- const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig, } = require('@angular-devkit/build-angular/src/tools/webpack/configs');
21
- return {
22
- getCommonConfig,
23
- getStylesConfig,
24
- getDevServerConfig,
25
- getTypeScriptConfig,
26
- };
27
- }
28
- };
7
+ const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig, } = require('@angular-devkit/build-angular/src/tools/webpack/configs');
29
8
  /**
30
9
  * Extract webpack config from angular-cli 13.x.x ⚠️ This file is in JavaScript to not use
31
10
  * TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
@@ -36,7 +15,6 @@ const getAngularWebpackUtils = () => {
36
15
  */
37
16
  exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext }) => {
38
17
  /** Get angular-cli Webpack config */
39
- const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig } = getAngularWebpackUtils();
40
18
  const { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext({
41
19
  // Default options
42
20
  index: 'noop-index',
@@ -60,6 +38,9 @@ exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext }
60
38
  getStylesConfig(wco),
61
39
  getTypeScriptConfig ? getTypeScriptConfig(wco) : getDevServerConfig(wco),
62
40
  ]);
41
+ if (!builderOptions.experimentalZoneless && !cliConfig.entry.polyfills?.includes('zone.js')) {
42
+ cliConfig.entry.polyfills.push('zone.js');
43
+ }
63
44
  /** Merge baseConfig Webpack with angular-cli Webpack */
64
45
  const entry = [
65
46
  ...(cliConfig.entry.polyfills ?? []),
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webpack = exports.runNgcc = void 0;
4
- const node_fs_1 = require("node:fs");
5
4
  const node_path_1 = require("node:path");
6
5
  /**
7
6
  * Source :
@@ -45,31 +44,17 @@ const runNgcc = async () => {
45
44
  };
46
45
  exports.runNgcc = runNgcc;
47
46
  const webpack = async (webpackConfig, options) => {
48
- const packageJsonPath = require.resolve('@angular/core/package.json');
49
- const packageJson = JSON.parse((0, node_fs_1.readFileSync)(packageJsonPath, 'utf8'));
50
- const VERSION = packageJson.version;
51
47
  const framework = await options.presets.apply('framework');
52
48
  const angularOptions = (typeof framework === 'object' ? framework.options : {});
53
- const angularMajorVersion = VERSION.split('.')[0];
54
- const isAngular16OrNewer = parseInt(angularMajorVersion, 10) >= 16;
55
49
  // Default to true, if undefined
56
50
  if (angularOptions.enableIvy === false) {
57
51
  return webpackConfig;
58
52
  }
59
- let extraMainFields = [];
60
- if (angularOptions.enableNgcc !== false && !isAngular16OrNewer) {
61
- // TODO: Drop if Angular 14 and 15 are not supported anymore
62
- (0, exports.runNgcc)();
63
- extraMainFields = ['es2015_ivy_ngcc', 'module_ivy_ngcc', 'main_ivy_ngcc'];
64
- }
65
- if (!isAngular16OrNewer) {
66
- extraMainFields.push('es2015');
67
- }
68
53
  return {
69
54
  ...webpackConfig,
70
55
  resolve: {
71
56
  ...webpackConfig.resolve,
72
- mainFields: [...extraMainFields, 'browser', 'module', 'main'],
57
+ mainFields: ['browser', 'module', 'main'],
73
58
  },
74
59
  };
75
60
  };
package/dist/types.d.ts CHANGED
@@ -23,6 +23,5 @@ type StorybookConfigFramework = {
23
23
  export type StorybookConfig = Omit<StorybookConfigBase, keyof StorybookConfigWebpack | keyof StorybookConfigFramework> & StorybookConfigWebpack & StorybookConfigFramework;
24
24
  export interface AngularOptions {
25
25
  enableIvy?: boolean;
26
- enableNgcc?: boolean;
27
26
  }
28
27
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "9.0.0-alpha.11",
3
+ "version": "9.0.0-alpha.13",
4
4
  "description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -52,8 +52,8 @@
52
52
  "prep": "rimraf dist && jiti ../../../scripts/prepare/tsc.ts"
53
53
  },
54
54
  "dependencies": {
55
- "@storybook/builder-webpack5": "9.0.0-alpha.11",
56
- "@storybook/core-webpack": "9.0.0-alpha.11",
55
+ "@storybook/builder-webpack5": "9.0.0-alpha.13",
56
+ "@storybook/core-webpack": "9.0.0-alpha.13",
57
57
  "@storybook/global": "^5.0.0",
58
58
  "@types/react": "^18.0.37",
59
59
  "@types/react-dom": "^18.0.11",
@@ -93,22 +93,22 @@
93
93
  "zone.js": "^0.15.0"
94
94
  },
95
95
  "peerDependencies": {
96
- "@angular-devkit/architect": ">=0.1500.0 < 0.2000.0",
97
- "@angular-devkit/build-angular": ">=15.0.0 < 20.0.0",
98
- "@angular-devkit/core": ">=15.0.0 < 20.0.0",
99
- "@angular/animations": ">=15.0.0 < 20.0.0",
100
- "@angular/cli": ">=15.0.0 < 20.0.0",
101
- "@angular/common": ">=15.0.0 < 20.0.0",
102
- "@angular/compiler": ">=15.0.0 < 20.0.0",
103
- "@angular/compiler-cli": ">=15.0.0 < 20.0.0",
104
- "@angular/core": ">=15.0.0 < 20.0.0",
105
- "@angular/forms": ">=15.0.0 < 20.0.0",
106
- "@angular/platform-browser": ">=15.0.0 < 20.0.0",
107
- "@angular/platform-browser-dynamic": ">=15.0.0 < 20.0.0",
108
- "rxjs": "^6.0.0 || ^7.4.0",
109
- "storybook": "^9.0.0-alpha.11",
96
+ "@angular-devkit/architect": ">=0.1800.0 < 0.2000.0",
97
+ "@angular-devkit/build-angular": ">=18.0.0 < 20.0.0",
98
+ "@angular-devkit/core": ">=18.0.0 < 20.0.0",
99
+ "@angular/animations": ">=18.0.0 < 20.0.0",
100
+ "@angular/cli": ">=18.0.0 < 20.0.0",
101
+ "@angular/common": ">=18.0.0 < 20.0.0",
102
+ "@angular/compiler": ">=18.0.0 < 20.0.0",
103
+ "@angular/compiler-cli": ">=18.0.0 < 20.0.0",
104
+ "@angular/core": ">=18.0.0 < 20.0.0",
105
+ "@angular/forms": ">=18.0.0 < 20.0.0",
106
+ "@angular/platform-browser": ">=18.0.0 < 20.0.0",
107
+ "@angular/platform-browser-dynamic": ">=18.0.0 < 20.0.0",
108
+ "rxjs": "^6.5.3 || ^7.4.0",
109
+ "storybook": "^9.0.0-alpha.13",
110
110
  "typescript": "^4.9.0 || ^5.0.0",
111
- "zone.js": ">= 0.11.1 < 1.0.0"
111
+ "zone.js": ">=0.14.0"
112
112
  },
113
113
  "peerDependenciesMeta": {
114
114
  "@angular/animations": {
@@ -122,7 +122,7 @@
122
122
  }
123
123
  },
124
124
  "engines": {
125
- "node": ">=18.0.0"
125
+ "node": ">=20.0.0"
126
126
  },
127
127
  "publishConfig": {
128
128
  "access": "public"