Skip to content

Commit 5c575a8

Browse files
devversionkirjs
authored andcommitted
build: ensure material dependencies are properly linked for devtools (angular#60822)
This is a follow-up to the recent devtools linking change, leveraging the dedicated package that we are also using in the components repository; avoiding future duplication. The latest version of that package contains a fix for an issue where the linked bundles did not rewrite imports to shared chunks. Such imports need to also point to their linked variants. PR Close angular#60822
1 parent 6aa0bbd commit 5c575a8

File tree

4 files changed

+36
-27
lines changed

4 files changed

+36
-27
lines changed

devtools/tools/linking/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ nodejs_binary(
1212
":linker_srcs",
1313
"//packages/compiler-cli/linker/babel",
1414
"@npm//@babel/core",
15+
"@npm//@nginfra/angular-linking",
1516
"@npm//tinyglobby",
1617
],
1718
entry_point = ":index.mjs",

devtools/tools/linking/index.mjs

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,13 @@ async function main() {
3535
}),
3636
);
3737

38-
const fesmBundles = globSync('fesm2022/**/*.mjs', {cwd: outDir});
39-
const tasks = [];
40-
const babelOptions = {
41-
plugins: [
42-
[
43-
linkerBabelPlugin,
44-
{
45-
// We compile with an unstamped version of the compiler, so ignore.
46-
unknownDeclarationVersionHandling: 'ignore',
47-
},
48-
],
49-
],
50-
};
38+
process.chdir(outDir);
5139

52-
for (const bundleFile of fesmBundles) {
53-
tasks.push(
54-
(async () => {
55-
const filePath = path.join(outDir, bundleFile);
56-
const content = await readFile(filePath, 'utf8');
57-
const result = await transformAsync(content, {...babelOptions, filename: filePath});
40+
// We compile with an unstamped version of the compiler, so ignore.
41+
process.env['LINKER_UNKNOWN_DECLARATION_VERSION_HANDLING'] = 'ignore';
5842

59-
await writeFile(path.join(outDir, bundleFile), result.code);
60-
})(),
61-
);
62-
}
63-
64-
await Promise.all(tasks);
43+
// Run linking in cwd.
44+
import('@nginfra/angular-linking');
6545
}
6646

6747
main().catch((e) => {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
"@lezer/common": "^1.1.2",
184184
"@lezer/highlight": "^1.2.0",
185185
"@lezer/javascript": "^1.4.10",
186+
"@nginfra/angular-linking": "^1.0.10",
186187
"@octokit/graphql": "^8.0.0",
187188
"@types/adm-zip": "^0.5.0",
188189
"@types/cldrjs": "^0.4.22",

yarn.lock

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@
465465

466466
"@angular/ng-dev@https://github.com/angular/dev-infra-private-ng-dev-builds.git#78c7e244442d09fad1d880658da3c88f4627b14e":
467467
version "0.0.0-77fb8b4387755a887550b2e5c3fe1206ae130007"
468-
uid "78c7e244442d09fad1d880658da3c88f4627b14e"
469468
resolved "https://github.com/angular/dev-infra-private-ng-dev-builds.git#78c7e244442d09fad1d880658da3c88f4627b14e"
470469
dependencies:
471470
"@google-cloud/spanner" "7.19.1"
@@ -2863,6 +2862,17 @@
28632862
"@napi-rs/nice-win32-ia32-msvc" "1.0.1"
28642863
"@napi-rs/nice-win32-x64-msvc" "1.0.1"
28652864

2865+
"@nginfra/angular-linking@^1.0.10":
2866+
version "1.0.10"
2867+
resolved "https://registry.yarnpkg.com/@nginfra/angular-linking/-/angular-linking-1.0.10.tgz#ce3de5310605eb1c1bb3712980dd71dc169b3b32"
2868+
integrity sha512-31zx+PCN8tBlC0FYUuCxS4uVPJLAlBhi4UVp6QgoQG44RsOHKTmcRORMVSJdPLRgRuCJkY45kj+PE3AxsgiUKA==
2869+
dependencies:
2870+
"@babel/core" "7.26.10"
2871+
"@types/babel__core" "^7.20.5"
2872+
"@types/node" "^22.14.0"
2873+
tinyglobby "0.2.12"
2874+
typescript "^5.8.3"
2875+
28662876
"@ngtools/[email protected]":
28672877
version "20.0.0-next.5"
28682878
resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-20.0.0-next.5.tgz#e11814b47262d3e3065535097917f2f20c48ddb6"
@@ -4107,7 +4117,7 @@
41074117
resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9"
41084118
integrity sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==
41094119

4110-
4120+
"@types/[email protected]", "@types/babel__core@^7.20.5":
41114121
version "7.20.5"
41124122
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017"
41134123
integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==
@@ -4706,6 +4716,13 @@
47064716
dependencies:
47074717
undici-types "~5.26.4"
47084718

4719+
"@types/node@^22.14.0":
4720+
version "22.14.0"
4721+
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.14.0.tgz#d3bfa3936fef0dbacd79ea3eb17d521c628bb47e"
4722+
integrity sha512-Kmpl+z84ILoG+3T/zQFyAJsU6EPTmOCj8/2+83fSN6djd6I4o7uOuGIH6vq3PrjY5BGitSbFuMN18j3iknubbA==
4723+
dependencies:
4724+
undici-types "~6.21.0"
4725+
47094726
"@types/normalize-package-data@^2.4.3":
47104727
version "2.4.4"
47114728
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901"
@@ -17390,6 +17407,11 @@ [email protected], typescript@^5.7.3:
1739017407
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.2.tgz#8170b3702f74b79db2e5a96207c15e65807999e4"
1739117408
integrity sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==
1739217409

17410+
typescript@^5.8.3:
17411+
version "5.8.3"
17412+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.3.tgz#92f8a3e5e3cf497356f4178c34cd65a7f5e8440e"
17413+
integrity sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==
17414+
1739317415
typescript@~4.9.0:
1739417416
version "4.9.5"
1739517417
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
@@ -17463,6 +17485,11 @@ undici-types@~6.20.0:
1746317485
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433"
1746417486
integrity sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==
1746517487

17488+
undici-types@~6.21.0:
17489+
version "6.21.0"
17490+
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb"
17491+
integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==
17492+
1746617493
undici@^5.25.4:
1746717494
version "5.29.0"
1746817495
resolved "https://registry.yarnpkg.com/undici/-/undici-5.29.0.tgz#419595449ae3f2cdcba3580a2e8903399bd1f5a3"

0 commit comments

Comments
 (0)