UNPKG

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