@lexibase/rdx-core 3.3.0 → 3.5.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 +125 -37
- package/dist/chunk-F5XY2FG4.js +269 -0
- package/dist/{chunk-GR2GL7HT.js → chunk-KRVOWYZS.js} +29 -0
- package/dist/{chunk-5RUC6AZX.js → chunk-LC6NZKLP.js} +65 -16
- package/dist/{chunk-CRQU7OO4.js → chunk-PJCL6IZD.js} +50 -100
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +19 -5
- package/dist/{document-links-BQXyBubK.d.ts → document-links-CuuelWKE.d.ts} +9 -1
- package/dist/{index-CIBgPARs.d.ts → index-Bf2lDSDI.d.ts} +25 -1
- package/dist/index.d.ts +18 -4
- package/dist/index.js +13 -9
- package/dist/mdx/index.d.ts +2 -2
- package/dist/mdx/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-SNNEXRLQ.js +0 -75
|
@@ -1,28 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseStaticDocument
|
|
3
|
+
} from "./chunk-F5XY2FG4.js";
|
|
1
4
|
import {
|
|
2
5
|
DEFAULT_POSITION,
|
|
3
6
|
documentExtension,
|
|
4
7
|
orderedName,
|
|
5
8
|
slugFromRelativePath
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KRVOWYZS.js";
|
|
7
10
|
|
|
8
|
-
// src/content/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
}
|
|
18
64
|
}
|
|
19
|
-
return
|
|
65
|
+
return redirects;
|
|
20
66
|
}
|
|
21
67
|
|
|
22
68
|
// src/content/index.ts
|
|
23
69
|
import fs from "fs";
|
|
24
70
|
import path from "path";
|
|
25
|
-
import
|
|
71
|
+
import matter from "gray-matter";
|
|
26
72
|
function getDocsRoot(docsDir = "docs") {
|
|
27
73
|
return path.resolve(
|
|
28
74
|
/* turbopackIgnore: true */
|
|
@@ -169,14 +215,16 @@ function getDocsIndex({ docsDir, fallbackDocsDir, fallbackOnly } = {}, onError)
|
|
|
169
215
|
category = createdCategory;
|
|
170
216
|
}
|
|
171
217
|
let frontmatter = {};
|
|
218
|
+
let redirectFrom = [];
|
|
172
219
|
try {
|
|
173
220
|
const raw = fs.readFileSync(
|
|
174
221
|
/* turbopackIgnore: true */
|
|
175
222
|
filePath,
|
|
176
223
|
"utf8"
|
|
177
224
|
);
|
|
178
|
-
const parsed = onError ? parseStaticDocument(raw) :
|
|
225
|
+
const parsed = onError ? parseStaticDocument(raw) : matter(raw);
|
|
179
226
|
frontmatter = isRecord(parsed.data) ? parsed.data : {};
|
|
227
|
+
redirectFrom = readRedirectFrom(frontmatter.redirectFrom);
|
|
180
228
|
} catch (error) {
|
|
181
229
|
if (!onError) throw error;
|
|
182
230
|
onError(error, filePath);
|
|
@@ -189,6 +237,7 @@ function getDocsIndex({ docsDir, fallbackDocsDir, fallbackOnly } = {}, onError)
|
|
|
189
237
|
).position;
|
|
190
238
|
category.pages.push({
|
|
191
239
|
slug,
|
|
240
|
+
...redirectFrom.length ? { redirectFrom } : {},
|
|
192
241
|
title: stringValue(frontmatter.title, fallbackTitle),
|
|
193
242
|
...navTitle ? { navTitle } : {},
|
|
194
243
|
...highlighting === "important" || highlighting === "new" ? { highlighting } : {},
|
|
@@ -238,7 +287,7 @@ function getDocument(slug, { docsDir, fallbackDocsDir, fallbackOnly } = {}) {
|
|
|
238
287
|
const sourcePath = candidates[0];
|
|
239
288
|
if (!sourcePath)
|
|
240
289
|
return fallbackDocsDir ? getDocument(slug, { docsDir: fallbackDocsDir }) : null;
|
|
241
|
-
const parsed =
|
|
290
|
+
const parsed = matter(
|
|
242
291
|
fs.readFileSync(
|
|
243
292
|
/* turbopackIgnore: true */
|
|
244
293
|
sourcePath,
|
|
@@ -302,7 +351,7 @@ function getProjectDocsPaths(project) {
|
|
|
302
351
|
}
|
|
303
352
|
|
|
304
353
|
export {
|
|
305
|
-
|
|
354
|
+
collectPageRedirects,
|
|
306
355
|
getDocsIndex,
|
|
307
356
|
getDocsPaths,
|
|
308
357
|
getDocument,
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RdxConfigError,
|
|
3
|
+
boundedProjectPath,
|
|
4
|
+
inside,
|
|
5
|
+
resolveProjectPath
|
|
6
|
+
} from "./chunk-F5XY2FG4.js";
|
|
7
|
+
|
|
1
8
|
// src/config/index.ts
|
|
2
|
-
import
|
|
9
|
+
import path6 from "path";
|
|
3
10
|
import { existsSync, readFileSync, readdirSync, statSync } from "fs";
|
|
4
11
|
import { bundledThemes } from "shiki/themes";
|
|
5
12
|
|
|
6
|
-
// src/config/error.ts
|
|
7
|
-
var RdxConfigError = class extends Error {
|
|
8
|
-
constructor(message) {
|
|
9
|
-
super(`Invalid rdx.config.ts: ${message}`);
|
|
10
|
-
this.name = "RdxConfigError";
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
13
|
// src/config/metadata.ts
|
|
15
14
|
function validateMetadata(input) {
|
|
16
15
|
function string(value, field) {
|
|
@@ -243,73 +242,18 @@ function resolveLocalization(input, language, rootDir, command) {
|
|
|
243
242
|
return localization;
|
|
244
243
|
}
|
|
245
244
|
|
|
246
|
-
// src/config/
|
|
245
|
+
// src/config/source-localization.ts
|
|
247
246
|
import fs2 from "fs";
|
|
248
247
|
import path2 from "path";
|
|
249
|
-
function resolveProjectPath(rootDir, value, field) {
|
|
250
|
-
if (typeof value !== "string" || !value.trim())
|
|
251
|
-
throw new RdxConfigError(`${field} must be a non-empty string.`);
|
|
252
|
-
const resolved = path2.resolve(
|
|
253
|
-
/* turbopackIgnore: true */
|
|
254
|
-
rootDir,
|
|
255
|
-
value
|
|
256
|
-
);
|
|
257
|
-
const relative = path2.relative(rootDir, resolved);
|
|
258
|
-
if (path2.isAbsolute(value) || !relative || relative === ".." || relative.startsWith(`..${path2.sep}`) || path2.isAbsolute(relative))
|
|
259
|
-
throw new RdxConfigError(
|
|
260
|
-
`${field} must be a relative path inside the project.`
|
|
261
|
-
);
|
|
262
|
-
return resolved;
|
|
263
|
-
}
|
|
264
|
-
function inside(parent, child) {
|
|
265
|
-
const relative = path2.relative(parent, child);
|
|
266
|
-
return !relative || relative !== ".." && !relative.startsWith(`..${path2.sep}`) && !path2.isAbsolute(relative);
|
|
267
|
-
}
|
|
268
|
-
function boundedProjectPath(rootDir, value, field) {
|
|
269
|
-
const target = resolveProjectPath(rootDir, value, field);
|
|
270
|
-
const root = fs2.realpathSync(
|
|
271
|
-
/* turbopackIgnore: true */
|
|
272
|
-
rootDir
|
|
273
|
-
);
|
|
274
|
-
let parent = target;
|
|
275
|
-
while (true) {
|
|
276
|
-
try {
|
|
277
|
-
fs2.lstatSync(
|
|
278
|
-
/* turbopackIgnore: true */
|
|
279
|
-
parent
|
|
280
|
-
);
|
|
281
|
-
break;
|
|
282
|
-
} catch (error) {
|
|
283
|
-
if (error.code !== "ENOENT") throw error;
|
|
284
|
-
parent = path2.dirname(parent);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
const canonical = path2.resolve(
|
|
288
|
-
fs2.realpathSync(
|
|
289
|
-
/* turbopackIgnore: true */
|
|
290
|
-
parent
|
|
291
|
-
),
|
|
292
|
-
path2.relative(parent, target)
|
|
293
|
-
);
|
|
294
|
-
if (!inside(root, canonical))
|
|
295
|
-
throw new RdxConfigError(
|
|
296
|
-
`${field} must remain inside the project, including filesystem links.`
|
|
297
|
-
);
|
|
298
|
-
return canonical;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// src/config/source-localization.ts
|
|
302
|
-
import fs3 from "fs";
|
|
303
|
-
import path3 from "path";
|
|
304
248
|
function readSnapshot(rootDir, source, current, validateContent = true) {
|
|
305
|
-
const relative =
|
|
249
|
+
const relative = path2.join(source.docsDir, ".rdx-locales.json");
|
|
306
250
|
const filename = boundedProjectPath(
|
|
307
251
|
rootDir,
|
|
308
252
|
relative,
|
|
309
253
|
"snapshot locale metadata"
|
|
310
254
|
);
|
|
311
255
|
try {
|
|
312
|
-
if (!
|
|
256
|
+
if (!fs2.lstatSync(
|
|
313
257
|
/* turbopackIgnore: true */
|
|
314
258
|
filename
|
|
315
259
|
).isFile())
|
|
@@ -320,7 +264,7 @@ function readSnapshot(rootDir, source, current, validateContent = true) {
|
|
|
320
264
|
}
|
|
321
265
|
try {
|
|
322
266
|
const value = JSON.parse(
|
|
323
|
-
|
|
267
|
+
fs2.readFileSync(
|
|
324
268
|
/* turbopackIgnore: true */
|
|
325
269
|
filename,
|
|
326
270
|
"utf8"
|
|
@@ -372,11 +316,11 @@ function readSnapshot(rootDir, source, current, validateContent = true) {
|
|
|
372
316
|
directory,
|
|
373
317
|
"snapshot translation"
|
|
374
318
|
);
|
|
375
|
-
if (validateContent &&
|
|
319
|
+
if (validateContent && fs2.existsSync(
|
|
376
320
|
/* turbopackIgnore: true */
|
|
377
321
|
absolute
|
|
378
322
|
)) {
|
|
379
|
-
if (!
|
|
323
|
+
if (!fs2.statSync(
|
|
380
324
|
/* turbopackIgnore: true */
|
|
381
325
|
absolute
|
|
382
326
|
).isDirectory())
|
|
@@ -423,7 +367,7 @@ function hydrateSourceLocalizations(rootDir, sources, current, runtimeFiles) {
|
|
|
423
367
|
docs: { [primary.code]: source.docsDir }
|
|
424
368
|
};
|
|
425
369
|
if (frozen)
|
|
426
|
-
runtimeFiles.add(
|
|
370
|
+
runtimeFiles.add(path2.join(source.docsDir, ".rdx-locales.json"));
|
|
427
371
|
}
|
|
428
372
|
sources[index] = { ...source, localization: inventory };
|
|
429
373
|
for (const locale of inventory.locales)
|
|
@@ -437,7 +381,7 @@ function hydrateSourceLocalizations(rootDir, sources, current, runtimeFiles) {
|
|
|
437
381
|
);
|
|
438
382
|
if (retained) {
|
|
439
383
|
runtimeFiles.add(
|
|
440
|
-
|
|
384
|
+
path2.join(source.previousSnapshot.docsDir, ".rdx-locales.json")
|
|
441
385
|
);
|
|
442
386
|
for (const locale of retained.locales)
|
|
443
387
|
if (!languages.has(locale.code)) languages.set(locale.code, locale);
|
|
@@ -452,8 +396,8 @@ function hydrateSourceLocalizations(rootDir, sources, current, runtimeFiles) {
|
|
|
452
396
|
}
|
|
453
397
|
|
|
454
398
|
// src/config/snapshots.ts
|
|
455
|
-
import
|
|
456
|
-
import
|
|
399
|
+
import fs3 from "fs";
|
|
400
|
+
import path3 from "path";
|
|
457
401
|
function collectSnapshotContributions(context, options) {
|
|
458
402
|
const directories = [
|
|
459
403
|
{ sourceDir: options.sourceDir, snapshotDir: options.snapshotDir }
|
|
@@ -493,7 +437,7 @@ function collectSnapshotContributions(context, options) {
|
|
|
493
437
|
entry.snapshotDir,
|
|
494
438
|
"snapshot snapshotDir"
|
|
495
439
|
);
|
|
496
|
-
if (!
|
|
440
|
+
if (!fs3.statSync(
|
|
497
441
|
/* turbopackIgnore: true */
|
|
498
442
|
from
|
|
499
443
|
).isDirectory())
|
|
@@ -501,7 +445,7 @@ function collectSnapshotContributions(context, options) {
|
|
|
501
445
|
`Snapshot source must be a directory: ${entry.sourceDir}`
|
|
502
446
|
);
|
|
503
447
|
try {
|
|
504
|
-
|
|
448
|
+
fs3.lstatSync(
|
|
505
449
|
/* turbopackIgnore: true */
|
|
506
450
|
to
|
|
507
451
|
);
|
|
@@ -543,11 +487,11 @@ function collectSnapshotContributions(context, options) {
|
|
|
543
487
|
"Snapshot files must have unique paths inside the new snapshot directories."
|
|
544
488
|
);
|
|
545
489
|
seen.add(filename);
|
|
546
|
-
const copiedFile =
|
|
490
|
+
const copiedFile = path3.join(
|
|
547
491
|
directory.from,
|
|
548
|
-
|
|
492
|
+
path3.relative(directory.to, filename)
|
|
549
493
|
);
|
|
550
|
-
if (
|
|
494
|
+
if (fs3.existsSync(
|
|
551
495
|
/* turbopackIgnore: true */
|
|
552
496
|
copiedFile
|
|
553
497
|
))
|
|
@@ -557,7 +501,7 @@ function collectSnapshotContributions(context, options) {
|
|
|
557
501
|
return { filename, content: entry.content };
|
|
558
502
|
});
|
|
559
503
|
return {
|
|
560
|
-
rootDir:
|
|
504
|
+
rootDir: fs3.realpathSync(
|
|
561
505
|
/* turbopackIgnore: true */
|
|
562
506
|
context.rootDir
|
|
563
507
|
),
|
|
@@ -567,13 +511,13 @@ function collectSnapshotContributions(context, options) {
|
|
|
567
511
|
}
|
|
568
512
|
|
|
569
513
|
// src/config/edit-page.ts
|
|
570
|
-
import
|
|
514
|
+
import path4 from "path";
|
|
571
515
|
function getEditPageHref(project, source, sourcePath) {
|
|
572
516
|
const editPage = project.config.editPage;
|
|
573
517
|
if (!editPage || source?.id !== "current") return;
|
|
574
|
-
const relative =
|
|
575
|
-
const segments = relative.split(
|
|
576
|
-
if (!relative ||
|
|
518
|
+
const relative = path4.relative(project.rootDir, sourcePath);
|
|
519
|
+
const segments = relative.split(path4.sep);
|
|
520
|
+
if (!relative || path4.isAbsolute(relative) || segments[0] === "..") return;
|
|
577
521
|
const url = new URL(editPage.baseUrl);
|
|
578
522
|
url.pathname = `${url.pathname.replace(/\/+$/, "")}/${segments.map(encodeURIComponent).join("/")}`;
|
|
579
523
|
return url.href;
|
|
@@ -581,15 +525,16 @@ function getEditPageHref(project, source, sourcePath) {
|
|
|
581
525
|
|
|
582
526
|
// src/config/document-dates.ts
|
|
583
527
|
import { execFileSync } from "child_process";
|
|
584
|
-
import
|
|
585
|
-
import
|
|
528
|
+
import fs4 from "fs";
|
|
529
|
+
import path5 from "path";
|
|
586
530
|
var snapshotDatesFilename = "_rdx-last-updated.json";
|
|
531
|
+
var builtDocumentDatesFilename = ".rdx-document-dates.json";
|
|
587
532
|
var datePattern = /^\d{4}-\d{2}-\d{2}$/;
|
|
588
533
|
function relativeFile(root, file) {
|
|
589
|
-
const relative =
|
|
590
|
-
if (!relative ||
|
|
534
|
+
const relative = path5.relative(root, file);
|
|
535
|
+
if (!relative || path5.isAbsolute(relative) || relative.split(path5.sep)[0] === "..")
|
|
591
536
|
return;
|
|
592
|
-
return relative.split(
|
|
537
|
+
return relative.split(path5.sep).join("/");
|
|
593
538
|
}
|
|
594
539
|
function createDocumentDateReader(root) {
|
|
595
540
|
const git = (...args) => execFileSync("git", ["--literal-pathspecs", ...args], {
|
|
@@ -609,7 +554,6 @@ function createDocumentDateReader(root) {
|
|
|
609
554
|
const relative = relativeFile(root, file);
|
|
610
555
|
if (!relative) return;
|
|
611
556
|
try {
|
|
612
|
-
git("ls-files", "--error-unmatch", "--", relative);
|
|
613
557
|
git("diff", "--quiet", "--no-ext-diff", "HEAD", "--", relative);
|
|
614
558
|
const [date, parents] = git(
|
|
615
559
|
"log",
|
|
@@ -627,12 +571,12 @@ function createDocumentDateReader(root) {
|
|
|
627
571
|
function collectSnapshotDocumentDates(directory, dateFor) {
|
|
628
572
|
const dates = /* @__PURE__ */ Object.create(null);
|
|
629
573
|
function visit(folder) {
|
|
630
|
-
for (const entry of
|
|
574
|
+
for (const entry of fs4.readdirSync(
|
|
631
575
|
/* turbopackIgnore: true */
|
|
632
576
|
folder,
|
|
633
577
|
{ withFileTypes: true }
|
|
634
578
|
).sort((a, b) => a.name.localeCompare(b.name, "en"))) {
|
|
635
|
-
const file =
|
|
579
|
+
const file = path5.join(folder, entry.name);
|
|
636
580
|
if (entry.isDirectory()) visit(file);
|
|
637
581
|
else if (entry.isFile() && /\.mdx?$/.test(entry.name)) {
|
|
638
582
|
const date = dateFor(file);
|
|
@@ -644,12 +588,18 @@ function collectSnapshotDocumentDates(directory, dateFor) {
|
|
|
644
588
|
return Object.keys(dates).length ? JSON.stringify(dates, null, 2) + "\n" : void 0;
|
|
645
589
|
}
|
|
646
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) {
|
|
647
598
|
const relative = relativeFile(directory, file);
|
|
648
599
|
if (!relative) return;
|
|
649
600
|
try {
|
|
650
|
-
const filename = path6.join(directory, snapshotDatesFilename);
|
|
651
601
|
const dates = JSON.parse(
|
|
652
|
-
|
|
602
|
+
fs4.readFileSync(
|
|
653
603
|
/* turbopackIgnore: true */
|
|
654
604
|
filename,
|
|
655
605
|
"utf8"
|
|
@@ -920,7 +870,7 @@ async function createRdxProject(input, {
|
|
|
920
870
|
rootDir = process.cwd(),
|
|
921
871
|
command = "runtime"
|
|
922
872
|
} = {}) {
|
|
923
|
-
rootDir =
|
|
873
|
+
rootDir = path6.resolve(
|
|
924
874
|
/* turbopackIgnore: true */
|
|
925
875
|
rootDir
|
|
926
876
|
);
|
|
@@ -969,9 +919,9 @@ async function createRdxProject(input, {
|
|
|
969
919
|
`${field} must contain a TextMate grammar with scopeName and patterns.`
|
|
970
920
|
);
|
|
971
921
|
runtimeFiles.add(
|
|
972
|
-
|
|
922
|
+
path6.relative(rootDir, resolveProjectPath(rootDir, filename, field))
|
|
973
923
|
);
|
|
974
|
-
runtimeFiles.add(
|
|
924
|
+
runtimeFiles.add(path6.relative(rootDir, resolved));
|
|
975
925
|
return {
|
|
976
926
|
...grammar,
|
|
977
927
|
name,
|
|
@@ -1035,7 +985,7 @@ async function createRdxProject(input, {
|
|
|
1035
985
|
const field = `plugin "${plugin.name}" runtimeFiles`;
|
|
1036
986
|
const filename = text(value, field);
|
|
1037
987
|
const resolved = resolveProjectPath(rootDir, filename, field);
|
|
1038
|
-
runtimeFiles.add(
|
|
988
|
+
runtimeFiles.add(path6.relative(rootDir, resolved));
|
|
1039
989
|
}
|
|
1040
990
|
}
|
|
1041
991
|
if (contribution.sources === void 0) continue;
|
|
@@ -1143,15 +1093,15 @@ async function createRdxProject(input, {
|
|
|
1143
1093
|
}
|
|
1144
1094
|
|
|
1145
1095
|
export {
|
|
1146
|
-
RdxConfigError,
|
|
1147
1096
|
normalizeLocalization,
|
|
1148
|
-
resolveProjectPath,
|
|
1149
1097
|
collectSnapshotContributions,
|
|
1150
1098
|
getEditPageHref,
|
|
1151
1099
|
snapshotDatesFilename,
|
|
1100
|
+
builtDocumentDatesFilename,
|
|
1152
1101
|
createDocumentDateReader,
|
|
1153
1102
|
collectSnapshotDocumentDates,
|
|
1154
1103
|
getSnapshotDocumentDate,
|
|
1104
|
+
readDocumentDate,
|
|
1155
1105
|
resolveConfig,
|
|
1156
1106
|
defineConfig,
|
|
1157
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,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
builtDocumentDatesFilename,
|
|
3
3
|
collectSnapshotContributions,
|
|
4
4
|
collectSnapshotDocumentDates,
|
|
5
5
|
createDocumentDateReader,
|
|
@@ -8,24 +8,38 @@ import {
|
|
|
8
8
|
getEditPageHref,
|
|
9
9
|
getSnapshotDocumentDate,
|
|
10
10
|
normalizeLocalization,
|
|
11
|
+
readDocumentDate,
|
|
11
12
|
resolveConfig,
|
|
12
|
-
resolveProjectPath,
|
|
13
13
|
snapshotDatesFilename
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-PJCL6IZD.js";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
RdxConfigError,
|
|
17
|
+
changelogPluginName,
|
|
18
|
+
getChangelogDirectory,
|
|
19
|
+
getChangelogFiles,
|
|
20
|
+
getContentSources,
|
|
21
|
+
isChangelogVersion,
|
|
22
|
+
readChangelog,
|
|
23
|
+
resolveProjectPath
|
|
24
|
+
} from "../chunk-F5XY2FG4.js";
|
|
18
25
|
export {
|
|
19
26
|
RdxConfigError,
|
|
27
|
+
builtDocumentDatesFilename,
|
|
28
|
+
changelogPluginName,
|
|
20
29
|
collectSnapshotContributions,
|
|
21
30
|
collectSnapshotDocumentDates,
|
|
22
31
|
createDocumentDateReader,
|
|
23
32
|
createRdxProject,
|
|
24
33
|
defineConfig,
|
|
34
|
+
getChangelogDirectory,
|
|
35
|
+
getChangelogFiles,
|
|
25
36
|
getContentSources,
|
|
26
37
|
getEditPageHref,
|
|
27
38
|
getSnapshotDocumentDate,
|
|
39
|
+
isChangelogVersion,
|
|
28
40
|
normalizeLocalization,
|
|
41
|
+
readChangelog,
|
|
42
|
+
readDocumentDate,
|
|
29
43
|
resolveConfig,
|
|
30
44
|
resolveProjectPath,
|
|
31
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 };
|
|
@@ -4,6 +4,28 @@ declare class RdxConfigError extends Error {
|
|
|
4
4
|
constructor(message: string);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
declare const changelogPluginName = "@lexibase/rdx-changelog";
|
|
8
|
+
declare function isChangelogVersion(version: unknown): version is string;
|
|
9
|
+
declare function getChangelogDirectory(rootDir: string): string;
|
|
10
|
+
declare function getChangelogFiles(rootDir: string): {
|
|
11
|
+
filename: string;
|
|
12
|
+
sourcePath: string;
|
|
13
|
+
}[];
|
|
14
|
+
declare function readChangelog(rootDir: string, onError?: (error: unknown, sourcePath: string) => void): {
|
|
15
|
+
title: string;
|
|
16
|
+
version: string;
|
|
17
|
+
date: string;
|
|
18
|
+
badges: ("breaking" | "security" | "deprecated")[];
|
|
19
|
+
links: {
|
|
20
|
+
label: string;
|
|
21
|
+
href: string;
|
|
22
|
+
}[];
|
|
23
|
+
content: string;
|
|
24
|
+
lineOffset: number;
|
|
25
|
+
filename: string;
|
|
26
|
+
sourcePath: string;
|
|
27
|
+
}[];
|
|
28
|
+
|
|
7
29
|
/** Resolve project-owned paths without allowing traversal or filesystem roots. */
|
|
8
30
|
declare function resolveProjectPath(rootDir: string, value: string, field: string): string;
|
|
9
31
|
|
|
@@ -42,9 +64,11 @@ declare function isFallbackPage(project: RdxProject, source: RdxContentSource, s
|
|
|
42
64
|
declare function getEditPageHref(project: Pick<RdxProject, 'config' | 'rootDir'>, source: Pick<RdxContentSource, 'id'> | undefined, sourcePath: string): string | undefined;
|
|
43
65
|
|
|
44
66
|
declare const snapshotDatesFilename = "_rdx-last-updated.json";
|
|
67
|
+
declare const builtDocumentDatesFilename = ".rdx-document-dates.json";
|
|
45
68
|
declare function createDocumentDateReader(root: string): (file: string) => string | undefined;
|
|
46
69
|
declare function collectSnapshotDocumentDates(directory: string, dateFor: (file: string) => string | undefined): string | undefined;
|
|
47
70
|
declare function getSnapshotDocumentDate(directory: string, file: string): string | undefined;
|
|
71
|
+
declare function readDocumentDate(directory: string, file: string, filename: string): string | undefined;
|
|
48
72
|
|
|
49
73
|
declare function resolveConfig(input: unknown): ResolvedRdxConfig;
|
|
50
74
|
declare function defineConfig(config: RDXConfig): RDXConfig;
|
|
@@ -53,4 +77,4 @@ declare function createRdxProject(input: unknown, { rootDir, command, }?: {
|
|
|
53
77
|
command?: string;
|
|
54
78
|
}): Promise<RdxProject>;
|
|
55
79
|
|
|
56
|
-
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,29 +1,31 @@
|
|
|
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-LC6NZKLP.js";
|
|
9
10
|
import {
|
|
10
|
-
RdxConfigError,
|
|
11
11
|
createRdxProject,
|
|
12
12
|
defineConfig,
|
|
13
|
-
resolveConfig
|
|
14
|
-
|
|
15
|
-
} from "./chunk-CRQU7OO4.js";
|
|
13
|
+
resolveConfig
|
|
14
|
+
} from "./chunk-PJCL6IZD.js";
|
|
16
15
|
import {
|
|
16
|
+
RdxConfigError,
|
|
17
17
|
getContentSources,
|
|
18
18
|
getDocsHref,
|
|
19
19
|
getLanguageLinks,
|
|
20
20
|
getLocalizedProject,
|
|
21
|
-
isFallbackPage
|
|
22
|
-
|
|
21
|
+
isFallbackPage,
|
|
22
|
+
resolveProjectPath
|
|
23
|
+
} from "./chunk-F5XY2FG4.js";
|
|
23
24
|
import {
|
|
24
25
|
RdxDocumentLinkError,
|
|
25
|
-
createDocumentLinkResolver
|
|
26
|
-
|
|
26
|
+
createDocumentLinkResolver,
|
|
27
|
+
getRelatedDocumentLinks
|
|
28
|
+
} from "./chunk-KRVOWYZS.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,
|