@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
|
@@ -0,0 +1,134 @@
|
|
|
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 `querystring` module provides utilities for parsing and formatting URL
|
|
6
|
+
* query strings. It can be accessed using:
|
|
7
|
+
*
|
|
8
|
+
* ```js
|
|
9
|
+
* const querystring = require('querystring');
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* `querystring` is more performant than `URLSearchParams` but is not a
|
|
13
|
+
* standardized API. Use `URLSearchParams` when performance is not critical
|
|
14
|
+
* or when compatibility with browser code is desirable.
|
|
15
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/querystring.js)
|
|
16
|
+
*/
|
|
17
|
+
declare module 'querystring' {
|
|
18
|
+
interface StringifyOptions {
|
|
19
|
+
encodeURIComponent?: ((str: string) => string) | undefined;
|
|
20
|
+
}
|
|
21
|
+
interface ParseOptions {
|
|
22
|
+
maxKeys?: number | undefined;
|
|
23
|
+
decodeURIComponent?: ((str: string) => string) | undefined;
|
|
24
|
+
}
|
|
25
|
+
interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> {}
|
|
26
|
+
interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> {}
|
|
27
|
+
/**
|
|
28
|
+
* The `querystring.stringify()` method produces a URL query string from a
|
|
29
|
+
* given `obj` by iterating through the object's "own properties".
|
|
30
|
+
*
|
|
31
|
+
* It serializes the following types of values passed in `obj`:[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
|
|
32
|
+
* [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
|
|
33
|
+
* [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
|
|
34
|
+
* [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
|
|
35
|
+
* [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
|
|
36
|
+
* [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
|
|
37
|
+
* [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
|
|
38
|
+
* [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to
|
|
39
|
+
* empty strings.
|
|
40
|
+
*
|
|
41
|
+
* ```js
|
|
42
|
+
* querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
|
|
43
|
+
* // Returns 'foo=bar&baz=qux&baz=quux&corge='
|
|
44
|
+
*
|
|
45
|
+
* querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');
|
|
46
|
+
* // Returns 'foo:bar;baz:qux'
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* By default, characters requiring percent-encoding within the query string will
|
|
50
|
+
* be encoded as UTF-8\. If an alternative encoding is required, then an alternative`encodeURIComponent` option will need to be specified:
|
|
51
|
+
*
|
|
52
|
+
* ```js
|
|
53
|
+
* // Assuming gbkEncodeURIComponent function already exists,
|
|
54
|
+
*
|
|
55
|
+
* querystring.stringify({ w: '中文', foo: 'bar' }, null, null,
|
|
56
|
+
* { encodeURIComponent: gbkEncodeURIComponent });
|
|
57
|
+
* ```
|
|
58
|
+
* @since v0.1.25
|
|
59
|
+
* @param obj The object to serialize into a URL query string
|
|
60
|
+
* @param [sep='&'] The substring used to delimit key and value pairs in the query string.
|
|
61
|
+
* @param [eq='='] . The substring used to delimit keys and values in the query string.
|
|
62
|
+
*/
|
|
63
|
+
function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
|
|
64
|
+
/**
|
|
65
|
+
* The `querystring.parse()` method parses a URL query string (`str`) into a
|
|
66
|
+
* collection of key and value pairs.
|
|
67
|
+
*
|
|
68
|
+
* For example, the query string `'foo=bar&abc=xyz&abc=123'` is parsed into:
|
|
69
|
+
*
|
|
70
|
+
* ```js
|
|
71
|
+
* {
|
|
72
|
+
* foo: 'bar',
|
|
73
|
+
* abc: ['xyz', '123']
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* The object returned by the `querystring.parse()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`,
|
|
78
|
+
* `obj.hasOwnProperty()`, and others
|
|
79
|
+
* are not defined and _will not work_.
|
|
80
|
+
*
|
|
81
|
+
* By default, percent-encoded characters within the query string will be assumed
|
|
82
|
+
* to use UTF-8 encoding. If an alternative character encoding is used, then an
|
|
83
|
+
* alternative `decodeURIComponent` option will need to be specified:
|
|
84
|
+
*
|
|
85
|
+
* ```js
|
|
86
|
+
* // Assuming gbkDecodeURIComponent function already exists...
|
|
87
|
+
*
|
|
88
|
+
* querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,
|
|
89
|
+
* { decodeURIComponent: gbkDecodeURIComponent });
|
|
90
|
+
* ```
|
|
91
|
+
* @since v0.1.25
|
|
92
|
+
* @param str The URL query string to parse
|
|
93
|
+
* @param [sep='&'] The substring used to delimit key and value pairs in the query string.
|
|
94
|
+
* @param [eq='='] . The substring used to delimit keys and values in the query string.
|
|
95
|
+
*/
|
|
96
|
+
function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery;
|
|
97
|
+
/**
|
|
98
|
+
* The querystring.encode() function is an alias for querystring.stringify().
|
|
99
|
+
*/
|
|
100
|
+
const encode: typeof stringify;
|
|
101
|
+
/**
|
|
102
|
+
* The querystring.decode() function is an alias for querystring.parse().
|
|
103
|
+
*/
|
|
104
|
+
const decode: typeof parse;
|
|
105
|
+
/**
|
|
106
|
+
* The `querystring.escape()` method performs URL percent-encoding on the given`str` in a manner that is optimized for the specific requirements of URL
|
|
107
|
+
* query strings.
|
|
108
|
+
*
|
|
109
|
+
* The `querystring.escape()` method is used by `querystring.stringify()` and is
|
|
110
|
+
* generally not expected to be used directly. It is exported primarily to allow
|
|
111
|
+
* application code to provide a replacement percent-encoding implementation if
|
|
112
|
+
* necessary by assigning `querystring.escape` to an alternative function.
|
|
113
|
+
* @since v0.1.25
|
|
114
|
+
*/
|
|
115
|
+
function escape(str: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* The `querystring.unescape()` method performs decoding of URL percent-encoded
|
|
118
|
+
* characters on the given `str`.
|
|
119
|
+
*
|
|
120
|
+
* The `querystring.unescape()` method is used by `querystring.parse()` and is
|
|
121
|
+
* generally not expected to be used directly. It is exported primarily to allow
|
|
122
|
+
* application code to provide a replacement decoding implementation if
|
|
123
|
+
* necessary by assigning `querystring.unescape` to an alternative function.
|
|
124
|
+
*
|
|
125
|
+
* By default, the `querystring.unescape()` method will attempt to use the
|
|
126
|
+
* JavaScript built-in `decodeURIComponent()` method to decode. If that fails,
|
|
127
|
+
* a safer equivalent that does not throw on malformed URLs will be used.
|
|
128
|
+
* @since v0.1.25
|
|
129
|
+
*/
|
|
130
|
+
function unescape(str: string): string;
|
|
131
|
+
}
|
|
132
|
+
declare module 'node:querystring' {
|
|
133
|
+
export * from 'querystring';
|
|
134
|
+
}
|
|
@@ -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
|
+
}
|