@types/node 16.4.2 → 16.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/module.d.ts CHANGED
@@ -1,12 +1,50 @@
1
+ /**
2
+ * @since v0.3.7
3
+ */
1
4
  declare module 'module' {
2
5
  import { URL } from 'node:url';
3
6
  namespace Module {
4
7
  /**
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.
8
+ * The `module.syncBuiltinESMExports()` method updates all the live bindings for
9
+ * builtin `ES Modules` to match the properties of the `CommonJS` exports. It
10
+ * does not add or remove exported names from the `ES Modules`.
11
+ *
12
+ * ```js
13
+ * const fs = require('fs');
14
+ * const assert = require('assert');
15
+ * const { syncBuiltinESMExports } = require('module');
16
+ *
17
+ * fs.readFile = newAPI;
18
+ *
19
+ * delete fs.readFileSync;
20
+ *
21
+ * function newAPI() {
22
+ * // ...
23
+ * }
24
+ *
25
+ * fs.newAPI = newAPI;
26
+ *
27
+ * syncBuiltinESMExports();
28
+ *
29
+ * import('fs').then((esmFS) => {
30
+ * // It syncs the existing readFile property with the new value
31
+ * assert.strictEqual(esmFS.readFile, newAPI);
32
+ * // readFileSync has been deleted from the required fs
33
+ * assert.strictEqual('readFileSync' in fs, false);
34
+ * // syncBuiltinESMExports() does not remove readFileSync from esmFS
35
+ * assert.strictEqual('readFileSync' in esmFS, true);
36
+ * // syncBuiltinESMExports() does not add names
37
+ * assert.strictEqual(esmFS.newAPI, undefined);
38
+ * });
39
+ * ```
40
+ * @since v12.12.0
7
41
  */
8
42
  function syncBuiltinESMExports(): void;
9
-
43
+ /**
44
+ * `path` is the resolved path for the file for which a corresponding source map
45
+ * should be fetched.
46
+ * @since v13.7.0, v12.17.0
47
+ */
10
48
  function findSourceMap(path: string, error?: Error): SourceMap;
11
49
  interface SourceMapPayload {
12
50
  file: string;
@@ -17,7 +55,6 @@ declare module 'module' {
17
55
  mappings: string;
18
56
  sourceRoot: string;
19
57
  }
20
-
21
58
  interface SourceMapping {
22
59
  generatedLine: number;
23
60
  generatedColumn: number;
@@ -25,10 +62,17 @@ declare module 'module' {
25
62
  originalLine: number;
26
63
  originalColumn: number;
27
64
  }
28
-
65
+ /**
66
+ * @since v13.7.0, v12.17.0
67
+ */
29
68
  class SourceMap {
30
69
  readonly payload: SourceMapPayload;
31
70
  constructor(payload: SourceMapPayload);
71
+ /**
72
+ * Given a line number and column number in the generated source file, returns
73
+ * an object representing the position in the original file. The object returned
74
+ * consists of the following keys:
75
+ */
32
76
  findEntry(line: number, column: number): SourceMapping;
33
77
  }
34
78
  }
@@ -36,15 +80,11 @@ declare module 'module' {
36
80
  class Module {
37
81
  static runMain(): void;
38
82
  static wrap(code: string): string;
39
-
40
83
  static createRequire(path: string | URL): NodeRequire;
41
84
  static builtinModules: string[];
42
-
43
85
  static Module: typeof Module;
44
-
45
86
  constructor(id: string, parent?: Module);
46
87
  }
47
-
48
88
  global {
49
89
  interface ImportMeta {
50
90
  url: string;
@@ -63,10 +103,8 @@ declare module 'module' {
63
103
  resolve?(specified: string, parent?: string | URL): Promise<string>;
64
104
  }
65
105
  }
66
-
67
106
  export = Module;
68
107
  }
69
-
70
108
  declare module 'node:module' {
71
109
  import module = require('module');
72
110
  export = module;