@volter/tabnode 0.5.26 → 0.5.28
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-VIeZbbDr.js → runtime-worker-C6ulimZ4.js} +75 -19
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +109 -597
- package/dist/port-bridge-CixAESwA.js +655 -0
- package/dist/port-bridge.d.ts +175 -0
- package/dist/port-bridge.mjs +6 -0
- package/dist/server-bridge.d.ts +9 -130
- package/package.json +5 -1
- package/src/index.ts +1 -0
- package/src/port-bridge.ts +791 -0
- package/src/runtime.ts +63 -6
- package/src/server-bridge.ts +22 -664
- package/src/shims/child_process.ts +31 -6
|
@@ -21146,10 +21146,17 @@ var implementation$1 = function bind2(that) {
|
|
|
21146
21146
|
var implementation = implementation$1;
|
|
21147
21147
|
var functionBind = Function.prototype.bind || implementation;
|
|
21148
21148
|
var functionCall = Function.prototype.call;
|
|
21149
|
-
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
|
+
}
|
|
21150
21157
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
21151
21158
|
var bind$2 = functionBind;
|
|
21152
|
-
var $apply$1 =
|
|
21159
|
+
var $apply$1 = requireFunctionApply();
|
|
21153
21160
|
var $call$2 = functionCall;
|
|
21154
21161
|
var $reflectApply = reflectApply;
|
|
21155
21162
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
@@ -21269,7 +21276,7 @@ var hasSymbols = requireHasSymbols()();
|
|
|
21269
21276
|
var getProto = requireGetProto();
|
|
21270
21277
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
21271
21278
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
21272
|
-
var $apply =
|
|
21279
|
+
var $apply = requireFunctionApply();
|
|
21273
21280
|
var $call = functionCall;
|
|
21274
21281
|
var needsEval = {};
|
|
21275
21282
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
@@ -21910,7 +21917,7 @@ function requireApplyBind() {
|
|
|
21910
21917
|
if (hasRequiredApplyBind) return applyBind;
|
|
21911
21918
|
hasRequiredApplyBind = 1;
|
|
21912
21919
|
var bind3 = functionBind;
|
|
21913
|
-
var $apply2 =
|
|
21920
|
+
var $apply2 = requireFunctionApply();
|
|
21914
21921
|
var actualApply$1 = actualApply;
|
|
21915
21922
|
applyBind = function applyBind2() {
|
|
21916
21923
|
return actualApply$1(bind3, $apply2, arguments);
|
|
@@ -29565,7 +29572,7 @@ Parser.acorn = {
|
|
|
29565
29572
|
function parse3(input, options) {
|
|
29566
29573
|
return Parser.parse(input, options);
|
|
29567
29574
|
}
|
|
29568
|
-
class Script {
|
|
29575
|
+
let Script$1 = class Script {
|
|
29569
29576
|
constructor(code2, _options22) {
|
|
29570
29577
|
__publicField(this, "code");
|
|
29571
29578
|
this.code = code2;
|
|
@@ -29628,7 +29635,7 @@ class Script {
|
|
|
29628
29635
|
createCachedData() {
|
|
29629
29636
|
return Buffer.from("");
|
|
29630
29637
|
}
|
|
29631
|
-
}
|
|
29638
|
+
};
|
|
29632
29639
|
function createContext(contextObject, _options22) {
|
|
29633
29640
|
return contextObject || {};
|
|
29634
29641
|
}
|
|
@@ -29639,7 +29646,7 @@ function runInThisContext(code, _options) {
|
|
|
29639
29646
|
return eval(code);
|
|
29640
29647
|
}
|
|
29641
29648
|
function runInNewContext(code2, contextObject, _options22) {
|
|
29642
|
-
const script = new Script(code2);
|
|
29649
|
+
const script = new Script$1(code2);
|
|
29643
29650
|
return script.runInNewContext(contextObject);
|
|
29644
29651
|
}
|
|
29645
29652
|
function runInContext(code2, context2, _options22) {
|
|
@@ -29677,7 +29684,7 @@ class SyntheticModule extends Module {
|
|
|
29677
29684
|
}
|
|
29678
29685
|
}
|
|
29679
29686
|
var vm$1 = {
|
|
29680
|
-
Script,
|
|
29687
|
+
Script: Script$1,
|
|
29681
29688
|
createContext,
|
|
29682
29689
|
isContext,
|
|
29683
29690
|
runInThisContext,
|
|
@@ -29691,7 +29698,7 @@ var vm$1 = {
|
|
|
29691
29698
|
var vmShim = /* @__PURE__ */ Object.freeze({
|
|
29692
29699
|
__proto__: null,
|
|
29693
29700
|
Module,
|
|
29694
|
-
Script,
|
|
29701
|
+
Script: Script$1,
|
|
29695
29702
|
SourceTextModule,
|
|
29696
29703
|
SyntheticModule,
|
|
29697
29704
|
compileFunction,
|
|
@@ -74699,7 +74706,24 @@ function readPackageJson(cwd) {
|
|
|
74699
74706
|
}
|
|
74700
74707
|
}
|
|
74701
74708
|
async function handleNpmRun(args, ctx) {
|
|
74702
|
-
|
|
74709
|
+
let scriptName;
|
|
74710
|
+
let silent = false;
|
|
74711
|
+
let ifPresent = false;
|
|
74712
|
+
const passed = [];
|
|
74713
|
+
for (let index2 = 0; index2 < args.length; index2++) {
|
|
74714
|
+
const arg = args[index2];
|
|
74715
|
+
if (arg === "--") {
|
|
74716
|
+
if (scriptName !== void 0) passed.push(...args.slice(index2 + 1));
|
|
74717
|
+
break;
|
|
74718
|
+
}
|
|
74719
|
+
if (arg.startsWith("-") && arg !== "-") {
|
|
74720
|
+
if (arg === "--silent" || arg === "-s" || arg === "--quiet" || arg === "-q" || arg === "--loglevel=silent") silent = true;
|
|
74721
|
+
else if (arg === "--if-present") ifPresent = true;
|
|
74722
|
+
continue;
|
|
74723
|
+
}
|
|
74724
|
+
if (scriptName === void 0) scriptName = arg;
|
|
74725
|
+
else passed.push(arg);
|
|
74726
|
+
}
|
|
74703
74727
|
if (!scriptName) {
|
|
74704
74728
|
return listScripts(ctx);
|
|
74705
74729
|
}
|
|
@@ -74709,6 +74733,7 @@ async function handleNpmRun(args, ctx) {
|
|
|
74709
74733
|
const scripts = pkgJson.scripts || {};
|
|
74710
74734
|
const scriptCommand = scripts[scriptName];
|
|
74711
74735
|
if (!scriptCommand) {
|
|
74736
|
+
if (ifPresent) return { stdout: "", stderr: "", exitCode: 0 };
|
|
74712
74737
|
const available = Object.keys(scripts);
|
|
74713
74738
|
let msg2 = `npm ERR! Missing script: "${scriptName}"
|
|
74714
74739
|
`;
|
|
@@ -74741,7 +74766,7 @@ async function handleNpmRun(args, ctx) {
|
|
|
74741
74766
|
const label = `${pkgJson.name || ""}@${pkgJson.version || ""}`;
|
|
74742
74767
|
const preScript = scripts[`pre${scriptName}`];
|
|
74743
74768
|
if (preScript) {
|
|
74744
|
-
allStderr += `
|
|
74769
|
+
if (!silent) allStderr += `
|
|
74745
74770
|
> ${label} pre${scriptName}
|
|
74746
74771
|
> ${preScript}
|
|
74747
74772
|
|
|
@@ -74753,12 +74778,13 @@ async function handleNpmRun(args, ctx) {
|
|
|
74753
74778
|
return { stdout: allStdout, stderr: allStderr, exitCode: preResult.exitCode };
|
|
74754
74779
|
}
|
|
74755
74780
|
}
|
|
74756
|
-
|
|
74781
|
+
const command = passed.length > 0 ? `${scriptCommand} ${passed.map((arg) => /^[\w@%+=:,./-]+$/.test(arg) ? arg : `'${arg.replace(/'/g, `'\\''`)}'`).join(" ")}` : scriptCommand;
|
|
74782
|
+
if (!silent) allStderr += `
|
|
74757
74783
|
> ${label} ${scriptName}
|
|
74758
|
-
> ${
|
|
74784
|
+
> ${command}
|
|
74759
74785
|
|
|
74760
74786
|
`;
|
|
74761
|
-
const mainResult = await ctx.exec(
|
|
74787
|
+
const mainResult = await ctx.exec(command, { cwd: ctx.cwd, env: npmEnv, ...typeof ctx.stdin === "string" ? { stdin: ctx.stdin } : {} });
|
|
74762
74788
|
allStdout += mainResult.stdout;
|
|
74763
74789
|
allStderr += mainResult.stderr;
|
|
74764
74790
|
if (mainResult.exitCode !== 0) {
|
|
@@ -74766,7 +74792,7 @@ async function handleNpmRun(args, ctx) {
|
|
|
74766
74792
|
}
|
|
74767
74793
|
const postScript = scripts[`post${scriptName}`];
|
|
74768
74794
|
if (postScript) {
|
|
74769
|
-
allStderr += `
|
|
74795
|
+
if (!silent) allStderr += `
|
|
74770
74796
|
> ${label} post${scriptName}
|
|
74771
74797
|
> ${postScript}
|
|
74772
74798
|
|
|
@@ -78272,6 +78298,22 @@ function __substrateGuestConstructor(Constructor, process2) {
|
|
|
78272
78298
|
return __substrateFunctionScope(__substrateGuestGlobal(process2), String(compiled));
|
|
78273
78299
|
} });
|
|
78274
78300
|
}
|
|
78301
|
+
const __substrateScriptScope = Function("__substrateScriptGlobals", "__substrateScriptSource", "with (__substrateScriptGlobals) { return eval(__substrateScriptSource); }");
|
|
78302
|
+
const __substrateGuestVms = /* @__PURE__ */ new WeakMap();
|
|
78303
|
+
function __substrateGuestVm(process2) {
|
|
78304
|
+
let vm2 = __substrateGuestVms.get(process2);
|
|
78305
|
+
if (vm2) return vm2;
|
|
78306
|
+
const run = (code2) => __substrateScriptScope(__substrateGuestGlobal(process2), String(code2));
|
|
78307
|
+
class Script2 extends Script$1 {
|
|
78308
|
+
runInThisContext(_options3) {
|
|
78309
|
+
return run(this.code);
|
|
78310
|
+
}
|
|
78311
|
+
}
|
|
78312
|
+
vm2 = { ...vmShim, Script: Script2, runInThisContext: (code2, _options3) => run(code2), default: void 0 };
|
|
78313
|
+
vm2.default = vm2;
|
|
78314
|
+
__substrateGuestVms.set(process2, vm2);
|
|
78315
|
+
return vm2;
|
|
78316
|
+
}
|
|
78275
78317
|
function __substrateModuleTypes(code2, resolvedPath, format2, process2) {
|
|
78276
78318
|
const typescript = format2 === void 0 ? /[.](?:ts|mts|cts)$/u.test(resolvedPath) && !resolvedPath.endsWith(".d.ts") : format2 === "typescript" || format2 === "commonjs-typescript" || format2 === "module-typescript";
|
|
78277
78319
|
if (!typescript) return code2;
|
|
@@ -78505,7 +78547,7 @@ function __substratePrepareBody(rawCode, resolvedPath, format2, process2) {
|
|
|
78505
78547
|
const lowered = transformEsmToCjs(code2, resolvedPath);
|
|
78506
78548
|
code2 = lowered === code2 ? code2 : `${__substrateModuleMarker}"use strict";${lowered}`;
|
|
78507
78549
|
} else {
|
|
78508
|
-
code2 =
|
|
78550
|
+
code2 = __substrateRewriteDynamicImportsInScript(code2);
|
|
78509
78551
|
}
|
|
78510
78552
|
return code2;
|
|
78511
78553
|
}
|
|
@@ -78652,6 +78694,17 @@ async function __substrateImportChain(hooks, id2, parentURL, moduleRequire) {
|
|
|
78652
78694
|
}));
|
|
78653
78695
|
return doors.__loadFromURL(resolved.url, loaded2.format ?? resolved.format, loaded2.source ?? void 0);
|
|
78654
78696
|
}
|
|
78697
|
+
function createImportMeta(moduleRequire, url2, dirname2, filename) {
|
|
78698
|
+
const resolve2 = (specifier, parent) => {
|
|
78699
|
+
const id2 = typeof specifier === "string" ? specifier : String(specifier);
|
|
78700
|
+
const base = parent === void 0 ? url2 : String(parent);
|
|
78701
|
+
if (id2.startsWith("./") || id2.startsWith("../") || id2.startsWith("/")) return new URL(id2, base).href;
|
|
78702
|
+
if (/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(id2)) return id2.startsWith("node:") ? id2 : new URL(id2).href;
|
|
78703
|
+
if (Object.prototype.hasOwnProperty.call(builtinModules, id2)) return `node:${id2}`;
|
|
78704
|
+
return "file://" + moduleRequire.resolve(id2);
|
|
78705
|
+
};
|
|
78706
|
+
return { url: url2, dirname: dirname2, filename, resolve: resolve2 };
|
|
78707
|
+
}
|
|
78655
78708
|
function createDynamicImport(moduleRequire, process2, parentURL) {
|
|
78656
78709
|
return async (specifier) => {
|
|
78657
78710
|
var _a3;
|
|
@@ -79620,7 +79673,7 @@ function createRequire(vfs2, fsShim, process2, currentDir, moduleCache, options,
|
|
|
79620
79673
|
dirname2,
|
|
79621
79674
|
process2,
|
|
79622
79675
|
consoleWrapper,
|
|
79623
|
-
|
|
79676
|
+
createImportMeta(moduleRequire, importMetaUrl, dirname2, resolvedPath),
|
|
79624
79677
|
dynamicImport,
|
|
79625
79678
|
__substrateGuestGlobal,
|
|
79626
79679
|
__substrateGuestConstructor
|
|
@@ -79723,6 +79776,9 @@ function createRequire(vfs2, fsShim, process2, currentDir, moduleCache, options,
|
|
|
79723
79776
|
if (id2 === "module") {
|
|
79724
79777
|
return __substrateModule();
|
|
79725
79778
|
}
|
|
79779
|
+
if (id2 === "vm") {
|
|
79780
|
+
return __substrateGuestVm(process2);
|
|
79781
|
+
}
|
|
79726
79782
|
if (id2 === "wasi") {
|
|
79727
79783
|
return __substrateGuestWasi(fsShim, process2);
|
|
79728
79784
|
}
|
|
@@ -79945,7 +80001,7 @@ class Runtime {
|
|
|
79945
80001
|
const lowered = transformEsmToCjs(code2, filename);
|
|
79946
80002
|
code2 = lowered === code2 ? code2 : `${__substrateModuleMarker}"use strict";${lowered}`;
|
|
79947
80003
|
} else {
|
|
79948
|
-
code2 =
|
|
80004
|
+
code2 = __substrateRewriteDynamicImportsInScript(code2);
|
|
79949
80005
|
}
|
|
79950
80006
|
try {
|
|
79951
80007
|
const importMetaUrl = "file://" + filename;
|
|
@@ -79976,7 +80032,7 @@ class Runtime {
|
|
|
79976
80032
|
dirname$1,
|
|
79977
80033
|
this.process,
|
|
79978
80034
|
consoleWrapper,
|
|
79979
|
-
|
|
80035
|
+
createImportMeta(require2, importMetaUrl, dirname$1, filename),
|
|
79980
80036
|
dynamicImport,
|
|
79981
80037
|
__substrateGuestGlobal,
|
|
79982
80038
|
__substrateGuestConstructor
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export { utilModule as util } from './node-lib/util-module';
|
|
|
31
31
|
export * as npm from './npm';
|
|
32
32
|
export { PackageManager, install } from './npm';
|
|
33
33
|
export { ServerBridge, getServerBridge, resetServerBridge } from './server-bridge';
|
|
34
|
+
export { PortBridge, getPortBridge } from './port-bridge';
|
|
34
35
|
export type { InitServiceWorkerOptions } from './server-bridge';
|
|
35
36
|
/** What a page's request is answered with, the shape the bridge answers. */
|
|
36
37
|
export type { ResponseData, LoopbackStreamFlow } from './node-lib/http-bridge';
|