@types/node 9.6.38 → 9.6.39

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.
node v9/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v9
9
9
 
10
10
  Additional Details
11
- * Last updated: Thu, 15 Nov 2018 01:51:18 GMT
11
+ * Last updated: Thu, 15 Nov 2018 20:14:07 GMT
12
12
  * Dependencies: none
13
13
  * Global values: Buffer, NodeJS, SlowBuffer, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, require, setImmediate, setInterval, setTimeout
14
14
 
node v9/index.d.ts CHANGED
@@ -1881,8 +1881,9 @@ declare module "punycode" {
1881
1881
  }
1882
1882
 
1883
1883
  declare module "repl" {
1884
- import { ReadLine, Completer, AsyncCompleter } from "readline";
1884
+ import { Interface, Completer, AsyncCompleter } from "readline";
1885
1885
  import { Context } from "vm";
1886
+ import { InspectOptions } from "util";
1886
1887
 
1887
1888
  interface ReplOptions {
1888
1889
  /**
@@ -1903,7 +1904,8 @@ declare module "repl" {
1903
1904
  /**
1904
1905
  * If `true`, specifies that the output should be treated as a TTY terminal, and have
1905
1906
  * ANSI/VT100 escape codes written to it.
1906
- * Default: checking the value of the `isTTY` property on the output stream upon instantiation.
1907
+ * Default: checking the value of the `isTTY` property on the output stream upon
1908
+ * instantiation.
1907
1909
  */
1908
1910
  terminal?: boolean;
1909
1911
  /**
@@ -1911,8 +1913,11 @@ declare module "repl" {
1911
1913
  * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can
1912
1914
  * error with `repl.Recoverable` to indicate the input was incomplete and prompt for
1913
1915
  * additional lines.
1916
+ *
1917
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation
1918
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions
1914
1919
  */
1915
- eval?: (evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void;
1920
+ eval?: REPLEval;
1916
1921
  /**
1917
1922
  * If `true`, specifies that the default `writer` function should include ANSI color
1918
1923
  * styling to REPL output. If a custom `writer` function is provided then this has no
@@ -1935,16 +1940,26 @@ declare module "repl" {
1935
1940
  ignoreUndefined?: boolean;
1936
1941
  /**
1937
1942
  * The function to invoke to format the output of each command before writing to `output`.
1938
- * Default: `util.inspect()`.
1943
+ * Default: a wrapper for `util.inspect`.
1944
+ *
1945
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output
1939
1946
  */
1940
- writer?: (obj: any) => string;
1947
+ writer?: REPLWriter;
1941
1948
  /**
1942
- * An optional function used for custom Tab auto completion. See
1943
- * [`readline.InterfaceCompleter`](https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function)
1944
- * for an example.
1949
+ * An optional function used for custom Tab auto completion.
1950
+ *
1951
+ * @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function
1945
1952
  */
1946
1953
  completer?: Completer | AsyncCompleter;
1947
- replMode?: any;
1954
+ /**
1955
+ * A flag that specifies whether the default evaluator executes all JavaScript commands in
1956
+ * strict mode or default (sloppy) mode.
1957
+ * Accepted values are:
1958
+ * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode.
1959
+ * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
1960
+ * prefacing every repl statement with `'use strict'`.
1961
+ */
1962
+ replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT;
1948
1963
  /**
1949
1964
  * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is
1950
1965
  * pressed. This cannot be used together with a custom `eval` function.
@@ -1953,6 +1968,17 @@ declare module "repl" {
1953
1968
  breakEvalOnSigint?: boolean;
1954
1969
  }
1955
1970
 
1971
+ type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void;
1972
+ type REPLWriter = (this: REPLServer, obj: any) => string;
1973
+
1974
+ /**
1975
+ * This is the default "writer" value, if none is passed in the REPL options,
1976
+ * and it can be overridden by custom print functions.
1977
+ */
1978
+ const writer: REPLWriter & { options: InspectOptions };
1979
+
1980
+ type REPLCommandAction = (this: REPLServer, text: string) => void;
1981
+
1956
1982
  interface REPLCommand {
1957
1983
  /**
1958
1984
  * Help text to be displayed when `.help` is entered.
@@ -1961,21 +1987,139 @@ declare module "repl" {
1961
1987
  /**
1962
1988
  * The function to execute, optionally accepting a single string argument.
1963
1989
  */
1964
- action: (this: REPLServer, text: string) => void;
1990
+ action: REPLCommandAction;
1965
1991
  }
1966
1992
 
1967
- interface REPLServer extends ReadLine {
1968
- context: Context;
1969
- inputStream: NodeJS.ReadableStream;
1970
- outputStream: NodeJS.WritableStream;
1993
+ /**
1994
+ * Provides a customizable Read-Eval-Print-Loop (REPL).
1995
+ *
1996
+ * Instances of `repl.REPLServer` will accept individual lines of user input, evaluate those
1997
+ * according to a user-defined evaluation function, then output the result. Input and output
1998
+ * may be from `stdin` and `stdout`, respectively, or may be connected to any Node.js `stream`.
1999
+ *
2000
+ * Instances of `repl.REPLServer` support automatic completion of inputs, simplistic Emacs-style
2001
+ * line editing, multi-line inputs, ANSI-styled output, saving and restoring current REPL session
2002
+ * state, error recovery, and customizable evaluation functions.
2003
+ *
2004
+ * Instances of `repl.REPLServer` are created using the `repl.start()` method and _should not_
2005
+ * be created directly using the JavaScript `new` keyword.
2006
+ *
2007
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_repl
2008
+ */
2009
+ class REPLServer extends Interface {
2010
+ /**
2011
+ * The `vm.Context` provided to the `eval` function to be used for JavaScript
2012
+ * evaluation.
2013
+ */
2014
+ readonly context: Context;
2015
+ /**
2016
+ * The `Readable` stream from which REPL input will be read.
2017
+ */
2018
+ readonly inputStream: NodeJS.ReadableStream;
2019
+ /**
2020
+ * The `Writable` stream to which REPL output will be written.
2021
+ */
2022
+ readonly outputStream: NodeJS.WritableStream;
2023
+ /**
2024
+ * The commands registered via `replServer.defineCommand()`.
2025
+ */
2026
+ readonly commands: { readonly [name: string]: REPLCommand | undefined };
2027
+ /**
2028
+ * A value indicating whether the REPL is currently in "editor mode".
2029
+ *
2030
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys
2031
+ */
2032
+ readonly editorMode: boolean;
2033
+ /**
2034
+ * A value indicating whether the `_` variable has been assigned.
2035
+ *
2036
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
2037
+ */
2038
+ readonly underscoreAssigned: boolean;
2039
+ /**
2040
+ * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL).
2041
+ *
2042
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
2043
+ */
2044
+ readonly last: any;
2045
+ /**
2046
+ * A value indicating whether the `_error` variable has been assigned.
2047
+ *
2048
+ * @since v9.8.0
2049
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
2050
+ */
2051
+ readonly underscoreErrAssigned: boolean;
2052
+ /**
2053
+ * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL).
2054
+ *
2055
+ * @since v9.8.0
2056
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
2057
+ */
2058
+ readonly lastError: any;
2059
+ /**
2060
+ * Specified in the REPL options, this is the function to be used when evaluating each
2061
+ * given line of input. If not specified in the REPL options, this is an async wrapper
2062
+ * for the JavaScript `eval()` function.
2063
+ */
2064
+ readonly eval: REPLEval;
2065
+ /**
2066
+ * Specified in the REPL options, this is a value indicating whether the default
2067
+ * `writer` function should include ANSI color styling to REPL output.
2068
+ */
2069
+ readonly useColors: boolean;
2070
+ /**
2071
+ * Specified in the REPL options, this is a value indicating whether the default `eval`
2072
+ * function will use the JavaScript `global` as the context as opposed to creating a new
2073
+ * separate context for the REPL instance.
2074
+ */
2075
+ readonly useGlobal: boolean;
2076
+ /**
2077
+ * Specified in the REPL options, this is a value indicating whether the default `writer`
2078
+ * function should output the result of a command if it evaluates to `undefined`.
2079
+ */
2080
+ readonly ignoreUndefined: boolean;
2081
+ /**
2082
+ * Specified in the REPL options, this is the function to invoke to format the output of
2083
+ * each command before writing to `outputStream`. If not specified in the REPL options,
2084
+ * this will be a wrapper for `util.inspect`.
2085
+ */
2086
+ readonly writer: REPLWriter;
2087
+ /**
2088
+ * Specified in the REPL options, this is the function to use for custom Tab auto-completion.
2089
+ */
2090
+ readonly completer: Completer | AsyncCompleter;
2091
+ /**
2092
+ * Specified in the REPL options, this is a flag that specifies whether the default `eval`
2093
+ * function should execute all JavaScript commands in strict mode or default (sloppy) mode.
2094
+ * Possible values are:
2095
+ * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode.
2096
+ * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
2097
+ * prefacing every repl statement with `'use strict'`.
2098
+ */
2099
+ readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT;
2100
+
2101
+ /**
2102
+ * NOTE: According to the documentation:
2103
+ *
2104
+ * > Instances of `repl.REPLServer` are created using the `repl.start()` method and
2105
+ * > _should not_ be created directly using the JavaScript `new` keyword.
2106
+ *
2107
+ * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS.
2108
+ *
2109
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver
2110
+ */
2111
+ private constructor();
1971
2112
 
1972
2113
  /**
1973
2114
  * Used to add new `.`-prefixed commands to the REPL instance. Such commands are invoked
1974
2115
  * by typing a `.` followed by the `keyword`.
2116
+ *
1975
2117
  * @param keyword The command keyword (_without_ a leading `.` character).
1976
2118
  * @param cmd The function to invoke when the command is processed.
2119
+ *
2120
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_replserver_definecommand_keyword_cmd
1977
2121
  */
1978
- defineCommand(keyword: string, cmd: ((this: REPLServer, text: string) => void) | REPLCommand): void;
2122
+ defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void;
1979
2123
  /**
1980
2124
  * Readies the REPL instance for input from the user, printing the configured `prompt` to a
1981
2125
  * new line in the `output` and resuming the `input` to accept new input.
@@ -2000,37 +2144,108 @@ declare module "repl" {
2000
2144
 
2001
2145
  /**
2002
2146
  * events.EventEmitter
2003
- * 1. exit
2004
- * 2. reset
2147
+ * 1. close - inherited from `readline.Interface`
2148
+ * 2. line - inherited from `readline.Interface`
2149
+ * 3. pause - inherited from `readline.Interface`
2150
+ * 4. resume - inherited from `readline.Interface`
2151
+ * 5. SIGCONT - inherited from `readline.Interface`
2152
+ * 6. SIGINT - inherited from `readline.Interface`
2153
+ * 7. SIGTSTP - inherited from `readline.Interface`
2154
+ * 8. exit
2155
+ * 9. reset
2005
2156
  */
2006
2157
 
2007
2158
  addListener(event: string, listener: (...args: any[]) => void): this;
2159
+ addListener(event: "close", listener: () => void): this;
2160
+ addListener(event: "line", listener: (input: string) => void): this;
2161
+ addListener(event: "pause", listener: () => void): this;
2162
+ addListener(event: "resume", listener: () => void): this;
2163
+ addListener(event: "SIGCONT", listener: () => void): this;
2164
+ addListener(event: "SIGINT", listener: () => void): this;
2165
+ addListener(event: "SIGTSTP", listener: () => void): this;
2008
2166
  addListener(event: "exit", listener: () => void): this;
2009
2167
  addListener(event: "reset", listener: (context: Context) => void): this;
2010
2168
 
2011
2169
  emit(event: string | symbol, ...args: any[]): boolean;
2170
+ emit(event: "close"): boolean;
2171
+ emit(event: "line", input: string): boolean;
2172
+ emit(event: "pause"): boolean;
2173
+ emit(event: "resume"): boolean;
2174
+ emit(event: "SIGCONT"): boolean;
2175
+ emit(event: "SIGINT"): boolean;
2176
+ emit(event: "SIGTSTP"): boolean;
2012
2177
  emit(event: "exit"): boolean;
2013
2178
  emit(event: "reset", context: Context): boolean;
2014
2179
 
2015
2180
  on(event: string, listener: (...args: any[]) => void): this;
2181
+ on(event: "close", listener: () => void): this;
2182
+ on(event: "line", listener: (input: string) => void): this;
2183
+ on(event: "pause", listener: () => void): this;
2184
+ on(event: "resume", listener: () => void): this;
2185
+ on(event: "SIGCONT", listener: () => void): this;
2186
+ on(event: "SIGINT", listener: () => void): this;
2187
+ on(event: "SIGTSTP", listener: () => void): this;
2016
2188
  on(event: "exit", listener: () => void): this;
2017
2189
  on(event: "reset", listener: (context: Context) => void): this;
2018
2190
 
2019
2191
  once(event: string, listener: (...args: any[]) => void): this;
2192
+ once(event: "close", listener: () => void): this;
2193
+ once(event: "line", listener: (input: string) => void): this;
2194
+ once(event: "pause", listener: () => void): this;
2195
+ once(event: "resume", listener: () => void): this;
2196
+ once(event: "SIGCONT", listener: () => void): this;
2197
+ once(event: "SIGINT", listener: () => void): this;
2198
+ once(event: "SIGTSTP", listener: () => void): this;
2020
2199
  once(event: "exit", listener: () => void): this;
2021
2200
  once(event: "reset", listener: (context: Context) => void): this;
2022
2201
 
2023
2202
  prependListener(event: string, listener: (...args: any[]) => void): this;
2203
+ prependListener(event: "close", listener: () => void): this;
2204
+ prependListener(event: "line", listener: (input: string) => void): this;
2205
+ prependListener(event: "pause", listener: () => void): this;
2206
+ prependListener(event: "resume", listener: () => void): this;
2207
+ prependListener(event: "SIGCONT", listener: () => void): this;
2208
+ prependListener(event: "SIGINT", listener: () => void): this;
2209
+ prependListener(event: "SIGTSTP", listener: () => void): this;
2024
2210
  prependListener(event: "exit", listener: () => void): this;
2025
2211
  prependListener(event: "reset", listener: (context: Context) => void): this;
2026
2212
 
2027
2213
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
2214
+ prependOnceListener(event: "close", listener: () => void): this;
2215
+ prependOnceListener(event: "line", listener: (input: string) => void): this;
2216
+ prependOnceListener(event: "pause", listener: () => void): this;
2217
+ prependOnceListener(event: "resume", listener: () => void): this;
2218
+ prependOnceListener(event: "SIGCONT", listener: () => void): this;
2219
+ prependOnceListener(event: "SIGINT", listener: () => void): this;
2220
+ prependOnceListener(event: "SIGTSTP", listener: () => void): this;
2028
2221
  prependOnceListener(event: "exit", listener: () => void): this;
2029
2222
  prependOnceListener(event: "reset", listener: (context: Context) => void): this;
2030
2223
  }
2031
2224
 
2225
+ /**
2226
+ * A flag passed in the REPL options. Evaluates expressions in sloppy mode.
2227
+ */
2228
+ export const REPL_MODE_SLOPPY: symbol; // TODO: unique symbol
2229
+
2230
+ /**
2231
+ * A flag passed in the REPL options. Evaluates expressions in strict mode.
2232
+ * This is equivalent to prefacing every repl statement with `'use strict'`.
2233
+ */
2234
+ export const REPL_MODE_STRICT: symbol; // TODO: unique symbol
2235
+
2236
+ /**
2237
+ * Creates and starts a `repl.REPLServer` instance.
2238
+ *
2239
+ * @param options The options for the `REPLServer`. If `options` is a string, then it specifies
2240
+ * the input prompt.
2241
+ */
2032
2242
  function start(options?: string | ReplOptions): REPLServer;
2033
2243
 
2244
+ /**
2245
+ * Indicates a recoverable error that a `REPLServer` can use to support multi-line input.
2246
+ *
2247
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors
2248
+ */
2034
2249
  class Recoverable extends SyntaxError {
2035
2250
  err: Error;
2036
2251
 
@@ -2042,7 +2257,7 @@ declare module "readline" {
2042
2257
  import * as events from "events";
2043
2258
  import * as stream from "stream";
2044
2259
 
2045
- export interface Key {
2260
+ interface Key {
2046
2261
  sequence?: string;
2047
2262
  name?: string;
2048
2263
  ctrl?: boolean;
@@ -2050,12 +2265,33 @@ declare module "readline" {
2050
2265
  shift?: boolean;
2051
2266
  }
2052
2267
 
2053
- export interface ReadLine extends events.EventEmitter {
2268
+ class Interface extends events.EventEmitter {
2269
+ readonly terminal: boolean;
2270
+
2271
+ /**
2272
+ * NOTE: According to the documentation:
2273
+ *
2274
+ * > Instances of the `readline.Interface` class are constructed using the
2275
+ * > `readline.createInterface()` method.
2276
+ *
2277
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
2278
+ */
2279
+ protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean);
2280
+ /**
2281
+ * NOTE: According to the documentation:
2282
+ *
2283
+ * > Instances of the `readline.Interface` class are constructed using the
2284
+ * > `readline.createInterface()` method.
2285
+ *
2286
+ * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
2287
+ */
2288
+ protected constructor(options: ReadLineOptions);
2289
+
2054
2290
  setPrompt(prompt: string): void;
2055
2291
  prompt(preserveCursor?: boolean): void;
2056
2292
  question(query: string, callback: (answer: string) => void): void;
2057
- pause(): ReadLine;
2058
- resume(): ReadLine;
2293
+ pause(): this;
2294
+ resume(): this;
2059
2295
  close(): void;
2060
2296
  write(data: string | Buffer, key?: Key): void;
2061
2297
 
@@ -2125,12 +2361,14 @@ declare module "readline" {
2125
2361
  prependOnceListener(event: "SIGTSTP", listener: () => void): this;
2126
2362
  }
2127
2363
 
2364
+ type ReadLine = Interface; // type forwarded for backwards compatiblity
2365
+
2128
2366
  type Completer = (line: string) => CompleterResult;
2129
2367
  type AsyncCompleter = (line: string, callback: (err: any, result: CompleterResult) => void) => any;
2130
2368
 
2131
- export type CompleterResult = [string[], string];
2369
+ type CompleterResult = [string[], string];
2132
2370
 
2133
- export interface ReadLineOptions {
2371
+ interface ReadLineOptions {
2134
2372
  input: NodeJS.ReadableStream;
2135
2373
  output?: NodeJS.WritableStream;
2136
2374
  completer?: Completer | AsyncCompleter;
@@ -2141,14 +2379,14 @@ declare module "readline" {
2141
2379
  removeHistoryDuplicates?: boolean;
2142
2380
  }
2143
2381
 
2144
- export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): ReadLine;
2145
- export function createInterface(options: ReadLineOptions): ReadLine;
2382
+ function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
2383
+ function createInterface(options: ReadLineOptions): Interface;
2146
2384
 
2147
- export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number): void;
2148
- export function emitKeypressEvents(stream: NodeJS.ReadableStream, interface?: ReadLine): void;
2149
- export function moveCursor(stream: NodeJS.WritableStream, dx: number | string, dy: number | string): void;
2150
- export function clearLine(stream: NodeJS.WritableStream, dir: number): void;
2151
- export function clearScreenDown(stream: NodeJS.WritableStream): void;
2385
+ function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number): void;
2386
+ function emitKeypressEvents(stream: NodeJS.ReadableStream, interface?: Interface): void;
2387
+ function moveCursor(stream: NodeJS.WritableStream, dx: number | string, dy: number | string): void;
2388
+ function clearLine(stream: NodeJS.WritableStream, dir: number): void;
2389
+ function clearScreenDown(stream: NodeJS.WritableStream): void;
2152
2390
  }
2153
2391
 
2154
2392
  declare module "vm" {
node v9/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "9.6.38",
3
+ "version": "9.6.39",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -143,6 +143,6 @@
143
143
  },
144
144
  "scripts": {},
145
145
  "dependencies": {},
146
- "typesPublisherContentHash": "0040b8fffc075ed54633998fb4b773f371384dc1b8899b50033e850da61f4fdc",
146
+ "typesPublisherContentHash": "3d6a8b5453c5338c08459a64cf383c317e45f7a5c6a63c872a2d4c53c7aae73d",
147
147
  "typeScriptVersion": "2.0"
148
148
  }