@lexibase/rdx-core 2.1.0 → 3.0.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.
@@ -2,7 +2,7 @@ import {
2
2
  getDocsIndex,
3
3
  getSourceOptions,
4
4
  parseStaticDocument
5
- } from "../chunk-CGOXC3S6.js";
5
+ } from "../chunk-GBW4LSBN.js";
6
6
  import {
7
7
  getContentSources,
8
8
  isFallbackPage
@@ -10,13 +10,13 @@ import {
10
10
  import {
11
11
  RdxDocumentLinkError,
12
12
  createDocumentLinkResolver
13
- } from "../chunk-LCBSNAUH.js";
13
+ } from "../chunk-L7FZDK6G.js";
14
14
  import {
15
15
  headingText
16
16
  } from "../chunk-FPBRKD4M.js";
17
17
  import {
18
18
  remarkDocumentationComponents
19
- } from "../chunk-J7VCQHSL.js";
19
+ } from "../chunk-6WNFE2QG.js";
20
20
 
21
21
  // src/check/index.ts
22
22
  import fs from "fs";
@@ -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 tree = parser.runSync(parser.parse(content), { value: content });
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 MDX path."
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 explicitMdx = !reference.image && !/^(?:[a-z][\w+.-]*:|\/|#|\?)/i.test(reference.href) && /\.mdx(?:[?#]|$)/.test(decodeURIComponent(reference.href));
236
- if (explicitMdx) {
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 (pathname.includes("\\") || pathname.includes("\0"))
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
  );
@@ -134,6 +134,18 @@ function container(node, source) {
134
134
  )
135
135
  ]);
136
136
  }
137
+ if (node.name === "steps") {
138
+ return component(
139
+ "Steps",
140
+ {},
141
+ groups.map(
142
+ (group) => component("Step", {}, [
143
+ component("StepTitle", {}, [{ type: "text", value: group.title }]),
144
+ ...group.children
145
+ ])
146
+ )
147
+ );
148
+ }
137
149
  return component(
138
150
  "Accordion",
139
151
  {},
@@ -157,7 +169,9 @@ function remarkDocumentationComponents() {
157
169
  if (["containerDirective", "leafDirective", "textDirective"].includes(
158
170
  node.type
159
171
  )) {
160
- const known = ["tabs", "accordion", "kbd"].includes(node.name ?? "");
172
+ const known = ["tabs", "accordion", "steps", "kbd"].includes(
173
+ node.name ?? ""
174
+ );
161
175
  if (!known) {
162
176
  const value = source.slice(
163
177
  node.position?.start.offset,
@@ -0,0 +1,312 @@
1
+ import {
2
+ DEFAULT_POSITION,
3
+ documentExtension,
4
+ orderedName,
5
+ slugFromRelativePath
6
+ } from "./chunk-L7FZDK6G.js";
7
+
8
+ // src/content/static-source.ts
9
+ import matter from "gray-matter";
10
+ function parseStaticDocument(source) {
11
+ const text = source.replace(/^\uFEFF/, "");
12
+ if (text.startsWith("---") && text[3] !== "-") {
13
+ const language = matter.language(text).name.toLowerCase();
14
+ if (language && !["yaml", "yml", "json"].includes(language))
15
+ throw new Error(
16
+ "rdx check accepts YAML or JSON frontmatter, without executing document code."
17
+ );
18
+ }
19
+ return matter(source, {});
20
+ }
21
+
22
+ // src/content/index.ts
23
+ import fs from "fs";
24
+ import path from "path";
25
+ import matter2 from "gray-matter";
26
+ function getDocsRoot(docsDir = "docs") {
27
+ return path.resolve(
28
+ /* turbopackIgnore: true */
29
+ process.cwd(),
30
+ docsDir
31
+ );
32
+ }
33
+ function toTitle(value) {
34
+ return value.replace(/[-_]/g, " ").replace(/\b\w/g, (character) => character.toUpperCase());
35
+ }
36
+ function isRecord(value) {
37
+ return typeof value === "object" && value !== null;
38
+ }
39
+ function stringValue(value, fallback) {
40
+ return typeof value === "string" && value.trim() ? value : fallback;
41
+ }
42
+ function numberValue(value, fallback = DEFAULT_POSITION) {
43
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
44
+ }
45
+ function readCategoryMeta(categoryPath, fallbackTitle, position = DEFAULT_POSITION) {
46
+ const metaPath = path.join(categoryPath, "_category.json");
47
+ if (!fs.existsSync(
48
+ /* turbopackIgnore: true */
49
+ metaPath
50
+ )) {
51
+ return { title: fallbackTitle, position };
52
+ }
53
+ try {
54
+ const parsed = JSON.parse(
55
+ fs.readFileSync(
56
+ /* turbopackIgnore: true */
57
+ metaPath,
58
+ "utf8"
59
+ )
60
+ );
61
+ if (!isRecord(parsed)) {
62
+ return { title: fallbackTitle, position };
63
+ }
64
+ return {
65
+ title: stringValue(parsed.title, fallbackTitle),
66
+ position: numberValue(parsed.sidebar_position, position)
67
+ };
68
+ } catch {
69
+ return { title: fallbackTitle, position };
70
+ }
71
+ }
72
+ function findDocumentFiles(directory) {
73
+ const entries = fs.readdirSync(
74
+ /* turbopackIgnore: true */
75
+ directory,
76
+ { withFileTypes: true }
77
+ ).sort((a, b) => a.name.localeCompare(b.name));
78
+ return entries.flatMap((entry) => {
79
+ const entryPath = path.join(directory, entry.name);
80
+ if (entry.isDirectory()) return findDocumentFiles(entryPath);
81
+ if (entry.isFile() && documentExtension.test(entry.name)) return [entryPath];
82
+ return [];
83
+ });
84
+ }
85
+ function matchingEntries(directory, name, folders) {
86
+ if (!fs.existsSync(
87
+ /* turbopackIgnore: true */
88
+ directory
89
+ )) return [];
90
+ return fs.readdirSync(
91
+ /* turbopackIgnore: true */
92
+ directory,
93
+ { withFileTypes: true }
94
+ ).flatMap((entry) => {
95
+ if (folders ? !entry.isDirectory() : !entry.isFile() || !documentExtension.test(entry.name))
96
+ return [];
97
+ const candidate = folders ? entry.name : entry.name.replace(documentExtension, "");
98
+ return orderedName(candidate).name === name ? [path.join(directory, entry.name)] : [];
99
+ });
100
+ }
101
+ function isSafeSlug(slug) {
102
+ if (path.isAbsolute(slug) || slug.includes("\\")) return false;
103
+ return slug.split("/").every((segment) => segment && segment !== "." && segment !== "..");
104
+ }
105
+ function getDocsIndex({ docsDir, fallbackDocsDir, fallbackOnly } = {}, onError) {
106
+ if (fallbackOnly)
107
+ return getDocsIndex({ docsDir: fallbackDocsDir ?? docsDir }, onError);
108
+ if (fallbackDocsDir) {
109
+ const primary = getDocsIndex({ docsDir: fallbackDocsDir }, onError);
110
+ const translated = getDocsIndex({ docsDir }, onError);
111
+ const pages = new Map(
112
+ translated.flatMap(
113
+ (category) => category.pages.map((page) => [page.slug, page])
114
+ )
115
+ );
116
+ const translatedRoot = getDocsRoot(docsDir);
117
+ return primary.map((category) => ({
118
+ ...category,
119
+ title: readCategoryMeta(
120
+ category.id === "_root" ? translatedRoot : matchingEntries(translatedRoot, category.id, true)[0] ?? path.join(translatedRoot, category.id),
121
+ category.title
122
+ ).title,
123
+ pages: category.pages.map((page) => ({
124
+ ...pages.get(page.slug) ?? page,
125
+ position: page.position
126
+ }))
127
+ }));
128
+ }
129
+ const docsRoot = getDocsRoot(docsDir);
130
+ if (!fs.existsSync(
131
+ /* turbopackIgnore: true */
132
+ docsRoot
133
+ )) return [];
134
+ const categories = /* @__PURE__ */ new Map();
135
+ const slugs = /* @__PURE__ */ new Map();
136
+ for (const filePath of findDocumentFiles(docsRoot)) {
137
+ const slug = slugFromRelativePath(path.relative(docsRoot, filePath));
138
+ const previous = slugs.get(slug);
139
+ if (previous) {
140
+ const error = new Error(
141
+ `[RDX] Duplicate documentation route "${slug}": ${previous} and ${filePath}. Keep one page per route.`
142
+ );
143
+ if (!onError) throw error;
144
+ onError(error, filePath);
145
+ continue;
146
+ }
147
+ slugs.set(slug, filePath);
148
+ const relativePath = path.relative(docsRoot, filePath);
149
+ const pathParts = relativePath.split(path.sep);
150
+ const categoryFolder = pathParts.length > 1 ? pathParts[0] ?? "_root" : "_root";
151
+ const { name: categoryId, position: categoryPosition } = orderedName(categoryFolder);
152
+ const categoryPath = categoryFolder === "_root" ? docsRoot : path.join(docsRoot, categoryFolder);
153
+ const fallbackCategoryTitle = categoryId === "_root" ? "Overview" : toTitle(categoryId);
154
+ let category = categories.get(categoryId);
155
+ if (!category) {
156
+ const meta = readCategoryMeta(
157
+ categoryPath,
158
+ fallbackCategoryTitle,
159
+ categoryPosition
160
+ );
161
+ const createdCategory = {
162
+ id: categoryId,
163
+ title: meta.title,
164
+ position: meta.position,
165
+ pages: [],
166
+ categoryPath
167
+ };
168
+ categories.set(categoryId, createdCategory);
169
+ category = createdCategory;
170
+ }
171
+ let frontmatter = {};
172
+ try {
173
+ const raw = fs.readFileSync(
174
+ /* turbopackIgnore: true */
175
+ filePath,
176
+ "utf8"
177
+ );
178
+ const parsed = onError ? parseStaticDocument(raw) : matter2(raw);
179
+ frontmatter = isRecord(parsed.data) ? parsed.data : {};
180
+ } catch (error) {
181
+ if (!onError) throw error;
182
+ onError(error, filePath);
183
+ }
184
+ const fallbackTitle = toTitle(path.basename(slug));
185
+ const navTitle = stringValue(frontmatter.navTitle, "");
186
+ const { highlighting } = frontmatter;
187
+ const filePosition = orderedName(
188
+ path.basename(relativePath).replace(documentExtension, "")
189
+ ).position;
190
+ category.pages.push({
191
+ slug,
192
+ title: stringValue(frontmatter.title, fallbackTitle),
193
+ ...navTitle ? { navTitle } : {},
194
+ ...highlighting === "important" || highlighting === "new" ? { highlighting } : {},
195
+ description: stringValue(frontmatter.description, ""),
196
+ position: numberValue(
197
+ frontmatter.order,
198
+ numberValue(frontmatter.link_position, filePosition)
199
+ ),
200
+ sourcePath: filePath
201
+ });
202
+ }
203
+ return [...categories.values()].map(({ categoryPath: _categoryPath, ...category }) => ({
204
+ ...category,
205
+ pages: category.pages.sort(
206
+ (first, second) => first.position - second.position || first.slug.localeCompare(second.slug)
207
+ )
208
+ })).sort(
209
+ (first, second) => first.position - second.position || first.title.localeCompare(second.title)
210
+ );
211
+ }
212
+ function getDocsPaths(options) {
213
+ return getDocsIndex(options).flatMap(
214
+ (category) => category.pages.map((page) => page.slug)
215
+ );
216
+ }
217
+ function getDocument(slug, { docsDir, fallbackDocsDir, fallbackOnly } = {}) {
218
+ if (!isSafeSlug(slug)) return null;
219
+ if (fallbackOnly)
220
+ return getDocument(slug, { docsDir: fallbackDocsDir ?? docsDir });
221
+ const docsRoot = getDocsRoot(docsDir);
222
+ const parts = slug.split("/");
223
+ const name = parts.pop();
224
+ let directories = [docsRoot];
225
+ for (const part of parts)
226
+ directories = directories.flatMap(
227
+ (directory) => matchingEntries(directory, part, true)
228
+ );
229
+ const candidates = directories.flatMap(
230
+ (directory) => matchingEntries(directory, name, false)
231
+ );
232
+ if (candidates.length > 1)
233
+ throw new Error(
234
+ `[RDX] Duplicate documentation route "${slug}": ${candidates.join(" and ")}. Keep one page per route.`
235
+ );
236
+ if (fallbackDocsDir && !getDocument(slug, { docsDir: fallbackDocsDir }))
237
+ return null;
238
+ const sourcePath = candidates[0];
239
+ if (!sourcePath)
240
+ return fallbackDocsDir ? getDocument(slug, { docsDir: fallbackDocsDir }) : null;
241
+ const parsed = matter2(
242
+ fs.readFileSync(
243
+ /* turbopackIgnore: true */
244
+ sourcePath,
245
+ "utf8"
246
+ )
247
+ );
248
+ return {
249
+ slug,
250
+ sourcePath,
251
+ content: parsed.content,
252
+ frontmatter: isRecord(parsed.data) ? parsed.data : {}
253
+ };
254
+ }
255
+
256
+ // src/project/index.ts
257
+ import path2 from "path";
258
+ function getSourceOptions(project, source) {
259
+ return {
260
+ docsDir: path2.resolve(project.rootDir, source.docsDir),
261
+ ...source.fallbackOnly ? { fallbackOnly: true } : {},
262
+ ...source.fallbackDocsDir ? {
263
+ fallbackDocsDir: path2.resolve(
264
+ project.rootDir,
265
+ source.fallbackDocsDir
266
+ )
267
+ } : {}
268
+ };
269
+ }
270
+ function resolveDocsRoute(project, segments = []) {
271
+ const source = project.sources.find(
272
+ (entry) => entry.routePrefix && entry.routePrefix === segments[0]
273
+ ) ?? project.sources[0];
274
+ const options = getSourceOptions(project, source);
275
+ const slug = (source.routePrefix ? segments.slice(1) : segments).join("/") || getDocsPaths(options)[0];
276
+ return {
277
+ source,
278
+ slug,
279
+ document: slug ? getDocument(slug, options) : null,
280
+ categories: getDocsIndex(options)
281
+ };
282
+ }
283
+ function getProjectDocsPaths(project) {
284
+ const paths = /* @__PURE__ */ new Set();
285
+ for (const source of project.sources) {
286
+ if (source.redirectTo !== void 0) continue;
287
+ for (const slug of getDocsPaths(getSourceOptions(project, source))) {
288
+ const route = [source.routePrefix, slug].filter(Boolean).join("/");
289
+ if (paths.has(route))
290
+ throw new Error(`Conflicting documentation route: /docs/${route}`);
291
+ if (!source.routePrefix && project.sources.some(
292
+ (other) => other.routePrefix === slug.split("/")[0]
293
+ )) {
294
+ throw new Error(
295
+ `Live documentation route /docs/${slug} conflicts with a plugin content source.`
296
+ );
297
+ }
298
+ paths.add(route);
299
+ }
300
+ }
301
+ return [...paths];
302
+ }
303
+
304
+ export {
305
+ parseStaticDocument,
306
+ getDocsIndex,
307
+ getDocsPaths,
308
+ getDocument,
309
+ getSourceOptions,
310
+ resolveDocsRoute,
311
+ getProjectDocsPaths
312
+ };
@@ -1,6 +1,6 @@
1
1
  // src/config/index.ts
2
- import path5 from "path";
3
- import { existsSync } from "fs";
2
+ import path6 from "path";
3
+ import { existsSync, readdirSync } from "fs";
4
4
 
5
5
  // src/config/error.ts
6
6
  var RdxConfigError = class extends Error {
@@ -565,6 +565,19 @@ function collectSnapshotContributions(context, options) {
565
565
  };
566
566
  }
567
567
 
568
+ // src/config/edit-page.ts
569
+ import path5 from "path";
570
+ function getEditPageHref(project, source, sourcePath) {
571
+ const editPage = project.config.editPage;
572
+ if (!editPage || source?.id !== "current") return;
573
+ const relative = path5.relative(project.rootDir, sourcePath);
574
+ const segments = relative.split(path5.sep);
575
+ if (!relative || path5.isAbsolute(relative) || segments[0] === "..") return;
576
+ const url = new URL(editPage.baseUrl);
577
+ url.pathname = `${url.pathname.replace(/\/+$/, "")}/${segments.map(encodeURIComponent).join("/")}`;
578
+ return url.href;
579
+ }
580
+
568
581
  // src/config/index.ts
569
582
  function record(value) {
570
583
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -588,7 +601,7 @@ function component(value, field) {
588
601
  /* @__PURE__ */ Symbol.for("react.lazy")
589
602
  ].includes(value.$$typeof)))
590
603
  throw new RdxConfigError(
591
- `${field} must be a React component, not JSX or a file path.`
604
+ `${field} must be an imported React component, not JSX.`
592
605
  );
593
606
  }
594
607
  function keys(value, allowed, field) {
@@ -618,7 +631,8 @@ function resolveConfig(input) {
618
631
  "plugins",
619
632
  "homepage",
620
633
  "TOC",
621
- "search"
634
+ "search",
635
+ "editPage"
622
636
  ],
623
637
  ""
624
638
  );
@@ -630,6 +644,16 @@ function resolveConfig(input) {
630
644
  text(config.description, "description", true);
631
645
  if (config.lang !== void 0) text(config.lang, "lang");
632
646
  validateMetadata(config.metadata);
647
+ if (config.editPage !== void 0 && config.editPage !== false) {
648
+ const editPage = object(config.editPage, "editPage");
649
+ keys(editPage, ["baseUrl"], "editPage.");
650
+ const value = text(editPage.baseUrl, "editPage.baseUrl");
651
+ const url = URL.parse(value);
652
+ if (!/^https?:\/\//i.test(value) || /[\s\\?#]/.test(value) || !url || url.username || url.password)
653
+ throw new RdxConfigError(
654
+ "editPage.baseUrl must be an absolute HTTP(S) edit URL without credentials, a query, or a fragment."
655
+ );
656
+ }
633
657
  if (config.homepage !== void 0) {
634
658
  const homepage = object(config.homepage, "homepage");
635
659
  keys(
@@ -677,7 +701,12 @@ function resolveConfig(input) {
677
701
  if (config.navbar !== void 0) {
678
702
  const navbar = object(config.navbar, "navbar");
679
703
  keys(navbar, ["title", "logo", "actions"], "navbar.");
680
- if (navbar.logo !== void 0) component(navbar.logo, "navbar.logo");
704
+ if (typeof navbar.logo === "string") {
705
+ if (!/^\/(?!\/)/.test(navbar.logo) || /[\s\\\0]/.test(navbar.logo) || new URL(navbar.logo, "https://rdx.invalid").pathname === "/")
706
+ throw new RdxConfigError(
707
+ "navbar.logo must be a root-relative image path from public/, e.g. '/images/logo.png', or an imported React component."
708
+ );
709
+ } else if (navbar.logo !== void 0) component(navbar.logo, "navbar.logo");
681
710
  if (navbar.title !== void 0) text(navbar.title, "navbar.title", true);
682
711
  if (navbar.actions !== void 0) {
683
712
  const actions = object(navbar.actions, "navbar.actions");
@@ -749,7 +778,7 @@ async function createRdxProject(input, {
749
778
  rootDir = process.cwd(),
750
779
  command = "runtime"
751
780
  } = {}) {
752
- rootDir = path5.resolve(
781
+ rootDir = path6.resolve(
753
782
  /* turbopackIgnore: true */
754
783
  rootDir
755
784
  );
@@ -825,7 +854,7 @@ async function createRdxProject(input, {
825
854
  const field = `plugin "${plugin.name}" runtimeFiles`;
826
855
  const filename = text(value, field);
827
856
  const resolved = resolveProjectPath(rootDir, filename, field);
828
- runtimeFiles.add(path5.relative(rootDir, resolved));
857
+ runtimeFiles.add(path6.relative(rootDir, resolved));
829
858
  }
830
859
  }
831
860
  if (contribution.sources === void 0) continue;
@@ -859,20 +888,15 @@ async function createRdxProject(input, {
859
888
  `duplicate content source id or route prefix: ${id}.`
860
889
  );
861
890
  }
862
- if (existsSync(
891
+ const liveNames = existsSync(
863
892
  /* turbopackIgnore: true */
864
- path5.join(
865
- /* turbopackIgnore: true */
866
- docsRoot,
867
- prefix
868
- )
869
- ) || existsSync(
893
+ docsRoot
894
+ ) ? readdirSync(
870
895
  /* turbopackIgnore: true */
871
- path5.join(
872
- /* turbopackIgnore: true */
873
- docsRoot,
874
- `${prefix}.mdx`
875
- )
896
+ docsRoot
897
+ ) : [];
898
+ if ([prefix, `${prefix}.md`, `${prefix}.mdx`].some(
899
+ (name) => liveNames.includes(name)
876
900
  )) {
877
901
  throw new RdxConfigError(
878
902
  `content source ${id} conflicts with live documentation at /docs/${prefix}.`
@@ -941,6 +965,7 @@ export {
941
965
  normalizeLocalization,
942
966
  resolveProjectPath,
943
967
  collectSnapshotContributions,
968
+ getEditPageHref,
944
969
  resolveConfig,
945
970
  defineConfig,
946
971
  createRdxProject