@nera-static/core 4.16.2 → 4.16.3

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/theme.js +14 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nera-static/core",
3
- "version": "4.16.2",
3
+ "version": "4.16.3",
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": {
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "repository": {
56
56
  "type": "git",
57
- "url": "https://github.com/seebaermichi/nera"
57
+ "url": "git+https://github.com/seebaermichi/nera.git"
58
58
  },
59
59
  "bugs": {
60
60
  "url": "https://github.com/seebaermichi/nera/issues"
package/src/theme.js CHANGED
@@ -274,12 +274,21 @@ function checkPluginCompatibility(theme, themePkg, cwd) {
274
274
  // The installed version of a dependency, resolved from the SITE (cwd) exactly
275
275
  // like resolvePackageRoot — the plugins are the site's dependencies, not the
276
276
  // generator's. Returns null when the package is not installed or unreadable.
277
+ //
278
+ // It walks the node_modules folders Node would search instead of resolving
279
+ // `<name>/package.json`: a package whose `exports` omits `./package.json` —
280
+ // every published plugin, whose `exports` lists only `.` — makes that resolve
281
+ // throw ERR_PACKAGE_PATH_NOT_EXPORTED, which silenced this check.
277
282
  function installedVersion(name, cwd) {
278
283
  const requireFromSite = createRequire(path.join(cwd, 'package.json'))
279
- try {
280
- const pkgPath = requireFromSite.resolve(`${name}/package.json`)
281
- return JSON.parse(fs.readFileSync(pkgPath, 'utf-8')).version || null
282
- } catch {
283
- return null
284
+ for (const dir of requireFromSite.resolve.paths(name) || []) {
285
+ const pkgPath = path.join(dir, name, 'package.json')
286
+ if (!fs.existsSync(pkgPath)) continue
287
+ try {
288
+ return JSON.parse(fs.readFileSync(pkgPath, 'utf-8')).version || null
289
+ } catch {
290
+ return null
291
+ }
284
292
  }
293
+ return null
285
294
  }