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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, U as HasRequiredKeys, t as InferBody, I as InferBodyInput, F as InferHeaders, G as InferHeadersInput, x as InferInputMethod, w as InferMethod, K as InferMiddlewareBody, L as InferMiddlewareQuery, y as InferParam, z as InferParamInput, Z as InferParamPath, $ as InferParamWildCard, v as InferQuery, u as InferQueryInput, B as InferRequest, D as InferRequestInput, J as InferUse, N as InputContext, W as IsEmptyObject, Y as MergeObject, r as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, V as Prettify, T as RequiredKeysOf, j as Router, R as RouterConfig, a0 as StandardSchemaV1, S as Status, X as UnionToIntersection, _ as _statusCode, c as createEndpoint, Q as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-BcwNrqXF.cjs';
1
+ export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, W as HasRequiredKeys, v as InferBody, I as InferBodyInput, J as InferHeaders, K as InferHeadersInput, z as InferInputMethod, y as InferMethod, N as InferMiddlewareBody, Q as InferMiddlewareQuery, B as InferParam, D as InferParamInput, a0 as InferParamPath, a1 as InferParamWildCard, x as InferQuery, w as InferQueryInput, F as InferRequest, G as InferRequestInput, L as InferUse, T as InputContext, Y as IsEmptyObject, $ as MergeObject, u as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, X as Prettify, V as RequiredKeysOf, j as Router, R as RouterConfig, a2 as StandardSchemaV1, S as Status, Z as UnionToIntersection, _ as _statusCode, c as createEndpoint, U as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, r as hideInternalStackFrames, t as makeErrorForHideStackFrame, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-CLKBSbjV.cjs';
2
2
 
3
3
  type JSONResponse = {
4
4
  body: Record<string, any>;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, U as HasRequiredKeys, t as InferBody, I as InferBodyInput, F as InferHeaders, G as InferHeadersInput, x as InferInputMethod, w as InferMethod, K as InferMiddlewareBody, L as InferMiddlewareQuery, y as InferParam, z as InferParamInput, Z as InferParamPath, $ as InferParamWildCard, v as InferQuery, u as InferQueryInput, B as InferRequest, D as InferRequestInput, J as InferUse, N as InputContext, W as IsEmptyObject, Y as MergeObject, r as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, V as Prettify, T as RequiredKeysOf, j as Router, R as RouterConfig, a0 as StandardSchemaV1, S as Status, X as UnionToIntersection, _ as _statusCode, c as createEndpoint, Q as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-BcwNrqXF.js';
1
+ export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, W as HasRequiredKeys, v as InferBody, I as InferBodyInput, J as InferHeaders, K as InferHeadersInput, z as InferInputMethod, y as InferMethod, N as InferMiddlewareBody, Q as InferMiddlewareQuery, B as InferParam, D as InferParamInput, a0 as InferParamPath, a1 as InferParamWildCard, x as InferQuery, w as InferQueryInput, F as InferRequest, G as InferRequestInput, L as InferUse, T as InputContext, Y as IsEmptyObject, $ as MergeObject, u as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, X as Prettify, V as RequiredKeysOf, j as Router, R as RouterConfig, a2 as StandardSchemaV1, S as Status, Z as UnionToIntersection, _ as _statusCode, c as createEndpoint, U as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, r as hideInternalStackFrames, t as makeErrorForHideStackFrame, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-CLKBSbjV.js';
2
2
 
3
3
  type JSONResponse = {
4
4
  body: Record<string, any>;
package/dist/index.js CHANGED
@@ -12,12 +12,6 @@ function isErrorStackTraceLimitWritable() {
12
12
  }
13
13
  return Object.prototype.hasOwnProperty.call(desc, "writable") ? desc.writable : desc.set !== void 0;
14
14
  }
15
- var ErrorWithStack = class extends Error {
16
- constructor() {
17
- super();
18
- this.name = "ErrorWithStack";
19
- }
20
- };
21
15
  function hideInternalStackFrames(stack) {
22
16
  const lines = stack.split("\n at ");
23
17
  if (lines.length <= 1) {
@@ -28,7 +22,7 @@ function hideInternalStackFrames(stack) {
28
22
  }
29
23
  function makeErrorForHideStackFrame(Base, clazz) {
30
24
  class HideStackFramesError extends Base {
31
- #errorWithStack;
25
+ #hiddenStack;
32
26
  constructor(...args) {
33
27
  if (isErrorStackTraceLimitWritable()) {
34
28
  const limit = Error.stackTraceLimit;
@@ -38,19 +32,23 @@ function makeErrorForHideStackFrame(Base, clazz) {
38
32
  } else {
39
33
  super(...args);
40
34
  }
41
- this.#errorWithStack = new ErrorWithStack();
42
- this.#errorWithStack.stack = hideInternalStackFrames(this.#errorWithStack.stack ?? "");
35
+ const stack = new Error().stack;
36
+ if (stack) {
37
+ this.#hiddenStack = hideInternalStackFrames(stack.replace(/^Error/, this.name));
38
+ }
43
39
  }
44
40
  // use `getter` here to avoid the stack trace being captured by loggers
45
- get 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;
41
+ get errorStack() {
42
+ return this.#hiddenStack;
52
43
  }
53
44
  }
45
+ Object.defineProperty(HideStackFramesError.prototype, "constructor", {
46
+ get() {
47
+ return clazz;
48
+ },
49
+ enumerable: false,
50
+ configurable: true
51
+ });
54
52
  return HideStackFramesError;
55
53
  }
56
54
  var _statusCode = {
@@ -3179,6 +3177,8 @@ export {
3179
3177
  generator,
3180
3178
  getCookieKey,
3181
3179
  getHTML,
3180
+ hideInternalStackFrames,
3181
+ makeErrorForHideStackFrame,
3182
3182
  parseCookies,
3183
3183
  serializeCookie,
3184
3184
  serializeSignedCookie,