UNPKG

@bscotch/stitch

Version:

Stitch: The GameMaker Studio 2 Asset Pipeline Development Kit.

64 lines 2.83 kB
/// <reference types="node" /> import { Yyp } from '@bscotch/yy'; import { z } from 'zod'; import type { Gms2ResourceType } from './components/Gms2ResourceArray.js'; /** * A class for centralizing file system i/o on GMS2 * projects, so that we can more easily run in read-only * mode, attach hooks to file i/o events, etc. */ export declare class StitchStorage { protected _yypPathAbsolute: string; readonly isReadOnly: boolean; readonly bypassGitRequirement: boolean; constructor(_yypPathAbsolute: string, isReadOnly?: boolean, bypassGitRequirement?: boolean); get yypPathAbsolute(): string; renameYypFile(newName: string): string; get yypDirAbsolute(): string; get workingDirIsClean(): boolean; get gitWorkingTreeRoot(): string; toAbsolutePath(pathRelativeToYypDir: string): string; ensureDirSync(dir: string): void; /** Delete all files and folders (recursively) inside this directory. */ emptyDirSync(dir: string, includeStartingDir?: boolean): void; deleteFileSync(path: string): void; listFilesSync(dir: string, recursive?: boolean, allowedExtension?: string[]): string[]; listPathsSync(dir: string, recursive?: boolean): string[]; /** * Copy a file or recursively copy a directory. * Files are only overwritten if there is a change. */ copySync(from: string, to: string, options?: { sparse?: boolean; }): void; existsSync(path: string): boolean; isFileSync(path: string): boolean; isDirectorySync(path: string): boolean; copyFileSync(paths: [source: string, dest: string]): void; copyFileSync(source: string, destinationPath: string): void; asPosixPath(path: string): string; /** Write a buffer to file */ writeBlobSync(filePath: string, data: string | Buffer): void; /** Write a string to file, optionally forcing EOL */ writeBlobSync(filePath: string, data: string, eol: '\r\n' | '\n'): void; /** * Write data as plain JSON */ writeJsonSync(filePath: string, data: any, schema?: z.ZodSchema): void; /** * @returns true if the file was written, false if not (e.g. read-only mode or no change) */ writeYySync(filePath: string, data: any, type?: Gms2ResourceType | 'project', yyp?: Yyp): boolean; writeYy(filePath: string, data: any, type?: Gms2ResourceType | 'project', yyp?: Yyp): Promise<void>; readBlobSync(filePath: string): Buffer; readTextSync(filePath: string): string; readJsonSync(filePath: string, schema?: z.ZodSchema): any; readJson<T = unknown>(filePath: string, options?: { schema?: z.ZodSchema; fallback?: any; }): Promise<T>; writeJson(filePath: string, data: unknown, options?: { schema?: z.ZodSchema; }): Promise<void>; } //# sourceMappingURL=StitchStorage.d.ts.map