hono 4.12.33 → 4.12.34

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.
@@ -92,6 +92,10 @@ const proxy = async (input, proxyInit) => {
92
92
  req.headers.delete("accept-encoding");
93
93
  const res = await (customFetch || fetch)(req);
94
94
  const resHeaders = new Headers(res.headers);
95
+ const connectionValue = resHeaders.get("connection");
96
+ if (connectionValue) {
97
+ connectionValue.split(",").map((h) => h.trim()).filter((h) => ALLOWED_TOKEN_PATTERN.test(h)).forEach((h) => resHeaders.delete(h));
98
+ }
95
99
  hopByHopHeaders.forEach((header) => {
96
100
  resHeaders.delete(header);
97
101
  });
@@ -315,15 +315,7 @@ const shallowEqual = (a, b) => {
315
315
  return true;
316
316
  };
317
317
  const memo = (component, propsAreEqual = shallowEqual) => {
318
- let computed = null;
319
- let prevProps = void 0;
320
- const wrapper = ((props) => {
321
- if (prevProps && !propsAreEqual(prevProps, props)) {
322
- computed = null;
323
- }
324
- prevProps = props;
325
- return computed ||= component(props);
326
- });
318
+ const wrapper = ((props) => component(props));
327
319
  wrapper[import_constants.DOM_MEMO] = propsAreEqual;
328
320
  wrapper[import_constants.DOM_RENDERER] = component;
329
321
  return wrapper;
@@ -79,7 +79,7 @@ const cors = (options) => {
79
79
  if (!headers?.length) {
80
80
  const requestHeaders = c.req.header("Access-Control-Request-Headers");
81
81
  if (requestHeaders) {
82
- headers = requestHeaders.split(/\s*,\s*/);
82
+ headers = requestHeaders.split(",").map((h) => h.trim());
83
83
  }
84
84
  }
85
85
  if (headers?.length) {
@@ -69,14 +69,18 @@ const normalizeLanguage = (lang, options) => {
69
69
  if (exactIndex !== -1) {
70
70
  return options.supportedLanguages[exactIndex];
71
71
  }
72
- const parts = compLang.split("-");
73
- for (let i = parts.length - 1; i > 0; i--) {
74
- const candidate = parts.slice(0, i).join("-");
75
- const prefixIndex = compSupported.indexOf(candidate);
76
- if (prefixIndex !== -1) {
77
- return options.supportedLanguages[prefixIndex];
72
+ let longestMatchIndex = -1;
73
+ let longestMatchLength = -1;
74
+ for (let i = 0; i < compSupported.length; i++) {
75
+ const candidate = compSupported[i];
76
+ if (candidate.length < compLang.length && candidate.length > longestMatchLength && compLang.startsWith(candidate) && compLang[candidate.length] === "-") {
77
+ longestMatchIndex = i;
78
+ longestMatchLength = candidate.length;
78
79
  }
79
80
  }
81
+ if (longestMatchIndex !== -1) {
82
+ return options.supportedLanguages[longestMatchIndex];
83
+ }
80
84
  return void 0;
81
85
  } catch {
82
86
  return void 0;
@@ -71,6 +71,10 @@ var proxy = async (input, proxyInit) => {
71
71
  req.headers.delete("accept-encoding");
72
72
  const res = await (customFetch || fetch)(req);
73
73
  const resHeaders = new Headers(res.headers);
74
+ const connectionValue = resHeaders.get("connection");
75
+ if (connectionValue) {
76
+ connectionValue.split(",").map((h) => h.trim()).filter((h) => ALLOWED_TOKEN_PATTERN.test(h)).forEach((h) => resHeaders.delete(h));
77
+ }
74
78
  hopByHopHeaders.forEach((header) => {
75
79
  resHeaders.delete(header);
76
80
  });
package/dist/jsx/base.js CHANGED
@@ -284,15 +284,7 @@ var shallowEqual = (a, b) => {
284
284
  return true;
285
285
  };
286
286
  var memo = (component, propsAreEqual = shallowEqual) => {
287
- let computed = null;
288
- let prevProps = void 0;
289
- const wrapper = ((props) => {
290
- if (prevProps && !propsAreEqual(prevProps, props)) {
291
- computed = null;
292
- }
293
- prevProps = props;
294
- return computed ||= component(props);
295
- });
287
+ const wrapper = ((props) => component(props));
296
288
  wrapper[DOM_MEMO] = propsAreEqual;
297
289
  wrapper[DOM_RENDERER] = component;
298
290
  return wrapper;
@@ -58,7 +58,7 @@ var cors = (options) => {
58
58
  if (!headers?.length) {
59
59
  const requestHeaders = c.req.header("Access-Control-Request-Headers");
60
60
  if (requestHeaders) {
61
- headers = requestHeaders.split(/\s*,\s*/);
61
+ headers = requestHeaders.split(",").map((h) => h.trim());
62
62
  }
63
63
  }
64
64
  if (headers?.length) {
@@ -39,14 +39,18 @@ var normalizeLanguage = (lang, options) => {
39
39
  if (exactIndex !== -1) {
40
40
  return options.supportedLanguages[exactIndex];
41
41
  }
42
- const parts = compLang.split("-");
43
- for (let i = parts.length - 1; i > 0; i--) {
44
- const candidate = parts.slice(0, i).join("-");
45
- const prefixIndex = compSupported.indexOf(candidate);
46
- if (prefixIndex !== -1) {
47
- return options.supportedLanguages[prefixIndex];
42
+ let longestMatchIndex = -1;
43
+ let longestMatchLength = -1;
44
+ for (let i = 0; i < compSupported.length; i++) {
45
+ const candidate = compSupported[i];
46
+ if (candidate.length < compLang.length && candidate.length > longestMatchLength && compLang.startsWith(candidate) && compLang[candidate.length] === "-") {
47
+ longestMatchIndex = i;
48
+ longestMatchLength = candidate.length;
48
49
  }
49
50
  }
51
+ if (longestMatchIndex !== -1) {
52
+ return options.supportedLanguages[longestMatchIndex];
53
+ }
50
54
  return void 0;
51
55
  } catch {
52
56
  return void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.12.33",
3
+ "version": "4.12.34",
4
4
  "description": "Web framework built on Web Standards",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",