From f68dc241ea86fa616caacda1fe85b185683282f7 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 5 Oct 2021 09:57:37 +0000 Subject: [PATCH 1/5] build: update angular --- .github/workflows/dev-infra.yml | 2 +- .github/workflows/lock-closed.yml | 2 +- package.json | 26 +-- packages/ngtools/webpack/package.json | 4 +- tests/legacy-cli/e2e/ng-snapshot/package.json | 26 +-- yarn.lock | 157 ++++++++---------- 6 files changed, 102 insertions(+), 115 deletions(-) diff --git a/.github/workflows/dev-infra.yml b/.github/workflows/dev-infra.yml index 243faa040e86..87ac8f08fa37 100644 --- a/.github/workflows/dev-infra.yml +++ b/.github/workflows/dev-infra.yml @@ -9,6 +9,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: angular/dev-infra/github-actions/breaking-changes-label@e638278dafb51a09bb06929dbfa44b3ac26e4030 + - uses: angular/dev-infra/github-actions/breaking-changes-label@792204aa7a4e88dab92636d34f5efb3546d69a9e with: angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }} diff --git a/.github/workflows/lock-closed.yml b/.github/workflows/lock-closed.yml index ff4e003406e8..7904c0a00f4e 100644 --- a/.github/workflows/lock-closed.yml +++ b/.github/workflows/lock-closed.yml @@ -9,6 +9,6 @@ jobs: lock_closed: runs-on: ubuntu-latest steps: - - uses: angular/dev-infra/github-actions/lock-closed@e638278dafb51a09bb06929dbfa44b3ac26e4030 + - uses: angular/dev-infra/github-actions/lock-closed@792204aa7a4e88dab92636d34f5efb3546d69a9e with: lock-bot-key: ${{ secrets.LOCK_BOT_PRIVATE_KEY }} diff --git a/package.json b/package.json index efc8301d2bf2..4fc97d6bf10e 100644 --- a/package.json +++ b/package.json @@ -64,21 +64,21 @@ }, "devDependencies": { "@ampproject/remapping": "1.0.1", - "@angular/animations": "13.0.0-next.9", + "@angular/animations": "13.0.0-next.11", "@angular/cdk": "13.0.0-next.7", - "@angular/common": "13.0.0-next.9", - "@angular/compiler": "13.0.0-next.9", - "@angular/compiler-cli": "13.0.0-next.9", - "@angular/core": "13.0.0-next.9", - "@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#60593b6c234682d0bb9f009e47316c26bb5a94a3", - "@angular/forms": "13.0.0-next.9", - "@angular/localize": "13.0.0-next.9", + "@angular/common": "13.0.0-next.11", + "@angular/compiler": "13.0.0-next.11", + "@angular/compiler-cli": "13.0.0-next.11", + "@angular/core": "13.0.0-next.11", + "@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#d008ca5d1aeebd192c7dca25d6eb09b9e69140c6", + "@angular/forms": "13.0.0-next.11", + "@angular/localize": "13.0.0-next.11", "@angular/material": "13.0.0-next.7", - "@angular/platform-browser": "13.0.0-next.9", - "@angular/platform-browser-dynamic": "13.0.0-next.9", - "@angular/platform-server": "13.0.0-next.9", - "@angular/router": "13.0.0-next.9", - "@angular/service-worker": "13.0.0-next.9", + "@angular/platform-browser": "13.0.0-next.11", + "@angular/platform-browser-dynamic": "13.0.0-next.11", + "@angular/platform-server": "13.0.0-next.11", + "@angular/router": "13.0.0-next.11", + "@angular/service-worker": "13.0.0-next.11", "@babel/core": "7.15.5", "@babel/generator": "7.15.4", "@babel/helper-annotate-as-pure": "7.15.4", diff --git a/packages/ngtools/webpack/package.json b/packages/ngtools/webpack/package.json index 93608f36df14..66540171851f 100644 --- a/packages/ngtools/webpack/package.json +++ b/packages/ngtools/webpack/package.json @@ -28,8 +28,8 @@ }, "devDependencies": { "@angular-devkit/core": "0.0.0", - "@angular/compiler": "13.0.0-next.9", - "@angular/compiler-cli": "13.0.0-next.9", + "@angular/compiler": "13.0.0-next.11", + "@angular/compiler-cli": "13.0.0-next.11", "typescript": "4.4.3", "webpack": "5.55.1" } diff --git a/tests/legacy-cli/e2e/ng-snapshot/package.json b/tests/legacy-cli/e2e/ng-snapshot/package.json index 92e83ec92d87..c56bdeee2d0b 100644 --- a/tests/legacy-cli/e2e/ng-snapshot/package.json +++ b/tests/legacy-cli/e2e/ng-snapshot/package.json @@ -2,21 +2,21 @@ "description": "snapshot versions of Angular for e2e testing", "private": true, "dependencies": { - "@angular/animations": "github:angular/animations-builds#a31a3ea8048c36a5f882a4d7f148d212854b59eb", + "@angular/animations": "github:angular/animations-builds#b8940cb799a53c882bde5938005f9c7ac3eda0f5", "@angular/cdk": "github:angular/cdk-builds#e5a4849a6415cef649ab139f56b1fb861d4b28de", - "@angular/common": "github:angular/common-builds#0fc7054dd88205228a4c8657f06b28ea37a2ba5b", - "@angular/compiler": "github:angular/compiler-builds#8bed807ddce7bc162212f41d05b8cb7175959d9c", - "@angular/compiler-cli": "github:angular/compiler-cli-builds#b4e8112a8ebec5cd2fabe56206b8788283824b75", - "@angular/core": "github:angular/core-builds#70f9f7e2fc2a487487a56808070f4e0790cb73ed", - "@angular/forms": "github:angular/forms-builds#45281fc1162fc3538fc92dd48756b2a78d945f2b", - "@angular/language-service": "github:angular/language-service-builds#6035963ecb22f63bbc0881c3569feca1da9b5b71", - "@angular/localize": "github:angular/localize-builds#b14bd32dd9a353b22fbda331a4519ab54804b715", + "@angular/common": "github:angular/common-builds#417e63ec55999662017a6f789dfa3e83119f78e3", + "@angular/compiler": "github:angular/compiler-builds#4322661f01854ad7b922185f8d3589d4e50e5e89", + "@angular/compiler-cli": "github:angular/compiler-cli-builds#10ce3e8340dcb08303682cea2a241c4bc80bfce0", + "@angular/core": "github:angular/core-builds#f28e1bec15ff51007ac8e609e7fa91f48d64af54", + "@angular/forms": "github:angular/forms-builds#44d91cd8c3401512c0ba1b10ae33015bfda02f63", + "@angular/language-service": "github:angular/language-service-builds#6a27af21862f9ca2d7a136a8a5bfcf8378f0dc65", + "@angular/localize": "github:angular/localize-builds#4fdcb429dfcd189d467d20dabb986bb0754ddf98", "@angular/material": "github:angular/material2-builds#cad080ae99ffdce7243e20fa3852a9db1451426a", "@angular/material-moment-adapter": "github:angular/material-moment-adapter-builds#1bb8e4ca72d41a08aa8368c7c8aa53349c92af8d", - "@angular/platform-browser": "github:angular/platform-browser-builds#8d67bad59eeb7c3c3d0a43522954d18da7fc05a1", - "@angular/platform-browser-dynamic": "github:angular/platform-browser-dynamic-builds#7fc46c851a447ce349e1146030dc9560b75ccf21", - "@angular/platform-server": "github:angular/platform-server-builds#a14e97a9d78c2eff3244613d0363552eb0c432ed", - "@angular/router": "github:angular/router-builds#541077b93aead0b34b387db3c8371a7df9c2b4d9", - "@angular/service-worker": "github:angular/service-worker-builds#6533cf229bdfad43ec5e8bbba0f15c60d985cd1b" + "@angular/platform-browser": "github:angular/platform-browser-builds#eba73ff7a340e77af074087ea0acd27eaaa769c6", + "@angular/platform-browser-dynamic": "github:angular/platform-browser-dynamic-builds#55827dddaf4b392309beb264b7dfce3c60b9bf8e", + "@angular/platform-server": "github:angular/platform-server-builds#7c59660b7830c4c6e824b848a7d8dce1f1427e3d", + "@angular/router": "github:angular/router-builds#c73fdb56f608d0d6234332abdfc66e651e73157d", + "@angular/service-worker": "github:angular/service-worker-builds#cbfa0e7517ed74797eab1b0d908397c9c1978eb2" } } diff --git a/yarn.lock b/yarn.lock index aeb597a4d816..3941e112161a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -41,10 +41,10 @@ tslib "2.3.0" typescript "4.3.5" -"@angular/animations@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-13.0.0-next.9.tgz#ef1ab7e8ad4bb02605bc7c7d6ed2ea80364bf958" - integrity sha512-Yj9WISMUrYJVKJulfODS6e/L4Q5YKtIjhzKMlc1w9PJuJscmipPVvr0MypUP4bs/jyBC6G/mO+e3/Oq8RJJL/A== +"@angular/animations@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-13.0.0-next.11.tgz#390cc273f25eafdf9f28c55d4f40918d0d0543fc" + integrity sha512-6iEOVWgAT3Yf0AC2bccApeJLVCcxizl1WBq8KYSV8nG1VqxyEeRzK0G5rjxxAnMzzpZxX307iCiZOgnYDPi43A== dependencies: tslib "^2.3.0" @@ -65,20 +65,19 @@ optionalDependencies: parse5 "^5.0.0" -"@angular/common@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/common/-/common-13.0.0-next.9.tgz#8b269de129a49bf163d3c4b88a78d6867b49d314" - integrity sha512-iPQZi6oTweicMLeazDLU1vVHhA5HSqHDYJNl6gPzCiLWjD5xBZJke9PYENbqBZO+eam/nDE4NuU65UQJu+kHtQ== +"@angular/common@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/common/-/common-13.0.0-next.11.tgz#a3ff2f252cc36c2cd2471d3ca06773feb0675a9b" + integrity sha512-exS/M13D2Hri0geSrmEUL4etjq/2QkayknQESsT8s60Vs6QnYKlWMGs3pbDYSRC3pTj+3XFe3OGHnr+3oPKaPQ== dependencies: tslib "^2.3.0" -"@angular/compiler-cli@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-13.0.0-next.9.tgz#76022a21fd0392390c2b22714a91055673f4a02f" - integrity sha512-N+dD2uMpKG8hpJVhL3ixrf5X7tiPnpERJaTzuYIcSWQDFUy4rNXhXkC9XvxR1GV9nGeuMzlgiDNFIP3Qnl5fyw== +"@angular/compiler-cli@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-13.0.0-next.11.tgz#99f3f18af94d952d4a01ef0776e1a56d1d014e72" + integrity sha512-XnjPCUYZ62Qby4bMNtmZlwHjEHVvauxGXrVGHOTE53Edt7YSmxa4ctcekmZKBdkKp2yR+7E/hHlb+AHnMpsZyA== dependencies: "@babel/core" "^7.8.6" - "@babel/types" "^7.8.6" canonical-path "1.0.0" chokidar "^3.0.0" convert-source-map "^1.5.1" @@ -90,19 +89,19 @@ source-map "^0.6.1" sourcemap-codec "^1.4.8" tslib "^2.3.0" - yargs "^17.0.0" + yargs "^17.2.1" -"@angular/compiler@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-13.0.0-next.9.tgz#d68d83f7509f177a9ecbeaa634255d0fd77fdeaa" - integrity sha512-NZC4RAbB2NSApaj9hiKc3+o48dUi4iQ55QTLf5BJMdYfhpq/hnI8Ri5OPRB3ZqZEXcg1MFc3KY0bCNlasVTfcw== +"@angular/compiler@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-13.0.0-next.11.tgz#14f2b347878347e3500821b88c28bb9953a31b38" + integrity sha512-3lL05/+h0Ou7LOmnDV10iBC+le05CV2hKlQGDUkOxkxF7uFiwwVkh6wxWW6n4VlofspRlnbFQp0rm4IJEiIBag== dependencies: tslib "^2.3.0" -"@angular/core@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/core/-/core-13.0.0-next.9.tgz#da06a257508076c5d6ed471ae87c22a31514bc01" - integrity sha512-e1Zri+2328T3YJ9xbwYd9AIHv5bFRUULomVBEBCR22EAAJpMhGCv0VfJvg6aNg/FNQv4Kuy+teI7NCbQSofqpg== +"@angular/core@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/core/-/core-13.0.0-next.11.tgz#701f274bec7e733a668940a643e09d6cc8aa65ad" + integrity sha512-wbCtmSAH0udzm9e9wyDJghG6EVyM8S0S0o0vo7HWQldQwGxw/CaIW9PNEmxNeYTayTI0EofFldcizrkNNwMBYQ== dependencies: tslib "^2.3.0" @@ -113,10 +112,10 @@ dependencies: tslib "^2.0.0" -"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#60593b6c234682d0bb9f009e47316c26bb5a94a3": +"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#d008ca5d1aeebd192c7dca25d6eb09b9e69140c6": version "0.0.0" - uid "60593b6c234682d0bb9f009e47316c26bb5a94a3" - resolved "https://github.com/angular/dev-infra-private-builds.git#60593b6c234682d0bb9f009e47316c26bb5a94a3" + uid d008ca5d1aeebd192c7dca25d6eb09b9e69140c6 + resolved "https://github.com/angular/dev-infra-private-builds.git#d008ca5d1aeebd192c7dca25d6eb09b9e69140c6" dependencies: "@actions/core" "^1.4.0" "@actions/github" "^5.0.0" @@ -169,21 +168,21 @@ yaml "^1.10.0" yargs "^17.0.0" -"@angular/forms@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-13.0.0-next.9.tgz#b1c70f2d14318abc4c5e8f6ddc9d841e3a7b6f77" - integrity sha512-AviKumCFJ9gDYJv9fA606uT9KRy/0kOoo3o+oWxkdZgwNjPi5WhrJlAFt6/F49JECnPR6n0qhlcvvTOxDDkT2Q== +"@angular/forms@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-13.0.0-next.11.tgz#29930e2baefeb9658083e5cf60d505834f8f2659" + integrity sha512-idgCsNF1+CBOUrqrMlY/TFjFNprxzKxC1zum+Hw2eXAvb9Vy4a2Ip/yjAAWLcHhugEsqsgTyc7SPNUP/hsbw5w== dependencies: tslib "^2.3.0" -"@angular/localize@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/localize/-/localize-13.0.0-next.9.tgz#b323fc089785ac77e60b26f1d5a0068b2387a196" - integrity sha512-gWaDGZniFChwt0dG4GdfrQLsmcKkzgOgzo87rHFqBHepJ3635d6xAO8SACtDIAb+Zap03TwBlr8QtgAE/HF71g== +"@angular/localize@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/localize/-/localize-13.0.0-next.11.tgz#2828c972c6586d5f6af8ca80ab149c9e13073718" + integrity sha512-Lkmp84Wq/SLMeHM2YAYV3STqktwCcOLNpnj/1wkLphWSQo02Tp7Mwa/9+9gA+Cf18ElxIwtpytJG7CqpjKRpbg== dependencies: - "@babel/core" "7.8.3" - glob "7.1.7" - yargs "^17.0.0" + "@babel/core" "7.8.6" + glob "7.2.0" + yargs "^17.2.1" "@angular/material@13.0.0-next.7": version "13.0.0-next.7" @@ -192,40 +191,40 @@ dependencies: tslib "^2.2.0" -"@angular/platform-browser-dynamic@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-13.0.0-next.9.tgz#bad6b655ff40c25d5c4195fd2495d077590dfa09" - integrity sha512-s6PSe0Dv5lAyIPZcCqeLY8jTAPus/+8dP2f3VNTwY/czo3qZtekpEmU3/WXCuHNyqzLTO9KviAh2pUAxl+yhqA== +"@angular/platform-browser-dynamic@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-13.0.0-next.11.tgz#3f4bb5786800e8a6d333257f6d6b86f2ab6edb56" + integrity sha512-vtI38oUnlw5zvwnekETzFjVF6BHqx5W2UWEolR3NEgw0e9cB73IbYU8fdv4K8Hro3rEntE5zkpXlsdGT/7lKUw== dependencies: tslib "^2.3.0" -"@angular/platform-browser@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-13.0.0-next.9.tgz#0d7aa78e502dced0b694e91dbb99b413236afc38" - integrity sha512-8Qq/+djeYLTydn3VuRnyT6GMT8jXPtnWxTXSNBeIuEAufabiKCsoWfF9U8SDDiWH5Pa7CM/7zTPAybJEt8iKFA== +"@angular/platform-browser@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-13.0.0-next.11.tgz#1e421c90f4302f79f9999586b37169dd96d02f0d" + integrity sha512-PwtvqOlrjSfd8BFYSkozAeN3ogUzK+K18Si2pVNmDFPAsp1q0w3t6Dsk1sVLK3WsZUUzTX2PttkiL4Pctl6tJg== dependencies: tslib "^2.3.0" -"@angular/platform-server@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-13.0.0-next.9.tgz#8f53bd2aa866a323bfcd4860615173332c5e07b4" - integrity sha512-slw2TF2zdBIbKhCqwx+6FS0uWM5Bi1uF9m7nT4uuU0DtZeuMK9tz3f2SHsCcxf+SpmEofIzYvAKmtQOBnj9+Yw== +"@angular/platform-server@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-13.0.0-next.11.tgz#233bf37423aac42349b88f38129fa5771633f82b" + integrity sha512-Zgg5u1XA2+V6HWf7O8PAW85G9KAWCJrtoqRagVZRLTqiCxKueCeypYdsPPvCu3c2pF5eB4UjzL1a1OL6nQhn+g== dependencies: domino "^2.1.2" tslib "^2.3.0" xhr2 "^0.2.0" -"@angular/router@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/router/-/router-13.0.0-next.9.tgz#e8b8e1180fa6e7c1403f0e785f87878828ed0302" - integrity sha512-ZM0zU0eNkxE1SYaf4bejbrXg3unHnVy27g5mOqOZN0GQC/5WfWWYPc1QfgYuEUvT/7SOHFrvuqnlfMdxBOebuQ== +"@angular/router@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/router/-/router-13.0.0-next.11.tgz#d4c5fdb26bb497798e40a58cf2ce961e2a370790" + integrity sha512-NgiTXGpKB3Q/HiP6yax182bSHFn+bobTxJFRtl+V7eK0whwwZ33PjennmAMf6IJOcol4KUj5Ll8xbo/Ond2hdw== dependencies: tslib "^2.3.0" -"@angular/service-worker@13.0.0-next.9": - version "13.0.0-next.9" - resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-13.0.0-next.9.tgz#172b98534ac8229b5583f2dd7334b83308da8cb0" - integrity sha512-QXXtu7BOUFwY98UiHldOA1e3Xx/orJZknF9YHALMOE3BKYWHsBby0lRXj3pj8fAwjfKyNP/CShTAJGf7/P6low== +"@angular/service-worker@13.0.0-next.11": + version "13.0.0-next.11" + resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-13.0.0-next.11.tgz#832a35f18cc3807e12a1bb4125d3b08f39eeea24" + integrity sha512-BeARGm4T1YvyLEK7dGjUSMM7okZ14eh2TLrt4hZDTbXiFSSCl4t1h4BvMe2x6/6kkjWxXcL1JhhOm106N67Mng== dependencies: tslib "^2.3.0" @@ -274,18 +273,18 @@ semver "^6.3.0" source-map "^0.5.0" -"@babel/core@7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.8.3.tgz#30b0ebb4dd1585de6923a0b4d179e0b9f5d82941" - integrity sha512-4XFkf8AwyrEG7Ziu3L2L0Cv+WyY47Tcsp70JFmpftbAA1K7YL/sgE9jh9HyNj08Y/U50ItUchpN0w6HxAoX1rA== +"@babel/core@7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.8.6.tgz#27d7df9258a45c2e686b6f18b6c659e563aa4636" + integrity sha512-Sheg7yEJD51YHAvLEV/7Uvw95AeWqYPL3Vk3zGujJKIhJ+8oLw2ALaf3hbucILhKsgSoADOvtKRJuNVdcJkOrg== dependencies: "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.8.3" - "@babel/helpers" "^7.8.3" - "@babel/parser" "^7.8.3" - "@babel/template" "^7.8.3" - "@babel/traverse" "^7.8.3" - "@babel/types" "^7.8.3" + "@babel/generator" "^7.8.6" + "@babel/helpers" "^7.8.4" + "@babel/parser" "^7.8.6" + "@babel/template" "^7.8.6" + "@babel/traverse" "^7.8.6" + "@babel/types" "^7.8.6" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.1" @@ -295,7 +294,7 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@7.15.4", "@babel/generator@^7.15.4", "@babel/generator@^7.8.3": +"@babel/generator@7.15.4", "@babel/generator@^7.15.4", "@babel/generator@^7.8.6": version "7.15.4" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.15.4.tgz#85acb159a267ca6324f9793986991ee2022a05b0" integrity sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw== @@ -493,7 +492,7 @@ "@babel/traverse" "^7.15.4" "@babel/types" "^7.15.4" -"@babel/helpers@^7.15.4", "@babel/helpers@^7.8.3": +"@babel/helpers@^7.15.4", "@babel/helpers@^7.8.4": version "7.15.4" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.15.4.tgz#5f40f02050a3027121a3cf48d497c05c555eaf43" integrity sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ== @@ -511,7 +510,7 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.15.4", "@babel/parser@^7.15.5", "@babel/parser@^7.8.3": +"@babel/parser@^7.1.0", "@babel/parser@^7.15.4", "@babel/parser@^7.15.5", "@babel/parser@^7.8.6": version "7.15.7" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.7.tgz#0c3ed4a2eb07b165dfa85b3cc45c727334c4edae" integrity sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g== @@ -1108,7 +1107,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/template@7.15.4", "@babel/template@^7.15.4", "@babel/template@^7.8.3": +"@babel/template@7.15.4", "@babel/template@^7.15.4", "@babel/template@^7.8.6": version "7.15.4" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.15.4.tgz#51898d35dcf3faa670c4ee6afcfd517ee139f194" integrity sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg== @@ -1117,7 +1116,7 @@ "@babel/parser" "^7.15.4" "@babel/types" "^7.15.4" -"@babel/traverse@^7.13.0", "@babel/traverse@^7.15.4", "@babel/traverse@^7.8.3": +"@babel/traverse@^7.13.0", "@babel/traverse@^7.15.4", "@babel/traverse@^7.8.6": version "7.15.4" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.4.tgz#ff8510367a144bfbff552d9e18e28f3e2889c22d" integrity sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA== @@ -1132,7 +1131,7 @@ debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.15.4", "@babel/types@^7.15.6", "@babel/types@^7.3.0", "@babel/types@^7.4.4", "@babel/types@^7.8.3", "@babel/types@^7.8.6": +"@babel/types@^7.0.0", "@babel/types@^7.15.4", "@babel/types@^7.15.6", "@babel/types@^7.3.0", "@babel/types@^7.4.4", "@babel/types@^7.8.6": version "7.15.6" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.6.tgz#99abdc48218b2881c058dd0a7ab05b99c9be758f" integrity sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig== @@ -5234,18 +5233,6 @@ glob-to-regexp@^0.4.1: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@7.1.7: - version "7.1.7" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" - integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@7.2.0, glob@^7.0.0, glob@^7.0.3, glob@^7.0.6, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.1.7: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" @@ -11003,7 +10990,7 @@ yargs@^16.0.0, yargs@^16.1.1: y18n "^5.0.5" yargs-parser "^20.2.2" -yargs@^17.0.0: +yargs@^17.0.0, yargs@^17.2.1: version "17.2.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.2.1.tgz#e2c95b9796a0e1f7f3bf4427863b42e0418191ea" integrity sha512-XfR8du6ua4K6uLGm5S6fA+FIJom/MdJcFNVY8geLlp2v8GYbOXD4EB1tPNZsRn4vBzKGMgb5DRZMeWuFc2GO8Q== From c4d618e89557ffe172b8531d51bd768adadfbf1a Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 5 Oct 2021 14:31:54 +0200 Subject: [PATCH 2/5] refactor(@angular-devkit/build-angular): use `@angular/localize/tools` entry-point --- .../src/babel/presets/application.ts | 29 +++---- .../src/builders/extract-i18n/index.ts | 82 ++++--------------- .../extract-i18n/ivy-extract-loader.ts | 19 ++--- .../build_angular/src/utils/load-esm.ts | 17 +--- .../src/utils/load-translations.ts | 66 ++++----------- .../build_angular/src/utils/process-bundle.ts | 80 +++++------------- 6 files changed, 73 insertions(+), 220 deletions(-) diff --git a/packages/angular_devkit/build_angular/src/babel/presets/application.ts b/packages/angular_devkit/build_angular/src/babel/presets/application.ts index 494d6d646778..9abfdb506333 100644 --- a/packages/angular_devkit/build_angular/src/babel/presets/application.ts +++ b/packages/angular_devkit/build_angular/src/babel/presets/application.ts @@ -6,6 +6,13 @@ * found in the LICENSE file at https://angular.io/license */ +import type { + DiagnosticHandlingStrategy, + Diagnostics, + makeEs2015TranslatePlugin, + makeEs5TranslatePlugin, + makeLocalePlugin, +} from '@angular/localize/tools'; import { strict as assert } from 'assert'; import * as fs from 'fs'; import * as path from 'path'; @@ -17,14 +24,11 @@ export type DiagnosticReporter = (type: 'error' | 'warning' | 'info', message: s * This must be provided for the ESM imports since dynamic imports are required to be asynchronous and * Babel presets currently can only be synchronous. * - * TODO_ESM: Remove all deep imports once `@angular/localize` is published with the `tools` entry point */ export interface I18nPluginCreators { - /* eslint-disable max-len */ - makeEs2015TranslatePlugin: typeof import('@angular/localize/src/tools/src/translate/source_files/es2015_translate_plugin').makeEs2015TranslatePlugin; - makeEs5TranslatePlugin: typeof import('@angular/localize/src/tools/src/translate/source_files/es5_translate_plugin').makeEs5TranslatePlugin; - makeLocalePlugin: typeof import('@angular/localize/src/tools/src/translate/source_files/locale_plugin').makeLocalePlugin; - /* eslint-enable max-len */ + makeEs2015TranslatePlugin: typeof makeEs2015TranslatePlugin; + makeEs5TranslatePlugin: typeof makeEs5TranslatePlugin; + makeLocalePlugin: typeof makeLocalePlugin; } export interface ApplicationPresetOptions { @@ -52,15 +56,12 @@ type NgtscLogger = Parameters< typeof import('@angular/compiler-cli/linker/babel').createEs2015LinkerPlugin >[0]['logger']; -type I18nDiagnostics = import('@angular/localize/src/tools/src/diagnostics').Diagnostics; -type I18nDiagnosticsHandlingStrategy = - import('@angular/localize/src/tools/src/diagnostics').DiagnosticHandlingStrategy; -function createI18nDiagnostics(reporter: DiagnosticReporter | undefined): I18nDiagnostics { - const diagnostics: I18nDiagnostics = new (class { - readonly messages: I18nDiagnostics['messages'] = []; +function createI18nDiagnostics(reporter: DiagnosticReporter | undefined): Diagnostics { + const diagnostics: Diagnostics = new (class { + readonly messages: Diagnostics['messages'] = []; hasErrors = false; - add(type: I18nDiagnosticsHandlingStrategy, message: string): void { + add(type: DiagnosticHandlingStrategy, message: string): void { if (type === 'ignore') { return; } @@ -78,7 +79,7 @@ function createI18nDiagnostics(reporter: DiagnosticReporter | undefined): I18nDi this.add('warning', message); } - merge(other: I18nDiagnostics): void { + merge(other: Diagnostics): void { for (const diagnostic of other.messages) { this.add(diagnostic.type, diagnostic.message); } diff --git a/packages/angular_devkit/build_angular/src/builders/extract-i18n/index.ts b/packages/angular_devkit/build_angular/src/builders/extract-i18n/index.ts index b8e0dbc09705..d85f0ebbdbd1 100644 --- a/packages/angular_devkit/build_angular/src/builders/extract-i18n/index.ts +++ b/packages/angular_devkit/build_angular/src/builders/extract-i18n/index.ts @@ -10,7 +10,7 @@ import { BuilderContext, createBuilder, targetFromTargetString } from '@angular- import { BuildResult, runWebpack } from '@angular-devkit/build-webpack'; import { JsonObject } from '@angular-devkit/core'; import type { ɵParsedMessage as LocalizeMessage } from '@angular/localize'; -import type { Diagnostics } from '@angular/localize/src/tools/src/diagnostics'; +import type { Diagnostics } from '@angular/localize/tools'; import * as fs from 'fs'; import * as path from 'path'; import webpack from 'webpack'; @@ -32,24 +32,6 @@ import { Format, Schema } from './schema'; export type ExtractI18nBuilderOptions = Schema & JsonObject; -/** - * The manually constructed type for the `@angular/localize/tools` module. - * This type only contains the exports that are need for this file. - * - * TODO_ESM: Remove once the `tools` entry point exists in a published package version - */ -interface LocalizeToolsModule { - /* eslint-disable max-len */ - checkDuplicateMessages: typeof import('@angular/localize/src/tools/src/extract/duplicates').checkDuplicateMessages; - XmbTranslationSerializer: typeof import('@angular/localize/src/tools/src/extract/translation_files/xmb_translation_serializer').XmbTranslationSerializer; - SimpleJsonTranslationSerializer: typeof import('@angular/localize/src/tools/src/extract/translation_files/json_translation_serializer').SimpleJsonTranslationSerializer; - Xliff1TranslationSerializer: typeof import('@angular/localize/src/tools/src/extract/translation_files/xliff1_translation_serializer').Xliff1TranslationSerializer; - Xliff2TranslationSerializer: typeof import('@angular/localize/src/tools/src/extract/translation_files/xliff2_translation_serializer').Xliff2TranslationSerializer; - ArbTranslationSerializer: typeof import('@angular/localize/src/tools/src/extract/translation_files/arb_translation_serializer').ArbTranslationSerializer; - LegacyMessageIdMigrationSerializer: typeof import('@angular/localize/src/tools/src/extract/translation_files/legacy_message_id_migration_serializer').LegacyMessageIdMigrationSerializer; - /* eslint-enable max-len */ -} - function getI18nOutfile(format: string | undefined) { switch (format) { case 'xmb': @@ -71,67 +53,40 @@ function getI18nOutfile(format: string | undefined) { } async function getSerializer( - localizeToolsModule: LocalizeToolsModule | undefined, + localizeToolsModule: typeof import('@angular/localize/tools'), format: Format, sourceLocale: string, basePath: string, useLegacyIds: boolean, diagnostics: Diagnostics, ) { + const { + XmbTranslationSerializer, + LegacyMessageIdMigrationSerializer, + ArbTranslationSerializer, + Xliff1TranslationSerializer, + Xliff2TranslationSerializer, + SimpleJsonTranslationSerializer, + } = localizeToolsModule; + switch (format) { case Format.Xmb: - const { XmbTranslationSerializer } = - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/extract/translation_files/xmb_translation_serializer' - )); - // eslint-disable-next-line @typescript-eslint/no-explicit-any return new XmbTranslationSerializer(basePath as any, useLegacyIds); case Format.Xlf: case Format.Xlif: case Format.Xliff: - const { Xliff1TranslationSerializer } = - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/extract/translation_files/xliff1_translation_serializer' - )); - // eslint-disable-next-line @typescript-eslint/no-explicit-any return new Xliff1TranslationSerializer(sourceLocale, basePath as any, useLegacyIds, {}); case Format.Xlf2: case Format.Xliff2: - const { Xliff2TranslationSerializer } = - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/extract/translation_files/xliff2_translation_serializer' - )); - // eslint-disable-next-line @typescript-eslint/no-explicit-any return new Xliff2TranslationSerializer(sourceLocale, basePath as any, useLegacyIds, {}); case Format.Json: - const { SimpleJsonTranslationSerializer } = - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/extract/translation_files/json_translation_serializer' - )); - return new SimpleJsonTranslationSerializer(sourceLocale); case Format.LegacyMigrate: - const { LegacyMessageIdMigrationSerializer } = - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/extract/translation_files/legacy_message_id_migration_serializer' - )); - return new LegacyMessageIdMigrationSerializer(diagnostics); case Format.Arb: - const { ArbTranslationSerializer } = - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/extract/translation_files/arb_translation_serializer' - )); - const fileSystem = { relative(from: string, to: string): string { return path.relative(from, to); @@ -287,15 +242,9 @@ export async function execute( // All the localize usages are setup to first try the ESM entry point then fallback to the deep imports. // This provides interim compatibility while the framework is transitioned to bundled ESM packages. - // TODO_ESM: Remove all deep imports once `@angular/localize` is published with the `tools` entry point - let localizeToolsModule; - try { - // Load ESM `@angular/localize/tools` using the TypeScript dynamic import workaround. - // Once TypeScript provides support for keeping the dynamic import this workaround can be - // changed to a direct dynamic import. - localizeToolsModule = await loadEsmModule('@angular/localize/tools'); - } catch {} - + const localizeToolsModule = await loadEsmModule( + '@angular/localize/tools', + ); const webpackResult = await runWebpack( (await transforms?.webpackConfiguration?.(config)) || config, context, @@ -315,8 +264,7 @@ export async function execute( const basePath = config.context || projectRoot; - const { checkDuplicateMessages } = - localizeToolsModule ?? (await import('@angular/localize/src/tools/src/extract/duplicates')); + const { checkDuplicateMessages } = localizeToolsModule; // The filesystem is used to create a relative path for each file // from the basePath. This relative path is then used in the error message. diff --git a/packages/angular_devkit/build_angular/src/builders/extract-i18n/ivy-extract-loader.ts b/packages/angular_devkit/build_angular/src/builders/extract-i18n/ivy-extract-loader.ts index fefad7c366fc..50da54cfe7b4 100644 --- a/packages/angular_devkit/build_angular/src/builders/extract-i18n/ivy-extract-loader.ts +++ b/packages/angular_devkit/build_angular/src/builders/extract-i18n/ivy-extract-loader.ts @@ -47,18 +47,13 @@ async function extract( // TODO_ESM: Remove all deep imports once `@angular/localize` is published with the `tools` entry point let MessageExtractor; try { - try { - // Load ESM `@angular/localize/tools` using the TypeScript dynamic import workaround. - // Once TypeScript provides support for keeping the dynamic import this workaround can be - // changed to a direct dynamic import. - const localizeToolsModule = await loadEsmModule< - typeof import('@angular/localize/src/tools/src/extract/extraction') - >('@angular/localize/tools'); - MessageExtractor = localizeToolsModule.MessageExtractor; - } catch { - MessageExtractor = (await import('@angular/localize/src/tools/src/extract/extraction')) - .MessageExtractor; - } + // Load ESM `@angular/localize/tools` using the TypeScript dynamic import workaround. + // Once TypeScript provides support for keeping the dynamic import this workaround can be + // changed to a direct dynamic import. + const localizeToolsModule = await loadEsmModule( + '@angular/localize/tools', + ); + MessageExtractor = localizeToolsModule.MessageExtractor; } catch { throw new Error( `Unable to load message extractor. Please ensure '@angular/localize' is installed.`, diff --git a/packages/angular_devkit/build_angular/src/utils/load-esm.ts b/packages/angular_devkit/build_angular/src/utils/load-esm.ts index 4fbda11823a9..a9d4e5cf87ae 100644 --- a/packages/angular_devkit/build_angular/src/utils/load-esm.ts +++ b/packages/angular_devkit/build_angular/src/utils/load-esm.ts @@ -20,19 +20,6 @@ import { URL } from 'url'; * @param modulePath The path of the module to load. * @returns A Promise that resolves to the dynamically imported module. */ -export async function loadEsmModule(modulePath: string | URL): Promise { - try { - return (await new Function('modulePath', `return import(modulePath);`)(modulePath)) as T; - } catch (e) { - // Temporary workaround to handle directory imports for current packages. ESM does not support - // directory imports. - // TODO_ESM: Remove once FW packages are fully ESM with defined `exports` package.json fields - if (e.code !== 'ERR_UNSUPPORTED_DIR_IMPORT') { - throw e; - } - - return (await new Function('modulePath', `return import(modulePath);`)( - modulePath + '/index.js', - )) as T; - } +export function loadEsmModule(modulePath: string | URL): Promise { + return new Function('modulePath', `return import(modulePath);`)(modulePath) as Promise; } diff --git a/packages/angular_devkit/build_angular/src/utils/load-translations.ts b/packages/angular_devkit/build_angular/src/utils/load-translations.ts index 760a2b7a34fe..1bef4e0b49f4 100644 --- a/packages/angular_devkit/build_angular/src/utils/load-translations.ts +++ b/packages/angular_devkit/build_angular/src/utils/load-translations.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ +import type { Diagnostics } from '@angular/localize/tools'; import { createHash } from 'crypto'; import * as fs from 'fs'; import { loadEsmModule } from './load-esm'; @@ -14,7 +15,7 @@ export type TranslationLoader = (path: string) => { translations: Record; format: string; locale?: string; - diagnostics: import('@angular/localize/src/tools/src/diagnostics').Diagnostics; + diagnostics: Diagnostics; integrity: string; }; @@ -60,64 +61,27 @@ export async function createTranslationLoader(): Promise { } async function importParsers() { - // All the localize usages are setup to first try the ESM entry point then fallback to the deep imports. - // This provides interim compatibility while the framework is transitioned to bundled ESM packages. - // TODO_ESM: Remove all deep imports once `@angular/localize` is published with the `tools` entry point - let localizeToolsModule; try { // Load ESM `@angular/localize/tools` using the TypeScript dynamic import workaround. // Once TypeScript provides support for keeping the dynamic import this workaround can be // changed to a direct dynamic import. - // TODO_ESM: The type needs to be manually constructed until the tools entry point exists - localizeToolsModule = await loadEsmModule<{ - Diagnostics: typeof import('@angular/localize/src/tools/src/diagnostics').Diagnostics; - /* eslint-disable max-len */ - ArbTranslationParser: typeof import('@angular/localize/src/tools/src/translate/translation_files/translation_parsers/arb_translation_parser').ArbTranslationParser; - SimpleJsonTranslationParser: typeof import('@angular/localize/src/tools/src/translate/translation_files/translation_parsers/simple_json_translation_parser').SimpleJsonTranslationParser; - Xliff1TranslationParser: typeof import('@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xliff1_translation_parser').Xliff1TranslationParser; - Xliff2TranslationParser: typeof import('@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xliff2_translation_parser').Xliff2TranslationParser; - XtbTranslationParser: typeof import('@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xtb_translation_parser').XtbTranslationParser; - /* eslint-enable max-len */ - }>('@angular/localize/tools'); - } catch {} + const { + Diagnostics, + ArbTranslationParser, + SimpleJsonTranslationParser, + Xliff1TranslationParser, + Xliff2TranslationParser, + XtbTranslationParser, + } = await loadEsmModule('@angular/localize/tools'); - try { - const { Diagnostics } = - localizeToolsModule ?? (await import('@angular/localize/src/tools/src/diagnostics')); const diagnostics = new Diagnostics(); - const parsers = { - arb: new ( - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/arb_translation_parser' - )) - ).ArbTranslationParser(), - json: new ( - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/simple_json_translation_parser' - )) - ).SimpleJsonTranslationParser(), - xlf: new ( - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xliff1_translation_parser' - )) - ).Xliff1TranslationParser(), - xlf2: new ( - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xliff2_translation_parser' - )) - ).Xliff2TranslationParser(), + arb: new ArbTranslationParser(), + json: new SimpleJsonTranslationParser(), + xlf: new Xliff1TranslationParser(), + xlf2: new Xliff2TranslationParser(), // The name ('xmb') needs to match the AOT compiler option - xmb: new ( - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xtb_translation_parser' - )) - ).XtbTranslationParser(), + xmb: new XtbTranslationParser(), }; return { parsers, diagnostics }; diff --git a/packages/angular_devkit/build_angular/src/utils/process-bundle.ts b/packages/angular_devkit/build_angular/src/utils/process-bundle.ts index e81070dbd5dc..071ad73e80ba 100644 --- a/packages/angular_devkit/build_angular/src/utils/process-bundle.ts +++ b/packages/angular_devkit/build_angular/src/utils/process-bundle.ts @@ -40,54 +40,28 @@ const { i18n } = (workerData || {}) as { i18n?: I18nOptions }; */ const USE_LOCALIZE_PLUGINS = false; -/** - * The extracted `@angular/localize` utilities module type used by the manually constructed - * `LocalizeToolsModule` type. - * - * TODO_ESM: Remove once the `tools` entry point exists in a published package version - */ -type LocalizeUtilityModule = typeof import('@angular/localize/src/tools/src/source_file_utils'); - -/** - * The manually constructed type for the `@angular/localize/tools` module. - * This type only contains the exports that are need for this file. - * - * TODO_ESM: Remove once the `tools` entry point exists in a published package version - */ -interface LocalizeToolsModule extends LocalizeUtilityModule { - /* eslint-disable max-len */ - Diagnostics: typeof import('@angular/localize/src/tools/src/diagnostics').Diagnostics; - makeEs2015TranslatePlugin: typeof import('@angular/localize/src/tools/src/translate/source_files/es2015_translate_plugin').makeEs2015TranslatePlugin; - makeEs5TranslatePlugin: typeof import('@angular/localize/src/tools/src/translate/source_files/es5_translate_plugin').makeEs5TranslatePlugin; - makeLocalePlugin: typeof import('@angular/localize/src/tools/src/translate/source_files/locale_plugin').makeLocalePlugin; - /* eslint-enable max-len */ -} +type LocalizeUtilityModule = typeof import('@angular/localize/tools'); /** * Cached instance of the `@angular/localize/tools` module. * This is used to remove the need to repeatedly import the module per file translation. */ -let localizeToolsModule: LocalizeToolsModule | undefined; +let localizeToolsModule: LocalizeUtilityModule | undefined; /** * Attempts to load the `@angular/localize/tools` module containing the functionality to * perform the file translations. * This module must be dynamically loaded as it is an ESM module and this file is CommonJS. */ -async function loadLocalizeTools(): Promise { +async function loadLocalizeTools(): Promise { if (localizeToolsModule !== undefined) { - return; + return localizeToolsModule; } - // All the localize usages are setup to first try the ESM entry point then fallback to the deep imports. - // This provides interim compatibility while the framework is transitioned to bundled ESM packages. - // TODO_ESM: Remove all deep imports once `@angular/localize` is published with the `tools` entry point - try { - // Load ESM `@angular/localize/tools` using the TypeScript dynamic import workaround. - // Once TypeScript provides support for keeping the dynamic import this workaround can be - // changed to a direct dynamic import. - localizeToolsModule = await loadEsmModule('@angular/localize/tools'); - } catch {} + // Load ESM `@angular/localize/tools` using the TypeScript dynamic import workaround. + // Once TypeScript provides support for keeping the dynamic import this workaround can be + // changed to a direct dynamic import. + return loadEsmModule('@angular/localize/tools'); } export async function createI18nPlugins( @@ -97,40 +71,29 @@ export async function createI18nPlugins( shouldInline: boolean, localeDataContent?: string, ) { - const plugins = []; - const localizeDiag = - localizeToolsModule ?? (await import('@angular/localize/src/tools/src/diagnostics')); + const { Diagnostics, makeEs2015TranslatePlugin, makeEs5TranslatePlugin, makeLocalePlugin } = + await loadLocalizeTools(); - const diagnostics = new localizeDiag.Diagnostics(); + const plugins = []; + const diagnostics = new Diagnostics(); if (shouldInline) { - const es2015 = - localizeToolsModule ?? - (await import( - '@angular/localize/src/tools/src/translate/source_files/es2015_translate_plugin' - )); plugins.push( // eslint-disable-next-line @typescript-eslint/no-explicit-any - es2015.makeEs2015TranslatePlugin(diagnostics, (translation || {}) as any, { + makeEs2015TranslatePlugin(diagnostics, (translation || {}) as any, { missingTranslation: translation === undefined ? 'ignore' : missingTranslation, }), ); - const es5 = - localizeToolsModule ?? - (await import('@angular/localize/src/tools/src/translate/source_files/es5_translate_plugin')); plugins.push( // eslint-disable-next-line @typescript-eslint/no-explicit-any - es5.makeEs5TranslatePlugin(diagnostics, (translation || {}) as any, { + makeEs5TranslatePlugin(diagnostics, (translation || {}) as any, { missingTranslation: translation === undefined ? 'ignore' : missingTranslation, }), ); } - const inlineLocale = - localizeToolsModule ?? - (await import('@angular/localize/src/tools/src/translate/source_files/locale_plugin')); - plugins.push(inlineLocale.makeLocalePlugin(locale)); + plugins.push(makeLocalePlugin(locale)); if (localeDataContent) { plugins.push({ @@ -269,15 +232,10 @@ async function inlineLocalesDirect(ast: ParseResult, options: InlineOptions) { } const { default: generate } = await import('@babel/generator'); - - const utils = - localizeToolsModule ?? (await import('@angular/localize/src/tools/src/source_file_utils')); - const localizeDiag = - localizeToolsModule ?? (await import('@angular/localize/src/tools/src/diagnostics')); - + const localizeDiag = await loadLocalizeTools(); const diagnostics = new localizeDiag.Diagnostics(); - const positions = findLocalizePositions(ast, options, utils); + const positions = findLocalizePositions(ast, options, localizeDiag); if (positions.length === 0 && !options.setLocale) { return inlineCopyOnly(options); } @@ -306,7 +264,7 @@ async function inlineLocalesDirect(ast: ParseResult, options: InlineOptions) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const translations: any = isSourceLocale ? {} : i18n.locales[locale].translation || {}; for (const position of positions) { - const translated = utils.translate( + const translated = localizeDiag.translate( diagnostics, translations, position.messageParts, @@ -314,7 +272,7 @@ async function inlineLocalesDirect(ast: ParseResult, options: InlineOptions) { isSourceLocale ? 'ignore' : options.missingTranslation || 'warning', ); - const expression = utils.buildLocalizeReplacement(translated[0], translated[1]); + const expression = localizeDiag.buildLocalizeReplacement(translated[0], translated[1]); const { code } = generate(expression); content.replace(position.start, position.end - 1, code); From c421b17b63be3beda36ddb1c258014dbfa8c4131 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 5 Oct 2021 14:47:48 +0200 Subject: [PATCH 3/5] build: update ng-packagr to version `13.0.0-next.6` --- package.json | 2 +- .../src/builders/ng-packagr/works_spec.ts | 6 ++--- yarn.lock | 24 ++++++++++++++----- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 4fc97d6bf10e..fea43216fb25 100644 --- a/package.json +++ b/package.json @@ -178,7 +178,7 @@ "mini-css-extract-plugin": "2.3.0", "minimatch": "3.0.4", "minimist": "^1.2.0", - "ng-packagr": "13.0.0-next.5", + "ng-packagr": "13.0.0-next.6", "node-fetch": "^2.2.0", "open": "8.2.1", "ora": "5.4.1", diff --git a/packages/angular_devkit/build_angular/src/builders/ng-packagr/works_spec.ts b/packages/angular_devkit/build_angular/src/builders/ng-packagr/works_spec.ts index 961ea1a7b17e..14ab1f699d52 100644 --- a/packages/angular_devkit/build_angular/src/builders/ng-packagr/works_spec.ts +++ b/packages/angular_devkit/build_angular/src/builders/ng-packagr/works_spec.ts @@ -56,9 +56,9 @@ describe('NgPackagr Builder', () => { await run.stop(); - expect(host.scopedSync().exists(normalize('./dist/lib/fesm2015/lib.js'))).toBe(true); + expect(host.scopedSync().exists(normalize('./dist/lib/fesm2015/lib.mjs'))).toBe(true); const content = virtualFs.fileBufferToString( - host.scopedSync().read(normalize('./dist/lib/fesm2015/lib.js')), + host.scopedSync().read(normalize('./dist/lib/fesm2015/lib.mjs')), ); expect(content).toContain('lib works'); @@ -90,7 +90,7 @@ describe('NgPackagr Builder', () => { tap((buildEvent) => expect(buildEvent.success).toBe(true)), debounceTime(1000), map(() => { - const fileName = './dist/lib/fesm2015/lib.js'; + const fileName = './dist/lib/fesm2015/lib.mjs'; const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName))); return content; diff --git a/yarn.lock b/yarn.lock index 3941e112161a..a07c32bd4535 100644 --- a/yarn.lock +++ b/yarn.lock @@ -114,7 +114,6 @@ "@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#d008ca5d1aeebd192c7dca25d6eb09b9e69140c6": version "0.0.0" - uid d008ca5d1aeebd192c7dca25d6eb09b9e69140c6 resolved "https://github.com/angular/dev-infra-private-builds.git#d008ca5d1aeebd192c7dca25d6eb09b9e69140c6" dependencies: "@actions/core" "^1.4.0" @@ -1637,6 +1636,19 @@ magic-string "^0.25.7" resolve "^1.17.0" +"@rollup/plugin-commonjs@^21.0.0": + version "21.0.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-21.0.0.tgz#b9e4342855ea20b5528f4587b9a90f642196a502" + integrity sha512-XDQimjHl0kNotAV5lLo34XoygaI0teqiKGJ100B3iCU8+15YscJPeqk2KqkqD3NIe1H8ZTUo5lYjUFZyEgASTw== + dependencies: + "@rollup/pluginutils" "^3.1.0" + commondir "^1.0.1" + estree-walker "^2.0.1" + glob "^7.1.6" + is-reference "^1.2.1" + magic-string "^0.25.7" + resolve "^1.17.0" + "@rollup/plugin-json@^4.1.0": version "4.1.0" resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3" @@ -7193,12 +7205,12 @@ next-tick@~1.0.0: resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= -ng-packagr@13.0.0-next.5: - version "13.0.0-next.5" - resolved "https://registry.yarnpkg.com/ng-packagr/-/ng-packagr-13.0.0-next.5.tgz#1214b418c79b82eb52997a04fbef5328ab557478" - integrity sha512-7hZ20WWMc6McpmxomTl7TdlYxqVoRqxO3VTm6eG9K0ixgWZ6CHJM5wP2JYkoemMGwRl8VveTNN89rwn709Dhew== +ng-packagr@13.0.0-next.6: + version "13.0.0-next.6" + resolved "https://registry.yarnpkg.com/ng-packagr/-/ng-packagr-13.0.0-next.6.tgz#5e318fb38b63a6d7bced93fbbd87cdd5933d5234" + integrity sha512-wqxAloy5xV6sHKlOpZtSr0YniscZpi2gnqYN1iZQjpURqi6oosfi7fF3TyNzn/WGlMgYseXspzBypSqzbqnI8g== dependencies: - "@rollup/plugin-commonjs" "^20.0.0" + "@rollup/plugin-commonjs" "^21.0.0" "@rollup/plugin-json" "^4.1.0" "@rollup/plugin-node-resolve" "^13.0.0" ajv "^8.0.0" From b295f6048cf684d4fb6166e9f33f2ba5a4e376e9 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 5 Oct 2021 14:50:58 +0200 Subject: [PATCH 4/5] test(@angular-devkit/build-angular): workaround for rxjs 6 directory imports rxjs 6 requires directory imports which are not support in ES modules. Disabling `fullySpecified` allows Webpack to ignore cases such as this until the package can be updated to use package exports. --- .../build_webpack/test/angular-app/webpack.config.js | 4 ++++ .../build_webpack/test/basic-app/webpack.config.js | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/packages/angular_devkit/build_webpack/test/angular-app/webpack.config.js b/packages/angular_devkit/build_webpack/test/angular-app/webpack.config.js index 3288bb639201..ed885f54ad43 100644 --- a/packages/angular_devkit/build_webpack/test/angular-app/webpack.config.js +++ b/packages/angular_devkit/build_webpack/test/angular-app/webpack.config.js @@ -24,6 +24,10 @@ module.exports = { ], module: { rules: [ + // rxjs 6 requires directory imports which are not support in ES modules. + // Disabling `fullySpecified` allows Webpack to ignore this but this is + // not ideal because it currently disables ESM behavior import for all JS files. + { test: /\.[m]?js$/, resolve: { fullySpecified: false } }, { test: /\.css$/, type: 'asset/source' }, { test: /\.html$/, type: 'asset/source' }, { test: /\.ts$/, loader: '@ngtools/webpack' }, diff --git a/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.js b/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.js index 3ab87b9d6003..b1f988ab2071 100644 --- a/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.js +++ b/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.js @@ -3,6 +3,14 @@ const path = require('path'); module.exports = { mode: 'development', entry: path.resolve(__dirname, './src/main.js'), + module: { + rules: [ + // rxjs 6 requires directory imports which are not support in ES modules. + // Disabling `fullySpecified` allows Webpack to ignore this but this is + // not ideal because it currently disables ESM behavior import for all JS files. + { test: /\.[m]?js$/, resolve: { fullySpecified: false } }, + ], + }, output: { path: path.resolve(__dirname, './dist'), filename: 'bundle.js', From 62606e2d62c783c26d50be24eb1c1ec453825a18 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 5 Oct 2021 14:54:16 +0200 Subject: [PATCH 5/5] test(@angular-devkit/build-angular): update shared lazy modules spec file path --- .../src/builders/browser/specs/lazy-module_spec.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/angular_devkit/build_angular/src/builders/browser/specs/lazy-module_spec.ts b/packages/angular_devkit/build_angular/src/builders/browser/specs/lazy-module_spec.ts index 38f2d5a9a1b3..f742f494e3b7 100644 --- a/packages/angular_devkit/build_angular/src/builders/browser/specs/lazy-module_spec.ts +++ b/packages/angular_devkit/build_angular/src/builders/browser/specs/lazy-module_spec.ts @@ -152,9 +152,7 @@ describe('Browser Builder lazy modules', () => { const { files } = await browserBuild(architect, host, target); expect(files['src_one_ts.js']).not.toBeUndefined(); expect(files['src_two_ts.js']).not.toBeUndefined(); - expect( - files['default-node_modules_angular_common___ivy_ngcc___fesm2015_http_js.js'], - ).toBeDefined(); + expect(files['default-node_modules_angular_common_fesm2020_http_mjs.js']).toBeDefined(); }); it(`supports disabling the common bundle`, async () => {