nitro-nightly 3.0.1-20251218-210030-3992c731 → 3.0.1-20251219-124228-00598a8a
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/_nitro.mjs +6 -4
- package/dist/types/index.d.mts +1 -1
- package/package.json +1 -1
package/dist/_nitro.mjs
CHANGED
|
@@ -814,15 +814,17 @@ var Router = class {
|
|
|
814
814
|
return this._routes.length > 0;
|
|
815
815
|
}
|
|
816
816
|
compileToString(opts) {
|
|
817
|
-
|
|
818
|
-
this._compiled
|
|
817
|
+
const key = opts ? hash(opts) : "";
|
|
818
|
+
this._compiled ||= {};
|
|
819
|
+
if (this._compiled[key]) return this._compiled[key];
|
|
820
|
+
this._compiled[key] = compileRouterToString(this._router, void 0, opts);
|
|
819
821
|
if (this.routes.length === 1 && this.routes[0].route === "/**" && this.routes[0].method === "") {
|
|
820
822
|
const data = (opts?.serialize || JSON.stringify)(this.routes[0].data);
|
|
821
823
|
let retCode = `{data,params:{"_":p.slice(1)}}`;
|
|
822
824
|
if (opts?.matchAll) retCode = `[${retCode}]`;
|
|
823
|
-
this._compiled = `/* @__PURE__ */ (() => {const data=${data};return ((_m, p)=>{return ${retCode};})})()`;
|
|
825
|
+
this._compiled[key] = `/* @__PURE__ */ (() => {const data=${data};return ((_m, p)=>{return ${retCode};})})()`;
|
|
824
826
|
}
|
|
825
|
-
return this._compiled;
|
|
827
|
+
return this._compiled[key];
|
|
826
828
|
}
|
|
827
829
|
match(method, path) {
|
|
828
830
|
return findRoute(this._router, method, path)?.data;
|
package/dist/types/index.d.mts
CHANGED
|
@@ -2561,7 +2561,7 @@ interface Route<T = unknown> {
|
|
|
2561
2561
|
declare class Router<T> {
|
|
2562
2562
|
_routes?: Route<T>[];
|
|
2563
2563
|
_router?: RouterContext<T>;
|
|
2564
|
-
_compiled?: string
|
|
2564
|
+
_compiled?: Record<string, string>;
|
|
2565
2565
|
_baseURL: string;
|
|
2566
2566
|
constructor(baseURL?: string);
|
|
2567
2567
|
get routes(): Route<T>[];
|
package/package.json
CHANGED