@zeropress/build-core 0.5.1 → 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 +38 -42
- package/package.json +4 -4
- package/src/api/build-site.js +1008 -135
- package/src/assets/asset-processor.js +1 -6
- package/src/index.d.ts +11 -4
- 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 -2
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:
|
|
@@ -54,7 +55,10 @@ import {
|
|
|
54
55
|
- generating special files such as:
|
|
55
56
|
- `sitemap.xml`
|
|
56
57
|
- `feed.xml`
|
|
57
|
-
- `robots.txt`
|
|
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,7 +121,10 @@ 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
|
|
122
|
-
- `
|
|
124
|
+
- callers may pass `sitemapStylesheetHref` to add an XML stylesheet processing instruction to generated `sitemap.xml`
|
|
125
|
+
- fallback `robots.txt` is emitted when `generateSpecialFiles` is enabled and `generateRobotsTxt` is not `false`
|
|
126
|
+
- fallback `robots.txt` uses `site.indexing`; `false` emits `Disallow: /`, while missing or `true` emits `Allow: /`
|
|
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
|
|
123
128
|
|
|
124
129
|
### `buildSiteFromThemeDir(input)`
|
|
125
130
|
|
|
@@ -127,8 +132,6 @@ Loads a theme directory from disk and renders it using the same core pipeline.
|
|
|
127
132
|
|
|
128
133
|
This is useful for local tooling that wants filesystem theme loading but still uses the same deterministic core renderer.
|
|
129
134
|
|
|
130
|
-
---
|
|
131
|
-
|
|
132
135
|
## Writers
|
|
133
136
|
|
|
134
137
|
### `MemoryWriter`
|
|
@@ -150,8 +153,6 @@ Best for:
|
|
|
150
153
|
- local output generation
|
|
151
154
|
- CLI workflows
|
|
152
155
|
|
|
153
|
-
---
|
|
154
|
-
|
|
155
156
|
## Input Contracts
|
|
156
157
|
|
|
157
158
|
### Preview Data
|
|
@@ -175,15 +176,18 @@ Theme validation is enforced through:
|
|
|
175
176
|
|
|
176
177
|
`buildSiteFromThemeDir()` is the convenience entry point that loads a theme directory and converts it into the required in-memory `themePackage`.
|
|
177
178
|
|
|
178
|
-
|
|
179
|
+
JavaScript theme assets are emitted as provided. Build-core may hash output filenames, but it does not rewrite or minify JavaScript content.
|
|
180
|
+
|
|
181
|
+
In `preview-data v0.6`, the payload does not carry `routes` arrays or raw HTML fragments such as `categories_html`.
|
|
179
182
|
|
|
180
|
-
Build-core
|
|
183
|
+
Build-core derives:
|
|
181
184
|
|
|
182
185
|
- index/archive/category/tag routes
|
|
183
186
|
- post list HTML blocks
|
|
184
187
|
- pagination HTML
|
|
185
188
|
- taxonomy link HTML
|
|
186
189
|
- formatted `published_at` / `updated_at`
|
|
190
|
+
- datetime formatting from `site.locale`, `site.timezone`, `site.date_style`, and `site.time_style`
|
|
187
191
|
- `reading_time`
|
|
188
192
|
- `comments_enabled`
|
|
189
193
|
|
|
@@ -193,14 +197,21 @@ It also emits a comments allowlist artifact:
|
|
|
193
197
|
|
|
194
198
|
Comment availability is derived from preview-data policy:
|
|
195
199
|
|
|
196
|
-
- `site.
|
|
200
|
+
- `site.disallow_comments`
|
|
197
201
|
- `content.posts[].allow_comments`
|
|
198
202
|
|
|
199
|
-
The canonical `preview-data v0.
|
|
203
|
+
The canonical `preview-data v0.6` site contract uses:
|
|
200
204
|
|
|
205
|
+
- `site.media_base_url`
|
|
206
|
+
- `site.media_delivery_mode`
|
|
201
207
|
- `site.locale`
|
|
202
208
|
- `site.timezone`
|
|
203
|
-
- `site.
|
|
209
|
+
- `site.datetime_display`
|
|
210
|
+
- `site.date_style`
|
|
211
|
+
- `site.time_style`
|
|
212
|
+
- `site.disallow_comments`
|
|
213
|
+
- `site.indexing`
|
|
214
|
+
- `site.expose_generator`
|
|
204
215
|
|
|
205
216
|
Optional route templates behave as rendering capabilities, not guaranteed outputs:
|
|
206
217
|
|
|
@@ -211,14 +222,15 @@ Optional route templates behave as rendering capabilities, not guaranteed output
|
|
|
211
222
|
|
|
212
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.
|
|
213
224
|
|
|
214
|
-
---
|
|
215
|
-
|
|
216
225
|
## Build Options
|
|
217
226
|
|
|
218
227
|
Supported options:
|
|
219
228
|
|
|
220
229
|
- `assetHashing`
|
|
230
|
+
- `favicon`
|
|
231
|
+
- `sitemapStylesheetHref`
|
|
221
232
|
- `generateSpecialFiles`
|
|
233
|
+
- `generateRobotsTxt`
|
|
222
234
|
- `writeManifest`
|
|
223
235
|
|
|
224
236
|
These options apply to both full builds and partial renders where relevant.
|
|
@@ -227,25 +239,9 @@ Defaults:
|
|
|
227
239
|
|
|
228
240
|
- `assetHashing: true`
|
|
229
241
|
- `generateSpecialFiles: true`
|
|
242
|
+
- `generateRobotsTxt: true`
|
|
230
243
|
- `writeManifest: false`
|
|
231
244
|
|
|
232
|
-
---
|
|
233
|
-
|
|
234
|
-
## Requirements
|
|
235
|
-
|
|
236
|
-
- Node.js >= 18.18.0
|
|
237
|
-
- ESM only
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
|
|
241
|
-
## Related
|
|
242
|
-
|
|
243
|
-
- [@zeropress/preview-data-validator](https://www.npmjs.com/package/@zeropress/preview-data-validator)
|
|
244
|
-
- [@zeropress/theme-validator](https://www.npmjs.com/package/@zeropress/theme-validator)
|
|
245
|
-
- [@zeropress/theme](https://www.npmjs.com/package/@zeropress/theme)
|
|
246
|
-
|
|
247
|
-
---
|
|
248
|
-
|
|
249
245
|
## License
|
|
250
246
|
|
|
251
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",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"node": ">=18.18.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@zeropress/slug-policy": "
|
|
37
|
-
"@zeropress/preview-data-validator": "0.
|
|
38
|
-
"@zeropress/theme-validator": "0.
|
|
36
|
+
"@zeropress/slug-policy": "0.1.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"
|