@angular-devkit/build-angular 14.0.0-next.2 → 14.0.0-next.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.
package/README.md CHANGED
@@ -4,16 +4,16 @@ This package contains [Architect builders](/packages/angular_devkit/architect/RE
4
4
 
5
5
  ## Builders
6
6
 
7
- | Name | Description |
8
- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
9
- | app-shell | Build an Angular [App shell](https://angular.io/guide/app-shell). |
10
- | browser | Build an Angular application targeting a browser environment. |
11
- | dev-server | A development server that provides live reloading. |
12
- | extract-i18n | Extract i18n messages from an Angular application. |
13
- | karma | Execute unit tests using [Karma](https://github.com/karma-runner/karma) test runner. |
14
- | ng-packagr | Build and package an Angular library in [Angular Package Format (APF)](https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview) format using [ng-packagr](https://github.com/ng-packagr/ng-packagr). |
15
- | server | Build an Angular application targeting a [Node.js](https://nodejs.org) environment. |
16
- | protractor | **Deprecated** - Run end-to-end tests using [Protractor](https://www.protractortest.org/) framework. |
7
+ | Name | Description |
8
+ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
9
+ | app-shell | Build an Angular [App shell](https://angular.io/guide/app-shell). |
10
+ | browser | Build an Angular application targeting a browser environment. |
11
+ | dev-server | A development server that provides live reloading. |
12
+ | extract-i18n | Extract i18n messages from an Angular application. |
13
+ | karma | Execute unit tests using [Karma](https://github.com/karma-runner/karma) test runner. |
14
+ | ng-packagr | Build and package an Angular library in [Angular Package Format (APF)](https://angular.io/guide/angular-package-format) format using [ng-packagr](https://github.com/ng-packagr/ng-packagr). |
15
+ | server | Build an Angular application targeting a [Node.js](https://nodejs.org) environment. |
16
+ | protractor | **Deprecated** - Run end-to-end tests using [Protractor](https://www.protractortest.org/) framework. |
17
17
 
18
18
  ## Disclaimer
19
19
 
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "14.0.0-next.2",
3
+ "version": "14.0.0-next.5",
4
4
  "description": "Angular Webpack Build Facade",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
7
7
  "builders": "builders.json",
8
8
  "dependencies": {
9
9
  "@ampproject/remapping": "2.1.2",
10
- "@angular-devkit/architect": "0.1400.0-next.2",
11
- "@angular-devkit/build-webpack": "0.1400.0-next.2",
12
- "@angular-devkit/core": "14.0.0-next.2",
10
+ "@angular-devkit/architect": "0.1400.0-next.5",
11
+ "@angular-devkit/build-webpack": "0.1400.0-next.5",
12
+ "@angular-devkit/core": "14.0.0-next.5",
13
13
  "@babel/core": "7.17.5",
14
14
  "@babel/generator": "7.17.3",
15
15
  "@babel/helper-annotate-as-pure": "7.16.7",
@@ -20,7 +20,7 @@
20
20
  "@babel/runtime": "7.17.2",
21
21
  "@babel/template": "7.16.7",
22
22
  "@discoveryjs/json-ext": "0.5.6",
23
- "@ngtools/webpack": "14.0.0-next.2",
23
+ "@ngtools/webpack": "14.0.0-next.5",
24
24
  "ansi-colors": "4.1.1",
25
25
  "babel-loader": "8.2.3",
26
26
  "babel-plugin-istanbul": "6.1.1",
@@ -29,49 +29,49 @@
29
29
  "copy-webpack-plugin": "10.2.4",
30
30
  "core-js": "3.21.1",
31
31
  "critters": "0.0.16",
32
- "css-loader": "6.6.0",
33
- "esbuild-wasm": "0.14.22",
32
+ "css-loader": "6.7.1",
33
+ "esbuild-wasm": "0.14.25",
34
34
  "glob": "7.2.0",
35
35
  "https-proxy-agent": "5.0.0",
36
- "inquirer": "8.2.0",
36
+ "inquirer": "8.2.1",
37
37
  "jsonc-parser": "3.0.0",
38
38
  "karma-source-map-support": "1.4.0",
39
39
  "less": "4.1.2",
40
40
  "less-loader": "10.2.0",
41
41
  "license-webpack-plugin": "4.0.2",
42
42
  "loader-utils": "3.2.0",
43
- "mini-css-extract-plugin": "2.5.3",
44
- "minimatch": "5.0.0",
43
+ "mini-css-extract-plugin": "2.6.0",
44
+ "minimatch": "5.0.1",
45
45
  "open": "8.4.0",
46
46
  "ora": "5.4.1",
47
47
  "parse5-html-rewriting-stream": "6.0.1",
48
48
  "piscina": "3.2.0",
49
- "postcss": "8.4.6",
49
+ "postcss": "8.4.8",
50
50
  "postcss-import": "14.0.2",
51
51
  "postcss-loader": "6.2.1",
52
- "postcss-preset-env": "7.4.1",
52
+ "postcss-preset-env": "7.4.2",
53
53
  "regenerator-runtime": "0.13.9",
54
54
  "resolve-url-loader": "5.0.0",
55
55
  "rxjs": "6.6.7",
56
- "sass": "1.49.7",
56
+ "sass": "1.49.9",
57
57
  "sass-loader": "12.6.0",
58
58
  "semver": "7.3.5",
59
59
  "source-map-loader": "3.0.1",
60
60
  "source-map-support": "0.5.21",
61
61
  "stylus": "0.56.0",
62
62
  "stylus-loader": "6.2.0",
63
- "terser": "5.10.0",
63
+ "terser": "5.12.0",
64
64
  "text-table": "0.2.0",
65
65
  "tree-kill": "1.2.2",
66
66
  "tslib": "2.3.1",
67
- "webpack": "5.69.1",
67
+ "webpack": "5.70.0",
68
68
  "webpack-dev-middleware": "5.3.1",
69
69
  "webpack-dev-server": "4.7.4",
70
70
  "webpack-merge": "5.8.0",
71
71
  "webpack-subresource-integrity": "5.1.0"
72
72
  },
73
73
  "optionalDependencies": {
74
- "esbuild": "0.14.22"
74
+ "esbuild": "0.14.25"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@angular/compiler-cli": "^14.0.0 || ^14.0.0-next",
@@ -115,7 +115,7 @@
115
115
  "url": "https://github.com/angular/angular-cli.git"
116
116
  },
117
117
  "engines": {
118
- "node": "^12.20.0 || ^14.15.0 || >=16.10.0",
118
+ "node": "^14.15.0 || >=16.10.0",
119
119
  "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
120
120
  "yarn": ">= 1.13.0"
121
121
  },
@@ -35,6 +35,7 @@ const inline_critical_css_1 = require("../../utils/index-file/inline-critical-cs
35
35
  const service_worker_1 = require("../../utils/service-worker");
36
36
  const spinner_1 = require("../../utils/spinner");
37
37
  async function _renderUniversal(options, context, browserResult, serverResult, spinner) {
38
+ var _a;
38
39
  // Get browser target options.
39
40
  const browserTarget = (0, architect_1.targetFromTargetString)(options.browserTarget);
40
41
  const rawBrowserOptions = (await context.getTargetOptions(browserTarget));
@@ -49,7 +50,7 @@ async function _renderUniversal(options, context, browserResult, serverResult, s
49
50
  throw new Error('The builder requires a target.');
50
51
  }
51
52
  const projectMetadata = await context.getProjectMetadata(projectName);
52
- const projectRoot = (0, core_1.resolve)((0, core_1.normalize)(root), (0, core_1.normalize)(projectMetadata.root || ''));
53
+ const projectRoot = path.join(root, (_a = projectMetadata.root) !== null && _a !== void 0 ? _a : '');
53
54
  const { styles } = (0, utils_1.normalizeOptimization)(browserOptions.optimization);
54
55
  const inlineCriticalCssProcessor = styles.inlineCritical
55
56
  ? new inline_critical_css_1.InlineCriticalCssProcessor({
@@ -91,7 +92,7 @@ async function _renderUniversal(options, context, browserResult, serverResult, s
91
92
  }
92
93
  await fs.promises.writeFile(outputIndexPath, html);
93
94
  if (browserOptions.serviceWorker) {
94
- await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, (0, core_1.normalize)(outputPath), browserOptions.baseHref || '/', browserOptions.ngswConfigPath);
95
+ await (0, service_worker_1.augmentAppWithServiceWorker)((0, core_1.normalize)(projectRoot), (0, core_1.normalize)(outputPath), browserOptions.baseHref || '/', browserOptions.ngswConfigPath);
95
96
  }
96
97
  }
97
98
  return browserResult;
@@ -7,7 +7,6 @@
7
7
  */
8
8
  import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
9
9
  import { WebpackLoggingCallback } from '@angular-devkit/build-webpack';
10
- import { json } from '@angular-devkit/core';
11
10
  import { Observable } from 'rxjs';
12
11
  import webpack from 'webpack';
13
12
  import { ExecutionTransformer } from '../../transforms';
@@ -16,7 +15,7 @@ import { Schema as BrowserBuilderSchema } from './schema';
16
15
  /**
17
16
  * @experimental Direct usage of this type is considered experimental.
18
17
  */
19
- export declare type BrowserBuilderOutput = json.JsonObject & BuilderOutput & {
18
+ export declare type BrowserBuilderOutput = BuilderOutput & {
20
19
  baseOutputPath: string;
21
20
  outputPaths: string[];
22
21
  /**
@@ -37,5 +36,5 @@ export declare function buildWebpackBrowser(options: BrowserBuilderSchema, conte
37
36
  logging?: WebpackLoggingCallback;
38
37
  indexHtml?: IndexHtmlTransform;
39
38
  }): Observable<BrowserBuilderOutput>;
40
- declare const _default: import("@angular-devkit/architect/src/internal").Builder<json.JsonObject & BrowserBuilderSchema>;
39
+ declare const _default: import("@angular-devkit/architect/src/internal").Builder<BrowserBuilderSchema & import("@angular-devkit/core").JsonObject>;
41
40
  export default _default;
@@ -92,7 +92,6 @@ async function initialize(options, context, webpackConfigurationTransform) {
92
92
  // eslint-disable-next-line max-lines-per-function
93
93
  function buildWebpackBrowser(options, context, transforms = {}) {
94
94
  var _a;
95
- const root = (0, core_1.normalize)(context.workspaceRoot);
96
95
  const projectName = (_a = context.target) === null || _a === void 0 ? void 0 : _a.project;
97
96
  if (!projectName) {
98
97
  throw new Error('The builder requires a target.');
@@ -102,13 +101,14 @@ function buildWebpackBrowser(options, context, transforms = {}) {
102
101
  // Check Angular version.
103
102
  (0, version_1.assertCompatibleAngularVersion)(context.workspaceRoot);
104
103
  return (0, rxjs_1.from)(context.getProjectMetadata(projectName)).pipe((0, operators_1.switchMap)(async (projectMetadata) => {
105
- var _a;
106
- const sysProjectRoot = (0, core_1.getSystemPath)((0, core_1.resolve)((0, core_1.normalize)(context.workspaceRoot), (0, core_1.normalize)((_a = projectMetadata.root) !== null && _a !== void 0 ? _a : '')));
107
104
  // Purge old build disk cache.
108
105
  await (0, purge_cache_1.purgeStaleBuildCache)(context);
109
- checkInternetExplorerSupport(sysProjectRoot, context.logger);
106
+ // Initialize builder
107
+ const initialization = await initialize(options, context, transforms.webpackConfiguration);
108
+ // Check and warn about IE browser support
109
+ checkInternetExplorerSupport(initialization.projectRoot, context.logger);
110
110
  return {
111
- ...(await initialize(options, context, transforms.webpackConfiguration)),
111
+ ...initialization,
112
112
  cacheOptions: (0, normalize_cache_1.normalizeCacheOptions)(projectMetadata, context.workspaceRoot),
113
113
  };
114
114
  }), (0, operators_1.switchMap)(
@@ -185,7 +185,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
185
185
  if (!options.watch && ((_c = options.assets) === null || _c === void 0 ? void 0 : _c.length)) {
186
186
  spinner.start('Copying assets...');
187
187
  try {
188
- await (0, copy_assets_1.copyAssets)((0, utils_1.normalizeAssetPatterns)(options.assets, root, (0, core_1.normalize)(projectRoot), projectSourceRoot === undefined ? undefined : (0, core_1.normalize)(projectSourceRoot)), Array.from(outputPaths.values()), context.workspaceRoot);
188
+ await (0, copy_assets_1.copyAssets)((0, utils_1.normalizeAssetPatterns)(options.assets, (0, core_1.normalize)(context.workspaceRoot), (0, core_1.normalize)(projectRoot), projectSourceRoot === undefined ? undefined : (0, core_1.normalize)(projectSourceRoot)), Array.from(outputPaths.values()), context.workspaceRoot);
189
189
  spinner.succeed('Copying assets complete.');
190
190
  }
191
191
  catch (err) {
@@ -98,7 +98,6 @@ export interface Schema {
98
98
  outputHashing?: OutputHashing;
99
99
  /**
100
100
  * The full path for the new output directory, relative to the current workspace.
101
- *
102
101
  * By default, writes output to a folder named dist/ in the current project.
103
102
  */
104
103
  outputPath: string;
@@ -193,12 +193,11 @@
193
193
  },
194
194
  "outputPath": {
195
195
  "type": "string",
196
- "description": "The full path for the new output directory, relative to the current workspace.\n\nBy default, writes output to a folder named dist/ in the current project."
196
+ "description": "The full path for the new output directory, relative to the current workspace.\nBy default, writes output to a folder named dist/ in the current project."
197
197
  },
198
198
  "resourcesOutputPath": {
199
199
  "type": "string",
200
- "description": "The path where style resources will be placed, relative to outputPath.",
201
- "default": ""
200
+ "description": "The path where style resources will be placed, relative to outputPath."
202
201
  },
203
202
  "aot": {
204
203
  "type": "boolean",
@@ -13,7 +13,7 @@ import webpack from 'webpack';
13
13
  import { ExecutionTransformer } from '../../transforms';
14
14
  import { IndexHtmlTransform } from '../../utils/index-file/index-html-generator';
15
15
  import { Schema } from './schema';
16
- export declare type DevServerBuilderOptions = Schema & json.JsonObject;
16
+ export declare type DevServerBuilderOptions = Schema;
17
17
  /**
18
18
  * @experimental Direct usage of this type is considered experimental.
19
19
  */
@@ -11,7 +11,7 @@ import { JsonObject } from '@angular-devkit/core';
11
11
  import webpack from 'webpack';
12
12
  import { ExecutionTransformer } from '../../transforms';
13
13
  import { Schema } from './schema';
14
- export declare type ExtractI18nBuilderOptions = Schema & JsonObject;
14
+ export declare type ExtractI18nBuilderOptions = Schema;
15
15
  /**
16
16
  * @experimental Direct usage of this function is considered experimental.
17
17
  */
@@ -6,11 +6,12 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
9
+ import { json } from '@angular-devkit/core';
9
10
  import { Schema as ProtractorBuilderOptions } from './schema';
10
11
  export { ProtractorBuilderOptions };
11
12
  /**
12
13
  * @experimental Direct usage of this function is considered experimental.
13
14
  */
14
15
  export declare function execute(options: ProtractorBuilderOptions, context: BuilderContext): Promise<BuilderOutput>;
15
- declare const _default: import("@angular-devkit/architect/src/internal").Builder<ProtractorBuilderOptions & import("@angular-devkit/core").JsonObject>;
16
+ declare const _default: import("@angular-devkit/architect/src/internal").Builder<ProtractorBuilderOptions & json.JsonObject>;
16
17
  export default _default;
@@ -6,7 +6,6 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
9
- import { json } from '@angular-devkit/core';
10
9
  import { Observable } from 'rxjs';
11
10
  import webpack from 'webpack';
12
11
  import { ExecutionTransformer } from '../../transforms';
@@ -14,7 +13,7 @@ import { Schema as ServerBuilderOptions } from './schema';
14
13
  /**
15
14
  * @experimental Direct usage of this type is considered experimental.
16
15
  */
17
- export declare type ServerBuilderOutput = json.JsonObject & BuilderOutput & {
16
+ export declare type ServerBuilderOutput = BuilderOutput & {
18
17
  baseOutputPath: string;
19
18
  outputPaths: string[];
20
19
  /**
@@ -29,5 +28,5 @@ export { ServerBuilderOptions };
29
28
  export declare function execute(options: ServerBuilderOptions, context: BuilderContext, transforms?: {
30
29
  webpackConfiguration?: ExecutionTransformer<webpack.Configuration>;
31
30
  }): Observable<ServerBuilderOutput>;
32
- declare const _default: import("@angular-devkit/architect/src/internal").Builder<ServerBuilderOptions & json.JsonObject>;
31
+ declare const _default: import("@angular-devkit/architect/src/internal").Builder<ServerBuilderOptions & import("@angular-devkit/core").JsonObject>;
33
32
  export default _default;
@@ -74,8 +74,7 @@
74
74
  },
75
75
  "resourcesOutputPath": {
76
76
  "type": "string",
77
- "description": "The path where style resources will be placed, relative to outputPath.",
78
- "default": ""
77
+ "description": "The path where style resources will be placed, relative to outputPath."
79
78
  },
80
79
  "sourceMap": {
81
80
  "description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
@@ -37,13 +37,6 @@ function deleteOutputDir(root, outputPath) {
37
37
  if (resolvedOutputPath === root) {
38
38
  throw new Error('Output path MUST not be project root directory!');
39
39
  }
40
- // The below should be removed and replace with just `rmSync` when support for Node.Js 12 is removed.
41
- const { rmSync, rmdirSync } = fs;
42
- if (rmSync) {
43
- rmSync(resolvedOutputPath, { force: true, recursive: true, maxRetries: 3 });
44
- }
45
- else {
46
- rmdirSync(resolvedOutputPath, { recursive: true, maxRetries: 3 });
47
- }
40
+ fs.rmSync(resolvedOutputPath, { force: true, recursive: true, maxRetries: 3 });
48
41
  }
49
42
  exports.deleteOutputDir = deleteOutputDir;
@@ -203,15 +203,8 @@ function findLocaleDataPath(locale, resolver) {
203
203
  }
204
204
  /** Remove temporary directory used for i18n processing. */
205
205
  function deleteTempDirectory(tempPath) {
206
- // The below should be removed and replaced with just `rmSync` when support for Node.Js 12 is removed.
207
- const { rmSync, rmdirSync } = fs_1.default;
208
206
  try {
209
- if (rmSync) {
210
- rmSync(tempPath, { force: true, recursive: true, maxRetries: 3 });
211
- }
212
- else {
213
- rmdirSync(tempPath, { recursive: true, maxRetries: 3 });
214
- }
207
+ fs_1.default.rmSync(tempPath, { force: true, recursive: true, maxRetries: 3 });
215
208
  }
216
209
  catch { }
217
210
  }
@@ -5,7 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { Path, json } from '@angular-devkit/core';
8
+ import { json } from '@angular-devkit/core';
9
9
  import { AssetPatternClass, Schema as BrowserBuilderSchema, SourceMapClass } from '../builders/browser/schema';
10
10
  import { BuildOptions } from './build-options';
11
11
  import { NormalizedFileReplacement } from './normalize-file-replacements';
@@ -19,4 +19,4 @@ export declare type NormalizedBrowserBuilderSchema = BrowserBuilderSchema & Buil
19
19
  fileReplacements: NormalizedFileReplacement[];
20
20
  optimization: NormalizedOptimizationOptions;
21
21
  };
22
- export declare function normalizeBrowserSchema(root: Path, projectRoot: Path, sourceRoot: Path | undefined, options: BrowserBuilderSchema, metadata: json.JsonObject): NormalizedBrowserBuilderSchema;
22
+ export declare function normalizeBrowserSchema(workspaceRoot: string, projectRoot: string, projectSourceRoot: string | undefined, options: BrowserBuilderSchema, metadata: json.JsonObject): NormalizedBrowserBuilderSchema;
@@ -15,13 +15,13 @@ const normalize_file_replacements_1 = require("./normalize-file-replacements");
15
15
  const normalize_optimization_1 = require("./normalize-optimization");
16
16
  const normalize_source_maps_1 = require("./normalize-source-maps");
17
17
  const supported_browsers_1 = require("./supported-browsers");
18
- function normalizeBrowserSchema(root, projectRoot, sourceRoot, options, metadata) {
18
+ function normalizeBrowserSchema(workspaceRoot, projectRoot, projectSourceRoot, options, metadata) {
19
19
  const normalizedSourceMapOptions = (0, normalize_source_maps_1.normalizeSourceMaps)(options.sourceMap || false);
20
20
  return {
21
21
  ...options,
22
- cache: (0, normalize_cache_1.normalizeCacheOptions)(metadata, (0, core_1.getSystemPath)(root)),
23
- assets: (0, normalize_asset_patterns_1.normalizeAssetPatterns)(options.assets || [], root, projectRoot, sourceRoot),
24
- fileReplacements: (0, normalize_file_replacements_1.normalizeFileReplacements)(options.fileReplacements || [], root),
22
+ cache: (0, normalize_cache_1.normalizeCacheOptions)(metadata, workspaceRoot),
23
+ assets: (0, normalize_asset_patterns_1.normalizeAssetPatterns)(options.assets || [], (0, core_1.normalize)(workspaceRoot), (0, core_1.normalize)(projectRoot), projectSourceRoot ? (0, core_1.normalize)(projectSourceRoot) : undefined),
24
+ fileReplacements: (0, normalize_file_replacements_1.normalizeFileReplacements)(options.fileReplacements || [], (0, core_1.normalize)(workspaceRoot)),
25
25
  optimization: (0, normalize_optimization_1.normalizeOptimization)(options.optimization),
26
26
  sourceMap: normalizedSourceMapOptions,
27
27
  preserveSymlinks: options.preserveSymlinks === undefined
@@ -38,7 +38,7 @@ function normalizeBrowserSchema(root, projectRoot, sourceRoot, options, metadata
38
38
  // A value of 0 is falsy and will disable polling rather then enable
39
39
  // 500 ms is a sensible default in this case
40
40
  poll: options.poll === 0 ? 500 : options.poll,
41
- supportedBrowsers: (0, supported_browsers_1.getSupportedBrowsers)((0, core_1.getSystemPath)(projectRoot)),
41
+ supportedBrowsers: (0, supported_browsers_1.getSupportedBrowsers)(projectRoot),
42
42
  };
43
43
  }
44
44
  exports.normalizeBrowserSchema = normalizeBrowserSchema;
@@ -23,16 +23,12 @@ async function purgeStaleBuildCache(context) {
23
23
  if (!enabled || !(0, fs_1.existsSync)(basePath)) {
24
24
  return;
25
25
  }
26
- // The below should be removed and replaced with just `rm` when support for Node.Js 12 is removed.
27
- const { rm, rmdir } = fs_1.promises;
28
26
  const entriesToDelete = (await fs_1.promises.readdir(basePath, { withFileTypes: true }))
29
27
  .filter((d) => (0, path_1.join)(basePath, d.name) !== path && d.isDirectory())
30
28
  .map((d) => {
31
29
  const subPath = (0, path_1.join)(basePath, d.name);
32
30
  try {
33
- return rm
34
- ? rm(subPath, { force: true, recursive: true, maxRetries: 3 })
35
- : rmdir(subPath, { recursive: true, maxRetries: 3 });
31
+ return fs_1.promises.rm(subPath, { force: true, recursive: true, maxRetries: 3 });
36
32
  }
37
33
  catch { }
38
34
  });
@@ -27,7 +27,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.getIndexInputFile = exports.getIndexOutputFile = exports.generateBrowserWebpackConfigFromContext = exports.generateI18nBrowserWebpackConfigFromContext = exports.generateWebpackConfig = void 0;
30
- const core_1 = require("@angular-devkit/core");
31
30
  const path = __importStar(require("path"));
32
31
  const typescript_1 = require("typescript");
33
32
  const webpack_1 = require("webpack");
@@ -108,19 +107,18 @@ async function generateI18nBrowserWebpackConfigFromContext(options, context, web
108
107
  }
109
108
  exports.generateI18nBrowserWebpackConfigFromContext = generateI18nBrowserWebpackConfigFromContext;
110
109
  async function generateBrowserWebpackConfigFromContext(options, context, webpackPartialGenerator, extraBuildOptions = {}) {
110
+ var _a;
111
111
  const projectName = context.target && context.target.project;
112
112
  if (!projectName) {
113
113
  throw new Error('The builder requires a target.');
114
114
  }
115
- const workspaceRoot = (0, core_1.normalize)(context.workspaceRoot);
115
+ const workspaceRoot = context.workspaceRoot;
116
116
  const projectMetadata = await context.getProjectMetadata(projectName);
117
- const projectRoot = (0, core_1.resolve)(workspaceRoot, (0, core_1.normalize)(projectMetadata.root || ''));
118
- const projectSourceRoot = projectMetadata.sourceRoot;
119
- const sourceRoot = projectSourceRoot
120
- ? (0, core_1.resolve)(workspaceRoot, (0, core_1.normalize)(projectSourceRoot))
121
- : undefined;
122
- const normalizedOptions = (0, utils_1.normalizeBrowserSchema)(workspaceRoot, projectRoot, sourceRoot, options, projectMetadata);
123
- const config = await generateWebpackConfig((0, core_1.getSystemPath)(workspaceRoot), (0, core_1.getSystemPath)(projectRoot), sourceRoot && (0, core_1.getSystemPath)(sourceRoot), projectName, normalizedOptions, webpackPartialGenerator, context.logger, extraBuildOptions);
117
+ const projectRoot = path.join(workspaceRoot, (_a = projectMetadata.root) !== null && _a !== void 0 ? _a : '');
118
+ const sourceRoot = projectMetadata.sourceRoot;
119
+ const projectSourceRoot = sourceRoot ? path.join(workspaceRoot, sourceRoot) : undefined;
120
+ const normalizedOptions = (0, utils_1.normalizeBrowserSchema)(workspaceRoot, projectRoot, projectSourceRoot, options, projectMetadata);
121
+ const config = await generateWebpackConfig(workspaceRoot, projectRoot, projectSourceRoot, projectName, normalizedOptions, webpackPartialGenerator, context.logger, extraBuildOptions);
124
122
  // If builder watch support is present in the context, add watch plugin
125
123
  // This is internal only and currently only used for testing
126
124
  const watcherFactory = context.watcherFactory;
@@ -132,8 +130,8 @@ async function generateBrowserWebpackConfigFromContext(options, context, webpack
132
130
  }
133
131
  return {
134
132
  config,
135
- projectRoot: (0, core_1.getSystemPath)(projectRoot),
136
- projectSourceRoot: sourceRoot && (0, core_1.getSystemPath)(sourceRoot),
133
+ projectRoot,
134
+ projectSourceRoot,
137
135
  };
138
136
  }
139
137
  exports.generateBrowserWebpackConfigFromContext = generateBrowserWebpackConfigFromContext;
@@ -24,6 +24,11 @@ class NamedChunksPlugin {
24
24
  if (chunk.name) {
25
25
  return;
26
26
  }
27
+ if ([...chunk.files.values()].every((f) => f.endsWith('.css'))) {
28
+ // If all chunk files are CSS files skip.
29
+ // This happens when using `import('./styles.css')` in a lazy loaded module.
30
+ return undefined;
31
+ }
27
32
  const name = this.generateName(chunk);
28
33
  if (name) {
29
34
  chunk.name = name;
@@ -37,6 +42,10 @@ class NamedChunksPlugin {
37
42
  if (!(block instanceof webpack_1.AsyncDependenciesBlock)) {
38
43
  continue;
39
44
  }
45
+ if (block.groupOptions.name) {
46
+ // Ignore groups which have been named already.
47
+ return undefined;
48
+ }
40
49
  for (const dependency of block.dependencies) {
41
50
  if (dependency instanceof ImportDependency) {
42
51
  return webpack_1.Template.toPath(dependency.request);