@absolutejs/absolute 0.19.0-beta.951 → 0.19.0-beta.952

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.
@@ -101,11 +101,22 @@ var init_constants = __esm(() => {
101
101
  var exports_devRouteRegistrationCallsite = {};
102
102
  __export(exports_devRouteRegistrationCallsite, {
103
103
  patchElysiaRouteRegistrationCallsites: () => patchElysiaRouteRegistrationCallsites,
104
+ isPageHandler: () => isPageHandler,
104
105
  getCurrentRouteRegistrationCallsite: () => getCurrentRouteRegistrationCallsite
105
106
  });
106
107
  import { AsyncLocalStorage } from "async_hooks";
107
108
  import { Elysia } from "elysia";
108
- var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES, isObjectRecord3 = (value) => Boolean(value) && typeof value === "object", isAsyncLocalStorage2 = (value) => isObjectRecord3(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function", isRouteMethod = (value) => typeof value === "function", getRouteCallsiteStorage = () => {
109
+ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES, PAGE_HANDLER_NAMES, pageHandlerWrappers, handlerSourceMentionsPageHelper = (handler) => {
110
+ const source = handler.toString();
111
+ return PAGE_HANDLER_NAMES.some((name) => source.includes(name));
112
+ }, isPageHandler = (handler) => {
113
+ if (typeof handler !== "function")
114
+ return false;
115
+ const fn = handler;
116
+ if (pageHandlerWrappers.has(fn))
117
+ return true;
118
+ return handlerSourceMentionsPageHelper(fn);
119
+ }, isObjectRecord3 = (value) => Boolean(value) && typeof value === "object", isAsyncLocalStorage2 = (value) => isObjectRecord3(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function", isRouteMethod = (value) => typeof value === "function", getRouteCallsiteStorage = () => {
109
120
  const value = Reflect.get(globalThis, ROUTE_CALLSITE_STORAGE_KEY);
110
121
  if (value === null || typeof value === "undefined") {
111
122
  return;
@@ -138,13 +149,13 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
138
149
  return function wrappedRouteHandler(...args) {
139
150
  return storage.run({ callsite }, () => Reflect.apply(routeHandler, this, args));
140
151
  };
141
- }, createPatchedRouteMethod = (originalMethod) => function patchedRouteMethod(path, handler, ...rest) {
152
+ }, createPatchedRouteMethod = (originalMethod, methodName) => function patchedRouteMethod(path, handler, ...rest) {
142
153
  const callsite = captureRouteRegistrationCallsite();
143
- return Reflect.apply(originalMethod, this, [
144
- path,
145
- wrapRouteHandlerWithCallsite(handler, callsite),
146
- ...rest
147
- ]);
154
+ const wrapped = wrapRouteHandlerWithCallsite(handler, callsite);
155
+ if (methodName === "get" && typeof handler === "function" && typeof wrapped === "function" && handlerSourceMentionsPageHelper(handler)) {
156
+ pageHandlerWrappers.add(wrapped);
157
+ }
158
+ return Reflect.apply(originalMethod, this, [path, wrapped, ...rest]);
148
159
  }, getCurrentRouteRegistrationCallsite = () => getRouteCallsiteStorage()?.getStore()?.callsite, patchElysiaRouteRegistrationCallsites = () => {
149
160
  if (false) {}
150
161
  if (Reflect.get(globalThis, ROUTE_CALLSITE_PATCHED_KEY) === true) {
@@ -155,7 +166,7 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
155
166
  const originalMethod = Reflect.get(prototype, methodName);
156
167
  if (!isRouteMethod(originalMethod))
157
168
  return;
158
- Reflect.set(prototype, methodName, createPatchedRouteMethod(originalMethod));
169
+ Reflect.set(prototype, methodName, createPatchedRouteMethod(originalMethod, methodName));
159
170
  });
160
171
  Reflect.set(globalThis, ROUTE_CALLSITE_PATCHED_KEY, true);
161
172
  };
@@ -172,6 +183,15 @@ var init_devRouteRegistrationCallsite = __esm(() => {
172
183
  "post",
173
184
  "put"
174
185
  ];
186
+ PAGE_HANDLER_NAMES = [
187
+ "handleReactPageRequest",
188
+ "handleSveltePageRequest",
189
+ "handleVuePageRequest",
190
+ "handleAngularPageRequest",
191
+ "handleHTMLPageRequest",
192
+ "handleHTMXPageRequest"
193
+ ];
194
+ pageHandlerWrappers = new WeakSet;
175
195
  });
176
196
 
177
197
  // src/client/streamSwap.ts
@@ -3929,5 +3949,5 @@ export {
3929
3949
  Island
3930
3950
  };
3931
3951
 
3932
- //# debugId=5EB00940C079771B64756E2164756E21
3952
+ //# debugId=3D9D414A2A9D33D964756E2164756E21
3933
3953
  //# sourceMappingURL=index.js.map