UNPKG

hackmud-script-manager

Version:

Script manager for game hackmud, with minification, TypeScript support, and player script type definition generation.

32 lines (31 loc) 1.36 kB
import type { LaxPartial } from "@samual/lib"; export { minify } from "./minify"; export { postprocess } from "./postprocess"; export { preprocess } from "./preprocess"; export { transform } from "./transform"; export type ProcessOptions = LaxPartial<{ /** whether to minify the given code */ minify: boolean; /** 11 a-z 0-9 characters */ uniqueId: string; /** the user going to be hosting this script (or set to `true` if not yet known) */ scriptUser: string | true; filePath: string; /** whether to mangle function and class names (defaults to `false`) */ mangleNames: boolean; /** when set to `true` forces use of quine cheats * * when set to `false` forces quine cheats not to be used * * when left unset or set to `undefined`, automatically uses or doesn't use quine cheats based on character count */ forceQuineCheats: boolean; rootFolderPath: string; }> & { scriptName: string | true; }; /** Minifies a given script * @param code JavaScript or TypeScript code * @param options {@link ProcessOptions details} */ export declare function processScript(code: string, { minify: shouldMinify, uniqueId, scriptUser, scriptName, filePath, mangleNames, forceQuineCheats, rootFolderPath }: ProcessOptions): Promise<{ script: string; warnings: { message: string; }[]; }>;