@lexibase/rdx-next 5.0.0 → 5.1.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/config.mjs CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  createRdxProject,
7
7
  resolveProjectPath,
8
8
  getContentSources,
9
+ snapshotDatesFilename,
9
10
  } from '@lexibase/rdx-core/config'
10
11
  import { createJiti } from 'jiti'
11
12
 
@@ -49,7 +50,9 @@ async function contentFiles(directory) {
49
50
  const filename = path.join(directory, entry.name)
50
51
  if (entry.isDirectory()) return contentFiles(filename)
51
52
  return entry.isFile() &&
52
- (/\.mdx?$/.test(entry.name) || entry.name === '_category.json')
53
+ (/\.mdx?$/.test(entry.name) ||
54
+ entry.name === '_category.json' ||
55
+ entry.name === snapshotDatesFilename)
53
56
  ? [filename]
54
57
  : []
55
58
  })
@@ -44,7 +44,7 @@ import {
44
44
  rehypeDocumentationHeadings,
45
45
  rehypeDocumentationCode
46
46
  } from "@lexibase/rdx-core/mdx";
47
- function compileDocumentation(source, components, links) {
47
+ function compileDocumentation(source, components, links, grammars, themes) {
48
48
  return compileMDX({
49
49
  source,
50
50
  components,
@@ -58,7 +58,10 @@ function compileDocumentation(source, components, links) {
58
58
  remarkDocumentationComponents,
59
59
  [remarkDocumentLinks, links]
60
60
  ],
61
- rehypePlugins: [rehypeDocumentationHeadings, rehypeDocumentationCode]
61
+ rehypePlugins: [
62
+ rehypeDocumentationHeadings,
63
+ [rehypeDocumentationCode, grammars, themes]
64
+ ]
62
65
  }
63
66
  }
64
67
  });
@@ -75,6 +78,10 @@ import {
75
78
  isFallbackPage
76
79
  } from "@lexibase/rdx-core";
77
80
  import { exportMarkdownBody } from "@lexibase/rdx-core/mdx";
81
+ import {
82
+ createDocumentDateReader,
83
+ getSnapshotDocumentDate
84
+ } from "@lexibase/rdx-core/config";
78
85
  function publicUrl(project, path) {
79
86
  const base = project.config.metadata.metadataBase;
80
87
  return base ? new URL(path, base).href : path;
@@ -186,11 +193,13 @@ function getDocumentMarkdownResponse(project, source, slug, documentPath) {
186
193
  documentPath?.(source, page2) ?? getDocsHref(project, source, page2.slug)
187
194
  );
188
195
  const page = bySlug.get(document.slug);
196
+ const lastUpdated = source.version ? getSnapshotDocumentDate(options.docsDir, document.sourcePath) : createDocumentDateReader(project.rootDir)(document.sourcePath);
189
197
  const frontmatter = {
190
198
  title: page.title,
191
199
  ...page.description ? { description: page.description } : {},
192
200
  url: href(document),
193
- docs_index: publicUrl(project, indexPath(project))
201
+ docs_index: publicUrl(project, indexPath(project)),
202
+ ...lastUpdated ? { lastUpdated } : {}
194
203
  };
195
204
  const fields = Object.entries(frontmatter).map(
196
205
  ([key, value]) => `${key}: ${JSON.stringify(value)}`
@@ -578,7 +587,9 @@ async function DocsPage({
578
587
  basePath: contentSource.basePath,
579
588
  virtualPaths: !!contentOptions.fallbackDocsDir,
580
589
  documents: contentCategories.flatMap((category2) => category2.pages)
581
- }
590
+ },
591
+ originalProject.syntaxGrammars,
592
+ originalProject.config.syntaxHighlighting?.themes
582
593
  );
583
594
  const description = typeof document.frontmatter.description === "string" ? document.frontmatter.description : null;
584
595
  const hrefFor = (pageSlug) => getDocsHref4(project, source, pageSlug);
@@ -689,7 +700,7 @@ async function DocsPage({
689
700
  /* @__PURE__ */ jsx("h1", { className: "min-w-0 max-w-full break-words text-4xl font-bold uppercase", children: title }),
690
701
  markdownHref && /* @__PURE__ */ jsx(CopyPage, { href: markdownHref }, markdownHref)
691
702
  ] }),
692
- description && /* @__PURE__ */ jsx("p", { className: "text-sm text-ring max-w-[726px]", children: description })
703
+ description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground max-w-[726px]", children: description })
693
704
  ] }),
694
705
  /* @__PURE__ */ jsx("div", { className: "h-full w-full flex-1 max-w-[960px]", children: content })
695
706
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lexibase/rdx-next",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "The Next.js runtime for RDX documentation projects.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -52,8 +52,8 @@
52
52
  "next-mdx-remote": "^6.0.0",
53
53
  "remark-gfm": "^4",
54
54
  "typescript": "6.0.3",
55
- "@lexibase/rdx-types": "2.3.0",
56
- "@lexibase/rdx-core": "3.0.0"
55
+ "@lexibase/rdx-core": "3.1.0",
56
+ "@lexibase/rdx-types": "2.4.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@lexibase/rdx-ui": "^3.5.0",
@@ -81,9 +81,9 @@
81
81
  "next": "^16.4.2",
82
82
  "react": "19.3.1",
83
83
  "react-dom": "19.3.1",
84
- "@lexibase/rdx-ui": "3.5.0",
85
- "@rdx/eslint-config": "1.0.0",
86
- "@rdx/typescript-config": "1.0.0"
84
+ "@rdx/typescript-config": "1.0.0",
85
+ "@lexibase/rdx-ui": "3.5.2",
86
+ "@rdx/eslint-config": "1.0.0"
87
87
  },
88
88
  "scripts": {
89
89
  "dev": "tsup src/index.ts src/runtime/index.tsx --format esm --dts --watch --external @lexibase/rdx-core --external @lexibase/rdx-types --external @lexibase/rdx-ui --external next --external react --external react-dom --external next-mdx-remote",