import type { Dict, Maybe, Nullable } from '@glimmer/interfaces'; import type { SourceLocation, SourcePosition } from '../source/location'; import type * as ASTv1 from './api'; import { SourceSpan } from '../source/span'; export type BuilderHead = string | ASTv1.CallableExpression; export type TagDescriptor = string | ASTv1.PathExpression | { path: ASTv1.PathExpression; selfClosing?: boolean; } | { name: string; selfClosing?: boolean; }; declare function buildMustache(path: BuilderHead | ASTv1.Literal, params?: ASTv1.Expression[], hash?: ASTv1.Hash, trusting?: boolean, loc?: SourceLocation, strip?: ASTv1.StripFlags): ASTv1.MustacheStatement; type PossiblyDeprecatedBlock = ASTv1.Block | ASTv1.Template; declare function buildBlock(path: BuilderHead, params: Nullable, hash: Nullable, _defaultBlock: PossiblyDeprecatedBlock, _elseBlock?: Nullable, loc?: SourceLocation, openStrip?: ASTv1.StripFlags, inverseStrip?: ASTv1.StripFlags, closeStrip?: ASTv1.StripFlags): ASTv1.BlockStatement; declare function buildElementModifier(path: BuilderHead, params?: ASTv1.Expression[], hash?: ASTv1.Hash, loc?: Nullable): ASTv1.ElementModifierStatement; declare function buildComment(value: string, loc?: SourceLocation): ASTv1.CommentStatement; declare function buildMustacheComment(value: string, loc?: SourceLocation): ASTv1.MustacheCommentStatement; declare function buildConcat(parts: (ASTv1.TextNode | ASTv1.MustacheStatement)[], loc?: SourceLocation): ASTv1.ConcatStatement; export type ElementParts = ['attrs', ...AttrSexp[]] | ['modifiers', ...ModifierSexp[]] | ['body', ...ASTv1.Statement[]] | ['comments', ...ElementComment[]] | ['as', ...string[]] | ['loc', SourceLocation]; export type PathSexp = string | ['path', string, LocSexp?]; export type ModifierSexp = string | [PathSexp, LocSexp?] | [PathSexp, ASTv1.Expression[], LocSexp?] | [PathSexp, ASTv1.Expression[], Dict, LocSexp?]; export type AttrSexp = [string, ASTv1.AttrNode['value'] | string, LocSexp?]; export type LocSexp = ['loc', SourceLocation]; export type ElementComment = ASTv1.MustacheCommentStatement | SourceLocation | string; export type SexpValue = string | ASTv1.Expression[] | Dict | LocSexp | PathSexp | undefined; export interface BuildElementOptions { attrs?: ASTv1.AttrNode[]; modifiers?: ASTv1.ElementModifierStatement[]; children?: ASTv1.Statement[]; comments?: ASTv1.MustacheCommentStatement[]; blockParams?: ASTv1.VarHead[] | string[]; openTag?: SourceLocation; closeTag?: Maybe; loc?: SourceLocation; } declare function buildElement(tag: TagDescriptor, options?: BuildElementOptions): ASTv1.ElementNode; declare function buildAttr(name: string, value: ASTv1.AttrValue, loc?: SourceLocation): ASTv1.AttrNode; declare function buildText(chars?: string, loc?: SourceLocation): ASTv1.TextNode; declare function buildSexpr(path: BuilderHead, params?: ASTv1.Expression[], hash?: ASTv1.Hash, loc?: SourceLocation): ASTv1.SubExpression; declare function buildThis(loc?: SourceLocation): ASTv1.ThisHead; declare function buildAtName(name: string, loc?: SourceLocation): ASTv1.AtHead; declare function buildVar(name: string, loc?: SourceLocation): ASTv1.VarHead; declare function buildHeadFromString(original: string, loc?: SourceLocation): ASTv1.PathHead; declare function buildCleanPath(head: ASTv1.PathHead, tail?: string[], loc?: SourceLocation): ASTv1.PathExpression; declare function buildPath(path: ASTv1.PathExpression | string | { head: string; tail: string[]; }, loc?: SourceLocation): ASTv1.PathExpression; declare function buildPath(path: BuilderHead, loc?: SourceLocation): ASTv1.CallableExpression; declare function buildPath(path: BuilderHead | ASTv1.Literal | ASTv1.Expression, loc?: SourceLocation): ASTv1.Expression; declare function buildLiteral(type: T['type'], value: T['value'], loc?: SourceLocation): T; declare function buildHash(pairs?: ASTv1.HashPair[], loc?: SourceLocation): ASTv1.Hash; declare function buildPair(key: string, value: ASTv1.Expression, loc?: SourceLocation): ASTv1.HashPair; declare function buildProgram(body?: ASTv1.Statement[], blockParams?: string[], loc?: SourceLocation): ASTv1.Template | ASTv1.Block; declare function buildBlockItself(body?: ASTv1.Statement[], params?: Array, chained?: boolean, loc?: SourceLocation): ASTv1.Block; declare function buildTemplate(body?: ASTv1.Statement[], blockParams?: string[], loc?: SourceLocation): ASTv1.Template; declare function buildPosition(line: number, column: number): SourcePosition; declare function buildLoc(loc: Nullable): SourceSpan; declare function buildLoc(startLine: number, startColumn: number, endLine?: number, endColumn?: number, source?: string): SourceSpan; declare const _default: { mustache: typeof buildMustache; block: typeof buildBlock; comment: typeof buildComment; mustacheComment: typeof buildMustacheComment; element: typeof buildElement; elementModifier: typeof buildElementModifier; attr: typeof buildAttr; text: typeof buildText; sexpr: typeof buildSexpr; concat: typeof buildConcat; hash: typeof buildHash; pair: typeof buildPair; literal: typeof buildLiteral; program: typeof buildProgram; blockItself: typeof buildBlockItself; template: typeof buildTemplate; loc: typeof buildLoc; pos: typeof buildPosition; path: typeof buildPath; fullPath: typeof buildCleanPath; head: typeof buildHeadFromString; at: typeof buildAtName; var: typeof buildVar; this: typeof buildThis; string: (value: string) => ASTv1.StringLiteral; boolean: (value: boolean) => ASTv1.BooleanLiteral; number: (value: number) => ASTv1.NumberLiteral; undefined(): ASTv1.UndefinedLiteral; null(): ASTv1.NullLiteral; }; export default _default;