@lexibase/rdx-next 2.0.0 → 3.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/bin/cli.mjs +2 -0
- package/bin/project-styles.mjs +27 -0
- package/dist/runtime/index.js +68 -45
- package/package.json +4 -4
package/bin/cli.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { createJiti } from 'jiti'
|
|
|
10
10
|
|
|
11
11
|
import postcssConfig from '../postcss.config.mjs'
|
|
12
12
|
import { preparePublicAssets } from './public-assets.mjs'
|
|
13
|
+
import { prepareProjectStyles } from './project-styles.mjs'
|
|
13
14
|
|
|
14
15
|
export async function runRdxCli({ templateDir } = {}) {
|
|
15
16
|
const supportedCommands = new Set(['dev', 'build', 'start'])
|
|
@@ -31,6 +32,7 @@ export async function runRdxCli({ templateDir } = {}) {
|
|
|
31
32
|
force: true,
|
|
32
33
|
recursive: true,
|
|
33
34
|
})
|
|
35
|
+
await prepareProjectStyles(projectRoot, runtimeDirectory)
|
|
34
36
|
// Resolve in Node before Next processes this file: UI may be transitive,
|
|
35
37
|
// and native Tailwind plugins must stay outside the Turbopack module graph.
|
|
36
38
|
const resolvePlugin = createRequire(import.meta.url)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { readFile, stat, writeFile } from 'node:fs/promises'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
|
|
4
|
+
/** Import project-owned CSS after the theme without copying or editing it. */
|
|
5
|
+
export async function prepareProjectStyles(projectRoot, runtimeDirectory) {
|
|
6
|
+
const source = path.join(projectRoot, 'rdx.css')
|
|
7
|
+
const destination = path.join(runtimeDirectory, 'app', 'globals.css')
|
|
8
|
+
const current = await readFile(destination, 'utf8')
|
|
9
|
+
const original = current.replace(
|
|
10
|
+
/^@import "\.\.\/\.\.\/rdx\.css";\r?\n/gm,
|
|
11
|
+
''
|
|
12
|
+
)
|
|
13
|
+
let exists = false
|
|
14
|
+
try {
|
|
15
|
+
const info = await stat(source)
|
|
16
|
+
if (!info.isFile()) throw new Error('rdx.css must be a CSS file.')
|
|
17
|
+
exists = true
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error.code !== 'ENOENT') throw error
|
|
20
|
+
}
|
|
21
|
+
const next = exists
|
|
22
|
+
? original.replace(/(@import[^;]+;)/, '$1\n@import "../../rdx.css";')
|
|
23
|
+
: original
|
|
24
|
+
if (next !== current) {
|
|
25
|
+
await writeFile(destination, next)
|
|
26
|
+
}
|
|
27
|
+
}
|
package/dist/runtime/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { Button } from "@lexibase/rdx-ui/components/button";
|
|
9
9
|
import { DocsSidebar } from "@lexibase/rdx-ui/components/docs-sidebar";
|
|
10
10
|
import { DocsToc } from "@lexibase/rdx-ui/components/docs-toc";
|
|
11
|
+
import { DocsPageTransition } from "@lexibase/rdx-ui/components/docs-page-transition";
|
|
11
12
|
import { DocsSearch } from "@lexibase/rdx-ui/components/docs-search";
|
|
12
13
|
import { Home } from "@lexibase/rdx-ui/components/home";
|
|
13
14
|
import { FooterCredit } from "@lexibase/rdx-ui/components/footer-credit";
|
|
@@ -28,6 +29,7 @@ import { compileMDX } from "next-mdx-remote/rsc";
|
|
|
28
29
|
import remarkGfm from "remark-gfm";
|
|
29
30
|
import {
|
|
30
31
|
remarkDocumentLinks,
|
|
32
|
+
remarkDocumentationComponents,
|
|
31
33
|
rehypeDocumentationHeadings,
|
|
32
34
|
rehypeDocumentationCode
|
|
33
35
|
} from "@lexibase/rdx-core/mdx";
|
|
@@ -39,7 +41,11 @@ function compileDocumentation(source, components, links) {
|
|
|
39
41
|
blockJS: true,
|
|
40
42
|
blockDangerousJS: true,
|
|
41
43
|
mdxOptions: {
|
|
42
|
-
remarkPlugins: [
|
|
44
|
+
remarkPlugins: [
|
|
45
|
+
remarkGfm,
|
|
46
|
+
remarkDocumentationComponents,
|
|
47
|
+
[remarkDocumentLinks, links]
|
|
48
|
+
],
|
|
43
49
|
rehypePlugins: [rehypeDocumentationHeadings, rehypeDocumentationCode]
|
|
44
50
|
}
|
|
45
51
|
}
|
|
@@ -286,51 +292,68 @@ async function DocsPage({
|
|
|
286
292
|
className: "relative flex-1 min-w-0 h-full overflow-y-auto pt-12 md:pt-0 outline-none",
|
|
287
293
|
children: [
|
|
288
294
|
project.config.TOC && /* @__PURE__ */ jsx(DocsToc, {}, hrefFor(currentSlug)),
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
|
|
295
|
+
/* @__PURE__ */ jsx(
|
|
296
|
+
DocsPageTransition,
|
|
291
297
|
{
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
298
|
+
previousHref: previous ? hrefFor(previous.slug) : void 0,
|
|
299
|
+
nextHref: next ? hrefFor(next.slug) : void 0,
|
|
300
|
+
children: /* @__PURE__ */ jsxs(
|
|
301
|
+
"section",
|
|
302
|
+
{
|
|
303
|
+
className: `w-full min-h-full bg-background px-7 flex flex-col gap-5 pb-8 md:py-8 ${project.config.TOC ? "xl:pr-20" : ""}`,
|
|
304
|
+
children: [
|
|
305
|
+
/* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col gap-5 md:mx-auto md:max-w-[860px] pt-14 md:pt-0 flex-1", children: [
|
|
306
|
+
/* @__PURE__ */ jsxs("header", { className: "mb-6", children: [
|
|
307
|
+
source.badge && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-4", children: source.badge === "Archived" ? messages.archivedVersion : source.badge }),
|
|
308
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-zinc-600 font-semibold uppercase block -mb-0.5", children: category?.title }),
|
|
309
|
+
/* @__PURE__ */ jsx("h1", { className: "text-4xl uppercase font-bold mb-2", children: title }),
|
|
310
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-ring max-w-[726px]", children: description })
|
|
311
|
+
] }),
|
|
312
|
+
/* @__PURE__ */ jsx(
|
|
313
|
+
"main",
|
|
314
|
+
{
|
|
315
|
+
id: "rdx-main",
|
|
316
|
+
tabIndex: -1,
|
|
317
|
+
className: "h-full w-full flex-1 max-w-[960px]",
|
|
318
|
+
children: content
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
] }),
|
|
322
|
+
/* @__PURE__ */ jsxs("footer", { className: "flex flex-col", children: [
|
|
323
|
+
/* @__PURE__ */ jsxs("section", { className: "flex items-center justify-between", children: [
|
|
324
|
+
previous ? /* @__PURE__ */ jsx(
|
|
325
|
+
Button,
|
|
326
|
+
{
|
|
327
|
+
variant: "outline",
|
|
328
|
+
size: "sm",
|
|
329
|
+
href: hrefFor(previous.slug),
|
|
330
|
+
transitionTypes: ["rdx-doc-back"],
|
|
331
|
+
children: previous.title
|
|
332
|
+
}
|
|
333
|
+
) : /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", disabled: true, children: messages.previous }),
|
|
334
|
+
next ? /* @__PURE__ */ jsx(
|
|
335
|
+
Button,
|
|
336
|
+
{
|
|
337
|
+
variant: "outline",
|
|
338
|
+
size: "sm",
|
|
339
|
+
href: hrefFor(next.slug),
|
|
340
|
+
transitionTypes: ["rdx-doc-forward"],
|
|
341
|
+
children: next.title
|
|
342
|
+
}
|
|
343
|
+
) : /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", disabled: true, children: messages.next })
|
|
344
|
+
] }),
|
|
345
|
+
/* @__PURE__ */ jsx(
|
|
346
|
+
FooterCredit,
|
|
347
|
+
{
|
|
348
|
+
lang: project.config.lang,
|
|
349
|
+
name: project.config.metadata.applicationName,
|
|
350
|
+
since: project.config.metadata.since
|
|
351
|
+
}
|
|
352
|
+
)
|
|
353
|
+
] })
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
)
|
|
334
357
|
}
|
|
335
358
|
)
|
|
336
359
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexibase/rdx-next",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "The Next.js runtime for RDX documentation projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"remark-gfm": "^4",
|
|
53
53
|
"typescript": "6.0.3",
|
|
54
54
|
"@lexibase/rdx-types": "1.1.1",
|
|
55
|
-
"@lexibase/rdx-core": "1.
|
|
55
|
+
"@lexibase/rdx-core": "1.3.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@lexibase/rdx-ui": "^
|
|
58
|
+
"@lexibase/rdx-ui": "^3.1.0",
|
|
59
59
|
"next": "^16.4.2",
|
|
60
60
|
"react": "^19.3.1",
|
|
61
61
|
"react-dom": "^19.3.1"
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"react": "19.3.1",
|
|
82
82
|
"react-dom": "19.3.1",
|
|
83
83
|
"@rdx/eslint-config": "1.0.0",
|
|
84
|
-
"@lexibase/rdx-ui": "
|
|
84
|
+
"@lexibase/rdx-ui": "3.1.0",
|
|
85
85
|
"@rdx/typescript-config": "1.0.0"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|