From fa7693f78465db0385b136d63980dffcee01580e Mon Sep 17 00:00:00 2001 From: JoostK Date: Sat, 2 Oct 2021 22:09:17 +0200 Subject: [PATCH] refactor(compiler-cli): extract error documentation base url into separate file (#43527) Prior refactorings caused unexpected g3 sync issues due to a patch that changes the error documentation URL. This commit moves the base url into a separate file to make this more apparent. PR Close #43527 --- .../compiler-cli/src/ngtsc/diagnostics/index.ts | 3 ++- .../src/ngtsc/diagnostics/src/docs.ts | 7 ------- .../diagnostics/src/error_details_base_url.ts | 16 ++++++++++++++++ packages/core/src/render3/error_code.ts | 5 +---- .../core/src/render3/error_details_base_url.ts | 16 ++++++++++++++++ 5 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts create mode 100644 packages/core/src/render3/error_details_base_url.ts diff --git a/packages/compiler-cli/src/ngtsc/diagnostics/index.ts b/packages/compiler-cli/src/ngtsc/diagnostics/index.ts index 58513e7c934..4ff58490a23 100644 --- a/packages/compiler-cli/src/ngtsc/diagnostics/index.ts +++ b/packages/compiler-cli/src/ngtsc/diagnostics/index.ts @@ -6,7 +6,8 @@ * found in the LICENSE file at https://angular.io/license */ -export {COMPILER_ERRORS_WITH_GUIDES, ERROR_DETAILS_PAGE_BASE_URL} from './src/docs'; +export {COMPILER_ERRORS_WITH_GUIDES} from './src/docs'; export {FatalDiagnosticError, isFatalDiagnosticError, makeDiagnostic, makeRelatedInformation} from './src/error'; export {ErrorCode} from './src/error_code'; +export {ERROR_DETAILS_PAGE_BASE_URL} from './src/error_details_base_url'; export {ngErrorCode, replaceTsWithNgInErrors} from './src/util'; diff --git a/packages/compiler-cli/src/ngtsc/diagnostics/src/docs.ts b/packages/compiler-cli/src/ngtsc/diagnostics/src/docs.ts index 28c0a90dae0..46f3866c57e 100644 --- a/packages/compiler-cli/src/ngtsc/diagnostics/src/docs.ts +++ b/packages/compiler-cli/src/ngtsc/diagnostics/src/docs.ts @@ -8,13 +8,6 @@ import {ErrorCode} from './error_code'; -/** - * Base URL for the error details page. - * Keep this value in sync with a similar const in - * `packages/core/src/render3/error_code.ts`. - */ -export const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors'; - /** * Contains a set of error messages that have detailed guides at angular.io. * Full list of available error guides can be found at https://angular.io/errors 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 new file mode 100644 index 00000000000..7f059401189 --- /dev/null +++ b/packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts @@ -0,0 +1,16 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +/** + * Base URL for the error details page. + * + * Keep the files below in full sync: + * - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts + * - packages/core/src/render3/error_details_base_url.ts + */ +export const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors'; diff --git a/packages/core/src/render3/error_code.ts b/packages/core/src/render3/error_code.ts index 700d5eded38..13710348101 100644 --- a/packages/core/src/render3/error_code.ts +++ b/packages/core/src/render3/error_code.ts @@ -6,10 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -// Base URL for the error details page. -// Keep this value in sync with a similar const in -// `packages/compiler-cli/src/ngtsc/diagnostics/src/docs.ts`. -const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors'; +import {ERROR_DETAILS_PAGE_BASE_URL} from './error_details_base_url'; export const enum RuntimeErrorCode { // Internal Errors diff --git a/packages/core/src/render3/error_details_base_url.ts b/packages/core/src/render3/error_details_base_url.ts new file mode 100644 index 00000000000..7f059401189 --- /dev/null +++ b/packages/core/src/render3/error_details_base_url.ts @@ -0,0 +1,16 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +/** + * Base URL for the error details page. + * + * Keep the files below in full sync: + * - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts + * - packages/core/src/render3/error_details_base_url.ts + */ +export const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';