@zeropress/build-core 0.6.6 → 0.6.8

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 CHANGED
@@ -120,7 +120,8 @@ Notes:
120
120
  - `writer` is required
121
121
  - `previewData` must already satisfy the canonical preview-data contract
122
122
  - `themePackage` must already be a validated in-memory theme package
123
- - `sitemap.xml` and `feed.xml` are emitted only when `site.url` is a non-empty canonical URL
123
+ - `sitemap.xml` is emitted only when `site.url` is a non-empty canonical URL
124
+ - `feed.xml` is emitted only when `site.url` is a non-empty canonical URL and `generateFeed` is not `false`
124
125
  - callers may pass `sitemapStylesheetHref` to add an XML stylesheet processing instruction to generated `sitemap.xml`
125
126
  - fallback `robots.txt` is emitted when `generateSpecialFiles` is enabled and `generateRobotsTxt` is not `false`
126
127
  - fallback `robots.txt` uses `site.indexing`; `false` emits `Disallow: /`, while missing or `true` emits `Allow: /`
@@ -229,6 +230,7 @@ Supported options:
229
230
  - `favicon`
230
231
  - `sitemapStylesheetHref`
231
232
  - `generateSpecialFiles`
233
+ - `generateFeed`
232
234
  - `generateRobotsTxt`
233
235
  - `writeManifest`
234
236
 
@@ -238,6 +240,7 @@ Defaults:
238
240
 
239
241
  - `assetHashing: true`
240
242
  - `generateSpecialFiles: true`
243
+ - `generateFeed: true`
241
244
  - `generateRobotsTxt: true`
242
245
  - `writeManifest: false`
243
246
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeropress/build-core",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
4
4
  "description": "Shared ZeroPress build core",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -9,6 +9,7 @@ import { ZeroPressEngine } from '../render/zeropress-engine.js';
9
9
  const DEFAULT_OPTIONS = {
10
10
  assetHashing: true,
11
11
  generateSpecialFiles: true,
12
+ generateFeed: true,
12
13
  generateRobotsTxt: true,
13
14
  writeManifest: false,
14
15
  };
@@ -115,7 +116,9 @@ export async function buildSite(input) {
115
116
  buildSitemapXml(state.previewData.site, state.emitted, state.generatedAt, options.sitemapStylesheetHref),
116
117
  'application/xml',
117
118
  );
118
- await writeOutput(state.writer, state.summaries, 'feed.xml', buildFeedXml(state.previewData.site, state.emitted, state.generatedAt), 'application/rss+xml');
119
+ if (shouldGenerateFeed(options)) {
120
+ await writeOutput(state.writer, state.summaries, 'feed.xml', buildFeedXml(state.previewData.site, state.emitted, state.generatedAt), 'application/rss+xml');
121
+ }
119
122
  }
120
123
  if (shouldGenerateRobotsTxt(options)) {
121
124
  await writeOutput(state.writer, state.summaries, 'robots.txt', buildRobotsTxt(state.previewData.site), 'text/plain');
@@ -2429,7 +2432,10 @@ function assertPlannedOutputPathsSafe(state) {
2429
2432
  plannedPaths.push('robots.txt');
2430
2433
  }
2431
2434
  if (hasCanonicalSiteUrl(state.previewData.site.url)) {
2432
- plannedPaths.push('sitemap.xml', 'feed.xml');
2435
+ plannedPaths.push('sitemap.xml');
2436
+ if (shouldGenerateFeed(state.options)) {
2437
+ plannedPaths.push('feed.xml');
2438
+ }
2433
2439
  }
2434
2440
  }
2435
2441
 
@@ -3158,6 +3164,10 @@ function shouldGenerateRobotsTxt(options) {
3158
3164
  return options.generateSpecialFiles && options.generateRobotsTxt !== false;
3159
3165
  }
3160
3166
 
3167
+ function shouldGenerateFeed(options) {
3168
+ return options.generateSpecialFiles && options.generateFeed !== false;
3169
+ }
3170
+
3161
3171
  function shouldGenerateSearchArtifacts(state, options) {
3162
3172
  return options.generateSpecialFiles && state.previewData.site.search === true;
3163
3173
  }
package/src/index.d.ts CHANGED
@@ -30,6 +30,7 @@ export interface BuildOptions {
30
30
  };
31
31
  sitemapStylesheetHref?: string;
32
32
  generateSpecialFiles?: boolean;
33
+ generateFeed?: boolean;
33
34
  generateRobotsTxt?: boolean;
34
35
  writeManifest?: boolean;
35
36
  }