one 1.1.323 → 1.1.325
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/createHandleRequest.cjs +2 -1
- package/dist/cjs/createHandleRequest.js +2 -1
- package/dist/cjs/createHandleRequest.js.map +1 -1
- package/dist/cjs/createHandleRequest.native.js +2 -1
- package/dist/cjs/createHandleRequest.native.js.map +2 -2
- package/dist/esm/createHandleRequest.js +2 -1
- package/dist/esm/createHandleRequest.js.map +1 -1
- package/dist/esm/createHandleRequest.mjs +2 -1
- package/dist/esm/createHandleRequest.mjs.map +1 -1
- package/dist/esm/createHandleRequest.native.js +2 -1
- package/dist/esm/createHandleRequest.native.js.map +2 -2
- package/package.json +8 -8
- package/src/createHandleRequest.ts +6 -2
- package/src/types.ts +1 -0
- package/types/createHandleRequest.d.ts +2 -4
- package/types/createHandleRequest.d.ts.map +1 -1
- package/types/types.d.ts +1 -0
- package/types/types.d.ts.map +1 -1
@@ -88,6 +88,7 @@ function createHandleRequest(options, handlers) {
|
|
88
88
|
url,
|
89
89
|
loaderProps: {
|
90
90
|
path: finalUrl.pathname,
|
91
|
+
request: route.type === "ssr" ? request : void 0,
|
91
92
|
params: getLoaderParams(finalUrl, route)
|
92
93
|
}
|
93
94
|
});
|
@@ -146,5 +147,5 @@ function getLoaderParams(url, config) {
|
|
146
147
|
}
|
147
148
|
function getRouteParams(pathname, route) {
|
148
149
|
const match = new RegExp(route.namedRegex).exec(pathname);
|
149
|
-
return match ? Object.fromEntries(Object.entries(route.routeKeys).map(([key, value]) => [value, match.groups?.[key]])) : {};
|
150
|
+
return match ? Object.fromEntries(Object.entries(route.routeKeys).map(([key, value]) => [value, match.groups?.[key] || ""])) : {};
|
150
151
|
}
|
@@ -75,6 +75,7 @@ function createHandleRequest(options, handlers) {
|
|
75
75
|
url,
|
76
76
|
loaderProps: {
|
77
77
|
path: finalUrl.pathname,
|
78
|
+
request: route.type === "ssr" ? request : void 0,
|
78
79
|
params: getLoaderParams(finalUrl, route)
|
79
80
|
}
|
80
81
|
});
|
@@ -132,7 +133,7 @@ function getLoaderParams(url, config) {
|
|
132
133
|
function getRouteParams(pathname, route) {
|
133
134
|
const match = new RegExp(route.namedRegex).exec(pathname);
|
134
135
|
return match ? Object.fromEntries(
|
135
|
-
Object.entries(route.routeKeys).map(([key, value]) => [value, match.groups?.[key]])
|
136
|
+
Object.entries(route.routeKeys).map(([key, value]) => [value, match.groups?.[key] || ""])
|
136
137
|
) : {};
|
137
138
|
}
|
138
139
|
//# sourceMappingURL=createHandleRequest.js.map
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/createHandleRequest.ts"],
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAsC,uBACtC,mBAAoE,
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAsC,uBACtC,mBAAoE,wBAGpE,oBAA2B,+BAC3B,8BAAqC,yCACrC,qBAA4B;AAYrB,SAAS,oBACd,SACA,UAKA;AACA,QAAM,eAAW,gCAAY;AAC7B,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,oBAAoB;AAGtC,QAAM,eACJ,SAAS,UAAU,OAAO,CAAC,KAAK,SAC9B,IAAI,IAAI,IAAI,IAAI,EAAE,GAAG,KAAK,eAAe,IAAI,OAAO,IAAI,UAAU,EAAE,GAC7D,MACN,CAAC,CAAC,GAED,gBAAgB,OAAO,OAAO,YAAY,GAK1C,iBAAiB,CAAC,GAGlB,aAAa,SAAS,WAAW,IAAI,CAAC,WAAW;AAAA,IACrD,GAAG;AAAA,IACH,cAAc,IAAI,OAAO,MAAM,UAAU;AAAA,EAC3C,EAAE;AAEF,SAAO;AAAA,IACL;AAAA,IACA,SAAS,eAA6B,SAAmD;AACvF,YAAM,YAAY,QAAQ,OAAO,IAC3B,MAAM,IAAI;AAAA,QACd,aAAa;AAAA,QACb,QAAQ,QAAQ,IAAI,M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ACrC,aAAO,QAAQ,IAAI;AAAA,IACrB;AAEF,SAAO;AACT;AAGA,SAAS,eAAe,UAAkB,OAA0B;AAElE,QAAM,QADQ,IAAI,OAAO,MAAM,UAAU,EACrB,KAAK,QAAQ;AACjC,SAAK,QACE,OAAO;AAAA,IACZ,OAAO,QAAQ,MAAM,SAAS,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MACvC,CAAC,OAAQ,MAAM,SAAS,GAAG,KAAK,EAAa,CACrD;AAAA,EACH,IALmB,CAAC;AAMtB;",
|
5
5
|
"names": []
|
6
6
|
}
|
@@ -86,6 +86,7 @@ function createHandleRequest(options, handlers) {
|
|
86
86
|
url,
|
87
87
|
loaderProps: {
|
88
88
|
path: finalUrl.pathname,
|
89
|
+
request: route.type === "ssr" ? request : void 0,
|
89
90
|
params: getLoaderParams(finalUrl, route)
|
90
91
|
}
|
91
92
|
});
|
@@ -184,7 +185,7 @@ function getRouteParams(pathname, route) {
|
|
184
185
|
var [key, value] = param, _match_groups;
|
185
186
|
return [
|
186
187
|
value,
|
187
|
-
(_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups[key]
|
188
|
+
((_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups[key]) || ""
|
188
189
|
];
|
189
190
|
})) : {};
|
190
191
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/Users/n8/one/packages/one/src/createHandleRequest.ts"],
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;sBAAsC,uBACtC,mBAAoE,
|
5
|
-
"names": ["createHandleRequest", "options", "handlers", "manifest", "getManifest", "Error", "apiRoutesMap", "apiRoutes", "reduce", "acc", "cur", "page", "compiledRegex", "RegExp", "namedRegex", "apiRoutesList", "Object", "values", "activeRequests", "pageRoutes", "map", "route", "workingRegex", "handler", "request", "urlString", "url", "URL", "headers", "get", "pathname", "search", "process", "env", "NODE_ENV", "startsWith", "handleAPI", "apiRoute", "find", "regex", "test", "params", "getRouteParams", "loaderProps", "path", "err", "isResponse", "method", "handleLoader", "isClientRequestingNewRoute", "endsWith", "LOADER_JS_POSTFIX_UNCACHED", "originalUrl", "getPathFromLoaderPath", "finalUrl", "origin", "file", "console", "info", "Headers", "set", "loaderResponse", "getLoaderParams", "Response", "error", "routes", "handleSSR", "promise", "reject", "resolve", "promiseWithResolvers", "ssrResponse", "config", "match", "exec", "groups", "entries", "key", "value", "namedKey", "routeKeys", "fromEntries"]
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;sBAAsC,uBACtC,mBAAoE,wBAGpE,oBAA2B,+BAC3B,8BAAqC,yCACrC,qBAA4B;AAYrB,SAASA,oBACdC,SACAC,UAIC;AAED,MAAMC,eAAWC,gCAAAA;AACjB,MAAI,CAACD;AACH,UAAM,IAAIE,MAAM,oBAAoB;AAGtC,MAAMC,eACJH,SAASI,UAAUC,OAAO,SAACC,KAAKC,KAAAA;AAC9BD,eAAIC,IAAIC,IAAI,IAAI;MAAE,GAAGD;MAAKE,eAAe,IAAIC,OAAOH,IAAII,UAAU;IAAE,GAC7DL;EACT,GAAG,CAAC,CAAA,GAEAM,gBAAgBC,OAAOC,OAAOX,YAAAA,GAK9BY,iBAAiB,CAAC,GAGlBC,aAAahB,SAASgB,WAAWC,IAAI,SAACC,OAAAA;WAAW;MACrD,GAAGA;MACHC,cAAc,IAAIT,OAAOQ,MAAMP,UAAU;IAC3C;;AAEA,SAAO;IACLX;IACAoB,SAAS,eAA6BC,SAAgB;AACpD,UAAMC,YAAYD,QAAQE,OAAO,IAC3BA,MAAM,IAAIC,IACdF,aAAa,IACbD,QAAQI,QAAQC,IAAI,MAAA,IAAU,UAAUL,QAAQI,QAAQC,IAAI,MAAA,CAAA,KAAY,EAAA,GAEpE,EAAEC,UAAUC,OAAM,IAAKL;AAE7B,UAAIM,QAAQC,IAAIC,aAAa,gBACvBhB,eAAeY,QAAAA;AACjB,eAAO,MAAM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utes", "reduce", "acc", "cur", "page", "compiledRegex", "RegExp", "namedRegex", "apiRoutesList", "Object", "values", "activeRequests", "pageRoutes", "map", "route", "workingRegex", "handler", "request", "urlString", "url", "URL", "headers", "get", "pathname", "search", "process", "env", "NODE_ENV", "startsWith", "handleAPI", "apiRoute", "find", "regex", "test", "params", "getRouteParams", "loaderProps", "path", "err", "isResponse", "method", "handleLoader", "isClientRequestingNewRoute", "endsWith", "LOADER_JS_POSTFIX_UNCACHED", "originalUrl", "getPathFromLoaderPath", "finalUrl", "origin", "file", "console", "info", "Headers", "set", "loaderResponse", "type", "undefined", "getLoaderParams", "Response", "error", "routes", "handleSSR", "promise", "reject", "resolve", "promiseWithResolvers", "ssrResponse", "config", "match", "exec", "groups", "entries", "key", "value", "namedKey", "routeKeys", "fromEntries"]
|
6
6
|
}
|
@@ -60,6 +60,7 @@ function createHandleRequest(options, handlers) {
|
|
60
60
|
url,
|
61
61
|
loaderProps: {
|
62
62
|
path: finalUrl.pathname,
|
63
|
+
request: route.type === "ssr" ? request : void 0,
|
63
64
|
params: getLoaderParams(finalUrl, route)
|
64
65
|
}
|
65
66
|
});
|
@@ -117,7 +118,7 @@ function getLoaderParams(url, config) {
|
|
117
118
|
function getRouteParams(pathname, route) {
|
118
119
|
const match = new RegExp(route.namedRegex).exec(pathname);
|
119
120
|
return match ? Object.fromEntries(
|
120
|
-
Object.entries(route.routeKeys).map(([key, value]) => [value, match.groups?.[key]])
|
121
|
+
Object.entries(route.routeKeys).map(([key, value]) => [value, match.groups?.[key] || ""])
|
121
122
|
) : {};
|
122
123
|
}
|
123
124
|
export {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/createHandleRequest.ts"],
|
4
|
-
"mappings": "AAAA,SAAS,6BAA6B;AACtC,SAAkC,kCAAkC;
|
4
|
+
"mappings": "AAAA,SAAS,6BAA6B;AACtC,SAAkC,kCAAkC;AAGpE,SAAS,kBAAkB;AAC3B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K,QAAQ;AACnC;AAGF,kBAAM,cAAc,MAAM,SAAS,UAAU;AAAA,cAC3C;AAAA,cACA;AAAA,cACA;AAAA,cACA,aAAa;AAAA,gBACX,MAAM,WAAW;AAAA,gBACjB,QAAQ,gBAAgB,KAAK,KAAK;AAAA,cACpC;AAAA,YACF,CAAC;AAED,2BAAQ,WAAW,GACZ;AAAA,UACT;AAAA,QACF,SAAS,KAAK;AACZ,uBAAO,GAAG,GACJ;AAAA,QACR,UAAE;AACA,iBAAO,eAAe,QAAQ;AAAA,QAChC;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,SAAS,gBACP,KACA,QACA;AACA,QAAM,SAAiC,CAAC,GAClC,QAAQ,IAAI,OAAO,OAAO,YAAY,EAAE,KAAK,IAAI,QAAQ;AAC/D,MAAI,OAAO;AACT,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,MAAM,GAAG;AACvD,YAAM,WAAW,OAAO,UAAU,GAAG;AACrC,aAAO,QAAQ,IAAI;AAAA,IACrB;AAEF,SAAO;AACT;AAGA,SAAS,eAAe,UAAkB,OAA0B;AAElE,QAAM,QADQ,IAAI,OAAO,MAAM,UAAU,EACrB,KAAK,QAAQ;AACjC,SAAK,QACE,OAAO;AAAA,IACZ,OAAO,QAAQ,MAAM,SAAS,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MACvC,CAAC,OAAQ,MAAM,SAAS,GAAG,KAAK,EAAa,CACrD;AAAA,EACH,IALmB,CAAC;AAMtB;",
|
5
5
|
"names": []
|
6
6
|
}
|
@@ -63,6 +63,7 @@ function createHandleRequest(options, handlers) {
|
|
63
63
|
url,
|
64
64
|
loaderProps: {
|
65
65
|
path: finalUrl.pathname,
|
66
|
+
request: route.type === "ssr" ? request : void 0,
|
66
67
|
params: getLoaderParams(finalUrl, route)
|
67
68
|
}
|
68
69
|
});
|
@@ -121,7 +122,7 @@ function getLoaderParams(url, config) {
|
|
121
122
|
}
|
122
123
|
function getRouteParams(pathname, route) {
|
123
124
|
const match = new RegExp(route.namedRegex).exec(pathname);
|
124
|
-
return match ? Object.fromEntries(Object.entries(route.routeKeys).map(([key, value]) => [value, match.groups?.[key]])) : {};
|
125
|
+
return match ? Object.fromEntries(Object.entries(route.routeKeys).map(([key, value]) => [value, match.groups?.[key] || ""])) : {};
|
125
126
|
}
|
126
127
|
export { createHandleRequest };
|
127
128
|
//# sourceMappingURL=createHandleRequest.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getPathFromLoaderPath","LOADER_JS_POSTFIX_UNCACHED","isResponse","promiseWithResolvers","getManifest","createHandleRequest","options","handlers","manifest","Error","apiRoutesMap","apiRoutes","reduce","acc","cur","page","compiledRegex","RegExp","namedRegex","apiRoutesList","Object","values","activeRequests","pageRoutes","map","route","workingRegex","handler","request","urlString","url","URL","headers","get","pathname","search","process","env","NODE_ENV","startsWith","handleAPI","apiRoute","find","test","params","getRouteParams","loaderProps","path","err","method","handleLoader","endsWith","originalUrl","finalUrl","origin","file","console","info","Headers","set","loaderResponse","getLoaderParams","Response","error","routes","handleSSR","promise","reject","resolve","ssrResponse","config","match","exec","groups","key","value","entries","namedKey","routeKeys","fromEntries"],"sources":["../../src/createHandleRequest.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,qBAAA,QAA6B;AACtC,SAAkCC,0BAAA,QAAkC;
|
1
|
+
{"version":3,"names":["getPathFromLoaderPath","LOADER_JS_POSTFIX_UNCACHED","isResponse","promiseWithResolvers","getManifest","createHandleRequest","options","handlers","manifest","Error","apiRoutesMap","apiRoutes","reduce","acc","cur","page","compiledRegex","RegExp","namedRegex","apiRoutesList","Object","values","activeRequests","pageRoutes","map","route","workingRegex","handler","request","urlString","url","URL","headers","get","pathname","search","process","env","NODE_ENV","startsWith","handleAPI","apiRoute","find","test","params","getRouteParams","loaderProps","path","err","method","handleLoader","endsWith","originalUrl","finalUrl","origin","file","console","info","Headers","set","loaderResponse","type","getLoaderParams","Response","error","routes","handleSSR","promise","reject","resolve","ssrResponse","config","match","exec","groups","key","value","entries","namedKey","routeKeys","fromEntries"],"sources":["../../src/createHandleRequest.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,qBAAA,QAA6B;AACtC,SAAkCC,0BAAA,QAAkC;AAGpE,SAASC,UAAA,QAAkB;AAC3B,SAASC,oBAAA,QAA4B;AACrC,SAASC,WAAA,QAAmB;AAYrB,SAASC,oBACdC,OAAA,EACAC,QAAA,EAKA;EACA,MAAMC,QAAA,GAAWJ,WAAA,CAAY;EAC7B,IAAI,CAACI,QAAA,EACH,MAAM,IAAIC,KAAA,CAAM,oBAAoB;EAGtC,MAAMC,YAAA,GACJF,QAAA,CAASG,SAAA,CAAUC,MAAA,CAAO,CAACC,GAAA,EAAKC,GAAA,MAC9BD,GAAA,CAAIC,GAAA,CAAIC,IAAI,IAAI;MAAE,GAAGD,GAAA;MAAKE,aAAA,EAAe,IAAIC,MAAA,CAAOH,GAAA,CAAII,UAAU;IAAE,GAC7DL,GAAA,GACN,CAAC,CAAC;IAEDM,aAAA,GAAgBC,MAAA,CAAOC,MAAA,CAAOX,YAAY;IAK1CY,cAAA,GAAiB,CAAC;IAGlBC,UAAA,GAAaf,QAAA,CAASe,UAAA,CAAWC,GAAA,CAAKC,KAAA,KAAW;MACrD,GAAGA,KAAA;MACHC,YAAA,EAAc,IAAIT,MAAA,CAAOQ,KAAA,CAAMP,UAAU;IAC3C,EAAE;EAEF,OAAO;IACLV,QAAA;IACAmB,OAAA,EAAS,eAAAA,CAA6BC,OAAA,EAAmD;MACvF,MAAMC,SAAA,GAAYD,OAAA,CAAQE,GAAA,IAAO;QAC3BA,GAAA,GAAM,IAAIC,GAAA,CACdF,SAAA,IAAa,IACbD,OAAA,CAAQI,OAAA,CAAQC,GAAA,CAAI,MAAM,IAAI,UAAUL,OAAA,CAAQI,OAAA,CAAQC,GAAA,CAAI,MAAM,CAAC,KAAK,EAC1E;QACM;UAAEC,QAAA;UAAUC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AAa,CACrD,CACH,IALmB,CAAC;AAMtB","ignoreList":[]}
|
@@ -70,6 +70,7 @@ function createHandleRequest(options, handlers) {
|
|
70
70
|
url,
|
71
71
|
loaderProps: {
|
72
72
|
path: finalUrl.pathname,
|
73
|
+
request: route.type === "ssr" ? request : void 0,
|
73
74
|
params: getLoaderParams(finalUrl, route)
|
74
75
|
}
|
75
76
|
});
|
@@ -168,7 +169,7 @@ function getRouteParams(pathname, route) {
|
|
168
169
|
var [key, value] = param, _match_groups;
|
169
170
|
return [
|
170
171
|
value,
|
171
|
-
(_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups[key]
|
172
|
+
((_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups[key]) || ""
|
172
173
|
];
|
173
174
|
})) : {};
|
174
175
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/Users/n8/one/packages/one/src/createHandleRequest.ts"],
|
4
|
-
"mappings": "AAAA,SAASA,6BAA6B;AACtC,SAAkCC,kCAAkC;
|
5
|
-
"names": ["getPathFromLoaderPath", "LOADER_JS_POSTFIX_UNCACHED", "isResponse", "promiseWithResolvers", "getManifest", "createHandleRequest", "options", "handlers", "manifest", "Error", "apiRoutesMap", "apiRoutes", "reduce", "acc", "cur", "page", "compiledRegex", "RegExp", "namedRegex", "apiRoutesList", "Object", "values", "activeRequests", "pageRoutes", "map", "route", "workingRegex", "handler", "request", "urlString", "url", "URL", "headers", "get", "pathname", "search", "process", "env", "NODE_ENV", "startsWith", "handleAPI", "apiRoute", "find", "regex", "test", "params", "getRouteParams", "loaderProps", "path", "err", "method", "handleLoader", "isClientRequestingNewRoute", "endsWith", "originalUrl", "finalUrl", "origin", "file", "console", "info", "Headers", "set", "loaderResponse", "getLoaderParams", "Response", "error", "routes", "handleSSR", "promise", "reject", "resolve", "ssrResponse", "config", "match", "exec", "groups", "entries", "key", "value", "namedKey", "routeKeys", "fromEntries"]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,QAAQ;QACZ,4BAAA,IAAA,oBAAA,IAAA,iBAAA;;AAAL,eAAK,YAAsBzD,OAAO0D,QAAQH,MAAME,MAAM,EAAA,OAAA,QAAA,EAAA,GAAjD,OAAA,EAAA,6BAAA,QAAA,UAAA,KAAA,GAAA,OAAA,4BAAA,IAAoD;AAApD,YAAM,CAACE,KAAKC,KAAAA,IAAZ,MAAA,OACGC,WAAWP,OAAOQ,UAAUH,GAAAA;AAClClC,eAAOoC,QAAAA,IAAYD;MACrB;;AAHK,0BAAA,IAAA,iBAAA;;;SAAA,6BAAA,UAAA,UAAA,QAAA,UAAA,OAAA;;YAAA;gBAAA;;;EAIP;AACA,SAAOnC;AACT;AAGA,SAASC,eAAeZ,UAAkBT,OAAwB;AAChE,MAAMkB,QAAQ,IAAI1B,OAAOQ,MAAMP,UAAU,GACnCyD,QAAQhC,MAAMiC,KAAK1C,QAAAA;AACzB,SAAKyC,QACEvD,OAAO+D,YACZ/D,OAAO0D,QAAQrD,MAAMyD,SAAS,EAAE1D,IAAI,SAAA,OAAA;QAAC,CAACuD,KAAKC,KAAAA,IAAM,OAC/BL;AAAhB,WAAO;MAACK;QAAQL,gBAAAA,MAAME,YAAM,QAAZF,kBAAAA,SAAAA,SAAAA,cAAeI,GAAAA,MAAQ;;EACzC,CAAA,CAAA,IAJiB,CAAC;AAMtB;",
|
5
|
+
"names": ["getPathFromLoaderPath", "LOADER_JS_POSTFIX_UNCACHED", "isResponse", "promiseWithResolvers", "getManifest", "createHandleRequest", "options", "handlers", "manifest", "Error", "apiRoutesMap", "apiRoutes", "reduce", "acc", "cur", "page", "compiledRegex", "RegExp", "namedRegex", "apiRoutesList", "Object", "values", "activeRequests", "pageRoutes", "map", "route", "workingRegex", "handler", "request", "urlString", "url", "URL", "headers", "get", "pathname", "search", "process", "env", "NODE_ENV", "startsWith", "handleAPI", "apiRoute", "find", "regex", "test", "params", "getRouteParams", "loaderProps", "path", "err", "method", "handleLoader", "isClientRequestingNewRoute", "endsWith", "originalUrl", "finalUrl", "origin", "file", "console", "info", "Headers", "set", "loaderResponse", "type", "undefined", "getLoaderParams", "Response", "error", "routes", "handleSSR", "promise", "reject", "resolve", "ssrResponse", "config", "match", "exec", "groups", "entries", "key", "value", "namedKey", "routeKeys", "fromEntries"]
|
6
6
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "one",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.325",
|
4
4
|
"source": "src/index.ts",
|
5
5
|
"types": "./types/index.d.ts",
|
6
6
|
"sideEffects": false,
|
@@ -91,14 +91,14 @@
|
|
91
91
|
"@react-navigation/native-stack": "~6.9.13",
|
92
92
|
"@react-navigation/routers": "~6.1.9",
|
93
93
|
"@ungap/structured-clone": "^1.2.0",
|
94
|
-
"@vxrn/resolve": "1.1.
|
95
|
-
"@vxrn/tslib-lite": "1.1.
|
96
|
-
"@vxrn/universal-color-scheme": "1.1.
|
97
|
-
"@vxrn/use-isomorphic-layout-effect": "1.1.
|
94
|
+
"@vxrn/resolve": "1.1.325",
|
95
|
+
"@vxrn/tslib-lite": "1.1.325",
|
96
|
+
"@vxrn/universal-color-scheme": "1.1.325",
|
97
|
+
"@vxrn/use-isomorphic-layout-effect": "1.1.325",
|
98
98
|
"babel-dead-code-elimination": "^1.0.6",
|
99
99
|
"citty": "^0.1.6",
|
100
100
|
"core-js": "^3.38.1",
|
101
|
-
"create-vxrn": "1.1.
|
101
|
+
"create-vxrn": "1.1.325",
|
102
102
|
"escape-string-regexp": "^5.0.0",
|
103
103
|
"expo-linking": "~6.3.1",
|
104
104
|
"expo-modules-core": "^1.12.24",
|
@@ -120,7 +120,7 @@
|
|
120
120
|
"url-parse": "^1.5.10",
|
121
121
|
"vite": "6.0.0-beta.1",
|
122
122
|
"vite-tsconfig-paths": "^5.0.1",
|
123
|
-
"vxrn": "1.1.
|
123
|
+
"vxrn": "1.1.325",
|
124
124
|
"ws": "^8.18.0",
|
125
125
|
"xxhashjs": "^0.2.2"
|
126
126
|
},
|
@@ -128,7 +128,7 @@
|
|
128
128
|
"react-native": "*"
|
129
129
|
},
|
130
130
|
"devDependencies": {
|
131
|
-
"@tamagui/build": "^1.116.
|
131
|
+
"@tamagui/build": "^1.116.7",
|
132
132
|
"@types/node": "^22.1.0",
|
133
133
|
"@types/react-dom": "^18.2.25",
|
134
134
|
"@types/url-parse": "^1.4.11",
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { getPathFromLoaderPath } from './cleanUrl'
|
2
2
|
import { LOADER_JS_POSTFIX_REGEX, LOADER_JS_POSTFIX_UNCACHED } from './constants'
|
3
3
|
import type { RouteInfo } from './server/createRoutesManifest'
|
4
|
+
import type { LoaderProps } from './types'
|
4
5
|
import { isResponse } from './utils/isResponse'
|
5
6
|
import { promiseWithResolvers } from './utils/promiseWithResolvers'
|
6
7
|
import { getManifest } from './vite/getManifest'
|
@@ -10,7 +11,7 @@ type RequestHandlerProps<RouteExtraProps extends Object = {}> = {
|
|
10
11
|
request: Request
|
11
12
|
route: RouteInfo<string> & RouteExtraProps
|
12
13
|
url: URL
|
13
|
-
loaderProps?:
|
14
|
+
loaderProps?: LoaderProps
|
14
15
|
}
|
15
16
|
|
16
17
|
type RequestHandlerResponse = null | string | Response
|
@@ -132,6 +133,7 @@ export function createHandleRequest(
|
|
132
133
|
url,
|
133
134
|
loaderProps: {
|
134
135
|
path: finalUrl.pathname,
|
136
|
+
request: route.type === 'ssr' ? request : undefined,
|
135
137
|
params: getLoaderParams(finalUrl, route),
|
136
138
|
},
|
137
139
|
})
|
@@ -223,6 +225,8 @@ function getRouteParams(pathname: string, route: RouteInfo<string>) {
|
|
223
225
|
const match = regex.exec(pathname)
|
224
226
|
if (!match) return {}
|
225
227
|
return Object.fromEntries(
|
226
|
-
Object.entries(route.routeKeys).map(([key, value]) =>
|
228
|
+
Object.entries(route.routeKeys).map(([key, value]) => {
|
229
|
+
return [value, (match.groups?.[key] || '') as string]
|
230
|
+
})
|
227
231
|
)
|
228
232
|
}
|
package/src/types.ts
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
import type { RouteInfo } from './server/createRoutesManifest';
|
2
|
+
import type { LoaderProps } from './types';
|
2
3
|
import type { One } from './vite/types';
|
3
4
|
type RequestHandlerProps<RouteExtraProps extends Object = {}> = {
|
4
5
|
request: Request;
|
5
6
|
route: RouteInfo<string> & RouteExtraProps;
|
6
7
|
url: URL;
|
7
|
-
loaderProps?:
|
8
|
-
path: string;
|
9
|
-
params: Record<string, any>;
|
10
|
-
};
|
8
|
+
loaderProps?: LoaderProps;
|
11
9
|
};
|
12
10
|
type RequestHandlerResponse = null | string | Response;
|
13
11
|
export declare function createHandleRequest(options: One.PluginOptions, handlers: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createHandleRequest.d.ts","sourceRoot":"","sources":["../src/createHandleRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;
|
1
|
+
{"version":3,"file":"createHandleRequest.d.ts","sourceRoot":"","sources":["../src/createHandleRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAI1C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEvC,KAAK,mBAAmB,CAAC,eAAe,SAAS,MAAM,GAAG,EAAE,IAAI;IAC9D,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,eAAe,CAAA;IAC1C,GAAG,EAAE,GAAG,CAAA;IACR,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAA;AAED,KAAK,sBAAsB,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEtD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,GAAG,CAAC,aAAa,EAC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