Files
dusk/types/require.d.ts
T
2026-06-06 19:06:52 -05:00

48 lines
1.4 KiB
TypeScript

/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
/**
* CommonJS-style module loader.
*
* Modules are cached after their first load. Subsequent calls with the same
* resolved path return the cached exports without re-executing the file.
*
* Path rules: `"./foo"` / `"../foo"` resolve relative to the calling script's
* directory; any other string resolves from the archive root. `.js` is
* appended automatically when missing.
*
* @example
* const NPC = require('./entities/NPC');
*/
declare function require(path: string): any;
/**
* Asynchronous module loader. Loads the module at `path` in the background
* and returns a Promise that resolves to the module's `exports`.
*
* If the module is already cached it resolves immediately. On load failure
* the Promise is rejected.
*
* Path rules are identical to `require`.
*
* @example
* const NPC = await requireAsync('./entities/NPC');
*/
declare function requireAsync(path: string): Promise<any>;
/**
* The module object for the currently executing script.
* Assign `module.exports` to control what `require()` returns to callers.
*/
declare var module: { exports: any };
/**
* Shorthand for `module.exports`. Direct assignment (`exports = ...`) does
* NOT update `module.exports`; use `module.exports = ...` for that.
*/
declare var exports: any;