diff --git a/dist/engine.bundle.js b/dist/engine.bundle.js index 7a9a3f654..d9ce18a31 100644 --- a/dist/engine.bundle.js +++ b/dist/engine.bundle.js @@ -63615,7 +63615,6 @@ function isnan (val) { __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeScriptBlob", function() { return makeScriptBlob; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "executeJSScript", function() { return executeJSScript; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConstructModule", function() { return ConstructModule; }); /* harmony import */ var _NetscriptJSPreamble_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NetscriptJSPreamble.js */ 128); /* harmony import */ var _NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NetscriptEvaluator.js */ 7); @@ -63661,13 +63660,7 @@ async function executeJSScript(script, scripts = [], workerScript) { throw Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_1__["makeRuntimeRejectMsg"])(script.filename + " did not have a main function, cannot run it."); } - console.log("loadedModule:"); - console.log(loadedModule); - let constructedModule = await ConstructModule(loadedModule, ns); - constructedModule = await constructedModule(); - console.log("constructedModule: "); - console.log(constructedModule); - return constructedModule.main(); + return loadedModule.main(ns); } finally { // Revoke the generated URLs if (urlStack != null) { @@ -63676,26 +63669,6 @@ async function executeJSScript(script, scripts = [], workerScript) { }; } -function ConstructModule(module, ns) { - function mod() { - /* - for (var fn in ns) { - let fooName = fn.toString(); - var evalStatement = "var " + fooName + " = ns[\"" + fooName + "\"];" - console.log(evalStatement); - eval(evalStatement); - console.log(ns[fooName]); - console.log("Setting " + fooName + " in ConstructModule()"); - console.log(fooName); - console.log(" "); - }*/ - var newModule = Object.create(module); - newModule.tprint = ns.tprint; - return newModule; - } - return mod; -} - // Gets a stack of blob urls, the top/right-most element being // the blob url for the named script on the named server. // @@ -63739,6 +63712,7 @@ function _getScriptUrls(script, scripts, seen) { return [prefix, urls[urls.length - 1], suffix].join(''); }); + // If we successfully transformed the code, create a blob url for it and // push that URL onto the top of the stack. urlStack.push(URL.createObjectURL(makeScriptBlob(transformedCode))); diff --git a/dist/tests.bundle.js b/dist/tests.bundle.js index d19308951..c0fa4d09e 100644 --- a/dist/tests.bundle.js +++ b/dist/tests.bundle.js @@ -63656,7 +63656,6 @@ module.exports = function flag(obj, key, value) { __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeScriptBlob", function() { return makeScriptBlob; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "executeJSScript", function() { return executeJSScript; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConstructModule", function() { return ConstructModule; }); /* harmony import */ var _NetscriptJSPreamble_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NetscriptJSPreamble.js */ 128); /* harmony import */ var _NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NetscriptEvaluator.js */ 7); @@ -63702,13 +63701,7 @@ async function executeJSScript(script, scripts = [], workerScript) { throw Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_1__["makeRuntimeRejectMsg"])(script.filename + " did not have a main function, cannot run it."); } - console.log("loadedModule:"); - console.log(loadedModule); - let constructedModule = await ConstructModule(loadedModule, ns); - constructedModule = await constructedModule(); - console.log("constructedModule: "); - console.log(constructedModule); - return constructedModule.main(); + return loadedModule.main(ns); } finally { // Revoke the generated URLs if (urlStack != null) { @@ -63717,26 +63710,6 @@ async function executeJSScript(script, scripts = [], workerScript) { }; } -function ConstructModule(module, ns) { - function mod() { - /* - for (var fn in ns) { - let fooName = fn.toString(); - var evalStatement = "var " + fooName + " = ns[\"" + fooName + "\"];" - console.log(evalStatement); - eval(evalStatement); - console.log(ns[fooName]); - console.log("Setting " + fooName + " in ConstructModule()"); - console.log(fooName); - console.log(" "); - }*/ - var newModule = Object.create(module); - newModule.tprint = ns.tprint; - return newModule; - } - return mod; -} - // Gets a stack of blob urls, the top/right-most element being // the blob url for the named script on the named server. // @@ -63780,6 +63753,7 @@ function _getScriptUrls(script, scripts, seen) { return [prefix, urls[urls.length - 1], suffix].join(''); }); + // If we successfully transformed the code, create a blob url for it and // push that URL onto the top of the stack. urlStack.push(URL.createObjectURL(makeScriptBlob(transformedCode))); diff --git a/src/NetscriptJSEvaluator.js b/src/NetscriptJSEvaluator.js index 8533b8c30..413b10fbe 100644 --- a/src/NetscriptJSEvaluator.js +++ b/src/NetscriptJSEvaluator.js @@ -41,13 +41,7 @@ export async function executeJSScript(script, scripts = [], workerScript) { throw makeRuntimeRejectMsg(script.filename + " did not have a main function, cannot run it."); } - console.log("loadedModule:"); - console.log(loadedModule); - let constructedModule = await ConstructModule(loadedModule, ns); - constructedModule = await constructedModule(); - console.log("constructedModule: "); - console.log(constructedModule); - return constructedModule.main(); + return loadedModule.main(ns); } finally { // Revoke the generated URLs if (urlStack != null) { @@ -56,26 +50,6 @@ export async function executeJSScript(script, scripts = [], workerScript) { }; } -export function ConstructModule(module, ns) { - function mod() { - /* - for (var fn in ns) { - let fooName = fn.toString(); - var evalStatement = "var " + fooName + " = ns[\"" + fooName + "\"];" - console.log(evalStatement); - eval(evalStatement); - console.log(ns[fooName]); - console.log("Setting " + fooName + " in ConstructModule()"); - console.log(fooName); - console.log(" "); - }*/ - var newModule = Object.create(module); - newModule.tprint = ns.tprint; - return newModule; - } - return mod; -} - // Gets a stack of blob urls, the top/right-most element being // the blob url for the named script on the named server. // @@ -119,6 +93,7 @@ function _getScriptUrls(script, scripts, seen) { return [prefix, urls[urls.length - 1], suffix].join(''); }); + // If we successfully transformed the code, create a blob url for it and // push that URL onto the top of the stack. urlStack.push(URL.createObjectURL(makeScriptBlob(transformedCode)));