@celljs/ta-exec 4.6.1 → 4.8.0
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.
- package/README.en.md +43 -0
- package/README.md +5 -1
- package/esm/node/exec-client.d.ts +28 -11
- package/esm/node/exec-client.js +89 -33
- package/esm/node/exec-client.js.map +1 -1
- package/esm/node/exec-peer.d.ts +40 -0
- package/esm/node/exec-peer.js +167 -0
- package/esm/node/exec-peer.js.map +1 -0
- package/esm/node/exec-protocol.d.ts +19 -1
- package/esm/node/exec-remote-source.d.ts +5 -0
- package/esm/node/exec-remote-source.js +9 -0
- package/esm/node/exec-remote-source.js.map +1 -0
- package/esm/node/exec-rpc.d.ts +21 -3
- package/esm/node/exec-rpc.js +14 -3
- package/esm/node/exec-rpc.js.map +1 -1
- package/esm/node/exec-server.d.ts +2 -26
- package/esm/node/exec-server.js +3 -132
- package/esm/node/exec-server.js.map +1 -1
- package/esm/node/exec-stdio.d.ts +27 -0
- package/esm/node/exec-stdio.js +60 -0
- package/esm/node/exec-stdio.js.map +1 -0
- package/esm/node/index.d.ts +8 -0
- package/esm/node/index.js +8 -0
- package/esm/node/index.js.map +1 -1
- package/esm/node/local-exec-environment.d.ts +2 -2
- package/esm/node/local-exec-environment.js +11 -11
- package/esm/node/local-exec-environment.js.map +1 -1
- package/esm/node/remote-exec-environment.d.ts +3 -2
- package/esm/node/remote-exec-environment.js +41 -2
- package/esm/node/remote-exec-environment.js.map +1 -1
- package/esm/node/ssh/node-dist.d.ts +20 -0
- package/esm/node/ssh/node-dist.js +77 -0
- package/esm/node/ssh/node-dist.js.map +1 -0
- package/esm/node/ssh/ssh-askpass.d.ts +24 -0
- package/esm/node/ssh/ssh-askpass.js +112 -0
- package/esm/node/ssh/ssh-askpass.js.map +1 -0
- package/esm/node/ssh/ssh-config.d.ts +20 -0
- package/esm/node/ssh/ssh-config.js +127 -0
- package/esm/node/ssh/ssh-config.js.map +1 -0
- package/esm/node/ssh/ssh-host.d.ts +73 -0
- package/esm/node/ssh/ssh-host.js +258 -0
- package/esm/node/ssh/ssh-host.js.map +1 -0
- package/esm/node/ssh/ssh-util.d.ts +45 -0
- package/esm/node/ssh/ssh-util.js +110 -0
- package/esm/node/ssh/ssh-util.js.map +1 -0
- package/lib/node/exec-client.d.ts +28 -11
- package/lib/node/exec-client.d.ts.map +1 -1
- package/lib/node/exec-client.js +89 -33
- package/lib/node/exec-client.js.map +1 -1
- package/lib/node/exec-peer.d.ts +41 -0
- package/lib/node/exec-peer.d.ts.map +1 -0
- package/lib/node/exec-peer.js +171 -0
- package/lib/node/exec-peer.js.map +1 -0
- package/lib/node/exec-protocol.d.ts +19 -1
- package/lib/node/exec-protocol.d.ts.map +1 -1
- package/lib/node/exec-remote-source.d.ts +6 -0
- package/lib/node/exec-remote-source.d.ts.map +1 -0
- package/lib/node/exec-remote-source.js +10 -0
- package/lib/node/exec-remote-source.js.map +1 -0
- package/lib/node/exec-rpc.d.ts +21 -3
- package/lib/node/exec-rpc.d.ts.map +1 -1
- package/lib/node/exec-rpc.js +14 -3
- package/lib/node/exec-rpc.js.map +1 -1
- package/lib/node/exec-server.d.ts +2 -26
- package/lib/node/exec-server.d.ts.map +1 -1
- package/lib/node/exec-server.js +4 -134
- package/lib/node/exec-server.js.map +1 -1
- package/lib/node/exec-server.spec.js +4 -1
- package/lib/node/exec-server.spec.js.map +1 -1
- package/lib/node/exec-stdio.d.ts +28 -0
- package/lib/node/exec-stdio.d.ts.map +1 -0
- package/lib/node/exec-stdio.js +64 -0
- package/lib/node/exec-stdio.js.map +1 -0
- package/lib/node/exec-stdio.spec.d.ts +2 -0
- package/lib/node/exec-stdio.spec.d.ts.map +1 -0
- package/lib/node/exec-stdio.spec.js +106 -0
- package/lib/node/exec-stdio.spec.js.map +1 -0
- package/lib/node/index.d.ts +8 -0
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +8 -0
- package/lib/node/index.js.map +1 -1
- package/lib/node/local-exec-environment.d.ts +2 -2
- package/lib/node/local-exec-environment.d.ts.map +1 -1
- package/lib/node/local-exec-environment.js +10 -10
- package/lib/node/local-exec-environment.js.map +1 -1
- package/lib/node/local-exec-environment.spec.js +2 -0
- package/lib/node/local-exec-environment.spec.js.map +1 -1
- package/lib/node/remote-exec-environment.d.ts +3 -2
- package/lib/node/remote-exec-environment.d.ts.map +1 -1
- package/lib/node/remote-exec-environment.js +41 -2
- package/lib/node/remote-exec-environment.js.map +1 -1
- package/lib/node/ssh/node-dist.d.ts +21 -0
- package/lib/node/ssh/node-dist.d.ts.map +1 -0
- package/lib/node/ssh/node-dist.js +80 -0
- package/lib/node/ssh/node-dist.js.map +1 -0
- package/lib/node/ssh/ssh-askpass.d.ts +25 -0
- package/lib/node/ssh/ssh-askpass.d.ts.map +1 -0
- package/lib/node/ssh/ssh-askpass.js +114 -0
- package/lib/node/ssh/ssh-askpass.js.map +1 -0
- package/lib/node/ssh/ssh-config.d.ts +21 -0
- package/lib/node/ssh/ssh-config.d.ts.map +1 -0
- package/lib/node/ssh/ssh-config.js +130 -0
- package/lib/node/ssh/ssh-config.js.map +1 -0
- package/lib/node/ssh/ssh-host.d.ts +74 -0
- package/lib/node/ssh/ssh-host.d.ts.map +1 -0
- package/lib/node/ssh/ssh-host.js +262 -0
- package/lib/node/ssh/ssh-host.js.map +1 -0
- package/lib/node/ssh/ssh-host.spec.d.ts +2 -0
- package/lib/node/ssh/ssh-host.spec.d.ts.map +1 -0
- package/lib/node/ssh/ssh-host.spec.js +182 -0
- package/lib/node/ssh/ssh-host.spec.js.map +1 -0
- package/lib/node/ssh/ssh-util.d.ts +46 -0
- package/lib/node/ssh/ssh-util.d.ts.map +1 -0
- package/lib/node/ssh/ssh-util.js +113 -0
- package/lib/node/ssh/ssh-util.js.map +1 -0
- package/lib/node/ssh/ssh-util.spec.d.ts +2 -0
- package/lib/node/ssh/ssh-util.spec.d.ts.map +1 -0
- package/lib/node/ssh/ssh-util.spec.js +87 -0
- package/lib/node/ssh/ssh-util.spec.js.map +1 -0
- package/package.json +3 -3
- package/src/node/exec-client.ts +108 -39
- package/src/node/exec-peer.ts +186 -0
- package/src/node/exec-protocol.ts +21 -1
- package/src/node/exec-remote-source.ts +7 -0
- package/src/node/exec-rpc.ts +23 -3
- package/src/node/exec-server.spec.ts +4 -1
- package/src/node/exec-server.ts +4 -140
- package/src/node/exec-stdio.spec.ts +108 -0
- package/src/node/exec-stdio.ts +75 -0
- package/src/node/index.ts +8 -0
- package/src/node/local-exec-environment.spec.ts +2 -0
- package/src/node/local-exec-environment.ts +11 -10
- package/src/node/remote-exec-environment.ts +41 -3
- package/src/node/ssh/node-dist.ts +83 -0
- package/src/node/ssh/ssh-askpass.ts +117 -0
- package/src/node/ssh/ssh-config.ts +128 -0
- package/src/node/ssh/ssh-host.spec.ts +189 -0
- package/src/node/ssh/ssh-host.ts +300 -0
- package/src/node/ssh/ssh-util.spec.ts +97 -0
- package/src/node/ssh/ssh-util.ts +127 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_http_1 = require("node:http");
|
|
8
|
+
const node_os_1 = require("node:os");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
const remote_exec_environment_1 = require("../remote-exec-environment");
|
|
11
|
+
const ssh_host_1 = require("./ssh-host");
|
|
12
|
+
const ssh_util_1 = require("./ssh-util");
|
|
13
|
+
/**
|
|
14
|
+
* An ssh that runs the command on this machine, as ssh would on the host: in the home directory of the
|
|
15
|
+
* test, with a PATH of the test. Its master is a process that waits; it asks for a password through
|
|
16
|
+
* SSH_ASKPASS when FAKE_SSH_PASSWORD is set.
|
|
17
|
+
*/
|
|
18
|
+
const FAKE_SSH = `#!/bin/sh
|
|
19
|
+
echo "$*" >> "$FAKE_SSH_DIR/log"
|
|
20
|
+
master=0; control=
|
|
21
|
+
while [ $# -gt 0 ]; do
|
|
22
|
+
case "$1" in
|
|
23
|
+
--) shift; break;;
|
|
24
|
+
-N) master=1; shift;;
|
|
25
|
+
-T) shift;;
|
|
26
|
+
-O) control="$2"; shift 2;;
|
|
27
|
+
-o|-F|-p|-i|-l) shift 2;;
|
|
28
|
+
*) shift;;
|
|
29
|
+
esac
|
|
30
|
+
done
|
|
31
|
+
shift
|
|
32
|
+
if [ -n "$control" ]; then [ -f "$FAKE_SSH_DIR/master" ]; exit $?; fi
|
|
33
|
+
if [ "$master" = 1 ]; then
|
|
34
|
+
if [ -n "$FAKE_SSH_PASSWORD" ]; then
|
|
35
|
+
answer=$("$SSH_ASKPASS" "fake's password: ") || { echo "Permission denied (cancelled)." >&2; exit 255; }
|
|
36
|
+
[ "$answer" = "$FAKE_SSH_PASSWORD" ] || { echo "Permission denied (password)." >&2; exit 255; }
|
|
37
|
+
fi
|
|
38
|
+
touch "$FAKE_SSH_DIR/master"
|
|
39
|
+
trap 'rm -f "$FAKE_SSH_DIR/master"; exit 0' TERM INT
|
|
40
|
+
while :; do sleep 1 & wait $!; done
|
|
41
|
+
fi
|
|
42
|
+
[ -f "$FAKE_SSH_DIR/master" ] || { echo "no master" >&2; exit 255; }
|
|
43
|
+
cmd=$(printf '%s' "$*" | sed -e 's#/opt/homebrew/bin/node#/none#g' -e 's#/usr/local/bin/node#/none#g')
|
|
44
|
+
HOME="$FAKE_SSH_HOME" PATH="$FAKE_SSH_PATH" SHELL="$FAKE_SSH_DIR/login-sh" exec /bin/sh -c "$cmd"
|
|
45
|
+
`;
|
|
46
|
+
/**
|
|
47
|
+
* The login shell of the host, with the PATH of the test: a real one reads /etc/profile, whose PATH on
|
|
48
|
+
* macOS has /usr/local/bin, where the runners of CI have a Node.js.
|
|
49
|
+
*/
|
|
50
|
+
const LOGIN_SH = `#!/bin/sh
|
|
51
|
+
[ "$1" = -lc ] && shift && set -- -c "$@"
|
|
52
|
+
exec /bin/sh "$@"
|
|
53
|
+
`;
|
|
54
|
+
const which = (name) => (0, node_child_process_1.execFileSync)('/bin/sh', ['-c', `command -v ${name} || true`])
|
|
55
|
+
.toString()
|
|
56
|
+
.trim();
|
|
57
|
+
const node = which('node');
|
|
58
|
+
bun_test_1.describe.skipIf(process.platform === 'win32' || !node)('SshHost', () => {
|
|
59
|
+
const root = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'ta-ssh-host-'));
|
|
60
|
+
const ssh = (0, node_path_1.join)(root, 'ssh');
|
|
61
|
+
/** A PATH with the tools the scripts use, and no Node.js. */
|
|
62
|
+
const bare = (0, node_path_1.join)(root, 'bin');
|
|
63
|
+
const hosts = [];
|
|
64
|
+
let mirror;
|
|
65
|
+
let mirrorUrl;
|
|
66
|
+
const steps = [];
|
|
67
|
+
const host = (options = {}) => {
|
|
68
|
+
const created = new ssh_host_1.SshHost({ host: 'fake', stateDir: (0, node_path_1.join)(root, 'state'), ssh, onStep: step => steps.push(step), nodeMirror: mirrorUrl, ...options });
|
|
69
|
+
hosts.push(created);
|
|
70
|
+
return created;
|
|
71
|
+
};
|
|
72
|
+
const remote = (name, path) => {
|
|
73
|
+
const home = (0, node_path_1.join)(root, name);
|
|
74
|
+
(0, node_fs_1.mkdirSync)(home, { recursive: true });
|
|
75
|
+
process.env.FAKE_SSH_HOME = home;
|
|
76
|
+
process.env.FAKE_SSH_PATH = path;
|
|
77
|
+
return home;
|
|
78
|
+
};
|
|
79
|
+
(0, bun_test_1.beforeAll)(async () => {
|
|
80
|
+
(0, node_fs_1.writeFileSync)(ssh, FAKE_SSH, { mode: 0o755 });
|
|
81
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(root, 'login-sh'), LOGIN_SH, { mode: 0o755 });
|
|
82
|
+
process.env.FAKE_SSH_DIR = root;
|
|
83
|
+
(0, node_fs_1.mkdirSync)(bare);
|
|
84
|
+
for (const tool of ['sh', 'uname', 'tar', 'gzip', 'cat', 'mkdir', 'mv', 'rm', 'dirname', 'tail', 'ls', 'sleep', 'sed']) {
|
|
85
|
+
(0, node_fs_1.symlinkSync)(which(tool), (0, node_path_1.join)(bare, tool));
|
|
86
|
+
}
|
|
87
|
+
// A mirror of nodejs.org with one build, for this machine, whose node runs the real one.
|
|
88
|
+
const platform = ssh_util_1.SshUtil.nodePlatform((0, node_child_process_1.execFileSync)('uname', ['-s']).toString().trim(), (0, node_child_process_1.execFileSync)('uname', ['-m']).toString().trim());
|
|
89
|
+
const name = `node-v22.99.0-${platform}`;
|
|
90
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.join)(root, 'dist', name, 'bin'), { recursive: true });
|
|
91
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(root, 'dist', name, 'bin', 'node'), `#!/bin/sh\nexec "${node}" "$@"\n`, { mode: 0o755 });
|
|
92
|
+
(0, node_child_process_1.execFileSync)('tar', ['-czf', `${name}.tar.gz`, name], { cwd: (0, node_path_1.join)(root, 'dist') });
|
|
93
|
+
const tarball = (0, node_fs_1.readFileSync)((0, node_path_1.join)(root, 'dist', `${name}.tar.gz`));
|
|
94
|
+
const sums = `${(0, node_crypto_1.createHash)('sha256').update(tarball).digest('hex')} ${name}.tar.gz\n`;
|
|
95
|
+
mirror = (0, node_http_1.createServer)((request, response) => {
|
|
96
|
+
if (request.url === '/latest-v22.x/SHASUMS256.txt') {
|
|
97
|
+
response.end(sums);
|
|
98
|
+
}
|
|
99
|
+
else if (request.url === `/latest-v22.x/${name}.tar.gz`) {
|
|
100
|
+
response.end(tarball);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
response.writeHead(404).end();
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
await new Promise(resolve => mirror.listen(0, '127.0.0.1', resolve));
|
|
107
|
+
mirrorUrl = `http://127.0.0.1:${mirror.address().port}`;
|
|
108
|
+
});
|
|
109
|
+
(0, bun_test_1.afterAll)(async () => {
|
|
110
|
+
await Promise.all(hosts.map(created => created.dispose()));
|
|
111
|
+
mirror.close();
|
|
112
|
+
delete process.env.FAKE_SSH_PASSWORD;
|
|
113
|
+
});
|
|
114
|
+
(0, bun_test_1.it)('copies its server once, and runs commands there with the Node.js of the host', async () => {
|
|
115
|
+
var _a;
|
|
116
|
+
const home = remote('with-node', `${(0, node_path_1.join)(node, '..')}:/usr/bin:/bin`);
|
|
117
|
+
steps.length = 0;
|
|
118
|
+
const first = host();
|
|
119
|
+
const env = new remote_exec_environment_1.RemoteExecEnvironment(first.client, home);
|
|
120
|
+
const chunks = [];
|
|
121
|
+
(0, bun_test_1.expect)((await env.exec('pwd; echo "$HOME"', { onData: data => chunks.push(data) })).exitCode).toBe(0);
|
|
122
|
+
(0, bun_test_1.expect)(Buffer.concat(chunks).toString()).toBe(`${home}\n${home}\n`);
|
|
123
|
+
(0, bun_test_1.expect)(steps).toEqual(['connecting', 'checking', 'copying-server', 'starting']);
|
|
124
|
+
(0, bun_test_1.expect)((await first.client.info()).cwd).toBe((0, node_fs_1.realpathSync)(home));
|
|
125
|
+
await first.dispose();
|
|
126
|
+
(0, bun_test_1.expect)((0, node_fs_1.existsSync)((0, node_path_1.join)(root, 'master'))).toBe(false);
|
|
127
|
+
steps.length = 0;
|
|
128
|
+
const second = host();
|
|
129
|
+
(0, bun_test_1.expect)((_a = (await new remote_exec_environment_1.RemoteExecEnvironment(second.client, home).stat('.'))) === null || _a === void 0 ? void 0 : _a.isDirectory).toBe(true);
|
|
130
|
+
(0, bun_test_1.expect)(steps).toEqual(['connecting', 'checking', 'starting']);
|
|
131
|
+
await second.dispose();
|
|
132
|
+
});
|
|
133
|
+
(0, bun_test_1.it)('installs Node.js on a host without one, from the mirror, checked', async () => {
|
|
134
|
+
const home = remote('without-node', bare);
|
|
135
|
+
steps.length = 0;
|
|
136
|
+
const created = host();
|
|
137
|
+
const env = new remote_exec_environment_1.RemoteExecEnvironment(created.client, home);
|
|
138
|
+
(0, bun_test_1.expect)((await env.exec('true')).exitCode).toBe(0);
|
|
139
|
+
(0, bun_test_1.expect)(steps).toEqual(['connecting', 'checking', 'installing-node', 'installing-node', 'copying-server', 'starting']);
|
|
140
|
+
(0, bun_test_1.expect)((0, node_fs_1.existsSync)((0, node_path_1.join)(home, '.ta/server/node/bin/node'))).toBe(true);
|
|
141
|
+
await created.dispose();
|
|
142
|
+
});
|
|
143
|
+
(0, bun_test_1.it)('asks for the password through Ta, and fails with what ssh said when it is wrong', async () => {
|
|
144
|
+
remote('password', `${(0, node_path_1.join)(node, '..')}:/usr/bin:/bin`);
|
|
145
|
+
process.env.FAKE_SSH_PASSWORD = 's3cret';
|
|
146
|
+
try {
|
|
147
|
+
const questions = [];
|
|
148
|
+
const right = host({
|
|
149
|
+
ask: async (question) => {
|
|
150
|
+
questions.push(`${question.kind}:${question.message}`);
|
|
151
|
+
return 's3cret';
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
await right.client.info();
|
|
155
|
+
(0, bun_test_1.expect)(questions).toEqual(["secret:fake's password:"]);
|
|
156
|
+
await right.dispose();
|
|
157
|
+
const wrong = host({ ask: async () => 'nope' });
|
|
158
|
+
await (0, bun_test_1.expect)(wrong.client.info()).rejects.toThrow('Permission denied (password).');
|
|
159
|
+
const cancelled = host({ ask: async () => undefined });
|
|
160
|
+
await (0, bun_test_1.expect)(cancelled.client.info()).rejects.toThrow('Permission denied (cancelled).');
|
|
161
|
+
}
|
|
162
|
+
finally {
|
|
163
|
+
delete process.env.FAKE_SSH_PASSWORD;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
(0, bun_test_1.it)('says the connection was lost when ssh ends', async () => {
|
|
167
|
+
const home = remote('lost', `${(0, node_path_1.join)(node, '..')}:/usr/bin:/bin`);
|
|
168
|
+
const created = host();
|
|
169
|
+
const env = new remote_exec_environment_1.RemoteExecEnvironment(created.client, home);
|
|
170
|
+
// Connected first: a first connection can take longer than the wait below, and then there would be
|
|
171
|
+
// no server to end yet.
|
|
172
|
+
await created.client.info();
|
|
173
|
+
const running = env.exec('sleep 30');
|
|
174
|
+
await new Promise(resolve => setTimeout(resolve, 300));
|
|
175
|
+
// Not through a shell, whose command line would match too.
|
|
176
|
+
(0, node_child_process_1.spawnSync)('pkill', ['-f', `${home}/.ta/server`]);
|
|
177
|
+
await (0, bun_test_1.expect)(running).rejects.toThrow(/lost/);
|
|
178
|
+
(0, bun_test_1.expect)(created.client.connected).toBe(false);
|
|
179
|
+
(0, bun_test_1.expect)((await env.exec('true')).exitCode).toBe(0);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
//# sourceMappingURL=ssh-host.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-host.spec.js","sourceRoot":"","sources":["../../../src/node/ssh/ssh-host.spec.ts"],"names":[],"mappings":";;AAAA,uCAAqE;AACrE,2DAA6D;AAC7D,6CAAyC;AACzC,qCAAqH;AACrH,yCAAsD;AACtD,qCAAiC;AACjC,yCAAiC;AACjC,wEAAmE;AACnE,yCAAwE;AACxE,yCAAqC;AAErC;;;;GAIG;AACH,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BhB,CAAC;AAEF;;;GAGG;AACH,MAAM,QAAQ,GAAG;;;CAGhB,CAAC;AAEF,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAC3B,IAAA,iCAAY,EAAC,SAAS,EAAE,CAAC,IAAI,EAAE,cAAc,IAAI,UAAU,CAAC,CAAC;KACxD,QAAQ,EAAE;KACV,IAAI,EAAE,CAAC;AAChB,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAE3B,mBAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,GAAG,EAAE;IACnE,MAAM,IAAI,GAAG,IAAA,qBAAW,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AAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** What ssh asks while it connects, for a person to answer. */
|
|
2
|
+
export interface SshQuestion {
|
|
3
|
+
/** `confirm`: answered `yes` or `no` (a new host key); `secret`: not shown as typed. */
|
|
4
|
+
kind: 'secret' | 'confirm' | 'text';
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
/** What a host has, as the probe script prints it. */
|
|
8
|
+
export interface SshProbe {
|
|
9
|
+
home: string;
|
|
10
|
+
os: string;
|
|
11
|
+
arch: string;
|
|
12
|
+
/** A Node.js of version 18 or later; none when it has none. */
|
|
13
|
+
node?: string;
|
|
14
|
+
musl: boolean;
|
|
15
|
+
/** The server of this version is there already. */
|
|
16
|
+
server: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** The pure parts of SshHost: arguments, scripts, and what comes back. */
|
|
19
|
+
export declare namespace SshUtil {
|
|
20
|
+
/** Where Ta keeps its server and Node.js on a host, under its home directory. */
|
|
21
|
+
const REMOTE_DIR = ".ta/server";
|
|
22
|
+
const MIN_NODE_MAJOR = 18;
|
|
23
|
+
/** One argument for a POSIX shell (and for fish, whose single quotes read `\'` the same way here). */
|
|
24
|
+
function quote(value: string): string;
|
|
25
|
+
/** What ssh takes for the host of a location: `ssh://user@host:port` when it names a port. */
|
|
26
|
+
function destination(host: string): string;
|
|
27
|
+
/** The command line ssh runs on the host: `script` in a POSIX shell, whatever the user's shell is. */
|
|
28
|
+
function remoteCommand(script: string, ...args: string[]): string;
|
|
29
|
+
function question(prompt: string): SshQuestion;
|
|
30
|
+
/** Looks at the host: its system, a Node.js to use, and whether the server of `hash` is there. */
|
|
31
|
+
function probeScript(hash: string): string;
|
|
32
|
+
/** undefined when the output is not the probe's: the host has no POSIX shell. */
|
|
33
|
+
function parseProbe(output: string): SshProbe | undefined;
|
|
34
|
+
/** Writes the standard input to `file` under the remote directory, whole or not at all. */
|
|
35
|
+
function uploadScript(file: string): string;
|
|
36
|
+
/** Unpacks the .tar.gz of Node.js on the standard input as node/ of the remote directory. */
|
|
37
|
+
function installNodeScript(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Starts the server (`$2`, a script) with Node.js (`$1`) in the home directory, in a login shell of the
|
|
40
|
+
* user when it is a POSIX one, so that commands find what the user's profile puts on PATH.
|
|
41
|
+
*/
|
|
42
|
+
function launchScript(): string;
|
|
43
|
+
/** The build of Node.js for a host, as nodejs.org names them; undefined when there is none. */
|
|
44
|
+
function nodePlatform(os: string, arch: string): string | undefined;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=ssh-util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-util.d.ts","sourceRoot":"","sources":["../../../src/node/ssh/ssh-util.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,WAAW,WAAW;IACxB,wFAAwF;IACxF,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,sDAAsD;AACtD,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,mDAAmD;IACnD,MAAM,EAAE,OAAO,CAAC;CACnB;AAED,0EAA0E;AAC1E,yBAAiB,OAAO,CAAC;IACrB,iFAAiF;IAC1E,MAAM,UAAU,eAAe,CAAC;IAChC,MAAM,cAAc,KAAK,CAAC;IAEjC,sGAAsG;IACtG,SAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3C;IAED,8FAA8F;IAC9F,SAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;IAED,sGAAsG;IACtG,SAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAEvE;IAED,SAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAMpD;IAED,kGAAkG;IAClG,SAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAchD;IAED,iFAAiF;IACjF,SAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAqB/D;IAED,2FAA2F;IAC3F,SAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;IAED,6FAA6F;IAC7F,SAAgB,iBAAiB,IAAI,MAAM,CAE1C;IAED;;;OAGG;IACH,SAAgB,YAAY,IAAI,MAAM,CAErC;IAED,+FAA+F;IAC/F,SAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAiBzE;CACJ"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SshUtil = void 0;
|
|
4
|
+
/** The pure parts of SshHost: arguments, scripts, and what comes back. */
|
|
5
|
+
var SshUtil;
|
|
6
|
+
(function (SshUtil) {
|
|
7
|
+
/** Where Ta keeps its server and Node.js on a host, under its home directory. */
|
|
8
|
+
SshUtil.REMOTE_DIR = '.ta/server';
|
|
9
|
+
SshUtil.MIN_NODE_MAJOR = 18;
|
|
10
|
+
/** One argument for a POSIX shell (and for fish, whose single quotes read `\'` the same way here). */
|
|
11
|
+
function quote(value) {
|
|
12
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
13
|
+
}
|
|
14
|
+
SshUtil.quote = quote;
|
|
15
|
+
/** What ssh takes for the host of a location: `ssh://user@host:port` when it names a port. */
|
|
16
|
+
function destination(host) {
|
|
17
|
+
return /^(?:[^@/]+@)?(?:\[[^\]]+\]|[^:@/[\]]+):\d+$/.test(host) ? `ssh://${host}` : host;
|
|
18
|
+
}
|
|
19
|
+
SshUtil.destination = destination;
|
|
20
|
+
/** The command line ssh runs on the host: `script` in a POSIX shell, whatever the user's shell is. */
|
|
21
|
+
function remoteCommand(script, ...args) {
|
|
22
|
+
return ['sh', '-c', quote(script), 'sh', ...args.map(quote)].join(' ');
|
|
23
|
+
}
|
|
24
|
+
SshUtil.remoteCommand = remoteCommand;
|
|
25
|
+
function question(prompt) {
|
|
26
|
+
const message = prompt.trim();
|
|
27
|
+
if (/\(yes\/no/i.test(message)) {
|
|
28
|
+
return { kind: 'confirm', message };
|
|
29
|
+
}
|
|
30
|
+
return { kind: /password|passphrase|\bpin\b|verification code|one-time/i.test(message) ? 'secret' : 'text', message };
|
|
31
|
+
}
|
|
32
|
+
SshUtil.question = question;
|
|
33
|
+
/** Looks at the host: its system, a Node.js to use, and whether the server of `hash` is there. */
|
|
34
|
+
function probeScript(hash) {
|
|
35
|
+
return [
|
|
36
|
+
`h="$HOME"; d="$h/${SshUtil.REMOTE_DIR}"`,
|
|
37
|
+
'echo "ta-home=$h"; echo "ta-os=$(uname -s)"; echo "ta-arch=$(uname -m)"',
|
|
38
|
+
'case "$(ldd --version 2>&1)" in *musl*) echo "ta-libc=musl";; esac',
|
|
39
|
+
'ok() { [ -n "$1" ] && [ -x "$1" ] && v=$("$1" -e \'process.stdout.write(process.versions.node)\' 2>/dev/null) && [ "${v%%.*}" -ge ' + SshUtil.MIN_NODE_MAJOR +
|
|
40
|
+
' ] 2>/dev/null; }',
|
|
41
|
+
'for n in "$d/node/bin/node" "$(command -v node 2>/dev/null)" "$("${SHELL:-/bin/sh}" -lc \'command -v node\' </dev/null 2>/dev/null | tail -n 1)" /usr/local/bin/node /opt/homebrew/bin/node "$h/.volta/bin/node" "$(ls -d "$h"/.nvm/versions/node/*/bin/node 2>/dev/null | tail -n 1)"; do',
|
|
42
|
+
' if ok "$n"; then echo "ta-node=$n"; break; fi',
|
|
43
|
+
'done',
|
|
44
|
+
`[ -f "$d/${hash}/exec-server.js" ] && echo "ta-server=1"`,
|
|
45
|
+
'exit 0',
|
|
46
|
+
].join('\n');
|
|
47
|
+
}
|
|
48
|
+
SshUtil.probeScript = probeScript;
|
|
49
|
+
/** undefined when the output is not the probe's: the host has no POSIX shell. */
|
|
50
|
+
function parseProbe(output) {
|
|
51
|
+
var _a;
|
|
52
|
+
const values = new Map();
|
|
53
|
+
for (const line of output.split(/\r?\n/)) {
|
|
54
|
+
const match = /^ta-(\w+)=(.*)$/.exec(line.trim());
|
|
55
|
+
if (match) {
|
|
56
|
+
values.set(match[1], match[2]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const home = values.get('home');
|
|
60
|
+
const os = values.get('os');
|
|
61
|
+
if (!home || !os) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
home,
|
|
66
|
+
os,
|
|
67
|
+
arch: (_a = values.get('arch')) !== null && _a !== void 0 ? _a : '',
|
|
68
|
+
node: values.get('node') || undefined,
|
|
69
|
+
musl: values.get('libc') === 'musl',
|
|
70
|
+
server: values.get('server') === '1',
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
SshUtil.parseProbe = parseProbe;
|
|
74
|
+
/** Writes the standard input to `file` under the remote directory, whole or not at all. */
|
|
75
|
+
function uploadScript(file) {
|
|
76
|
+
return `set -e; f="$HOME/${SshUtil.REMOTE_DIR}/${file}"; mkdir -p "$(dirname "$f")"; cat > "$f.tmp"; mv "$f.tmp" "$f"`;
|
|
77
|
+
}
|
|
78
|
+
SshUtil.uploadScript = uploadScript;
|
|
79
|
+
/** Unpacks the .tar.gz of Node.js on the standard input as node/ of the remote directory. */
|
|
80
|
+
function installNodeScript() {
|
|
81
|
+
return `set -e; d="$HOME/${SshUtil.REMOTE_DIR}/node"; rm -rf "$d.tmp"; mkdir -p "$d.tmp"; tar -xzf - -C "$d.tmp" --strip-components=1; rm -rf "$d"; mv "$d.tmp" "$d"`;
|
|
82
|
+
}
|
|
83
|
+
SshUtil.installNodeScript = installNodeScript;
|
|
84
|
+
/**
|
|
85
|
+
* Starts the server (`$2`, a script) with Node.js (`$1`) in the home directory, in a login shell of the
|
|
86
|
+
* user when it is a POSIX one, so that commands find what the user's profile puts on PATH.
|
|
87
|
+
*/
|
|
88
|
+
function launchScript() {
|
|
89
|
+
return 'cd "$HOME" || exit 1; s="${SHELL:-/bin/sh}"; case "${s##*/}" in bash|zsh|sh|dash|ksh) exec "$s" -lc \'exec "$0" "$1"\' "$1" "$2";; esac; exec "$1" "$2"';
|
|
90
|
+
}
|
|
91
|
+
SshUtil.launchScript = launchScript;
|
|
92
|
+
/** The build of Node.js for a host, as nodejs.org names them; undefined when there is none. */
|
|
93
|
+
function nodePlatform(os, arch) {
|
|
94
|
+
const systems = { Linux: 'linux', Darwin: 'darwin' };
|
|
95
|
+
const cpus = {
|
|
96
|
+
x86_64: 'x64',
|
|
97
|
+
amd64: 'x64',
|
|
98
|
+
aarch64: 'arm64',
|
|
99
|
+
arm64: 'arm64',
|
|
100
|
+
armv7l: 'armv7l',
|
|
101
|
+
ppc64le: 'ppc64le',
|
|
102
|
+
s390x: 's390x',
|
|
103
|
+
};
|
|
104
|
+
const system = systems[os];
|
|
105
|
+
const cpu = cpus[arch];
|
|
106
|
+
if (!system || !cpu || (system === 'darwin' && cpu !== 'x64' && cpu !== 'arm64')) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
return `${system}-${cpu}`;
|
|
110
|
+
}
|
|
111
|
+
SshUtil.nodePlatform = nodePlatform;
|
|
112
|
+
})(SshUtil || (exports.SshUtil = SshUtil = {}));
|
|
113
|
+
//# sourceMappingURL=ssh-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-util.js","sourceRoot":"","sources":["../../../src/node/ssh/ssh-util.ts"],"names":[],"mappings":";;;AAmBA,0EAA0E;AAC1E,IAAiB,OAAO,CA0GvB;AA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":"","sources":["../../../src/node/ssh/ssh-util.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_os_1 = require("node:os");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const node_dist_1 = require("./node-dist");
|
|
9
|
+
const ssh_config_1 = require("./ssh-config");
|
|
10
|
+
const ssh_util_1 = require("./ssh-util");
|
|
11
|
+
(0, bun_test_1.describe)('SshUtil', () => {
|
|
12
|
+
(0, bun_test_1.it)('quotes an argument for the shell of the host', () => {
|
|
13
|
+
const value = `it's "$HOME" & more`;
|
|
14
|
+
(0, bun_test_1.expect)((0, node_child_process_1.execFileSync)('/bin/sh', ['-c', `printf %s ${ssh_util_1.SshUtil.quote(value)}`]).toString()).toBe(value);
|
|
15
|
+
});
|
|
16
|
+
(0, bun_test_1.it)('runs a script with its arguments in sh, whatever the remote shell', () => {
|
|
17
|
+
const command = ssh_util_1.SshUtil.remoteCommand('printf "%s|%s" "$1" "$2"', 'a b', `c'd`);
|
|
18
|
+
(0, bun_test_1.expect)((0, node_child_process_1.execFileSync)('/bin/sh', ['-c', command]).toString()).toBe(`a b|c'd`);
|
|
19
|
+
});
|
|
20
|
+
(0, bun_test_1.it)('gives ssh a URL for a host with a port', () => {
|
|
21
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.destination('dev')).toBe('dev');
|
|
22
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.destination('me@dev.example.com')).toBe('me@dev.example.com');
|
|
23
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.destination('me@10.0.0.2:2222')).toBe('ssh://me@10.0.0.2:2222');
|
|
24
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.destination('[::1]:22')).toBe('ssh://[::1]:22');
|
|
25
|
+
});
|
|
26
|
+
(0, bun_test_1.it)('tells what kind of answer ssh asks for', () => {
|
|
27
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.question("me@dev's password: ").kind).toBe('secret');
|
|
28
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.question("Enter passphrase for key '/home/me/.ssh/id_ed25519': ").kind).toBe('secret');
|
|
29
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.question('Are you sure you want to continue connecting (yes/no/[fingerprint])? ').kind).toBe('confirm');
|
|
30
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.question('Verification code: ').kind).toBe('secret');
|
|
31
|
+
});
|
|
32
|
+
(0, bun_test_1.it)('reads what the probe prints, past what else a shell printed', () => {
|
|
33
|
+
const home = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'ta-probe-'));
|
|
34
|
+
const output = (0, node_child_process_1.execFileSync)('/bin/sh', ['-c', ssh_util_1.SshUtil.probeScript('0123456789abcdef')], { env: { ...process.env, HOME: home } }).toString();
|
|
35
|
+
const probe = ssh_util_1.SshUtil.parseProbe(`Last login: today\n${output}`);
|
|
36
|
+
(0, bun_test_1.expect)(probe).toMatchObject({ home, server: false, musl: false });
|
|
37
|
+
(0, bun_test_1.expect)(probe === null || probe === void 0 ? void 0 : probe.os).toBe((0, node_child_process_1.execFileSync)('uname', ['-s']).toString().trim());
|
|
38
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.parseProbe('bash: sh: command not found')).toBeUndefined();
|
|
39
|
+
});
|
|
40
|
+
(0, bun_test_1.it)('names the build of Node.js of a host', () => {
|
|
41
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.nodePlatform('Linux', 'x86_64')).toBe('linux-x64');
|
|
42
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.nodePlatform('Linux', 'aarch64')).toBe('linux-arm64');
|
|
43
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.nodePlatform('Darwin', 'arm64')).toBe('darwin-arm64');
|
|
44
|
+
(0, bun_test_1.expect)(ssh_util_1.SshUtil.nodePlatform('FreeBSD', 'amd64')).toBeUndefined();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
(0, bun_test_1.describe)('NodeDist', () => {
|
|
48
|
+
(0, bun_test_1.it)('finds the tarball of a platform in the sums', () => {
|
|
49
|
+
const sums = [
|
|
50
|
+
`${'a'.repeat(64)} node-v22.9.0-darwin-arm64.tar.gz`,
|
|
51
|
+
`${'b'.repeat(64)} node-v22.9.0-linux-arm64.tar.xz`,
|
|
52
|
+
`${'c'.repeat(64)} node-v22.9.0-linux-arm64.tar.gz`,
|
|
53
|
+
].join('\n');
|
|
54
|
+
(0, bun_test_1.expect)(node_dist_1.NodeDist.find(sums, 'linux-arm64')).toEqual({ sha256: 'c'.repeat(64), name: 'node-v22.9.0-linux-arm64.tar.gz', version: 'v22.9.0' });
|
|
55
|
+
(0, bun_test_1.expect)(node_dist_1.NodeDist.find(sums, 'linux-x64')).toBeUndefined();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
(0, bun_test_1.describe)('SshConfig', () => {
|
|
59
|
+
(0, bun_test_1.it)('reads Host, Match and Include lines', () => {
|
|
60
|
+
(0, bun_test_1.expect)(ssh_config_1.SshConfig.parse('Host dev prod *.example.com !bad\n HostName 10.0.0.1\nhost="quoted"\nMatch all\nInclude conf.d/*')).toEqual([
|
|
61
|
+
{ host: ['dev', 'prod', '*.example.com', '!bad'] },
|
|
62
|
+
{ host: ['quoted'] },
|
|
63
|
+
{ match: true },
|
|
64
|
+
{ include: 'conf.d/*' },
|
|
65
|
+
]);
|
|
66
|
+
});
|
|
67
|
+
(0, bun_test_1.it)('matches hosts as ssh does', () => {
|
|
68
|
+
(0, bun_test_1.expect)(ssh_config_1.SshConfig.matches(['*.example.com'], 'a.example.com')).toBe(true);
|
|
69
|
+
(0, bun_test_1.expect)(ssh_config_1.SshConfig.matches(['*.example.com'], 'colima')).toBe(false);
|
|
70
|
+
(0, bun_test_1.expect)(ssh_config_1.SshConfig.matches(['*', '!bad'], 'bad')).toBe(false);
|
|
71
|
+
(0, bun_test_1.expect)(ssh_config_1.SshConfig.matches(['dev?'], 'dev1')).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
(0, bun_test_1.it)('lists the hosts without wildcards, with those of files included where ssh reads them', () => {
|
|
74
|
+
const dir = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'ta-ssh-config-'));
|
|
75
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.join)(dir, 'conf.d'));
|
|
76
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, 'config'), 'Include top.conf\nHost a\nInclude conf.d/*.conf\nHost b *.corp\n\nInclude corp.conf\nMatch all\nInclude never.conf\n');
|
|
77
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, 'top.conf'), 'Host t\n');
|
|
78
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, 'conf.d', 'x.conf'), 'Host c a\n');
|
|
79
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, 'conf.d', 'y.txt'), 'Host d\n');
|
|
80
|
+
// Read only for b and the hosts of *.corp: its other hosts are not reachable by their names.
|
|
81
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, 'corp.conf'), 'Host colima x.corp\n');
|
|
82
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, 'never.conf'), 'Host n\n');
|
|
83
|
+
(0, bun_test_1.expect)(ssh_config_1.SshConfig.hosts((0, node_path_1.join)(dir, 'config'))).toEqual(['t', 'a', 'b', 'x.corp']);
|
|
84
|
+
(0, bun_test_1.expect)(ssh_config_1.SshConfig.hosts((0, node_path_1.join)(dir, 'missing'))).toEqual([]);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
//# sourceMapping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AC,IAAA,gBAAI,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;QAChF,IAAA,iBAAM,EAAC,sBAAS,CAAC,KAAK,CAAC,IAAA,gBAAI,EAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-exec",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "Where Ta runs commands and touches files: the ExecEnvironment interface, this machine, and ta exec-server for another one",
|
|
5
5
|
"homepage": "https://github.com/cellbang/cell",
|
|
6
6
|
"bugs": {
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"src"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build": "tsc -b && bun ../../scripts/build-esm.ts",
|
|
25
|
+
"build": "bun scripts/remote-server.ts && tsc -b && bun ../../scripts/build-esm.ts",
|
|
26
26
|
"clean": "rm -rf lib esm *.tsbuildinfo",
|
|
27
27
|
"test": "bun test ./lib",
|
|
28
28
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@celljs/rpc": "4.
|
|
31
|
+
"@celljs/rpc": "4.8.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|