@power-seo/sitemap 1.0.10 → 1.0.12
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/README.md +28 -29
- package/package.json +31 -10
package/README.md
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
# @power-seo/sitemap
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
5
|
XML sitemap generation for TypeScript — streaming output, automatic index splitting, image/video/news extensions, and URL validation — works in Next.js, Remix, Express, and edge runtimes with zero runtime dependencies.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@power-seo/sitemap)
|
|
8
8
|
[](https://www.npmjs.com/package/@power-seo/sitemap)
|
|
9
9
|
[](https://socket.dev/npm/package/@power-seo/sitemap)
|
|
10
|
-
[](https://github.com/CyberCraftBD/power-seo/actions)
|
|
11
10
|
[](https://opensource.org/licenses/MIT)
|
|
12
11
|
[](https://www.typescriptlang.org/)
|
|
13
12
|
[](https://bundlephobia.com/package/@power-seo/sitemap)
|
|
14
13
|
|
|
15
|
-
`@power-seo/sitemap` produces standards-compliant `<urlset>` and `<sitemapindex>` XML from typed URL arrays. Provide a hostname and URL list — get back a valid XML string ready to serve as `Content-Type: application/xml`. For large catalogs, stream chunks with constant memory usage or auto-split at the 50,000-URL spec limit with a generated index file. All
|
|
14
|
+
`@power-seo/sitemap` produces standards-compliant `<urlset>` and `<sitemapindex>` XML from typed URL arrays. Provide a hostname and URL list — get back a valid XML string ready to serve as `Content-Type: application/xml`. For large catalogs, stream chunks with constant memory usage or auto-split at the 50,000-URL spec limit with a generated index file. All six functions are independently importable and tree-shakeable.
|
|
16
15
|
|
|
17
16
|
> **Zero runtime dependencies** — only `@power-seo/core` as a peer.
|
|
18
17
|
|
|
@@ -31,7 +30,13 @@ XML sitemap generation for TypeScript — streaming output, automatic index spli
|
|
|
31
30
|
| Hostname handling | ❌ Hardcode absolute URLs everywhere | ✅ Pass `hostname` once; use relative `loc` paths |
|
|
32
31
|
| Validation | ❌ Silent bad data reaches Google | ✅ `validateSitemapUrl()` returns errors + warnings |
|
|
33
32
|
|
|
34
|
-

|
|
34
|
+
|
|
35
|
+
<p align="left">
|
|
36
|
+
<a href="https://www.buymeacoffee.com/ccbd.dev" target="_blank">
|
|
37
|
+
<img src="https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20coffee&emoji=&slug=ccbd.dev&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff" />
|
|
38
|
+
</a>
|
|
39
|
+
</p>
|
|
35
40
|
|
|
36
41
|
---
|
|
37
42
|
|
|
@@ -45,15 +50,16 @@ XML sitemap generation for TypeScript — streaming output, automatic index spli
|
|
|
45
50
|
- **Streaming generation** — `streamSitemap()` is a synchronous generator yielding XML string chunks; no memory spike on large lists
|
|
46
51
|
- **Automatic index splitting** — `splitSitemap()` chunks at `MAX_URLS_PER_SITEMAP` (50,000) and returns both sitemaps and the index XML
|
|
47
52
|
- **Sitemap index generation** — `generateSitemapIndex()` creates a `<sitemapindex>` pointing to child sitemaps
|
|
53
|
+
- **Smart namespace detection** — `generateSitemap()` only declares XML namespaces for extensions (image, video, news) that are actually used
|
|
48
54
|
- **URL validation** — `validateSitemapUrl()` returns `{ valid, errors, warnings }` without throwing
|
|
49
|
-
- **Next.js App Router adapter** — `toNextSitemap()`
|
|
55
|
+
- **Next.js App Router adapter** — `toNextSitemap()` converts `SitemapURL[]` to the `MetadataRoute.Sitemap[]` format for `app/sitemap.ts`
|
|
50
56
|
- **Constants exported** — `MAX_URLS_PER_SITEMAP` (50,000) and `MAX_SITEMAP_SIZE_BYTES` (52,428,800)
|
|
51
57
|
- **Framework-agnostic** — works in Next.js API routes, Remix loaders, Express, Fastify, and edge runtimes
|
|
52
58
|
- **Full TypeScript support** — typed `SitemapURL`, `SitemapImage`, `SitemapVideo`, `SitemapNews`, `SitemapConfig`
|
|
53
59
|
- **Zero runtime dependencies** — pure TypeScript, no external XML libraries
|
|
54
60
|
- **Tree-shakeable** — import only the functions you use
|
|
55
61
|
|
|
56
|
-

|
|
57
63
|
|
|
58
64
|
---
|
|
59
65
|
|
|
@@ -74,7 +80,7 @@ XML sitemap generation for TypeScript — streaming output, automatic index spli
|
|
|
74
80
|
| Tree-shakeable | ✅ | ❌ | ❌ | ❌ |
|
|
75
81
|
| Next.js `app/sitemap.ts` adapter | ✅ | ✅ | ❌ | ❌ |
|
|
76
82
|
|
|
77
|
-

|
|
78
84
|
|
|
79
85
|
---
|
|
80
86
|
|
|
@@ -116,7 +122,7 @@ const xml = generateSitemap({
|
|
|
116
122
|
|
|
117
123
|
`hostname` is required — it is prepended to any `loc` value that is a relative path. Absolute `loc` values (starting with `http`) are used as-is.
|
|
118
124
|
|
|
119
|
-

|
|
120
126
|
|
|
121
127
|
---
|
|
122
128
|
|
|
@@ -254,11 +260,11 @@ const result = validateSitemapUrl({
|
|
|
254
260
|
|
|
255
261
|
### Next.js App Router — `app/sitemap.ts` Convention
|
|
256
262
|
|
|
257
|
-
Next.js App Router has a built-in `app/sitemap.ts` file convention that returns an array of URL objects (not XML). Use `toNextSitemap()`
|
|
263
|
+
Next.js App Router has a built-in `app/sitemap.ts` file convention that returns an array of URL objects (not XML). Use `toNextSitemap()` to convert `SitemapURL[]` to the required format:
|
|
258
264
|
|
|
259
265
|
```ts
|
|
260
266
|
// app/sitemap.ts
|
|
261
|
-
import { toNextSitemap } from '@power-seo/sitemap
|
|
267
|
+
import { toNextSitemap } from '@power-seo/sitemap';
|
|
262
268
|
|
|
263
269
|
export default async function sitemap() {
|
|
264
270
|
const urls = await fetchUrlsFromCms();
|
|
@@ -268,7 +274,7 @@ export default async function sitemap() {
|
|
|
268
274
|
}
|
|
269
275
|
```
|
|
270
276
|
|
|
271
|
-
`toNextSitemap()` filters out invalid URLs
|
|
277
|
+
`toNextSitemap()` filters out invalid URLs and maps `changefreq` to `changeFrequency` as required by Next.js. The `lastmod` field is passed through as-is (string or Date).
|
|
272
278
|
|
|
273
279
|
### Next.js App Router — Route Handler (XML)
|
|
274
280
|
|
|
@@ -387,22 +393,22 @@ function validateSitemapUrl(url: SitemapURL): SitemapValidationResult;
|
|
|
387
393
|
|
|
388
394
|
Returns `{ valid: boolean; errors: string[]; warnings: string[] }`. Never throws.
|
|
389
395
|
|
|
390
|
-
### `toNextSitemap(urls)`
|
|
396
|
+
### `toNextSitemap(urls)`
|
|
391
397
|
|
|
392
398
|
```ts
|
|
393
|
-
import { toNextSitemap } from '@power-seo/sitemap
|
|
399
|
+
import { toNextSitemap } from '@power-seo/sitemap';
|
|
394
400
|
|
|
395
401
|
function toNextSitemap(urls: SitemapURL[]): NextSitemapEntry[];
|
|
396
402
|
```
|
|
397
403
|
|
|
398
|
-
Converts a `SitemapURL[]` to the array format expected by Next.js App Router's `app/sitemap.ts` file convention. Invalid URLs (per `validateSitemapUrl`) are filtered out automatically. `
|
|
404
|
+
Converts a `SitemapURL[]` to the array format expected by Next.js App Router's `app/sitemap.ts` file convention. Invalid URLs (per `validateSitemapUrl`) are filtered out automatically. `changefreq` is mapped to `changeFrequency`.
|
|
399
405
|
|
|
400
|
-
| Field | Type | Description
|
|
401
|
-
| ----------------- | ---------------- |
|
|
402
|
-
| `url` | `string` | Absolute URL (`loc`)
|
|
403
|
-
| `lastModified` | `Date \| string` | From `lastmod` (
|
|
404
|
-
| `changeFrequency` | `string` | From `changefreq`
|
|
405
|
-
| `priority` | `number` | From `priority`
|
|
406
|
+
| Field | Type | Description |
|
|
407
|
+
| ----------------- | ---------------- | ------------------------------------- |
|
|
408
|
+
| `url` | `string` | Absolute URL (`loc`) |
|
|
409
|
+
| `lastModified` | `Date \| string` | From `lastmod` (passed through as-is) |
|
|
410
|
+
| `changeFrequency` | `string` | From `changefreq` |
|
|
411
|
+
| `priority` | `number` | From `priority` |
|
|
406
412
|
|
|
407
413
|
---
|
|
408
414
|
|
|
@@ -461,7 +467,7 @@ Converts a `SitemapURL[]` to the array format expected by Next.js App Router's `
|
|
|
461
467
|
- **SSR compatible** — safe to run in Next.js Server Components, Remix loaders, or Express handlers
|
|
462
468
|
- **Edge runtime safe** — no `fs`, no `path`, no Node.js-specific APIs; runs in Cloudflare Workers, Vercel Edge, Deno
|
|
463
469
|
- **Synchronous generator streaming** — `streamSitemap()` uses `function*` — no async overhead, no backpressure complexity
|
|
464
|
-
- **
|
|
470
|
+
- **Smart namespace detection** — `generateSitemap()` only declares image/video/news namespaces when actually used; `streamSitemap()` always includes all namespaces for simplicity
|
|
465
471
|
- **Tree-shakeable** — `"sideEffects": false` with named exports per function
|
|
466
472
|
- **Dual ESM + CJS** — ships both formats via tsup for any bundler or `require()` usage
|
|
467
473
|
|
|
@@ -472,7 +478,6 @@ Converts a `SitemapURL[]` to the array format expected by Next.js App Router's `
|
|
|
472
478
|
- No install scripts (`postinstall`, `preinstall`)
|
|
473
479
|
- No runtime network access
|
|
474
480
|
- No `eval` or dynamic code execution
|
|
475
|
-
- npm provenance enabled — every release is signed via Sigstore through GitHub Actions
|
|
476
481
|
- CI-signed builds — all releases published via verified `github.com/CyberCraftBD/power-seo` workflow
|
|
477
482
|
- Safe for SSR, Edge, and server environments
|
|
478
483
|
|
|
@@ -487,7 +492,7 @@ All 17 packages are independently installable — use only what you need.
|
|
|
487
492
|
| [`@power-seo/core`](https://www.npmjs.com/package/@power-seo/core) | `npm i @power-seo/core` | Framework-agnostic utilities, types, validators, and constants |
|
|
488
493
|
| [`@power-seo/react`](https://www.npmjs.com/package/@power-seo/react) | `npm i @power-seo/react` | React SEO components — meta, Open Graph, Twitter Card, breadcrumbs |
|
|
489
494
|
| [`@power-seo/meta`](https://www.npmjs.com/package/@power-seo/meta) | `npm i @power-seo/meta` | SSR meta helpers for Next.js App Router, Remix v2, and generic SSR |
|
|
490
|
-
| [`@power-seo/schema`](https://www.npmjs.com/package/@power-seo/schema) | `npm i @power-seo/schema` | Type-safe JSON-LD structured data — 23 builders +
|
|
495
|
+
| [`@power-seo/schema`](https://www.npmjs.com/package/@power-seo/schema) | `npm i @power-seo/schema` | Type-safe JSON-LD structured data — 23 builders + 22 React components |
|
|
491
496
|
| [`@power-seo/content-analysis`](https://www.npmjs.com/package/@power-seo/content-analysis) | `npm i @power-seo/content-analysis` | Yoast-style SEO content scoring engine with React components |
|
|
492
497
|
| [`@power-seo/readability`](https://www.npmjs.com/package/@power-seo/readability) | `npm i @power-seo/readability` | Readability scoring — Flesch-Kincaid, Gunning Fog, Coleman-Liau, ARI |
|
|
493
498
|
| [`@power-seo/preview`](https://www.npmjs.com/package/@power-seo/preview) | `npm i @power-seo/preview` | SERP, Open Graph, and Twitter/X Card preview generators |
|
|
@@ -504,12 +509,6 @@ All 17 packages are independently installable — use only what you need.
|
|
|
504
509
|
|
|
505
510
|
---
|
|
506
511
|
|
|
507
|
-
## Keywords
|
|
508
|
-
|
|
509
|
-
xml sitemap generator typescript · sitemap npm package · nextjs sitemap · streaming sitemap · sitemap index generator · image sitemap extension · video sitemap extension · news sitemap google · split sitemap 50000 urls · sitemap validation · edge runtime sitemap · remix sitemap · programmatic seo sitemap · sitemap generator zero dependencies · typescript xml sitemap · sitemap url priority · crawl budget optimization · sitemap changelog · google sitemap spec · seo sitemap typescript
|
|
510
|
-
|
|
511
|
-
---
|
|
512
|
-
|
|
513
512
|
## About [CyberCraft Bangladesh](https://ccbd.dev)
|
|
514
513
|
|
|
515
514
|
**[CyberCraft Bangladesh](https://ccbd.dev)** is a Bangladesh-based enterprise-grade software development and Full Stack SEO service provider company specializing in ERP system development, AI-powered SaaS and business applications, full-stack SEO services, custom website development, and scalable eCommerce platforms. We design and develop intelligent, automation-driven SaaS and enterprise solutions that help startups, SMEs, NGOs, educational institutes, and large organizations streamline operations, enhance digital visibility, and accelerate growth through modern cloud-native technologies.
|
package/package.json
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@power-seo/sitemap",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "XML sitemap generation, streaming, and validation with image, video, and news support",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"seo",
|
|
7
|
+
"sitemap",
|
|
8
|
+
"xml",
|
|
9
|
+
"xml-sitemap",
|
|
10
|
+
"sitemap-generator",
|
|
11
|
+
"sitemap-index",
|
|
12
|
+
"nextjs-sitemap",
|
|
13
|
+
"streaming-sitemap",
|
|
14
|
+
"image-sitemap",
|
|
15
|
+
"video-sitemap",
|
|
16
|
+
"news-sitemap",
|
|
17
|
+
"split-sitemap",
|
|
18
|
+
"sitemap-validation",
|
|
19
|
+
"edge-runtime",
|
|
20
|
+
"remix",
|
|
21
|
+
"crawl-budget",
|
|
22
|
+
"google-sitemap",
|
|
23
|
+
"url-priority",
|
|
24
|
+
"typescript",
|
|
25
|
+
"zero-dependency"
|
|
26
|
+
],
|
|
5
27
|
"license": "MIT",
|
|
6
28
|
"type": "module",
|
|
7
29
|
"exports": {
|
|
@@ -15,10 +37,16 @@
|
|
|
15
37
|
"module": "./dist/index.js",
|
|
16
38
|
"types": "./dist/index.d.ts",
|
|
17
39
|
"files": [
|
|
18
|
-
"dist"
|
|
40
|
+
"dist",
|
|
41
|
+
"LICENSE"
|
|
19
42
|
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.0.0",
|
|
45
|
+
"npm": ">=9.0.0",
|
|
46
|
+
"pnpm": ">=8.0.0"
|
|
47
|
+
},
|
|
20
48
|
"dependencies": {
|
|
21
|
-
"@power-seo/core": "1.0.
|
|
49
|
+
"@power-seo/core": "1.0.12"
|
|
22
50
|
},
|
|
23
51
|
"devDependencies": {
|
|
24
52
|
"rimraf": "^6.1.3",
|
|
@@ -26,13 +54,6 @@
|
|
|
26
54
|
"typescript": "^5.7.0",
|
|
27
55
|
"vitest": "^2.1.0"
|
|
28
56
|
},
|
|
29
|
-
"keywords": [
|
|
30
|
-
"seo",
|
|
31
|
-
"sitemap",
|
|
32
|
-
"xml",
|
|
33
|
-
"sitemap-index",
|
|
34
|
-
"typescript"
|
|
35
|
-
],
|
|
36
57
|
"sideEffects": false,
|
|
37
58
|
"author": "CyberCraft Bangladesh <info@ccbd.dev>",
|
|
38
59
|
"repository": {
|