@zeropress/build-core 0.5.2 → 0.6.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 +30 -40
- package/package.json +3 -3
- package/src/api/build-site.js +708 -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,9 @@ import {
|
|
|
55
56
|
- `sitemap.xml`
|
|
56
57
|
- `feed.xml`
|
|
57
58
|
- fallback `robots.txt`
|
|
59
|
+
- `/_zeropress/comment-policy.json`
|
|
60
|
+
- `/_zeropress/search.json`
|
|
61
|
+
- `/_zeropress/search.js`
|
|
58
62
|
- writing outputs through a pluggable writer
|
|
59
63
|
|
|
60
64
|
It does not:
|
|
@@ -64,8 +68,6 @@ It does not:
|
|
|
64
68
|
- watch files, run a dev server, or perform deployment
|
|
65
69
|
- talk to queues, KV, Durable Objects, R2, GitHub, or other infrastructure directly
|
|
66
70
|
|
|
67
|
-
---
|
|
68
|
-
|
|
69
71
|
## Core APIs
|
|
70
72
|
|
|
71
73
|
### `buildSite(input)`
|
|
@@ -119,6 +121,7 @@ Notes:
|
|
|
119
121
|
- `previewData` must already satisfy the canonical preview-data contract
|
|
120
122
|
- `themePackage` must already be a validated in-memory theme package
|
|
121
123
|
- `sitemap.xml` and `feed.xml` are emitted only when `site.url` is a non-empty canonical URL
|
|
124
|
+
- callers may pass `sitemapStylesheetHref` to add an XML stylesheet processing instruction to generated `sitemap.xml`
|
|
122
125
|
- fallback `robots.txt` is emitted when `generateSpecialFiles` is enabled and `generateRobotsTxt` is not `false`
|
|
123
126
|
- fallback `robots.txt` uses `site.indexing`; `false` emits `Disallow: /`, while missing or `true` emits `Allow: /`
|
|
124
127
|
- 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 +132,6 @@ Loads a theme directory from disk and renders it using the same core pipeline.
|
|
|
129
132
|
|
|
130
133
|
This is useful for local tooling that wants filesystem theme loading but still uses the same deterministic core renderer.
|
|
131
134
|
|
|
132
|
-
---
|
|
133
|
-
|
|
134
135
|
## Writers
|
|
135
136
|
|
|
136
137
|
### `MemoryWriter`
|
|
@@ -152,8 +153,6 @@ Best for:
|
|
|
152
153
|
- local output generation
|
|
153
154
|
- CLI workflows
|
|
154
155
|
|
|
155
|
-
---
|
|
156
|
-
|
|
157
156
|
## Input Contracts
|
|
158
157
|
|
|
159
158
|
### Preview Data
|
|
@@ -179,15 +178,16 @@ Theme validation is enforced through:
|
|
|
179
178
|
|
|
180
179
|
JavaScript theme assets are emitted as provided. Build-core may hash output filenames, but it does not rewrite or minify JavaScript content.
|
|
181
180
|
|
|
182
|
-
|
|
181
|
+
In `preview-data v0.6`, the payload does not carry `routes` arrays or raw HTML fragments such as `categories_html`.
|
|
183
182
|
|
|
184
|
-
Build-core
|
|
183
|
+
Build-core derives:
|
|
185
184
|
|
|
186
185
|
- index/archive/category/tag routes
|
|
187
186
|
- post list HTML blocks
|
|
188
187
|
- pagination HTML
|
|
189
188
|
- taxonomy link HTML
|
|
190
189
|
- formatted `published_at` / `updated_at`
|
|
190
|
+
- datetime formatting from `site.locale`, `site.timezone`, `site.date_style`, and `site.time_style`
|
|
191
191
|
- `reading_time`
|
|
192
192
|
- `comments_enabled`
|
|
193
193
|
|
|
@@ -197,14 +197,21 @@ It also emits a comments allowlist artifact:
|
|
|
197
197
|
|
|
198
198
|
Comment availability is derived from preview-data policy:
|
|
199
199
|
|
|
200
|
-
- `site.
|
|
200
|
+
- `site.disallow_comments`
|
|
201
201
|
- `content.posts[].allow_comments`
|
|
202
202
|
|
|
203
|
-
The canonical `preview-data v0.
|
|
203
|
+
The canonical `preview-data v0.6` site contract uses:
|
|
204
204
|
|
|
205
|
+
- `site.media_base_url`
|
|
206
|
+
- `site.media_delivery_mode`
|
|
205
207
|
- `site.locale`
|
|
206
208
|
- `site.timezone`
|
|
207
|
-
- `site.
|
|
209
|
+
- `site.datetime_display`
|
|
210
|
+
- `site.date_style`
|
|
211
|
+
- `site.time_style`
|
|
212
|
+
- `site.disallow_comments`
|
|
213
|
+
- `site.indexing`
|
|
214
|
+
- `site.expose_generator`
|
|
208
215
|
|
|
209
216
|
Optional route templates behave as rendering capabilities, not guaranteed outputs:
|
|
210
217
|
|
|
@@ -215,13 +222,13 @@ Optional route templates behave as rendering capabilities, not guaranteed output
|
|
|
215
222
|
|
|
216
223
|
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
224
|
|
|
218
|
-
---
|
|
219
|
-
|
|
220
225
|
## Build Options
|
|
221
226
|
|
|
222
227
|
Supported options:
|
|
223
228
|
|
|
224
229
|
- `assetHashing`
|
|
230
|
+
- `favicon`
|
|
231
|
+
- `sitemapStylesheetHref`
|
|
225
232
|
- `generateSpecialFiles`
|
|
226
233
|
- `generateRobotsTxt`
|
|
227
234
|
- `writeManifest`
|
|
@@ -235,23 +242,6 @@ Defaults:
|
|
|
235
242
|
- `generateRobotsTxt: true`
|
|
236
243
|
- `writeManifest: false`
|
|
237
244
|
|
|
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
245
|
## License
|
|
256
246
|
|
|
257
247
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeropress/build-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
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.1",
|
|
38
|
+
"@zeropress/theme-validator": "0.6.1",
|
|
39
39
|
"highlight.js": "^11.11.1",
|
|
40
40
|
"markdown-it": "^14.1.0",
|
|
41
41
|
"markdown-it-anchor": "^9.2.0"
|