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
This commit is contained in:
SkyZeroZx
2026-01-07 16:21:31 -05:00
committed by Jessica Janiuk
parent f4469ad583
commit 0aaadafc50
5 changed files with 20 additions and 7 deletions
@@ -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(),
});
}
@@ -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';
@@ -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`;
})();
@@ -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<ErrorCode.INVALID
const diagnostic = ctx.makeTemplateDiagnostic(
node.sourceSpan,
`In the two-way binding syntax the parentheses should be inside the brackets, ex. '${expectedBoundSyntax}'.
Find more at https://angular.dev/guide/templates/two-way-binding`,
Find more at ${DOC_PAGE_BASE_URL}/guide/templates/two-way-binding`,
);
return [diagnostic];
}
@@ -39,6 +39,7 @@ import {TemplateDiagnostic, TypeCheckId} from '../api';
import {makeTemplateDiagnostic} from '../diagnostics';
import {TypeCheckSourceResolver} from './tcb_util';
import {DOC_PAGE_BASE_URL} from '../../diagnostics/src/error_details_base_url';
/**
* Collects `ts.Diagnostic`s on problems which occur in the template which aren't directly sourced
@@ -514,7 +515,7 @@ export class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnosticRecor
): void {
const mapping = this.resolver.getTemplateSourceMapping(id);
const errorMsg = `The property and event halves of the two-way binding '${input.name}' are not bound to the same target.
Find more at https://angular.dev/guide/templates/two-way-binding#how-two-way-binding-works`;
Find more at ${DOC_PAGE_BASE_URL}/guide/templates/two-way-binding`;
const relatedMessages: {text: string; start: number; end: number; sourceFile: ts.SourceFile}[] =
[];