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

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.
@@ -1066,11 +1066,22 @@ var init_svelteServerModule = __esm(() => {
1066
1066
  var exports_devRouteRegistrationCallsite = {};
1067
1067
  __export(exports_devRouteRegistrationCallsite, {
1068
1068
  patchElysiaRouteRegistrationCallsites: () => patchElysiaRouteRegistrationCallsites,
1069
+ isPageHandler: () => isPageHandler,
1069
1070
  getCurrentRouteRegistrationCallsite: () => getCurrentRouteRegistrationCallsite
1070
1071
  });
1071
1072
  import { AsyncLocalStorage } from "async_hooks";
1072
1073
  import { Elysia } from "elysia";
1073
- 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 = () => {
1074
+ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES, PAGE_HANDLER_NAMES, pageHandlerWrappers, handlerSourceMentionsPageHelper = (handler) => {
1075
+ const source = handler.toString();
1076
+ return PAGE_HANDLER_NAMES.some((name) => source.includes(name));
1077
+ }, isPageHandler = (handler) => {
1078
+ if (typeof handler !== "function")
1079
+ return false;
1080
+ const fn = handler;
1081
+ if (pageHandlerWrappers.has(fn))
1082
+ return true;
1083
+ return handlerSourceMentionsPageHelper(fn);
1084
+ }, 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 = () => {
1074
1085
  const value = Reflect.get(globalThis, ROUTE_CALLSITE_STORAGE_KEY);
1075
1086
  if (value === null || typeof value === "undefined") {
1076
1087
  return;
@@ -1103,13 +1114,13 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
1103
1114
  return function wrappedRouteHandler(...args) {
1104
1115
  return storage.run({ callsite }, () => Reflect.apply(routeHandler, this, args));
1105
1116
  };
1106
- }, createPatchedRouteMethod = (originalMethod) => function patchedRouteMethod(path, handler, ...rest) {
1117
+ }, createPatchedRouteMethod = (originalMethod, methodName) => function patchedRouteMethod(path, handler, ...rest) {
1107
1118
  const callsite = captureRouteRegistrationCallsite();
1108
- return Reflect.apply(originalMethod, this, [
1109
- path,
1110
- wrapRouteHandlerWithCallsite(handler, callsite),
1111
- ...rest
1112
- ]);
1119
+ const wrapped = wrapRouteHandlerWithCallsite(handler, callsite);
1120
+ if (methodName === "get" && typeof handler === "function" && typeof wrapped === "function" && handlerSourceMentionsPageHelper(handler)) {
1121
+ pageHandlerWrappers.add(wrapped);
1122
+ }
1123
+ return Reflect.apply(originalMethod, this, [path, wrapped, ...rest]);
1113
1124
  }, getCurrentRouteRegistrationCallsite = () => getRouteCallsiteStorage()?.getStore()?.callsite, patchElysiaRouteRegistrationCallsites = () => {
1114
1125
  if (false) {}
1115
1126
  if (Reflect.get(globalThis, ROUTE_CALLSITE_PATCHED_KEY) === true) {
@@ -1120,7 +1131,7 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
1120
1131
  const originalMethod = Reflect.get(prototype, methodName);
1121
1132
  if (!isRouteMethod(originalMethod))
1122
1133
  return;
1123
- Reflect.set(prototype, methodName, createPatchedRouteMethod(originalMethod));
1134
+ Reflect.set(prototype, methodName, createPatchedRouteMethod(originalMethod, methodName));
1124
1135
  });
1125
1136
  Reflect.set(globalThis, ROUTE_CALLSITE_PATCHED_KEY, true);
1126
1137
  };
@@ -1137,6 +1148,15 @@ var init_devRouteRegistrationCallsite = __esm(() => {
1137
1148
  "post",
1138
1149
  "put"
1139
1150
  ];
1151
+ PAGE_HANDLER_NAMES = [
1152
+ "handleReactPageRequest",
1153
+ "handleSveltePageRequest",
1154
+ "handleVuePageRequest",
1155
+ "handleAngularPageRequest",
1156
+ "handleHTMLPageRequest",
1157
+ "handleHTMXPageRequest"
1158
+ ];
1159
+ pageHandlerWrappers = new WeakSet;
1140
1160
  });
1141
1161
 
1142
1162
  // src/client/streamSwap.ts
@@ -2925,5 +2945,5 @@ export {
2925
2945
  handleSveltePageRequest
2926
2946
  };
2927
2947
 
2928
- //# debugId=1F5B3F98B980146C64756E2164756E21
2948
+ //# debugId=01E383F10C97E15164756E2164756E21
2929
2949
  //# sourceMappingURL=server.js.map