Update deps

This commit is contained in:
Anton Medvedev 2023-03-28 17:15:22 +02:00
parent eed58e3496
commit 363bb1be96
126 changed files with 5743 additions and 2737 deletions

1
node_modules/webpod/dist/cli.d.ts generated vendored Normal file
View file

@ -0,0 +1 @@
export {};

1
node_modules/webpod/dist/cli.js generated vendored Normal file
View file

@ -0,0 +1 @@
export {};

1
node_modules/webpod/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1 @@
export { ssh } from './ssh.js';

1
node_modules/webpod/dist/index.js generated vendored Executable file
View file

@ -0,0 +1 @@
export { ssh } from './ssh.js';

19
node_modules/webpod/dist/ssh.d.ts generated vendored Normal file
View file

@ -0,0 +1,19 @@
export type RemoteShell = ((pieces: TemplateStringsArray, ...values: any[]) => Promise<Result>) & {
exit: () => void;
};
export type Options = {
port?: number | string;
forwardAgent?: boolean;
shell?: string;
options?: (SshOption | `${SshOption}=${string}`)[];
};
export declare function ssh(host: string, options?: Options): RemoteShell;
export declare class Result extends String {
readonly source: string;
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);
}
export 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';

79
node_modules/webpod/dist/ssh.js generated vendored Normal file
View file

@ -0,0 +1,79 @@
import { spawn, spawnSync } from 'node:child_process';
import process from 'node:process';
import { controlPath, escapeshellarg } from './utils.js';
export function ssh(host, options = {}) {
const $ = function (pieces, ...values) {
const source = new Error().stack.split(/^\s*at\s/m)[2].trim();
if (pieces.some(p => p == undefined)) {
throw new Error(`Malformed command at ${source}`);
}
let cmd = pieces[0], i = 0;
while (i < values.length) {
let s;
if (Array.isArray(values[i])) {
s = values[i].map((x) => escapeshellarg(x)).join(' ');
}
else {
s = escapeshellarg(values[i]);
}
cmd += s + pieces[++i];
}
let resolve, reject;
const promise = new Promise((...args) => ([resolve, reject] = args));
const shellID = 'id$' + Math.random().toString(36).slice(2);
const args = [
host,
'-o', 'ControlMaster=auto',
'-o', 'ControlPath=' + controlPath(host),
'-o', 'ControlPersist=5m',
...(options.port ? ['-p', `${options.port}`] : []),
...(options.forwardAgent ? ['-A'] : []),
...(options.options || []).flatMap(x => ['-o', x]),
`: ${shellID}; ` + (options.shell || 'bash -ls')
];
if (process.env.WEBPOD_DEBUG) {
console.log('ssh', args.join(' '));
}
const child = spawn('ssh', args, {
stdio: ['pipe', 'pipe', 'pipe'],
windowsHide: true,
});
let stdout = '', stderr = '', combined = '';
const onStdout = (data) => {
stdout += data;
combined += data;
};
const onStderr = (data) => {
stderr += data;
combined += data;
};
child.stdout.on('data', onStdout);
child.stderr.on('data', onStderr);
child.on('close', (code) => {
if (code === 0) {
resolve(new Result(source, code, stdout, stderr, combined));
}
else {
reject(new Result(source, code, stdout, stderr, combined));
}
});
child.on('error', err => {
reject(new Result(source, null, stdout, stderr, combined, err));
});
child.stdin.write(cmd);
child.stdin.end();
return promise;
};
$.exit = () => spawnSync('ssh', [host, '-O', 'exit', '-o', `ControlPath=${controlPath(host)}`]);
return $;
}
export class Result extends String {
constructor(source, exitCode, stdout, stderr, combined, error) {
super(combined);
this.source = source;
this.stdout = stdout;
this.stderr = stderr;
this.exitCode = exitCode;
this.error = error;
}
}

3
node_modules/webpod/dist/utils.d.ts generated vendored Normal file
View file

@ -0,0 +1,3 @@
export declare function isWritable(path: string): boolean;
export declare function controlPath(host: string): string;
export declare function escapeshellarg(arg: string): string;

35
node_modules/webpod/dist/utils.js generated vendored Normal file
View file

@ -0,0 +1,35 @@
import fs from 'node:fs';
import os from 'node:os';
import process from 'node:process';
export function isWritable(path) {
try {
fs.accessSync(path, fs.constants.W_OK);
return true;
}
catch (err) {
return false;
}
}
export function controlPath(host) {
let c = 'ssh-' + host;
if ('CI' in process.env && isWritable('/dev/shm')) {
return `/dev/shm/${c}`;
}
return `${os.homedir()}/.ssh/${c}`;
}
export function escapeshellarg(arg) {
if (/^[a-z0-9/_.\-@:=]+$/i.test(arg) || arg === '') {
return arg;
}
return (`$'` +
arg
.replace(/\\/g, '\\\\')
.replace(/'/g, '\\\'')
.replace(/\f/g, '\\f')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/\t/g, '\\t')
.replace(/\v/g, '\\v')
.replace(/\0/g, '\\0') +
`'`);
}