hono 4.12.32 → 4.12.33
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/cjs/jsx/hooks/index.js +14 -11
- package/dist/cjs/utils/cookie.js +2 -1
- package/dist/jsx/hooks/index.js +14 -11
- package/dist/utils/cookie.js +2 -1
- package/package.json +2 -3
|
@@ -330,19 +330,22 @@ const useSyncExternalStore = (subscribe, getSnapshot, getServerSnapshot) => {
|
|
|
330
330
|
}
|
|
331
331
|
return getServerSnapshot();
|
|
332
332
|
}
|
|
333
|
-
const
|
|
334
|
-
const [
|
|
335
|
-
|
|
336
|
-
|
|
333
|
+
const snapshot = buildData[0][4] && getServerSnapshot ? getServerSnapshot() : getSnapshot();
|
|
334
|
+
const [, setVersion] = useState(0);
|
|
335
|
+
const latestSnapshot = useRef([snapshot, getSnapshot]);
|
|
336
|
+
latestSnapshot.current = [snapshot, getSnapshot];
|
|
337
|
+
const unsubscribeRef = useRef(null);
|
|
337
338
|
useEffect(() => {
|
|
338
|
-
|
|
339
|
-
|
|
339
|
+
const update2 = () => setVersion((version) => version + 1);
|
|
340
|
+
unsubscribeRef.current?.();
|
|
341
|
+
unsubscribeRef.current = subscribe(update2);
|
|
342
|
+
const [snapshot2, getSnapshot2] = latestSnapshot.current;
|
|
343
|
+
if (!Object.is(snapshot2, getSnapshot2())) {
|
|
344
|
+
update2();
|
|
340
345
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
}, []);
|
|
345
|
-
return state;
|
|
346
|
+
}, [subscribe]);
|
|
347
|
+
useEffect(() => () => unsubscribeRef.current?.(), []);
|
|
348
|
+
return snapshot;
|
|
346
349
|
};
|
|
347
350
|
// Annotate the CommonJS export names for ESM import in node:
|
|
348
351
|
0 && (module.exports = {
|
package/dist/cjs/utils/cookie.js
CHANGED
|
@@ -47,6 +47,7 @@ const verifySignature = async (base64Signature, value, secret) => {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
const validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
|
|
50
|
+
const relaxedCookieNameRegEx = /^[!#-:<>-[\]-~]+$/;
|
|
50
51
|
const validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
|
|
51
52
|
const trimCookieWhitespace = (value) => {
|
|
52
53
|
let start = 0;
|
|
@@ -79,7 +80,7 @@ const parse = (cookie, name) => {
|
|
|
79
80
|
continue;
|
|
80
81
|
}
|
|
81
82
|
const cookieName = trimCookieWhitespace(pairStr.substring(0, valueStartPos));
|
|
82
|
-
if (name && name !== cookieName || !
|
|
83
|
+
if (name && name !== cookieName || !relaxedCookieNameRegEx.test(cookieName) || cookieName in parsedCookie) {
|
|
83
84
|
continue;
|
|
84
85
|
}
|
|
85
86
|
let cookieValue = trimCookieWhitespace(pairStr.substring(valueStartPos + 1));
|
package/dist/jsx/hooks/index.js
CHANGED
|
@@ -289,19 +289,22 @@ var useSyncExternalStore = (subscribe, getSnapshot, getServerSnapshot) => {
|
|
|
289
289
|
}
|
|
290
290
|
return getServerSnapshot();
|
|
291
291
|
}
|
|
292
|
-
const
|
|
293
|
-
const [
|
|
294
|
-
|
|
295
|
-
|
|
292
|
+
const snapshot = buildData[0][4] && getServerSnapshot ? getServerSnapshot() : getSnapshot();
|
|
293
|
+
const [, setVersion] = useState(0);
|
|
294
|
+
const latestSnapshot = useRef([snapshot, getSnapshot]);
|
|
295
|
+
latestSnapshot.current = [snapshot, getSnapshot];
|
|
296
|
+
const unsubscribeRef = useRef(null);
|
|
296
297
|
useEffect(() => {
|
|
297
|
-
|
|
298
|
-
|
|
298
|
+
const update2 = () => setVersion((version) => version + 1);
|
|
299
|
+
unsubscribeRef.current?.();
|
|
300
|
+
unsubscribeRef.current = subscribe(update2);
|
|
301
|
+
const [snapshot2, getSnapshot2] = latestSnapshot.current;
|
|
302
|
+
if (!Object.is(snapshot2, getSnapshot2())) {
|
|
303
|
+
update2();
|
|
299
304
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}, []);
|
|
304
|
-
return state;
|
|
305
|
+
}, [subscribe]);
|
|
306
|
+
useEffect(() => () => unsubscribeRef.current?.(), []);
|
|
307
|
+
return snapshot;
|
|
305
308
|
};
|
|
306
309
|
export {
|
|
307
310
|
STASH_EFFECT,
|
package/dist/utils/cookie.js
CHANGED
|
@@ -23,6 +23,7 @@ var verifySignature = async (base64Signature, value, secret) => {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
var validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
|
|
26
|
+
var relaxedCookieNameRegEx = /^[!#-:<>-[\]-~]+$/;
|
|
26
27
|
var validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
|
|
27
28
|
var trimCookieWhitespace = (value) => {
|
|
28
29
|
let start = 0;
|
|
@@ -55,7 +56,7 @@ var parse = (cookie, name) => {
|
|
|
55
56
|
continue;
|
|
56
57
|
}
|
|
57
58
|
const cookieName = trimCookieWhitespace(pairStr.substring(0, valueStartPos));
|
|
58
|
-
if (name && name !== cookieName || !
|
|
59
|
+
if (name && name !== cookieName || !relaxedCookieNameRegEx.test(cookieName) || cookieName in parsedCookie) {
|
|
59
60
|
continue;
|
|
60
61
|
}
|
|
61
62
|
let cookieValue = trimCookieWhitespace(pairStr.substring(valueStartPos + 1));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.33",
|
|
4
4
|
"description": "Web framework built on Web Standards",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -667,7 +667,7 @@
|
|
|
667
667
|
],
|
|
668
668
|
"devDependencies": {
|
|
669
669
|
"@hono/eslint-config": "^2.1.1",
|
|
670
|
-
"@hono/node-server": "^2.0.
|
|
670
|
+
"@hono/node-server": "^2.0.12",
|
|
671
671
|
"@types/jsdom": "^21.1.7",
|
|
672
672
|
"@types/node": "^24.3.0",
|
|
673
673
|
"@types/ws": "^8.18.1",
|
|
@@ -685,7 +685,6 @@
|
|
|
685
685
|
"prettier": "3.7.4",
|
|
686
686
|
"publint": "0.3.15",
|
|
687
687
|
"typescript": "^6.0.3",
|
|
688
|
-
"undici": "^6.27.0",
|
|
689
688
|
"vite-plugin-fastly-js-compute": "^0.4.2",
|
|
690
689
|
"vitest": "^4.1.9",
|
|
691
690
|
"wrangler": "4.107.0",
|