/// import { FSWatcher } from 'fs'; import Module from './module'; import Bundle, { CompileOptions } from './bundle'; import Porter from './porter'; import { LoaderConfig, PartiallyRequired } from './defs'; export interface PacketMeta { name: string; version: string; main: string; module: string; browserify: Record; browser: string | Record; babel: Record; exports: Record>>; } interface PacketOptions { app: Porter; dir: string; name?: string; paths?: string[]; parent?: Packet; packet?: PacketMeta; alias?: Record; } type PacketConstructor = PartiallyRequired; interface FakeEntryOptions { entry: string; deps?: string[]; imports?: string[]; code: string; } export default class Packet { app: Porter; dir: string; name: string; version: string; paths: string[]; parent?: Packet; dependencies: Record; entries: Record; bundles: Record; files: Record; folder: Record; browser: Record; exports: Record>>; browserify: Record; depPaths: string[]; isolated: boolean; alias: Record; transpiler: string; transpilerVersion: string; transpilerOpts: Record; lessPlugin?: { install: (less: any, pluginManager: any) => {}; minVersion: number[]; }; main: string; watchers?: FSWatcher[]; lazyloaded?: boolean; fake: boolean; static create(options: PacketConstructor): Packet; static findOrCreate({ name, dir, parent, app }: PacketOptions): Promise; constructor({ app, dir, paths, parent, packet, alias }: PacketConstructor); get rootPacket(): Packet; get bundle(): Bundle; /** * check if packet should be bundled and were not bundled yet */ get bundleable(): boolean; get all(): Iterable; /** * Find packet by name or by name and version in the packet tree. * @param {Object} opts * @param {string} opts.name * @param {string} opts.version */ find({ name, version }: { name?: string; version?: string; }): Packet | null; findAll({ name }: { name: string; }): Packet[]; parseDepPaths(): Promise; findTranspiler(): Promise; prepareTranspiler(): Promise; prepare(): Promise; watch(): void; onChange(eventType: string, filename: string | null): Promise; reload(eventType: string, filename: string): Promise; tryRequire(name: string): any; normalizeFile(file: string): string | false; parseModule(file: string): Promise; parseEntry(entry: string): Promise; parseFile(file: string): Promise; /** * Parse an entry that has code or deps (or both) specified already. */ parseFakeEntry(options: FakeEntryOptions): Promise; parsePacket({ name, entry }: { name: string; entry: string; }): Promise; resolve(file: string): Promise; get lock(): any; get copy(): Record; get loaderConfig(): { alias: Record; baseUrl: string; map: Record | undefined; preload: string[]; package: { name: string; version: string; main: string; }; timeout: number; }; parseLoader(loaderConfig: LoaderConfig): Promise<{ sourceContent: string; code: string; }>; pack({ minify }?: { minify?: boolean | undefined; }): Promise; compileAll(opts: CompileOptions): Promise; compile(entries: string | string[], opts: CompileOptions): Promise; destroy(): Promise; } export {};