asajs
Version:
Make your Minecraft JsonUI with ScriptingAPI
96 lines (95 loc) • 2.81 kB
TypeScript
import { UUID } from "crypto";
import { SemverString, Version } from "../types/objects/Manifest";
/**
* Interface representing the structure of a config manifest.
* This is used to define the metadata of the resource pack.
*/
interface ConfigManifest {
name: string;
description: string;
version: Version | SemverString;
baseGameVersion: Version;
uuid: UUID;
}
interface ConfigCompilerUI {
obfuscateName: boolean;
obfuscateType: boolean;
nameLength: number;
namespaceLength: number;
namespaceAmount: number;
}
interface ConfigCompiler {
UI: ConfigCompilerUI;
autoCompress: boolean;
fileExtension: string;
encodeJson: boolean;
}
interface ConfigInstaller {
autoInstall: boolean;
developEvironment: boolean;
previewVersion: boolean;
customPath: boolean;
installPath?: string;
}
export interface Config {
installer: ConfigInstaller;
compiler: ConfigCompiler;
manifest: ConfigManifest;
}
/**
* Reads an object and applies default values where necessary.
*
* This function allows deeply nested objects to be filled with default values when they are undefined.
*
* @param {object} [obj] - The object to read and apply the default values to.
* @param {object} [defaultObjValue] - The default values to use if any properties in `obj` are undefined.
* @returns {object} - The object with default values applied.
*/
export declare function readObject(obj?: object, defaultObjValue?: object): object;
/**
* A class to manage and load configuration settings.
*
* The class allows reading from a configuration file and merging the saved configuration
* with default values when necessary.
*/
export declare class Configs {
/**
* The current loaded configuration saved to disk.
*/
save: Config;
/**
* The statically cached configuration.
*/
static config: Config;
/**
* Loads the configuration file and parses it into the `save` property.
*/
constructor();
/**
* Retrieves the current configuration, either from the saved configuration or the default values.
*
* @returns {Config} - The configuration object.
*/
static getConfig(): Config;
/**
* Retrieves the default configuration values.
*
* @returns {Config} - The default configuration object.
*/
static getDefaultConfig(): Config;
private static apply;
private static arguments;
private static bind;
private static call;
private static caller;
private static length;
private static name;
private static toString;
}
/**
* Exporting the Configs class to be used globally.
*
* This allows other modules to access the configuration settings through `config`.
*/
export declare const config: typeof Configs;
export {};