Download native-eiffel/engine/hooks.mjs from peih/matrix-shooter-train: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/peih/matrix-shooter-train/resolve/main/native-eiffel/engine/hooks.mjs
- Command line
-
hf download hf://peih/matrix-shooter-train/native-eiffel/engine/hooks.mjs
-
curl -L -o hooks.mjs https://huggingface.co/peih/matrix-shooter-train/resolve/main/native-eiffel/engine/hooks.mjs
1 kB
| // Resolve the browser-style specifiers the game uses ("three", "/assets/...", | |
| // "/vendor/...") to files on disk, and swap the DOM-bound PrototypeShell for | |
| // a headless one. Registered by host.mjs through module.register(). | |
| import { pathToFileURL } from 'node:url'; | |
| import path from 'node:path'; | |
| let config; | |
| export async function initialize(data) { | |
| config = data; | |
| } | |
| export async function resolve(specifier, context, next) { | |
| const { gameDir, threeModule, shellStub } = config; | |
| if (specifier === 'three' || specifier === '/vendor/three.module.js') { | |
| return { url: pathToFileURL(threeModule).href, shortCircuit: true }; | |
| } | |
| if (specifier === '/assets/user-interface/PrototypeShell.js' && !context.parentURL?.endsWith('shell-stub.mjs')) { | |
| return { url: pathToFileURL(shellStub).href, shortCircuit: true }; | |
| } | |
| if (specifier.startsWith('/assets/')) { | |
| return { url: pathToFileURL(path.join(gameDir, specifier)).href, shortCircuit: true }; | |
| } | |
| return next(specifier, context); | |
| } | |