Skip to content

Commit 924b5e5

Browse files
committed
refactor: update to angular v13 with APF v13 output
Updates to an Angular v13 version which comes with the APF v13 output where all FW packages are strict ESM. This required some changes in the ngcc lookup logic to properly work with strict ESM and the new `package.json` `exports` field.
1 parent d17f863 commit 924b5e5

File tree

10 files changed

+109
-95
lines changed

10 files changed

+109
-95
lines changed

integration/project/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "angular-ls-integration-test-project",
33
"private": true,
44
"dependencies": {
5-
"@angular/common": "12.2.3",
6-
"@angular/compiler": "12.2.3",
7-
"@angular/compiler-cli": "12.2.3",
8-
"@angular/core": "12.2.3",
5+
"@angular/common": "13.0.0-next.15",
6+
"@angular/compiler": "13.0.0-next.15",
7+
"@angular/compiler-cli": "13.0.0-next.15",
8+
"@angular/core": "13.0.0-next.15",
99
"rxjs": "6.6.7",
1010
"zone.js": "0.11.4"
1111
}

integration/project/yarn.lock

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,43 @@
22
# yarn lockfile v1
33

44

5-
"@angular/common@12.2.3":
6-
version "12.2.3"
7-
resolved "https://registry.yarnpkg.com/@angular/common/-/common-12.2.3.tgz#deb11b2cc0e0e3056af4b0318098aecbc67fa561"
8-
integrity sha512-AkOeknm35kzLqqh5dIz1143e3Q1MjWgi7THlY3StY63yphseQUUvGQSNHkDSIpfwBN8Mt+ZykKFjhY+cNFYt7w==
5+
"@angular/common@13.0.0-next.15":
6+
version "13.0.0-next.15"
7+
resolved "https://registry.yarnpkg.com/@angular/common/-/common-13.0.0-next.15.tgz#9d55f51fbda235bea9510ca30a2f6389b22a19c2"
8+
integrity sha512-T0LPfZ4kKbcoT0QVluyT1Jo7J5ZK3vVSKSYMEHxqE21pFqlI5MMGdqn9X+SDlIEvEikARXG4w10Q3uJuAaaS5Q==
99
dependencies:
10-
tslib "^2.2.0"
10+
tslib "^2.3.0"
1111

12-
"@angular/compiler-cli@12.2.3":
13-
version "12.2.3"
14-
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-12.2.3.tgz#77774b219276ef45b269743093a40166299b6da6"
15-
integrity sha512-8yw13AqfRSY9YV4zb6PfuJizPa5/lh4DNbc6gQkw1Dmh/Af+U2bxrtZhQCgXWJAys1sd+PN/gTQOc7/YzDNVLQ==
12+
"@angular/compiler-cli@13.0.0-next.15":
13+
version "13.0.0-next.15"
14+
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-13.0.0-next.15.tgz#4f25b6d3feb1dbb0a6dd0f7d5445f24d20b49709"
15+
integrity sha512-15w0fFrqFfHNbQ7nrzTB4rrObsIpmsbGAlrKoFPdWN2LbAYUEauUhRIPi1Et+4A1eh9beIUHpofwb+VRrUhuLw==
1616
dependencies:
1717
"@babel/core" "^7.8.6"
18-
"@babel/types" "^7.8.6"
1918
canonical-path "1.0.0"
2019
chokidar "^3.0.0"
2120
convert-source-map "^1.5.1"
2221
dependency-graph "^0.11.0"
2322
magic-string "^0.25.0"
24-
minimist "^1.2.0"
2523
reflect-metadata "^0.1.2"
2624
semver "^7.0.0"
27-
source-map "^0.6.1"
2825
sourcemap-codec "^1.4.8"
29-
tslib "^2.2.0"
30-
yargs "^17.0.0"
26+
tslib "^2.3.0"
27+
yargs "^17.2.1"
3128

32-
"@angular/compiler@12.2.3":
33-
version "12.2.3"
34-
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-12.2.3.tgz#a528dcda48c17c9b844caba5b61cfd119e515d17"
35-
integrity sha512-jlS7XUokGb4eH6aYEIanrq6a7ZxcMI9GmMr5tBAdIHusH3b40dcMpZVXIxoGzv1Ws47m2izDCrjWjkFKeXPavQ==
29+
"@angular/compiler@13.0.0-next.15":
30+
version "13.0.0-next.15"
31+
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-13.0.0-next.15.tgz#bd9eaf5edc017112cf0c43de584f4167c6a3008f"
32+
integrity sha512-R2rKkSvONDuSW7D7WsN4nBH1fmZ9YagSiAb4F7cch5408DOMT6OlEgJDWAp69eWXiVDagd8R3e6K8j8StoZ6PQ==
3633
dependencies:
37-
tslib "^2.2.0"
34+
tslib "^2.3.0"
3835

39-
"@angular/core@12.2.3":
40-
version "12.2.3"
41-
resolved "https://registry.yarnpkg.com/@angular/core/-/core-12.2.3.tgz#74f53915da3134f7e3a205219107b2eb4adcf8a6"
42-
integrity sha512-gv3FJPiwDKugySzPepBzXrbr8HxeK2enotEmducNv3IdtGZPS0/qrbDVt7W0woRt7BGAeWaZKEaPoFzMZeEbCw==
36+
"@angular/core@13.0.0-next.15":
37+
version "13.0.0-next.15"
38+
resolved "https://registry.yarnpkg.com/@angular/core/-/core-13.0.0-next.15.tgz#0d6083c7154bedf9a825e6270f41b83bacb325b3"
39+
integrity sha512-lBjH+dUWCj+Ki4najMRF4yoXq0p6MF+4hEQEwimlvUo3BFRMRTl9CMv82oSBeSYJkZlov1w5zhaA1PQO6zjyKQ==
4340
dependencies:
44-
tslib "^2.2.0"
41+
tslib "^2.3.0"
4542

4643
"@babel/code-frame@^7.10.4":
4744
version "7.10.4"
@@ -209,7 +206,7 @@
209206
globals "^11.1.0"
210207
lodash "^4.17.19"
211208

212-
"@babel/types@^7.10.4", "@babel/types@^7.11.0", "@babel/types@^7.12.1", "@babel/types@^7.12.5", "@babel/types@^7.8.6":
209+
"@babel/types@^7.10.4", "@babel/types@^7.11.0", "@babel/types@^7.12.1", "@babel/types@^7.12.5":
213210
version "7.12.6"
214211
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.6.tgz#ae0e55ef1cce1fbc881cd26f8234eb3e657edc96"
215212
integrity sha512-hwyjw6GvjBLiyy3W0YQf0Z5Zf4NpYejUnKFcfcUhZCSffoBBp30w6wP2Wn6pk31jMYZvcOrB/1b7cGXvEoKogA==
@@ -482,7 +479,7 @@ magic-string@^0.25.0:
482479
dependencies:
483480
sourcemap-codec "^1.4.4"
484481

485-
minimist@^1.2.0, minimist@^1.2.5:
482+
minimist@^1.2.5:
486483
version "1.2.5"
487484
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
488485
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
@@ -561,11 +558,6 @@ source-map@^0.5.0:
561558
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
562559
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
563560

564-
source-map@^0.6.1:
565-
version "0.6.1"
566-
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
567-
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
568-
569561
sourcemap-codec@^1.4.4, sourcemap-codec@^1.4.8:
570562
version "1.4.8"
571563
resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
@@ -616,10 +608,10 @@ tslib@^2.0.0:
616608
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.1.tgz#410eb0d113e5b6356490eec749603725b021b43e"
617609
integrity sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==
618610

619-
tslib@^2.2.0:
620-
version "2.3.0"
621-
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.0.tgz#803b8cdab3e12ba581a4ca41c8839bbb0dacb09e"
622-
integrity sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==
611+
tslib@^2.3.0:
612+
version "2.3.1"
613+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
614+
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
623615

624616
wrap-ansi@^7.0.0:
625617
version "7.0.0"
@@ -645,10 +637,10 @@ yargs-parser@^20.2.2:
645637
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54"
646638
integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==
647639

648-
yargs@^17.0.0:
649-
version "17.0.1"
650-
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.0.1.tgz#6a1ced4ed5ee0b388010ba9fd67af83b9362e0bb"
651-
integrity sha512-xBBulfCc8Y6gLFcrPvtqKz9hz8SO0l1Ni8GgDekvBX2ro0HRQImDGnikfc33cgzcYUSncapnNcZDjVFIH3f6KQ==
640+
yargs@^17.2.1:
641+
version "17.2.1"
642+
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.2.1.tgz#e2c95b9796a0e1f7f3bf4427863b42e0418191ea"
643+
integrity sha512-XfR8du6ua4K6uLGm5S6fA+FIJom/MdJcFNVY8geLlp2v8GYbOXD4EB1tPNZsRn4vBzKGMgb5DRZMeWuFc2GO8Q==
652644
dependencies:
653645
cliui "^7.0.2"
654646
escalade "^3.1.1"

integration/workspace/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
"name": "workspace",
33
"private": true,
44
"dependencies": {
5-
"@angular/common": "12.2.3",
6-
"@angular/compiler-cli": "12.2.3",
7-
"@angular/core": "12.2.3",
5+
"@angular/common": "13.0.0-next.15",
6+
"@angular/compiler": "13.0.0-next.15",
7+
"@angular/compiler-cli": "13.0.0-next.15",
8+
"@angular/core": "13.0.0-next.15",
89
"rxjs": "6.6.7",
910
"zone.js": "0.11.4"
1011
}

integration/workspace/yarn.lock

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,43 @@
22
# yarn lockfile v1
33

44

5-
"@angular/common@12.2.3":
6-
version "12.2.3"
7-
resolved "https://registry.yarnpkg.com/@angular/common/-/common-12.2.3.tgz#deb11b2cc0e0e3056af4b0318098aecbc67fa561"
8-
integrity sha512-AkOeknm35kzLqqh5dIz1143e3Q1MjWgi7THlY3StY63yphseQUUvGQSNHkDSIpfwBN8Mt+ZykKFjhY+cNFYt7w==
5+
"@angular/common@13.0.0-next.15":
6+
version "13.0.0-next.15"
7+
resolved "https://registry.yarnpkg.com/@angular/common/-/common-13.0.0-next.15.tgz#9d55f51fbda235bea9510ca30a2f6389b22a19c2"
8+
integrity sha512-T0LPfZ4kKbcoT0QVluyT1Jo7J5ZK3vVSKSYMEHxqE21pFqlI5MMGdqn9X+SDlIEvEikARXG4w10Q3uJuAaaS5Q==
99
dependencies:
10-
tslib "^2.2.0"
10+
tslib "^2.3.0"
1111

12-
"@angular/compiler-cli@12.2.3":
13-
version "12.2.3"
14-
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-12.2.3.tgz#77774b219276ef45b269743093a40166299b6da6"
15-
integrity sha512-8yw13AqfRSY9YV4zb6PfuJizPa5/lh4DNbc6gQkw1Dmh/Af+U2bxrtZhQCgXWJAys1sd+PN/gTQOc7/YzDNVLQ==
12+
"@angular/compiler-cli@13.0.0-next.15":
13+
version "13.0.0-next.15"
14+
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-13.0.0-next.15.tgz#4f25b6d3feb1dbb0a6dd0f7d5445f24d20b49709"
15+
integrity sha512-15w0fFrqFfHNbQ7nrzTB4rrObsIpmsbGAlrKoFPdWN2LbAYUEauUhRIPi1Et+4A1eh9beIUHpofwb+VRrUhuLw==
1616
dependencies:
1717
"@babel/core" "^7.8.6"
18-
"@babel/types" "^7.8.6"
1918
canonical-path "1.0.0"
2019
chokidar "^3.0.0"
2120
convert-source-map "^1.5.1"
2221
dependency-graph "^0.11.0"
2322
magic-string "^0.25.0"
24-
minimist "^1.2.0"
2523
reflect-metadata "^0.1.2"
2624
semver "^7.0.0"
27-
source-map "^0.6.1"
2825
sourcemap-codec "^1.4.8"
29-
tslib "^2.2.0"
30-
yargs "^17.0.0"
26+
tslib "^2.3.0"
27+
yargs "^17.2.1"
3128

32-
"@angular/[email protected]":
33-
version "12.2.3"
34-
resolved "https://registry.yarnpkg.com/@angular/core/-/core-12.2.3.tgz#74f53915da3134f7e3a205219107b2eb4adcf8a6"
35-
integrity sha512-gv3FJPiwDKugySzPepBzXrbr8HxeK2enotEmducNv3IdtGZPS0/qrbDVt7W0woRt7BGAeWaZKEaPoFzMZeEbCw==
29+
"@angular/[email protected]":
30+
version "13.0.0-next.15"
31+
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-13.0.0-next.15.tgz#bd9eaf5edc017112cf0c43de584f4167c6a3008f"
32+
integrity sha512-R2rKkSvONDuSW7D7WsN4nBH1fmZ9YagSiAb4F7cch5408DOMT6OlEgJDWAp69eWXiVDagd8R3e6K8j8StoZ6PQ==
3633
dependencies:
37-
tslib "^2.2.0"
34+
tslib "^2.3.0"
35+
36+
"@angular/[email protected]":
37+
version "13.0.0-next.15"
38+
resolved "https://registry.yarnpkg.com/@angular/core/-/core-13.0.0-next.15.tgz#0d6083c7154bedf9a825e6270f41b83bacb325b3"
39+
integrity sha512-lBjH+dUWCj+Ki4najMRF4yoXq0p6MF+4hEQEwimlvUo3BFRMRTl9CMv82oSBeSYJkZlov1w5zhaA1PQO6zjyKQ==
40+
dependencies:
41+
tslib "^2.3.0"
3842

3943
"@babel/code-frame@^7.10.4":
4044
version "7.12.11"
@@ -201,7 +205,7 @@
201205
globals "^11.1.0"
202206
lodash "^4.17.19"
203207

204-
"@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.11", "@babel/types@^7.12.5", "@babel/types@^7.12.7", "@babel/types@^7.8.6":
208+
"@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.11", "@babel/types@^7.12.5", "@babel/types@^7.12.7":
205209
version "7.12.11"
206210
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.11.tgz#a86e4d71e30a9b6ee102590446c98662589283ce"
207211
integrity sha512-ukA9SQtKThINm++CX1CwmliMrE54J6nIYB5XTwL5f/CLFW9owfls+YSU8tVW15RQ2w+a3fSbPjC6HdQNtWZkiA==
@@ -449,7 +453,7 @@ magic-string@^0.25.0:
449453
dependencies:
450454
sourcemap-codec "^1.4.4"
451455

452-
minimist@^1.2.0, minimist@^1.2.5:
456+
minimist@^1.2.5:
453457
version "1.2.5"
454458
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
455459
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
@@ -515,11 +519,6 @@ source-map@^0.5.0:
515519
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
516520
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
517521

518-
source-map@^0.6.1:
519-
version "0.6.1"
520-
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
521-
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
522-
523522
sourcemap-codec@^1.4.4, sourcemap-codec@^1.4.8:
524523
version "1.4.8"
525524
resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
@@ -570,10 +569,10 @@ tslib@^2.0.0:
570569
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.3.tgz#8e0741ac45fc0c226e58a17bfc3e64b9bc6ca61c"
571570
integrity sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==
572571

573-
tslib@^2.2.0:
574-
version "2.3.0"
575-
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.0.tgz#803b8cdab3e12ba581a4ca41c8839bbb0dacb09e"
576-
integrity sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==
572+
tslib@^2.3.0:
573+
version "2.3.1"
574+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
575+
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
577576

578577
wrap-ansi@^7.0.0:
579578
version "7.0.0"
@@ -599,10 +598,10 @@ yargs-parser@^20.2.2:
599598
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54"
600599
integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==
601600

602-
yargs@^17.0.0:
603-
version "17.0.1"
604-
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.0.1.tgz#6a1ced4ed5ee0b388010ba9fd67af83b9362e0bb"
605-
integrity sha512-xBBulfCc8Y6gLFcrPvtqKz9hz8SO0l1Ni8GgDekvBX2ro0HRQImDGnikfc33cgzcYUSncapnNcZDjVFIH3f6KQ==
601+
yargs@^17.2.1:
602+
version "17.2.1"
603+
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.2.1.tgz#e2c95b9796a0e1f7f3bf4427863b42e0418191ea"
604+
integrity sha512-XfR8du6ua4K6uLGm5S6fA+FIJom/MdJcFNVY8geLlp2v8GYbOXD4EB1tPNZsRn4vBzKGMgb5DRZMeWuFc2GO8Q==
606605
dependencies:
607606
cliui "^7.0.2"
608607
escalade "^3.1.1"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
"test:syntaxes": "yarn compile:syntaxes-test && yarn build:syntaxes && jasmine dist/syntaxes/test/driver.js"
184184
},
185185
"dependencies": {
186-
"@angular/language-service": "13.0.0-next.9",
186+
"@angular/language-service": "13.0.0-next.15",
187187
"typescript": "4.4.3",
188188
"vscode-jsonrpc": "6.0.0",
189189
"vscode-languageclient": "7.0.0",

scripts/test.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ if [[ -z "${CI}" ]]; then
88
(cd integration/workspace && yarn)
99
fi
1010

11-
# Run ngcc before test starts
12-
(
13-
cd integration/project
14-
yarn ngcc
15-
)
16-
1711
# Server unit tests
1812
yarn run test
1913

server/src/ngcc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface Progress {
2323
*/
2424
export async function resolveAndRunNgcc(tsconfig: string, progress: Progress): Promise<void> {
2525
const directory = dirname(tsconfig);
26-
const ngcc = resolveNgcc(directory);
26+
const ngcc = await resolveNgcc(directory);
2727
if (!ngcc) {
2828
throw new Error(`Failed to resolve ngcc from ${directory}`);
2929
}

server/src/session.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ export class Session {
148148
// TODO(atscott): The Ivy flag was removed in v13. We need to include a legacy version (some
149149
// v12) of the language service in order to continue supporting view engine.
150150
const pluginConfig: PluginConfig = {
151-
ivy: true,
152151
angularOnly: true,
153152
};
154153
if (options.host.isG3) {

server/src/version_provider.ts

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import * as fs from 'fs';
1010
import * as path from 'path';
11+
import url from 'url';
1112

1213
import {NodeModule, resolve, Version} from '../common/resolver';
1314

@@ -84,6 +85,22 @@ function resolveTsServerFromTsdk(tsdk: string): NodeModule|undefined {
8485
}
8586
}
8687

88+
/**
89+
* This uses a dynamic import to load a module which may be ESM.
90+
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
91+
* will currently, unconditionally downlevel dynamic import into a require call.
92+
* require calls cannot load ESM code and will result in a runtime error. To workaround
93+
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
94+
* Once TypeScript provides support for keeping the dynamic import this workaround can
95+
* be dropped.
96+
*
97+
* @param modulePath The path of the module to load.
98+
* @returns A Promise that resolves to the dynamically imported module.
99+
*/
100+
export function loadEsmModule<T>(modulePath: string|URL): Promise<T> {
101+
return new Function('modulePath', `return import(modulePath);`)(modulePath) as Promise<T>;
102+
}
103+
87104
/**
88105
* Resolve `@angular/language-service` from the given locations.
89106
* @param probeLocations locations from which resolution is attempted
@@ -93,6 +110,18 @@ export function resolveNgLangSvc(probeLocations: string[]): NodeModule {
93110
return resolveWithMinVersion(ngls, MIN_NG_VERSION, probeLocations, ngls);
94111
}
95112

96-
export function resolveNgcc(directory: string): NodeModule|undefined {
97-
return resolve('@angular/compiler-cli/ngcc/main-ngcc.js', directory, '@angular/compiler-cli');
113+
export async function resolveNgcc(directory: string): Promise<NodeModule|undefined> {
114+
const ngcc = resolve('@angular/compiler-cli/ngcc', directory, '@angular/compiler-cli');
115+
if (ngcc === undefined) {
116+
return undefined;
117+
}
118+
119+
// The Angular compiler-CLI package is strict ESM as of v13.
120+
const ngccModule = await loadEsmModule</* ideally use a type here?? */ any>(
121+
url.pathToFileURL(ngcc.resolvedPath));
122+
123+
return {
124+
...ngcc,
125+
resolvedPath: ngccModule.ngccMainFilePath,
126+
};
98127
}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@
5252
yaml "^1.10.0"
5353
yargs "^17.0.0"
5454

55-
"@angular/[email protected].9":
56-
version "13.0.0-next.9"
57-
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-13.0.0-next.9.tgz#4a7ad7b1d703d41354796a918b46555d7e31a497"
58-
integrity sha512-QuxolblOcGFXP/wPBIM4HRZ6HaFtOAGhwy4L5ZMaYGLsPIQ2nSYkicHy2pTiVwxNpXmfwSc80c11XrJTVPqBTQ==
55+
"@angular/[email protected].15":
56+
version "13.0.0-next.15"
57+
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-13.0.0-next.15.tgz#3839fca225b02ad41bf1e35e79abc95934b9e074"
58+
integrity sha512-L0T+Ov9TchY9H76LJl0ZCAIsNv89jpXbhkZSyg4WvO3fcOx7WPfo0xW3ymM+4kofF8u1l6WRBaqCDM+350DG3A==
5959

6060
"@babel/code-frame@^7.0.0":
6161
version "7.12.13"

0 commit comments

Comments
 (0)