diff --git a/package.json b/package.json index ab0366fbd..d34683d2c 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,8 @@ "shell", "console" ], - "electronVersion": "0.37.8", "dependencies": { - "chokidar": "1.4.3", + "chokidar": "1.5.0", "fixed-sticky": "0.1.7", "font-awesome": "4.6.1", "fs-extra": "0.30.0", @@ -46,7 +45,7 @@ "chai": "3.5.0", "del": "2.2.0", "electron-packager": "7.0.1", - "electron-prebuilt": "0.37.8", + "electron-prebuilt": "1.0.1", "electron-rebuild": "1.1.3", "gulp": "3.9.1", "gulp-cached": "1.1.0", @@ -63,18 +62,19 @@ "npm-check-updates": "2.6.4", "run-sequence": "1.1.5", "ts-node": "0.7.2", - "tslint": "3.9.0", + "tslint": "3.10.1", "typescript": "1.9.0-dev.20160425", "typings": "0.8.1" }, "scripts": { "preinstall": "npm prune", "postinstall": "npm run recompile", - "recompile": "HOME=~/.electron-gyp cd node_modules/pty.js; node-gyp rebuild --target=$npm_package_electronVersion --arch=x64 --dist-url=https://atom.io/download/atom-shell", + "electron-version": "cat package.json | grep 'electron-prebuilt\": \"' | cut -d '\"' -f 4", + "recompile": "export ELECTRON_VERSION=$(npm run electron-version --silent); HOME=~/.electron-gyp cd node_modules/pty.js; node-gyp rebuild --target=$ELECTRON_VERSION --arch=x64 --dist-url=https://atom.io/download/atom-shell", "electron": "electron .", "start": "gulp", - "package": "gulp build && electron-packager . \"$npm_package_productName\" --overwrite --platform=darwin --arch=x64 --version=$npm_package_electronVersion --out='/Applications' --icon='./icon.icns' --asar=true", - "test": "mocha --require ts-node/register test/**", + "package": "gulp build && electron-packager . \"$npm_package_productName\" --overwrite --platform=darwin --arch=x64 --version=$(npm run electron-version --silent) --out='/Applications' --icon='./icon.icns' --asar=true", + "test": "ELECTRON_RUN_AS_NODE=1 electron $(which mocha) --require ts-node/register test/**", "update-typings": "typings ls | awk '$2 ~ /.+/ {print $2}' | xargs -I {} typings i '{}' -S -A --source dt", "update-dependencies": "ncu -u", "lint": "tslint `find src -name '*.ts*'`", diff --git a/src/Buffer.ts b/src/Buffer.ts index 9bffc1294..6395127c9 100644 --- a/src/Buffer.ts +++ b/src/Buffer.ts @@ -5,7 +5,7 @@ import * as i from "./Interfaces"; import * as e from "./Enums"; import {List} from "immutable"; import {error, times} from "./utils/Common"; -const shell: Electron.Shell = require("remote").require("electron").shell; +import {remote} from "electron"; export default class Buffer extends events.EventEmitter { public static hugeOutputThreshold = 300; @@ -32,7 +32,7 @@ export default class Buffer extends events.EventEmitter { if (charObject.isSpecial()) { switch (charObject.keyCode) { case e.KeyCode.Bell: - shell.beep(); + remote.shell.beep(); break; case e.KeyCode.Backspace: this.moveCursorRelative({horizontal: -1}); diff --git a/src/PTY.ts b/src/PTY.ts index e53e442af..7677dde8a 100644 --- a/src/PTY.ts +++ b/src/PTY.ts @@ -1,49 +1,56 @@ import * as ChildProcess from "child_process"; import * as OS from "os"; import * as _ from "lodash"; +import * as pty from "pty.js"; import {baseName, resolveFile, exists, filterAsync, shell} from "./utils/Common"; -const ptyInternalPath = require.resolve("./PTYInternal"); -interface Message { - data?: string; - exit?: number; -} +const noConfigSwitches: Dictionary = { + zsh: ["--no-globalrcs", "--no-rcs"], + bash: ["--noprofile", "--norc"], +}; export default class PTY { - private process: ChildProcess.ChildProcess; + private terminal: pty.Terminal; // TODO: write proper signatures. // TODO: use generators. // TODO: terminate. https://github.com/atom/atom/blob/v1.0.15/src/task.coffee#L151 constructor(command: string, args: string[], env: ProcessEnvironment, dimensions: Dimensions, dataHandler: (d: string) => void, exitHandler: (c: number) => void) { - this.process = ChildProcess.fork( - ptyInternalPath, - [command, dimensions.columns.toString(), dimensions.rows.toString(), ...args], - {env: env, cwd: env.PWD} - ); + this.terminal = pty.fork(shell(), [...noConfigSwitches[baseName(shell())], "-c", `${command} ${args.map(arg => `'${arg}'`).join(" ")}`], { + cols: dimensions.columns, + rows: dimensions.rows, + cwd: env.PWD, + env: env, + }); - this.process.on("message", (message: Message) => { - if (message.hasOwnProperty("data")) { - dataHandler(message.data); - } else if (message.hasOwnProperty("exit")) { - exitHandler(message.exit); - this.process.disconnect(); - } else { - throw `Unhandled message: ${JSON.stringify(message)}`; - } + this.terminal.on("data", (data: string) => dataHandler(data)); + this.terminal.on("exit", (code: number) => { + exitHandler(code); }); } write(data: string): void { - this.process.send({input: data}); + this.terminal.write(data); } set dimensions(dimensions: Dimensions) { - this.process.send({resize: [dimensions.columns, dimensions.rows]}); + this.terminal.resize(dimensions.columns, dimensions.rows); } kill(signal: string): void { - this.process.send({signal: signal}); + /** + * The if branch is necessary because pty.js doesn"t handle SIGINT correctly. + * You can test whether it works by executing + * ruby -e "loop { puts "yes"; sleep 1 }" + * and trying to kill it with SIGINT. + * + * {@link https://github.com/chjj/pty.js/issues/58} + */ + if (signal === "SIGINT") { + this.terminal.kill("SIGTERM"); + } else { + this.terminal.kill(signal); + } } } diff --git a/src/PTYInternal.ts b/src/PTYInternal.ts deleted file mode 100644 index 599a8e0cb..000000000 --- a/src/PTYInternal.ts +++ /dev/null @@ -1,52 +0,0 @@ -import * as pty from "pty.js"; -import {baseName, shell} from "./utils/Common"; - -let commandName = process.argv[2]; -let args = process.argv.slice(5); -let columns = parseInt(process.argv[3], 10); -let rows = parseInt(process.argv[4], 10); - -const noConfigSwitches: Dictionary = { - zsh: ["--no-globalrcs", "--no-rcs"], - bash: ["--noprofile", "--norc"], -}; - -const fork = pty.fork(shell(), [...noConfigSwitches[baseName(shell())], "-c", `${commandName} ${args.map(arg => `'${arg}'`).join(" ")}`], { - cols: columns, - rows: rows, - cwd: process.cwd(), - env: process.env, -}); - -interface IncomingMessage { - input?: string; - resize?: number[]; - signal?: string; -} - -process.on("message", (message: IncomingMessage) => { - if (message.hasOwnProperty("input")) { - fork.write(message.input); - } else if (message.hasOwnProperty("resize")) { - fork.resize(message.resize[0], message.resize[1]); - } else if (message.hasOwnProperty("signal")) { - /** - * The if branch is necessary because pty.js doesn"t handle SIGINT correctly. - * You can test whether it works by executing - * ruby -e "loop { puts "yes"; sleep 1 }" - * and trying to kill it with SIGINT. - * - * {@link https://github.com/chjj/pty.js/issues/58} - */ - if (message.signal === "SIGINT") { - fork.kill("SIGTERM"); - } else { - fork.kill(message.signal); - } - } else { - throw `Unhandled incoming message: ${JSON.stringify(message)}`; - } -}); - -fork.on("data", (data: string) => process.send({ data: data })); -fork.on("exit", (code: number) => process.send({ exit: code })); diff --git a/src/Prompt.ts b/src/Prompt.ts index 5748a52f7..1cfa93f80 100644 --- a/src/Prompt.ts +++ b/src/Prompt.ts @@ -27,7 +27,7 @@ export default class Prompt extends events.EventEmitter { this._value = value; this._lexemes = lex(this.value); - this._historyExpanded = await expandHistory(this._lexemes); + this._historyExpanded = expandHistory(this._lexemes); this._expanded = await expandAliases(this._historyExpanded); } diff --git a/src/Session.ts b/src/Session.ts index 2ad826443..f8ddf3875 100644 --- a/src/Session.ts +++ b/src/Session.ts @@ -9,18 +9,16 @@ import {Status} from "./Enums"; import ApplicationComponent from "./views/1_ApplicationComponent"; import Environment from "./Environment"; import {homeDirectory, normalizeDirectory} from "./utils/Common"; -const remote = require("remote"); -const app = remote.require("app"); -const browserWindow: typeof Electron.BrowserWindow = remote.require("electron").BrowserWindow; +import {remote} from "electron"; export default class Session extends EmitterWithUniqueID { jobs: Array = []; - environment = new Environment(); + readonly environment = new Environment(); history: typeof History; historicalCurrentDirectoriesStack: string[] = []; - private stateFileName = `${homeDirectory()}/.black-screen-state`; + private readonly stateFileName = `${homeDirectory()}/.black-screen-state`; // The value of the dictionary is the default value used if there is no serialized data. - private serializableProperties: Dictionary = { + private readonly serializableProperties: Dictionary = { directory: `String:${homeDirectory()}`, history: `History:[]`, }; @@ -42,9 +40,9 @@ export default class Session extends EmitterWithUniqueID { const job = new Job(this); job.once("end", () => { - if (app.dock && !browserWindow.getAllWindows().some(window => window.isFocused())) { - app.dock.bounce("informational"); - app.dock.setBadge(job.status === Status.Success ? "1" : "✕"); + if (remote.app.dock && !remote.BrowserWindow.getAllWindows().some(window => window.isFocused())) { + remote.app.dock.bounce("informational"); + remote.app.dock.setBadge(job.status === Status.Success ? "1" : "✕"); /* tslint:disable:no-unused-expression */ new Notification("Command has been completed", { body: job.prompt.value }); } diff --git a/src/main/Main.ts b/src/main/Main.ts index 06366524c..2b11576bd 100644 --- a/src/main/Main.ts +++ b/src/main/Main.ts @@ -1,6 +1,4 @@ -const app: Electron.App = require("app"); -const browserWindowConstructor: typeof Electron.BrowserWindow = require("browser-window"); -import {ipcMain, nativeImage} from "electron"; +import {app, ipcMain, nativeImage, BrowserWindow, screen} from "electron"; import menu from "./Menu"; let browserWindow: Electron.BrowserWindow = undefined; @@ -17,7 +15,6 @@ app.on("mainWindow-all-closed", () => process.platform === "darwin" || app.quit( ipcMain.on("quit", app.quit); function getMainWindow(): Electron.BrowserWindow { - const screen: Electron.Screen = require("screen"); const workAreaSize = screen.getPrimaryDisplay().workAreaSize; if (!browserWindow) { @@ -34,7 +31,7 @@ function getMainWindow(): Electron.BrowserWindow { height: workAreaSize.height, show: false, }; - browserWindow = new browserWindowConstructor(options); + browserWindow = new BrowserWindow(options); browserWindow.loadURL("file://" + __dirname + "/../views/index.html"); menu.setMenu(app, browserWindow); diff --git a/src/main/Menu.ts b/src/main/Menu.ts index 99b6f864f..5d186cbdc 100644 --- a/src/main/Menu.ts +++ b/src/main/Menu.ts @@ -1,4 +1,4 @@ -const menuConstructor: typeof Electron.Menu = require("menu"); +import {Menu, shell} from "electron"; export default { setMenu: (app: Electron.App, browserWindow: Electron.BrowserWindow) => { @@ -91,15 +91,15 @@ export default { label: "GitHub Repository", click: function () { /* tslint:disable:no-unused-expression */ - require("shell").openExternal("https://github.com/shockone/black-screen"); + shell.openExternal("https://github.com/shockone/black-screen"); }, }, ], }, ]; - let menu = menuConstructor.buildFromTemplate(template); - menuConstructor.setApplicationMenu(menu); + let menu = Menu.buildFromTemplate(template); + Menu.setApplicationMenu(menu); } else { const template = [ { @@ -134,14 +134,14 @@ export default { { label: "GitHub Repository", click: function () { - require("shell").openExternal("https://github.com/shockone/black-screen"); + shell.openExternal("https://github.com/shockone/black-screen"); }, }, ], }, ]; - let menu = menuConstructor.buildFromTemplate(template); + let menu = Menu.buildFromTemplate(template); browserWindow.setMenu(menu); } }, diff --git a/src/plugins/PWDOperatingSystemIntegrator.ts b/src/plugins/PWDOperatingSystemIntegrator.ts index fd2a39923..393fe5898 100644 --- a/src/plugins/PWDOperatingSystemIntegrator.ts +++ b/src/plugins/PWDOperatingSystemIntegrator.ts @@ -1,13 +1,12 @@ import Session from "../Session"; import PluginManager from "../PluginManager"; -const remote = require("remote"); -const app = remote.require("app"); +import {remote} from "electron"; PluginManager.registerEnvironmentObserver({ currentWorkingDirectoryWillChange: () => { /* do nothing */ }, currentWorkingDirectoryDidChange: (session: Session, directory: string) => { - app.addRecentDocument(directory); + remote.app.addRecentDocument(directory); remote.getCurrentWindow().setRepresentedFilename(directory); }, }); diff --git a/src/views/1_ApplicationComponent.tsx b/src/views/1_ApplicationComponent.tsx index 8bdf790b6..157a5f317 100644 --- a/src/views/1_ApplicationComponent.tsx +++ b/src/views/1_ApplicationComponent.tsx @@ -5,7 +5,7 @@ import * as _ from "lodash"; import Session from "../Session"; import {ipcRenderer} from "electron"; import {KeyCode} from "../Enums"; -const shell: Electron.Shell = require("remote").require("electron").shell; +import {remote} from "electron"; interface State { sessions: Session[]; @@ -77,7 +77,7 @@ export default class ApplicationComponent extends React.Component<{}, State> { this.addTab(); this.setState({sessions: this.activeTab.sessions}); } else { - shell.beep(); + remote.shell.beep(); } event.stopPropagation(); @@ -98,7 +98,7 @@ export default class ApplicationComponent extends React.Component<{}, State> { this.activeTabIndex = newTabIndex; this.setState({sessions: this.activeTab.sessions}); } else { - shell.beep(); + remote.shell.beep(); } event.stopPropagation(); diff --git a/src/views/4_PromptComponent.tsx b/src/views/4_PromptComponent.tsx index 11249b020..51e5d5dae 100644 --- a/src/views/4_PromptComponent.tsx +++ b/src/views/4_PromptComponent.tsx @@ -70,7 +70,7 @@ export default class PromptComponent extends React.Component imple promptKeys .filter(keys.deleteWord).forEach(() => this.deleteWord()); promptKeys - .filter(keys.enter).forEach(() => this.execute()); + .filter(keys.enter).forEach((event: KeyboardEvent) => this.execute(event)); promptKeys .filter(keys.interrupt).forEach(() => this.prompt.setValue("").then(() => this.setDOMValueProgrammatically(""))); promptKeys @@ -187,7 +187,9 @@ export default class PromptComponent extends React.Component imple ); } - private execute(): void { + private async execute(event: KeyboardEvent): Promise { + await this.prompt.setValue((event.target as HTMLElement).innerText); + if (!this.isEmpty()) { this.prompt.execute(); } diff --git a/src/views/Main.tsx b/src/views/Main.tsx index 8d455c065..ed7559a07 100644 --- a/src/views/Main.tsx +++ b/src/views/Main.tsx @@ -9,6 +9,7 @@ import {loadEnvironment} from "../Environment"; $(() => { // FIXME: Remove loadAllPlugins after switching to Webpack (because all the files will be loaded at start anyway). Promise.all([loadAllPlugins(), loadEnvironment()]) - .then(() => reactDOM.render(, document.getElementById("black-screen")) ) - .then(() => Aliases.all()); + .then(() => reactDOM.render(, document.getElementById("black-screen"))); + + Aliases.all(); }); diff --git a/tslint.json b/tslint.json index dbc5f8342..0447dabde 100644 --- a/tslint.json +++ b/tslint.json @@ -27,12 +27,7 @@ 200 ], "member-access": false, - "member-ordering": [ - true, - "public-before-private", - "static-before-instance", - "variables-before-functions" - ], + "member-ordering": false, "no-any": false, "no-arg": true, "no-bitwise": true, diff --git a/typings.json b/typings.json index 0f8ea5379..661318f13 100644 --- a/typings.json +++ b/typings.json @@ -2,10 +2,10 @@ "ambientDependencies": { "chai": "registry:dt/chai#3.4.0+20160317120654", "chokidar": "registry:dt/chokidar#1.4.3+20160316155526", - "github-electron": "registry:dt/github-electron#0.37.8+20160505171444", + "github-electron": "registry:dt/github-electron#0.37.8+20160509083739", "jquery": "registry:dt/jquery#1.10.0+20160417213236", "mocha": "registry:dt/mocha#2.2.5+20160317120654", - "node": "registry:dt/node#4.0.0+20160505172921", + "node": "registry:dt/node#4.0.0+20160509154515", "pty.js": "registry:dt/pty.js#0.0.0+20160316155526", "react": "registry:dt/react#0.14.0+20160423065914" }, diff --git a/typings/browser/ambient/github-electron/index.d.ts b/typings/browser/ambient/github-electron/index.d.ts index a8e47a98b..4f9926157 100644 --- a/typings/browser/ambient/github-electron/index.d.ts +++ b/typings/browser/ambient/github-electron/index.d.ts @@ -1,5 +1,5 @@ // Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/77664bdf013d68a0798116721aa1991542eef169/github-electron/github-electron.d.ts +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/d9e73fad7d1dedbd31ef214fb737ee3a7cab58ab/github-electron/github-electron.d.ts // Type definitions for Electron v0.37.8 // Project: http://electron.atom.io/ // Definitions by: jedmao , rhysd , Milan Burda @@ -281,7 +281,7 @@ declare namespace Electron { * multiple instances of your app to run, this will ensure that only a single instance * of your app is running, and other instances signal this instance and exit. */ - makeSingleInstance(callback: (args: string[], workingDirectory: string) => boolean): boolean; + makeSingleInstance(callback: (args: string[], workingDirectory: string) => void): boolean; /** * Changes the Application User Model ID to id. */ diff --git a/typings/browser/ambient/node/index.d.ts b/typings/browser/ambient/node/index.d.ts index 0d66108ac..1d73329bc 100644 --- a/typings/browser/ambient/node/index.d.ts +++ b/typings/browser/ambient/node/index.d.ts @@ -1,5 +1,5 @@ // Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b8948c7009ae9af08bc2be3ef6b50d4f9a0019ad/node/node.d.ts +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6d0e826824da52204c1c93f92cecbc961ac84fa9/node/node.d.ts // Type definitions for Node.js v4.x // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript , DefinitelyTyped @@ -872,7 +872,7 @@ declare module "https" { SNICallback?: (servername: string) => any; } - export interface RequestOptions extends http.RequestOptions{ + export interface RequestOptions extends http.RequestOptions { pfx?: any; key?: any; passphrase?: string; @@ -883,13 +883,14 @@ declare module "https" { secureProtocol?: string; } - export interface Agent { - maxSockets: number; - sockets: any; - requests: any; + export interface Agent extends http.Agent { } + + export interface AgentOptions extends http.AgentOptions { + maxCachedSessions?: number; } + export var Agent: { - new (options?: RequestOptions): Agent; + new (options?: AgentOptions): Agent; }; export interface Server extends tls.Server { } export function createServer(options: ServerOptions, requestListener?: Function): Server; @@ -1193,7 +1194,7 @@ declare module "url" { host?: string; pathname?: string; search?: string; - query?: any; // string | Object + query?: string | any; slashes?: boolean; hash?: string; path?: string; @@ -1815,13 +1816,13 @@ declare module "tls" { host?: string; port?: number; socket?: net.Socket; - pfx?: any; //string | Buffer - key?: any; //string | Buffer + pfx?: string | Buffer + key?: string | Buffer passphrase?: string; - cert?: any; //string | Buffer - ca?: any; //Array of string | Buffer + cert?: string | Buffer + ca?: (string | Buffer)[]; rejectUnauthorized?: boolean; - NPNProtocols?: any; //Array of string | Buffer + NPNProtocols?: (string | Buffer)[]; servername?: string; } @@ -1860,12 +1861,12 @@ declare module "tls" { } export interface SecureContextOptions { - pfx?: any; //string | buffer - key?: any; //string | buffer + pfx?: string | Buffer; + key?: string | Buffer; passphrase?: string; - cert?: any; // string | buffer - ca?: any; // string | buffer - crl?: any; // string | string[] + cert?: string | Buffer; + ca?: string | Buffer; + crl?: string | string[] ciphers?: string; honorCipherOrder?: boolean; } @@ -1888,8 +1889,8 @@ declare module "crypto" { key: string; passphrase: string; cert: string; - ca: any; //string | string array - crl: any; //string | string array + ca: string | string[]; + crl: string | string[]; ciphers: string; } export interface Credentials { context?: any; } diff --git a/typings/main/ambient/github-electron/index.d.ts b/typings/main/ambient/github-electron/index.d.ts index a8e47a98b..4f9926157 100644 --- a/typings/main/ambient/github-electron/index.d.ts +++ b/typings/main/ambient/github-electron/index.d.ts @@ -1,5 +1,5 @@ // Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/77664bdf013d68a0798116721aa1991542eef169/github-electron/github-electron.d.ts +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/d9e73fad7d1dedbd31ef214fb737ee3a7cab58ab/github-electron/github-electron.d.ts // Type definitions for Electron v0.37.8 // Project: http://electron.atom.io/ // Definitions by: jedmao , rhysd , Milan Burda @@ -281,7 +281,7 @@ declare namespace Electron { * multiple instances of your app to run, this will ensure that only a single instance * of your app is running, and other instances signal this instance and exit. */ - makeSingleInstance(callback: (args: string[], workingDirectory: string) => boolean): boolean; + makeSingleInstance(callback: (args: string[], workingDirectory: string) => void): boolean; /** * Changes the Application User Model ID to id. */ diff --git a/typings/main/ambient/node/index.d.ts b/typings/main/ambient/node/index.d.ts index 0d66108ac..1d73329bc 100644 --- a/typings/main/ambient/node/index.d.ts +++ b/typings/main/ambient/node/index.d.ts @@ -1,5 +1,5 @@ // Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b8948c7009ae9af08bc2be3ef6b50d4f9a0019ad/node/node.d.ts +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6d0e826824da52204c1c93f92cecbc961ac84fa9/node/node.d.ts // Type definitions for Node.js v4.x // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript , DefinitelyTyped @@ -872,7 +872,7 @@ declare module "https" { SNICallback?: (servername: string) => any; } - export interface RequestOptions extends http.RequestOptions{ + export interface RequestOptions extends http.RequestOptions { pfx?: any; key?: any; passphrase?: string; @@ -883,13 +883,14 @@ declare module "https" { secureProtocol?: string; } - export interface Agent { - maxSockets: number; - sockets: any; - requests: any; + export interface Agent extends http.Agent { } + + export interface AgentOptions extends http.AgentOptions { + maxCachedSessions?: number; } + export var Agent: { - new (options?: RequestOptions): Agent; + new (options?: AgentOptions): Agent; }; export interface Server extends tls.Server { } export function createServer(options: ServerOptions, requestListener?: Function): Server; @@ -1193,7 +1194,7 @@ declare module "url" { host?: string; pathname?: string; search?: string; - query?: any; // string | Object + query?: string | any; slashes?: boolean; hash?: string; path?: string; @@ -1815,13 +1816,13 @@ declare module "tls" { host?: string; port?: number; socket?: net.Socket; - pfx?: any; //string | Buffer - key?: any; //string | Buffer + pfx?: string | Buffer + key?: string | Buffer passphrase?: string; - cert?: any; //string | Buffer - ca?: any; //Array of string | Buffer + cert?: string | Buffer + ca?: (string | Buffer)[]; rejectUnauthorized?: boolean; - NPNProtocols?: any; //Array of string | Buffer + NPNProtocols?: (string | Buffer)[]; servername?: string; } @@ -1860,12 +1861,12 @@ declare module "tls" { } export interface SecureContextOptions { - pfx?: any; //string | buffer - key?: any; //string | buffer + pfx?: string | Buffer; + key?: string | Buffer; passphrase?: string; - cert?: any; // string | buffer - ca?: any; // string | buffer - crl?: any; // string | string[] + cert?: string | Buffer; + ca?: string | Buffer; + crl?: string | string[] ciphers?: string; honorCipherOrder?: boolean; } @@ -1888,8 +1889,8 @@ declare module "crypto" { key: string; passphrase: string; cert: string; - ca: any; //string | string array - crl: any; //string | string array + ca: string | string[]; + crl: string | string[]; ciphers: string; } export interface Credentials { context?: any; }