@justanarthur/payload-www 0.3.3 → 0.3.5

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/blocks.js CHANGED
@@ -42,8 +42,11 @@ var RenderBlocks = ({
42
42
  locale,
43
43
  searchParams
44
44
  }) => {
45
- if (!blocks || !Array.isArray(blocks) || blocks.length === 0)
45
+ if (!blocks || !Array.isArray(blocks) || blocks.length === 0) {
46
+ console.log("[WWW] render/blocks:RenderBlocks no blocks (locale=", locale, ")");
46
47
  return null;
48
+ }
49
+ console.log("[WWW] render/blocks:RenderBlocks rendering count=", blocks.length, "locale=", locale);
47
50
  const rendered = [];
48
51
  for (let i = 0;i < blocks.length; i++) {
49
52
  const block = blocks[i];
@@ -51,9 +54,10 @@ var RenderBlocks = ({
51
54
  const importMapPath = config.admin?.dependencies?.[blockType]?.path ?? generateImportName("block", blockType);
52
55
  const Block = getFromImportMap(importMapPath, importMap);
53
56
  if (!Block) {
54
- console.warn(`No block found for type: ${blockType}, config.admin?.dependencies?.[blockType]: ${config.admin?.dependencies?.[blockType]}`);
57
+ console.warn(`[WWW] render/blocks:RenderBlocks no block for type=${blockType} importMapPath=${importMapPath} (locale=${locale})`);
55
58
  continue;
56
59
  }
60
+ console.log("[WWW] render/blocks:RenderBlocks [", i, "] blockType=", blockType, "importMapPath=", importMapPath);
57
61
  rendered.push(/* @__PURE__ */ jsx(Block, {
58
62
  index: i,
59
63
  ...blockProps,
@@ -54,30 +54,45 @@ var slugField = (options = {}) => {
54
54
 
55
55
  // src/render/_locale.ts
56
56
  function prefixFor(locale, defaultLocale, mode) {
57
+ let result;
57
58
  if (mode === "never")
58
- return "";
59
- if (mode === "as-needed" && locale === defaultLocale)
60
- return "";
61
- return `/${locale}`;
59
+ result = "";
60
+ else if (mode === "as-needed" && locale === defaultLocale)
61
+ result = "";
62
+ else
63
+ result = `/${locale}`;
64
+ console.log("[WWW] render/_locale:prefixFor locale=", locale, "default=", defaultLocale, "mode=", mode, "->", JSON.stringify(result));
65
+ return result;
62
66
  }
63
67
  function resolveLocale(req) {
64
- if (!req || typeof req !== "object")
68
+ if (!req || typeof req !== "object") {
69
+ console.log('[WWW] render/_locale:resolveLocale -> "" (no req)');
65
70
  return "";
71
+ }
66
72
  const r = req;
67
- if (typeof r.locale === "string" && r.locale.length > 0)
73
+ if (typeof r.locale === "string" && r.locale.length > 0) {
74
+ console.log("[WWW] render/_locale:resolveLocale ->", r.locale, "(from req.locale)");
68
75
  return r.locale;
76
+ }
69
77
  const fallback = r.payload?.config?.localization?.defaultLocale;
70
- if (typeof fallback === "string" && fallback.length > 0)
78
+ if (typeof fallback === "string" && fallback.length > 0) {
79
+ console.log("[WWW] render/_locale:resolveLocale ->", fallback, "(from config.localization.defaultLocale)");
71
80
  return fallback;
81
+ }
82
+ console.log('[WWW] render/_locale:resolveLocale -> "" (no locale anywhere)');
72
83
  return "";
73
84
  }
74
85
  function allLocales(req) {
75
- if (!req || typeof req !== "object")
86
+ if (!req || typeof req !== "object") {
87
+ console.log("[WWW] render/_locale:allLocales -> [] (no req)");
76
88
  return [];
89
+ }
77
90
  const r = req;
78
91
  const list = r.payload?.config?.localization?.locales;
79
- if (!Array.isArray(list) || list.length === 0)
92
+ if (!Array.isArray(list) || list.length === 0) {
93
+ console.log("[WWW] render/_locale:allLocales -> [] (no locales declared)");
80
94
  return [];
95
+ }
81
96
  const out = [];
82
97
  for (const entry of list) {
83
98
  if (typeof entry === "string" && entry.length > 0) {
@@ -88,6 +103,7 @@ function allLocales(req) {
88
103
  out.push(code);
89
104
  }
90
105
  }
106
+ console.log("[WWW] render/_locale:allLocales ->", JSON.stringify(out));
91
107
  return out;
92
108
  }
93
109
 
@@ -97,21 +113,28 @@ function nextCacheImport() {
97
113
  return cachePromise ??= import("next/cache");
98
114
  }
99
115
  function shouldSkipRevalidate(context) {
100
- return Boolean(context?.disableRevalidate);
116
+ const skip = Boolean(context?.disableRevalidate);
117
+ if (skip)
118
+ console.log("[WWW] render/hooks:_shared:shouldSkipRevalidate -> skip");
119
+ return skip;
101
120
  }
102
121
  async function safeRevalidatePath(payload, path) {
122
+ console.log("[WWW] render/hooks:_shared:safeRevalidatePath path=", path);
103
123
  try {
104
124
  const { revalidatePath } = await nextCacheImport();
105
125
  revalidatePath(path);
106
126
  } catch (error) {
127
+ console.error("[WWW] render/hooks:_shared:safeRevalidatePath failed path=", path, "err=", String(error));
107
128
  payload.logger.error(`revalidatePath("${path}") failed: ${String(error)}`);
108
129
  }
109
130
  }
110
131
  async function safeRevalidateTag(payload, tag, profile = "max") {
132
+ console.log("[WWW] render/hooks:_shared:safeRevalidateTag tag=", tag, "profile=", profile);
111
133
  try {
112
134
  const { revalidateTag } = await nextCacheImport();
113
135
  revalidateTag(tag, profile);
114
136
  } catch (error) {
137
+ console.error("[WWW] render/hooks:_shared:safeRevalidateTag failed tag=", tag, "err=", String(error));
115
138
  payload.logger.error(`revalidateTag("${tag}") failed: ${String(error)}`);
116
139
  }
117
140
  }
@@ -127,6 +150,7 @@ function createRevalidateCollectionHook(options) {
127
150
  pathMode = "url"
128
151
  } = options;
129
152
  const resolvedSitemapTag = sitemapTag === false ? false : sitemapTag ?? `${collectionSlug}-sitemap`;
153
+ console.log("[WWW] render/hooks:createRevalidateCollectionHook collectionSlug=", collectionSlug, "urlPathPrefix=", urlPathPrefix, "sitemapTag=", resolvedSitemapTag, "pathMode=", pathMode);
130
154
  const resolveDefaults = (req) => {
131
155
  const mode = modeOption ?? "always";
132
156
  const defaultLocale = defaultLocaleOption ?? req?.payload?.config?.localization?.defaultLocale ?? "";
@@ -155,6 +179,7 @@ function createRevalidateCollectionHook(options) {
155
179
  }
156
180
  };
157
181
  const fireCollectionTags = async (payload, docId, req) => {
182
+ console.log("[WWW] render/hooks:fireCollectionTags collectionSlug=", collectionSlug, "docId=", docId);
158
183
  if (typeof docId === "string" || typeof docId === "number") {
159
184
  await safeRevalidateTag(payload, `collection_${collectionSlug}_${docId}`);
160
185
  }
@@ -168,6 +193,7 @@ function createRevalidateCollectionHook(options) {
168
193
  const { payload } = req;
169
194
  const typed = doc;
170
195
  const prev = previousDoc;
196
+ console.log("[WWW] render/hooks:afterChange collectionSlug=", collectionSlug, "id=", typed.id, "slug=", typed.slug, "prevSlug=", prev?.slug);
171
197
  const isPublished = typed._status === "published";
172
198
  const wasPublished = prev?._status === "published";
173
199
  const prevSlugIsString = typeof prev?.slug === "string";
@@ -191,6 +217,7 @@ function createRevalidateCollectionHook(options) {
191
217
  return doc ?? null;
192
218
  const { payload } = req;
193
219
  const typed = doc;
220
+ console.log("[WWW] render/hooks:afterDelete collectionSlug=", collectionSlug, "id=", typed?.id, "slug=", typed?.slug);
194
221
  if (pathMode !== "tag-only") {
195
222
  await fanOutPaths(payload, req, typed?.slug, `Revalidating deleted ${collectionSlug} at path:`);
196
223
  }
@@ -199,11 +226,14 @@ function createRevalidateCollectionHook(options) {
199
226
  };
200
227
  return { afterChange, afterDelete };
201
228
  }
202
- var createRevalidatePageHooks = (opts = {}) => createRevalidateCollectionHook({
203
- collectionSlug: "pages",
204
- urlPathPrefix: "",
205
- ...opts
206
- });
229
+ var createRevalidatePageHooks = (opts = {}) => {
230
+ console.log("[WWW] render/hooks:createRevalidatePageHooks (deprecated alias) opts=", JSON.stringify(opts));
231
+ return createRevalidateCollectionHook({
232
+ collectionSlug: "pages",
233
+ urlPathPrefix: "",
234
+ ...opts
235
+ });
236
+ };
207
237
 
208
238
  // src/config/constants.ts
209
239
  var PAGES_RENDER_PATH = "@justanarthur/payload-www/render-pages#PagesPage";
@@ -511,10 +541,12 @@ var link = (options = {}) => {
511
541
 
512
542
  // src/render/hooks/revalidateGlobal.ts
513
543
  function createRevalidateGlobalHook(slug) {
544
+ console.log("[WWW] render/hooks:createRevalidateGlobalHook slug=", slug);
514
545
  return async ({ doc, req: { payload, context, locale } }) => {
515
546
  if (shouldSkipRevalidate(context))
516
547
  return doc;
517
548
  const tags = [`global_${slug}`, `global_${slug}_${locale}`];
549
+ console.log("[WWW] render/hooks:revalidateGlobal slug=", slug, "locale=", locale, "tags=", JSON.stringify(tags));
518
550
  payload.logger.info?.(`Revalidating global: ${tags.join(", ")}`);
519
551
  for (const tag of tags) {
520
552
  await safeRevalidateTag(payload, tag);
@@ -24,6 +24,7 @@ import { jsx } from "react/jsx-runtime";
24
24
  var LivePreviewListener = ({ serverURL }) => {
25
25
  const router = useRouter();
26
26
  const url = serverURL ?? process.env.NEXT_PUBLIC_SERVER_URL ?? (typeof window !== "undefined" ? window.location.origin : "");
27
+ console.log("[WWW] render/components:LivePreviewListener serverURL=", url);
27
28
  return /* @__PURE__ */ jsx(PayloadLivePreview, {
28
29
  refresh: router.refresh,
29
30
  serverURL: url
package/dist/config.js CHANGED
@@ -54,30 +54,45 @@ var slugField = (options = {}) => {
54
54
 
55
55
  // src/render/_locale.ts
56
56
  function prefixFor(locale, defaultLocale, mode) {
57
+ let result;
57
58
  if (mode === "never")
58
- return "";
59
- if (mode === "as-needed" && locale === defaultLocale)
60
- return "";
61
- return `/${locale}`;
59
+ result = "";
60
+ else if (mode === "as-needed" && locale === defaultLocale)
61
+ result = "";
62
+ else
63
+ result = `/${locale}`;
64
+ console.log("[WWW] render/_locale:prefixFor locale=", locale, "default=", defaultLocale, "mode=", mode, "->", JSON.stringify(result));
65
+ return result;
62
66
  }
63
67
  function resolveLocale(req) {
64
- if (!req || typeof req !== "object")
68
+ if (!req || typeof req !== "object") {
69
+ console.log('[WWW] render/_locale:resolveLocale -> "" (no req)');
65
70
  return "";
71
+ }
66
72
  const r = req;
67
- if (typeof r.locale === "string" && r.locale.length > 0)
73
+ if (typeof r.locale === "string" && r.locale.length > 0) {
74
+ console.log("[WWW] render/_locale:resolveLocale ->", r.locale, "(from req.locale)");
68
75
  return r.locale;
76
+ }
69
77
  const fallback = r.payload?.config?.localization?.defaultLocale;
70
- if (typeof fallback === "string" && fallback.length > 0)
78
+ if (typeof fallback === "string" && fallback.length > 0) {
79
+ console.log("[WWW] render/_locale:resolveLocale ->", fallback, "(from config.localization.defaultLocale)");
71
80
  return fallback;
81
+ }
82
+ console.log('[WWW] render/_locale:resolveLocale -> "" (no locale anywhere)');
72
83
  return "";
73
84
  }
74
85
  function allLocales(req) {
75
- if (!req || typeof req !== "object")
86
+ if (!req || typeof req !== "object") {
87
+ console.log("[WWW] render/_locale:allLocales -> [] (no req)");
76
88
  return [];
89
+ }
77
90
  const r = req;
78
91
  const list = r.payload?.config?.localization?.locales;
79
- if (!Array.isArray(list) || list.length === 0)
92
+ if (!Array.isArray(list) || list.length === 0) {
93
+ console.log("[WWW] render/_locale:allLocales -> [] (no locales declared)");
80
94
  return [];
95
+ }
81
96
  const out = [];
82
97
  for (const entry of list) {
83
98
  if (typeof entry === "string" && entry.length > 0) {
@@ -88,6 +103,7 @@ function allLocales(req) {
88
103
  out.push(code);
89
104
  }
90
105
  }
106
+ console.log("[WWW] render/_locale:allLocales ->", JSON.stringify(out));
91
107
  return out;
92
108
  }
93
109
 
@@ -97,21 +113,28 @@ function nextCacheImport() {
97
113
  return cachePromise ??= import("next/cache");
98
114
  }
99
115
  function shouldSkipRevalidate(context) {
100
- return Boolean(context?.disableRevalidate);
116
+ const skip = Boolean(context?.disableRevalidate);
117
+ if (skip)
118
+ console.log("[WWW] render/hooks:_shared:shouldSkipRevalidate -> skip");
119
+ return skip;
101
120
  }
102
121
  async function safeRevalidatePath(payload, path) {
122
+ console.log("[WWW] render/hooks:_shared:safeRevalidatePath path=", path);
103
123
  try {
104
124
  const { revalidatePath } = await nextCacheImport();
105
125
  revalidatePath(path);
106
126
  } catch (error) {
127
+ console.error("[WWW] render/hooks:_shared:safeRevalidatePath failed path=", path, "err=", String(error));
107
128
  payload.logger.error(`revalidatePath("${path}") failed: ${String(error)}`);
108
129
  }
109
130
  }
110
131
  async function safeRevalidateTag(payload, tag, profile = "max") {
132
+ console.log("[WWW] render/hooks:_shared:safeRevalidateTag tag=", tag, "profile=", profile);
111
133
  try {
112
134
  const { revalidateTag } = await nextCacheImport();
113
135
  revalidateTag(tag, profile);
114
136
  } catch (error) {
137
+ console.error("[WWW] render/hooks:_shared:safeRevalidateTag failed tag=", tag, "err=", String(error));
115
138
  payload.logger.error(`revalidateTag("${tag}") failed: ${String(error)}`);
116
139
  }
117
140
  }
@@ -127,6 +150,7 @@ function createRevalidateCollectionHook(options) {
127
150
  pathMode = "url"
128
151
  } = options;
129
152
  const resolvedSitemapTag = sitemapTag === false ? false : sitemapTag ?? `${collectionSlug}-sitemap`;
153
+ console.log("[WWW] render/hooks:createRevalidateCollectionHook collectionSlug=", collectionSlug, "urlPathPrefix=", urlPathPrefix, "sitemapTag=", resolvedSitemapTag, "pathMode=", pathMode);
130
154
  const resolveDefaults = (req) => {
131
155
  const mode = modeOption ?? "always";
132
156
  const defaultLocale = defaultLocaleOption ?? req?.payload?.config?.localization?.defaultLocale ?? "";
@@ -155,6 +179,7 @@ function createRevalidateCollectionHook(options) {
155
179
  }
156
180
  };
157
181
  const fireCollectionTags = async (payload, docId, req) => {
182
+ console.log("[WWW] render/hooks:fireCollectionTags collectionSlug=", collectionSlug, "docId=", docId);
158
183
  if (typeof docId === "string" || typeof docId === "number") {
159
184
  await safeRevalidateTag(payload, `collection_${collectionSlug}_${docId}`);
160
185
  }
@@ -168,6 +193,7 @@ function createRevalidateCollectionHook(options) {
168
193
  const { payload } = req;
169
194
  const typed = doc;
170
195
  const prev = previousDoc;
196
+ console.log("[WWW] render/hooks:afterChange collectionSlug=", collectionSlug, "id=", typed.id, "slug=", typed.slug, "prevSlug=", prev?.slug);
171
197
  const isPublished = typed._status === "published";
172
198
  const wasPublished = prev?._status === "published";
173
199
  const prevSlugIsString = typeof prev?.slug === "string";
@@ -191,6 +217,7 @@ function createRevalidateCollectionHook(options) {
191
217
  return doc ?? null;
192
218
  const { payload } = req;
193
219
  const typed = doc;
220
+ console.log("[WWW] render/hooks:afterDelete collectionSlug=", collectionSlug, "id=", typed?.id, "slug=", typed?.slug);
194
221
  if (pathMode !== "tag-only") {
195
222
  await fanOutPaths(payload, req, typed?.slug, `Revalidating deleted ${collectionSlug} at path:`);
196
223
  }
@@ -199,11 +226,14 @@ function createRevalidateCollectionHook(options) {
199
226
  };
200
227
  return { afterChange, afterDelete };
201
228
  }
202
- var createRevalidatePageHooks = (opts = {}) => createRevalidateCollectionHook({
203
- collectionSlug: "pages",
204
- urlPathPrefix: "",
205
- ...opts
206
- });
229
+ var createRevalidatePageHooks = (opts = {}) => {
230
+ console.log("[WWW] render/hooks:createRevalidatePageHooks (deprecated alias) opts=", JSON.stringify(opts));
231
+ return createRevalidateCollectionHook({
232
+ collectionSlug: "pages",
233
+ urlPathPrefix: "",
234
+ ...opts
235
+ });
236
+ };
207
237
 
208
238
  // src/config/constants.ts
209
239
  var PAGES_RENDER_PATH = "@justanarthur/payload-www/render-pages#PagesPage";
@@ -511,10 +541,12 @@ var link = (options = {}) => {
511
541
 
512
542
  // src/render/hooks/revalidateGlobal.ts
513
543
  function createRevalidateGlobalHook(slug) {
544
+ console.log("[WWW] render/hooks:createRevalidateGlobalHook slug=", slug);
514
545
  return async ({ doc, req: { payload, context, locale } }) => {
515
546
  if (shouldSkipRevalidate(context))
516
547
  return doc;
517
548
  const tags = [`global_${slug}`, `global_${slug}_${locale}`];
549
+ console.log("[WWW] render/hooks:revalidateGlobal slug=", slug, "locale=", locale, "tags=", JSON.stringify(tags));
518
550
  payload.logger.info?.(`Revalidating global: ${tags.join(", ")}`);
519
551
  for (const tag of tags) {
520
552
  await safeRevalidateTag(payload, tag);
@@ -609,11 +641,14 @@ function createPreviewHandler(options) {
609
641
  const url = new URL(req.url);
610
642
  const path = url.searchParams.get("path") ?? "/";
611
643
  const previewSecret = url.searchParams.get("previewSecret");
644
+ console.log("[WWW] render/preview:createPreviewHandler:GET path=", path, "hasSecret=", Boolean(previewSecret), "enableDraftMode=", enableDraftMode);
612
645
  if (!previewSecret || previewSecret !== secret) {
646
+ console.warn("[WWW] render/preview:createPreviewHandler:GET invalid preview secret (401)");
613
647
  return new Response("Invalid preview secret", { status: 401 });
614
648
  }
615
649
  if (enableDraftMode) {
616
650
  (await draftMode()).enable();
651
+ console.log("[WWW] render/preview:createPreviewHandler:GET draftMode enabled");
617
652
  }
618
653
  redirect(path);
619
654
  return new Response(null, { status: 204 });
@@ -633,6 +668,7 @@ async function buildHreflangAlternates({
633
668
  localePrefix = "always"
634
669
  }) {
635
670
  const allLocaleSlugs = await queryAllLocaleSlugs(storedSlug, locale);
671
+ console.log("[WWW] render/metadata:buildHreflangAlternates storedSlug=", storedSlug, "locale=", locale, "allLocaleSlugs=", JSON.stringify(allLocaleSlugs));
636
672
  const languages = {};
637
673
  const urlFor = (l, slug) => {
638
674
  const trimmedPrefix = urlPrefix.replace(/^\/|\/$/g, "");
@@ -650,6 +686,7 @@ async function buildHreflangAlternates({
650
686
  if (allLocaleSlugs?.[defaultLocale]) {
651
687
  languages["x-default"] = urlFor(defaultLocale, allLocaleSlugs[defaultLocale]);
652
688
  }
689
+ console.log("[WWW] render/metadata:buildHreflangAlternates ->", JSON.stringify(languages));
653
690
  return languages;
654
691
  }
655
692
 
@@ -671,6 +708,7 @@ var queryDocBySlug = cache(async function queryDocBySlug2({
671
708
  draft = false,
672
709
  config
673
710
  }) {
711
+ console.log("[WWW] render/metadata:queryDocBySlug collection=", collectionSlug, "slug=", slug, "slugField=", slugField2, "locale=", locale, "draft=", draft);
674
712
  const payload = await getPayload({ config });
675
713
  const result = await payload.find({
676
714
  collection: collectionSlug,
@@ -681,7 +719,9 @@ var queryDocBySlug = cache(async function queryDocBySlug2({
681
719
  where: { [slugField2]: { equals: slug } },
682
720
  locale
683
721
  });
684
- return result.docs?.[0] ?? null;
722
+ const doc = result.docs?.[0] ?? null;
723
+ console.log("[WWW] render/metadata:queryDocBySlug ->", doc ? "hit" : "miss");
724
+ return doc;
685
725
  });
686
726
  var queryAllDocs = cache(async function queryAllDocs2({
687
727
  collectionSlug,
@@ -689,6 +729,7 @@ var queryAllDocs = cache(async function queryAllDocs2({
689
729
  locale,
690
730
  config
691
731
  }) {
732
+ console.log("[WWW] render/metadata:queryAllDocs collection=", collectionSlug, "locale=", locale);
692
733
  const payload = await getPayload({ config });
693
734
  const result = await payload.find({
694
735
  collection: collectionSlug,
@@ -699,7 +740,9 @@ var queryAllDocs = cache(async function queryAllDocs2({
699
740
  select: { [slugField2]: true },
700
741
  locale
701
742
  });
702
- return result.docs ?? [];
743
+ const docs = result.docs ?? [];
744
+ console.log("[WWW] render/metadata:queryAllDocs -> count=", docs.length);
745
+ return docs;
703
746
  });
704
747
  var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
705
748
  collectionSlug,
@@ -708,6 +751,7 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
708
751
  locale,
709
752
  config
710
753
  }) {
754
+ console.log("[WWW] render/metadata:queryAllLocaleSlugs collection=", collectionSlug, "slug=", slug, "locale=", locale);
711
755
  const payload = await getPayload({ config });
712
756
  const result = await payload.find({
713
757
  collection: collectionSlug,
@@ -720,8 +764,10 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
720
764
  select: { [slugField2]: true }
721
765
  });
722
766
  const doc = result.docs?.[0];
723
- if (!doc)
767
+ if (!doc) {
768
+ console.log("[WWW] render/metadata:queryAllLocaleSlugs -> undefined (no doc)");
724
769
  return;
770
+ }
725
771
  let fieldValue = doc[slugField2];
726
772
  if (doc.id != null) {
727
773
  const allLocales2 = await payload.findByID({
@@ -736,6 +782,7 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
736
782
  fieldValue = allLocales2[slugField2];
737
783
  }
738
784
  if (fieldValue && typeof fieldValue === "object") {
785
+ console.log("[WWW] render/metadata:queryAllLocaleSlugs -> localized map=", JSON.stringify(fieldValue));
739
786
  return fieldValue;
740
787
  }
741
788
  const resolved = await config;
@@ -743,6 +790,7 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
743
790
  const out = {};
744
791
  for (const l of rawLocales)
745
792
  out[l] = String(fieldValue ?? slug);
793
+ console.log("[WWW] render/metadata:queryAllLocaleSlugs -> flat-fanout locales=", rawLocales.length, "slug=", JSON.stringify(fieldValue ?? slug));
746
794
  return out;
747
795
  });
748
796
  var queryGlobal = cache(async function queryGlobal2({
@@ -752,6 +800,7 @@ var queryGlobal = cache(async function queryGlobal2({
752
800
  draft = false,
753
801
  config
754
802
  }) {
803
+ console.log("[WWW] render/metadata:queryGlobal global=", globalSlug, "locale=", locale, "depth=", depth, "draft=", draft);
755
804
  const payload = await getPayload({ config });
756
805
  try {
757
806
  const global = await payload.findGlobal({
@@ -760,27 +809,35 @@ var queryGlobal = cache(async function queryGlobal2({
760
809
  draft,
761
810
  locale
762
811
  });
812
+ console.log("[WWW] render/metadata:queryGlobal -> hit");
763
813
  return global;
764
- } catch {
814
+ } catch (error) {
815
+ console.warn("[WWW] render/metadata:queryGlobal failed for slug=", globalSlug, "err=", String(error));
765
816
  return null;
766
817
  }
767
818
  });
768
819
  function getRenderModuleExports(exportName, collection, importMap) {
769
820
  const path = collection?.custom?.path;
770
- if (!path)
821
+ if (!path) {
822
+ console.log("[WWW] render/metadata:getRenderModuleExports no custom.path exportName=", exportName);
771
823
  return;
824
+ }
772
825
  const mod = getFromImportMap(path, importMap);
773
- return mod?.[exportName];
826
+ const value = mod?.[exportName];
827
+ console.log("[WWW] render/metadata:getRenderModuleExports exportName=", exportName, "path=", path, "hit=", Boolean(value));
828
+ return value;
774
829
  }
775
830
 
776
831
  // src/render/sitemap/createSitemapFile.ts
777
832
  function createSitemapFile(options) {
778
833
  const { collections } = options;
779
834
  return async function sitemap() {
835
+ console.log("[WWW] render/sitemap:createSitemapFile:sitemap collections=", JSON.stringify(options.collections), "localePrefix=", options.localePrefix ?? "always");
780
836
  const cfg = await options.config;
781
837
  const allLocales2 = Array.isArray(cfg.localization?.locales) ? cfg.localization.locales.map((l) => typeof l === "string" ? l : l.code) : [cfg.localization?.defaultLocale ?? "en"];
782
838
  const defaultLocale = cfg.localization?.defaultLocale ?? allLocales2[0];
783
839
  const activeLocales = Array.isArray(options.locales) && options.locales.length > 0 ? options.locales.filter((l) => allLocales2.includes(l)) : allLocales2;
840
+ console.log("[WWW] render/sitemap:createSitemapFile:sitemap allLocales=", JSON.stringify(allLocales2), "default=", defaultLocale, "active=", JSON.stringify(activeLocales));
784
841
  const entries = [];
785
842
  const seen = new Set;
786
843
  for (const collectionSlug of collections) {
@@ -836,6 +893,7 @@ function createSitemapFile(options) {
836
893
  }
837
894
  }
838
895
  }
896
+ console.log("[WWW] render/sitemap:createSitemapFile:sitemap -> entries=", entries.length);
839
897
  return entries;
840
898
  };
841
899
  }
@@ -42,8 +42,11 @@ var RenderBlocks = ({
42
42
  locale,
43
43
  searchParams
44
44
  }) => {
45
- if (!blocks || !Array.isArray(blocks) || blocks.length === 0)
45
+ if (!blocks || !Array.isArray(blocks) || blocks.length === 0) {
46
+ console.log("[WWW] render/blocks:RenderBlocks no blocks (locale=", locale, ")");
46
47
  return null;
48
+ }
49
+ console.log("[WWW] render/blocks:RenderBlocks rendering count=", blocks.length, "locale=", locale);
47
50
  const rendered = [];
48
51
  for (let i = 0;i < blocks.length; i++) {
49
52
  const block = blocks[i];
@@ -51,9 +54,10 @@ var RenderBlocks = ({
51
54
  const importMapPath = config.admin?.dependencies?.[blockType]?.path ?? generateImportName("block", blockType);
52
55
  const Block = getFromImportMap(importMapPath, importMap);
53
56
  if (!Block) {
54
- console.warn(`No block found for type: ${blockType}, config.admin?.dependencies?.[blockType]: ${config.admin?.dependencies?.[blockType]}`);
57
+ console.warn(`[WWW] render/blocks:RenderBlocks no block for type=${blockType} importMapPath=${importMapPath} (locale=${locale})`);
55
58
  continue;
56
59
  }
60
+ console.log("[WWW] render/blocks:RenderBlocks [", i, "] blockType=", blockType, "importMapPath=", importMapPath);
57
61
  rendered.push(/* @__PURE__ */ jsx(Block, {
58
62
  index: i,
59
63
  ...blockProps,
@@ -36,13 +36,17 @@ function generateImportName(type, slug) {
36
36
  import { jsx } from "react/jsx-runtime";
37
37
  function renderCollectionModule(collection = [], slug, importMap, props) {
38
38
  const renderPath = collection?.find((c) => c.slug === slug)?.custom?.path;
39
- if (!renderPath)
39
+ if (!renderPath) {
40
+ console.log("[WWW] render/utils:renderCollectionModule no custom.path slug=", slug);
40
41
  return null;
42
+ }
41
43
  const CollectionRenderModule = getFromImportMap(renderPath, importMap);
42
44
  if (!CollectionRenderModule) {
45
+ console.error("[WWW] render/utils:renderCollectionModule not found slug=", slug, "path=", renderPath);
43
46
  if (false) {}
44
47
  return null;
45
48
  }
49
+ console.log("[WWW] render/utils:renderCollectionModule rendering slug=", slug, "path=", renderPath);
46
50
  return /* @__PURE__ */ jsx(CollectionRenderModule, {
47
51
  importMap,
48
52
  ...props