sandboxedjs 0.1.81 → 0.1.83
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/agent.d.cts +2 -2
- package/dist/agent.d.ts +2 -2
- package/dist/{container-LwAV9JTH.d.cts → container-B14Q03ng.d.cts} +1 -1
- package/dist/{container-CUB12Moo.d.ts → container-DtVUncWL.d.ts} +1 -1
- package/dist/{contracts-C2_dTgk3.d.cts → contracts-DNkSvBCM.d.cts} +19 -2
- package/dist/{contracts-C2_dTgk3.d.ts → contracts-DNkSvBCM.d.ts} +19 -2
- package/dist/index.cjs +606 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +606 -54
- package/dist/index.js.map +1 -1
- package/dist/{memory-volume-CG56p660.d.ts → memory-volume-D4FLjyEU.d.ts} +1 -1
- package/dist/{memory-volume-DqEWFo7t.d.cts → memory-volume-n-LY8Vdv.d.cts} +1 -1
- package/dist/python-abi.d.cts +3 -3
- package/dist/python-abi.d.ts +3 -3
- package/dist/worker-entry.js +557 -54
- package/dist/worker-entry.js.map +1 -1
- package/package.json +1 -1
package/dist/worker-entry.js
CHANGED
|
@@ -8795,7 +8795,7 @@ var require_path_browserify = __commonJS({
|
|
|
8795
8795
|
if (hasRoot && end === 1) return "//";
|
|
8796
8796
|
return path.slice(0, end);
|
|
8797
8797
|
},
|
|
8798
|
-
basename: function
|
|
8798
|
+
basename: function basename2(path, ext) {
|
|
8799
8799
|
if (ext !== void 0 && typeof ext !== "string") throw new TypeError('"ext" argument must be a string');
|
|
8800
8800
|
assertPath(path);
|
|
8801
8801
|
var start = 0;
|
|
@@ -8849,7 +8849,7 @@ var require_path_browserify = __commonJS({
|
|
|
8849
8849
|
return path.slice(start, end);
|
|
8850
8850
|
}
|
|
8851
8851
|
},
|
|
8852
|
-
extname: function
|
|
8852
|
+
extname: function extname2(path) {
|
|
8853
8853
|
assertPath(path);
|
|
8854
8854
|
var startDot = -1;
|
|
8855
8855
|
var startPart = 0;
|
|
@@ -15513,6 +15513,18 @@ function dirname(p) {
|
|
|
15513
15513
|
if (idx === 0) return "/";
|
|
15514
15514
|
return norm.slice(0, idx);
|
|
15515
15515
|
}
|
|
15516
|
+
function basename(p, ext) {
|
|
15517
|
+
const norm = stripTrailing(normalize(p));
|
|
15518
|
+
if (norm === "/") return "/";
|
|
15519
|
+
const idx = norm.lastIndexOf("/");
|
|
15520
|
+
let base2 = idx < 0 ? norm : norm.slice(idx + 1);
|
|
15521
|
+
return base2;
|
|
15522
|
+
}
|
|
15523
|
+
function extname(p) {
|
|
15524
|
+
const base2 = basename(p);
|
|
15525
|
+
const idx = base2.lastIndexOf(".");
|
|
15526
|
+
return idx <= 0 ? "" : base2.slice(idx);
|
|
15527
|
+
}
|
|
15516
15528
|
function clean(p) {
|
|
15517
15529
|
return stripTrailing(normalize(p));
|
|
15518
15530
|
}
|
|
@@ -21686,6 +21698,49 @@ var CommonJsEngine = class {
|
|
|
21686
21698
|
this.globals = { ...options.globals };
|
|
21687
21699
|
this.aliases = { ...options.aliases };
|
|
21688
21700
|
this.overrides = { ...options.overrides };
|
|
21701
|
+
const engine = this;
|
|
21702
|
+
this.moduleApi = function Module(id = "", parent = null) {
|
|
21703
|
+
Object.assign(this, { id, filename: id, exports: {}, loaded: false, parent, children: [] });
|
|
21704
|
+
};
|
|
21705
|
+
Object.assign(this.moduleApi, this.builtins.module);
|
|
21706
|
+
this.moduleApi.Module = this.moduleApi;
|
|
21707
|
+
this.moduleApi._extensions = {
|
|
21708
|
+
".js": (module, filename) => this.evaluate(module, this.readText(filename)),
|
|
21709
|
+
".json": (module, filename) => {
|
|
21710
|
+
module.exports = JSON.parse(this.readText(filename));
|
|
21711
|
+
},
|
|
21712
|
+
".node": (_module, filename) => {
|
|
21713
|
+
throw dlopenFailed(filename);
|
|
21714
|
+
}
|
|
21715
|
+
};
|
|
21716
|
+
this.moduleApi._cache = new Proxy(/* @__PURE__ */ Object.create(null), {
|
|
21717
|
+
get: (_target, key) => typeof key === "string" ? this.cache.get(key) : void 0,
|
|
21718
|
+
set: (_target, key, value) => {
|
|
21719
|
+
this.cache.set(String(key), value);
|
|
21720
|
+
return true;
|
|
21721
|
+
},
|
|
21722
|
+
deleteProperty: (_target, key) => this.cache.delete(String(key)),
|
|
21723
|
+
ownKeys: () => [...this.cache.keys()],
|
|
21724
|
+
getOwnPropertyDescriptor: (_target, key) => this.cache.has(String(key)) ? { enumerable: true, configurable: true, writable: true, value: this.cache.get(String(key)) } : void 0
|
|
21725
|
+
});
|
|
21726
|
+
this.moduleApi._resolveFilename = (request, parent) => this.resolve(request, parent?.filename || join(this.cwd, "__entry__.js"));
|
|
21727
|
+
this.moduleApi.prototype.require = function(request) {
|
|
21728
|
+
const filename = engine.moduleApi._resolveFilename(request, this);
|
|
21729
|
+
const builtin = engine.builtin(filename, this);
|
|
21730
|
+
if (builtin.found) return builtin.value;
|
|
21731
|
+
const target = engine.load(filename, this, false);
|
|
21732
|
+
if (target.pending) throw requireOfAsyncModule(request);
|
|
21733
|
+
return target.exports;
|
|
21734
|
+
};
|
|
21735
|
+
this.moduleApi.prototype._compile = function(source, filename) {
|
|
21736
|
+
this.filename = filename;
|
|
21737
|
+
engine.evaluate(this, source);
|
|
21738
|
+
};
|
|
21739
|
+
this.moduleApi.createRequire = (filename) => {
|
|
21740
|
+
const path = String(filename).startsWith("file:") ? pathFromFileUrl(String(filename)) : String(filename);
|
|
21741
|
+
if (!path.startsWith("/")) throw new TypeError("createRequire requires an absolute path or file URL");
|
|
21742
|
+
return this.makeRequire(Object.assign(new this.moduleApi(path), { filename: path }));
|
|
21743
|
+
};
|
|
21689
21744
|
}
|
|
21690
21745
|
volume;
|
|
21691
21746
|
cache = /* @__PURE__ */ new Map();
|
|
@@ -21698,6 +21753,7 @@ var CommonJsEngine = class {
|
|
|
21698
21753
|
/** `package.json` per directory; resolution reads them constantly. */
|
|
21699
21754
|
manifests = /* @__PURE__ */ new Map();
|
|
21700
21755
|
evaluationDepth = 0;
|
|
21756
|
+
moduleApi;
|
|
21701
21757
|
/**
|
|
21702
21758
|
* Is a module body running synchronously right now?
|
|
21703
21759
|
*
|
|
@@ -21734,7 +21790,7 @@ var CommonJsEngine = class {
|
|
|
21734
21790
|
specifier = pathFromFileUrl(specifier);
|
|
21735
21791
|
}
|
|
21736
21792
|
const builtin = this.builtin(specifier);
|
|
21737
|
-
if (builtin.found) return specifier
|
|
21793
|
+
if (builtin.found) return specifier;
|
|
21738
21794
|
if (specifier.startsWith("#")) {
|
|
21739
21795
|
const found = this.resolveImports(specifier, importer, kind);
|
|
21740
21796
|
if (found) return found;
|
|
@@ -21767,17 +21823,14 @@ var CommonJsEngine = class {
|
|
|
21767
21823
|
parent,
|
|
21768
21824
|
children: []
|
|
21769
21825
|
};
|
|
21826
|
+
Object.setPrototypeOf(module, this.moduleApi.prototype);
|
|
21770
21827
|
this.cache.set(filename, module);
|
|
21771
21828
|
parent?.children.push(module);
|
|
21772
21829
|
if (isMain) this.main = module;
|
|
21773
21830
|
try {
|
|
21774
|
-
|
|
21775
|
-
|
|
21776
|
-
|
|
21777
|
-
module.exports = JSON.parse(this.readText(filename));
|
|
21778
|
-
} else {
|
|
21779
|
-
this.evaluate(module, this.readText(filename));
|
|
21780
|
-
}
|
|
21831
|
+
const extension = extname(filename);
|
|
21832
|
+
const loader = this.moduleApi._extensions[extension] ?? this.moduleApi._extensions[".js"];
|
|
21833
|
+
loader(module, filename);
|
|
21781
21834
|
module.loaded = true;
|
|
21782
21835
|
return module;
|
|
21783
21836
|
} catch (error) {
|
|
@@ -21830,15 +21883,12 @@ ${code}
|
|
|
21830
21883
|
/** The `require` a module sees, complete with `resolve`, `cache` and `main`. */
|
|
21831
21884
|
makeRequire(module) {
|
|
21832
21885
|
const localRequire = ((specifier) => {
|
|
21833
|
-
|
|
21834
|
-
if (builtin.found) return builtin.value;
|
|
21835
|
-
const target = this.load(this.resolve(specifier, module.filename, "require"), module, false);
|
|
21836
|
-
if (target.pending) throw requireOfAsyncModule(specifier);
|
|
21837
|
-
return target.exports;
|
|
21886
|
+
return this.moduleApi.prototype.require.call(module, specifier);
|
|
21838
21887
|
});
|
|
21839
|
-
localRequire.resolve = (specifier) => this.
|
|
21888
|
+
localRequire.resolve = (specifier) => this.moduleApi._resolveFilename(specifier, module);
|
|
21840
21889
|
Object.defineProperty(localRequire, "main", { get: () => this.main });
|
|
21841
|
-
localRequire.cache =
|
|
21890
|
+
localRequire.cache = this.moduleApi._cache;
|
|
21891
|
+
localRequire.extensions = this.moduleApi._extensions;
|
|
21842
21892
|
return localRequire;
|
|
21843
21893
|
}
|
|
21844
21894
|
/**
|
|
@@ -22013,12 +22063,7 @@ ${code}
|
|
|
22013
22063
|
if (prefixOnly || !Object.prototype.hasOwnProperty.call(this.builtins, name)) {
|
|
22014
22064
|
return Object.prototype.hasOwnProperty.call(this.overrides, specifier) ? { found: true, value: this.overrides[specifier] } : { found: false, value: void 0 };
|
|
22015
22065
|
}
|
|
22016
|
-
if (name === "module"
|
|
22017
|
-
return {
|
|
22018
|
-
found: true,
|
|
22019
|
-
value: { ...this.builtins.module, createRequire: () => this.makeRequire(importer) }
|
|
22020
|
-
};
|
|
22021
|
-
}
|
|
22066
|
+
if (name === "module") return { found: true, value: this.moduleApi };
|
|
22022
22067
|
return { found: true, value: this.builtins[name] };
|
|
22023
22068
|
}
|
|
22024
22069
|
exists(path) {
|
|
@@ -22126,6 +22171,62 @@ function splitSpecifier(specifier) {
|
|
|
22126
22171
|
return { name: parts.slice(0, size).join("/"), subpath: parts.slice(size).join("/") };
|
|
22127
22172
|
}
|
|
22128
22173
|
|
|
22174
|
+
// src/node/diagnostics-channel.ts
|
|
22175
|
+
function createDiagnosticsChannel() {
|
|
22176
|
+
const channels = /* @__PURE__ */ new Map();
|
|
22177
|
+
class Channel {
|
|
22178
|
+
constructor(name) {
|
|
22179
|
+
this.name = name;
|
|
22180
|
+
}
|
|
22181
|
+
name;
|
|
22182
|
+
listeners = /* @__PURE__ */ new Set();
|
|
22183
|
+
get hasSubscribers() {
|
|
22184
|
+
return this.listeners.size > 0;
|
|
22185
|
+
}
|
|
22186
|
+
subscribe(fn) {
|
|
22187
|
+
if (typeof fn !== "function") throw new TypeError("subscriber must be a function");
|
|
22188
|
+
this.listeners.add(fn);
|
|
22189
|
+
}
|
|
22190
|
+
unsubscribe(fn) {
|
|
22191
|
+
return this.listeners.delete(fn);
|
|
22192
|
+
}
|
|
22193
|
+
publish(message) {
|
|
22194
|
+
for (const fn of [...this.listeners]) {
|
|
22195
|
+
try {
|
|
22196
|
+
fn(message, this.name);
|
|
22197
|
+
} catch (error) {
|
|
22198
|
+
queueMicrotask(() => {
|
|
22199
|
+
throw error;
|
|
22200
|
+
});
|
|
22201
|
+
}
|
|
22202
|
+
}
|
|
22203
|
+
}
|
|
22204
|
+
}
|
|
22205
|
+
const channel = (name) => {
|
|
22206
|
+
if (typeof name !== "string" && typeof name !== "symbol") throw new TypeError("channel name must be a string or symbol");
|
|
22207
|
+
let result = channels.get(name);
|
|
22208
|
+
if (!result) {
|
|
22209
|
+
result = new Channel(name);
|
|
22210
|
+
channels.set(name, result);
|
|
22211
|
+
}
|
|
22212
|
+
return result;
|
|
22213
|
+
};
|
|
22214
|
+
return {
|
|
22215
|
+
Channel,
|
|
22216
|
+
channel,
|
|
22217
|
+
hasSubscribers: (name) => channels.get(name)?.hasSubscribers ?? false,
|
|
22218
|
+
subscribe: (name, fn) => channel(name).subscribe(fn),
|
|
22219
|
+
unsubscribe: (name, fn) => channels.get(name)?.unsubscribe(fn) ?? false
|
|
22220
|
+
};
|
|
22221
|
+
}
|
|
22222
|
+
|
|
22223
|
+
// src/node/ipc-channel.ts
|
|
22224
|
+
var IPC_CHANNEL_ENV = "SANDBOXEDJS_IPC_CHANNEL";
|
|
22225
|
+
function newIpcChannelId() {
|
|
22226
|
+
const random = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : Math.random().toString(36).slice(2);
|
|
22227
|
+
return `ipc-${random}`;
|
|
22228
|
+
}
|
|
22229
|
+
|
|
22129
22230
|
// src/node/buffer-module.ts
|
|
22130
22231
|
var import_buffer = __toESM(require_buffer());
|
|
22131
22232
|
var platformBuffer = globalThis.Buffer;
|
|
@@ -22254,6 +22355,132 @@ ${lines[index]}`;
|
|
|
22254
22355
|
return out;
|
|
22255
22356
|
}
|
|
22256
22357
|
|
|
22358
|
+
// src/node/parse-args.ts
|
|
22359
|
+
function argError(code, message) {
|
|
22360
|
+
return Object.assign(new TypeError(message), { code });
|
|
22361
|
+
}
|
|
22362
|
+
function parseArgs(config = {}) {
|
|
22363
|
+
const args = config.args ?? globalThis.process?.argv?.slice(2) ?? [];
|
|
22364
|
+
const options = config.options ?? {};
|
|
22365
|
+
const strict = config.strict ?? true;
|
|
22366
|
+
const allowPositionals = config.allowPositionals ?? !strict;
|
|
22367
|
+
const allowNegative = config.allowNegative ?? false;
|
|
22368
|
+
const byShort = /* @__PURE__ */ new Map();
|
|
22369
|
+
for (const [name, option] of Object.entries(options)) {
|
|
22370
|
+
if (option.type !== "string" && option.type !== "boolean") {
|
|
22371
|
+
throw argError("ERR_INVALID_ARG_VALUE", `The property 'options.${name}.type' must be one of: 'string', 'boolean'`);
|
|
22372
|
+
}
|
|
22373
|
+
if (option.short !== void 0) {
|
|
22374
|
+
if (option.short.length !== 1) {
|
|
22375
|
+
throw argError("ERR_INVALID_ARG_VALUE", `The property 'options.${name}.short' must be a single character`);
|
|
22376
|
+
}
|
|
22377
|
+
byShort.set(option.short, name);
|
|
22378
|
+
}
|
|
22379
|
+
}
|
|
22380
|
+
const tokens = [];
|
|
22381
|
+
const takesValue = (name) => options[name]?.type === "string";
|
|
22382
|
+
for (let index = 0; index < args.length; index++) {
|
|
22383
|
+
const arg = args[index];
|
|
22384
|
+
if (arg === "--") {
|
|
22385
|
+
tokens.push({ kind: "option-terminator", index });
|
|
22386
|
+
for (let rest = index + 1; rest < args.length; rest++) tokens.push({ kind: "positional", index: rest, value: args[rest] });
|
|
22387
|
+
break;
|
|
22388
|
+
}
|
|
22389
|
+
if (arg.startsWith("--") && arg.length > 2) {
|
|
22390
|
+
const equals = arg.indexOf("=");
|
|
22391
|
+
if (equals !== -1) {
|
|
22392
|
+
tokens.push({ kind: "option", name: arg.slice(2, equals), rawName: arg.slice(0, equals), index, value: arg.slice(equals + 1), inlineValue: true });
|
|
22393
|
+
continue;
|
|
22394
|
+
}
|
|
22395
|
+
const name = arg.slice(2);
|
|
22396
|
+
if (takesValue(name) && index + 1 < args.length) {
|
|
22397
|
+
tokens.push({ kind: "option", name, rawName: arg, index, value: args[index + 1], inlineValue: false });
|
|
22398
|
+
index++;
|
|
22399
|
+
} else {
|
|
22400
|
+
tokens.push({ kind: "option", name, rawName: arg, index, value: void 0, inlineValue: void 0 });
|
|
22401
|
+
}
|
|
22402
|
+
continue;
|
|
22403
|
+
}
|
|
22404
|
+
if (arg.startsWith("-") && arg.length > 1) {
|
|
22405
|
+
for (let at2 = 1; at2 < arg.length; at2++) {
|
|
22406
|
+
const short = arg[at2];
|
|
22407
|
+
const name = byShort.get(short) ?? short;
|
|
22408
|
+
if (takesValue(name)) {
|
|
22409
|
+
if (at2 + 1 < arg.length) {
|
|
22410
|
+
tokens.push({ kind: "option", name, rawName: `-${short}`, index, value: arg.slice(at2 + 1), inlineValue: true });
|
|
22411
|
+
} else if (index + 1 < args.length) {
|
|
22412
|
+
tokens.push({ kind: "option", name, rawName: `-${short}`, index, value: args[index + 1], inlineValue: false });
|
|
22413
|
+
index++;
|
|
22414
|
+
} else {
|
|
22415
|
+
tokens.push({ kind: "option", name, rawName: `-${short}`, index, value: void 0, inlineValue: void 0 });
|
|
22416
|
+
}
|
|
22417
|
+
break;
|
|
22418
|
+
}
|
|
22419
|
+
tokens.push({ kind: "option", name, rawName: `-${short}`, index, value: void 0, inlineValue: void 0 });
|
|
22420
|
+
}
|
|
22421
|
+
continue;
|
|
22422
|
+
}
|
|
22423
|
+
tokens.push({ kind: "positional", index, value: arg });
|
|
22424
|
+
}
|
|
22425
|
+
const values = /* @__PURE__ */ Object.create(null);
|
|
22426
|
+
const positionals = [];
|
|
22427
|
+
const store = (name, value) => {
|
|
22428
|
+
if (options[name]?.multiple) {
|
|
22429
|
+
const list = values[name] ?? [];
|
|
22430
|
+
list.push(value);
|
|
22431
|
+
values[name] = list;
|
|
22432
|
+
} else {
|
|
22433
|
+
values[name] = value;
|
|
22434
|
+
}
|
|
22435
|
+
};
|
|
22436
|
+
for (const token of tokens) {
|
|
22437
|
+
if (token.kind === "option-terminator") continue;
|
|
22438
|
+
if (token.kind === "positional") {
|
|
22439
|
+
if (!allowPositionals) {
|
|
22440
|
+
throw argError("ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL", `Unexpected argument '${token.value}'. This command does not take positional arguments`);
|
|
22441
|
+
}
|
|
22442
|
+
positionals.push(token.value);
|
|
22443
|
+
continue;
|
|
22444
|
+
}
|
|
22445
|
+
let name = token.name;
|
|
22446
|
+
let negated = false;
|
|
22447
|
+
if (allowNegative && name.startsWith("no-") && token.rawName.startsWith("--") && options[name.slice(3)]?.type === "boolean") {
|
|
22448
|
+
name = name.slice(3);
|
|
22449
|
+
negated = true;
|
|
22450
|
+
}
|
|
22451
|
+
const option = options[name];
|
|
22452
|
+
if (!option) {
|
|
22453
|
+
if (strict) {
|
|
22454
|
+
throw argError(
|
|
22455
|
+
"ERR_PARSE_ARGS_UNKNOWN_OPTION",
|
|
22456
|
+
`Unknown option '${token.rawName}'${allowPositionals ? `. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- ${JSON.stringify(token.rawName)}'` : ""}`
|
|
22457
|
+
);
|
|
22458
|
+
}
|
|
22459
|
+
store(name, token.value ?? true);
|
|
22460
|
+
continue;
|
|
22461
|
+
}
|
|
22462
|
+
if (option.type === "string") {
|
|
22463
|
+
if (token.value === void 0) {
|
|
22464
|
+
if (strict) throw argError("ERR_PARSE_ARGS_INVALID_OPTION_VALUE", `Option '${token.rawName} <value>' argument missing`);
|
|
22465
|
+
store(name, true);
|
|
22466
|
+
continue;
|
|
22467
|
+
}
|
|
22468
|
+
store(name, token.value);
|
|
22469
|
+
} else {
|
|
22470
|
+
if (token.inlineValue && strict) {
|
|
22471
|
+
throw argError("ERR_PARSE_ARGS_INVALID_OPTION_VALUE", `Option '${token.rawName}' does not take an argument`);
|
|
22472
|
+
}
|
|
22473
|
+
store(name, !negated);
|
|
22474
|
+
}
|
|
22475
|
+
}
|
|
22476
|
+
for (const [name, option] of Object.entries(options)) {
|
|
22477
|
+
if (option.default !== void 0 && values[name] === void 0) {
|
|
22478
|
+
values[name] = Array.isArray(option.default) ? option.default.slice() : option.default;
|
|
22479
|
+
}
|
|
22480
|
+
}
|
|
22481
|
+
return config.tokens ? { values, positionals, tokens } : { values, positionals };
|
|
22482
|
+
}
|
|
22483
|
+
|
|
22257
22484
|
// src/node/util-module.ts
|
|
22258
22485
|
var customInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
22259
22486
|
var promisifyCustom = /* @__PURE__ */ Symbol.for("nodejs.util.promisify.custom");
|
|
@@ -22282,8 +22509,9 @@ function render(value, depth, seen, options) {
|
|
|
22282
22509
|
if (value === null) return "null";
|
|
22283
22510
|
const object = value;
|
|
22284
22511
|
const custom = object[customInspect];
|
|
22285
|
-
if (typeof custom === "function") {
|
|
22286
|
-
|
|
22512
|
+
if (options.customInspect !== false && typeof custom === "function") {
|
|
22513
|
+
const result = custom.call(object, depth, options, inspect);
|
|
22514
|
+
if (result !== object) return typeof result === "string" ? result : render(result, depth, seen, options);
|
|
22287
22515
|
}
|
|
22288
22516
|
if (seen.has(object)) return "[Circular *1]";
|
|
22289
22517
|
if (depth < 0) return Array.isArray(object) ? "[Array]" : "[Object]";
|
|
@@ -22618,6 +22846,7 @@ var legacy = {
|
|
|
22618
22846
|
inspect.custom = customInspect;
|
|
22619
22847
|
var utilModule = {
|
|
22620
22848
|
parseEnv,
|
|
22849
|
+
parseArgs,
|
|
22621
22850
|
format,
|
|
22622
22851
|
formatWithOptions,
|
|
22623
22852
|
inspect,
|
|
@@ -29587,20 +29816,10 @@ var SyncChannelClient = class {
|
|
|
29587
29816
|
var import_events2 = __toESM(require_events());
|
|
29588
29817
|
var import_stream_browserify3 = __toESM(require_stream_browserify());
|
|
29589
29818
|
var ChildProcess = class extends import_events2.default {
|
|
29590
|
-
|
|
29591
|
-
|
|
29592
|
-
stdin;
|
|
29593
|
-
stdio;
|
|
29594
|
-
pid;
|
|
29595
|
-
exitCode = null;
|
|
29596
|
-
signalCode = null;
|
|
29597
|
-
killed = false;
|
|
29598
|
-
spawnfile;
|
|
29599
|
-
spawnargs;
|
|
29600
|
-
handle;
|
|
29601
|
-
settled = false;
|
|
29602
|
-
constructor(handle, file, args) {
|
|
29819
|
+
constructor(handle, file, args, referenceChanged = () => {
|
|
29820
|
+
}) {
|
|
29603
29821
|
super();
|
|
29822
|
+
this.referenceChanged = referenceChanged;
|
|
29604
29823
|
this.handle = handle;
|
|
29605
29824
|
this.pid = handle.pid;
|
|
29606
29825
|
this.spawnfile = file;
|
|
@@ -29625,31 +29844,90 @@ var ChildProcess = class extends import_events2.default {
|
|
|
29625
29844
|
handle.on("stdout", (text) => this.stdout.write(text));
|
|
29626
29845
|
handle.on("stderr", (text) => this.stderr.write(text));
|
|
29627
29846
|
handle.on("exit", (code) => this.finish(code));
|
|
29628
|
-
|
|
29847
|
+
referenceChanged(1);
|
|
29848
|
+
try {
|
|
29849
|
+
handle.exec();
|
|
29850
|
+
} catch (error) {
|
|
29851
|
+
this.unref();
|
|
29852
|
+
throw error;
|
|
29853
|
+
}
|
|
29629
29854
|
}
|
|
29855
|
+
referenceChanged;
|
|
29856
|
+
stdout = new import_stream_browserify3.default.PassThrough();
|
|
29857
|
+
stderr = new import_stream_browserify3.default.PassThrough();
|
|
29858
|
+
stdin;
|
|
29859
|
+
stdio;
|
|
29860
|
+
pid;
|
|
29861
|
+
exitCode = null;
|
|
29862
|
+
signalCode = null;
|
|
29863
|
+
killed = false;
|
|
29864
|
+
spawnfile;
|
|
29865
|
+
spawnargs;
|
|
29866
|
+
handle;
|
|
29867
|
+
settled = false;
|
|
29868
|
+
referenced = true;
|
|
29630
29869
|
kill(signal = "SIGTERM") {
|
|
29631
29870
|
this.killed = true;
|
|
29632
29871
|
this.handle.kill(typeof signal === "number" ? "SIGTERM" : signal);
|
|
29633
29872
|
return true;
|
|
29634
29873
|
}
|
|
29635
29874
|
ref() {
|
|
29875
|
+
if (!this.settled && !this.referenced) {
|
|
29876
|
+
this.referenced = true;
|
|
29877
|
+
this.referenceChanged(1);
|
|
29878
|
+
}
|
|
29636
29879
|
return this;
|
|
29637
29880
|
}
|
|
29638
29881
|
unref() {
|
|
29882
|
+
if (this.referenced) {
|
|
29883
|
+
this.referenced = false;
|
|
29884
|
+
this.referenceChanged(-1);
|
|
29885
|
+
}
|
|
29639
29886
|
return this;
|
|
29640
29887
|
}
|
|
29641
|
-
|
|
29642
|
-
|
|
29643
|
-
|
|
29644
|
-
|
|
29645
|
-
|
|
29646
|
-
|
|
29888
|
+
channel;
|
|
29889
|
+
channelOpen = false;
|
|
29890
|
+
/** Open the parent's end of a `fork` channel. */
|
|
29891
|
+
attachChannel(transport, id) {
|
|
29892
|
+
this.channelOpen = true;
|
|
29893
|
+
this.channel = transport.attach(
|
|
29894
|
+
id,
|
|
29895
|
+
"parent",
|
|
29896
|
+
(message) => this.emit("message", message, void 0),
|
|
29897
|
+
() => this.channelClosed()
|
|
29898
|
+
);
|
|
29647
29899
|
}
|
|
29648
29900
|
get connected() {
|
|
29649
|
-
return
|
|
29901
|
+
return this.channelOpen;
|
|
29902
|
+
}
|
|
29903
|
+
/** `send(message[, sendHandle][, options][, callback])`, as Node spells it. */
|
|
29904
|
+
send(message, ...rest) {
|
|
29905
|
+
const callback = rest.find((value) => typeof value === "function");
|
|
29906
|
+
if (!this.channel || !this.channelOpen) {
|
|
29907
|
+
const error = Object.assign(new Error("Channel closed"), { code: "ERR_IPC_CHANNEL_CLOSED" });
|
|
29908
|
+
if (callback) queueMicrotask(() => callback(error));
|
|
29909
|
+
else queueMicrotask(() => this.emit("error", error));
|
|
29910
|
+
return false;
|
|
29911
|
+
}
|
|
29912
|
+
this.channel.send(message);
|
|
29913
|
+
if (callback) queueMicrotask(() => callback(null));
|
|
29914
|
+
return true;
|
|
29915
|
+
}
|
|
29916
|
+
disconnect() {
|
|
29917
|
+
if (!this.channelOpen) return;
|
|
29918
|
+
this.channel?.disconnect();
|
|
29919
|
+
this.channelClosed();
|
|
29920
|
+
}
|
|
29921
|
+
channelClosed() {
|
|
29922
|
+
if (!this.channelOpen) return;
|
|
29923
|
+
this.channelOpen = false;
|
|
29924
|
+
this.emit("disconnect");
|
|
29650
29925
|
}
|
|
29651
29926
|
finish(code) {
|
|
29652
29927
|
if (this.settled) return;
|
|
29928
|
+
this.channel?.disconnect();
|
|
29929
|
+
this.channelClosed();
|
|
29930
|
+
this.unref();
|
|
29653
29931
|
this.settled = true;
|
|
29654
29932
|
this.exitCode = code;
|
|
29655
29933
|
this.stdout.end();
|
|
@@ -29658,7 +29936,7 @@ var ChildProcess = class extends import_events2.default {
|
|
|
29658
29936
|
queueMicrotask(() => this.emit("close", code, null));
|
|
29659
29937
|
}
|
|
29660
29938
|
};
|
|
29661
|
-
function createChildProcessModule(spawnChild, defaultCwd, syncSpawn, defaultEnv = () => ({})) {
|
|
29939
|
+
function createChildProcessModule(spawnChild, defaultCwd, syncSpawn, defaultEnv = () => ({}), lifecycle = {}) {
|
|
29662
29940
|
const environmentFor = (options) => options.env ? { ...options.env } : defaultEnv();
|
|
29663
29941
|
const throughShell = (command, options) => {
|
|
29664
29942
|
const shell = typeof options.shell === "string" ? options.shell : "/bin/sh";
|
|
@@ -29669,16 +29947,24 @@ function createChildProcessModule(spawnChild, defaultCwd, syncSpawn, defaultEnv
|
|
|
29669
29947
|
if (stdio === "ignore") return true;
|
|
29670
29948
|
return Array.isArray(stdio) && stdio[0] === "ignore";
|
|
29671
29949
|
};
|
|
29950
|
+
const wantsChannel = (options) => Array.isArray(options.stdio) && options.stdio.includes("ipc");
|
|
29672
29951
|
const start = (file, args, options) => {
|
|
29673
29952
|
const resolved = options.shell ? throughShell([file, ...args].join(" "), options) : { file, args };
|
|
29953
|
+
const channelId = wantsChannel(options) && lifecycle.ipc ? newIpcChannelId() : void 0;
|
|
29674
29954
|
const handle = spawnChild({
|
|
29675
29955
|
command: resolved.file,
|
|
29676
29956
|
args: resolved.args,
|
|
29677
29957
|
cwd: options.cwd ?? defaultCwd(),
|
|
29678
|
-
env: environmentFor(options),
|
|
29958
|
+
env: channelId ? { ...environmentFor(options), [IPC_CHANNEL_ENV]: channelId } : environmentFor(options),
|
|
29959
|
+
...options.stdio === "inherit" || Array.isArray(options.stdio) && options.stdio[0] === "inherit" ? { inheritStdio: true } : {},
|
|
29679
29960
|
...stdinIgnored(options) ? { stdinIgnored: true } : {}
|
|
29680
29961
|
});
|
|
29681
|
-
|
|
29962
|
+
const child = new ChildProcess(handle, resolved.file, resolved.args, lifecycle.referenceChanged);
|
|
29963
|
+
if (channelId && lifecycle.ipc) child.attachChannel(lifecycle.ipc, channelId);
|
|
29964
|
+
const inherited = (index) => options.stdio === "inherit" || Array.isArray(options.stdio) && options.stdio[index] === "inherit";
|
|
29965
|
+
if (inherited(1)) child.stdout.on("data", (chunk) => lifecycle.stdout?.(chunk.toString()));
|
|
29966
|
+
if (inherited(2)) child.stderr.on("data", (chunk) => lifecycle.stderr?.(chunk.toString()));
|
|
29967
|
+
return child;
|
|
29682
29968
|
};
|
|
29683
29969
|
const spawn = (file, args = [], options = {}) => {
|
|
29684
29970
|
if (!Array.isArray(args)) return start(file, [], args);
|
|
@@ -29721,7 +30007,13 @@ ${err2.join("")}`),
|
|
|
29721
30007
|
spawn,
|
|
29722
30008
|
exec,
|
|
29723
30009
|
execFile,
|
|
29724
|
-
fork: (modulePath, args = [], options = {}) =>
|
|
30010
|
+
fork: (modulePath, args = [], options = {}) => {
|
|
30011
|
+
const [list, opts] = Array.isArray(args) ? [args, options] : [[], args ?? {}];
|
|
30012
|
+
const stdio = Array.isArray(opts.stdio) ? opts.stdio : typeof opts.stdio === "string" ? [opts.stdio, opts.stdio, opts.stdio] : opts.silent ? ["pipe", "pipe", "pipe"] : ["inherit", "inherit", "inherit"];
|
|
30013
|
+
const withChannel = stdio.includes("ipc") ? stdio : [...stdio, "ipc"];
|
|
30014
|
+
const execArgv = (opts.execArgv ?? []).filter((flag) => !/^--(inspect|debug)/.test(flag));
|
|
30015
|
+
return start("node", [...execArgv, modulePath, ...list], { ...opts, shell: false, stdio: withChannel });
|
|
30016
|
+
},
|
|
29725
30017
|
...buildSyncFamily(syncSpawn, throughShell, defaultCwd, environmentFor),
|
|
29726
30018
|
ChildProcess
|
|
29727
30019
|
};
|
|
@@ -30394,6 +30686,9 @@ function createCoreModules(options) {
|
|
|
30394
30686
|
argv: options.argv?.slice() ?? ["/usr/bin/node"],
|
|
30395
30687
|
argv0: "node",
|
|
30396
30688
|
execPath: "/usr/bin/node",
|
|
30689
|
+
/* `process/browser.js` has no `execArgv`; Node always has an array, and
|
|
30690
|
+
* CLIs that fork copy it (`[...process.execArgv]`). */
|
|
30691
|
+
execArgv: [],
|
|
30397
30692
|
env,
|
|
30398
30693
|
platform: "linux",
|
|
30399
30694
|
arch: "x64",
|
|
@@ -30447,6 +30742,25 @@ function createCoreModules(options) {
|
|
|
30447
30742
|
const implementation = import_events4.default.prototype[method];
|
|
30448
30743
|
if (typeof implementation === "function") processObject[method] = implementation;
|
|
30449
30744
|
}
|
|
30745
|
+
const hrtime = (previous) => {
|
|
30746
|
+
const now = performance.timeOrigin + performance.now();
|
|
30747
|
+
let seconds = Math.floor(now / 1e3);
|
|
30748
|
+
let nanoseconds = Math.floor(now % 1e3 * 1e6);
|
|
30749
|
+
if (previous) {
|
|
30750
|
+
seconds -= previous[0];
|
|
30751
|
+
nanoseconds -= previous[1];
|
|
30752
|
+
if (nanoseconds < 0) {
|
|
30753
|
+
seconds -= 1;
|
|
30754
|
+
nanoseconds += 1e9;
|
|
30755
|
+
}
|
|
30756
|
+
}
|
|
30757
|
+
return [seconds, nanoseconds];
|
|
30758
|
+
};
|
|
30759
|
+
hrtime.bigint = () => {
|
|
30760
|
+
const [seconds, nanoseconds] = hrtime();
|
|
30761
|
+
return BigInt(seconds) * 1000000000n + BigInt(nanoseconds);
|
|
30762
|
+
};
|
|
30763
|
+
processObject.hrtime = hrtime;
|
|
30450
30764
|
const tty = options.tty === true;
|
|
30451
30765
|
processObject.stdout = makeOutputStream(stdoutWrite, 1, tty);
|
|
30452
30766
|
processObject.stderr = makeOutputStream(stderrWrite, 2, tty);
|
|
@@ -30531,6 +30845,7 @@ function createCoreModules(options) {
|
|
|
30531
30845
|
const moduleBuiltin = {
|
|
30532
30846
|
builtinModules: builtinNames.flatMap((name) => [name, `node:${name}`]),
|
|
30533
30847
|
isBuiltin: (name) => builtinNames.includes(name.replace(/^node:/, "")),
|
|
30848
|
+
findSourceMap: () => void 0,
|
|
30534
30849
|
createRequire: () => {
|
|
30535
30850
|
throw new Error("createRequire is only available inside a loaded module");
|
|
30536
30851
|
}
|
|
@@ -30553,7 +30868,86 @@ function createCoreModules(options) {
|
|
|
30553
30868
|
};
|
|
30554
30869
|
const http = options.http ? createHttpModule(options.http.router, options.http.owner, httpOptions, "http:") : createUnsupportedModule("http");
|
|
30555
30870
|
const https = options.http ? createHttpModule(options.http.router, options.http.owner, httpOptions, "https:") : createUnsupportedModule("https");
|
|
30556
|
-
|
|
30871
|
+
let referencedChildren = 0;
|
|
30872
|
+
const childProcess = options.spawnChild ? createChildProcessModule(options.spawnChild, () => cwd, options.syncSpawn, () => ({ ...processObject.env }), {
|
|
30873
|
+
referenceChanged: (delta) => {
|
|
30874
|
+
referencedChildren += delta;
|
|
30875
|
+
},
|
|
30876
|
+
stdout: options.stdout,
|
|
30877
|
+
stderr: options.stderr,
|
|
30878
|
+
...options.ipc ? { ipc: options.ipc } : {}
|
|
30879
|
+
}) : createUnsupportedModule("child_process");
|
|
30880
|
+
let channelReferenced = 0;
|
|
30881
|
+
const channelId = env[IPC_CHANNEL_ENV];
|
|
30882
|
+
if (channelId && options.ipc) {
|
|
30883
|
+
delete env[IPC_CHANNEL_ENV];
|
|
30884
|
+
let open = true;
|
|
30885
|
+
let referenced = true;
|
|
30886
|
+
channelReferenced = 1;
|
|
30887
|
+
const close = () => {
|
|
30888
|
+
if (!open) return;
|
|
30889
|
+
open = false;
|
|
30890
|
+
if (referenced) channelReferenced = 0;
|
|
30891
|
+
processObject.connected = false;
|
|
30892
|
+
delete processObject.send;
|
|
30893
|
+
try {
|
|
30894
|
+
processObject.emit("disconnect");
|
|
30895
|
+
} catch (error) {
|
|
30896
|
+
reportUncaught(error);
|
|
30897
|
+
}
|
|
30898
|
+
runTicks();
|
|
30899
|
+
};
|
|
30900
|
+
const endpoint = options.ipc.attach(
|
|
30901
|
+
channelId,
|
|
30902
|
+
"child",
|
|
30903
|
+
(message) => {
|
|
30904
|
+
try {
|
|
30905
|
+
processObject.emit("message", message, void 0);
|
|
30906
|
+
} catch (error) {
|
|
30907
|
+
reportUncaught(error);
|
|
30908
|
+
}
|
|
30909
|
+
runTicks();
|
|
30910
|
+
},
|
|
30911
|
+
close
|
|
30912
|
+
);
|
|
30913
|
+
processObject.connected = true;
|
|
30914
|
+
processObject.send = (message, ...rest) => {
|
|
30915
|
+
const callback = rest.find((value) => typeof value === "function");
|
|
30916
|
+
if (!open) {
|
|
30917
|
+
const error = Object.assign(new Error("Channel closed"), { code: "ERR_IPC_CHANNEL_CLOSED" });
|
|
30918
|
+
if (callback) defer(() => callback(error));
|
|
30919
|
+
else defer(() => {
|
|
30920
|
+
processObject.emit("error", error);
|
|
30921
|
+
});
|
|
30922
|
+
return false;
|
|
30923
|
+
}
|
|
30924
|
+
endpoint.send(message);
|
|
30925
|
+
if (callback) defer(() => callback(null));
|
|
30926
|
+
return true;
|
|
30927
|
+
};
|
|
30928
|
+
processObject.disconnect = () => {
|
|
30929
|
+
if (open) {
|
|
30930
|
+
endpoint.disconnect();
|
|
30931
|
+
close();
|
|
30932
|
+
}
|
|
30933
|
+
};
|
|
30934
|
+
processObject.channel = {
|
|
30935
|
+
ref() {
|
|
30936
|
+
if (open && !referenced) {
|
|
30937
|
+
referenced = true;
|
|
30938
|
+
channelReferenced = 1;
|
|
30939
|
+
}
|
|
30940
|
+
return this;
|
|
30941
|
+
},
|
|
30942
|
+
unref() {
|
|
30943
|
+
if (referenced) {
|
|
30944
|
+
referenced = false;
|
|
30945
|
+
channelReferenced = 0;
|
|
30946
|
+
}
|
|
30947
|
+
return this;
|
|
30948
|
+
}
|
|
30949
|
+
};
|
|
30950
|
+
}
|
|
30557
30951
|
const readline = createReadlineModule(() => processObject.stdin, () => processObject.stdout);
|
|
30558
30952
|
const dns = createDnsModule(defer);
|
|
30559
30953
|
const builtins = {
|
|
@@ -30565,6 +30959,7 @@ function createCoreModules(options) {
|
|
|
30565
30959
|
console: consoleObject,
|
|
30566
30960
|
constants: fs.constants,
|
|
30567
30961
|
crypto: createCryptoModule(),
|
|
30962
|
+
diagnostics_channel: createDiagnosticsChannel(),
|
|
30568
30963
|
dns,
|
|
30569
30964
|
"dns/promises": dns.promises,
|
|
30570
30965
|
events: import_events4.default,
|
|
@@ -30583,6 +30978,25 @@ function createCoreModules(options) {
|
|
|
30583
30978
|
readline,
|
|
30584
30979
|
"readline/promises": readline.promises,
|
|
30585
30980
|
stream: import_stream_browserify4.default,
|
|
30981
|
+
"stream/web": Object.fromEntries([
|
|
30982
|
+
"ReadableStream",
|
|
30983
|
+
"ReadableStreamDefaultReader",
|
|
30984
|
+
"ReadableStreamBYOBReader",
|
|
30985
|
+
"ReadableStreamDefaultController",
|
|
30986
|
+
"ReadableByteStreamController",
|
|
30987
|
+
"ReadableStreamBYOBRequest",
|
|
30988
|
+
"WritableStream",
|
|
30989
|
+
"WritableStreamDefaultWriter",
|
|
30990
|
+
"WritableStreamDefaultController",
|
|
30991
|
+
"TransformStream",
|
|
30992
|
+
"TransformStreamDefaultController",
|
|
30993
|
+
"ByteLengthQueuingStrategy",
|
|
30994
|
+
"CountQueuingStrategy",
|
|
30995
|
+
"TextEncoderStream",
|
|
30996
|
+
"TextDecoderStream",
|
|
30997
|
+
"CompressionStream",
|
|
30998
|
+
"DecompressionStream"
|
|
30999
|
+
].filter((name) => name in globalThis).map((name) => [name, globalThis[name]])),
|
|
30586
31000
|
"stream/promises": createStreamPromises(),
|
|
30587
31001
|
string_decoder: import_string_decoder.default,
|
|
30588
31002
|
timers: { ...import_timers_browserify.default, ...timers.api },
|
|
@@ -30614,7 +31028,57 @@ function createCoreModules(options) {
|
|
|
30614
31028
|
})
|
|
30615
31029
|
};
|
|
30616
31030
|
for (const name of stubNames) builtins[name] = createUnsupportedModule(name);
|
|
31031
|
+
builtins.worker_threads = {
|
|
31032
|
+
MessagePort: globalThis.MessagePort ?? class MessagePort {
|
|
31033
|
+
},
|
|
31034
|
+
markAsUncloneable: () => {
|
|
31035
|
+
},
|
|
31036
|
+
isMarkedAsUncloneable: () => false,
|
|
31037
|
+
markAsUntransferable: () => {
|
|
31038
|
+
},
|
|
31039
|
+
isMarkedAsUntransferable: () => false
|
|
31040
|
+
};
|
|
30617
31041
|
builtins.net = createNetModule();
|
|
31042
|
+
builtins.inspector = createUnsupportedModule("inspector", {
|
|
31043
|
+
url: () => void 0,
|
|
31044
|
+
close: () => {
|
|
31045
|
+
},
|
|
31046
|
+
waitForDebugger: () => {
|
|
31047
|
+
throw Object.assign(new Error("Inspector is not active"), { code: "ERR_INSPECTOR_NOT_ACTIVE" });
|
|
31048
|
+
},
|
|
31049
|
+
console: consoleObject
|
|
31050
|
+
});
|
|
31051
|
+
builtins.v8 = createUnsupportedModule("v8", {
|
|
31052
|
+
getHeapStatistics: () => {
|
|
31053
|
+
const memory = performance.memory;
|
|
31054
|
+
const limit = memory?.jsHeapSizeLimit ?? 4 * 1024 ** 3;
|
|
31055
|
+
return {
|
|
31056
|
+
total_heap_size: memory?.totalJSHeapSize ?? 0,
|
|
31057
|
+
total_heap_size_executable: 0,
|
|
31058
|
+
total_physical_size: memory?.totalJSHeapSize ?? 0,
|
|
31059
|
+
total_available_size: limit - (memory?.usedJSHeapSize ?? 0),
|
|
31060
|
+
used_heap_size: memory?.usedJSHeapSize ?? 0,
|
|
31061
|
+
heap_size_limit: limit,
|
|
31062
|
+
malloced_memory: 0,
|
|
31063
|
+
peak_malloced_memory: 0,
|
|
31064
|
+
does_zap_garbage: 0,
|
|
31065
|
+
number_of_native_contexts: 1,
|
|
31066
|
+
number_of_detached_contexts: 0,
|
|
31067
|
+
total_global_handles_size: 0,
|
|
31068
|
+
used_global_handles_size: 0,
|
|
31069
|
+
external_memory: 0
|
|
31070
|
+
};
|
|
31071
|
+
},
|
|
31072
|
+
getHeapSpaceStatistics: () => [],
|
|
31073
|
+
getHeapCodeStatistics: () => ({ code_and_metadata_size: 0, bytecode_and_metadata_size: 0, external_script_source_size: 0, cpu_profiler_metadata_size: 0 }),
|
|
31074
|
+
cachedDataVersionTag: () => 0,
|
|
31075
|
+
setFlagsFromString: () => {
|
|
31076
|
+
},
|
|
31077
|
+
setHeapSnapshotNearHeapLimit: () => {
|
|
31078
|
+
},
|
|
31079
|
+
serialize: (value) => Buffer2.from(JSON.stringify(value) ?? "null"),
|
|
31080
|
+
deserialize: (buffer) => JSON.parse(Buffer2.from(buffer).toString("utf8"))
|
|
31081
|
+
});
|
|
30618
31082
|
const globals = {
|
|
30619
31083
|
Buffer: Buffer2,
|
|
30620
31084
|
console: consoleObject,
|
|
@@ -30649,7 +31113,7 @@ function createCoreModules(options) {
|
|
|
30649
31113
|
builtins,
|
|
30650
31114
|
globals,
|
|
30651
31115
|
process: processObject,
|
|
30652
|
-
pendingHandles: timers.pending,
|
|
31116
|
+
pendingHandles: () => timers.pending() + referencedChildren + channelReferenced,
|
|
30653
31117
|
pendingUnrefed: timers.pendingUnrefed,
|
|
30654
31118
|
/** Client requests sent but not yet read to completion. */
|
|
30655
31119
|
pendingRequests: () => inFlightRequests,
|
|
@@ -30715,7 +31179,9 @@ var ASYNC_FS_METHODS = [
|
|
|
30715
31179
|
"close",
|
|
30716
31180
|
"read",
|
|
30717
31181
|
"write",
|
|
30718
|
-
"exists"
|
|
31182
|
+
"exists",
|
|
31183
|
+
"fsync",
|
|
31184
|
+
"fdatasync"
|
|
30719
31185
|
];
|
|
30720
31186
|
function createPathModule(cwd) {
|
|
30721
31187
|
const resolve2 = (...segments2) => import_path_browserify.default.resolve(cwd(), ...segments2);
|
|
@@ -30938,6 +31404,12 @@ function createFsModule(volume, cwd, stdinPath, defer = queueMicrotask) {
|
|
|
30938
31404
|
unwatchFile: () => {
|
|
30939
31405
|
}
|
|
30940
31406
|
};
|
|
31407
|
+
fs.fsyncSync = (fd) => {
|
|
31408
|
+
requiredFd(fds, fd);
|
|
31409
|
+
};
|
|
31410
|
+
fs.fdatasyncSync = (fd) => {
|
|
31411
|
+
requiredFd(fds, fd);
|
|
31412
|
+
};
|
|
30941
31413
|
fs.ftruncateSync = (fd, length) => fs.truncateSync(requiredFd(fds, fd).path, length);
|
|
30942
31414
|
fs.fchmodSync = (fd, mode) => fs.chmodSync(requiredFd(fds, fd).path, mode);
|
|
30943
31415
|
fs.fchownSync = (fd, uid, gid) => fs.chownSync(requiredFd(fds, fd).path, uid, gid);
|
|
@@ -30998,6 +31470,8 @@ function makeFileHandle(fs, fd) {
|
|
|
30998
31470
|
return {
|
|
30999
31471
|
fd,
|
|
31000
31472
|
close: async () => fs.closeSync(fd),
|
|
31473
|
+
sync: async () => fs.fsyncSync(fd),
|
|
31474
|
+
datasync: async () => fs.fdatasyncSync(fd),
|
|
31001
31475
|
stat: async () => fs.fstatSync(fd),
|
|
31002
31476
|
truncate: async (length) => fs.ftruncateSync(fd, length),
|
|
31003
31477
|
chmod: async (mode) => fs.fchmodSync(fd, mode),
|
|
@@ -31591,7 +32065,7 @@ function formatUncaught(error) {
|
|
|
31591
32065
|
Node.js v22.12.0
|
|
31592
32066
|
`;
|
|
31593
32067
|
}
|
|
31594
|
-
var stubNames = ["cluster", "dgram", "
|
|
32068
|
+
var stubNames = ["cluster", "dgram", "domain", "http2", "inspector", "net", "tls", "v8", "vm", "worker_threads"];
|
|
31595
32069
|
var builtinNames = [
|
|
31596
32070
|
"assert",
|
|
31597
32071
|
"assert/strict",
|
|
@@ -31604,6 +32078,7 @@ var builtinNames = [
|
|
|
31604
32078
|
"events",
|
|
31605
32079
|
"fs",
|
|
31606
32080
|
"fs/promises",
|
|
32081
|
+
"diagnostics_channel",
|
|
31607
32082
|
"dns",
|
|
31608
32083
|
"dns/promises",
|
|
31609
32084
|
"http",
|
|
@@ -31619,6 +32094,7 @@ var builtinNames = [
|
|
|
31619
32094
|
"readline",
|
|
31620
32095
|
"readline/promises",
|
|
31621
32096
|
"stream",
|
|
32097
|
+
"stream/web",
|
|
31622
32098
|
"stream/promises",
|
|
31623
32099
|
"string_decoder",
|
|
31624
32100
|
"timers",
|
|
@@ -31846,6 +32322,7 @@ async function run(port, start) {
|
|
|
31846
32322
|
/* Asynchronous children are the host's business: it owns the process table
|
|
31847
32323
|
* and the PATH. Both forms end up in the same place, one blocking. */
|
|
31848
32324
|
spawnChild: (config) => hostChildProcess(port, config),
|
|
32325
|
+
ipc: hostIpcOverPort(port),
|
|
31849
32326
|
syncSpawn: (request) => spawnSyncOverChannel(channel, request),
|
|
31850
32327
|
...start.stdinPath ? { stdinPath: start.stdinPath } : {},
|
|
31851
32328
|
...start.interactiveStdin ? { interactiveStdin: true } : {},
|
|
@@ -32012,6 +32489,32 @@ function hostChildProcess(port, config) {
|
|
|
32012
32489
|
});
|
|
32013
32490
|
return handle;
|
|
32014
32491
|
}
|
|
32492
|
+
function hostIpcOverPort(port) {
|
|
32493
|
+
const ends = /* @__PURE__ */ new Map();
|
|
32494
|
+
port.onMessage((message) => {
|
|
32495
|
+
if (message?.type !== "ipc-message" && message?.type !== "ipc-disconnect") return;
|
|
32496
|
+
const end = ends.get(`${message.side}:${message.id}`);
|
|
32497
|
+
if (!end) return;
|
|
32498
|
+
if (message.type === "ipc-message") end.message(message.value);
|
|
32499
|
+
else {
|
|
32500
|
+
ends.delete(`${message.side}:${message.id}`);
|
|
32501
|
+
end.disconnect();
|
|
32502
|
+
}
|
|
32503
|
+
});
|
|
32504
|
+
return {
|
|
32505
|
+
attach(id, side, onMessage, onDisconnect) {
|
|
32506
|
+
ends.set(`${side}:${id}`, { message: onMessage, disconnect: onDisconnect });
|
|
32507
|
+
port.postMessage({ type: "ipc-attach", id, side });
|
|
32508
|
+
return {
|
|
32509
|
+
send: (value) => port.postMessage({ type: "ipc-send", id, side, value: value === void 0 ? void 0 : JSON.parse(JSON.stringify(value)) }),
|
|
32510
|
+
disconnect: () => {
|
|
32511
|
+
ends.delete(`${side}:${id}`);
|
|
32512
|
+
port.postMessage({ type: "ipc-close", id, side });
|
|
32513
|
+
}
|
|
32514
|
+
};
|
|
32515
|
+
}
|
|
32516
|
+
};
|
|
32517
|
+
}
|
|
32015
32518
|
function formatError(error) {
|
|
32016
32519
|
if (error instanceof Error) return `${error.stack ?? `${error.name}: ${error.message}`}
|
|
32017
32520
|
`;
|