@aligent/cdk-prerender-proxy 0.2.4 → 0.2.5-beta

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.
Files changed (150) hide show
  1. package/lib/handlers/cache-control.ts +7 -20
  2. package/lib/handlers/error-response.ts +8 -51
  3. package/lib/handlers/node_modules/.package-lock.json +32 -3
  4. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/index.d.ts +6 -0
  5. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/index.js +14 -0
  6. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/cache-control.d.ts +3 -0
  7. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/cache-control.js +24 -0
  8. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/error-response.d.ts +3 -0
  9. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/error-response.js +50 -0
  10. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender-check.d.ts +3 -0
  11. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender-check.js +28 -0
  12. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender.d.ts +3 -0
  13. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender.js +49 -0
  14. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/redirect.d.ts +3 -0
  15. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/redirect.js +33 -0
  16. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/package.json +27 -0
  17. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/tsconfig.json +3 -0
  18. package/lib/handlers/node_modules/@middy/core/LICENSE +21 -0
  19. package/lib/handlers/node_modules/@middy/core/README.md +65 -0
  20. package/lib/handlers/node_modules/@middy/core/index.cjs +207 -0
  21. package/lib/handlers/node_modules/@middy/core/index.d.ts +91 -0
  22. package/lib/handlers/node_modules/@middy/core/index.js +199 -0
  23. package/lib/handlers/node_modules/@middy/core/package.json +65 -0
  24. package/lib/handlers/node_modules/@types/node/README.md +4 -4
  25. package/lib/handlers/node_modules/@types/node/assert/strict.d.ts +5 -1
  26. package/lib/handlers/node_modules/@types/node/assert.d.ts +904 -67
  27. package/lib/handlers/node_modules/@types/node/async_hooks.d.ts +371 -96
  28. package/lib/handlers/node_modules/@types/node/buffer.d.ts +2199 -25
  29. package/lib/handlers/node_modules/@types/node/child_process.d.ts +1151 -308
  30. package/lib/handlers/node_modules/@types/node/cluster.d.ts +356 -208
  31. package/lib/handlers/node_modules/@types/node/console.d.ts +324 -45
  32. package/lib/handlers/node_modules/@types/node/constants.d.ts +8 -3
  33. package/lib/handlers/node_modules/@types/node/crypto.d.ts +3230 -846
  34. package/lib/handlers/node_modules/@types/node/dgram.d.ts +478 -74
  35. package/lib/handlers/node_modules/@types/node/diagnostics_channel.d.ts +153 -0
  36. package/lib/handlers/node_modules/@types/node/dns/promises.d.ts +308 -35
  37. package/lib/handlers/node_modules/@types/node/dns.d.ts +444 -107
  38. package/lib/handlers/node_modules/@types/node/dom-events.d.ts +126 -0
  39. package/lib/handlers/node_modules/@types/node/domain.d.ts +162 -16
  40. package/lib/handlers/node_modules/@types/node/events.d.ts +624 -39
  41. package/lib/handlers/node_modules/@types/node/fs/promises.d.ts +911 -365
  42. package/lib/handlers/node_modules/@types/node/fs.d.ts +2611 -978
  43. package/lib/handlers/node_modules/@types/node/globals.d.ts +66 -421
  44. package/lib/handlers/node_modules/@types/node/globals.global.d.ts +1 -1
  45. package/lib/handlers/node_modules/@types/node/http.d.ts +1416 -199
  46. package/lib/handlers/node_modules/@types/node/http2.d.ts +1688 -530
  47. package/lib/handlers/node_modules/@types/node/https.d.ts +532 -26
  48. package/lib/handlers/node_modules/@types/node/index.d.ts +92 -16
  49. package/lib/handlers/node_modules/@types/node/inspector.d.ts +511 -811
  50. package/lib/handlers/node_modules/@types/node/module.d.ts +75 -13
  51. package/lib/handlers/node_modules/@types/node/net.d.ts +710 -167
  52. package/lib/handlers/node_modules/@types/node/os.d.ts +252 -25
  53. package/lib/handlers/node_modules/@types/node/package.json +30 -25
  54. package/lib/handlers/node_modules/@types/node/path.d.ts +59 -31
  55. package/lib/handlers/node_modules/@types/node/perf_hooks.d.ts +420 -105
  56. package/lib/handlers/node_modules/@types/node/process.d.ts +1249 -228
  57. package/lib/handlers/node_modules/@types/node/punycode.d.ts +67 -25
  58. package/lib/handlers/node_modules/@types/node/querystring.d.ts +113 -10
  59. package/lib/handlers/node_modules/@types/node/readline/promises.d.ts +143 -0
  60. package/lib/handlers/node_modules/@types/node/readline.d.ts +570 -109
  61. package/lib/handlers/node_modules/@types/node/repl.d.ts +154 -125
  62. package/lib/handlers/node_modules/@types/node/stream/consumers.d.ts +12 -0
  63. package/lib/handlers/node_modules/@types/node/stream/promises.d.ts +18 -43
  64. package/lib/handlers/node_modules/@types/node/stream/web.d.ts +330 -0
  65. package/lib/handlers/node_modules/@types/node/stream.d.ts +1117 -248
  66. package/lib/handlers/node_modules/@types/node/string_decoder.d.ts +60 -0
  67. package/lib/handlers/node_modules/@types/node/test.d.ts +446 -0
  68. package/lib/handlers/node_modules/@types/node/timers/promises.d.ts +81 -9
  69. package/lib/handlers/node_modules/@types/node/timers.d.ts +84 -17
  70. package/lib/handlers/node_modules/@types/node/tls.d.ts +510 -275
  71. package/lib/handlers/node_modules/@types/node/trace_events.d.ts +120 -10
  72. package/lib/handlers/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  73. package/lib/handlers/node_modules/@types/node/ts4.8/assert.d.ts +961 -0
  74. package/lib/handlers/node_modules/@types/node/ts4.8/async_hooks.d.ts +501 -0
  75. package/lib/handlers/node_modules/@types/node/ts4.8/buffer.d.ts +2259 -0
  76. package/lib/handlers/node_modules/@types/node/ts4.8/child_process.d.ts +1369 -0
  77. package/lib/handlers/node_modules/@types/node/ts4.8/cluster.d.ts +410 -0
  78. package/lib/handlers/node_modules/@types/node/ts4.8/console.d.ts +412 -0
  79. package/lib/handlers/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
  80. package/lib/handlers/node_modules/@types/node/ts4.8/crypto.d.ts +3964 -0
  81. package/lib/handlers/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
  82. package/lib/handlers/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +153 -0
  83. package/lib/handlers/node_modules/@types/node/ts4.8/dns/promises.d.ts +370 -0
  84. package/lib/handlers/node_modules/@types/node/ts4.8/dns.d.ts +659 -0
  85. package/lib/handlers/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
  86. package/lib/handlers/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  87. package/lib/handlers/node_modules/@types/node/ts4.8/events.d.ts +678 -0
  88. package/lib/handlers/node_modules/@types/node/ts4.8/fs/promises.d.ts +1138 -0
  89. package/lib/handlers/node_modules/@types/node/ts4.8/fs.d.ts +3872 -0
  90. package/lib/handlers/node_modules/@types/node/ts4.8/globals.d.ts +294 -0
  91. package/lib/handlers/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  92. package/lib/handlers/node_modules/@types/node/ts4.8/http.d.ts +1651 -0
  93. package/lib/handlers/node_modules/@types/node/ts4.8/http2.d.ts +2134 -0
  94. package/lib/handlers/node_modules/@types/node/ts4.8/https.d.ts +542 -0
  95. package/lib/handlers/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  96. package/lib/handlers/node_modules/@types/node/ts4.8/inspector.d.ts +2741 -0
  97. package/lib/handlers/node_modules/@types/node/ts4.8/module.d.ts +114 -0
  98. package/lib/handlers/node_modules/@types/node/ts4.8/net.d.ts +869 -0
  99. package/lib/handlers/node_modules/@types/node/ts4.8/os.d.ts +466 -0
  100. package/lib/handlers/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  101. package/lib/handlers/node_modules/@types/node/ts4.8/perf_hooks.d.ts +625 -0
  102. package/lib/handlers/node_modules/@types/node/ts4.8/process.d.ts +1482 -0
  103. package/lib/handlers/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  104. package/lib/handlers/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
  105. package/lib/handlers/node_modules/@types/node/ts4.8/readline/promises.d.ts +143 -0
  106. package/lib/handlers/node_modules/@types/node/ts4.8/readline.d.ts +653 -0
  107. package/lib/handlers/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
  108. package/lib/handlers/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  109. package/lib/handlers/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
  110. package/lib/handlers/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
  111. package/lib/handlers/node_modules/@types/node/ts4.8/stream.d.ts +1340 -0
  112. package/lib/handlers/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  113. package/lib/handlers/node_modules/@types/node/ts4.8/test.d.ts +446 -0
  114. package/lib/handlers/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
  115. package/lib/handlers/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
  116. package/lib/handlers/node_modules/@types/node/ts4.8/tls.d.ts +1028 -0
  117. package/lib/handlers/node_modules/@types/node/ts4.8/trace_events.d.ts +171 -0
  118. package/lib/handlers/node_modules/@types/node/ts4.8/tty.d.ts +206 -0
  119. package/lib/handlers/node_modules/@types/node/ts4.8/url.d.ts +897 -0
  120. package/lib/handlers/node_modules/@types/node/ts4.8/util.d.ts +1926 -0
  121. package/lib/handlers/node_modules/@types/node/ts4.8/v8.d.ts +396 -0
  122. package/lib/handlers/node_modules/@types/node/ts4.8/vm.d.ts +509 -0
  123. package/lib/handlers/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
  124. package/lib/handlers/node_modules/@types/node/ts4.8/worker_threads.d.ts +689 -0
  125. package/lib/handlers/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  126. package/lib/handlers/node_modules/@types/node/tty.d.ts +163 -23
  127. package/lib/handlers/node_modules/@types/node/url.d.ts +825 -44
  128. package/lib/handlers/node_modules/@types/node/util.d.ts +1842 -72
  129. package/lib/handlers/node_modules/@types/node/v8.d.ts +276 -78
  130. package/lib/handlers/node_modules/@types/node/vm.d.ts +410 -53
  131. package/lib/handlers/node_modules/@types/node/wasi.d.ts +102 -30
  132. package/lib/handlers/node_modules/@types/node/worker_threads.d.ts +559 -152
  133. package/lib/handlers/node_modules/@types/node/zlib.d.ts +234 -78
  134. package/lib/handlers/node_modules/esbuild/README.md +3 -0
  135. package/lib/handlers/node_modules/esbuild/bin/esbuild +0 -0
  136. package/lib/handlers/node_modules/esbuild/install.js +256 -0
  137. package/lib/handlers/node_modules/esbuild/lib/main.d.ts +397 -0
  138. package/lib/handlers/node_modules/esbuild/lib/main.js +1939 -0
  139. package/lib/handlers/node_modules/esbuild/package.json +15 -0
  140. package/lib/handlers/package-lock.json +62 -6
  141. package/lib/handlers/package.json +6 -1
  142. package/lib/handlers/prerender-check.ts +8 -27
  143. package/lib/handlers/prerender.ts +8 -43
  144. package/package.json +1 -1
  145. package/lib/handlers/node_modules/@types/node/base.d.ts +0 -19
  146. package/lib/handlers/node_modules/@types/node/diagnostic_channel.d.ts +0 -34
  147. package/lib/handlers/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
  148. package/lib/handlers/node_modules/@types/node/ts3.6/base.d.ts +0 -68
  149. package/lib/handlers/node_modules/@types/node/ts3.6/index.d.ts +0 -7
  150. package/lib/handlers/node_modules/@types/node/util/types.d.ts +0 -53
@@ -1,93 +1,318 @@
1
+ /**
2
+ * The `console` module provides a simple debugging console that is similar to the
3
+ * JavaScript console mechanism provided by web browsers.
4
+ *
5
+ * The module exports two specific components:
6
+ *
7
+ * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
8
+ * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
9
+ *
10
+ * _**Warning**_: The global console object's methods are neither consistently
11
+ * synchronous like the browser APIs they resemble, nor are they consistently
12
+ * asynchronous like all other Node.js streams. See the `note on process I/O` for
13
+ * more information.
14
+ *
15
+ * Example using the global `console`:
16
+ *
17
+ * ```js
18
+ * console.log('hello world');
19
+ * // Prints: hello world, to stdout
20
+ * console.log('hello %s', 'world');
21
+ * // Prints: hello world, to stdout
22
+ * console.error(new Error('Whoops, something bad happened'));
23
+ * // Prints error message and stack trace to stderr:
24
+ * // Error: Whoops, something bad happened
25
+ * // at [eval]:5:15
26
+ * // at Script.runInThisContext (node:vm:132:18)
27
+ * // at Object.runInThisContext (node:vm:309:38)
28
+ * // at node:internal/process/execution:77:19
29
+ * // at [eval]-wrapper:6:22
30
+ * // at evalScript (node:internal/process/execution:76:60)
31
+ * // at node:internal/main/eval_string:23:3
32
+ *
33
+ * const name = 'Will Robinson';
34
+ * console.warn(`Danger ${name}! Danger!`);
35
+ * // Prints: Danger Will Robinson! Danger!, to stderr
36
+ * ```
37
+ *
38
+ * Example using the `Console` class:
39
+ *
40
+ * ```js
41
+ * const out = getStreamSomehow();
42
+ * const err = getStreamSomehow();
43
+ * const myConsole = new console.Console(out, err);
44
+ *
45
+ * myConsole.log('hello world');
46
+ * // Prints: hello world, to out
47
+ * myConsole.log('hello %s', 'world');
48
+ * // Prints: hello world, to out
49
+ * myConsole.error(new Error('Whoops, something bad happened'));
50
+ * // Prints: [Error: Whoops, something bad happened], to err
51
+ *
52
+ * const name = 'Will Robinson';
53
+ * myConsole.warn(`Danger ${name}! Danger!`);
54
+ * // Prints: Danger Will Robinson! Danger!, to err
55
+ * ```
56
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/console.js)
57
+ */
1
58
  declare module 'console' {
2
- import { InspectOptions } from 'util';
3
-
59
+ import console = require('node:console');
60
+ export = console;
61
+ }
62
+ declare module 'node:console' {
63
+ import { InspectOptions } from 'node:util';
4
64
  global {
5
65
  // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
6
66
  interface Console {
7
- Console: NodeJS.ConsoleConstructor;
67
+ Console: console.ConsoleConstructor;
8
68
  /**
9
- * A simple assertion test that verifies whether `value` is truthy.
10
- * If it is not, an `AssertionError` is thrown.
11
- * If provided, the error `message` is formatted using `util.format()` and used as the error message.
69
+ * `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only
70
+ * writes a message and does not otherwise affect execution. The output always
71
+ * starts with `"Assertion failed"`. If provided, `message` is formatted using `util.format()`.
72
+ *
73
+ * If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens.
74
+ *
75
+ * ```js
76
+ * console.assert(true, 'does nothing');
77
+ *
78
+ * console.assert(false, 'Whoops %s work', 'didn\'t');
79
+ * // Assertion failed: Whoops didn't work
80
+ *
81
+ * console.assert();
82
+ * // Assertion failed
83
+ * ```
84
+ * @since v0.1.101
85
+ * @param value The value tested for being truthy.
86
+ * @param message All arguments besides `value` are used as error message.
12
87
  */
13
88
  assert(value: any, message?: string, ...optionalParams: any[]): void;
14
89
  /**
15
- * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY.
16
- * When `stdout` is not a TTY, this method does nothing.
90
+ * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the
91
+ * TTY. When `stdout` is not a TTY, this method does nothing.
92
+ *
93
+ * The specific operation of `console.clear()` can vary across operating systems
94
+ * and terminal types. For most Linux operating systems, `console.clear()`operates similarly to the `clear` shell command. On Windows, `console.clear()`will clear only the output in the
95
+ * current terminal viewport for the Node.js
96
+ * binary.
97
+ * @since v8.3.0
17
98
  */
18
99
  clear(): void;
19
100
  /**
20
- * Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`.
101
+ * Maintains an internal counter specific to `label` and outputs to `stdout` the
102
+ * number of times `console.count()` has been called with the given `label`.
103
+ *
104
+ * ```js
105
+ * > console.count()
106
+ * default: 1
107
+ * undefined
108
+ * > console.count('default')
109
+ * default: 2
110
+ * undefined
111
+ * > console.count('abc')
112
+ * abc: 1
113
+ * undefined
114
+ * > console.count('xyz')
115
+ * xyz: 1
116
+ * undefined
117
+ * > console.count('abc')
118
+ * abc: 2
119
+ * undefined
120
+ * > console.count()
121
+ * default: 3
122
+ * undefined
123
+ * >
124
+ * ```
125
+ * @since v8.3.0
126
+ * @param label The display label for the counter.
21
127
  */
22
128
  count(label?: string): void;
23
129
  /**
24
130
  * Resets the internal counter specific to `label`.
131
+ *
132
+ * ```js
133
+ * > console.count('abc');
134
+ * abc: 1
135
+ * undefined
136
+ * > console.countReset('abc');
137
+ * undefined
138
+ * > console.count('abc');
139
+ * abc: 1
140
+ * undefined
141
+ * >
142
+ * ```
143
+ * @since v8.3.0
144
+ * @param label The display label for the counter.
25
145
  */
26
146
  countReset(label?: string): void;
27
147
  /**
28
- * The `console.debug()` function is an alias for {@link console.log}.
148
+ * The `console.debug()` function is an alias for {@link log}.
149
+ * @since v8.0.0
29
150
  */
30
151
  debug(message?: any, ...optionalParams: any[]): void;
31
152
  /**
32
- * Uses {@link util.inspect} on `obj` and prints the resulting string to `stdout`.
153
+ * Uses `util.inspect()` on `obj` and prints the resulting string to `stdout`.
33
154
  * This function bypasses any custom `inspect()` function defined on `obj`.
155
+ * @since v0.1.101
34
156
  */
35
157
  dir(obj: any, options?: InspectOptions): void;
36
158
  /**
37
- * This method calls {@link console.log} passing it the arguments received. Please note that this method does not produce any XML formatting
159
+ * This method calls `console.log()` passing it the arguments received.
160
+ * This method does not produce any XML formatting.
161
+ * @since v8.0.0
38
162
  */
39
163
  dirxml(...data: any[]): void;
40
164
  /**
41
- * Prints to `stderr` with newline.
165
+ * Prints to `stderr` with newline. Multiple arguments can be passed, with the
166
+ * first used as the primary message and all additional used as substitution
167
+ * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
168
+ *
169
+ * ```js
170
+ * const code = 5;
171
+ * console.error('error #%d', code);
172
+ * // Prints: error #5, to stderr
173
+ * console.error('error', code);
174
+ * // Prints: error 5, to stderr
175
+ * ```
176
+ *
177
+ * If formatting elements (e.g. `%d`) are not found in the first string then `util.inspect()` is called on each argument and the resulting string
178
+ * values are concatenated. See `util.format()` for more information.
179
+ * @since v0.1.100
42
180
  */
43
181
  error(message?: any, ...optionalParams: any[]): void;
44
182
  /**
45
- * Increases indentation of subsequent lines by two spaces.
46
- * If one or more `label`s are provided, those are printed first without the additional indentation.
183
+ * Increases indentation of subsequent lines by spaces for `groupIndentation`length.
184
+ *
185
+ * If one or more `label`s are provided, those are printed first without the
186
+ * additional indentation.
187
+ * @since v8.5.0
47
188
  */
48
189
  group(...label: any[]): void;
49
190
  /**
50
- * The `console.groupCollapsed()` function is an alias for {@link console.group}.
191
+ * An alias for {@link group}.
192
+ * @since v8.5.0
51
193
  */
52
194
  groupCollapsed(...label: any[]): void;
53
195
  /**
54
- * Decreases indentation of subsequent lines by two spaces.
196
+ * Decreases indentation of subsequent lines by spaces for `groupIndentation`length.
197
+ * @since v8.5.0
55
198
  */
56
199
  groupEnd(): void;
57
200
  /**
58
- * The {@link console.info} function is an alias for {@link console.log}.
201
+ * The `console.info()` function is an alias for {@link log}.
202
+ * @since v0.1.100
59
203
  */
60
204
  info(message?: any, ...optionalParams: any[]): void;
61
205
  /**
62
- * Prints to `stdout` with newline.
206
+ * Prints to `stdout` with newline. Multiple arguments can be passed, with the
207
+ * first used as the primary message and all additional used as substitution
208
+ * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
209
+ *
210
+ * ```js
211
+ * const count = 5;
212
+ * console.log('count: %d', count);
213
+ * // Prints: count: 5, to stdout
214
+ * console.log('count:', count);
215
+ * // Prints: count: 5, to stdout
216
+ * ```
217
+ *
218
+ * See `util.format()` for more information.
219
+ * @since v0.1.100
63
220
  */
64
221
  log(message?: any, ...optionalParams: any[]): void;
65
222
  /**
66
- * This method does not display anything unless used in the inspector.
67
- * Prints to `stdout` the array `array` formatted as a table.
223
+ * Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just
224
+ * logging the argument if it can’t be parsed as tabular.
225
+ *
226
+ * ```js
227
+ * // These can't be parsed as tabular data
228
+ * console.table(Symbol());
229
+ * // Symbol()
230
+ *
231
+ * console.table(undefined);
232
+ * // undefined
233
+ *
234
+ * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]);
235
+ * // ┌─────────┬─────┬─────┐
236
+ * // │ (index) │ a │ b │
237
+ * // ├─────────┼─────┼─────┤
238
+ * // │ 0 │ 1 │ 'Y' │
239
+ * // │ 1 │ 'Z' │ 2 │
240
+ * // └─────────┴─────┴─────┘
241
+ *
242
+ * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']);
243
+ * // ┌─────────┬─────┐
244
+ * // │ (index) │ a │
245
+ * // ├─────────┼─────┤
246
+ * // │ 0 │ 1 │
247
+ * // │ 1 │ 'Z' │
248
+ * // └─────────┴─────┘
249
+ * ```
250
+ * @since v10.0.0
251
+ * @param properties Alternate properties for constructing the table.
68
252
  */
69
253
  table(tabularData: any, properties?: ReadonlyArray<string>): void;
70
254
  /**
71
- * Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`.
255
+ * Starts a timer that can be used to compute the duration of an operation. Timers
256
+ * are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
257
+ * suitable time units to `stdout`. For example, if the elapsed
258
+ * time is 3869ms, `console.timeEnd()` displays "3.869s".
259
+ * @since v0.1.104
72
260
  */
73
261
  time(label?: string): void;
74
262
  /**
75
- * Stops a timer that was previously started by calling {@link console.time} and prints the result to `stdout`.
263
+ * Stops a timer that was previously started by calling {@link time} and
264
+ * prints the result to `stdout`:
265
+ *
266
+ * ```js
267
+ * console.time('100-elements');
268
+ * for (let i = 0; i < 100; i++) {}
269
+ * console.timeEnd('100-elements');
270
+ * // prints 100-elements: 225.438ms
271
+ * ```
272
+ * @since v0.1.104
76
273
  */
77
274
  timeEnd(label?: string): void;
78
275
  /**
79
- * For a timer that was previously started by calling {@link console.time}, prints the elapsed time and other `data` arguments to `stdout`.
276
+ * For a timer that was previously started by calling {@link time}, prints
277
+ * the elapsed time and other `data` arguments to `stdout`:
278
+ *
279
+ * ```js
280
+ * console.time('process');
281
+ * const value = expensiveProcess1(); // Returns 42
282
+ * console.timeLog('process', value);
283
+ * // Prints "process: 365.227ms 42".
284
+ * doExpensiveProcess2(value);
285
+ * console.timeEnd('process');
286
+ * ```
287
+ * @since v10.7.0
80
288
  */
81
289
  timeLog(label?: string, ...data: any[]): void;
82
290
  /**
83
- * Prints to `stderr` the string 'Trace :', followed by the {@link util.format} formatted message and stack trace to the current position in the code.
291
+ * Prints to `stderr` the string `'Trace: '`, followed by the `util.format()` formatted message and stack trace to the current position in the code.
292
+ *
293
+ * ```js
294
+ * console.trace('Show me');
295
+ * // Prints: (stack trace will vary based on where trace is called)
296
+ * // Trace: Show me
297
+ * // at repl:2:9
298
+ * // at REPLServer.defaultEval (repl.js:248:27)
299
+ * // at bound (domain.js:287:14)
300
+ * // at REPLServer.runBound [as eval] (domain.js:300:12)
301
+ * // at REPLServer.<anonymous> (repl.js:412:12)
302
+ * // at emitOne (events.js:82:20)
303
+ * // at REPLServer.emit (events.js:169:7)
304
+ * // at REPLServer.Interface._onLine (readline.js:210:10)
305
+ * // at REPLServer.Interface._line (readline.js:549:8)
306
+ * // at REPLServer.Interface._ttyWrite (readline.js:826:14)
307
+ * ```
308
+ * @since v0.1.104
84
309
  */
85
310
  trace(message?: any, ...optionalParams: any[]): void;
86
311
  /**
87
- * The {@link console.warn} function is an alias for {@link console.error}.
312
+ * The `console.warn()` function is an alias for {@link error}.
313
+ * @since v0.1.100
88
314
  */
89
315
  warn(message?: any, ...optionalParams: any[]): void;
90
-
91
316
  // --- Inspector mode only ---
92
317
  /**
93
318
  * This method does not display anything unless used in the inspector.
@@ -105,29 +330,83 @@ declare module 'console' {
105
330
  */
106
331
  timeStamp(label?: string): void;
107
332
  }
108
-
109
- var console: Console;
110
-
111
- namespace NodeJS {
333
+ /**
334
+ * The `console` module provides a simple debugging console that is similar to the
335
+ * JavaScript console mechanism provided by web browsers.
336
+ *
337
+ * The module exports two specific components:
338
+ *
339
+ * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
340
+ * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
341
+ *
342
+ * _**Warning**_: The global console object's methods are neither consistently
343
+ * synchronous like the browser APIs they resemble, nor are they consistently
344
+ * asynchronous like all other Node.js streams. See the `note on process I/O` for
345
+ * more information.
346
+ *
347
+ * Example using the global `console`:
348
+ *
349
+ * ```js
350
+ * console.log('hello world');
351
+ * // Prints: hello world, to stdout
352
+ * console.log('hello %s', 'world');
353
+ * // Prints: hello world, to stdout
354
+ * console.error(new Error('Whoops, something bad happened'));
355
+ * // Prints error message and stack trace to stderr:
356
+ * // Error: Whoops, something bad happened
357
+ * // at [eval]:5:15
358
+ * // at Script.runInThisContext (node:vm:132:18)
359
+ * // at Object.runInThisContext (node:vm:309:38)
360
+ * // at node:internal/process/execution:77:19
361
+ * // at [eval]-wrapper:6:22
362
+ * // at evalScript (node:internal/process/execution:76:60)
363
+ * // at node:internal/main/eval_string:23:3
364
+ *
365
+ * const name = 'Will Robinson';
366
+ * console.warn(`Danger ${name}! Danger!`);
367
+ * // Prints: Danger Will Robinson! Danger!, to stderr
368
+ * ```
369
+ *
370
+ * Example using the `Console` class:
371
+ *
372
+ * ```js
373
+ * const out = getStreamSomehow();
374
+ * const err = getStreamSomehow();
375
+ * const myConsole = new console.Console(out, err);
376
+ *
377
+ * myConsole.log('hello world');
378
+ * // Prints: hello world, to out
379
+ * myConsole.log('hello %s', 'world');
380
+ * // Prints: hello world, to out
381
+ * myConsole.error(new Error('Whoops, something bad happened'));
382
+ * // Prints: [Error: Whoops, something bad happened], to err
383
+ *
384
+ * const name = 'Will Robinson';
385
+ * myConsole.warn(`Danger ${name}! Danger!`);
386
+ * // Prints: Danger Will Robinson! Danger!, to err
387
+ * ```
388
+ * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/console.js)
389
+ */
390
+ namespace console {
112
391
  interface ConsoleConstructorOptions {
113
- stdout: WritableStream;
114
- stderr?: WritableStream;
115
- ignoreErrors?: boolean;
116
- colorMode?: boolean | 'auto';
117
- inspectOptions?: InspectOptions;
392
+ stdout: NodeJS.WritableStream;
393
+ stderr?: NodeJS.WritableStream | undefined;
394
+ ignoreErrors?: boolean | undefined;
395
+ colorMode?: boolean | 'auto' | undefined;
396
+ inspectOptions?: InspectOptions | undefined;
397
+ /**
398
+ * Set group indentation
399
+ * @default 2
400
+ */
401
+ groupIndentation?: number | undefined;
118
402
  }
119
-
120
403
  interface ConsoleConstructor {
121
404
  prototype: Console;
122
- new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console;
123
- new(options: ConsoleConstructorOptions): Console;
124
- }
125
-
126
- interface Global {
127
- console: typeof console;
405
+ new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
406
+ new (options: ConsoleConstructorOptions): Console;
128
407
  }
129
408
  }
409
+ var console: Console;
130
410
  }
131
-
132
- export = console;
411
+ export = globalThis.console;
133
412
  }
@@ -1,8 +1,8 @@
1
1
  /** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
2
2
  declare module 'constants' {
3
- import { constants as osConstants, SignalConstants } from 'os';
4
- import { constants as cryptoConstants } from 'crypto';
5
- import { constants as fsConstants } from 'fs';
3
+ import { constants as osConstants, SignalConstants } from 'node:os';
4
+ import { constants as cryptoConstants } from 'node:crypto';
5
+ import { constants as fsConstants } from 'node:fs';
6
6
 
7
7
  const exp: typeof osConstants.errno &
8
8
  typeof osConstants.priority &
@@ -11,3 +11,8 @@ declare module 'constants' {
11
11
  typeof fsConstants;
12
12
  export = exp;
13
13
  }
14
+
15
+ declare module 'node:constants' {
16
+ import constants = require('constants');
17
+ export = constants;
18
+ }