@absolutejs/absolute 0.19.0-beta.954 → 0.19.0-beta.956

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.
@@ -12,6 +12,10 @@ export type ReactPageRequestInput<Props extends Record<string, unknown> = Record
12
12
  * threading the URL by hand. User-supplied `props.url` (if present)
13
13
  * takes precedence — the auto-injection only fills in when missing. */
14
14
  request?: Request;
15
+ /** Sitemap metadata for this route. Statically read from the handler
16
+ * source at registration time, so only literal-object values are
17
+ * honoured. */
18
+ sitemap?: import('../../types/sitemap').PageHandlerSitemapMetadata;
15
19
  } & (keyof Props extends never ? {
16
20
  props?: NoInfer<Props>;
17
21
  } : {
@@ -0,0 +1,7 @@
1
+ import type { SpaHost } from '../utils/spaRouteTypes';
2
+ /** Statically scan a React page-source directory for SPA hosts —
3
+ * files that call `createBrowserRouter(routes, { basename })` from
4
+ * `react-router-dom`. The first argument supplies the routes (inline
5
+ * array or identifier reference), the second arg's `basename`
6
+ * supplies the mount path. */
7
+ export declare const analyzeReactSpaRoutes: (reactDirectory: string) => Promise<SpaHost[]>;
@@ -15,6 +15,10 @@ export type SveltePageRequestInput<Component extends SvelteComponent<never> = Sv
15
15
  * `<Router url={url}>` without the caller threading it by hand.
16
16
  * User-supplied `props.url` (if present) takes precedence. */
17
17
  request?: Request;
18
+ /** Sitemap metadata for this route. Statically read from the handler
19
+ * source at registration time, so only literal-object values are
20
+ * honoured. */
21
+ sitemap?: import('../../types/sitemap').PageHandlerSitemapMetadata;
18
22
  } & (HasNoSvelteProps<SveltePropsOf<Component>> extends true ? {
19
23
  props?: NoInfer<SveltePropsOf<Component>>;
20
24
  } : {
@@ -0,0 +1,7 @@
1
+ import type { SpaHost } from '../utils/spaRouteTypes';
2
+ /** Statically scan a Svelte page-source directory for SPA hosts —
3
+ * `.svelte` files that contain a `<Router basepath="...">` block from
4
+ * AbsoluteJS's Svelte router with one or more `<Route path="...">`
5
+ * children. Regex-based since `.svelte` files aren't directly TS-AST
6
+ * parseable; covers the common case where the markup is literal. */
7
+ export declare const analyzeSvelteSpaRoutes: (svelteDirectory: string) => Promise<SpaHost[]>;
@@ -6,6 +6,9 @@ type AppRoute = {
6
6
  };
7
7
  export type SitemapPipelineConfig = {
8
8
  angularDirectory?: string;
9
+ reactDirectory?: string;
10
+ svelteDirectory?: string;
11
+ vueDirectory?: string;
9
12
  };
10
13
  export declare const generateSitemap: (routes: AppRoute[], serverUrl: string, outDir: string, config?: SitemapConfig, pipelineConfig?: SitemapPipelineConfig) => Promise<void>;
11
14
  export {};
@@ -0,0 +1,25 @@
1
+ export type SpaRoute = {
2
+ /** Full joined path within the SPA (no mount-path prefix). */
3
+ path: string;
4
+ /** `true` when any segment is `:param`, `*`, or `**`. */
5
+ dynamic: boolean;
6
+ /** `true` when this route is purely a `redirectTo` — sitemap skips. */
7
+ redirected: boolean;
8
+ /** `true` when an explicit opt-out marker was found
9
+ * (`Route.data.sitemap === 'exclude'` in Angular, etc.). */
10
+ sitemapExcluded: boolean;
11
+ };
12
+ export type SpaHost = {
13
+ /** Absolute path of the source file the routes were read from. */
14
+ sourceFile: string;
15
+ /** Mount path the page expects to be served at — e.g. `'/portal/'`,
16
+ * `'/admin/'`. Frameworks express this differently:
17
+ * - Angular: `{ provide: APP_BASE_HREF, useValue: '...' }`
18
+ * - React: `<BrowserRouter basename="...">` or
19
+ * `createBrowserRouter(routes, { basename: '...' })`
20
+ * - Vue: `createRouter({ history: createWebHistory('...') })`
21
+ * - Svelte: `<Router basepath="...">` */
22
+ baseHref: string;
23
+ /** Leaf routes extracted from the page's router config. */
24
+ routes: SpaRoute[];
25
+ };
@@ -22,6 +22,10 @@ export type VuePageRequestInput<Component extends VueComponent> = VuePageRenderO
22
22
  * (see compileVue's index generation) so plugins like
23
23
  * vue-router can navigate to the correct route before SSR. */
24
24
  request?: Request;
25
+ /** Sitemap metadata for this route. Statically read from the
26
+ * handler source at registration time, so only literal-object
27
+ * values are honoured. */
28
+ sitemap?: import('../../types/sitemap').PageHandlerSitemapMetadata;
25
29
  } & (keyof VuePropsOf<Component> extends never ? {
26
30
  props?: NoInfer<VuePropsOf<Component>>;
27
31
  } : {
@@ -0,0 +1,7 @@
1
+ import type { SpaHost } from '../utils/spaRouteTypes';
2
+ /** Statically scan a Vue page-source directory for SPA hosts — files
3
+ * that call `createRouter({ history: createWebHistory('/...'), routes })`
4
+ * from `vue-router`. The `createWebHistory` argument supplies the mount
5
+ * path; the `routes` option supplies the route table (inline array or
6
+ * identifier reference). Scans `.vue` SFC script blocks too. */
7
+ export declare const analyzeVueSpaRoutes: (vueDirectory: string) => Promise<SpaHost[]>;
@@ -1067,6 +1067,7 @@ var exports_devRouteRegistrationCallsite = {};
1067
1067
  __export(exports_devRouteRegistrationCallsite, {
1068
1068
  patchElysiaRouteRegistrationCallsites: () => patchElysiaRouteRegistrationCallsites,
1069
1069
  isPageHandler: () => isPageHandler,
1070
+ getOriginalPageHandlerSource: () => getOriginalPageHandlerSource,
1070
1071
  getCurrentRouteRegistrationCallsite: () => getCurrentRouteRegistrationCallsite
1071
1072
  });
1072
1073
  import { AsyncLocalStorage } from "async_hooks";
@@ -1081,6 +1082,12 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
1081
1082
  if (pageHandlerWrappers.has(fn))
1082
1083
  return true;
1083
1084
  return handlerSourceMentionsPageHelper(fn);
1085
+ }, getOriginalPageHandlerSource = (handler) => {
1086
+ if (typeof handler !== "function")
1087
+ return;
1088
+ const fn = handler;
1089
+ const info = pageHandlerWrappers.get(fn);
1090
+ return (info?.originalHandler ?? fn).toString();
1084
1091
  }, 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 = () => {
1085
1092
  const value = Reflect.get(globalThis, ROUTE_CALLSITE_STORAGE_KEY);
1086
1093
  if (value === null || typeof value === "undefined") {
@@ -1118,7 +1125,9 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
1118
1125
  const callsite = captureRouteRegistrationCallsite();
1119
1126
  const wrapped = wrapRouteHandlerWithCallsite(handler, callsite);
1120
1127
  if (methodName === "get" && typeof handler === "function" && typeof wrapped === "function" && handlerSourceMentionsPageHelper(handler)) {
1121
- pageHandlerWrappers.add(wrapped);
1128
+ pageHandlerWrappers.set(wrapped, {
1129
+ originalHandler: handler
1130
+ });
1122
1131
  }
1123
1132
  return Reflect.apply(originalMethod, this, [path, wrapped, ...rest]);
1124
1133
  }, getCurrentRouteRegistrationCallsite = () => getRouteCallsiteStorage()?.getStore()?.callsite, patchElysiaRouteRegistrationCallsites = () => {
@@ -1156,7 +1165,7 @@ var init_devRouteRegistrationCallsite = __esm(() => {
1156
1165
  "handleHTMLPageRequest",
1157
1166
  "handleHTMXPageRequest"
1158
1167
  ];
1159
- pageHandlerWrappers = new WeakSet;
1168
+ pageHandlerWrappers = new WeakMap;
1160
1169
  });
1161
1170
 
1162
1171
  // src/client/streamSwap.ts
@@ -4004,5 +4013,5 @@ export {
4004
4013
  createTypedIsland
4005
4014
  };
4006
4015
 
4007
- //# debugId=DBD28BB3223B533264756E2164756E21
4016
+ //# debugId=FE605B696293584564756E2164756E21
4008
4017
  //# sourceMappingURL=index.js.map