@lexibase/rdx-core 3.6.2 → 3.6.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.
- package/dist/check/index.js +25 -11
- package/dist/chunk-GYXSGI72.js +58 -0
- package/dist/{chunk-TTL5UOXQ.js → chunk-HTAJZQVN.js} +1 -1
- package/dist/{chunk-6WNFE2QG.js → chunk-NQMIRIOR.js} +27 -6
- package/dist/{chunk-OOKOB72A.js → chunk-VVW5BNUX.js} +34 -2
- package/dist/{chunk-EY2T3I2T.js → chunk-YFA7NT73.js} +1 -1
- package/dist/config/index.js +2 -2
- package/dist/index.js +3 -3
- package/dist/mdx/index.js +7 -4
- package/dist/search/index.js +6 -7
- package/package.json +1 -1
- package/dist/chunk-FPBRKD4M.js +0 -14
package/dist/check/index.js
CHANGED
|
@@ -2,30 +2,29 @@ import {
|
|
|
2
2
|
collectPageRedirects,
|
|
3
3
|
getDocsIndex,
|
|
4
4
|
getSourceOptions
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-YFA7NT73.js";
|
|
6
6
|
import {
|
|
7
7
|
changelogPluginName,
|
|
8
8
|
getContentSources,
|
|
9
9
|
isFallbackPage,
|
|
10
10
|
parseStaticDocument,
|
|
11
11
|
readChangelog
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-VVW5BNUX.js";
|
|
13
13
|
import {
|
|
14
14
|
RdxDocumentLinkError,
|
|
15
15
|
createDocumentLinkResolver,
|
|
16
16
|
readDocumentLinkField
|
|
17
17
|
} from "../chunk-T27TQEAY.js";
|
|
18
18
|
import {
|
|
19
|
-
|
|
20
|
-
} from "../chunk-
|
|
19
|
+
getHeadingIds
|
|
20
|
+
} from "../chunk-GYXSGI72.js";
|
|
21
21
|
import {
|
|
22
22
|
remarkDocumentationComponents
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-NQMIRIOR.js";
|
|
24
24
|
|
|
25
25
|
// src/check/index.ts
|
|
26
26
|
import fs from "fs";
|
|
27
27
|
import path from "path";
|
|
28
|
-
import GithubSlugger from "github-slugger";
|
|
29
28
|
import remarkGfm from "remark-gfm";
|
|
30
29
|
import remarkMdx from "remark-mdx";
|
|
31
30
|
import remarkParse from "remark-parse";
|
|
@@ -85,7 +84,7 @@ function parse(content, markdown, duplicateAnchor) {
|
|
|
85
84
|
const anchors = /* @__PURE__ */ new Set();
|
|
86
85
|
const references = [];
|
|
87
86
|
const definitions = /* @__PURE__ */ new Map();
|
|
88
|
-
const
|
|
87
|
+
const headingIds = getHeadingIds(tree);
|
|
89
88
|
let dynamicIds = false;
|
|
90
89
|
walk(tree, (node) => {
|
|
91
90
|
if (node.type === "definition" && node.identifier && node.url && !definitions.has(identifier(node.identifier)))
|
|
@@ -93,8 +92,8 @@ function parse(content, markdown, duplicateAnchor) {
|
|
|
93
92
|
});
|
|
94
93
|
walk(tree, (node) => {
|
|
95
94
|
const nodeAnchors = /* @__PURE__ */ new Set();
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
const headingId = headingIds.get(node);
|
|
96
|
+
if (headingId !== void 0) nodeAnchors.add(headingId);
|
|
98
97
|
for (const attribute of node.attributes ?? []) {
|
|
99
98
|
if (typeof attribute.value === "string" && (attribute.name === "id" || node.name === "a" && attribute.name === "name"))
|
|
100
99
|
nodeAnchors.add(attribute.value);
|
|
@@ -145,7 +144,15 @@ function checkDocumentation(project, options = {}) {
|
|
|
145
144
|
const referencedPages = /* @__PURE__ */ new Set();
|
|
146
145
|
const routes = /* @__PURE__ */ new Map();
|
|
147
146
|
const coreRoutes = /* @__PURE__ */ new Map();
|
|
148
|
-
const roots = /* @__PURE__ */ new Set([
|
|
147
|
+
const roots = /* @__PURE__ */ new Set([
|
|
148
|
+
"/robots.txt",
|
|
149
|
+
"/sitemap.xml",
|
|
150
|
+
"/docs/llms.txt"
|
|
151
|
+
]);
|
|
152
|
+
for (const locale of project.localization?.locales ?? []) {
|
|
153
|
+
roots.add(`/${locale.path}/docs/llms.txt`);
|
|
154
|
+
if (project.config.homepage?.enabled) roots.add(`/${locale.path}`);
|
|
155
|
+
}
|
|
149
156
|
const prefixes = [];
|
|
150
157
|
const redirects = new Map(Object.entries(options.redirects ?? {}));
|
|
151
158
|
const pageRedirects = /* @__PURE__ */ new Set();
|
|
@@ -294,8 +301,12 @@ function checkDocumentation(project, options = {}) {
|
|
|
294
301
|
pages: []
|
|
295
302
|
};
|
|
296
303
|
redirectSources.push(redirectSource);
|
|
297
|
-
if (project.config.search)
|
|
304
|
+
if (project.config.search) {
|
|
298
305
|
roots.add(`/rdx-search/${source.routePrefix || "_"}`);
|
|
306
|
+
for (const locale of project.localization?.locales ?? [])
|
|
307
|
+
if (source.basePath === `/${locale.path}/docs`)
|
|
308
|
+
roots.add(`/${locale.path}/rdx-search/${source.routePrefix || "_"}`);
|
|
309
|
+
}
|
|
299
310
|
for (const page of pages) {
|
|
300
311
|
const hrefs = options.documentRoutes?.(source, page, pages) ?? [
|
|
301
312
|
documentRoute(source, page)
|
|
@@ -309,6 +320,8 @@ function checkDocumentation(project, options = {}) {
|
|
|
309
320
|
lineOffset: 0
|
|
310
321
|
};
|
|
311
322
|
documents.push(document);
|
|
323
|
+
if (!isFallbackPage(project, source, page.sourcePath))
|
|
324
|
+
roots.add(key(`/rdx-markdown${document.href}.md`));
|
|
312
325
|
for (const href of hrefs) routes.set(key(href), document);
|
|
313
326
|
coreRoutes.set(key(documentRoute(source, page)), document);
|
|
314
327
|
if (page === pages[0]) {
|
|
@@ -332,6 +345,7 @@ function checkDocumentation(project, options = {}) {
|
|
|
332
345
|
const changelogAnchors = /* @__PURE__ */ new Set();
|
|
333
346
|
let changelogHasUnknownAnchors = false;
|
|
334
347
|
const releaseChecks = releases.flatMap((release) => {
|
|
348
|
+
roots.add(`/rdx-markdown/changelog/${release.version}.md`);
|
|
335
349
|
changelogAnchors.add(`v${release.version}`);
|
|
336
350
|
try {
|
|
337
351
|
const parsed = parseDocument(
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/mdx/heading-text.ts
|
|
2
|
+
import GithubSlugger from "github-slugger";
|
|
3
|
+
function headingText(node, footnotes) {
|
|
4
|
+
if (node.type === "footnoteReference") return footnotes.get(node) ?? "";
|
|
5
|
+
if (["image", "imageReference", "break"].includes(node.type)) return "";
|
|
6
|
+
if (node.children)
|
|
7
|
+
return node.children.map((child) => headingText(child, footnotes)).join("");
|
|
8
|
+
if (["mdxjsEsm", "mdxFlowExpression", "mdxTextExpression", "html"].includes(
|
|
9
|
+
node.type
|
|
10
|
+
))
|
|
11
|
+
return "";
|
|
12
|
+
return node.value ?? "";
|
|
13
|
+
}
|
|
14
|
+
function getHeadingIds(tree) {
|
|
15
|
+
const definitions = /* @__PURE__ */ new Map();
|
|
16
|
+
function collect(node) {
|
|
17
|
+
if (node.type === "footnoteDefinition" && node.identifier) {
|
|
18
|
+
const id = node.identifier.toUpperCase();
|
|
19
|
+
if (!definitions.has(id)) definitions.set(id, node);
|
|
20
|
+
}
|
|
21
|
+
node.children?.forEach(collect);
|
|
22
|
+
}
|
|
23
|
+
collect(tree);
|
|
24
|
+
function walk(node, visit) {
|
|
25
|
+
if (node.type === "footnoteDefinition") return;
|
|
26
|
+
visit(node);
|
|
27
|
+
node.children?.forEach((child) => walk(child, visit));
|
|
28
|
+
}
|
|
29
|
+
const order = [];
|
|
30
|
+
const numbers = /* @__PURE__ */ new Map();
|
|
31
|
+
const footnotes = /* @__PURE__ */ new WeakMap();
|
|
32
|
+
function reference(node) {
|
|
33
|
+
if (node.type !== "footnoteReference" || !node.identifier) return;
|
|
34
|
+
const id = node.identifier.toUpperCase();
|
|
35
|
+
if (!numbers.has(id)) {
|
|
36
|
+
order.push(id);
|
|
37
|
+
numbers.set(id, String(order.length));
|
|
38
|
+
}
|
|
39
|
+
footnotes.set(node, numbers.get(id));
|
|
40
|
+
}
|
|
41
|
+
walk(tree, reference);
|
|
42
|
+
for (const id of order)
|
|
43
|
+
definitions.get(id)?.children?.forEach((child) => walk(child, reference));
|
|
44
|
+
const ids = /* @__PURE__ */ new WeakMap();
|
|
45
|
+
const slugger = new GithubSlugger();
|
|
46
|
+
function heading(node) {
|
|
47
|
+
if (node.type === "heading")
|
|
48
|
+
ids.set(node, slugger.slug(headingText(node, footnotes)));
|
|
49
|
+
}
|
|
50
|
+
walk(tree, heading);
|
|
51
|
+
for (const id of order)
|
|
52
|
+
definitions.get(id)?.children?.forEach((child) => walk(child, heading));
|
|
53
|
+
return ids;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
getHeadingIds
|
|
58
|
+
};
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
// src/mdx/markdown-components.ts
|
|
2
2
|
import remarkDirective from "remark-directive";
|
|
3
|
+
|
|
4
|
+
// src/mdx/tab-marker.ts
|
|
5
|
+
function hasDisabledTabMarker(children, source) {
|
|
6
|
+
const marker = children.at(-1);
|
|
7
|
+
if (!marker) return false;
|
|
8
|
+
const raw = source.slice(
|
|
9
|
+
marker.position?.start.offset,
|
|
10
|
+
marker.position?.end.offset
|
|
11
|
+
);
|
|
12
|
+
if (marker.type === "mdxTextExpression") {
|
|
13
|
+
const previous = children.at(-2);
|
|
14
|
+
return marker.value === "disabled" && raw === "{disabled}" && (!previous || previous.type === "text" && /\s$/.test(previous.value ?? ""));
|
|
15
|
+
}
|
|
16
|
+
return marker.type === "text" && /(?:^|\s)\{disabled\}[ \t]*$/.test(marker.value ?? "") && /(?:^|\s)\{disabled\}[ \t]*$/.test(raw);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// src/mdx/markdown-components.ts
|
|
3
20
|
function component(name, attributes, children, inline = false) {
|
|
4
21
|
return {
|
|
5
22
|
type: inline ? "mdxJsxTextElement" : "mdxJsxFlowElement",
|
|
@@ -79,12 +96,15 @@ function container(node, source) {
|
|
|
79
96
|
if (child.type === "heading" && child.depth === 3) {
|
|
80
97
|
const children = [...child.children ?? []];
|
|
81
98
|
const marker = children.at(-1);
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
marker.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
99
|
+
const disabled = node.name === "tabs" && hasDisabledTabMarker(children, source);
|
|
100
|
+
if (disabled) {
|
|
101
|
+
if (marker.type === "text")
|
|
102
|
+
children[children.length - 1] = {
|
|
103
|
+
...marker,
|
|
104
|
+
value: marker.value.replace(/\{disabled\}[ \t]*$/, "")
|
|
105
|
+
};
|
|
106
|
+
else children.pop();
|
|
107
|
+
}
|
|
88
108
|
const title = label(children);
|
|
89
109
|
if (!title)
|
|
90
110
|
throw new Error(
|
|
@@ -207,5 +227,6 @@ function remarkDocumentationComponents() {
|
|
|
207
227
|
}
|
|
208
228
|
|
|
209
229
|
export {
|
|
230
|
+
hasDisabledTabMarker,
|
|
210
231
|
remarkDocumentationComponents
|
|
211
232
|
};
|
|
@@ -178,7 +178,39 @@ function readBadges(value) {
|
|
|
178
178
|
return [...badges];
|
|
179
179
|
}
|
|
180
180
|
function isChangelogVersion(version) {
|
|
181
|
-
|
|
181
|
+
if (typeof version !== "string" || version !== version.trim()) return false;
|
|
182
|
+
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?$/i.exec(
|
|
183
|
+
version
|
|
184
|
+
);
|
|
185
|
+
return !!match && (match[4]?.split(".").every(
|
|
186
|
+
(part) => !/^\d+$/.test(part) || part === "0" || !part.startsWith("0")
|
|
187
|
+
) ?? true);
|
|
188
|
+
}
|
|
189
|
+
function compareIdentifier(a, b) {
|
|
190
|
+
const numericA = /^\d+$/.test(a);
|
|
191
|
+
const numericB = /^\d+$/.test(b);
|
|
192
|
+
if (numericA !== numericB) return numericA ? -1 : 1;
|
|
193
|
+
if (numericA && a.length !== b.length) return a.length - b.length;
|
|
194
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
195
|
+
}
|
|
196
|
+
function compareVersions(a, b) {
|
|
197
|
+
const [coreA, prereleaseA] = a.split("+", 1)[0].split(/-(.*)/, 2);
|
|
198
|
+
const [coreB, prereleaseB] = b.split("+", 1)[0].split(/-(.*)/, 2);
|
|
199
|
+
const partsA = coreA.split(".");
|
|
200
|
+
const partsB = coreB.split(".");
|
|
201
|
+
for (let i = 0; i < 3; i++) {
|
|
202
|
+
const difference = compareIdentifier(partsA[i], partsB[i]);
|
|
203
|
+
if (difference) return difference;
|
|
204
|
+
}
|
|
205
|
+
if (prereleaseA === void 0 || prereleaseB === void 0)
|
|
206
|
+
return prereleaseA === prereleaseB ? 0 : prereleaseA === void 0 ? 1 : -1;
|
|
207
|
+
const identifiersA = prereleaseA.split(".");
|
|
208
|
+
const identifiersB = prereleaseB.split(".");
|
|
209
|
+
for (let i = 0; i < Math.min(identifiersA.length, identifiersB.length); i++) {
|
|
210
|
+
const difference = compareIdentifier(identifiersA[i], identifiersB[i]);
|
|
211
|
+
if (difference) return difference;
|
|
212
|
+
}
|
|
213
|
+
return identifiersA.length - identifiersB.length;
|
|
182
214
|
}
|
|
183
215
|
function getChangelogDirectory(rootDir) {
|
|
184
216
|
return boundedProjectPath(rootDir, "changelog", "changelog/");
|
|
@@ -246,7 +278,7 @@ function readChangelog(rootDir, onError) {
|
|
|
246
278
|
});
|
|
247
279
|
}
|
|
248
280
|
}).sort(
|
|
249
|
-
(a, b) => b.date.localeCompare(a.date) || b.version
|
|
281
|
+
(a, b) => b.date.localeCompare(a.date) || compareVersions(b.version, a.version)
|
|
250
282
|
);
|
|
251
283
|
}
|
|
252
284
|
|
package/dist/config/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
readDocumentDate,
|
|
12
12
|
resolveConfig,
|
|
13
13
|
snapshotDatesFilename
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-HTAJZQVN.js";
|
|
15
15
|
import {
|
|
16
16
|
RdxConfigError,
|
|
17
17
|
changelogPluginName,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
isChangelogVersion,
|
|
22
22
|
readChangelog,
|
|
23
23
|
resolveProjectPath
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-VVW5BNUX.js";
|
|
25
25
|
export {
|
|
26
26
|
RdxConfigError,
|
|
27
27
|
builtDocumentDatesFilename,
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getProjectDocsPaths,
|
|
7
7
|
getSourceOptions,
|
|
8
8
|
resolveDocsRoute
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YFA7NT73.js";
|
|
10
10
|
import {
|
|
11
11
|
createRdxProject,
|
|
12
12
|
defineConfig,
|
|
13
13
|
resolveConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HTAJZQVN.js";
|
|
15
15
|
import {
|
|
16
16
|
RdxConfigError,
|
|
17
17
|
getContentSources,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
getLocalizedProject,
|
|
21
21
|
isFallbackPage,
|
|
22
22
|
resolveProjectPath
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-VVW5BNUX.js";
|
|
24
24
|
import {
|
|
25
25
|
RdxDocumentLinkError,
|
|
26
26
|
createDocumentLinkResolver,
|
package/dist/mdx/index.js
CHANGED
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
remarkDocumentLinks
|
|
3
3
|
} from "../chunk-T27TQEAY.js";
|
|
4
4
|
import {
|
|
5
|
+
hasDisabledTabMarker,
|
|
5
6
|
remarkDocumentationComponents
|
|
6
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-NQMIRIOR.js";
|
|
7
8
|
|
|
8
9
|
// src/mdx/index.ts
|
|
9
10
|
import { default as default2 } from "rehype-slug";
|
|
@@ -213,9 +214,11 @@ function exportMarkdownBody(content, links) {
|
|
|
213
214
|
const processor = unified().use(remarkParse).use(remarkGfm).use(remarkDirective);
|
|
214
215
|
if (links.sourcePath.endsWith(".mdx")) processor.use(remarkMdx);
|
|
215
216
|
const exporter = processor.use(remarkStringify).use(() => (tree) => {
|
|
216
|
-
function strip(node) {
|
|
217
|
+
function strip(node, parent) {
|
|
218
|
+
const disabled = node.type === "heading" && node.depth === 3 && parent?.type === "containerDirective" && parent.name === "tabs" && hasDisabledTabMarker(node.children ?? [], content);
|
|
219
|
+
const marker = disabled ? node.children?.at(-1) : void 0;
|
|
217
220
|
node.children = node.children?.filter(
|
|
218
|
-
(child) => !["mdxjsEsm", "mdxFlowExpression", "mdxTextExpression"].includes(
|
|
221
|
+
(child) => child === marker || !["mdxjsEsm", "mdxFlowExpression", "mdxTextExpression"].includes(
|
|
219
222
|
child.type
|
|
220
223
|
)
|
|
221
224
|
);
|
|
@@ -223,7 +226,7 @@ function exportMarkdownBody(content, links) {
|
|
|
223
226
|
node.attributes = node.attributes.filter(
|
|
224
227
|
(attribute) => attribute.type !== "mdxJsxExpressionAttribute" && (typeof attribute.value !== "object" || attribute.value?.type !== "mdxJsxAttributeValueExpression")
|
|
225
228
|
);
|
|
226
|
-
node.children?.forEach(strip);
|
|
229
|
+
node.children?.forEach((child) => strip(child, node));
|
|
227
230
|
}
|
|
228
231
|
strip(tree);
|
|
229
232
|
}).use(remarkDocumentLinks, links);
|
package/dist/search/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
2
|
+
getHeadingIds
|
|
3
|
+
} from "../chunk-GYXSGI72.js";
|
|
4
4
|
import {
|
|
5
5
|
remarkDocumentationComponents
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-NQMIRIOR.js";
|
|
7
7
|
|
|
8
8
|
// src/search/index.ts
|
|
9
|
-
import GithubSlugger from "github-slugger";
|
|
10
9
|
import remarkGfm from "remark-gfm";
|
|
11
10
|
import remarkMdx from "remark-mdx";
|
|
12
11
|
import remarkParse from "remark-parse";
|
|
@@ -45,8 +44,8 @@ function buildSearchIndex(documents) {
|
|
|
45
44
|
let visit2 = function(node, interactive = false) {
|
|
46
45
|
if (node.type === "heading") {
|
|
47
46
|
const title = plain(text(node));
|
|
48
|
-
const id =
|
|
49
|
-
if (!title) return;
|
|
47
|
+
const id = headingIds.get(node);
|
|
48
|
+
if (!title || id === void 0) return;
|
|
50
49
|
if (interactive) {
|
|
51
50
|
current.text += ` ${title}`;
|
|
52
51
|
return;
|
|
@@ -82,11 +81,11 @@ function buildSearchIndex(documents) {
|
|
|
82
81
|
};
|
|
83
82
|
var visit = visit2;
|
|
84
83
|
const firstEntry = entries.length;
|
|
85
|
-
const slugger = new GithubSlugger();
|
|
86
84
|
const processor = document.sourcePath?.endsWith(".md") ? markdownParser : parser;
|
|
87
85
|
const tree = processor.runSync(processor.parse(document.content), {
|
|
88
86
|
value: document.content
|
|
89
87
|
});
|
|
88
|
+
const headingIds = getHeadingIds(tree);
|
|
90
89
|
let current = {
|
|
91
90
|
href: document.href,
|
|
92
91
|
title: document.title,
|
package/package.json
CHANGED
package/dist/chunk-FPBRKD4M.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// src/mdx/heading-text.ts
|
|
2
|
-
function headingText(node) {
|
|
3
|
-
if (["image", "imageReference", "break"].includes(node.type)) return "";
|
|
4
|
-
if (node.children) return node.children.map(headingText).join("");
|
|
5
|
-
if (["mdxjsEsm", "mdxFlowExpression", "mdxTextExpression", "html"].includes(
|
|
6
|
-
node.type
|
|
7
|
-
))
|
|
8
|
-
return "";
|
|
9
|
-
return node.value ?? "";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
headingText
|
|
14
|
-
};
|