@zeropress/build-core 0.5.2 → 0.6.2
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 +34 -40
- package/package.json +3 -3
- package/src/api/build-site.js +805 -135
- package/src/index.d.ts +4 -3
- package/src/render/content-renderer.js +20 -2
- package/src/render/control-flow-renderer.js +251 -39
- package/src/render/partial-resolver.js +42 -6
- package/src/render/variable-resolver.js +4 -0
- package/src/render/zeropress-engine.js +2 -2
- package/src/theme/load-theme-dir.js +56 -1
package/README.md
CHANGED
|
@@ -4,12 +4,19 @@
|
|
|
4
4
|

|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
Shared
|
|
7
|
+
Shared deterministic rendering core for ZeroPress static output v0.6.
|
|
8
8
|
|
|
9
|
-
This package is the
|
|
9
|
+
This package is the canonical rendering core for preview-data and theme packages consumed directly by:
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
- [
|
|
11
|
+
- [@zeropress/build](https://www.npmjs.com/package/@zeropress/build)
|
|
12
|
+
- [@zeropress/theme](https://www.npmjs.com/package/@zeropress/theme)
|
|
13
|
+
|
|
14
|
+
Public contract references:
|
|
15
|
+
|
|
16
|
+
- [Preview Data v0.6 Spec](https://zeropress.dev/spec/preview-data-v0.6.html)
|
|
17
|
+
- [Preview Data v0.6 Schema](https://zeropress.dev/schemas/preview-data.v0.6.schema.json)
|
|
18
|
+
- [Theme Runtime v0.6 Spec](https://zeropress.dev/spec/theme-runtime-v0.6.html)
|
|
19
|
+
- [Theme Runtime v0.6 Schema](https://zeropress.dev/schemas/theme.v0.6.runtime.schema.json)
|
|
13
20
|
|
|
14
21
|
It accepts canonical preview-data plus a validated theme package and produces static HTML artifacts through a writer interface.
|
|
15
22
|
|
|
@@ -18,16 +25,12 @@ It accepts canonical preview-data plus a validated theme package and produces st
|
|
|
18
25
|
- renderable preview-data entries
|
|
19
26
|
- theme template capability
|
|
20
27
|
|
|
21
|
-
---
|
|
22
|
-
|
|
23
28
|
## Install
|
|
24
29
|
|
|
25
30
|
```bash
|
|
26
31
|
npm install @zeropress/build-core
|
|
27
32
|
```
|
|
28
33
|
|
|
29
|
-
---
|
|
30
|
-
|
|
31
34
|
## Exports
|
|
32
35
|
|
|
33
36
|
```js
|
|
@@ -39,8 +42,6 @@ import {
|
|
|
39
42
|
} from '@zeropress/build-core';
|
|
40
43
|
```
|
|
41
44
|
|
|
42
|
-
---
|
|
43
|
-
|
|
44
45
|
## Purpose
|
|
45
46
|
|
|
46
47
|
`@zeropress/build-core` is responsible for:
|
|
@@ -55,6 +56,10 @@ import {
|
|
|
55
56
|
- `sitemap.xml`
|
|
56
57
|
- `feed.xml`
|
|
57
58
|
- fallback `robots.txt`
|
|
59
|
+
- `/_zeropress/comment-policy.json`
|
|
60
|
+
- `/_zeropress/search.json` when native search is enabled
|
|
61
|
+
- `/_zeropress/search.js` when native search is enabled
|
|
62
|
+
- `/_zeropress/search_pagefind.js` when native search is enabled
|
|
58
63
|
- writing outputs through a pluggable writer
|
|
59
64
|
|
|
60
65
|
It does not:
|
|
@@ -64,8 +69,6 @@ It does not:
|
|
|
64
69
|
- watch files, run a dev server, or perform deployment
|
|
65
70
|
- talk to queues, KV, Durable Objects, R2, GitHub, or other infrastructure directly
|
|
66
71
|
|
|
67
|
-
---
|
|
68
|
-
|
|
69
72
|
## Core APIs
|
|
70
73
|
|
|
71
74
|
### `buildSite(input)`
|
|
@@ -119,6 +122,7 @@ Notes:
|
|
|
119
122
|
- `previewData` must already satisfy the canonical preview-data contract
|
|
120
123
|
- `themePackage` must already be a validated in-memory theme package
|
|
121
124
|
- `sitemap.xml` and `feed.xml` are emitted only when `site.url` is a non-empty canonical URL
|
|
125
|
+
- callers may pass `sitemapStylesheetHref` to add an XML stylesheet processing instruction to generated `sitemap.xml`
|
|
122
126
|
- fallback `robots.txt` is emitted when `generateSpecialFiles` is enabled and `generateRobotsTxt` is not `false`
|
|
123
127
|
- fallback `robots.txt` uses `site.indexing`; `false` emits `Disallow: /`, while missing or `true` emits `Allow: /`
|
|
124
128
|
- callers that disable fallback robots because a public `robots.txt` exists should copy that file as-is; sitemap directives in custom robots files are caller/user responsibility
|
|
@@ -129,8 +133,6 @@ Loads a theme directory from disk and renders it using the same core pipeline.
|
|
|
129
133
|
|
|
130
134
|
This is useful for local tooling that wants filesystem theme loading but still uses the same deterministic core renderer.
|
|
131
135
|
|
|
132
|
-
---
|
|
133
|
-
|
|
134
136
|
## Writers
|
|
135
137
|
|
|
136
138
|
### `MemoryWriter`
|
|
@@ -152,8 +154,6 @@ Best for:
|
|
|
152
154
|
- local output generation
|
|
153
155
|
- CLI workflows
|
|
154
156
|
|
|
155
|
-
---
|
|
156
|
-
|
|
157
157
|
## Input Contracts
|
|
158
158
|
|
|
159
159
|
### Preview Data
|
|
@@ -179,15 +179,16 @@ Theme validation is enforced through:
|
|
|
179
179
|
|
|
180
180
|
JavaScript theme assets are emitted as provided. Build-core may hash output filenames, but it does not rewrite or minify JavaScript content.
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
In `preview-data v0.6`, the payload does not carry `routes` arrays or raw HTML fragments such as `categories_html`.
|
|
183
183
|
|
|
184
|
-
Build-core
|
|
184
|
+
Build-core derives:
|
|
185
185
|
|
|
186
186
|
- index/archive/category/tag routes
|
|
187
187
|
- post list HTML blocks
|
|
188
188
|
- pagination HTML
|
|
189
189
|
- taxonomy link HTML
|
|
190
190
|
- formatted `published_at` / `updated_at`
|
|
191
|
+
- datetime formatting from `site.locale`, `site.timezone`, `site.date_style`, and `site.time_style`
|
|
191
192
|
- `reading_time`
|
|
192
193
|
- `comments_enabled`
|
|
193
194
|
|
|
@@ -197,14 +198,24 @@ It also emits a comments allowlist artifact:
|
|
|
197
198
|
|
|
198
199
|
Comment availability is derived from preview-data policy:
|
|
199
200
|
|
|
200
|
-
- `site.
|
|
201
|
+
- `site.disallow_comments`
|
|
201
202
|
- `content.posts[].allow_comments`
|
|
202
203
|
|
|
203
|
-
The canonical `preview-data v0.
|
|
204
|
+
The canonical `preview-data v0.6` site contract uses:
|
|
204
205
|
|
|
206
|
+
- `site.media_base_url`
|
|
207
|
+
- `site.media_delivery_mode`
|
|
205
208
|
- `site.locale`
|
|
206
209
|
- `site.timezone`
|
|
207
|
-
- `site.
|
|
210
|
+
- `site.datetime_display`
|
|
211
|
+
- `site.date_style`
|
|
212
|
+
- `site.time_style`
|
|
213
|
+
- `site.disallow_comments`
|
|
214
|
+
- `site.indexing`
|
|
215
|
+
- `site.expose_generator`
|
|
216
|
+
- `site.search`
|
|
217
|
+
|
|
218
|
+
Native search artifacts are emitted only when preview-data does not set `site.search: false` and the active theme declares `features.search: true`. `search_pagefind.js` is a Pagefind adapter that can replace `search.js` after a post-build Pagefind step.
|
|
208
219
|
|
|
209
220
|
Optional route templates behave as rendering capabilities, not guaranteed outputs:
|
|
210
221
|
|
|
@@ -215,13 +226,13 @@ Optional route templates behave as rendering capabilities, not guaranteed output
|
|
|
215
226
|
|
|
216
227
|
If preview-data includes content that could produce archive/category/tag pages but the theme omits the matching optional template, build-core skips those outputs. Special files are derived from emitted outputs rather than raw preview-data alone.
|
|
217
228
|
|
|
218
|
-
---
|
|
219
|
-
|
|
220
229
|
## Build Options
|
|
221
230
|
|
|
222
231
|
Supported options:
|
|
223
232
|
|
|
224
233
|
- `assetHashing`
|
|
234
|
+
- `favicon`
|
|
235
|
+
- `sitemapStylesheetHref`
|
|
225
236
|
- `generateSpecialFiles`
|
|
226
237
|
- `generateRobotsTxt`
|
|
227
238
|
- `writeManifest`
|
|
@@ -235,23 +246,6 @@ Defaults:
|
|
|
235
246
|
- `generateRobotsTxt: true`
|
|
236
247
|
- `writeManifest: false`
|
|
237
248
|
|
|
238
|
-
---
|
|
239
|
-
|
|
240
|
-
## Requirements
|
|
241
|
-
|
|
242
|
-
- Node.js >= 18.18.0
|
|
243
|
-
- ESM only
|
|
244
|
-
|
|
245
|
-
---
|
|
246
|
-
|
|
247
|
-
## Related
|
|
248
|
-
|
|
249
|
-
- [@zeropress/preview-data-validator](https://www.npmjs.com/package/@zeropress/preview-data-validator)
|
|
250
|
-
- [@zeropress/theme-validator](https://www.npmjs.com/package/@zeropress/theme-validator)
|
|
251
|
-
- [@zeropress/theme](https://www.npmjs.com/package/@zeropress/theme)
|
|
252
|
-
|
|
253
|
-
---
|
|
254
|
-
|
|
255
249
|
## License
|
|
256
250
|
|
|
257
251
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeropress/build-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Shared ZeroPress build core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@zeropress/slug-policy": "0.1.0",
|
|
37
|
-
"@zeropress/preview-data-validator": "0.
|
|
38
|
-
"@zeropress/theme-validator": "0.
|
|
37
|
+
"@zeropress/preview-data-validator": "0.6.2",
|
|
38
|
+
"@zeropress/theme-validator": "0.6.2",
|
|
39
39
|
"highlight.js": "^11.11.1",
|
|
40
40
|
"markdown-it": "^14.1.0",
|
|
41
41
|
"markdown-it-anchor": "^9.2.0"
|