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
This commit is contained in:
Paul Gschwendtner 2022-03-28 17:05:06 +02:00 committed by Dylan Hunn
parent 468c7768a6
commit 209a73ede6
30 changed files with 186 additions and 5 deletions

View file

@ -69,7 +69,6 @@ export type WithProperties<P> = {
[property in keyof P]: P[property];
};
// (No @packageDocumentation comment for this package)
```

View file

@ -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<ArbJsonObject> {
// (undocumented)
analyze(_filePath: string, contents: string): ParseAnalysis<ArbJsonObject>;
// @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<t.Identifier>): boolean;
// @public
export class LegacyMessageIdMigrationSerializer implements TranslationSerializer {
constructor(_diagnostics: Diagnostics);
// (undocumented)
serialize(messages: ɵParsedMessage[]): string;
}
// @public
export function makeEs2015TranslatePlugin(diagnostics: Diagnostics, translations: Record<string, ɵParsedTranslation>, { missingTranslation, localizeName }?: TranslatePluginOptions, fs?: PathManipulation): PluginObj;
// @public
export function makeEs5TranslatePlugin(diagnostics: Diagnostics, translations: Record<string, ɵParsedTranslation>, { 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<SimpleJsonFile> {
// (undocumented)
analyze(filePath: string, contents: string): ParseAnalysis<SimpleJsonFile>;
// @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<string, ɵParsedTranslation>, messageParts: TemplateStringsArray, substitutions: readonly any[], missingTranslation: DiagnosticHandlingStrategy): [TemplateStringsArray, readonly any[]];
// @public
export function unwrapExpressionsFromTemplateLiteral(quasi: NodePath<t.TemplateLiteral>, fs?: PathManipulation): [t.Expression[], (ɵSourceLocation | undefined)[]];
// @public
export function unwrapMessagePartsFromLocalizeCall(call: NodePath<t.CallExpression>, fs?: PathManipulation): [TemplateStringsArray, (ɵSourceLocation | undefined)[]];
// @public
export function unwrapMessagePartsFromTemplateLiteral(elements: NodePath<t.TemplateElement>[], fs?: PathManipulation): [
TemplateStringsArray,
(ɵSourceLocation | undefined)[]
];
// @public
export function unwrapSubstitutionsFromLocalizeCall(call: NodePath<t.CallExpression>, fs?: PathManipulation): [t.Expression[], (ɵSourceLocation | undefined)[]];
// @public
export class Xliff1TranslationParser implements TranslationParser<XmlTranslationParserHint> {
// (undocumented)
analyze(filePath: string, contents: string): ParseAnalysis<XmlTranslationParserHint>;
// @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<XmlTranslationParserHint> {
// (undocumented)
analyze(filePath: string, contents: string): ParseAnalysis<XmlTranslationParserHint>;
// @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<XmlTranslationParserHint> {
// (undocumented)
analyze(filePath: string, contents: string): ParseAnalysis<XmlTranslationParserHint>;
// @deprecated (undocumented)
canParse(filePath: string, contents: string): XmlTranslationParserHint | false;
// (undocumented)
parse(filePath: string, contents: string, hint?: XmlTranslationParserHint): ParsedTranslationBundle;
}
// (No @packageDocumentation comment for this package)
```

View file

@ -4,7 +4,6 @@
```ts
// (No @packageDocumentation comment for this package)
```

View file

@ -19,7 +19,6 @@ export const RouterUpgradeInitializer: {
// @public
export function setUpLocationSync(ngUpgrade: UpgradeModule, urlType?: 'path' | 'hash'): void;
// (No @packageDocumentation comment for this package)
```

View file

@ -40,7 +40,6 @@ export class UpgradeAdapterRef {
// @public (undocumented)
export const VERSION: Version;
// (No @packageDocumentation comment for this package)
```

View file

@ -12,7 +12,6 @@ export function createAngularJSTestingModule(angularModules: any[]): string;
// @public
export function createAngularTestingModule(angularJSModules: string[], strictDi?: boolean): Type<any>;
// (No @packageDocumentation comment for this package)
```

View file

@ -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"],
)