+47
| import { | ||
| Readable, | ||
| ReadableOptions, | ||
| Writable, | ||
| WritableEvents, | ||
| WritableOptions | ||
| } from 'bare-stream' | ||
| interface ReadStream extends Readable { | ||
| readonly isTTY: true | ||
| setMode(mode: number): this | ||
| setRawMode(mode: boolean): this | ||
| } | ||
| declare class ReadStream extends Readable { | ||
| constructor(fd: number, opts?: ReadableOptions) | ||
| } | ||
| interface WriteStreamEvents extends WritableEvents { | ||
| resize: [] | ||
| } | ||
| interface WriteStream<M extends WriteStreamEvents = WriteStreamEvents> | ||
| extends Writable<M> { | ||
| readonly isTTY: true | ||
| readonly columns: number | ||
| readonly rows: number | ||
| getWindowSize(): [width: number, height: number] | ||
| } | ||
| declare class WriteStream< | ||
| M extends WriteStreamEvents = WriteStreamEvents | ||
| > extends Writable<M> { | ||
| constructor(fd: number, opts?: WritableOptions) | ||
| } | ||
| declare function isTTY(fd: number): boolean | ||
| declare const constants: { | ||
| mode: { NORMAL: number; RAW: number; IO: number } | ||
| state: { READING: number; CLOSING: number } | ||
| } | ||
| export { ReadStream, WriteStream, isTTY, isTTY as isatty, constants } |
+11
-3
@@ -278,6 +278,12 @@ #include <assert.h> | ||
| js_value_t **elements = malloc(sizeof(js_value_t *) * bufs_len); | ||
| uint32_t fetched; | ||
| err = js_get_array_elements(env, arr, elements, bufs_len, 0, &fetched); | ||
| assert(err == 0); | ||
| assert(fetched == bufs_len); | ||
| for (uint32_t i = 0; i < bufs_len; i++) { | ||
| js_value_t *item; | ||
| err = js_get_element(env, arr, i, &item); | ||
| assert(err == 0); | ||
| js_value_t *item = elements[i]; | ||
@@ -289,2 +295,4 @@ uv_buf_t *buf = &bufs[i]; | ||
| free(elements); | ||
| uv_write_t *req = &tty->requests.write; | ||
@@ -291,0 +299,0 @@ |
+2
-2
@@ -43,4 +43,4 @@ /* global Bare */ | ||
| setRawMode(mode) { | ||
| return this.setMode(mode ? constants.mode.RAW : constants.mode.NORMAL) | ||
| setRawMode(enabled) { | ||
| return this.setMode(enabled ? constants.mode.RAW : constants.mode.NORMAL) | ||
| } | ||
@@ -47,0 +47,0 @@ |
+7
-3
| { | ||
| "name": "bare-tty", | ||
| "version": "5.0.1", | ||
| "version": "5.0.2", | ||
| "description": "Native TTY streams for JavaScript", | ||
| "exports": { | ||
| ".": "./index.js", | ||
| ".": { | ||
| "types": "./index.d.ts", | ||
| "default": "./index.js" | ||
| }, | ||
| "./package": "./package.json", | ||
@@ -12,2 +15,3 @@ "./constants": "./lib/constants.js" | ||
| "index.js", | ||
| "index.d.ts", | ||
| "binding.c", | ||
@@ -34,3 +38,3 @@ "binding.js", | ||
| "engines": { | ||
| "bare": ">=1.7.0" | ||
| "bare": ">=1.16.0" | ||
| }, | ||
@@ -37,0 +41,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
564890
48.95%22
4.76%225
19.05%