@camstack/addon-terminal 0.1.8 → 0.1.10
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/dist/addon.js +28 -5
- package/dist/addon.mjs +30 -7
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -23,6 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
}) : target, mod));
|
|
24
24
|
//#endregion
|
|
25
25
|
let node_fs = require("node:fs");
|
|
26
|
+
let node_module = require("node:module");
|
|
26
27
|
let node_path = require("node:path");
|
|
27
28
|
let sharp = require("sharp");
|
|
28
29
|
sharp = __toESM(sharp);
|
|
@@ -32970,6 +32971,7 @@ DEFAULT_NATIVE_LEASE_SETTINGS.admission;
|
|
|
32970
32971
|
* a full-screen program (`btm`) gets no terminal and no runtime resize channel.
|
|
32971
32972
|
* See docs/design/2026-07-26-terminal-session-design.md ("The pty").
|
|
32972
32973
|
*/
|
|
32974
|
+
var require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
32973
32975
|
/**
|
|
32974
32976
|
* Resolve `file` to an executable path the way a shell would: a path-qualified
|
|
32975
32977
|
* name is checked directly, a bare name is searched on `PATH`. Returns the
|
|
@@ -32996,8 +32998,19 @@ function isExecutableFile(p) {
|
|
|
32996
32998
|
}
|
|
32997
32999
|
}
|
|
32998
33000
|
var cachedModule = null;
|
|
33001
|
+
function ensureSpawnHelperExecutable() {
|
|
33002
|
+
if (process.platform === "win32") return;
|
|
33003
|
+
const packageRoot = (0, node_path.dirname)(require$1.resolve("node-pty/package.json"));
|
|
33004
|
+
const candidates = [(0, node_path.join)(packageRoot, "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper"), (0, node_path.join)(packageRoot, "build", "Release", "spawn-helper")];
|
|
33005
|
+
for (const candidate of candidates) {
|
|
33006
|
+
if (!(0, node_fs.existsSync)(candidate)) continue;
|
|
33007
|
+
const mode = (0, node_fs.statSync)(candidate).mode & 511;
|
|
33008
|
+
if ((mode & 73) === 0) (0, node_fs.chmodSync)(candidate, mode | (mode & 292) >> 2);
|
|
33009
|
+
}
|
|
33010
|
+
}
|
|
32999
33011
|
async function loadNodePty() {
|
|
33000
33012
|
if (cachedModule) return cachedModule;
|
|
33013
|
+
ensureSpawnHelperExecutable();
|
|
33001
33014
|
const mod = await import("node-pty");
|
|
33002
33015
|
cachedModule = mod;
|
|
33003
33016
|
return mod;
|
|
@@ -38279,7 +38292,11 @@ function buildProfiles(options) {
|
|
|
38279
38292
|
label: "System Monitor",
|
|
38280
38293
|
description: "bottom (btm) — CPU, memory, network and process monitor",
|
|
38281
38294
|
file: options.btmPath.trim().length > 0 ? options.btmPath.trim() : "btm",
|
|
38282
|
-
args: []
|
|
38295
|
+
args: [],
|
|
38296
|
+
...options.btmPath.trim().length === 0 ? { fallbacks: [{
|
|
38297
|
+
file: "top",
|
|
38298
|
+
args: []
|
|
38299
|
+
}] } : {}
|
|
38283
38300
|
}];
|
|
38284
38301
|
if (options.allowShell) profiles.push({
|
|
38285
38302
|
profileId: "shell",
|
|
@@ -38388,11 +38405,17 @@ var TerminalSessionManager = class {
|
|
|
38388
38405
|
const cols = clampDimension(input.cols, MAX_COLS);
|
|
38389
38406
|
const rows = clampDimension(input.rows, MAX_ROWS);
|
|
38390
38407
|
const sessionId = this.mintId();
|
|
38391
|
-
const
|
|
38392
|
-
|
|
38408
|
+
const executable = [{
|
|
38409
|
+
file: profile.file,
|
|
38410
|
+
args: profile.args
|
|
38411
|
+
}, ...profile.fallbacks ?? []].map((candidate) => ({
|
|
38412
|
+
...candidate,
|
|
38413
|
+
resolvedFile: this.resolveBinary(candidate.file)
|
|
38414
|
+
})).find((candidate) => candidate.resolvedFile !== null);
|
|
38415
|
+
if (executable === void 0) throw new Error(`Terminal profile '${profile.profileId}' cannot start: executable '${profile.file}' was not found on PATH. Install it in the server image or set its path in Terminal settings.`);
|
|
38393
38416
|
const pty = this.opts.spawn({
|
|
38394
|
-
file: resolvedFile,
|
|
38395
|
-
args:
|
|
38417
|
+
file: executable.resolvedFile,
|
|
38418
|
+
args: executable.args,
|
|
38396
38419
|
cols,
|
|
38397
38420
|
rows,
|
|
38398
38421
|
...profile.cwd !== void 0 || this.opts.cwd !== void 0 ? { cwd: profile.cwd ?? this.opts.cwd } : {},
|
package/dist/addon.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
3
|
+
import { delimiter, dirname, join } from "node:path";
|
|
3
4
|
import sharp from "sharp";
|
|
4
5
|
import { createServer } from "node:http";
|
|
5
6
|
//#region \0rolldown/runtime.js
|
|
@@ -32948,6 +32949,7 @@ DEFAULT_NATIVE_LEASE_SETTINGS.admission;
|
|
|
32948
32949
|
* a full-screen program (`btm`) gets no terminal and no runtime resize channel.
|
|
32949
32950
|
* See docs/design/2026-07-26-terminal-session-design.md ("The pty").
|
|
32950
32951
|
*/
|
|
32952
|
+
var require = createRequire(import.meta.url);
|
|
32951
32953
|
/**
|
|
32952
32954
|
* Resolve `file` to an executable path the way a shell would: a path-qualified
|
|
32953
32955
|
* name is checked directly, a bare name is searched on `PATH`. Returns the
|
|
@@ -32974,8 +32976,19 @@ function isExecutableFile(p) {
|
|
|
32974
32976
|
}
|
|
32975
32977
|
}
|
|
32976
32978
|
var cachedModule = null;
|
|
32979
|
+
function ensureSpawnHelperExecutable() {
|
|
32980
|
+
if (process.platform === "win32") return;
|
|
32981
|
+
const packageRoot = dirname(require.resolve("node-pty/package.json"));
|
|
32982
|
+
const candidates = [join(packageRoot, "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper"), join(packageRoot, "build", "Release", "spawn-helper")];
|
|
32983
|
+
for (const candidate of candidates) {
|
|
32984
|
+
if (!existsSync(candidate)) continue;
|
|
32985
|
+
const mode = statSync(candidate).mode & 511;
|
|
32986
|
+
if ((mode & 73) === 0) chmodSync(candidate, mode | (mode & 292) >> 2);
|
|
32987
|
+
}
|
|
32988
|
+
}
|
|
32977
32989
|
async function loadNodePty() {
|
|
32978
32990
|
if (cachedModule) return cachedModule;
|
|
32991
|
+
ensureSpawnHelperExecutable();
|
|
32979
32992
|
const mod = await import("node-pty");
|
|
32980
32993
|
cachedModule = mod;
|
|
32981
32994
|
return mod;
|
|
@@ -38257,7 +38270,11 @@ function buildProfiles(options) {
|
|
|
38257
38270
|
label: "System Monitor",
|
|
38258
38271
|
description: "bottom (btm) — CPU, memory, network and process monitor",
|
|
38259
38272
|
file: options.btmPath.trim().length > 0 ? options.btmPath.trim() : "btm",
|
|
38260
|
-
args: []
|
|
38273
|
+
args: [],
|
|
38274
|
+
...options.btmPath.trim().length === 0 ? { fallbacks: [{
|
|
38275
|
+
file: "top",
|
|
38276
|
+
args: []
|
|
38277
|
+
}] } : {}
|
|
38261
38278
|
}];
|
|
38262
38279
|
if (options.allowShell) profiles.push({
|
|
38263
38280
|
profileId: "shell",
|
|
@@ -38366,11 +38383,17 @@ var TerminalSessionManager = class {
|
|
|
38366
38383
|
const cols = clampDimension(input.cols, MAX_COLS);
|
|
38367
38384
|
const rows = clampDimension(input.rows, MAX_ROWS);
|
|
38368
38385
|
const sessionId = this.mintId();
|
|
38369
|
-
const
|
|
38370
|
-
|
|
38386
|
+
const executable = [{
|
|
38387
|
+
file: profile.file,
|
|
38388
|
+
args: profile.args
|
|
38389
|
+
}, ...profile.fallbacks ?? []].map((candidate) => ({
|
|
38390
|
+
...candidate,
|
|
38391
|
+
resolvedFile: this.resolveBinary(candidate.file)
|
|
38392
|
+
})).find((candidate) => candidate.resolvedFile !== null);
|
|
38393
|
+
if (executable === void 0) throw new Error(`Terminal profile '${profile.profileId}' cannot start: executable '${profile.file}' was not found on PATH. Install it in the server image or set its path in Terminal settings.`);
|
|
38371
38394
|
const pty = this.opts.spawn({
|
|
38372
|
-
file: resolvedFile,
|
|
38373
|
-
args:
|
|
38395
|
+
file: executable.resolvedFile,
|
|
38396
|
+
args: executable.args,
|
|
38374
38397
|
cols,
|
|
38375
38398
|
rows,
|
|
38376
38399
|
...profile.cwd !== void 0 || this.opts.cwd !== void 0 ? { cwd: profile.cwd ?? this.opts.cwd } : {},
|