Socket
Socket
Sign inDemoInstall

zx

Package Overview
Dependencies
4
Maintainers
2
Versions
111
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.2.3-dev.c2cda4a to 7.2.3-dev.cafb90d

12

build/cli.js

@@ -40,3 +40,11 @@ #!/usr/bin/env node

string: ["shell", "prefix", "eval"],
boolean: ["version", "help", "quiet", "install", "repl", "experimental"],
boolean: [
"version",
"help",
"quiet",
"verbose",
"install",
"repl",
"experimental"
],
alias: { e: "eval", i: "install", v: "version", h: "help" },

@@ -48,2 +56,4 @@ stopEarly: true

await import(globals);
if (argv.verbose)
$.verbose = true;
if (argv.quiet)

@@ -50,0 +60,0 @@ $.verbose = false;

@@ -33,2 +33,3 @@ import { spawn, spawnSync, StdioNull, StdioPipe } from 'node:child_process';

log: typeof log;
kill: typeof kill;
}

@@ -72,2 +73,3 @@ export declare const defaults: Options;

quiet(): ProcessPromise;
isQuiet(): boolean;
isVerbose(): boolean;

@@ -98,2 +100,3 @@ timeout(d: Duration, signal?: string): ProcessPromise;

export declare function cd(dir: string | ProcessOutput): void;
export declare function kill(pid: number, signal?: string): Promise<void>;
export type LogEntry = {

@@ -100,0 +103,0 @@ kind: 'cmd';

39

build/core.js

@@ -36,3 +36,3 @@ // src/core.ts

[syncExec]: false,
verbose: true,
verbose: false,
env: process.env,

@@ -49,3 +49,4 @@ sync: false,

spawnSync,
log
log,
kill
};

@@ -189,3 +190,3 @@ var isWin = process.platform == "win32";

stderr: (data) => {
$2.log({ kind: "stderr", data, verbose: self.isVerbose() });
$2.log({ kind: "stderr", data, verbose: !self.isQuiet() });
},

@@ -311,13 +312,3 @@ end: ({ error, stdout, stderr, stdall, status, signal }) => {

throw new Error("The process pid is undefined.");
let children = await ps.tree({ pid: this.child.pid, recursive: true });
for (const p of children) {
try {
process.kill(+p.pid, signal);
} catch (e) {
}
}
try {
process.kill(-this.child.pid, signal);
} catch (e) {
}
return $.kill(this.child.pid, signal);
}

@@ -336,5 +327,7 @@ stdio(stdin, stdout = "pipe", stderr = "pipe") {

}
isQuiet() {
return this._quiet ?? this._snapshot.quiet;
}
isVerbose() {
const { verbose, quiet } = this._snapshot;
return verbose && !(this._quiet ?? quiet);
return this._snapshot.verbose && !this.isQuiet();
}

@@ -428,2 +421,15 @@ timeout(d, signal = "SIGTERM") {

}
async function kill(pid, signal) {
let children = await ps.tree({ pid, recursive: true });
for (const p of children) {
try {
process.kill(+p.pid, signal);
} catch (e) {
}
}
try {
process.kill(-pid, signal);
} catch (e) {
}
}
function log(entry) {

@@ -469,4 +475,5 @@ switch (entry.kind) {

defaults,
kill,
log,
within
};

@@ -19,8 +19,5 @@ // src/goods.ts

}
var globby = Object.assign(
function globby2(patterns, options) {
return globbyModule.globby(patterns, options);
},
globbyModule
);
var globby = Object.assign(function globby2(patterns, options) {
return globbyModule.globby(patterns, options);
}, globbyModule);
var glob = globby;

@@ -27,0 +24,0 @@ function sleep(duration) {

@@ -5,3 +5,2 @@ // Generated by dts-bundle-generator v9.3.1

import { default as ps } from '@webpod/ps';
import * as fs from 'fs';

@@ -683,21 +682,67 @@ import * as cp from 'node:child_process';

}
type RemoteShell = ((pieces: TemplateStringsArray, ...values: any[]) => Promise<Result>) & {
exit: () => void;
type TPsLookupCallback = (err: any, processList?: TPsLookupEntry[]) => void;
type TPsLookupEntry = {
pid: string;
ppid?: string;
command: string;
arguments: string[];
};
type Options$2 = {
type TPsLookupQuery = {
pid?: number | string | (string | number)[];
command?: string;
arguments?: string;
ppid?: number | string;
psargs?: string | string[];
};
type TPsKillOptions = {
timeout?: number;
signal?: string | number | NodeJS.Signals;
};
type TPsNext = (err?: any, data?: any) => void;
type TPsTreeOpts = {
pid: string | number;
recursive?: boolean;
};
declare const _default: {
lookup: (query?: TPsLookupQuery, cb?: TPsLookupCallback) => Promise<TPsLookupEntry[]>;
kill: (pid: string | number, opts?: string | number | TPsKillOptions | TPsNext | undefined, next?: TPsNext | undefined) => Promise<void>;
tree: (opts: string | number | TPsTreeOpts, cb?: TPsLookupCallback) => Promise<TPsLookupEntry[]>;
};
type Values = (string | string[] | Promise<string> | Promise<string[]>)[];
type RemoteShell = {
(pieces: TemplateStringsArray, ...values: Values): Promise<Response$1>;
with(config: Partial<SshConfig>): RemoteShell;
exit(): void;
check(): boolean;
test(pieces: TemplateStringsArray, ...values: Values): Promise<boolean>;
cd(path: string): void;
};
type SshConfig = {
remoteUser: string;
hostname: string;
port?: number | string;
forwardAgent?: boolean;
shell?: string;
options?: (SshOption | `${SshOption}=${string}`)[];
shell: string;
prefix: string;
cwd?: string;
nothrow: boolean;
multiplexing: boolean;
verbose: boolean;
become?: string;
env: Record<string, string>;
ssh: SshOptions;
};
export declare function ssh(host: string, options?: Options$2): RemoteShell;
declare class Result extends String {
readonly source: string;
export declare function ssh(partial: Partial<SshConfig>): RemoteShell;
declare class Response$1 extends String {
readonly command: string;
readonly location: string;
readonly exitCode: number | null;
readonly stdout: string;
readonly stderr: string;
readonly exitCode: number | null;
readonly error?: Error;
constructor(source: string, exitCode: number | null, stdout: string, stderr: string, combined: string, error?: Error);
readonly error?: Error | undefined;
constructor(command: string, location: string, exitCode: number | null, stdout: string, stderr: string, error?: Error | undefined);
}
type SshOption = "AddKeysToAgent" | "AddressFamily" | "BatchMode" | "BindAddress" | "CanonicalDomains" | "CanonicalizeFallbackLocal" | "CanonicalizeHostname" | "CanonicalizeMaxDots" | "CanonicalizePermittedCNAMEs" | "CASignatureAlgorithms" | "CertificateFile" | "ChallengeResponseAuthentication" | "CheckHostIP" | "Ciphers" | "ClearAllForwardings" | "Compression" | "ConnectionAttempts" | "ConnectTimeout" | "ControlMaster" | "ControlPath" | "ControlPersist" | "DynamicForward" | "EscapeChar" | "ExitOnForwardFailure" | "FingerprintHash" | "ForwardAgent" | "ForwardX11" | "ForwardX11Timeout" | "ForwardX11Trusted" | "GatewayPorts" | "GlobalKnownHostsFile" | "GSSAPIAuthentication" | "GSSAPIDelegateCredentials" | "HashKnownHosts" | "Host" | "HostbasedAcceptedAlgorithms" | "HostbasedAuthentication" | "HostKeyAlgorithms" | "HostKeyAlias" | "Hostname" | "IdentitiesOnly" | "IdentityAgent" | "IdentityFile" | "IPQoS" | "KbdInteractiveAuthentication" | "KbdInteractiveDevices" | "KexAlgorithms" | "KnownHostsCommand" | "LocalCommand" | "LocalForward" | "LogLevel" | "MACs" | "Match" | "NoHostAuthenticationForLocalhost" | "NumberOfPasswordPrompts" | "PasswordAuthentication" | "PermitLocalCommand" | "PermitRemoteOpen" | "PKCS11Provider" | "Port" | "PreferredAuthentications" | "ProxyCommand" | "ProxyJump" | "ProxyUseFdpass" | "PubkeyAcceptedAlgorithms" | "PubkeyAuthentication" | "RekeyLimit" | "RemoteCommand" | "RemoteForward" | "RequestTTY" | "SendEnv" | "ServerAliveInterval" | "ServerAliveCountMax" | "SetEnv" | "StreamLocalBindMask" | "StreamLocalBindUnlink" | "StrictHostKeyChecking" | "TCPKeepAlive" | "Tunnel" | "TunnelDevice" | "UpdateHostKeys" | "UseKeychain" | "User" | "UserKnownHostsFile" | "VerifyHostKeyDNS" | "VisualHostKey" | "XAuthLocation";
type SshOptions = {
[key in AvailableOptions]?: string;
};
type AvailableOptions = "AddKeysToAgent" | "AddressFamily" | "BatchMode" | "BindAddress" | "CanonicalDomains" | "CanonicalizeFallbackLocal" | "CanonicalizeHostname" | "CanonicalizeMaxDots" | "CanonicalizePermittedCNAMEs" | "CASignatureAlgorithms" | "CertificateFile" | "ChallengeResponseAuthentication" | "CheckHostIP" | "Ciphers" | "ClearAllForwardings" | "Compression" | "ConnectionAttempts" | "ConnectTimeout" | "ControlMaster" | "ControlPath" | "ControlPersist" | "DynamicForward" | "EscapeChar" | "ExitOnForwardFailure" | "FingerprintHash" | "ForwardAgent" | "ForwardX11" | "ForwardX11Timeout" | "ForwardX11Trusted" | "GatewayPorts" | "GlobalKnownHostsFile" | "GSSAPIAuthentication" | "GSSAPIDelegateCredentials" | "HashKnownHosts" | "Host" | "HostbasedAcceptedAlgorithms" | "HostbasedAuthentication" | "HostKeyAlgorithms" | "HostKeyAlias" | "Hostname" | "IdentitiesOnly" | "IdentityAgent" | "IdentityFile" | "IPQoS" | "KbdInteractiveAuthentication" | "KbdInteractiveDevices" | "KexAlgorithms" | "KnownHostsCommand" | "LocalCommand" | "LocalForward" | "LogLevel" | "MACs" | "Match" | "NoHostAuthenticationForLocalhost" | "NumberOfPasswordPrompts" | "PasswordAuthentication" | "PermitLocalCommand" | "PermitRemoteOpen" | "PKCS11Provider" | "Port" | "PreferredAuthentications" | "ProxyCommand" | "ProxyJump" | "ProxyUseFdpass" | "PubkeyAcceptedAlgorithms" | "PubkeyAuthentication" | "RekeyLimit" | "RemoteCommand" | "RemoteForward" | "RequestTTY" | "SendEnv" | "ServerAliveInterval" | "ServerAliveCountMax" | "SetEnv" | "StreamLocalBindMask" | "StreamLocalBindUnlink" | "StrictHostKeyChecking" | "TCPKeepAlive" | "Tunnel" | "TunnelDevice" | "UpdateHostKeys" | "UseKeychain" | "User" | "UserKnownHostsFile" | "VerifyHostKeyDNS" | "VisualHostKey" | "XAuthLocation";
export type RequestInfo = Parameters<typeof fetch$1>[0];

@@ -724,7 +769,7 @@ type RequestInit$1 = Parameters<typeof fetch$1>[1];

RequestInit$1 as RequestInit,
_default as ps,
fetch$1 as nodeFetch,
fs$1 as fs,
ps,
};
export {};
{
"name": "zx",
"version": "7.2.3-dev.c2cda4a",
"version": "7.2.3-dev.cafb90d",
"description": "A tool for writing better scripts",

@@ -49,3 +49,4 @@ "type": "module",

"build:dts": "tsc --project tsconfig.prod.json && node scripts/build-dts.mjs",
"test": "npm run build && node ./test/all.test.js",
"test": "npm run build && npm run test:unit && npm run test:types",
"test:unit": "node ./test/all.test.js",
"test:types": "tsd",

@@ -59,3 +60,3 @@ "coverage": "c8 -x build/vendor.js -x 'test/**' -x scripts --check-coverage npm test",

"@types/fs-extra": "^11.0.4",
"@types/node": ">=20.11.28"
"@types/node": ">=20.11.30"
},

@@ -66,6 +67,6 @@ "devDependencies": {

"@types/minimist": "^1.2.5",
"@types/node": ">=20.11.19",
"@types/node": ">=20.11.30",
"@types/which": "^3.0.3",
"@webpod/ps": "^0.0.0-beta.2",
"c8": "^7.13.0",
"c8": "^9.1.0",
"chalk": "^5.3.0",

@@ -81,8 +82,8 @@ "dts-bundle-generator": "^9.3.1",

"minimist": "^1.2.8",
"node-fetch-native": "^1.6.2",
"prettier": "^2.8.8",
"node-fetch-native": "^1.6.4",
"prettier": "^3.2.5",
"tsd": "^0.30.7",
"typescript": "^5.4.3",
"webpod": "^0",
"which": "^3.0.0",
"webpod": "^1",
"which": "^4.0.0",
"yaml": "^2.4.1",

@@ -101,3 +102,4 @@ "zurk": "^0.0.32"

"singleQuote": true,
"endOfLine": "lf"
"endOfLine": "lf",
"trailingComma": "es5"
},

@@ -104,0 +106,0 @@ "repository": "google/zx",

Sorry, the diff of this file is too big to display

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