@lexibase/rdx-core 1.0.0-beta.3 → 1.0.0-beta.5
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.
|
@@ -22,6 +22,16 @@ function text(value, field, allowEmpty = false) {
|
|
|
22
22
|
}
|
|
23
23
|
return value;
|
|
24
24
|
}
|
|
25
|
+
function component(value, field) {
|
|
26
|
+
if (typeof value !== "function" && !(record(value) && [
|
|
27
|
+
/* @__PURE__ */ Symbol.for("react.memo"),
|
|
28
|
+
/* @__PURE__ */ Symbol.for("react.forward_ref"),
|
|
29
|
+
/* @__PURE__ */ Symbol.for("react.lazy")
|
|
30
|
+
].includes(value.$$typeof)))
|
|
31
|
+
throw new RdxConfigError(
|
|
32
|
+
`${field} must be a React component, not JSX or a file path.`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
25
35
|
function keys(value, allowed, field) {
|
|
26
36
|
for (const key of Object.keys(value)) {
|
|
27
37
|
if (!allowed.includes(key))
|
|
@@ -62,7 +72,13 @@ function resolveConfig(input) {
|
|
|
62
72
|
if (config.docsDir !== void 0) text(config.docsDir, "docsDir");
|
|
63
73
|
if (config.homepage !== void 0) {
|
|
64
74
|
const homepage = object(config.homepage, "homepage");
|
|
65
|
-
keys(
|
|
75
|
+
keys(
|
|
76
|
+
homepage,
|
|
77
|
+
["enabled", "component", "title", "description", "buttons"],
|
|
78
|
+
"homepage."
|
|
79
|
+
);
|
|
80
|
+
if (homepage.component !== void 0)
|
|
81
|
+
component(homepage.component, "homepage.component");
|
|
66
82
|
if (homepage.enabled !== void 0 && typeof homepage.enabled !== "boolean")
|
|
67
83
|
throw new RdxConfigError("homepage.enabled must be a boolean.");
|
|
68
84
|
if (homepage.title !== void 0) text(homepage.title, "homepage.title");
|
|
@@ -100,11 +116,16 @@ function resolveConfig(input) {
|
|
|
100
116
|
}
|
|
101
117
|
if (config.navbar !== void 0) {
|
|
102
118
|
const navbar = object(config.navbar, "navbar");
|
|
103
|
-
keys(navbar, ["title", "actions"], "navbar.");
|
|
119
|
+
keys(navbar, ["title", "logo", "actions"], "navbar.");
|
|
120
|
+
if (navbar.logo !== void 0) component(navbar.logo, "navbar.logo");
|
|
104
121
|
if (navbar.title !== void 0) text(navbar.title, "navbar.title", true);
|
|
105
122
|
if (navbar.actions !== void 0) {
|
|
106
123
|
const actions = object(navbar.actions, "navbar.actions");
|
|
107
|
-
keys(actions, ["github"], "navbar.actions.");
|
|
124
|
+
keys(actions, ["github", "showToggleMode"], "navbar.actions.");
|
|
125
|
+
if (actions.showToggleMode !== void 0 && typeof actions.showToggleMode !== "boolean")
|
|
126
|
+
throw new RdxConfigError(
|
|
127
|
+
"navbar.actions.showToggleMode must be a boolean."
|
|
128
|
+
);
|
|
108
129
|
if (actions.github !== void 0) {
|
|
109
130
|
const github = object(actions.github, "navbar.actions.github");
|
|
110
131
|
keys(github, ["visible", "url"], "navbar.actions.github.");
|
|
@@ -113,12 +134,12 @@ function resolveConfig(input) {
|
|
|
113
134
|
"navbar.actions.github.visible must be a boolean."
|
|
114
135
|
);
|
|
115
136
|
const url = text(github.url, "navbar.actions.github.url");
|
|
116
|
-
if (!/^https?:\/\//i.test(url))
|
|
137
|
+
if (url !== "#" && !/^https?:\/\//i.test(url))
|
|
117
138
|
throw new RdxConfigError(
|
|
118
|
-
|
|
139
|
+
'navbar.actions.github.url must use http or https, or "#" as a placeholder.'
|
|
119
140
|
);
|
|
120
141
|
try {
|
|
121
|
-
new URL(url);
|
|
142
|
+
if (url !== "#") new URL(url);
|
|
122
143
|
} catch {
|
|
123
144
|
throw new RdxConfigError(
|
|
124
145
|
"navbar.actions.github.url must be a valid URL."
|
package/dist/config/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexibase/rdx-core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.5",
|
|
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.
|
|
37
|
+
"@lexibase/rdx-types": "1.0.0-beta.4"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^22.15.3",
|