Skip to content

Commit

Permalink
fix(@ngtools/webpack): use getDiagnosticsForFile instead of `getDia…
Browse files Browse the repository at this point in the history
…gnostics`

With this change we replace `getDiagnostics` with `getDiagnosticsForFile`. `getDiagnostics` no longer accept a parameter and is intended to be used instead of `getDiagnostics`.

I used `OptimizeFor.WholeProgram` based on the comments in angular/angular#40331 (comment) which suggests that if you iterate through files one at a time the `WholeProgram` flag should be used.

For more context see: angular/angular#40331

(cherry picked from commit 5fdc0a6)
  • Loading branch information
alan-agius4 authored and clydin committed Jan 14, 2021
1 parent d7d90e1 commit 5e375a1
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 66 deletions.
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@
]
},
"devDependencies": {
"@angular/animations": "11.1.0-next.4",
"@angular/animations": "11.1.0-rc.0",
"@angular/cdk": "11.0.3",
"@angular/common": "11.1.0-next.4",
"@angular/compiler": "11.1.0-next.4",
"@angular/compiler-cli": "11.1.0-next.4",
"@angular/core": "11.1.0-next.4",
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#579e491f4308ab4733a5c28ef7c5c734e3bf405e",
"@angular/forms": "11.1.0-next.4",
"@angular/localize": "11.1.0-next.4",
"@angular/common": "11.1.0-rc.0",
"@angular/compiler": "11.1.0-rc.0",
"@angular/compiler-cli": "11.1.0-rc.0",
"@angular/core": "11.1.0-rc.0",
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#d46e59817dc0ecebc10e2c716baa461afcd710cf",
"@angular/forms": "11.1.0-rc.0",
"@angular/localize": "11.1.0-rc.0",
"@angular/material": "11.0.3",
"@angular/platform-browser": "11.1.0-next.4",
"@angular/platform-browser-dynamic": "11.1.0-next.4",
"@angular/platform-server": "11.1.0-next.4",
"@angular/router": "11.1.0-next.4",
"@angular/service-worker": "11.1.0-next.4",
"@angular/platform-browser": "11.1.0-rc.0",
"@angular/platform-browser-dynamic": "11.1.0-rc.0",
"@angular/platform-server": "11.1.0-rc.0",
"@angular/router": "11.1.0-rc.0",
"@angular/service-worker": "11.1.0-rc.0",
"@babel/core": "7.12.10",
"@babel/generator": "7.12.11",
"@babel/plugin-transform-runtime": "7.12.10",
Expand Down
4 changes: 2 additions & 2 deletions packages/ngtools/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"webpack": "^4.0.0"
},
"devDependencies": {
"@angular/compiler": "11.1.0-next.4",
"@angular/compiler-cli": "11.1.0-next.4",
"@angular/compiler": "11.1.0-rc.0",
"@angular/compiler-cli": "11.1.0-rc.0",
"typescript": "4.1.3",
"webpack": "4.44.2"
}
Expand Down
12 changes: 11 additions & 1 deletion packages/ngtools/webpack/src/ivy/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,17 @@ export class AngularWebpackPlugin {
for (const sourceFile of builder.getSourceFiles()) {
// Collect Angular template diagnostics
if (!ignoreForDiagnostics.has(sourceFile)) {
diagnosticsReporter(angularCompiler.getDiagnostics(sourceFile));
// The below check should be removed once support for compiler 11.0 is dropped.
// Also, the below require should be changed to an ES6 import.
if (angularCompiler.getDiagnosticsForFile) {
// @angular/compiler-cli 11.1+
const { OptimizeFor } = require('@angular/compiler-cli/src/ngtsc/typecheck/api');
diagnosticsReporter(angularCompiler.getDiagnosticsForFile(sourceFile, OptimizeFor.WholeProgram));
} else {
// @angular/compiler-cli 11.0+
const getDiagnostics = angularCompiler.getDiagnostics as (sourceFile: ts.SourceFile) => ts.Diagnostic[];
diagnosticsReporter(getDiagnostics.call(angularCompiler, sourceFile));
}
}

// Collect sources that are required to be emitted
Expand Down
100 changes: 50 additions & 50 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# yarn lockfile v1


"@angular/animations@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-11.1.0-next.4.tgz#dea9d08a3d62c302f9c12c5064ab8adc6f2db228"
integrity sha512-ZwNyimfkhT029JvRSNnmflBGIGU8kR38yQsD1h4u4ypPwdoxYWonvI6mAbnRHAa85WG3qA8Fb8HA3kKuAXYDag==
"@angular/animations@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-11.1.0-rc.0.tgz#963697f805a2b06c3e4de7e95ba5216d9f21123a"
integrity sha512-2Rw/4Mch5GccVb2uNNumeKLXS2g/g7FTXOS/PBhN38rxFuAzL2WE3Obx72y3xr3sfta2avfJdWQjIf+5B8qytw==
dependencies:
tslib "^2.0.0"

Expand All @@ -26,17 +26,17 @@
optionalDependencies:
parse5 "^5.0.0"

"@angular/common@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/common/-/common-11.1.0-next.4.tgz#e5602ac8f1df0eaa0f403383be4921c663765f14"
integrity sha512-O5tFWJl6yr45mvy84onR/gUYfxTqP10Pv2/0MJbLF/L3R1sK5LwBHg69SB6y8mdma/kwOMvemUK3lt9k9SrQQQ==
"@angular/common@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/common/-/common-11.1.0-rc.0.tgz#c19ffada76d3e01dfcca7e01b2244da1a724af1c"
integrity sha512-ZivVwORX8FC+Eq2oJsVAEw5EST/nCBlW/JHF5hpyfuBynhDmH4vQunPQapHfhP841FGiSGjGKTXFTBw09/gBpA==
dependencies:
tslib "^2.0.0"

"@angular/compiler-cli@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-11.1.0-next.4.tgz#feaada877589cdabbcc687e939ffde4393293605"
integrity sha512-E1/6e0JS3Saj9nG12eo8q0zJJXlbwtPyuWOVK7EK57OJdF6PsYIAf9g93TKk2QA+iimbNklconj/2LQj9cCGMQ==
"@angular/compiler-cli@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-11.1.0-rc.0.tgz#8bb026939a421190ac55dacaf7aca63d568ace82"
integrity sha512-YYyg/ixzqxoqaRnoInT60BwqA3enfcQvK2BcaUKvmhyyzqK+fnAiCiRgBl3uZGu+kQgAZuleUKdFmyHJZ275sQ==
dependencies:
"@babel/core" "^7.8.6"
"@babel/types" "^7.8.6"
Expand All @@ -54,10 +54,10 @@
tslib "^2.0.0"
yargs "^16.1.1"

"@angular/compiler@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-11.1.0-next.4.tgz#abf575efdec0fcc76cc15205431e460ed4063953"
integrity sha512-RP2kXZsPxtHPfAngYz0TPkGBQlJxD0CIC0+Gn3Ck2axSAWGCwRCuiozK9NVEIOzKT3VNtFZB9+esYzSYawcr2w==
"@angular/compiler@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-11.1.0-rc.0.tgz#de784751a59d619ebccb7b0e6c58e77aaab9bce3"
integrity sha512-ArVrXo/ozIb/MIGtjSrXF3+ZUjUUlQcOQ1+/zdWDeH+B8Gs78p1C6VQoBx8j27UsJ1XgX/Khsl3Zg3nzPq1kOA==
dependencies:
tslib "^2.0.0"

Expand All @@ -66,10 +66,10 @@
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-9.0.0.tgz#87e0bef4c369b6cadae07e3a4295778fc93799d5"
integrity sha512-ctjwuntPfZZT2mNj2NDIVu51t9cvbhl/16epc5xEwyzyDt76pX9UgwvY+MbXrf/C/FWwdtmNtfP698BKI+9leQ==

"@angular/core@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-11.1.0-next.4.tgz#d7bfc8e77f7bddcad40b45d52679d2eec5cbc049"
integrity sha512-2fsArpeyIDiZa2jjhj+FFCS+Rgj2+D3CoRUcAXNly+SVEL+yR8fZSCsBsFHFbReQnrAE/XvU0N63Q2jD3m56Yw==
"@angular/core@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-11.1.0-rc.0.tgz#2185e63d085921641c1c11ca57a29d16f5d881ed"
integrity sha512-OqYl5yGjLKeoMlWDpyEQWgWxf6qs7pJzHtw8220Alqio0lLTQTpldUBk8QgdRL75A+lZ/L8YqsLssozTyytPKw==
dependencies:
tslib "^2.0.0"

Expand All @@ -85,9 +85,9 @@
dependencies:
tslib "^2.0.0"

"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#579e491f4308ab4733a5c28ef7c5c734e3bf405e":
"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#d46e59817dc0ecebc10e2c716baa461afcd710cf":
version "0.0.0"
resolved "https://github.com/angular/dev-infra-private-builds.git#579e491f4308ab4733a5c28ef7c5c734e3bf405e"
resolved "https://github.com/angular/dev-infra-private-builds.git#d46e59817dc0ecebc10e2c716baa461afcd710cf"
dependencies:
"@angular/benchpress" "0.2.1"
"@bazel/buildifier" "^0.29.0"
Expand Down Expand Up @@ -117,17 +117,17 @@
yaml "^1.10.0"
yargs "^16.1.1"

"@angular/forms@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-11.1.0-next.4.tgz#c5a4b516aeadf6c3672c33595b66b04ae1050b4f"
integrity sha512-ZkW8bsYPL8C10RjhwdU1G07TVWyxxfHzzlLORFZ3CQgXoZtXBNTh0P7VDw44ZDLHmfwuksxryYVHTTrCeGQPew==
"@angular/forms@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-11.1.0-rc.0.tgz#7c03253e2b4a57ad6fe6fa0ecc0b436fb77c6097"
integrity sha512-yAFoMaPGiA2JleIQ8wwEaILMIGiM3tBg6RFcMkOz/pw3ihlh6cyj6UN5yM2z4SFwn87p8eSyd6XQBTybg5Ht4A==
dependencies:
tslib "^2.0.0"

"@angular/localize@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/localize/-/localize-11.1.0-next.4.tgz#124671437a4b43a1d70e824abedb04c9fe64d656"
integrity sha512-PCV+gzszB3OMHyWhAgDy9QSZCXlTXmhUYWy/4FGvc37LzRTFj+6U74y7mFIt3AXX547a3WbBU5/VLQw+ykhHBQ==
"@angular/localize@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/localize/-/localize-11.1.0-rc.0.tgz#8fac82a2453ff68cdce0cdc15e6f09f95320a44e"
integrity sha512-06F9Bzl6jAgu+4ZPSkG9XWgd/ZF+1/lQQ0RfcTEGcYNfcqXv4EaM9R2eCCFLFEClEz0pA0Bis9l2jtf8Z6c02A==
dependencies:
"@babel/core" "7.8.3"
glob "7.1.2"
Expand All @@ -140,40 +140,40 @@
dependencies:
tslib "^2.0.0"

"@angular/platform-browser-dynamic@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-11.1.0-next.4.tgz#b77709cd540affe41b23b38f941c75b9f3efda9d"
integrity sha512-RyLrIKFbSBxtERnZkZ1nOn4912JmuFjOdU83b+j22DWBmMJVi4+aWYZcjJPSnjLTrKMwvpDIGwS95+GcNL8Gww==
"@angular/platform-browser-dynamic@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-11.1.0-rc.0.tgz#1e9df5f9a6a6284256db7f8b3a8c0e9a8fa21e30"
integrity sha512-9Tiji8ahz23mozpZkuTjwH/GBSVLR+kdfeHpdArY7c1F7iyLgdHSnxgTfdUyz4fd+zg7a7y4YGP99iOJKnT3Ug==
dependencies:
tslib "^2.0.0"

"@angular/platform-browser@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-11.1.0-next.4.tgz#dbf902fb7034bd89b77369c28ac76dfd800d45af"
integrity sha512-y8rvqieQHXTgXtrJcjsYLIVYE5wAxSpLZ66M5/pbnO/cxtl+UUQRfUVpNOFO8ZvCZyzF/6cgcUw2/bm7GxdW8A==
"@angular/platform-browser@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-11.1.0-rc.0.tgz#4bfeea5a45eb883e2f4236a959d8529ac634509e"
integrity sha512-5Qx6iBeoBuvFGA/CMiMaj6tIz6V9uM2tWuMbT9UVM5HW0ZgBRJzHTlHjVZE1LpV3lwBVORD5G2Txgji4ti8Mjg==
dependencies:
tslib "^2.0.0"

"@angular/platform-server@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-11.1.0-next.4.tgz#ea1f25c0034e970bc74a0b1b26c59e7a4cefb143"
integrity sha512-RSYx2D/g4Pn33JUQIdGEmXDWYiztZH+tqes2408msWiq9PNXd4JHdmamHNS/dnCB/OMoxtFG2N++jz10bbhEqQ==
"@angular/platform-server@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-11.1.0-rc.0.tgz#a6954df0a6e100c00e33077dab1c5429b6ae8622"
integrity sha512-KUkNXGVrObstqw81STkERH+8Dp8//HNeadISAuCVMtkkqVnSSkASVce4jBHyCu4dg3hFEGAdAgMWOqC/Dr7OSQ==
dependencies:
domino "^2.1.2"
tslib "^2.0.0"
xhr2 "^0.2.0"

"@angular/router@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/router/-/router-11.1.0-next.4.tgz#1204848b79f97503da6f4a2cfe0dd6f9bd0046db"
integrity sha512-l4LW1/BHTBihV9+d2KYOmvTJZUS75JdXziB7iNCGp7ZBRD51YDr8rbBHQnQTYVE8lFi5y6uzZonkrHVEm9CKWQ==
"@angular/router@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/router/-/router-11.1.0-rc.0.tgz#5bf8a01d7d09e0aac36b3d8fe3119c8a6cc2efff"
integrity sha512-yevlvefmCa0ltlKPeTz9sT5d5UKVthMB2mOIopVsbr3U0HKVbIMJUhaLQmWdbBC1L2AKuBmUm4ljuOWEsIO4VA==
dependencies:
tslib "^2.0.0"

"@angular/service-worker@11.1.0-next.4":
version "11.1.0-next.4"
resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-11.1.0-next.4.tgz#58af6e3e47866d718ec8ad710bb4ff55833ec3f5"
integrity sha512-fpL6bXGc5QAIx3tphkgXntYB4OHSUek7zlAJTM8MPgiVrdCErpjLUufATYII+34X0blgZ1AarpWwpI/MOZUMiA==
"@angular/service-worker@11.1.0-rc.0":
version "11.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-11.1.0-rc.0.tgz#08d2073a6b7c86894fc0b9647405883576331021"
integrity sha512-8eRlxwK+56Po0LUEfObYxhoWe0yruMgRmfe46wel02rz/aPXnc7wqbxb6/PDYiJrTvBxkyxZ1MAh4ezAo6py+Q==
dependencies:
tslib "^2.0.0"

Expand Down

0 comments on commit 5e375a1

Please sign in to comment.