better-call 1.0.14 → 1.0.15

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.js CHANGED
@@ -1,15 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __typeError = (msg) => {
3
- throw TypeError(msg);
4
- };
5
2
  var __export = (target, all) => {
6
3
  for (var name in all)
7
4
  __defProp(target, name, { get: all[name], enumerable: true });
8
5
  };
9
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
10
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
11
- 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);
12
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
13
6
 
14
7
  // src/error.ts
15
8
  function isErrorStackTraceLimitWritable() {
@@ -34,36 +27,30 @@ function hideInternalStackFrames(stack) {
34
27
  return lines.join("\n at ");
35
28
  }
36
29
  function makeErrorForHideStackFrame(Base, clazz) {
37
- var _errorWithStack;
38
30
  class HideStackFramesError extends Base {
39
- // This is a workaround for wpt tests that expect that the error
40
- // constructor has a `name` property of the base class.
41
- get ["constructor"]() {
42
- var __super = (...args) => {
43
- super(...args);
44
- __privateAdd(this, _errorWithStack);
45
- return this;
46
- };
47
- return clazz;
48
- }
49
- constructor(...args2) {
31
+ #errorWithStack;
32
+ constructor(...args) {
50
33
  if (isErrorStackTraceLimitWritable()) {
51
34
  const limit = Error.stackTraceLimit;
52
35
  Error.stackTraceLimit = 0;
53
- __super(...args2);
36
+ super(...args);
54
37
  Error.stackTraceLimit = limit;
55
38
  } else {
56
- __super(...args2);
39
+ super(...args);
57
40
  }
58
- __privateSet(this, _errorWithStack, new ErrorWithStack());
59
- __privateGet(this, _errorWithStack).stack = hideInternalStackFrames(__privateGet(this, _errorWithStack).stack ?? "");
41
+ this.#errorWithStack = new ErrorWithStack();
42
+ this.#errorWithStack.stack = hideInternalStackFrames(this.#errorWithStack.stack ?? "");
60
43
  }
61
44
  // use `getter` here to avoid the stack trace being captured by loggers
62
45
  get errorWithStack() {
63
- return __privateGet(this, _errorWithStack);
46
+ return this.#errorWithStack;
47
+ }
48
+ // This is a workaround for wpt tests that expect that the error
49
+ // constructor has a `name` property of the base class.
50
+ get ["constructor"]() {
51
+ return clazz;
64
52
  }
65
53
  }
66
- _errorWithStack = new WeakMap();
67
54
  return HideStackFramesError;
68
55
  }
69
56
  var _statusCode = {