@absolutejs/absolute 0.19.0-beta.218 → 0.19.0-beta.219

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/index.js CHANGED
@@ -177354,20 +177354,14 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
177354
177354
  return true;
177355
177355
  }
177356
177356
  return false;
177357
- }, isPageRoute = async (serverUrl, path) => {
177358
- try {
177359
- const res = await fetch(`${serverUrl}${path}`, {
177360
- method: "HEAD",
177361
- redirect: "manual"
177362
- });
177363
- const contentType = res.headers.get("content-type") ?? "";
177364
- return contentType.includes("text/html");
177365
- } catch {
177357
+ }, PAGE_HANDLER_NAMES, isPageHandler = (handler) => {
177358
+ if (typeof handler !== "function")
177366
177359
  return false;
177367
- }
177368
- }, discoverPageRoutes = async (routes, serverUrl, exclude) => {
177360
+ const source = handler.toString();
177361
+ return PAGE_HANDLER_NAMES.some((name) => source.includes(name));
177362
+ }, discoverPageRoutes = (routes, exclude) => {
177369
177363
  const seen = new Set;
177370
- const candidates = routes.filter((route) => {
177364
+ return routes.filter((route) => {
177371
177365
  if (route.method !== "GET")
177372
177366
  return false;
177373
177367
  if (route.path.includes("*") || route.path.includes(":"))
@@ -177376,11 +177370,11 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
177376
177370
  return false;
177377
177371
  if (isExcluded(route.path, exclude))
177378
177372
  return false;
177373
+ if (!isPageHandler(route.handler))
177374
+ return false;
177379
177375
  seen.add(route.path);
177380
177376
  return true;
177381
- });
177382
- const results = await Promise.all(candidates.map((route) => isPageRoute(serverUrl, route.path)));
177383
- return candidates.filter((_, index) => results[index]).map((route) => route.path);
177377
+ }).map((route) => route.path);
177384
177378
  }, buildSitemapXml = (pageRoutes, baseUrl, config) => {
177385
177379
  const normalizedBase = baseUrl.replace(/\/$/, "");
177386
177380
  const entries = [];
@@ -177412,7 +177406,7 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
177412
177406
  `);
177413
177407
  }, generateSitemap = async (routes, serverUrl, outDir, config = {}) => {
177414
177408
  const exclude = config.exclude ?? [];
177415
- const discoveredRoutes = await discoverPageRoutes(routes, serverUrl, exclude);
177409
+ const discoveredRoutes = discoverPageRoutes(routes, exclude);
177416
177410
  const dynamicRoutes = config.routes ? await config.routes() : [];
177417
177411
  const filteredDynamic = dynamicRoutes.filter((path) => !isExcluded(path, exclude));
177418
177412
  const allRoutes = [...discoveredRoutes, ...filteredDynamic];
@@ -177420,7 +177414,16 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
177420
177414
  const xml = buildSitemapXml(allRoutes, baseUrl, config);
177421
177415
  await write3(`${outDir}/sitemap.xml`, xml);
177422
177416
  };
177423
- var init_generateSitemap = () => {};
177417
+ var init_generateSitemap = __esm(() => {
177418
+ PAGE_HANDLER_NAMES = [
177419
+ "handleReactPageRequest",
177420
+ "handleSveltePageRequest",
177421
+ "handleVuePageRequest",
177422
+ "handleAngularPageRequest",
177423
+ "handleHTMLPageRequest",
177424
+ "handleHTMXPageRequest"
177425
+ ];
177426
+ });
177424
177427
 
177425
177428
  // src/core/prerender.ts
177426
177429
  var exports_prerender = {};
@@ -178312,5 +178315,5 @@ export {
178312
178315
  ANGULAR_INIT_TIMEOUT_MS
178313
178316
  };
178314
178317
 
178315
- //# debugId=AB59F796F36384F564756E2164756E21
178318
+ //# debugId=AD9A47EFFA4D94E464756E2164756E21
178316
178319
  //# sourceMappingURL=index.js.map