@nera-static/core 4.16.3 โ 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 +19 -7
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
|
@@ -347,10 +347,11 @@ export function ignoreFiles(ignoreList, filePath, sourceRoot) {
|
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
// OS and editor clutter that never belongs in public/, matched against a file's
|
|
350
|
-
// basename. The list cpy (via the `junk` package) skipped by default
|
|
351
|
-
//
|
|
350
|
+
// basename. The list cpy (via the `junk` package) skipped by default, plus the
|
|
351
|
+
// `.gitkeep`/`.keep` markers that keep an empty folder in git (`nera new`
|
|
352
|
+
// ships `theme/assets/.gitkeep`); a marker is never content to serve.
|
|
352
353
|
const JUNK =
|
|
353
|
-
|
|
354
|
+
/^\.gitkeep$|^\.keep$|^npm-debug\.log$|^\..*\.swp$|^\.DS_Store$|^\.AppleDouble$|^\.LSOverride$|^Icon\r$|^\._.*|^\.Spotlight-V100(?:$|\/)|\.Trashes|^__MACOSX$|~$|^Thumbs\.db$|^ehthumbs\.db$|^[Dd]esktop\.ini$|@eaDir$/
|
|
354
355
|
|
|
355
356
|
// Every file under `dir`, dotfiles included, junk excluded. Symlinks are
|
|
356
357
|
// followed like cpy's glob did (a linked directory is walked, a dangling link
|
|
@@ -394,7 +395,15 @@ const copyPreserving = async (from, to) => {
|
|
|
394
395
|
// list keeps filtering its assets after they move under `theme/`, ยง2d)
|
|
395
396
|
// - null โ skip ignore entirely, as the theme pass does: a theme package's
|
|
396
397
|
// payload is author-controlled (`files:`), so nobody's `.neraignore` filters it
|
|
397
|
-
|
|
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
|
+
) => {
|
|
398
407
|
if (fssync.existsSync(sourceFolder)) {
|
|
399
408
|
const base =
|
|
400
409
|
ignoreBase === undefined ? path.dirname(sourceFolder) : ignoreBase
|
|
@@ -408,12 +417,15 @@ export const copyFolder = async (sourceFolder, targetFolder, ignoreBase) => {
|
|
|
408
417
|
path.join(targetFolder, path.relative(sourceFolder, file))
|
|
409
418
|
)
|
|
410
419
|
}
|
|
411
|
-
console.log(
|
|
420
|
+
console.log(
|
|
421
|
+
SUCCESS_COLOR,
|
|
422
|
+
`${label.charAt(0).toUpperCase()}${label.slice(1)} copied`
|
|
423
|
+
)
|
|
412
424
|
} catch (err) {
|
|
413
425
|
console.error('Copy failed:', err)
|
|
414
426
|
}
|
|
415
427
|
} else {
|
|
416
|
-
console.log(SUCCESS_COLOR,
|
|
428
|
+
console.log(SUCCESS_COLOR, `No ${label} found`)
|
|
417
429
|
}
|
|
418
430
|
}
|
|
419
431
|
|
|
@@ -437,7 +449,7 @@ export const copyPluginAssets = async (assets = [], targetFolder) => {
|
|
|
437
449
|
}
|
|
438
450
|
|
|
439
451
|
if (stat.isDirectory()) {
|
|
440
|
-
await copyFolder(from, target, null)
|
|
452
|
+
await copyFolder(from, target, null, `plugin "${plugin}" assets`)
|
|
441
453
|
} else if (to === '') {
|
|
442
454
|
console.warn(
|
|
443
455
|
`โ ๏ธ Plugin "${plugin}" asset ${from} is a file and needs a file path as "to", skipped`
|