Skip to content

Commit e6afbc8

Browse files
committed
fix(bazel): properly handle highlighter.js in strict deps tests
1 parent acce054 commit e6afbc8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bazel/ts_project/strict_deps/index.mts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,18 @@ function checkPathsForMatch(moduleSpecifier: string, paths?: ts.MapLike<string[]
5252
return false;
5353
}
5454

55+
/** The list of known package names that end with extensions and need to be special cased. */
56+
const knownModuleSpecifiersWithExtensions = new Set(['highlight.js', 'zone.js']);
57+
5558
for (const fileExecPath of manifest.testFiles) {
5659
const content = await fs.readFile(fileExecPath, 'utf8');
5760
const sf = ts.createSourceFile(fileExecPath, content, ts.ScriptTarget.ESNext, true);
5861
const imports = getImportsInSourceFile(sf);
5962

6063
for (const i of imports) {
61-
const moduleSpecifier =
62-
i.moduleSpecifier === 'zone.js'
63-
? 'zone.js'
64-
: i.moduleSpecifier.replace(extensionRemoveRegex, '');
64+
const moduleSpecifier = knownModuleSpecifiersWithExtensions.has(i.moduleSpecifier)
65+
? i.moduleSpecifier
66+
: i.moduleSpecifier.replace(extensionRemoveRegex, '');
6567
// When the module specified is the file itself this is always a valid dep.
6668
if (i.moduleSpecifier === '') {
6769
continue;

0 commit comments

Comments
 (0)