@lexibase/rdx-next 1.1.0 → 1.2.1
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.d.mts +3 -0
- package/config.mjs +27 -1
- package/dist/runtime/index.js +9 -6
- package/package.json +7 -7
- package/src/runtime/styles.css +2 -1
- package/templates/runtime/next.config.mjs +4 -3
package/config.d.mts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/** Common build root for the documentation project and its installed Next.js. */
|
|
2
|
+
export function getRdxBuildRoot(rootDir: string): Promise<string>
|
|
3
|
+
|
|
1
4
|
/** Explicit deployment files for a native Next.js application using RDX. */
|
|
2
5
|
export function getRdxTracingConfig(options: {
|
|
3
6
|
rootDir: string
|
package/config.mjs
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
|
-
import { readdir, stat } from 'node:fs/promises'
|
|
1
|
+
import { readdir, realpath, stat } from 'node:fs/promises'
|
|
2
|
+
import { createRequire } from 'node:module'
|
|
2
3
|
import path from 'node:path'
|
|
3
4
|
|
|
4
5
|
import { createRdxProject, resolveProjectPath } from '@lexibase/rdx-core/config'
|
|
5
6
|
import { createJiti } from 'jiti'
|
|
6
7
|
|
|
8
|
+
/** Include the project and the real Next.js installation in Turbopack's root. */
|
|
9
|
+
export async function getRdxBuildRoot(rootDir) {
|
|
10
|
+
const projectRoot = await realpath(path.resolve(rootDir))
|
|
11
|
+
const require = createRequire(path.join(projectRoot, 'package.json'))
|
|
12
|
+
const nextRoot = path.dirname(
|
|
13
|
+
await realpath(require.resolve('next/package.json'))
|
|
14
|
+
)
|
|
15
|
+
let root = projectRoot
|
|
16
|
+
while (true) {
|
|
17
|
+
const relative = path.relative(root, nextRoot)
|
|
18
|
+
if (
|
|
19
|
+
!path.isAbsolute(relative) &&
|
|
20
|
+
relative !== '..' &&
|
|
21
|
+
!relative.startsWith(`..${path.sep}`)
|
|
22
|
+
)
|
|
23
|
+
return root
|
|
24
|
+
const parent = path.dirname(root)
|
|
25
|
+
if (parent === root || parent === path.parse(parent).root)
|
|
26
|
+
throw new Error(
|
|
27
|
+
'RDX could not determine a bounded build root. Install Next.js inside the project or its workspace.'
|
|
28
|
+
)
|
|
29
|
+
root = parent
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
7
33
|
// These files are enumerated by Next's configuration loader, not by a server
|
|
8
34
|
// bundle. The core's dynamic readers deliberately leave tracing to this adapter.
|
|
9
35
|
async function contentFiles(directory) {
|
package/dist/runtime/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { DocsSidebar } from "@lexibase/rdx-ui/components/docs-sidebar";
|
|
|
11
11
|
import { DocsToc } from "@lexibase/rdx-ui/components/docs-toc";
|
|
12
12
|
import { DocsSearch } from "@lexibase/rdx-ui/components/docs-search";
|
|
13
13
|
import { Home } from "@lexibase/rdx-ui/components/home";
|
|
14
|
+
import { FooterCredit } from "@lexibase/rdx-ui/components/footer-credit";
|
|
14
15
|
import { Logo } from "@lexibase/rdx-ui/components/logo";
|
|
15
16
|
import { mdxComponents } from "@lexibase/rdx-ui/components/mdx-components";
|
|
16
17
|
import { Navbar } from "@lexibase/rdx-ui/components/navbar";
|
|
@@ -93,6 +94,7 @@ function getDocumentMetadata({
|
|
|
93
94
|
}
|
|
94
95
|
function getRdxMetadata(config) {
|
|
95
96
|
const { metadataBase, ...metadata } = config.metadata;
|
|
97
|
+
delete metadata.since;
|
|
96
98
|
const name = metadata.applicationName;
|
|
97
99
|
return {
|
|
98
100
|
title: { default: name, template: `%s | ${name}` },
|
|
@@ -308,12 +310,13 @@ async function DocsPage({
|
|
|
308
310
|
}
|
|
309
311
|
) : /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", disabled: true, children: "Next" })
|
|
310
312
|
] }),
|
|
311
|
-
/* @__PURE__ */ jsx(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
313
|
+
/* @__PURE__ */ jsx(
|
|
314
|
+
FooterCredit,
|
|
315
|
+
{
|
|
316
|
+
name: project.config.metadata.applicationName,
|
|
317
|
+
since: project.config.metadata.since
|
|
318
|
+
}
|
|
319
|
+
)
|
|
317
320
|
] })
|
|
318
321
|
]
|
|
319
322
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexibase/rdx-next",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "The Next.js runtime for RDX documentation projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"next-mdx-remote": "^6.0.0",
|
|
52
52
|
"remark-gfm": "^4",
|
|
53
53
|
"typescript": "6.0.3",
|
|
54
|
-
"@lexibase/rdx-
|
|
55
|
-
"@lexibase/rdx-
|
|
54
|
+
"@lexibase/rdx-core": "1.1.0",
|
|
55
|
+
"@lexibase/rdx-types": "1.1.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@lexibase/rdx-ui": "^1.
|
|
58
|
+
"@lexibase/rdx-ui": "^1.1.0",
|
|
59
59
|
"next": "^16.4.2",
|
|
60
60
|
"react": "^19.3.1",
|
|
61
61
|
"react-dom": "^19.3.1"
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"next": "^16.4.2",
|
|
81
81
|
"react": "19.3.1",
|
|
82
82
|
"react-dom": "19.3.1",
|
|
83
|
-
"@lexibase/rdx-ui": "1.
|
|
84
|
-
"@rdx/
|
|
85
|
-
"@rdx/
|
|
83
|
+
"@lexibase/rdx-ui": "1.1.0",
|
|
84
|
+
"@rdx/typescript-config": "1.0.0",
|
|
85
|
+
"@rdx/eslint-config": "1.0.0"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
88
88
|
"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",
|
package/src/runtime/styles.css
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@import '@lexibase/rdx-ui/globals.css';
|
|
2
|
-
|
|
2
|
+
/* Register the entry file directly: consumer ignore rules can hide nested dist folders. */
|
|
3
|
+
@source '../../dist/runtime/index.js';
|
|
3
4
|
|
|
4
5
|
/* Colors, buttons, dropdowns and typography come from the shared UI theme. */
|
|
5
6
|
.rdx-skip-link {
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url'
|
|
2
2
|
|
|
3
|
-
import { getRdxTracingConfig } from '@lexibase/rdx-next/config'
|
|
3
|
+
import { getRdxBuildRoot, getRdxTracingConfig } from '@lexibase/rdx-next/config'
|
|
4
4
|
|
|
5
5
|
const rootDir = fileURLToPath(new URL('..', import.meta.url))
|
|
6
6
|
const appDir = fileURLToPath(new URL('.', import.meta.url))
|
|
7
|
+
const buildRoot = await getRdxBuildRoot(rootDir)
|
|
7
8
|
|
|
8
9
|
/** @type {import('next').NextConfig} */
|
|
9
10
|
const nextConfig = {
|
|
10
11
|
...(await getRdxTracingConfig({ rootDir, appDir })),
|
|
11
|
-
outputFileTracingRoot:
|
|
12
|
+
outputFileTracingRoot: buildRoot,
|
|
12
13
|
agentRules: false,
|
|
13
14
|
turbopack: {
|
|
14
|
-
root:
|
|
15
|
+
root: buildRoot,
|
|
15
16
|
},
|
|
16
17
|
transpilePackages: [
|
|
17
18
|
'@lexibase/rdx-core',
|