@nera-static/core 4.16.0 → 4.16.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 +2 -0
- package/package.json +2 -2
- package/src/render.js +12 -2
package/README.md
CHANGED
|
@@ -54,6 +54,8 @@ Two things that are easy to miss:
|
|
|
54
54
|
|
|
55
55
|
The package is ESM (`"type": "module"`), requires **Node 20.19 or later** (Node 21 excluded), and exposes a barrel at the root plus per-module subpath exports.
|
|
56
56
|
|
|
57
|
+
On Node 20, and on Node 22 before 22.22.2, `npm install` prints `npm warn EBADENGINE` for `nopt` and `abbrev`. They come with `js-beautify` 2, which formats the HTML, and only its command-line tool uses them, never core, so the warning is harmless and every page renders the same.
|
|
58
|
+
|
|
57
59
|
```js
|
|
58
60
|
import { run } from '@nera-static/core'
|
|
59
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nera-static/core",
|
|
3
|
-
"version": "4.16.
|
|
3
|
+
"version": "4.16.2",
|
|
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": {
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"dotenv": "^18.0.4",
|
|
65
65
|
"fs-readdir-recursive": "^1.1.0",
|
|
66
|
+
"js-beautify": "^2.0.3",
|
|
66
67
|
"markdown-it": "^15.0.0",
|
|
67
|
-
"pretty": "^2.0.0",
|
|
68
68
|
"pug": "^3.0.2",
|
|
69
69
|
"rimraf": "^6.0.1",
|
|
70
70
|
"semver": "^7.8.5",
|
package/src/render.js
CHANGED
|
@@ -3,7 +3,7 @@ import fssync from 'fs'
|
|
|
3
3
|
import path from 'path'
|
|
4
4
|
import { createHash } from 'crypto'
|
|
5
5
|
import pug from 'pug'
|
|
6
|
-
import
|
|
6
|
+
import beautify from 'js-beautify'
|
|
7
7
|
import { rimraf } from 'rimraf'
|
|
8
8
|
import dotenv from 'dotenv'
|
|
9
9
|
import { makeLayeredResolver, resolveEntry } from './resolve.js'
|
|
@@ -14,6 +14,16 @@ dotenv.config({ quiet: true })
|
|
|
14
14
|
|
|
15
15
|
const SUCCESS_COLOR = '\x1b[32m%s\x1b[0m'
|
|
16
16
|
|
|
17
|
+
// The defaults of the `pretty` package, which core used until 4.16.0: calling
|
|
18
|
+
// js-beautify 2 directly keeps the output and drops the deprecated `glob@10`
|
|
19
|
+
// that `pretty` pulled in through js-beautify 1.
|
|
20
|
+
const HTML_FORMAT = {
|
|
21
|
+
unformatted: ['code', 'pre', 'em', 'strong', 'span'],
|
|
22
|
+
indent_inner_html: true,
|
|
23
|
+
indent_char: ' ',
|
|
24
|
+
indent_size: 2,
|
|
25
|
+
}
|
|
26
|
+
|
|
17
27
|
// --- Base-path URL rewriting (config `base_path` → `app.basePath`) ------------
|
|
18
28
|
//
|
|
19
29
|
// A site served from a subdirectory (e.g. GitHub *project* Pages under
|
|
@@ -512,7 +522,7 @@ export const createHtmlFiles = async (
|
|
|
512
522
|
)
|
|
513
523
|
|
|
514
524
|
await fs.mkdir(path.dirname(htmlPath), { recursive: true })
|
|
515
|
-
await fs.writeFile(htmlPath,
|
|
525
|
+
await fs.writeFile(htmlPath, beautify.html(html, HTML_FORMAT), 'utf-8')
|
|
516
526
|
|
|
517
527
|
// Name the file actually written, as its path under `public/`
|
|
518
528
|
// (`/de/index.html`), so every page gets a distinct line.
|