better-call 1.0.15-beta.1 → 1.0.16

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-c8myTmx-.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-c8myTmx-.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,12 +66,14 @@ 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;
75
+ get errorStack() {
76
+ return this.#hiddenStack;
79
77
  }
80
78
  // This is a workaround for wpt tests that expect that the error
81
79
  // constructor has a `name` property of the base class.
@@ -3212,6 +3210,8 @@ var createRouter = (endpoints, config2) => {
3212
3210
  generator,
3213
3211
  getCookieKey,
3214
3212
  getHTML,
3213
+ hideInternalStackFrames,
3214
+ makeErrorForHideStackFrame,
3215
3215
  parseCookies,
3216
3216
  serializeCookie,
3217
3217
  serializeSignedCookie,