UNPKG

1.64 kBTypeScriptView Raw
1declare module 'module' {
2 import { URL } from 'url';
3 namespace Module {
4 /**
5 * Updates all the live bindings for builtin ES Modules to match the properties of the CommonJS exports.
6 * It does not add or remove exported names from the ES Modules.
7 */
8 function syncBuiltinESMExports(): void;
9
10 function findSourceMap(path: string, error?: Error): SourceMap;
11 interface SourceMapPayload {
12 file: string;
13 version: number;
14 sources: string[];
15 sourcesContent: string[];
16 names: string[];
17 mappings: string;
18 sourceRoot: string;
19 }
20
21 interface SourceMapping {
22 generatedLine: number;
23 generatedColumn: number;
24 originalSource: string;
25 originalLine: number;
26 originalColumn: number;
27 }
28
29 class SourceMap {
30 readonly payload: SourceMapPayload;
31 constructor(payload: SourceMapPayload);
32 findEntry(line: number, column: number): SourceMapping;
33 }
34 }
35 interface Module extends NodeModule {}
36 class Module {
37 static runMain(): void;
38 static wrap(code: string): string;
39
40 /**
41 * @deprecated Deprecated since: v12.2.0. Please use createRequire() instead.
42 */
43 static createRequireFromPath(path: string): NodeRequire;
44 static createRequire(path: string | URL): NodeRequire;
45 static builtinModules: string[];
46
47 static Module: typeof Module;
48
49 constructor(id: string, parent?: Module);
50 }
51 export = Module;
52}