From 209a73ede651367adb97b38ee9c8b0fc459bd4fa Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Mon, 28 Mar 2022 17:05:06 +0200 Subject: [PATCH] test: update api goldens to reflect api-golden bazel rule change (#45461) The API golden Bazel rule has changed in the shared dev-infra code. Instead of putting golden API reports into the golden folder as per their original location in the NPM package, golden reports are now stored based on the package exports. This makes it more obvious how entry-points are consumable As part of this change, since the API golden rule now consutls the NPM package `exports` field, the `localize/tools` entry-point golden file is now generated. Previously it wasn't generated due to it not having a secondary entry-point `package.json` file. Such package json files should not be needed anymore and will be gone in future APF versions. PR Close #45461 --- .../browser/{browser.md => index.md} | 0 .../browser/testing/{testing.md => index.md} | 0 .../animations/{animations.md => index.md} | 0 .../common/http/{http.md => index.md} | 0 .../http/testing/{testing.md => index.md} | 0 .../public-api/common/{common.md => index.md} | 0 .../common/testing/{testing.md => index.md} | 0 .../common/upgrade/{upgrade.md => index.md} | 0 goldens/public-api/core/{core.md => index.md} | 0 .../core/testing/{testing.md => index.md} | 0 .../elements/{elements.md => index.md} | 1 - .../public-api/forms/{forms.md => index.md} | 0 goldens/public-api/localize/tools/index.md | 183 ++++++++++++++++++ .../{platform-browser-dynamic.md => index.md} | 0 .../testing/{testing.md => index.md} | 0 .../animations/{animations.md => index.md} | 0 .../{platform-browser.md => index.md} | 0 .../testing/{testing.md => index.md} | 0 .../{platform-server.md => index.md} | 0 .../init/{init.md => index.md} | 1 - .../testing/{testing.md => index.md} | 0 .../public-api/router/{router.md => index.md} | 0 .../router/testing/{testing.md => index.md} | 0 .../router/upgrade/{upgrade.md => index.md} | 1 - .../config/{config.md => index.md} | 0 .../{service-worker.md => index.md} | 0 .../upgrade/{upgrade.md => index.md} | 1 - .../upgrade/static/{static.md => index.md} | 0 .../static/testing/{testing.md => index.md} | 1 - packages/localize/BUILD.bazel | 3 + 30 files changed, 186 insertions(+), 5 deletions(-) rename goldens/public-api/animations/browser/{browser.md => index.md} (100%) rename goldens/public-api/animations/browser/testing/{testing.md => index.md} (100%) rename goldens/public-api/animations/{animations.md => index.md} (100%) rename goldens/public-api/common/http/{http.md => index.md} (100%) rename goldens/public-api/common/http/testing/{testing.md => index.md} (100%) rename goldens/public-api/common/{common.md => index.md} (100%) rename goldens/public-api/common/testing/{testing.md => index.md} (100%) rename goldens/public-api/common/upgrade/{upgrade.md => index.md} (100%) rename goldens/public-api/core/{core.md => index.md} (100%) rename goldens/public-api/core/testing/{testing.md => index.md} (100%) rename goldens/public-api/elements/{elements.md => index.md} (99%) rename goldens/public-api/forms/{forms.md => index.md} (100%) create mode 100644 goldens/public-api/localize/tools/index.md rename goldens/public-api/platform-browser-dynamic/{platform-browser-dynamic.md => index.md} (100%) rename goldens/public-api/platform-browser-dynamic/testing/{testing.md => index.md} (100%) rename goldens/public-api/platform-browser/animations/{animations.md => index.md} (100%) rename goldens/public-api/platform-browser/{platform-browser.md => index.md} (100%) rename goldens/public-api/platform-browser/testing/{testing.md => index.md} (100%) rename goldens/public-api/platform-server/{platform-server.md => index.md} (100%) rename goldens/public-api/platform-server/init/{init.md => index.md} (99%) rename goldens/public-api/platform-server/testing/{testing.md => index.md} (100%) rename goldens/public-api/router/{router.md => index.md} (100%) rename goldens/public-api/router/testing/{testing.md => index.md} (100%) rename goldens/public-api/router/upgrade/{upgrade.md => index.md} (99%) rename goldens/public-api/service-worker/config/{config.md => index.md} (100%) rename goldens/public-api/service-worker/{service-worker.md => index.md} (100%) rename goldens/public-api/upgrade/{upgrade.md => index.md} (99%) rename goldens/public-api/upgrade/static/{static.md => index.md} (100%) rename goldens/public-api/upgrade/static/testing/{testing.md => index.md} (99%) diff --git a/goldens/public-api/animations/browser/browser.md b/goldens/public-api/animations/browser/index.md similarity index 100% rename from goldens/public-api/animations/browser/browser.md rename to goldens/public-api/animations/browser/index.md diff --git a/goldens/public-api/animations/browser/testing/testing.md b/goldens/public-api/animations/browser/testing/index.md similarity index 100% rename from goldens/public-api/animations/browser/testing/testing.md rename to goldens/public-api/animations/browser/testing/index.md diff --git a/goldens/public-api/animations/animations.md b/goldens/public-api/animations/index.md similarity index 100% rename from goldens/public-api/animations/animations.md rename to goldens/public-api/animations/index.md diff --git a/goldens/public-api/common/http/http.md b/goldens/public-api/common/http/index.md similarity index 100% rename from goldens/public-api/common/http/http.md rename to goldens/public-api/common/http/index.md diff --git a/goldens/public-api/common/http/testing/testing.md b/goldens/public-api/common/http/testing/index.md similarity index 100% rename from goldens/public-api/common/http/testing/testing.md rename to goldens/public-api/common/http/testing/index.md diff --git a/goldens/public-api/common/common.md b/goldens/public-api/common/index.md similarity index 100% rename from goldens/public-api/common/common.md rename to goldens/public-api/common/index.md diff --git a/goldens/public-api/common/testing/testing.md b/goldens/public-api/common/testing/index.md similarity index 100% rename from goldens/public-api/common/testing/testing.md rename to goldens/public-api/common/testing/index.md diff --git a/goldens/public-api/common/upgrade/upgrade.md b/goldens/public-api/common/upgrade/index.md similarity index 100% rename from goldens/public-api/common/upgrade/upgrade.md rename to goldens/public-api/common/upgrade/index.md diff --git a/goldens/public-api/core/core.md b/goldens/public-api/core/index.md similarity index 100% rename from goldens/public-api/core/core.md rename to goldens/public-api/core/index.md diff --git a/goldens/public-api/core/testing/testing.md b/goldens/public-api/core/testing/index.md similarity index 100% rename from goldens/public-api/core/testing/testing.md rename to goldens/public-api/core/testing/index.md diff --git a/goldens/public-api/elements/elements.md b/goldens/public-api/elements/index.md similarity index 99% rename from goldens/public-api/elements/elements.md rename to goldens/public-api/elements/index.md index 66ac31d9cae..a2c5822f78b 100644 --- a/goldens/public-api/elements/elements.md +++ b/goldens/public-api/elements/index.md @@ -69,7 +69,6 @@ export type WithProperties

= { [property in keyof P]: P[property]; }; - // (No @packageDocumentation comment for this package) ``` diff --git a/goldens/public-api/forms/forms.md b/goldens/public-api/forms/index.md similarity index 100% rename from goldens/public-api/forms/forms.md rename to goldens/public-api/forms/index.md diff --git a/goldens/public-api/localize/tools/index.md b/goldens/public-api/localize/tools/index.md new file mode 100644 index 00000000000..9d6c0345523 --- /dev/null +++ b/goldens/public-api/localize/tools/index.md @@ -0,0 +1,183 @@ +## API Report File for "@angular/localize_tools" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { AbsoluteFsPath } from '@angular/compiler-cli/private/localize'; +import * as _babelNamespace from '@babel/core'; +import { Element as Element_2 } from '@angular/compiler'; +import { Logger } from '@angular/compiler-cli/private/localize'; +import { NodePath } from '@babel/traverse'; +import { ParseError } from '@angular/compiler'; +import { PathManipulation } from '@angular/compiler-cli/private/localize'; +import { ReadonlyFileSystem } from '@angular/compiler-cli/private/localize'; +import * as t from '@babel/types'; +import { ɵMessageId } from '@angular/localize'; +import { ɵParsedMessage } from '@angular/localize'; +import { ɵParsedTranslation } from '@angular/localize'; +import { ɵSourceLocation } from '@angular/localize'; +import { ɵSourceMessage } from '@angular/localize'; + +// @public +export class ArbTranslationParser implements TranslationParser { + // (undocumented) + analyze(_filePath: string, contents: string): ParseAnalysis; + // @deprecated (undocumented) + canParse(filePath: string, contents: string): ArbJsonObject | false; + // (undocumented) + parse(_filePath: string, contents: string, arb?: ArbJsonObject): ParsedTranslationBundle; +} + +// @public +export class ArbTranslationSerializer implements TranslationSerializer { + constructor(sourceLocale: string, basePath: AbsoluteFsPath, fs: PathManipulation); + // (undocumented) + serialize(messages: ɵParsedMessage[]): string; +} + +// @public +export function buildLocalizeReplacement(messageParts: TemplateStringsArray, substitutions: readonly t.Expression[]): t.Expression; + +// @public +export function checkDuplicateMessages(fs: PathManipulation, messages: ɵParsedMessage[], duplicateMessageHandling: DiagnosticHandlingStrategy, basePath: AbsoluteFsPath): Diagnostics; + +// @public +export type DiagnosticHandlingStrategy = 'error' | 'warning' | 'ignore'; + +// @public +export class Diagnostics { + // (undocumented) + add(type: DiagnosticHandlingStrategy, message: string): void; + // (undocumented) + error(message: string): void; + // (undocumented) + formatDiagnostics(message: string): string; + // (undocumented) + get hasErrors(): boolean; + // (undocumented) + merge(other: Diagnostics): void; + // (undocumented) + readonly messages: { + type: 'warning' | 'error'; + message: string; + }[]; + // (undocumented) + warn(message: string): void; +} + +// @public +export function isGlobalIdentifier(identifier: NodePath): boolean; + +// @public +export class LegacyMessageIdMigrationSerializer implements TranslationSerializer { + constructor(_diagnostics: Diagnostics); + // (undocumented) + serialize(messages: ɵParsedMessage[]): string; +} + +// @public +export function makeEs2015TranslatePlugin(diagnostics: Diagnostics, translations: Record, { missingTranslation, localizeName }?: TranslatePluginOptions, fs?: PathManipulation): PluginObj; + +// @public +export function makeEs5TranslatePlugin(diagnostics: Diagnostics, translations: Record, { missingTranslation, localizeName }?: TranslatePluginOptions, fs?: PathManipulation): PluginObj; + +// @public +export function makeLocalePlugin(locale: string, { localizeName }?: TranslatePluginOptions): PluginObj; + +// @public +export class MessageExtractor { + constructor(fs: ReadonlyFileSystem, logger: Logger, { basePath, useSourceMaps, localizeName }: ExtractionOptions); + // (undocumented) + extractMessages(filename: string): ɵParsedMessage[]; +} + +// @public +export class SimpleJsonTranslationParser implements TranslationParser { + // (undocumented) + analyze(filePath: string, contents: string): ParseAnalysis; + // @deprecated (undocumented) + canParse(filePath: string, contents: string): SimpleJsonFile | false; + // (undocumented) + parse(_filePath: string, contents: string, json?: SimpleJsonFile): ParsedTranslationBundle; +} + +// @public +export class SimpleJsonTranslationSerializer implements TranslationSerializer { + constructor(sourceLocale: string); + // (undocumented) + serialize(messages: ɵParsedMessage[]): string; +} + +// @public +export function translate(diagnostics: Diagnostics, translations: Record, messageParts: TemplateStringsArray, substitutions: readonly any[], missingTranslation: DiagnosticHandlingStrategy): [TemplateStringsArray, readonly any[]]; + +// @public +export function unwrapExpressionsFromTemplateLiteral(quasi: NodePath, fs?: PathManipulation): [t.Expression[], (ɵSourceLocation | undefined)[]]; + +// @public +export function unwrapMessagePartsFromLocalizeCall(call: NodePath, fs?: PathManipulation): [TemplateStringsArray, (ɵSourceLocation | undefined)[]]; + +// @public +export function unwrapMessagePartsFromTemplateLiteral(elements: NodePath[], fs?: PathManipulation): [ +TemplateStringsArray, +(ɵSourceLocation | undefined)[] +]; + +// @public +export function unwrapSubstitutionsFromLocalizeCall(call: NodePath, fs?: PathManipulation): [t.Expression[], (ɵSourceLocation | undefined)[]]; + +// @public +export class Xliff1TranslationParser implements TranslationParser { + // (undocumented) + analyze(filePath: string, contents: string): ParseAnalysis; + // @deprecated (undocumented) + canParse(filePath: string, contents: string): XmlTranslationParserHint | false; + // (undocumented) + parse(filePath: string, contents: string, hint?: XmlTranslationParserHint): ParsedTranslationBundle; +} + +// @public +export class Xliff1TranslationSerializer implements TranslationSerializer { + constructor(sourceLocale: string, basePath: AbsoluteFsPath, useLegacyIds: boolean, formatOptions?: FormatOptions, fs?: PathManipulation); + // (undocumented) + serialize(messages: ɵParsedMessage[]): string; +} + +// @public +export class Xliff2TranslationParser implements TranslationParser { + // (undocumented) + analyze(filePath: string, contents: string): ParseAnalysis; + // @deprecated (undocumented) + canParse(filePath: string, contents: string): XmlTranslationParserHint | false; + // (undocumented) + parse(filePath: string, contents: string, hint?: XmlTranslationParserHint): ParsedTranslationBundle; +} + +// @public +export class Xliff2TranslationSerializer implements TranslationSerializer { + constructor(sourceLocale: string, basePath: AbsoluteFsPath, useLegacyIds: boolean, formatOptions?: FormatOptions, fs?: PathManipulation); + // (undocumented) + serialize(messages: ɵParsedMessage[]): string; +} + +// @public +export class XmbTranslationSerializer implements TranslationSerializer { + constructor(basePath: AbsoluteFsPath, useLegacyIds: boolean, fs?: PathManipulation); + // (undocumented) + serialize(messages: ɵParsedMessage[]): string; +} + +// @public +export class XtbTranslationParser implements TranslationParser { + // (undocumented) + analyze(filePath: string, contents: string): ParseAnalysis; + // @deprecated (undocumented) + canParse(filePath: string, contents: string): XmlTranslationParserHint | false; + // (undocumented) + parse(filePath: string, contents: string, hint?: XmlTranslationParserHint): ParsedTranslationBundle; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/goldens/public-api/platform-browser-dynamic/platform-browser-dynamic.md b/goldens/public-api/platform-browser-dynamic/index.md similarity index 100% rename from goldens/public-api/platform-browser-dynamic/platform-browser-dynamic.md rename to goldens/public-api/platform-browser-dynamic/index.md diff --git a/goldens/public-api/platform-browser-dynamic/testing/testing.md b/goldens/public-api/platform-browser-dynamic/testing/index.md similarity index 100% rename from goldens/public-api/platform-browser-dynamic/testing/testing.md rename to goldens/public-api/platform-browser-dynamic/testing/index.md diff --git a/goldens/public-api/platform-browser/animations/animations.md b/goldens/public-api/platform-browser/animations/index.md similarity index 100% rename from goldens/public-api/platform-browser/animations/animations.md rename to goldens/public-api/platform-browser/animations/index.md diff --git a/goldens/public-api/platform-browser/platform-browser.md b/goldens/public-api/platform-browser/index.md similarity index 100% rename from goldens/public-api/platform-browser/platform-browser.md rename to goldens/public-api/platform-browser/index.md diff --git a/goldens/public-api/platform-browser/testing/testing.md b/goldens/public-api/platform-browser/testing/index.md similarity index 100% rename from goldens/public-api/platform-browser/testing/testing.md rename to goldens/public-api/platform-browser/testing/index.md diff --git a/goldens/public-api/platform-server/platform-server.md b/goldens/public-api/platform-server/index.md similarity index 100% rename from goldens/public-api/platform-server/platform-server.md rename to goldens/public-api/platform-server/index.md diff --git a/goldens/public-api/platform-server/init/init.md b/goldens/public-api/platform-server/init/index.md similarity index 99% rename from goldens/public-api/platform-server/init/init.md rename to goldens/public-api/platform-server/init/index.md index 03c40608bb4..c1608a873d2 100644 --- a/goldens/public-api/platform-server/init/init.md +++ b/goldens/public-api/platform-server/init/index.md @@ -4,7 +4,6 @@ ```ts - // (No @packageDocumentation comment for this package) ``` diff --git a/goldens/public-api/platform-server/testing/testing.md b/goldens/public-api/platform-server/testing/index.md similarity index 100% rename from goldens/public-api/platform-server/testing/testing.md rename to goldens/public-api/platform-server/testing/index.md diff --git a/goldens/public-api/router/router.md b/goldens/public-api/router/index.md similarity index 100% rename from goldens/public-api/router/router.md rename to goldens/public-api/router/index.md diff --git a/goldens/public-api/router/testing/testing.md b/goldens/public-api/router/testing/index.md similarity index 100% rename from goldens/public-api/router/testing/testing.md rename to goldens/public-api/router/testing/index.md diff --git a/goldens/public-api/router/upgrade/upgrade.md b/goldens/public-api/router/upgrade/index.md similarity index 99% rename from goldens/public-api/router/upgrade/upgrade.md rename to goldens/public-api/router/upgrade/index.md index 8b7522abbfe..f052443c781 100644 --- a/goldens/public-api/router/upgrade/upgrade.md +++ b/goldens/public-api/router/upgrade/index.md @@ -19,7 +19,6 @@ export const RouterUpgradeInitializer: { // @public export function setUpLocationSync(ngUpgrade: UpgradeModule, urlType?: 'path' | 'hash'): void; - // (No @packageDocumentation comment for this package) ``` diff --git a/goldens/public-api/service-worker/config/config.md b/goldens/public-api/service-worker/config/index.md similarity index 100% rename from goldens/public-api/service-worker/config/config.md rename to goldens/public-api/service-worker/config/index.md diff --git a/goldens/public-api/service-worker/service-worker.md b/goldens/public-api/service-worker/index.md similarity index 100% rename from goldens/public-api/service-worker/service-worker.md rename to goldens/public-api/service-worker/index.md diff --git a/goldens/public-api/upgrade/upgrade.md b/goldens/public-api/upgrade/index.md similarity index 99% rename from goldens/public-api/upgrade/upgrade.md rename to goldens/public-api/upgrade/index.md index e3d0a9dfbbd..bc44961e612 100644 --- a/goldens/public-api/upgrade/upgrade.md +++ b/goldens/public-api/upgrade/index.md @@ -40,7 +40,6 @@ export class UpgradeAdapterRef { // @public (undocumented) export const VERSION: Version; - // (No @packageDocumentation comment for this package) ``` diff --git a/goldens/public-api/upgrade/static/static.md b/goldens/public-api/upgrade/static/index.md similarity index 100% rename from goldens/public-api/upgrade/static/static.md rename to goldens/public-api/upgrade/static/index.md diff --git a/goldens/public-api/upgrade/static/testing/testing.md b/goldens/public-api/upgrade/static/testing/index.md similarity index 99% rename from goldens/public-api/upgrade/static/testing/testing.md rename to goldens/public-api/upgrade/static/testing/index.md index fcab6e91cb7..879ee154335 100644 --- a/goldens/public-api/upgrade/static/testing/testing.md +++ b/goldens/public-api/upgrade/static/testing/index.md @@ -12,7 +12,6 @@ export function createAngularJSTestingModule(angularModules: any[]): string; // @public export function createAngularTestingModule(angularJSModules: string[], strictDi?: boolean): Type; - // (No @packageDocumentation comment for this package) ``` diff --git a/packages/localize/BUILD.bazel b/packages/localize/BUILD.bazel index 42066b3b98c..78c6febb394 100644 --- a/packages/localize/BUILD.bazel +++ b/packages/localize/BUILD.bazel @@ -44,4 +44,7 @@ api_golden_test_npm_package( ], golden_dir = "angular/goldens/public-api/localize", npm_package = "angular/packages/localize/npm_package", + # The tool entry-point uses namespace aliases and API extractor needs to be + # able to resolve `@babel/core` to fully understand the `types` re-export/alias. + types = ["@npm//@types/babel__core"], )