fumadocs-core 10.1.2 → 10.1.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/mdx-plugins/index.d.ts +8 -5
- package/dist/mdx-plugins/index.js +11 -11
- package/package.json +7 -6
|
@@ -93,10 +93,13 @@ declare module 'mdast' {
|
|
|
93
93
|
*/
|
|
94
94
|
declare function remarkHeading(): Transformer<Root$1, Root$1>;
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
interface PackageManager {
|
|
97
|
+
name: string;
|
|
98
|
+
/**
|
|
99
|
+
* Convert from npm to another package manager
|
|
100
|
+
*/
|
|
101
|
+
command: (command: string) => string;
|
|
102
|
+
}
|
|
100
103
|
type RemarkInstallOptions = Partial<{
|
|
101
104
|
Tabs: string;
|
|
102
105
|
Tab: string;
|
|
@@ -107,7 +110,7 @@ type RemarkInstallOptions = Partial<{
|
|
|
107
110
|
*
|
|
108
111
|
* @example
|
|
109
112
|
* ```tsx
|
|
110
|
-
* <Tabs items={["
|
|
113
|
+
* <Tabs items={["npm", "pnpm", "yarn", "bun"]}>
|
|
111
114
|
* <Tab value="pnpm">...</Tab>
|
|
112
115
|
* ...
|
|
113
116
|
* </Tabs>
|
|
@@ -529,20 +529,22 @@ function structure(content, remarkPlugins = [], options = {}) {
|
|
|
529
529
|
|
|
530
530
|
// src/mdx-plugins/remark-install.ts
|
|
531
531
|
import { visit as visit5 } from "unist-util-visit";
|
|
532
|
+
import convert from "npm-to-yarn";
|
|
532
533
|
function remarkInstall({
|
|
533
534
|
Tab = "Tab",
|
|
534
535
|
Tabs = "Tabs",
|
|
535
536
|
packageManagers = [
|
|
536
|
-
(
|
|
537
|
-
(
|
|
538
|
-
(
|
|
537
|
+
{ command: (cmd) => convert(cmd, "npm"), name: "npm" },
|
|
538
|
+
{ command: (cmd) => convert(cmd, "pnpm"), name: "pnpm" },
|
|
539
|
+
{ command: (cmd) => convert(cmd, "yarn"), name: "yarn" },
|
|
540
|
+
{ command: (cmd) => convert(cmd, "bun"), name: "bun" }
|
|
539
541
|
]
|
|
540
542
|
} = {}) {
|
|
541
543
|
return (tree) => {
|
|
542
544
|
visit5(tree, "code", (node) => {
|
|
543
545
|
if (node.lang !== "package-install")
|
|
544
546
|
return "skip";
|
|
545
|
-
const
|
|
547
|
+
const value = node.value.startsWith("npm") ? node.value : `npm install ${node.value}`;
|
|
546
548
|
const insert = {
|
|
547
549
|
type: "mdxJsxFlowElement",
|
|
548
550
|
name: Tabs,
|
|
@@ -559,9 +561,9 @@ function remarkInstall({
|
|
|
559
561
|
type: "ExpressionStatement",
|
|
560
562
|
expression: {
|
|
561
563
|
type: "ArrayExpression",
|
|
562
|
-
elements:
|
|
564
|
+
elements: packageManagers.map(({ name }) => ({
|
|
563
565
|
type: "Literal",
|
|
564
|
-
value:
|
|
566
|
+
value: name
|
|
565
567
|
}))
|
|
566
568
|
}
|
|
567
569
|
}
|
|
@@ -571,17 +573,15 @@ function remarkInstall({
|
|
|
571
573
|
}
|
|
572
574
|
}
|
|
573
575
|
],
|
|
574
|
-
children:
|
|
576
|
+
children: packageManagers.map(({ command, name }) => ({
|
|
575
577
|
type: "mdxJsxFlowElement",
|
|
576
578
|
name: Tab,
|
|
577
|
-
attributes: [
|
|
578
|
-
{ type: "mdxJsxAttribute", name: "value", value: packageManager }
|
|
579
|
-
],
|
|
579
|
+
attributes: [{ type: "mdxJsxAttribute", name: "value", value: name }],
|
|
580
580
|
children: [
|
|
581
581
|
{
|
|
582
582
|
type: "code",
|
|
583
583
|
lang: "bash",
|
|
584
|
-
value: command
|
|
584
|
+
value: command(value)
|
|
585
585
|
}
|
|
586
586
|
]
|
|
587
587
|
}))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.3",
|
|
4
4
|
"description": "The library for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -109,23 +109,24 @@
|
|
|
109
109
|
],
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@formatjs/intl-localematcher": "^0.5.4",
|
|
112
|
-
"@shikijs/rehype": "^1.2.
|
|
113
|
-
"@shikijs/transformers": "^1.2.
|
|
112
|
+
"@shikijs/rehype": "^1.2.1",
|
|
113
|
+
"@shikijs/transformers": "^1.2.1",
|
|
114
114
|
"flexsearch": "0.7.21",
|
|
115
115
|
"github-slugger": "^2.0.0",
|
|
116
116
|
"hast-util-to-estree": "^3.1.0",
|
|
117
117
|
"negotiator": "^0.6.3",
|
|
118
|
+
"npm-to-yarn": "^2.2.1",
|
|
118
119
|
"react-remove-scroll": "^2.5.9",
|
|
119
120
|
"remark": "^15.0.0",
|
|
120
121
|
"remark-gfm": "^4.0.0",
|
|
121
122
|
"remark-mdx": "^3.0.1",
|
|
122
123
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
123
|
-
"shiki": "^1.2.
|
|
124
|
+
"shiki": "^1.2.1",
|
|
124
125
|
"swr": "^2.2.5",
|
|
125
126
|
"unist-util-visit": "^5.0.0"
|
|
126
127
|
},
|
|
127
128
|
"devDependencies": {
|
|
128
|
-
"@algolia/client-search": "^4.
|
|
129
|
+
"@algolia/client-search": "^4.23.2",
|
|
129
130
|
"@mdx-js/mdx": "^3.0.1",
|
|
130
131
|
"@types/flexsearch": "0.7.6",
|
|
131
132
|
"@types/hast": "^3.0.4",
|
|
@@ -134,7 +135,7 @@
|
|
|
134
135
|
"@types/node": "18.17.5",
|
|
135
136
|
"@types/react": "^18.2.67",
|
|
136
137
|
"@types/react-dom": "^18.2.22",
|
|
137
|
-
"algoliasearch": "^4.
|
|
138
|
+
"algoliasearch": "^4.23.2",
|
|
138
139
|
"next": "^14.1.4",
|
|
139
140
|
"unified": "^11.0.4",
|
|
140
141
|
"eslint-config-custom": "0.0.0",
|