@volter/tabnode 0.5.6 → 0.5.7
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.
|
@@ -7817,7 +7817,7 @@ class Pipe extends LibuvStreamWrap {
|
|
|
7817
7817
|
if (native) return native.write(req, [bytes2], handle);
|
|
7818
7818
|
if (handle === void 0 || handle === null) return super.dispatchWrite(req, bytes2);
|
|
7819
7819
|
const sent = handle;
|
|
7820
|
-
const given = sent.
|
|
7820
|
+
const given = sent.listening === true ? sent : sent.duplicate();
|
|
7821
7821
|
__adoptHandle(given, ownerOf(this.peer ?? this));
|
|
7822
7822
|
const status = super.dispatchWrite(req, bytes2, given);
|
|
7823
7823
|
if (status !== 0 && given !== sent) given.close();
|
|
@@ -70769,12 +70769,27 @@ function programExists(file, cwd, env) {
|
|
|
70769
70769
|
const name = __substrateProgramName(file);
|
|
70770
70770
|
const bare = name.includes("/") ? name.slice(name.lastIndexOf("/") + 1) : name;
|
|
70771
70771
|
if (shellCommandNames().has(bare)) return true;
|
|
70772
|
-
if (name.includes("/"))
|
|
70772
|
+
if (name.includes("/")) {
|
|
70773
|
+
const path2 = resolve(cwd ?? "/", name);
|
|
70774
|
+
return existsInTree(path2) && !isRegisteredProgramStub(path2);
|
|
70775
|
+
}
|
|
70773
70776
|
for (const dir of (env.PATH ?? "/usr/local/bin:/usr/bin:/bin:/node_modules/.bin").split(":")) {
|
|
70774
|
-
|
|
70777
|
+
const path2 = `${dir}/${name}`.replace(/\/+/gu, "/");
|
|
70778
|
+
if (dir.length > 0 && existsInTree(path2) && !isRegisteredProgramStub(path2)) return true;
|
|
70775
70779
|
}
|
|
70776
70780
|
return false;
|
|
70777
70781
|
}
|
|
70782
|
+
const REGISTERED_PROGRAM_STUB = /^#!\/bin\/sh\n# [\w.+-]+: runtime-registered program\n/u;
|
|
70783
|
+
function isRegisteredProgramStub(path2) {
|
|
70784
|
+
if (!currentVfs$1) return false;
|
|
70785
|
+
try {
|
|
70786
|
+
const stat = currentVfs$1.statSync(path2);
|
|
70787
|
+
if (!stat.isFile() || stat.size > 256) return false;
|
|
70788
|
+
return REGISTERED_PROGRAM_STUB.test(String(currentVfs$1.readFileSync(path2, "utf8")));
|
|
70789
|
+
} catch {
|
|
70790
|
+
return false;
|
|
70791
|
+
}
|
|
70792
|
+
}
|
|
70778
70793
|
let __nextChildRun = 1;
|
|
70779
70794
|
function startChildRun(request) {
|
|
70780
70795
|
var _a3;
|
package/dist/index.mjs
CHANGED
|
@@ -7980,7 +7980,7 @@ class Pipe extends LibuvStreamWrap {
|
|
|
7980
7980
|
if (native) return native.write(req, [bytes2], handle);
|
|
7981
7981
|
if (handle === void 0 || handle === null) return super.dispatchWrite(req, bytes2);
|
|
7982
7982
|
const sent = handle;
|
|
7983
|
-
const given = sent.
|
|
7983
|
+
const given = sent.listening === true ? sent : sent.duplicate();
|
|
7984
7984
|
__adoptHandle(given, ownerOf(this.peer ?? this));
|
|
7985
7985
|
const status = super.dispatchWrite(req, bytes2, given);
|
|
7986
7986
|
if (status !== 0 && given !== sent) given.close();
|
|
@@ -30461,12 +30461,27 @@ function programExists(file, cwd, env) {
|
|
|
30461
30461
|
const name = __substrateProgramName(file);
|
|
30462
30462
|
const bare = name.includes("/") ? name.slice(name.lastIndexOf("/") + 1) : name;
|
|
30463
30463
|
if (shellCommandNames().has(bare)) return true;
|
|
30464
|
-
if (name.includes("/"))
|
|
30464
|
+
if (name.includes("/")) {
|
|
30465
|
+
const path2 = resolve(cwd ?? "/", name);
|
|
30466
|
+
return existsInTree(path2) && !isRegisteredProgramStub(path2);
|
|
30467
|
+
}
|
|
30465
30468
|
for (const dir of (env.PATH ?? "/usr/local/bin:/usr/bin:/bin:/node_modules/.bin").split(":")) {
|
|
30466
|
-
|
|
30469
|
+
const path2 = `${dir}/${name}`.replace(/\/+/gu, "/");
|
|
30470
|
+
if (dir.length > 0 && existsInTree(path2) && !isRegisteredProgramStub(path2)) return true;
|
|
30467
30471
|
}
|
|
30468
30472
|
return false;
|
|
30469
30473
|
}
|
|
30474
|
+
const REGISTERED_PROGRAM_STUB = /^#!\/bin\/sh\n# [\w.+-]+: runtime-registered program\n/u;
|
|
30475
|
+
function isRegisteredProgramStub(path2) {
|
|
30476
|
+
if (!currentVfs$1) return false;
|
|
30477
|
+
try {
|
|
30478
|
+
const stat = currentVfs$1.statSync(path2);
|
|
30479
|
+
if (!stat.isFile() || stat.size > 256) return false;
|
|
30480
|
+
return REGISTERED_PROGRAM_STUB.test(String(currentVfs$1.readFileSync(path2, "utf8")));
|
|
30481
|
+
} catch {
|
|
30482
|
+
return false;
|
|
30483
|
+
}
|
|
30484
|
+
}
|
|
30470
30485
|
let __nextChildRun = 1;
|
|
30471
30486
|
function startChildRun(request) {
|
|
30472
30487
|
var _a2;
|
|
@@ -35668,7 +35683,7 @@ class WorkerRuntime {
|
|
|
35668
35683
|
this.worker = new Worker(
|
|
35669
35684
|
new URL(
|
|
35670
35685
|
/* @vite-ignore */
|
|
35671
|
-
"/assets/runtime-worker-
|
|
35686
|
+
"/assets/runtime-worker-CZQ5Vxoj.js",
|
|
35672
35687
|
import.meta.url
|
|
35673
35688
|
),
|
|
35674
35689
|
{ type: "module" }
|
|
@@ -38240,7 +38255,7 @@ class NativeStreamScope {
|
|
|
38240
38255
|
if (bytes2.byteLength > this.limits.maxReadChunkBytes || this.pendingWriteBytes + bytes2.byteLength > this.limits.maxPendingWriteBytes) return Promise.resolve(UV_ENOBUFS);
|
|
38241
38256
|
const sent = sentId === void 0 ? void 0 : (_b2 = this.entry(sentId)) == null ? void 0 : _b2.handle;
|
|
38242
38257
|
if (sentId !== void 0 && !sent) return Promise.resolve(UV_EBADF);
|
|
38243
|
-
if (sent && (!(handle instanceof Pipe) ||
|
|
38258
|
+
if (sent && (!(handle instanceof Pipe) || sent.listening || bytes2.byteLength === 0)) return Promise.resolve(UV_ENOTSUP);
|
|
38244
38259
|
const owned = new Uint8Array(bytes2.byteLength);
|
|
38245
38260
|
owned.set(bytes2);
|
|
38246
38261
|
const retained = sent == null ? void 0 : sent.duplicate();
|
package/package.json
CHANGED
|
@@ -240,7 +240,11 @@ export class NativeStreamScope {
|
|
|
240
240
|
|| this.pendingWriteBytes + bytes.byteLength > this.limits.maxPendingWriteBytes) return Promise.resolve(UV_ENOBUFS);
|
|
241
241
|
const sent = sentId === undefined ? undefined : this.entry(sentId)?.handle;
|
|
242
242
|
if (sentId !== undefined && !sent) return Promise.resolve(UV_EBADF);
|
|
243
|
-
|
|
243
|
+
// A connection crosses whether or not its other end is still there: Node
|
|
244
|
+
// passes a socket whose peer has closed, and the receiver reads its EOF.
|
|
245
|
+
// Refusing it failed the whole channel write (`write ENOTSUP`), which ended
|
|
246
|
+
// VS Code's extension host when a reconnecting client had already gone.
|
|
247
|
+
if (sent && (!(handle instanceof Pipe) || sent.listening || bytes.byteLength === 0)) return Promise.resolve(UV_ENOTSUP);
|
|
244
248
|
// Retain the descriptor while capacity is unavailable; the sender can close
|
|
245
249
|
// its original after submitting the write without invalidating this copy.
|
|
246
250
|
const owned = new Uint8Array(bytes.byteLength);
|
|
@@ -165,10 +165,11 @@ export class Pipe extends LibuvStreamWrap {
|
|
|
165
165
|
// A descriptor crosses as a duplicate, as `SCM_RIGHTS` hands one over: the
|
|
166
166
|
// receiver gets its own handle on the same connection, so the sender's
|
|
167
167
|
// close on `NODE_HANDLE_ACK` -- which Node's `child_process.js` does the
|
|
168
|
-
// moment the receiver confirms -- ends nothing. A
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
const
|
|
168
|
+
// moment the receiver confirms -- ends nothing. A connection is duplicated
|
|
169
|
+
// whether or not its other end is still there; a listening server has no
|
|
170
|
+
// connection to duplicate and crosses as it is.
|
|
171
|
+
const sent = handle as LibuvStreamWrap & { listening?: boolean };
|
|
172
|
+
const given = sent.listening === true ? sent : sent.duplicate();
|
|
172
173
|
// The receiving run owns this reference; the sender retains its own until
|
|
173
174
|
// Node closes it on acknowledgement, or continues using it with keepOpen.
|
|
174
175
|
__adoptHandle(given, ownerOf(this.peer ?? this));
|
|
@@ -1650,13 +1650,34 @@ function programExists(file: string, cwd: string | undefined, env: Record<string
|
|
|
1650
1650
|
// what `spawn('/usr/bin/env', …)` means and what a Dockerfile's shebang
|
|
1651
1651
|
// reaches. A file in the tree is a program too, and so is one on PATH.
|
|
1652
1652
|
if (shellCommandNames().has(bare)) return true;
|
|
1653
|
-
if (name.includes('/'))
|
|
1653
|
+
if (name.includes('/')) {
|
|
1654
|
+
const path = __resolvePath(cwd ?? '/', name);
|
|
1655
|
+
return existsInTree(path) && !isRegisteredProgramStub(path);
|
|
1656
|
+
}
|
|
1654
1657
|
for (const dir of (env.PATH ?? '/usr/local/bin:/usr/bin:/bin:/node_modules/.bin').split(':')) {
|
|
1655
|
-
|
|
1658
|
+
const path = `${dir}/${name}`.replace(/\/+/gu, '/');
|
|
1659
|
+
if (dir.length > 0 && existsInTree(path) && !isRegisteredProgramStub(path)) return true;
|
|
1656
1660
|
}
|
|
1657
1661
|
return false;
|
|
1658
1662
|
}
|
|
1659
1663
|
|
|
1664
|
+
/**
|
|
1665
|
+
* A program the page registered is not a file, so a host places a stub where
|
|
1666
|
+
* a loader looks for it (`#!/bin/sh` then `# <name>: runtime-registered
|
|
1667
|
+
* program`), for a caller that checks the path exists or walks PATH. The stub
|
|
1668
|
+
* is the page's program, not a script of this engine's: it is relayed to the
|
|
1669
|
+
* host, whose process host maps the pathname to the program by its basename.
|
|
1670
|
+
*/
|
|
1671
|
+
const REGISTERED_PROGRAM_STUB = /^#!\/bin\/sh\n# [\w.+-]+: runtime-registered program\n/u;
|
|
1672
|
+
function isRegisteredProgramStub(path: string): boolean {
|
|
1673
|
+
if (!currentVfs) return false;
|
|
1674
|
+
try {
|
|
1675
|
+
const stat = currentVfs.statSync(path);
|
|
1676
|
+
if (!stat.isFile() || stat.size > 256) return false;
|
|
1677
|
+
return REGISTERED_PROGRAM_STUB.test(String(currentVfs.readFileSync(path, 'utf8')));
|
|
1678
|
+
} catch { return false; }
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1660
1681
|
/** The runs a `Process` handle started, so a later name never lands on a live one. */
|
|
1661
1682
|
let __nextChildRun = 1;
|
|
1662
1683
|
|