@ngtools/webpack 11.1.0-rc.0 → 11.1.0

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/ivy/plugin.js +12 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngtools/webpack",
3
- "version": "11.1.0-rc.0",
3
+ "version": "11.1.0",
4
4
  "description": "Webpack plugin that AoT compiles your Angular components and modules.",
5
5
  "main": "./src/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "homepage": "https://github.com/angular/angular-cli",
27
27
  "dependencies": {
28
- "@angular-devkit/core": "11.1.0-rc.0",
28
+ "@angular-devkit/core": "11.1.0",
29
29
  "enhanced-resolve": "5.6.0",
30
30
  "webpack-sources": "2.2.0"
31
31
  },
package/src/ivy/plugin.js CHANGED
@@ -272,7 +272,18 @@ class AngularWebpackPlugin {
272
272
  for (const sourceFile of builder.getSourceFiles()) {
273
273
  // Collect Angular template diagnostics
274
274
  if (!ignoreForDiagnostics.has(sourceFile)) {
275
- diagnosticsReporter(angularCompiler.getDiagnostics(sourceFile));
275
+ // The below check should be removed once support for compiler 11.0 is dropped.
276
+ // Also, the below require should be changed to an ES6 import.
277
+ if (angularCompiler.getDiagnosticsForFile) {
278
+ // @angular/compiler-cli 11.1+
279
+ const { OptimizeFor } = require('@angular/compiler-cli/src/ngtsc/typecheck/api');
280
+ diagnosticsReporter(angularCompiler.getDiagnosticsForFile(sourceFile, OptimizeFor.WholeProgram));
281
+ }
282
+ else {
283
+ // @angular/compiler-cli 11.0+
284
+ const getDiagnostics = angularCompiler.getDiagnostics;
285
+ diagnosticsReporter(getDiagnostics.call(angularCompiler, sourceFile));
286
+ }
276
287
  }
277
288
  // Collect sources that are required to be emitted
278
289
  if (!sourceFile.isDeclarationFile &&