@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.
- package/lib/handlers/cache-control.ts +7 -20
- package/lib/handlers/error-response.ts +8 -51
- package/lib/handlers/node_modules/.package-lock.json +32 -3
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/index.d.ts +6 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/index.js +14 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/cache-control.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/cache-control.js +24 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/error-response.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/error-response.js +50 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender-check.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender-check.js +28 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender.js +49 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/redirect.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/redirect.js +33 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/package.json +27 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/tsconfig.json +3 -0
- package/lib/handlers/node_modules/@middy/core/LICENSE +21 -0
- package/lib/handlers/node_modules/@middy/core/README.md +65 -0
- package/lib/handlers/node_modules/@middy/core/index.cjs +207 -0
- package/lib/handlers/node_modules/@middy/core/index.d.ts +91 -0
- package/lib/handlers/node_modules/@middy/core/index.js +199 -0
- package/lib/handlers/node_modules/@middy/core/package.json +65 -0
- package/lib/handlers/node_modules/@types/node/README.md +4 -4
- package/lib/handlers/node_modules/@types/node/assert/strict.d.ts +5 -1
- package/lib/handlers/node_modules/@types/node/assert.d.ts +904 -67
- package/lib/handlers/node_modules/@types/node/async_hooks.d.ts +371 -96
- package/lib/handlers/node_modules/@types/node/buffer.d.ts +2199 -25
- package/lib/handlers/node_modules/@types/node/child_process.d.ts +1151 -308
- package/lib/handlers/node_modules/@types/node/cluster.d.ts +356 -208
- package/lib/handlers/node_modules/@types/node/console.d.ts +324 -45
- package/lib/handlers/node_modules/@types/node/constants.d.ts +8 -3
- package/lib/handlers/node_modules/@types/node/crypto.d.ts +3230 -846
- package/lib/handlers/node_modules/@types/node/dgram.d.ts +478 -74
- package/lib/handlers/node_modules/@types/node/diagnostics_channel.d.ts +153 -0
- package/lib/handlers/node_modules/@types/node/dns/promises.d.ts +308 -35
- package/lib/handlers/node_modules/@types/node/dns.d.ts +444 -107
- package/lib/handlers/node_modules/@types/node/dom-events.d.ts +126 -0
- package/lib/handlers/node_modules/@types/node/domain.d.ts +162 -16
- package/lib/handlers/node_modules/@types/node/events.d.ts +624 -39
- package/lib/handlers/node_modules/@types/node/fs/promises.d.ts +911 -365
- package/lib/handlers/node_modules/@types/node/fs.d.ts +2611 -978
- package/lib/handlers/node_modules/@types/node/globals.d.ts +66 -421
- package/lib/handlers/node_modules/@types/node/globals.global.d.ts +1 -1
- package/lib/handlers/node_modules/@types/node/http.d.ts +1416 -199
- package/lib/handlers/node_modules/@types/node/http2.d.ts +1688 -530
- package/lib/handlers/node_modules/@types/node/https.d.ts +532 -26
- package/lib/handlers/node_modules/@types/node/index.d.ts +92 -16
- package/lib/handlers/node_modules/@types/node/inspector.d.ts +511 -811
- package/lib/handlers/node_modules/@types/node/module.d.ts +75 -13
- package/lib/handlers/node_modules/@types/node/net.d.ts +710 -167
- package/lib/handlers/node_modules/@types/node/os.d.ts +252 -25
- package/lib/handlers/node_modules/@types/node/package.json +30 -25
- package/lib/handlers/node_modules/@types/node/path.d.ts +59 -31
- package/lib/handlers/node_modules/@types/node/perf_hooks.d.ts +420 -105
- package/lib/handlers/node_modules/@types/node/process.d.ts +1249 -228
- package/lib/handlers/node_modules/@types/node/punycode.d.ts +67 -25
- package/lib/handlers/node_modules/@types/node/querystring.d.ts +113 -10
- package/lib/handlers/node_modules/@types/node/readline/promises.d.ts +143 -0
- package/lib/handlers/node_modules/@types/node/readline.d.ts +570 -109
- package/lib/handlers/node_modules/@types/node/repl.d.ts +154 -125
- package/lib/handlers/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/lib/handlers/node_modules/@types/node/stream/promises.d.ts +18 -43
- package/lib/handlers/node_modules/@types/node/stream/web.d.ts +330 -0
- package/lib/handlers/node_modules/@types/node/stream.d.ts +1117 -248
- package/lib/handlers/node_modules/@types/node/string_decoder.d.ts +60 -0
- package/lib/handlers/node_modules/@types/node/test.d.ts +446 -0
- package/lib/handlers/node_modules/@types/node/timers/promises.d.ts +81 -9
- package/lib/handlers/node_modules/@types/node/timers.d.ts +84 -17
- package/lib/handlers/node_modules/@types/node/tls.d.ts +510 -275
- package/lib/handlers/node_modules/@types/node/trace_events.d.ts +120 -10
- package/lib/handlers/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/assert.d.ts +961 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/async_hooks.d.ts +501 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/buffer.d.ts +2259 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/child_process.d.ts +1369 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/cluster.d.ts +410 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/console.d.ts +412 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/crypto.d.ts +3964 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +153 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dns/promises.d.ts +370 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dns.d.ts +659 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/events.d.ts +678 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/fs/promises.d.ts +1138 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/fs.d.ts +3872 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/globals.d.ts +294 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/http.d.ts +1651 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/http2.d.ts +2134 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/https.d.ts +542 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/inspector.d.ts +2741 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/module.d.ts +114 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/net.d.ts +869 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/os.d.ts +466 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/perf_hooks.d.ts +625 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/process.d.ts +1482 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/readline/promises.d.ts +143 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/readline.d.ts +653 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream.d.ts +1340 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/test.d.ts +446 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/tls.d.ts +1028 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/trace_events.d.ts +171 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/tty.d.ts +206 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/url.d.ts +897 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/util.d.ts +1926 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/v8.d.ts +396 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/vm.d.ts +509 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/worker_threads.d.ts +689 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/lib/handlers/node_modules/@types/node/tty.d.ts +163 -23
- package/lib/handlers/node_modules/@types/node/url.d.ts +825 -44
- package/lib/handlers/node_modules/@types/node/util.d.ts +1842 -72
- package/lib/handlers/node_modules/@types/node/v8.d.ts +276 -78
- package/lib/handlers/node_modules/@types/node/vm.d.ts +410 -53
- package/lib/handlers/node_modules/@types/node/wasi.d.ts +102 -30
- package/lib/handlers/node_modules/@types/node/worker_threads.d.ts +559 -152
- package/lib/handlers/node_modules/@types/node/zlib.d.ts +234 -78
- package/lib/handlers/node_modules/esbuild/README.md +3 -0
- package/lib/handlers/node_modules/esbuild/bin/esbuild +0 -0
- package/lib/handlers/node_modules/esbuild/install.js +256 -0
- package/lib/handlers/node_modules/esbuild/lib/main.d.ts +397 -0
- package/lib/handlers/node_modules/esbuild/lib/main.js +1939 -0
- package/lib/handlers/node_modules/esbuild/package.json +15 -0
- package/lib/handlers/package-lock.json +62 -6
- package/lib/handlers/package.json +6 -1
- package/lib/handlers/prerender-check.ts +8 -27
- package/lib/handlers/prerender.ts +8 -43
- package/package.json +1 -1
- package/lib/handlers/node_modules/@types/node/base.d.ts +0 -19
- package/lib/handlers/node_modules/@types/node/diagnostic_channel.d.ts +0 -34
- package/lib/handlers/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
- package/lib/handlers/node_modules/@types/node/ts3.6/base.d.ts +0 -68
- package/lib/handlers/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/lib/handlers/node_modules/@types/node/util/types.d.ts +0 -53
|
@@ -1,31 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `repl` module provides a Read-Eval-Print-Loop (REPL) implementation that
|
|
3
|
+
* is available both as a standalone program or includible in other applications.
|
|
4
|
+
* It can be accessed using:
|
|
5
|
+
*
|
|
6
|
+
* ```js
|
|
7
|
+
* const repl = require('repl');
|
|
8
|
+
* ```
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/repl.js)
|
|
10
|
+
*/
|
|
1
11
|
declare module 'repl' {
|
|
2
|
-
import { Interface, Completer, AsyncCompleter } from 'readline';
|
|
3
|
-
import { Context } from 'vm';
|
|
4
|
-
import { InspectOptions } from 'util';
|
|
5
|
-
|
|
12
|
+
import { Interface, Completer, AsyncCompleter } from 'node:readline';
|
|
13
|
+
import { Context } from 'node:vm';
|
|
14
|
+
import { InspectOptions } from 'node:util';
|
|
6
15
|
interface ReplOptions {
|
|
7
16
|
/**
|
|
8
17
|
* The input prompt to display.
|
|
9
18
|
* @default "> "
|
|
10
19
|
*/
|
|
11
|
-
prompt?: string;
|
|
20
|
+
prompt?: string | undefined;
|
|
12
21
|
/**
|
|
13
22
|
* The `Readable` stream from which REPL input will be read.
|
|
14
23
|
* @default process.stdin
|
|
15
24
|
*/
|
|
16
|
-
input?: NodeJS.ReadableStream;
|
|
25
|
+
input?: NodeJS.ReadableStream | undefined;
|
|
17
26
|
/**
|
|
18
27
|
* The `Writable` stream to which REPL output will be written.
|
|
19
28
|
* @default process.stdout
|
|
20
29
|
*/
|
|
21
|
-
output?: NodeJS.WritableStream;
|
|
30
|
+
output?: NodeJS.WritableStream | undefined;
|
|
22
31
|
/**
|
|
23
32
|
* If `true`, specifies that the output should be treated as a TTY terminal, and have
|
|
24
33
|
* ANSI/VT100 escape codes written to it.
|
|
25
34
|
* Default: checking the value of the `isTTY` property on the output stream upon
|
|
26
35
|
* instantiation.
|
|
27
36
|
*/
|
|
28
|
-
terminal?: boolean;
|
|
37
|
+
terminal?: boolean | undefined;
|
|
29
38
|
/**
|
|
30
39
|
* The function to be used when evaluating each given line of input.
|
|
31
40
|
* Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can
|
|
@@ -35,45 +44,45 @@ declare module 'repl' {
|
|
|
35
44
|
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation
|
|
36
45
|
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions
|
|
37
46
|
*/
|
|
38
|
-
eval?: REPLEval;
|
|
47
|
+
eval?: REPLEval | undefined;
|
|
39
48
|
/**
|
|
40
49
|
* Defines if the repl prints output previews or not.
|
|
41
50
|
* @default `true` Always `false` in case `terminal` is falsy.
|
|
42
51
|
*/
|
|
43
|
-
preview?: boolean;
|
|
52
|
+
preview?: boolean | undefined;
|
|
44
53
|
/**
|
|
45
54
|
* If `true`, specifies that the default `writer` function should include ANSI color
|
|
46
55
|
* styling to REPL output. If a custom `writer` function is provided then this has no
|
|
47
56
|
* effect.
|
|
48
57
|
* Default: the REPL instance's `terminal` value.
|
|
49
58
|
*/
|
|
50
|
-
useColors?: boolean;
|
|
59
|
+
useColors?: boolean | undefined;
|
|
51
60
|
/**
|
|
52
61
|
* If `true`, specifies that the default evaluation function will use the JavaScript
|
|
53
62
|
* `global` as the context as opposed to creating a new separate context for the REPL
|
|
54
63
|
* instance. The node CLI REPL sets this value to `true`.
|
|
55
64
|
* Default: `false`.
|
|
56
65
|
*/
|
|
57
|
-
useGlobal?: boolean;
|
|
66
|
+
useGlobal?: boolean | undefined;
|
|
58
67
|
/**
|
|
59
68
|
* If `true`, specifies that the default writer will not output the return value of a
|
|
60
69
|
* command if it evaluates to `undefined`.
|
|
61
70
|
* Default: `false`.
|
|
62
71
|
*/
|
|
63
|
-
ignoreUndefined?: boolean;
|
|
72
|
+
ignoreUndefined?: boolean | undefined;
|
|
64
73
|
/**
|
|
65
74
|
* The function to invoke to format the output of each command before writing to `output`.
|
|
66
75
|
* Default: a wrapper for `util.inspect`.
|
|
67
76
|
*
|
|
68
77
|
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output
|
|
69
78
|
*/
|
|
70
|
-
writer?: REPLWriter;
|
|
79
|
+
writer?: REPLWriter | undefined;
|
|
71
80
|
/**
|
|
72
81
|
* An optional function used for custom Tab auto completion.
|
|
73
82
|
*
|
|
74
83
|
* @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function
|
|
75
84
|
*/
|
|
76
|
-
completer?: Completer | AsyncCompleter;
|
|
85
|
+
completer?: Completer | AsyncCompleter | undefined;
|
|
77
86
|
/**
|
|
78
87
|
* A flag that specifies whether the default evaluator executes all JavaScript commands in
|
|
79
88
|
* strict mode or default (sloppy) mode.
|
|
@@ -82,52 +91,47 @@ declare module 'repl' {
|
|
|
82
91
|
* - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
|
|
83
92
|
* prefacing every repl statement with `'use strict'`.
|
|
84
93
|
*/
|
|
85
|
-
replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT;
|
|
94
|
+
replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT | undefined;
|
|
86
95
|
/**
|
|
87
96
|
* Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is
|
|
88
97
|
* pressed. This cannot be used together with a custom `eval` function.
|
|
89
98
|
* Default: `false`.
|
|
90
99
|
*/
|
|
91
|
-
breakEvalOnSigint?: boolean;
|
|
100
|
+
breakEvalOnSigint?: boolean | undefined;
|
|
92
101
|
}
|
|
93
|
-
|
|
94
102
|
type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void;
|
|
95
103
|
type REPLWriter = (this: REPLServer, obj: any) => string;
|
|
96
|
-
|
|
97
104
|
/**
|
|
98
105
|
* This is the default "writer" value, if none is passed in the REPL options,
|
|
99
106
|
* and it can be overridden by custom print functions.
|
|
100
107
|
*/
|
|
101
|
-
const writer: REPLWriter & {
|
|
102
|
-
|
|
108
|
+
const writer: REPLWriter & {
|
|
109
|
+
options: InspectOptions;
|
|
110
|
+
};
|
|
103
111
|
type REPLCommandAction = (this: REPLServer, text: string) => void;
|
|
104
|
-
|
|
105
112
|
interface REPLCommand {
|
|
106
113
|
/**
|
|
107
114
|
* Help text to be displayed when `.help` is entered.
|
|
108
115
|
*/
|
|
109
|
-
help?: string;
|
|
116
|
+
help?: string | undefined;
|
|
110
117
|
/**
|
|
111
118
|
* The function to execute, optionally accepting a single string argument.
|
|
112
119
|
*/
|
|
113
120
|
action: REPLCommandAction;
|
|
114
121
|
}
|
|
115
|
-
|
|
116
122
|
/**
|
|
117
|
-
*
|
|
123
|
+
* Instances of `repl.REPLServer` are created using the {@link start} method
|
|
124
|
+
* or directly using the JavaScript `new` keyword.
|
|
118
125
|
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* may be from `stdin` and `stdout`, respectively, or may be connected to any Node.js `stream`.
|
|
126
|
+
* ```js
|
|
127
|
+
* const repl = require('repl');
|
|
122
128
|
*
|
|
123
|
-
*
|
|
124
|
-
* line editing, multi-line inputs, ANSI-styled output, saving and restoring current REPL session
|
|
125
|
-
* state, error recovery, and customizable evaluation functions.
|
|
129
|
+
* const options = { useColors: true };
|
|
126
130
|
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* @
|
|
131
|
+
* const firstInstance = repl.start(options);
|
|
132
|
+
* const secondInstance = new repl.REPLServer(options);
|
|
133
|
+
* ```
|
|
134
|
+
* @since v0.1.91
|
|
131
135
|
*/
|
|
132
136
|
class REPLServer extends Interface {
|
|
133
137
|
/**
|
|
@@ -228,7 +232,6 @@ declare module 'repl' {
|
|
|
228
232
|
* prefacing every repl statement with `'use strict'`.
|
|
229
233
|
*/
|
|
230
234
|
readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT;
|
|
231
|
-
|
|
232
235
|
/**
|
|
233
236
|
* NOTE: According to the documentation:
|
|
234
237
|
*
|
|
@@ -240,49 +243,76 @@ declare module 'repl' {
|
|
|
240
243
|
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver
|
|
241
244
|
*/
|
|
242
245
|
private constructor();
|
|
243
|
-
|
|
244
246
|
/**
|
|
245
|
-
*
|
|
246
|
-
* by typing a `.` followed by the
|
|
247
|
+
* The `replServer.defineCommand()` method is used to add new `.`\-prefixed commands
|
|
248
|
+
* to the REPL instance. Such commands are invoked by typing a `.` followed by the`keyword`. The `cmd` is either a `Function` or an `Object` with the following
|
|
249
|
+
* properties:
|
|
250
|
+
*
|
|
251
|
+
* The following example shows two new commands added to the REPL instance:
|
|
252
|
+
*
|
|
253
|
+
* ```js
|
|
254
|
+
* const repl = require('repl');
|
|
247
255
|
*
|
|
256
|
+
* const replServer = repl.start({ prompt: '> ' });
|
|
257
|
+
* replServer.defineCommand('sayhello', {
|
|
258
|
+
* help: 'Say hello',
|
|
259
|
+
* action(name) {
|
|
260
|
+
* this.clearBufferedCommand();
|
|
261
|
+
* console.log(`Hello, ${name}!`);
|
|
262
|
+
* this.displayPrompt();
|
|
263
|
+
* }
|
|
264
|
+
* });
|
|
265
|
+
* replServer.defineCommand('saybye', function saybye() {
|
|
266
|
+
* console.log('Goodbye!');
|
|
267
|
+
* this.close();
|
|
268
|
+
* });
|
|
269
|
+
* ```
|
|
270
|
+
*
|
|
271
|
+
* The new commands can then be used from within the REPL instance:
|
|
272
|
+
*
|
|
273
|
+
* ```console
|
|
274
|
+
* > .sayhello Node.js User
|
|
275
|
+
* Hello, Node.js User!
|
|
276
|
+
* > .saybye
|
|
277
|
+
* Goodbye!
|
|
278
|
+
* ```
|
|
279
|
+
* @since v0.3.0
|
|
248
280
|
* @param keyword The command keyword (_without_ a leading `.` character).
|
|
249
281
|
* @param cmd The function to invoke when the command is processed.
|
|
250
|
-
*
|
|
251
|
-
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_replserver_definecommand_keyword_cmd
|
|
252
282
|
*/
|
|
253
283
|
defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void;
|
|
254
284
|
/**
|
|
255
|
-
*
|
|
256
|
-
* new line in the `output`
|
|
285
|
+
* The `replServer.displayPrompt()` method readies the REPL instance for input
|
|
286
|
+
* from the user, printing the configured `prompt` to a new line in the `output`and resuming the `input` to accept new input.
|
|
257
287
|
*
|
|
258
|
-
* When multi-line input is being entered, an ellipsis is printed rather than the
|
|
288
|
+
* When multi-line input is being entered, an ellipsis is printed rather than the
|
|
289
|
+
* 'prompt'.
|
|
259
290
|
*
|
|
260
|
-
*
|
|
261
|
-
* commands registered using the `replServer.defineCommand()` method.
|
|
291
|
+
* When `preserveCursor` is `true`, the cursor placement will not be reset to `0`.
|
|
262
292
|
*
|
|
263
|
-
*
|
|
293
|
+
* The `replServer.displayPrompt` method is primarily intended to be called from
|
|
294
|
+
* within the action function for commands registered using the`replServer.defineCommand()` method.
|
|
295
|
+
* @since v0.1.91
|
|
264
296
|
*/
|
|
265
297
|
displayPrompt(preserveCursor?: boolean): void;
|
|
266
298
|
/**
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* commands registered using the `replServer.defineCommand()` method.
|
|
271
|
-
*
|
|
299
|
+
* The `replServer.clearBufferedCommand()` method clears any command that has been
|
|
300
|
+
* buffered but not yet executed. This method is primarily intended to be
|
|
301
|
+
* called from within the action function for commands registered using the`replServer.defineCommand()` method.
|
|
272
302
|
* @since v9.0.0
|
|
273
303
|
*/
|
|
274
304
|
clearBufferedCommand(): void;
|
|
275
|
-
|
|
276
305
|
/**
|
|
277
306
|
* Initializes a history log file for the REPL instance. When executing the
|
|
278
|
-
* Node.js binary and using the command
|
|
307
|
+
* Node.js binary and using the command-line REPL, a history file is initialized
|
|
279
308
|
* by default. However, this is not the case when creating a REPL
|
|
280
309
|
* programmatically. Use this method to initialize a history log file when working
|
|
281
310
|
* with REPL instances programmatically.
|
|
282
|
-
* @
|
|
311
|
+
* @since v11.10.0
|
|
312
|
+
* @param historyPath the path to the history file
|
|
313
|
+
* @param callback called when history writes are ready or upon error
|
|
283
314
|
*/
|
|
284
|
-
setupHistory(path: string,
|
|
285
|
-
|
|
315
|
+
setupHistory(path: string, callback: (err: Error | null, repl: this) => void): void;
|
|
286
316
|
/**
|
|
287
317
|
* events.EventEmitter
|
|
288
318
|
* 1. close - inherited from `readline.Interface`
|
|
@@ -295,93 +325,90 @@ declare module 'repl' {
|
|
|
295
325
|
* 8. exit
|
|
296
326
|
* 9. reset
|
|
297
327
|
*/
|
|
298
|
-
|
|
299
328
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
300
|
-
addListener(event:
|
|
301
|
-
addListener(event:
|
|
302
|
-
addListener(event:
|
|
303
|
-
addListener(event:
|
|
304
|
-
addListener(event:
|
|
305
|
-
addListener(event:
|
|
306
|
-
addListener(event:
|
|
307
|
-
addListener(event:
|
|
308
|
-
addListener(event:
|
|
309
|
-
|
|
329
|
+
addListener(event: 'close', listener: () => void): this;
|
|
330
|
+
addListener(event: 'line', listener: (input: string) => void): this;
|
|
331
|
+
addListener(event: 'pause', listener: () => void): this;
|
|
332
|
+
addListener(event: 'resume', listener: () => void): this;
|
|
333
|
+
addListener(event: 'SIGCONT', listener: () => void): this;
|
|
334
|
+
addListener(event: 'SIGINT', listener: () => void): this;
|
|
335
|
+
addListener(event: 'SIGTSTP', listener: () => void): this;
|
|
336
|
+
addListener(event: 'exit', listener: () => void): this;
|
|
337
|
+
addListener(event: 'reset', listener: (context: Context) => void): this;
|
|
310
338
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
311
|
-
emit(event:
|
|
312
|
-
emit(event:
|
|
313
|
-
emit(event:
|
|
314
|
-
emit(event:
|
|
315
|
-
emit(event:
|
|
316
|
-
emit(event:
|
|
317
|
-
emit(event:
|
|
318
|
-
emit(event:
|
|
319
|
-
emit(event:
|
|
320
|
-
|
|
339
|
+
emit(event: 'close'): boolean;
|
|
340
|
+
emit(event: 'line', input: string): boolean;
|
|
341
|
+
emit(event: 'pause'): boolean;
|
|
342
|
+
emit(event: 'resume'): boolean;
|
|
343
|
+
emit(event: 'SIGCONT'): boolean;
|
|
344
|
+
emit(event: 'SIGINT'): boolean;
|
|
345
|
+
emit(event: 'SIGTSTP'): boolean;
|
|
346
|
+
emit(event: 'exit'): boolean;
|
|
347
|
+
emit(event: 'reset', context: Context): boolean;
|
|
321
348
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
322
|
-
on(event:
|
|
323
|
-
on(event:
|
|
324
|
-
on(event:
|
|
325
|
-
on(event:
|
|
326
|
-
on(event:
|
|
327
|
-
on(event:
|
|
328
|
-
on(event:
|
|
329
|
-
on(event:
|
|
330
|
-
on(event:
|
|
331
|
-
|
|
349
|
+
on(event: 'close', listener: () => void): this;
|
|
350
|
+
on(event: 'line', listener: (input: string) => void): this;
|
|
351
|
+
on(event: 'pause', listener: () => void): this;
|
|
352
|
+
on(event: 'resume', listener: () => void): this;
|
|
353
|
+
on(event: 'SIGCONT', listener: () => void): this;
|
|
354
|
+
on(event: 'SIGINT', listener: () => void): this;
|
|
355
|
+
on(event: 'SIGTSTP', listener: () => void): this;
|
|
356
|
+
on(event: 'exit', listener: () => void): this;
|
|
357
|
+
on(event: 'reset', listener: (context: Context) => void): this;
|
|
332
358
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
333
|
-
once(event:
|
|
334
|
-
once(event:
|
|
335
|
-
once(event:
|
|
336
|
-
once(event:
|
|
337
|
-
once(event:
|
|
338
|
-
once(event:
|
|
339
|
-
once(event:
|
|
340
|
-
once(event:
|
|
341
|
-
once(event:
|
|
342
|
-
|
|
359
|
+
once(event: 'close', listener: () => void): this;
|
|
360
|
+
once(event: 'line', listener: (input: string) => void): this;
|
|
361
|
+
once(event: 'pause', listener: () => void): this;
|
|
362
|
+
once(event: 'resume', listener: () => void): this;
|
|
363
|
+
once(event: 'SIGCONT', listener: () => void): this;
|
|
364
|
+
once(event: 'SIGINT', listener: () => void): this;
|
|
365
|
+
once(event: 'SIGTSTP', listener: () => void): this;
|
|
366
|
+
once(event: 'exit', listener: () => void): this;
|
|
367
|
+
once(event: 'reset', listener: (context: Context) => void): this;
|
|
343
368
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
344
|
-
prependListener(event:
|
|
345
|
-
prependListener(event:
|
|
346
|
-
prependListener(event:
|
|
347
|
-
prependListener(event:
|
|
348
|
-
prependListener(event:
|
|
349
|
-
prependListener(event:
|
|
350
|
-
prependListener(event:
|
|
351
|
-
prependListener(event:
|
|
352
|
-
prependListener(event:
|
|
353
|
-
|
|
369
|
+
prependListener(event: 'close', listener: () => void): this;
|
|
370
|
+
prependListener(event: 'line', listener: (input: string) => void): this;
|
|
371
|
+
prependListener(event: 'pause', listener: () => void): this;
|
|
372
|
+
prependListener(event: 'resume', listener: () => void): this;
|
|
373
|
+
prependListener(event: 'SIGCONT', listener: () => void): this;
|
|
374
|
+
prependListener(event: 'SIGINT', listener: () => void): this;
|
|
375
|
+
prependListener(event: 'SIGTSTP', listener: () => void): this;
|
|
376
|
+
prependListener(event: 'exit', listener: () => void): this;
|
|
377
|
+
prependListener(event: 'reset', listener: (context: Context) => void): this;
|
|
354
378
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
355
|
-
prependOnceListener(event:
|
|
356
|
-
prependOnceListener(event:
|
|
357
|
-
prependOnceListener(event:
|
|
358
|
-
prependOnceListener(event:
|
|
359
|
-
prependOnceListener(event:
|
|
360
|
-
prependOnceListener(event:
|
|
361
|
-
prependOnceListener(event:
|
|
362
|
-
prependOnceListener(event:
|
|
363
|
-
prependOnceListener(event:
|
|
379
|
+
prependOnceListener(event: 'close', listener: () => void): this;
|
|
380
|
+
prependOnceListener(event: 'line', listener: (input: string) => void): this;
|
|
381
|
+
prependOnceListener(event: 'pause', listener: () => void): this;
|
|
382
|
+
prependOnceListener(event: 'resume', listener: () => void): this;
|
|
383
|
+
prependOnceListener(event: 'SIGCONT', listener: () => void): this;
|
|
384
|
+
prependOnceListener(event: 'SIGINT', listener: () => void): this;
|
|
385
|
+
prependOnceListener(event: 'SIGTSTP', listener: () => void): this;
|
|
386
|
+
prependOnceListener(event: 'exit', listener: () => void): this;
|
|
387
|
+
prependOnceListener(event: 'reset', listener: (context: Context) => void): this;
|
|
364
388
|
}
|
|
365
|
-
|
|
366
389
|
/**
|
|
367
390
|
* A flag passed in the REPL options. Evaluates expressions in sloppy mode.
|
|
368
391
|
*/
|
|
369
392
|
const REPL_MODE_SLOPPY: unique symbol;
|
|
370
|
-
|
|
371
393
|
/**
|
|
372
394
|
* A flag passed in the REPL options. Evaluates expressions in strict mode.
|
|
373
395
|
* This is equivalent to prefacing every repl statement with `'use strict'`.
|
|
374
396
|
*/
|
|
375
397
|
const REPL_MODE_STRICT: unique symbol;
|
|
376
|
-
|
|
377
398
|
/**
|
|
378
|
-
*
|
|
399
|
+
* The `repl.start()` method creates and starts a {@link REPLServer} instance.
|
|
400
|
+
*
|
|
401
|
+
* If `options` is a string, then it specifies the input prompt:
|
|
379
402
|
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
403
|
+
* ```js
|
|
404
|
+
* const repl = require('repl');
|
|
405
|
+
*
|
|
406
|
+
* // a Unix style prompt
|
|
407
|
+
* repl.start('$ ');
|
|
408
|
+
* ```
|
|
409
|
+
* @since v0.1.91
|
|
382
410
|
*/
|
|
383
411
|
function start(options?: string | ReplOptions): REPLServer;
|
|
384
|
-
|
|
385
412
|
/**
|
|
386
413
|
* Indicates a recoverable error that a `REPLServer` can use to support multi-line input.
|
|
387
414
|
*
|
|
@@ -389,7 +416,9 @@ declare module 'repl' {
|
|
|
389
416
|
*/
|
|
390
417
|
class Recoverable extends SyntaxError {
|
|
391
418
|
err: Error;
|
|
392
|
-
|
|
393
419
|
constructor(err: Error);
|
|
394
420
|
}
|
|
395
421
|
}
|
|
422
|
+
declare module 'node:repl' {
|
|
423
|
+
export * from 'repl';
|
|
424
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare module 'stream/consumers' {
|
|
2
|
+
import { Blob as NodeBlob } from "node:buffer";
|
|
3
|
+
import { Readable } from 'node:stream';
|
|
4
|
+
function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
|
|
5
|
+
function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
|
|
6
|
+
function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
|
|
7
|
+
function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<NodeBlob>;
|
|
8
|
+
function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
|
|
9
|
+
}
|
|
10
|
+
declare module 'node:stream/consumers' {
|
|
11
|
+
export * from 'stream/consumers';
|
|
12
|
+
}
|
|
@@ -1,67 +1,42 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
import { FinishedOptions, PipelineSource, PipelineTransform,
|
|
3
|
-
PipelineDestination, PipelinePromise, PipelineOptions } from "stream";
|
|
4
|
-
|
|
1
|
+
declare module 'stream/promises' {
|
|
2
|
+
import { FinishedOptions, PipelineSource, PipelineTransform, PipelineDestination, PipelinePromise, PipelineOptions } from 'node:stream';
|
|
5
3
|
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
|
|
6
|
-
|
|
7
|
-
function pipeline<A extends PipelineSource<any>,
|
|
8
|
-
B extends PipelineDestination<A, any>>(
|
|
9
|
-
source: A,
|
|
10
|
-
destination: B,
|
|
11
|
-
options?: PipelineOptions
|
|
12
|
-
): PipelinePromise<B>;
|
|
13
|
-
function pipeline<A extends PipelineSource<any>,
|
|
14
|
-
T1 extends PipelineTransform<A, any>,
|
|
15
|
-
B extends PipelineDestination<T1, any>>(
|
|
4
|
+
function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(source: A, destination: B, options?: PipelineOptions): PipelinePromise<B>;
|
|
5
|
+
function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, B extends PipelineDestination<T1, any>>(
|
|
16
6
|
source: A,
|
|
17
7
|
transform1: T1,
|
|
18
8
|
destination: B,
|
|
19
9
|
options?: PipelineOptions
|
|
20
10
|
): PipelinePromise<B>;
|
|
21
|
-
function pipeline<A extends PipelineSource<any>,
|
|
22
|
-
T1 extends PipelineTransform<A, any>,
|
|
23
|
-
T2 extends PipelineTransform<T1, any>,
|
|
24
|
-
B extends PipelineDestination<T2, any>>(
|
|
11
|
+
function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, T2 extends PipelineTransform<T1, any>, B extends PipelineDestination<T2, any>>(
|
|
25
12
|
source: A,
|
|
26
13
|
transform1: T1,
|
|
27
14
|
transform2: T2,
|
|
28
15
|
destination: B,
|
|
29
16
|
options?: PipelineOptions
|
|
30
17
|
): PipelinePromise<B>;
|
|
31
|
-
function pipeline<
|
|
18
|
+
function pipeline<
|
|
19
|
+
A extends PipelineSource<any>,
|
|
32
20
|
T1 extends PipelineTransform<A, any>,
|
|
33
21
|
T2 extends PipelineTransform<T1, any>,
|
|
34
22
|
T3 extends PipelineTransform<T2, any>,
|
|
35
|
-
B extends PipelineDestination<T3, any
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
transform3: T3,
|
|
40
|
-
destination: B,
|
|
41
|
-
options?: PipelineOptions
|
|
42
|
-
): PipelinePromise<B>;
|
|
43
|
-
function pipeline<A extends PipelineSource<any>,
|
|
23
|
+
B extends PipelineDestination<T3, any>
|
|
24
|
+
>(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, options?: PipelineOptions): PipelinePromise<B>;
|
|
25
|
+
function pipeline<
|
|
26
|
+
A extends PipelineSource<any>,
|
|
44
27
|
T1 extends PipelineTransform<A, any>,
|
|
45
28
|
T2 extends PipelineTransform<T1, any>,
|
|
46
29
|
T3 extends PipelineTransform<T2, any>,
|
|
47
30
|
T4 extends PipelineTransform<T3, any>,
|
|
48
|
-
B extends PipelineDestination<T4, any
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
transform2: T2,
|
|
52
|
-
transform3: T3,
|
|
53
|
-
transform4: T4,
|
|
54
|
-
destination: B,
|
|
55
|
-
options?: PipelineOptions
|
|
56
|
-
): PipelinePromise<B>;
|
|
57
|
-
|
|
58
|
-
function pipeline(
|
|
59
|
-
streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
|
|
60
|
-
options?: PipelineOptions
|
|
61
|
-
): Promise<void>;
|
|
31
|
+
B extends PipelineDestination<T4, any>
|
|
32
|
+
>(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, options?: PipelineOptions): PipelinePromise<B>;
|
|
33
|
+
function pipeline(streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>, options?: PipelineOptions): Promise<void>;
|
|
62
34
|
function pipeline(
|
|
63
35
|
stream1: NodeJS.ReadableStream,
|
|
64
36
|
stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
|
|
65
|
-
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions
|
|
37
|
+
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
|
|
66
38
|
): Promise<void>;
|
|
67
39
|
}
|
|
40
|
+
declare module 'node:stream/promises' {
|
|
41
|
+
export * from 'stream/promises';
|
|
42
|
+
}
|