@theholocron/docs-theme 1.2.1 → 1.3.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.
@@ -0,0 +1,10 @@
1
+ //#region src/content.d.ts
2
+ interface DocsConfig {
3
+ slug: string;
4
+ name: string;
5
+ }
6
+ declare function createDocsCollections(docsConfig: DocsConfig, importMetaUrl: string): {
7
+ docs: any;
8
+ };
9
+ //#endregion
10
+ export { DocsConfig, createDocsCollections };
@@ -0,0 +1,16 @@
1
+ import { createDocsLoader } from "./loader.mjs";
2
+ import { fileURLToPath } from "node:url";
3
+ import { docsSchema } from "@astrojs/starlight/schema";
4
+ import { defineCollection } from "astro:content";
5
+ //#region src/content.ts
6
+ function createDocsCollections(docsConfig, importMetaUrl) {
7
+ return { docs: defineCollection({
8
+ loader: createDocsLoader([{
9
+ dir: fileURLToPath(new URL(`../../packages/${docsConfig.slug}-docs/content`, importMetaUrl)),
10
+ slug: ""
11
+ }]),
12
+ schema: docsSchema()
13
+ }) };
14
+ }
15
+ //#endregion
16
+ export { createDocsCollections };
package/dist/loader.mjs CHANGED
@@ -72,7 +72,7 @@ function createDocsLoader(sources) {
72
72
  const raw = await readFile(absPath, "utf-8");
73
73
  const { data: frontmatter, content: body } = matter(raw);
74
74
  const digest = ctx.generateDigest(raw);
75
- const filePath = relative(siteRoot, absPath);
75
+ const filePath = absPath.includes("node_modules") ? id + extname(absPath) : relative(siteRoot, absPath);
76
76
  const data = await ctx.parseData({
77
77
  id,
78
78
  data: frontmatter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/docs-theme",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Starlight plugin providing the shared docs theme.",
5
5
  "keywords": [
6
6
  "astro",
@@ -30,6 +30,11 @@
30
30
  "import": "./dist/index.mjs",
31
31
  "default": "./dist/index.mjs"
32
32
  },
33
+ "./content": {
34
+ "types": "./dist/content.d.mts",
35
+ "import": "./dist/content.mjs",
36
+ "default": "./dist/content.mjs"
37
+ },
33
38
  "./loader": {
34
39
  "types": "./dist/loader.d.mts",
35
40
  "import": "./dist/loader.mjs",