write-sitemap-chunk.ts — astro Source File
Architecture documentation for write-sitemap-chunk.ts, a typescript file in the astro codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d93872ee_352c_b6ca_8205_2268f8108f4e["write-sitemap-chunk.ts"] 3adbf330_e1f3_6c24_255f_e8c25442ac9f["./index.js"] d93872ee_352c_b6ca_8205_2268f8108f4e --> 3adbf330_e1f3_6c24_255f_e8c25442ac9f e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"] d93872ee_352c_b6ca_8205_2268f8108f4e --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415 5d6d1861_a18d_b246_cd94_08889ab7e74c["promises"] d93872ee_352c_b6ca_8205_2268f8108f4e --> 5d6d1861_a18d_b246_cd94_08889ab7e74c c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"] d93872ee_352c_b6ca_8205_2268f8108f4e --> c52a5f83_66e3_37d7_9ebb_767f7129bc62 8f34f3e8_2f0f_1f0d_91dc_c25ece8c8169["node:stream"] d93872ee_352c_b6ca_8205_2268f8108f4e --> 8f34f3e8_2f0f_1f0d_91dc_c25ece8c8169 b4a76fc8_3591_85b4_7b57_55ab21d1030d["node:util"] d93872ee_352c_b6ca_8205_2268f8108f4e --> b4a76fc8_3591_85b4_7b57_55ab21d1030d f16d8c76_2866_6150_bd14_0347b59abfe9["astro"] d93872ee_352c_b6ca_8205_2268f8108f4e --> f16d8c76_2866_6150_bd14_0347b59abfe9 4b2a278b_7519_80c4_73d6_387d11edd840["sitemap"] d93872ee_352c_b6ca_8205_2268f8108f4e --> 4b2a278b_7519_80c4_73d6_387d11edd840 d737c47c_6343_2a32_1a89_76870c6eadf4["stream-replace-string"] d93872ee_352c_b6ca_8205_2268f8108f4e --> d737c47c_6343_2a32_1a89_76870c6eadf4 style d93872ee_352c_b6ca_8205_2268f8108f4e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { createWriteStream, type WriteStream } from 'node:fs';
import { mkdir } from 'node:fs/promises';
import { normalize, resolve } from 'node:path';
import { pipeline, Readable } from 'node:stream';
import { promisify } from 'node:util';
import type { AstroConfig } from 'astro';
import { SitemapAndIndexStream, SitemapIndexStream, SitemapStream } from 'sitemap';
import replace from 'stream-replace-string';
import type { SitemapItem } from './index.js';
type WriteSitemapChunkConfig = {
filenameBase: string;
hostname: string;
sitemapHostname?: string;
sourceData: Record<string, SitemapItem[]>;
destinationDir: string;
customSitemaps?: string[];
publicBasePath?: string;
limit?: number;
xslURL?: string;
lastmod?: string;
namespaces?: {
news?: boolean;
xhtml?: boolean;
image?: boolean;
video?: boolean;
};
};
// adapted from sitemap.js/sitemap-simple
export async function writeSitemapChunk(
{
filenameBase,
hostname,
sitemapHostname = hostname,
sourceData,
destinationDir,
limit = 50000,
customSitemaps = [],
publicBasePath = './',
xslURL: xslUrl,
lastmod,
namespaces = { news: true, xhtml: true, image: true, video: true },
}: WriteSitemapChunkConfig,
astroConfig: AstroConfig,
) {
await mkdir(destinationDir, { recursive: true });
// Normalize publicBasePath
let normalizedPublicBasePath = publicBasePath;
if (!normalizedPublicBasePath.endsWith('/')) {
normalizedPublicBasePath += '/';
}
// Array to collect all sitemap URLs for the index
const sitemapUrls: Array<{ url: string; lastmod?: string }> = [];
// Process each chunk separately
for (const [chunkName, items] of Object.entries(sourceData)) {
const sitemapAndIndexStream = new SitemapAndIndexStream({
// ... (68 more lines)
Domain
Subdomains
Functions
Types
Dependencies
- ./index.js
- astro
- node:fs
- node:path
- node:stream
- node:util
- promises
- sitemap
- stream-replace-string
Source
Frequently Asked Questions
What does write-sitemap-chunk.ts do?
write-sitemap-chunk.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, CoreMiddleware subdomain.
What functions are defined in write-sitemap-chunk.ts?
write-sitemap-chunk.ts defines 1 function(s): writeSitemapChunk.
What does write-sitemap-chunk.ts depend on?
write-sitemap-chunk.ts imports 9 module(s): ./index.js, astro, node:fs, node:path, node:stream, node:util, promises, sitemap, and 1 more.
Where is write-sitemap-chunk.ts in the architecture?
write-sitemap-chunk.ts is located at packages/integrations/sitemap/src/write-sitemap-chunk.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/integrations/sitemap/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free