hono 4.8.2 → 4.8.3

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.
@@ -178,15 +178,15 @@ class JSXNode {
178
178
  }
179
179
  } else if (key === "dangerouslySetInnerHTML") {
180
180
  if (children.length > 0) {
181
- throw "Can only set one of `children` or `props.dangerouslySetInnerHTML`.";
181
+ throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
182
182
  }
183
183
  children = [(0, import_html.raw)(v.__html)];
184
184
  } else if (v instanceof Promise) {
185
185
  buffer[0] += ` ${key}="`;
186
186
  buffer.unshift('"', v);
187
187
  } else if (typeof v === "function") {
188
- if (!key.startsWith("on")) {
189
- throw `Invalid prop '${key}' of type 'function' supplied to '${tag}'.`;
188
+ if (!key.startsWith("on") && key !== "ref") {
189
+ throw new Error(`Invalid prop '${key}' of type 'function' supplied to '${tag}'.`);
190
190
  }
191
191
  } else {
192
192
  buffer[0] += ` ${key}="`;
@@ -70,7 +70,7 @@ const parse = (cookie, name) => {
70
70
  cookieValue = cookieValue.slice(1, -1);
71
71
  }
72
72
  if (validCookieValueRegEx.test(cookieValue)) {
73
- parsedCookie[cookieName] = (0, import_url.decodeURIComponent_)(cookieValue);
73
+ parsedCookie[cookieName] = cookieValue.indexOf("%") !== -1 ? (0, import_url.tryDecode)(cookieValue, import_url.decodeURIComponent_) : cookieValue;
74
74
  if (name) {
75
75
  break;
76
76
  }
@@ -55,7 +55,9 @@ class JwtTokenExpired extends Error {
55
55
  }
56
56
  class JwtTokenIssuedAt extends Error {
57
57
  constructor(currentTimestamp, iat) {
58
- super(`Incorrect "iat" claim must be a older than "${currentTimestamp}" (iat: "${iat}")`);
58
+ super(
59
+ `Invalid "iat" claim, must be a valid number lower than "${currentTimestamp}" (iat: "${iat}")`
60
+ );
59
61
  this.name = "JwtTokenIssuedAt";
60
62
  }
61
63
  }
package/dist/jsx/base.js CHANGED
@@ -139,15 +139,15 @@ var JSXNode = class {
139
139
  }
140
140
  } else if (key === "dangerouslySetInnerHTML") {
141
141
  if (children.length > 0) {
142
- throw "Can only set one of `children` or `props.dangerouslySetInnerHTML`.";
142
+ throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
143
143
  }
144
144
  children = [raw(v.__html)];
145
145
  } else if (v instanceof Promise) {
146
146
  buffer[0] += ` ${key}="`;
147
147
  buffer.unshift('"', v);
148
148
  } else if (typeof v === "function") {
149
- if (!key.startsWith("on")) {
150
- throw `Invalid prop '${key}' of type 'function' supplied to '${tag}'.`;
149
+ if (!key.startsWith("on") && key !== "ref") {
150
+ throw new Error(`Invalid prop '${key}' of type 'function' supplied to '${tag}'.`);
151
151
  }
152
152
  } else {
153
153
  buffer[0] += ` ${key}="`;
@@ -1,5 +1,5 @@
1
1
  // src/utils/cookie.ts
2
- import { decodeURIComponent_ } from "./url.js";
2
+ import { decodeURIComponent_, tryDecode } from "./url.js";
3
3
  var algorithm = { name: "HMAC", hash: "SHA-256" };
4
4
  var getCryptoKey = async (secret) => {
5
5
  const secretBuf = typeof secret === "string" ? new TextEncoder().encode(secret) : secret;
@@ -45,7 +45,7 @@ var parse = (cookie, name) => {
45
45
  cookieValue = cookieValue.slice(1, -1);
46
46
  }
47
47
  if (validCookieValueRegEx.test(cookieValue)) {
48
- parsedCookie[cookieName] = decodeURIComponent_(cookieValue);
48
+ parsedCookie[cookieName] = cookieValue.indexOf("%") !== -1 ? tryDecode(cookieValue, decodeURIComponent_) : cookieValue;
49
49
  if (name) {
50
50
  break;
51
51
  }
@@ -25,7 +25,9 @@ var JwtTokenExpired = class extends Error {
25
25
  };
26
26
  var JwtTokenIssuedAt = class extends Error {
27
27
  constructor(currentTimestamp, iat) {
28
- super(`Incorrect "iat" claim must be a older than "${currentTimestamp}" (iat: "${iat}")`);
28
+ super(
29
+ `Invalid "iat" claim, must be a valid number lower than "${currentTimestamp}" (iat: "${iat}")`
30
+ );
29
31
  this.name = "JwtTokenIssuedAt";
30
32
  }
31
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.8.2",
3
+ "version": "4.8.3",
4
4
  "description": "Web framework built on Web Standards",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",
@@ -671,6 +671,7 @@
671
671
  "jsdom": "^22.1.0",
672
672
  "msw": "^2.6.0",
673
673
  "np": "10.2.0",
674
+ "pkg-pr-new": "^0.0.53",
674
675
  "prettier": "^2.6.2",
675
676
  "publint": "^0.1.16",
676
677
  "supertest": "^6.3.4",