UNPKG

sc4

Version:

A command line utility for automating SimCity 4 modding tasks & modifying savegames

86 lines (85 loc) 3.39 kB
import { Cohort, Exemplar, LotObject } from 'sc4/core'; import PluginIndex from './plugin-index.node.js'; import * as Dep from './dependency-types.js'; import type { Entry, TGI } from 'sc4/core'; import type { Logger, TGIQuery } from 'sc4/types'; import PQueue from 'p-queue'; declare const kIndex: unique symbol; declare const kPackageIndex: unique symbol; type folder = string; type DependencyTrackerOptions = { plugins?: folder; installation?: folder; logger?: Logger; cache?: string; }; type PackageIndex = { [pkg: string]: folder; }; type ExemplarLike = Exemplar | Cohort; type ExemplarEntry = Entry<ExemplarLike>; type TrackOptions = { dependencies?: string[]; }; export default class DependencyTracker { plugins: folder | undefined; installation: folder | undefined; logger: Logger | undefined; index: PluginIndex; packages: PackageIndex | null; options: DependencyTrackerOptions; private [kIndex]?; private [kPackageIndex]?; constructor(opts?: DependencyTrackerOptions); buildIndex(opts?: { logger?: Logger; }): Promise<void>; ensureIndex(): Promise<any>; buildPackageIndex(): Promise<void>; ensurePackageIndex(): Promise<any>; track(patterns?: string | string[], opts?: TrackOptions): Promise<DependencyTrackingResult>; } type MaybePromise<T> = T | Promise<T>; declare class DependencyTrackingContext { explicitDependencies: Set<string>; tracker: DependencyTracker; index: PluginIndex; files: string[]; entries: Map<string, MaybePromise<Dep.Dependency>>; touched: Set<string>; missing: Dep.Missing[]; queue: PQueue; constructor(tracker: DependencyTracker, files: string[], opts: TrackOptions); findWithPriority(query: TGIQuery, filter?: (entry: Entry) => boolean): Entry<import("../core/types.js").DecodedFile | Uint8Array<ArrayBufferLike>>; track(): Promise<DependencyTrackingResult>; touch(entry: Entry): void; read(file: string): Promise<void>; readResource(entry: Entry): Promise<Dep.Dependency>; readExemplar(entry: ExemplarEntry): Promise<Dep.Dependency | Dep.Missing>; readLotExemplar<T extends ExemplarLike>(exemplar: T, entry: Entry<T>): Promise<Dep.Lot>; readLotObject(lotObject: LotObject, entry: Entry): Promise<void | Dep.Dependency>; readLotObjectIIDs(lotObject: LotObject, entry: ExemplarEntry): Promise<Dep.Dependency>; readLotObjectIID(iid: number, lotObject: LotObject, lotEntry: ExemplarEntry): Promise<Dep.Dependency>; readFamily(tgis: TGI[], family: number): Promise<Dep.Family>; readLotObjectNetwork(lotObject: LotObject, _entry: Entry): Promise<void>; readRktExemplar(exemplar: ExemplarLike, entry: ExemplarEntry): Promise<Dep.Exemplar>; readTexture(entry: Entry): Promise<Dep.Texture>; addMissing(opts: Dep.MissingOptions): Dep.Missing; once<T extends Dep.Dependency>(entry: Entry, fn: () => MaybePromise<T>): Promise<T>; } type DependencyTrackingResultDumpOptions = { format?: string; }; declare class DependencyTrackingResult { installation: folder; plugins: folder; scanned: string[]; dependencies: Dep.Dependency[]; tree: Dep.Dependency[]; files: string[]; packages: string[]; missing: Dep.Missing[]; constructor(ctx: DependencyTrackingContext); dump({ format }?: DependencyTrackingResultDumpOptions): void; } export {};