better-call 1.0.15 → 1.0.17

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/client.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BetterFetchOption, BetterFetchResponse } from '@better-fetch/fetch';
2
- import { j as Router, X as UnionToIntersection, b as Endpoint, U as HasRequiredKeys } from './router-BcwNrqXF.cjs';
2
+ import { j as Router, Z as UnionToIntersection, b as Endpoint, W as HasRequiredKeys } from './router-CLKBSbjV.cjs';
3
3
 
4
4
  type HasRequired<T extends {
5
5
  body?: any;
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BetterFetchOption, BetterFetchResponse } from '@better-fetch/fetch';
2
- import { j as Router, X as UnionToIntersection, b as Endpoint, U as HasRequiredKeys } from './router-BcwNrqXF.js';
2
+ import { j as Router, Z as UnionToIntersection, b as Endpoint, W as HasRequiredKeys } from './router-CLKBSbjV.js';
3
3
 
4
4
  type HasRequired<T extends {
5
5
  body?: any;
package/dist/index.cjs CHANGED
@@ -29,6 +29,8 @@ __export(src_exports, {
29
29
  generator: () => generator,
30
30
  getCookieKey: () => getCookieKey,
31
31
  getHTML: () => getHTML,
32
+ hideInternalStackFrames: () => hideInternalStackFrames,
33
+ makeErrorForHideStackFrame: () => makeErrorForHideStackFrame,
32
34
  parseCookies: () => parseCookies,
33
35
  serializeCookie: () => serializeCookie,
34
36
  serializeSignedCookie: () => serializeSignedCookie,
@@ -44,12 +46,6 @@ function isErrorStackTraceLimitWritable() {
44
46
  }
45
47
  return Object.prototype.hasOwnProperty.call(desc, "writable") ? desc.writable : desc.set !== void 0;
46
48
  }
47
- var ErrorWithStack = class extends Error {
48
- constructor() {
49
- super();
50
- this.name = "ErrorWithStack";
51
- }
52
- };
53
49
  function hideInternalStackFrames(stack) {
54
50
  const lines = stack.split("\n at ");
55
51
  if (lines.length <= 1) {
@@ -60,7 +56,7 @@ function hideInternalStackFrames(stack) {
60
56
  }
61
57
  function makeErrorForHideStackFrame(Base, clazz) {
62
58
  class HideStackFramesError extends Base {
63
- #errorWithStack;
59
+ #hiddenStack;
64
60
  constructor(...args) {
65
61
  if (isErrorStackTraceLimitWritable()) {
66
62
  const limit = Error.stackTraceLimit;
@@ -70,19 +66,23 @@ function makeErrorForHideStackFrame(Base, clazz) {
70
66
  } else {
71
67
  super(...args);
72
68
  }
73
- this.#errorWithStack = new ErrorWithStack();
74
- this.#errorWithStack.stack = hideInternalStackFrames(this.#errorWithStack.stack ?? "");
69
+ const stack = new Error().stack;
70
+ if (stack) {
71
+ this.#hiddenStack = hideInternalStackFrames(stack.replace(/^Error/, this.name));
72
+ }
75
73
  }
76
74
  // use `getter` here to avoid the stack trace being captured by loggers
77
- get 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;
75
+ get errorStack() {
76
+ return this.#hiddenStack;
84
77
  }
85
78
  }
79
+ Object.defineProperty(HideStackFramesError.prototype, "constructor", {
80
+ get() {
81
+ return clazz;
82
+ },
83
+ enumerable: false,
84
+ configurable: true
85
+ });
86
86
  return HideStackFramesError;
87
87
  }
88
88
  var _statusCode = {
@@ -3212,6 +3212,8 @@ var createRouter = (endpoints, config2) => {
3212
3212
  generator,
3213
3213
  getCookieKey,
3214
3214
  getHTML,
3215
+ hideInternalStackFrames,
3216
+ makeErrorForHideStackFrame,
3215
3217
  parseCookies,
3216
3218
  serializeCookie,
3217
3219
  serializeSignedCookie,