@absolutejs/absolute 0.19.0-beta.960 → 0.19.0-beta.962

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/build.js CHANGED
@@ -4979,7 +4979,7 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
4979
4979
  return true;
4980
4980
  }
4981
4981
  return false;
4982
- }, stripTrailingWildcard = (path) => path.replace(/\/\*+$/, ""), isWildcardPagePath = (path) => path.endsWith("/*") || path.endsWith("*"), SITEMAP_BLOCK_PATTERN, SITEMAP_STRING_FIELD_PATTERN, SITEMAP_NUMBER_FIELD_PATTERN, VALID_CHANGEFREQ, extractSitemapMetadataFromHandlerSource = (source) => {
4982
+ }, stripTrailingWildcard = (path) => path.replace(/\/\*+$/, ""), isWildcardPagePath = (path) => path.endsWith("/*") || path.endsWith("*"), SITEMAP_BLOCK_PATTERN, SITEMAP_STRING_FIELD_PATTERN, SITEMAP_NUMBER_FIELD_PATTERN, SITEMAP_BOOLEAN_FIELD_PATTERN, VALID_CHANGEFREQ, extractSitemapMetadataFromHandlerSource = (source) => {
4983
4983
  const block = SITEMAP_BLOCK_PATTERN.exec(source);
4984
4984
  if (!block)
4985
4985
  return;
@@ -5004,6 +5004,11 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
5004
5004
  if (!Number.isNaN(num))
5005
5005
  out.priority = num;
5006
5006
  }
5007
+ SITEMAP_BOOLEAN_FIELD_PATTERN.lastIndex = 0;
5008
+ while ((m = SITEMAP_BOOLEAN_FIELD_PATTERN.exec(body)) !== null) {
5009
+ if (m[1] === "exclude")
5010
+ out.exclude = m[2] === "true";
5011
+ }
5007
5012
  return Object.keys(out).length > 0 ? out : undefined;
5008
5013
  }, PAGE_HANDLER_NAMES2, sourceMentionsPageHandler = (source) => PAGE_HANDLER_NAMES2.some((name) => source.includes(name)), routeHandlerSource = (route) => {
5009
5014
  if (route.handlerSource)
@@ -5035,12 +5040,15 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
5035
5040
  continue;
5036
5041
  if (isExcluded(mountPath, exclude))
5037
5042
  continue;
5043
+ const meta = sitemapMetadataForRoute(route);
5044
+ if (meta?.exclude === true)
5045
+ continue;
5038
5046
  seen.add(mountPath);
5039
5047
  out.push({
5040
5048
  emitTopLevel: !isWildcardPagePath(route.path),
5041
5049
  mountPath,
5042
5050
  rawPath: route.path,
5043
- sitemap: sitemapMetadataForRoute(route)
5051
+ sitemap: meta
5044
5052
  });
5045
5053
  }
5046
5054
  return out;
@@ -5173,6 +5181,7 @@ var init_generateSitemap = __esm(() => {
5173
5181
  SITEMAP_BLOCK_PATTERN = /\bsitemap\s*:\s*\{([^{}]*)\}/;
5174
5182
  SITEMAP_STRING_FIELD_PATTERN = /\b(changefreq|lastmod)\s*:\s*['"]([^'"]+)['"]/g;
5175
5183
  SITEMAP_NUMBER_FIELD_PATTERN = /\bpriority\s*:\s*([+-]?\d+(?:\.\d+)?)/g;
5184
+ SITEMAP_BOOLEAN_FIELD_PATTERN = /\b(exclude)\s*:\s*(true|false)\b/g;
5176
5185
  VALID_CHANGEFREQ = new Set([
5177
5186
  "always",
5178
5187
  "hourly",
@@ -10406,17 +10415,12 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
10406
10415
  return actual.startsWith(prefix);
10407
10416
  }
10408
10417
  return actual === pattern;
10409
- }, MIME_MAP, isSharpFactory = (value) => typeof value === "function", callSharp = (sharpRef, input) => {
10410
- if (!isSharpFactory(sharpRef)) {
10411
- throw new Error("Loaded sharp module is not callable.");
10412
- }
10413
- return sharpRef(input);
10414
- }, toBuffer = (input) => {
10418
+ }, MIME_MAP, isSharpFactory = (value) => typeof value === "function", toBuffer = (input) => {
10415
10419
  if (Buffer.isBuffer(input))
10416
10420
  return input;
10417
10421
  return Buffer.from(input);
10418
- }, buildOptimizedUrl = (src, width, quality, basePath = OPTIMIZATION_ENDPOINT) => `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`, formatToMime = (format) => MIME_MAP[format], generateBlurSvg = (base64Thumbnail) => {
10419
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 320"><filter id="b" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="${BLUR_DEVIATION}"/><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1"/></filter><image filter="url(#b)" x="0" y="0" width="100%" height="100%" href="${base64Thumbnail}"/></svg>`;
10422
+ }, isUnsupportedFormatError = (err) => typeof err === "object" && err !== null && ("code" in err) && err.code === "ERR_IMAGE_FORMAT_UNSUPPORTED", buildOptimizedUrl = (src, width, quality, basePath = OPTIMIZATION_ENDPOINT) => `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`, formatToMime = (format) => MIME_MAP[format], generateBlurSvg = (base64Thumbnail) => {
10423
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 320"><filter id="b" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="${BLUR_DEVIATION}"/><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 100 -1"/></filter><image filter="url(#b)" x="0" y="0" width="100%" height="100%" href="${base64Thumbnail}"/></svg>`;
10420
10424
  const encoded = encodeURIComponent(svg);
10421
10425
  return `url("data:image/svg+xml,${encoded}")`;
10422
10426
  }, generateSrcSet = (src, width, sizes, config, loader) => {
@@ -10476,11 +10480,24 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
10476
10480
  return "webp";
10477
10481
  }
10478
10482
  return "jpeg";
10479
- }, AVIF_QUALITY_OFFSET = 20, AVIF_EFFORT = 3, optimizeImage = async (buffer, width, quality, format) => {
10480
- const sharp = await tryLoadSharp();
10481
- if (!sharp)
10482
- return toBuffer(buffer);
10483
- const pipeline = callSharp(sharp, toBuffer(buffer)).rotate().resize(width, undefined, { withoutEnlargement: true });
10483
+ }, AVIF_QUALITY_OFFSET = 20, AVIF_EFFORT = 3, PNG_COMPRESSION_LEVEL = 9, optimizeWithBunImage = async (buffer, width, quality, format) => {
10484
+ const pipeline = new Bun.Image(buffer).resize(width, undefined, {
10485
+ withoutEnlargement: true
10486
+ });
10487
+ switch (format) {
10488
+ case "avif":
10489
+ return pipeline.avif({
10490
+ quality: Math.max(1, quality - AVIF_QUALITY_OFFSET)
10491
+ }).toBuffer();
10492
+ case "jpeg":
10493
+ return pipeline.jpeg({ quality }).toBuffer();
10494
+ case "png":
10495
+ return pipeline.png({ compressionLevel: PNG_COMPRESSION_LEVEL }).toBuffer();
10496
+ case "webp":
10497
+ return pipeline.webp({ quality }).toBuffer();
10498
+ }
10499
+ }, optimizeWithSharp = async (sharpRef, buffer, width, quality, format) => {
10500
+ const pipeline = sharpRef(buffer).rotate().resize(width, undefined, { withoutEnlargement: true });
10484
10501
  switch (format) {
10485
10502
  case "avif":
10486
10503
  return pipeline.avif({
@@ -10493,8 +10510,19 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
10493
10510
  return pipeline.png({ quality }).toBuffer();
10494
10511
  case "webp":
10495
10512
  return pipeline.webp({ quality }).toBuffer();
10496
- default:
10497
- return toBuffer(buffer);
10513
+ }
10514
+ }, optimizeImage = async (buffer, width, quality, format) => {
10515
+ const input = toBuffer(buffer);
10516
+ try {
10517
+ return await optimizeWithBunImage(input, width, quality, format);
10518
+ } catch (err) {
10519
+ if (format === "avif" && isUnsupportedFormatError(err)) {
10520
+ const sharp = await tryLoadSharp();
10521
+ if (sharp && isSharpFactory(sharp)) {
10522
+ return optimizeWithSharp(sharp, input, width, quality, format);
10523
+ }
10524
+ }
10525
+ throw err;
10498
10526
  }
10499
10527
  }, readFromCache = (cacheDir, cacheKey) => {
10500
10528
  const metaPath = join14(cacheDir, `${cacheKey}.meta`);
@@ -10521,7 +10549,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
10521
10549
  if (sharpWarned)
10522
10550
  return null;
10523
10551
  sharpWarned = true;
10524
- console.warn("[image] sharp not installed \u2014 serving unoptimized images. Install with: bun add sharp");
10552
+ console.warn('[image] AVIF requested but sharp not installed and Bun.Image cannot encode AVIF on this platform. Install sharp (`bun add sharp`) to enable AVIF, or remove "avif" from your image formats config. See docs/SHARP_REMOVAL.md for context.');
10525
10553
  return null;
10526
10554
  }
10527
10555
  }, writeToCache = (cacheDir, cacheKey, buffer, meta) => {
@@ -26290,5 +26318,5 @@ export {
26290
26318
  build
26291
26319
  };
26292
26320
 
26293
- //# debugId=A960973FB835AD9B64756E2164756E21
26321
+ //# debugId=A92228156E225CEE64756E2164756E21
26294
26322
  //# sourceMappingURL=build.js.map