Closed prepare closed 4 years ago
... about line about line 603
function tryModuleLoad(module, filename) {
var threw = true;
try {
module.load(filename);
threw = false;
} finally {
if (threw) {
delete Module._cache[filename];
}
}
}
Module._resolveFilename = function(request, parent, isMain, options) {
if (NativeModule.canBeRequiredByUsers(request)) {
return request;
}
////////////////////////////////////////////
//#espresso, #4
if (request.endsWith(".espr")) {
return request;
}
////////////////////////////////////////////
var paths;
patch4: lib/internal/modules/cjs/loader.js
... about line about line 797
// Native extension for .node
Module._extensions['.node'] = function(module, filename) {
if (manifest) {
const content = fs.readFileSync(filename);
const moduleURL = pathToFileURL(filename);
manifest.assertIntegrity(moduleURL, content);
}
// Be aware this doesn't use `content`
return process.dlopen(module, path.toNamespacedPath(filename));
};
//////////////////////////////////
//#espresso, #5
Module.external_loader= LibEspresso;
Module._extensions['.espr'] = function (module, filename) {
//this make node to callback to our module
var content = Module.external_loader.LoadMainSrcFile();
module._compile(stripBOM(content), filename);
};
//////////////////////////////////
if (experimentalModules) {
if (asyncESM === undefined) lazyLoadESM();
Module._extensions['.mjs'] = function(module, filename) {
throw new ERR_REQUIRE_ESM(filename);
};
}
patch5: lib/internal/modules/cjs/loader.js
Espresso-ND based on NodeJS 11.12.0, there are 5 patches
Espresso-VE based on v8 from NodeJS 11.12.0
to build release mode of the 'VE' version for 32 bits on Windows, one should build it with x64_x86 CrossTools command promt
eg ...
msbuild libespresso.vcxproj /p:Configuration=Release
Bridge your C# soul to the power of Javascript (V8 Javascript Engine / NodeJs)
Patches for NodeJS 11.12.0
patches are located here => Espresso\node_patches\node11.12.0_modified
... about line 116
patch 1: src/node.cc
... about line 778
patch2: src/node.cc
about line 856
patch3: src/node.cc