@angular-devkit/build-angular 14.0.0-rc.2 → 14.0.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": "14.0.0-rc.2",
3
+ "version": "14.0.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": "2.2.0",
10
- "@angular-devkit/architect": "0.1400.0-rc.2",
11
- "@angular-devkit/build-webpack": "0.1400.0-rc.2",
12
- "@angular-devkit/core": "14.0.0-rc.2",
10
+ "@angular-devkit/architect": "0.1400.1",
11
+ "@angular-devkit/build-webpack": "0.1400.1",
12
+ "@angular-devkit/core": "14.0.1",
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-rc.2",
23
+ "@ngtools/webpack": "14.0.1",
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"
@@ -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) => {
@@ -224,7 +224,7 @@ async function bundleCode(workspaceRoot, entryPoints, outputNames, options, opti
224
224
  assetNames: outputNames.media,
225
225
  target: 'es2020',
226
226
  mainFields: ['es2020', 'browser', 'module', 'main'],
227
- conditions: ['es2020', 'module'],
227
+ conditions: ['es2020', 'es2015', 'module'],
228
228
  resolveExtensions: ['.ts', '.tsx', '.mjs', '.js'],
229
229
  logLevel: options.verbose ? 'debug' : 'silent',
230
230
  metafile: true,
@@ -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: {
@@ -110,19 +110,10 @@ function getStylesConfig(wco) {
110
110
  const assetNameTemplate = (0, helpers_1.assetNameTemplateFactory)(hashFormat);
111
111
  const extraPostcssPlugins = [];
112
112
  // Attempt to setup Tailwind CSS
113
- // A configuration file can exist in the project or workspace root
114
- const tailwindConfigFile = 'tailwind.config.js';
115
- let tailwindConfigPath;
116
- for (const basePath of [wco.projectRoot, wco.root]) {
117
- const fullPath = path.join(basePath, tailwindConfigFile);
118
- if (fs.existsSync(fullPath)) {
119
- tailwindConfigPath = fullPath;
120
- break;
121
- }
122
- }
123
113
  // Only load Tailwind CSS plugin if configuration file was found.
124
114
  // This acts as a guard to ensure the project actually wants to use Tailwind CSS.
125
115
  // The package may be unknowningly present due to a third-party transitive package dependency.
116
+ const tailwindConfigPath = getTailwindConfigPath(wco);
126
117
  if (tailwindConfigPath) {
127
118
  let tailwindPackagePath;
128
119
  try {
@@ -374,3 +365,19 @@ function getStylesConfig(wco) {
374
365
  };
375
366
  }
376
367
  exports.getStylesConfig = getStylesConfig;
368
+ function getTailwindConfigPath({ projectRoot, root }) {
369
+ // A configuration file can exist in the project or workspace root
370
+ // The list of valid config files can be found:
371
+ // https://github.com/tailwindlabs/tailwindcss/blob/8845d112fb62d79815b50b3bae80c317450b8b92/src/util/resolveConfigPath.js#L46-L52
372
+ const tailwindConfigFiles = ['tailwind.config.js', 'tailwind.config.cjs'];
373
+ for (const basePath of [projectRoot, root]) {
374
+ for (const configFile of tailwindConfigFiles) {
375
+ // Irrespective of the name project level configuration should always take precedence.
376
+ const fullPath = path.join(basePath, configFile);
377
+ if (fs.existsSync(fullPath)) {
378
+ return fullPath;
379
+ }
380
+ }
381
+ }
382
+ return undefined;
383
+ }
@@ -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;