@lexibase/rdx-core 3.4.0 → 3.5.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.
- package/dist/check/index.js +40 -13
- package/dist/{chunk-MR2RBNYL.js → chunk-4S2NYHNB.js} +67 -7
- package/dist/{chunk-GR2GL7HT.js → chunk-KRVOWYZS.js} +29 -0
- package/dist/{chunk-F5XY2FG4.js → chunk-OOKOB72A.js} +1 -1
- package/dist/{chunk-72FMWDD4.js → chunk-TTL5UOXQ.js} +11 -3
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +6 -2
- package/dist/{document-links-BQXyBubK.d.ts → document-links-CuuelWKE.d.ts} +9 -1
- package/dist/{index-BI3YflHV.d.ts → index-Bf2lDSDI.d.ts} +3 -1
- package/dist/index.d.ts +18 -4
- package/dist/index.js +11 -7
- package/dist/mdx/index.d.ts +2 -2
- package/dist/mdx/index.js +1 -1
- package/package.json +2 -2
package/dist/check/index.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
+
collectPageRedirects,
|
|
2
3
|
getDocsIndex,
|
|
3
4
|
getSourceOptions
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import {
|
|
6
|
-
changelogPluginName,
|
|
7
|
-
getContentSources,
|
|
8
|
-
isFallbackPage,
|
|
9
|
-
parseStaticDocument,
|
|
10
|
-
readChangelog
|
|
11
|
-
} from "../chunk-F5XY2FG4.js";
|
|
12
|
-
import {
|
|
13
|
-
RdxDocumentLinkError,
|
|
14
|
-
createDocumentLinkResolver
|
|
15
|
-
} from "../chunk-GR2GL7HT.js";
|
|
5
|
+
} from "../chunk-4S2NYHNB.js";
|
|
16
6
|
import {
|
|
17
7
|
headingText
|
|
18
8
|
} from "../chunk-FPBRKD4M.js";
|
|
9
|
+
import {
|
|
10
|
+
RdxDocumentLinkError,
|
|
11
|
+
createDocumentLinkResolver,
|
|
12
|
+
readDocumentLinkField
|
|
13
|
+
} from "../chunk-KRVOWYZS.js";
|
|
19
14
|
import {
|
|
20
15
|
remarkDocumentationComponents
|
|
21
16
|
} from "../chunk-6WNFE2QG.js";
|
|
17
|
+
import {
|
|
18
|
+
changelogPluginName,
|
|
19
|
+
getContentSources,
|
|
20
|
+
isFallbackPage,
|
|
21
|
+
parseStaticDocument,
|
|
22
|
+
readChangelog
|
|
23
|
+
} from "../chunk-OOKOB72A.js";
|
|
22
24
|
|
|
23
25
|
// src/check/index.ts
|
|
24
26
|
import fs from "fs";
|
|
@@ -96,6 +98,7 @@ function checkDocumentation(project, options = {}) {
|
|
|
96
98
|
const prefixes = [];
|
|
97
99
|
const redirects = new Map(Object.entries(options.redirects ?? {}));
|
|
98
100
|
const failed = /* @__PURE__ */ new Set();
|
|
101
|
+
const redirectSources = [];
|
|
99
102
|
const origin = project.config.metadata.metadataBase ? new URL(project.config.metadata.metadataBase).origin : "https://rdx.invalid";
|
|
100
103
|
const key = (href) => decodeURIComponent(new URL(href, origin).pathname).replace(/\/$/, "") || "/";
|
|
101
104
|
const rootFor = options.sourceRoute ?? sourceRoute;
|
|
@@ -152,6 +155,7 @@ function checkDocumentation(project, options = {}) {
|
|
|
152
155
|
}
|
|
153
156
|
for (const source of sources) {
|
|
154
157
|
if (source.redirectTo !== void 0) {
|
|
158
|
+
redirectSources.push({ source, root: rootFor(source), pages: [] });
|
|
155
159
|
const destination = sources.find(
|
|
156
160
|
(entry) => entry.routePrefix === source.redirectTo && entry.basePath === source.basePath
|
|
157
161
|
);
|
|
@@ -190,12 +194,19 @@ function checkDocumentation(project, options = {}) {
|
|
|
190
194
|
continue;
|
|
191
195
|
}
|
|
192
196
|
roots.add(key(rootFor(source)));
|
|
197
|
+
const redirectSource = {
|
|
198
|
+
source,
|
|
199
|
+
root: rootFor(source),
|
|
200
|
+
pages: []
|
|
201
|
+
};
|
|
202
|
+
redirectSources.push(redirectSource);
|
|
193
203
|
if (project.config.search)
|
|
194
204
|
roots.add(`/rdx-search/${source.routePrefix || "_"}`);
|
|
195
205
|
for (const page of pages) {
|
|
196
206
|
const hrefs = options.documentRoutes?.(source, page, pages) ?? [
|
|
197
207
|
documentRoute(source, page)
|
|
198
208
|
];
|
|
209
|
+
redirectSource.pages.push({ page, hrefs });
|
|
199
210
|
const document = {
|
|
200
211
|
sourcePath: page.sourcePath,
|
|
201
212
|
page,
|
|
@@ -212,6 +223,9 @@ function checkDocumentation(project, options = {}) {
|
|
|
212
223
|
}
|
|
213
224
|
}
|
|
214
225
|
}
|
|
226
|
+
for (const redirect of collectPageRedirects(redirectSources, syntax)) {
|
|
227
|
+
redirects.set(key(redirect.source), redirect.destination);
|
|
228
|
+
}
|
|
215
229
|
if (project.config.homepage?.enabled) roots.add("/");
|
|
216
230
|
else redirects.set("/", "/docs");
|
|
217
231
|
const changelog = project.config.plugins.some(
|
|
@@ -248,9 +262,22 @@ function checkDocumentation(project, options = {}) {
|
|
|
248
262
|
if (failed.has(document.page.sourcePath)) continue;
|
|
249
263
|
try {
|
|
250
264
|
const raw = fs.readFileSync(document.page.sourcePath, "utf8");
|
|
251
|
-
const content = parseStaticDocument(raw)
|
|
265
|
+
const { content, data } = parseStaticDocument(raw);
|
|
252
266
|
document.lineOffset = (raw.slice(0, raw.length - content.length).match(/\n/g) ?? []).length;
|
|
253
267
|
document.parsed = parse(content, document.page.sourcePath.endsWith(".md"));
|
|
268
|
+
for (const field of ["related", "prerequisites"]) {
|
|
269
|
+
try {
|
|
270
|
+
document.parsed.references.push(
|
|
271
|
+
...readDocumentLinkField(data[field], field).map((href, index) => ({
|
|
272
|
+
href,
|
|
273
|
+
image: false,
|
|
274
|
+
field: `${field}[${index}]`
|
|
275
|
+
}))
|
|
276
|
+
);
|
|
277
|
+
} catch (error) {
|
|
278
|
+
syntax(error, document.page.sourcePath);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
254
281
|
} catch (error) {
|
|
255
282
|
syntax(error, document.page.sourcePath, document.lineOffset);
|
|
256
283
|
}
|
|
@@ -1,17 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parseStaticDocument
|
|
3
|
-
} from "./chunk-F5XY2FG4.js";
|
|
4
1
|
import {
|
|
5
2
|
DEFAULT_POSITION,
|
|
6
3
|
documentExtension,
|
|
7
4
|
orderedName,
|
|
8
5
|
slugFromRelativePath
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KRVOWYZS.js";
|
|
7
|
+
import {
|
|
8
|
+
parseStaticDocument
|
|
9
|
+
} from "./chunk-OOKOB72A.js";
|
|
10
|
+
|
|
11
|
+
// src/content/page-redirects.ts
|
|
12
|
+
function readRedirectFrom(value) {
|
|
13
|
+
if (value === void 0) return [];
|
|
14
|
+
if (!Array.isArray(value))
|
|
15
|
+
throw new Error("redirectFrom must be a list of /docs/ paths.");
|
|
16
|
+
return value.map((entry, index) => {
|
|
17
|
+
if (typeof entry === "string" && /^\/docs(?:\/[A-Za-z0-9._~-]+)+$/.test(entry) && !entry.split("/").some((segment) => segment === "." || segment === ".."))
|
|
18
|
+
return entry;
|
|
19
|
+
throw new Error(
|
|
20
|
+
`redirectFrom[${index}] must be a /docs/ path without a trailing slash, query, or fragment.`
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
var routeKey = (href) => decodeURIComponent(href);
|
|
25
|
+
function collectPageRedirects(sources, onError = (error) => {
|
|
26
|
+
throw error;
|
|
27
|
+
}) {
|
|
28
|
+
const occupied = new Set(
|
|
29
|
+
sources.flatMap(({ root, pages }) => [
|
|
30
|
+
routeKey(root),
|
|
31
|
+
...pages.flatMap(({ hrefs }) => hrefs.map(routeKey))
|
|
32
|
+
])
|
|
33
|
+
);
|
|
34
|
+
const aliases = /* @__PURE__ */ new Map();
|
|
35
|
+
const redirects = [];
|
|
36
|
+
for (const { source, root, pages } of sources) {
|
|
37
|
+
if (source.redirectTo !== void 0) continue;
|
|
38
|
+
for (const { page, hrefs } of pages) {
|
|
39
|
+
for (const former of page.redirectFrom ?? []) {
|
|
40
|
+
const old = `${root}${former.slice("/docs".length)}`;
|
|
41
|
+
const key = routeKey(old);
|
|
42
|
+
const destination = hrefs[0];
|
|
43
|
+
const reserved = sources.some(
|
|
44
|
+
(other) => other.root !== root && key.startsWith(`${routeKey(other.root)}/`) && routeKey(other.root).startsWith(`${routeKey(root)}/`)
|
|
45
|
+
);
|
|
46
|
+
const builtIn = key === "/docs/llms.txt" || key === `${source.basePath}/llms.txt`;
|
|
47
|
+
if (occupied.has(key) || reserved || builtIn || aliases.has(key)) {
|
|
48
|
+
onError(
|
|
49
|
+
new Error(
|
|
50
|
+
`redirectFrom path "${old}" conflicts with ${aliases.has(key) ? `a redirect to "${aliases.get(key)}"` : "an existing documentation route"}.`
|
|
51
|
+
),
|
|
52
|
+
page.sourcePath
|
|
53
|
+
);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
aliases.set(key, destination);
|
|
57
|
+
redirects.push({
|
|
58
|
+
source: key.split("/").map(encodeURIComponent).join("/"),
|
|
59
|
+
destination,
|
|
60
|
+
permanent: true
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return redirects;
|
|
66
|
+
}
|
|
10
67
|
|
|
11
68
|
// src/content/index.ts
|
|
12
69
|
import fs from "fs";
|
|
13
70
|
import path from "path";
|
|
14
|
-
import matter from "gray-matter";
|
|
15
71
|
function getDocsRoot(docsDir = "docs") {
|
|
16
72
|
return path.resolve(
|
|
17
73
|
/* turbopackIgnore: true */
|
|
@@ -158,14 +214,16 @@ function getDocsIndex({ docsDir, fallbackDocsDir, fallbackOnly } = {}, onError)
|
|
|
158
214
|
category = createdCategory;
|
|
159
215
|
}
|
|
160
216
|
let frontmatter = {};
|
|
217
|
+
let redirectFrom = [];
|
|
161
218
|
try {
|
|
162
219
|
const raw = fs.readFileSync(
|
|
163
220
|
/* turbopackIgnore: true */
|
|
164
221
|
filePath,
|
|
165
222
|
"utf8"
|
|
166
223
|
);
|
|
167
|
-
const parsed =
|
|
224
|
+
const parsed = parseStaticDocument(raw);
|
|
168
225
|
frontmatter = isRecord(parsed.data) ? parsed.data : {};
|
|
226
|
+
redirectFrom = readRedirectFrom(frontmatter.redirectFrom);
|
|
169
227
|
} catch (error) {
|
|
170
228
|
if (!onError) throw error;
|
|
171
229
|
onError(error, filePath);
|
|
@@ -178,6 +236,7 @@ function getDocsIndex({ docsDir, fallbackDocsDir, fallbackOnly } = {}, onError)
|
|
|
178
236
|
).position;
|
|
179
237
|
category.pages.push({
|
|
180
238
|
slug,
|
|
239
|
+
...redirectFrom.length ? { redirectFrom } : {},
|
|
181
240
|
title: stringValue(frontmatter.title, fallbackTitle),
|
|
182
241
|
...navTitle ? { navTitle } : {},
|
|
183
242
|
...highlighting === "important" || highlighting === "new" ? { highlighting } : {},
|
|
@@ -227,7 +286,7 @@ function getDocument(slug, { docsDir, fallbackDocsDir, fallbackOnly } = {}) {
|
|
|
227
286
|
const sourcePath = candidates[0];
|
|
228
287
|
if (!sourcePath)
|
|
229
288
|
return fallbackDocsDir ? getDocument(slug, { docsDir: fallbackDocsDir }) : null;
|
|
230
|
-
const parsed =
|
|
289
|
+
const parsed = parseStaticDocument(
|
|
231
290
|
fs.readFileSync(
|
|
232
291
|
/* turbopackIgnore: true */
|
|
233
292
|
sourcePath,
|
|
@@ -291,6 +350,7 @@ function getProjectDocsPaths(project) {
|
|
|
291
350
|
}
|
|
292
351
|
|
|
293
352
|
export {
|
|
353
|
+
collectPageRedirects,
|
|
294
354
|
getDocsIndex,
|
|
295
355
|
getDocsPaths,
|
|
296
356
|
getDocument,
|
|
@@ -22,6 +22,33 @@ var RdxDocumentLinkError = class extends Error {
|
|
|
22
22
|
}
|
|
23
23
|
reason;
|
|
24
24
|
};
|
|
25
|
+
function readDocumentLinkField(value, field) {
|
|
26
|
+
if (value === void 0) return [];
|
|
27
|
+
if (!Array.isArray(value))
|
|
28
|
+
throw new Error(
|
|
29
|
+
`${field} must be an array of relative Markdown file paths.`
|
|
30
|
+
);
|
|
31
|
+
return value.map((entry, index) => {
|
|
32
|
+
if (typeof entry !== "string" || /^(?:[a-z][a-z\d+.-]*:|\/)/i.test(entry.trim()) || !/^[^?#\\]+\.mdx?$/.test(entry.trim()))
|
|
33
|
+
throw new Error(
|
|
34
|
+
`${field}[${index}] must be a relative .md or .mdx file path.`
|
|
35
|
+
);
|
|
36
|
+
return entry.trim();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function getRelatedDocumentLinks(value, options, currentSlug, hrefFor, field = "related") {
|
|
40
|
+
const paths = readDocumentLinkField(value, field);
|
|
41
|
+
if (!paths.length) return [];
|
|
42
|
+
const resolve = createDocumentLinkResolver({
|
|
43
|
+
...options,
|
|
44
|
+
documentHref: (slug) => slug
|
|
45
|
+
});
|
|
46
|
+
const pages = new Map(options.documents.map((page) => [page.slug, page]));
|
|
47
|
+
return [...new Set(paths.map(resolve))].flatMap((slug) => {
|
|
48
|
+
const page = pages.get(slug);
|
|
49
|
+
return page && page.slug !== currentSlug ? [{ href: hrefFor(page), label: page.navTitle ?? page.title }] : [];
|
|
50
|
+
});
|
|
51
|
+
}
|
|
25
52
|
function createDocumentLinkResolver(options) {
|
|
26
53
|
const root = path2.resolve(options.sourceRoot);
|
|
27
54
|
const current = path2.resolve(options.sourcePath);
|
|
@@ -150,6 +177,8 @@ export {
|
|
|
150
177
|
orderedName,
|
|
151
178
|
slugFromRelativePath,
|
|
152
179
|
RdxDocumentLinkError,
|
|
180
|
+
readDocumentLinkField,
|
|
181
|
+
getRelatedDocumentLinks,
|
|
153
182
|
createDocumentLinkResolver,
|
|
154
183
|
remarkDocumentLinks
|
|
155
184
|
};
|
|
@@ -6,7 +6,7 @@ function parseStaticDocument(source) {
|
|
|
6
6
|
const language = matter.language(text).name.toLowerCase();
|
|
7
7
|
if (language && !["yaml", "yml", "json"].includes(language))
|
|
8
8
|
throw new Error(
|
|
9
|
-
"
|
|
9
|
+
"RDX accepts YAML or JSON frontmatter, without executing document code."
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
return matter(source, {});
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
boundedProjectPath,
|
|
4
4
|
inside,
|
|
5
5
|
resolveProjectPath
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OOKOB72A.js";
|
|
7
7
|
|
|
8
8
|
// src/config/index.ts
|
|
9
9
|
import path6 from "path";
|
|
@@ -528,6 +528,7 @@ import { execFileSync } from "child_process";
|
|
|
528
528
|
import fs4 from "fs";
|
|
529
529
|
import path5 from "path";
|
|
530
530
|
var snapshotDatesFilename = "_rdx-last-updated.json";
|
|
531
|
+
var builtDocumentDatesFilename = ".rdx-document-dates.json";
|
|
531
532
|
var datePattern = /^\d{4}-\d{2}-\d{2}$/;
|
|
532
533
|
function relativeFile(root, file) {
|
|
533
534
|
const relative = path5.relative(root, file);
|
|
@@ -553,7 +554,6 @@ function createDocumentDateReader(root) {
|
|
|
553
554
|
const relative = relativeFile(root, file);
|
|
554
555
|
if (!relative) return;
|
|
555
556
|
try {
|
|
556
|
-
git("ls-files", "--error-unmatch", "--", relative);
|
|
557
557
|
git("diff", "--quiet", "--no-ext-diff", "HEAD", "--", relative);
|
|
558
558
|
const [date, parents] = git(
|
|
559
559
|
"log",
|
|
@@ -588,10 +588,16 @@ function collectSnapshotDocumentDates(directory, dateFor) {
|
|
|
588
588
|
return Object.keys(dates).length ? JSON.stringify(dates, null, 2) + "\n" : void 0;
|
|
589
589
|
}
|
|
590
590
|
function getSnapshotDocumentDate(directory, file) {
|
|
591
|
+
return readDocumentDate(
|
|
592
|
+
directory,
|
|
593
|
+
file,
|
|
594
|
+
path5.join(directory, snapshotDatesFilename)
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
function readDocumentDate(directory, file, filename) {
|
|
591
598
|
const relative = relativeFile(directory, file);
|
|
592
599
|
if (!relative) return;
|
|
593
600
|
try {
|
|
594
|
-
const filename = path5.join(directory, snapshotDatesFilename);
|
|
595
601
|
const dates = JSON.parse(
|
|
596
602
|
fs4.readFileSync(
|
|
597
603
|
/* turbopackIgnore: true */
|
|
@@ -1091,9 +1097,11 @@ export {
|
|
|
1091
1097
|
collectSnapshotContributions,
|
|
1092
1098
|
getEditPageHref,
|
|
1093
1099
|
snapshotDatesFilename,
|
|
1100
|
+
builtDocumentDatesFilename,
|
|
1094
1101
|
createDocumentDateReader,
|
|
1095
1102
|
collectSnapshotDocumentDates,
|
|
1096
1103
|
getSnapshotDocumentDate,
|
|
1104
|
+
readDocumentDate,
|
|
1097
1105
|
resolveConfig,
|
|
1098
1106
|
defineConfig,
|
|
1099
1107
|
createRdxProject
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '@lexibase/rdx-types';
|
|
2
|
-
export { R as RdxConfigError, h as
|
|
2
|
+
export { R as RdxConfigError, h as builtDocumentDatesFilename, j as changelogPluginName, k as collectSnapshotContributions, l as collectSnapshotDocumentDates, m as createDocumentDateReader, c as createRdxProject, d as defineConfig, n as getChangelogDirectory, o as getChangelogFiles, g as getContentSources, p as getEditPageHref, q as getSnapshotDocumentDate, s as isChangelogVersion, t as normalizeLocalization, u as readChangelog, v as readDocumentDate, r as resolveConfig, f as resolveProjectPath, w as snapshotDatesFilename } from '../index-Bf2lDSDI.js';
|
package/dist/config/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
builtDocumentDatesFilename,
|
|
2
3
|
collectSnapshotContributions,
|
|
3
4
|
collectSnapshotDocumentDates,
|
|
4
5
|
createDocumentDateReader,
|
|
@@ -7,9 +8,10 @@ import {
|
|
|
7
8
|
getEditPageHref,
|
|
8
9
|
getSnapshotDocumentDate,
|
|
9
10
|
normalizeLocalization,
|
|
11
|
+
readDocumentDate,
|
|
10
12
|
resolveConfig,
|
|
11
13
|
snapshotDatesFilename
|
|
12
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-TTL5UOXQ.js";
|
|
13
15
|
import {
|
|
14
16
|
RdxConfigError,
|
|
15
17
|
changelogPluginName,
|
|
@@ -19,9 +21,10 @@ import {
|
|
|
19
21
|
isChangelogVersion,
|
|
20
22
|
readChangelog,
|
|
21
23
|
resolveProjectPath
|
|
22
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-OOKOB72A.js";
|
|
23
25
|
export {
|
|
24
26
|
RdxConfigError,
|
|
27
|
+
builtDocumentDatesFilename,
|
|
25
28
|
changelogPluginName,
|
|
26
29
|
collectSnapshotContributions,
|
|
27
30
|
collectSnapshotDocumentDates,
|
|
@@ -36,6 +39,7 @@ export {
|
|
|
36
39
|
isChangelogVersion,
|
|
37
40
|
normalizeLocalization,
|
|
38
41
|
readChangelog,
|
|
42
|
+
readDocumentDate,
|
|
39
43
|
resolveConfig,
|
|
40
44
|
resolveProjectPath,
|
|
41
45
|
snapshotDatesFilename
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { RdxDocPage } from '@lexibase/rdx-types';
|
|
2
|
+
|
|
1
3
|
interface DocumentLinkOptions {
|
|
2
4
|
sourceRoot: string;
|
|
3
5
|
sourcePath: string;
|
|
@@ -17,10 +19,16 @@ declare class RdxDocumentLinkError extends Error {
|
|
|
17
19
|
readonly reason: string;
|
|
18
20
|
constructor(sourcePath: string, href: string, reason: string);
|
|
19
21
|
}
|
|
22
|
+
declare function getRelatedDocumentLinks(value: unknown, options: Omit<DocumentLinkOptions, 'documents'> & {
|
|
23
|
+
documents: readonly RdxDocPage[];
|
|
24
|
+
}, currentSlug: string, hrefFor: (page: RdxDocPage) => string, field?: 'related' | 'prerequisites'): {
|
|
25
|
+
href: string;
|
|
26
|
+
label: string;
|
|
27
|
+
}[];
|
|
20
28
|
/** Resolve only explicit relative Markdown links within the current content source. */
|
|
21
29
|
declare function createDocumentLinkResolver(options: DocumentLinkOptions): (href: string) => string;
|
|
22
30
|
/** A remark adapter shared by generated sites and the development website. */
|
|
23
31
|
declare function remarkDocumentLinks(options?: DocumentLinkOptions): ((tree: unknown) => void) | undefined;
|
|
24
32
|
|
|
25
|
-
export { RdxDocumentLinkError as R, createDocumentLinkResolver as c, remarkDocumentLinks as r };
|
|
33
|
+
export { RdxDocumentLinkError as R, createDocumentLinkResolver as c, getRelatedDocumentLinks as g, remarkDocumentLinks as r };
|
|
26
34
|
export type { DocumentLinkOptions as D };
|
|
@@ -64,9 +64,11 @@ declare function isFallbackPage(project: RdxProject, source: RdxContentSource, s
|
|
|
64
64
|
declare function getEditPageHref(project: Pick<RdxProject, 'config' | 'rootDir'>, source: Pick<RdxContentSource, 'id'> | undefined, sourcePath: string): string | undefined;
|
|
65
65
|
|
|
66
66
|
declare const snapshotDatesFilename = "_rdx-last-updated.json";
|
|
67
|
+
declare const builtDocumentDatesFilename = ".rdx-document-dates.json";
|
|
67
68
|
declare function createDocumentDateReader(root: string): (file: string) => string | undefined;
|
|
68
69
|
declare function collectSnapshotDocumentDates(directory: string, dateFor: (file: string) => string | undefined): string | undefined;
|
|
69
70
|
declare function getSnapshotDocumentDate(directory: string, file: string): string | undefined;
|
|
71
|
+
declare function readDocumentDate(directory: string, file: string, filename: string): string | undefined;
|
|
70
72
|
|
|
71
73
|
declare function resolveConfig(input: unknown): ResolvedRdxConfig;
|
|
72
74
|
declare function defineConfig(config: RDXConfig): RDXConfig;
|
|
@@ -75,4 +77,4 @@ declare function createRdxProject(input: unknown, { rootDir, command, }?: {
|
|
|
75
77
|
command?: string;
|
|
76
78
|
}): Promise<RdxProject>;
|
|
77
79
|
|
|
78
|
-
export { RdxConfigError as R, getDocsHref as a, getLanguageLinks as b, createRdxProject as c, defineConfig as d, getLocalizedProject as e, resolveProjectPath as f, getContentSources as g,
|
|
80
|
+
export { RdxConfigError as R, getDocsHref as a, getLanguageLinks as b, createRdxProject as c, defineConfig as d, getLocalizedProject as e, resolveProjectPath as f, getContentSources as g, builtDocumentDatesFilename as h, isFallbackPage as i, changelogPluginName as j, collectSnapshotContributions as k, collectSnapshotDocumentDates as l, createDocumentDateReader as m, getChangelogDirectory as n, getChangelogFiles as o, getEditPageHref as p, getSnapshotDocumentDate as q, resolveConfig as r, isChangelogVersion as s, normalizeLocalization as t, readChangelog as u, readDocumentDate as v, snapshotDatesFilename as w };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _lexibase_rdx_types from '@lexibase/rdx-types';
|
|
2
|
-
import { RdxDocsOptions, RdxDocCategory, RdxDocument,
|
|
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-
|
|
4
|
-
export { D as DocumentLinkOptions, R as RdxDocumentLinkError, c as createDocumentLinkResolver } from './document-links-
|
|
2
|
+
import { RdxDocsOptions, RdxDocCategory, RdxDocument, RdxContentSource, RdxDocPage, RdxProject } from '@lexibase/rdx-types';
|
|
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-Bf2lDSDI.js';
|
|
4
|
+
export { D as DocumentLinkOptions, R as RdxDocumentLinkError, c as createDocumentLinkResolver, g as getRelatedDocumentLinks } from './document-links-CuuelWKE.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Reads the documentation tree from the user's project. The URL slug always
|
|
@@ -17,6 +17,20 @@ declare function getDocument(slug: string, { docsDir, fallbackDocsDir, fallbackO
|
|
|
17
17
|
/** Convert an app-relative URL for consumers that do not use the Next router. */
|
|
18
18
|
declare function withBasePath(href: string, basePath?: string): string;
|
|
19
19
|
|
|
20
|
+
type PageRedirectSource = {
|
|
21
|
+
source: RdxContentSource;
|
|
22
|
+
root: string;
|
|
23
|
+
pages: {
|
|
24
|
+
page: RdxDocPage;
|
|
25
|
+
hrefs: string[];
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
28
|
+
declare function collectPageRedirects(sources: PageRedirectSource[], onError?: (error: Error, file: string) => void): {
|
|
29
|
+
source: string;
|
|
30
|
+
destination: string;
|
|
31
|
+
permanent: true;
|
|
32
|
+
}[];
|
|
33
|
+
|
|
20
34
|
declare function getSourceOptions(project: RdxProject, source: RdxContentSource): {
|
|
21
35
|
fallbackDocsDir?: string | undefined;
|
|
22
36
|
fallbackOnly?: boolean | undefined;
|
|
@@ -31,4 +45,4 @@ declare function resolveDocsRoute(project: RdxProject, segments?: string[]): {
|
|
|
31
45
|
};
|
|
32
46
|
declare function getProjectDocsPaths(project: RdxProject): string[];
|
|
33
47
|
|
|
34
|
-
export { getDocsIndex, getDocsPaths, getDocument, getProjectDocsPaths, getSourceOptions, resolveDocsRoute, withBasePath };
|
|
48
|
+
export { collectPageRedirects, getDocsIndex, getDocsPaths, getDocument, getProjectDocsPaths, getSourceOptions, resolveDocsRoute, withBasePath };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
+
collectPageRedirects,
|
|
2
3
|
getDocsIndex,
|
|
3
4
|
getDocsPaths,
|
|
4
5
|
getDocument,
|
|
5
6
|
getProjectDocsPaths,
|
|
6
7
|
getSourceOptions,
|
|
7
8
|
resolveDocsRoute
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4S2NYHNB.js";
|
|
10
|
+
import {
|
|
11
|
+
RdxDocumentLinkError,
|
|
12
|
+
createDocumentLinkResolver,
|
|
13
|
+
getRelatedDocumentLinks
|
|
14
|
+
} from "./chunk-KRVOWYZS.js";
|
|
9
15
|
import {
|
|
10
16
|
createRdxProject,
|
|
11
17
|
defineConfig,
|
|
12
18
|
resolveConfig
|
|
13
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-TTL5UOXQ.js";
|
|
14
20
|
import {
|
|
15
21
|
RdxConfigError,
|
|
16
22
|
getContentSources,
|
|
@@ -19,11 +25,7 @@ import {
|
|
|
19
25
|
getLocalizedProject,
|
|
20
26
|
isFallbackPage,
|
|
21
27
|
resolveProjectPath
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import {
|
|
24
|
-
RdxDocumentLinkError,
|
|
25
|
-
createDocumentLinkResolver
|
|
26
|
-
} from "./chunk-GR2GL7HT.js";
|
|
28
|
+
} from "./chunk-OOKOB72A.js";
|
|
27
29
|
|
|
28
30
|
// src/content/base-path.ts
|
|
29
31
|
function withBasePath(href, basePath) {
|
|
@@ -33,6 +35,7 @@ function withBasePath(href, basePath) {
|
|
|
33
35
|
export {
|
|
34
36
|
RdxConfigError,
|
|
35
37
|
RdxDocumentLinkError,
|
|
38
|
+
collectPageRedirects,
|
|
36
39
|
createDocumentLinkResolver,
|
|
37
40
|
createRdxProject,
|
|
38
41
|
defineConfig,
|
|
@@ -44,6 +47,7 @@ export {
|
|
|
44
47
|
getLanguageLinks,
|
|
45
48
|
getLocalizedProject,
|
|
46
49
|
getProjectDocsPaths,
|
|
50
|
+
getRelatedDocumentLinks,
|
|
47
51
|
getSourceOptions,
|
|
48
52
|
isFallbackPage,
|
|
49
53
|
resolveConfig,
|
package/dist/mdx/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DocumentLinkOptions } from '../document-links-
|
|
2
|
-
export { r as remarkDocumentLinks } from '../document-links-
|
|
1
|
+
import { D as DocumentLinkOptions } from '../document-links-CuuelWKE.js';
|
|
2
|
+
export { r as remarkDocumentLinks } from '../document-links-CuuelWKE.js';
|
|
3
3
|
export { default as rehypeDocumentationHeadings } from 'rehype-slug';
|
|
4
4
|
import rehypeShiki from '@shikijs/rehype';
|
|
5
5
|
import { RdxProject, RDXConfig } from '@lexibase/rdx-types';
|
package/dist/mdx/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexibase/rdx-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"description": "Content indexing and document utilities for RDX documentation projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"remark-stringify": "^11.0.0",
|
|
57
57
|
"shiki": "^4.5.0",
|
|
58
58
|
"unified": "^11.0.5",
|
|
59
|
-
"@lexibase/rdx-types": "2.
|
|
59
|
+
"@lexibase/rdx-types": "2.8.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/node": "^22.15.3",
|