vaza-content 0.2.2 → 0.3.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.
- package/dist/adapters/astro/index.cjs +5 -52
- package/dist/adapters/astro/index.cjs.map +1 -1
- package/dist/adapters/astro/index.d.cts +1 -1
- package/dist/adapters/astro/index.d.ts +1 -1
- package/dist/adapters/astro/index.js +5 -52
- package/dist/adapters/astro/index.js.map +1 -1
- package/dist/adapters/next/index.cjs +6 -54
- package/dist/adapters/next/index.cjs.map +1 -1
- package/dist/adapters/next/index.d.cts +1 -2
- package/dist/adapters/next/index.d.ts +1 -2
- package/dist/adapters/next/index.js +7 -55
- package/dist/adapters/next/index.js.map +1 -1
- package/dist/adapters/nuxt/index.cjs +6 -53
- package/dist/adapters/nuxt/index.cjs.map +1 -1
- package/dist/adapters/nuxt/index.d.cts +1 -1
- package/dist/adapters/nuxt/index.d.ts +1 -1
- package/dist/adapters/nuxt/index.js +6 -53
- package/dist/adapters/nuxt/index.js.map +1 -1
- package/dist/adapters/sveltekit/index.cjs +5 -54
- package/dist/adapters/sveltekit/index.cjs.map +1 -1
- package/dist/adapters/sveltekit/index.d.cts +1 -1
- package/dist/adapters/sveltekit/index.d.ts +1 -1
- package/dist/adapters/sveltekit/index.js +5 -54
- package/dist/adapters/sveltekit/index.js.map +1 -1
- package/dist/chunk-42BZQUA7.js +87 -0
- package/dist/chunk-42BZQUA7.js.map +1 -0
- package/dist/{chunk-H3D7F4TA.cjs → chunk-NHCLSSMK.cjs} +397 -33
- package/dist/chunk-NHCLSSMK.cjs.map +1 -0
- package/dist/chunk-QJYWBJE2.cjs +87 -0
- package/dist/chunk-QJYWBJE2.cjs.map +1 -0
- package/dist/{chunk-OKXBDPYF.js → chunk-UCWY7BIM.js} +369 -5
- package/dist/chunk-UCWY7BIM.js.map +1 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/index.cjs +18 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -3
- package/dist/index.d.ts +48 -3
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/process-K3PJFLUV.cjs +7 -0
- package/dist/{process-VXDWM664.cjs.map → process-K3PJFLUV.cjs.map} +1 -1
- package/dist/process-XS6U5TCT.js +7 -0
- package/dist/{types-DAfWIHiD.d.cts → types-CtC0JyA4.d.cts} +47 -1
- package/dist/{types-DAfWIHiD.d.ts → types-CtC0JyA4.d.ts} +47 -1
- package/package.json +1 -1
- package/dist/chunk-H3D7F4TA.cjs.map +0 -1
- package/dist/chunk-OKXBDPYF.js.map +0 -1
- package/dist/process-VXDWM664.cjs +0 -7
- package/dist/process-ZQV5M2TB.js +0 -7
- /package/dist/{process-ZQV5M2TB.js.map → process-XS6U5TCT.js.map} +0 -0
|
@@ -1,68 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkH3D7F4TAcjs = require('../../chunk-H3D7F4TA.cjs');
|
|
3
|
+
var _chunkQJYWBJE2cjs = require('../../chunk-QJYWBJE2.cjs');
|
|
4
|
+
require('../../chunk-NHCLSSMK.cjs');
|
|
7
5
|
|
|
8
6
|
// src/adapters/astro/index.ts
|
|
9
|
-
var _fs = require('fs');
|
|
10
|
-
var _path = require('path');
|
|
11
7
|
function vazaContent(config) {
|
|
12
8
|
return {
|
|
13
9
|
name: "vaza-content",
|
|
14
10
|
hooks: {
|
|
15
11
|
"astro:build:start": async () => {
|
|
16
|
-
await
|
|
12
|
+
await _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
17
13
|
}
|
|
18
14
|
}
|
|
19
15
|
};
|
|
20
16
|
}
|
|
21
17
|
async function buildVazaContent(config) {
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
async function processAndWrite(config) {
|
|
25
|
-
const output = await _chunkH3D7F4TAcjs.processCollections.call(void 0, config);
|
|
26
|
-
const outDir = ".vaza-content";
|
|
27
|
-
ensureDir(outDir);
|
|
28
|
-
ensureDir("public");
|
|
29
|
-
if (_optionalChain([config, 'access', _ => _.sitemap, 'optionalAccess', _2 => _2.enabled]) !== false) {
|
|
30
|
-
writeJson(_path.join.call(void 0, outDir, "sitemap-data.json"), output.sitemap);
|
|
31
|
-
const xml = _chunkH3D7F4TAcjs.renderSitemapXml.call(void 0, output.sitemap);
|
|
32
|
-
_fs.writeFileSync.call(void 0, "public/sitemap.xml", xml, "utf-8");
|
|
33
|
-
}
|
|
34
|
-
if (_optionalChain([config, 'access', _3 => _3.rss, 'optionalAccess', _4 => _4.enabled]) !== false) {
|
|
35
|
-
const xml = _chunkH3D7F4TAcjs.renderRssXml.call(void 0, output.rss, config);
|
|
36
|
-
const rssPath = _nullishCoalesce(_optionalChain([config, 'access', _5 => _5.rss, 'optionalAccess', _6 => _6.path]), () => ( "/rss.xml"));
|
|
37
|
-
_fs.writeFileSync.call(void 0, _path.join.call(void 0, "public", rssPath.replace(/^\//, "")), xml, "utf-8");
|
|
38
|
-
}
|
|
39
|
-
if (_optionalChain([config, 'access', _7 => _7.jsonLd, 'optionalAccess', _8 => _8.enabled]) !== false) {
|
|
40
|
-
const jsonLdDir = _path.join.call(void 0, outDir, "json-ld");
|
|
41
|
-
ensureDir(jsonLdDir);
|
|
42
|
-
for (const [slug, schemas] of Object.entries(output.jsonLd)) {
|
|
43
|
-
writeJson(_path.join.call(void 0, jsonLdDir, `${slug}.json`), schemas);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (_optionalChain([config, 'access', _9 => _9.taxonomy, 'optionalAccess', _10 => _10.enabled]) !== false) {
|
|
47
|
-
writeJson(_path.join.call(void 0, outDir, "taxonomy.json"), output.taxonomy);
|
|
48
|
-
}
|
|
49
|
-
if (_optionalChain([config, 'access', _11 => _11.redirects, 'optionalAccess', _12 => _12.enabled]) !== false) {
|
|
50
|
-
writeJson(_path.join.call(void 0, outDir, "redirects.json"), output.redirects);
|
|
51
|
-
}
|
|
52
|
-
writeJson(_path.join.call(void 0, outDir, "integrity-report.json"), output.integrity);
|
|
53
|
-
const slugManifest = output.entries.map((e) => e.slug);
|
|
54
|
-
writeJson(_path.join.call(void 0, outDir, "slugs.json"), slugManifest);
|
|
55
|
-
_chunkH3D7F4TAcjs.logger.info(`Generated ${output.entries.length} entries`);
|
|
56
|
-
return output;
|
|
57
|
-
}
|
|
58
|
-
function ensureDir(dir) {
|
|
59
|
-
if (!_fs.existsSync.call(void 0, dir)) {
|
|
60
|
-
_fs.mkdirSync.call(void 0, dir, { recursive: true });
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function writeJson(path, data) {
|
|
64
|
-
ensureDir(_path.dirname.call(void 0, path));
|
|
65
|
-
_fs.writeFileSync.call(void 0, path, JSON.stringify(data, null, 2), "utf-8");
|
|
18
|
+
return _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
66
19
|
}
|
|
67
20
|
|
|
68
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/mehdi/vaza-content/dist/adapters/astro/index.cjs","../../../src/adapters/astro/index.ts"],"names":[],"mappings":"AAAA;AACE;
|
|
1
|
+
{"version":3,"sources":["/Users/mehdi/vaza-content/dist/adapters/astro/index.cjs","../../../src/adapters/astro/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,4DAAiC;AACjC,oCAAiC;AACjC;AACA;ACQO,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,sDAAA,MAAuB,EAAQ,QAAQ,CAAA;AAAA,MAC/C;AAAA,IACF;AAAA,EACF,CAAA;AACF;AAKA,MAAA,SAAsB,gBAAA,CACpB,MAAA,EACqB;AACrB,EAAA,OAAO,sDAAA,MAAuB,EAAQ,QAAQ,CAAA;AAChD;ADZA;AACE;AACA;AACF,+EAAC","file":"/Users/mehdi/vaza-content/dist/adapters/astro/index.cjs","sourcesContent":[null,"import type { VazaConfig, VazaOutput } from \"../../types.js\";\nimport { processAndWriteOutputs } from \"../shared.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 processAndWriteOutputs(config, \"public\");\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 processAndWriteOutputs(config, \"public\");\n}\n"]}
|
|
@@ -1,68 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
renderSitemapXml
|
|
6
|
-
} from "../../chunk-OKXBDPYF.js";
|
|
2
|
+
processAndWriteOutputs
|
|
3
|
+
} from "../../chunk-42BZQUA7.js";
|
|
4
|
+
import "../../chunk-UCWY7BIM.js";
|
|
7
5
|
|
|
8
6
|
// src/adapters/astro/index.ts
|
|
9
|
-
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
10
|
-
import { dirname, join } from "path";
|
|
11
7
|
function vazaContent(config) {
|
|
12
8
|
return {
|
|
13
9
|
name: "vaza-content",
|
|
14
10
|
hooks: {
|
|
15
11
|
"astro:build:start": async () => {
|
|
16
|
-
await
|
|
12
|
+
await processAndWriteOutputs(config, "public");
|
|
17
13
|
}
|
|
18
14
|
}
|
|
19
15
|
};
|
|
20
16
|
}
|
|
21
17
|
async function buildVazaContent(config) {
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
async function processAndWrite(config) {
|
|
25
|
-
const output = await processCollections(config);
|
|
26
|
-
const outDir = ".vaza-content";
|
|
27
|
-
ensureDir(outDir);
|
|
28
|
-
ensureDir("public");
|
|
29
|
-
if (config.sitemap?.enabled !== false) {
|
|
30
|
-
writeJson(join(outDir, "sitemap-data.json"), output.sitemap);
|
|
31
|
-
const xml = renderSitemapXml(output.sitemap);
|
|
32
|
-
writeFileSync("public/sitemap.xml", xml, "utf-8");
|
|
33
|
-
}
|
|
34
|
-
if (config.rss?.enabled !== false) {
|
|
35
|
-
const xml = renderRssXml(output.rss, config);
|
|
36
|
-
const rssPath = config.rss?.path ?? "/rss.xml";
|
|
37
|
-
writeFileSync(join("public", rssPath.replace(/^\//, "")), xml, "utf-8");
|
|
38
|
-
}
|
|
39
|
-
if (config.jsonLd?.enabled !== false) {
|
|
40
|
-
const jsonLdDir = join(outDir, "json-ld");
|
|
41
|
-
ensureDir(jsonLdDir);
|
|
42
|
-
for (const [slug, schemas] of Object.entries(output.jsonLd)) {
|
|
43
|
-
writeJson(join(jsonLdDir, `${slug}.json`), schemas);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (config.taxonomy?.enabled !== false) {
|
|
47
|
-
writeJson(join(outDir, "taxonomy.json"), output.taxonomy);
|
|
48
|
-
}
|
|
49
|
-
if (config.redirects?.enabled !== false) {
|
|
50
|
-
writeJson(join(outDir, "redirects.json"), output.redirects);
|
|
51
|
-
}
|
|
52
|
-
writeJson(join(outDir, "integrity-report.json"), output.integrity);
|
|
53
|
-
const slugManifest = output.entries.map((e) => e.slug);
|
|
54
|
-
writeJson(join(outDir, "slugs.json"), slugManifest);
|
|
55
|
-
logger.info(`Generated ${output.entries.length} entries`);
|
|
56
|
-
return output;
|
|
57
|
-
}
|
|
58
|
-
function ensureDir(dir) {
|
|
59
|
-
if (!existsSync(dir)) {
|
|
60
|
-
mkdirSync(dir, { recursive: true });
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function writeJson(path, data) {
|
|
64
|
-
ensureDir(dirname(path));
|
|
65
|
-
writeFileSync(path, JSON.stringify(data, null, 2), "utf-8");
|
|
18
|
+
return processAndWriteOutputs(config, "public");
|
|
66
19
|
}
|
|
67
20
|
export {
|
|
68
21
|
buildVazaContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapters/astro/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/astro/index.ts"],"sourcesContent":["import type { VazaConfig, VazaOutput } from \"../../types.js\";\nimport { processAndWriteOutputs } from \"../shared.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 processAndWriteOutputs(config, \"public\");\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 processAndWriteOutputs(config, \"public\");\n}\n"],"mappings":";;;;;;AAaO,SAAS,YAAY,QAAoB;AAC9C,SAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,MACL,qBAAqB,YAAY;AAC/B,cAAM,uBAAuB,QAAQ,QAAQ;AAAA,MAC/C;AAAA,IACF;AAAA,EACF;AACF;AAKA,eAAsB,iBACpB,QACqB;AACrB,SAAO,uBAAuB,QAAQ,QAAQ;AAChD;","names":[]}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
+
var _chunkQJYWBJE2cjs = require('../../chunk-QJYWBJE2.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
var _chunkH3D7F4TAcjs = require('../../chunk-H3D7F4TA.cjs');
|
|
6
|
+
var _chunkNHCLSSMKcjs = require('../../chunk-NHCLSSMK.cjs');
|
|
7
7
|
|
|
8
8
|
// src/adapters/next/index.ts
|
|
9
|
-
var _fs = require('fs');
|
|
10
|
-
var _path = require('path');
|
|
11
9
|
var processingPromise = null;
|
|
12
10
|
function withVazaContent(nextConfig, vazaConfig) {
|
|
13
11
|
const originalWebpack = nextConfig.webpack;
|
|
@@ -15,9 +13,9 @@ function withVazaContent(nextConfig, vazaConfig) {
|
|
|
15
13
|
...nextConfig,
|
|
16
14
|
webpack(config, options) {
|
|
17
15
|
if (options.isServer && vazaConfig && !processingPromise) {
|
|
18
|
-
processingPromise =
|
|
16
|
+
processingPromise = _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, vazaConfig, "public");
|
|
19
17
|
processingPromise.catch((err) => {
|
|
20
|
-
|
|
18
|
+
_chunkNHCLSSMKcjs.logger.error("Build error:", err);
|
|
21
19
|
process.exit(1);
|
|
22
20
|
});
|
|
23
21
|
}
|
|
@@ -29,53 +27,7 @@ function withVazaContent(nextConfig, vazaConfig) {
|
|
|
29
27
|
};
|
|
30
28
|
}
|
|
31
29
|
async function buildVazaContent(config) {
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
async function processAndWrite(config) {
|
|
35
|
-
const output = await _chunkH3D7F4TAcjs.processCollections.call(void 0, config);
|
|
36
|
-
const outDir = ".vaza-content";
|
|
37
|
-
ensureDir(outDir);
|
|
38
|
-
if (_optionalChain([config, 'access', _ => _.sitemap, 'optionalAccess', _2 => _2.enabled]) !== false) {
|
|
39
|
-
writeJson(_path.join.call(void 0, outDir, "sitemap-data.json"), output.sitemap);
|
|
40
|
-
const xml = _chunkH3D7F4TAcjs.renderSitemapXml.call(void 0, output.sitemap);
|
|
41
|
-
ensureDir("public");
|
|
42
|
-
_fs.writeFileSync.call(void 0, "public/sitemap.xml", xml, "utf-8");
|
|
43
|
-
}
|
|
44
|
-
if (_optionalChain([config, 'access', _3 => _3.rss, 'optionalAccess', _4 => _4.enabled]) !== false) {
|
|
45
|
-
const xml = _chunkH3D7F4TAcjs.renderRssXml.call(void 0, output.rss, config);
|
|
46
|
-
const rssPath = _nullishCoalesce(_optionalChain([config, 'access', _5 => _5.rss, 'optionalAccess', _6 => _6.path]), () => ( "/rss.xml"));
|
|
47
|
-
const rssFile = _path.join.call(void 0, "public", rssPath.replace(/^\//, ""));
|
|
48
|
-
ensureDir(_path.dirname.call(void 0, rssFile));
|
|
49
|
-
_fs.writeFileSync.call(void 0, rssFile, xml, "utf-8");
|
|
50
|
-
}
|
|
51
|
-
if (_optionalChain([config, 'access', _7 => _7.jsonLd, 'optionalAccess', _8 => _8.enabled]) !== false) {
|
|
52
|
-
const jsonLdDir = _path.join.call(void 0, outDir, "json-ld");
|
|
53
|
-
ensureDir(jsonLdDir);
|
|
54
|
-
for (const [slug, schemas] of Object.entries(output.jsonLd)) {
|
|
55
|
-
writeJson(_path.join.call(void 0, jsonLdDir, `${slug}.json`), schemas);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (_optionalChain([config, 'access', _9 => _9.taxonomy, 'optionalAccess', _10 => _10.enabled]) !== false) {
|
|
59
|
-
writeJson(_path.join.call(void 0, outDir, "taxonomy.json"), output.taxonomy);
|
|
60
|
-
}
|
|
61
|
-
if (_optionalChain([config, 'access', _11 => _11.redirects, 'optionalAccess', _12 => _12.enabled]) !== false) {
|
|
62
|
-
writeJson(_path.join.call(void 0, outDir, "redirects.json"), output.redirects);
|
|
63
|
-
}
|
|
64
|
-
writeJson(_path.join.call(void 0, outDir, "integrity-report.json"), output.integrity);
|
|
65
|
-
const slugManifest = output.entries.map((e) => e.slug);
|
|
66
|
-
writeJson(_path.join.call(void 0, outDir, "slugs.json"), slugManifest);
|
|
67
|
-
_chunkH3D7F4TAcjs.logger.info(`Generated ${output.entries.length} entries`);
|
|
68
|
-
_chunkH3D7F4TAcjs.logger.info(`Outputs written to ${outDir}/ and public/`);
|
|
69
|
-
return output;
|
|
70
|
-
}
|
|
71
|
-
function ensureDir(dir) {
|
|
72
|
-
if (!_fs.existsSync.call(void 0, dir)) {
|
|
73
|
-
_fs.mkdirSync.call(void 0, dir, { recursive: true });
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function writeJson(path, data) {
|
|
77
|
-
ensureDir(_path.dirname.call(void 0, path));
|
|
78
|
-
_fs.writeFileSync.call(void 0, path, JSON.stringify(data, null, 2), "utf-8");
|
|
30
|
+
return _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
79
31
|
}
|
|
80
32
|
|
|
81
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/mehdi/vaza-content/dist/adapters/next/index.cjs","../../../src/adapters/next/index.ts"],"names":[],"mappings":"AAAA;AACE;
|
|
1
|
+
{"version":3,"sources":["/Users/mehdi/vaza-content/dist/adapters/next/index.cjs","../../../src/adapters/next/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,4DAAiC;AACjC;AACE;AACF,4DAAiC;AACjC;AACA;ACFA,IAAI,kBAAA,EAAgD,IAAA;AAU7C,SAAS,eAAA,CACd,UAAA,EACA,UAAA,EACyB;AACzB,EAAA,MAAM,gBAAA,EAAkB,UAAA,CAAW,OAAA;AAInC,EAAA,OAAO;AAAA,IACL,GAAG,UAAA;AAAA,IACH,OAAA,CAAQ,MAAA,EAAiB,OAAA,EAAkC;AACzD,MAAA,GAAA,CAAI,OAAA,CAAQ,SAAA,GAAY,WAAA,GAAc,CAAC,iBAAA,EAAmB;AACxD,QAAA,kBAAA,EAAoB,sDAAA,UAAuB,EAAY,QAAQ,CAAA;AAC/D,QAAA,iBAAA,CAAkB,KAAA,CAAM,CAAC,GAAA,EAAA,GAAiB;AACxC,UAAA,wBAAA,CAAO,KAAA,CAAM,cAAA,EAAgB,GAAG,CAAA;AAChC,UAAA,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA;AAAA,QAChB,CAAC,CAAA;AAAA,MACH;AAEA,MAAA,GAAA,CAAI,eAAA,EAAiB;AACnB,QAAA,OAAO,eAAA,CAAgB,MAAA,EAAQ,OAAO,CAAA;AAAA,MACxC;AACA,MAAA,OAAO,MAAA;AAAA,IACT;AAAA,EACF,CAAA;AACF;AAMA,MAAA,SAAsB,gBAAA,CACpB,MAAA,EACqB;AACrB,EAAA,OAAO,sDAAA,MAAuB,EAAQ,QAAQ,CAAA;AAChD;ADnBA;AACE;AACA;AACF,uFAAC","file":"/Users/mehdi/vaza-content/dist/adapters/next/index.cjs","sourcesContent":[null,"import { logger } from \"../../logger.js\";\nimport type { VazaConfig, VazaOutput } from \"../../types.js\";\nimport { processAndWriteOutputs } from \"../shared.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 if (options.isServer && vazaConfig && !processingPromise) {\n processingPromise = processAndWriteOutputs(vazaConfig, \"public\");\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 */\nexport async function buildVazaContent(\n config: VazaConfig,\n): Promise<VazaOutput> {\n return processAndWriteOutputs(config, \"public\");\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as VazaConfig, a as VazaOutput } from '../../types-
|
|
1
|
+
import { V as VazaConfig, a as VazaOutput } from '../../types-CtC0JyA4.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Next.js adapter -- wraps next.config and hooks into the build.
|
|
@@ -12,7 +12,6 @@ declare function withVazaContent(nextConfig: Record<string, unknown>, vazaConfig
|
|
|
12
12
|
/**
|
|
13
13
|
* Standalone function to process and write outputs.
|
|
14
14
|
* Recommended over withVazaContent for more reliable builds.
|
|
15
|
-
* Call from a prebuild script or next.config.ts top level.
|
|
16
15
|
*/
|
|
17
16
|
declare function buildVazaContent(config: VazaConfig): Promise<VazaOutput>;
|
|
18
17
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as VazaConfig, a as VazaOutput } from '../../types-
|
|
1
|
+
import { V as VazaConfig, a as VazaOutput } from '../../types-CtC0JyA4.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Next.js adapter -- wraps next.config and hooks into the build.
|
|
@@ -12,7 +12,6 @@ declare function withVazaContent(nextConfig: Record<string, unknown>, vazaConfig
|
|
|
12
12
|
/**
|
|
13
13
|
* Standalone function to process and write outputs.
|
|
14
14
|
* Recommended over withVazaContent for more reliable builds.
|
|
15
|
-
* Call from a prebuild script or next.config.ts top level.
|
|
16
15
|
*/
|
|
17
16
|
declare function buildVazaContent(config: VazaConfig): Promise<VazaOutput>;
|
|
18
17
|
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "../../chunk-
|
|
2
|
+
processAndWriteOutputs
|
|
3
|
+
} from "../../chunk-42BZQUA7.js";
|
|
4
|
+
import {
|
|
5
|
+
logger
|
|
6
|
+
} from "../../chunk-UCWY7BIM.js";
|
|
7
7
|
|
|
8
8
|
// src/adapters/next/index.ts
|
|
9
|
-
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
10
|
-
import { dirname, join } from "path";
|
|
11
9
|
var processingPromise = null;
|
|
12
10
|
function withVazaContent(nextConfig, vazaConfig) {
|
|
13
11
|
const originalWebpack = nextConfig.webpack;
|
|
@@ -15,7 +13,7 @@ function withVazaContent(nextConfig, vazaConfig) {
|
|
|
15
13
|
...nextConfig,
|
|
16
14
|
webpack(config, options) {
|
|
17
15
|
if (options.isServer && vazaConfig && !processingPromise) {
|
|
18
|
-
processingPromise =
|
|
16
|
+
processingPromise = processAndWriteOutputs(vazaConfig, "public");
|
|
19
17
|
processingPromise.catch((err) => {
|
|
20
18
|
logger.error("Build error:", err);
|
|
21
19
|
process.exit(1);
|
|
@@ -29,53 +27,7 @@ function withVazaContent(nextConfig, vazaConfig) {
|
|
|
29
27
|
};
|
|
30
28
|
}
|
|
31
29
|
async function buildVazaContent(config) {
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
async function processAndWrite(config) {
|
|
35
|
-
const output = await processCollections(config);
|
|
36
|
-
const outDir = ".vaza-content";
|
|
37
|
-
ensureDir(outDir);
|
|
38
|
-
if (config.sitemap?.enabled !== false) {
|
|
39
|
-
writeJson(join(outDir, "sitemap-data.json"), output.sitemap);
|
|
40
|
-
const xml = renderSitemapXml(output.sitemap);
|
|
41
|
-
ensureDir("public");
|
|
42
|
-
writeFileSync("public/sitemap.xml", xml, "utf-8");
|
|
43
|
-
}
|
|
44
|
-
if (config.rss?.enabled !== false) {
|
|
45
|
-
const xml = renderRssXml(output.rss, config);
|
|
46
|
-
const rssPath = config.rss?.path ?? "/rss.xml";
|
|
47
|
-
const rssFile = join("public", rssPath.replace(/^\//, ""));
|
|
48
|
-
ensureDir(dirname(rssFile));
|
|
49
|
-
writeFileSync(rssFile, xml, "utf-8");
|
|
50
|
-
}
|
|
51
|
-
if (config.jsonLd?.enabled !== false) {
|
|
52
|
-
const jsonLdDir = join(outDir, "json-ld");
|
|
53
|
-
ensureDir(jsonLdDir);
|
|
54
|
-
for (const [slug, schemas] of Object.entries(output.jsonLd)) {
|
|
55
|
-
writeJson(join(jsonLdDir, `${slug}.json`), schemas);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (config.taxonomy?.enabled !== false) {
|
|
59
|
-
writeJson(join(outDir, "taxonomy.json"), output.taxonomy);
|
|
60
|
-
}
|
|
61
|
-
if (config.redirects?.enabled !== false) {
|
|
62
|
-
writeJson(join(outDir, "redirects.json"), output.redirects);
|
|
63
|
-
}
|
|
64
|
-
writeJson(join(outDir, "integrity-report.json"), output.integrity);
|
|
65
|
-
const slugManifest = output.entries.map((e) => e.slug);
|
|
66
|
-
writeJson(join(outDir, "slugs.json"), slugManifest);
|
|
67
|
-
logger.info(`Generated ${output.entries.length} entries`);
|
|
68
|
-
logger.info(`Outputs written to ${outDir}/ and public/`);
|
|
69
|
-
return output;
|
|
70
|
-
}
|
|
71
|
-
function ensureDir(dir) {
|
|
72
|
-
if (!existsSync(dir)) {
|
|
73
|
-
mkdirSync(dir, { recursive: true });
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function writeJson(path, data) {
|
|
77
|
-
ensureDir(dirname(path));
|
|
78
|
-
writeFileSync(path, JSON.stringify(data, null, 2), "utf-8");
|
|
30
|
+
return processAndWriteOutputs(config, "public");
|
|
79
31
|
}
|
|
80
32
|
export {
|
|
81
33
|
buildVazaContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapters/next/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/next/index.ts"],"sourcesContent":["import { logger } from \"../../logger.js\";\nimport type { VazaConfig, VazaOutput } from \"../../types.js\";\nimport { processAndWriteOutputs } from \"../shared.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 if (options.isServer && vazaConfig && !processingPromise) {\n processingPromise = processAndWriteOutputs(vazaConfig, \"public\");\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 */\nexport async function buildVazaContent(\n config: VazaConfig,\n): Promise<VazaOutput> {\n return processAndWriteOutputs(config, \"public\");\n}\n"],"mappings":";;;;;;;;AAKA,IAAI,oBAAgD;AAU7C,SAAS,gBACd,YACA,YACyB;AACzB,QAAM,kBAAkB,WAAW;AAInC,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ,QAAiB,SAAkC;AACzD,UAAI,QAAQ,YAAY,cAAc,CAAC,mBAAmB;AACxD,4BAAoB,uBAAuB,YAAY,QAAQ;AAC/D,0BAAkB,MAAM,CAAC,QAAiB;AACxC,iBAAO,MAAM,gBAAgB,GAAG;AAChC,kBAAQ,KAAK,CAAC;AAAA,QAChB,CAAC;AAAA,MACH;AAEA,UAAI,iBAAiB;AACnB,eAAO,gBAAgB,QAAQ,OAAO;AAAA,MACxC;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAMA,eAAsB,iBACpB,QACqB;AACrB,SAAO,uBAAuB,QAAQ,QAAQ;AAChD;","names":[]}
|
|
@@ -1,69 +1,22 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkH3D7F4TAcjs = require('../../chunk-H3D7F4TA.cjs');
|
|
3
|
+
var _chunkQJYWBJE2cjs = require('../../chunk-QJYWBJE2.cjs');
|
|
4
|
+
require('../../chunk-NHCLSSMK.cjs');
|
|
7
5
|
|
|
8
6
|
// src/adapters/nuxt/index.ts
|
|
9
|
-
var _fs = require('fs');
|
|
10
|
-
var _path = require('path');
|
|
11
7
|
function defineVazaContentModule(config) {
|
|
12
8
|
return async (_inlineOptions, nuxt) => {
|
|
13
9
|
if (_optionalChain([nuxt, 'optionalAccess', _ => _.hook])) {
|
|
14
10
|
nuxt.hook("build:before", async () => {
|
|
15
|
-
await
|
|
11
|
+
await _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
16
12
|
});
|
|
17
13
|
} else {
|
|
18
|
-
await
|
|
14
|
+
await _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
19
15
|
}
|
|
20
16
|
};
|
|
21
17
|
}
|
|
22
18
|
async function buildVazaContent(config) {
|
|
23
|
-
return
|
|
24
|
-
}
|
|
25
|
-
async function processAndWrite(config) {
|
|
26
|
-
const output = await _chunkH3D7F4TAcjs.processCollections.call(void 0, config);
|
|
27
|
-
const outDir = ".vaza-content";
|
|
28
|
-
ensureDir(outDir);
|
|
29
|
-
ensureDir("public");
|
|
30
|
-
if (_optionalChain([config, 'access', _2 => _2.sitemap, 'optionalAccess', _3 => _3.enabled]) !== false) {
|
|
31
|
-
writeJson(_path.join.call(void 0, outDir, "sitemap-data.json"), output.sitemap);
|
|
32
|
-
const xml = _chunkH3D7F4TAcjs.renderSitemapXml.call(void 0, output.sitemap);
|
|
33
|
-
_fs.writeFileSync.call(void 0, "public/sitemap.xml", xml, "utf-8");
|
|
34
|
-
}
|
|
35
|
-
if (_optionalChain([config, 'access', _4 => _4.rss, 'optionalAccess', _5 => _5.enabled]) !== false) {
|
|
36
|
-
const xml = _chunkH3D7F4TAcjs.renderRssXml.call(void 0, output.rss, config);
|
|
37
|
-
const rssPath = _nullishCoalesce(_optionalChain([config, 'access', _6 => _6.rss, 'optionalAccess', _7 => _7.path]), () => ( "/rss.xml"));
|
|
38
|
-
_fs.writeFileSync.call(void 0, _path.join.call(void 0, "public", rssPath.replace(/^\//, "")), xml, "utf-8");
|
|
39
|
-
}
|
|
40
|
-
if (_optionalChain([config, 'access', _8 => _8.jsonLd, 'optionalAccess', _9 => _9.enabled]) !== false) {
|
|
41
|
-
const jsonLdDir = _path.join.call(void 0, outDir, "json-ld");
|
|
42
|
-
ensureDir(jsonLdDir);
|
|
43
|
-
for (const [slug, schemas] of Object.entries(output.jsonLd)) {
|
|
44
|
-
writeJson(_path.join.call(void 0, jsonLdDir, `${slug}.json`), schemas);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (_optionalChain([config, 'access', _10 => _10.taxonomy, 'optionalAccess', _11 => _11.enabled]) !== false) {
|
|
48
|
-
writeJson(_path.join.call(void 0, outDir, "taxonomy.json"), output.taxonomy);
|
|
49
|
-
}
|
|
50
|
-
if (_optionalChain([config, 'access', _12 => _12.redirects, 'optionalAccess', _13 => _13.enabled]) !== false) {
|
|
51
|
-
writeJson(_path.join.call(void 0, outDir, "redirects.json"), output.redirects);
|
|
52
|
-
}
|
|
53
|
-
writeJson(_path.join.call(void 0, outDir, "integrity-report.json"), output.integrity);
|
|
54
|
-
const slugManifest = output.entries.map((e) => e.slug);
|
|
55
|
-
writeJson(_path.join.call(void 0, outDir, "slugs.json"), slugManifest);
|
|
56
|
-
_chunkH3D7F4TAcjs.logger.info(`Generated ${output.entries.length} entries`);
|
|
57
|
-
return output;
|
|
58
|
-
}
|
|
59
|
-
function ensureDir(dir) {
|
|
60
|
-
if (!_fs.existsSync.call(void 0, dir)) {
|
|
61
|
-
_fs.mkdirSync.call(void 0, dir, { recursive: true });
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function writeJson(path, data) {
|
|
65
|
-
ensureDir(_path.dirname.call(void 0, path));
|
|
66
|
-
_fs.writeFileSync.call(void 0, path, JSON.stringify(data, null, 2), "utf-8");
|
|
19
|
+
return _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
67
20
|
}
|
|
68
21
|
|
|
69
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/mehdi/vaza-content/dist/adapters/nuxt/index.cjs","../../../src/adapters/nuxt/index.ts"],"names":[],"mappings":"AAAA;AACE;
|
|
1
|
+
{"version":3,"sources":["/Users/mehdi/vaza-content/dist/adapters/nuxt/index.cjs","../../../src/adapters/nuxt/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,4DAAiC;AACjC,oCAAiC;AACjC;AACA;ACSO,SAAS,uBAAA,CAAwB,MAAA,EAAoB;AAC1D,EAAA,OAAO,MAAA,CACL,cAAA,EACA,IAAA,EAAA,GACG;AACH,IAAA,GAAA,iBAAI,IAAA,2BAAM,MAAA,EAAM;AACd,MAAA,IAAA,CAAK,IAAA,CAAK,cAAA,EAAgB,MAAA,CAAA,EAAA,GAAY;AACpC,QAAA,MAAM,sDAAA,MAAuB,EAAQ,QAAQ,CAAA;AAAA,MAC/C,CAAC,CAAA;AAAA,IACH,EAAA,KAAO;AACL,MAAA,MAAM,sDAAA,MAAuB,EAAQ,QAAQ,CAAA;AAAA,IAC/C;AAAA,EACF,CAAA;AACF;AAKA,MAAA,SAAsB,gBAAA,CACpB,MAAA,EACqB;AACrB,EAAA,OAAO,sDAAA,MAAuB,EAAQ,QAAQ,CAAA;AAChD;ADhBA;AACE;AACA;AACF,uGAAC","file":"/Users/mehdi/vaza-content/dist/adapters/nuxt/index.cjs","sourcesContent":[null,"import type { VazaConfig, VazaOutput } from \"../../types.js\";\nimport { processAndWriteOutputs } from \"../shared.js\";\n\n/**\n * Nuxt adapter -- module that hooks into the Nuxt build.\n *\n * Usage in nuxt.config.ts:\n * import { defineVazaContentModule } from 'vaza-content/nuxt'\n * import vazaConfig from './vaza.config'\n *\n * export default defineNuxtConfig({\n * modules: [defineVazaContentModule(vazaConfig)]\n * })\n */\nexport function defineVazaContentModule(config: VazaConfig) {\n return async (\n _inlineOptions: unknown,\n nuxt: { hook?: (event: string, fn: () => Promise<void>) => void },\n ) => {\n if (nuxt?.hook) {\n nuxt.hook(\"build:before\", async () => {\n await processAndWriteOutputs(config, \"public\");\n });\n } else {\n await processAndWriteOutputs(config, \"public\");\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 processAndWriteOutputs(config, \"public\");\n}\n"]}
|