Skip to content

Commit

Permalink
fix(compiler-cli): detect when the linker is working in unpublished a…
Browse files Browse the repository at this point in the history
…ngular and widen supported versions (#54439)

When the linker is running using an unpublished version of angular, locally built, the version will be `0.0.0`.
When encountering this situation, the range that for the linker map support is considered to be `*.*.*` allowing
for the linker to work at build time with packages built with versioned angular.

Most notably this allows for us to properly use the linker in building our documentation site with the locally
built version of angular.

PR Close #54439
  • Loading branch information
josephperrott authored and AndrewKushnir committed Feb 14, 2024
1 parent 36bd7d3 commit da7fbb4
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ export class PartialLinkerSelector<TExpression> {
* @returns A semver range for the provided `version` and comparator.
*/
function getRange(comparator: '<='|'>=', versionStr: string): semver.Range {
// If the provided version is exactly `0.0.0` then we are known to be running with an unpublished
// version of angular and assume that all ranges are compatible.
if (versionStr === '0.0.0' && (PLACEHOLDER_VERSION as string) === '0.0.0') {
return new semver.Range('*.*.*');
}
const version = new semver.SemVer(versionStr);
// Wipe out any prerelease versions
version.prerelease = [];
Expand Down

0 comments on commit da7fbb4

Please sign in to comment.