Socket
Socket
Sign inDemoInstall

node-ssh

Package Overview
Dependencies
12
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 10.0.2 to 11.0.0

lib/esm/index.mjs

7

CHANGELOG.md

@@ -0,1 +1,8 @@

#### 11.0.0
* Add ESM module exports for upcoming Node.js versions
* BREAKING: Changed export to named, so it becomes `const {NodeSSH} = require('node-ssh')` and `import {NodeSSH} from 'node-ssh'`
* Export Typescript types from package
* Set default concurrency to `1` to ensure compatibility with wider array of servers
#### 10.0.2

@@ -2,0 +9,0 @@

34

lib/cjs/index.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeSSH = exports.SSHError = void 0;
const fs_1 = __importDefault(require("fs"));

@@ -19,4 +33,4 @@ const path_1 = __importDefault(require("path"));

const assert_1 = __importStar(require("assert"));
const ssh2_1 = require("ssh2");
const DEFAULT_CONCURRENCY = 5;
const ssh2_1 = __importDefault(require("ssh2"));
const DEFAULT_CONCURRENCY = 1;
const DEFAULT_VALIDATE = (path) => !path_1.default.basename(path).startsWith('.');

@@ -32,2 +46,3 @@ const DEFAULT_TICK = () => {

}
exports.SSHError = SSHError;
function unixifyPath(path) {

@@ -158,3 +173,3 @@ if (path.includes('\\')) {

}
const connection = new ssh2_1.Client();
const connection = new ssh2_1.default.Client();
this.connection = connection;

@@ -539,2 +554,3 @@ await new Promise((resolve, reject) => {

else {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
resolve(res);

@@ -601,2 +617,2 @@ }

}
module.exports = NodeSSH;
exports.NodeSSH = NodeSSH;
/// <reference types="node" />
import { Client, ConnectConfig, ClientChannel, SFTPWrapper, ExecOptions } from 'ssh2';
import SSH2, { ConnectConfig, ClientChannel, SFTPWrapper, ExecOptions } from 'ssh2';
import { Prompt, TransferOptions } from 'ssh2-streams';
declare type Config = ConnectConfig & {
export declare type Config = ConnectConfig & {
password?: string;

@@ -10,3 +10,3 @@ privateKey?: string;

};
interface SSHExecCommandOptions {
export interface SSHExecCommandOptions {
cwd?: string;

@@ -20,3 +20,3 @@ stdin?: string;

}
interface SSHExecCommandResponse {
export interface SSHExecCommandResponse {
stdout: string;

@@ -27,6 +27,6 @@ stderr: string;

}
interface SSHExecOptions extends SSHExecCommandOptions {
export interface SSHExecOptions extends SSHExecCommandOptions {
stream?: 'stdout' | 'stderr' | 'both';
}
interface SSHPutFilesOptions {
export interface SSHPutFilesOptions {
sftp?: SFTPWrapper | null;

@@ -36,3 +36,3 @@ concurrency?: number;

}
interface SSHGetPutDirectoryOptions extends SSHPutFilesOptions {
export interface SSHGetPutDirectoryOptions extends SSHPutFilesOptions {
tick?: (localFile: string, remoteFile: string, error: Error | null) => void;

@@ -42,5 +42,9 @@ validate?: (path: string) => boolean;

}
declare type SSHMkdirMethod = 'sftp' | 'exec';
declare class NodeSSH {
connection: Client | null;
export declare type SSHMkdirMethod = 'sftp' | 'exec';
export declare class SSHError extends Error {
code: string | null;
constructor(message: string, code?: string | null);
}
export declare class NodeSSH {
connection: SSH2.Client | null;
private getConnection;

@@ -71,2 +75,1 @@ connect(givenConfig: Config): Promise<this>;

}
export = NodeSSH;
{
"name": "node-ssh",
"version": "10.0.2",
"version": "11.0.0",
"description": "SS2 with Promises",
"main": "lib/cjs/index.js",
"typings": "lib/typings/index.d.ts",
"module": "lib/esm/index.js",
"module": "lib/esm/index.mjs",
"exports": {
".": {
"import": "./lib/esm/index.mjs",
"require": "./lib/cjs/index.js"
},
"./package.json": "./package.json"
},
"type": "commonjs",
"scripts": {
"test": "ava",
"lint": "(tsc -p . --noEmit) && (eslint . --ext .ts) && (prettier --list-different src/*.ts)",
"prepare": "yarn build:clean ; yarn build:cjs ; yarn build:typings",
"prepare": "yarn build:clean ; yarn build:cjs ; yarn build:esm ; yarn build:typings",
"build:clean": "rm -rf lib",
"build:esm": "tsc --module es2015 --target es2018 --outDir lib/esm && mv lib/esm/index.js lib/esm/index.mjs",
"build:cjs": "tsc --module commonjs --target es2018 --outDir lib/cjs",

@@ -46,4 +55,4 @@ "build:typings": "tsc --declaration --outDir lib/typings --emitDeclarationOnly"

"make-dir": "^3.1.0",
"sb-promise-queue": "^2.0.0",
"sb-scandir": "^3.0.0",
"sb-promise-queue": "^2.1.0",
"sb-scandir": "^3.1.0",
"shell-escape": "^0.2.0",

@@ -50,0 +59,0 @@ "ssh2": "^0.8.9"

@@ -58,2 +58,4 @@ Node-SSH - SSH2 with Promises

concurrency: 10,
// ^ WARNING: Not all servers support high concurrency
// try a bunch of values and see what works on your server
validate: function(itemPath) {

@@ -60,0 +62,0 @@ const baseName = path.basename(itemPath)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc