From 0aaadafc5073c2c7bb9ffa3935adc0cb36b233cd Mon Sep 17 00:00:00 2001 From: SkyZeroZx <73321943+SkyZeroZx@users.noreply.github.com> Date: Wed, 7 Jan 2026 16:21:31 -0500 Subject: [PATCH] refactor(compiler-cli): update error message links to versioned docs (#66374) Error message links now point to the archived documentation site (v*.angular.dev) so that referenced content matches the framework version in use. See angular#44650 PR Close #66374 --- packages/compiler-cli/src/ngtsc/core/src/compiler.ts | 3 ++- packages/compiler-cli/src/ngtsc/diagnostics/index.ts | 2 +- .../ngtsc/diagnostics/src/error_details_base_url.ts | 11 +++++++++-- .../extended/checks/invalid_banana_in_box/index.ts | 8 ++++++-- packages/compiler-cli/src/ngtsc/typecheck/src/oob.ts | 3 ++- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/core/src/compiler.ts b/packages/compiler-cli/src/ngtsc/core/src/compiler.ts index 26f484b7307..080daa327d6 100644 --- a/packages/compiler-cli/src/ngtsc/core/src/compiler.ts +++ b/packages/compiler-cli/src/ngtsc/core/src/compiler.ts @@ -127,6 +127,7 @@ import {DiagnosticCategoryLabel, NgCompilerAdapter, NgCompilerOptions} from '../ import {coreVersionSupportsFeature} from './feature_detection'; import {angularJitApplicationTransform} from '../../transform/jit'; import {untagAllTsFiles} from '../../shims'; +import {DOC_PAGE_BASE_URL} from '../../diagnostics/src/error_details_base_url'; /** * State information about a compilation which is only generated once some data is requested from @@ -1777,7 +1778,7 @@ One of the following actions is required: 2. Remove "strictTemplates" or set it to 'false'. More information about the template type checking compiler options can be found in the documentation: -https://angular.dev/tools/cli/template-typecheck +${DOC_PAGE_BASE_URL}/tools/cli/template-typecheck `.trim(), }); } diff --git a/packages/compiler-cli/src/ngtsc/diagnostics/index.ts b/packages/compiler-cli/src/ngtsc/diagnostics/index.ts index 744f4b36e90..769efba7f64 100644 --- a/packages/compiler-cli/src/ngtsc/diagnostics/index.ts +++ b/packages/compiler-cli/src/ngtsc/diagnostics/index.ts @@ -17,6 +17,6 @@ export { makeRelatedInformation, } from './src/error'; export {ErrorCode} from './src/error_code'; -export {ERROR_DETAILS_PAGE_BASE_URL} from './src/error_details_base_url'; +export {ERROR_DETAILS_PAGE_BASE_URL, DOC_PAGE_BASE_URL} from './src/error_details_base_url'; export {ExtendedTemplateDiagnosticName} from './src/extended_template_diagnostic_name'; export {ngErrorCode, replaceTsWithNgInErrors} from './src/util'; diff --git a/packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts b/packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts index cd93df42bc5..4a9a1b2e242 100644 --- a/packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts +++ b/packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts @@ -8,6 +8,14 @@ import {VERSION} from '@angular/compiler'; +export const DOC_PAGE_BASE_URL: string = (() => { + const full = VERSION.full; + const isPreRelease = + full.includes('-next') || full.includes('-rc') || full === '0.0.0' + '-PLACEHOLDER'; + const prefix = isPreRelease ? 'next' : `v${VERSION.major}`; + return `https://${prefix}.angular.dev`; +})(); + /** * Base URL for the error details page. * @@ -16,6 +24,5 @@ import {VERSION} from '@angular/compiler'; * - packages/core/src/error_details_base_url.ts */ export const ERROR_DETAILS_PAGE_BASE_URL: string = (() => { - const versionSubDomain = VERSION.major !== '0' ? `v${VERSION.major}.` : ''; - return `https://${versionSubDomain}angular.dev/errors`; + return `${DOC_PAGE_BASE_URL}/errors`; })(); diff --git a/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.ts b/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.ts index 970bb6bdbdb..8e2438c0ad2 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.ts @@ -9,7 +9,11 @@ import {AST, TmplAstBoundEvent, TmplAstNode} from '@angular/compiler'; import ts from 'typescript'; -import {ErrorCode, ExtendedTemplateDiagnosticName} from '../../../../diagnostics'; +import { + ErrorCode, + ExtendedTemplateDiagnosticName, + DOC_PAGE_BASE_URL, +} from '../../../../diagnostics'; import {NgTemplateDiagnostic} from '../../../api'; import {TemplateCheckFactory, TemplateCheckWithVisitor, TemplateContext} from '../../api'; @@ -36,7 +40,7 @@ class InvalidBananaInBoxCheck extends TemplateCheckWithVisitor