ABout to try scene and script merger

This commit is contained in:
2026-06-02 16:46:39 -05:00
parent 241a52b94a
commit 2b3abbe13b
36 changed files with 1137 additions and 419 deletions
+69
View File
@@ -0,0 +1,69 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
/**
* CommonJS-style module loader. Accepts a single path or an array of paths.
*
* - Single string → returns that module's `exports`.
* - Array of strings → returns an array of `exports` in the same order.
*
* 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');
* const [NPC, Item] = require(['./entities/NPC', './entities/Item']);
*/
declare function require(path: string): any;
declare function require(paths: string[]): any[];
/**
* Asynchronous module loader. Accepts a single path or an array of paths.
* The asset file(s) are read in the background; once all are loaded and
* evaluated, `callback` is invoked.
*
* - Single string → `callback(exports)` — first argument is the module's
* `exports`, or `null` on load failure.
* - Array of strings → `callback(exportsArray)` — first argument is an array
* of `exports` values in the same order; failed entries are `null`.
*
* Cached modules resolve synchronously (callback fires on the same call).
* Path rules are identical to `require`.
*
* @example
* requireAsync('./entities/NPC', function(NPC) {
* if(NPC) NPC.init();
* });
*
* requireAsync(['./entities/NPC', './entities/Item'], function(mods) {
* const [NPC, Item] = mods;
* });
*/
declare function requireAsync(
path: string,
callback: (exports: any) => void
): void;
declare function requireAsync(
paths: string[],
callback: (exports: any[]) => void
): void;
/**
* 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;