@finesoft/front 0.1.70 → 0.1.71
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/index.mjs +6 -7
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -679,6 +679,9 @@ function makeDependencies(container, options = {}) {
|
|
|
679
679
|
/**
|
|
680
680
|
* URL 路由器 — URL pattern → Intent + FlowAction
|
|
681
681
|
*/
|
|
682
|
+
function createNullPrototypeRecord(source) {
|
|
683
|
+
return Object.assign(Object.create(null), source);
|
|
684
|
+
}
|
|
682
685
|
var Router = class {
|
|
683
686
|
routes = [];
|
|
684
687
|
/** 添加路由规则 */
|
|
@@ -711,12 +714,11 @@ var Router = class {
|
|
|
711
714
|
for (const route of this.routes) {
|
|
712
715
|
const match = path.match(route.regex);
|
|
713
716
|
if (match) {
|
|
714
|
-
const params =
|
|
717
|
+
const params = createNullPrototypeRecord(queryParams);
|
|
715
718
|
route.paramNames.forEach((name, index) => {
|
|
716
719
|
const value = match[index + 1];
|
|
717
720
|
if (value) params[name] = value;
|
|
718
721
|
});
|
|
719
|
-
for (const [k, v] of Object.entries(queryParams)) if (!(k in params)) params[k] = v;
|
|
720
722
|
return {
|
|
721
723
|
intent: {
|
|
722
724
|
id: route.intentId,
|
|
@@ -738,10 +740,7 @@ var Router = class {
|
|
|
738
740
|
parseUrl(url) {
|
|
739
741
|
try {
|
|
740
742
|
const parsed = new URL(url, "http://localhost");
|
|
741
|
-
const params = Object.
|
|
742
|
-
parsed.searchParams.forEach((v, k) => {
|
|
743
|
-
params[k] = v;
|
|
744
|
-
});
|
|
743
|
+
const params = createNullPrototypeRecord(Object.fromEntries(parsed.searchParams));
|
|
745
744
|
return {
|
|
746
745
|
path: parsed.pathname,
|
|
747
746
|
queryParams: params
|
|
@@ -749,7 +748,7 @@ var Router = class {
|
|
|
749
748
|
} catch {
|
|
750
749
|
return {
|
|
751
750
|
path: url.split("?")[0].split("#")[0],
|
|
752
|
-
queryParams:
|
|
751
|
+
queryParams: createNullPrototypeRecord()
|
|
753
752
|
};
|
|
754
753
|
}
|
|
755
754
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finesoft/front",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.71",
|
|
4
4
|
"description": "Full-stack framework: router, DI, actions, SSR, and server — all in one package",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@hono/node-server": "^1.
|
|
23
|
+
"@hono/node-server": "^1.19.13",
|
|
24
24
|
"@types/node": "^22",
|
|
25
25
|
"dotenv": "^17.3.1",
|
|
26
|
-
"hono": "^4.
|
|
26
|
+
"hono": "^4.12.12",
|
|
27
27
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.16",
|
|
28
28
|
"vite-plus": "0.1.16"
|
|
29
29
|
},
|