@angular-devkit/build-angular 0.1100.0-rc.3 → 0.1100.3

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/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "0.1100.0-rc.3",
3
+ "version": "0.1100.3",
4
4
  "description": "Angular Webpack Build Facade",
5
5
  "experimental": true,
6
6
  "main": "src/index.js",
7
7
  "typings": "src/index.d.ts",
8
8
  "builders": "builders.json",
9
9
  "dependencies": {
10
- "@angular-devkit/architect": "0.1100.0-rc.3",
11
- "@angular-devkit/build-optimizer": "0.1100.0-rc.3",
12
- "@angular-devkit/build-webpack": "0.1100.0-rc.3",
13
- "@angular-devkit/core": "11.0.0-rc.3",
10
+ "@angular-devkit/architect": "0.1100.3",
11
+ "@angular-devkit/build-optimizer": "0.1100.3",
12
+ "@angular-devkit/build-webpack": "0.1100.3",
13
+ "@angular-devkit/core": "11.0.3",
14
14
  "@babel/core": "7.12.3",
15
15
  "@babel/generator": "7.12.1",
16
16
  "@babel/plugin-transform-runtime": "7.12.1",
@@ -18,7 +18,7 @@
18
18
  "@babel/runtime": "7.12.1",
19
19
  "@babel/template": "7.10.4",
20
20
  "@jsdevtools/coverage-istanbul-loader": "3.0.5",
21
- "@ngtools/webpack": "11.0.0-rc.3",
21
+ "@ngtools/webpack": "11.0.3",
22
22
  "ansi-colors": "4.1.1",
23
23
  "autoprefixer": "9.8.6",
24
24
  "babel-loader": "8.1.0",
@@ -28,7 +28,7 @@
28
28
  "circular-dependency-plugin": "5.2.0",
29
29
  "copy-webpack-plugin": "6.2.1",
30
30
  "core-js": "3.6.5",
31
- "css-loader": "5.0.0",
31
+ "css-loader": "4.3.0",
32
32
  "cssnano": "4.1.10",
33
33
  "file-loader": "6.1.1",
34
34
  "find-cache-dir": "3.3.1",
@@ -78,10 +78,10 @@
78
78
  "worker-plugin": "5.0.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@angular/compiler-cli": "^11.0.0 || ^11.0.0-next",
82
- "@angular/localize": "^11.0.0 || ^11.0.0-next",
83
- "karma": "^5.2.0",
84
- "ng-packagr": "^11.0.0 || ^11.0.0-next",
81
+ "@angular/compiler-cli": "^11.0.0",
82
+ "@angular/localize": "^11.0.0",
83
+ "karma": "~5.1.0",
84
+ "ng-packagr": "^11.0.0",
85
85
  "protractor": "^7.0.0",
86
86
  "tslint": "^6.1.0",
87
87
  "typescript": "~4.0.0"
@@ -124,11 +124,5 @@
124
124
  "bugs": {
125
125
  "url": "https://github.com/angular/angular-cli/issues"
126
126
  },
127
- "homepage": "https://github.com/angular/angular-cli",
128
- "husky": {
129
- "hooks": {
130
- "commit-msg": "yarn -s ng-dev commit-message pre-commit-validate --file-env-variable HUSKY_GIT_PARAMS",
131
- "prepare-commit-msg": "yarn -s ng-dev commit-message restore-commit-message-draft --file-env-variable HUSKY_GIT_PARAMS"
132
- }
133
- }
127
+ "homepage": "https://github.com/angular/angular-cli"
134
128
  }
@@ -9,7 +9,9 @@ export interface Schema {
9
9
  */
10
10
  appModuleBundle?: string;
11
11
  /**
12
- * Target to build.
12
+ * A browser builder target use for rendering the app shell in the format of
13
+ * `project:target[:configuration]`. You can also pass in more than one configuration name
14
+ * as a comma-separated list. Example: `project:target:production,staging`.
13
15
  */
14
16
  browserTarget: string;
15
17
  /**
@@ -26,7 +28,9 @@ export interface Schema {
26
28
  */
27
29
  route?: string;
28
30
  /**
29
- * Server target to use for rendering the app shell.
31
+ * A server builder target use for rendering the app shell in the format of
32
+ * `project:target[:configuration]`. You can also pass in more than one configuration name
33
+ * as a comma-separated list. Example: `project:target:production,staging`.
30
34
  */
31
35
  serverTarget: string;
32
36
  }
@@ -6,12 +6,12 @@
6
6
  "properties": {
7
7
  "browserTarget": {
8
8
  "type": "string",
9
- "description": "Target to build.",
9
+ "description": "A browser builder target use for rendering the app shell in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
10
10
  "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
11
11
  },
12
12
  "serverTarget": {
13
13
  "type": "string",
14
- "description": "Server target to use for rendering the app shell.",
14
+ "description": "A server builder target use for rendering the app shell in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
15
15
  "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
16
16
  },
17
17
  "appModuleBundle": {
@@ -423,17 +423,17 @@ function buildWebpackBrowser(options, context, transforms = {}) {
423
423
  for (const result of processResults) {
424
424
  const chunk = (_a = webpackStats.chunks) === null || _a === void 0 ? void 0 : _a.find((chunk) => chunk.id.toString() === result.name);
425
425
  if (result.original) {
426
- bundleInfoStats.push(generateBundleInfoStats(result.original, chunk));
426
+ bundleInfoStats.push(generateBundleInfoStats(result.original, chunk, 'modern'));
427
427
  }
428
428
  if (result.downlevel) {
429
- bundleInfoStats.push(generateBundleInfoStats(result.downlevel, chunk));
429
+ bundleInfoStats.push(generateBundleInfoStats(result.downlevel, chunk, 'legacy'));
430
430
  }
431
431
  }
432
432
  const unprocessedChunks = ((_b = webpackStats.chunks) === null || _b === void 0 ? void 0 : _b.filter((chunk) => !processResults
433
433
  .find((result) => chunk.id.toString() === result.name))) || [];
434
434
  for (const chunk of unprocessedChunks) {
435
435
  const asset = (_c = webpackStats.assets) === null || _c === void 0 ? void 0 : _c.find(a => a.name === chunk.files[0]);
436
- bundleInfoStats.push(stats_1.generateBundleStats({ ...chunk, size: asset === null || asset === void 0 ? void 0 : asset.size }, true));
436
+ bundleInfoStats.push(stats_1.generateBundleStats({ ...chunk, size: asset === null || asset === void 0 ? void 0 : asset.size }));
437
437
  }
438
438
  // Check for budget errors and display them to the user.
439
439
  const budgets = options.budgets || [];
@@ -550,7 +550,7 @@ function mapErrorToMessage(error) {
550
550
  function assertNever(input) {
551
551
  throw new Error(`Unexpected call to assertNever() with input: ${JSON.stringify(input, null /* replacer */, 4 /* tabSize */)}`);
552
552
  }
553
- function generateBundleInfoStats(bundle, chunk) {
553
+ function generateBundleInfoStats(bundle, chunk, chunkType) {
554
554
  return stats_1.generateBundleStats({
555
555
  size: bundle.size,
556
556
  files: bundle.map ? [bundle.filename, bundle.map.filename] : [bundle.filename],
@@ -558,6 +558,7 @@ function generateBundleInfoStats(bundle, chunk) {
558
558
  entry: !!(chunk === null || chunk === void 0 ? void 0 : chunk.names.includes('runtime')),
559
559
  initial: !!(chunk === null || chunk === void 0 ? void 0 : chunk.initial),
560
560
  rendered: true,
561
- }, true);
561
+ chunkType,
562
+ });
562
563
  }
563
564
  exports.default = architect_1.createBuilder(buildWebpackBrowser);
@@ -95,6 +95,9 @@ export interface Schema {
95
95
  * 'import()' syntax instead.
96
96
  */
97
97
  lazyModules?: string[];
98
+ /**
99
+ * Translate the bundles in one or more locales.
100
+ */
98
101
  localize?: Localize;
99
102
  /**
100
103
  * The full path for the main entry point to the app, relative to the current workspace.
@@ -109,7 +112,9 @@ export interface Schema {
109
112
  */
110
113
  ngswConfigPath?: string;
111
114
  /**
112
- * Enables optimization of the build output.
115
+ * Enables optimization of the build output. Including minification of scripts and styles,
116
+ * tree-shaking, dead-code eliminiation and fonts inlining. For more information, see
117
+ * https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.
113
118
  */
114
119
  optimization?: OptimizationUnion;
115
120
  /**
@@ -303,9 +308,14 @@ export interface IndexObject {
303
308
  */
304
309
  output?: string;
305
310
  }
311
+ /**
312
+ * Translate the bundles in one or more locales.
313
+ */
306
314
  export declare type Localize = string[] | boolean;
307
315
  /**
308
- * Enables optimization of the build output.
316
+ * Enables optimization of the build output. Including minification of scripts and styles,
317
+ * tree-shaking, dead-code eliminiation and fonts inlining. For more information, see
318
+ * https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.
309
319
  */
310
320
  export declare type OptimizationUnion = boolean | OptimizationClass;
311
321
  export interface OptimizationClass {
@@ -57,7 +57,7 @@
57
57
  "additionalProperties": false
58
58
  },
59
59
  "optimization": {
60
- "description": "Enables optimization of the build output.",
60
+ "description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code eliminiation and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.",
61
61
  "x-user-analytics": 16,
62
62
  "default": false,
63
63
  "oneOf": [
@@ -210,6 +210,7 @@
210
210
  "default": "warning"
211
211
  },
212
212
  "localize": {
213
+ "description": "Translate the bundles in one or more locales.",
213
214
  "oneOf": [
214
215
  {
215
216
  "type": "boolean",
@@ -429,11 +430,11 @@
429
430
  "properties": {
430
431
  "src": {
431
432
  "type": "string",
432
- "pattern": "\\.([cm]?j|t)sx?$"
433
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
433
434
  },
434
435
  "replaceWith": {
435
436
  "type": "string",
436
- "pattern": "\\.([cm]?j|t)sx?$"
437
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
437
438
  }
438
439
  },
439
440
  "additionalProperties": false,
@@ -447,11 +448,11 @@
447
448
  "properties": {
448
449
  "replace": {
449
450
  "type": "string",
450
- "pattern": "\\.([cm]?j|t)sx?$"
451
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
451
452
  },
452
453
  "with": {
453
454
  "type": "string",
454
- "pattern": "\\.([cm]?j|t)sx?$"
455
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
455
456
  }
456
457
  },
457
458
  "additionalProperties": false,
@@ -19,6 +19,7 @@ const ts = require("typescript");
19
19
  const url = require("url");
20
20
  const webpackDevServer = require("webpack-dev-server");
21
21
  const browser_1 = require("../browser");
22
+ const schema_1 = require("../browser/schema");
22
23
  const utils_1 = require("../utils");
23
24
  const cache_path_1 = require("../utils/cache-path");
24
25
  const check_port_1 = require("../utils/check-port");
@@ -64,7 +65,7 @@ function serveWebpackBrowser(options, context, transforms = {}) {
64
65
  async function setup() {
65
66
  var _a;
66
67
  // Get the browser configuration from the target name.
67
- const rawBrowserOptions = await context.getTargetOptions(browserTarget);
68
+ const rawBrowserOptions = (await context.getTargetOptions(browserTarget));
68
69
  options.port = await check_port_1.checkPort((_a = options.port) !== null && _a !== void 0 ? _a : 4200, options.host || 'localhost');
69
70
  // Override options we need to override, if defined.
70
71
  const overrides = Object.keys(options)
@@ -82,6 +83,12 @@ function serveWebpackBrowser(options, context, transforms = {}) {
82
83
  }), {});
83
84
  // In dev server we should not have budgets because of extra libs such as socks-js
84
85
  overrides.budgets = undefined;
86
+ if (rawBrowserOptions.outputHashing && rawBrowserOptions.outputHashing !== schema_1.OutputHashing.None) {
87
+ // Disable output hashing for dev build as this can cause memory leaks
88
+ // See: https://github.com/webpack/webpack-dev-server/issues/377#issuecomment-241258405
89
+ overrides.outputHashing = schema_1.OutputHashing.None;
90
+ logger.warn(`Warning: 'outputHashing' option is disabled when using the dev-server.`);
91
+ }
85
92
  const browserName = await context.getBuilderNameForTarget(browserTarget);
86
93
  const browserOptions = await context.validateOptions({ ...rawBrowserOptions, ...overrides }, browserName);
87
94
  const { config, projectRoot, i18n } = await webpack_browser_config_1.generateI18nBrowserWebpackConfigFromContext(browserOptions, context, wco => [
@@ -17,7 +17,9 @@ export interface Schema {
17
17
  */
18
18
  baseHref?: string;
19
19
  /**
20
- * Target to serve.
20
+ * A browser builder target to serve in the format of `project:target[:configuration]`. You
21
+ * can also pass in more than one configuration name as a comma-separated list. Example:
22
+ * `project:target:production,staging`.
21
23
  */
22
24
  browserTarget: string;
23
25
  /**
@@ -62,7 +64,10 @@ export interface Schema {
62
64
  */
63
65
  open?: boolean;
64
66
  /**
65
- * Enables optimization of the build output.
67
+ * Enables optimization of the build output. Including minification of scripts and styles,
68
+ * tree-shaking, dead-code eliminiation, tree-shaking and fonts inlining. For more
69
+ * information, see
70
+ * https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.
66
71
  * @deprecated Use the "optimization" option in the browser builder instead.
67
72
  */
68
73
  optimization?: OptimizationUnion;
@@ -130,7 +135,10 @@ export interface Schema {
130
135
  watch?: boolean;
131
136
  }
132
137
  /**
133
- * Enables optimization of the build output.
138
+ * Enables optimization of the build output. Including minification of scripts and styles,
139
+ * tree-shaking, dead-code eliminiation, tree-shaking and fonts inlining. For more
140
+ * information, see
141
+ * https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.
134
142
  * @deprecated Use the "optimization" option in the browser builder instead.
135
143
  */
136
144
  export declare type OptimizationUnion = boolean | OptimizationClass;
@@ -6,7 +6,7 @@
6
6
  "properties": {
7
7
  "browserTarget": {
8
8
  "type": "string",
9
- "description": "Target to serve.",
9
+ "description": "A browser builder target to serve in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
10
10
  "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
11
11
  },
12
12
  "port": {
@@ -105,7 +105,7 @@
105
105
  "x-deprecated": "No longer has an effect."
106
106
  },
107
107
  "optimization": {
108
- "description": "Enables optimization of the build output.",
108
+ "description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code eliminiation, tree-shaking and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.",
109
109
  "x-user-analytics": 16,
110
110
  "oneOf": [
111
111
  {
@@ -3,7 +3,9 @@
3
3
  */
4
4
  export interface Schema {
5
5
  /**
6
- * Target to extract from.
6
+ * A browser builder target to extract i18n messages in the format of
7
+ * `project:target[:configuration]`. You can also pass in more than one configuration name
8
+ * as a comma-separated list. Example: `project:target:production,staging`.
7
9
  */
8
10
  browserTarget: string;
9
11
  /**
@@ -6,7 +6,7 @@
6
6
  "properties": {
7
7
  "browserTarget": {
8
8
  "type": "string",
9
- "description": "Target to extract from.",
9
+ "description": "A browser builder target to extract i18n messages in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
10
10
  "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
11
11
  },
12
12
  "format": {
@@ -7,7 +7,9 @@ export interface Schema {
7
7
  */
8
8
  baseUrl?: string;
9
9
  /**
10
- * Dev server target to run tests against.
10
+ * A dev-server builder target to run tests against in the format of
11
+ * `project:target[:configuration]`. You can also pass in more than one configuration name
12
+ * as a comma-separated list. Example: `project:target:production,staging`.
11
13
  */
12
14
  devServerTarget?: string;
13
15
  /**
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "devServerTarget": {
12
12
  "type": "string",
13
- "description": "Dev server target to run tests against.",
13
+ "description": "A dev-server builder target to run tests against in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
14
14
  "pattern": "^([^:\\s]+:[^:\\s]+(:[^\\s]+)?)?$"
15
15
  },
16
16
  "grep": {
@@ -55,6 +55,9 @@ export interface Schema {
55
55
  * 'import()' syntax instead.
56
56
  */
57
57
  lazyModules?: string[];
58
+ /**
59
+ * Translate the bundles in one or more locales.
60
+ */
58
61
  localize?: Localize;
59
62
  /**
60
63
  * The name of the main entry-point file.
@@ -65,7 +68,9 @@ export interface Schema {
65
68
  */
66
69
  namedChunks?: boolean;
67
70
  /**
68
- * Enables optimization of the build output.
71
+ * Enables optimization of the build output. Including minification of scripts and styles,
72
+ * tree-shaking and dead-code eliminiation. For more information, see
73
+ * https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.
69
74
  */
70
75
  optimization?: OptimizationUnion;
71
76
  /**
@@ -146,9 +151,14 @@ export declare enum I18NMissingTranslation {
146
151
  Ignore = "ignore",
147
152
  Warning = "warning"
148
153
  }
154
+ /**
155
+ * Translate the bundles in one or more locales.
156
+ */
149
157
  export declare type Localize = string[] | boolean;
150
158
  /**
151
- * Enables optimization of the build output.
159
+ * Enables optimization of the build output. Including minification of scripts and styles,
160
+ * tree-shaking and dead-code eliminiation. For more information, see
161
+ * https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.
152
162
  */
153
163
  export declare type OptimizationUnion = boolean | OptimizationClass;
154
164
  export interface OptimizationClass {
@@ -29,7 +29,7 @@
29
29
  "additionalProperties": false
30
30
  },
31
31
  "optimization": {
32
- "description": "Enables optimization of the build output.",
32
+ "description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking and dead-code eliminiation. For more information, see https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.",
33
33
  "x-user-analytics": 16,
34
34
  "default": false,
35
35
  "oneOf": [
@@ -142,6 +142,7 @@
142
142
  "default": "warning"
143
143
  },
144
144
  "localize": {
145
+ "description": "Translate the bundles in one or more locales.",
145
146
  "oneOf": [
146
147
  {
147
148
  "type": "boolean",
@@ -260,11 +261,11 @@
260
261
  "properties": {
261
262
  "src": {
262
263
  "type": "string",
263
- "pattern": "\\.([cm]?j|t)sx?$"
264
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
264
265
  },
265
266
  "replaceWith": {
266
267
  "type": "string",
267
- "pattern": "\\.([cm]?j|t)sx?$"
268
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
268
269
  }
269
270
  },
270
271
  "additionalProperties": false,
@@ -278,11 +279,11 @@
278
279
  "properties": {
279
280
  "replace": {
280
281
  "type": "string",
281
- "pattern": "\\.([cm]?j|t)sx?$"
282
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
282
283
  },
283
284
  "with": {
284
285
  "type": "string",
285
- "pattern": "\\.([cm]?j|t)sx?$"
286
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
286
287
  }
287
288
  },
288
289
  "additionalProperties": false,
@@ -41,7 +41,7 @@ async function augmentIndexHtml(params) {
41
41
  }
42
42
  }
43
43
  }
44
- const scriptTags = [];
44
+ let scriptTags = [];
45
45
  for (const script of scripts) {
46
46
  const attrs = [`src="${deployUrl}${script}"`];
47
47
  if (crossOrigin !== 'none') {
@@ -75,7 +75,7 @@ async function augmentIndexHtml(params) {
75
75
  }
76
76
  scriptTags.push(`<script ${attrs.join(' ')}></script>`);
77
77
  }
78
- const linkTags = [];
78
+ let linkTags = [];
79
79
  for (const stylesheet of stylesheets) {
80
80
  const attrs = [
81
81
  `rel="stylesheet"`,
@@ -124,17 +124,24 @@ async function augmentIndexHtml(params) {
124
124
  for (const linkTag of linkTags) {
125
125
  rewriter.emitRaw(linkTag);
126
126
  }
127
+ linkTags = [];
127
128
  break;
128
129
  case 'body':
129
130
  // Add script tags
130
131
  for (const scriptTag of scriptTags) {
131
132
  rewriter.emitRaw(scriptTag);
132
133
  }
134
+ scriptTags = [];
133
135
  break;
134
136
  }
135
137
  rewriter.emitEndTag(tag);
136
138
  });
137
- return transformedContent;
139
+ const content = await transformedContent;
140
+ if (linkTags.length || scriptTags.length) {
141
+ // In case no body/head tags are not present (dotnet partial templates)
142
+ return linkTags.join('') + scriptTags.join('') + content;
143
+ }
144
+ return content;
138
145
  }
139
146
  exports.augmentIndexHtml = augmentIndexHtml;
140
147
  function generateSriAttributes(content) {
@@ -122,10 +122,10 @@ class InlineFontsProcessor {
122
122
  cssContent += await this.getResponse(url, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36" /* Chrome */);
123
123
  if (this.options.minifyInlinedCSS) {
124
124
  cssContent = cssContent
125
+ // Comments.
126
+ .replace(/\/\*([\s\S]*?)\*\//g, '')
125
127
  // New lines.
126
128
  .replace(/\n/g, '')
127
- // Comments and new lines.
128
- .replace(/\/\*\s.+\s\*\//g, '')
129
129
  // Safe spaces.
130
130
  .replace(/\s?[\{\:\;]\s+/g, s => s.trim());
131
131
  }
@@ -30,6 +30,9 @@ function getDevServerConfig(wco) {
30
30
  const parsedHost = url.parse(publicHost);
31
31
  publicHost = parsedHost.host;
32
32
  }
33
+ else {
34
+ publicHost = '0.0.0.0:0';
35
+ }
33
36
  if (!watch) {
34
37
  // There's no option to turn off file watching in webpack-dev-server, but
35
38
  // we can override the file watcher instead.
@@ -198,7 +198,7 @@ function getStylesConfig(wco) {
198
198
  }));
199
199
  // load global css as css files
200
200
  if (globalStylePaths.length > 0) {
201
- const globalSourceMap = !!(cssSourceMap && !buildOptions.extractCss && !buildOptions.sourceMap.hidden);
201
+ const globalSourceMap = !!cssSourceMap && !buildOptions.sourceMap.hidden;
202
202
  rules.push(...baseRules.map(({ test, use }) => {
203
203
  return {
204
204
  include: globalStylePaths,
@@ -34,7 +34,8 @@ function default_1(mod) {
34
34
  if (!appRef) {
35
35
  return;
36
36
  }
37
- const oldInputs = document.querySelectorAll('input, textarea');
37
+ // Inputs that are hidden should be ignored
38
+ const oldInputs = document.querySelectorAll('input:not([type="hidden"]), textarea');
38
39
  const oldOptions = document.querySelectorAll('option');
39
40
  // Create new application
40
41
  appRef.components
@@ -115,8 +116,8 @@ function dispatchEvents(element) {
115
116
  element.dispatchEvent(new KeyboardEvent('keyup', { key: 'Enter' }));
116
117
  }
117
118
  function restoreFormValues(oldInputs, oldOptions) {
118
- // Restore input
119
- const newInputs = document.querySelectorAll('input, textarea');
119
+ // Restore input that are not hidden
120
+ const newInputs = document.querySelectorAll('input:not([type="hidden"]), textarea');
120
121
  if (newInputs.length && newInputs.length === oldInputs.length) {
121
122
  console.log('[NG HMR] Restoring input/textarea values.');
122
123
  for (let index = 0; index < newInputs.length; index++) {
@@ -85,13 +85,14 @@ const init = (config, emitter, customFileHandlers) => {
85
85
  const hasIstanbulReporter = reporters.includes('coverage-istanbul');
86
86
  if (hasCoveragePlugin && !hasCoverageReporter) {
87
87
  reporters.push('coverage');
88
+ logger.warn(`There is a known issue with Karma and karma-coverage. Tests that exceed the coverage threshold will not fail. This will be fixed in Karma 5.2.x soon.`);
88
89
  }
89
90
  else if (hasIstanbulPlugin && !hasIstanbulReporter) {
90
91
  // coverage-istanbul is deprecated in favor of karma-coverage
91
92
  reporters.push('coverage-istanbul');
92
93
  }
93
- else {
94
- throw new Error('karma-coverage must be installed in order to run code coverage');
94
+ else if (!hasCoveragePlugin && !hasIstanbulPlugin) {
95
+ throw new Error('karma-coverage must be installed in order to run code coverage.');
95
96
  }
96
97
  if (hasIstanbulPlugin) {
97
98
  logger.warn(`'karma-coverage-istanbul-reporter' usage has been deprecated since version 11.\n` +
@@ -10,9 +10,11 @@ import { WebpackLoggingCallback } from '@angular-devkit/build-webpack';
10
10
  import { Configuration, Stats } from 'webpack';
11
11
  export declare function formatSize(size: number): string;
12
12
  export declare type BundleStatsData = [files: string, names: string, size: number | string];
13
+ export declare type ChunkType = 'modern' | 'legacy' | 'unknown';
13
14
  export interface BundleStats {
14
15
  initial: boolean;
15
16
  stats: BundleStatsData;
17
+ chunkType: ChunkType;
16
18
  }
17
19
  export declare function generateBundleStats(info: {
18
20
  size?: number;
@@ -21,7 +23,8 @@ export declare function generateBundleStats(info: {
21
23
  entry: boolean;
22
24
  initial: boolean;
23
25
  rendered?: boolean;
24
- }, colors: boolean): BundleStats;
26
+ chunkType?: ChunkType;
27
+ }): BundleStats;
25
28
  export declare function statsWarningsToString(json: any, statsConfig: any): string;
26
29
  export declare function statsErrorsToString(json: any, statsConfig: any): string;
27
30
  export declare function statsHasErrors(json: any): boolean;
@@ -27,13 +27,15 @@ function formatSize(size) {
27
27
  }
28
28
  exports.formatSize = formatSize;
29
29
  ;
30
- function generateBundleStats(info, colors) {
30
+ function generateBundleStats(info) {
31
31
  var _a;
32
32
  const size = typeof info.size === 'number' ? info.size : '-';
33
33
  const files = info.files.filter(f => !f.endsWith('.map')).map(f => path.basename(f)).join(', ');
34
34
  const names = ((_a = info.names) === null || _a === void 0 ? void 0 : _a.length) ? info.names.join(', ') : '-';
35
35
  const initial = !!(info.entry || info.initial);
36
+ const chunkType = info.chunkType || 'unknown';
36
37
  return {
38
+ chunkType,
37
39
  initial,
38
40
  stats: [files, names, size],
39
41
  };
@@ -46,8 +48,10 @@ function generateBuildStatsTable(data, colors, showTotalSize) {
46
48
  const dim = (x) => colors ? color_1.colors.dim(x) : x;
47
49
  const changedEntryChunksStats = [];
48
50
  const changedLazyChunksStats = [];
49
- let initialTotalSize = 0;
50
- for (const { initial, stats } of data) {
51
+ let initialModernTotalSize = 0;
52
+ let initialLegacyTotalSize = 0;
53
+ let modernFileSuffix;
54
+ for (const { initial, stats, chunkType } of data) {
51
55
  const [files, names, size] = stats;
52
56
  const data = [
53
57
  g(files),
@@ -57,7 +61,22 @@ function generateBuildStatsTable(data, colors, showTotalSize) {
57
61
  if (initial) {
58
62
  changedEntryChunksStats.push(data);
59
63
  if (typeof size === 'number') {
60
- initialTotalSize += size;
64
+ switch (chunkType) {
65
+ case 'modern':
66
+ initialModernTotalSize += size;
67
+ if (!modernFileSuffix) {
68
+ const match = files.match(/-(es20\d{2}|esnext)/);
69
+ modernFileSuffix = match === null || match === void 0 ? void 0 : match[1].toString().toUpperCase();
70
+ }
71
+ break;
72
+ case 'legacy':
73
+ initialLegacyTotalSize += size;
74
+ break;
75
+ default:
76
+ initialModernTotalSize += size;
77
+ initialLegacyTotalSize += size;
78
+ break;
79
+ }
61
80
  }
62
81
  }
63
82
  else {
@@ -70,7 +89,12 @@ function generateBuildStatsTable(data, colors, showTotalSize) {
70
89
  bundleInfo.push(['Initial Chunk Files', 'Names', 'Size'].map(bold), ...changedEntryChunksStats);
71
90
  if (showTotalSize) {
72
91
  bundleInfo.push([]);
73
- bundleInfo.push([' ', 'Initial Total', formatSize(initialTotalSize)].map(bold));
92
+ if (initialModernTotalSize === initialLegacyTotalSize) {
93
+ bundleInfo.push([' ', 'Initial Total', formatSize(initialModernTotalSize)].map(bold));
94
+ }
95
+ else {
96
+ bundleInfo.push([' ', 'Initial ES5 Total', formatSize(initialLegacyTotalSize)].map(bold), [' ', `Initial ${modernFileSuffix} Total`, formatSize(initialModernTotalSize)].map(bold));
97
+ }
74
98
  }
75
99
  }
76
100
  // Seperator
@@ -103,7 +127,7 @@ function statsToString(json, statsConfig, bundleState) {
103
127
  }
104
128
  const assets = json.assets.filter((asset) => chunk.files.includes(asset.name));
105
129
  const summedSize = assets.filter((asset) => !asset.name.endsWith(".map")).reduce((total, asset) => { return total + asset.size; }, 0);
106
- changedChunksStats.push(generateBundleStats({ ...chunk, size: summedSize }, colors));
130
+ changedChunksStats.push(generateBundleStats({ ...chunk, size: summedSize }));
107
131
  }
108
132
  unchangedChunkNumber = json.chunks.length - changedChunksStats.length;
109
133
  }