hono 4.7.5 → 4.7.6

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.
@@ -112,20 +112,21 @@ class ClientRequestImpl {
112
112
  }
113
113
  const hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
114
114
  const parts = [...opts.path];
115
- if (parts.at(-1) === "toString") {
116
- if (parts.at(-2) === "name") {
117
- return parts.at(-3) || "";
115
+ const lastParts = parts.slice(-3).reverse();
116
+ if (lastParts[0] === "toString") {
117
+ if (lastParts[1] === "name") {
118
+ return lastParts[2] || "";
118
119
  }
119
120
  return proxyCallback.toString();
120
121
  }
121
- if (parts.at(-1) === "valueOf") {
122
- if (parts.at(-2) === "name") {
123
- return parts.at(-3) || "";
122
+ if (lastParts[0] === "valueOf") {
123
+ if (lastParts[1] === "name") {
124
+ return lastParts[2] || "";
124
125
  }
125
126
  return proxyCallback;
126
127
  }
127
128
  let method = "";
128
- if (/^\$/.test(parts.at(-1))) {
129
+ if (/^\$/.test(lastParts[0])) {
129
130
  const last = parts.pop();
130
131
  if (last) {
131
132
  method = last.replace(/^\$/, "");
@@ -29,7 +29,7 @@ const compress = (options) => {
29
29
  return async function compress2(ctx, next) {
30
30
  await next();
31
31
  const contentLength = ctx.res.headers.get("Content-Length");
32
- if (ctx.res.headers.has("Content-Encoding") || ctx.req.method === "HEAD" || contentLength && Number(contentLength) < threshold || !shouldCompress(ctx.res) || !shouldTransform(ctx.res)) {
32
+ if (ctx.res.headers.has("Content-Encoding") || ctx.res.headers.has("Transfer-Encoding") || ctx.req.method === "HEAD" || contentLength && Number(contentLength) < threshold || !shouldCompress(ctx.res) || !shouldTransform(ctx.res)) {
33
33
  return;
34
34
  }
35
35
  const accepted = ctx.req.header("Accept-Encoding");
@@ -97,20 +97,21 @@ var ClientRequestImpl = class {
97
97
  };
98
98
  var hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
99
99
  const parts = [...opts.path];
100
- if (parts.at(-1) === "toString") {
101
- if (parts.at(-2) === "name") {
102
- return parts.at(-3) || "";
100
+ const lastParts = parts.slice(-3).reverse();
101
+ if (lastParts[0] === "toString") {
102
+ if (lastParts[1] === "name") {
103
+ return lastParts[2] || "";
103
104
  }
104
105
  return proxyCallback.toString();
105
106
  }
106
- if (parts.at(-1) === "valueOf") {
107
- if (parts.at(-2) === "name") {
108
- return parts.at(-3) || "";
107
+ if (lastParts[0] === "valueOf") {
108
+ if (lastParts[1] === "name") {
109
+ return lastParts[2] || "";
109
110
  }
110
111
  return proxyCallback;
111
112
  }
112
113
  let method = "";
113
- if (/^\$/.test(parts.at(-1))) {
114
+ if (/^\$/.test(lastParts[0])) {
114
115
  const last = parts.pop();
115
116
  if (last) {
116
117
  method = last.replace(/^\$/, "");
@@ -7,7 +7,7 @@ var compress = (options) => {
7
7
  return async function compress2(ctx, next) {
8
8
  await next();
9
9
  const contentLength = ctx.res.headers.get("Content-Length");
10
- if (ctx.res.headers.has("Content-Encoding") || ctx.req.method === "HEAD" || contentLength && Number(contentLength) < threshold || !shouldCompress(ctx.res) || !shouldTransform(ctx.res)) {
10
+ if (ctx.res.headers.has("Content-Encoding") || ctx.res.headers.has("Transfer-Encoding") || ctx.req.method === "HEAD" || contentLength && Number(contentLength) < threshold || !shouldCompress(ctx.res) || !shouldTransform(ctx.res)) {
11
11
  return;
12
12
  }
13
13
  const accepted = ctx.req.header("Accept-Encoding");
@@ -339,7 +339,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
339
339
  * @example
340
340
  * ```ts
341
341
  * app.use('*', async (c, next) => {
342
- * c.set('message', 'Hono is cool!!')
342
+ * c.set('message', 'Hono is hot!!')
343
343
  * await next()
344
344
  * })
345
345
  * ```
@@ -40,7 +40,7 @@ type BasicAuthOptions = {
40
40
  * '/auth/*',
41
41
  * basicAuth({
42
42
  * username: 'hono',
43
- * password: 'acoolproject',
43
+ * password: 'ahotproject',
44
44
  * })
45
45
  * )
46
46
  *
@@ -47,7 +47,7 @@ type BearerAuthOptions = {
47
47
  * ```ts
48
48
  * const app = new Hono()
49
49
  *
50
- * const token = 'honoiscool'
50
+ * const token = 'honoishot'
51
51
  *
52
52
  * app.use('/api/*', bearerAuth({ token }))
53
53
  *
@@ -24,7 +24,7 @@ import type { Env, MiddlewareHandler } from '../../types';
24
24
  * app.use(contextStorage())
25
25
  *
26
26
  * app.use(async (c, next) => {
27
- * c.set('message', 'Hono is cool!!)
27
+ * c.set('message', 'Hono is hot!!)
28
28
  * await next()
29
29
  * })
30
30
  *
@@ -34,7 +34,7 @@ export declare const RETAINED_304_HEADERS: string[];
34
34
  *
35
35
  * app.use('/etag/*', etag())
36
36
  * app.get('/etag/abc', (c) => {
37
- * return c.text('Hono is cool')
37
+ * return c.text('Hono is hot')
38
38
  * })
39
39
  * ```
40
40
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.7.5",
3
+ "version": "4.7.6",
4
4
  "description": "Web framework built on Web Standards",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",