@angular-devkit/build-angular 12.1.0-next.5 → 12.1.2

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 (70) hide show
  1. package/package.json +24 -23
  2. package/src/app-shell/index.js +28 -8
  3. package/src/babel/plugins/adjust-static-class-members.js +4 -1
  4. package/src/babel/plugins/adjust-typescript-enums.js +4 -1
  5. package/src/babel/plugins/pure-toplevel-functions.js +24 -2
  6. package/src/babel/presets/application.js +25 -4
  7. package/src/browser/index.d.ts +1 -4
  8. package/src/browser/index.js +38 -36
  9. package/src/dev-server/index.d.ts +1 -1
  10. package/src/dev-server/index.js +31 -10
  11. package/src/dev-server/tests/execute-fetch.js +4 -1
  12. package/src/extract-i18n/index.d.ts +1 -1
  13. package/src/extract-i18n/index.js +34 -12
  14. package/src/extract-i18n/ivy-extract-loader.js +20 -1
  15. package/src/karma/find-tests.js +20 -1
  16. package/src/karma/index.js +21 -2
  17. package/src/ng-packagr/index.js +21 -2
  18. package/src/protractor/index.js +21 -2
  19. package/src/server/index.d.ts +1 -1
  20. package/src/server/index.js +21 -2
  21. package/src/server/tests/setup.d.ts +18 -0
  22. package/src/server/tests/setup.js +27 -0
  23. package/src/tslint/index.js +22 -3
  24. package/src/utils/action-cache.js +21 -2
  25. package/src/utils/action-executor.js +21 -2
  26. package/src/utils/build-browser-features.js +25 -3
  27. package/src/utils/cache-path.js +5 -2
  28. package/src/utils/check-port.js +20 -1
  29. package/src/utils/color.js +20 -1
  30. package/src/utils/copy-assets.js +26 -4
  31. package/src/utils/copy-file.js +20 -1
  32. package/src/utils/delete-output-dir.js +28 -2
  33. package/src/utils/environment-options.d.ts +1 -0
  34. package/src/utils/environment-options.js +26 -2
  35. package/src/utils/find-up.js +20 -1
  36. package/src/utils/i18n-inlining.js +21 -2
  37. package/src/utils/i18n-options.js +22 -3
  38. package/src/utils/index-file/html-rewriting-stream.js +20 -1
  39. package/src/utils/index-file/index-html-generator.js +20 -1
  40. package/src/utils/index-file/inline-critical-css.js +20 -1
  41. package/src/utils/index-file/inline-fonts.js +27 -5
  42. package/src/utils/is-directory.js +20 -1
  43. package/src/utils/load-translations.js +26 -7
  44. package/src/utils/process-bundle.js +34 -12
  45. package/src/utils/read-tsconfig.js +20 -1
  46. package/src/utils/service-worker.js +21 -2
  47. package/src/utils/spinner.js +5 -2
  48. package/src/utils/version.d.ts +1 -2
  49. package/src/utils/version.js +5 -4
  50. package/src/utils/webpack-browser-config.js +21 -2
  51. package/src/webpack/configs/analytics.d.ts +11 -0
  52. package/src/webpack/configs/analytics.js +29 -0
  53. package/src/webpack/configs/browser.js +0 -16
  54. package/src/webpack/configs/common.js +94 -16
  55. package/src/webpack/configs/dev-server.js +20 -1
  56. package/src/webpack/configs/index.d.ts +1 -0
  57. package/src/webpack/configs/index.js +1 -0
  58. package/src/webpack/configs/server.js +0 -1
  59. package/src/webpack/configs/styles.js +30 -2
  60. package/src/webpack/configs/test.js +32 -3
  61. package/src/webpack/configs/typescript.d.ts +2 -9
  62. package/src/webpack/configs/typescript.js +16 -14
  63. package/src/webpack/plugins/any-component-style-budget-checker.js +20 -1
  64. package/src/webpack/plugins/index.js +4 -1
  65. package/src/webpack/plugins/karma/karma.js +26 -4
  66. package/src/webpack/plugins/postcss-cli-resources.js +21 -2
  67. package/src/webpack/plugins/scripts-webpack-plugin.js +20 -1
  68. package/src/webpack/utils/helpers.js +20 -1
  69. package/src/webpack/utils/stats.d.ts +0 -1
  70. package/src/webpack/utils/stats.js +35 -12
@@ -11,10 +11,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
12
12
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13
13
  };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
14
17
  var _Spinner_isTTY;
15
18
  Object.defineProperty(exports, "__esModule", { value: true });
16
19
  exports.Spinner = void 0;
17
- const ora = require("ora");
20
+ const ora_1 = __importDefault(require("ora"));
18
21
  const color_1 = require("./color");
19
22
  const tty_1 = require("./tty");
20
23
  class Spinner {
@@ -22,7 +25,7 @@ class Spinner {
22
25
  /** When false, only fail messages will be displayed. */
23
26
  this.enabled = true;
24
27
  _Spinner_isTTY.set(this, tty_1.isTTY());
25
- this.spinner = ora({
28
+ this.spinner = ora_1.default({
26
29
  text,
27
30
  // The below 2 options are needed because otherwise CTRL+C will be delayed
28
31
  // when the underlying process is sync.
@@ -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 { logging } from '@angular-devkit/core';
9
- export declare function assertCompatibleAngularVersion(projectRoot: string, logger: logging.LoggerApi): void;
8
+ export declare function assertCompatibleAngularVersion(projectRoot: string): void | never;
@@ -8,9 +8,10 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.assertCompatibleAngularVersion = void 0;
11
+ /* eslint-disable no-console */
11
12
  const core_1 = require("@angular-devkit/core");
12
13
  const semver_1 = require("semver");
13
- function assertCompatibleAngularVersion(projectRoot, logger) {
14
+ function assertCompatibleAngularVersion(projectRoot) {
14
15
  let angularCliPkgJson;
15
16
  let angularPkgJson;
16
17
  let rxjsPkgJson;
@@ -22,13 +23,13 @@ function assertCompatibleAngularVersion(projectRoot, logger) {
22
23
  rxjsPkgJson = require(rxjsPackagePath);
23
24
  }
24
25
  catch {
25
- logger.error(core_1.tags.stripIndents `
26
+ console.error(core_1.tags.stripIndents `
26
27
  You seem to not be depending on "@angular/core" and/or "rxjs". This is an error.
27
28
  `);
28
29
  process.exit(2);
29
30
  }
30
31
  if (!(angularPkgJson && angularPkgJson['version'] && rxjsPkgJson && rxjsPkgJson['version'])) {
31
- logger.error(core_1.tags.stripIndents `
32
+ console.error(core_1.tags.stripIndents `
32
33
  Cannot determine versions of "@angular/core" and/or "rxjs".
33
34
  This likely means your local installation is broken. Please reinstall your packages.
34
35
  `);
@@ -57,7 +58,7 @@ function assertCompatibleAngularVersion(projectRoot, logger) {
57
58
  // of both 8 and 9.
58
59
  const supportedAngularSemver = `^${cliMajor}.0.0-next || >=${cliMajor}.0.0 <${cliMajor + 1}.0.0`;
59
60
  if (!semver_1.satisfies(angularVersion, supportedAngularSemver, { includePrerelease: true })) {
60
- logger.error(core_1.tags.stripIndents `
61
+ console.error(core_1.tags.stripIndents `
61
62
  This version of CLI is only compatible with Angular versions ${supportedAngularSemver},
62
63
  but Angular version ${angularVersion} was found instead.
63
64
 
@@ -6,10 +6,29 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.getIndexInputFile = exports.getIndexOutputFile = exports.generateBrowserWebpackConfigFromContext = exports.generateI18nBrowserWebpackConfigFromContext = exports.generateWebpackConfig = void 0;
11
30
  const core_1 = require("@angular-devkit/core");
12
- const path = require("path");
31
+ const path = __importStar(require("path"));
13
32
  const webpack_1 = require("webpack");
14
33
  const webpack_merge_1 = require("webpack-merge");
15
34
  const utils_1 = require("../utils");
@@ -23,7 +42,7 @@ async function generateWebpackConfig(workspaceRoot, projectRoot, sourceRoot, opt
23
42
  }
24
43
  const tsConfigPath = path.resolve(workspaceRoot, options.tsConfig);
25
44
  const tsConfig = read_tsconfig_1.readTsconfig(tsConfigPath);
26
- const ts = await Promise.resolve().then(() => require('typescript'));
45
+ const ts = await Promise.resolve().then(() => __importStar(require('typescript')));
27
46
  const scriptTarget = tsConfig.options.target || ts.ScriptTarget.ES5;
28
47
  const buildOptions = { ...options, ...extraBuildOptions };
29
48
  const wco = {
@@ -0,0 +1,11 @@
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
+ */
8
+ import { BuilderContext } from '@angular-devkit/architect';
9
+ import { Configuration } from 'webpack';
10
+ import { WebpackConfigOptions } from '../../utils/build-options';
11
+ export declare function getAnalyticsConfig(wco: WebpackConfigOptions, context: BuilderContext): Configuration;
@@ -0,0 +1,29 @@
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
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.getAnalyticsConfig = void 0;
11
+ const analytics_1 = require("../plugins/analytics");
12
+ function getAnalyticsConfig(wco, context) {
13
+ if (!context.analytics) {
14
+ return {};
15
+ }
16
+ // If there's analytics, add our plugin. Otherwise no need to slow down the build.
17
+ let category = 'build';
18
+ if (context.builder) {
19
+ // We already vetted that this is a "safe" package, otherwise the analytics would be noop.
20
+ category = context.builder.builderName.split(':')[1] || context.builder.builderName || 'build';
21
+ }
22
+ // The category is the builder name if it's an angular builder.
23
+ return {
24
+ plugins: [
25
+ new analytics_1.NgBuildAnalyticsPlugin(wco.projectRoot, context.analytics, category, !!wco.tsConfig.options.enableIvy),
26
+ ],
27
+ };
28
+ }
29
+ exports.getAnalyticsConfig = getAnalyticsConfig;
@@ -8,7 +8,6 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.getBrowserConfig = void 0;
11
- const typescript_1 = require("typescript");
12
11
  const utils_1 = require("../../utils");
13
12
  const plugins_1 = require("../plugins");
14
13
  const helpers_1 = require("../utils/helpers");
@@ -23,18 +22,6 @@ function getBrowserConfig(wco) {
23
22
  hashFuncNames: ['sha384'],
24
23
  }));
25
24
  }
26
- if (extractLicenses) {
27
- const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
28
- extraPlugins.push(new LicenseWebpackPlugin({
29
- stats: {
30
- warnings: false,
31
- errors: false,
32
- },
33
- perChunkOutput: false,
34
- outputFilename: '3rdpartylicenses.txt',
35
- skipChildCompilers: true,
36
- }));
37
- }
38
25
  if (scriptsSourceMap || stylesSourceMap) {
39
26
  extraPlugins.push(helpers_1.getSourceMapDevTool(scriptsSourceMap, stylesSourceMap, buildOptions.differentialLoadingNeeded && !buildOptions.watch ? true : hiddenSourceMap, false));
40
27
  }
@@ -51,9 +38,6 @@ function getBrowserConfig(wco) {
51
38
  resolve: {
52
39
  mainFields: ['es2015', 'browser', 'module', 'main'],
53
40
  },
54
- target: wco.tsConfig.options.target === typescript_1.ScriptTarget.ES5 || buildBrowserFeatures.isEs5SupportNeeded()
55
- ? ['web', 'es5']
56
- : 'web',
57
41
  output: {
58
42
  crossOriginLoading,
59
43
  trustedTypes: 'angular#bundler',
@@ -6,12 +6,36 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
9
31
  Object.defineProperty(exports, "__esModule", { value: true });
10
32
  exports.getCommonConfig = void 0;
11
33
  const build_optimizer_1 = require("@angular-devkit/build-optimizer");
12
- const CopyWebpackPlugin = require("copy-webpack-plugin");
34
+ const compiler_cli_1 = require("@angular/compiler-cli");
35
+ const copy_webpack_plugin_1 = __importDefault(require("copy-webpack-plugin"));
36
+ const crypto_1 = require("crypto");
13
37
  const fs_1 = require("fs");
14
- const path = require("path");
38
+ const path = __importStar(require("path"));
15
39
  const typescript_1 = require("typescript");
16
40
  const webpack_1 = require("webpack");
17
41
  const utils_1 = require("../../utils");
@@ -22,7 +46,6 @@ const spinner_1 = require("../../utils/spinner");
22
46
  const webpack_diagnostics_1 = require("../../utils/webpack-diagnostics");
23
47
  const plugins_1 = require("../plugins");
24
48
  const helpers_1 = require("../utils/helpers");
25
- const stats_1 = require("../utils/stats");
26
49
  // eslint-disable-next-line max-lines-per-function
27
50
  function getCommonConfig(wco) {
28
51
  var _a, _b;
@@ -179,7 +202,7 @@ function getCommonConfig(wco) {
179
202
  },
180
203
  };
181
204
  });
182
- extraPlugins.push(new CopyWebpackPlugin({
205
+ extraPlugins.push(new copy_webpack_plugin_1.default({
183
206
  patterns: copyWebpackPluginPatterns,
184
207
  }));
185
208
  }
@@ -189,11 +212,23 @@ function getCommonConfig(wco) {
189
212
  exclude: /[\\\/]node_modules[\\\/]/,
190
213
  }));
191
214
  }
215
+ if (buildOptions.extractLicenses) {
216
+ const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
217
+ extraPlugins.push(new LicenseWebpackPlugin({
218
+ stats: {
219
+ warnings: false,
220
+ errors: false,
221
+ },
222
+ perChunkOutput: false,
223
+ outputFilename: '3rdpartylicenses.txt',
224
+ skipChildCompilers: true,
225
+ }));
226
+ }
192
227
  if (buildOptions.statsJson) {
193
228
  extraPlugins.push(new (class {
194
229
  apply(compiler) {
195
230
  compiler.hooks.done.tapPromise('angular-cli-stats', async (stats) => {
196
- const { stringifyStream } = await Promise.resolve().then(() => require('@discoveryjs/json-ext'));
231
+ const { stringifyStream } = await Promise.resolve().then(() => __importStar(require('@discoveryjs/json-ext')));
197
232
  const data = stats.toJson('verbose');
198
233
  const statsOutputPath = path.resolve(root, buildOptions.outputPath, 'stats.json');
199
234
  try {
@@ -231,10 +266,9 @@ function getCommonConfig(wco) {
231
266
  const extraMinimizers = [];
232
267
  if (scriptsOptimization) {
233
268
  const TerserPlugin = require('terser-webpack-plugin');
234
- const { GLOBAL_DEFS_FOR_TERSER, GLOBAL_DEFS_FOR_TERSER_WITH_AOT, } = require('@angular/compiler-cli');
235
269
  const angularGlobalDefinitions = buildOptions.aot
236
- ? GLOBAL_DEFS_FOR_TERSER_WITH_AOT
237
- : GLOBAL_DEFS_FOR_TERSER;
270
+ ? compiler_cli_1.GLOBAL_DEFS_FOR_TERSER_WITH_AOT
271
+ : compiler_cli_1.GLOBAL_DEFS_FOR_TERSER;
238
272
  // TODO: Investigate why this fails for some packages: wco.supportES2015 ? 6 : 5;
239
273
  const terserEcma = 5;
240
274
  const terserOptions = {
@@ -302,12 +336,19 @@ function getCommonConfig(wco) {
302
336
  return {
303
337
  mode: scriptsOptimization || stylesOptimization.minify ? 'production' : 'development',
304
338
  devtool: false,
339
+ target: [
340
+ platform === 'server' ? 'node' : 'web',
341
+ tsConfig.options.target === typescript_1.ScriptTarget.ES5 ||
342
+ (platform !== 'server' && buildBrowserFeatures.isEs5SupportNeeded())
343
+ ? 'es5'
344
+ : 'es2015',
345
+ ],
305
346
  profile: buildOptions.statsJson,
306
347
  resolve: {
307
348
  roots: [projectRoot],
308
349
  extensions: ['.ts', '.tsx', '.mjs', '.js'],
309
350
  symlinks: !buildOptions.preserveSymlinks,
310
- modules: [wco.tsConfig.options.baseUrl || projectRoot, 'node_modules'],
351
+ modules: [tsConfig.options.baseUrl || projectRoot, 'node_modules'],
311
352
  },
312
353
  resolveLoader: {
313
354
  symlinks: !buildOptions.preserveSymlinks,
@@ -333,14 +374,22 @@ function getCommonConfig(wco) {
333
374
  return `[name]${targetInFileName}${hashFormat.chunk}.js`;
334
375
  }
335
376
  },
336
- chunkFilename: `[id]${targetInFileName}${hashFormat.chunk}.js`,
377
+ chunkFilename: `[name]${targetInFileName}${hashFormat.chunk}.js`,
337
378
  },
338
379
  watch: buildOptions.watch,
339
380
  watchOptions: helpers_1.getWatchOptions(buildOptions.poll),
340
381
  performance: {
341
382
  hints: false,
342
383
  },
343
- ignoreWarnings: stats_1.IGNORE_WARNINGS,
384
+ ignoreWarnings: [
385
+ // Webpack 5+ has no facility to disable this warning.
386
+ // System.import is used in @angular/core for deprecated string-form lazy routes
387
+ /System.import\(\) is deprecated and will be removed soon/i,
388
+ // https://github.com/webpack-contrib/source-map-loader/blob/b2de4249c7431dd8432da607e08f0f65e9d64219/src/index.js#L83
389
+ /Failed to parse source map from/,
390
+ // https://github.com/webpack-contrib/postcss-loader/blob/bd261875fdf9c596af4ffb3a1a73fe3c549befda/src/index.js#L153-L158
391
+ /Add postcss as project dependency/,
392
+ ],
344
393
  module: {
345
394
  // Show an error for missing exports instead of a warning.
346
395
  strictExportPresence: true,
@@ -383,11 +432,7 @@ function getCommonConfig(wco) {
383
432
  syncWebAssembly: true,
384
433
  asyncWebAssembly: true,
385
434
  },
386
- cache: !!buildOptions.watch &&
387
- !environment_options_1.cachingDisabled && {
388
- type: 'memory',
389
- maxGenerations: 1,
390
- },
435
+ cache: getCacheSettings(wco, buildBrowserFeatures.supportedBrowsers),
391
436
  optimization: {
392
437
  minimizer: extraMinimizers,
393
438
  moduleIds: 'deterministic',
@@ -404,3 +449,36 @@ function getCommonConfig(wco) {
404
449
  };
405
450
  }
406
451
  exports.getCommonConfig = getCommonConfig;
452
+ function getCacheSettings(wco, supportedBrowsers) {
453
+ if (environment_options_1.persistentBuildCacheEnabled) {
454
+ const packageVersion = require('../../../package.json').version;
455
+ return {
456
+ type: 'filesystem',
457
+ cacheDirectory: cache_path_1.findCachePath('angular-webpack'),
458
+ maxMemoryGenerations: 1,
459
+ // We use the versions and build options as the cache name. The Webpack configurations are too
460
+ // dynamic and shared among different build types: test, build and serve.
461
+ // None of which are "named".
462
+ name: crypto_1.createHash('sha1')
463
+ .update(compiler_cli_1.VERSION.full)
464
+ .update(packageVersion)
465
+ .update(wco.projectRoot)
466
+ .update(JSON.stringify(wco.tsConfig))
467
+ .update(JSON.stringify({
468
+ ...wco.buildOptions,
469
+ // Needed because outputPath changes on every build when using i18n extraction
470
+ // https://github.com/angular/angular-cli/blob/736a5f89deaca85f487b78aec9ff66d4118ceb6a/packages/angular_devkit/build_angular/src/utils/i18n-options.ts#L264-L265
471
+ outputPath: undefined,
472
+ }))
473
+ .update(supportedBrowsers.join(''))
474
+ .digest('hex'),
475
+ };
476
+ }
477
+ if (wco.buildOptions.watch && !environment_options_1.cachingDisabled) {
478
+ return {
479
+ type: 'memory',
480
+ maxGenerations: 1,
481
+ };
482
+ }
483
+ return false;
484
+ }
@@ -6,12 +6,31 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.buildServePath = exports.getDevServerConfig = void 0;
11
30
  const core_1 = require("@angular-devkit/core");
12
31
  const fs_1 = require("fs");
13
32
  const path_1 = require("path");
14
- const url = require("url");
33
+ const url = __importStar(require("url"));
15
34
  const utils_1 = require("../../utils");
16
35
  const webpack_browser_config_1 = require("../../utils/webpack-browser-config");
17
36
  const hmr_loader_1 = require("../plugins/hmr/hmr-loader");
@@ -5,6 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
+ export * from './analytics';
8
9
  export * from './browser';
9
10
  export * from './common';
10
11
  export * from './dev-server';
@@ -17,6 +17,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
17
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./analytics"), exports);
20
21
  __exportStar(require("./browser"), exports);
21
22
  __exportStar(require("./common"), exports);
22
23
  __exportStar(require("./dev-server"), exports);
@@ -30,7 +30,6 @@ function getServerConfig(wco) {
30
30
  resolve: {
31
31
  mainFields: ['es2015', 'main', 'module'],
32
32
  },
33
- target: 'node',
34
33
  output: {
35
34
  libraryTarget: 'commonjs',
36
35
  },
@@ -6,10 +6,29 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.getStylesConfig = void 0;
11
- const fs = require("fs");
12
- const path = require("path");
30
+ const fs = __importStar(require("fs"));
31
+ const path = __importStar(require("path"));
13
32
  const sass_service_1 = require("../../sass/sass-service");
14
33
  const build_browser_features_1 = require("../../utils/build-browser-features");
15
34
  const environment_options_1 = require("../../utils/environment-options");
@@ -251,6 +270,9 @@ function getStylesConfig(wco) {
251
270
  // Ex: /* autoprefixer grid: autoplace */
252
271
  // See: https://github.com/webpack-contrib/sass-loader/blob/45ad0be17264ceada5f0b4fb87e9357abe85c4ff/src/getSassOptions.js#L68-L70
253
272
  outputStyle: 'expanded',
273
+ // Silences compiler warnings from 3rd party stylesheets
274
+ quietDeps: !buildOptions.verbose,
275
+ verbose: buildOptions.verbose,
254
276
  },
255
277
  },
256
278
  },
@@ -280,6 +302,9 @@ function getStylesConfig(wco) {
280
302
  // Ex: /* autoprefixer grid: autoplace */
281
303
  // See: https://github.com/webpack-contrib/sass-loader/blob/45ad0be17264ceada5f0b4fb87e9357abe85c4ff/src/getSassOptions.js#L68-L70
282
304
  outputStyle: 'expanded',
305
+ // Silences compiler warnings from 3rd party stylesheets
306
+ quietDeps: !buildOptions.verbose,
307
+ verbose: buildOptions.verbose,
283
308
  },
284
309
  },
285
310
  },
@@ -365,6 +390,9 @@ function getStylesConfig(wco) {
365
390
  calc: false,
366
391
  // Disable CSS rules sorted due to several issues #20693, https://github.com/ionic-team/ionic-framework/issues/23266 and https://github.com/cssnano/cssnano/issues/1054
367
392
  cssDeclarationSorter: false,
393
+ // Workaround for Critters as it doesn't work when `@media all {}` is minified to `@media {}`.
394
+ // TODO: Remove once they move to postcss.
395
+ minifyParams: !buildOptions.optimization.styles.inlineCritical,
368
396
  },
369
397
  ],
370
398
  };
@@ -6,13 +6,33 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.getTestConfig = void 0;
11
- const glob = require("glob");
12
- const path = require("path");
30
+ const glob = __importStar(require("glob"));
31
+ const path = __importStar(require("path"));
32
+ const typescript_1 = require("typescript");
13
33
  const helpers_1 = require("../utils/helpers");
14
34
  function getTestConfig(wco) {
15
- const { buildOptions: { codeCoverage, codeCoverageExclude, main, sourceMap }, root, sourceRoot, } = wco;
35
+ const { buildOptions: { codeCoverage, codeCoverageExclude, main, sourceMap, webWorkerTsConfig }, root, sourceRoot, } = wco;
16
36
  const extraRules = [];
17
37
  const extraPlugins = [];
18
38
  if (codeCoverage) {
@@ -38,6 +58,7 @@ function getTestConfig(wco) {
38
58
  }
39
59
  return {
40
60
  mode: 'development',
61
+ target: wco.tsConfig.options.target === typescript_1.ScriptTarget.ES5 ? ['web', 'es5'] : 'web',
41
62
  resolve: {
42
63
  mainFields: ['es2015', 'browser', 'module', 'main'],
43
64
  },
@@ -47,6 +68,14 @@ function getTestConfig(wco) {
47
68
  },
48
69
  module: {
49
70
  rules: extraRules,
71
+ parser: webWorkerTsConfig === undefined
72
+ ? {
73
+ javascript: {
74
+ worker: false,
75
+ url: false,
76
+ },
77
+ }
78
+ : undefined,
50
79
  },
51
80
  plugins: extraPlugins,
52
81
  optimization: {
@@ -6,14 +6,7 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { AngularWebpackPlugin } from '@ngtools/webpack';
9
+ import { Configuration } from 'webpack';
9
10
  import { WebpackConfigOptions } from '../../utils/build-options';
10
- export declare function getTypeScriptConfig(wco: WebpackConfigOptions): {
11
- module: {
12
- rules: {
13
- test: RegExp;
14
- loader: string;
15
- }[];
16
- };
17
- plugins: AngularWebpackPlugin[];
18
- };
11
+ export declare function getTypeScriptConfig(wco: WebpackConfigOptions): Configuration;
19
12
  export declare function getTypescriptWorkerPlugin(wco: WebpackConfigOptions, workerTsConfigPath: string): AngularWebpackPlugin;
@@ -63,20 +63,22 @@ function createIvyPlugin(wco, aot, tsconfig) {
63
63
  });
64
64
  }
65
65
  function getTypeScriptConfig(wco) {
66
- const { buildOptions, tsConfigPath } = wco;
67
- const aot = !!buildOptions.aot;
68
- ensureIvy(wco);
69
- return {
70
- module: {
71
- rules: [
72
- {
73
- test: /\.[jt]sx?$/,
74
- loader: webpack_1.AngularWebpackLoaderPath,
75
- },
76
- ],
77
- },
78
- plugins: [createIvyPlugin(wco, aot, tsConfigPath)],
79
- };
66
+ const { buildOptions: { aot = false, main, polyfills }, tsConfigPath, } = wco;
67
+ if (main || polyfills) {
68
+ ensureIvy(wco);
69
+ return {
70
+ module: {
71
+ rules: [
72
+ {
73
+ test: /\.[jt]sx?$/,
74
+ loader: webpack_1.AngularWebpackLoaderPath,
75
+ },
76
+ ],
77
+ },
78
+ plugins: [createIvyPlugin(wco, aot, tsConfigPath)],
79
+ };
80
+ }
81
+ return {};
80
82
  }
81
83
  exports.getTypeScriptConfig = getTypeScriptConfig;
82
84
  function getTypescriptWorkerPlugin(wco, workerTsConfigPath) {
@@ -6,9 +6,28 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.AnyComponentStyleBudgetChecker = void 0;
11
- const path = require("path");
30
+ const path = __importStar(require("path"));
12
31
  const webpack_1 = require("webpack");
13
32
  const schema_1 = require("../../browser/schema");
14
33
  const bundle_calculator_1 = require("../../utils/bundle-calculator");