@node-red/editor-client 3.1.8 → 4.0.0-beta.2
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/locales/de/editor.json +2 -0
- package/locales/en-US/editor.json +10 -1
- package/locales/fr/editor.json +8 -1
- package/locales/ja/editor.json +10 -3
- package/package.json +1 -1
- package/public/red/about +52 -0
- package/public/red/red.js +1433 -263
- package/public/red/red.min.js +3 -3
- package/public/red/style.min.css +2 -2
- package/public/red/tours/3.1/welcome.js +231 -0
- package/public/red/tours/images/nr4-auto-complete.png +0 -0
- package/public/red/tours/images/nr4-config-select.png +0 -0
- package/public/red/tours/images/nr4-multiplayer.png +0 -0
- package/public/red/tours/images/nr4-plugins.png +0 -0
- package/public/red/tours/images/nr4-sf-config.png +0 -0
- package/public/red/tours/images/nr4-timestamp-formatting.png +0 -0
- package/public/red/tours/welcome.js +105 -161
- package/public/types/node/assert/strict.d.ts +1 -1
- package/public/types/node/assert.d.ts +8 -9
- package/public/types/node/async_hooks.d.ts +9 -5
- package/public/types/node/buffer.d.ts +43 -18
- package/public/types/node/child_process.d.ts +8 -5
- package/public/types/node/cluster.d.ts +15 -19
- package/public/types/node/console.d.ts +2 -2
- package/public/types/node/crypto.d.ts +165 -70
- package/public/types/node/dgram.d.ts +4 -4
- package/public/types/node/diagnostics_channel.d.ts +8 -7
- package/public/types/node/dns/promises.d.ts +11 -9
- package/public/types/node/dns.d.ts +18 -13
- package/public/types/node/dom-events.d.ts +129 -0
- package/public/types/node/domain.d.ts +2 -2
- package/public/types/node/events.d.ts +49 -12
- package/public/types/node/fs/promises.d.ts +68 -24
- package/public/types/node/fs.d.ts +132 -59
- package/public/types/node/globals.d.ts +31 -17
- package/public/types/node/http.d.ts +138 -27
- package/public/types/node/http2.d.ts +38 -5
- package/public/types/node/https.d.ts +12 -3
- package/public/types/node/module.d.ts +1 -2
- package/public/types/node/net.d.ts +69 -28
- package/public/types/node/os.d.ts +16 -5
- package/public/types/node/path.d.ts +5 -5
- package/public/types/node/perf_hooks.d.ts +48 -9
- package/public/types/node/process.d.ts +18 -17
- package/public/types/node/querystring.d.ts +2 -2
- package/public/types/node/readline/promises.d.ts +146 -0
- package/public/types/node/readline.d.ts +141 -31
- package/public/types/node/stream/consumers.d.ts +2 -2
- package/public/types/node/stream/promises.d.ts +1 -1
- package/public/types/node/stream/web.d.ts +4 -66
- package/public/types/node/stream.d.ts +96 -118
- package/public/types/node/string_decoder.d.ts +2 -2
- package/public/types/node/test.d.ts +200 -16
- package/public/types/node/timers/promises.d.ts +1 -26
- package/public/types/node/timers.d.ts +2 -2
- package/public/types/node/tls.d.ts +21 -12
- package/public/types/node/trace_events.d.ts +12 -2
- package/public/types/node/ts4.8/assert/strict.d.ts +11 -0
- package/public/types/node/ts4.8/assert.d.ts +964 -0
- package/public/types/node/ts4.8/async_hooks.d.ts +504 -0
- package/public/types/node/ts4.8/buffer.d.ts +2262 -0
- package/public/types/node/ts4.8/child_process.d.ts +1372 -0
- package/public/types/node/ts4.8/cluster.d.ts +413 -0
- package/public/types/node/ts4.8/console.d.ts +415 -0
- package/public/types/node/ts4.8/crypto.d.ts +3967 -0
- package/public/types/node/ts4.8/dgram.d.ts +548 -0
- package/public/types/node/ts4.8/diagnostics_channel.d.ts +156 -0
- package/public/types/node/ts4.8/dns/promises.d.ts +373 -0
- package/public/types/node/ts4.8/dns.d.ts +662 -0
- package/public/types/node/ts4.8/dom-events.d.ts +129 -0
- package/public/types/node/ts4.8/domain.d.ts +173 -0
- package/public/types/node/ts4.8/events.d.ts +681 -0
- package/public/types/node/ts4.8/fs/promises.d.ts +1141 -0
- package/public/types/node/ts4.8/fs.d.ts +3875 -0
- package/public/types/node/ts4.8/globals.d.ts +297 -0
- package/public/types/node/ts4.8/http.d.ts +1617 -0
- package/public/types/node/ts4.8/http2.d.ts +2137 -0
- package/public/types/node/ts4.8/https.d.ts +544 -0
- package/public/types/node/ts4.8/module.d.ts +117 -0
- package/public/types/node/ts4.8/net.d.ts +872 -0
- package/public/types/node/ts4.8/os.d.ts +469 -0
- package/public/types/node/ts4.8/path.d.ts +194 -0
- package/public/types/node/ts4.8/perf_hooks.d.ts +628 -0
- package/public/types/node/ts4.8/process.d.ts +1485 -0
- package/public/types/node/ts4.8/querystring.d.ts +134 -0
- package/public/types/node/ts4.8/readline/promises.d.ts +146 -0
- package/public/types/node/ts4.8/readline.d.ts +656 -0
- package/public/types/node/ts4.8/stream/consumers.d.ts +15 -0
- package/public/types/node/ts4.8/stream/promises.d.ts +45 -0
- package/public/types/node/ts4.8/stream/web.d.ts +333 -0
- package/public/types/node/ts4.8/stream.d.ts +1343 -0
- package/public/types/node/ts4.8/string_decoder.d.ts +70 -0
- package/public/types/node/ts4.8/test.d.ts +377 -0
- package/public/types/node/ts4.8/timers/promises.d.ts +71 -0
- package/public/types/node/ts4.8/timers.d.ts +97 -0
- package/public/types/node/ts4.8/tls.d.ts +1031 -0
- package/public/types/node/ts4.8/trace_events.d.ts +174 -0
- package/public/types/node/ts4.8/tty.d.ts +209 -0
- package/public/types/node/ts4.8/url.d.ts +900 -0
- package/public/types/node/ts4.8/util.d.ts +1853 -0
- package/public/types/node/ts4.8/v8.d.ts +399 -0
- package/public/types/node/ts4.8/vm.d.ts +512 -0
- package/public/types/node/ts4.8/wasi.d.ts +161 -0
- package/public/types/node/ts4.8/worker_threads.d.ts +692 -0
- package/public/types/node/ts4.8/zlib.d.ts +520 -0
- package/public/types/node/tty.d.ts +5 -3
- package/public/types/node/url.d.ts +81 -39
- package/public/types/node/util.d.ts +269 -13
- package/public/types/node/v8.d.ts +22 -4
- package/public/types/node/vm.d.ts +7 -5
- package/public/types/node/wasi.d.ts +2 -2
- package/public/types/node/worker_threads.d.ts +51 -11
- package/public/types/node/zlib.d.ts +2 -2
- package/public/types/node-red/func.d.ts +26 -17
- package/public/vendor/ace/worker-jsonata.js +1 -1
- package/public/vendor/monaco/dist/{fa2cc0ab9f0bec2b3365.ttf → 0c718f5b7d2bce997c5f.ttf} +0 -0
- package/public/vendor/monaco/dist/css.worker.js +1 -1
- package/public/vendor/monaco/dist/css.worker.js.LICENSE.txt +1 -1
- package/public/vendor/monaco/dist/editor.js +1 -29
- package/public/vendor/monaco/dist/editor.js.LICENSE.txt +2 -2
- package/public/vendor/monaco/dist/editor.worker.js +1 -1
- package/public/vendor/monaco/dist/html.worker.js +1 -1
- package/public/vendor/monaco/dist/html.worker.js.LICENSE.txt +1 -1
- package/public/vendor/monaco/dist/json.worker.js +1 -1
- package/public/vendor/monaco/dist/json.worker.js.LICENSE.txt +1 -1
- package/public/vendor/monaco/dist/locale/cs.js +324 -106
- package/public/vendor/monaco/dist/locale/de.js +336 -118
- package/public/vendor/monaco/dist/locale/es.js +329 -111
- package/public/vendor/monaco/dist/locale/fr.js +334 -116
- package/public/vendor/monaco/dist/locale/it.js +327 -109
- package/public/vendor/monaco/dist/locale/ja.js +329 -111
- package/public/vendor/monaco/dist/locale/ko.js +330 -112
- package/public/vendor/monaco/dist/locale/pl.js +329 -111
- package/public/vendor/monaco/dist/locale/pt-br.js +329 -111
- package/public/vendor/monaco/dist/locale/qps-ploc.js +330 -112
- package/public/vendor/monaco/dist/locale/ru.js +331 -113
- package/public/vendor/monaco/dist/locale/tr.js +329 -111
- package/public/vendor/monaco/dist/locale/zh-hans.js +331 -113
- package/public/vendor/monaco/dist/locale/zh-hant.js +331 -113
- package/public/vendor/monaco/dist/ts.worker.js +2 -2
- package/public/vendor/vendor.js +1 -1
- package/public/vendor/monaco/dist/7064e66c3890a12c47b4.ttf +0 -0
- /package/public/red/tours/{images → 3.1/images}/context-menu.png +0 -0
- /package/public/red/tours/{images → 3.1/images}/global-env-vars.png +0 -0
- /package/public/red/tours/{images → 3.1/images}/hiding-flows.png +0 -0
- /package/public/red/tours/{images → 3.1/images}/locking-flows.png +0 -0
- /package/public/red/tours/{images → 3.1/images}/mermaid.png +0 -0
- /package/public/red/tours/{images → 3.1/images}/node-help.png +0 -0
- /package/public/red/tours/{images → 3.1/images}/tab-changes.png +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/
|
|
2
|
+
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The `querystring` module provides utilities for parsing and formatting URL
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* `querystring` is more performant than `URLSearchParams` but is not a
|
|
13
13
|
* standardized API. Use `URLSearchParams` when performance is not critical
|
|
14
14
|
* or when compatibility with browser code is desirable.
|
|
15
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
15
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/querystring.js)
|
|
16
16
|
*/
|
|
17
17
|
declare module 'querystring' {
|
|
18
18
|
interface StringifyOptions {
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
|
|
2
|
+
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The `readline/promise` module provides an API for reading lines of input from a Readable stream one line at a time.
|
|
6
|
+
*
|
|
7
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/readline/promises.js)
|
|
8
|
+
* @since v17.0.0
|
|
9
|
+
*/
|
|
10
|
+
declare module 'readline/promises' {
|
|
11
|
+
import { Interface as _Interface, ReadLineOptions, Completer, AsyncCompleter, Direction } from 'node:readline';
|
|
12
|
+
import { Abortable } from 'node:events';
|
|
13
|
+
|
|
14
|
+
class Interface extends _Interface {
|
|
15
|
+
/**
|
|
16
|
+
* The rl.question() method displays the query by writing it to the output, waits for user input to be provided on input,
|
|
17
|
+
* then invokes the callback function passing the provided input as the first argument.
|
|
18
|
+
*
|
|
19
|
+
* When called, rl.question() will resume the input stream if it has been paused.
|
|
20
|
+
*
|
|
21
|
+
* If the readlinePromises.Interface was created with output set to null or undefined the query is not written.
|
|
22
|
+
*
|
|
23
|
+
* If the question is called after rl.close(), it returns a rejected promise.
|
|
24
|
+
*
|
|
25
|
+
* Example usage:
|
|
26
|
+
*
|
|
27
|
+
* ```js
|
|
28
|
+
* const answer = await rl.question('What is your favorite food? ');
|
|
29
|
+
* console.log(`Oh, so your favorite food is ${answer}`);
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* Using an AbortSignal to cancel a question.
|
|
33
|
+
*
|
|
34
|
+
* ```js
|
|
35
|
+
* const signal = AbortSignal.timeout(10_000);
|
|
36
|
+
*
|
|
37
|
+
* signal.addEventListener('abort', () => {
|
|
38
|
+
* console.log('The food question timed out');
|
|
39
|
+
* }, { once: true });
|
|
40
|
+
*
|
|
41
|
+
* const answer = await rl.question('What is your favorite food? ', { signal });
|
|
42
|
+
* console.log(`Oh, so your favorite food is ${answer}`);
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @since v17.0.0
|
|
46
|
+
* @param query A statement or query to write to output, prepended to the prompt.
|
|
47
|
+
*/
|
|
48
|
+
question(query: string): Promise<string>;
|
|
49
|
+
question(query: string, options: Abortable): Promise<string>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
class Readline {
|
|
53
|
+
/**
|
|
54
|
+
* @param stream A TTY stream.
|
|
55
|
+
*/
|
|
56
|
+
constructor(stream: NodeJS.WritableStream, options?: { autoCommit?: boolean });
|
|
57
|
+
/**
|
|
58
|
+
* The `rl.clearLine()` method adds to the internal list of pending action an action that clears current line of the associated `stream` in a specified direction identified by `dir`.
|
|
59
|
+
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
|
|
60
|
+
*/
|
|
61
|
+
clearLine(dir: Direction): this;
|
|
62
|
+
/**
|
|
63
|
+
* The `rl.clearScreenDown()` method adds to the internal list of pending action an action that clears the associated `stream` from the current position of the cursor down.
|
|
64
|
+
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
|
|
65
|
+
*/
|
|
66
|
+
clearScreenDown(): this;
|
|
67
|
+
/**
|
|
68
|
+
* The `rl.commit()` method sends all the pending actions to the associated `stream` and clears the internal list of pending actions.
|
|
69
|
+
*/
|
|
70
|
+
commit(): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* The `rl.cursorTo()` method adds to the internal list of pending action an action that moves cursor to the specified position in the associated `stream`.
|
|
73
|
+
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
|
|
74
|
+
*/
|
|
75
|
+
cursorTo(x: number, y?: number): this;
|
|
76
|
+
/**
|
|
77
|
+
* The `rl.moveCursor()` method adds to the internal list of pending action an action that moves the cursor relative to its current position in the associated `stream`.
|
|
78
|
+
* Call `rl.commit()` to see the effect of this method, unless autoCommit: true was passed to the constructor.
|
|
79
|
+
*/
|
|
80
|
+
moveCursor(dx: number, dy: number): this;
|
|
81
|
+
/**
|
|
82
|
+
* The `rl.rollback()` method clears the internal list of pending actions without sending it to the associated `stream`.
|
|
83
|
+
*/
|
|
84
|
+
rollback(): this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance.
|
|
89
|
+
*
|
|
90
|
+
* ```js
|
|
91
|
+
* const readlinePromises = require('node:readline/promises');
|
|
92
|
+
* const rl = readlinePromises.createInterface({
|
|
93
|
+
* input: process.stdin,
|
|
94
|
+
* output: process.stdout
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* Once the `readlinePromises.Interface` instance is created, the most common case is to listen for the `'line'` event:
|
|
99
|
+
*
|
|
100
|
+
* ```js
|
|
101
|
+
* rl.on('line', (line) => {
|
|
102
|
+
* console.log(`Received: ${line}`);
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* If `terminal` is `true` for this instance then the `output` stream will get the best compatibility if it defines an `output.columns` property,
|
|
107
|
+
* and emits a `'resize'` event on the `output`, if or when the columns ever change (`process.stdout` does this automatically when it is a TTY).
|
|
108
|
+
*
|
|
109
|
+
* ## Use of the `completer` function
|
|
110
|
+
*
|
|
111
|
+
* The `completer` function takes the current line entered by the user as an argument, and returns an `Array` with 2 entries:
|
|
112
|
+
*
|
|
113
|
+
* - An Array with matching entries for the completion.
|
|
114
|
+
* - The substring that was used for the matching.
|
|
115
|
+
*
|
|
116
|
+
* For instance: `[[substr1, substr2, ...], originalsubstring]`.
|
|
117
|
+
*
|
|
118
|
+
* ```js
|
|
119
|
+
* function completer(line) {
|
|
120
|
+
* const completions = '.help .error .exit .quit .q'.split(' ');
|
|
121
|
+
* const hits = completions.filter((c) => c.startsWith(line));
|
|
122
|
+
* // Show all completions if none found
|
|
123
|
+
* return [hits.length ? hits : completions, line];
|
|
124
|
+
* }
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* The `completer` function can also returns a `Promise`, or be asynchronous:
|
|
128
|
+
*
|
|
129
|
+
* ```js
|
|
130
|
+
* async function completer(linePartial) {
|
|
131
|
+
* await someAsyncWork();
|
|
132
|
+
* return [['123'], linePartial];
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
function createInterface(
|
|
137
|
+
input: NodeJS.ReadableStream,
|
|
138
|
+
output?: NodeJS.WritableStream,
|
|
139
|
+
completer?: Completer | AsyncCompleter,
|
|
140
|
+
terminal?: boolean,
|
|
141
|
+
): Interface;
|
|
142
|
+
function createInterface(options: ReadLineOptions): Interface;
|
|
143
|
+
}
|
|
144
|
+
declare module 'node:readline/promises' {
|
|
145
|
+
export * from 'readline/promises';
|
|
146
|
+
}
|
|
@@ -1,39 +1,46 @@
|
|
|
1
1
|
|
|
2
|
-
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/
|
|
2
|
+
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* The `readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time.
|
|
6
|
-
*
|
|
5
|
+
* The `readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time.
|
|
6
|
+
*
|
|
7
|
+
* To use the promise-based APIs:
|
|
7
8
|
*
|
|
8
9
|
* ```js
|
|
9
|
-
*
|
|
10
|
+
* import * as readline from 'node:readline/promises';
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* To use the callback and sync APIs:
|
|
14
|
+
*
|
|
15
|
+
* ```js
|
|
16
|
+
* import * as readline from 'node:readline';
|
|
10
17
|
* ```
|
|
11
18
|
*
|
|
12
19
|
* The following simple example illustrates the basic use of the `readline` module.
|
|
13
20
|
*
|
|
14
21
|
* ```js
|
|
15
|
-
*
|
|
22
|
+
* import * as readline from 'node:readline/promises';
|
|
23
|
+
* import { stdin as input, stdout as output } from 'node:process';
|
|
24
|
+
*
|
|
25
|
+
* const rl = readline.createInterface({ input, output });
|
|
16
26
|
*
|
|
17
|
-
* const
|
|
18
|
-
* input: process.stdin,
|
|
19
|
-
* output: process.stdout
|
|
20
|
-
* });
|
|
27
|
+
* const answer = await rl.question('What do you think of Node.js? ');
|
|
21
28
|
*
|
|
22
|
-
*
|
|
23
|
-
* // TODO: Log the answer in a database
|
|
24
|
-
* console.log(`Thank you for your valuable feedback: ${answer}`);
|
|
29
|
+
* console.log(`Thank you for your valuable feedback: ${answer}`);
|
|
25
30
|
*
|
|
26
|
-
*
|
|
27
|
-
* });
|
|
31
|
+
* rl.close();
|
|
28
32
|
* ```
|
|
29
33
|
*
|
|
30
34
|
* Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be
|
|
31
35
|
* received on the `input` stream.
|
|
32
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
36
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/readline.js)
|
|
33
37
|
*/
|
|
34
38
|
declare module 'readline' {
|
|
35
39
|
import { Abortable, EventEmitter } from 'node:events';
|
|
36
|
-
|
|
40
|
+
import * as promises from 'node:readline/promises';
|
|
41
|
+
|
|
42
|
+
export { promises };
|
|
43
|
+
export interface Key {
|
|
37
44
|
sequence?: string | undefined;
|
|
38
45
|
name?: string | undefined;
|
|
39
46
|
ctrl?: boolean | undefined;
|
|
@@ -47,7 +54,7 @@ declare module 'readline' {
|
|
|
47
54
|
* and is read from, the `input` stream.
|
|
48
55
|
* @since v0.1.104
|
|
49
56
|
*/
|
|
50
|
-
class Interface extends EventEmitter {
|
|
57
|
+
export class Interface extends EventEmitter {
|
|
51
58
|
readonly terminal: boolean;
|
|
52
59
|
/**
|
|
53
60
|
* The current input data being processed by node.
|
|
@@ -314,11 +321,11 @@ declare module 'readline' {
|
|
|
314
321
|
prependOnceListener(event: 'history', listener: (history: string[]) => void): this;
|
|
315
322
|
[Symbol.asyncIterator](): AsyncIterableIterator<string>;
|
|
316
323
|
}
|
|
317
|
-
type ReadLine = Interface; // type forwarded for backwards compatibility
|
|
318
|
-
type Completer = (line: string) => CompleterResult;
|
|
319
|
-
type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => void;
|
|
320
|
-
type CompleterResult = [string[], string];
|
|
321
|
-
interface ReadLineOptions {
|
|
324
|
+
export type ReadLine = Interface; // type forwarded for backwards compatibility
|
|
325
|
+
export type Completer = (line: string) => CompleterResult;
|
|
326
|
+
export type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => void;
|
|
327
|
+
export type CompleterResult = [string[], string];
|
|
328
|
+
export interface ReadLineOptions {
|
|
322
329
|
input: NodeJS.ReadableStream;
|
|
323
330
|
output?: NodeJS.WritableStream | undefined;
|
|
324
331
|
completer?: Completer | AsyncCompleter | undefined;
|
|
@@ -379,8 +386,8 @@ declare module 'readline' {
|
|
|
379
386
|
* ```
|
|
380
387
|
* @since v0.1.98
|
|
381
388
|
*/
|
|
382
|
-
function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
|
|
383
|
-
function createInterface(options: ReadLineOptions): Interface;
|
|
389
|
+
export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
|
|
390
|
+
export function createInterface(options: ReadLineOptions): Interface;
|
|
384
391
|
/**
|
|
385
392
|
* The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input.
|
|
386
393
|
*
|
|
@@ -397,11 +404,114 @@ declare module 'readline' {
|
|
|
397
404
|
* if (process.stdin.isTTY)
|
|
398
405
|
* process.stdin.setRawMode(true);
|
|
399
406
|
* ```
|
|
407
|
+
*
|
|
408
|
+
* ## Example: Tiny CLI
|
|
409
|
+
*
|
|
410
|
+
* The following example illustrates the use of `readline.Interface` class to
|
|
411
|
+
* implement a small command-line interface:
|
|
412
|
+
*
|
|
413
|
+
* ```js
|
|
414
|
+
* const readline = require('readline');
|
|
415
|
+
* const rl = readline.createInterface({
|
|
416
|
+
* input: process.stdin,
|
|
417
|
+
* output: process.stdout,
|
|
418
|
+
* prompt: 'OHAI> '
|
|
419
|
+
* });
|
|
420
|
+
*
|
|
421
|
+
* rl.prompt();
|
|
422
|
+
*
|
|
423
|
+
* rl.on('line', (line) => {
|
|
424
|
+
* switch (line.trim()) {
|
|
425
|
+
* case 'hello':
|
|
426
|
+
* console.log('world!');
|
|
427
|
+
* break;
|
|
428
|
+
* default:
|
|
429
|
+
* console.log(`Say what? I might have heard '${line.trim()}'`);
|
|
430
|
+
* break;
|
|
431
|
+
* }
|
|
432
|
+
* rl.prompt();
|
|
433
|
+
* }).on('close', () => {
|
|
434
|
+
* console.log('Have a great day!');
|
|
435
|
+
* process.exit(0);
|
|
436
|
+
* });
|
|
437
|
+
* ```
|
|
438
|
+
*
|
|
439
|
+
* ## Example: Read file stream line-by-Line
|
|
440
|
+
*
|
|
441
|
+
* A common use case for `readline` is to consume an input file one line at a
|
|
442
|
+
* time. The easiest way to do so is leveraging the `fs.ReadStream` API as
|
|
443
|
+
* well as a `for await...of` loop:
|
|
444
|
+
*
|
|
445
|
+
* ```js
|
|
446
|
+
* const fs = require('fs');
|
|
447
|
+
* const readline = require('readline');
|
|
448
|
+
*
|
|
449
|
+
* async function processLineByLine() {
|
|
450
|
+
* const fileStream = fs.createReadStream('input.txt');
|
|
451
|
+
*
|
|
452
|
+
* const rl = readline.createInterface({
|
|
453
|
+
* input: fileStream,
|
|
454
|
+
* crlfDelay: Infinity
|
|
455
|
+
* });
|
|
456
|
+
* // Note: we use the crlfDelay option to recognize all instances of CR LF
|
|
457
|
+
* // ('\r\n') in input.txt as a single line break.
|
|
458
|
+
*
|
|
459
|
+
* for await (const line of rl) {
|
|
460
|
+
* // Each line in input.txt will be successively available here as `line`.
|
|
461
|
+
* console.log(`Line from file: ${line}`);
|
|
462
|
+
* }
|
|
463
|
+
* }
|
|
464
|
+
*
|
|
465
|
+
* processLineByLine();
|
|
466
|
+
* ```
|
|
467
|
+
*
|
|
468
|
+
* Alternatively, one could use the `'line'` event:
|
|
469
|
+
*
|
|
470
|
+
* ```js
|
|
471
|
+
* const fs = require('fs');
|
|
472
|
+
* const readline = require('readline');
|
|
473
|
+
*
|
|
474
|
+
* const rl = readline.createInterface({
|
|
475
|
+
* input: fs.createReadStream('sample.txt'),
|
|
476
|
+
* crlfDelay: Infinity
|
|
477
|
+
* });
|
|
478
|
+
*
|
|
479
|
+
* rl.on('line', (line) => {
|
|
480
|
+
* console.log(`Line from file: ${line}`);
|
|
481
|
+
* });
|
|
482
|
+
* ```
|
|
483
|
+
*
|
|
484
|
+
* Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
|
|
485
|
+
*
|
|
486
|
+
* ```js
|
|
487
|
+
* const { once } = require('events');
|
|
488
|
+
* const { createReadStream } = require('fs');
|
|
489
|
+
* const { createInterface } = require('readline');
|
|
490
|
+
*
|
|
491
|
+
* (async function processLineByLine() {
|
|
492
|
+
* try {
|
|
493
|
+
* const rl = createInterface({
|
|
494
|
+
* input: createReadStream('big-file.txt'),
|
|
495
|
+
* crlfDelay: Infinity
|
|
496
|
+
* });
|
|
497
|
+
*
|
|
498
|
+
* rl.on('line', (line) => {
|
|
499
|
+
* // Process the line.
|
|
500
|
+
* });
|
|
501
|
+
*
|
|
502
|
+
* await once(rl, 'close');
|
|
503
|
+
*
|
|
504
|
+
* console.log('File processed.');
|
|
505
|
+
* } catch (err) {
|
|
506
|
+
* console.error(err);
|
|
507
|
+
* }
|
|
508
|
+
* })();
|
|
509
|
+
* ```
|
|
400
510
|
* @since v0.7.7
|
|
401
511
|
*/
|
|
402
|
-
function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
|
|
403
|
-
type Direction = -1 | 0 | 1;
|
|
404
|
-
interface CursorPos {
|
|
512
|
+
export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
|
|
513
|
+
export type Direction = -1 | 0 | 1;
|
|
514
|
+
export interface CursorPos {
|
|
405
515
|
rows: number;
|
|
406
516
|
cols: number;
|
|
407
517
|
}
|
|
@@ -412,7 +522,7 @@ declare module 'readline' {
|
|
|
412
522
|
* @param callback Invoked once the operation completes.
|
|
413
523
|
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
|
414
524
|
*/
|
|
415
|
-
function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
|
|
525
|
+
export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
|
|
416
526
|
/**
|
|
417
527
|
* The `readline.clearScreenDown()` method clears the given `TTY` stream from
|
|
418
528
|
* the current position of the cursor down.
|
|
@@ -420,7 +530,7 @@ declare module 'readline' {
|
|
|
420
530
|
* @param callback Invoked once the operation completes.
|
|
421
531
|
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
|
422
532
|
*/
|
|
423
|
-
function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
|
|
533
|
+
export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
|
|
424
534
|
/**
|
|
425
535
|
* The `readline.cursorTo()` method moves cursor to the specified position in a
|
|
426
536
|
* given `TTY` `stream`.
|
|
@@ -428,7 +538,7 @@ declare module 'readline' {
|
|
|
428
538
|
* @param callback Invoked once the operation completes.
|
|
429
539
|
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
|
430
540
|
*/
|
|
431
|
-
function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
|
|
541
|
+
export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
|
|
432
542
|
/**
|
|
433
543
|
* The `readline.moveCursor()` method moves the cursor _relative_ to its current
|
|
434
544
|
* position in a given `TTY` `stream`.
|
|
@@ -539,7 +649,7 @@ declare module 'readline' {
|
|
|
539
649
|
* @param callback Invoked once the operation completes.
|
|
540
650
|
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
|
541
651
|
*/
|
|
542
|
-
function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
|
|
652
|
+
export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
|
|
543
653
|
}
|
|
544
654
|
declare module 'node:readline' {
|
|
545
655
|
export * from 'readline';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/
|
|
2
|
+
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
|
|
3
3
|
|
|
4
4
|
declare module 'stream/consumers' {
|
|
5
|
-
import { Readable } from 'node:stream';
|
|
6
5
|
import { Blob as NodeBlob } from "node:buffer";
|
|
6
|
+
import { Readable } from 'node:stream';
|
|
7
7
|
function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
|
|
8
8
|
function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
|
|
9
9
|
function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/
|
|
2
|
+
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
|
|
3
3
|
|
|
4
4
|
declare module 'stream/promises' {
|
|
5
5
|
import { FinishedOptions, PipelineSource, PipelineTransform, PipelineDestination, PipelinePromise, PipelineOptions } from 'node:stream';
|