@angular-devkit/build-angular 0.803.22 → 0.803.26

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,32 +1,32 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "0.803.22",
3
+ "version": "0.803.26",
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.803.22",
11
- "@angular-devkit/build-optimizer": "0.803.22",
12
- "@angular-devkit/build-webpack": "0.803.22",
13
- "@angular-devkit/core": "8.3.22",
14
- "@babel/core": "7.7.5",
15
- "@babel/preset-env": "7.7.6",
16
- "@ngtools/webpack": "8.3.22",
10
+ "@angular-devkit/architect": "0.803.26",
11
+ "@angular-devkit/build-optimizer": "0.803.26",
12
+ "@angular-devkit/build-webpack": "0.803.26",
13
+ "@angular-devkit/core": "8.3.26",
14
+ "@babel/core": "7.8.7",
15
+ "@babel/preset-env": "7.8.7",
16
+ "@ngtools/webpack": "8.3.26",
17
17
  "ajv": "6.10.2",
18
18
  "autoprefixer": "9.6.1",
19
- "browserslist": "4.8.3",
19
+ "browserslist": "4.10.0",
20
20
  "cacache": "12.0.2",
21
- "caniuse-lite": "1.0.30001019",
21
+ "caniuse-lite": "1.0.30001035",
22
22
  "circular-dependency-plugin": "5.2.0",
23
23
  "clean-css": "4.2.1",
24
+ "coverage-istanbul-loader": "2.0.3",
24
25
  "copy-webpack-plugin": "5.1.1",
25
- "core-js": "3.2.1",
26
+ "core-js": "3.6.4",
26
27
  "file-loader": "4.2.0",
27
28
  "find-cache-dir": "3.0.0",
28
29
  "glob": "7.1.4",
29
- "istanbul-instrumenter-loader": "3.0.1",
30
30
  "jest-worker": "24.9.0",
31
31
  "karma-source-map-support": "1.4.0",
32
32
  "less": "3.9.0",
@@ -53,8 +53,8 @@
53
53
  "style-loader": "1.0.0",
54
54
  "stylus": "0.54.5",
55
55
  "stylus-loader": "3.0.2",
56
- "tree-kill": "1.2.1",
57
- "terser": "4.3.9",
56
+ "tree-kill": "1.2.2",
57
+ "terser": "4.6.3",
58
58
  "terser-webpack-plugin": "1.4.3",
59
59
  "webpack": "4.39.2",
60
60
  "webpack-dev-middleware": "3.7.2",
@@ -8,7 +8,7 @@
8
8
  import { logging } from '@angular-devkit/core';
9
9
  import { ParsedConfiguration } from '@angular/compiler-cli';
10
10
  import { ScriptTarget } from 'typescript';
11
- import { AssetPatternClass, Budget, ExtraEntryPoint, OptimizationClass, SourceMapClass } from '../../browser/schema';
11
+ import { AssetPatternClass, Budget, CrossOrigin, ExtraEntryPoint, OptimizationClass, SourceMapClass } from '../../browser/schema';
12
12
  import { NormalizedFileReplacement } from '../../utils/normalize-file-replacements';
13
13
  export interface BuildOptions {
14
14
  optimization: OptimizationClass;
@@ -43,6 +43,7 @@ export interface BuildOptions {
43
43
  showCircularDependencies?: boolean;
44
44
  buildOptimizer?: boolean;
45
45
  namedChunks?: boolean;
46
+ crossOrigin?: CrossOrigin;
46
47
  subresourceIntegrity?: boolean;
47
48
  serviceWorker?: boolean;
48
49
  webWorkerTsConfig?: string;
@@ -91,7 +91,14 @@ import 'core-js/modules/es.parse-float';
91
91
  import 'core-js/es/number';
92
92
  import 'core-js/es/math';
93
93
  import 'core-js/es/date';
94
- import 'core-js/es/regexp';
94
+
95
+ import 'core-js/modules/es.regexp.constructor';
96
+ import 'core-js/modules/es.regexp.to-string';
97
+ import 'core-js/modules/es.regexp.flags';
98
+ import 'core-js/modules/es.string.match';
99
+ import 'core-js/modules/es.string.replace';
100
+ import 'core-js/modules/es.string.search';
101
+ import 'core-js/modules/es.string.split';
95
102
 
96
103
  import 'core-js/modules/es.map';
97
104
  import 'core-js/modules/es.weak-map';
@@ -12,38 +12,46 @@ const utils_1 = require("./utils");
12
12
  const SubresourceIntegrityPlugin = require('webpack-subresource-integrity');
13
13
  function getBrowserConfig(wco) {
14
14
  const { buildOptions } = wco;
15
+ const { crossOrigin = 'none', subresourceIntegrity, evalSourceMap, extractLicenses, vendorChunk, commonChunk, styles, } = buildOptions;
15
16
  const extraPlugins = [];
16
17
  let isEval = false;
17
18
  const { styles: stylesOptimization, scripts: scriptsOptimization } = buildOptions.optimization;
18
19
  const { styles: stylesSourceMap, scripts: scriptsSourceMap, hidden: hiddenSourceMap, } = buildOptions.sourceMap;
19
20
  // See https://webpack.js.org/configuration/devtool/ for sourcemap types.
20
21
  if ((stylesSourceMap || scriptsSourceMap) &&
21
- buildOptions.evalSourceMap &&
22
+ evalSourceMap &&
22
23
  !stylesOptimization &&
23
24
  !scriptsOptimization) {
24
25
  // Produce eval sourcemaps for development with serve, which are faster.
25
26
  isEval = true;
26
27
  }
27
- if (buildOptions.subresourceIntegrity) {
28
+ if (subresourceIntegrity) {
28
29
  extraPlugins.push(new SubresourceIntegrityPlugin({
29
30
  hashFuncNames: ['sha384'],
30
31
  }));
31
32
  }
32
- if (buildOptions.extractLicenses) {
33
+ if (extractLicenses) {
33
34
  extraPlugins.push(new license_webpack_plugin_1.LicenseWebpackPlugin({
34
35
  stats: {
35
36
  warnings: false,
36
37
  errors: false,
37
38
  },
38
39
  perChunkOutput: false,
39
- outputFilename: `3rdpartylicenses.txt`,
40
+ outputFilename: '3rdpartylicenses.txt',
40
41
  }));
41
42
  }
42
43
  if (!isEval && (scriptsSourceMap || stylesSourceMap)) {
43
44
  extraPlugins.push(utils_1.getSourceMapDevTool(!!scriptsSourceMap, !!stylesSourceMap, wco.differentialLoadingMode ? true : hiddenSourceMap));
44
45
  }
45
- const globalStylesBundleNames = utils_1.normalizeExtraEntryPoints(buildOptions.styles, 'styles')
46
+ const globalStylesBundleNames = utils_1.normalizeExtraEntryPoints(styles, 'styles')
46
47
  .map(style => style.bundleName);
48
+ let crossOriginLoading = false;
49
+ if (subresourceIntegrity && crossOrigin === 'none') {
50
+ crossOriginLoading = 'anonymous';
51
+ }
52
+ else if (crossOrigin !== 'none') {
53
+ crossOriginLoading = crossOrigin;
54
+ }
47
55
  return {
48
56
  devtool: isEval ? 'eval' : false,
49
57
  resolve: {
@@ -53,19 +61,19 @@ function getBrowserConfig(wco) {
53
61
  ],
54
62
  },
55
63
  output: {
56
- crossOriginLoading: buildOptions.subresourceIntegrity ? 'anonymous' : false,
64
+ crossOriginLoading,
57
65
  },
58
66
  optimization: {
59
67
  runtimeChunk: 'single',
60
68
  splitChunks: {
61
69
  maxAsyncRequests: Infinity,
62
70
  cacheGroups: {
63
- default: !!buildOptions.commonChunk && {
71
+ default: !!commonChunk && {
64
72
  chunks: 'async',
65
73
  minChunks: 2,
66
74
  priority: 10,
67
75
  },
68
- common: !!buildOptions.commonChunk && {
76
+ common: !!commonChunk && {
69
77
  name: 'common',
70
78
  chunks: 'async',
71
79
  minChunks: 2,
@@ -73,7 +81,7 @@ function getBrowserConfig(wco) {
73
81
  priority: 5,
74
82
  },
75
83
  vendors: false,
76
- vendor: !!buildOptions.vendorChunk && {
84
+ vendor: !!vendorChunk && {
77
85
  name: 'vendor',
78
86
  chunks: 'initial',
79
87
  enforce: true,
@@ -21,7 +21,6 @@ function getTestConfig(wco) {
21
21
  const { root, buildOptions, sourceRoot: include } = wco;
22
22
  const extraRules = [];
23
23
  const extraPlugins = [];
24
- // if (buildOptions.codeCoverage && CliConfig.fromProject()) {
25
24
  if (buildOptions.codeCoverage) {
26
25
  const codeCoverageExclude = buildOptions.codeCoverageExclude;
27
26
  const exclude = [
@@ -37,8 +36,8 @@ function getTestConfig(wco) {
37
36
  });
38
37
  }
39
38
  extraRules.push({
40
- test: /\.(js|ts)$/,
41
- loader: 'istanbul-instrumenter-loader',
39
+ test: /\.(jsx?|tsx?)$/,
40
+ loader: require.resolve('coverage-istanbul-loader'),
42
41
  options: { esModules: true },
43
42
  enforce: 'post',
44
43
  exclude,
@@ -66,11 +66,19 @@ function statsToString(json, statsConfig) {
66
66
  }
67
67
  }
68
68
  exports.statsToString = statsToString;
69
+ // TODO(#16193): Don't emit this warning in the first place rather than just suppressing it.
70
+ const ERRONEOUS_WARNINGS = [
71
+ /multiple assets emit different content.*3rdpartylicenses\.txt/i,
72
+ ];
69
73
  function statsWarningsToString(json, statsConfig) {
70
74
  const colors = statsConfig.colors;
71
75
  const rs = (x) => colors ? reset(x) : x;
72
76
  const y = (x) => colors ? bold(yellow(x)) : x;
73
- return rs('\n' + json.warnings.map((warning) => y(`WARNING in ${warning}`)).join('\n\n'));
77
+ return rs('\n' + json.warnings
78
+ .map((warning) => `${warning}`)
79
+ .filter((warning) => !ERRONEOUS_WARNINGS.some((erroneous) => erroneous.test(warning)))
80
+ .map((warning) => y(`WARNING in ${warning}`))
81
+ .join('\n\n'));
74
82
  }
75
83
  exports.statsWarningsToString = statsWarningsToString;
76
84
  function statsErrorsToString(json, statsConfig) {
@@ -284,6 +284,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
284
284
  const runtimeOptions = {
285
285
  ...processRuntimeAction,
286
286
  runtimeData: processResults,
287
+ supportedBrowsers: buildBrowserFeatures.supportedBrowsers,
287
288
  };
288
289
  processResults.push(await Promise.resolve().then(() => require('../utils/process-bundle')).then(m => m.process(runtimeOptions)));
289
290
  }
@@ -22,7 +22,10 @@ async function _loadTslint() {
22
22
  throw new Error('Unable to find TSLint. Ensure TSLint is installed.');
23
23
  }
24
24
  const version = tslint.Linter.VERSION && tslint.Linter.VERSION.split('.');
25
- if (!version || version.length < 2 || Number(version[0]) < 5 || Number(version[1]) < 5) {
25
+ if (!version || version.length < 2
26
+ || (Number(version[0]) === 5 && Number(version[1]) < 5) // 5.5+
27
+ || Number(version[0]) < 5 // 6.0+
28
+ ) {
26
29
  throw new Error('TSLint must be version 5.5 or higher.');
27
30
  }
28
31
  return tslint;
@@ -10,8 +10,8 @@ export declare const fullDifferential: boolean;
10
10
  export declare class BuildBrowserFeatures {
11
11
  private projectRoot;
12
12
  private scriptTarget;
13
- private readonly _supportedBrowsers;
14
13
  private readonly _es6TargetOrLater;
14
+ readonly supportedBrowsers: string[];
15
15
  constructor(projectRoot: string, scriptTarget: ts.ScriptTarget);
16
16
  /**
17
17
  * True, when one or more browsers requires ES5
@@ -18,7 +18,7 @@ class BuildBrowserFeatures {
18
18
  constructor(projectRoot, scriptTarget) {
19
19
  this.projectRoot = projectRoot;
20
20
  this.scriptTarget = scriptTarget;
21
- this._supportedBrowsers = browserslist(undefined, { path: this.projectRoot });
21
+ this.supportedBrowsers = browserslist(undefined, { path: this.projectRoot });
22
22
  this._es6TargetOrLater = this.scriptTarget > ts.ScriptTarget.ES5;
23
23
  }
24
24
  /**
@@ -48,7 +48,7 @@ class BuildBrowserFeatures {
48
48
  'safari 10.1',
49
49
  'ios_saf 10.3',
50
50
  ];
51
- return this._supportedBrowsers.some(browser => safariBrowsers.includes(browser));
51
+ return this.supportedBrowsers.some(browser => safariBrowsers.includes(browser));
52
52
  }
53
53
  /**
54
54
  * True, when a browser feature is supported partially or fully.
@@ -63,7 +63,7 @@ class BuildBrowserFeatures {
63
63
  'a',
64
64
  ];
65
65
  const data = caniuse_lite_1.feature(caniuse_lite_1.features[featureId]);
66
- return !this._supportedBrowsers
66
+ return !this.supportedBrowsers
67
67
  .some(browser => {
68
68
  const [agentId, version] = browser.split(' ');
69
69
  const browserData = data.stats[agentId];
@@ -13,6 +13,7 @@ export interface ProcessBundleOptions {
13
13
  cacheKeys?: (string | undefined)[];
14
14
  integrityAlgorithm?: 'sha256' | 'sha384' | 'sha512';
15
15
  runtimeData?: ProcessBundleResult[];
16
+ supportedBrowsers?: string[] | Record<string, string>;
16
17
  }
17
18
  export interface ProcessBundleResult {
18
19
  name: string;
@@ -53,6 +53,16 @@ async function process(options) {
53
53
  let downlevelCode;
54
54
  let downlevelMap;
55
55
  if (downlevel) {
56
+ const { supportedBrowsers: targets = [] } = options;
57
+ // todo: revisit this in version 10, when we update our defaults browserslist
58
+ // Without this workaround bundles will not be downlevelled because Babel doesn't know handle to 'op_mini all'
59
+ // See: https://github.com/babel/babel/issues/11155
60
+ if (Array.isArray(targets) && targets.includes('op_mini all')) {
61
+ targets.push('ie_mob 11');
62
+ }
63
+ else if ('op_mini' in targets) {
64
+ targets['ie_mob'] = '11';
65
+ }
56
66
  // Downlevel the bundle
57
67
  const transformResult = await core_1.transformAsync(sourceCode, {
58
68
  filename: options.filename,
@@ -63,6 +73,8 @@ async function process(options) {
63
73
  [
64
74
  require.resolve('@babel/preset-env'),
65
75
  {
76
+ // browserslist-compatible query or object of minimum environment versions to support
77
+ targets,
66
78
  // modules aren't needed since the bundles use webpack's custom module loading
67
79
  modules: false,
68
80
  // 'transform-typeof-symbol' generates slower code