UNPKG

@angular/compiler

Version:

Angular - the compiler library

1,284 lines (1,272 loc) • 243 kB
/** * @license Angular v20.3.0 * (c) 2010-2025 Google LLC. https://angular.io/ * License: MIT */ declare const emitDistinctChangesOnlyDefaultValue = true; declare enum ViewEncapsulation$1 { Emulated = 0, None = 2, ShadowDom = 3 } declare enum ChangeDetectionStrategy$1 { OnPush = 0, Default = 1 } interface Input { alias?: string; required?: boolean; transform?: (value: any) => any; isSignal: boolean; } /** Flags describing an input for a directive. */ declare enum InputFlags { None = 0, SignalBased = 1, HasDecoratorInputTransform = 2 } interface Output { alias?: string; } interface HostBinding { hostPropertyName?: string; } interface HostListener { eventName?: string; args?: string[]; } interface SchemaMetadata { name: string; } declare const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata; declare const NO_ERRORS_SCHEMA: SchemaMetadata; interface Type$2 extends Function { new (...args: any[]): any; } declare const Type$2: FunctionConstructor; declare enum SecurityContext { NONE = 0, HTML = 1, STYLE = 2, SCRIPT = 3, URL = 4, RESOURCE_URL = 5 } /** * Injection flags for DI. */ declare const enum InjectFlags { Default = 0, /** * Specifies that an injector should retrieve a dependency from any injector until reaching the * host element of the current component. (Only used with Element Injector) */ Host = 1, /** Don't descend into ancestors of the node requesting injection. */ Self = 2, /** Skip the node that is requesting injection. */ SkipSelf = 4, /** Inject `defaultValue` instead if token not found. */ Optional = 8 } declare enum MissingTranslationStrategy { Error = 0, Warning = 1, Ignore = 2 } /** * Flags used to generate R3-style CSS Selectors. They are pasted from * core/src/render3/projection.ts because they cannot be referenced directly. */ declare const enum SelectorFlags { /** Indicates this is the beginning of a new negative selector */ NOT = 1, /** Mode for matching attributes */ ATTRIBUTE = 2, /** Mode for matching tag names */ ELEMENT = 4, /** Mode for matching class names */ CLASS = 8 } type R3CssSelector = (string | SelectorFlags)[]; type R3CssSelectorList = R3CssSelector[]; declare function parseSelectorToR3Selector(selector: string | null): R3CssSelectorList; /** * Flags passed into template functions to determine which blocks (i.e. creation, update) * should be executed. * * Typically, a template runs both the creation block and the update block on initialization and * subsequent runs only execute the update block. However, dynamically created views require that * the creation block be executed separately from the update block (for backwards compat). */ declare const enum RenderFlags { Create = 1, Update = 2 } /** * A set of marker values to be used in the attributes arrays. These markers indicate that some * items are not regular attributes and the processing should be adapted accordingly. */ declare const enum AttributeMarker { /** * Marker indicates that the following 3 values in the attributes array are: * namespaceUri, attributeName, attributeValue * in that order. */ NamespaceURI = 0, /** * Signals class declaration. * * Each value following `Classes` designates a class name to include on the element. * ## Example: * * Given: * ```html * <div class="foo bar baz">...</div> * ``` * * the generated code is: * ```ts * var _c1 = [AttributeMarker.Classes, 'foo', 'bar', 'baz']; * ``` */ Classes = 1, /** * Signals style declaration. * * Each pair of values following `Styles` designates a style name and value to include on the * element. * ## Example: * * Given: * ```html * <div style="width:100px; height:200px; color:red">...</div> * ``` * * the generated code is: * ```ts * var _c1 = [AttributeMarker.Styles, 'width', '100px', 'height'. '200px', 'color', 'red']; * ``` */ Styles = 2, /** * Signals that the following attribute names were extracted from input or output bindings. * * For example, given the following HTML: * * ```html * <div moo="car" [foo]="exp" (bar)="doSth()"> * ``` * * the generated code is: * * ```ts * var _c1 = ['moo', 'car', AttributeMarker.Bindings, 'foo', 'bar']; * ``` */ Bindings = 3, /** * Signals that the following attribute names were hoisted from an inline-template declaration. * * For example, given the following HTML: * * ```html * <div *ngFor="let value of values; trackBy:trackBy" dirA [dirB]="value"> * ``` * * the generated code for the `template()` instruction would include: * * ``` * ['dirA', '', AttributeMarker.Bindings, 'dirB', AttributeMarker.Template, 'ngFor', 'ngForOf', * 'ngForTrackBy', 'let-value'] * ``` * * while the generated code for the `element()` instruction inside the template function would * include: * * ``` * ['dirA', '', AttributeMarker.Bindings, 'dirB'] * ``` */ Template = 4, /** * Signals that the following attribute is `ngProjectAs` and its value is a parsed `CssSelector`. * * For example, given the following HTML: * * ```html * <h1 attr="value" ngProjectAs="[title]"> * ``` * * the generated code for the `element()` instruction would include: * * ``` * ['attr', 'value', AttributeMarker.ProjectAs, ['', 'title', '']] * ``` */ ProjectAs = 5, /** * Signals that the following attribute will be translated by runtime i18n * * For example, given the following HTML: * * ```html * <div moo="car" foo="value" i18n-foo [bar]="binding" i18n-bar> * ``` * * the generated code is: * * ```ts * var _c1 = ['moo', 'car', AttributeMarker.I18n, 'foo', 'bar']; * ``` */ I18n = 6 } type core_d_AttributeMarker = AttributeMarker; declare const core_d_AttributeMarker: typeof AttributeMarker; declare const core_d_CUSTOM_ELEMENTS_SCHEMA: typeof CUSTOM_ELEMENTS_SCHEMA; type core_d_HostBinding = HostBinding; type core_d_HostListener = HostListener; type core_d_InjectFlags = InjectFlags; declare const core_d_InjectFlags: typeof InjectFlags; type core_d_Input = Input; type core_d_InputFlags = InputFlags; declare const core_d_InputFlags: typeof InputFlags; type core_d_MissingTranslationStrategy = MissingTranslationStrategy; declare const core_d_MissingTranslationStrategy: typeof MissingTranslationStrategy; declare const core_d_NO_ERRORS_SCHEMA: typeof NO_ERRORS_SCHEMA; type core_d_Output = Output; type core_d_R3CssSelector = R3CssSelector; type core_d_R3CssSelectorList = R3CssSelectorList; type core_d_RenderFlags = RenderFlags; declare const core_d_RenderFlags: typeof RenderFlags; type core_d_SchemaMetadata = SchemaMetadata; type core_d_SecurityContext = SecurityContext; declare const core_d_SecurityContext: typeof SecurityContext; type core_d_SelectorFlags = SelectorFlags; declare const core_d_SelectorFlags: typeof SelectorFlags; declare const core_d_emitDistinctChangesOnlyDefaultValue: typeof emitDistinctChangesOnlyDefaultValue; declare const core_d_parseSelectorToR3Selector: typeof parseSelectorToR3Selector; declare namespace core_d { export { core_d_AttributeMarker as AttributeMarker, core_d_CUSTOM_ELEMENTS_SCHEMA as CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy$1 as ChangeDetectionStrategy, core_d_InjectFlags as InjectFlags, core_d_InputFlags as InputFlags, core_d_MissingTranslationStrategy as MissingTranslationStrategy, core_d_NO_ERRORS_SCHEMA as NO_ERRORS_SCHEMA, core_d_RenderFlags as RenderFlags, core_d_SecurityContext as SecurityContext, core_d_SelectorFlags as SelectorFlags, Type$2 as Type, ViewEncapsulation$1 as ViewEncapsulation, core_d_emitDistinctChangesOnlyDefaultValue as emitDistinctChangesOnlyDefaultValue, core_d_parseSelectorToR3Selector as parseSelectorToR3Selector }; export type { core_d_HostBinding as HostBinding, core_d_HostListener as HostListener, core_d_Input as Input, core_d_Output as Output, core_d_R3CssSelector as R3CssSelector, core_d_R3CssSelectorList as R3CssSelectorList, core_d_SchemaMetadata as SchemaMetadata }; } declare class ParseLocation { file: ParseSourceFile; offset: number; line: number; col: number; constructor(file: ParseSourceFile, offset: number, line: number, col: number); toString(): string; moveBy(delta: number): ParseLocation; getContext(maxChars: number, maxLines: number): { before: string; after: string; } | null; } declare class ParseSourceFile { content: string; url: string; constructor(content: string, url: string); } declare class ParseSourceSpan$1 { start: ParseLocation; end: ParseLocation; fullStart: ParseLocation; details: string | null; /** * Create an object that holds information about spans of tokens/nodes captured during * lexing/parsing of text. * * @param start * The location of the start of the span (having skipped leading trivia). * Skipping leading trivia makes source-spans more "user friendly", since things like HTML * elements will appear to begin at the start of the opening tag, rather than at the start of any * leading trivia, which could include newlines. * * @param end * The location of the end of the span. * * @param fullStart * The start of the token without skipping the leading trivia. * This is used by tooling that splits tokens further, such as extracting Angular interpolations * from text tokens. Such tooling creates new source-spans relative to the original token's * source-span. If leading trivia characters have been skipped then the new source-spans may be * incorrectly offset. * * @param details * Additional information (such as identifier names) that should be associated with the span. */ constructor(start: ParseLocation, end: ParseLocation, fullStart?: ParseLocation, details?: string | null); toString(): string; } declare enum ParseErrorLevel { WARNING = 0, ERROR = 1 } declare class ParseError extends Error { /** Location of the error. */ readonly span: ParseSourceSpan$1; /** Error message. */ readonly msg: string; /** Severity level of the error. */ readonly level: ParseErrorLevel; /** * Error that caused the error to be surfaced. For example, an error in a sub-expression that * couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context. */ readonly relatedError?: unknown | undefined; constructor( /** Location of the error. */ span: ParseSourceSpan$1, /** Error message. */ msg: string, /** Severity level of the error. */ level?: ParseErrorLevel, /** * Error that caused the error to be surfaced. For example, an error in a sub-expression that * couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context. */ relatedError?: unknown | undefined); contextualMessage(): string; toString(): string; } /** * Generates Source Span object for a given R3 Type for JIT mode. * * @param kind Component or Directive. * @param typeName name of the Component or Directive. * @param sourceUrl reference to Component or Directive source. * @returns instance of ParseSourceSpan that represent a given Component or Directive. */ declare function r3JitTypeSourceSpan(kind: string, typeName: string, sourceUrl: string): ParseSourceSpan$1; declare function identifierName(compileIdentifier: CompileIdentifierMetadata | null | undefined): string | null; interface CompileIdentifierMetadata { reference: any; } declare function sanitizeIdentifier(name: string): string; /** * Describes the text contents of a placeholder as it appears in an ICU expression, including its * source span information. */ interface MessagePlaceholder { /** The text contents of the placeholder */ text: string; /** The source span of the placeholder */ sourceSpan: ParseSourceSpan$1; } declare class Message { nodes: Node$2[]; placeholders: { [phName: string]: MessagePlaceholder; }; placeholderToMessage: { [phName: string]: Message; }; meaning: string; description: string; customId: string; sources: MessageSpan[]; id: string; /** The ids to use if there are no custom id and if `i18nLegacyMessageIdFormat` is not empty */ legacyIds: string[]; messageString: string; /** * @param nodes message AST * @param placeholders maps placeholder names to static content and their source spans * @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages) * @param meaning * @param description * @param customId */ constructor(nodes: Node$2[], placeholders: { [phName: string]: MessagePlaceholder; }, placeholderToMessage: { [phName: string]: Message; }, meaning: string, description: string, customId: string); } interface MessageSpan { filePath: string; startLine: number; startCol: number; endLine: number; endCol: number; } interface Node$2 { sourceSpan: ParseSourceSpan$1; visit(visitor: Visitor$2, context?: any): any; } declare class Text$2 implements Node$2 { value: string; sourceSpan: ParseSourceSpan$1; constructor(value: string, sourceSpan: ParseSourceSpan$1); visit(visitor: Visitor$2, context?: any): any; } declare class Container implements Node$2 { children: Node$2[]; sourceSpan: ParseSourceSpan$1; constructor(children: Node$2[], sourceSpan: ParseSourceSpan$1); visit(visitor: Visitor$2, context?: any): any; } declare class Icu$1 implements Node$2 { expression: string; type: string; cases: { [k: string]: Node$2; }; sourceSpan: ParseSourceSpan$1; expressionPlaceholder?: string | undefined; constructor(expression: string, type: string, cases: { [k: string]: Node$2; }, sourceSpan: ParseSourceSpan$1, expressionPlaceholder?: string | undefined); visit(visitor: Visitor$2, context?: any): any; } declare class TagPlaceholder implements Node$2 { tag: string; attrs: { [k: string]: string; }; startName: string; closeName: string; children: Node$2[]; isVoid: boolean; sourceSpan: ParseSourceSpan$1; startSourceSpan: ParseSourceSpan$1 | null; endSourceSpan: ParseSourceSpan$1 | null; constructor(tag: string, attrs: { [k: string]: string; }, startName: string, closeName: string, children: Node$2[], isVoid: boolean, sourceSpan: ParseSourceSpan$1, startSourceSpan: ParseSourceSpan$1 | null, endSourceSpan: ParseSourceSpan$1 | null); visit(visitor: Visitor$2, context?: any): any; } declare class Placeholder implements Node$2 { value: string; name: string; sourceSpan: ParseSourceSpan$1; constructor(value: string, name: string, sourceSpan: ParseSourceSpan$1); visit(visitor: Visitor$2, context?: any): any; } declare class IcuPlaceholder implements Node$2 { value: Icu$1; name: string; sourceSpan: ParseSourceSpan$1; /** Used to capture a message computed from a previous processing pass (see `setI18nRefs()`). */ previousMessage?: Message; constructor(value: Icu$1, name: string, sourceSpan: ParseSourceSpan$1); visit(visitor: Visitor$2, context?: any): any; } declare class BlockPlaceholder implements Node$2 { name: string; parameters: string[]; startName: string; closeName: string; children: Node$2[]; sourceSpan: ParseSourceSpan$1; startSourceSpan: ParseSourceSpan$1 | null; endSourceSpan: ParseSourceSpan$1 | null; constructor(name: string, parameters: string[], startName: string, closeName: string, children: Node$2[], sourceSpan: ParseSourceSpan$1, startSourceSpan: ParseSourceSpan$1 | null, endSourceSpan: ParseSourceSpan$1 | null); visit(visitor: Visitor$2, context?: any): any; } /** * Each HTML node that is affect by an i18n tag will also have an `i18n` property that is of type * `I18nMeta`. * This information is either a `Message`, which indicates it is the root of an i18n message, or a * `Node`, which indicates is it part of a containing `Message`. */ type I18nMeta$1 = Message | Node$2; interface Visitor$2 { visitText(text: Text$2, context?: any): any; visitContainer(container: Container, context?: any): any; visitIcu(icu: Icu$1, context?: any): any; visitTagPlaceholder(ph: TagPlaceholder, context?: any): any; visitPlaceholder(ph: Placeholder, context?: any): any; visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): any; visitBlockPlaceholder(ph: BlockPlaceholder, context?: any): any; } declare const enum TokenType$1 { TAG_OPEN_START = 0, TAG_OPEN_END = 1, TAG_OPEN_END_VOID = 2, TAG_CLOSE = 3, INCOMPLETE_TAG_OPEN = 4, TEXT = 5, ESCAPABLE_RAW_TEXT = 6, RAW_TEXT = 7, INTERPOLATION = 8, ENCODED_ENTITY = 9, COMMENT_START = 10, COMMENT_END = 11, CDATA_START = 12, CDATA_END = 13, ATTR_NAME = 14, ATTR_QUOTE = 15, ATTR_VALUE_TEXT = 16, ATTR_VALUE_INTERPOLATION = 17, DOC_TYPE = 18, EXPANSION_FORM_START = 19, EXPANSION_CASE_VALUE = 20, EXPANSION_CASE_EXP_START = 21, EXPANSION_CASE_EXP_END = 22, EXPANSION_FORM_END = 23, BLOCK_OPEN_START = 24, BLOCK_OPEN_END = 25, BLOCK_CLOSE = 26, BLOCK_PARAMETER = 27, INCOMPLETE_BLOCK_OPEN = 28, LET_START = 29, LET_VALUE = 30, LET_END = 31, INCOMPLETE_LET = 32, COMPONENT_OPEN_START = 33, COMPONENT_OPEN_END = 34, COMPONENT_OPEN_END_VOID = 35, COMPONENT_CLOSE = 36, INCOMPLETE_COMPONENT_OPEN = 37, DIRECTIVE_NAME = 38, DIRECTIVE_OPEN = 39, DIRECTIVE_CLOSE = 40, EOF = 41 } type InterpolatedTextToken = TextToken | InterpolationToken | EncodedEntityToken; type InterpolatedAttributeToken = AttributeValueTextToken | AttributeValueInterpolationToken | EncodedEntityToken; interface TokenBase { type: TokenType$1; parts: string[]; sourceSpan: ParseSourceSpan$1; } interface TextToken extends TokenBase { type: TokenType$1.TEXT | TokenType$1.ESCAPABLE_RAW_TEXT | TokenType$1.RAW_TEXT; parts: [text: string]; } interface InterpolationToken extends TokenBase { type: TokenType$1.INTERPOLATION; parts: [startMarker: string, expression: string, endMarker: string] | [startMarker: string, expression: string]; } interface EncodedEntityToken extends TokenBase { type: TokenType$1.ENCODED_ENTITY; parts: [decoded: string, encoded: string]; } interface AttributeValueTextToken extends TokenBase { type: TokenType$1.ATTR_VALUE_TEXT; parts: [value: string]; } interface AttributeValueInterpolationToken extends TokenBase { type: TokenType$1.ATTR_VALUE_INTERPOLATION; parts: [startMarker: string, expression: string, endMarker: string] | [startMarker: string, expression: string]; } interface BaseNode { sourceSpan: ParseSourceSpan$1; visit(visitor: Visitor$1, context: any): any; } type Node$1 = Attribute | Comment$1 | Element$1 | Expansion | ExpansionCase | Text$1 | Block | BlockParameter | Component$1 | Directive$1; declare abstract class NodeWithI18n implements BaseNode { sourceSpan: ParseSourceSpan$1; i18n?: I18nMeta$1 | undefined; constructor(sourceSpan: ParseSourceSpan$1, i18n?: I18nMeta$1 | undefined); abstract visit(visitor: Visitor$1, context: any): any; } declare class Text$1 extends NodeWithI18n { value: string; tokens: InterpolatedTextToken[]; constructor(value: string, sourceSpan: ParseSourceSpan$1, tokens: InterpolatedTextToken[], i18n?: I18nMeta$1); visit(visitor: Visitor$1, context: any): any; } declare class Expansion extends NodeWithI18n { switchValue: string; type: string; cases: ExpansionCase[]; switchValueSourceSpan: ParseSourceSpan$1; constructor(switchValue: string, type: string, cases: ExpansionCase[], sourceSpan: ParseSourceSpan$1, switchValueSourceSpan: ParseSourceSpan$1, i18n?: I18nMeta$1); visit(visitor: Visitor$1, context: any): any; } declare class ExpansionCase implements BaseNode { value: string; expression: Node$1[]; sourceSpan: ParseSourceSpan$1; valueSourceSpan: ParseSourceSpan$1; expSourceSpan: ParseSourceSpan$1; constructor(value: string, expression: Node$1[], sourceSpan: ParseSourceSpan$1, valueSourceSpan: ParseSourceSpan$1, expSourceSpan: ParseSourceSpan$1); visit(visitor: Visitor$1, context: any): any; } declare class Attribute extends NodeWithI18n { name: string; value: string; readonly keySpan: ParseSourceSpan$1 | undefined; valueSpan: ParseSourceSpan$1 | undefined; valueTokens: InterpolatedAttributeToken[] | undefined; constructor(name: string, value: string, sourceSpan: ParseSourceSpan$1, keySpan: ParseSourceSpan$1 | undefined, valueSpan: ParseSourceSpan$1 | undefined, valueTokens: InterpolatedAttributeToken[] | undefined, i18n: I18nMeta$1 | undefined); visit(visitor: Visitor$1, context: any): any; } declare class Element$1 extends NodeWithI18n { name: string; attrs: Attribute[]; readonly directives: Directive$1[]; children: Node$1[]; readonly isSelfClosing: boolean; startSourceSpan: ParseSourceSpan$1; endSourceSpan: ParseSourceSpan$1 | null; readonly isVoid: boolean; constructor(name: string, attrs: Attribute[], directives: Directive$1[], children: Node$1[], isSelfClosing: boolean, sourceSpan: ParseSourceSpan$1, startSourceSpan: ParseSourceSpan$1, endSourceSpan: (ParseSourceSpan$1 | null) | undefined, isVoid: boolean, i18n?: I18nMeta$1); visit(visitor: Visitor$1, context: any): any; } declare class Comment$1 implements BaseNode { value: string | null; sourceSpan: ParseSourceSpan$1; constructor(value: string | null, sourceSpan: ParseSourceSpan$1); visit(visitor: Visitor$1, context: any): any; } declare class Block extends NodeWithI18n { name: string; parameters: BlockParameter[]; children: Node$1[]; nameSpan: ParseSourceSpan$1; startSourceSpan: ParseSourceSpan$1; endSourceSpan: ParseSourceSpan$1 | null; constructor(name: string, parameters: BlockParameter[], children: Node$1[], sourceSpan: ParseSourceSpan$1, nameSpan: ParseSourceSpan$1, startSourceSpan: ParseSourceSpan$1, endSourceSpan?: ParseSourceSpan$1 | null, i18n?: I18nMeta$1); visit(visitor: Visitor$1, context: any): any; } declare class Component$1 extends NodeWithI18n { readonly componentName: string; readonly tagName: string | null; readonly fullName: string; attrs: Attribute[]; readonly directives: Directive$1[]; readonly children: Node$1[]; readonly isSelfClosing: boolean; readonly startSourceSpan: ParseSourceSpan$1; endSourceSpan: ParseSourceSpan$1 | null; constructor(componentName: string, tagName: string | null, fullName: string, attrs: Attribute[], directives: Directive$1[], children: Node$1[], isSelfClosing: boolean, sourceSpan: ParseSourceSpan$1, startSourceSpan: ParseSourceSpan$1, endSourceSpan?: ParseSourceSpan$1 | null, i18n?: I18nMeta$1); visit(visitor: Visitor$1, context: any): any; } declare class Directive$1 implements BaseNode { readonly name: string; readonly attrs: Attribute[]; readonly sourceSpan: ParseSourceSpan$1; readonly startSourceSpan: ParseSourceSpan$1; readonly endSourceSpan: ParseSourceSpan$1 | null; constructor(name: string, attrs: Attribute[], sourceSpan: ParseSourceSpan$1, startSourceSpan: ParseSourceSpan$1, endSourceSpan?: ParseSourceSpan$1 | null); visit(visitor: Visitor$1, context: any): any; } declare class BlockParameter implements BaseNode { expression: string; sourceSpan: ParseSourceSpan$1; constructor(expression: string, sourceSpan: ParseSourceSpan$1); visit(visitor: Visitor$1, context: any): any; } declare class LetDeclaration$1 implements BaseNode { name: string; value: string; sourceSpan: ParseSourceSpan$1; readonly nameSpan: ParseSourceSpan$1; valueSpan: ParseSourceSpan$1; constructor(name: string, value: string, sourceSpan: ParseSourceSpan$1, nameSpan: ParseSourceSpan$1, valueSpan: ParseSourceSpan$1); visit(visitor: Visitor$1, context: any): any; } interface Visitor$1 { visit?(node: Node$1, context: any): any; visitElement(element: Element$1, context: any): any; visitAttribute(attribute: Attribute, context: any): any; visitText(text: Text$1, context: any): any; visitComment(comment: Comment$1, context: any): any; visitExpansion(expansion: Expansion, context: any): any; visitExpansionCase(expansionCase: ExpansionCase, context: any): any; visitBlock(block: Block, context: any): any; visitBlockParameter(parameter: BlockParameter, context: any): any; visitLetDeclaration(decl: LetDeclaration$1, context: any): any; visitComponent(component: Component$1, context: any): any; visitDirective(directive: Directive$1, context: any): any; } declare function visitAll$1(visitor: Visitor$1, nodes: Node$1[], context?: any): any[]; declare class RecursiveVisitor$1 implements Visitor$1 { constructor(); visitElement(ast: Element$1, context: any): any; visitAttribute(ast: Attribute, context: any): any; visitText(ast: Text$1, context: any): any; visitComment(ast: Comment$1, context: any): any; visitExpansion(ast: Expansion, context: any): any; visitExpansionCase(ast: ExpansionCase, context: any): any; visitBlock(block: Block, context: any): any; visitBlockParameter(ast: BlockParameter, context: any): any; visitLetDeclaration(decl: LetDeclaration$1, context: any): void; visitComponent(component: Component$1, context: any): void; visitDirective(directive: Directive$1, context: any): void; private visitChildren; } declare class InterpolationConfig { start: string; end: string; static fromArray(markers: [string, string] | null): InterpolationConfig; constructor(start: string, end: string); } declare const DEFAULT_INTERPOLATION_CONFIG: InterpolationConfig; declare enum TagContentType { RAW_TEXT = 0, ESCAPABLE_RAW_TEXT = 1, PARSABLE_DATA = 2 } interface TagDefinition { closedByParent: boolean; implicitNamespacePrefix: string | null; isVoid: boolean; ignoreFirstLf: boolean; canSelfClose: boolean; preventNamespaceInheritance: boolean; isClosedByChild(name: string): boolean; getContentType(prefix?: string): TagContentType; } declare function splitNsName(elementName: string, fatal?: boolean): [string | null, string]; declare function isNgContainer(tagName: string): boolean; declare function isNgContent(tagName: string): boolean; declare function isNgTemplate(tagName: string): boolean; declare function getNsPrefix(fullName: string): string; declare function getNsPrefix(fullName: null): null; declare function mergeNsAndName(prefix: string, localName: string): string; interface LexerRange { startPos: number; startLine: number; startCol: number; endPos: number; } /** * Options that modify how the text is tokenized. */ interface TokenizeOptions { /** Whether to tokenize ICU messages (considered as text nodes when false). */ tokenizeExpansionForms?: boolean; /** How to tokenize interpolation markers. */ interpolationConfig?: InterpolationConfig; /** * The start and end point of the text to parse within the `source` string. * The entire `source` string is parsed if this is not provided. * */ range?: LexerRange; /** * If this text is stored in a JavaScript string, then we have to deal with escape sequences. * * **Example 1:** * * ``` * "abc\"def\nghi" * ``` * * - The `\"` must be converted to `"`. * - The `\n` must be converted to a new line character in a token, * but it should not increment the current line for source mapping. * * **Example 2:** * * ``` * "abc\ * def" * ``` * * The line continuation (`\` followed by a newline) should be removed from a token * but the new line should increment the current line for source mapping. */ escapedString?: boolean; /** * If this text is stored in an external template (e.g. via `templateUrl`) then we need to decide * whether or not to normalize the line-endings (from `\r\n` to `\n`) when processing ICU * expressions. * * If `true` then we will normalize ICU expression line endings. * The default is `false`, but this will be switched in a future major release. */ i18nNormalizeLineEndingsInICUs?: boolean; /** * An array of characters that should be considered as leading trivia. * Leading trivia are characters that are not important to the developer, and so should not be * included in source-map segments. A common example is whitespace. */ leadingTriviaChars?: string[]; /** * If true, do not convert CRLF to LF. */ preserveLineEndings?: boolean; /** * Whether to tokenize @ block syntax. Otherwise considered text, * or ICU tokens if `tokenizeExpansionForms` is enabled. */ tokenizeBlocks?: boolean; /** * Whether to tokenize the `@let` syntax. Otherwise will be considered either * text or an incomplete block, depending on whether `tokenizeBlocks` is enabled. */ tokenizeLet?: boolean; /** Whether the selectorless syntax is enabled. */ selectorlessEnabled?: boolean; } declare class TreeError extends ParseError { elementName: string | null; static create(elementName: string | null, span: ParseSourceSpan$1, msg: string): TreeError; constructor(elementName: string | null, span: ParseSourceSpan$1, msg: string); } declare class ParseTreeResult { rootNodes: Node$1[]; errors: ParseError[]; constructor(rootNodes: Node$1[], errors: ParseError[]); } declare class Parser$1 { getTagDefinition: (tagName: string) => TagDefinition; constructor(getTagDefinition: (tagName: string) => TagDefinition); parse(source: string, url: string, options?: TokenizeOptions): ParseTreeResult; } type I18nMeta = { id?: string; customId?: string; legacyIds?: string[]; description?: string; meaning?: string; }; declare enum TypeModifier { None = 0, Const = 1 } declare abstract class Type$1 { modifiers: TypeModifier; constructor(modifiers?: TypeModifier); abstract visitType(visitor: TypeVisitor, context: any): any; hasModifier(modifier: TypeModifier): boolean; } declare enum BuiltinTypeName { Dynamic = 0, Bool = 1, String = 2, Int = 3, Number = 4, Function = 5, Inferred = 6, None = 7 } declare class BuiltinType extends Type$1 { name: BuiltinTypeName; constructor(name: BuiltinTypeName, modifiers?: TypeModifier); visitType(visitor: TypeVisitor, context: any): any; } declare class ExpressionType extends Type$1 { value: Expression; typeParams: Type$1[] | null; constructor(value: Expression, modifiers?: TypeModifier, typeParams?: Type$1[] | null); visitType(visitor: TypeVisitor, context: any): any; } declare class ArrayType extends Type$1 { of: Type$1; constructor(of: Type$1, modifiers?: TypeModifier); visitType(visitor: TypeVisitor, context: any): any; } declare class MapType extends Type$1 { valueType: Type$1 | null; constructor(valueType: Type$1 | null | undefined, modifiers?: TypeModifier); visitType(visitor: TypeVisitor, context: any): any; } declare class TransplantedType<T> extends Type$1 { readonly type: T; constructor(type: T, modifiers?: TypeModifier); visitType(visitor: TypeVisitor, context: any): any; } declare const DYNAMIC_TYPE: BuiltinType; declare const INFERRED_TYPE: BuiltinType; declare const BOOL_TYPE: BuiltinType; declare const INT_TYPE: BuiltinType; declare const NUMBER_TYPE: BuiltinType; declare const STRING_TYPE: BuiltinType; declare const FUNCTION_TYPE: BuiltinType; declare const NONE_TYPE: BuiltinType; interface TypeVisitor { visitBuiltinType(type: BuiltinType, context: any): any; visitExpressionType(type: ExpressionType, context: any): any; visitArrayType(type: ArrayType, context: any): any; visitMapType(type: MapType, context: any): any; visitTransplantedType(type: TransplantedType<unknown>, context: any): any; } declare enum UnaryOperator { Minus = 0, Plus = 1 } declare enum BinaryOperator { Equals = 0, NotEquals = 1, Assign = 2, Identical = 3, NotIdentical = 4, Minus = 5, Plus = 6, Divide = 7, Multiply = 8, Modulo = 9, And = 10, Or = 11, BitwiseOr = 12, BitwiseAnd = 13, Lower = 14, LowerEquals = 15, Bigger = 16, BiggerEquals = 17, NullishCoalesce = 18, Exponentiation = 19, In = 20, AdditionAssignment = 21, SubtractionAssignment = 22, MultiplicationAssignment = 23, DivisionAssignment = 24, RemainderAssignment = 25, ExponentiationAssignment = 26, AndAssignment = 27, OrAssignment = 28, NullishCoalesceAssignment = 29 } declare function nullSafeIsEquivalent<T extends { isEquivalent(other: T): boolean; }>(base: T | null, other: T | null): boolean; declare function areAllEquivalent<T extends { isEquivalent(other: T): boolean; }>(base: T[], other: T[]): boolean; declare abstract class Expression { type: Type$1 | null; sourceSpan: ParseSourceSpan$1 | null; constructor(type: Type$1 | null | undefined, sourceSpan?: ParseSourceSpan$1 | null); abstract visitExpression(visitor: ExpressionVisitor, context: any): any; /** * Calculates whether this expression produces the same value as the given expression. * Note: We don't check Types nor ParseSourceSpans nor function arguments. */ abstract isEquivalent(e: Expression): boolean; /** * Return true if the expression is constant. */ abstract isConstant(): boolean; abstract clone(): Expression; prop(name: string, sourceSpan?: ParseSourceSpan$1 | null): ReadPropExpr; key(index: Expression, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null): ReadKeyExpr; callFn(params: Expression[], sourceSpan?: ParseSourceSpan$1 | null, pure?: boolean): InvokeFunctionExpr; instantiate(params: Expression[], type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null): InstantiateExpr; conditional(trueCase: Expression, falseCase?: Expression | null, sourceSpan?: ParseSourceSpan$1 | null): ConditionalExpr; equals(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; notEquals(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; identical(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; notIdentical(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; minus(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; plus(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; divide(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; multiply(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; modulo(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; power(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; and(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; bitwiseOr(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; bitwiseAnd(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; or(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; lower(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; lowerEquals(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; bigger(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; biggerEquals(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; isBlank(sourceSpan?: ParseSourceSpan$1 | null): Expression; nullishCoalesce(rhs: Expression, sourceSpan?: ParseSourceSpan$1 | null): BinaryOperatorExpr; toStmt(): Statement; } declare class ReadVarExpr extends Expression { name: string; constructor(name: string, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): ReadVarExpr; set(value: Expression): BinaryOperatorExpr; } declare class TypeofExpr extends Expression { expr: Expression; constructor(expr: Expression, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); visitExpression(visitor: ExpressionVisitor, context: any): any; isEquivalent(e: Expression): boolean; isConstant(): boolean; clone(): TypeofExpr; } declare class VoidExpr extends Expression { expr: Expression; constructor(expr: Expression, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); visitExpression(visitor: ExpressionVisitor, context: any): any; isEquivalent(e: Expression): boolean; isConstant(): boolean; clone(): VoidExpr; } declare class WrappedNodeExpr<T> extends Expression { node: T; constructor(node: T, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): WrappedNodeExpr<T>; } declare class InvokeFunctionExpr extends Expression { fn: Expression; args: Expression[]; pure: boolean; constructor(fn: Expression, args: Expression[], type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null, pure?: boolean); get receiver(): Expression; isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): InvokeFunctionExpr; } declare class TaggedTemplateLiteralExpr extends Expression { tag: Expression; template: TemplateLiteralExpr; constructor(tag: Expression, template: TemplateLiteralExpr, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): TaggedTemplateLiteralExpr; } declare class InstantiateExpr extends Expression { classExpr: Expression; args: Expression[]; constructor(classExpr: Expression, args: Expression[], type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): InstantiateExpr; } declare class LiteralExpr extends Expression { value: number | string | boolean | null | undefined; constructor(value: number | string | boolean | null | undefined, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): LiteralExpr; } declare class TemplateLiteralExpr extends Expression { elements: TemplateLiteralElementExpr[]; expressions: Expression[]; constructor(elements: TemplateLiteralElementExpr[], expressions: Expression[], sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): TemplateLiteralExpr; } declare class TemplateLiteralElementExpr extends Expression { readonly text: string; readonly rawText: string; constructor(text: string, sourceSpan?: ParseSourceSpan$1 | null, rawText?: string); visitExpression(visitor: ExpressionVisitor, context: any): any; isEquivalent(e: Expression): boolean; isConstant(): boolean; clone(): TemplateLiteralElementExpr; } declare class LiteralPiece { text: string; sourceSpan: ParseSourceSpan$1; constructor(text: string, sourceSpan: ParseSourceSpan$1); } declare class PlaceholderPiece { text: string; sourceSpan: ParseSourceSpan$1; associatedMessage?: Message | undefined; /** * Create a new instance of a `PlaceholderPiece`. * * @param text the name of this placeholder (e.g. `PH_1`). * @param sourceSpan the location of this placeholder in its localized message the source code. * @param associatedMessage reference to another message that this placeholder is associated with. * The `associatedMessage` is mainly used to provide a relationship to an ICU message that has * been extracted out from the message containing the placeholder. */ constructor(text: string, sourceSpan: ParseSourceSpan$1, associatedMessage?: Message | undefined); } type MessagePiece = LiteralPiece | PlaceholderPiece; declare class LocalizedString extends Expression { readonly metaBlock: I18nMeta; readonly messageParts: LiteralPiece[]; readonly placeHolderNames: PlaceholderPiece[]; readonly expressions: Expression[]; constructor(metaBlock: I18nMeta, messageParts: LiteralPiece[], placeHolderNames: PlaceholderPiece[], expressions: Expression[], sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): LocalizedString; /** * Serialize the given `meta` and `messagePart` into "cooked" and "raw" strings that can be used * in a `$localize` tagged string. The format of the metadata is the same as that parsed by * `parseI18nMeta()`. * * @param meta The metadata to serialize * @param messagePart The first part of the tagged string */ serializeI18nHead(): CookedRawString; getMessagePartSourceSpan(i: number): ParseSourceSpan$1 | null; getPlaceholderSourceSpan(i: number): ParseSourceSpan$1; /** * Serialize the given `placeholderName` and `messagePart` into "cooked" and "raw" strings that * can be used in a `$localize` tagged string. * * The format is `:<placeholder-name>[@@<associated-id>]:`. * * The `associated-id` is the message id of the (usually an ICU) message to which this placeholder * refers. * * @param partIndex The index of the message part to serialize. */ serializeI18nTemplatePart(partIndex: number): CookedRawString; } /** * A structure to hold the cooked and raw strings of a template literal element, along with its * source-span range. */ interface CookedRawString { cooked: string; raw: string; range: ParseSourceSpan$1 | null; } declare class ExternalExpr extends Expression { value: ExternalReference; typeParams: Type$1[] | null; constructor(value: ExternalReference, type?: Type$1 | null, typeParams?: Type$1[] | null, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): ExternalExpr; } declare class ExternalReference { moduleName: string | null; name: string | null; constructor(moduleName: string | null, name: string | null); } declare class ConditionalExpr extends Expression { condition: Expression; falseCase: Expression | null; trueCase: Expression; constructor(condition: Expression, trueCase: Expression, falseCase?: Expression | null, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): ConditionalExpr; } declare class DynamicImportExpr extends Expression { url: string | Expression; urlComment?: string | undefined; constructor(url: string | Expression, sourceSpan?: ParseSourceSpan$1 | null, urlComment?: string | undefined); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): DynamicImportExpr; } declare class NotExpr extends Expression { condition: Expression; constructor(condition: Expression, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): NotExpr; } declare class FnParam { name: string; type: Type$1 | null; constructor(name: string, type?: Type$1 | null); isEquivalent(param: FnParam): boolean; clone(): FnParam; } declare class FunctionExpr extends Expression { params: FnParam[]; statements: Statement[]; name?: string | null | undefined; constructor(params: FnParam[], statements: Statement[], type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null, name?: string | null | undefined); isEquivalent(e: Expression | Statement): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; toDeclStmt(name: string, modifiers?: StmtModifier): DeclareFunctionStmt; clone(): FunctionExpr; } declare class ArrowFunctionExpr extends Expression { params: FnParam[]; body: Expression | Statement[]; constructor(params: FnParam[], body: Expression | Statement[], type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): Expression; toDeclStmt(name: string, modifiers?: StmtModifier): DeclareVarStmt; } declare class UnaryOperatorExpr extends Expression { operator: UnaryOperator; expr: Expression; parens: boolean; constructor(operator: UnaryOperator, expr: Expression, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null, parens?: boolean); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): UnaryOperatorExpr; } declare class ParenthesizedExpr extends Expression { expr: Expression; constructor(expr: Expression, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); visitExpression(visitor: ExpressionVisitor, context: any): any; isEquivalent(e: Expression): boolean; isConstant(): boolean; clone(): ParenthesizedExpr; } declare class BinaryOperatorExpr extends Expression { operator: BinaryOperator; rhs: Expression; lhs: Expression; constructor(operator: BinaryOperator, lhs: Expression, rhs: Expression, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): BinaryOperatorExpr; isAssignment(): boolean; } declare class ReadPropExpr extends Expression { receiver: Expression; name: string; constructor(receiver: Expression, name: string, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); get index(): string; isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; set(value: Expression): BinaryOperatorExpr; clone(): ReadPropExpr; } declare class ReadKeyExpr extends Expression { receiver: Expression; index: Expression; constructor(receiver: Expression, index: Expression, type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; set(value: Expression): BinaryOperatorExpr; clone(): ReadKeyExpr; } declare class LiteralArrayExpr extends Expression { entries: Expression[]; constructor(entries: Expression[], type?: Type$1 | null, sourceSpan?: ParseSourceSpan$1 | null); isConstant(): boolean; isEquivalent(e: Expression): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): LiteralArrayExpr; } declare class LiteralMapEntry { key: string; value: Expression; quoted: boolean; constructor(key: string, value: Expression, quoted: boolean); isEquivalent(e: LiteralMapEntry): boolean; clone(): LiteralMapEntry; } declare class LiteralMapExpr extends Expression { entries: LiteralMapEntry[]; valueType: Type$1 | null; constructor(entries: LiteralMapEntry[], type?: MapType | null, sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): LiteralMapExpr; } declare class CommaExpr extends Expression { parts: Expression[]; constructor(parts: Expression[], sourceSpan?: ParseSourceSpan$1 | null); isEquivalent(e: Expression): boolean; isConstant(): boolean; visitExpression(visitor: ExpressionVisitor, context: any): any; clone(): CommaExpr; } interface ExpressionVisitor { visitReadVarExpr(ast: ReadVarExpr, context: any): any; visitInvokeFunctionExpr(ast: InvokeFunctionExpr, context: any): any; visitTaggedTemplateLiteralExpr(ast