UNPKG

hackmud-script-manager

Version:

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

23 lines (22 loc) 893 B
import type { File } from "@babel/types"; import type { LaxPartial } from "@samual/lib"; export type TransformOptions = LaxPartial<{ /** 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; seclevel: number; }> & { scriptName: string | true; }; /** transform a given babel `File` to be hackmud compatible * * (returned File will need `postprocess()`ing) * @param file babel ast node representing a file containing preprocessed code * @param sourceCode the original untouched source code * @param options {@link TransformOptions details} */ export declare function transform(file: File, sourceCode: string, { uniqueId, scriptUser, scriptName, seclevel }: TransformOptions): { file: File; seclevel: number; warnings: { message: string; }[]; };