@volter/tabnode 0.5.1 → 0.5.2
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.
|
@@ -17595,17 +17595,10 @@ var implementation$1 = function bind2(that) {
|
|
|
17595
17595
|
var implementation = implementation$1;
|
|
17596
17596
|
var functionBind = Function.prototype.bind || implementation;
|
|
17597
17597
|
var functionCall = Function.prototype.call;
|
|
17598
|
-
var functionApply;
|
|
17599
|
-
var hasRequiredFunctionApply;
|
|
17600
|
-
function requireFunctionApply() {
|
|
17601
|
-
if (hasRequiredFunctionApply) return functionApply;
|
|
17602
|
-
hasRequiredFunctionApply = 1;
|
|
17603
|
-
functionApply = Function.prototype.apply;
|
|
17604
|
-
return functionApply;
|
|
17605
|
-
}
|
|
17598
|
+
var functionApply = Function.prototype.apply;
|
|
17606
17599
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
17607
17600
|
var bind$2 = functionBind;
|
|
17608
|
-
var $apply$1 =
|
|
17601
|
+
var $apply$1 = functionApply;
|
|
17609
17602
|
var $call$2 = functionCall;
|
|
17610
17603
|
var $reflectApply = reflectApply;
|
|
17611
17604
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
@@ -17725,7 +17718,7 @@ var hasSymbols = requireHasSymbols()();
|
|
|
17725
17718
|
var getProto = requireGetProto();
|
|
17726
17719
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
17727
17720
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
17728
|
-
var $apply =
|
|
17721
|
+
var $apply = functionApply;
|
|
17729
17722
|
var $call = functionCall;
|
|
17730
17723
|
var needsEval = {};
|
|
17731
17724
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
@@ -18366,7 +18359,7 @@ function requireApplyBind() {
|
|
|
18366
18359
|
if (hasRequiredApplyBind) return applyBind;
|
|
18367
18360
|
hasRequiredApplyBind = 1;
|
|
18368
18361
|
var bind3 = functionBind;
|
|
18369
|
-
var $apply2 =
|
|
18362
|
+
var $apply2 = functionApply;
|
|
18370
18363
|
var actualApply$1 = actualApply;
|
|
18371
18364
|
applyBind = function applyBind2() {
|
|
18372
18365
|
return actualApply$1(bind3, $apply2, arguments);
|
|
@@ -27126,6 +27119,16 @@ function nodeLibPublic(name, require2, _process) {
|
|
|
27126
27119
|
});
|
|
27127
27120
|
return __table[name];
|
|
27128
27121
|
}
|
|
27122
|
+
const stackOverrides = /* @__PURE__ */ new Map();
|
|
27123
|
+
const stackOverrideMap = {
|
|
27124
|
+
set(error, override) {
|
|
27125
|
+
stackOverrides.set(error, override);
|
|
27126
|
+
return this;
|
|
27127
|
+
},
|
|
27128
|
+
get: (error) => stackOverrides.get(error),
|
|
27129
|
+
has: (error) => stackOverrides.has(error),
|
|
27130
|
+
delete: (error) => stackOverrides.delete(error)
|
|
27131
|
+
};
|
|
27129
27132
|
var builtPrimordials;
|
|
27130
27133
|
function primordialsOf() {
|
|
27131
27134
|
if (builtPrimordials === void 0) {
|
|
@@ -27403,6 +27406,11 @@ function bootstrapNodeLib(name, exports$1, process2) {
|
|
|
27403
27406
|
};
|
|
27404
27407
|
return;
|
|
27405
27408
|
}
|
|
27409
|
+
if (name === "internal/errors") {
|
|
27410
|
+
const map = exports$1.overrideStackTrace;
|
|
27411
|
+
for (const [key, value] of Object.entries(stackOverrideMap)) Object.defineProperty(map, key, { value, configurable: true });
|
|
27412
|
+
return;
|
|
27413
|
+
}
|
|
27406
27414
|
if (name === "internal/util/debuglog") {
|
|
27407
27415
|
const env = process2.env;
|
|
27408
27416
|
(_a3 = exports$1.initializeDebugEnv) == null ? void 0 : _a3.call(exports$1, (env == null ? void 0 : env.NODE_DEBUG) ?? "");
|
|
@@ -75824,7 +75832,17 @@ function __substrateCallSiteFileNames() {
|
|
|
75824
75832
|
}
|
|
75825
75833
|
return namer;
|
|
75826
75834
|
};
|
|
75827
|
-
const
|
|
75835
|
+
const overriding = (error, sites) => {
|
|
75836
|
+
const override = error !== null && typeof error === "object" ? stackOverrides.get(error) : void 0;
|
|
75837
|
+
if (override) {
|
|
75838
|
+
stackOverrides.delete(error);
|
|
75839
|
+
return override(error, sites.map(named));
|
|
75840
|
+
}
|
|
75841
|
+
if (typeof guestPrepare === "function") return namerFor(guestPrepare)(error, sites);
|
|
75842
|
+
return `${Error.prototype.toString.call(error)}${sites.map((site) => `
|
|
75843
|
+
at ${String(site)}`).join("")}`;
|
|
75844
|
+
};
|
|
75845
|
+
const get2 = () => stackOverrides.size > 0 ? overriding : typeof guestPrepare === "function" ? namerFor(guestPrepare) : guestPrepare;
|
|
75828
75846
|
get2.__substrateNamesFrames = true;
|
|
75829
75847
|
defineOnHost(Error, "prepareStackTrace", {
|
|
75830
75848
|
get: get2,
|
package/dist/index.mjs
CHANGED
|
@@ -27286,6 +27286,16 @@ function nodeLibPublic(name, require2, _process) {
|
|
|
27286
27286
|
});
|
|
27287
27287
|
return __table[name];
|
|
27288
27288
|
}
|
|
27289
|
+
const stackOverrides = /* @__PURE__ */ new Map();
|
|
27290
|
+
const stackOverrideMap = {
|
|
27291
|
+
set(error, override) {
|
|
27292
|
+
stackOverrides.set(error, override);
|
|
27293
|
+
return this;
|
|
27294
|
+
},
|
|
27295
|
+
get: (error) => stackOverrides.get(error),
|
|
27296
|
+
has: (error) => stackOverrides.has(error),
|
|
27297
|
+
delete: (error) => stackOverrides.delete(error)
|
|
27298
|
+
};
|
|
27289
27299
|
var builtPrimordials;
|
|
27290
27300
|
function primordialsOf() {
|
|
27291
27301
|
if (builtPrimordials === void 0) {
|
|
@@ -27569,6 +27579,11 @@ function bootstrapNodeLib(name, exports$1, process2) {
|
|
|
27569
27579
|
};
|
|
27570
27580
|
return;
|
|
27571
27581
|
}
|
|
27582
|
+
if (name === "internal/errors") {
|
|
27583
|
+
const map = exports$1.overrideStackTrace;
|
|
27584
|
+
for (const [key, value] of Object.entries(stackOverrideMap)) Object.defineProperty(map, key, { value, configurable: true });
|
|
27585
|
+
return;
|
|
27586
|
+
}
|
|
27572
27587
|
if (name === "internal/util/debuglog") {
|
|
27573
27588
|
const env = process2.env;
|
|
27574
27589
|
(_a2 = exports$1.initializeDebugEnv) == null ? void 0 : _a2.call(exports$1, (env == null ? void 0 : env.NODE_DEBUG) ?? "");
|
|
@@ -35498,7 +35513,17 @@ function __substrateCallSiteFileNames() {
|
|
|
35498
35513
|
}
|
|
35499
35514
|
return namer;
|
|
35500
35515
|
};
|
|
35501
|
-
const
|
|
35516
|
+
const overriding = (error, sites) => {
|
|
35517
|
+
const override = error !== null && typeof error === "object" ? stackOverrides.get(error) : void 0;
|
|
35518
|
+
if (override) {
|
|
35519
|
+
stackOverrides.delete(error);
|
|
35520
|
+
return override(error, sites.map(named));
|
|
35521
|
+
}
|
|
35522
|
+
if (typeof guestPrepare === "function") return namerFor(guestPrepare)(error, sites);
|
|
35523
|
+
return `${Error.prototype.toString.call(error)}${sites.map((site) => `
|
|
35524
|
+
at ${String(site)}`).join("")}`;
|
|
35525
|
+
};
|
|
35526
|
+
const get2 = () => stackOverrides.size > 0 ? overriding : typeof guestPrepare === "function" ? namerFor(guestPrepare) : guestPrepare;
|
|
35502
35527
|
get2.__substrateNamesFrames = true;
|
|
35503
35528
|
defineOnHost(Error, "prepareStackTrace", {
|
|
35504
35529
|
get: get2,
|
|
@@ -35523,7 +35548,7 @@ class WorkerRuntime {
|
|
|
35523
35548
|
this.worker = new Worker(
|
|
35524
35549
|
new URL(
|
|
35525
35550
|
/* @vite-ignore */
|
|
35526
|
-
"/assets/runtime-worker-
|
|
35551
|
+
"/assets/runtime-worker-CqG62h2U.js",
|
|
35527
35552
|
import.meta.url
|
|
35528
35553
|
),
|
|
35529
35554
|
{ type: "module" }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node's `overrideStackTrace`, as the realm's stack hook reads it.
|
|
3
|
+
*
|
|
4
|
+
* Node's files format a stack their own way by putting a function for one
|
|
5
|
+
* error in `internal/errors`' `overrideStackTrace` and reading `error.stack`:
|
|
6
|
+
* `assert.ok` takes its caller's call site that way. V8 hands that function
|
|
7
|
+
* the call sites because Node's bootstrap registers `prepareStackTraceCallback`
|
|
8
|
+
* with it, and that callback reads the map first. The engine has no such
|
|
9
|
+
* registration; `Error.prepareStackTrace` is the door it has. Every process's
|
|
10
|
+
* `internal/errors` writes here, and the realm's hook reads here, so the
|
|
11
|
+
* override reaches V8 whichever process set it. An entry is consumed by the
|
|
12
|
+
* stack it formats, as Node's is.
|
|
13
|
+
*/
|
|
14
|
+
export type StackOverride = (error: unknown, sites: unknown[]) => unknown;
|
|
15
|
+
export declare const stackOverrides: Map<object, StackOverride>;
|
|
16
|
+
/** A WeakMap-shaped view of the table, which is what `internal/errors` holds. */
|
|
17
|
+
export declare const stackOverrideMap: {
|
|
18
|
+
set(this: object, error: object, override: StackOverride): object;
|
|
19
|
+
get: (error: object) => StackOverride | undefined;
|
|
20
|
+
has: (error: object) => boolean;
|
|
21
|
+
delete: (error: object) => boolean;
|
|
22
|
+
};
|
package/package.json
CHANGED
package/src/node-lib/load.ts
CHANGED
|
@@ -31,6 +31,7 @@ import { setLibRequire } from './require-hook';
|
|
|
31
31
|
import { NODE_LTS_VERSION, nodeVersions } from './node-versions';
|
|
32
32
|
import { createUtilBinding } from './binding/util';
|
|
33
33
|
import { createFsBindings } from './binding/fs';
|
|
34
|
+
import { stackOverrideMap } from '../stack-overrides';
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* The realm's built-ins, captured as Node captures them: before a program can
|
|
@@ -445,6 +446,19 @@ function bootstrapNodeLib(name: string, exports: unknown, process: object): void
|
|
|
445
446
|
};
|
|
446
447
|
return;
|
|
447
448
|
}
|
|
449
|
+
if (name === 'internal/errors') {
|
|
450
|
+
// Node's bootstrap registers this file's `prepareStackTraceCallback` with
|
|
451
|
+
// V8, which reads `overrideStackTrace` before anything else formats a
|
|
452
|
+
// stack. Here the realm's `Error.prepareStackTrace` hook is that reader,
|
|
453
|
+
// so the map is the one it reads (`src/stack-overrides.ts`). Unread, an
|
|
454
|
+
// `assert.ok(false)` indexed the stack's text for a call site and threw
|
|
455
|
+
// `TypeError: call.getFileName is not a function`.
|
|
456
|
+
// A primordial map's prototype is frozen, so its methods are shadowed by
|
|
457
|
+
// definition rather than assignment.
|
|
458
|
+
const map = (exports as { overrideStackTrace: object }).overrideStackTrace;
|
|
459
|
+
for (const [key, value] of Object.entries(stackOverrideMap)) Object.defineProperty(map, key, { value, configurable: true });
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
448
462
|
if (name === 'internal/util/debuglog') {
|
|
449
463
|
const env = (process as { env?: Record<string, string | undefined> }).env;
|
|
450
464
|
(exports as { initializeDebugEnv?: (value: string) => void }).initializeDebugEnv?.(env?.NODE_DEBUG ?? '');
|
package/src/runtime.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { netModule as netShim } from './node-lib/net-module';
|
|
|
24
24
|
import { errname as __uvErrname } from './node-lib/binding/uv';
|
|
25
25
|
import { createTimersModule } from './node-lib/timers';
|
|
26
26
|
import { guestTimerFunctions } from './guest-timers';
|
|
27
|
+
import { stackOverrides } from './stack-overrides';
|
|
27
28
|
export { pendingGuestTimers, stopGuestTimers } from './guest-timers';
|
|
28
29
|
import eventsShim from './node-lib/events-module';
|
|
29
30
|
import { streamModule as streamShim, streamPromisesModule as streamPromises } from './node-lib/stream-module';
|
|
@@ -2936,7 +2937,19 @@ function __substrateCallSiteFileNames(): void {
|
|
|
2936
2937
|
}
|
|
2937
2938
|
return namer;
|
|
2938
2939
|
};
|
|
2939
|
-
|
|
2940
|
+
// While one of Node's own files has an override pending for a stack it is
|
|
2941
|
+
// about to read, V8 is handed a function that gives that error its
|
|
2942
|
+
// override and every other error what it would have had: the guest's
|
|
2943
|
+
// function, else V8's own text, which is the error and one `at` line
|
|
2944
|
+
// per call site. Otherwise V8 is handed exactly what the guest set.
|
|
2945
|
+
const overriding: Prepare = (error, sites) => {
|
|
2946
|
+
const override = error !== null && typeof error === 'object' ? stackOverrides.get(error) : undefined;
|
|
2947
|
+
if (override) { stackOverrides.delete(error as object); return override(error, sites.map(named)); }
|
|
2948
|
+
if (typeof guestPrepare === 'function') return namerFor(guestPrepare as Prepare)(error, sites);
|
|
2949
|
+
return `${Error.prototype.toString.call(error)}${sites.map(site => `\n at ${String(site)}`).join('')}`;
|
|
2950
|
+
};
|
|
2951
|
+
const get = () => (stackOverrides.size > 0 ? overriding
|
|
2952
|
+
: typeof guestPrepare === 'function' ? namerFor(guestPrepare as Prepare) : guestPrepare);
|
|
2940
2953
|
(get as { __substrateNamesFrames?: boolean }).__substrateNamesFrames = true;
|
|
2941
2954
|
defineOnHost(Error, 'prepareStackTrace', {
|
|
2942
2955
|
get,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node's `overrideStackTrace`, as the realm's stack hook reads it.
|
|
3
|
+
*
|
|
4
|
+
* Node's files format a stack their own way by putting a function for one
|
|
5
|
+
* error in `internal/errors`' `overrideStackTrace` and reading `error.stack`:
|
|
6
|
+
* `assert.ok` takes its caller's call site that way. V8 hands that function
|
|
7
|
+
* the call sites because Node's bootstrap registers `prepareStackTraceCallback`
|
|
8
|
+
* with it, and that callback reads the map first. The engine has no such
|
|
9
|
+
* registration; `Error.prepareStackTrace` is the door it has. Every process's
|
|
10
|
+
* `internal/errors` writes here, and the realm's hook reads here, so the
|
|
11
|
+
* override reaches V8 whichever process set it. An entry is consumed by the
|
|
12
|
+
* stack it formats, as Node's is.
|
|
13
|
+
*/
|
|
14
|
+
export type StackOverride = (error: unknown, sites: unknown[]) => unknown;
|
|
15
|
+
|
|
16
|
+
export const stackOverrides = new Map<object, StackOverride>();
|
|
17
|
+
|
|
18
|
+
/** A WeakMap-shaped view of the table, which is what `internal/errors` holds. */
|
|
19
|
+
export const stackOverrideMap = {
|
|
20
|
+
set(this: object, error: object, override: StackOverride) { stackOverrides.set(error, override); return this; },
|
|
21
|
+
get: (error: object) => stackOverrides.get(error),
|
|
22
|
+
has: (error: object) => stackOverrides.has(error),
|
|
23
|
+
delete: (error: object) => stackOverrides.delete(error),
|
|
24
|
+
};
|