Change rom-patcher-js to not use patch-package

This commit is contained in:
Jared Schoeny 2025-12-10 01:28:09 -10:00
parent 8cc0160b41
commit e6de329a32
3 changed files with 3 additions and 69 deletions

4
package-lock.json generated
View File

@ -30,7 +30,7 @@
"react-markdown": "^10",
"rehype-slug": "^6.0.0",
"remark-gfm": "4.0.0",
"rom-patcher-js": "github:marcrobledo/RomPatcher.js#91e522e247f709e894761157ccba3189004d0859",
"rom-patcher-js": "github:Hackdex-App/RomPatcher.js",
"schema-dts": "^1.1.5",
"serialize-javascript": "^7.0.0"
},
@ -6388,7 +6388,7 @@
"node_modules/rom-patcher-js": {
"name": "rom-patcher",
"version": "3.0.0",
"resolved": "git+ssh://git@github.com/marcrobledo/RomPatcher.js.git#91e522e247f709e894761157ccba3189004d0859",
"resolved": "git+ssh://git@github.com/Hackdex-App/RomPatcher.js.git#869d22db643c1d188ec7fe3d33d119f1520e3488",
"license": "MIT",
"dependencies": {
"chalk": "4.1.2",

View File

@ -31,7 +31,7 @@
"react-markdown": "^10",
"rehype-slug": "^6.0.0",
"remark-gfm": "4.0.0",
"rom-patcher-js": "github:marcrobledo/RomPatcher.js#91e522e247f709e894761157ccba3189004d0859",
"rom-patcher-js": "github:Hackdex-App/RomPatcher.js",
"schema-dts": "^1.1.5",
"serialize-javascript": "^7.0.0"
},

View File

@ -1,66 +0,0 @@
diff --git a/node_modules/rom-patcher-js/rom-patcher-js/modules/BinFile.js b/node_modules/rom-patcher-js/rom-patcher-js/modules/BinFile.js
index 5a8a855..2bc9838 100644
--- a/node_modules/rom-patcher-js/rom-patcher-js/modules/BinFile.js
+++ b/node_modules/rom-patcher-js/rom-patcher-js/modules/BinFile.js
@@ -29,6 +29,18 @@
* SOFTWARE.
*/
+/* ensure BinFile is available in this module (browser or node bundlers) */
+if (typeof HashCalculator === 'undefined') {
+ try {
+ // eslint-disable-next-line
+ var HashCalculator = require('./HashCalculator');
+ } catch (_e) {
+ if (typeof window !== 'undefined' && window.HashCalculator) {
+ // eslint-disable-next-line
+ var HashCalculator = window.HashCalculator;
+ }
+ }
+}
function BinFile(source, onLoad) {
@@ -475,9 +487,14 @@ BinFile.prototype.hashCRC16 = function (start, len) {
-if (BinFile.RUNTIME_ENVIROMENT === 'node' && typeof module !== 'undefined' && module.exports) {
- module.exports = BinFile;
- HashCalculator = require('./HashCalculator');
- nodePath = require('path');
- nodeFs = require('fs');
+if (typeof module !== 'undefined' && module.exports) {
+ module.exports = BinFile;
+ try {
+ var __req = eval('require');
+ HashCalculator = __req('./HashCalculator');
+ nodePath = __req('path');
+ nodeFs = __req('fs');
+ } catch (_e) {
+ // ignore when bundling for browser
+ }
}
diff --git a/node_modules/rom-patcher-js/rom-patcher-js/modules/RomPatcher.format.bps.js b/node_modules/rom-patcher-js/rom-patcher-js/modules/RomPatcher.format.bps.js
index b2e8266..28eee25 100644
--- a/node_modules/rom-patcher-js/rom-patcher-js/modules/RomPatcher.format.bps.js
+++ b/node_modules/rom-patcher-js/rom-patcher-js/modules/RomPatcher.format.bps.js
@@ -6,6 +6,18 @@ const BPS_ACTION_SOURCE_READ=0;
const BPS_ACTION_TARGET_READ=1;
const BPS_ACTION_SOURCE_COPY=2;
const BPS_ACTION_TARGET_COPY=3;
+/* ensure BinFile is available in this module (browser or node bundlers) */
+if (typeof BinFile === 'undefined') {
+ try {
+ // eslint-disable-next-line
+ var BinFile = require('./BinFile');
+ } catch (_e) {
+ if (typeof window !== 'undefined' && window.BinFile) {
+ // eslint-disable-next-line
+ var BinFile = window.BinFile;
+ }
+ }
+}
if(typeof module !== "undefined" && module.exports){
module.exports = BPS;
}