@onruntime/next-sitemap 0.6.2 → 0.7.0

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.
@@ -2,12 +2,10 @@
2
2
 
3
3
  var fs = require('fs');
4
4
  var path = require('path');
5
- var jiti = require('jiti');
6
- var stripJsonComments = require('strip-json-comments');
5
+ var childProcess = require('child_process');
6
+ var url = require('url');
7
7
 
8
8
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
9
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
-
11
9
  function _interopNamespace(e) {
12
10
  if (e && e.__esModule) return e;
13
11
  var n = Object.create(null);
@@ -26,11 +24,168 @@ function _interopNamespace(e) {
26
24
  return Object.freeze(n);
27
25
  }
28
26
 
29
- var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
30
- var path__namespace = /*#__PURE__*/_interopNamespace(path);
31
- var stripJsonComments__default = /*#__PURE__*/_interopDefault(stripJsonComments);
27
+ var childProcess__namespace = /*#__PURE__*/_interopNamespace(childProcess);
32
28
 
33
29
  // src/app/index.ts
30
+ var NO_STATIC_PARAMS = "NO_STATIC_PARAMS";
31
+ var spawnProcess = childProcess__namespace.spawn;
32
+ var __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
33
+ var paramsCache = /* @__PURE__ */ new Map();
34
+ var isDev = process.env.NODE_ENV === "development";
35
+ async function executeWorker(directory, fileKey, debug) {
36
+ const absolutePath = path.join(directory, fileKey.replace("./", ""));
37
+ const projectRoot = process.cwd();
38
+ const distRoot = path.join(__dirname$1, "..");
39
+ const workerPath = path.join(distRoot, "worker.cjs");
40
+ const loaderPath = path.join(distRoot, "loader.js");
41
+ if (debug) {
42
+ console.log(`[next-sitemap] Worker path: ${workerPath}`);
43
+ console.log(`[next-sitemap] Worker exists: ${fs.existsSync(workerPath)}`);
44
+ console.log(`[next-sitemap] Loader path: ${loaderPath}`);
45
+ console.log(`[next-sitemap] Loader exists: ${fs.existsSync(loaderPath)}`);
46
+ }
47
+ return new Promise((resolve) => {
48
+ const nodePath = [
49
+ path.join(projectRoot, "node_modules"),
50
+ path.join(__dirname$1, "..", "node_modules")
51
+ ].join(path.delimiter);
52
+ const importFlag = ["--import", loaderPath];
53
+ const args = [...importFlag, workerPath, absolutePath, projectRoot];
54
+ const child = spawnProcess("node", args, {
55
+ cwd: projectRoot,
56
+ stdio: ["ignore", "pipe", "pipe"],
57
+ env: { ...process.env, NODE_PATH: nodePath }
58
+ });
59
+ let stdout = "";
60
+ let stderr = "";
61
+ child.stdout.on("data", (data) => {
62
+ stdout += data.toString();
63
+ });
64
+ child.stderr.on("data", (data) => {
65
+ stderr += data.toString();
66
+ });
67
+ child.on("close", (code) => {
68
+ if (debug && stderr) {
69
+ console.warn(`[next-sitemap] Worker stderr: ${stderr}`);
70
+ }
71
+ if (code !== 0 && code !== null) {
72
+ if (debug) console.warn(`[next-sitemap] Worker exited with code ${code}`);
73
+ resolve(null);
74
+ return;
75
+ }
76
+ try {
77
+ const lines = stdout.trim().split("\n");
78
+ const result = JSON.parse(lines[lines.length - 1]);
79
+ if (result.success) {
80
+ resolve(result.params);
81
+ } else {
82
+ if (result.error !== NO_STATIC_PARAMS && debug) {
83
+ console.warn(`[next-sitemap] Worker error: ${result.error}`);
84
+ }
85
+ resolve(null);
86
+ }
87
+ } catch {
88
+ if (debug) console.warn(`[next-sitemap] Failed to parse worker output: ${stdout}`);
89
+ resolve(null);
90
+ }
91
+ });
92
+ child.on("error", (err) => {
93
+ if (debug) console.warn(`[next-sitemap] Failed to spawn worker: ${err.message}`);
94
+ resolve(null);
95
+ });
96
+ });
97
+ }
98
+ async function getRouteParams(route, directory, debug) {
99
+ const cacheKey = route.fileKey;
100
+ if (paramsCache.has(cacheKey)) {
101
+ return paramsCache.get(cacheKey);
102
+ }
103
+ if (debug) {
104
+ console.log(`[next-sitemap] ${route.pathname}: executing static params via worker`);
105
+ }
106
+ const params = await executeWorker(directory, route.fileKey, debug);
107
+ paramsCache.set(cacheKey, params);
108
+ if (debug && params) {
109
+ console.log(`[next-sitemap] ${route.pathname}: got ${params.length} params`);
110
+ }
111
+ return params;
112
+ }
113
+ async function generateAllPaths(routes, directory, debug) {
114
+ const staticPaths = ["/"];
115
+ const dynamicRoutes = [];
116
+ for (const route of routes) {
117
+ if (route.dynamicSegments.length === 0) {
118
+ if (route.pathname !== "/") {
119
+ staticPaths.push(route.pathname);
120
+ }
121
+ } else {
122
+ dynamicRoutes.push(route);
123
+ }
124
+ }
125
+ const startTime = isDev ? Date.now() : 0;
126
+ if (isDev && dynamicRoutes.length > 0) {
127
+ console.log(`[next-sitemap] Generating sitemap for ${dynamicRoutes.length} dynamic routes (dev only, instant in production)...`);
128
+ }
129
+ const dynamicResults = await Promise.all(
130
+ dynamicRoutes.map(async (route) => {
131
+ const params = await getRouteParams(route, directory, debug);
132
+ if (!params || params.length === 0) {
133
+ if (debug) {
134
+ console.warn(`[next-sitemap] Skipping dynamic route ${route.pathname}: no static params or empty result.`);
135
+ }
136
+ return [];
137
+ }
138
+ const paths = [];
139
+ for (const param of params) {
140
+ let path = route.pathname;
141
+ let valid = true;
142
+ for (const segment of route.dynamicSegments) {
143
+ const value = param[segment];
144
+ if (value === void 0) {
145
+ if (debug) {
146
+ console.warn(`[next-sitemap] ${route.pathname}: missing param "${segment}" in`, param);
147
+ }
148
+ valid = false;
149
+ break;
150
+ }
151
+ path = path.replace(`[${segment}]`, value);
152
+ }
153
+ if (valid) paths.push(path);
154
+ }
155
+ return paths;
156
+ })
157
+ );
158
+ const allPaths = new Set(staticPaths);
159
+ for (const paths of dynamicResults) {
160
+ for (const path of paths) {
161
+ allPaths.add(path);
162
+ }
163
+ }
164
+ if (isDev && dynamicRoutes.length > 0) {
165
+ const elapsed = Date.now() - startTime;
166
+ console.log(`[next-sitemap] Done! Found ${allPaths.size} total URLs in ${elapsed}ms.`);
167
+ }
168
+ return Array.from(allPaths);
169
+ }
170
+ function pathsToEntries(paths, config) {
171
+ const { baseUrl, locales = [], defaultLocale, exclude, priority, changeFreq } = config;
172
+ return paths.filter((pathname) => !shouldExclude(pathname, exclude)).map((pathname) => {
173
+ const entry = {
174
+ url: buildUrl(baseUrl, pathname, defaultLocale, defaultLocale),
175
+ lastModified: /* @__PURE__ */ new Date(),
176
+ changeFrequency: getChangeFreq(pathname, changeFreq),
177
+ priority: getPriority(pathname, priority)
178
+ };
179
+ if (locales.length > 0) {
180
+ entry.alternates = {
181
+ languages: Object.fromEntries(
182
+ locales.map((locale) => [locale, buildUrl(baseUrl, pathname, locale, defaultLocale)])
183
+ )
184
+ };
185
+ }
186
+ return entry;
187
+ });
188
+ }
34
189
 
35
190
  // src/index.ts
36
191
  function calculateDepthPriority(pathname) {
@@ -133,17 +288,16 @@ ${allEntries}
133
288
  }
134
289
 
135
290
  // src/app/index.ts
136
- var joinPath = (...segments) => path__namespace.join(...segments);
137
291
  function findPageFiles(dir, baseDir = dir) {
138
292
  const files = [];
139
293
  try {
140
- const entries = fs__namespace.readdirSync(dir, { withFileTypes: true });
294
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
141
295
  for (const entry of entries) {
142
- const fullPath = path__namespace.join(dir, entry.name);
296
+ const fullPath = path.join(dir, entry.name);
143
297
  if (entry.isDirectory()) {
144
298
  files.push(...findPageFiles(fullPath, baseDir));
145
299
  } else if (/^page\.(tsx?|jsx?)$/.test(entry.name)) {
146
- const relativePath = "./" + path__namespace.relative(baseDir, fullPath).replace(/\\/g, "/");
300
+ const relativePath = "./" + path.relative(baseDir, fullPath).replace(/\\/g, "/");
147
301
  files.push(relativePath);
148
302
  }
149
303
  }
@@ -151,83 +305,12 @@ function findPageFiles(dir, baseDir = dir) {
151
305
  }
152
306
  return files;
153
307
  }
154
- function detectAppDirectory() {
155
- const srcApp = path__namespace.join(process.cwd(), "src/app");
156
- if (fs__namespace.existsSync(srcApp)) {
157
- return srcApp;
158
- }
159
- return path__namespace.join(process.cwd(), "app");
160
- }
161
- function resolveAppDirectory(options) {
162
- if (options.appDirectory) {
163
- return path__namespace.isAbsolute(options.appDirectory) ? options.appDirectory : path__namespace.join(process.cwd(), options.appDirectory);
308
+ function resolveAppDirectory(appDirectory) {
309
+ if (appDirectory) {
310
+ return path.isAbsolute(appDirectory) ? appDirectory : path.join(process.cwd(), appDirectory);
164
311
  }
165
- return detectAppDirectory();
166
- }
167
- function getPageKeys(options) {
168
- return findPageFiles(resolveAppDirectory(options));
169
- }
170
- var jitiCache = /* @__PURE__ */ new Map();
171
- function getTsconfigPaths(projectRoot, debug = false) {
172
- const alias = {};
173
- try {
174
- const tsconfigPath = path__namespace.join(projectRoot, "tsconfig.json");
175
- if (debug) {
176
- console.log("[next-sitemap] Looking for tsconfig at:", tsconfigPath);
177
- console.log("[next-sitemap] tsconfig exists:", fs__namespace.existsSync(tsconfigPath));
178
- }
179
- if (fs__namespace.existsSync(tsconfigPath)) {
180
- const content = fs__namespace.readFileSync(tsconfigPath, "utf-8");
181
- const withoutComments = stripJsonComments__default.default(content);
182
- const cleaned = withoutComments.replace(/,(\s*[}\]])/g, "$1");
183
- if (debug) {
184
- console.log("[next-sitemap] Cleaned tsconfig (first 500 chars):", cleaned.slice(0, 500));
185
- }
186
- const tsconfig = JSON.parse(cleaned);
187
- if (debug) {
188
- console.log("[next-sitemap] Parsed tsconfig paths:", tsconfig.compilerOptions?.paths);
189
- }
190
- const baseUrl = tsconfig.compilerOptions?.baseUrl || ".";
191
- const paths = tsconfig.compilerOptions?.paths || {};
192
- for (const [key, values] of Object.entries(paths)) {
193
- if (values.length > 0) {
194
- const aliasKey = key.replace(/\*$/, "");
195
- const aliasValue = joinPath(projectRoot, baseUrl, values[0].replace(/\*$/, ""));
196
- alias[aliasKey] = aliasValue;
197
- }
198
- }
199
- }
200
- } catch (error) {
201
- if (debug) {
202
- console.error("[next-sitemap] Error parsing tsconfig:", error);
203
- }
204
- }
205
- return alias;
206
- }
207
- function getJiti(projectRoot, debug = false) {
208
- if (jitiCache.has(projectRoot)) {
209
- return jitiCache.get(projectRoot);
210
- }
211
- const alias = getTsconfigPaths(projectRoot, debug);
212
- if (debug) {
213
- console.log("[next-sitemap] Final alias config:", JSON.stringify(alias));
214
- }
215
- const jiti$1 = jiti.createJiti((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)), {
216
- moduleCache: false,
217
- interopDefault: true,
218
- jsx: true,
219
- alias
220
- });
221
- jitiCache.set(projectRoot, jiti$1);
222
- return jiti$1;
223
- }
224
- async function importPage(appDirectory, key, debug = false) {
225
- const relativePath = key.replace("./", "");
226
- const absolutePath = path__namespace.join(appDirectory, relativePath);
227
- const projectRoot = process.cwd();
228
- const jiti = getJiti(projectRoot, debug);
229
- const module = await jiti.import(absolutePath);
230
- return module.default || module;
312
+ const srcApp = path.join(process.cwd(), "src/app");
313
+ return fs.existsSync(srcApp) ? srcApp : path.join(process.cwd(), "app");
231
314
  }
232
315
  function extractRoutes(pageKeys, localeSegment) {
233
316
  const routes = [];
@@ -235,163 +318,64 @@ function extractRoutes(pageKeys, localeSegment) {
235
318
  if (key.includes("[...")) continue;
236
319
  let pathname = key.replace("./", "/").replace(/\/page\.(tsx?|jsx?)$/, "");
237
320
  if (localeSegment) {
238
- pathname = pathname.replace(
239
- new RegExp(`^/${localeSegment.replace(/[[\]]/g, "\\$&")}`),
240
- ""
241
- );
321
+ const escapedSegment = localeSegment.replace(/[[\]]/g, "\\$&");
322
+ pathname = pathname.replace(new RegExp(`^/${escapedSegment}`), "");
242
323
  }
243
324
  pathname = pathname.replace(/\/\([^)]+\)/g, "");
244
325
  if (/(?:^|\/)(src|app)(?:\/|$)/.test(pathname)) continue;
245
- if (!pathname || pathname === "") {
246
- pathname = "/";
247
- } else if (!pathname.startsWith("/")) {
326
+ pathname = pathname || "/";
327
+ if (pathname !== "/" && !pathname.startsWith("/")) {
248
328
  pathname = "/" + pathname;
249
329
  }
250
- const dynamicSegments = pathname.match(/\[([^\]]+)\]/g)?.map((s) => s.slice(1, -1)) || [];
251
- routes.push({
252
- pathname,
253
- dynamicSegments,
254
- key
255
- });
330
+ const dynamicSegments = pathname.match(/\[([^\]]+)\]/g)?.map((s) => s.slice(1, -1)) ?? [];
331
+ routes.push({ pathname, dynamicSegments, fileKey: key });
256
332
  }
257
333
  return routes;
258
334
  }
259
- async function getAllPaths(routes, appDirectory, debug = false) {
260
- const allPaths = ["/"];
261
- const seenPaths = /* @__PURE__ */ new Set(["/"]);
262
- for (const route of routes) {
263
- if (route.dynamicSegments.length === 0) {
264
- if (route.pathname !== "/" && !seenPaths.has(route.pathname)) {
265
- allPaths.push(route.pathname);
266
- seenPaths.add(route.pathname);
267
- }
268
- } else {
269
- let getParams = null;
270
- try {
271
- if (debug) {
272
- console.log(`[next-sitemap] ${route.pathname}: importing ${route.key}`);
273
- }
274
- const module = await importPage(appDirectory, route.key, debug);
275
- getParams = module.generateStaticParams || null;
276
- } catch (error) {
277
- if (debug) {
278
- console.warn(`[next-sitemap] ${route.pathname}: import failed:`, error);
279
- }
280
- }
281
- if (getParams) {
282
- try {
283
- const params = await getParams();
284
- if (debug) {
285
- console.log(`[next-sitemap] ${route.pathname}: generateStaticParams returned ${params.length} params`);
286
- }
287
- for (const param of params) {
288
- let dynamicPath = route.pathname;
289
- for (const segment of route.dynamicSegments) {
290
- const value = param[segment];
291
- if (value === void 0) {
292
- if (debug) {
293
- console.warn(`[next-sitemap] ${route.pathname}: missing param "${segment}" in`, param);
294
- }
295
- continue;
296
- }
297
- dynamicPath = dynamicPath.replace(`[${segment}]`, value);
298
- }
299
- if (!seenPaths.has(dynamicPath)) {
300
- allPaths.push(dynamicPath);
301
- seenPaths.add(dynamicPath);
302
- }
303
- }
304
- } catch (error) {
305
- console.error(`[next-sitemap] Error calling generateStaticParams for ${route.pathname}:`, error);
306
- }
307
- } else {
308
- if (debug) {
309
- console.warn(
310
- `[next-sitemap] Skipping dynamic route ${route.pathname}: no generateStaticParams exported. Use additionalSitemaps for routes that fetch data at runtime.`
311
- );
312
- }
313
- }
314
- }
315
- }
316
- return allPaths;
317
- }
318
- function pathsToEntries(paths, config) {
319
- const { baseUrl, locales = [], defaultLocale, exclude, priority, changeFreq } = config;
320
- const filteredPaths = paths.filter((pathname) => !shouldExclude(pathname, exclude));
321
- return filteredPaths.map((pathname) => {
322
- const entry = {
323
- url: buildUrl(baseUrl, pathname, defaultLocale, defaultLocale),
324
- lastModified: /* @__PURE__ */ new Date(),
325
- changeFrequency: getChangeFreq(pathname, changeFreq),
326
- priority: getPriority(pathname, priority)
327
- };
328
- if (locales.length > 0) {
329
- entry.alternates = {
330
- languages: Object.fromEntries(
331
- locales.map((locale) => [
332
- locale,
333
- buildUrl(baseUrl, pathname, locale, defaultLocale)
334
- ])
335
- )
336
- };
337
- }
338
- return entry;
339
- });
340
- }
341
335
  function createSitemapIndexHandler(options) {
342
336
  const { urlsPerSitemap = 5e3, locales = [], defaultLocale, additionalSitemaps, exclude, debug = false } = options;
343
337
  const localeSegment = options.localeSegment ?? (locales.length > 0 || defaultLocale ? "[locale]" : "");
344
- const appDir = resolveAppDirectory(options);
345
- const pageKeys = getPageKeys(options);
338
+ const appDir = resolveAppDirectory(options.appDirectory);
339
+ const pageKeys = findPageFiles(appDir);
346
340
  const routes = extractRoutes(pageKeys, localeSegment);
347
341
  return {
348
342
  GET: async () => {
349
343
  if (debug) {
350
- console.log(`[next-sitemap] Found ${routes.length} routes:`);
351
- routes.forEach((r) => {
352
- const isDynamic = r.dynamicSegments.length > 0;
353
- const segments = isDynamic ? ` [${r.dynamicSegments.join(", ")}]` : "";
354
- console.log(` ${r.pathname}${segments}${isDynamic ? " (dynamic)" : ""}`);
355
- });
344
+ console.log(`[next-sitemap] Found ${routes.length} routes`);
356
345
  }
357
- const allPaths = await getAllPaths(routes, appDir, debug);
358
- const filteredPaths = allPaths.filter((pathname) => !shouldExclude(pathname, exclude));
346
+ const allPaths = await generateAllPaths(routes, appDir, debug);
347
+ const filteredPaths = allPaths.filter((p) => !shouldExclude(p, exclude));
359
348
  const sitemapCount = Math.max(1, Math.ceil(filteredPaths.length / urlsPerSitemap));
360
- const xml = generateSitemapIndexXml(options.baseUrl, sitemapCount, {
361
- additionalSitemaps
362
- });
363
- return new Response(xml, {
364
- headers: { "Content-Type": "application/xml" }
365
- });
349
+ return new Response(
350
+ generateSitemapIndexXml(options.baseUrl, sitemapCount, { additionalSitemaps }),
351
+ { headers: { "Content-Type": "application/xml" } }
352
+ );
366
353
  }
367
354
  };
368
355
  }
369
356
  function createSitemapHandler(options) {
370
357
  const { urlsPerSitemap = 5e3, locales = [], defaultLocale, exclude, debug = false } = options;
371
358
  const localeSegment = options.localeSegment ?? (locales.length > 0 || defaultLocale ? "[locale]" : "");
372
- const appDir = resolveAppDirectory(options);
373
- const pageKeys = getPageKeys(options);
359
+ const appDir = resolveAppDirectory(options.appDirectory);
360
+ const pageKeys = findPageFiles(appDir);
374
361
  const routes = extractRoutes(pageKeys, localeSegment);
375
362
  const getFilteredPaths = async () => {
376
- const allPaths = await getAllPaths(routes, appDir, debug);
377
- return allPaths.filter((pathname) => !shouldExclude(pathname, exclude));
363
+ const allPaths = await generateAllPaths(routes, appDir, debug);
364
+ return allPaths.filter((p) => !shouldExclude(p, exclude));
378
365
  };
379
366
  return {
380
367
  generateStaticParams: async () => {
381
368
  const filteredPaths = await getFilteredPaths();
382
- const sitemapCount = Math.max(1, Math.ceil(filteredPaths.length / urlsPerSitemap));
383
- return Array.from({ length: sitemapCount }, (_, i) => ({ id: String(i) }));
369
+ const count = Math.max(1, Math.ceil(filteredPaths.length / urlsPerSitemap));
370
+ return Array.from({ length: count }, (_, i) => ({ id: String(i) }));
384
371
  },
385
372
  GET: async (_request, { params }) => {
386
373
  const { id } = await params;
387
374
  const sitemapId = parseInt(id, 10);
388
375
  const filteredPaths = await getFilteredPaths();
389
- const start = sitemapId * urlsPerSitemap;
390
- const end = start + urlsPerSitemap;
391
- const paths = filteredPaths.slice(start, end);
376
+ const paths = filteredPaths.slice(sitemapId * urlsPerSitemap, (sitemapId + 1) * urlsPerSitemap);
392
377
  const entries = pathsToEntries(paths, { ...options, exclude: void 0 });
393
- const xml = generateSitemapXml(entries);
394
- return new Response(xml, {
378
+ return new Response(generateSitemapXml(entries), {
395
379
  headers: { "Content-Type": "application/xml" }
396
380
  });
397
381
  }
@@ -1,4 +1,5 @@
1
1
  type ChangeFrequency = "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
2
+
2
3
  interface SitemapConfig {
3
4
  /**
4
5
  * Base URL of the site (e.g., "https://example.com")
@@ -51,6 +52,11 @@ interface SitemapConfig {
51
52
  * @example additionalSitemaps: ["/products-sitemap.xml", "/blog-sitemap.xml"]
52
53
  */
53
54
  additionalSitemaps?: string[];
55
+ /**
56
+ * Enable debug logging to diagnose issues with route discovery
57
+ * @default false
58
+ */
59
+ debug?: boolean;
54
60
  }
55
61
  interface SitemapEntry {
56
62
  url: string;
@@ -67,19 +73,8 @@ interface CreateSitemapHandlerOptions extends SitemapConfig {
67
73
  * Path to the app directory to scan for page.tsx files.
68
74
  * Can be absolute or relative to process.cwd().
69
75
  * If not provided, auto-detects src/app or app.
70
- *
71
- * Example:
72
- * ```ts
73
- * appDirectory: 'src/app/(frontend)'
74
- * ```
75
76
  */
76
77
  appDirectory?: string;
77
- /**
78
- * Enable debug logging to diagnose issues with route discovery
79
- * Logs info about generateStaticParams calls and skipped routes
80
- * @default false
81
- */
82
- debug?: boolean;
83
78
  }
84
79
  /**
85
80
  * Create handlers for sitemap index route
@@ -1,4 +1,5 @@
1
1
  type ChangeFrequency = "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
2
+
2
3
  interface SitemapConfig {
3
4
  /**
4
5
  * Base URL of the site (e.g., "https://example.com")
@@ -51,6 +52,11 @@ interface SitemapConfig {
51
52
  * @example additionalSitemaps: ["/products-sitemap.xml", "/blog-sitemap.xml"]
52
53
  */
53
54
  additionalSitemaps?: string[];
55
+ /**
56
+ * Enable debug logging to diagnose issues with route discovery
57
+ * @default false
58
+ */
59
+ debug?: boolean;
54
60
  }
55
61
  interface SitemapEntry {
56
62
  url: string;
@@ -67,19 +73,8 @@ interface CreateSitemapHandlerOptions extends SitemapConfig {
67
73
  * Path to the app directory to scan for page.tsx files.
68
74
  * Can be absolute or relative to process.cwd().
69
75
  * If not provided, auto-detects src/app or app.
70
- *
71
- * Example:
72
- * ```ts
73
- * appDirectory: 'src/app/(frontend)'
74
- * ```
75
76
  */
76
77
  appDirectory?: string;
77
- /**
78
- * Enable debug logging to diagnose issues with route discovery
79
- * Logs info about generateStaticParams calls and skipped routes
80
- * @default false
81
- */
82
- debug?: boolean;
83
78
  }
84
79
  /**
85
80
  * Create handlers for sitemap index route