fix(ivy): ngcc - recognize suffixed tslib helpers (#31614)

An identifier may become repeated when bundling multiple source files
into a single bundle, so bundlers have a strategy of suffixing non-unique
identifiers with a suffix like $2. Since ngcc operates on such bundles,
it needs to process potentially suffixed identifiers in their canonical
form without the suffix. The "ngx-pagination" package was previously not
compiled fully, as most decorators were not recognized.

This commit ensures that identifiers are first canonicalized by removing
the suffix, such that they are properly recognized and processed by ngcc.

Fixes #31540

PR Close #31614
This commit is contained in:
JoostK
2019-07-19 23:22:52 +02:00
committed by Andrew Kushnir
parent 5e5be43acd
commit 80f290e301
7 changed files with 60 additions and 25 deletions

View File

@ -82,3 +82,14 @@ export function resolveFileWithPostfixes(
}
return null;
}
/**
* An identifier may become repeated when bundling multiple source files into a single bundle, so
* bundlers have a strategy of suffixing non-unique identifiers with a suffix like $2. This function
* strips off such suffixes, so that ngcc deals with the canonical name of an identifier.
* @param value The value to strip any suffix of, if applicable.
* @returns The canonical representation of the value, without any suffix.
*/
export function stripDollarSuffix(value: string): string {
return value.replace(/\$\d+$/, '');
}