@angular-devkit/build-angular 13.1.0-next.0 → 13.1.0-next.1

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,15 +1,15 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "13.1.0-next.0",
3
+ "version": "13.1.0-next.1",
4
4
  "description": "Angular Webpack Build Facade",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
7
7
  "builders": "builders.json",
8
8
  "dependencies": {
9
9
  "@ampproject/remapping": "1.0.1",
10
- "@angular-devkit/architect": "0.1301.0-next.0",
11
- "@angular-devkit/build-webpack": "0.1301.0-next.0",
12
- "@angular-devkit/core": "13.1.0-next.0",
10
+ "@angular-devkit/architect": "0.1301.0-next.1",
11
+ "@angular-devkit/build-webpack": "0.1301.0-next.1",
12
+ "@angular-devkit/core": "13.1.0-next.1",
13
13
  "@babel/core": "7.16.0",
14
14
  "@babel/generator": "7.16.0",
15
15
  "@babel/helper-annotate-as-pure": "7.16.0",
@@ -17,22 +17,21 @@
17
17
  "@babel/plugin-transform-async-to-generator": "7.16.0",
18
18
  "@babel/plugin-transform-runtime": "7.16.0",
19
19
  "@babel/preset-env": "7.16.0",
20
- "@babel/runtime": "7.16.0",
20
+ "@babel/runtime": "7.16.3",
21
21
  "@babel/template": "7.16.0",
22
22
  "@discoveryjs/json-ext": "0.5.5",
23
- "@ngtools/webpack": "13.1.0-next.0",
23
+ "@ngtools/webpack": "13.1.0-next.1",
24
24
  "ansi-colors": "4.1.1",
25
25
  "babel-loader": "8.2.3",
26
26
  "babel-plugin-istanbul": "6.1.1",
27
27
  "browserslist": "^4.9.1",
28
28
  "cacache": "15.3.0",
29
- "caniuse-lite": "^1.0.30001032",
30
29
  "circular-dependency-plugin": "5.2.2",
31
30
  "copy-webpack-plugin": "9.0.1",
32
31
  "core-js": "3.19.1",
33
32
  "critters": "0.0.14",
34
- "css-loader": "6.5.0",
35
- "esbuild-wasm": "0.13.12",
33
+ "css-loader": "6.5.1",
34
+ "esbuild-wasm": "0.13.13",
36
35
  "glob": "7.2.0",
37
36
  "https-proxy-agent": "5.0.0",
38
37
  "inquirer": "8.2.0",
@@ -40,8 +39,8 @@
40
39
  "less": "4.1.2",
41
40
  "less-loader": "10.2.0",
42
41
  "license-webpack-plugin": "3.0.0",
43
- "loader-utils": "3.1.0",
44
- "mini-css-extract-plugin": "2.4.3",
42
+ "loader-utils": "3.1.3",
43
+ "mini-css-extract-plugin": "2.4.4",
45
44
  "minimatch": "3.0.4",
46
45
  "open": "8.4.0",
47
46
  "ora": "5.4.1",
@@ -65,21 +64,21 @@
65
64
  "text-table": "0.2.0",
66
65
  "tree-kill": "1.2.2",
67
66
  "tslib": "2.3.1",
68
- "webpack": "5.61.0",
67
+ "webpack": "5.63.0",
69
68
  "webpack-dev-middleware": "5.2.1",
70
69
  "webpack-dev-server": "4.4.0",
71
70
  "webpack-merge": "5.8.0",
72
71
  "webpack-subresource-integrity": "5.0.0"
73
72
  },
74
73
  "optionalDependencies": {
75
- "esbuild": "0.13.12"
74
+ "esbuild": "0.13.13"
76
75
  },
77
76
  "peerDependencies": {
78
- "@angular/compiler-cli": "^13.0.0 || ^13.0.0-next",
79
- "@angular/localize": "^13.0.0 || ^13.0.0-next",
80
- "@angular/service-worker": "^13.0.0 || ^13.0.0-next",
77
+ "@angular/compiler-cli": "^13.0.0 || ^13.1.0-next",
78
+ "@angular/localize": "^13.0.0 || ^13.1.0-next",
79
+ "@angular/service-worker": "^13.0.0 || ^13.1.0-next",
81
80
  "karma": "^6.3.0",
82
- "ng-packagr": "^13.0.0 || ^13.0.0-next",
81
+ "ng-packagr": "^13.0.0 || ^13.1.0-next",
83
82
  "protractor": "^7.0.0",
84
83
  "tailwindcss": "^2.0.0",
85
84
  "typescript": "~4.4.3"
@@ -34,6 +34,7 @@ export interface ApplicationPresetOptions {
34
34
  forceAsyncTransformation?: boolean;
35
35
  instrumentCode?: {
36
36
  includedBasePath: string;
37
+ inputSourceMap: unknown;
37
38
  };
38
39
  optimize?: {
39
40
  looseEnums: boolean;
@@ -101,7 +101,7 @@ function createNgtscLogger(reporter) {
101
101
  };
102
102
  }
103
103
  function default_1(api, options) {
104
- var _a;
104
+ var _a, _b;
105
105
  const presets = [];
106
106
  const plugins = [];
107
107
  let needRuntimeTransform = false;
@@ -160,7 +160,10 @@ function default_1(api, options) {
160
160
  if (options.instrumentCode) {
161
161
  plugins.push([
162
162
  require('babel-plugin-istanbul').default,
163
- { inputSourceMap: false, cwd: options.instrumentCode.includedBasePath },
163
+ {
164
+ inputSourceMap: (_b = options.instrumentCode.inputSourceMap) !== null && _b !== void 0 ? _b : false,
165
+ cwd: options.instrumentCode.includedBasePath,
166
+ },
164
167
  ]);
165
168
  }
166
169
  if (needRuntimeTransform) {
@@ -51,7 +51,7 @@ exports.default = (0, babel_loader_1.custom)(() => {
51
51
  inputSourceMap: false,
52
52
  });
53
53
  return {
54
- async customOptions(options, { source }) {
54
+ async customOptions(options, { source, map }) {
55
55
  var _a, _b;
56
56
  const { i18n, scriptTarget, aot, optimize, instrumentCode, ...rawOptions } = options;
57
57
  // Must process file if plugins are added
@@ -140,6 +140,7 @@ exports.default = (0, babel_loader_1.custom)(() => {
140
140
  // `babel-plugin-istanbul` has it's own includes but we do the below so that we avoid running the the loader.
141
141
  customOptions.instrumentCode = {
142
142
  includedBasePath: instrumentCode.includedBasePath,
143
+ inputSourceMap: map,
143
144
  };
144
145
  shouldProcess = true;
145
146
  }
@@ -46,6 +46,7 @@ const output_paths_1 = require("../../utils/output-paths");
46
46
  const package_chunk_sort_1 = require("../../utils/package-chunk-sort");
47
47
  const service_worker_1 = require("../../utils/service-worker");
48
48
  const spinner_1 = require("../../utils/spinner");
49
+ const supported_browsers_1 = require("../../utils/supported-browsers");
49
50
  const version_1 = require("../../utils/version");
50
51
  const webpack_browser_config_1 = require("../../utils/webpack-browser-config");
51
52
  const configs_1 = require("../../webpack/configs");
@@ -97,8 +98,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
97
98
  return (0, rxjs_1.from)(context.getProjectMetadata(projectName)).pipe((0, operators_1.switchMap)(async (projectMetadata) => {
98
99
  var _a;
99
100
  const sysProjectRoot = (0, core_1.getSystemPath)((0, core_1.resolve)((0, core_1.normalize)(context.workspaceRoot), (0, core_1.normalize)((_a = projectMetadata.root) !== null && _a !== void 0 ? _a : '')));
100
- const buildBrowserFeatures = new utils_1.BuildBrowserFeatures(sysProjectRoot);
101
- checkInternetExplorerSupport(buildBrowserFeatures.supportedBrowsers, context.logger);
101
+ checkInternetExplorerSupport(sysProjectRoot, context.logger);
102
102
  return {
103
103
  ...(await initialize(options, context, transforms.webpackConfiguration)),
104
104
  cacheOptions: (0, normalize_cache_1.normalizeCacheOptions)(projectMetadata, context.workspaceRoot),
@@ -290,7 +290,8 @@ function mapEmittedFilesToFileInfo(files = []) {
290
290
  }
291
291
  return filteredFiles;
292
292
  }
293
- function checkInternetExplorerSupport(supportedBrowsers, logger) {
293
+ function checkInternetExplorerSupport(projectRoot, logger) {
294
+ const supportedBrowsers = (0, supported_browsers_1.getSupportedBrowsers)(projectRoot);
294
295
  if (supportedBrowsers.some((b) => b === 'ie 9' || b === 'ie 10' || b === 'ie 11')) {
295
296
  logger.warn(`Warning: Support was requested for Internet Explorer in the project's browserslist configuration. ` +
296
297
  'Internet Explorer is no longer officially supported.' +
@@ -61,6 +61,7 @@ export interface BuildOptions {
61
61
  cache: NormalizedCachedOptions;
62
62
  codeCoverage?: boolean;
63
63
  codeCoverageExclude?: string[];
64
+ supportedBrowsers: string[];
64
65
  }
65
66
  export interface WebpackDevServerOptions extends BuildOptions, Omit<DevServerSchema, 'optimization' | 'sourceMap' | 'browserTarget'> {
66
67
  }
@@ -5,7 +5,6 @@
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 './build-browser-features';
9
8
  export * from './default-progress';
10
9
  export * from './delete-output-dir';
11
10
  export * from './run-module-as-observable-fork';
@@ -17,7 +17,6 @@ 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("./build-browser-features"), exports);
21
20
  __exportStar(require("./default-progress"), exports);
22
21
  __exportStar(require("./delete-output-dir"), exports);
23
22
  __exportStar(require("./run-module-as-observable-fork"), exports);
@@ -14,6 +14,7 @@ const normalize_cache_1 = require("./normalize-cache");
14
14
  const normalize_file_replacements_1 = require("./normalize-file-replacements");
15
15
  const normalize_optimization_1 = require("./normalize-optimization");
16
16
  const normalize_source_maps_1 = require("./normalize-source-maps");
17
+ const supported_browsers_1 = require("./supported-browsers");
17
18
  function normalizeBrowserSchema(root, projectRoot, sourceRoot, options, metadata) {
18
19
  const normalizedSourceMapOptions = (0, normalize_source_maps_1.normalizeSourceMaps)(options.sourceMap || false);
19
20
  return {
@@ -37,6 +38,7 @@ function normalizeBrowserSchema(root, projectRoot, sourceRoot, options, metadata
37
38
  // A value of 0 is falsy and will disable polling rather then enable
38
39
  // 500 ms is a sensible default in this case
39
40
  poll: options.poll === 0 ? 500 : options.poll,
41
+ supportedBrowsers: (0, supported_browsers_1.getSupportedBrowsers)((0, core_1.getSystemPath)(projectRoot)),
40
42
  };
41
43
  }
42
44
  exports.normalizeBrowserSchema = normalizeBrowserSchema;
@@ -0,0 +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
+ */
8
+ export declare function getSupportedBrowsers(projectRoot: string): string[];
@@ -0,0 +1,26 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
10
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.getSupportedBrowsers = void 0;
14
+ const browserslist_1 = __importDefault(require("browserslist"));
15
+ function getSupportedBrowsers(projectRoot) {
16
+ browserslist_1.default.defaults = [
17
+ 'last 1 Chrome version',
18
+ 'last 1 Firefox version',
19
+ 'last 2 Edge major versions',
20
+ 'last 2 Safari major versions',
21
+ 'last 2 iOS major versions',
22
+ 'Firefox ESR',
23
+ ];
24
+ return (0, browserslist_1.default)(undefined, { path: projectRoot });
25
+ }
26
+ exports.getSupportedBrowsers = getSupportedBrowsers;
@@ -36,7 +36,6 @@ const path = __importStar(require("path"));
36
36
  const typescript_1 = require("typescript");
37
37
  const webpack_2 = require("webpack");
38
38
  const webpack_subresource_integrity_1 = require("webpack-subresource-integrity");
39
- const utils_1 = require("../../utils");
40
39
  const environment_options_1 = require("../../utils/environment-options");
41
40
  const load_esm_1 = require("../../utils/load-esm");
42
41
  const plugins_1 = require("../plugins");
@@ -61,7 +60,6 @@ async function getCommonConfig(wco) {
61
60
  const { GLOBAL_DEFS_FOR_TERSER, GLOBAL_DEFS_FOR_TERSER_WITH_AOT, VERSION: NG_VERSION, } = (compilerCliModule.GLOBAL_DEFS_FOR_TERSER ? compilerCliModule : compilerCliModule.default);
62
61
  // determine hashing format
63
62
  const hashFormat = (0, helpers_1.getOutputHashFormat)(buildOptions.outputHashing || 'none');
64
- const buildBrowserFeatures = new utils_1.BuildBrowserFeatures(projectRoot);
65
63
  if (buildOptions.progress) {
66
64
  extraPlugins.push(new progress_plugin_1.ProgressPlugin(platform));
67
65
  }
@@ -270,6 +268,9 @@ async function getCommonConfig(wco) {
270
268
  /Failed to parse source map from/,
271
269
  // https://github.com/webpack-contrib/postcss-loader/blob/bd261875fdf9c596af4ffb3a1a73fe3c549befda/src/index.js#L153-L158
272
270
  /Add postcss as project dependency/,
271
+ // esbuild will issue a warning, while still hoists the @charset at the very top.
272
+ // This is caused by a bug in css-loader https://github.com/webpack-contrib/css-loader/issues/1212
273
+ /"@charset" must be the first rule in the file/,
273
274
  ],
274
275
  module: {
275
276
  // Show an error for missing exports instead of a warning.
@@ -324,7 +325,7 @@ async function getCommonConfig(wco) {
324
325
  level: verbose ? 'verbose' : 'error',
325
326
  },
326
327
  stats: (0, helpers_1.getStatsOptions)(verbose),
327
- cache: (0, helpers_1.getCacheSettings)(wco, buildBrowserFeatures.supportedBrowsers, NG_VERSION.full),
328
+ cache: (0, helpers_1.getCacheSettings)(wco, NG_VERSION.full),
328
329
  optimization: {
329
330
  minimizer: extraMinimizers,
330
331
  moduleIds: 'deterministic',
@@ -30,7 +30,6 @@ exports.getStylesConfig = void 0;
30
30
  const fs = __importStar(require("fs"));
31
31
  const path = __importStar(require("path"));
32
32
  const sass_service_1 = require("../../sass/sass-service");
33
- const build_browser_features_1 = require("../../utils/build-browser-features");
34
33
  const plugins_1 = require("../plugins");
35
34
  const css_optimizer_plugin_1 = require("../plugins/css-optimizer-plugin");
36
35
  const helpers_1 = require("../utils/helpers");
@@ -134,9 +133,8 @@ function getStylesConfig(wco) {
134
133
  extraPostcssPlugins.push(require(tailwindPackagePath)({ config: tailwindConfigPath }));
135
134
  }
136
135
  }
137
- const { supportedBrowsers } = new build_browser_features_1.BuildBrowserFeatures(wco.projectRoot);
138
136
  const postcssPresetEnvPlugin = postcssPresetEnv({
139
- browsers: supportedBrowsers,
137
+ browsers: buildOptions.supportedBrowsers,
140
138
  autoprefixer: true,
141
139
  stage: 3,
142
140
  });
@@ -361,7 +359,7 @@ function getStylesConfig(wco) {
361
359
  minimizer: buildOptions.optimization.styles.minify
362
360
  ? [
363
361
  new css_optimizer_plugin_1.CssOptimizerPlugin({
364
- supportedBrowsers,
362
+ supportedBrowsers: buildOptions.supportedBrowsers,
365
363
  }),
366
364
  ]
367
365
  : undefined,
@@ -140,7 +140,6 @@ function restoreFormValues(oldInputs, oldOptions) {
140
140
  case 'date':
141
141
  case 'datetime-local':
142
142
  case 'email':
143
- case 'file':
144
143
  case 'hidden':
145
144
  case 'month':
146
145
  case 'number':
@@ -155,6 +154,10 @@ function restoreFormValues(oldInputs, oldOptions) {
155
154
  case 'week':
156
155
  newElement.value = oldElement.value;
157
156
  break;
157
+ case 'file':
158
+ // Ignored due: Uncaught DOMException: Failed to set the 'value' property on 'HTMLInputElement':
159
+ // This input element accepts a filename, which may only be programmatically set to the empty string.
160
+ break;
158
161
  default:
159
162
  console.warn('[NG HMR] Unknown input type ' + oldElement.type + '.');
160
163
  continue;
@@ -20,7 +20,7 @@ export declare type NormalizedEntryPoint = Required<ExtraEntryPointClass>;
20
20
  export declare function normalizeExtraEntryPoints(extraEntryPoints: ExtraEntryPoint[], defaultBundleName: string): NormalizedEntryPoint[];
21
21
  export declare function assetNameTemplateFactory(hashFormat: HashFormat): (resourcePath: string) => string;
22
22
  export declare function getInstrumentationExcludedPaths(sourceRoot: string, excludedPaths: string[]): Set<string>;
23
- export declare function getCacheSettings(wco: WebpackConfigOptions, supportedBrowsers: string[], angularVersion: string): WebpackOptionsNormalized['cache'];
23
+ export declare function getCacheSettings(wco: WebpackConfigOptions, angularVersion: string): WebpackOptionsNormalized['cache'];
24
24
  export declare function globalScriptsByBundleName(root: string, scripts: ExtraEntryPoint[]): {
25
25
  bundleName: string;
26
26
  inject: boolean;
@@ -109,7 +109,7 @@ function getInstrumentationExcludedPaths(sourceRoot, excludedPaths) {
109
109
  return excluded;
110
110
  }
111
111
  exports.getInstrumentationExcludedPaths = getInstrumentationExcludedPaths;
112
- function getCacheSettings(wco, supportedBrowsers, angularVersion) {
112
+ function getCacheSettings(wco, angularVersion) {
113
113
  const { enabled, path: cacheDirectory } = wco.buildOptions.cache;
114
114
  if (enabled) {
115
115
  const packageVersion = require('../../../package.json').version;
@@ -131,7 +131,6 @@ function getCacheSettings(wco, supportedBrowsers, angularVersion) {
131
131
  // https://github.com/angular/angular-cli/blob/736a5f89deaca85f487b78aec9ff66d4118ceb6a/packages/angular_devkit/build_angular/src/utils/i18n-options.ts#L264-L265
132
132
  outputPath: undefined,
133
133
  }))
134
- .update(supportedBrowsers.join(''))
135
134
  .digest('hex'),
136
135
  };
137
136
  }
@@ -1,16 +0,0 @@
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
- export declare class BuildBrowserFeatures {
9
- private projectRoot;
10
- readonly supportedBrowsers: string[];
11
- constructor(projectRoot: string);
12
- /**
13
- * True, when a browser feature is supported partially or fully.
14
- */
15
- isFeatureSupported(featureId: string): boolean;
16
- }
@@ -1,54 +0,0 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.BuildBrowserFeatures = void 0;
14
- const browserslist_1 = __importDefault(require("browserslist"));
15
- const caniuse_lite_1 = require("caniuse-lite");
16
- class BuildBrowserFeatures {
17
- constructor(projectRoot) {
18
- // By default, browserslist defaults are too inclusive
19
- // https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
20
- this.projectRoot = projectRoot;
21
- // We change the default query to browsers that Angular support.
22
- // https://angular.io/guide/browser-support
23
- browserslist_1.default.defaults = [
24
- 'last 1 Chrome version',
25
- 'last 1 Firefox version',
26
- 'last 2 Edge major versions',
27
- 'last 2 Safari major versions',
28
- 'last 2 iOS major versions',
29
- 'Firefox ESR',
30
- ];
31
- this.supportedBrowsers = (0, browserslist_1.default)(undefined, { path: this.projectRoot });
32
- }
33
- /**
34
- * True, when a browser feature is supported partially or fully.
35
- */
36
- isFeatureSupported(featureId) {
37
- // y: feature is fully available
38
- // n: feature is unavailable
39
- // a: feature is partially supported
40
- // x: feature is prefixed
41
- const criteria = ['y', 'a'];
42
- const data = (0, caniuse_lite_1.feature)(caniuse_lite_1.features[featureId]);
43
- return !this.supportedBrowsers.some((browser) => {
44
- const [agentId, version] = browser.split(' ');
45
- const browserData = data.stats[agentId];
46
- const featureStatus = (browserData && browserData[version]);
47
- // We are only interested in the first character
48
- // Ex: when 'a #4 #5', we only need to check for 'a'
49
- // as for such cases we should polyfill these features as needed
50
- return !featureStatus || !criteria.includes(featureStatus.charAt(0));
51
- });
52
- }
53
- }
54
- exports.BuildBrowserFeatures = BuildBrowserFeatures;