termdock 1.4.362 → 1.4.363
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 +8 -0
- package/README.md +8 -0
- package/dist/server/utils/npmUpdate.js +4 -14
- package/package.json +2 -2
- package/runtime-manifest.json +2 -2
- package/scripts/ensure-node-pty.cjs +5 -1
- package/scripts/native-build-env.cjs +47 -0
package/README.en.md
CHANGED
|
@@ -52,6 +52,14 @@ sudo apt-get install -y tmux
|
|
|
52
52
|
|
|
53
53
|
If `node-pty` needs compilation, install Xcode Command Line Tools on macOS (`xcode-select --install`), or `build-essential` and `python3` on Ubuntu / Debian. Behavior on WSL2, other Linux distributions, and mobile devices depends on the actual environment.
|
|
54
54
|
|
|
55
|
+
On macOS, installation, startup repair, and automatic updates resolve the SDK, `clang`, and `clang++` from the selected Xcode / Command Line Tools, preserving explicit `DEVELOPER_DIR`, `SDKROOT`, `CC`, and `CXX` settings. To select Xcode for one installation without changing the global selection:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" npm install -g termdock --foreground-scripts
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
For `tapi error` / `unknown architecture`, check the toolchain paths in the failure log, `xcode-select -p`, and `xcrun --sdk macosx --show-sdk-path`. Explicit SDK or compiler overrides must also belong to a compatible toolchain.
|
|
62
|
+
|
|
55
63
|
### Install and launch
|
|
56
64
|
|
|
57
65
|
```bash
|
package/README.md
CHANGED
|
@@ -52,6 +52,14 @@ sudo apt-get install -y tmux
|
|
|
52
52
|
|
|
53
53
|
如果 `node-pty` 需要本机编译,macOS 安装 `xcode-select --install`,Ubuntu / Debian 安装 `build-essential` 和 `python3`。WSL2、不同 Linux 发行版和手机系统的具体行为请以实际环境为准。
|
|
54
54
|
|
|
55
|
+
macOS 安装、启动修复和自动更新会从当前选中的 Xcode / Command Line Tools 解析配套的 SDK、`clang` 和 `clang++`,保留显式设置的 `DEVELOPER_DIR`、`SDKROOT`、`CC`、`CXX`。多套工具共存时,可仅为本次安装选择 Xcode(无需修改全局设置):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" npm install -g termdock --foreground-scripts
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
若出现 `tapi error` / `unknown architecture`,检查失败日志中的工具链路径,以及 `xcode-select -p` 和 `xcrun --sdk macosx --show-sdk-path`;已有的 SDK 或编译器覆盖也需要来自配套工具链。
|
|
62
|
+
|
|
55
63
|
### 安装并启动
|
|
56
64
|
|
|
57
65
|
```bash
|
|
@@ -3,7 +3,9 @@ import { promisify } from 'node:util';
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
6
7
|
const execFileAsync = promisify(execFile);
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
7
9
|
export const OFFICIAL_NPM_REGISTRY = 'https://registry.npmjs.org';
|
|
8
10
|
const TERMDOCK_PACKAGE = 'termdock';
|
|
9
11
|
const NPM_QUERY_TIMEOUT_MS = 30_000;
|
|
@@ -120,20 +122,8 @@ export function npmRuntimeEnvironment(execPath = process.execPath, env = process
|
|
|
120
122
|
return { ...env, PATH: [path.dirname(execPath), ...systemBins, env.PATH].filter(Boolean).join(path.delimiter) };
|
|
121
123
|
}
|
|
122
124
|
async function installEnvironment() {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
// New CLT releases can leave node-gyp's implicit libc++ search path stale.
|
|
126
|
-
// Use the SDK selected by xcrun without changing the user's global setup.
|
|
127
|
-
const { stdout } = await execFileAsync('/usr/bin/xcrun', ['--show-sdk-path'], { timeout: 5000, env });
|
|
128
|
-
const sdk = stdout.trim();
|
|
129
|
-
const headers = path.join(sdk, 'usr/include/c++/v1');
|
|
130
|
-
if (!path.isAbsolute(sdk) || !fs.existsSync(path.join(headers, 'functional'))) {
|
|
131
|
-
throw new Error('macOS C++ SDK headers are unavailable. Install or repair Command Line Tools, then retry.');
|
|
132
|
-
}
|
|
133
|
-
env.SDKROOT = sdk;
|
|
134
|
-
env.CPLUS_INCLUDE_PATH = [headers, env.CPLUS_INCLUDE_PATH].filter(Boolean).join(path.delimiter);
|
|
135
|
-
}
|
|
136
|
-
return env;
|
|
125
|
+
const { nativeBuildEnvironment } = require('../../../scripts/native-build-env.cjs');
|
|
126
|
+
return nativeBuildEnvironment(npmRuntimeEnvironment());
|
|
137
127
|
}
|
|
138
128
|
function npmExecutable() {
|
|
139
129
|
return process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "termdock",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.363",
|
|
4
4
|
"description": "A complete web-based terminal application with modern UI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": ".desktop-dist/main.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"trace:fsio": "node scripts/inspect-fs-io.mjs",
|
|
45
45
|
"release:classify": "node scripts/classify-release.mjs",
|
|
46
46
|
"test": "vitest --passWithNoTests",
|
|
47
|
-
"test:initialization": "node --test tests/nodePtyInstall.test.mjs tests/installUtils.test.mjs && node --import tsx --test tests/initialization.process.test.mjs && vitest run --maxWorkers=2 src/server/utils/bootCheck.test.ts src/server/utils/localHttpsSetup.test.ts src/server/utils/nodePtyCleanup.test.ts",
|
|
47
|
+
"test:initialization": "node --test tests/nodePtyInstall.test.mjs tests/installUtils.test.mjs && node --import tsx --test tests/initialization.process.test.mjs && vitest run --maxWorkers=2 src/server/utils/bootCheck.test.ts src/server/utils/localHttpsSetup.test.ts src/server/utils/nodePtyCleanup.test.ts src/server/utils/npmUpdate.test.ts",
|
|
48
48
|
"test:initialization:real": "node --import tsx --test tests/initialization.real.test.mjs",
|
|
49
49
|
"test:webgl": "vitest run --config vitest.webgl.config.ts",
|
|
50
50
|
"test:terminal-geometry": "vitest run src/lib/terminal/geometry.test.ts src/lib/terminal/geometryBoundary.test.ts src/lib/terminal/fitHysteresis.test.ts src/lib/terminal/api.continuousReconnect.test.ts src/lib/components/terminal/TerminalViewportPasteOwnership.test.tsx src/lib/federation/SessionAccessView.test.tsx src/server/utils/tmuxDisplayGeometry.test.ts src/server/utils/tmuxObserverSize.test.ts src/server/utils/tmuxSizeOwnership.test.ts src/server/utils/terminalHandshakeDimensions.test.ts src/server/routes/terminalInitialSize.test.ts src/server/routes/terminalSampling.test.ts",
|
package/runtime-manifest.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"packageName": "termdock",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.363",
|
|
5
5
|
"runtimeProtocolVersion": 1,
|
|
6
6
|
"minimumDesktopVersion": "1.4.46",
|
|
7
7
|
"nodeMajor": 22,
|
|
8
8
|
"dependencyHash": "sha256-Y8lMrpp3Lu4r/I8Zx3R59DZsC3RtYVYC7b/kH84ZMeY=",
|
|
9
|
-
"serverBundleHash": "sha256-
|
|
9
|
+
"serverBundleHash": "sha256-vTdrZVQ5FX778s9lGNFOgKR2oMpKcNS3xb6BYf0YQr0=",
|
|
10
10
|
"clientBundleHash": "sha256-Y5z0lKMQXjjKtUKjCVqX14u7Zh92XcJpDgwJ+kfsvZs=",
|
|
11
11
|
"entrypoint": "dist/server/cli.js",
|
|
12
12
|
"clientEntrypoint": "dist/client/index.html"
|
|
@@ -3,14 +3,16 @@ const fs = require('node:fs');
|
|
|
3
3
|
const path = require('node:path');
|
|
4
4
|
const { createHash } = require('node:crypto');
|
|
5
5
|
const { spawnSync } = require('node:child_process');
|
|
6
|
+
const { nativeBuildEnvironment } = require('./native-build-env.cjs');
|
|
6
7
|
const hash = data => createHash('sha256').update(data).digest('hex');
|
|
7
8
|
const upstreamHash = '5e1005d6bdcfbe97b486ee415419fe7adae99035047f07340fbad36419e0bae6';
|
|
8
9
|
|
|
9
10
|
function rebuildNodePty(ptyRoot, { timeout = 180_000, patched = false } = {}) {
|
|
11
|
+
const env = nativeBuildEnvironment();
|
|
10
12
|
// npm install -g passes npm_config_global=true to lifecycle scripts. Do not
|
|
11
13
|
// let it turn npx's temporary dependency installation into a global install.
|
|
12
14
|
const result = spawnSync('npx', ['--global=false', '--yes', 'node-gyp', 'rebuild'], {
|
|
13
|
-
cwd: ptyRoot, stdio: 'inherit', timeout,
|
|
15
|
+
cwd: ptyRoot, stdio: 'inherit', timeout, env,
|
|
14
16
|
});
|
|
15
17
|
if (result.error || result.status !== 0) {
|
|
16
18
|
const context = [
|
|
@@ -18,6 +20,8 @@ function rebuildNodePty(ptyRoot, { timeout = 180_000, patched = false } = {}) {
|
|
|
18
20
|
`exit status=${result.status ?? 'none'}`,
|
|
19
21
|
...(result.signal ? [`signal=${result.signal}`] : []),
|
|
20
22
|
...(result.error ? [`${result.error.code || 'spawn error'}: ${result.error.message}`] : []),
|
|
23
|
+
...(process.platform === 'darwin'
|
|
24
|
+
? ['DEVELOPER_DIR', 'SDKROOT', 'CC', 'CXX'].map(key => `${key}=${env[key] || '(unset)'}`) : []),
|
|
21
25
|
].join('; ');
|
|
22
26
|
throw new Error(`${patched ? 'Patched node-pty' : 'node-pty'} rebuild failed (${context}). `
|
|
23
27
|
+ 'See the npx/node-gyp output above for the cause. Check npm/cache errors before changing build tools; '
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Keep macOS compiler and SDK discovery in one place for install and repair.
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const { spawnSync } = require('node:child_process');
|
|
5
|
+
|
|
6
|
+
function nativeBuildEnvironment(inherited = process.env, platform = process.platform) {
|
|
7
|
+
const env = { ...inherited };
|
|
8
|
+
if (platform !== 'darwin' || (env.SDKROOT && env.CC && env.CXX)) return env;
|
|
9
|
+
|
|
10
|
+
function resolve(command, args, directory) {
|
|
11
|
+
const result = spawnSync(command, args, { env, encoding: 'utf8', timeout: 5000 });
|
|
12
|
+
const value = result.stdout?.trim();
|
|
13
|
+
let valid = false;
|
|
14
|
+
if (!result.error && result.status === 0 && value && path.isAbsolute(value)) {
|
|
15
|
+
try {
|
|
16
|
+
valid = directory ? fs.statSync(value).isDirectory() : fs.statSync(value).isFile();
|
|
17
|
+
if (!directory) fs.accessSync(value, fs.constants.X_OK);
|
|
18
|
+
} catch { valid = false; }
|
|
19
|
+
}
|
|
20
|
+
if (!valid) {
|
|
21
|
+
const detail = result.error?.message || result.stderr?.trim() || `exit status=${result.status}; output=${JSON.stringify(value)}`;
|
|
22
|
+
throw new Error(`Cannot resolve macOS native build tools: ${command} ${args.join(' ')} (${detail}). `
|
|
23
|
+
+ `DEVELOPER_DIR=${env.DEVELOPER_DIR || '(xcode-select default)'}. `
|
|
24
|
+
+ 'Check xcode-select -p and xcrun --sdk macosx --show-sdk-path, or explicitly set matching DEVELOPER_DIR, SDKROOT, CC and CXX for this install.',
|
|
25
|
+
result.error ? { cause: result.error } : undefined);
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Pin the selection for every xcrun query and for node-gyp. Never change the
|
|
31
|
+
// machine-wide xcode-select setting or replace explicit compiler/SDK choices.
|
|
32
|
+
env.DEVELOPER_DIR ||= resolve('/usr/bin/xcode-select', ['-p'], true);
|
|
33
|
+
// The explicit SDK name matters: bare --show-sdk-path can select the CLT SDK
|
|
34
|
+
// even when an older Xcode is selected (nodejs/node-gyp#3344).
|
|
35
|
+
env.SDKROOT ||= resolve('/usr/bin/xcrun', ['--sdk', 'macosx', '--show-sdk-path'], true);
|
|
36
|
+
// gyp treats CC/CXX as shell commands, so a discovered path needs quoting
|
|
37
|
+
// when an Xcode directory contains spaces. Explicit commands stay verbatim.
|
|
38
|
+
const compiler = name => {
|
|
39
|
+
const file = resolve('/usr/bin/xcrun', ['--sdk', 'macosx', '--find', name], false);
|
|
40
|
+
return /^[\w/.:+-]+$/.test(file) ? file : `'${file.replaceAll("'", "'\\''")}'`;
|
|
41
|
+
};
|
|
42
|
+
env.CC ||= compiler('clang');
|
|
43
|
+
env.CXX ||= compiler('clang++');
|
|
44
|
+
return env;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = { nativeBuildEnvironment };
|