import type { Artifact, ExpressionValue } from '@wyw-in-js/shared'; import type { AstService, Expression, Identifier, MemberExpression, SourceLocation } from './ast.js'; import type { ProcessorStaticContext, ProcessorStaticValue } from './static.js'; import type { IInterpolation, Params, ProcessorDiagnostic, Value, ValueCache } from './types.js'; import type { IFileContext, IOptions } from './utils/types.js'; export type { Expression }; export type ProcessorParams = ConstructorParameters; export type TailProcessorParams = ProcessorParams extends [Params, ...infer T] ? T : never; export type TagSource = { imported: string; source: string; }; export declare abstract class BaseProcessor { tagSource: TagSource; protected readonly astService: AstService; readonly location: SourceLocation | null; protected readonly replacer: (replacement: Expression | ((tagPath: unknown) => Expression), isPure: boolean) => void; readonly displayName: string; readonly isReferenced: boolean; protected readonly idx: number; protected readonly options: IOptions; protected readonly context: IFileContext; static SKIP: symbol; readonly artifacts: Artifact[]; readonly className: string; readonly dependencies: ExpressionValue[]; interpolations: IInterpolation[]; readonly slug: string; protected callee: Identifier | MemberExpression; protected evaluated: Record<'dependencies' | 'expression', Value[]> | undefined; constructor(params: Params, tagSource: TagSource, astService: AstService, location: SourceLocation | null, replacer: (replacement: Expression | ((tagPath: unknown) => Expression), isPure: boolean) => void, displayName: string, isReferenced: boolean, idx: number, options: IOptions, context: IFileContext); /** * A replacement for tag referenced in a template literal. */ abstract get asSelector(): string; /** * A replacement for the tag in evaluation time. * For example, `css` tag will be replaced with its className, * whereas `styled` tag will be replaced with an object with metadata. */ abstract get value(): Expression; addDiagnostic(diagnostic: ProcessorDiagnostic): void; getStaticValue?(context: ProcessorStaticContext): ProcessorStaticValue | null | undefined; resolveStaticInterpolation?(interpolation: IInterpolation, value: ProcessorStaticValue, context: ProcessorStaticContext): ProcessorStaticValue | null | undefined; resolveStaticTagTarget?(target: ProcessorStaticValue, context: ProcessorStaticContext): ProcessorStaticValue | null | undefined; isValidValue(value: unknown): value is Value; toString(): string; protected tagSourceCode(): string; abstract build(values: ValueCache): void; /** * Perform a replacement for the tag in evaluation time. * For example, `css` tag will be replaced with its className, * whereas `styled` tag will be replaced with an object with metadata. */ abstract doEvaltimeReplacement(): void; /** * Perform a replacement for the tag with its runtime version. * For example, `css` tag will be replaced with its className, * whereas `styled` tag will be replaced with a component. * If some parts require evaluated data for render, * they will be replaced with placeholders. */ abstract doRuntimeReplacement(): void; }