@farming-labs/next 0.0.2-beta.2 → 0.0.2-beta.3
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/config.d.mts +1 -1
- package/dist/config.mjs +6 -10
- package/dist/mdx-plugins/rehype-code.d.mts +2 -0
- package/dist/mdx-plugins/rehype-code.mjs +3 -0
- package/dist/mdx-plugins/rehype-toc.d.mts +2 -0
- package/dist/mdx-plugins/rehype-toc.mjs +3 -0
- package/dist/mdx-plugins/remark-heading.d.mts +2 -0
- package/dist/mdx-plugins/remark-heading.mjs +3 -0
- package/package.json +19 -4
package/dist/config.d.mts
CHANGED
|
@@ -18,6 +18,6 @@ import * as next from "next";
|
|
|
18
18
|
* images: { remotePatterns: [{ hostname: "example.com" }] },
|
|
19
19
|
* });
|
|
20
20
|
*/
|
|
21
|
-
declare function withDocs(nextConfig?: Record<string, unknown>):
|
|
21
|
+
declare function withDocs(nextConfig?: Record<string, unknown>): next.NextConfig;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { withDocs };
|
package/dist/config.mjs
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import createMDX from "@next/mdx";
|
|
4
|
-
import remarkGfm from "remark-gfm";
|
|
5
|
-
import remarkFrontmatter from "remark-frontmatter";
|
|
6
|
-
import remarkMdxFrontmatter from "remark-mdx-frontmatter";
|
|
7
4
|
|
|
8
5
|
//#region src/config.ts
|
|
9
6
|
/**
|
|
@@ -73,9 +70,8 @@ function readDocsEntry(root) {
|
|
|
73
70
|
}
|
|
74
71
|
return "docs";
|
|
75
72
|
}
|
|
76
|
-
|
|
73
|
+
function withDocs(nextConfig = {}) {
|
|
77
74
|
const root = process.cwd();
|
|
78
|
-
const { remarkHeading, rehypeToc, rehypeCode } = await new Function("specifier", "return import(specifier)")("fumadocs-core/mdx-plugins");
|
|
79
75
|
if (!hasFile(root, "mdx-components")) writeFileSync(join(root, "mdx-components.tsx"), MDX_COMPONENTS_TEMPLATE);
|
|
80
76
|
const layoutDir = join(root, "app", readDocsEntry(root));
|
|
81
77
|
if (existsSync(layoutDir) && !hasFile(layoutDir, "layout")) writeFileSync(join(layoutDir, "layout.tsx"), DOCS_LAYOUT_TEMPLATE);
|
|
@@ -92,12 +88,12 @@ async function withDocs(nextConfig = {}) {
|
|
|
92
88
|
extension: /\.mdx?$/,
|
|
93
89
|
options: {
|
|
94
90
|
remarkPlugins: [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
[
|
|
98
|
-
|
|
91
|
+
"remark-gfm",
|
|
92
|
+
"remark-frontmatter",
|
|
93
|
+
["remark-mdx-frontmatter", { name: "metadata" }],
|
|
94
|
+
"@farming-labs/next/mdx-plugins/remark-heading"
|
|
99
95
|
],
|
|
100
|
-
rehypePlugins: [
|
|
96
|
+
rehypePlugins: ["@farming-labs/next/mdx-plugins/rehype-toc", ["@farming-labs/next/mdx-plugins/rehype-code", { themes: {
|
|
101
97
|
dark: "github-dark",
|
|
102
98
|
light: "github-light"
|
|
103
99
|
} }]]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/next",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.3",
|
|
4
4
|
"description": "Next.js adapter for @farming-labs/docs — MDX config wrapper",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -15,6 +15,21 @@
|
|
|
15
15
|
"types": "./dist/config.d.mts",
|
|
16
16
|
"import": "./dist/config.mjs",
|
|
17
17
|
"default": "./dist/config.mjs"
|
|
18
|
+
},
|
|
19
|
+
"./mdx-plugins/remark-heading": {
|
|
20
|
+
"types": "./dist/mdx-plugins/remark-heading.d.mts",
|
|
21
|
+
"import": "./dist/mdx-plugins/remark-heading.mjs",
|
|
22
|
+
"default": "./dist/mdx-plugins/remark-heading.mjs"
|
|
23
|
+
},
|
|
24
|
+
"./mdx-plugins/rehype-toc": {
|
|
25
|
+
"types": "./dist/mdx-plugins/rehype-toc.d.mts",
|
|
26
|
+
"import": "./dist/mdx-plugins/rehype-toc.mjs",
|
|
27
|
+
"default": "./dist/mdx-plugins/rehype-toc.mjs"
|
|
28
|
+
},
|
|
29
|
+
"./mdx-plugins/rehype-code": {
|
|
30
|
+
"types": "./dist/mdx-plugins/rehype-code.d.mts",
|
|
31
|
+
"import": "./dist/mdx-plugins/rehype-code.mjs",
|
|
32
|
+
"default": "./dist/mdx-plugins/rehype-code.mjs"
|
|
18
33
|
}
|
|
19
34
|
},
|
|
20
35
|
"files": [
|
|
@@ -43,9 +58,9 @@
|
|
|
43
58
|
"typescript": "^5.9.3"
|
|
44
59
|
},
|
|
45
60
|
"peerDependencies": {
|
|
46
|
-
"next": ">=
|
|
47
|
-
"react": ">=
|
|
48
|
-
"react-dom": ">=
|
|
61
|
+
"next": ">=16.0.0",
|
|
62
|
+
"react": ">=19.2.0",
|
|
63
|
+
"react-dom": ">=19.2.0"
|
|
49
64
|
},
|
|
50
65
|
"scripts": {
|
|
51
66
|
"build": "tsdown",
|