mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
d0d6966d41
The `packages/localize` package still required some trickery to support CommonJS because tests in the repo were running as CommonJS. This commit removes the CommonJS logic in localize and its tests, so that only ESM is used in production & tests. PR Close #48521
6.9 KiB
6.9 KiB
API Report File for "@angular/localize_tools"
Do not edit this file. It is a report generated by API Extractor.
import { AbsoluteFsPath } from '@angular/compiler-cli/private/localize';
import { Element as Element_2 } from '@angular/compiler';
import { Logger } from '@angular/compiler-cli/private/localize';
import { MessageId } from '@angular/localize';
import { NodePath } from '@babel/traverse';
import { ParseError } from '@angular/compiler';
import { PathManipulation } from '@angular/compiler-cli/private/localize';
import { PluginObj } from '@babel/core';
import { ReadonlyFileSystem } from '@angular/compiler-cli/private/localize';
import { types } from '@babel/core';
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>;
// (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 types.Expression[]): types.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<types.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>;
// (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<types.TemplateLiteral>, fs?: PathManipulation): [types.Expression[], (ɵSourceLocation | undefined)[]];
// @public
export function unwrapMessagePartsFromLocalizeCall(call: NodePath<types.CallExpression>, fs?: PathManipulation): [TemplateStringsArray, (ɵSourceLocation | undefined)[]];
// @public
export function unwrapMessagePartsFromTemplateLiteral(elements: NodePath<types.TemplateElement>[], fs?: PathManipulation): [
TemplateStringsArray,
(ɵSourceLocation | undefined)[]
];
// @public
export function unwrapSubstitutionsFromLocalizeCall(call: NodePath<types.CallExpression>, fs?: PathManipulation): [types.Expression[], (ɵSourceLocation | undefined)[]];
// @public
export class Xliff1TranslationParser implements TranslationParser<XmlTranslationParserHint> {
// (undocumented)
analyze(filePath: string, contents: string): ParseAnalysis<XmlTranslationParserHint>;
// (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>;
// (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>;
// (undocumented)
parse(filePath: string, contents: string, hint: XmlTranslationParserHint): ParsedTranslationBundle;
}
// (No @packageDocumentation comment for this package)