@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
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.0",
|
|
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",
|
package/dist/chunk-SNNEXRLQ.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// src/project/localization.ts
|
|
2
|
-
import path from "path";
|
|
3
|
-
function getLocalizedProject(project, locale) {
|
|
4
|
-
const selected = project.localization?.locales.find(
|
|
5
|
-
(entry) => entry.path === locale
|
|
6
|
-
);
|
|
7
|
-
if (!selected) throw new Error(`Unknown documentation language: ${locale}`);
|
|
8
|
-
return {
|
|
9
|
-
...project,
|
|
10
|
-
locale: selected,
|
|
11
|
-
config: { ...project.config, lang: selected.code },
|
|
12
|
-
sources: project.sources.map((source) => {
|
|
13
|
-
const primary = source.localization?.docs[project.localization.defaultLocale] ?? source.fallbackDocsDir ?? source.docsDir;
|
|
14
|
-
const translated = source.localization?.docs[selected.code] ?? (!source.localization && !source.version && selected.folder ? `locale/${selected.folder}/docs` : void 0);
|
|
15
|
-
const isPrimary = selected.code === project.localization.defaultLocale;
|
|
16
|
-
return {
|
|
17
|
-
...source,
|
|
18
|
-
docsDir: isPrimary ? primary : translated ?? primary,
|
|
19
|
-
fallbackDocsDir: isPrimary ? void 0 : primary,
|
|
20
|
-
fallbackOnly: !isPrimary && !translated,
|
|
21
|
-
basePath: `/${selected.path}/docs`
|
|
22
|
-
};
|
|
23
|
-
})
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function getContentSources(project) {
|
|
27
|
-
return project.localization && !project.locale ? project.localization.locales.flatMap(
|
|
28
|
-
(locale) => getLocalizedProject(project, locale.path).sources
|
|
29
|
-
) : project.sources;
|
|
30
|
-
}
|
|
31
|
-
function getDocsHref(project, source = project.sources[0], slug = "") {
|
|
32
|
-
const base = source.basePath ?? (project.localization ? `/${project.localization.locales.find((entry) => entry.code === project.localization.defaultLocale).path}/docs` : "/docs");
|
|
33
|
-
return [
|
|
34
|
-
base,
|
|
35
|
-
source.routePrefix,
|
|
36
|
-
...slug.split("/").filter(Boolean).map(encodeURIComponent)
|
|
37
|
-
].filter(Boolean).join("/");
|
|
38
|
-
}
|
|
39
|
-
function getLanguageLinks(project, source, slug = "") {
|
|
40
|
-
if (!project.localization) return [];
|
|
41
|
-
const visible = new Set(
|
|
42
|
-
(project.sources[0]?.localization?.locales ?? project.localization.locales).map((locale) => locale.code)
|
|
43
|
-
);
|
|
44
|
-
for (const locale of source.localization?.locales ?? [])
|
|
45
|
-
visible.add(locale.code);
|
|
46
|
-
if (project.locale) visible.add(project.locale.code);
|
|
47
|
-
return project.localization.locales.filter((locale) => visible.has(locale.code)).map((locale) => {
|
|
48
|
-
const view = getLocalizedProject(project, locale.path);
|
|
49
|
-
return {
|
|
50
|
-
code: locale.code,
|
|
51
|
-
label: source.localization?.locales.find(
|
|
52
|
-
(entry) => entry.code === locale.code
|
|
53
|
-
)?.label ?? locale.label,
|
|
54
|
-
href: getDocsHref(
|
|
55
|
-
view,
|
|
56
|
-
view.sources.find((entry) => entry.id === source.id),
|
|
57
|
-
slug
|
|
58
|
-
)
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function isFallbackPage(project, source, sourcePath) {
|
|
63
|
-
return !!source.fallbackDocsDir && !path.relative(
|
|
64
|
-
path.resolve(project.rootDir, source.fallbackDocsDir),
|
|
65
|
-
sourcePath
|
|
66
|
-
).startsWith("..");
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export {
|
|
70
|
-
getLocalizedProject,
|
|
71
|
-
getContentSources,
|
|
72
|
-
getDocsHref,
|
|
73
|
-
getLanguageLinks,
|
|
74
|
-
isFallbackPage
|
|
75
|
-
};
|