@theholocron/docs-theme 1.2.0 → 1.2.1

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/dist/loader.mjs +12 -4
  2. package/package.json +1 -1
package/dist/loader.mjs CHANGED
@@ -20,10 +20,18 @@ function computeId(filePath, baseDir, slugPrefix) {
20
20
  return slugPrefix || "index";
21
21
  }
22
22
  function resolvePackageContentDir(packageName, root) {
23
- let dir = dirname(createRequire(root).resolve(packageName));
24
- while (dir !== dirname(dir)) {
25
- if (existsSync(join(dir, "package.json"))) return join(dir, "content");
26
- dir = dirname(dir);
23
+ const req = createRequire(root);
24
+ try {
25
+ let dir = dirname(req.resolve(packageName));
26
+ while (dir !== dirname(dir)) {
27
+ if (existsSync(join(dir, "package.json"))) return join(dir, "content");
28
+ dir = dirname(dir);
29
+ }
30
+ } catch {}
31
+ const parts = packageName.startsWith("@") ? packageName.split("/", 2) : [packageName];
32
+ for (const searchPath of req.resolve.paths(packageName) ?? []) {
33
+ const candidate = join(searchPath, ...parts);
34
+ if (existsSync(join(candidate, "package.json"))) return join(candidate, "content");
27
35
  }
28
36
  throw new Error(`Could not resolve content directory for ${packageName}`);
29
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/docs-theme",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Starlight plugin providing the shared docs theme.",
5
5
  "keywords": [
6
6
  "astro",