UNPKG

1.74 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 /**
11 * @experimental
12 */
13 function findSourceMap(path: string, error?: Error): SourceMap;
14 interface SourceMapPayload {
15 file: string;
16 version: number;
17 sources: string[];
18 sourcesContent: string[];
19 names: string[];
20 mappings: string;
21 sourceRoot: string;
22 }
23
24 interface SourceMapping {
25 generatedLine: number;
26 generatedColumn: number;
27 originalSource: string;
28 originalLine: number;
29 originalColumn: number;
30 }
31
32 /**
33 * @experimental
34 */
35 class SourceMap {
36 readonly payload: SourceMapPayload;
37 constructor(payload: SourceMapPayload);
38 findEntry(line: number, column: number): SourceMapping;
39 }
40 }
41 interface Module extends NodeModule {}
42 class Module {
43 static runMain(): void;
44 static wrap(code: string): string;
45
46 /**
47 * @deprecated Deprecated since: v12.2.0. Please use createRequire() instead.
48 */
49 static createRequireFromPath(path: string): NodeRequire;
50 static createRequire(path: string | URL): NodeRequire;
51 static builtinModules: string[];
52
53 static Module: typeof Module;
54
55 constructor(id: string, parent?: Module);
56 }
57 export = Module;
58}