Bun's SQL client (mariadb/mysql adapters, Bun 1.3.14) doesn't keep the event loop alive for a query on an idle connection, so a second dynamic route's sitemap export querying the DB made the command exit silently. Hold the loop open with a timer during generation, and log what a stuck run is waiting on. Co-Authored-By: Claude Opus 5.5 <[email protected]>
41 lines
1.6 KiB
TypeScript
41 lines
1.6 KiB
TypeScript
import type { BunextGenerateSitemapParams, BunextSitemapEntry } from "../types";
|
|
/**
|
|
* Protocol limits for a single sitemap file
|
|
* https://www.sitemaps.org/protocol.html#index
|
|
*/
|
|
export declare const SitemapMaxUrlsPerFile = 50000;
|
|
export declare const SitemapMaxBytesPerFile: number;
|
|
export declare const SitemapDefaultChunkSize = 10000;
|
|
export declare function grabPendingSitemapTask(): string | undefined;
|
|
export type SitemapChunkFile = {
|
|
file_name: string;
|
|
xml: string;
|
|
url_count: number;
|
|
};
|
|
export type SitemapFiles = {
|
|
/**
|
|
* A `<urlset>` when everything fits in one file, otherwise a
|
|
* `<sitemapindex>` referencing `chunks`.
|
|
*/
|
|
sitemap: string;
|
|
chunks: SitemapChunkFile[];
|
|
url_count: number;
|
|
};
|
|
/**
|
|
* # Generate a sitemap.xml string for all pages
|
|
* Dynamic routes are only included through a `sitemap` export in their
|
|
* `.server.ts` file, or through `additional_paths`. Always returns a
|
|
* single `<urlset>`; `bunext sitemap` splits large sitemaps into chunks.
|
|
*/
|
|
export default function generateSitemap(params?: BunextGenerateSitemapParams): Promise<string>;
|
|
/**
|
|
* # Generate sitemap.xml, split into chunk files when needed
|
|
* Chunks hold at most `chunk_size` URLs and 50MB each. `chunks_url_path`
|
|
* is the public URL path the chunk files are served from.
|
|
*/
|
|
export declare function generateSitemapFiles({ chunk_size, chunks_url_path, ...params }: BunextGenerateSitemapParams & {
|
|
chunk_size?: number;
|
|
chunks_url_path: string;
|
|
}): Promise<SitemapFiles>;
|
|
export declare function grabSitemapEntries(params?: BunextGenerateSitemapParams): Promise<BunextSitemapEntry[]>;
|