vaza-content 0.1.0 → 0.2.1
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 +267 -0
- package/dist/adapters/astro/index.cjs +8 -12
- package/dist/adapters/astro/index.cjs.map +1 -1
- package/dist/adapters/astro/index.d.cts +4 -3
- package/dist/adapters/astro/index.d.ts +4 -3
- package/dist/adapters/astro/index.js +7 -11
- package/dist/adapters/astro/index.js.map +1 -1
- package/dist/adapters/next/index.cjs +12 -10
- package/dist/adapters/next/index.cjs.map +1 -1
- package/dist/adapters/next/index.d.cts +6 -4
- package/dist/adapters/next/index.d.ts +6 -4
- package/dist/adapters/next/index.js +11 -9
- package/dist/adapters/next/index.js.map +1 -1
- package/dist/adapters/nuxt/index.cjs +21 -19
- package/dist/adapters/nuxt/index.cjs.map +1 -1
- package/dist/adapters/nuxt/index.d.cts +11 -7
- package/dist/adapters/nuxt/index.d.ts +11 -7
- package/dist/adapters/nuxt/index.js +14 -12
- package/dist/adapters/nuxt/index.js.map +1 -1
- package/dist/adapters/sveltekit/index.cjs +8 -12
- package/dist/adapters/sveltekit/index.cjs.map +1 -1
- package/dist/adapters/sveltekit/index.d.cts +3 -2
- package/dist/adapters/sveltekit/index.d.ts +3 -2
- package/dist/adapters/sveltekit/index.js +7 -11
- package/dist/adapters/sveltekit/index.js.map +1 -1
- package/dist/{blog-7EEJJG26.js → blog-L7HRY3QC.js} +2 -4
- package/dist/{blog-7EEJJG26.js.map → blog-L7HRY3QC.js.map} +1 -1
- package/dist/{blog-Z3R5GOMP.cjs → blog-SEXXJJSV.cjs} +3 -5
- package/dist/blog-SEXXJJSV.cjs.map +1 -0
- package/dist/{chunk-7VCRDESM.cjs → chunk-FHOZ3ACN.cjs} +722 -508
- package/dist/chunk-FHOZ3ACN.cjs.map +1 -0
- package/dist/{chunk-L4VH2NSA.js → chunk-VUZWHEZ2.js} +707 -493
- package/dist/chunk-VUZWHEZ2.js.map +1 -0
- package/dist/cli/index.cjs +30 -24
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +29 -23
- package/dist/cli/index.js.map +1 -1
- package/dist/{dark-EX2GRAYK.cjs → dark-66ZWYLT7.cjs} +2 -4
- package/dist/dark-66ZWYLT7.cjs.map +1 -0
- package/dist/{dark-6E36AKLN.js → dark-SZOURAMM.js} +1 -3
- package/dist/{dark-6E36AKLN.js.map → dark-SZOURAMM.js.map} +1 -1
- package/dist/index.cjs +21 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -30
- package/dist/index.d.ts +39 -30
- package/dist/index.js +22 -9
- package/dist/index.js.map +1 -1
- package/dist/{minimal-D2PRAVG6.js → minimal-CGXF737F.js} +1 -3
- package/dist/{minimal-D2PRAVG6.js.map → minimal-CGXF737F.js.map} +1 -1
- package/dist/{minimal-RHOK4XEZ.cjs → minimal-XTTHXE3T.cjs} +2 -4
- package/dist/minimal-XTTHXE3T.cjs.map +1 -0
- package/dist/process-IELSAOA3.js +7 -0
- package/dist/process-M4NZQGJJ.cjs +7 -0
- package/dist/process-M4NZQGJJ.cjs.map +1 -0
- package/dist/{product-OT3XYMWD.cjs → product-BY3GVQGV.cjs} +2 -4
- package/dist/product-BY3GVQGV.cjs.map +1 -0
- package/dist/{product-NCUW3U72.js → product-UQXUI5YL.js} +1 -3
- package/dist/{product-NCUW3U72.js.map → product-UQXUI5YL.js.map} +1 -1
- package/dist/{types-Bkue7DeN.d.cts → types-DAfWIHiD.d.cts} +11 -1
- package/dist/{types-Bkue7DeN.d.ts → types-DAfWIHiD.d.ts} +11 -1
- package/package.json +35 -16
- package/dist/blog-Z3R5GOMP.cjs.map +0 -1
- package/dist/chunk-7VCRDESM.cjs.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-JEQ2X3Z6.cjs +0 -11
- package/dist/chunk-JEQ2X3Z6.cjs.map +0 -1
- package/dist/chunk-L4VH2NSA.js.map +0 -1
- package/dist/dark-EX2GRAYK.cjs.map +0 -1
- package/dist/minimal-RHOK4XEZ.cjs.map +0 -1
- package/dist/process-FYZZ5QAG.js +0 -8
- package/dist/process-FYZZ5QAG.js.map +0 -1
- package/dist/process-XEGGGY6S.cjs +0 -8
- package/dist/process-XEGGGY6S.cjs.map +0 -1
- package/dist/product-OT3XYMWD.cjs.map +0 -1
- /package/dist/{chunk-DGUM43GV.js.map → process-IELSAOA3.js.map} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# vaza-content
|
|
2
|
+
|
|
3
|
+
Universal SEO layer for content collections. Auto-generates sitemap, RSS, JSON-LD, OG images, and integrity checks for Next.js, SvelteKit, Astro, and Nuxt.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install vaza-content
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### CLI Setup
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx vaza-content init
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This auto-detects your framework, installs dependencies, and scaffolds a `vaza.config.ts`.
|
|
18
|
+
|
|
19
|
+
### Manual Setup
|
|
20
|
+
|
|
21
|
+
Create `vaza.config.ts`:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { defineConfig } from 'vaza-content'
|
|
25
|
+
|
|
26
|
+
export default defineConfig({
|
|
27
|
+
site: {
|
|
28
|
+
url: 'https://example.com',
|
|
29
|
+
name: 'My Site',
|
|
30
|
+
description: 'A content-driven site',
|
|
31
|
+
language: 'en',
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
collections: {
|
|
35
|
+
blog: {
|
|
36
|
+
entries: () => getAllPosts(),
|
|
37
|
+
map: (post) => ({
|
|
38
|
+
slug: post.slug,
|
|
39
|
+
title: post.title,
|
|
40
|
+
body: post.content,
|
|
41
|
+
publishDate: new Date(post.date),
|
|
42
|
+
tags: post.tags,
|
|
43
|
+
}),
|
|
44
|
+
basePath: '/blog',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Framework Integration
|
|
51
|
+
|
|
52
|
+
### Next.js
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// next.config.ts
|
|
56
|
+
import { withVazaContent } from 'vaza-content/next'
|
|
57
|
+
import vazaConfig from './vaza.config'
|
|
58
|
+
|
|
59
|
+
export default withVazaContent({ /* next config */ }, vazaConfig)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### SvelteKit
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// vite.config.ts
|
|
66
|
+
import { sveltekit } from '@sveltejs/kit/vite'
|
|
67
|
+
import { vazaContent } from 'vaza-content/sveltekit'
|
|
68
|
+
import vazaConfig from './vaza.config'
|
|
69
|
+
|
|
70
|
+
export default { plugins: [sveltekit(), vazaContent(vazaConfig)] }
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Astro
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
// astro.config.mjs
|
|
77
|
+
import { vazaContent } from 'vaza-content/astro'
|
|
78
|
+
import vazaConfig from './vaza.config'
|
|
79
|
+
|
|
80
|
+
export default defineConfig({
|
|
81
|
+
integrations: [vazaContent(vazaConfig)]
|
|
82
|
+
})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Nuxt
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// nuxt.config.ts
|
|
89
|
+
import { defineVazaContentModule } from 'vaza-content/nuxt'
|
|
90
|
+
import vazaConfig from './vaza.config'
|
|
91
|
+
|
|
92
|
+
export default defineNuxtConfig({
|
|
93
|
+
modules: [defineVazaContentModule(vazaConfig)]
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## What It Generates
|
|
98
|
+
|
|
99
|
+
| Output | Location | Description |
|
|
100
|
+
|--------|----------|-------------|
|
|
101
|
+
| Sitemap | `public/sitemap.xml` | XML sitemap with image extensions |
|
|
102
|
+
| RSS Feed | `public/rss.xml` | RSS 2.0 feed |
|
|
103
|
+
| JSON-LD | `.vaza-content/json-ld/{slug}.json` | Structured data per entry |
|
|
104
|
+
| OG Images | `public/og/{slug}.png` | Auto-generated Open Graph images |
|
|
105
|
+
| Taxonomy | `.vaza-content/taxonomy.json` | Tag and category maps |
|
|
106
|
+
| Redirects | `.vaza-content/redirects.json` | Detected slug changes |
|
|
107
|
+
| Integrity | `.vaza-content/integrity-report.json` | Content quality report |
|
|
108
|
+
|
|
109
|
+
## Configuration Reference
|
|
110
|
+
|
|
111
|
+
### `site` (required)
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
site: {
|
|
115
|
+
url: string // Your site URL (no trailing slash)
|
|
116
|
+
name: string // Site name
|
|
117
|
+
description?: string
|
|
118
|
+
language?: string // Default: "en"
|
|
119
|
+
author?: { name: string; url?: string }
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### `collections` (required)
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
collections: {
|
|
127
|
+
[name: string]: {
|
|
128
|
+
entries: () => T[] | Promise<T[]> // Function returning raw entries
|
|
129
|
+
map: (entry: T) => PartialVazaEntry // Transform to VazaEntry shape
|
|
130
|
+
basePath: string // URL prefix (e.g. "/blog")
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### `sitemap`
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
sitemap: {
|
|
139
|
+
enabled?: boolean // Default: true
|
|
140
|
+
changeFrequency?: string // Default: "weekly"
|
|
141
|
+
priority?: number // Default: 0.7
|
|
142
|
+
additionalPaths?: string[] // Extra static paths to include
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### `rss`
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
rss: {
|
|
150
|
+
enabled?: boolean // Default: true
|
|
151
|
+
path?: string // Default: "/rss.xml"
|
|
152
|
+
limit?: number // Default: 50
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### `jsonLd`
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
jsonLd: {
|
|
160
|
+
enabled?: boolean
|
|
161
|
+
organization?: { name: string; logo?: string; url?: string }
|
|
162
|
+
customSchemas?: Record<string, JsonLdGenerator> // Add custom schema types
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Auto-detected schema types: Article, FAQ, HowTo, Product, Recipe, Event, BreadcrumbList.
|
|
167
|
+
|
|
168
|
+
### `ogImages`
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
ogImages: {
|
|
172
|
+
enabled?: boolean
|
|
173
|
+
template?: "minimal" | "blog" | "product" | "dark" // Default: "blog"
|
|
174
|
+
outputDir?: string // Default: "./public/og"
|
|
175
|
+
fontPath?: string // Custom .ttf/.woff font (auto-downloads Inter if omitted)
|
|
176
|
+
concurrency?: number // Max parallel generations (default: 5)
|
|
177
|
+
colors?: { bg?: string; text?: string; accent?: string }
|
|
178
|
+
logo?: string
|
|
179
|
+
render?: (entry: VazaEntry) => JSX.Element // Custom Satori template
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### `redirects`
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
redirects: {
|
|
187
|
+
enabled?: boolean
|
|
188
|
+
strategy?: "git" | "manifest" | "both" // Default: "both"
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Uses git rename history and/or a slug manifest with Levenshtein similarity matching.
|
|
193
|
+
|
|
194
|
+
### `integrity`
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
integrity: {
|
|
198
|
+
brokenLinks?: Severity
|
|
199
|
+
metaTitleLength?: { max?: number; severity?: Severity }
|
|
200
|
+
metaDescriptionLength?: { max?: number; severity?: Severity }
|
|
201
|
+
altText?: Severity
|
|
202
|
+
duplicateSlugs?: Severity
|
|
203
|
+
duplicateContent?: Severity
|
|
204
|
+
orphanPages?: Severity
|
|
205
|
+
freshness?: { maxAge?: string; severity?: Severity } // "90d", "6m", "1y"
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Severity: `"error"` (fails build), `"warn"` (prints warning), `"off"` (disabled).
|
|
210
|
+
|
|
211
|
+
### `logLevel`
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
logLevel?: "silent" | "error" | "warn" | "info" | "debug" // Default: "info"
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## CLI
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
vaza-content init # Scaffold config for detected framework
|
|
221
|
+
vaza-content generate # Generate all SEO outputs
|
|
222
|
+
vaza-content check # Run all integrity checks
|
|
223
|
+
vaza-content check --links # Check broken links only
|
|
224
|
+
vaza-content check --meta # Check meta lengths only
|
|
225
|
+
vaza-content check --freshness # Check content age only
|
|
226
|
+
vaza-content check --alt # Check image alt text only
|
|
227
|
+
vaza-content check --duplicates # Check duplicates only
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Programmatic API
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import {
|
|
234
|
+
processCollections,
|
|
235
|
+
normalize,
|
|
236
|
+
generateSitemap,
|
|
237
|
+
generateRss,
|
|
238
|
+
generateJsonLd,
|
|
239
|
+
generateOgImages,
|
|
240
|
+
generateTaxonomy,
|
|
241
|
+
generateCanonical,
|
|
242
|
+
generateBreadcrumbs,
|
|
243
|
+
detectRedirects,
|
|
244
|
+
checkIntegrity,
|
|
245
|
+
} from 'vaza-content'
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Each function can be used standalone or orchestrated via `processCollections`.
|
|
249
|
+
|
|
250
|
+
## Entry Shape
|
|
251
|
+
|
|
252
|
+
The `PartialVazaEntry` you return from `map()` only requires `slug`, `title`, and `body`. Everything else is auto-generated:
|
|
253
|
+
|
|
254
|
+
| Field | Auto-generated From |
|
|
255
|
+
|-------|-------------------|
|
|
256
|
+
| `description` | First ~160 chars of body |
|
|
257
|
+
| `excerpt` | First ~160 chars, stripped of markdown |
|
|
258
|
+
| `readingTime` | Word count / 200 WPM |
|
|
259
|
+
| `wordCount` | Body text word count |
|
|
260
|
+
| `toc` | `##` and `###` headings |
|
|
261
|
+
| `publishDate` | Current date if omitted |
|
|
262
|
+
| `image.width/height` | Read via sharp |
|
|
263
|
+
| `image.blurDataURL` | Tiny blur placeholder via sharp |
|
|
264
|
+
|
|
265
|
+
## License
|
|
266
|
+
|
|
267
|
+
MIT
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
require('../../chunk-
|
|
5
|
+
|
|
6
|
+
var _chunkFHOZ3ACNcjs = require('../../chunk-FHOZ3ACN.cjs');
|
|
7
7
|
|
|
8
8
|
// src/adapters/astro/index.ts
|
|
9
9
|
var _fs = require('fs');
|
|
@@ -12,7 +12,7 @@ function vazaContent(config) {
|
|
|
12
12
|
return {
|
|
13
13
|
name: "vaza-content",
|
|
14
14
|
hooks: {
|
|
15
|
-
"astro:build:
|
|
15
|
+
"astro:build:start": async () => {
|
|
16
16
|
await processAndWrite(config);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -22,23 +22,19 @@ async function buildVazaContent(config) {
|
|
|
22
22
|
return processAndWrite(config);
|
|
23
23
|
}
|
|
24
24
|
async function processAndWrite(config) {
|
|
25
|
-
const output = await
|
|
25
|
+
const output = await _chunkFHOZ3ACNcjs.processCollections.call(void 0, config);
|
|
26
26
|
const outDir = ".vaza-content";
|
|
27
27
|
ensureDir(outDir);
|
|
28
28
|
ensureDir("public");
|
|
29
29
|
if (_optionalChain([config, 'access', _ => _.sitemap, 'optionalAccess', _2 => _2.enabled]) !== false) {
|
|
30
30
|
writeJson(_path.join.call(void 0, outDir, "sitemap-data.json"), output.sitemap);
|
|
31
|
-
const xml =
|
|
31
|
+
const xml = _chunkFHOZ3ACNcjs.renderSitemapXml.call(void 0, output.sitemap);
|
|
32
32
|
_fs.writeFileSync.call(void 0, "public/sitemap.xml", xml, "utf-8");
|
|
33
33
|
}
|
|
34
34
|
if (_optionalChain([config, 'access', _3 => _3.rss, 'optionalAccess', _4 => _4.enabled]) !== false) {
|
|
35
|
-
const xml =
|
|
35
|
+
const xml = _chunkFHOZ3ACNcjs.renderRssXml.call(void 0, output.rss, config);
|
|
36
36
|
const rssPath = _nullishCoalesce(_optionalChain([config, 'access', _5 => _5.rss, 'optionalAccess', _6 => _6.path]), () => ( "/rss.xml"));
|
|
37
|
-
_fs.writeFileSync.call(void 0,
|
|
38
|
-
_path.join.call(void 0, "public", rssPath.replace(/^\//, "")),
|
|
39
|
-
xml,
|
|
40
|
-
"utf-8"
|
|
41
|
-
);
|
|
37
|
+
_fs.writeFileSync.call(void 0, _path.join.call(void 0, "public", rssPath.replace(/^\//, "")), xml, "utf-8");
|
|
42
38
|
}
|
|
43
39
|
if (_optionalChain([config, 'access', _7 => _7.jsonLd, 'optionalAccess', _8 => _8.enabled]) !== false) {
|
|
44
40
|
const jsonLdDir = _path.join.call(void 0, outDir, "json-ld");
|
|
@@ -56,7 +52,7 @@ async function processAndWrite(config) {
|
|
|
56
52
|
writeJson(_path.join.call(void 0, outDir, "integrity-report.json"), output.integrity);
|
|
57
53
|
const slugManifest = output.entries.map((e) => e.slug);
|
|
58
54
|
writeJson(_path.join.call(void 0, outDir, "slugs.json"), slugManifest);
|
|
59
|
-
|
|
55
|
+
_chunkFHOZ3ACNcjs.logger.info(`Generated ${output.entries.length} entries`);
|
|
60
56
|
return output;
|
|
61
57
|
}
|
|
62
58
|
function ensureDir(dir) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/mehdi/vaza-content/dist/adapters/astro/index.cjs","../../../src/adapters/astro/index.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,4DAAiC;AACjC
|
|
1
|
+
{"version":3,"sources":["/Users/mehdi/vaza-content/dist/adapters/astro/index.cjs","../../../src/adapters/astro/index.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,4DAAiC;AACjC;AACA;ACPA,wBAAqD;AACrD,4BAA8B;AAiBvB,SAAS,WAAA,CAAY,MAAA,EAAoB;AAC9C,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,cAAA;AAAA,IACN,KAAA,EAAO;AAAA,MACL,mBAAA,EAAqB,MAAA,CAAA,EAAA,GAAY;AAC/B,QAAA,MAAM,eAAA,CAAgB,MAAM,CAAA;AAAA,MAC9B;AAAA,IACF;AAAA,EACF,CAAA;AACF;AAKA,MAAA,SAAsB,gBAAA,CACpB,MAAA,EACqB;AACrB,EAAA,OAAO,eAAA,CAAgB,MAAM,CAAA;AAC/B;AAEA,MAAA,SAAe,eAAA,CAAgB,MAAA,EAAyC;AACtE,EAAA,MAAM,OAAA,EAAS,MAAM,kDAAA,MAAyB,CAAA;AAC9C,EAAA,MAAM,OAAA,EAAS,eAAA;AAEf,EAAA,SAAA,CAAU,MAAM,CAAA;AAChB,EAAA,SAAA,CAAU,QAAQ,CAAA;AAGlB,EAAA,GAAA,iBAAI,MAAA,mBAAO,OAAA,6BAAS,UAAA,IAAY,KAAA,EAAO;AACrC,IAAA,SAAA,CAAU,wBAAA,MAAK,EAAQ,mBAAmB,CAAA,EAAG,MAAA,CAAO,OAAO,CAAA;AAC3D,IAAA,MAAM,IAAA,EAAM,gDAAA,MAAiB,CAAO,OAAO,CAAA;AAC3C,IAAA,+BAAA,oBAAc,EAAsB,GAAA,EAAK,OAAO,CAAA;AAAA,EAClD;AAGA,EAAA,GAAA,iBAAI,MAAA,qBAAO,GAAA,6BAAK,UAAA,IAAY,KAAA,EAAO;AACjC,IAAA,MAAM,IAAA,EAAM,4CAAA,MAAa,CAAO,GAAA,EAAK,MAAM,CAAA;AAC3C,IAAA,MAAM,QAAA,mCAAU,MAAA,qBAAO,GAAA,6BAAK,MAAA,UAAQ,YAAA;AACpC,IAAA,+BAAA,wBAAc,QAAK,EAAU,OAAA,CAAQ,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAC,CAAA,EAAG,GAAA,EAAK,OAAO,CAAA;AAAA,EACxE;AAGA,EAAA,GAAA,iBAAI,MAAA,qBAAO,MAAA,6BAAQ,UAAA,IAAY,KAAA,EAAO;AACpC,IAAA,MAAM,UAAA,EAAY,wBAAA,MAAK,EAAQ,SAAS,CAAA;AACxC,IAAA,SAAA,CAAU,SAAS,CAAA;AACnB,IAAA,IAAA,CAAA,MAAW,CAAC,IAAA,EAAM,OAAO,EAAA,GAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,CAAO,MAAM,CAAA,EAAG;AAC3D,MAAA,SAAA,CAAU,wBAAA,SAAK,EAAW,CAAA,EAAA;AAC5B,IAAA;AACF,EAAA;AAGqB,EAAA;AACI,IAAA;AACzB,EAAA;AAGsB,EAAA;AACG,IAAA;AACzB,EAAA;AAGuB,EAAA;AAGK,EAAA;AACL,EAAA;AAEE,EAAA;AAElB,EAAA;AACT;AAEsC;AACd,EAAA;AACQ,IAAA;AAC9B,EAAA;AACF;AAEsD;AAC7B,EAAA;AACE,EAAA;AAC3B;ADjCiC;AACA;AACA;AACA","file":"/Users/mehdi/vaza-content/dist/adapters/astro/index.cjs","sourcesContent":[null,"import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { renderRssXml } from \"../../generate/rss.js\";\nimport { renderSitemapXml } from \"../../generate/sitemap.js\";\nimport { logger } from \"../../logger.js\";\nimport { processCollections } from \"../../process.js\";\nimport type { VazaConfig, VazaOutput } from \"../../types.js\";\n\n/**\n * Astro adapter -- integration that hooks into build lifecycle.\n *\n * Usage in astro.config.mjs:\n * import { vazaContent } from 'vaza-content/astro'\n * import vazaConfig from './vaza.config'\n * export default defineConfig({\n * integrations: [vazaContent(vazaConfig)]\n * })\n */\nexport function vazaContent(config: VazaConfig) {\n return {\n name: \"vaza-content\",\n hooks: {\n \"astro:build:start\": async () => {\n await processAndWrite(config);\n },\n },\n };\n}\n\n/**\n * Standalone function to process and write outputs.\n */\nexport async function buildVazaContent(\n config: VazaConfig,\n): Promise<VazaOutput> {\n return processAndWrite(config);\n}\n\nasync function processAndWrite(config: VazaConfig): Promise<VazaOutput> {\n const output = await processCollections(config);\n const outDir = \".vaza-content\";\n\n ensureDir(outDir);\n ensureDir(\"public\");\n\n // Write sitemap\n if (config.sitemap?.enabled !== false) {\n writeJson(join(outDir, \"sitemap-data.json\"), output.sitemap);\n const xml = renderSitemapXml(output.sitemap);\n writeFileSync(\"public/sitemap.xml\", xml, \"utf-8\");\n }\n\n // Write RSS\n if (config.rss?.enabled !== false) {\n const xml = renderRssXml(output.rss, config);\n const rssPath = config.rss?.path ?? \"/rss.xml\";\n writeFileSync(join(\"public\", rssPath.replace(/^\\//, \"\")), xml, \"utf-8\");\n }\n\n // Write JSON-LD per slug\n if (config.jsonLd?.enabled !== false) {\n const jsonLdDir = join(outDir, \"json-ld\");\n ensureDir(jsonLdDir);\n for (const [slug, schemas] of Object.entries(output.jsonLd)) {\n writeJson(join(jsonLdDir, `${slug}.json`), schemas);\n }\n }\n\n // Write taxonomy data\n if (config.taxonomy?.enabled !== false) {\n writeJson(join(outDir, \"taxonomy.json\"), output.taxonomy);\n }\n\n // Write redirects\n if (config.redirects?.enabled !== false) {\n writeJson(join(outDir, \"redirects.json\"), output.redirects);\n }\n\n // Write integrity report\n writeJson(join(outDir, \"integrity-report.json\"), output.integrity);\n\n // Write slug manifest\n const slugManifest = output.entries.map((e) => e.slug);\n writeJson(join(outDir, \"slugs.json\"), slugManifest);\n\n logger.info(`Generated ${output.entries.length} entries`);\n\n return output;\n}\n\nfunction ensureDir(dir: string): void {\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n}\n\nfunction writeJson(path: string, data: unknown): void {\n ensureDir(dirname(path));\n writeFileSync(path, JSON.stringify(data, null, 2), \"utf-8\");\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { V as VazaConfig, a as VazaOutput } from '../../types-
|
|
1
|
+
import { V as VazaConfig, a as VazaOutput } from '../../types-DAfWIHiD.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Astro adapter
|
|
4
|
+
* Astro adapter -- integration that hooks into build lifecycle.
|
|
5
5
|
*
|
|
6
6
|
* Usage in astro.config.mjs:
|
|
7
7
|
* import { vazaContent } from 'vaza-content/astro'
|
|
8
|
+
* import vazaConfig from './vaza.config'
|
|
8
9
|
* export default defineConfig({
|
|
9
10
|
* integrations: [vazaContent(vazaConfig)]
|
|
10
11
|
* })
|
|
@@ -12,7 +13,7 @@ import { V as VazaConfig, a as VazaOutput } from '../../types-Bkue7DeN.cjs';
|
|
|
12
13
|
declare function vazaContent(config: VazaConfig): {
|
|
13
14
|
name: string;
|
|
14
15
|
hooks: {
|
|
15
|
-
"astro:build:
|
|
16
|
+
"astro:build:start": () => Promise<void>;
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { V as VazaConfig, a as VazaOutput } from '../../types-
|
|
1
|
+
import { V as VazaConfig, a as VazaOutput } from '../../types-DAfWIHiD.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Astro adapter
|
|
4
|
+
* Astro adapter -- integration that hooks into build lifecycle.
|
|
5
5
|
*
|
|
6
6
|
* Usage in astro.config.mjs:
|
|
7
7
|
* import { vazaContent } from 'vaza-content/astro'
|
|
8
|
+
* import vazaConfig from './vaza.config'
|
|
8
9
|
* export default defineConfig({
|
|
9
10
|
* integrations: [vazaContent(vazaConfig)]
|
|
10
11
|
* })
|
|
@@ -12,7 +13,7 @@ import { V as VazaConfig, a as VazaOutput } from '../../types-Bkue7DeN.js';
|
|
|
12
13
|
declare function vazaContent(config: VazaConfig): {
|
|
13
14
|
name: string;
|
|
14
15
|
hooks: {
|
|
15
|
-
"astro:build:
|
|
16
|
+
"astro:build:start": () => Promise<void>;
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
+
logger,
|
|
2
3
|
processCollections,
|
|
3
4
|
renderRssXml,
|
|
4
5
|
renderSitemapXml
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-DGUM43GV.js";
|
|
6
|
+
} from "../../chunk-VUZWHEZ2.js";
|
|
7
7
|
|
|
8
8
|
// src/adapters/astro/index.ts
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
10
|
+
import { dirname, join } from "path";
|
|
11
11
|
function vazaContent(config) {
|
|
12
12
|
return {
|
|
13
13
|
name: "vaza-content",
|
|
14
14
|
hooks: {
|
|
15
|
-
"astro:build:
|
|
15
|
+
"astro:build:start": async () => {
|
|
16
16
|
await processAndWrite(config);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -34,11 +34,7 @@ async function processAndWrite(config) {
|
|
|
34
34
|
if (config.rss?.enabled !== false) {
|
|
35
35
|
const xml = renderRssXml(output.rss, config);
|
|
36
36
|
const rssPath = config.rss?.path ?? "/rss.xml";
|
|
37
|
-
writeFileSync(
|
|
38
|
-
join("public", rssPath.replace(/^\//, "")),
|
|
39
|
-
xml,
|
|
40
|
-
"utf-8"
|
|
41
|
-
);
|
|
37
|
+
writeFileSync(join("public", rssPath.replace(/^\//, "")), xml, "utf-8");
|
|
42
38
|
}
|
|
43
39
|
if (config.jsonLd?.enabled !== false) {
|
|
44
40
|
const jsonLdDir = join(outDir, "json-ld");
|
|
@@ -56,7 +52,7 @@ async function processAndWrite(config) {
|
|
|
56
52
|
writeJson(join(outDir, "integrity-report.json"), output.integrity);
|
|
57
53
|
const slugManifest = output.entries.map((e) => e.slug);
|
|
58
54
|
writeJson(join(outDir, "slugs.json"), slugManifest);
|
|
59
|
-
|
|
55
|
+
logger.info(`Generated ${output.entries.length} entries`);
|
|
60
56
|
return output;
|
|
61
57
|
}
|
|
62
58
|
function ensureDir(dir) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapters/astro/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/astro/index.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { renderRssXml } from \"../../generate/rss.js\";\nimport { renderSitemapXml } from \"../../generate/sitemap.js\";\nimport { logger } from \"../../logger.js\";\nimport { processCollections } from \"../../process.js\";\nimport type { VazaConfig, VazaOutput } from \"../../types.js\";\n\n/**\n * Astro adapter -- integration that hooks into build lifecycle.\n *\n * Usage in astro.config.mjs:\n * import { vazaContent } from 'vaza-content/astro'\n * import vazaConfig from './vaza.config'\n * export default defineConfig({\n * integrations: [vazaContent(vazaConfig)]\n * })\n */\nexport function vazaContent(config: VazaConfig) {\n return {\n name: \"vaza-content\",\n hooks: {\n \"astro:build:start\": async () => {\n await processAndWrite(config);\n },\n },\n };\n}\n\n/**\n * Standalone function to process and write outputs.\n */\nexport async function buildVazaContent(\n config: VazaConfig,\n): Promise<VazaOutput> {\n return processAndWrite(config);\n}\n\nasync function processAndWrite(config: VazaConfig): Promise<VazaOutput> {\n const output = await processCollections(config);\n const outDir = \".vaza-content\";\n\n ensureDir(outDir);\n ensureDir(\"public\");\n\n // Write sitemap\n if (config.sitemap?.enabled !== false) {\n writeJson(join(outDir, \"sitemap-data.json\"), output.sitemap);\n const xml = renderSitemapXml(output.sitemap);\n writeFileSync(\"public/sitemap.xml\", xml, \"utf-8\");\n }\n\n // Write RSS\n if (config.rss?.enabled !== false) {\n const xml = renderRssXml(output.rss, config);\n const rssPath = config.rss?.path ?? \"/rss.xml\";\n writeFileSync(join(\"public\", rssPath.replace(/^\\//, \"\")), xml, \"utf-8\");\n }\n\n // Write JSON-LD per slug\n if (config.jsonLd?.enabled !== false) {\n const jsonLdDir = join(outDir, \"json-ld\");\n ensureDir(jsonLdDir);\n for (const [slug, schemas] of Object.entries(output.jsonLd)) {\n writeJson(join(jsonLdDir, `${slug}.json`), schemas);\n }\n }\n\n // Write taxonomy data\n if (config.taxonomy?.enabled !== false) {\n writeJson(join(outDir, \"taxonomy.json\"), output.taxonomy);\n }\n\n // Write redirects\n if (config.redirects?.enabled !== false) {\n writeJson(join(outDir, \"redirects.json\"), output.redirects);\n }\n\n // Write integrity report\n writeJson(join(outDir, \"integrity-report.json\"), output.integrity);\n\n // Write slug manifest\n const slugManifest = output.entries.map((e) => e.slug);\n writeJson(join(outDir, \"slugs.json\"), slugManifest);\n\n logger.info(`Generated ${output.entries.length} entries`);\n\n return output;\n}\n\nfunction ensureDir(dir: string): void {\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n}\n\nfunction writeJson(path: string, data: unknown): void {\n ensureDir(dirname(path));\n writeFileSync(path, JSON.stringify(data, null, 2), \"utf-8\");\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,YAAY,WAAW,qBAAqB;AACrD,SAAS,SAAS,YAAY;AAiBvB,SAAS,YAAY,QAAoB;AAC9C,SAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,MACL,qBAAqB,YAAY;AAC/B,cAAM,gBAAgB,MAAM;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AACF;AAKA,eAAsB,iBACpB,QACqB;AACrB,SAAO,gBAAgB,MAAM;AAC/B;AAEA,eAAe,gBAAgB,QAAyC;AACtE,QAAM,SAAS,MAAM,mBAAmB,MAAM;AAC9C,QAAM,SAAS;AAEf,YAAU,MAAM;AAChB,YAAU,QAAQ;AAGlB,MAAI,OAAO,SAAS,YAAY,OAAO;AACrC,cAAU,KAAK,QAAQ,mBAAmB,GAAG,OAAO,OAAO;AAC3D,UAAM,MAAM,iBAAiB,OAAO,OAAO;AAC3C,kBAAc,sBAAsB,KAAK,OAAO;AAAA,EAClD;AAGA,MAAI,OAAO,KAAK,YAAY,OAAO;AACjC,UAAM,MAAM,aAAa,OAAO,KAAK,MAAM;AAC3C,UAAM,UAAU,OAAO,KAAK,QAAQ;AACpC,kBAAc,KAAK,UAAU,QAAQ,QAAQ,OAAO,EAAE,CAAC,GAAG,KAAK,OAAO;AAAA,EACxE;AAGA,MAAI,OAAO,QAAQ,YAAY,OAAO;AACpC,UAAM,YAAY,KAAK,QAAQ,SAAS;AACxC,cAAU,SAAS;AACnB,eAAW,CAAC,MAAM,OAAO,KAAK,OAAO,QAAQ,OAAO,MAAM,GAAG;AAC3D,gBAAU,KAAK,WAAW,GAAG,IAAI,OAAO,GAAG,OAAO;AAAA,IACpD;AAAA,EACF;AAGA,MAAI,OAAO,UAAU,YAAY,OAAO;AACtC,cAAU,KAAK,QAAQ,eAAe,GAAG,OAAO,QAAQ;AAAA,EAC1D;AAGA,MAAI,OAAO,WAAW,YAAY,OAAO;AACvC,cAAU,KAAK,QAAQ,gBAAgB,GAAG,OAAO,SAAS;AAAA,EAC5D;AAGA,YAAU,KAAK,QAAQ,uBAAuB,GAAG,OAAO,SAAS;AAGjE,QAAM,eAAe,OAAO,QAAQ,IAAI,CAAC,MAAM,EAAE,IAAI;AACrD,YAAU,KAAK,QAAQ,YAAY,GAAG,YAAY;AAElD,SAAO,KAAK,aAAa,OAAO,QAAQ,MAAM,UAAU;AAExD,SAAO;AACT;AAEA,SAAS,UAAU,KAAmB;AACpC,MAAI,CAAC,WAAW,GAAG,GAAG;AACpB,cAAU,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,EACpC;AACF;AAEA,SAAS,UAAU,MAAc,MAAqB;AACpD,YAAU,QAAQ,IAAI,CAAC;AACvB,gBAAc,MAAM,KAAK,UAAU,MAAM,MAAM,CAAC,GAAG,OAAO;AAC5D;","names":[]}
|
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
require('../../chunk-
|
|
5
|
+
|
|
6
|
+
var _chunkFHOZ3ACNcjs = require('../../chunk-FHOZ3ACN.cjs');
|
|
7
7
|
|
|
8
8
|
// src/adapters/next/index.ts
|
|
9
9
|
var _fs = require('fs');
|
|
10
10
|
var _path = require('path');
|
|
11
|
+
var processingPromise = null;
|
|
11
12
|
function withVazaContent(nextConfig, vazaConfig) {
|
|
12
13
|
const originalWebpack = nextConfig.webpack;
|
|
13
14
|
return {
|
|
14
15
|
...nextConfig,
|
|
15
16
|
webpack(config, options) {
|
|
16
|
-
if (options.isServer && vazaConfig) {
|
|
17
|
-
processAndWrite(vazaConfig)
|
|
18
|
-
|
|
17
|
+
if (options.isServer && vazaConfig && !processingPromise) {
|
|
18
|
+
processingPromise = processAndWrite(vazaConfig);
|
|
19
|
+
processingPromise.catch((err) => {
|
|
20
|
+
_chunkFHOZ3ACNcjs.logger.error("Build error:", err);
|
|
19
21
|
process.exit(1);
|
|
20
22
|
});
|
|
21
23
|
}
|
|
@@ -30,17 +32,17 @@ async function buildVazaContent(config) {
|
|
|
30
32
|
return processAndWrite(config);
|
|
31
33
|
}
|
|
32
34
|
async function processAndWrite(config) {
|
|
33
|
-
const output = await
|
|
35
|
+
const output = await _chunkFHOZ3ACNcjs.processCollections.call(void 0, config);
|
|
34
36
|
const outDir = ".vaza-content";
|
|
35
37
|
ensureDir(outDir);
|
|
36
38
|
if (_optionalChain([config, 'access', _ => _.sitemap, 'optionalAccess', _2 => _2.enabled]) !== false) {
|
|
37
39
|
writeJson(_path.join.call(void 0, outDir, "sitemap-data.json"), output.sitemap);
|
|
38
|
-
const xml =
|
|
40
|
+
const xml = _chunkFHOZ3ACNcjs.renderSitemapXml.call(void 0, output.sitemap);
|
|
39
41
|
ensureDir("public");
|
|
40
42
|
_fs.writeFileSync.call(void 0, "public/sitemap.xml", xml, "utf-8");
|
|
41
43
|
}
|
|
42
44
|
if (_optionalChain([config, 'access', _3 => _3.rss, 'optionalAccess', _4 => _4.enabled]) !== false) {
|
|
43
|
-
const xml =
|
|
45
|
+
const xml = _chunkFHOZ3ACNcjs.renderRssXml.call(void 0, output.rss, config);
|
|
44
46
|
const rssPath = _nullishCoalesce(_optionalChain([config, 'access', _5 => _5.rss, 'optionalAccess', _6 => _6.path]), () => ( "/rss.xml"));
|
|
45
47
|
const rssFile = _path.join.call(void 0, "public", rssPath.replace(/^\//, ""));
|
|
46
48
|
ensureDir(_path.dirname.call(void 0, rssFile));
|
|
@@ -62,8 +64,8 @@ async function processAndWrite(config) {
|
|
|
62
64
|
writeJson(_path.join.call(void 0, outDir, "integrity-report.json"), output.integrity);
|
|
63
65
|
const slugManifest = output.entries.map((e) => e.slug);
|
|
64
66
|
writeJson(_path.join.call(void 0, outDir, "slugs.json"), slugManifest);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
_chunkFHOZ3ACNcjs.logger.info(`Generated ${output.entries.length} entries`);
|
|
68
|
+
_chunkFHOZ3ACNcjs.logger.info(`Outputs written to ${outDir}/ and public/`);
|
|
67
69
|
return output;
|
|
68
70
|
}
|
|
69
71
|
function ensureDir(dir) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/mehdi/vaza-content/dist/adapters/next/index.cjs","../../../src/adapters/next/index.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,4DAAiC;AACjC
|
|
1
|
+
{"version":3,"sources":["/Users/mehdi/vaza-content/dist/adapters/next/index.cjs","../../../src/adapters/next/index.ts"],"names":[],"mappings":"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","file":"/Users/mehdi/vaza-content/dist/adapters/next/index.cjs","sourcesContent":[null,"import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { renderRssXml } from \"../../generate/rss.js\";\nimport { renderSitemapXml } from \"../../generate/sitemap.js\";\nimport { logger } from \"../../logger.js\";\nimport { processCollections } from \"../../process.js\";\nimport type { VazaConfig, VazaOutput } from \"../../types.js\";\n\n// Track if processing is in progress to avoid duplicate runs\nlet processingPromise: Promise<VazaOutput> | null = null;\n\n/**\n * Next.js adapter -- wraps next.config and hooks into the build.\n *\n * Usage in next.config.ts:\n * import { withVazaContent } from 'vaza-content/next'\n * import vazaConfig from './vaza.config'\n * export default withVazaContent({ ... }, vazaConfig)\n */\nexport function withVazaContent(\n nextConfig: Record<string, unknown>,\n vazaConfig?: VazaConfig,\n): Record<string, unknown> {\n const originalWebpack = nextConfig.webpack as\n | ((config: unknown, options: unknown) => unknown)\n | undefined;\n\n return {\n ...nextConfig,\n webpack(config: unknown, options: Record<string, unknown>) {\n // Only run during server build (not client), and only once\n if (options.isServer && vazaConfig && !processingPromise) {\n processingPromise = processAndWrite(vazaConfig);\n processingPromise.catch((err: unknown) => {\n logger.error(\"Build error:\", err);\n process.exit(1);\n });\n }\n\n if (originalWebpack) {\n return originalWebpack(config, options);\n }\n return config;\n },\n };\n}\n\n/**\n * Standalone function to process and write outputs.\n * Recommended over withVazaContent for more reliable builds.\n * Call from a prebuild script or next.config.ts top level.\n */\nexport async function buildVazaContent(\n config: VazaConfig,\n): Promise<VazaOutput> {\n return processAndWrite(config);\n}\n\nasync function processAndWrite(config: VazaConfig): Promise<VazaOutput> {\n const output = await processCollections(config);\n const outDir = \".vaza-content\";\n\n ensureDir(outDir);\n\n // Write sitemap data\n if (config.sitemap?.enabled !== false) {\n writeJson(join(outDir, \"sitemap-data.json\"), output.sitemap);\n\n // Also write the XML to public/\n const xml = renderSitemapXml(output.sitemap);\n ensureDir(\"public\");\n writeFileSync(\"public/sitemap.xml\", xml, \"utf-8\");\n }\n\n // Write RSS\n if (config.rss?.enabled !== false) {\n const xml = renderRssXml(output.rss, config);\n const rssPath = config.rss?.path ?? \"/rss.xml\";\n const rssFile = join(\"public\", rssPath.replace(/^\\//, \"\"));\n ensureDir(dirname(rssFile));\n writeFileSync(rssFile, xml, \"utf-8\");\n }\n\n // Write JSON-LD per slug\n if (config.jsonLd?.enabled !== false) {\n const jsonLdDir = join(outDir, \"json-ld\");\n ensureDir(jsonLdDir);\n for (const [slug, schemas] of Object.entries(output.jsonLd)) {\n writeJson(join(jsonLdDir, `${slug}.json`), schemas);\n }\n }\n\n // Write taxonomy data\n if (config.taxonomy?.enabled !== false) {\n writeJson(join(outDir, \"taxonomy.json\"), output.taxonomy);\n }\n\n // Write redirects\n if (config.redirects?.enabled !== false) {\n writeJson(join(outDir, \"redirects.json\"), output.redirects);\n }\n\n // Write integrity report\n writeJson(join(outDir, \"integrity-report.json\"), output.integrity);\n\n // Write slug manifest for redirect detection\n const slugManifest = output.entries.map((e) => e.slug);\n writeJson(join(outDir, \"slugs.json\"), slugManifest);\n\n logger.info(`Generated ${output.entries.length} entries`);\n logger.info(`Outputs written to ${outDir}/ and public/`);\n\n return output;\n}\n\nfunction ensureDir(dir: string): void {\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n}\n\nfunction writeJson(path: string, data: unknown): void {\n ensureDir(dirname(path));\n writeFileSync(path, JSON.stringify(data, null, 2), \"utf-8\");\n}\n"]}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { V as VazaConfig, a as VazaOutput } from '../../types-
|
|
1
|
+
import { V as VazaConfig, a as VazaOutput } from '../../types-DAfWIHiD.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Next.js adapter
|
|
4
|
+
* Next.js adapter -- wraps next.config and hooks into the build.
|
|
5
5
|
*
|
|
6
6
|
* Usage in next.config.ts:
|
|
7
7
|
* import { withVazaContent } from 'vaza-content/next'
|
|
8
|
-
*
|
|
8
|
+
* import vazaConfig from './vaza.config'
|
|
9
|
+
* export default withVazaContent({ ... }, vazaConfig)
|
|
9
10
|
*/
|
|
10
11
|
declare function withVazaContent(nextConfig: Record<string, unknown>, vazaConfig?: VazaConfig): Record<string, unknown>;
|
|
11
12
|
/**
|
|
12
13
|
* Standalone function to process and write outputs.
|
|
13
|
-
*
|
|
14
|
+
* Recommended over withVazaContent for more reliable builds.
|
|
15
|
+
* Call from a prebuild script or next.config.ts top level.
|
|
14
16
|
*/
|
|
15
17
|
declare function buildVazaContent(config: VazaConfig): Promise<VazaOutput>;
|
|
16
18
|
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { V as VazaConfig, a as VazaOutput } from '../../types-
|
|
1
|
+
import { V as VazaConfig, a as VazaOutput } from '../../types-DAfWIHiD.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Next.js adapter
|
|
4
|
+
* Next.js adapter -- wraps next.config and hooks into the build.
|
|
5
5
|
*
|
|
6
6
|
* Usage in next.config.ts:
|
|
7
7
|
* import { withVazaContent } from 'vaza-content/next'
|
|
8
|
-
*
|
|
8
|
+
* import vazaConfig from './vaza.config'
|
|
9
|
+
* export default withVazaContent({ ... }, vazaConfig)
|
|
9
10
|
*/
|
|
10
11
|
declare function withVazaContent(nextConfig: Record<string, unknown>, vazaConfig?: VazaConfig): Record<string, unknown>;
|
|
11
12
|
/**
|
|
12
13
|
* Standalone function to process and write outputs.
|
|
13
|
-
*
|
|
14
|
+
* Recommended over withVazaContent for more reliable builds.
|
|
15
|
+
* Call from a prebuild script or next.config.ts top level.
|
|
14
16
|
*/
|
|
15
17
|
declare function buildVazaContent(config: VazaConfig): Promise<VazaOutput>;
|
|
16
18
|
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
|
+
logger,
|
|
2
3
|
processCollections,
|
|
3
4
|
renderRssXml,
|
|
4
5
|
renderSitemapXml
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-DGUM43GV.js";
|
|
6
|
+
} from "../../chunk-VUZWHEZ2.js";
|
|
7
7
|
|
|
8
8
|
// src/adapters/next/index.ts
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
10
|
+
import { dirname, join } from "path";
|
|
11
|
+
var processingPromise = null;
|
|
11
12
|
function withVazaContent(nextConfig, vazaConfig) {
|
|
12
13
|
const originalWebpack = nextConfig.webpack;
|
|
13
14
|
return {
|
|
14
15
|
...nextConfig,
|
|
15
16
|
webpack(config, options) {
|
|
16
|
-
if (options.isServer && vazaConfig) {
|
|
17
|
-
processAndWrite(vazaConfig)
|
|
18
|
-
|
|
17
|
+
if (options.isServer && vazaConfig && !processingPromise) {
|
|
18
|
+
processingPromise = processAndWrite(vazaConfig);
|
|
19
|
+
processingPromise.catch((err) => {
|
|
20
|
+
logger.error("Build error:", err);
|
|
19
21
|
process.exit(1);
|
|
20
22
|
});
|
|
21
23
|
}
|
|
@@ -62,8 +64,8 @@ async function processAndWrite(config) {
|
|
|
62
64
|
writeJson(join(outDir, "integrity-report.json"), output.integrity);
|
|
63
65
|
const slugManifest = output.entries.map((e) => e.slug);
|
|
64
66
|
writeJson(join(outDir, "slugs.json"), slugManifest);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
logger.info(`Generated ${output.entries.length} entries`);
|
|
68
|
+
logger.info(`Outputs written to ${outDir}/ and public/`);
|
|
67
69
|
return output;
|
|
68
70
|
}
|
|
69
71
|
function ensureDir(dir) {
|