@angular-devkit/build-angular 14.0.0-next.5 → 14.0.0-next.8

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.
Files changed (67) hide show
  1. package/package.json +23 -24
  2. package/src/babel/plugins/pure-toplevel-functions.js +5 -1
  3. package/src/babel/presets/application.js +5 -1
  4. package/src/builders/app-shell/index.js +6 -3
  5. package/src/builders/app-shell/schema.d.ts +2 -2
  6. package/src/builders/app-shell/schema.json +2 -2
  7. package/src/builders/browser/index.js +8 -5
  8. package/src/builders/dev-server/index.js +5 -1
  9. package/src/builders/dev-server/schema.d.ts +1 -1
  10. package/src/builders/dev-server/schema.json +1 -1
  11. package/src/builders/extract-i18n/index.js +5 -1
  12. package/src/builders/extract-i18n/ivy-extract-loader.js +5 -1
  13. package/src/builders/karma/find-tests.js +5 -1
  14. package/src/builders/karma/index.d.ts +1 -1
  15. package/src/builders/karma/index.js +10 -6
  16. package/src/builders/ng-packagr/index.js +5 -1
  17. package/src/builders/protractor/index.js +5 -1
  18. package/src/builders/server/index.js +5 -1
  19. package/src/index.js +5 -1
  20. package/src/typings.d.ts +0 -4
  21. package/src/utils/check-port.js +8 -4
  22. package/src/utils/color.js +5 -1
  23. package/src/utils/copy-assets.js +5 -1
  24. package/src/utils/delete-output-dir.js +5 -1
  25. package/src/utils/environment-options.d.ts +0 -1
  26. package/src/utils/environment-options.js +1 -13
  27. package/src/utils/i18n-inlining.js +5 -1
  28. package/src/utils/index-file/html-rewriting-stream.js +5 -1
  29. package/src/utils/index-file/index-html-generator.js +5 -1
  30. package/src/utils/index-file/inline-critical-css.js +5 -1
  31. package/src/utils/index-file/inline-fonts.js +5 -1
  32. package/src/utils/index.js +5 -1
  33. package/src/utils/load-translations.js +5 -1
  34. package/src/utils/normalize-asset-patterns.d.ts +2 -2
  35. package/src/utils/normalize-asset-patterns.js +34 -10
  36. package/src/utils/normalize-builder-schema.js +2 -3
  37. package/src/utils/normalize-cache.js +0 -4
  38. package/src/utils/normalize-file-replacements.d.ts +4 -4
  39. package/src/utils/normalize-file-replacements.js +38 -18
  40. package/src/utils/process-bundle.js +6 -2
  41. package/src/utils/purge-cache.js +3 -4
  42. package/src/utils/read-tsconfig.js +5 -1
  43. package/src/utils/service-worker.d.ts +1 -2
  44. package/src/utils/service-worker.js +13 -11
  45. package/src/utils/webpack-browser-config.js +5 -1
  46. package/src/webpack/configs/analytics.js +1 -4
  47. package/src/webpack/configs/common.js +9 -12
  48. package/src/webpack/configs/dev-server.js +6 -2
  49. package/src/webpack/configs/index.js +5 -1
  50. package/src/webpack/configs/styles.js +14 -21
  51. package/src/webpack/plugins/analytics.d.ts +1 -2
  52. package/src/webpack/plugins/analytics.js +1 -3
  53. package/src/webpack/plugins/any-component-style-budget-checker.js +5 -1
  54. package/src/webpack/plugins/common-js-usage-warn-plugin.js +2 -2
  55. package/src/webpack/plugins/css-optimizer-plugin.js +7 -3
  56. package/src/webpack/plugins/esbuild-executor.d.ts +2 -2
  57. package/src/webpack/plugins/esbuild-executor.js +11 -17
  58. package/src/webpack/plugins/javascript-optimizer-plugin.js +8 -4
  59. package/src/webpack/plugins/json-stats-plugin.js +5 -1
  60. package/src/webpack/plugins/karma/karma.js +5 -1
  61. package/src/webpack/plugins/postcss-cli-resources.js +7 -3
  62. package/src/webpack/plugins/scripts-webpack-plugin.js +5 -1
  63. package/src/webpack/plugins/transfer-size-plugin.js +3 -2
  64. package/src/webpack/plugins/typescript.js +1 -2
  65. package/src/webpack/utils/helpers.js +5 -1
  66. package/src/webpack/utils/stats.js +5 -1
  67. package/esbuild-check.js +0 -16
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -5,9 +5,9 @@
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 { BaseException, Path } from '@angular-devkit/core';
8
+ import { BaseException } from '@angular-devkit/core';
9
9
  import { AssetPattern, AssetPatternClass } from '../builders/browser/schema';
10
10
  export declare class MissingAssetSourceRootException extends BaseException {
11
11
  constructor(path: String);
12
12
  }
13
- export declare function normalizeAssetPatterns(assetPatterns: AssetPattern[], root: Path, projectRoot: Path, maybeSourceRoot: Path | undefined): AssetPatternClass[];
13
+ export declare function normalizeAssetPatterns(assetPatterns: AssetPattern[], workspaceRoot: string, projectRoot: string, projectSourceRoot: string | undefined): AssetPatternClass[];
@@ -6,28 +6,52 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
9
32
  Object.defineProperty(exports, "__esModule", { value: true });
10
33
  exports.normalizeAssetPatterns = exports.MissingAssetSourceRootException = void 0;
11
34
  const core_1 = require("@angular-devkit/core");
12
35
  const fs_1 = require("fs");
36
+ const path = __importStar(require("path"));
13
37
  class MissingAssetSourceRootException extends core_1.BaseException {
14
38
  constructor(path) {
15
39
  super(`The ${path} asset path must start with the project source root.`);
16
40
  }
17
41
  }
18
42
  exports.MissingAssetSourceRootException = MissingAssetSourceRootException;
19
- function normalizeAssetPatterns(assetPatterns, root, projectRoot, maybeSourceRoot) {
20
- // When sourceRoot is not available, we default to ${projectRoot}/src.
21
- const sourceRoot = maybeSourceRoot || (0, core_1.join)(projectRoot, 'src');
22
- const resolvedSourceRoot = (0, core_1.resolve)(root, sourceRoot);
43
+ function normalizeAssetPatterns(assetPatterns, workspaceRoot, projectRoot, projectSourceRoot) {
23
44
  if (assetPatterns.length === 0) {
24
45
  return [];
25
46
  }
47
+ // When sourceRoot is not available, we default to ${projectRoot}/src.
48
+ const sourceRoot = projectSourceRoot || path.join(projectRoot, 'src');
49
+ const resolvedSourceRoot = path.resolve(workspaceRoot, sourceRoot);
26
50
  return assetPatterns.map((assetPattern) => {
27
51
  // Normalize string asset patterns to objects.
28
52
  if (typeof assetPattern === 'string') {
29
- const assetPath = (0, core_1.normalize)(assetPattern);
30
- const resolvedAssetPath = (0, core_1.resolve)(root, assetPath);
53
+ const assetPath = path.normalize(assetPattern);
54
+ const resolvedAssetPath = path.resolve(workspaceRoot, assetPath);
31
55
  // Check if the string asset is within sourceRoot.
32
56
  if (!resolvedAssetPath.startsWith(resolvedSourceRoot)) {
33
57
  throw new MissingAssetSourceRootException(assetPattern);
@@ -35,7 +59,7 @@ function normalizeAssetPatterns(assetPatterns, root, projectRoot, maybeSourceRoo
35
59
  let glob, input;
36
60
  let isDirectory = false;
37
61
  try {
38
- isDirectory = (0, fs_1.statSync)((0, core_1.getSystemPath)(resolvedAssetPath)).isDirectory();
62
+ isDirectory = (0, fs_1.statSync)(resolvedAssetPath).isDirectory();
39
63
  }
40
64
  catch {
41
65
  isDirectory = true;
@@ -48,12 +72,12 @@ function normalizeAssetPatterns(assetPatterns, root, projectRoot, maybeSourceRoo
48
72
  }
49
73
  else {
50
74
  // Files are their own glob.
51
- glob = (0, core_1.basename)(assetPath);
75
+ glob = path.basename(assetPath);
52
76
  // Input directory is their original dirname.
53
- input = (0, core_1.dirname)(assetPath);
77
+ input = path.dirname(assetPath);
54
78
  }
55
79
  // Output directory for both is the relative path from source root to input.
56
- const output = (0, core_1.relative)(resolvedSourceRoot, (0, core_1.resolve)(root, input));
80
+ const output = path.relative(resolvedSourceRoot, path.resolve(workspaceRoot, input));
57
81
  // Return the asset pattern in object format.
58
82
  return { glob, input, output };
59
83
  }
@@ -8,7 +8,6 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.normalizeBrowserSchema = void 0;
11
- const core_1 = require("@angular-devkit/core");
12
11
  const normalize_asset_patterns_1 = require("./normalize-asset-patterns");
13
12
  const normalize_cache_1 = require("./normalize-cache");
14
13
  const normalize_file_replacements_1 = require("./normalize-file-replacements");
@@ -20,8 +19,8 @@ function normalizeBrowserSchema(workspaceRoot, projectRoot, projectSourceRoot, o
20
19
  return {
21
20
  ...options,
22
21
  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)),
22
+ assets: (0, normalize_asset_patterns_1.normalizeAssetPatterns)(options.assets || [], workspaceRoot, projectRoot, projectSourceRoot),
23
+ fileReplacements: (0, normalize_file_replacements_1.normalizeFileReplacements)(options.fileReplacements || [], workspaceRoot),
25
24
  optimization: (0, normalize_optimization_1.normalizeOptimization)(options.optimization),
26
25
  sourceMap: normalizedSourceMapOptions,
27
26
  preserveSymlinks: options.preserveSymlinks === undefined
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.normalizeCacheOptions = void 0;
11
11
  const core_1 = require("@angular-devkit/core");
12
12
  const path_1 = require("path");
13
- const environment_options_1 = require("./environment-options");
14
13
  const package_version_1 = require("./package-version");
15
14
  function normalizeCacheOptions(metadata, worspaceRoot) {
16
15
  var _a;
@@ -20,9 +19,6 @@ function normalizeCacheOptions(metadata, worspaceRoot) {
20
19
  const { enabled = true, environment = 'local', path = '.angular/cache' } = cacheMetadata;
21
20
  const isCI = process.env['CI'] === '1' || ((_a = process.env['CI']) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
22
21
  let cacheEnabled = enabled;
23
- if (environment_options_1.cachingDisabled !== null) {
24
- cacheEnabled = !environment_options_1.cachingDisabled;
25
- }
26
22
  if (cacheEnabled) {
27
23
  switch (environment) {
28
24
  case 'ci':
@@ -5,13 +5,13 @@
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 { BaseException, Path } from '@angular-devkit/core';
8
+ import { BaseException } from '@angular-devkit/core';
9
9
  import { FileReplacement } from '../builders/browser/schema';
10
10
  export declare class MissingFileReplacementException extends BaseException {
11
11
  constructor(path: String);
12
12
  }
13
13
  export interface NormalizedFileReplacement {
14
- replace: Path;
15
- with: Path;
14
+ replace: string;
15
+ with: string;
16
16
  }
17
- export declare function normalizeFileReplacements(fileReplacements: FileReplacement[], root: Path): NormalizedFileReplacement[];
17
+ export declare function normalizeFileReplacements(fileReplacements: FileReplacement[], workspaceRoot: string): NormalizedFileReplacement[];
@@ -6,27 +6,51 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
9
32
  Object.defineProperty(exports, "__esModule", { value: true });
10
33
  exports.normalizeFileReplacements = exports.MissingFileReplacementException = void 0;
11
34
  const core_1 = require("@angular-devkit/core");
12
35
  const fs_1 = require("fs");
36
+ const path = __importStar(require("path"));
13
37
  class MissingFileReplacementException extends core_1.BaseException {
14
38
  constructor(path) {
15
39
  super(`The ${path} path in file replacements does not exist.`);
16
40
  }
17
41
  }
18
42
  exports.MissingFileReplacementException = MissingFileReplacementException;
19
- function normalizeFileReplacements(fileReplacements, root) {
43
+ function normalizeFileReplacements(fileReplacements, workspaceRoot) {
20
44
  if (fileReplacements.length === 0) {
21
45
  return [];
22
46
  }
23
- const normalizedReplacement = fileReplacements.map((replacement) => normalizeFileReplacement(replacement, root));
47
+ const normalizedReplacement = fileReplacements.map((replacement) => normalizeFileReplacement(replacement, workspaceRoot));
24
48
  for (const { replace, with: replacementWith } of normalizedReplacement) {
25
- if (!(0, fs_1.existsSync)((0, core_1.getSystemPath)(replacementWith))) {
26
- throw new MissingFileReplacementException((0, core_1.getSystemPath)(replacementWith));
49
+ if (!(0, fs_1.existsSync)(replacementWith)) {
50
+ throw new MissingFileReplacementException(replacementWith);
27
51
  }
28
- if (!(0, fs_1.existsSync)((0, core_1.getSystemPath)(replace))) {
29
- throw new MissingFileReplacementException((0, core_1.getSystemPath)(replace));
52
+ if (!(0, fs_1.existsSync)(replace)) {
53
+ throw new MissingFileReplacementException(replace);
30
54
  }
31
55
  }
32
56
  return normalizedReplacement;
@@ -36,22 +60,18 @@ function normalizeFileReplacement(fileReplacement, root) {
36
60
  let replacePath;
37
61
  let withPath;
38
62
  if (fileReplacement.src && fileReplacement.replaceWith) {
39
- replacePath = (0, core_1.normalize)(fileReplacement.src);
40
- withPath = (0, core_1.normalize)(fileReplacement.replaceWith);
63
+ replacePath = fileReplacement.src;
64
+ withPath = fileReplacement.replaceWith;
41
65
  }
42
66
  else if (fileReplacement.replace && fileReplacement.with) {
43
- replacePath = (0, core_1.normalize)(fileReplacement.replace);
44
- withPath = (0, core_1.normalize)(fileReplacement.with);
67
+ replacePath = fileReplacement.replace;
68
+ withPath = fileReplacement.with;
45
69
  }
46
70
  else {
47
71
  throw new Error(`Invalid file replacement: ${JSON.stringify(fileReplacement)}`);
48
72
  }
49
- // TODO: For 7.x should this only happen if not absolute?
50
- if (root) {
51
- replacePath = (0, core_1.join)(root, replacePath);
52
- }
53
- if (root) {
54
- withPath = (0, core_1.join)(root, withPath);
55
- }
56
- return { replace: replacePath, with: withPath };
73
+ return {
74
+ replace: path.join(root, replacePath),
75
+ with: path.join(root, withPath),
76
+ };
57
77
  }
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -125,7 +129,7 @@ async function inlineLocales(options) {
125
129
  // Same errors will contain the full content of the file as the error message
126
130
  // Which makes it hard to find the actual error message.
127
131
  const index = error.message.indexOf(')\n');
128
- const msg = index !== -1 ? error.message.substr(0, index + 1) : error.message;
132
+ const msg = index !== -1 ? error.message.slice(0, index + 1) : error.message;
129
133
  throw new Error(`${msg}\nAn error occurred inlining file "${options.filename}"`);
130
134
  }
131
135
  }
@@ -27,10 +27,9 @@ async function purgeStaleBuildCache(context) {
27
27
  .filter((d) => (0, path_1.join)(basePath, d.name) !== path && d.isDirectory())
28
28
  .map((d) => {
29
29
  const subPath = (0, path_1.join)(basePath, d.name);
30
- try {
31
- return fs_1.promises.rm(subPath, { force: true, recursive: true, maxRetries: 3 });
32
- }
33
- catch { }
30
+ return fs_1.promises
31
+ .rm(subPath, { force: true, recursive: true, maxRetries: 3 })
32
+ .catch(() => void 0);
34
33
  });
35
34
  await Promise.all(entriesToDelete);
36
35
  }
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -5,5 +5,4 @@
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 } from '@angular-devkit/core';
9
- export declare function augmentAppWithServiceWorker(appRoot: Path, outputPath: Path, baseHref: string, ngswConfigPath?: string): Promise<void>;
8
+ export declare function augmentAppWithServiceWorker(appRoot: string, outputPath: string, baseHref: string, ngswConfigPath?: string): Promise<void>;
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -27,7 +31,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
31
  };
28
32
  Object.defineProperty(exports, "__esModule", { value: true });
29
33
  exports.augmentAppWithServiceWorker = void 0;
30
- const core_1 = require("@angular-devkit/core");
31
34
  const crypto = __importStar(require("crypto"));
32
35
  const fs_1 = require("fs");
33
36
  const path = __importStar(require("path"));
@@ -73,11 +76,10 @@ class CliFilesystem {
73
76
  }
74
77
  }
75
78
  async function augmentAppWithServiceWorker(appRoot, outputPath, baseHref, ngswConfigPath) {
76
- const distPath = (0, core_1.getSystemPath)((0, core_1.normalize)(outputPath));
77
79
  // Determine the configuration file path
78
80
  const configPath = ngswConfigPath
79
- ? (0, core_1.getSystemPath)((0, core_1.normalize)(ngswConfigPath))
80
- : path.join((0, core_1.getSystemPath)(appRoot), 'ngsw-config.json');
81
+ ? path.normalize(ngswConfigPath)
82
+ : path.join(appRoot, 'ngsw-config.json');
81
83
  // Read the configuration file
82
84
  let config;
83
85
  try {
@@ -87,7 +89,7 @@ async function augmentAppWithServiceWorker(appRoot, outputPath, baseHref, ngswCo
87
89
  catch (error) {
88
90
  if (error.code === 'ENOENT') {
89
91
  throw new Error('Error: Expected to find an ngsw-config.json configuration file' +
90
- ` in the ${(0, core_1.getSystemPath)(appRoot)} folder. Either provide one or` +
92
+ ` in the ${appRoot} folder. Either provide one or` +
91
93
  ' disable Service Worker in the angular.json configuration file.');
92
94
  }
93
95
  else {
@@ -99,20 +101,20 @@ async function augmentAppWithServiceWorker(appRoot, outputPath, baseHref, ngswCo
99
101
  // changed to a direct dynamic import.
100
102
  const GeneratorConstructor = (await (0, load_esm_1.loadEsmModule)('@angular/service-worker/config')).Generator;
101
103
  // Generate the manifest
102
- const generator = new GeneratorConstructor(new CliFilesystem(distPath), baseHref);
104
+ const generator = new GeneratorConstructor(new CliFilesystem(outputPath), baseHref);
103
105
  const output = await generator.process(config);
104
106
  // Write the manifest
105
107
  const manifest = JSON.stringify(output, null, 2);
106
- await fs_1.promises.writeFile(path.join(distPath, 'ngsw.json'), manifest);
108
+ await fs_1.promises.writeFile(path.join(outputPath, 'ngsw.json'), manifest);
107
109
  // Find the service worker package
108
110
  const workerPath = require.resolve('@angular/service-worker/ngsw-worker.js');
109
111
  // Write the worker code
110
- await fs_1.promises.copyFile(workerPath, path.join(distPath, 'ngsw-worker.js'), fs_1.constants.COPYFILE_FICLONE);
112
+ await fs_1.promises.copyFile(workerPath, path.join(outputPath, 'ngsw-worker.js'), fs_1.constants.COPYFILE_FICLONE);
111
113
  // If present, write the safety worker code
112
114
  const safetyPath = path.join(path.dirname(workerPath), 'safety-worker.js');
113
115
  try {
114
- await fs_1.promises.copyFile(safetyPath, path.join(distPath, 'worker-basic.min.js'), fs_1.constants.COPYFILE_FICLONE);
115
- await fs_1.promises.copyFile(safetyPath, path.join(distPath, 'safety-worker.js'), fs_1.constants.COPYFILE_FICLONE);
116
+ await fs_1.promises.copyFile(safetyPath, path.join(outputPath, 'worker-basic.min.js'), fs_1.constants.COPYFILE_FICLONE);
117
+ await fs_1.promises.copyFile(safetyPath, path.join(outputPath, 'safety-worker.js'), fs_1.constants.COPYFILE_FICLONE);
116
118
  }
117
119
  catch (error) {
118
120
  if (error.code !== 'ENOENT') {
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.getAnalyticsConfig = void 0;
11
11
  const analytics_1 = require("../plugins/analytics");
12
12
  function getAnalyticsConfig(wco, context) {
13
- var _a;
14
13
  if (!context.analytics) {
15
14
  return {};
16
15
  }
@@ -22,9 +21,7 @@ function getAnalyticsConfig(wco, context) {
22
21
  }
23
22
  // The category is the builder name if it's an angular builder.
24
23
  return {
25
- plugins: [
26
- new analytics_1.NgBuildAnalyticsPlugin(wco.projectRoot, context.analytics, category, (_a = wco.buildOptions.aot) !== null && _a !== void 0 ? _a : false),
27
- ],
24
+ plugins: [new analytics_1.NgBuildAnalyticsPlugin(wco.projectRoot, context.analytics, category)],
28
25
  };
29
26
  }
30
27
  exports.getAnalyticsConfig = getAnalyticsConfig;
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -80,15 +84,6 @@ async function getCommonConfig(wco) {
80
84
  entryPoints['polyfills'] = [projectPolyfills];
81
85
  }
82
86
  }
83
- if (!buildOptions.aot) {
84
- const jitPolyfills = require.resolve('core-js/proposals/reflect-metadata');
85
- if (entryPoints['polyfills']) {
86
- entryPoints['polyfills'].push(jitPolyfills);
87
- }
88
- else {
89
- entryPoints['polyfills'] = [jitPolyfills];
90
- }
91
- }
92
87
  }
93
88
  if (allowedCommonJsDependencies) {
94
89
  // When this is not defined it means the builder doesn't support showing common js usages.
@@ -179,7 +174,9 @@ async function getCommonConfig(wco) {
179
174
  test: tsConfig.options.allowJs ? /\.[cm]?[tj]sx?$/ : /\.[cm]?tsx?$/,
180
175
  loader: webpack_1.AngularWebpackLoaderPath,
181
176
  // The below are known paths that are not part of the TypeScript compilation even when allowJs is enabled.
182
- exclude: [/[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/],
177
+ exclude: [
178
+ /[\\/]node_modules[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/,
179
+ ],
183
180
  });
184
181
  extraPlugins.push((0, typescript_2.createIvyPlugin)(wco, aot, tsConfigPath));
185
182
  }
@@ -293,7 +290,7 @@ async function getCommonConfig(wco) {
293
290
  // The below is needed due to a bug in `@babel/runtime`. See: https://github.com/babel/babel/issues/12824
294
291
  resolve: { fullySpecified: false },
295
292
  exclude: [
296
- /[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill|whatwg-url)[/\\]/,
293
+ /[\\/]node_modules[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill|whatwg-url)[/\\]/,
297
294
  ],
298
295
  use: [
299
296
  {
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -114,7 +118,7 @@ function buildServePath(options, logger) {
114
118
  servePath = defaultPath || '';
115
119
  }
116
120
  if (servePath.endsWith('/')) {
117
- servePath = servePath.substr(0, servePath.length - 1);
121
+ servePath = servePath.slice(0, -1);
118
122
  }
119
123
  if (!servePath.startsWith('/')) {
120
124
  servePath = `/${servePath}`;
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -94,16 +98,14 @@ function getStylesConfig(wco) {
94
98
  wco.logger.warn('Stylus usage is deprecated and will be removed in a future major version. ' +
95
99
  'To opt-out of the deprecated behaviour, please migrate to another stylesheet language.');
96
100
  }
97
- const sassImplementation = getSassImplementation();
98
- if (sassImplementation instanceof sass_service_1.SassWorkerImplementation) {
99
- extraPlugins.push({
100
- apply(compiler) {
101
- compiler.hooks.shutdown.tap('sass-worker', () => {
102
- sassImplementation === null || sassImplementation === void 0 ? void 0 : sassImplementation.close();
103
- });
104
- },
105
- });
106
- }
101
+ const sassImplementation = new sass_service_1.SassWorkerImplementation();
102
+ extraPlugins.push({
103
+ apply(compiler) {
104
+ compiler.hooks.shutdown.tap('sass-worker', () => {
105
+ sassImplementation.close();
106
+ });
107
+ },
108
+ });
107
109
  const assetNameTemplate = (0, helpers_1.assetNameTemplateFactory)(hashFormat);
108
110
  const extraPostcssPlugins = [];
109
111
  // Attempt to setup Tailwind CSS
@@ -151,7 +153,7 @@ function getStylesConfig(wco) {
151
153
  : undefined,
152
154
  plugins: [
153
155
  postcssImports({
154
- resolve: (url) => (url.startsWith('~') ? url.substr(1) : url),
156
+ resolve: (url) => (url.startsWith('~') ? url.slice(1) : url),
155
157
  load: (filename) => {
156
158
  return new Promise((resolve, reject) => {
157
159
  loader.fs.readFile(filename, (err, data) => {
@@ -371,12 +373,3 @@ function getStylesConfig(wco) {
371
373
  };
372
374
  }
373
375
  exports.getStylesConfig = getStylesConfig;
374
- function getSassImplementation() {
375
- const { webcontainer } = process.versions;
376
- // When `webcontainer` is a truthy it means that we are running in a StackBlitz webcontainer.
377
- // `SassWorkerImplementation` uses `receiveMessageOnPort` Node.js `worker_thread` API to ensure sync behavior which is ~2x faster.
378
- // However, it is non trivial to support this in a webcontainer and while slower we choose to use `dart-sass`
379
- // which in Webpack uses the slower async path.
380
- // We should periodically check with StackBlitz folks (Mark Whitfeld / Dominic Elm) to determine if this workaround is still needed.
381
- return webcontainer ? require('sass') : new sass_service_1.SassWorkerImplementation();
382
- }
@@ -40,10 +40,9 @@ export declare class NgBuildAnalyticsPlugin {
40
40
  protected _projectRoot: string;
41
41
  protected _analytics: analytics.Analytics;
42
42
  protected _category: string;
43
- private aotEnabled;
44
43
  protected _built: boolean;
45
44
  protected _stats: AnalyticsBuildStats;
46
- constructor(_projectRoot: string, _analytics: analytics.Analytics, _category: string, aotEnabled: boolean);
45
+ constructor(_projectRoot: string, _analytics: analytics.Analytics, _category: string);
47
46
  protected _reset(): void;
48
47
  protected _getMetrics(stats: Stats): (string | number)[];
49
48
  protected _getDimensions(): (string | number | boolean)[];
@@ -73,11 +73,10 @@ class AnalyticsBuildStats {
73
73
  * Analytics plugin that reports the analytics we want from the CLI.
74
74
  */
75
75
  class NgBuildAnalyticsPlugin {
76
- constructor(_projectRoot, _analytics, _category, aotEnabled) {
76
+ constructor(_projectRoot, _analytics, _category) {
77
77
  this._projectRoot = _projectRoot;
78
78
  this._analytics = _analytics;
79
79
  this._category = _category;
80
- this.aotEnabled = aotEnabled;
81
80
  this._built = false;
82
81
  this._stats = new AnalyticsBuildStats();
83
82
  }
@@ -108,7 +107,6 @@ class NgBuildAnalyticsPlugin {
108
107
  // Adding commas before and after so the regex are easier to define filters.
109
108
  dimensions[core_1.analytics.NgCliAnalyticsDimensions.BuildErrors] = `,${this._stats.errors.join()},`;
110
109
  }
111
- dimensions[core_1.analytics.NgCliAnalyticsDimensions.AotEnabled] = this.aotEnabled;
112
110
  return dimensions;
113
111
  }
114
112
  _reportBuildMetrics(stats) {
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];