@nera-static/core 4.17.0 → 4.18.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/README.md +3 -1
- package/package.json +1 -1
- package/src/site-model.js +6 -1
package/README.md
CHANGED
|
@@ -82,9 +82,11 @@ Subpath exports (`@nera-static/core/resolve`, `/site-model`, `/core`, `/render`,
|
|
|
82
82
|
import { resolveSiteModel } from '@nera-static/core/site-model'
|
|
83
83
|
|
|
84
84
|
const model = resolveSiteModel({ cwd: '/path/to/site' })
|
|
85
|
-
// → { folders, theme, roots, appConfigError, themeError, ... } (never throws)
|
|
85
|
+
// → { folders, theme, roots, appConfigError, appConfigErrorLine, themeError, ... } (never throws)
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
A malformed `config/app.yaml` comes back as `appConfigError` (the parser's message) and `appConfigErrorLine` (its 1-based line, core ≥ 4.18.0; `null` when the file is missing or parses, or the parser gives no position).
|
|
89
|
+
|
|
88
90
|
---
|
|
89
91
|
|
|
90
92
|
## 🔌 Plugin contract
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nera-static/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.18.0",
|
|
4
4
|
"description": "The Nera static site generator engine — the build pipeline and the layered theme/view resolver, importable by the Nera CLI, @nera-static/validate and tooling",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"exports": {
|
package/src/site-model.js
CHANGED
|
@@ -16,7 +16,9 @@ import { resolveTheme } from './theme.js'
|
|
|
16
16
|
// pages, never warns, and never throws on a missing or broken theme. A theme
|
|
17
17
|
// that cannot be resolved (unset package, missing `views/`) is returned as
|
|
18
18
|
// `themeError` and a malformed app.yaml as `appConfigError`, for the caller to
|
|
19
|
-
// surface as a validation finding rather than aborting.
|
|
19
|
+
// surface as a validation finding rather than aborting. `appConfigErrorLine`
|
|
20
|
+
// carries the parser's 1-based line for that error, or `null` when there is no
|
|
21
|
+
// error or the parser gives no position.
|
|
20
22
|
export function resolveSiteModel({
|
|
21
23
|
cwd = process.cwd(),
|
|
22
24
|
settings = defaultSettings,
|
|
@@ -27,11 +29,13 @@ export function resolveSiteModel({
|
|
|
27
29
|
|
|
28
30
|
let appConfig = {}
|
|
29
31
|
let appConfigError = null
|
|
32
|
+
let appConfigErrorLine = null
|
|
30
33
|
if (fs.existsSync(appConfigPath)) {
|
|
31
34
|
try {
|
|
32
35
|
appConfig = yaml.parse(fs.readFileSync(appConfigPath, 'utf-8')) || {}
|
|
33
36
|
} catch (err) {
|
|
34
37
|
appConfigError = err.message
|
|
38
|
+
appConfigErrorLine = err.linePos?.[0]?.line ?? null
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -55,6 +59,7 @@ export function resolveSiteModel({
|
|
|
55
59
|
cwd,
|
|
56
60
|
appConfig,
|
|
57
61
|
appConfigError,
|
|
62
|
+
appConfigErrorLine,
|
|
58
63
|
folders,
|
|
59
64
|
viewsRoot,
|
|
60
65
|
theme,
|