import { RawSourceMap } from 'source-map'; import Packet from './packet'; import Porter from './porter'; export interface ModuleOptions { file: string; fpath: string; packet: Packet; code?: string; } export interface ModuleCache { code: string; map: RawSourceMap; imports: string[]; exports?: Record; dynamicImports: string[]; minified?: boolean; __esModule?: boolean; } export interface SourceOptions { code: string; map?: RawSourceMap; } export interface TranspileOptions { code: string; map?: RawSourceMap; minify?: boolean; } export default class Module { app: Porter; packet: Packet; name: string; version: string; file: string; fpath: string; parent?: Module; children: Module[]; dynamicChildren: Module[]; imports?: string[]; dynamicImports?: string[]; __esModule?: boolean; entries: Module[]; loaders: Record; status: number; isPreload?: boolean; preloaded?: boolean; reloaded?: Date | null; fake?: boolean; isolated?: boolean; cache?: ModuleCache; code?: string; constructor({ file, fpath, packet }: ModuleOptions); get id(): string; get isRootEntry(): boolean; get isWorker(): boolean; get family(): Iterable; get immediateFamily(): Iterable; get dynamicFamily(): Iterable; get lock(): any; setCache(source: string, result: { code: string; map?: string | RawSourceMap; minified?: boolean; }): void; parseRelative(dep: string): Promise; parseNonRelative(dep: string): Promise; parseImport(dep: string): Promise; parse(): Promise; matchImport(code: string): void; load(): Promise<{ code: string; map?: RawSourceMap; }>; transpile(options: TranspileOptions): Promise<{ code: string; map?: RawSourceMap; }>; /** * Find deps of code and compare them with existing `this.deps` to see if there's * new dep to parse. Only the modules of the root packet are checked. */ checkImports({ code }: SourceOptions): Promise; obtain(): Promise; reload(): Promise; minify(): Promise<{ code: string; map?: RawSourceMap; }>; }