Skip to content

Commit 9d090cb

Browse files
alexeaglejasonaden
authored andcommitted
fix(bazel): correct regexp test for self-references in metadata (#29346)
Add a test that catches the mistake, should have had this in the previous change PR Close #29346
1 parent 3d5b986 commit 9d090cb

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/bazel/src/ng_package/packager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ export * from '${srcDirRelative(inputPath, typingsFile.replace(/\.d\.tsx?$/, '')
415415
if (metadata.exports) {
416416
// Strip re-exports which are now self-references
417417
metadata.exports =
418-
metadata.exports.filter((e: {from: string}) => !relativePathRegex.test(e.from));
418+
metadata.exports.filter((e: {from: string}) => !e.from.match(relativePathRegex));
419419
}
420420
return JSON.stringify(metadata).replace(relativePathRegex, typingsRelativePath);
421421
}

packages/bazel/test/ng_package/core_package.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ describe('@angular/core ng_package', () => {
8989
.describe('angular metadata', () => {
9090
it('should have metadata.json files',
9191
() => { expect(shx.cat('core.metadata.json')).toContain(`"__symbolic":"module"`); });
92+
it('should not have self-references in metadata.json',
93+
() => { expect(shx.cat('core.metadata.json')).not.toContain(`"from":"./core"`); });
9294
});
9395

9496
describe('fesm2015', () => {

0 commit comments

Comments
 (0)