feat: polyfill URLSearchParams on the server side (#555)

This commit is contained in:
Valerio Ageno
2025-02-12 08:35:36 +01:00
committed by GitHub
parent 9aa6aedee0
commit e00dad9200
4 changed files with 13 additions and 2 deletions
@@ -31,8 +31,9 @@ function getInitialLocation(
hash: '',
href: serverPayloadLocation.href || '',
searchStr: serverPayloadLocation.searchStr || '',
// TODO: Polyfill URLSearchParams
search: {},
search: Object.fromEntries(
new URLSearchParams(serverPayloadLocation.searchStr),
),
}
}
+1
View File
@@ -100,6 +100,7 @@
"fast-text-encoding": "^1.0.6",
"tuono-fs-router-vite-plugin": "workspace:*",
"tuono-router": "workspace:*",
"url-search-params-polyfill": "^8.2.5",
"vite": "^5.4.14",
"web-streams-polyfill": "^4.0.0"
},
+1
View File
@@ -27,6 +27,7 @@
* https://docs.rs/ssr_rs/latest/ssr_rs/struct.Ssr.html#method.add_global_fn
*/
import 'fast-text-encoding'
import 'url-search-params-polyfill'
/* eslint-disable import/order, import/newline-after-import */
import { MessageChannelPolyfill } from './polyfills/MessageChannel'
+8
View File
@@ -223,6 +223,9 @@ importers:
tuono-router:
specifier: workspace:*
version: link:../tuono-router
url-search-params-polyfill:
specifier: ^8.2.5
version: 8.2.5
vite:
specifier: ^5.4.14
version: 5.4.14(@types/node@22.13.1)(lightningcss@1.29.1)(sugarss@4.0.1(postcss@8.5.1))
@@ -3256,6 +3259,9 @@ packages:
uri-js@4.4.1:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
url-search-params-polyfill@8.2.5:
resolution: {integrity: sha512-FOEojW4XReTmtZOB7xqSHmJZhrNTmClhBriwLTmle4iA7bwuCo6ldSfbtsFSb8bTf3E0a3XpfonAdaur9vqq8A==}
use-callback-ref@1.3.3:
resolution: {integrity: sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg==}
engines: {node: '>=10'}
@@ -7020,6 +7026,8 @@ snapshots:
dependencies:
punycode: 2.3.1
url-search-params-polyfill@8.2.5: {}
use-callback-ref@1.3.3(@types/react@19.0.8)(react@19.0.0):
dependencies:
react: 19.0.0