@angular-devkit/build-angular 0.803.24 → 0.803.25

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,24 +1,24 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "0.803.24",
3
+ "version": "0.803.25",
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.24",
11
- "@angular-devkit/build-optimizer": "0.803.24",
12
- "@angular-devkit/build-webpack": "0.803.24",
13
- "@angular-devkit/core": "8.3.24",
10
+ "@angular-devkit/architect": "0.803.25",
11
+ "@angular-devkit/build-optimizer": "0.803.25",
12
+ "@angular-devkit/build-webpack": "0.803.25",
13
+ "@angular-devkit/core": "8.3.25",
14
14
  "@babel/core": "7.8.3",
15
15
  "@babel/preset-env": "7.8.3",
16
- "@ngtools/webpack": "8.3.24",
16
+ "@ngtools/webpack": "8.3.25",
17
17
  "ajv": "6.10.2",
18
18
  "autoprefixer": "9.6.1",
19
- "browserslist": "4.8.3",
19
+ "browserslist": "4.8.6",
20
20
  "cacache": "12.0.2",
21
- "caniuse-lite": "1.0.30001019",
21
+ "caniuse-lite": "1.0.30001024",
22
22
  "circular-dependency-plugin": "5.2.0",
23
23
  "clean-css": "4.2.1",
24
24
  "coverage-istanbul-loader": "2.0.3",
@@ -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;
@@ -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,
@@ -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
  }
@@ -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;
@@ -63,6 +63,8 @@ async function process(options) {
63
63
  [
64
64
  require.resolve('@babel/preset-env'),
65
65
  {
66
+ // browserslist-compatible query or object of minimum environment versions to support
67
+ targets: options.supportedBrowsers,
66
68
  // modules aren't needed since the bundles use webpack's custom module loading
67
69
  modules: false,
68
70
  // 'transform-typeof-symbol' generates slower code