@angular-devkit/build-angular 14.0.0 → 14.0.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,15 +1,15 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "14.0.0",
3
+ "version": "14.0.3",
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": "2.2.0",
10
- "@angular-devkit/architect": "0.1400.0",
11
- "@angular-devkit/build-webpack": "0.1400.0",
12
- "@angular-devkit/core": "14.0.0",
10
+ "@angular-devkit/architect": "0.1400.3",
11
+ "@angular-devkit/build-webpack": "0.1400.3",
12
+ "@angular-devkit/core": "14.0.3",
13
13
  "@babel/core": "7.17.10",
14
14
  "@babel/generator": "7.17.10",
15
15
  "@babel/helper-annotate-as-pure": "7.16.7",
@@ -20,7 +20,7 @@
20
20
  "@babel/runtime": "7.17.9",
21
21
  "@babel/template": "7.16.7",
22
22
  "@discoveryjs/json-ext": "0.5.7",
23
- "@ngtools/webpack": "14.0.0",
23
+ "@ngtools/webpack": "14.0.3",
24
24
  "ansi-colors": "4.1.1",
25
25
  "babel-loader": "8.2.5",
26
26
  "babel-plugin-istanbul": "6.1.1",
@@ -73,11 +73,11 @@
73
73
  "esbuild": "0.14.38"
74
74
  },
75
75
  "peerDependencies": {
76
- "@angular/compiler-cli": "^14.0.0 || ^14.0.0-rc",
77
- "@angular/localize": "^14.0.0 || ^14.0.0-rc",
78
- "@angular/service-worker": "^14.0.0 || ^14.0.0-rc",
76
+ "@angular/compiler-cli": "^14.0.0",
77
+ "@angular/localize": "^14.0.0",
78
+ "@angular/service-worker": "^14.0.0",
79
79
  "karma": "^6.3.0",
80
- "ng-packagr": "^14.0.0 || ^14.0.0-next",
80
+ "ng-packagr": "^14.0.0",
81
81
  "protractor": "^7.0.0",
82
82
  "tailwindcss": "^2.0.0 || ^3.0.0",
83
83
  "typescript": ">=4.6.2 <4.8"
@@ -52,7 +52,7 @@ exports.default = (0, babel_loader_1.custom)(() => {
52
52
  });
53
53
  return {
54
54
  async customOptions(options, { source, map }) {
55
- var _a, _b;
55
+ var _a, _b, _c;
56
56
  const { i18n, scriptTarget, aot, optimize, instrumentCode, supportedBrowsers, ...rawOptions } = options;
57
57
  // Must process file if plugins are added
58
58
  let shouldProcess = Array.isArray(rawOptions.plugins) && rawOptions.plugins.length > 0;
@@ -89,7 +89,7 @@ exports.default = (0, babel_loader_1.custom)(() => {
89
89
  // Comparable behavior to tsconfig target of ES5
90
90
  customOptions.supportedBrowsers = ['IE 9'];
91
91
  }
92
- else if (isJsFile) {
92
+ else if (isJsFile && ((_a = customOptions.supportedBrowsers) === null || _a === void 0 ? void 0 : _a.length)) {
93
93
  // Applications code ES version can be controlled using TypeScript's `target` option.
94
94
  // However, this doesn't effect libraries and hence we use preset-env to downlevel ES fetaures
95
95
  // based on the supported browsers in browserlist.
@@ -142,7 +142,7 @@ exports.default = (0, babel_loader_1.custom)(() => {
142
142
  pureTopLevel: angularPackage,
143
143
  // JavaScript modules that are marked as side effect free are considered to have
144
144
  // no decorators that contain non-local effects.
145
- wrapDecorators: !!((_b = (_a = this._module) === null || _a === void 0 ? void 0 : _a.factoryMeta) === null || _b === void 0 ? void 0 : _b.sideEffectFree),
145
+ wrapDecorators: !!((_c = (_b = this._module) === null || _b === void 0 ? void 0 : _b.factoryMeta) === null || _c === void 0 ? void 0 : _c.sideEffectFree),
146
146
  };
147
147
  shouldProcess = true;
148
148
  }
@@ -119,7 +119,7 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
119
119
  // Once TypeScript provides support for retaining dynamic imports this workaround can be dropped.
120
120
  const compilerCli = await (0, load_esm_1.loadEsmModule)('@angular/compiler-cli');
121
121
  // Temporary deep import for transformer support
122
- const { createAotTransformers, mergeTransformers, } = require('@ngtools/webpack/src/ivy/transformation');
122
+ const { mergeTransformers, replaceBootstrap, } = require('@ngtools/webpack/src/ivy/transformation');
123
123
  // Setup defines based on the values provided by the Angular compiler-cli
124
124
  (_a = (_b = build.initialOptions).define) !== null && _a !== void 0 ? _a : (_b.define = {});
125
125
  for (const [key, value] of Object.entries(compilerCli.GLOBAL_DEFS_FOR_TERSER_WITH_AOT)) {
@@ -226,7 +226,9 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
226
226
  ((_b = result.warnings) !== null && _b !== void 0 ? _b : (result.warnings = [])).push(message);
227
227
  }
228
228
  }
229
- fileEmitter = createFileEmitter(builder, mergeTransformers(angularCompiler.prepareEmit().transformers, createAotTransformers(builder, {})), () => []);
229
+ fileEmitter = createFileEmitter(builder, mergeTransformers(angularCompiler.prepareEmit().transformers, {
230
+ before: [replaceBootstrap(() => builder.getProgram().getTypeChecker())],
231
+ }), () => []);
230
232
  return result;
231
233
  });
232
234
  build.onLoad({ filter: compilerOptions.allowJs ? /\.[cm]?[jt]sx?$/ : /\.[cm]?tsx?$/ }, async (args) => {
@@ -209,7 +209,9 @@ async function execute(options, context, transforms) {
209
209
  },
210
210
  });
211
211
  return partials;
212
- });
212
+ },
213
+ // During extraction we don't need specific browser support.
214
+ { supportedBrowsers: undefined });
213
215
  // All the localize usages are setup to first try the ESM entry point then fallback to the deep imports.
214
216
  // This provides interim compatibility while the framework is transitioned to bundled ESM packages.
215
217
  const localizeToolsModule = await (0, load_esm_1.loadEsmModule)('@angular/localize/tools');
@@ -107,8 +107,8 @@ function execute(options, context, transforms = {}) {
107
107
  throw new Error('The builder requires a target.');
108
108
  }
109
109
  const projectMetadata = await context.getProjectMetadata(projectName);
110
- const projectRoot = path.join(context.workspaceRoot, (_c = projectMetadata.root) !== null && _c !== void 0 ? _c : '');
111
- const projectSourceRoot = path.join(projectRoot, (_d = projectMetadata.sourceRoot) !== null && _d !== void 0 ? _d : '');
110
+ const sourceRoot = ((_d = (_c = projectMetadata.sourceRoot) !== null && _c !== void 0 ? _c : projectMetadata.root) !== null && _d !== void 0 ? _d : '');
111
+ const projectSourceRoot = path.join(context.workspaceRoot, sourceRoot);
112
112
  const files = await (0, find_tests_1.findTests)(options.include, context.workspaceRoot, projectSourceRoot);
113
113
  // early exit, no reason to start karma
114
114
  if (!files.length) {
@@ -146,12 +146,12 @@ async function configureI18nBuild(context, options) {
146
146
  if (first) {
147
147
  localeDataPath = findLocaleDataPath(first.toLowerCase(), localeResolver);
148
148
  if (localeDataPath) {
149
- context.logger.warn(`Locale data for '${locale}' cannot be found. Using locale data for '${first}'.`);
149
+ context.logger.warn(`Locale data for '${locale}' cannot be found. Using locale data for '${first}'.`);
150
150
  }
151
151
  }
152
152
  }
153
153
  if (!localeDataPath) {
154
- context.logger.warn(`Locale data for '${locale}' cannot be found. No locale data will be included for this locale.`);
154
+ context.logger.warn(`Locale data for '${locale}' cannot be found. No locale data will be included for this locale.`);
155
155
  }
156
156
  else {
157
157
  desc.dataPath = localeDataPath;
@@ -194,11 +194,8 @@ function findLocaleDataPath(locale, resolver) {
194
194
  return resolver(scrubbedLocale);
195
195
  }
196
196
  catch {
197
- if (scrubbedLocale === 'en-US') {
198
- // fallback to known existing en-US locale data as of 9.0
199
- return findLocaleDataPath('en-US-POSIX', resolver);
200
- }
201
- return null;
197
+ // fallback to known existing en-US locale data as of 14.0
198
+ return scrubbedLocale === 'en-US' ? findLocaleDataPath('en', resolver) : null;
202
199
  }
203
200
  }
204
201
  /** Remove temporary directory used for i18n processing. */
@@ -47,6 +47,7 @@ const named_chunks_plugin_1 = require("../plugins/named-chunks-plugin");
47
47
  const progress_plugin_1 = require("../plugins/progress-plugin");
48
48
  const transfer_size_plugin_1 = require("../plugins/transfer-size-plugin");
49
49
  const typescript_2 = require("../plugins/typescript");
50
+ const watch_files_logs_plugin_1 = require("../plugins/watch-files-logs-plugin");
50
51
  const helpers_1 = require("../utils/helpers");
51
52
  // eslint-disable-next-line max-lines-per-function
52
53
  async function getCommonConfig(wco) {
@@ -143,6 +144,9 @@ async function getCommonConfig(wco) {
143
144
  append: hiddenSourceMap ? false : undefined,
144
145
  }));
145
146
  }
147
+ if (verbose) {
148
+ extraPlugins.push(new watch_files_logs_plugin_1.WatchFilesLogsPlugin());
149
+ }
146
150
  if (buildOptions.statsJson) {
147
151
  extraPlugins.push(new plugins_1.JsonStatsPlugin(path.resolve(root, buildOptions.outputPath, 'stats.json')));
148
152
  }
@@ -270,7 +270,7 @@ function getWebSocketSettings(options, servePath) {
270
270
  client: undefined,
271
271
  };
272
272
  }
273
- const webSocketPath = path_1.posix.join(servePath, 'ws');
273
+ const webSocketPath = path_1.posix.join(servePath, 'ng-cli-ws');
274
274
  return {
275
275
  webSocketServer: {
276
276
  options: {
@@ -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 type { Compiler } from 'webpack';
9
+ export declare class WatchFilesLogsPlugin {
10
+ apply(compiler: Compiler): void;
11
+ }
@@ -0,0 +1,27 @@
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.WatchFilesLogsPlugin = void 0;
11
+ const PLUGIN_NAME = 'angular.watch-files-logs-plugin';
12
+ class WatchFilesLogsPlugin {
13
+ apply(compiler) {
14
+ compiler.hooks.watchRun.tap(PLUGIN_NAME, ({ modifiedFiles, removedFiles }) => {
15
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
16
+ const logger = compilation.getLogger(PLUGIN_NAME);
17
+ if (modifiedFiles === null || modifiedFiles === void 0 ? void 0 : modifiedFiles.size) {
18
+ logger.log(`Modified files:\n${[...modifiedFiles].join('\n')}\n`);
19
+ }
20
+ if (removedFiles === null || removedFiles === void 0 ? void 0 : removedFiles.size) {
21
+ logger.log(`Removed files:\n${[...removedFiles].join('\n')}\n`);
22
+ }
23
+ });
24
+ });
25
+ }
26
+ }
27
+ exports.WatchFilesLogsPlugin = WatchFilesLogsPlugin;
@@ -125,8 +125,8 @@ function getInstrumentationExcludedPaths(sourceRoot, excludedPaths) {
125
125
  const excluded = new Set();
126
126
  for (const excludeGlob of excludedPaths) {
127
127
  glob_1.default
128
- .sync(path.join(sourceRoot, excludeGlob), { nodir: true })
129
- .forEach((p) => excluded.add(path.normalize(p)));
128
+ .sync(excludeGlob, { nodir: true, cwd: sourceRoot })
129
+ .forEach((p) => excluded.add(path.join(sourceRoot, p)));
130
130
  }
131
131
  return excluded;
132
132
  }