Add process.mainModule, improve NodeModule (#12257)

* Add process.mainModule, improve NodeModule

Add mainModule in process. See https://nodejs.org/dist/latest-v6.x/docs/api/process.html#process_process_mainmodule

improve require.main see https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_accessing_the_main_module

improve NodeModule see https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_module_children and https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_module_parent

* Correct require.main and NodeModule
This commit is contained in:
Flarna
2016-10-28 16:13:14 +02:00
committed by Masahiro Wakame
parent 94bd397fda
commit 45c5bcd854
4 changed files with 42 additions and 6 deletions

7
node/node-4.d.ts vendored
View File

@@ -52,7 +52,7 @@ interface NodeRequire extends NodeRequireFunction {
resolve(id:string): string;
cache: any;
extensions: any;
main: any;
main: NodeModule;
}
declare var require: NodeRequire;
@@ -63,8 +63,8 @@ interface NodeModule {
id: string;
filename: string;
loaded: boolean;
parent: any;
children: any[];
parent: NodeModule;
children: NodeModule[];
}
declare var module: NodeModule;
@@ -339,6 +339,7 @@ declare namespace NodeJS {
title: string;
arch: string;
platform: string;
mainModule?: NodeModule;
memoryUsage(): MemoryUsage;
nextTick(callback: Function): void;
umask(mask?: number): number;