@angular-devkit/build-angular 12.0.0-rc.0 → 12.0.0

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 (216) hide show
  1. package/README.md +14 -13
  2. package/package.json +24 -24
  3. package/plugins/karma.d.ts +1 -1
  4. package/plugins/karma.js +1 -1
  5. package/src/app-shell/index.d.ts +7 -0
  6. package/src/app-shell/index.js +9 -7
  7. package/src/app-shell/schema.json +1 -4
  8. package/src/babel/babel-loader.d.ts +2 -1
  9. package/src/babel/presets/application.d.ts +7 -0
  10. package/src/babel/presets/application.js +3 -3
  11. package/src/babel/webpack-loader.d.ts +7 -0
  12. package/src/babel/webpack-loader.js +6 -5
  13. package/src/babel-bazel.d.ts +2 -1
  14. package/src/browser/index.d.ts +1 -1
  15. package/src/browser/index.js +34 -33
  16. package/src/browser/schema.d.ts +1 -5
  17. package/src/browser/schema.json +11 -57
  18. package/src/browser/tests/setup.d.ts +1 -1
  19. package/src/browser/tests/setup.js +7 -0
  20. package/src/dev-server/index.d.ts +1 -1
  21. package/src/dev-server/index.js +22 -15
  22. package/src/dev-server/schema.json +1 -3
  23. package/src/dev-server/tests/execute-fetch.d.ts +1 -1
  24. package/src/dev-server/tests/execute-fetch.js +4 -4
  25. package/src/dev-server/tests/setup.d.ts +7 -0
  26. package/src/dev-server/tests/setup.js +7 -0
  27. package/src/extract-i18n/index.d.ts +1 -1
  28. package/src/extract-i18n/index.js +10 -12
  29. package/src/extract-i18n/ivy-extract-loader.d.ts +7 -0
  30. package/src/extract-i18n/ivy-extract-loader.js +7 -6
  31. package/src/extract-i18n/schema.json +2 -14
  32. package/src/index.d.ts +6 -6
  33. package/src/index.js +1 -1
  34. package/src/karma/find-tests.d.ts +7 -0
  35. package/src/karma/find-tests.js +4 -4
  36. package/src/karma/index.d.ts +1 -1
  37. package/src/karma/index.js +21 -13
  38. package/src/karma/schema.json +7 -28
  39. package/src/ng-packagr/index.d.ts +1 -1
  40. package/src/ng-packagr/index.js +4 -4
  41. package/src/ng-packagr/schema.json +1 -3
  42. package/src/protractor/index.d.ts +1 -1
  43. package/src/protractor/index.js +8 -8
  44. package/src/protractor/schema.json +1 -3
  45. package/src/server/index.d.ts +1 -1
  46. package/src/server/index.js +6 -6
  47. package/src/server/schema.d.ts +1 -5
  48. package/src/server/schema.json +7 -35
  49. package/src/test-utils.d.ts +1 -1
  50. package/src/test-utils.js +4 -4
  51. package/src/testing/builder-harness.d.ts +2 -2
  52. package/src/testing/builder-harness.js +10 -8
  53. package/src/testing/file-watching.d.ts +1 -1
  54. package/src/testing/file-watching.js +7 -0
  55. package/src/testing/index.d.ts +1 -1
  56. package/src/testing/index.js +7 -0
  57. package/src/testing/jasmine-helpers.d.ts +2 -2
  58. package/src/testing/jasmine-helpers.js +7 -0
  59. package/src/transforms.d.ts +1 -1
  60. package/src/transforms.js +7 -0
  61. package/src/tslint/index.d.ts +7 -0
  62. package/src/tslint/index.js +10 -12
  63. package/src/tslint/schema.json +1 -1
  64. package/src/typings.d.ts +2 -1
  65. package/src/utils/action-cache.d.ts +7 -0
  66. package/src/utils/action-cache.js +6 -8
  67. package/src/utils/action-executor.d.ts +7 -0
  68. package/src/utils/action-executor.js +13 -28
  69. package/src/utils/build-browser-features.d.ts +1 -1
  70. package/src/utils/build-browser-features.js +3 -7
  71. package/src/utils/build-options.d.ts +1 -2
  72. package/src/utils/build-options.js +1 -1
  73. package/src/utils/bundle-calculator.d.ts +7 -0
  74. package/src/utils/bundle-calculator.js +32 -31
  75. package/src/utils/cache-path.d.ts +7 -0
  76. package/src/utils/cache-path.js +3 -3
  77. package/src/utils/check-port.d.ts +7 -0
  78. package/src/utils/check-port.js +4 -4
  79. package/src/utils/color.d.ts +1 -1
  80. package/src/utils/color.js +3 -3
  81. package/src/utils/copy-assets.d.ts +7 -0
  82. package/src/utils/copy-assets.js +3 -3
  83. package/src/utils/copy-file.d.ts +2 -2
  84. package/src/utils/copy-file.js +4 -4
  85. package/src/utils/default-progress.d.ts +1 -1
  86. package/src/utils/default-progress.js +1 -1
  87. package/src/utils/delete-output-dir.d.ts +7 -0
  88. package/src/utils/delete-output-dir.js +3 -3
  89. package/src/utils/empty.js +0 -1
  90. package/src/utils/environment-options.d.ts +7 -0
  91. package/src/utils/environment-options.js +3 -3
  92. package/src/utils/find-up.d.ts +7 -0
  93. package/src/utils/find-up.js +3 -3
  94. package/src/utils/i18n-inlining.d.ts +1 -1
  95. package/src/utils/i18n-inlining.js +8 -1
  96. package/src/utils/i18n-options.d.ts +1 -1
  97. package/src/utils/i18n-options.js +11 -3
  98. package/src/utils/index-file/augment-index-html.d.ts +1 -1
  99. package/src/utils/index-file/augment-index-html.js +6 -11
  100. package/src/utils/index-file/html-rewriting-stream.d.ts +1 -1
  101. package/src/utils/index-file/html-rewriting-stream.js +2 -2
  102. package/src/utils/index-file/index-html-generator.d.ts +1 -1
  103. package/src/utils/index-file/index-html-generator.js +7 -11
  104. package/src/utils/index-file/inline-critical-css.d.ts +1 -1
  105. package/src/utils/index-file/inline-critical-css.js +1 -1
  106. package/src/utils/index-file/inline-fonts.d.ts +1 -1
  107. package/src/utils/index-file/inline-fonts.js +18 -19
  108. package/src/utils/index.d.ts +1 -1
  109. package/src/utils/index.js +1 -1
  110. package/src/utils/is-directory.d.ts +1 -1
  111. package/src/utils/is-directory.js +2 -3
  112. package/src/utils/load-translations.d.ts +7 -0
  113. package/src/utils/load-translations.js +9 -19
  114. package/src/utils/normalize-asset-patterns.d.ts +1 -1
  115. package/src/utils/normalize-asset-patterns.js +6 -7
  116. package/src/utils/normalize-builder-schema.d.ts +1 -1
  117. package/src/utils/normalize-builder-schema.js +5 -6
  118. package/src/utils/normalize-file-replacements.d.ts +1 -1
  119. package/src/utils/normalize-file-replacements.js +2 -3
  120. package/src/utils/normalize-optimization.d.ts +1 -1
  121. package/src/utils/normalize-optimization.js +12 -8
  122. package/src/utils/normalize-source-maps.d.ts +1 -1
  123. package/src/utils/normalize-source-maps.js +3 -3
  124. package/src/utils/output-paths.d.ts +7 -0
  125. package/src/utils/output-paths.js +7 -4
  126. package/src/utils/package-chunk-sort.d.ts +1 -1
  127. package/src/utils/package-chunk-sort.js +10 -3
  128. package/src/utils/process-bundle-bootstrap.js +3 -2
  129. package/src/utils/process-bundle.d.ts +2 -2
  130. package/src/utils/process-bundle.js +31 -40
  131. package/src/utils/read-tsconfig.d.ts +1 -1
  132. package/src/utils/read-tsconfig.js +2 -4
  133. package/src/utils/run-module-as-observable-fork.d.ts +1 -1
  134. package/src/utils/run-module-as-observable-fork.js +9 -2
  135. package/src/utils/run-module-worker.js +1 -3
  136. package/src/utils/service-worker.d.ts +1 -1
  137. package/src/utils/service-worker.js +3 -3
  138. package/src/utils/spinner.d.ts +1 -1
  139. package/src/utils/spinner.js +1 -1
  140. package/src/utils/strip-bom.d.ts +1 -1
  141. package/src/utils/strip-bom.js +2 -3
  142. package/src/utils/tty.d.ts +1 -1
  143. package/src/utils/tty.js +1 -1
  144. package/src/utils/url.d.ts +1 -1
  145. package/src/utils/url.js +1 -1
  146. package/src/utils/version.d.ts +1 -1
  147. package/src/utils/version.js +3 -3
  148. package/src/utils/webpack-browser-config.d.ts +1 -1
  149. package/src/utils/webpack-browser-config.js +9 -2
  150. package/src/utils/webpack-diagnostics.d.ts +2 -2
  151. package/src/utils/webpack-diagnostics.js +4 -4
  152. package/src/utils/workers.d.ts +1 -1
  153. package/src/utils/workers.js +1 -1
  154. package/src/webpack/configs/browser.d.ts +7 -0
  155. package/src/webpack/configs/browser.js +3 -3
  156. package/src/webpack/configs/common.d.ts +7 -0
  157. package/src/webpack/configs/common.js +16 -19
  158. package/src/webpack/configs/dev-server.d.ts +1 -1
  159. package/src/webpack/configs/dev-server.js +7 -6
  160. package/src/webpack/configs/index.d.ts +1 -1
  161. package/src/webpack/configs/index.js +7 -7
  162. package/src/webpack/configs/server.d.ts +7 -0
  163. package/src/webpack/configs/server.js +4 -4
  164. package/src/webpack/configs/stats.d.ts +1 -1
  165. package/src/webpack/configs/stats.js +1 -1
  166. package/src/webpack/configs/styles.d.ts +7 -0
  167. package/src/webpack/configs/styles.js +6 -10
  168. package/src/webpack/configs/test.d.ts +1 -1
  169. package/src/webpack/configs/test.js +2 -5
  170. package/src/webpack/configs/typescript.d.ts +7 -0
  171. package/src/webpack/configs/typescript.js +4 -6
  172. package/src/webpack/configs/worker.d.ts +7 -0
  173. package/src/webpack/configs/worker.js +3 -3
  174. package/src/webpack/es5-jit-polyfills.js +2 -1
  175. package/src/webpack/es5-polyfills.js +2 -3
  176. package/src/webpack/jit-polyfills.js +2 -1
  177. package/src/webpack/plugins/analytics.d.ts +2 -2
  178. package/src/webpack/plugins/analytics.js +9 -9
  179. package/src/webpack/plugins/any-component-style-budget-checker.d.ts +1 -1
  180. package/src/webpack/plugins/any-component-style-budget-checker.js +3 -9
  181. package/src/webpack/plugins/builder-watch-plugin.d.ts +1 -1
  182. package/src/webpack/plugins/builder-watch-plugin.js +7 -0
  183. package/src/webpack/plugins/common-js-usage-warn-plugin.d.ts +1 -1
  184. package/src/webpack/plugins/common-js-usage-warn-plugin.js +10 -10
  185. package/src/webpack/plugins/dedupe-module-resolve-plugin.d.ts +1 -1
  186. package/src/webpack/plugins/dedupe-module-resolve-plugin.js +9 -2
  187. package/src/webpack/plugins/hmr/hmr-accept.d.ts +1 -1
  188. package/src/webpack/plugins/hmr/hmr-accept.js +6 -9
  189. package/src/webpack/plugins/hmr/hmr-loader.d.ts +1 -1
  190. package/src/webpack/plugins/hmr/hmr-loader.js +2 -2
  191. package/src/webpack/plugins/index-html-webpack-plugin.d.ts +7 -0
  192. package/src/webpack/plugins/index-html-webpack-plugin.js +6 -6
  193. package/src/webpack/plugins/index.d.ts +2 -2
  194. package/src/webpack/plugins/index.js +1 -1
  195. package/src/webpack/plugins/karma/karma-context.html +31 -30
  196. package/src/webpack/plugins/karma/karma-debug.html +34 -33
  197. package/src/webpack/plugins/karma/karma.d.ts +7 -0
  198. package/src/webpack/plugins/karma/karma.js +13 -11
  199. package/src/webpack/plugins/optimize-css-webpack-plugin.d.ts +7 -0
  200. package/src/webpack/plugins/optimize-css-webpack-plugin.js +18 -11
  201. package/src/webpack/plugins/postcss-cli-resources.d.ts +7 -0
  202. package/src/webpack/plugins/postcss-cli-resources.js +11 -9
  203. package/src/webpack/plugins/remove-hash-plugin.d.ts +1 -1
  204. package/src/webpack/plugins/remove-hash-plugin.js +9 -4
  205. package/src/webpack/plugins/scripts-webpack-plugin.d.ts +1 -1
  206. package/src/webpack/plugins/scripts-webpack-plugin.js +11 -10
  207. package/src/webpack/plugins/single-test-transform.d.ts +1 -1
  208. package/src/webpack/plugins/single-test-transform.js +5 -5
  209. package/src/webpack/plugins/suppress-entry-chunks-webpack-plugin.d.ts +1 -1
  210. package/src/webpack/plugins/suppress-entry-chunks-webpack-plugin.js +1 -1
  211. package/src/webpack/utils/async-chunks.d.ts +1 -1
  212. package/src/webpack/utils/async-chunks.js +9 -1
  213. package/src/webpack/utils/helpers.d.ts +1 -1
  214. package/src/webpack/utils/helpers.js +2 -2
  215. package/src/webpack/utils/stats.d.ts +1 -1
  216. package/src/webpack/utils/stats.js +39 -33
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.copyFile = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.copyFile = void 0;
11
11
  const fs = require("fs");
12
12
  // Workaround Node.js issue prior to 10.16 with copyFile on macOS
13
13
  // https://github.com/angular/angular-cli/issues/15544 & https://github.com/nodejs/node/pull/27241
14
14
  let copyFileWorkaround = false;
15
15
  if (process.platform === 'darwin') {
16
- const version = process.versions.node.split('.').map(part => Number(part));
16
+ const version = process.versions.node.split('.').map((part) => Number(part));
17
17
  if (version[0] < 10 || version[0] === 11 || (version[0] === 10 && version[1] < 16)) {
18
18
  copyFileWorkaround = true;
19
19
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
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
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
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
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
1
8
  /**
2
9
  * Delete an output directory, but error out if it's the root of the project.
3
10
  */
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteOutputDir = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.deleteOutputDir = void 0;
11
11
  const path_1 = require("path");
12
12
  const rimraf = require("rimraf");
13
13
  /**
@@ -1 +0,0 @@
1
-
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
1
8
  export declare const allowMangle: boolean;
2
9
  export declare const shouldBeautify: boolean;
3
10
  export declare const allowMinify: boolean;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.profilingEnabled = exports.cachingBasePath = exports.cachingDisabled = exports.allowMinify = exports.shouldBeautify = exports.allowMangle = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.profilingEnabled = exports.cachingBasePath = exports.cachingDisabled = exports.allowMinify = exports.shouldBeautify = exports.allowMangle = void 0;
11
11
  const path = require("path");
12
12
  function isDisabled(variable) {
13
13
  return variable === '0' || variable.toLowerCase() === 'false';
@@ -1 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
1
8
  export declare function findAllNodeModules(from: string, root?: string): string[];
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findAllNodeModules = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.findAllNodeModules = void 0;
11
11
  const fs_1 = require("fs");
12
12
  const path = require("path");
13
13
  const is_directory_1 = require("./is-directory");
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
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
@@ -1,4 +1,11 @@
1
1
  "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  exports.i18nInlineEmittedFiles = void 0;
4
11
  const fs = require("fs");
@@ -65,7 +72,7 @@ async function i18nInlineEmittedFiles(context, emittedFiles, i18n, baseOutputPat
65
72
  glob: '**/*',
66
73
  input: emittedPath,
67
74
  output: '',
68
- ignore: [...processedFiles].map(f => path.relative(emittedPath, f)),
75
+ ignore: [...processedFiles].map((f) => path.relative(emittedPath, f)),
69
76
  },
70
77
  ], outputPaths, '');
71
78
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
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
@@ -1,4 +1,11 @@
1
1
  "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  exports.configureI18nBuild = exports.createI18nOptions = void 0;
4
11
  const core_1 = require("@angular-devkit/core");
@@ -42,7 +49,8 @@ function createI18nOptions(metadata, inline) {
42
49
  let rawSourceLocaleBaseHref;
43
50
  if (core_1.json.isJsonObject(metadata.sourceLocale)) {
44
51
  rawSourceLocale = metadata.sourceLocale.code;
45
- if (metadata.sourceLocale.baseHref !== undefined && typeof metadata.sourceLocale.baseHref !== 'string') {
52
+ if (metadata.sourceLocale.baseHref !== undefined &&
53
+ typeof metadata.sourceLocale.baseHref !== 'string') {
46
54
  throw new Error('Project i18n sourceLocale baseHref field is malformed. Expected a string.');
47
55
  }
48
56
  rawSourceLocaleBaseHref = metadata.sourceLocale.baseHref;
@@ -88,7 +96,7 @@ function createI18nOptions(metadata, inline) {
88
96
  }
89
97
  if (inline === true) {
90
98
  i18n.inlineLocales.add(i18n.sourceLocale);
91
- Object.keys(i18n.locales).forEach(locale => i18n.inlineLocales.add(locale));
99
+ Object.keys(i18n.locales).forEach((locale) => i18n.inlineLocales.add(locale));
92
100
  }
93
101
  else if (inline) {
94
102
  for (const locale of inline) {
@@ -118,7 +126,7 @@ async function configureI18nBuild(context, options) {
118
126
  if (!localeDataBasePath) {
119
127
  throw new Error(`Unable to find locale data within '@angular/common'. Please ensure '@angular/common' is installed.`);
120
128
  }
121
- // Load locale data and translations (if present)
129
+ // Load locale data and translations (if present)
122
130
  let loader;
123
131
  const usedFormats = new Set();
124
132
  for (const [locale, desc] of Object.entries(i18n.locales)) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
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
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
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
@@ -77,10 +77,7 @@ async function augmentIndexHtml(params) {
77
77
  }
78
78
  let linkTags = [];
79
79
  for (const stylesheet of stylesheets) {
80
- const attrs = [
81
- `rel="stylesheet"`,
82
- `href="${deployUrl}${stylesheet}"`,
83
- ];
80
+ const attrs = [`rel="stylesheet"`, `href="${deployUrl}${stylesheet}"`];
84
81
  if (crossOrigin !== 'none') {
85
82
  attrs.push(`crossorigin="${crossOrigin}"`);
86
83
  }
@@ -93,7 +90,7 @@ async function augmentIndexHtml(params) {
93
90
  const { rewriter, transformedContent } = await html_rewriting_stream_1.htmlRewritingStream(html);
94
91
  const baseTagExists = html.includes('<base');
95
92
  rewriter
96
- .on('startTag', tag => {
93
+ .on('startTag', (tag) => {
97
94
  switch (tag.tagName) {
98
95
  case 'html':
99
96
  // Adjust document locale if specified
@@ -118,7 +115,7 @@ async function augmentIndexHtml(params) {
118
115
  }
119
116
  rewriter.emitStartTag(tag);
120
117
  })
121
- .on('endTag', tag => {
118
+ .on('endTag', (tag) => {
122
119
  switch (tag.tagName) {
123
120
  case 'head':
124
121
  for (const linkTag of linkTags) {
@@ -146,13 +143,11 @@ async function augmentIndexHtml(params) {
146
143
  exports.augmentIndexHtml = augmentIndexHtml;
147
144
  function generateSriAttributes(content) {
148
145
  const algo = 'sha384';
149
- const hash = crypto_1.createHash(algo)
150
- .update(content, 'utf8')
151
- .digest('base64');
146
+ const hash = crypto_1.createHash(algo).update(content, 'utf8').digest('base64');
152
147
  return `integrity="${algo}-${hash}"`;
153
148
  }
154
149
  function updateAttribute(tag, name, value) {
155
- const index = tag.attrs.findIndex(a => a.name === name);
150
+ const index = tag.attrs.findIndex((a) => a.name === name);
156
151
  const newValue = { name, value };
157
152
  if (index === -1) {
158
153
  tag.attrs.push(newValue);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
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
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
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
@@ -14,7 +14,7 @@ async function htmlRewritingStream(content) {
14
14
  const rewriter = new (await Promise.resolve().then(() => require('parse5-html-rewriting-stream')))();
15
15
  return {
16
16
  rewriter,
17
- transformedContent: new Promise(resolve => {
17
+ transformedContent: new Promise((resolve) => {
18
18
  new stream_1.Readable({
19
19
  encoding: 'utf8',
20
20
  read() {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
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
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
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
@@ -25,11 +25,7 @@ class IndexHtmlGenerator {
25
25
  if ((_b = this.options.optimization) === null || _b === void 0 ? void 0 : _b.styles.inlineCritical) {
26
26
  extraPlugins.push(inlineCriticalCssPlugin(this));
27
27
  }
28
- this.plugins = [
29
- augmentIndexHtmlPlugin(this),
30
- ...extraPlugins,
31
- postTransformPlugin(this),
32
- ];
28
+ this.plugins = [augmentIndexHtmlPlugin(this), ...extraPlugins, postTransformPlugin(this)];
33
29
  }
34
30
  async process(options) {
35
31
  let content = strip_bom_1.stripBom(await this.readIndex(this.options.indexPath));
@@ -65,9 +61,9 @@ class IndexHtmlGenerator {
65
61
  }
66
62
  exports.IndexHtmlGenerator = IndexHtmlGenerator;
67
63
  function augmentIndexHtmlPlugin(generator) {
68
- const { deployUrl, crossOrigin, sri = false, entrypoints, } = generator.options;
64
+ const { deployUrl, crossOrigin, sri = false, entrypoints } = generator.options;
69
65
  return async (html, options) => {
70
- const { lang, baseHref, outputPath = '', noModuleFiles, files, moduleFiles, } = options;
66
+ const { lang, baseHref, outputPath = '', noModuleFiles, files, moduleFiles } = options;
71
67
  return augment_index_html_1.augmentIndexHtml({
72
68
  html,
73
69
  baseHref,
@@ -76,7 +72,7 @@ function augmentIndexHtmlPlugin(generator) {
76
72
  sri,
77
73
  lang,
78
74
  entrypoints,
79
- loadOutputFile: filePath => generator.readAsset(path_1.join(outputPath, filePath)),
75
+ loadOutputFile: (filePath) => generator.readAsset(path_1.join(outputPath, filePath)),
80
76
  noModuleFiles,
81
77
  moduleFiles,
82
78
  files,
@@ -96,10 +92,10 @@ function inlineCriticalCssPlugin(generator) {
96
92
  const inlineCriticalCssProcessor = new inline_critical_css_1.InlineCriticalCssProcessor({
97
93
  minify: (_a = generator.options.optimization) === null || _a === void 0 ? void 0 : _a.styles.minify,
98
94
  deployUrl: generator.options.deployUrl,
99
- readAsset: filePath => generator.readAsset(filePath),
95
+ readAsset: (filePath) => generator.readAsset(filePath),
100
96
  });
101
97
  return async (html, options) => inlineCriticalCssProcessor.process(html, { outputPath: options.outputPath });
102
98
  }
103
99
  function postTransformPlugin({ options }) {
104
- return async (html) => options.postTransform ? options.postTransform(html) : html;
100
+ return async (html) => (options.postTransform ? options.postTransform(html) : html);
105
101
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
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
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
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
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
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
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
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
@@ -16,11 +16,11 @@ const url_1 = require("url");
16
16
  const cache_path_1 = require("../cache-path");
17
17
  const environment_options_1 = require("../environment-options");
18
18
  const html_rewriting_stream_1 = require("./html-rewriting-stream");
19
- const cacheFontsPath = environment_options_1.cachingDisabled ? undefined : cache_path_1.findCachePath('angular-build-fonts');
19
+ const cacheFontsPath = environment_options_1.cachingDisabled
20
+ ? undefined
21
+ : cache_path_1.findCachePath('angular-build-fonts');
20
22
  const packageVersion = require('../../../package.json').version;
21
- const SUPPORTED_PROVIDERS = [
22
- 'fonts.googleapis.com',
23
- ];
23
+ const SUPPORTED_PROVIDERS = ['fonts.googleapis.com'];
24
24
  class InlineFontsProcessor {
25
25
  constructor(options) {
26
26
  this.options = options;
@@ -29,20 +29,20 @@ class InlineFontsProcessor {
29
29
  const hrefList = [];
30
30
  // Collector link tags with href
31
31
  const { rewriter: collectorStream } = await html_rewriting_stream_1.htmlRewritingStream(content);
32
- collectorStream.on('startTag', tag => {
32
+ collectorStream.on('startTag', (tag) => {
33
33
  var _a;
34
34
  const { tagName, attrs } = tag;
35
35
  if (tagName !== 'link') {
36
36
  return;
37
37
  }
38
38
  // <link tag with rel="stylesheet" and a href.
39
- const href = attrs.find(({ name, value }) => name === 'rel' && value === 'stylesheet')
40
- && ((_a = attrs.find(({ name }) => name === 'href')) === null || _a === void 0 ? void 0 : _a.value);
39
+ const href = attrs.find(({ name, value }) => name === 'rel' && value === 'stylesheet') &&
40
+ ((_a = attrs.find(({ name }) => name === 'href')) === null || _a === void 0 ? void 0 : _a.value);
41
41
  if (href) {
42
42
  hrefList.push(href);
43
43
  }
44
44
  });
45
- await new Promise(resolve => collectorStream.on('finish', resolve));
45
+ await new Promise((resolve) => collectorStream.on('finish', resolve));
46
46
  // Download stylesheets
47
47
  const hrefsContent = await this.processHrefs(hrefList);
48
48
  if (hrefsContent.size === 0) {
@@ -50,14 +50,14 @@ class InlineFontsProcessor {
50
50
  }
51
51
  // Replace link with style tag.
52
52
  const { rewriter, transformedContent } = await html_rewriting_stream_1.htmlRewritingStream(content);
53
- rewriter.on('startTag', tag => {
53
+ rewriter.on('startTag', (tag) => {
54
54
  const { tagName, attrs } = tag;
55
55
  if (tagName !== 'link') {
56
56
  rewriter.emitStartTag(tag);
57
57
  return;
58
58
  }
59
- const hrefAttr = attrs.some(({ name, value }) => name === 'rel' && value === 'stylesheet')
60
- && attrs.find(({ name, value }) => name === 'href' && hrefsContent.has(value));
59
+ const hrefAttr = attrs.some(({ name, value }) => name === 'rel' && value === 'stylesheet') &&
60
+ attrs.find(({ name, value }) => name === 'href' && hrefsContent.has(value));
61
61
  if (hrefAttr) {
62
62
  const href = hrefAttr.value;
63
63
  const cssContent = hrefsContent.get(href);
@@ -85,22 +85,21 @@ class InlineFontsProcessor {
85
85
  }
86
86
  const data = await new Promise((resolve, reject) => {
87
87
  let rawResponse = '';
88
- https.get(url, {
88
+ https
89
+ .get(url, {
89
90
  agent,
90
91
  rejectUnauthorized: false,
91
92
  headers: {
92
93
  'user-agent': userAgent,
93
94
  },
94
- }, res => {
95
+ }, (res) => {
95
96
  if (res.statusCode !== 200) {
96
97
  reject(new Error(`Inlining of fonts failed. ${url} returned status code: ${res.statusCode}.`));
97
98
  return;
98
99
  }
99
- res
100
- .on('data', chunk => rawResponse += chunk)
101
- .on('end', () => resolve(rawResponse));
100
+ res.on('data', (chunk) => (rawResponse += chunk)).on('end', () => resolve(rawResponse));
102
101
  })
103
- .on('error', e => reject(new Error(`Inlining of fonts failed. An error has occurred while retrieving ${url} over the internet.\n` +
102
+ .on('error', (e) => reject(new Error(`Inlining of fonts failed. An error has occurred while retrieving ${url} over the internet.\n` +
104
103
  e.message)));
105
104
  });
106
105
  if (cacheFontsPath) {
@@ -138,7 +137,7 @@ class InlineFontsProcessor {
138
137
  // New lines.
139
138
  .replace(/\n/g, '')
140
139
  // Safe spaces.
141
- .replace(/\s?[\{\:\;]\s+/g, s => s.trim());
140
+ .replace(/\s?[\{\:\;]\s+/g, (s) => s.trim());
142
141
  }
143
142
  hrefsContent.set(hrefPath, cssContent);
144
143
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
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
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
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
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
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
@@ -1,15 +1,14 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
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
- // tslint:disable
10
- // TODO: cleanup this file, it's copied as is from Angular CLI.
11
9
  Object.defineProperty(exports, "__esModule", { value: true });
12
10
  exports.isDirectory = void 0;
11
+ // TODO: cleanup this file, it's copied as is from Angular CLI.
13
12
  const fs = require("fs");
14
13
  function isDirectory(path) {
15
14
  try {
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
1
8
  export declare type TranslationLoader = (path: string) => {
2
9
  translations: Record<string, import('@angular/localize').ɵParsedTranslation>;
3
10
  format: string;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createTranslationLoader = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.createTranslationLoader = void 0;
11
11
  const crypto_1 = require("crypto");
12
12
  const fs = require("fs");
13
13
  async function createTranslationLoader() {
@@ -34,7 +34,7 @@ async function createTranslationLoader() {
34
34
  messages.join('\n'));
35
35
  };
36
36
  // TODO: `parser.canParse()` is deprecated; remove this polyfill once we are sure all parsers provide the `parser.analyze()` method.
37
- // tslint:disable-next-line: no-any
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
38
  function analyze(parser, path, content) {
39
39
  if (parser.analyze !== undefined) {
40
40
  return parser.analyze(path, content);
@@ -51,22 +51,12 @@ async function importParsers() {
51
51
  const localizeDiag = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/diagnostics'));
52
52
  const diagnostics = new localizeDiag.Diagnostics();
53
53
  const parsers = {
54
- arb: new (await Promise.resolve().then(() => require(
55
- // tslint:disable-next-line:trailing-comma
56
- '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/arb_translation_parser'))).ArbTranslationParser(),
57
- json: new (await Promise.resolve().then(() => require(
58
- // tslint:disable-next-line:trailing-comma
59
- '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/simple_json_translation_parser'))).SimpleJsonTranslationParser(),
60
- xlf: new (await Promise.resolve().then(() => require(
61
- // tslint:disable-next-line:trailing-comma
62
- '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xliff1_translation_parser'))).Xliff1TranslationParser(),
63
- xlf2: new (await Promise.resolve().then(() => require(
64
- // tslint:disable-next-line:trailing-comma
65
- '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xliff2_translation_parser'))).Xliff2TranslationParser(),
54
+ arb: new (await Promise.resolve().then(() => require('@angular/localize/src/tools/src/translate/translation_files/translation_parsers/arb_translation_parser'))).ArbTranslationParser(),
55
+ json: new (await Promise.resolve().then(() => require('@angular/localize/src/tools/src/translate/translation_files/translation_parsers/simple_json_translation_parser'))).SimpleJsonTranslationParser(),
56
+ xlf: new (await Promise.resolve().then(() => require('@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xliff1_translation_parser'))).Xliff1TranslationParser(),
57
+ xlf2: new (await Promise.resolve().then(() => require('@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xliff2_translation_parser'))).Xliff2TranslationParser(),
66
58
  // The name ('xmb') needs to match the AOT compiler option
67
- xmb: new (await Promise.resolve().then(() => require(
68
- // tslint:disable-next-line:trailing-comma
69
- '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xtb_translation_parser'))).XtbTranslationParser(),
59
+ xmb: new (await Promise.resolve().then(() => require('@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xtb_translation_parser'))).XtbTranslationParser(),
70
60
  };
71
61
  return { parsers, diagnostics };
72
62
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
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