better-call 1.0.14 → 1.0.15-beta.1
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/index.cjs +12 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,9 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __typeError = (msg) => {
|
|
7
|
-
throw TypeError(msg);
|
|
8
|
-
};
|
|
9
6
|
var __export = (target, all) => {
|
|
10
7
|
for (var name in all)
|
|
11
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -19,10 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
16
|
return to;
|
|
20
17
|
};
|
|
21
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
23
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
24
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
25
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
26
19
|
|
|
27
20
|
// src/index.ts
|
|
28
21
|
var src_exports = {};
|
|
@@ -66,36 +59,30 @@ function hideInternalStackFrames(stack) {
|
|
|
66
59
|
return lines.join("\n at ");
|
|
67
60
|
}
|
|
68
61
|
function makeErrorForHideStackFrame(Base, clazz) {
|
|
69
|
-
var _errorWithStack;
|
|
70
62
|
class HideStackFramesError extends Base {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
get ["constructor"]() {
|
|
74
|
-
var __super = (...args) => {
|
|
75
|
-
super(...args);
|
|
76
|
-
__privateAdd(this, _errorWithStack);
|
|
77
|
-
return this;
|
|
78
|
-
};
|
|
79
|
-
return clazz;
|
|
80
|
-
}
|
|
81
|
-
constructor(...args2) {
|
|
63
|
+
#errorWithStack;
|
|
64
|
+
constructor(...args) {
|
|
82
65
|
if (isErrorStackTraceLimitWritable()) {
|
|
83
66
|
const limit = Error.stackTraceLimit;
|
|
84
67
|
Error.stackTraceLimit = 0;
|
|
85
|
-
|
|
68
|
+
super(...args);
|
|
86
69
|
Error.stackTraceLimit = limit;
|
|
87
70
|
} else {
|
|
88
|
-
|
|
71
|
+
super(...args);
|
|
89
72
|
}
|
|
90
|
-
|
|
91
|
-
|
|
73
|
+
this.#errorWithStack = new ErrorWithStack();
|
|
74
|
+
this.#errorWithStack.stack = hideInternalStackFrames(this.#errorWithStack.stack ?? "");
|
|
92
75
|
}
|
|
93
76
|
// use `getter` here to avoid the stack trace being captured by loggers
|
|
94
77
|
get errorWithStack() {
|
|
95
|
-
return
|
|
78
|
+
return this.#errorWithStack;
|
|
79
|
+
}
|
|
80
|
+
// This is a workaround for wpt tests that expect that the error
|
|
81
|
+
// constructor has a `name` property of the base class.
|
|
82
|
+
get ["constructor"]() {
|
|
83
|
+
return clazz;
|
|
96
84
|
}
|
|
97
85
|
}
|
|
98
|
-
_errorWithStack = new WeakMap();
|
|
99
86
|
return HideStackFramesError;
|
|
100
87
|
}
|
|
101
88
|
var _statusCode = {
|