From 7b6786441fc58c1215c4194b680248204f979212 Mon Sep 17 00:00:00 2001 From: ZXMushroom63 <116805577+ZXMushroom63@users.noreply.github.com> Date: Fri, 28 Mar 2025 16:01:49 +0800 Subject: [PATCH 1/8] automatic rehost --- examplemods/servermod.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examplemods/servermod.js b/examplemods/servermod.js index 9c54614..db0acd2 100644 --- a/examplemods/servermod.js +++ b/examplemods/servermod.js @@ -114,7 +114,7 @@ gui.innerText += "\n" + ModAPI.util.ustr(status); } }, ModAPI.util.str(worldName), 0).then(code => { - opening = true; //change to false later + opening = false; if (code != null) { ModAPI.hooks.methods.nlevs_SingleplayerServerController_configureLAN(ModAPI.mc.playerController.currentGameType.getRef(), 0); var msg = "code: " + ModAPI.util.ustr(code) + " relay: " + ModAPI.util.ustr(ModAPI.hooks.methods.nlevsl_LANServerController_getCurrentURI()); From 9adbf70805dec67505e326769a3a5c9f341542cc Mon Sep 17 00:00:00 2001 From: Leah Anderson Date: Wed, 9 Apr 2025 14:26:33 -0600 Subject: [PATCH 2/8] fix a thing --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4b7319..4c3ef81 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Download this repository as a .zip, and extract it. Open index.html with your pr This tool matches patterns in eaglercraft builds and adds patching code to let you modify how the code works at runtime. It then adds a [corelib](./postinit.js) that initialises the `ModAPI` object. #### History -EaglerForgeInjector is a replacement for the `ModAPI` in the [old eaglerforge](https://github.com/EaglerForge/EaglerForge-old), which was maintained by @radmanplays. The legacy eaglerforge was a port of [OtterDev's EaglerReborn (dmca'd)](https://github.com/EaglerReborn/reborn)'s `PluginAPI` (created by me, @ZXMushroom63) to run on newer versions of Eaglercraft, with a few improvements and new features. Unlike EaglerForgeInjector, both legacy eaglerforge and eaglerreborn manually exposed properties and methods one by one. +EaglerForgeInjector is a replacement for the `ModAPI` in the [old eaglerforge](https://github.com/EaglerForge/EaglerForge-old), which was maintained by @radmanplays. The legacy eaglerforge was a port of [Leah Anderson's EaglerReborn (dmca'd)](https://github.com/EaglerReborn/reborn)'s `PluginAPI` (created by me, @ZXMushroom63) to run on newer versions of Eaglercraft, with a few improvements and new features. Unlike EaglerForgeInjector, both legacy eaglerforge and eaglerreborn manually exposed properties and methods one by one. ## Discord server [https://discord.gg/rbxN7kby5W](https://discord.gg/rbxN7kby5W) From a4c5769acfd2fc4dea98c7ac1deeee099b267880 Mon Sep 17 00:00:00 2001 From: Leah Anderson Date: Wed, 9 Apr 2025 15:05:10 -0600 Subject: [PATCH 3/8] Update postinit.js to update my description --- postinit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postinit.js b/postinit.js index f75e2df..4958fcc 100644 --- a/postinit.js +++ b/postinit.js @@ -61,7 +61,7 @@ globalThis.modapi_postinit = "(" + (() => { " - Created EaglerReborn" + LF + " - EaglerForge developer" + LF + " - Helped update the client to newer versions" + LF + - " - Made signed clients work" + LF + + " - Made signed clients work in the legacy version" + LF + " - Maintainer nowadays" + LF + " - Various bug fixes for EaglerForgeInjector"); From a420e22fc71ad2d706c34745271374be09c0213a Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Thu, 10 Apr 2025 17:30:12 +0800 Subject: [PATCH 4/8] fix typo --- docs/tutorials/disable_all_particles.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/disable_all_particles.md b/docs/tutorials/disable_all_particles.md index 99526ff..40a816a 100644 --- a/docs/tutorials/disable_all_particles.md +++ b/docs/tutorials/disable_all_particles.md @@ -62,7 +62,7 @@ When TeaVM translates booleans, it converts booleans to integers: - `false` turns into `0` - `true` turns into `1` -So when we override `hasParticlesInAlphaLayer`, we'll need to return a `0` or a `1`. Since we want the game to thing that there aren't any particles in the alpha layer, we'll return `0` (false). +So when we override `hasParticlesInAlphaLayer`, we'll need to return a `0` or a `1`. Since we want the game to think that there aren't any particles in the alpha layer, we'll return `0` (false). ```javascript (function NoParticles() { From 114c91cf4929eadae8a805abdc4e7044470b22bd Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Thu, 10 Apr 2025 17:31:24 +0800 Subject: [PATCH 5/8] fix rendering issue in slippery.md --- docs/tutorials/slippery.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/tutorials/slippery.md b/docs/tutorials/slippery.md index 7a13370..7c7fd61 100644 --- a/docs/tutorials/slippery.md +++ b/docs/tutorials/slippery.md @@ -15,6 +15,7 @@ We'll begin with the basic boilerplate mod code: Let's write the client side part of the code first. - We'll get the keys for the ModAPI.blocks object (ids of each block) using [`Object.keys()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys) - Then, we'll loop over those keys, and modify their respective block to be as slippery as ice. + ```javascript var blockKeys = Object.keys(ModAPI.blocks); From cfb5c56ce50780f746cbc8a742e9acf99ccca073 Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Thu, 10 Apr 2025 17:34:40 +0800 Subject: [PATCH 6/8] fix link for hat.md --- docs/tutorials/hat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/hat.md b/docs/tutorials/hat.md index 89c48d2..5ad5e67 100644 --- a/docs/tutorials/hat.md +++ b/docs/tutorials/hat.md @@ -1,6 +1,6 @@ ## /hat with ModAPI /hat is a common server-side plugin that lets you put any block/item on your head. This tutorial will explain how to register a server-side command, construct a packet, and send it to a player. -[`S09PacketHeldItemChange` constructors]() +[`S09PacketHeldItemChange` constructors](https://nurmarvin.github.io/Minecraft-1.8-JavaDocs/net/minecraft/network/play/server/S09PacketHeldItemChange.html) As always, start with the basic boilerplate IIFE with credits: From 94ba73c990ce30e4dd223d7380367ea45e070edd Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Fri, 11 Apr 2025 20:39:00 +0800 Subject: [PATCH 7/8] refactor codebase + add cli --- .gitignore | 3 + browser.js | 50 +++ cli.js | 46 +++ injector.js => core/core.js | 143 ++++---- efserver.js => core/efserver.js | 6 + injector.minify.js => core/minify.js | 29 +- modgui.js => core/modgui.js | 10 +- modloader.js => core/modloader.js | 10 +- patches.js => core/patches.js | 8 +- postinit.js => core/postinit.js | 8 +- index.html | 37 +-- package-lock.json | 475 +++++++++++++++++++++++++++ package.json | 20 ++ 13 files changed, 742 insertions(+), 103 deletions(-) create mode 100644 .gitignore create mode 100644 browser.js create mode 100644 cli.js rename injector.js => core/core.js (81%) rename efserver.js => core/efserver.js (99%) rename injector.minify.js => core/minify.js (68%) rename modgui.js => core/modgui.js (98%) rename modloader.js => core/modloader.js (98%) rename patches.js => core/patches.js (91%) rename postinit.js => core/postinit.js (99%) create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..377be45 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +EaglercraftX_1.8_Offline_en_US.html +processed.html \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..645ed12 --- /dev/null +++ b/browser.js @@ -0,0 +1,50 @@ +document.querySelector("title").innerText = `EaglerForge Injector ${EFIConfig.ModAPIVersion}`; +document.querySelector("h1").innerText = `EaglerForge Injector ${EFIConfig.ModAPIVersion}`; + +document.querySelector("#giveme").addEventListener("click", () => { + if ( + !document.querySelector("input").files || + !document.querySelector("input").files[0] + ) { + return; + } + // @type File + var file = document.querySelector("input").files[0]; + var fileType = file.name.split("."); + fileType = fileType[fileType.length - 1]; + + file.text().then(async (string) => { + var patchedFile = string; + + EFIConfig.doServerExtras = false; + patchedFile = patchClient(string, new DOMParser()); + + var blob = new Blob([patchedFile], { type: file.type }); + saveAs(blob, "processed." + fileType); + backgroundLog("Saving file...", true); + }); +}); + +document.querySelector("#givemeserver").addEventListener("click", () => { + if ( + !document.querySelector("input").files || + !document.querySelector("input").files[0] + ) { + return; + } + // @type File + var file = document.querySelector("input").files[0]; + var fileType = file.name.split("."); + fileType = fileType[fileType.length - 1]; + + file.text().then(async (string) => { + var patchedFile = string; + + EFIConfig.doServerExtras = true; + patchedFile = patchClient(string, new DOMParser()); + + var blob = new Blob([patchedFile], { type: file.type }); + saveAs(blob, "efserver." + fileType); + backgroundLog("Saving file...", true); + }); +}); diff --git a/cli.js b/cli.js new file mode 100644 index 0000000..0ce7143 --- /dev/null +++ b/cli.js @@ -0,0 +1,46 @@ +const { DOMParser } = require("@xmldom/xmldom"); +const fs = require("fs/promises"); +const EFI = require("./core/core"); + +async function main() { + const args = process.argv.slice(2); + + if (args.includes("/help") || args.length === 0) { + console.log("***************************"); + console.log("* EaglerForgeInjector CLI *"); + console.log("***************************"); + console.log(""); + console.log("> npm run efi /help #shows this help text"); + console.log("> npm run efi my_unminified_file.html #does nothing"); + console.log("> npm run efi my_unminified_file.html /eaglerforge #injects eaglerforge"); + console.log("> npm run efi my_unminified_file.html /minify #minifies file"); + console.log("> npm run efi my_unminified_file.html /minify /minify_extras #minifies file with extra optimisations"); + console.log("> npm run efi my_unminified_file.html /eaglerforge /minify #minifies file and injects eaglerforge"); + console.log("> npm run efi my_unminified_file.html /server_extras #inject server hosting stuff"); + console.log("> npm run efi my_unminified_file.html output.html /eaglerforge /minify #minifies file and injects eaglerforge, write to file named output.html"); + console.log("> npm run efi my_unminified_file.html /verbose #much logging"); + console.log("By default, output is written to processed.html"); + return; + } + const inputFile = args[0]; + if (!inputFile) { + return console.error("No file provided!"); + } + EFI.conf.doMinify = args.includes("/minify"); + EFI.conf.doEaglerforge = args.includes("/eaglerforge"); + EFI.conf.doServerExtras = args.includes("/server_extras"); + EFI.conf.doMinifyPlus = args.includes("/minify_extras"); + EFI.conf.verbose = args.includes("/verbose"); + const string = await fs.readFile(inputFile, {encoding: 'utf-8'}); + const res = await EFI.patchClient(string, new DOMParser()); + if (res) { + var output = args[1]; + if (!output || !output.endsWith(".html")) { + output = "processed.html"; + } + console.log("Writing to " + output); + await fs.writeFile(output, res); + console.log("Done!"); + } +} +main(); \ No newline at end of file diff --git a/injector.js b/core/core.js similarity index 81% rename from injector.js rename to core/core.js index 892919c..bdb2be4 100644 --- a/injector.js +++ b/core/core.js @@ -1,13 +1,44 @@ -globalThis.ModAPIVersion = "v2.7.3"; -globalThis.doEaglerforge = true; -document.querySelector("title").innerText = `EaglerForge Injector ${ModAPIVersion}`; -document.querySelector("h1").innerText = `EaglerForge Injector ${ModAPIVersion}`; +var modapi_preinit = `globalThis.ModAPI ||= {}; + ModAPI.hooks ||= {}; + ModAPI.hooks.freezeCallstack = false; + ModAPI.hooks._rippedData ||= []; + ModAPI.hooks._rippedInterfaceMap ||= {}; + ModAPI.hooks._teavm ||= {}; + ModAPI.hooks._rippedConstructors ||= {}; + ModAPI.hooks._rippedInternalConstructors ||= {}; + ModAPI.hooks.methods ||= {}; + ModAPI.hooks._rippedMethodTypeMap ||= {}; + ModAPI.hooks._postInit ||= ()=>{}; + ModAPI.hooks._rippedStaticProperties ||= {}; + ModAPI.hooks._rippedStaticIndexer ||= {}; + `; +var freezeCallstack = `if(ModAPI.hooks.freezeCallstack){return false};`; +const EFIConfig = { + ModAPIVersion: "v2.7.3", + doEaglerforge: true, + verbose: false, + doServerExtras: false, + doMinify: false, + doMinifyPlus: false +} +if (globalThis.process) { + var backgroundLog = (x) => { + if (EFIConfig.verbose) { + console.log(x); + } + }; + var alert = console.error; + var confirm = console.warn; +} function wait(ms) { return new Promise((resolve, reject) => { setTimeout(() => { resolve(); }, ms); }); } function _status(x) { + if (globalThis.process) { + return console.log(x); + } backgroundLog(x, true); document.querySelector("#status").innerText = x; } @@ -73,7 +104,15 @@ function entriesToStaticVariableProxy(entries, prefix, clinitList) { });`; return proxy; } -async function processClasses(string) { +async function processClasses(string, parser) { + if (globalThis.process) { + var { modapi_guikit } = require("./modgui"); + var { modapi_postinit } = require("./postinit"); + var { modapi_modloader } = require("./modloader"); + var { PatchesRegistry } = require("./patches"); + var { EFServer } = require("./efserver"); + var { minify } = require("./minify"); + } if (string.includes("__eaglerforgeinjector_installation_flag__")) { backgroundLog("Detected input containing EFI installation flag.", true); return alert("this file already has EaglerForge injected in it, you nonce.\nif you're trying to update, you need a vanilla file.") @@ -82,11 +121,14 @@ async function processClasses(string) { backgroundLog("Detected invalid input.\nPlease ensure file is unsigned, unminified and unobfuscated.", true); return alert("This file does not match the requirements for EaglerForgeInjector. (not unminified & unobfuscated). Check info.") } - if (globalThis.doShronk) { - if (!confirm("The minify step is extremely slow, especially on lower-end devices, and can take upwards of 15 minutes.")) { + if (EFIConfig.doMinify) { + if (!confirm("The minify step is extremely slow, especially on lower-end devices, and can take upwards of 15 minutes.") && !module) { return; } backgroundLog("[MINIFY] Minify warning bypassed."); + if (globalThis.process) { + await wait(1000); + } } _status("Beginning patch process..."); await wait(50); @@ -308,11 +350,11 @@ var main;(function(){` await wait(50); patchedFile = PatchesRegistry.patchFile(patchedFile); - if (globalThis.doShronk) { + if (EFIConfig.doMinify) { _status("Shrinking file..."); await wait(50); - patchedFile = await shronk(patchedFile); + patchedFile = await minify(patchedFile, parser, EFIConfig); } @@ -322,15 +364,15 @@ var main;(function(){` ` id="game_frame">`, ` id="game_frame"> \`; @@ -27,10 +37,9 @@ async function shronk(input) { _status("[MINIFY] Parsing html..."); await wait(50); - const parser = new DOMParser(); const doc = parser.parseFromString(inputHtml, 'text/html'); - const scriptTags = doc.querySelectorAll('script'); - await wait(100); //trying to get chrome to gc + const scriptTags = doc.getElementsByTagName('script'); + await wait(200); //trying to get chrome to gc for (let i = 0; i < scriptTags.length; i++) { const scriptTag = scriptTags[i]; const code = scriptTag.textContent; @@ -39,7 +48,7 @@ async function shronk(input) { const output = Babel.transform(code, { - plugins: globalThis.doShronkPlus ? [ + plugins: EFIConfig.doMinifyPlus ? [ MINIFY() ] : [] }); @@ -51,8 +60,14 @@ async function shronk(input) { await wait(50); if (isHtml) { - return doc.documentElement.outerHTML; + return globalThis.process ? doc.toString() : doc.documentElement.outerHTML; } else { return doc.querySelector('script').textContent; } +} + +if (globalThis.process) { + module.exports = { + minify: minify + } } \ No newline at end of file diff --git a/modgui.js b/core/modgui.js similarity index 98% rename from modgui.js rename to core/modgui.js index 6b58b16..87d0853 100644 --- a/modgui.js +++ b/core/modgui.js @@ -1,5 +1,5 @@ -globalThis.modapi_guikit = "(" + (() => { +const modapi_guikit = "(" + (() => { // ModAPI GUI made by TheIdiotPlays // https://github.com/TheIdiotPlays var splashes = [ @@ -316,4 +316,10 @@ globalThis.modapi_guikit = "(" + (() => { }); f.click(); } -}).toString() + ")();"; \ No newline at end of file +}).toString() + ")();"; + +if (globalThis.process) { + module.exports = { + modapi_guikit: modapi_guikit + } +} \ No newline at end of file diff --git a/modloader.js b/core/modloader.js similarity index 98% rename from modloader.js rename to core/modloader.js index fd21afe..06155d9 100644 --- a/modloader.js +++ b/core/modloader.js @@ -1,4 +1,4 @@ -globalThis.modapi_modloader = "(" + (() => { +const modapi_modloader = "(" + (() => { globalThis.promisifyIDBRequest = function promisifyIDBRequest(request) { return new Promise((resolve, reject) => { request.onsuccess = () => resolve(request.result); @@ -252,4 +252,10 @@ globalThis.modapi_modloader = "(" + (() => { return totalLoaded; }; }; -}).toString() + ")();" \ No newline at end of file +}).toString() + ")();" + +if (globalThis.process) { + module.exports = { + modapi_modloader: modapi_modloader + } +} \ No newline at end of file diff --git a/patches.js b/core/patches.js similarity index 91% rename from patches.js rename to core/patches.js index 8087300..27d130a 100644 --- a/patches.js +++ b/core/patches.js @@ -35,4 +35,10 @@ PatchesRegistry.addPatch(function (input) { if (!$this.$renderHand)` ); return output; -}); \ No newline at end of file +}); + +if (globalThis.process) { + module.exports = { + PatchesRegistry: PatchesRegistry + } +} \ No newline at end of file diff --git a/postinit.js b/core/postinit.js similarity index 99% rename from postinit.js rename to core/postinit.js index 4958fcc..e45bfb9 100644 --- a/postinit.js +++ b/core/postinit.js @@ -1,4 +1,4 @@ -globalThis.modapi_postinit = "(" + (() => { +const modapi_postinit = "(" + (() => { //EaglerForge post initialization code. //This script cannot contain backticks, escape characters, or backslashes in order to inject into the dedicated server code. var startedModLoader = false; @@ -1187,3 +1187,9 @@ globalThis.modapi_postinit = "(" + (() => { return qhash(entity, values, 127); } }).toString() + ")();"; + +if (globalThis.process) { + module.exports = { + modapi_postinit: modapi_postinit + } + } \ No newline at end of file diff --git a/index.html b/index.html index b3cc149..502360d 100644 --- a/index.html +++ b/index.html @@ -91,11 +91,11 @@ >
- +     - +     - +      Awaiting input...

@@ -151,31 +151,16 @@ e.target.files[0].name; } }); - var modapi_preinit = `globalThis.ModAPI ||= {}; - ModAPI.hooks ||= {}; - ModAPI.hooks.freezeCallstack = false; - ModAPI.hooks._rippedData ||= []; - ModAPI.hooks._rippedInterfaceMap ||= {}; - ModAPI.hooks._teavm ||= {}; - ModAPI.hooks._rippedConstructors ||= {}; - ModAPI.hooks._rippedInternalConstructors ||= {}; - ModAPI.hooks.methods ||= {}; - ModAPI.hooks._rippedMethodTypeMap ||= {}; - ModAPI.hooks._postInit ||= ()=>{}; - ModAPI.hooks._rippedStaticProperties ||= {}; - ModAPI.hooks._rippedStaticIndexer ||= {}; - `; - var freezeCallstack = `if(ModAPI.hooks.freezeCallstack){return false};`; - - - - - - - - + + + + + + + + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..9200436 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,475 @@ +{ + "name": "eaglerforgeinjector", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "eaglerforgeinjector", + "version": "0.0.0", + "license": "MIT", + "dependencies": { + "@babel/core": "^7.26.10" + }, + "devDependencies": { + "@xmldom/xmldom": "^0.9.8" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", + "dependencies": { + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", + "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", + "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.10", + "@babel/helper-compilation-targets": "^7.26.5", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.10", + "@babel/parser": "^7.26.10", + "@babel/template": "^7.26.9", + "@babel/traverse": "^7.26.10", + "@babel/types": "^7.26.10", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.27.0.tgz", + "integrity": "sha512-VybsKvpiN1gU1sdMZIp7FcqphVVKEwcuj02x73uvcHE0PTihx1nlBcowYWhDwjpoAXRv43+gDzyggGnn1XZhVw==", + "dependencies": { + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.0.tgz", + "integrity": "sha512-LVk7fbXml0H2xH34dFzKQ7TDZ2G4/rVTOrq9V+icbbadjbVxxeFeDsNHv2SrZeWoA+6ZiTyWYWtScEIW07EAcA==", + "dependencies": { + "@babel/compat-data": "^7.26.8", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", + "dependencies": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.0.tgz", + "integrity": "sha512-U5eyP/CTFPuNE3qk+WZMxFkp/4zUzdceQlfzf7DdGdhp+Fezd7HD+i8Y24ZuTMKX3wQBld449jijbGq6OdGNQg==", + "dependencies": { + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz", + "integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==", + "dependencies": { + "@babel/types": "^7.27.0" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/template": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.0.tgz", + "integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.27.0.tgz", + "integrity": "sha512-19lYZFzYVQkkHkl4Cy4WrAVcqBkgvV2YM2TU3xG6DIwO7O3ecbDPfW3yM3bjAGcqcQHi+CCtjMR3dIEHxsd6bA==", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.27.0", + "@babel/parser": "^7.27.0", + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz", + "integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==", + "dependencies": { + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@xmldom/xmldom": { + "version": "0.9.8", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.8.tgz", + "integrity": "sha512-p96FSY54r+WJ50FIOsCOjyj/wavs8921hG5+kVMmZgKcvIKxMXHTrjNJvRgWa/zuX3B6t2lijLNFaOyuxUH+2A==", + "dev": true, + "engines": { + "node": ">=14.6" + } + }, + "node_modules/browserslist": { + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.1" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001713", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001713.tgz", + "integrity": "sha512-wCIWIg+A4Xr7NfhTuHdX+/FKh3+Op3LBbSp2N5Pfx6T/LhdQy3GTyoTg48BReaW/MyMNZAkTadsBtai3ldWK0Q==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" + }, + "node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.136", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.136.tgz", + "integrity": "sha512-kL4+wUTD7RSA5FHx5YwWtjDnEEkIIikFgWHR4P6fqjw1PPLlqYkxeOb++wAauAssat0YClCy8Y3C5SxgSkjibQ==" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/node-releases": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..b5f9759 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "eaglerforgeinjector", + "version": "0.0.0", + "description": "Advanced modding API injector for unminified, unobfuscated, unsigned eaglercraft builds.", + "main": "node.js", + "directories": { + "doc": "docs" + }, + "scripts": { + "efi": "node --max-old-space-size=16384 cli.js" + }, + "author": "EaglerForge Team", + "license": "MIT", + "devDependencies": { + "@xmldom/xmldom": "^0.9.8" + }, + "dependencies": { + "@babel/core": "^7.26.10" + } +} From 1bd9f324bd0efeb10eccdeb001891304af2f5506 Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Fri, 11 Apr 2025 20:43:03 +0800 Subject: [PATCH 8/8] add cli.js readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 4c3ef81..5a0f60c 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,12 @@ Go to https://eaglerforge.github.io/EaglerForgeInjector/ and upload an unminifie #### Portable Offline Download this repository as a .zip, and extract it. Open index.html with your preferred browser (use `ctrl` + `O` on a new tab) and upload an unminified, unobfuscated, unsigned EaglercraftX offline download. +#### Offline CLI +- Clone the repository and run `npm ci` to install the required libraries. +- In the project directory, run `npm run efi /help` for use instructions. +- This is good for bypassing browser memory limitations, for minifying. +- Yes, I am forcing DOS command syntax upon you + #### How does it work? This tool matches patterns in eaglercraft builds and adds patching code to let you modify how the code works at runtime. It then adds a [corelib](./postinit.js) that initialises the `ModAPI` object.