import type { LocationUri, MimeTypeAction, StorageAction } from './squared'; import type { IDocument, IFileManager, IModule } from './index'; import type { ExternalAsset, InitialValue } from './asset'; import type { CloudStorage } from './cloud'; import type { LogComponent, LogDate } from './logger'; import type { DocumentTransform } from './settings'; export interface DocumentAsset extends ExternalAsset, StorageAction { initialValue?: InitialValue & { inlineFilename?: string }; } export interface StartOfSourceMap { file?: string; sourceRoot?: string; } export interface RawSourceMap extends StartOfSourceMap { version: T; sources: string[]; names: string[]; sourcesContent?: string[]; mappings: string; } export interface SourceInput { code?: string; sourceFile?: T; sourceName?: string; sourcesRelativeTo?: string; } export interface SourceCode { code: string; map?: RawSourceMap; sourceMappingURL?: string; } export interface ChunkFile { code: string; filename?: string; entryPoint?: boolean; } export interface ChunkData extends ChunkFile { sourceMap?: SourceMap; } export interface CacheData { uri?: string; etag?: string; encoding?: BufferEncoding; override?: boolean; } export interface TransformAction { cacheData?: CacheData; } export interface TransformResult extends SourceCode { type?: string; chunks?: Null<(SourceCode & ChunkFile)[]>; sourceFiles?: string[]; } export interface TransformOutput extends Partial, Omit, "code">, MimeTypeAction { imported?: boolean; sourceMap?: SourceMap; metadata?: unknown; external?: PlainObject; productionRelease?: boolean; getMainFile?(code?: string, imports?: StringMap): Undef>; getSourceFiles?(imports?: StringMap): Undef; } export interface TransformOptions extends TransformOutput { baseConfig: T; outputConfig: U; sourceMap: SourceMap; supplementChunks: ChunkData[]; } export interface ITransformSeries extends IModule, TransformOptions { readonly type: string; init(instance: IModule, dirname?: string): this; close(instance: IModule): void; createSourceMap(value: string): SourceMap; getMainFile(code?: string, imports?: StringMap): Undef>; getSourceFiles(imports?: StringMap): Undef; toBaseConfig(all?: boolean): T; upgrade(context: V, dirname?: string, name?: string): V; set code(value); get code(): string; get out(): IOut; get metadata(): object; get options(): TransformOutput; get productionRelease(): boolean; get imported(): boolean; set version(value); get version(): string; set packageName(value); get packageName(): string; get packageVersion(): string; get username(): string; } export interface TransformSeriesConstructor { readonly prototype: ITransformSeries; new(type: string, code: string, options: TransformOutput): ITransformSeries; } export interface IOut extends OutV3, OutV4 {} export interface OutV3 { sourceFiles?: string[]; ignoreCache?: boolean; logAppend?: LogComponent[]; messageAppend?: string; } export interface OutV4 { logQueued?: LogComponent[]; } export interface SourceMapOptions extends MimeTypeAction { file?: string; hash?: string; sourceRoot?: string; sourceMappingURL?: string; inlineMap?: boolean; emptySources?: boolean; } export interface SourceMap extends SourceCode { output: Map; reset(): void; nextMap(name: string, code: string, map: unknown, sourceMappingURL?: string, emptySources?: boolean): boolean; set map(value); get map(): Undef; } export interface SourceMapConstructor { findSourceMap(code?: string, uri?: string): Undef; removeSourceMappingURL(value: string): [string, string?, Null?]; isRaw(map: unknown): map is RawSourceMap; readonly prototype: SourceMap; new(code: string, remove: boolean): SourceMap; new(code: string, uri?: string, remove?: boolean): SourceMap; } export interface ImportMap { imports?: StringMap; scopes?: ObjectMap; } export interface UpdateGradleOptions { multiple?: boolean; addendum?: string; upgrade?: boolean; updateOnly?: boolean; } export interface LintMessage { ruleId: string; message: string; line: number; column: number; endLine?: number; endColumn?: number; severity?: 0 | 1 | 2 | "" | "error" | "warning"; fatal?: boolean; } export interface GenerateLintTableOptions extends Partial { leadingText?: string; trailingText?: string; errorCount?: number; warningCount?: number; fatalErrorCount?: number; timeStamp?: LogDate; ruleWidth?: number; messageWidth?: number; } export interface CustomizeOptions { transform?: DocumentTransform; } export interface AsSourceFileOptions { encoding?: BufferEncoding; persist?: boolean; cache?: boolean; } export type Transformer = FunctionType | string>>; export type ConfigOrTransformer = AnyObject | Transformer; export type PluginConfig = [string, Undef, Undef, boolean?] | []; export type TransformCallback, U extends ExternalAsset = ExternalAsset> = (this: T, instance: IDocument, requireOrDocumentDir?: NodeJS.Require | string) => Void>;