@lexibase/rdx-core 2.1.0 → 2.2.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.
- package/dist/check/index.js +44 -21
- package/dist/{chunk-LCBSNAUH.js → chunk-36CTLWNI.js} +11 -3
- package/dist/{chunk-WDWRIRH2.js → chunk-GYLAW7YX.js} +15 -15
- package/dist/{chunk-CGOXC3S6.js → chunk-M32EH5KP.js} +71 -15
- package/dist/config/index.js +1 -1
- package/dist/{document-links-Dr4JVYuN.d.ts → document-links-B9zsPsqx.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/mdx/index.d.ts +1 -1
- package/dist/mdx/index.js +1 -1
- package/dist/search/index.d.ts +2 -0
- package/dist/search/index.js +3 -1
- package/package.json +2 -2
package/dist/check/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
getDocsIndex,
|
|
3
3
|
getSourceOptions,
|
|
4
4
|
parseStaticDocument
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-M32EH5KP.js";
|
|
6
6
|
import {
|
|
7
7
|
getContentSources,
|
|
8
8
|
isFallbackPage
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
RdxDocumentLinkError,
|
|
12
12
|
createDocumentLinkResolver
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-36CTLWNI.js";
|
|
14
14
|
import {
|
|
15
15
|
headingText
|
|
16
16
|
} from "../chunk-FPBRKD4M.js";
|
|
@@ -27,6 +27,7 @@ import remarkMdx from "remark-mdx";
|
|
|
27
27
|
import remarkParse from "remark-parse";
|
|
28
28
|
import { unified } from "unified";
|
|
29
29
|
var parser = unified().use(remarkParse).use(remarkGfm).use(remarkMdx).use(remarkDocumentationComponents);
|
|
30
|
+
var markdownParser = unified().use(remarkParse).use(remarkGfm).use(remarkDocumentationComponents);
|
|
30
31
|
var sourceRoute = (source) => [source.basePath ?? "/docs", source.routePrefix].filter(Boolean).join("/");
|
|
31
32
|
var documentRoute = (source, page) => `${sourceRoute(source)}/${page.slug.split("/").map(encodeURIComponent).join("/")}`;
|
|
32
33
|
var identifier = (value) => value.trim().replace(/\s+/g, " ").toLowerCase();
|
|
@@ -34,8 +35,11 @@ function walk(node, visit) {
|
|
|
34
35
|
visit(node);
|
|
35
36
|
for (const child of node.children ?? []) walk(child, visit);
|
|
36
37
|
}
|
|
37
|
-
function parse(content) {
|
|
38
|
-
const
|
|
38
|
+
function parse(content, markdown) {
|
|
39
|
+
const processor = markdown ? markdownParser : parser;
|
|
40
|
+
const tree = processor.runSync(processor.parse(content), {
|
|
41
|
+
value: content
|
|
42
|
+
});
|
|
39
43
|
const anchors = /* @__PURE__ */ new Set();
|
|
40
44
|
const references = [];
|
|
41
45
|
const definitions = /* @__PURE__ */ new Map();
|
|
@@ -104,6 +108,37 @@ function checkDocumentation(project, options = {}) {
|
|
|
104
108
|
message: value.message ?? String(error)
|
|
105
109
|
});
|
|
106
110
|
}
|
|
111
|
+
function publicFileExists(pathname) {
|
|
112
|
+
if (pathname.includes("\\") || pathname.includes("\0"))
|
|
113
|
+
throw new Error("Use a valid URL with forward slashes.");
|
|
114
|
+
const publicRoot = path.resolve(project.rootDir, "public");
|
|
115
|
+
const asset = path.resolve(publicRoot, `.${pathname}`);
|
|
116
|
+
const relative = path.relative(publicRoot, asset);
|
|
117
|
+
if (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
|
|
118
|
+
throw new Error("The destination escapes public/.");
|
|
119
|
+
let exists = false;
|
|
120
|
+
try {
|
|
121
|
+
exists = fs.statSync(asset).isFile();
|
|
122
|
+
} catch {
|
|
123
|
+
}
|
|
124
|
+
return exists;
|
|
125
|
+
}
|
|
126
|
+
const logo = project.config.navbar?.logo;
|
|
127
|
+
if (typeof logo === "string") {
|
|
128
|
+
try {
|
|
129
|
+
const pathname = decodeURIComponent(new URL(logo, origin).pathname);
|
|
130
|
+
if (!publicFileExists(pathname))
|
|
131
|
+
throw new Error(`Local file "${pathname}" does not exist in public/.`);
|
|
132
|
+
} catch (error) {
|
|
133
|
+
diagnostics.push({
|
|
134
|
+
file: "rdx.config.ts",
|
|
135
|
+
line: 1,
|
|
136
|
+
column: 1,
|
|
137
|
+
code: "asset",
|
|
138
|
+
message: `navbar.logo "${logo}": ${error instanceof Error ? error.message : String(error)}`
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
107
142
|
const sources = getContentSources(
|
|
108
143
|
project.locale ? { ...project, locale: void 0 } : project
|
|
109
144
|
);
|
|
@@ -141,7 +176,7 @@ function checkDocumentation(project, options = {}) {
|
|
|
141
176
|
line: 1,
|
|
142
177
|
column: 1,
|
|
143
178
|
code: "page",
|
|
144
|
-
message: "Translation has no primary-language counterpart with the same relative
|
|
179
|
+
message: "Translation has no primary-language counterpart with the same relative document path (without the extension)."
|
|
145
180
|
});
|
|
146
181
|
}
|
|
147
182
|
pages = getDocsIndex(getSourceOptions(project, source), (error, file) => {
|
|
@@ -182,7 +217,7 @@ function checkDocumentation(project, options = {}) {
|
|
|
182
217
|
const raw = fs.readFileSync(document.page.sourcePath, "utf8");
|
|
183
218
|
const content = parseStaticDocument(raw).content;
|
|
184
219
|
document.lineOffset = (raw.slice(0, raw.length - content.length).match(/\n/g) ?? []).length;
|
|
185
|
-
document.parsed = parse(content);
|
|
220
|
+
document.parsed = parse(content, document.page.sourcePath.endsWith(".md"));
|
|
186
221
|
} catch (error) {
|
|
187
222
|
syntax(error, document.page.sourcePath, document.lineOffset);
|
|
188
223
|
}
|
|
@@ -232,8 +267,8 @@ function checkDocumentation(project, options = {}) {
|
|
|
232
267
|
continue;
|
|
233
268
|
let target;
|
|
234
269
|
let pathname;
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
270
|
+
const explicitDocument = !reference.image && !/^(?:[a-z][\w+.-]*:|\/|#|\?)/i.test(reference.href) && /\.mdx?(?:[?#]|$)/.test(decodeURIComponent(reference.href));
|
|
271
|
+
if (explicitDocument) {
|
|
237
272
|
const resolved = resolve(reference.href);
|
|
238
273
|
pathname = key(resolved);
|
|
239
274
|
target = coreRoutes.get(pathname);
|
|
@@ -254,19 +289,7 @@ function checkDocumentation(project, options = {}) {
|
|
|
254
289
|
}
|
|
255
290
|
if (!reference.image && roots.has(pathname)) continue;
|
|
256
291
|
code = reference.image || !/^\/(?:[^/]+\/)?docs(?:\/|$)/.test(pathname) ? "asset" : "page";
|
|
257
|
-
if (
|
|
258
|
-
throw new Error("Use a valid URL with forward slashes.");
|
|
259
|
-
const publicRoot = path.resolve(project.rootDir, "public");
|
|
260
|
-
const asset = path.resolve(publicRoot, `.${pathname}`);
|
|
261
|
-
const relative = path.relative(publicRoot, asset);
|
|
262
|
-
if (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
|
|
263
|
-
throw new Error("The destination escapes public/.");
|
|
264
|
-
let exists = false;
|
|
265
|
-
try {
|
|
266
|
-
exists = fs.statSync(asset).isFile();
|
|
267
|
-
} catch {
|
|
268
|
-
}
|
|
269
|
-
if (!exists)
|
|
292
|
+
if (!publicFileExists(pathname))
|
|
270
293
|
throw new Error(
|
|
271
294
|
code === "page" ? `Documentation page "${pathname}" does not exist.` : `Local file "${pathname}" does not exist in public/.`
|
|
272
295
|
);
|
|
@@ -14,7 +14,15 @@ function createDocumentLinkResolver(options) {
|
|
|
14
14
|
const documents = new Map(
|
|
15
15
|
options.documents.flatMap((page) => [
|
|
16
16
|
[path.resolve(page.sourcePath), page.slug],
|
|
17
|
-
...options.virtualPaths ? [
|
|
17
|
+
...options.virtualPaths ? [
|
|
18
|
+
[
|
|
19
|
+
path.resolve(
|
|
20
|
+
root,
|
|
21
|
+
`${page.slug}${path.extname(page.sourcePath)}`
|
|
22
|
+
),
|
|
23
|
+
page.slug
|
|
24
|
+
]
|
|
25
|
+
] : []
|
|
18
26
|
])
|
|
19
27
|
);
|
|
20
28
|
const routeCounts = /* @__PURE__ */ new Map();
|
|
@@ -29,7 +37,7 @@ function createDocumentLinkResolver(options) {
|
|
|
29
37
|
try {
|
|
30
38
|
decoded = decodeURIComponent(pathname);
|
|
31
39
|
} catch {
|
|
32
|
-
if (/\.mdx
|
|
40
|
+
if (/\.mdx?$/i.test(pathname))
|
|
33
41
|
throw new RdxDocumentLinkError(
|
|
34
42
|
current,
|
|
35
43
|
href,
|
|
@@ -37,7 +45,7 @@ function createDocumentLinkResolver(options) {
|
|
|
37
45
|
);
|
|
38
46
|
return href;
|
|
39
47
|
}
|
|
40
|
-
if (
|
|
48
|
+
if (!/\.mdx?$/.test(decoded)) return href;
|
|
41
49
|
const fail = (reason) => {
|
|
42
50
|
throw new RdxDocumentLinkError(current, href, reason);
|
|
43
51
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/config/index.ts
|
|
2
2
|
import path5 from "path";
|
|
3
|
-
import { existsSync } from "fs";
|
|
3
|
+
import { existsSync, readdirSync } from "fs";
|
|
4
4
|
|
|
5
5
|
// src/config/error.ts
|
|
6
6
|
var RdxConfigError = class extends Error {
|
|
@@ -588,7 +588,7 @@ function component(value, field) {
|
|
|
588
588
|
/* @__PURE__ */ Symbol.for("react.lazy")
|
|
589
589
|
].includes(value.$$typeof)))
|
|
590
590
|
throw new RdxConfigError(
|
|
591
|
-
`${field} must be
|
|
591
|
+
`${field} must be an imported React component, not JSX.`
|
|
592
592
|
);
|
|
593
593
|
}
|
|
594
594
|
function keys(value, allowed, field) {
|
|
@@ -677,7 +677,12 @@ function resolveConfig(input) {
|
|
|
677
677
|
if (config.navbar !== void 0) {
|
|
678
678
|
const navbar = object(config.navbar, "navbar");
|
|
679
679
|
keys(navbar, ["title", "logo", "actions"], "navbar.");
|
|
680
|
-
if (navbar.logo
|
|
680
|
+
if (typeof navbar.logo === "string") {
|
|
681
|
+
if (!/^\/(?!\/)/.test(navbar.logo) || /[\s\\\0]/.test(navbar.logo) || new URL(navbar.logo, "https://rdx.invalid").pathname === "/")
|
|
682
|
+
throw new RdxConfigError(
|
|
683
|
+
"navbar.logo must be a root-relative image path from public/, e.g. '/images/logo.png', or an imported React component."
|
|
684
|
+
);
|
|
685
|
+
} else if (navbar.logo !== void 0) component(navbar.logo, "navbar.logo");
|
|
681
686
|
if (navbar.title !== void 0) text(navbar.title, "navbar.title", true);
|
|
682
687
|
if (navbar.actions !== void 0) {
|
|
683
688
|
const actions = object(navbar.actions, "navbar.actions");
|
|
@@ -859,20 +864,15 @@ async function createRdxProject(input, {
|
|
|
859
864
|
`duplicate content source id or route prefix: ${id}.`
|
|
860
865
|
);
|
|
861
866
|
}
|
|
862
|
-
|
|
867
|
+
const liveNames = existsSync(
|
|
863
868
|
/* turbopackIgnore: true */
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
docsRoot,
|
|
867
|
-
prefix
|
|
868
|
-
)
|
|
869
|
-
) || existsSync(
|
|
869
|
+
docsRoot
|
|
870
|
+
) ? readdirSync(
|
|
870
871
|
/* turbopackIgnore: true */
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
)
|
|
872
|
+
docsRoot
|
|
873
|
+
) : [];
|
|
874
|
+
if ([prefix, `${prefix}.md`, `${prefix}.mdx`].some(
|
|
875
|
+
(name) => liveNames.includes(name)
|
|
876
876
|
)) {
|
|
877
877
|
throw new RdxConfigError(
|
|
878
878
|
`content source ${id} conflicts with live documentation at /docs/${prefix}.`
|
|
@@ -16,7 +16,8 @@ function parseStaticDocument(source) {
|
|
|
16
16
|
import fs from "fs";
|
|
17
17
|
import path from "path";
|
|
18
18
|
import matter2 from "gray-matter";
|
|
19
|
-
var
|
|
19
|
+
var DOCUMENT_EXTENSIONS = [".md", ".mdx"];
|
|
20
|
+
var documentExtension = /\.mdx?$/;
|
|
20
21
|
var DEFAULT_POSITION = Number.MAX_SAFE_INTEGER;
|
|
21
22
|
function getDocsRoot(docsDir = "docs") {
|
|
22
23
|
return path.resolve(
|
|
@@ -39,11 +40,20 @@ function numberValue(value, fallback = DEFAULT_POSITION) {
|
|
|
39
40
|
}
|
|
40
41
|
function readCategoryMeta(categoryPath, fallbackTitle) {
|
|
41
42
|
const metaPath = path.join(categoryPath, "_category.json");
|
|
42
|
-
if (!fs.existsSync(
|
|
43
|
+
if (!fs.existsSync(
|
|
44
|
+
/* turbopackIgnore: true */
|
|
45
|
+
metaPath
|
|
46
|
+
)) {
|
|
43
47
|
return { title: fallbackTitle, position: DEFAULT_POSITION };
|
|
44
48
|
}
|
|
45
49
|
try {
|
|
46
|
-
const parsed = JSON.parse(
|
|
50
|
+
const parsed = JSON.parse(
|
|
51
|
+
fs.readFileSync(
|
|
52
|
+
/* turbopackIgnore: true */
|
|
53
|
+
metaPath,
|
|
54
|
+
"utf8"
|
|
55
|
+
)
|
|
56
|
+
);
|
|
47
57
|
if (!isRecord(parsed)) {
|
|
48
58
|
return { title: fallbackTitle, position: DEFAULT_POSITION };
|
|
49
59
|
}
|
|
@@ -55,17 +65,21 @@ function readCategoryMeta(categoryPath, fallbackTitle) {
|
|
|
55
65
|
return { title: fallbackTitle, position: DEFAULT_POSITION };
|
|
56
66
|
}
|
|
57
67
|
}
|
|
58
|
-
function
|
|
59
|
-
const entries = fs.readdirSync(
|
|
68
|
+
function findDocumentFiles(directory) {
|
|
69
|
+
const entries = fs.readdirSync(
|
|
70
|
+
/* turbopackIgnore: true */
|
|
71
|
+
directory,
|
|
72
|
+
{ withFileTypes: true }
|
|
73
|
+
).sort((a, b) => a.name.localeCompare(b.name));
|
|
60
74
|
return entries.flatMap((entry) => {
|
|
61
75
|
const entryPath = path.join(directory, entry.name);
|
|
62
|
-
if (entry.isDirectory()) return
|
|
63
|
-
if (entry.isFile() && entry.name
|
|
76
|
+
if (entry.isDirectory()) return findDocumentFiles(entryPath);
|
|
77
|
+
if (entry.isFile() && documentExtension.test(entry.name)) return [entryPath];
|
|
64
78
|
return [];
|
|
65
79
|
});
|
|
66
80
|
}
|
|
67
81
|
function slugFromRelativePath(relativePath) {
|
|
68
|
-
return relativePath.split(path.sep).join("/").replace(
|
|
82
|
+
return relativePath.split(path.sep).join("/").replace(documentExtension, "");
|
|
69
83
|
}
|
|
70
84
|
function isSafeSlug(slug) {
|
|
71
85
|
if (path.isAbsolute(slug) || slug.includes("\\")) return false;
|
|
@@ -98,9 +112,24 @@ function getDocsIndex({ docsDir, fallbackDocsDir, fallbackOnly } = {}, onError)
|
|
|
98
112
|
}));
|
|
99
113
|
}
|
|
100
114
|
const docsRoot = getDocsRoot(docsDir);
|
|
101
|
-
if (!fs.existsSync(
|
|
115
|
+
if (!fs.existsSync(
|
|
116
|
+
/* turbopackIgnore: true */
|
|
117
|
+
docsRoot
|
|
118
|
+
)) return [];
|
|
102
119
|
const categories = /* @__PURE__ */ new Map();
|
|
103
|
-
|
|
120
|
+
const slugs = /* @__PURE__ */ new Map();
|
|
121
|
+
for (const filePath of findDocumentFiles(docsRoot)) {
|
|
122
|
+
const slug = slugFromRelativePath(path.relative(docsRoot, filePath));
|
|
123
|
+
const previous = slugs.get(slug);
|
|
124
|
+
if (previous) {
|
|
125
|
+
const error = new Error(
|
|
126
|
+
`[RDX] Duplicate documentation route "${slug}": ${previous} and ${filePath}. Keep one page per route.`
|
|
127
|
+
);
|
|
128
|
+
if (!onError) throw error;
|
|
129
|
+
onError(error, filePath);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
slugs.set(slug, filePath);
|
|
104
133
|
const relativePath = path.relative(docsRoot, filePath);
|
|
105
134
|
const pathParts = relativePath.split(path.sep);
|
|
106
135
|
const categoryId = pathParts.length > 1 ? pathParts[0] ?? "_root" : "_root";
|
|
@@ -121,14 +150,17 @@ function getDocsIndex({ docsDir, fallbackDocsDir, fallbackOnly } = {}, onError)
|
|
|
121
150
|
}
|
|
122
151
|
let frontmatter = {};
|
|
123
152
|
try {
|
|
124
|
-
const raw = fs.readFileSync(
|
|
153
|
+
const raw = fs.readFileSync(
|
|
154
|
+
/* turbopackIgnore: true */
|
|
155
|
+
filePath,
|
|
156
|
+
"utf8"
|
|
157
|
+
);
|
|
125
158
|
const parsed = onError ? parseStaticDocument(raw) : matter2(raw);
|
|
126
159
|
frontmatter = isRecord(parsed.data) ? parsed.data : {};
|
|
127
160
|
} catch (error) {
|
|
128
161
|
if (!onError) throw error;
|
|
129
162
|
onError(error, filePath);
|
|
130
163
|
}
|
|
131
|
-
const slug = slugFromRelativePath(relativePath);
|
|
132
164
|
const fallbackTitle = toTitle(path.basename(slug));
|
|
133
165
|
category.pages.push({
|
|
134
166
|
slug,
|
|
@@ -157,15 +189,39 @@ function getDocument(slug, { docsDir, fallbackDocsDir, fallbackOnly } = {}) {
|
|
|
157
189
|
if (fallbackOnly)
|
|
158
190
|
return getDocument(slug, { docsDir: fallbackDocsDir ?? docsDir });
|
|
159
191
|
const docsRoot = getDocsRoot(docsDir);
|
|
160
|
-
const
|
|
192
|
+
const candidates = DOCUMENT_EXTENSIONS.map(
|
|
193
|
+
(extension) => path.resolve(docsRoot, `${slug}${extension}`)
|
|
194
|
+
).filter(
|
|
195
|
+
(filename) => fs.existsSync(
|
|
196
|
+
/* turbopackIgnore: true */
|
|
197
|
+
filename
|
|
198
|
+
) && fs.statSync(
|
|
199
|
+
/* turbopackIgnore: true */
|
|
200
|
+
filename
|
|
201
|
+
).isFile()
|
|
202
|
+
);
|
|
203
|
+
if (candidates.length > 1)
|
|
204
|
+
throw new Error(
|
|
205
|
+
`[RDX] Duplicate documentation route "${slug}": ${candidates.join(" and ")}. Keep one page per route.`
|
|
206
|
+
);
|
|
207
|
+
const sourcePath = candidates[0] ?? path.resolve(docsRoot, `${slug}.mdx`);
|
|
161
208
|
const relativePath = path.relative(docsRoot, sourcePath);
|
|
162
209
|
if (relativePath.startsWith("..") || path.isAbsolute(relativePath))
|
|
163
210
|
return null;
|
|
164
211
|
if (fallbackDocsDir && !getDocument(slug, { docsDir: fallbackDocsDir }))
|
|
165
212
|
return null;
|
|
166
|
-
if (!fs.existsSync(
|
|
213
|
+
if (!fs.existsSync(
|
|
214
|
+
/* turbopackIgnore: true */
|
|
215
|
+
sourcePath
|
|
216
|
+
))
|
|
167
217
|
return fallbackDocsDir ? getDocument(slug, { docsDir: fallbackDocsDir }) : null;
|
|
168
|
-
const parsed = matter2(
|
|
218
|
+
const parsed = matter2(
|
|
219
|
+
fs.readFileSync(
|
|
220
|
+
/* turbopackIgnore: true */
|
|
221
|
+
sourcePath,
|
|
222
|
+
"utf8"
|
|
223
|
+
)
|
|
224
|
+
);
|
|
169
225
|
return {
|
|
170
226
|
slug,
|
|
171
227
|
sourcePath,
|
package/dist/config/index.js
CHANGED
|
@@ -14,7 +14,7 @@ declare class RdxDocumentLinkError extends Error {
|
|
|
14
14
|
readonly reason: string;
|
|
15
15
|
constructor(sourcePath: string, href: string, reason: string);
|
|
16
16
|
}
|
|
17
|
-
/** Resolve only explicit relative
|
|
17
|
+
/** Resolve only explicit relative Markdown links within the current content source. */
|
|
18
18
|
declare function createDocumentLinkResolver(options: DocumentLinkOptions): (href: string) => string;
|
|
19
19
|
/** A remark adapter shared by generated sites and the development website. */
|
|
20
20
|
declare function remarkDocumentLinks(options?: DocumentLinkOptions): ((tree: unknown) => void) | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _lexibase_rdx_types from '@lexibase/rdx-types';
|
|
2
2
|
import { RdxDocsOptions, RdxDocCategory, RdxDocument, RdxProject, RdxContentSource } from '@lexibase/rdx-types';
|
|
3
3
|
export { R as RdxConfigError, c as createRdxProject, d as defineConfig, g as getContentSources, a as getDocsHref, b as getLanguageLinks, e as getLocalizedProject, i as isFallbackPage, r as resolveConfig, f as resolveProjectPath } from './index-DjuvW7o_.js';
|
|
4
|
-
export { D as DocumentLinkOptions, R as RdxDocumentLinkError, c as createDocumentLinkResolver } from './document-links-
|
|
4
|
+
export { D as DocumentLinkOptions, R as RdxDocumentLinkError, c as createDocumentLinkResolver } from './document-links-B9zsPsqx.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Reads the documentation tree from the user's project. The URL slug always
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RdxConfigError,
|
|
3
|
+
createRdxProject,
|
|
4
|
+
defineConfig,
|
|
5
|
+
resolveConfig,
|
|
6
|
+
resolveProjectPath
|
|
7
|
+
} from "./chunk-GYLAW7YX.js";
|
|
1
8
|
import {
|
|
2
9
|
getDocsIndex,
|
|
3
10
|
getDocsPaths,
|
|
@@ -5,14 +12,7 @@ import {
|
|
|
5
12
|
getProjectDocsPaths,
|
|
6
13
|
getSourceOptions,
|
|
7
14
|
resolveDocsRoute
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
RdxConfigError,
|
|
11
|
-
createRdxProject,
|
|
12
|
-
defineConfig,
|
|
13
|
-
resolveConfig,
|
|
14
|
-
resolveProjectPath
|
|
15
|
-
} from "./chunk-WDWRIRH2.js";
|
|
15
|
+
} from "./chunk-M32EH5KP.js";
|
|
16
16
|
import {
|
|
17
17
|
getContentSources,
|
|
18
18
|
getDocsHref,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
RdxDocumentLinkError,
|
|
25
25
|
createDocumentLinkResolver
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-36CTLWNI.js";
|
|
27
27
|
export {
|
|
28
28
|
RdxConfigError,
|
|
29
29
|
RdxDocumentLinkError,
|
package/dist/mdx/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { D as DocumentLinkOptions, r as remarkDocumentLinks } from '../document-links-
|
|
1
|
+
export { D as DocumentLinkOptions, r as remarkDocumentLinks } from '../document-links-B9zsPsqx.js';
|
|
2
2
|
export { default as rehypeDocumentationHeadings } from 'rehype-slug';
|
|
3
3
|
import rehypeShiki from '@shikijs/rehype';
|
|
4
4
|
import remarkDirective from 'remark-directive';
|
package/dist/mdx/index.js
CHANGED
package/dist/search/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ interface SearchDocument {
|
|
|
6
6
|
category: string;
|
|
7
7
|
href: string;
|
|
8
8
|
content: string;
|
|
9
|
+
/** Original filename selects Markdown or MDX parsing. Omitted defaults to MDX. */
|
|
10
|
+
sourcePath?: string;
|
|
9
11
|
}
|
|
10
12
|
/** Parse text/sections without compiling MDX, evaluating JS, or exposing paths. */
|
|
11
13
|
declare function buildSearchIndex(documents: SearchDocument[]): RdxSearchIndex;
|
package/dist/search/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import remarkMdx from "remark-mdx";
|
|
|
12
12
|
import remarkParse from "remark-parse";
|
|
13
13
|
import { unified } from "unified";
|
|
14
14
|
var parser = unified().use(remarkParse).use(remarkGfm).use(remarkMdx).use(remarkDocumentationComponents);
|
|
15
|
+
var markdownParser = unified().use(remarkParse).use(remarkGfm).use(remarkDocumentationComponents);
|
|
15
16
|
function text(node) {
|
|
16
17
|
if (node.type === "break") return " ";
|
|
17
18
|
if (["mdxjsEsm", "mdxFlowExpression", "mdxTextExpression", "html"].includes(
|
|
@@ -82,7 +83,8 @@ function buildSearchIndex(documents) {
|
|
|
82
83
|
var visit = visit2;
|
|
83
84
|
const firstEntry = entries.length;
|
|
84
85
|
const slugger = new GithubSlugger();
|
|
85
|
-
const
|
|
86
|
+
const processor = document.sourcePath?.endsWith(".md") ? markdownParser : parser;
|
|
87
|
+
const tree = processor.runSync(processor.parse(document.content), {
|
|
86
88
|
value: document.content
|
|
87
89
|
});
|
|
88
90
|
let current = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexibase/rdx-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Content indexing and document utilities for RDX documentation projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"remark-mdx": "^3.1.1",
|
|
55
55
|
"remark-parse": "^11.0.0",
|
|
56
56
|
"unified": "^11.0.5",
|
|
57
|
-
"@lexibase/rdx-types": "2.
|
|
57
|
+
"@lexibase/rdx-types": "2.2.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/node": "^22.15.3",
|