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.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
- // This is a workaround for wpt tests that expect that the error
72
- // constructor has a `name` property of the base class.
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
- __super(...args2);
68
+ super(...args);
86
69
  Error.stackTraceLimit = limit;
87
70
  } else {
88
- __super(...args2);
71
+ super(...args);
89
72
  }
90
- __privateSet(this, _errorWithStack, new ErrorWithStack());
91
- __privateGet(this, _errorWithStack).stack = hideInternalStackFrames(__privateGet(this, _errorWithStack).stack ?? "");
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 __privateGet(this, _errorWithStack);
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 = {