@@ -42,54 +42,13 @@ const requireFilesystemModule = (id: string, builtInExtensionsDir: string): any
4242 return customMod . require ( id ) ;
4343} ;
4444
45- /**
46- * Called from forking a module
47- */
48- export const requireFork = ( modulePath : string , args : string [ ] , builtInExtensionsDir : string ) : void => {
49- const Module = require ( "module" ) as typeof import ( "module" ) ;
50- const oldRequire = Module . prototype . require ;
51- // tslint:disable-next-line:no-any
52- const oldLoad = ( Module as any ) . _findPath ;
53- // @ts -ignore
54- ( Module as any ) . _findPath = function ( request , parent , isMain ) : any {
55- const lookupPaths = oldLoad . call ( this , request , parent , isMain ) ;
56-
57- return lookupPaths ;
58- } ;
59- // tslint:disable-next-line:no-any
60- Module . prototype . require = function ( id : string ) : any {
61- if ( id === "typescript" ) {
62- return require ( "typescript" ) ;
63- }
64-
65- // tslint:disable-next-line:no-any
66- return oldRequire . call ( this , id as any ) ;
67- } ;
68-
69- if ( ! process . send ) {
70- throw new Error ( "No IPC messaging initialized" ) ;
71- }
72-
73- process . argv = [ "" , "" , ...args ] ;
74- requireFilesystemModule ( modulePath , builtInExtensionsDir ) ;
75-
76- if ( ipcMsgBuffer && ipcMsgListener ) {
77- process . removeListener ( "message" , ipcMsgListener ) ;
78- // tslint:disable-next-line:no-any
79- ipcMsgBuffer . forEach ( ( i ) => process . emit ( "message" as any , i as any ) ) ;
80- ipcMsgBuffer = undefined ;
81- ipcMsgListener = undefined ;
82- }
83- } ;
84-
85- export const requireModule = ( modulePath : string , dataDir : string , builtInExtensionsDir : string ) : void => {
45+ export const requireModule = ( modulePath : string , builtInExtensionsDir : string ) : void => {
8646 process . env . AMD_ENTRYPOINT = modulePath ;
8747 const xml = require ( "xhr2" ) ;
8848 xml . XMLHttpRequest . prototype . _restrictedHeaders [ "user-agent" ] = false ;
8949 // tslint:disable-next-line no-any this makes installing extensions work.
9050 ( global as any ) . XMLHttpRequest = xml . XMLHttpRequest ;
9151
92- const mod = require ( "module" ) as typeof import ( "module" ) ;
9352 const promiseFinally = require ( "promise.prototype.finally" ) as { shim : ( ) => void } ;
9453 promiseFinally . shim ( ) ;
9554 /**
@@ -102,16 +61,7 @@ export const requireModule = (modulePath: string, dataDir: string, builtInExtens
10261 } ;
10362
10463 if ( isCli ) {
105- /**
106- * Needed for properly forking external modules within the CLI
107- */
108- // tslint:disable-next-line:no-any
109- ( < any > cp ) . fork = ( modulePath : string , args : ReadonlyArray < string > = [ ] , options ?: cp . ForkOptions ) : cp . ChildProcess => {
110- return cp . spawn ( process . execPath , [ path . join ( buildDir , "out" , "cli.js" ) , "--fork" , modulePath , "--extra-args" , JSON . stringify ( args ) , "--data-dir" , dataDir ] , {
111- ...options ,
112- stdio : [ null , null , null , "ipc" ] ,
113- } ) ;
114- } ;
64+ process . env . NBIN_BYPASS = "true" ;
11565 }
11666
11767 const baseDir = path . join ( buildDir , "build" ) ;
0 commit comments