@angular-devkit/build-angular 0.1102.0 → 0.1102.4

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,16 +1,16 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "0.1102.0",
3
+ "version": "0.1102.4",
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.1102.0",
11
- "@angular-devkit/build-optimizer": "0.1102.0",
12
- "@angular-devkit/build-webpack": "0.1102.0",
13
- "@angular-devkit/core": "11.2.0",
10
+ "@angular-devkit/architect": "0.1102.4",
11
+ "@angular-devkit/build-optimizer": "0.1102.4",
12
+ "@angular-devkit/build-webpack": "0.1102.4",
13
+ "@angular-devkit/core": "11.2.4",
14
14
  "@babel/core": "7.12.10",
15
15
  "@babel/generator": "7.12.11",
16
16
  "@babel/plugin-transform-async-to-generator": "7.12.1",
@@ -19,7 +19,7 @@
19
19
  "@babel/runtime": "7.12.5",
20
20
  "@babel/template": "7.12.7",
21
21
  "@jsdevtools/coverage-istanbul-loader": "3.0.5",
22
- "@ngtools/webpack": "11.2.0",
22
+ "@ngtools/webpack": "11.2.4",
23
23
  "ansi-colors": "4.1.1",
24
24
  "autoprefixer": "10.2.4",
25
25
  "babel-loader": "8.2.2",
@@ -29,7 +29,7 @@
29
29
  "circular-dependency-plugin": "5.2.2",
30
30
  "copy-webpack-plugin": "6.3.2",
31
31
  "core-js": "3.8.3",
32
- "critters": "0.0.6",
32
+ "critters": "0.0.7",
33
33
  "css-loader": "5.0.1",
34
34
  "cssnano": "4.1.10",
35
35
  "file-loader": "6.2.0",
@@ -127,7 +127,7 @@
127
127
  },
128
128
  "engines": {
129
129
  "node": ">= 10.13.0",
130
- "npm": "^6.11.0",
130
+ "npm": "^6.11.0 || ^7.5.6",
131
131
  "yarn": ">= 1.13.0"
132
132
  },
133
133
  "author": "Angular Authors",
@@ -51,51 +51,61 @@ exports.default = babel_loader_1.custom(() => {
51
51
  sourceType: 'unambiguous',
52
52
  });
53
53
  return {
54
- async customOptions({ scriptTarget, ...loaderOptions }, { source }) {
54
+ async customOptions({ i18n, scriptTarget, ...rawOptions }, { source }) {
55
55
  // Must process file if plugins are added
56
- let shouldProcess = Array.isArray(loaderOptions.plugins) && loaderOptions.plugins.length > 0;
56
+ let shouldProcess = Array.isArray(rawOptions.plugins) && rawOptions.plugins.length > 0;
57
+ const customOptions = {
58
+ forceAsyncTransformation: false,
59
+ forceES5: false,
60
+ shouldLink: false,
61
+ i18n: undefined,
62
+ };
57
63
  // Analyze file for linking
58
- let shouldLink = false;
59
64
  const { hasLinkerSupport, requiresLinking } = await checkLinking(this.resourcePath, source);
60
65
  if (requiresLinking && !hasLinkerSupport) {
61
66
  // Cannot link if there is no linker support
62
67
  this.emitError('File requires the Angular linker. "@angular/compiler-cli" version 11.1.0 or greater is needed.');
63
68
  }
64
69
  else {
65
- shouldLink = requiresLinking;
70
+ customOptions.shouldLink = requiresLinking;
66
71
  }
67
- shouldProcess || (shouldProcess = shouldLink);
72
+ shouldProcess || (shouldProcess = customOptions.shouldLink);
68
73
  // Analyze for ES target processing
69
- let forceES5 = false;
70
- let forceAsyncTransformation = false;
71
74
  const esTarget = scriptTarget;
72
- if (esTarget < typescript_1.ScriptTarget.ES2015) {
73
- // TypeScript files will have already been downlevelled
74
- forceES5 = !/\.tsx?$/.test(this.resourcePath);
75
+ if (esTarget !== undefined) {
76
+ if (esTarget < typescript_1.ScriptTarget.ES2015) {
77
+ // TypeScript files will have already been downlevelled
78
+ customOptions.forceES5 = !/\.tsx?$/.test(this.resourcePath);
79
+ }
80
+ else if (esTarget >= typescript_1.ScriptTarget.ES2017) {
81
+ customOptions.forceAsyncTransformation = source.includes('async');
82
+ }
83
+ shouldProcess || (shouldProcess = customOptions.forceAsyncTransformation || customOptions.forceES5);
75
84
  }
76
- else if (esTarget >= typescript_1.ScriptTarget.ES2017) {
77
- forceAsyncTransformation = source.includes('async');
85
+ // Analyze for i18n inlining
86
+ if (i18n &&
87
+ !/[\\\/]@angular[\\\/](?:compiler|localize)/.test(this.resourcePath) &&
88
+ source.includes('$localize')) {
89
+ customOptions.i18n = i18n;
90
+ shouldProcess = true;
78
91
  }
79
- shouldProcess || (shouldProcess = forceAsyncTransformation || forceES5);
80
92
  // Add provided loader options to default base options
81
- const options = {
93
+ const loaderOptions = {
82
94
  ...baseOptions,
83
- ...loaderOptions,
95
+ ...rawOptions,
84
96
  cacheIdentifier: JSON.stringify({
85
97
  buildAngular: require('../../package.json').version,
86
- forceAsyncTransformation,
87
- forceES5,
88
- shouldLink,
98
+ customOptions,
89
99
  baseOptions,
90
- loaderOptions,
100
+ rawOptions,
91
101
  }),
92
102
  };
93
103
  // Skip babel processing if no actions are needed
94
104
  if (!shouldProcess) {
95
105
  // Force the current file to be ignored
96
- options.ignore = [() => true];
106
+ loaderOptions.ignore = [() => true];
97
107
  }
98
- return { custom: { forceAsyncTransformation, forceES5, shouldLink }, loader: options };
108
+ return { custom: customOptions, loader: loaderOptions };
99
109
  },
100
110
  config(configuration, { customOptions }) {
101
111
  return {
@@ -108,6 +118,7 @@ exports.default = babel_loader_1.custom(() => {
108
118
  angularLinker: customOptions.shouldLink,
109
119
  forceES5: customOptions.forceES5,
110
120
  forceAsyncTransformation: customOptions.forceAsyncTransformation,
121
+ i18n: customOptions.i18n,
111
122
  diagnosticReporter: (type, message) => {
112
123
  switch (type) {
113
124
  case 'error':
@@ -514,8 +514,8 @@ function buildWebpackBrowser(options, context, transforms = {}) {
514
514
  spinner.fail('Index html generation failed.');
515
515
  return { success: false, error: mapErrorToMessage(error) };
516
516
  }
517
- spinner.succeed('Index html generation complete.');
518
517
  }
518
+ spinner.succeed('Index html generation complete.');
519
519
  }
520
520
  if (options.serviceWorker) {
521
521
  spinner.start('Generating service worker...');
@@ -527,8 +527,8 @@ function buildWebpackBrowser(options, context, transforms = {}) {
527
527
  spinner.fail('Service worker generation failed.');
528
528
  return { success: false, error: mapErrorToMessage(error) };
529
529
  }
530
- spinner.succeed('Service worker generation complete.');
531
530
  }
531
+ spinner.succeed('Service worker generation complete.');
532
532
  }
533
533
  }
534
534
  stats_1.webpackStatsLogger(context.logger, webpackStats, config, bundleInfoStats);
@@ -27,7 +27,6 @@ const package_chunk_sort_1 = require("../utils/package-chunk-sort");
27
27
  const read_tsconfig_1 = require("../utils/read-tsconfig");
28
28
  const version_1 = require("../utils/version");
29
29
  const webpack_browser_config_1 = require("../utils/webpack-browser-config");
30
- const webpack_diagnostics_1 = require("../utils/webpack-diagnostics");
31
30
  const configs_1 = require("../webpack/configs");
32
31
  const index_html_webpack_plugin_1 = require("../webpack/plugins/index-html-webpack-plugin");
33
32
  const stats_1 = require("../webpack/utils/stats");
@@ -255,7 +254,6 @@ exports.serveWebpackBrowser = serveWebpackBrowser;
255
254
  async function setupLocalize(locale, i18n, browserOptions, webpackConfig) {
256
255
  var _a;
257
256
  const localeDescription = i18n.locales[locale];
258
- const i18nDiagnostics = [];
259
257
  // Modify main entrypoint to include locale data
260
258
  if ((localeDescription === null || localeDescription === void 0 ? void 0 : localeDescription.dataPath) &&
261
259
  typeof webpackConfig.entry === 'object' &&
@@ -274,37 +272,24 @@ async function setupLocalize(locale, i18n, browserOptions, webpackConfig) {
274
272
  missingTranslationBehavior = 'ignore';
275
273
  translation = {};
276
274
  }
275
+ const i18nLoaderOptions = {
276
+ locale,
277
+ missingTranslationBehavior,
278
+ translation: i18n.shouldInline ? translation : undefined,
279
+ };
277
280
  const i18nRule = {
278
- test: /\.(?:m?js|ts)$/,
281
+ test: /\.(?:[cm]?js|ts)$/,
279
282
  enforce: 'post',
280
283
  use: [
281
284
  {
282
- loader: require.resolve('babel-loader'),
285
+ loader: require.resolve('../babel/webpack-loader'),
283
286
  options: {
284
- babelrc: false,
285
- configFile: false,
286
- compact: false,
287
- cacheCompression: false,
288
- cacheDirectory: cache_path_1.findCachePath('babel-loader'),
287
+ cacheDirectory: cache_path_1.findCachePath('babel-dev-server-i18n'),
289
288
  cacheIdentifier: JSON.stringify({
290
- buildAngular: require('../../package.json').version,
291
289
  locale,
292
290
  translationIntegrity: localeDescription === null || localeDescription === void 0 ? void 0 : localeDescription.files.map((file) => file.integrity),
293
291
  }),
294
- sourceType: 'unambiguous',
295
- presets: [
296
- [
297
- require.resolve('../babel/presets/application'),
298
- {
299
- i18n: {
300
- locale,
301
- translation: i18n.shouldInline ? translation : undefined,
302
- missingTranslationBehavior,
303
- },
304
- diagnosticReporter: (type, message) => i18nDiagnostics.push({ type, message }),
305
- },
306
- ],
307
- ],
292
+ i18n: i18nLoaderOptions,
308
293
  },
309
294
  },
310
295
  ],
@@ -318,24 +303,5 @@ async function setupLocalize(locale, i18n, browserOptions, webpackConfig) {
318
303
  webpackConfig.module.rules = rules;
319
304
  }
320
305
  rules.push(i18nRule);
321
- // Add a plugin to inject the i18n diagnostics
322
- // tslint:disable-next-line: no-non-null-assertion
323
- webpackConfig.plugins.push({
324
- apply: (compiler) => {
325
- compiler.hooks.thisCompilation.tap('build-angular', compilation => {
326
- compilation.hooks.finishModules.tap('build-angular', () => {
327
- for (const diagnostic of i18nDiagnostics) {
328
- if (diagnostic.type === 'error') {
329
- webpack_diagnostics_1.addError(compilation, diagnostic.message);
330
- }
331
- else {
332
- webpack_diagnostics_1.addWarning(compilation, diagnostic.message);
333
- }
334
- }
335
- i18nDiagnostics.length = 0;
336
- });
337
- });
338
- },
339
- });
340
306
  }
341
307
  exports.default = architect_1.createBuilder(serveWebpackBrowser);
@@ -27,6 +27,7 @@ class CrittersExtended extends Critters {
27
27
  mergeStylesheets: false,
28
28
  preload: 'media',
29
29
  noscriptFallback: true,
30
+ inlineFonts: true,
30
31
  });
31
32
  this.optionsExtended = optionsExtended;
32
33
  this.warnings = [];
@@ -48,7 +49,7 @@ class InlineCriticalCssProcessor {
48
49
  // Clean up value from value less attributes.
49
50
  // This is caused because parse5 always requires attributes to have a string value.
50
51
  // nomodule="" defer="" -> nomodule defer.
51
- content: content.replace(/(\s[a-z]+)=""/g, '$1'),
52
+ content: content.replace(/(\s(?:defer|nomodule))=""/g, '$1'),
52
53
  errors: critters.errors,
53
54
  warnings: critters.warnings,
54
55
  };
@@ -46,9 +46,9 @@ function assertCompatibleAngularVersion(projectRoot, logger) {
46
46
  // In this case we don't provide as many version checks.
47
47
  return;
48
48
  }
49
- if (angularCliPkgJson['version'] === '0.0.0' || angularPkgJson['version'] === '0.0.0-PLACEHOLDER') {
49
+ if (angularCliPkgJson['version'] === '0.0.0' || angularPkgJson['version'] === '0.0.0') {
50
50
  // Internal CLI testing version or integration testing in the angular/angular
51
- // repository with the generated development @angular/core npm package which is versioned "0.0.0-PLACEHOLDER".
51
+ // repository with the generated development @angular/core npm package which is versioned "0.0.0".
52
52
  return;
53
53
  }
54
54
  const angularVersion = new semver_1.SemVer(angularPkgJson['version']);
@@ -112,6 +112,7 @@ function getStylesConfig(wco) {
112
112
  implementation: require('less'),
113
113
  sourceMap: cssSourceMap,
114
114
  lessOptions: {
115
+ math: 'always',
115
116
  javascriptEnabled: true,
116
117
  paths: includePaths,
117
118
  },
@@ -31,6 +31,8 @@ function createIvyPlugin(wco, aot, tsconfig) {
31
31
  const optimize = buildOptions.optimization.scripts;
32
32
  const compilerOptions = {
33
33
  sourceMap: buildOptions.sourceMap.scripts,
34
+ declaration: false,
35
+ declarationMap: false,
34
36
  };
35
37
  if (buildOptions.preserveSymlinks !== undefined) {
36
38
  compilerOptions.preserveSymlinks = buildOptions.preserveSymlinks;