import JSZip from "jszip"; import { Static } from "@sinclair/typebox"; import * as lib from "@clusterio/lib"; import BaseInstancePlugin from "./BaseInstancePlugin"; /** * Describes a module that can be patched into a save */ export declare class SaveModule { /** Module */ info: lib.ModuleInfo; /** Files and their content that will be patched into the save */ files: Map>; constructor( /** Module */ info: lib.ModuleInfo, /** Files and their content that will be patched into the save */ files?: Map>); static moduleFilePath(filePath: string, moduleName: string): string; loadFiles(moduleDirectory: string): Promise; static jsonSchema: import("@sinclair/typebox").TObject<{ files: import("@sinclair/typebox").TArray; name: import("@sinclair/typebox").TString; version: import("@sinclair/typebox").TString; dependencies: import("@sinclair/typebox").TOptional>; require: import("@sinclair/typebox").TOptional>; load: import("@sinclair/typebox").TOptional>; }>; toJSON(): { files: string[]; name: string; version: string; dependencies: { [k: string]: string; }; require: string[]; load: string[]; }; static fromSave(json: Static, root: JSZip): Promise; static fromPlugin(plugin: BaseInstancePlugin): Promise; static fromDirectory(moduleDirectory: string): Promise; } export declare class PatchInfo { patchNumber: number; scenario: lib.ModuleInfo; modules: SaveModule[]; version: number; static currentVersion: number; constructor(patchNumber: number, scenario: lib.ModuleInfo, modules: SaveModule[], version?: number); static jsonSchema: import("@sinclair/typebox").TObject<{ version: import("@sinclair/typebox").TNumber; patch_number: import("@sinclair/typebox").TNumber; scenario: import("@sinclair/typebox").TObject<{ name: import("@sinclair/typebox").TString; version: import("@sinclair/typebox").TString; dependencies: import("@sinclair/typebox").TOptional>; files: import("@sinclair/typebox").TOptional>; require: import("@sinclair/typebox").TOptional>; load: import("@sinclair/typebox").TOptional>; }>; modules: import("@sinclair/typebox").TArray; name: import("@sinclair/typebox").TString; version: import("@sinclair/typebox").TString; dependencies: import("@sinclair/typebox").TOptional>; require: import("@sinclair/typebox").TOptional>; load: import("@sinclair/typebox").TOptional>; }>>; }>; toJSON(): { version: number; patch_number: number; scenario: { name: string; version: string; dependencies: { [k: string]: string; }; require: string[]; load: string[]; }; modules: { files: string[]; name: string; version: string; dependencies: { [k: string]: string; }; require: string[]; load: string[]; }[]; }; static fromSave(json: Static, root: JSZip): Promise; } /** * Generates control.lua code for loading the Clusterio modules * * @param patchInfo - The patch info files's json content * @returns Generated control.lua code. * @internal */ declare function generateLoader(patchInfo: PatchInfo): string; /** * Reorders modules to satisfy their dependencies * * Looks through and reorders the array of module definitions in order to * satisfy the property that dependencies are earlier in the array than * their dependents. Throws an error if this is not possible. * * @param modules - Array of modules to reorder * @internal */ declare function reorderDependencies(modules: SaveModule[]): void; /** * Patch a save with the given modules * * Adds the modules given by the modules parameter to the save located * at savePath and rewrites the control.lua in the save to load the * modules that were added. Will also remove any previous module * located in the save. * * @param savePath - Path to the Factorio save to patch. * @param modules - Description of the modules to patch. */ export declare function patch(savePath: string, modules: SaveModule[]): Promise; export declare const _generateLoader: typeof generateLoader; export declare const _reorderDependencies: typeof reorderDependencies; export {}; //# sourceMappingURL=patch.d.ts.map