From da7fbb40f06e6e37504f69e7b335f8219f424de2 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Wed, 14 Feb 2024 17:57:28 +0000 Subject: [PATCH] fix(compiler-cli): detect when the linker is working in unpublished angular 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 --- .../file_linker/partial_linkers/partial_linker_selector.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/compiler-cli/linker/src/file_linker/partial_linkers/partial_linker_selector.ts b/packages/compiler-cli/linker/src/file_linker/partial_linkers/partial_linker_selector.ts index 03e0cbf9d33..f3a000df3a7 100644 --- a/packages/compiler-cli/linker/src/file_linker/partial_linkers/partial_linker_selector.ts +++ b/packages/compiler-cli/linker/src/file_linker/partial_linkers/partial_linker_selector.ts @@ -185,6 +185,11 @@ export class PartialLinkerSelector { * @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 = [];