pagiera 0.2.0-alpha.40 → 0.2.0-alpha.41

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.
@@ -9547,6 +9547,15 @@ function isRegistry(value) {
9547
9547
  (entry) => Boolean(entry && typeof entry.id === "string" && typeof entry.name === "string" && typeof entry.version === "string" && entry.preview)
9548
9548
  );
9549
9549
  }
9550
+ function withRefresh(url) {
9551
+ try {
9552
+ const parsed = new URL(url, globalThis.location?.href ?? "http://localhost");
9553
+ parsed.searchParams.set("refresh", "1");
9554
+ return /^[a-z][a-z0-9+.-]*:|^\/\//i.test(url) ? parsed.href : parsed.pathname + parsed.search + parsed.hash;
9555
+ } catch {
9556
+ return url;
9557
+ }
9558
+ }
9550
9559
  async function fetchJson(url) {
9551
9560
  const response = await fetch(url, { cache: "no-cache", headers: { Accept: "application/json" } });
9552
9561
  if (!response.ok) throw new Error(`Template registry returned ${response.status}.`);
@@ -9563,7 +9572,7 @@ async function loadTemplateRegistry(url = DEFAULT_TEMPLATE_REGISTRY_URL, force =
9563
9572
  if (cached && isRegistry(cached)) return { registry: cached, source: "cache" };
9564
9573
  }
9565
9574
  try {
9566
- const response = await fetchJson(url);
9575
+ const response = await fetchJson(force ? withRefresh(url) : url);
9567
9576
  const value = response.value;
9568
9577
  if (!isRegistry(value)) throw new Error("Template registry has an unsupported format.");
9569
9578
  if (cacheable) writeCache(key, value);