@lexibase/rdx-core 1.0.0-beta.2 → 1.0.0-beta.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.
@@ -43,7 +43,16 @@ function resolveConfig(input) {
43
43
  const config = object(input, "default export");
44
44
  keys(
45
45
  config,
46
- ["title", "description", "lang", "docsDir", "theme", "navbar", "plugins"],
46
+ [
47
+ "title",
48
+ "description",
49
+ "lang",
50
+ "docsDir",
51
+ "theme",
52
+ "navbar",
53
+ "plugins",
54
+ "homepage"
55
+ ],
47
56
  ""
48
57
  );
49
58
  text(config.title, "title");
@@ -51,6 +60,35 @@ function resolveConfig(input) {
51
60
  text(config.description, "description", true);
52
61
  if (config.lang !== void 0) text(config.lang, "lang");
53
62
  if (config.docsDir !== void 0) text(config.docsDir, "docsDir");
63
+ if (config.homepage !== void 0) {
64
+ const homepage = object(config.homepage, "homepage");
65
+ keys(homepage, ["enabled", "title", "description", "buttons"], "homepage.");
66
+ if (homepage.enabled !== void 0 && typeof homepage.enabled !== "boolean")
67
+ throw new RdxConfigError("homepage.enabled must be a boolean.");
68
+ if (homepage.title !== void 0) text(homepage.title, "homepage.title");
69
+ if (homepage.description !== void 0)
70
+ text(homepage.description, "homepage.description", true);
71
+ if (homepage.buttons !== void 0) {
72
+ if (!Array.isArray(homepage.buttons))
73
+ throw new RdxConfigError("homepage.buttons must be an array.");
74
+ for (const [index, value] of homepage.buttons.entries()) {
75
+ const field = `homepage.buttons[${index}]`;
76
+ const button = object(value, field);
77
+ keys(button, ["label", "href"], `${field}.`);
78
+ text(button.label, `${field}.label`);
79
+ const href = text(button.href, `${field}.href`);
80
+ if (/[\s\\]/.test(href) || !/^\/(?!\/)/.test(href) && !/^https?:\/\//i.test(href))
81
+ throw new RdxConfigError(
82
+ `${field}.href must be a root-relative path or http(s) URL.`
83
+ );
84
+ try {
85
+ new URL(href, "https://rdx.local");
86
+ } catch {
87
+ throw new RdxConfigError(`${field}.href must be a valid URL.`);
88
+ }
89
+ }
90
+ }
91
+ }
54
92
  if (config.theme !== void 0) {
55
93
  const theme = object(config.theme, "theme");
56
94
  keys(theme, ["defaultTheme"], "theme.");
@@ -4,7 +4,7 @@ import {
4
4
  defineConfig,
5
5
  resolveConfig,
6
6
  resolveProjectPath
7
- } from "../chunk-WPEYN7KN.js";
7
+ } from "../chunk-LEDAZNXX.js";
8
8
  export {
9
9
  RdxConfigError,
10
10
  createRdxProject,
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  defineConfig,
5
5
  resolveConfig,
6
6
  resolveProjectPath
7
- } from "./chunk-WPEYN7KN.js";
7
+ } from "./chunk-LEDAZNXX.js";
8
8
 
9
9
  // src/content/index.ts
10
10
  import fs from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lexibase/rdx-core",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Content indexing and document utilities for RDX documentation projects.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,7 +34,7 @@
34
34
  "homepage": "https://github.com/lexibase/rdx#readme",
35
35
  "dependencies": {
36
36
  "gray-matter": "^4.0.3",
37
- "@lexibase/rdx-types": "1.0.0-beta.2"
37
+ "@lexibase/rdx-types": "1.0.0-beta.3"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^22.15.3",