@nera-static/core 4.16.4 โ 4.17.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 +2 -2
- package/package.json +2 -2
- package/src/index.js +2 -2
- package/src/render.js +15 -4
package/README.md
CHANGED
|
@@ -52,9 +52,9 @@ Two things that are easy to miss:
|
|
|
52
52
|
|
|
53
53
|
## ๐ฆ Public API
|
|
54
54
|
|
|
55
|
-
The package is ESM (`"type": "module"`), requires **Node
|
|
55
|
+
The package is ESM (`"type": "module"`), requires **Node 22.12 or later**, and exposes a barrel at the root plus per-module subpath exports.
|
|
56
56
|
|
|
57
|
-
On Node
|
|
57
|
+
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
58
|
|
|
59
59
|
```js
|
|
60
60
|
import { run } from '@nera-static/core'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nera-static/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.17.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": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"author": "Michael Becker <micha.becker79@gmail.com> (https://github.com/seebaermichi)",
|
|
51
51
|
"license": "MIT",
|
|
52
52
|
"engines": {
|
|
53
|
-
"node": "
|
|
53
|
+
"node": ">=22.12.0"
|
|
54
54
|
},
|
|
55
55
|
"repository": {
|
|
56
56
|
"type": "git",
|
package/src/index.js
CHANGED
|
@@ -67,13 +67,13 @@ const run = async (settings = defaultSettings) => {
|
|
|
67
67
|
// the site's own .neraignore from the site root ('.'), so it keeps filtering
|
|
68
68
|
// the site's assets even though they now live under `theme/assets`.
|
|
69
69
|
if (theme) {
|
|
70
|
-
await copyFolder(theme.assetsRoot, dist, null)
|
|
70
|
+
await copyFolder(theme.assetsRoot, dist, null, 'theme assets')
|
|
71
71
|
}
|
|
72
72
|
// Plugin assets (`getAssets`) sit between the two: they override the
|
|
73
73
|
// theme and the site overrides them. Unfiltered like the theme pass โ the
|
|
74
74
|
// payload is plugin-controlled.
|
|
75
75
|
await copyPluginAssets(data.assets, dist)
|
|
76
|
-
await copyFolder(assets, dist, '.')
|
|
76
|
+
await copyFolder(assets, dist, '.', 'site assets')
|
|
77
77
|
|
|
78
78
|
// Subdirectory deploys: prefix root-absolute URLs inside copied assets that
|
|
79
79
|
// the HTML rewrite can't reach (CSS `url(/โฆ)`, the web app manifest). Runs
|
package/src/render.js
CHANGED
|
@@ -395,7 +395,15 @@ const copyPreserving = async (from, to) => {
|
|
|
395
395
|
// list keeps filtering its assets after they move under `theme/`, ยง2d)
|
|
396
396
|
// - null โ skip ignore entirely, as the theme pass does: a theme package's
|
|
397
397
|
// payload is author-controlled (`files:`), so nobody's `.neraignore` filters it
|
|
398
|
-
|
|
398
|
+
// `label` names the source in the build log ("Theme assets copied", "No site
|
|
399
|
+
// assets found"), so the theme, plugin and site passes are told apart. Omitted,
|
|
400
|
+
// the log keeps the unlabelled "Assets copied" / "No Assets found".
|
|
401
|
+
export const copyFolder = async (
|
|
402
|
+
sourceFolder,
|
|
403
|
+
targetFolder,
|
|
404
|
+
ignoreBase,
|
|
405
|
+
label = 'Assets'
|
|
406
|
+
) => {
|
|
399
407
|
if (fssync.existsSync(sourceFolder)) {
|
|
400
408
|
const base =
|
|
401
409
|
ignoreBase === undefined ? path.dirname(sourceFolder) : ignoreBase
|
|
@@ -409,12 +417,15 @@ export const copyFolder = async (sourceFolder, targetFolder, ignoreBase) => {
|
|
|
409
417
|
path.join(targetFolder, path.relative(sourceFolder, file))
|
|
410
418
|
)
|
|
411
419
|
}
|
|
412
|
-
console.log(
|
|
420
|
+
console.log(
|
|
421
|
+
SUCCESS_COLOR,
|
|
422
|
+
`${label.charAt(0).toUpperCase()}${label.slice(1)} copied`
|
|
423
|
+
)
|
|
413
424
|
} catch (err) {
|
|
414
425
|
console.error('Copy failed:', err)
|
|
415
426
|
}
|
|
416
427
|
} else {
|
|
417
|
-
console.log(SUCCESS_COLOR,
|
|
428
|
+
console.log(SUCCESS_COLOR, `No ${label} found`)
|
|
418
429
|
}
|
|
419
430
|
}
|
|
420
431
|
|
|
@@ -438,7 +449,7 @@ export const copyPluginAssets = async (assets = [], targetFolder) => {
|
|
|
438
449
|
}
|
|
439
450
|
|
|
440
451
|
if (stat.isDirectory()) {
|
|
441
|
-
await copyFolder(from, target, null)
|
|
452
|
+
await copyFolder(from, target, null, `plugin "${plugin}" assets`)
|
|
442
453
|
} else if (to === '') {
|
|
443
454
|
console.warn(
|
|
444
455
|
`โ ๏ธ Plugin "${plugin}" asset ${from} is a file and needs a file path as "to", skipped`
|