@@ -6,26 +6,29 @@ const path = require('path');
66const util = require ( 'util' ) ;
77const fs = require ( 'fs' ) ;
88
9- /* Require the JavaScript parser */
9+ // Require the JavaScript parser
1010const espree = require ( path . join ( __dirname , 'node_modules' , 'espree' ) ) ;
1111
1212const node_require = Module . prototype . require ;
1313const node_resolve = require . resolve ;
1414const node_cache = require . cache ;
1515
16- /* Store in the module prototype the original functions for future use in derived loaders like TypeScript */
16+ // Store in the module prototype the original functions for future use in derived loaders like TypeScript
1717Module . prototype . node_require = node_require ;
1818Module . prototype . node_resolve = node_resolve ;
1919Module . prototype . node_cache = node_cache ;
2020
2121function node_loader_trampoline_initialize ( loader_library_path ) {
22+ // Restore the argv (this is used for tricking node::Start method)
23+ process . argv = [ process . argv [ 0 ] ] ;
24+
2225 // Add current execution directory to the execution paths
2326 node_loader_trampoline_execution_path ( process . cwd ( ) ) ;
2427
2528 const paths = [
26- /* Local version of MetaCall NodeJS Port */
29+ // Local version of MetaCall NodeJS Port
2730 'metacall' ,
28- /* Optionally, use loader library path for global installed NodeJS Port */
31+ // Optionally, use loader library path for global installed NodeJS Port
2932 ...loader_library_path ? [ path . join ( loader_library_path , 'node_modules' , 'metacall' , 'index.js' ) ] : [ ] ,
3033 ] ;
3134
@@ -333,7 +336,7 @@ function node_loader_trampoline_discover(handle) {
333336}
334337
335338function node_loader_trampoline_test ( obj ) {
336- /* Imporant: never trigger an async resource in this function */
339+ // Imporant: never trigger an async resource in this function
337340 if ( obj !== undefined ) {
338341 fs . writeSync ( process . stdout . fd , `${ util . inspect ( obj , false , null , true ) } \n` ) ;
339342 }
@@ -411,7 +414,7 @@ module.exports = ((impl, ptr) => {
411414 throw new Error ( 'Process arguments (process.argv[2], process.argv[3]) not defined.' ) ;
412415 }
413416
414- /* Get trampoline from list of linked bindings */
417+ // Get trampoline from list of linked bindings
415418 const trampoline = process . _linkedBinding ( 'node_loader_trampoline_module' ) ;
416419
417420 const node_loader_ptr = trampoline . register ( impl , ptr , {
0 commit comments