@volter/tabnode 0.5.19 → 0.5.21
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/assets/{runtime-worker-ChOZScpd.js → runtime-worker-XRE6n_4W.js} +90 -31
- package/dist/index.mjs +82 -29
- package/dist/shims/tls.d.ts +44 -515
- package/package.json +1 -1
- package/src/http-client-transport.ts +8 -4
- package/src/node-lib/binding/fs.ts +11 -4
- package/src/shims/child_process.ts +11 -2
- package/src/shims/tls.ts +93 -34
|
@@ -8246,20 +8246,30 @@ function descriptorWriter(fd2) {
|
|
|
8246
8246
|
if (!file || file.directory || (file.flags & 3) === 0) return null;
|
|
8247
8247
|
const { tree: tree2, path: path2 } = file;
|
|
8248
8248
|
const append = (file.flags & flagBits().append) !== 0;
|
|
8249
|
-
let
|
|
8249
|
+
let cursor = descriptorCursors.get(file);
|
|
8250
|
+
if (!cursor) {
|
|
8251
|
+
cursor = { position: file.position };
|
|
8252
|
+
descriptorCursors.set(file, cursor);
|
|
8253
|
+
}
|
|
8254
|
+
const offset2 = cursor;
|
|
8250
8255
|
return (text) => {
|
|
8251
8256
|
const bytes2 = new TextEncoder().encode(text);
|
|
8252
8257
|
const shared = openFiles.get(fd2) === file ? file : null;
|
|
8258
|
+
if (shared) offset2.position = shared.position;
|
|
8253
8259
|
const existing = (shared == null ? void 0 : shared.cached) ?? (tree2.existsSync(path2) ? tree2.readFileSync(path2) : new Uint8Array(0));
|
|
8254
|
-
const at3 = append ? existing.length : position;
|
|
8260
|
+
const at3 = append ? existing.length : offset2.position;
|
|
8255
8261
|
const next2 = new Uint8Array(Math.max(existing.length, at3 + bytes2.length));
|
|
8256
8262
|
next2.set(existing, 0);
|
|
8257
8263
|
next2.set(bytes2, at3);
|
|
8258
8264
|
tree2.writeFileSync(path2, next2);
|
|
8259
|
-
position = at3 + bytes2.length;
|
|
8260
|
-
if (shared)
|
|
8265
|
+
offset2.position = at3 + bytes2.length;
|
|
8266
|
+
if (shared) {
|
|
8267
|
+
shared.cached = next2;
|
|
8268
|
+
shared.position = offset2.position;
|
|
8269
|
+
}
|
|
8261
8270
|
};
|
|
8262
8271
|
}
|
|
8272
|
+
const descriptorCursors = /* @__PURE__ */ new WeakMap();
|
|
8263
8273
|
function statArray(stats, bigint, path2) {
|
|
8264
8274
|
var _a3, _b3, _c3;
|
|
8265
8275
|
const mtime = stats.mtime instanceof Date ? stats.mtime.getTime() : Number(stats.mtimeMs ?? 0);
|
|
@@ -19014,16 +19024,30 @@ nodePath.parse;
|
|
|
19014
19024
|
nodePath.format;
|
|
19015
19025
|
nodePath.toNamespacedPath;
|
|
19016
19026
|
nodePath.matchesGlob;
|
|
19027
|
+
function loopback(host) {
|
|
19028
|
+
const bare = host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
|
|
19029
|
+
const name = bare.toLowerCase();
|
|
19030
|
+
return name === "" || name === "localhost" || name === "::1" || name.startsWith("127.");
|
|
19031
|
+
}
|
|
19017
19032
|
function createTlsModule(require2) {
|
|
19018
19033
|
const NetSocket = require2 ? require2("net").Socket : lazyExport("net", "Socket");
|
|
19019
|
-
const
|
|
19034
|
+
const netServer = () => (require2 ? require2("net") : nodeLibInternalRequire("net")).Server;
|
|
19020
19035
|
class TLSSocket2 extends NetSocket {
|
|
19021
19036
|
constructor(_socket, _options3) {
|
|
19022
19037
|
super({ allowHalfOpen: false });
|
|
19023
19038
|
__publicField(this, "authorized", false);
|
|
19024
19039
|
__publicField(this, "encrypted", true);
|
|
19025
19040
|
}
|
|
19026
|
-
connect(...
|
|
19041
|
+
connect(...args) {
|
|
19042
|
+
const options = args[0];
|
|
19043
|
+
const host = String((options == null ? void 0 : options.host) ?? (options == null ? void 0 : options.hostname) ?? "localhost");
|
|
19044
|
+
if (options && typeof options === "object" && options.socket === void 0 && loopback(host)) {
|
|
19045
|
+
this.once("connect", () => {
|
|
19046
|
+
this.authorized = true;
|
|
19047
|
+
this.emit("secureConnect");
|
|
19048
|
+
});
|
|
19049
|
+
return NetSocket.prototype.connect.call(this, { port: options.port, host });
|
|
19050
|
+
}
|
|
19027
19051
|
this.connecting = true;
|
|
19028
19052
|
queueMicrotask(() => queueMicrotask(() => this.destroy(Object.assign(
|
|
19029
19053
|
new Error("TLS transport is unavailable in this runtime; HTTPS requires an admitted HTTP transport."),
|
|
@@ -19046,34 +19070,53 @@ function createTlsModule(require2) {
|
|
|
19046
19070
|
return false;
|
|
19047
19071
|
}
|
|
19048
19072
|
}
|
|
19049
|
-
|
|
19050
|
-
|
|
19051
|
-
|
|
19052
|
-
|
|
19053
|
-
|
|
19054
|
-
|
|
19073
|
+
let chained = false;
|
|
19074
|
+
const Server2 = function TLSServer(options, secureConnectionListener) {
|
|
19075
|
+
if (!(this instanceof Server2)) return new Server2(options, secureConnectionListener);
|
|
19076
|
+
const NetServer = netServer();
|
|
19077
|
+
if (!chained) {
|
|
19078
|
+
Object.setPrototypeOf(Server2.prototype, NetServer.prototype);
|
|
19079
|
+
Object.setPrototypeOf(Server2, NetServer);
|
|
19080
|
+
chained = true;
|
|
19055
19081
|
}
|
|
19056
|
-
|
|
19057
|
-
|
|
19058
|
-
|
|
19059
|
-
address() {
|
|
19060
|
-
return null;
|
|
19082
|
+
if (typeof options === "function") {
|
|
19083
|
+
secureConnectionListener = options;
|
|
19084
|
+
options = {};
|
|
19061
19085
|
}
|
|
19086
|
+
NetServer.call(this, options ?? {}, function secure(socket) {
|
|
19087
|
+
socket.encrypted = true;
|
|
19088
|
+
socket.authorized = false;
|
|
19089
|
+
this.emit("secureConnection", socket);
|
|
19090
|
+
});
|
|
19091
|
+
if (secureConnectionListener) this.on("secureConnection", secureConnectionListener);
|
|
19092
|
+
return this;
|
|
19093
|
+
};
|
|
19094
|
+
Object.assign(Server2.prototype, {
|
|
19095
|
+
addContext(_hostname, _context) {
|
|
19096
|
+
},
|
|
19062
19097
|
getTicketKeys() {
|
|
19063
19098
|
return (require2 ? require2("buffer").Buffer : Buffer).from("");
|
|
19064
|
-
}
|
|
19099
|
+
},
|
|
19065
19100
|
setTicketKeys(_keys) {
|
|
19066
|
-
}
|
|
19101
|
+
},
|
|
19067
19102
|
setSecureContext(_options3) {
|
|
19068
19103
|
}
|
|
19104
|
+
});
|
|
19105
|
+
function createServer2(options, secureConnectionListener) {
|
|
19106
|
+
return new Server2(options, secureConnectionListener);
|
|
19069
19107
|
}
|
|
19070
|
-
function
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19108
|
+
function connect2(...args) {
|
|
19109
|
+
const options = {};
|
|
19110
|
+
let callback;
|
|
19111
|
+
for (const arg of args) {
|
|
19112
|
+
if (typeof arg === "function") callback = arg;
|
|
19113
|
+
else if (typeof arg === "number" || typeof arg === "string" && options.port === void 0 && /^\d+$/u.test(arg)) options.port = arg;
|
|
19114
|
+
else if (typeof arg === "string") options.host = arg;
|
|
19115
|
+
else if (arg && typeof arg === "object") Object.assign(options, arg);
|
|
19116
|
+
}
|
|
19074
19117
|
const socket = new TLSSocket2();
|
|
19075
|
-
if (
|
|
19076
|
-
return socket.connect();
|
|
19118
|
+
if (callback) socket.once("secureConnect", callback);
|
|
19119
|
+
return socket.connect(options);
|
|
19077
19120
|
}
|
|
19078
19121
|
const createSecureContext2 = (_options3) => ({});
|
|
19079
19122
|
const getCiphers2 = () => ["TLS_AES_256_GCM_SHA384", "TLS_AES_128_GCM_SHA256"];
|
|
@@ -21103,10 +21146,17 @@ var implementation$1 = function bind2(that) {
|
|
|
21103
21146
|
var implementation = implementation$1;
|
|
21104
21147
|
var functionBind = Function.prototype.bind || implementation;
|
|
21105
21148
|
var functionCall = Function.prototype.call;
|
|
21106
|
-
var functionApply
|
|
21149
|
+
var functionApply;
|
|
21150
|
+
var hasRequiredFunctionApply;
|
|
21151
|
+
function requireFunctionApply() {
|
|
21152
|
+
if (hasRequiredFunctionApply) return functionApply;
|
|
21153
|
+
hasRequiredFunctionApply = 1;
|
|
21154
|
+
functionApply = Function.prototype.apply;
|
|
21155
|
+
return functionApply;
|
|
21156
|
+
}
|
|
21107
21157
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
21108
21158
|
var bind$2 = functionBind;
|
|
21109
|
-
var $apply$1 =
|
|
21159
|
+
var $apply$1 = requireFunctionApply();
|
|
21110
21160
|
var $call$2 = functionCall;
|
|
21111
21161
|
var $reflectApply = reflectApply;
|
|
21112
21162
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
@@ -21226,7 +21276,7 @@ var hasSymbols = requireHasSymbols()();
|
|
|
21226
21276
|
var getProto = requireGetProto();
|
|
21227
21277
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
21228
21278
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
21229
|
-
var $apply =
|
|
21279
|
+
var $apply = requireFunctionApply();
|
|
21230
21280
|
var $call = functionCall;
|
|
21231
21281
|
var needsEval = {};
|
|
21232
21282
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
@@ -21867,7 +21917,7 @@ function requireApplyBind() {
|
|
|
21867
21917
|
if (hasRequiredApplyBind) return applyBind;
|
|
21868
21918
|
hasRequiredApplyBind = 1;
|
|
21869
21919
|
var bind3 = functionBind;
|
|
21870
|
-
var $apply2 =
|
|
21920
|
+
var $apply2 = requireFunctionApply();
|
|
21871
21921
|
var actualApply$1 = actualApply;
|
|
21872
21922
|
applyBind = function applyBind2() {
|
|
21873
21923
|
return actualApply$1(bind3, $apply2, arguments);
|
|
@@ -74526,8 +74576,15 @@ async function handleNpmInstall(args, ctx) {
|
|
|
74526
74576
|
}
|
|
74527
74577
|
}
|
|
74528
74578
|
async function handleNpmInit(args, ctx) {
|
|
74579
|
+
var _a3;
|
|
74529
74580
|
const yes = args.includes("-y") || args.includes("--yes");
|
|
74530
|
-
const
|
|
74581
|
+
const takesValue = (flag) => !flag.includes("=") && (flag === "--scope" || flag === "-w" || flag === "--workspace" || flag.startsWith("--init-"));
|
|
74582
|
+
const valueOf = (flag) => {
|
|
74583
|
+
const at3 = args.findIndex((a) => a === flag || a.startsWith(`${flag}=`));
|
|
74584
|
+
if (at3 < 0) return void 0;
|
|
74585
|
+
return args[at3].includes("=") ? args[at3].slice(args[at3].indexOf("=") + 1) : args[at3 + 1];
|
|
74586
|
+
};
|
|
74587
|
+
const initializer = args.find((a, i10) => !a.startsWith("-") && !(i10 > 0 && takesValue(args[i10 - 1])));
|
|
74531
74588
|
if (initializer) {
|
|
74532
74589
|
return { stdout: "", stderr: `npm ERR! npm init ${initializer} runs an initializer package, which this engine's npm does not; write package.json, or run \`npm init -y\`.
|
|
74533
74590
|
`, exitCode: 1 };
|
|
@@ -74547,7 +74604,9 @@ async function handleNpmInit(args, ctx) {
|
|
|
74547
74604
|
}
|
|
74548
74605
|
}
|
|
74549
74606
|
const base = ctx.cwd.split("/").filter(Boolean).pop() ?? "package";
|
|
74550
|
-
const
|
|
74607
|
+
const bare = base.toLowerCase().replace(/^[._]+/, "").replace(/[^a-z0-9._~-]+/g, "-") || "package";
|
|
74608
|
+
const scope = (_a3 = valueOf("--scope")) == null ? void 0 : _a3.replace(/^@?/, "@");
|
|
74609
|
+
const name = scope ? `${scope}/${bare}` : bare;
|
|
74551
74610
|
const manifest = {
|
|
74552
74611
|
name,
|
|
74553
74612
|
version: "1.0.0",
|
package/dist/index.mjs
CHANGED
|
@@ -8402,20 +8402,30 @@ function descriptorWriter(fd) {
|
|
|
8402
8402
|
if (!file || file.directory || (file.flags & 3) === 0) return null;
|
|
8403
8403
|
const { tree: tree2, path: path2 } = file;
|
|
8404
8404
|
const append = (file.flags & flagBits().append) !== 0;
|
|
8405
|
-
let
|
|
8405
|
+
let cursor = descriptorCursors.get(file);
|
|
8406
|
+
if (!cursor) {
|
|
8407
|
+
cursor = { position: file.position };
|
|
8408
|
+
descriptorCursors.set(file, cursor);
|
|
8409
|
+
}
|
|
8410
|
+
const offset2 = cursor;
|
|
8406
8411
|
return (text) => {
|
|
8407
8412
|
const bytes2 = new TextEncoder().encode(text);
|
|
8408
8413
|
const shared = openFiles.get(fd) === file ? file : null;
|
|
8414
|
+
if (shared) offset2.position = shared.position;
|
|
8409
8415
|
const existing = (shared == null ? void 0 : shared.cached) ?? (tree2.existsSync(path2) ? tree2.readFileSync(path2) : new Uint8Array(0));
|
|
8410
|
-
const at2 = append ? existing.length : position;
|
|
8416
|
+
const at2 = append ? existing.length : offset2.position;
|
|
8411
8417
|
const next = new Uint8Array(Math.max(existing.length, at2 + bytes2.length));
|
|
8412
8418
|
next.set(existing, 0);
|
|
8413
8419
|
next.set(bytes2, at2);
|
|
8414
8420
|
tree2.writeFileSync(path2, next);
|
|
8415
|
-
position = at2 + bytes2.length;
|
|
8416
|
-
if (shared)
|
|
8421
|
+
offset2.position = at2 + bytes2.length;
|
|
8422
|
+
if (shared) {
|
|
8423
|
+
shared.cached = next;
|
|
8424
|
+
shared.position = offset2.position;
|
|
8425
|
+
}
|
|
8417
8426
|
};
|
|
8418
8427
|
}
|
|
8428
|
+
const descriptorCursors = /* @__PURE__ */ new WeakMap();
|
|
8419
8429
|
function statArray(stats, bigint, path2) {
|
|
8420
8430
|
var _a2, _b2, _c2;
|
|
8421
8431
|
const mtime = stats.mtime instanceof Date ? stats.mtime.getTime() : Number(stats.mtimeMs ?? 0);
|
|
@@ -19190,16 +19200,30 @@ const path = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
|
|
|
19190
19200
|
toNamespacedPath,
|
|
19191
19201
|
win32
|
|
19192
19202
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
19203
|
+
function loopback(host2) {
|
|
19204
|
+
const bare = host2.startsWith("[") && host2.endsWith("]") ? host2.slice(1, -1) : host2;
|
|
19205
|
+
const name = bare.toLowerCase();
|
|
19206
|
+
return name === "" || name === "localhost" || name === "::1" || name.startsWith("127.");
|
|
19207
|
+
}
|
|
19193
19208
|
function createTlsModule(require2) {
|
|
19194
19209
|
const NetSocket = require2 ? require2("net").Socket : lazyExport("net", "Socket");
|
|
19195
|
-
const
|
|
19210
|
+
const netServer = () => (require2 ? require2("net") : nodeLibInternalRequire("net")).Server;
|
|
19196
19211
|
class TLSSocket2 extends NetSocket {
|
|
19197
19212
|
constructor(_socket, _options2) {
|
|
19198
19213
|
super({ allowHalfOpen: false });
|
|
19199
19214
|
__publicField(this, "authorized", false);
|
|
19200
19215
|
__publicField(this, "encrypted", true);
|
|
19201
19216
|
}
|
|
19202
|
-
connect(...
|
|
19217
|
+
connect(...args) {
|
|
19218
|
+
const options = args[0];
|
|
19219
|
+
const host2 = String((options == null ? void 0 : options.host) ?? (options == null ? void 0 : options.hostname) ?? "localhost");
|
|
19220
|
+
if (options && typeof options === "object" && options.socket === void 0 && loopback(host2)) {
|
|
19221
|
+
this.once("connect", () => {
|
|
19222
|
+
this.authorized = true;
|
|
19223
|
+
this.emit("secureConnect");
|
|
19224
|
+
});
|
|
19225
|
+
return NetSocket.prototype.connect.call(this, { port: options.port, host: host2 });
|
|
19226
|
+
}
|
|
19203
19227
|
this.connecting = true;
|
|
19204
19228
|
queueMicrotask(() => queueMicrotask(() => this.destroy(Object.assign(
|
|
19205
19229
|
new Error("TLS transport is unavailable in this runtime; HTTPS requires an admitted HTTP transport."),
|
|
@@ -19222,34 +19246,53 @@ function createTlsModule(require2) {
|
|
|
19222
19246
|
return false;
|
|
19223
19247
|
}
|
|
19224
19248
|
}
|
|
19225
|
-
|
|
19226
|
-
|
|
19227
|
-
|
|
19249
|
+
let chained = false;
|
|
19250
|
+
const Server2 = function TLSServer(options, secureConnectionListener) {
|
|
19251
|
+
if (!(this instanceof Server2)) return new Server2(options, secureConnectionListener);
|
|
19252
|
+
const NetServer = netServer();
|
|
19253
|
+
if (!chained) {
|
|
19254
|
+
Object.setPrototypeOf(Server2.prototype, NetServer.prototype);
|
|
19255
|
+
Object.setPrototypeOf(Server2, NetServer);
|
|
19256
|
+
chained = true;
|
|
19228
19257
|
}
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
|
|
19232
|
-
close(_callback3) {
|
|
19233
|
-
return this;
|
|
19234
|
-
}
|
|
19235
|
-
address() {
|
|
19236
|
-
return null;
|
|
19258
|
+
if (typeof options === "function") {
|
|
19259
|
+
secureConnectionListener = options;
|
|
19260
|
+
options = {};
|
|
19237
19261
|
}
|
|
19262
|
+
NetServer.call(this, options ?? {}, function secure(socket) {
|
|
19263
|
+
socket.encrypted = true;
|
|
19264
|
+
socket.authorized = false;
|
|
19265
|
+
this.emit("secureConnection", socket);
|
|
19266
|
+
});
|
|
19267
|
+
if (secureConnectionListener) this.on("secureConnection", secureConnectionListener);
|
|
19268
|
+
return this;
|
|
19269
|
+
};
|
|
19270
|
+
Object.assign(Server2.prototype, {
|
|
19271
|
+
addContext(_hostname, _context) {
|
|
19272
|
+
},
|
|
19238
19273
|
getTicketKeys() {
|
|
19239
19274
|
return (require2 ? require2("buffer").Buffer : Buffer).from("");
|
|
19240
|
-
}
|
|
19275
|
+
},
|
|
19241
19276
|
setTicketKeys(_keys) {
|
|
19242
|
-
}
|
|
19277
|
+
},
|
|
19243
19278
|
setSecureContext(_options2) {
|
|
19244
19279
|
}
|
|
19280
|
+
});
|
|
19281
|
+
function createServer2(options, secureConnectionListener) {
|
|
19282
|
+
return new Server2(options, secureConnectionListener);
|
|
19245
19283
|
}
|
|
19246
|
-
function
|
|
19247
|
-
|
|
19248
|
-
|
|
19249
|
-
|
|
19284
|
+
function connect2(...args) {
|
|
19285
|
+
const options = {};
|
|
19286
|
+
let callback;
|
|
19287
|
+
for (const arg of args) {
|
|
19288
|
+
if (typeof arg === "function") callback = arg;
|
|
19289
|
+
else if (typeof arg === "number" || typeof arg === "string" && options.port === void 0 && /^\d+$/u.test(arg)) options.port = arg;
|
|
19290
|
+
else if (typeof arg === "string") options.host = arg;
|
|
19291
|
+
else if (arg && typeof arg === "object") Object.assign(options, arg);
|
|
19292
|
+
}
|
|
19250
19293
|
const socket = new TLSSocket2();
|
|
19251
|
-
if (
|
|
19252
|
-
return socket.connect();
|
|
19294
|
+
if (callback) socket.once("secureConnect", callback);
|
|
19295
|
+
return socket.connect(options);
|
|
19253
19296
|
}
|
|
19254
19297
|
const createSecureContext2 = (_options2) => ({});
|
|
19255
19298
|
const getCiphers2 = () => ["TLS_AES_256_GCM_SHA384", "TLS_AES_128_GCM_SHA256"];
|
|
@@ -34189,8 +34232,15 @@ async function handleNpmInstall(args, ctx) {
|
|
|
34189
34232
|
}
|
|
34190
34233
|
}
|
|
34191
34234
|
async function handleNpmInit(args, ctx) {
|
|
34235
|
+
var _a2;
|
|
34192
34236
|
const yes = args.includes("-y") || args.includes("--yes");
|
|
34193
|
-
const
|
|
34237
|
+
const takesValue = (flag) => !flag.includes("=") && (flag === "--scope" || flag === "-w" || flag === "--workspace" || flag.startsWith("--init-"));
|
|
34238
|
+
const valueOf = (flag) => {
|
|
34239
|
+
const at2 = args.findIndex((a) => a === flag || a.startsWith(`${flag}=`));
|
|
34240
|
+
if (at2 < 0) return void 0;
|
|
34241
|
+
return args[at2].includes("=") ? args[at2].slice(args[at2].indexOf("=") + 1) : args[at2 + 1];
|
|
34242
|
+
};
|
|
34243
|
+
const initializer = args.find((a, i2) => !a.startsWith("-") && !(i2 > 0 && takesValue(args[i2 - 1])));
|
|
34194
34244
|
if (initializer) {
|
|
34195
34245
|
return { stdout: "", stderr: `npm ERR! npm init ${initializer} runs an initializer package, which this engine's npm does not; write package.json, or run \`npm init -y\`.
|
|
34196
34246
|
`, exitCode: 1 };
|
|
@@ -34210,7 +34260,9 @@ async function handleNpmInit(args, ctx) {
|
|
|
34210
34260
|
}
|
|
34211
34261
|
}
|
|
34212
34262
|
const base = ctx.cwd.split("/").filter(Boolean).pop() ?? "package";
|
|
34213
|
-
const
|
|
34263
|
+
const bare = base.toLowerCase().replace(/^[._]+/, "").replace(/[^a-z0-9._~-]+/g, "-") || "package";
|
|
34264
|
+
const scope = (_a2 = valueOf("--scope")) == null ? void 0 : _a2.replace(/^@?/, "@");
|
|
34265
|
+
const name = scope ? `${scope}/${bare}` : bare;
|
|
34214
34266
|
const manifest = {
|
|
34215
34267
|
name,
|
|
34216
34268
|
version: "1.0.0",
|
|
@@ -39787,7 +39839,7 @@ class WorkerRuntime {
|
|
|
39787
39839
|
this.worker = new Worker(
|
|
39788
39840
|
new URL(
|
|
39789
39841
|
/* @vite-ignore */
|
|
39790
|
-
"/assets/runtime-worker-
|
|
39842
|
+
"/assets/runtime-worker-XRE6n_4W.js",
|
|
39791
39843
|
import.meta.url
|
|
39792
39844
|
),
|
|
39793
39845
|
{ type: "module" }
|
|
@@ -40016,7 +40068,8 @@ function installHttpClientTransport(factory, transportOptions = {}) {
|
|
|
40016
40068
|
const connect2 = function(options, callback) {
|
|
40017
40069
|
var _a2;
|
|
40018
40070
|
const host2 = String(options.hostname ?? options.host ?? "localhost").toLowerCase();
|
|
40019
|
-
|
|
40071
|
+
const hostPort = local(host2) && !options.socketPath && ((_a2 = transportOptions.hostPorts) == null ? void 0 : _a2.call(transportOptions).has(Number(options.port ?? (protocol === "https:" ? 443 : 80))));
|
|
40072
|
+
if (!hostPort && (protocol === "http:" && (local(host2) || options.socketPath) || protocol === "https:" && local(host2) && !options.socketPath)) {
|
|
40020
40073
|
return original.call(this, options, callback);
|
|
40021
40074
|
}
|
|
40022
40075
|
try {
|
package/dist/shims/tls.d.ts
CHANGED
|
@@ -1,75 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* tls
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* tls: a tab's loopback carries no wire to protect. A TLS server listens on
|
|
3
|
+
* the engine's loopback as a net server does and hands its connections on as
|
|
4
|
+
* secure; a TLS connect to a loopback port pairs with that listener the same
|
|
5
|
+
* way. Bytes cross unencrypted because nothing lies between the two ends, and
|
|
6
|
+
* the browser holds TLS wherever there is a wire: a page reaches a guest
|
|
7
|
+
* server through the sandbox origin, and a request to another host goes out
|
|
8
|
+
* through the page's HTTP transport. A TLS connect to any other host fails
|
|
9
|
+
* asynchronously, rather than pretending to connect and leaving Node's HTTPS
|
|
10
|
+
* client waiting forever.
|
|
5
11
|
*/
|
|
6
|
-
|
|
12
|
+
import type { Socket } from '../node-lib/net-module';
|
|
13
|
+
import type { EventEmitter } from '../node-lib/events-module';
|
|
14
|
+
/** A TLS server as Node's module exposes it: constructed with or without `new`. */
|
|
15
|
+
export interface TlsServer extends EventEmitter {
|
|
16
|
+
listen(...args: unknown[]): this;
|
|
17
|
+
close(callback?: (err?: Error) => void): this;
|
|
18
|
+
address(): {
|
|
19
|
+
port: number;
|
|
20
|
+
family: string;
|
|
21
|
+
address: string;
|
|
22
|
+
} | string | null;
|
|
23
|
+
addContext(hostname: string, context: unknown): void;
|
|
24
|
+
getTicketKeys(): Buffer;
|
|
25
|
+
setTicketKeys(keys: Buffer): void;
|
|
26
|
+
setSecureContext(options: unknown): void;
|
|
27
|
+
}
|
|
28
|
+
export interface TlsServerConstructor {
|
|
29
|
+
new (options?: unknown, secureConnectionListener?: (socket: Socket) => void): TlsServer;
|
|
30
|
+
(options?: unknown, secureConnectionListener?: (socket: Socket) => void): TlsServer;
|
|
31
|
+
readonly prototype: TlsServer;
|
|
32
|
+
}
|
|
33
|
+
/** Each graph's TLS keeps that graph's Socket and Server identity. */
|
|
7
34
|
export declare function createTlsModule(require?: (name: string) => any): {
|
|
8
35
|
TLSSocket: {
|
|
9
36
|
new (_socket?: unknown, _options?: unknown): {
|
|
10
37
|
[key: string]: unknown;
|
|
11
38
|
authorized: boolean;
|
|
12
39
|
encrypted: boolean;
|
|
13
|
-
connect(...
|
|
14
|
-
getPeerCertificate(_detailed?: boolean): object;
|
|
15
|
-
getCipher(): {
|
|
16
|
-
name: string;
|
|
17
|
-
version: string;
|
|
18
|
-
} | null;
|
|
19
|
-
getProtocol(): string | null;
|
|
20
|
-
setServername(_name: string): void;
|
|
21
|
-
renegotiate(_options: unknown, _callback: (err: Error | null) => void): boolean;
|
|
22
|
-
connecting: boolean;
|
|
23
|
-
pending: boolean;
|
|
24
|
-
readyState: string;
|
|
25
|
-
bufferSize: number | undefined;
|
|
26
|
-
bytesRead: number;
|
|
27
|
-
bytesWritten: number | undefined;
|
|
28
|
-
localAddress: string | undefined;
|
|
29
|
-
localPort: number | undefined;
|
|
30
|
-
localFamily: string | undefined;
|
|
31
|
-
remoteAddress: string | undefined;
|
|
32
|
-
remotePort: number | undefined;
|
|
33
|
-
remoteFamily: string | undefined;
|
|
34
|
-
timeout?: number;
|
|
35
|
-
server: import("../node-lib/net-module").Server | null;
|
|
36
|
-
_server: import("../node-lib/net-module").Server | null;
|
|
37
|
-
_handle: import("../node-lib/binding/stream_wrap").LibuvStreamWrap | null;
|
|
38
|
-
address(): import("../node-lib/net-module").AddressInfo | Record<string, never>;
|
|
39
|
-
setTimeout(timeout: number, callback?: (() => void) | undefined): /*elided*/ any;
|
|
40
|
-
setNoDelay(enable?: boolean): /*elided*/ any;
|
|
41
|
-
setKeepAlive(enable?: boolean, initialDelay?: number): /*elided*/ any;
|
|
42
|
-
resetAndDestroy(): /*elided*/ any;
|
|
43
|
-
destroySoon(): void;
|
|
44
|
-
ref(): /*elided*/ any;
|
|
45
|
-
unref(): /*elided*/ any;
|
|
46
|
-
cork(): void;
|
|
47
|
-
uncork(): void;
|
|
48
|
-
push(chunk: unknown, encoding?: string): boolean;
|
|
49
|
-
read(size?: number): string | Uint8Array | null;
|
|
50
|
-
pause(): /*elided*/ any;
|
|
51
|
-
resume(): /*elided*/ any;
|
|
52
|
-
destroy(error?: Error): /*elided*/ any;
|
|
53
|
-
setEncoding(encoding: string): /*elided*/ any;
|
|
54
|
-
pipe(destination: unknown, options?: unknown): unknown;
|
|
55
|
-
on(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
56
|
-
once(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
57
|
-
emit(event: string, ...args: unknown[]): boolean;
|
|
58
|
-
readable: boolean;
|
|
59
|
-
readableEnded: boolean;
|
|
60
|
-
destroyed: boolean;
|
|
61
|
-
isTTY?: boolean;
|
|
62
|
-
write(chunk: unknown, encoding?: unknown, callback?: unknown): boolean;
|
|
63
|
-
end(chunk?: unknown, encoding?: unknown, callback?: unknown): /*elided*/ any;
|
|
64
|
-
writable: boolean;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
Server: {
|
|
68
|
-
new (_options?: unknown, _connectionListener?: (socket: {
|
|
69
|
-
[key: string]: unknown;
|
|
70
|
-
authorized: boolean;
|
|
71
|
-
encrypted: boolean;
|
|
72
|
-
connect(..._args: unknown[]): /*elided*/ any;
|
|
40
|
+
connect(...args: unknown[]): /*elided*/ any;
|
|
73
41
|
getPeerCertificate(_detailed?: boolean): object;
|
|
74
42
|
getCipher(): {
|
|
75
43
|
name: string;
|
|
@@ -121,122 +89,15 @@ export declare function createTlsModule(require?: (name: string) => any): {
|
|
|
121
89
|
write(chunk: unknown, encoding?: unknown, callback?: unknown): boolean;
|
|
122
90
|
end(chunk?: unknown, encoding?: unknown, callback?: unknown): /*elided*/ any;
|
|
123
91
|
writable: boolean;
|
|
124
|
-
}) => void): {
|
|
125
|
-
listen(..._args: unknown[]): /*elided*/ any;
|
|
126
|
-
close(_callback?: (err?: Error) => void): /*elided*/ any;
|
|
127
|
-
address(): {
|
|
128
|
-
port: number;
|
|
129
|
-
family: string;
|
|
130
|
-
address: string;
|
|
131
|
-
} | string | null;
|
|
132
|
-
getTicketKeys(): Buffer;
|
|
133
|
-
setTicketKeys(_keys: Buffer): void;
|
|
134
|
-
setSecureContext(_options: unknown): void;
|
|
135
|
-
addListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
136
|
-
on(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
137
|
-
once(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
138
|
-
removeListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
139
|
-
off(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
140
|
-
removeAllListeners(event?: string | symbol): /*elided*/ any;
|
|
141
|
-
setMaxListeners(n: number): /*elided*/ any;
|
|
142
|
-
getMaxListeners(): number;
|
|
143
|
-
listeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
144
|
-
rawListeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
145
|
-
emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
146
|
-
listenerCount(event: string | symbol, listener?: import("../node-lib/events-module").EventListener): number;
|
|
147
|
-
prependListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
148
|
-
prependOnceListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
149
|
-
eventNames(): Array<string | symbol>;
|
|
150
92
|
};
|
|
151
93
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
encrypted: boolean;
|
|
156
|
-
connect(..._args: unknown[]): /*elided*/ any;
|
|
157
|
-
getPeerCertificate(_detailed?: boolean): object;
|
|
158
|
-
getCipher(): {
|
|
159
|
-
name: string;
|
|
160
|
-
version: string;
|
|
161
|
-
} | null;
|
|
162
|
-
getProtocol(): string | null;
|
|
163
|
-
setServername(_name: string): void;
|
|
164
|
-
renegotiate(_options: unknown, _callback: (err: Error | null) => void): boolean;
|
|
165
|
-
connecting: boolean;
|
|
166
|
-
pending: boolean;
|
|
167
|
-
readyState: string;
|
|
168
|
-
bufferSize: number | undefined;
|
|
169
|
-
bytesRead: number;
|
|
170
|
-
bytesWritten: number | undefined;
|
|
171
|
-
localAddress: string | undefined;
|
|
172
|
-
localPort: number | undefined;
|
|
173
|
-
localFamily: string | undefined;
|
|
174
|
-
remoteAddress: string | undefined;
|
|
175
|
-
remotePort: number | undefined;
|
|
176
|
-
remoteFamily: string | undefined;
|
|
177
|
-
timeout?: number;
|
|
178
|
-
server: import("../node-lib/net-module").Server | null;
|
|
179
|
-
_server: import("../node-lib/net-module").Server | null;
|
|
180
|
-
_handle: import("../node-lib/binding/stream_wrap").LibuvStreamWrap | null;
|
|
181
|
-
address(): import("../node-lib/net-module").AddressInfo | Record<string, never>;
|
|
182
|
-
setTimeout(timeout: number, callback?: (() => void) | undefined): /*elided*/ any;
|
|
183
|
-
setNoDelay(enable?: boolean): /*elided*/ any;
|
|
184
|
-
setKeepAlive(enable?: boolean, initialDelay?: number): /*elided*/ any;
|
|
185
|
-
resetAndDestroy(): /*elided*/ any;
|
|
186
|
-
destroySoon(): void;
|
|
187
|
-
ref(): /*elided*/ any;
|
|
188
|
-
unref(): /*elided*/ any;
|
|
189
|
-
cork(): void;
|
|
190
|
-
uncork(): void;
|
|
191
|
-
push(chunk: unknown, encoding?: string): boolean;
|
|
192
|
-
read(size?: number): string | Uint8Array | null;
|
|
193
|
-
pause(): /*elided*/ any;
|
|
194
|
-
resume(): /*elided*/ any;
|
|
195
|
-
destroy(error?: Error): /*elided*/ any;
|
|
196
|
-
setEncoding(encoding: string): /*elided*/ any;
|
|
197
|
-
pipe(destination: unknown, options?: unknown): unknown;
|
|
198
|
-
on(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
199
|
-
once(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
200
|
-
emit(event: string, ...args: unknown[]): boolean;
|
|
201
|
-
readable: boolean;
|
|
202
|
-
readableEnded: boolean;
|
|
203
|
-
destroyed: boolean;
|
|
204
|
-
isTTY?: boolean;
|
|
205
|
-
write(chunk: unknown, encoding?: unknown, callback?: unknown): boolean;
|
|
206
|
-
end(chunk?: unknown, encoding?: unknown, callback?: unknown): /*elided*/ any;
|
|
207
|
-
writable: boolean;
|
|
208
|
-
}) => void) => {
|
|
209
|
-
listen(..._args: unknown[]): /*elided*/ any;
|
|
210
|
-
close(_callback?: (err?: Error) => void): /*elided*/ any;
|
|
211
|
-
address(): {
|
|
212
|
-
port: number;
|
|
213
|
-
family: string;
|
|
214
|
-
address: string;
|
|
215
|
-
} | string | null;
|
|
216
|
-
getTicketKeys(): Buffer;
|
|
217
|
-
setTicketKeys(_keys: Buffer): void;
|
|
218
|
-
setSecureContext(_options: unknown): void;
|
|
219
|
-
addListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
220
|
-
on(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
221
|
-
once(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
222
|
-
removeListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
223
|
-
off(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
224
|
-
removeAllListeners(event?: string | symbol): /*elided*/ any;
|
|
225
|
-
setMaxListeners(n: number): /*elided*/ any;
|
|
226
|
-
getMaxListeners(): number;
|
|
227
|
-
listeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
228
|
-
rawListeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
229
|
-
emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
230
|
-
listenerCount(event: string | symbol, listener?: import("../node-lib/events-module").EventListener): number;
|
|
231
|
-
prependListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
232
|
-
prependOnceListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
233
|
-
eventNames(): Array<string | symbol>;
|
|
234
|
-
};
|
|
235
|
-
connect: (_options: unknown, _callback?: () => void) => {
|
|
94
|
+
Server: TlsServerConstructor;
|
|
95
|
+
createServer: (options?: unknown, secureConnectionListener?: (socket: Socket) => void) => TlsServer;
|
|
96
|
+
connect: (...args: unknown[]) => {
|
|
236
97
|
[key: string]: unknown;
|
|
237
98
|
authorized: boolean;
|
|
238
99
|
encrypted: boolean;
|
|
239
|
-
connect(...
|
|
100
|
+
connect(...args: unknown[]): /*elided*/ any;
|
|
240
101
|
getPeerCertificate(_detailed?: boolean): object;
|
|
241
102
|
getCipher(): {
|
|
242
103
|
name: string;
|
|
@@ -303,7 +164,7 @@ declare const tls: {
|
|
|
303
164
|
[key: string]: unknown;
|
|
304
165
|
authorized: boolean;
|
|
305
166
|
encrypted: boolean;
|
|
306
|
-
connect(...
|
|
167
|
+
connect(...args: unknown[]): /*elided*/ any;
|
|
307
168
|
getPeerCertificate(_detailed?: boolean): object;
|
|
308
169
|
getCipher(): {
|
|
309
170
|
name: string;
|
|
@@ -357,179 +218,13 @@ declare const tls: {
|
|
|
357
218
|
writable: boolean;
|
|
358
219
|
};
|
|
359
220
|
};
|
|
360
|
-
Server:
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
authorized: boolean;
|
|
364
|
-
encrypted: boolean;
|
|
365
|
-
connect(..._args: unknown[]): /*elided*/ any;
|
|
366
|
-
getPeerCertificate(_detailed?: boolean): object;
|
|
367
|
-
getCipher(): {
|
|
368
|
-
name: string;
|
|
369
|
-
version: string;
|
|
370
|
-
} | null;
|
|
371
|
-
getProtocol(): string | null;
|
|
372
|
-
setServername(_name: string): void;
|
|
373
|
-
renegotiate(_options: unknown, _callback: (err: Error | null) => void): boolean;
|
|
374
|
-
connecting: boolean;
|
|
375
|
-
pending: boolean;
|
|
376
|
-
readyState: string;
|
|
377
|
-
bufferSize: number | undefined;
|
|
378
|
-
bytesRead: number;
|
|
379
|
-
bytesWritten: number | undefined;
|
|
380
|
-
localAddress: string | undefined;
|
|
381
|
-
localPort: number | undefined;
|
|
382
|
-
localFamily: string | undefined;
|
|
383
|
-
remoteAddress: string | undefined;
|
|
384
|
-
remotePort: number | undefined;
|
|
385
|
-
remoteFamily: string | undefined;
|
|
386
|
-
timeout?: number;
|
|
387
|
-
server: import("../node-lib/net-module").Server | null;
|
|
388
|
-
_server: import("../node-lib/net-module").Server | null;
|
|
389
|
-
_handle: import("../node-lib/binding/stream_wrap").LibuvStreamWrap | null;
|
|
390
|
-
address(): import("../node-lib/net-module").AddressInfo | Record<string, never>;
|
|
391
|
-
setTimeout(timeout: number, callback?: (() => void) | undefined): /*elided*/ any;
|
|
392
|
-
setNoDelay(enable?: boolean): /*elided*/ any;
|
|
393
|
-
setKeepAlive(enable?: boolean, initialDelay?: number): /*elided*/ any;
|
|
394
|
-
resetAndDestroy(): /*elided*/ any;
|
|
395
|
-
destroySoon(): void;
|
|
396
|
-
ref(): /*elided*/ any;
|
|
397
|
-
unref(): /*elided*/ any;
|
|
398
|
-
cork(): void;
|
|
399
|
-
uncork(): void;
|
|
400
|
-
push(chunk: unknown, encoding?: string): boolean;
|
|
401
|
-
read(size?: number): string | Uint8Array | null;
|
|
402
|
-
pause(): /*elided*/ any;
|
|
403
|
-
resume(): /*elided*/ any;
|
|
404
|
-
destroy(error?: Error): /*elided*/ any;
|
|
405
|
-
setEncoding(encoding: string): /*elided*/ any;
|
|
406
|
-
pipe(destination: unknown, options?: unknown): unknown;
|
|
407
|
-
on(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
408
|
-
once(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
409
|
-
emit(event: string, ...args: unknown[]): boolean;
|
|
410
|
-
readable: boolean;
|
|
411
|
-
readableEnded: boolean;
|
|
412
|
-
destroyed: boolean;
|
|
413
|
-
isTTY?: boolean;
|
|
414
|
-
write(chunk: unknown, encoding?: unknown, callback?: unknown): boolean;
|
|
415
|
-
end(chunk?: unknown, encoding?: unknown, callback?: unknown): /*elided*/ any;
|
|
416
|
-
writable: boolean;
|
|
417
|
-
}) => void): {
|
|
418
|
-
listen(..._args: unknown[]): /*elided*/ any;
|
|
419
|
-
close(_callback?: (err?: Error) => void): /*elided*/ any;
|
|
420
|
-
address(): {
|
|
421
|
-
port: number;
|
|
422
|
-
family: string;
|
|
423
|
-
address: string;
|
|
424
|
-
} | string | null;
|
|
425
|
-
getTicketKeys(): Buffer;
|
|
426
|
-
setTicketKeys(_keys: Buffer): void;
|
|
427
|
-
setSecureContext(_options: unknown): void;
|
|
428
|
-
addListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
429
|
-
on(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
430
|
-
once(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
431
|
-
removeListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
432
|
-
off(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
433
|
-
removeAllListeners(event?: string | symbol): /*elided*/ any;
|
|
434
|
-
setMaxListeners(n: number): /*elided*/ any;
|
|
435
|
-
getMaxListeners(): number;
|
|
436
|
-
listeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
437
|
-
rawListeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
438
|
-
emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
439
|
-
listenerCount(event: string | symbol, listener?: import("../node-lib/events-module").EventListener): number;
|
|
440
|
-
prependListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
441
|
-
prependOnceListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
442
|
-
eventNames(): Array<string | symbol>;
|
|
443
|
-
};
|
|
444
|
-
};
|
|
445
|
-
createServer: (_options?: unknown, _connectionListener?: (socket: {
|
|
446
|
-
[key: string]: unknown;
|
|
447
|
-
authorized: boolean;
|
|
448
|
-
encrypted: boolean;
|
|
449
|
-
connect(..._args: unknown[]): /*elided*/ any;
|
|
450
|
-
getPeerCertificate(_detailed?: boolean): object;
|
|
451
|
-
getCipher(): {
|
|
452
|
-
name: string;
|
|
453
|
-
version: string;
|
|
454
|
-
} | null;
|
|
455
|
-
getProtocol(): string | null;
|
|
456
|
-
setServername(_name: string): void;
|
|
457
|
-
renegotiate(_options: unknown, _callback: (err: Error | null) => void): boolean;
|
|
458
|
-
connecting: boolean;
|
|
459
|
-
pending: boolean;
|
|
460
|
-
readyState: string;
|
|
461
|
-
bufferSize: number | undefined;
|
|
462
|
-
bytesRead: number;
|
|
463
|
-
bytesWritten: number | undefined;
|
|
464
|
-
localAddress: string | undefined;
|
|
465
|
-
localPort: number | undefined;
|
|
466
|
-
localFamily: string | undefined;
|
|
467
|
-
remoteAddress: string | undefined;
|
|
468
|
-
remotePort: number | undefined;
|
|
469
|
-
remoteFamily: string | undefined;
|
|
470
|
-
timeout?: number;
|
|
471
|
-
server: import("../node-lib/net-module").Server | null;
|
|
472
|
-
_server: import("../node-lib/net-module").Server | null;
|
|
473
|
-
_handle: import("../node-lib/binding/stream_wrap").LibuvStreamWrap | null;
|
|
474
|
-
address(): import("../node-lib/net-module").AddressInfo | Record<string, never>;
|
|
475
|
-
setTimeout(timeout: number, callback?: (() => void) | undefined): /*elided*/ any;
|
|
476
|
-
setNoDelay(enable?: boolean): /*elided*/ any;
|
|
477
|
-
setKeepAlive(enable?: boolean, initialDelay?: number): /*elided*/ any;
|
|
478
|
-
resetAndDestroy(): /*elided*/ any;
|
|
479
|
-
destroySoon(): void;
|
|
480
|
-
ref(): /*elided*/ any;
|
|
481
|
-
unref(): /*elided*/ any;
|
|
482
|
-
cork(): void;
|
|
483
|
-
uncork(): void;
|
|
484
|
-
push(chunk: unknown, encoding?: string): boolean;
|
|
485
|
-
read(size?: number): string | Uint8Array | null;
|
|
486
|
-
pause(): /*elided*/ any;
|
|
487
|
-
resume(): /*elided*/ any;
|
|
488
|
-
destroy(error?: Error): /*elided*/ any;
|
|
489
|
-
setEncoding(encoding: string): /*elided*/ any;
|
|
490
|
-
pipe(destination: unknown, options?: unknown): unknown;
|
|
491
|
-
on(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
492
|
-
once(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
493
|
-
emit(event: string, ...args: unknown[]): boolean;
|
|
494
|
-
readable: boolean;
|
|
495
|
-
readableEnded: boolean;
|
|
496
|
-
destroyed: boolean;
|
|
497
|
-
isTTY?: boolean;
|
|
498
|
-
write(chunk: unknown, encoding?: unknown, callback?: unknown): boolean;
|
|
499
|
-
end(chunk?: unknown, encoding?: unknown, callback?: unknown): /*elided*/ any;
|
|
500
|
-
writable: boolean;
|
|
501
|
-
}) => void) => {
|
|
502
|
-
listen(..._args: unknown[]): /*elided*/ any;
|
|
503
|
-
close(_callback?: (err?: Error) => void): /*elided*/ any;
|
|
504
|
-
address(): {
|
|
505
|
-
port: number;
|
|
506
|
-
family: string;
|
|
507
|
-
address: string;
|
|
508
|
-
} | string | null;
|
|
509
|
-
getTicketKeys(): Buffer;
|
|
510
|
-
setTicketKeys(_keys: Buffer): void;
|
|
511
|
-
setSecureContext(_options: unknown): void;
|
|
512
|
-
addListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
513
|
-
on(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
514
|
-
once(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
515
|
-
removeListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
516
|
-
off(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
517
|
-
removeAllListeners(event?: string | symbol): /*elided*/ any;
|
|
518
|
-
setMaxListeners(n: number): /*elided*/ any;
|
|
519
|
-
getMaxListeners(): number;
|
|
520
|
-
listeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
521
|
-
rawListeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
522
|
-
emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
523
|
-
listenerCount(event: string | symbol, listener?: import("../node-lib/events-module").EventListener): number;
|
|
524
|
-
prependListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
525
|
-
prependOnceListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
526
|
-
eventNames(): Array<string | symbol>;
|
|
527
|
-
};
|
|
528
|
-
connect: (_options: unknown, _callback?: () => void) => {
|
|
221
|
+
Server: TlsServerConstructor;
|
|
222
|
+
createServer: (options?: unknown, secureConnectionListener?: (socket: Socket) => void) => TlsServer;
|
|
223
|
+
connect: (...args: unknown[]) => {
|
|
529
224
|
[key: string]: unknown;
|
|
530
225
|
authorized: boolean;
|
|
531
226
|
encrypted: boolean;
|
|
532
|
-
connect(...
|
|
227
|
+
connect(...args: unknown[]): /*elided*/ any;
|
|
533
228
|
getPeerCertificate(_detailed?: boolean): object;
|
|
534
229
|
getCipher(): {
|
|
535
230
|
name: string;
|
|
@@ -595,7 +290,7 @@ export declare const TLSSocket: {
|
|
|
595
290
|
[key: string]: unknown;
|
|
596
291
|
authorized: boolean;
|
|
597
292
|
encrypted: boolean;
|
|
598
|
-
connect(...
|
|
293
|
+
connect(...args: unknown[]): /*elided*/ any;
|
|
599
294
|
getPeerCertificate(_detailed?: boolean): object;
|
|
600
295
|
getCipher(): {
|
|
601
296
|
name: string;
|
|
@@ -648,177 +343,11 @@ export declare const TLSSocket: {
|
|
|
648
343
|
end(chunk?: unknown, encoding?: unknown, callback?: unknown): /*elided*/ any;
|
|
649
344
|
writable: boolean;
|
|
650
345
|
};
|
|
651
|
-
}, Server: {
|
|
652
|
-
new (_options?: unknown, _connectionListener?: (socket: {
|
|
653
|
-
[key: string]: unknown;
|
|
654
|
-
authorized: boolean;
|
|
655
|
-
encrypted: boolean;
|
|
656
|
-
connect(..._args: unknown[]): /*elided*/ any;
|
|
657
|
-
getPeerCertificate(_detailed?: boolean): object;
|
|
658
|
-
getCipher(): {
|
|
659
|
-
name: string;
|
|
660
|
-
version: string;
|
|
661
|
-
} | null;
|
|
662
|
-
getProtocol(): string | null;
|
|
663
|
-
setServername(_name: string): void;
|
|
664
|
-
renegotiate(_options: unknown, _callback: (err: Error | null) => void): boolean;
|
|
665
|
-
connecting: boolean;
|
|
666
|
-
pending: boolean;
|
|
667
|
-
readyState: string;
|
|
668
|
-
bufferSize: number | undefined;
|
|
669
|
-
bytesRead: number;
|
|
670
|
-
bytesWritten: number | undefined;
|
|
671
|
-
localAddress: string | undefined;
|
|
672
|
-
localPort: number | undefined;
|
|
673
|
-
localFamily: string | undefined;
|
|
674
|
-
remoteAddress: string | undefined;
|
|
675
|
-
remotePort: number | undefined;
|
|
676
|
-
remoteFamily: string | undefined;
|
|
677
|
-
timeout?: number;
|
|
678
|
-
server: import("../node-lib/net-module").Server | null;
|
|
679
|
-
_server: import("../node-lib/net-module").Server | null;
|
|
680
|
-
_handle: import("../node-lib/binding/stream_wrap").LibuvStreamWrap | null;
|
|
681
|
-
address(): import("../node-lib/net-module").AddressInfo | Record<string, never>;
|
|
682
|
-
setTimeout(timeout: number, callback?: (() => void) | undefined): /*elided*/ any;
|
|
683
|
-
setNoDelay(enable?: boolean): /*elided*/ any;
|
|
684
|
-
setKeepAlive(enable?: boolean, initialDelay?: number): /*elided*/ any;
|
|
685
|
-
resetAndDestroy(): /*elided*/ any;
|
|
686
|
-
destroySoon(): void;
|
|
687
|
-
ref(): /*elided*/ any;
|
|
688
|
-
unref(): /*elided*/ any;
|
|
689
|
-
cork(): void;
|
|
690
|
-
uncork(): void;
|
|
691
|
-
push(chunk: unknown, encoding?: string): boolean;
|
|
692
|
-
read(size?: number): string | Uint8Array | null;
|
|
693
|
-
pause(): /*elided*/ any;
|
|
694
|
-
resume(): /*elided*/ any;
|
|
695
|
-
destroy(error?: Error): /*elided*/ any;
|
|
696
|
-
setEncoding(encoding: string): /*elided*/ any;
|
|
697
|
-
pipe(destination: unknown, options?: unknown): unknown;
|
|
698
|
-
on(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
699
|
-
once(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
700
|
-
emit(event: string, ...args: unknown[]): boolean;
|
|
701
|
-
readable: boolean;
|
|
702
|
-
readableEnded: boolean;
|
|
703
|
-
destroyed: boolean;
|
|
704
|
-
isTTY?: boolean;
|
|
705
|
-
write(chunk: unknown, encoding?: unknown, callback?: unknown): boolean;
|
|
706
|
-
end(chunk?: unknown, encoding?: unknown, callback?: unknown): /*elided*/ any;
|
|
707
|
-
writable: boolean;
|
|
708
|
-
}) => void): {
|
|
709
|
-
listen(..._args: unknown[]): /*elided*/ any;
|
|
710
|
-
close(_callback?: (err?: Error) => void): /*elided*/ any;
|
|
711
|
-
address(): {
|
|
712
|
-
port: number;
|
|
713
|
-
family: string;
|
|
714
|
-
address: string;
|
|
715
|
-
} | string | null;
|
|
716
|
-
getTicketKeys(): Buffer;
|
|
717
|
-
setTicketKeys(_keys: Buffer): void;
|
|
718
|
-
setSecureContext(_options: unknown): void;
|
|
719
|
-
addListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
720
|
-
on(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
721
|
-
once(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
722
|
-
removeListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
723
|
-
off(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
724
|
-
removeAllListeners(event?: string | symbol): /*elided*/ any;
|
|
725
|
-
setMaxListeners(n: number): /*elided*/ any;
|
|
726
|
-
getMaxListeners(): number;
|
|
727
|
-
listeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
728
|
-
rawListeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
729
|
-
emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
730
|
-
listenerCount(event: string | symbol, listener?: import("../node-lib/events-module").EventListener): number;
|
|
731
|
-
prependListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
732
|
-
prependOnceListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
733
|
-
eventNames(): Array<string | symbol>;
|
|
734
|
-
};
|
|
735
|
-
}, createServer: (_options?: unknown, _connectionListener?: (socket: {
|
|
736
|
-
[key: string]: unknown;
|
|
737
|
-
authorized: boolean;
|
|
738
|
-
encrypted: boolean;
|
|
739
|
-
connect(..._args: unknown[]): /*elided*/ any;
|
|
740
|
-
getPeerCertificate(_detailed?: boolean): object;
|
|
741
|
-
getCipher(): {
|
|
742
|
-
name: string;
|
|
743
|
-
version: string;
|
|
744
|
-
} | null;
|
|
745
|
-
getProtocol(): string | null;
|
|
746
|
-
setServername(_name: string): void;
|
|
747
|
-
renegotiate(_options: unknown, _callback: (err: Error | null) => void): boolean;
|
|
748
|
-
connecting: boolean;
|
|
749
|
-
pending: boolean;
|
|
750
|
-
readyState: string;
|
|
751
|
-
bufferSize: number | undefined;
|
|
752
|
-
bytesRead: number;
|
|
753
|
-
bytesWritten: number | undefined;
|
|
754
|
-
localAddress: string | undefined;
|
|
755
|
-
localPort: number | undefined;
|
|
756
|
-
localFamily: string | undefined;
|
|
757
|
-
remoteAddress: string | undefined;
|
|
758
|
-
remotePort: number | undefined;
|
|
759
|
-
remoteFamily: string | undefined;
|
|
760
|
-
timeout?: number;
|
|
761
|
-
server: import("../node-lib/net-module").Server | null;
|
|
762
|
-
_server: import("../node-lib/net-module").Server | null;
|
|
763
|
-
_handle: import("../node-lib/binding/stream_wrap").LibuvStreamWrap | null;
|
|
764
|
-
address(): import("../node-lib/net-module").AddressInfo | Record<string, never>;
|
|
765
|
-
setTimeout(timeout: number, callback?: (() => void) | undefined): /*elided*/ any;
|
|
766
|
-
setNoDelay(enable?: boolean): /*elided*/ any;
|
|
767
|
-
setKeepAlive(enable?: boolean, initialDelay?: number): /*elided*/ any;
|
|
768
|
-
resetAndDestroy(): /*elided*/ any;
|
|
769
|
-
destroySoon(): void;
|
|
770
|
-
ref(): /*elided*/ any;
|
|
771
|
-
unref(): /*elided*/ any;
|
|
772
|
-
cork(): void;
|
|
773
|
-
uncork(): void;
|
|
774
|
-
push(chunk: unknown, encoding?: string): boolean;
|
|
775
|
-
read(size?: number): string | Uint8Array | null;
|
|
776
|
-
pause(): /*elided*/ any;
|
|
777
|
-
resume(): /*elided*/ any;
|
|
778
|
-
destroy(error?: Error): /*elided*/ any;
|
|
779
|
-
setEncoding(encoding: string): /*elided*/ any;
|
|
780
|
-
pipe(destination: unknown, options?: unknown): unknown;
|
|
781
|
-
on(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
782
|
-
once(event: string, listener: (...args: never[]) => void): /*elided*/ any;
|
|
783
|
-
emit(event: string, ...args: unknown[]): boolean;
|
|
784
|
-
readable: boolean;
|
|
785
|
-
readableEnded: boolean;
|
|
786
|
-
destroyed: boolean;
|
|
787
|
-
isTTY?: boolean;
|
|
788
|
-
write(chunk: unknown, encoding?: unknown, callback?: unknown): boolean;
|
|
789
|
-
end(chunk?: unknown, encoding?: unknown, callback?: unknown): /*elided*/ any;
|
|
790
|
-
writable: boolean;
|
|
791
|
-
}) => void) => {
|
|
792
|
-
listen(..._args: unknown[]): /*elided*/ any;
|
|
793
|
-
close(_callback?: (err?: Error) => void): /*elided*/ any;
|
|
794
|
-
address(): {
|
|
795
|
-
port: number;
|
|
796
|
-
family: string;
|
|
797
|
-
address: string;
|
|
798
|
-
} | string | null;
|
|
799
|
-
getTicketKeys(): Buffer;
|
|
800
|
-
setTicketKeys(_keys: Buffer): void;
|
|
801
|
-
setSecureContext(_options: unknown): void;
|
|
802
|
-
addListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
803
|
-
on(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
804
|
-
once(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
805
|
-
removeListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
806
|
-
off(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
807
|
-
removeAllListeners(event?: string | symbol): /*elided*/ any;
|
|
808
|
-
setMaxListeners(n: number): /*elided*/ any;
|
|
809
|
-
getMaxListeners(): number;
|
|
810
|
-
listeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
811
|
-
rawListeners(event: string | symbol): Array<import("../node-lib/events-module").EventListener>;
|
|
812
|
-
emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
813
|
-
listenerCount(event: string | symbol, listener?: import("../node-lib/events-module").EventListener): number;
|
|
814
|
-
prependListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
815
|
-
prependOnceListener(event: string | symbol, listener: import("../node-lib/events-module").EventListener): /*elided*/ any;
|
|
816
|
-
eventNames(): Array<string | symbol>;
|
|
817
|
-
}, connect: (_options: unknown, _callback?: () => void) => {
|
|
346
|
+
}, Server: TlsServerConstructor, createServer: (options?: unknown, secureConnectionListener?: (socket: Socket) => void) => TlsServer, connect: (...args: unknown[]) => {
|
|
818
347
|
[key: string]: unknown;
|
|
819
348
|
authorized: boolean;
|
|
820
349
|
encrypted: boolean;
|
|
821
|
-
connect(...
|
|
350
|
+
connect(...args: unknown[]): /*elided*/ any;
|
|
822
351
|
getPeerCertificate(_detailed?: boolean): object;
|
|
823
352
|
getCipher(): {
|
|
824
353
|
name: string;
|
package/package.json
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Node's Agent connection seam over a host HTTP exchange. Both sides of the
|
|
3
3
|
* internal connection use Node's unmodified HTTP library: it parses requests,
|
|
4
4
|
* generates responses and owns ClientRequest/IncomingMessage and backpressure.
|
|
5
|
-
* No TLS socket or network metadata is fabricated
|
|
5
|
+
* No TLS socket or network metadata is fabricated for a remote host; a
|
|
6
|
+
* loopback port stays the engine's own network, plain or TLS. The host admits the target
|
|
6
7
|
* and capabilities before sending, and returns one response without retries.
|
|
7
8
|
*/
|
|
8
9
|
import { httpModule, httpsModule } from './node-lib/http-module';
|
|
@@ -54,9 +55,12 @@ export function installHttpClientTransport(factory: HttpClientTransportFactory,
|
|
|
54
55
|
const original = prototype.createConnection;
|
|
55
56
|
const connect = function(this: unknown, options: Record<string, any>, callback: (error: Error | null, socket?: unknown) => void): unknown {
|
|
56
57
|
const host = String(options.hostname ?? options.host ?? 'localhost').toLowerCase();
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
// Local HTTP, plain or TLS, is the engine's existing virtual network,
|
|
59
|
+
// except a port the host serves itself: a TLS connect to loopback pairs
|
|
60
|
+
// with the guest's listener, as `tls` does, with no wire to protect.
|
|
61
|
+
const hostPort = local(host) && !options.socketPath
|
|
62
|
+
&& transportOptions.hostPorts?.().has(Number(options.port ?? (protocol === 'https:' ? 443 : 80)));
|
|
63
|
+
if (!hostPort && ((protocol === 'http:' && (local(host) || options.socketPath)) || (protocol === 'https:' && local(host) && !options.socketPath))) {
|
|
60
64
|
return original.call(this, options, callback);
|
|
61
65
|
}
|
|
62
66
|
try {
|
|
@@ -186,21 +186,28 @@ export function descriptorWriter(fd: number): ((text: string) => void) | null {
|
|
|
186
186
|
if (!file || file.directory || (file.flags & 3) === 0) return null;
|
|
187
187
|
const { tree, path } = file;
|
|
188
188
|
const append = (file.flags & flagBits().append) !== 0;
|
|
189
|
-
|
|
189
|
+
// One offset per open file, as a dup'd descriptor shares one: a child's
|
|
190
|
+
// stdout and stderr on the same file follow each other, and the parent's
|
|
191
|
+
// own position moves with them while its copy is open.
|
|
192
|
+
let cursor = descriptorCursors.get(file);
|
|
193
|
+
if (!cursor) { cursor = { position: file.position }; descriptorCursors.set(file, cursor); }
|
|
194
|
+
const offset = cursor;
|
|
190
195
|
return (text) => {
|
|
191
196
|
const bytes = new TextEncoder().encode(text);
|
|
192
197
|
// the parent's copy, while it is open, holds the file's bytes as it last wrote them
|
|
193
198
|
const shared = openFiles.get(fd) === file ? file : null;
|
|
199
|
+
if (shared) offset.position = shared.position;
|
|
194
200
|
const existing = shared?.cached ?? (tree.existsSync(path) ? tree.readFileSync(path) as Uint8Array : new Uint8Array(0));
|
|
195
|
-
const at = append ? existing.length : position;
|
|
201
|
+
const at = append ? existing.length : offset.position;
|
|
196
202
|
const next = new Uint8Array(Math.max(existing.length, at + bytes.length));
|
|
197
203
|
next.set(existing, 0);
|
|
198
204
|
next.set(bytes, at);
|
|
199
205
|
tree.writeFileSync(path, next);
|
|
200
|
-
position = at + bytes.length;
|
|
201
|
-
if (shared) shared.cached = next;
|
|
206
|
+
offset.position = at + bytes.length;
|
|
207
|
+
if (shared) { shared.cached = next; shared.position = offset.position; }
|
|
202
208
|
};
|
|
203
209
|
}
|
|
210
|
+
const descriptorCursors = new WeakMap<object, { position: number }>();
|
|
204
211
|
|
|
205
212
|
/** Node's stat array: eighteen numbers, with each time a second and a nanosecond. */
|
|
206
213
|
function statArray(stats: VfsStats, bigint: boolean, path?: string): Float64Array | BigInt64Array {
|
|
@@ -1308,7 +1308,14 @@ async function handleNpmInstall(args: string[], ctx: CommandContext): Promise<Ju
|
|
|
1308
1308
|
*/
|
|
1309
1309
|
async function handleNpmInit(args: string[], ctx: CommandContext): Promise<JustBashExecResult> {
|
|
1310
1310
|
const yes = args.includes('-y') || args.includes('--yes');
|
|
1311
|
-
|
|
1311
|
+
// a flag's value is not an initializer: `--scope @x`, `-w pkg`, `--init-license MIT`
|
|
1312
|
+
const takesValue = (flag: string) => !flag.includes('=') && (flag === '--scope' || flag === '-w' || flag === '--workspace' || flag.startsWith('--init-'));
|
|
1313
|
+
const valueOf = (flag: string) => {
|
|
1314
|
+
const at = args.findIndex((a) => a === flag || a.startsWith(`${flag}=`));
|
|
1315
|
+
if (at < 0) return undefined;
|
|
1316
|
+
return args[at].includes('=') ? args[at].slice(args[at].indexOf('=') + 1) : args[at + 1];
|
|
1317
|
+
};
|
|
1318
|
+
const initializer = args.find((a, i) => !a.startsWith('-') && !(i > 0 && takesValue(args[i - 1]!)));
|
|
1312
1319
|
if (initializer) {
|
|
1313
1320
|
return { stdout: '', stderr: `npm ERR! npm init ${initializer} runs an initializer package, which this engine's npm does not; write package.json, or run \`npm init -y\`.\n`, exitCode: 1 };
|
|
1314
1321
|
}
|
|
@@ -1323,7 +1330,9 @@ async function handleNpmInit(args: string[], ctx: CommandContext): Promise<JustB
|
|
|
1323
1330
|
catch { return { stdout: '', stderr: `npm ERR! ${file} is not valid JSON\n`, exitCode: 1 }; }
|
|
1324
1331
|
}
|
|
1325
1332
|
const base = ctx.cwd.split('/').filter(Boolean).pop() ?? 'package';
|
|
1326
|
-
const
|
|
1333
|
+
const bare = base.toLowerCase().replace(/^[._]+/, '').replace(/[^a-z0-9._~-]+/g, '-') || 'package';
|
|
1334
|
+
const scope = valueOf('--scope')?.replace(/^@?/, '@');
|
|
1335
|
+
const name = scope ? `${scope}/${bare}` : bare;
|
|
1327
1336
|
const manifest = {
|
|
1328
1337
|
name,
|
|
1329
1338
|
version: '1.0.0',
|
package/src/shims/tls.ts
CHANGED
|
@@ -1,21 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* tls
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* tls: a tab's loopback carries no wire to protect. A TLS server listens on
|
|
3
|
+
* the engine's loopback as a net server does and hands its connections on as
|
|
4
|
+
* secure; a TLS connect to a loopback port pairs with that listener the same
|
|
5
|
+
* way. Bytes cross unencrypted because nothing lies between the two ends, and
|
|
6
|
+
* the browser holds TLS wherever there is a wire: a page reaches a guest
|
|
7
|
+
* server through the sandbox origin, and a request to another host goes out
|
|
8
|
+
* through the page's HTTP transport. A TLS connect to any other host fails
|
|
9
|
+
* asynchronously, rather than pretending to connect and leaving Node's HTTPS
|
|
10
|
+
* client waiting forever.
|
|
5
11
|
*/
|
|
6
12
|
|
|
7
|
-
import { EventEmitter } from '../node-lib/events-module';
|
|
8
13
|
import { lazyExport } from '../node-lib/lazy';
|
|
14
|
+
import { nodeLibInternalRequire } from '../node-lib/load';
|
|
9
15
|
import type { Socket } from '../node-lib/net-module';
|
|
16
|
+
import type { EventEmitter } from '../node-lib/events-module';
|
|
17
|
+
|
|
18
|
+
/** A TLS server as Node's module exposes it: constructed with or without `new`. */
|
|
19
|
+
export interface TlsServer extends EventEmitter {
|
|
20
|
+
listen(...args: unknown[]): this;
|
|
21
|
+
close(callback?: (err?: Error) => void): this;
|
|
22
|
+
address(): { port: number; family: string; address: string } | string | null;
|
|
23
|
+
addContext(hostname: string, context: unknown): void;
|
|
24
|
+
getTicketKeys(): Buffer;
|
|
25
|
+
setTicketKeys(keys: Buffer): void;
|
|
26
|
+
setSecureContext(options: unknown): void;
|
|
27
|
+
}
|
|
28
|
+
export interface TlsServerConstructor {
|
|
29
|
+
new (options?: unknown, secureConnectionListener?: (socket: Socket) => void): TlsServer;
|
|
30
|
+
(options?: unknown, secureConnectionListener?: (socket: Socket) => void): TlsServer;
|
|
31
|
+
readonly prototype: TlsServer;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The names a loopback connect reaches, as the engine's tcp_wrap answers them. */
|
|
35
|
+
function loopback(host: string): boolean {
|
|
36
|
+
const bare = host.startsWith('[') && host.endsWith(']') ? host.slice(1, -1) : host;
|
|
37
|
+
const name = bare.toLowerCase();
|
|
38
|
+
return name === '' || name === 'localhost' || name === '::1' || name.startsWith('127.');
|
|
39
|
+
}
|
|
10
40
|
|
|
11
41
|
// Keep the ordinary stream lifecycle (error, close, destroy) from Node's own
|
|
12
42
|
// Socket. Resolve it lazily, like the other builtin classes, to avoid a loader
|
|
13
43
|
// cycle while the engine is being imported.
|
|
14
|
-
/**
|
|
44
|
+
/** Each graph's TLS keeps that graph's Socket and Server identity. */
|
|
15
45
|
export function createTlsModule(require?: (name: string) => any) {
|
|
16
46
|
const NetSocket = require ? require('net').Socket as new (options?: object) => Socket
|
|
17
47
|
: lazyExport<new (options?: object) => Socket>('net', 'Socket');
|
|
18
|
-
const
|
|
48
|
+
const netServer = (): any => (require ? require('net') : nodeLibInternalRequire('net') as any).Server;
|
|
19
49
|
|
|
20
50
|
class TLSSocket extends NetSocket {
|
|
21
51
|
authorized = false;
|
|
@@ -25,7 +55,19 @@ class TLSSocket extends NetSocket {
|
|
|
25
55
|
super({ allowHalfOpen: false });
|
|
26
56
|
}
|
|
27
57
|
|
|
28
|
-
connect(...
|
|
58
|
+
connect(...args: unknown[]): this {
|
|
59
|
+
const options = args[0] as { port?: unknown; host?: unknown; hostname?: unknown; socket?: unknown } | undefined;
|
|
60
|
+
const host = String(options?.host ?? options?.hostname ?? 'localhost');
|
|
61
|
+
if (options && typeof options === 'object' && options.socket === undefined && loopback(host)) {
|
|
62
|
+
// The peer is a listener of this engine, or nothing: a refused port
|
|
63
|
+
// fails as a net connect does.
|
|
64
|
+
this.once('connect', () => {
|
|
65
|
+
this.authorized = true;
|
|
66
|
+
this.emit('secureConnect');
|
|
67
|
+
});
|
|
68
|
+
return (NetSocket.prototype as unknown as { connect: (this: TLSSocket, options: object) => TLSSocket })
|
|
69
|
+
.connect.call(this, { port: options.port, host }) as this;
|
|
70
|
+
}
|
|
29
71
|
this.connecting = true;
|
|
30
72
|
// Never inherit a plain TCP connect while advertising an encrypted socket.
|
|
31
73
|
// Agent assigns its socket on nextTick after connect returns, so failure
|
|
@@ -56,40 +98,57 @@ class TLSSocket extends NetSocket {
|
|
|
56
98
|
}
|
|
57
99
|
}
|
|
58
100
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
101
|
+
// A function constructor, as Node's: its own `https.js` builds an https.Server
|
|
102
|
+
// by calling `tls.Server` on the instance, which a class refuses. It is a net
|
|
103
|
+
// server, chained to the graph's `net.Server` when the first one is built.
|
|
104
|
+
let chained = false;
|
|
105
|
+
const Server = function TLSServer(this: TlsServer, options?: unknown, secureConnectionListener?: (socket: Socket) => void): TlsServer {
|
|
106
|
+
if (!(this instanceof Server)) return new Server(options, secureConnectionListener);
|
|
107
|
+
const NetServer = netServer();
|
|
108
|
+
if (!chained) {
|
|
109
|
+
Object.setPrototypeOf(Server.prototype, NetServer.prototype);
|
|
110
|
+
Object.setPrototypeOf(Server, NetServer);
|
|
111
|
+
chained = true;
|
|
70
112
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
113
|
+
if (typeof options === 'function') {
|
|
114
|
+
secureConnectionListener = options as (socket: Socket) => void;
|
|
115
|
+
options = {};
|
|
74
116
|
}
|
|
75
|
-
|
|
76
|
-
|
|
117
|
+
NetServer.call(this, options ?? {}, function secure(this: TlsServer, socket: Socket & { encrypted?: boolean; authorized?: boolean }) {
|
|
118
|
+
socket.encrypted = true;
|
|
119
|
+
socket.authorized = false;
|
|
120
|
+
this.emit('secureConnection', socket);
|
|
121
|
+
});
|
|
122
|
+
if (secureConnectionListener) this.on('secureConnection', secureConnectionListener);
|
|
123
|
+
return this;
|
|
124
|
+
} as unknown as TlsServerConstructor;
|
|
125
|
+
|
|
126
|
+
Object.assign(Server.prototype, {
|
|
127
|
+
addContext(_hostname: string, _context: unknown) {},
|
|
128
|
+
getTicketKeys() {
|
|
77
129
|
return (require ? require('buffer').Buffer : Buffer).from('');
|
|
78
|
-
}
|
|
130
|
+
},
|
|
131
|
+
setTicketKeys(_keys: Buffer) {},
|
|
132
|
+
setSecureContext(_options: unknown) {},
|
|
133
|
+
});
|
|
79
134
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
setSecureContext(_options: unknown): void {}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function createServer(_options?: unknown, _connectionListener?: (socket: TLSSocket) => void): Server {
|
|
86
|
-
return new Server(_options, _connectionListener);
|
|
135
|
+
function createServer(options?: unknown, secureConnectionListener?: (socket: Socket) => void): TlsServer {
|
|
136
|
+
return new Server(options, secureConnectionListener);
|
|
87
137
|
}
|
|
88
138
|
|
|
89
|
-
|
|
139
|
+
// tls.connect(options[, callback]) and tls.connect(port[, host][, options][, callback]).
|
|
140
|
+
function connect(...args: unknown[]): TLSSocket {
|
|
141
|
+
const options: Record<string, unknown> = {};
|
|
142
|
+
let callback: (() => void) | undefined;
|
|
143
|
+
for (const arg of args) {
|
|
144
|
+
if (typeof arg === 'function') callback = arg as () => void;
|
|
145
|
+
else if (typeof arg === 'number' || (typeof arg === 'string' && options.port === undefined && /^\d+$/u.test(arg))) options.port = arg;
|
|
146
|
+
else if (typeof arg === 'string') options.host = arg;
|
|
147
|
+
else if (arg && typeof arg === 'object') Object.assign(options, arg);
|
|
148
|
+
}
|
|
90
149
|
const socket = new TLSSocket();
|
|
91
|
-
if (
|
|
92
|
-
return socket.connect();
|
|
150
|
+
if (callback) socket.once('secureConnect', callback);
|
|
151
|
+
return socket.connect(options);
|
|
93
152
|
}
|
|
94
153
|
|
|
95
154
|
const createSecureContext = (_options?: unknown) => ({});
|