@rspress-theme-anatole/rspress-plugin-devkit 0.0.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.
Files changed (43) hide show
  1. package/dist/ConfigMutator/index.d.ts +14 -0
  2. package/dist/ConfigMutator/index.js +25 -0
  3. package/dist/DirectivesTransformer/index.d.ts +41 -0
  4. package/dist/DirectivesTransformer/index.js +86 -0
  5. package/dist/Exports/Unist.d.ts +14 -0
  6. package/dist/Exports/Unist.js +4 -0
  7. package/dist/NodeFactory/ESTreeNodeFactory.d.ts +23 -0
  8. package/dist/NodeFactory/ESTreeNodeFactory.js +126 -0
  9. package/dist/NodeFactory/MdAstNodeFactory.d.ts +31 -0
  10. package/dist/NodeFactory/MdAstNodeFactory.js +113 -0
  11. package/dist/NodeFactory/MdxAttrNodeFactory.d.ts +7 -0
  12. package/dist/NodeFactory/MdxAttrNodeFactory.js +35 -0
  13. package/dist/NodeFactory/MdxJsxElementFactory.d.ts +13 -0
  14. package/dist/NodeFactory/MdxJsxElementFactory.js +33 -0
  15. package/dist/RemarkPluginFactory/CodeBlock2GlobalComponent.d.ts +15 -0
  16. package/dist/RemarkPluginFactory/CodeBlock2GlobalComponent.js +29 -0
  17. package/dist/RemarkPluginFactory/FactoryBase.d.ts +18 -0
  18. package/dist/RemarkPluginFactory/FactoryBase.js +23 -0
  19. package/dist/RemarkPluginFactory/InsertComponent.d.ts +16 -0
  20. package/dist/RemarkPluginFactory/InsertComponent.js +48 -0
  21. package/dist/Shared/SharedPluginOptions.d.ts +4 -0
  22. package/dist/Shared/SharedPluginOptions.js +1 -0
  23. package/dist/Shared.d.ts +1 -0
  24. package/dist/Shared.js +1 -0
  25. package/dist/SourceParser/ParserUtils.d.mts +9 -0
  26. package/dist/SourceParser/ParserUtils.mjs +16 -0
  27. package/dist/SourceParser/TS.d.mts +17 -0
  28. package/dist/SourceParser/TS.mjs +84 -0
  29. package/dist/Utils/createTuple.d.ts +3 -0
  30. package/dist/Utils/createTuple.js +4 -0
  31. package/dist/Utils/ensureArray.d.ts +2 -0
  32. package/dist/Utils/ensureArray.js +3 -0
  33. package/dist/Utils/is.d.ts +3 -0
  34. package/dist/Utils/is.js +8 -0
  35. package/dist/Utils/registerComponent.d.ts +1 -0
  36. package/dist/Utils/registerComponent.js +4 -0
  37. package/dist/Utils/resolveSourcePath.d.ts +1 -0
  38. package/dist/Utils/resolveSourcePath.js +15 -0
  39. package/dist/Utils/uniqArray.d.ts +1 -0
  40. package/dist/Utils/uniqArray.js +3 -0
  41. package/dist/index.d.ts +18 -0
  42. package/dist/index.js +17 -0
  43. package/package.json +46 -0
@@ -0,0 +1,14 @@
1
+ import type { RspressPlugin } from '@rspress-theme-anatole/shared';
2
+ type PluginConfigMutatorInput = Parameters<NonNullable<RspressPlugin['config']>>[0];
3
+ export declare class PresetConfigMutator {
4
+ private readonly config;
5
+ private readonly utils?;
6
+ constructor(config: PluginConfigMutatorInput, utils?: {
7
+ addPlugin: (plugin: RspressPlugin) => void;
8
+ removePlugin: (pluginName: string) => void;
9
+ } | undefined);
10
+ toConfig(): PluginConfigMutatorInput;
11
+ addPlugins(...plugins: RspressPlugin[]): this;
12
+ disableMdxRs(): PresetConfigMutator;
13
+ }
14
+ export {};
@@ -0,0 +1,25 @@
1
+ export class PresetConfigMutator {
2
+ constructor(config, utils) {
3
+ this.config = config;
4
+ this.utils = utils;
5
+ }
6
+ toConfig() {
7
+ return this.config;
8
+ }
9
+ addPlugins(...plugins) {
10
+ if (!this.utils) {
11
+ throw new Error('PluginConfigUtils not provided.');
12
+ }
13
+ plugins.forEach((plugin) => {
14
+ this.utils.addPlugin(plugin);
15
+ });
16
+ return this;
17
+ }
18
+ disableMdxRs() {
19
+ var _a;
20
+ var _b;
21
+ (_a = (_b = this.config).markdown) !== null && _a !== void 0 ? _a : (_b.markdown = {});
22
+ this.config.markdown.mdxRs = false;
23
+ return this;
24
+ }
25
+ }
@@ -0,0 +1,41 @@
1
+ import { type RemarkPluginFactory } from '../Exports/Unist';
2
+ import type { Content } from 'mdast';
3
+ import type { VFile } from 'vfile';
4
+ import type { Dictionary, MaybeArray } from 'util-ts-types';
5
+ /**
6
+ * Directives can be transformed to:
7
+ *
8
+ * - MDAST Node, reference directive usually, like `:comment` referencing to JSDoc comment node.
9
+ * - Global component, like `:info` referencing to built-in `Info` component.
10
+ */
11
+ declare const directiveTypes: string[] & {
12
+ _type: "textComponent" | "containerComponent";
13
+ };
14
+ declare const directiveTransformerTypes: string[] & {
15
+ _type: "globalComponent" | "astNode";
16
+ };
17
+ export type DirectiveTypes = typeof directiveTypes._type;
18
+ export type DirectiveTransformerTypes = typeof directiveTransformerTypes._type;
19
+ type ParsedDirectiveMeta<Attrs = Dictionary<string>> = {
20
+ type: DirectiveTypes;
21
+ name: string;
22
+ attributes: Attrs;
23
+ };
24
+ type Directive2ComponentTransformer<DirectiveAttributes = Dictionary<string>, Ext = {}> = {
25
+ type: 'globalComponent';
26
+ getComponentName: (meta: ParsedDirectiveMeta<DirectiveAttributes>, vfile: VFile) => string;
27
+ getComponentProps?: (attributes: DirectiveAttributes, vfile: VFile) => Dictionary<string>;
28
+ getComponentChildren?: (meta: ParsedDirectiveMeta<DirectiveAttributes>, node: any, vfile: VFile) => string;
29
+ } & Ext;
30
+ type Directive2AstNodeTransformer<DirectiveAttributes = Dictionary<string>, Ext = {}> = {
31
+ type: 'astNode';
32
+ getContent: (meta: ParsedDirectiveMeta<DirectiveAttributes>, vfile: VFile) => Content[];
33
+ } & Ext;
34
+ export type RemarkDirectiveTransformer<DirectiveAttributes = Dictionary<string>, GlobalComponentExt = {}, ASTNodeExt = {}> = {
35
+ directive: string;
36
+ transformer: Directive2ComponentTransformer<DirectiveAttributes, GlobalComponentExt> | Directive2AstNodeTransformer<DirectiveAttributes, ASTNodeExt>;
37
+ };
38
+ export type RemarkTransformDirectiveOptions = MaybeArray<RemarkDirectiveTransformer>;
39
+ export declare const remarkTransformDirective: RemarkPluginFactory<RemarkTransformDirectiveOptions>;
40
+ export declare const remarkParseDirective: RemarkPluginFactory;
41
+ export {};
@@ -0,0 +1,86 @@
1
+ import _remarkParseDirective from 'remark-mdc';
2
+ import { toString } from 'mdast-util-to-string';
3
+ import { unistVisit } from '../Exports/Unist';
4
+ import { createTuple } from '../Utils/createTuple';
5
+ import { ensureArray } from '../Utils/ensureArray';
6
+ import { MdxAttrNodeFactory } from '../NodeFactory/MdxAttrNodeFactory';
7
+ /**
8
+ * Directives can be transformed to:
9
+ *
10
+ * - MDAST Node, reference directive usually, like `:comment` referencing to JSDoc comment node.
11
+ * - Global component, like `:info` referencing to built-in `Info` component.
12
+ */
13
+ const directiveTypes = createTuple('textComponent', 'containerComponent');
14
+ const directiveTransformerTypes = createTuple('globalComponent', 'astNode');
15
+ export const remarkTransformDirective = (options = []) => {
16
+ const directiveTransformers = ensureArray(options);
17
+ return (tree, vfile) => {
18
+ unistVisit(tree, (node, index = 0, parent) => {
19
+ if (!directiveTypes.includes(node.type)) {
20
+ return;
21
+ }
22
+ directiveTransformers.forEach((trdirectiveTransformeransformer) => {
23
+ var _a;
24
+ const { transformer, directive } = trdirectiveTransformeransformer;
25
+ if (node.name !== directive) {
26
+ return;
27
+ }
28
+ const meta = {
29
+ type: node.type,
30
+ name: node.name,
31
+ attributes: node.attributes,
32
+ };
33
+ const transformerType = transformer.type;
34
+ if (transformerType === 'astNode') {
35
+ const content = transformer.getContent(meta, vfile);
36
+ parent.children.splice(index, 1, ...content);
37
+ }
38
+ else if (transformerType === 'globalComponent') {
39
+ const attrsNormalizer = (_a = transformer === null || transformer === void 0 ? void 0 : transformer.getComponentProps) !== null && _a !== void 0 ? _a : MdxAttrNodeFactory.createMdxJsxAttributeNodes;
40
+ // parent.children.splice(index, 1, {
41
+ // type: 'mdxJsxFlowElement',
42
+ // name: transformer.getComponentName(meta, vfile),
43
+ // attributes: attrsNormalizer(meta.attributes, vfile),
44
+ // children: transformer.getComponentChildren
45
+ // ? [
46
+ // {
47
+ // type: 'text',
48
+ // value: transformer.getComponentChildren(meta, node, vfile),
49
+ // },
50
+ // ]
51
+ // : [
52
+ // {
53
+ // type: 'text',
54
+ // value: toString(node),
55
+ // },
56
+ // ],
57
+ // });
58
+
59
+ // Preserve markdown formatting by properly handling node children
60
+ const children = transformer.getComponentChildren
61
+ ? [{
62
+ type: 'paragraph',
63
+ children: [{
64
+ type: 'text',
65
+ value: transformer.getComponentChildren(meta, node, vfile),
66
+ }]
67
+ }]
68
+ : node.children || [{
69
+ type: 'text',
70
+ value: toString(node),
71
+ }];
72
+
73
+ parent.children.splice(index, 1, {
74
+ type: 'mdxJsxFlowElement',
75
+ name: transformer.getComponentName(meta, vfile),
76
+ attributes: attrsNormalizer(meta.attributes, vfile),
77
+ children: children,
78
+ });
79
+ }
80
+ else {
81
+ }
82
+ });
83
+ });
84
+ };
85
+ };
86
+ export const remarkParseDirective = _remarkParseDirective;
@@ -0,0 +1,14 @@
1
+ import type { Plugin } from 'unified';
2
+ import type { Root as MDASTRoot } from 'mdast';
3
+ import type { Root as HASTRoot } from 'hast';
4
+ export type RemarkPluginFactory<PluginOptions = unknown> = Plugin<[
5
+ PluginOptions
6
+ ], MDASTRoot>;
7
+ export type RehypePluginFactory<PluginOptions = unknown> = Plugin<[
8
+ PluginOptions
9
+ ], HASTRoot>;
10
+ export { visit as unistVisit } from 'unist-util-visit';
11
+ export { fromMarkdown as MDASTFromMarkdown } from 'mdast-util-from-markdown';
12
+ export { toMarkdown as MDASTToMarkdown } from 'mdast-util-to-markdown';
13
+ export { toString as MDASTToString } from 'mdast-util-to-string';
14
+ export type { Plugin, MDASTRoot, HASTRoot };
@@ -0,0 +1,4 @@
1
+ export { visit as unistVisit } from 'unist-util-visit';
2
+ export { fromMarkdown as MDASTFromMarkdown } from 'mdast-util-from-markdown';
3
+ export { toMarkdown as MDASTToMarkdown } from 'mdast-util-to-markdown';
4
+ export { toString as MDASTToString } from 'mdast-util-to-string';
@@ -0,0 +1,23 @@
1
+ import type { Dictionary } from 'util-ts-types';
2
+ import type { ObjectExpression, SimpleLiteral, ExpressionStatement, Program, Property, Statement, Identifier, ArrayExpression, ImportDeclaration, ModuleDeclaration } from 'estree-jsx';
3
+ import type { Primitive } from '../Shared';
4
+ export declare class ESTreeNodeFactory {
5
+ private static createNamedImportSpecifierNode;
6
+ private static createDefaultImportSpecifierNode;
7
+ static createNamedImportDeclarationNode(specifiers: string[], source: string): ImportDeclaration;
8
+ static createDefaultImportDeclarationNode(specifier: string, source: string): ImportDeclaration;
9
+ private static createBasePropertyNode;
10
+ static createIdentifierNode(name: string): Identifier;
11
+ static createLiteralNode(val: Primitive): SimpleLiteral;
12
+ static createObjectExpressionNode(val: Dictionary<any>): ObjectExpression;
13
+ static createArrayExpressionNode(val: Array<any>): ArrayExpression;
14
+ static createValueNode(input: Primitive): SimpleLiteral;
15
+ static createValueNode(input: Array<any>): ArrayExpression;
16
+ static createValueNode(input: Dictionary): ObjectExpression;
17
+ static createLiteralPropertyNode(key: string, val: Primitive): Property;
18
+ static createObjectPropertyNode(key: string, val: Dictionary): Property;
19
+ static createArrayPropertyNode(key: string, val: Array<any>): Property;
20
+ static createPropertyNode(key: string, val: Primitive | Array<any> | Dictionary): Property;
21
+ static createSpreadObjectExpressionNode(spread: Dictionary): ExpressionStatement;
22
+ static createESTreeProgramNode(statements: (Statement | ModuleDeclaration)[]): Program;
23
+ }
@@ -0,0 +1,126 @@
1
+ import { isObject } from '../Utils/is';
2
+ export class ESTreeNodeFactory {
3
+ static createNamedImportSpecifierNode(name) {
4
+ return {
5
+ type: 'ImportSpecifier',
6
+ imported: ESTreeNodeFactory.createIdentifierNode(name),
7
+ local: ESTreeNodeFactory.createIdentifierNode(name),
8
+ };
9
+ }
10
+ static createDefaultImportSpecifierNode(name) {
11
+ return {
12
+ type: 'ImportDefaultSpecifier',
13
+ local: ESTreeNodeFactory.createIdentifierNode(name),
14
+ };
15
+ }
16
+ static createNamedImportDeclarationNode(specifiers, source) {
17
+ return {
18
+ type: 'ImportDeclaration',
19
+ specifiers: specifiers.map((specifier) => ESTreeNodeFactory.createNamedImportSpecifierNode(specifier)),
20
+ source: ESTreeNodeFactory.createLiteralNode(source),
21
+ };
22
+ }
23
+ static createDefaultImportDeclarationNode(specifier, source) {
24
+ return {
25
+ type: 'ImportDeclaration',
26
+ specifiers: [
27
+ ESTreeNodeFactory.createDefaultImportSpecifierNode(specifier),
28
+ ],
29
+ source: ESTreeNodeFactory.createLiteralNode(source),
30
+ };
31
+ }
32
+ static createBasePropertyNode() {
33
+ return {
34
+ type: 'Property',
35
+ method: false,
36
+ shorthand: false,
37
+ computed: false,
38
+ kind: 'init',
39
+ };
40
+ }
41
+ static createIdentifierNode(name) {
42
+ return {
43
+ type: 'Identifier',
44
+ name,
45
+ };
46
+ }
47
+ static createLiteralNode(val) {
48
+ return {
49
+ type: 'Literal',
50
+ value: val !== null && val !== void 0 ? val : '',
51
+ raw: JSON.stringify(val),
52
+ };
53
+ }
54
+ static createObjectExpressionNode(val) {
55
+ return {
56
+ type: 'ObjectExpression',
57
+ properties: Object.entries(val).map(([k, v]) => ESTreeNodeFactory.createPropertyNode(k, v)),
58
+ };
59
+ }
60
+ static createArrayExpressionNode(val) {
61
+ return {
62
+ type: 'ArrayExpression',
63
+ elements: val.map((v) => ESTreeNodeFactory.createValueNode(v)),
64
+ };
65
+ }
66
+ static createValueNode(input) {
67
+ if (Array.isArray(input)) {
68
+ return ESTreeNodeFactory.createArrayExpressionNode(input);
69
+ }
70
+ if (isObject(input)) {
71
+ return ESTreeNodeFactory.createObjectExpressionNode(input);
72
+ }
73
+ return ESTreeNodeFactory.createLiteralNode(input);
74
+ }
75
+ static createLiteralPropertyNode(key, val) {
76
+ return {
77
+ ...ESTreeNodeFactory.createBasePropertyNode(),
78
+ key: ESTreeNodeFactory.createIdentifierNode(key),
79
+ value: ESTreeNodeFactory.createLiteralNode(val),
80
+ };
81
+ }
82
+ static createObjectPropertyNode(key, val) {
83
+ return {
84
+ ...ESTreeNodeFactory.createBasePropertyNode(),
85
+ key: ESTreeNodeFactory.createIdentifierNode(key),
86
+ value: ESTreeNodeFactory.createObjectExpressionNode(val),
87
+ };
88
+ }
89
+ static createArrayPropertyNode(key, val) {
90
+ return {
91
+ ...ESTreeNodeFactory.createBasePropertyNode(),
92
+ key: ESTreeNodeFactory.createIdentifierNode(key),
93
+ value: ESTreeNodeFactory.createArrayExpressionNode(val),
94
+ };
95
+ }
96
+ static createPropertyNode(key, val) {
97
+ if (Array.isArray(val)) {
98
+ return ESTreeNodeFactory.createArrayPropertyNode(key, val);
99
+ }
100
+ if (isObject(val)) {
101
+ return ESTreeNodeFactory.createObjectPropertyNode(key, val);
102
+ }
103
+ return ESTreeNodeFactory.createLiteralPropertyNode(key, val);
104
+ }
105
+ static createSpreadObjectExpressionNode(spread) {
106
+ return {
107
+ type: 'ExpressionStatement',
108
+ expression: {
109
+ type: 'ObjectExpression',
110
+ properties: [
111
+ {
112
+ type: 'SpreadElement',
113
+ argument: ESTreeNodeFactory.createObjectExpressionNode(spread),
114
+ },
115
+ ],
116
+ },
117
+ };
118
+ }
119
+ static createESTreeProgramNode(statements) {
120
+ return {
121
+ type: 'Program',
122
+ sourceType: 'module',
123
+ body: statements,
124
+ };
125
+ }
126
+ }
@@ -0,0 +1,31 @@
1
+ import { toString as mdastToString } from 'mdast-util-to-string';
2
+ import type { Root, Heading, Code, Paragraph, Link, Text, Table, Blockquote, ThematicBreak, Content } from 'mdast';
3
+ export type Depth = Heading['depth'];
4
+ export declare class MDASTNodeFactory {
5
+ static matchAllLinks(str: string): {
6
+ text: string;
7
+ url: string;
8
+ }[];
9
+ static createRoot(children: Content[]): Root;
10
+ static createAnyNodeParagraphNode(...contents: any): Paragraph;
11
+ static createLinkNode(text: string, url: string): Link;
12
+ static createHeadingNode(text: string, depth: Depth): Heading;
13
+ static createTextNode(text: string): Text;
14
+ static toString: typeof mdastToString;
15
+ static createTextChildren(text: string): Text[];
16
+ static createParagraphNode(text: string): Paragraph;
17
+ static createBlockquote(...contents: any[]): Blockquote;
18
+ static createThematicBreakNode(): ThematicBreak;
19
+ static createCodeBlockNode(input: {
20
+ lang: string;
21
+ value: string;
22
+ meta?: string | null;
23
+ data?: Record<string, unknown>;
24
+ }): Code;
25
+ static crateTableNode<T extends any = any>(source: T[], getter: {
26
+ [key: string]: (source: T) => string | {
27
+ text: string;
28
+ url: string;
29
+ } | Paragraph;
30
+ }): Table;
31
+ }
@@ -0,0 +1,113 @@
1
+ import { toString as mdastToString } from 'mdast-util-to-string';
2
+ export class MDASTNodeFactory {
3
+ static matchAllLinks(str) {
4
+ const regex = /\[(.*?)\]\((.*?)\)/g;
5
+ const matches = [...str.matchAll(regex)];
6
+ return matches.map((match) => {
7
+ return { text: match[1], url: match[2] };
8
+ });
9
+ }
10
+ static createRoot(children) {
11
+ return {
12
+ type: 'root',
13
+ children,
14
+ };
15
+ }
16
+ static createAnyNodeParagraphNode(...contents) {
17
+ const children = contents.map((content) => typeof content === 'string'
18
+ ? MDASTNodeFactory.createTextChildren(content)[0]
19
+ : content);
20
+ return {
21
+ type: 'paragraph',
22
+ children,
23
+ };
24
+ }
25
+ static createLinkNode(text, url) {
26
+ return {
27
+ type: 'link',
28
+ url,
29
+ children: MDASTNodeFactory.createTextChildren(text),
30
+ };
31
+ }
32
+ static createHeadingNode(text, depth) {
33
+ return {
34
+ type: 'heading',
35
+ depth,
36
+ children: MDASTNodeFactory.createTextChildren(text),
37
+ };
38
+ }
39
+ static createTextNode(text) {
40
+ return {
41
+ type: 'text',
42
+ value: text,
43
+ };
44
+ }
45
+ static createTextChildren(text) {
46
+ return [MDASTNodeFactory.createTextNode(text)];
47
+ }
48
+ static createParagraphNode(text) {
49
+ return {
50
+ type: 'paragraph',
51
+ children: MDASTNodeFactory.createTextChildren(text),
52
+ };
53
+ }
54
+ static createBlockquote(...contents) {
55
+ const children = contents.map((content) => typeof content === 'string'
56
+ ? MDASTNodeFactory.createParagraphNode(content)
57
+ : content);
58
+ return {
59
+ type: 'blockquote',
60
+ children,
61
+ };
62
+ }
63
+ static createThematicBreakNode() {
64
+ return {
65
+ type: 'thematicBreak',
66
+ };
67
+ }
68
+ static createCodeBlockNode(input) {
69
+ var _a;
70
+ return {
71
+ type: 'code',
72
+ lang: input.lang,
73
+ meta: input.meta,
74
+ value: input.value,
75
+ data: (_a = input.data) !== null && _a !== void 0 ? _a : {},
76
+ };
77
+ }
78
+ static crateTableNode(source, getter) {
79
+ const argTableFirstRow = {
80
+ type: 'tableRow',
81
+ children: Object.keys(getter).map((rowTitle) => {
82
+ return {
83
+ type: 'tableCell',
84
+ children: MDASTNodeFactory.createTextChildren(rowTitle),
85
+ };
86
+ }),
87
+ };
88
+ return {
89
+ type: 'table',
90
+ align: Object.keys(getter).map(() => 'center'),
91
+ children: [argTableFirstRow].concat(source.map((member) => {
92
+ return {
93
+ type: 'tableRow',
94
+ children: Object.keys(getter).map((rowTitle) => {
95
+ var _a;
96
+ const targetGetter = getter[rowTitle];
97
+ const value = (_a = targetGetter(member)) !== null && _a !== void 0 ? _a : '';
98
+ const node = typeof value === 'object'
99
+ ? 'url' in value
100
+ ? [MDASTNodeFactory.createLinkNode(value.text, value.url)]
101
+ : [value]
102
+ : MDASTNodeFactory.createTextChildren(value);
103
+ return {
104
+ type: 'tableCell',
105
+ children: node,
106
+ };
107
+ }),
108
+ };
109
+ })),
110
+ };
111
+ }
112
+ }
113
+ MDASTNodeFactory.toString = mdastToString;
@@ -0,0 +1,7 @@
1
+ import type { MdxJsxAttribute, MdxJsxExpressionAttribute } from 'mdast-util-mdx-jsx';
2
+ import type { Dictionary } from 'util-ts-types';
3
+ export declare class MdxAttrNodeFactory {
4
+ static createMdxJsxAttributeNodes(attributes: Dictionary<any>): (MdxJsxExpressionAttribute | MdxJsxAttribute)[];
5
+ static createMdxJsxLiteralAttributeNode(name: string, value: string | number | boolean): MdxJsxAttribute;
6
+ static createMdxJsxExpressionAttributeNode(name: string, value: Dictionary<any>): MdxJsxExpressionAttribute;
7
+ }
@@ -0,0 +1,35 @@
1
+ import { ESTreeNodeFactory } from './ESTreeNodeFactory';
2
+ import { isObject } from '../Utils/is';
3
+ export class MdxAttrNodeFactory {
4
+ static createMdxJsxAttributeNodes(attributes) {
5
+ var _a, _b;
6
+ const parsedAttrs = (_b = (_a = Object.entries(attributes)) === null || _a === void 0 ? void 0 : _a.filter(([_, v]) => typeof v !== 'undefined' && v !== null)) === null || _b === void 0 ? void 0 : _b.map(([key, val]) => {
7
+ return isObject(val) || Array.isArray(val)
8
+ ? MdxAttrNodeFactory.createMdxJsxExpressionAttributeNode(key, val)
9
+ : MdxAttrNodeFactory.createMdxJsxLiteralAttributeNode(key, val);
10
+ });
11
+ return parsedAttrs;
12
+ }
13
+ static createMdxJsxLiteralAttributeNode(name, value) {
14
+ return {
15
+ type: 'mdxJsxAttribute',
16
+ name,
17
+ value: value.toString(),
18
+ };
19
+ }
20
+ static createMdxJsxExpressionAttributeNode(name, value) {
21
+ return {
22
+ type: 'mdxJsxExpressionAttribute',
23
+ value: `{...${JSON.stringify({
24
+ [name]: value,
25
+ })}`,
26
+ data: {
27
+ estree: ESTreeNodeFactory.createESTreeProgramNode([
28
+ ESTreeNodeFactory.createSpreadObjectExpressionNode({
29
+ [name]: value,
30
+ }),
31
+ ]),
32
+ },
33
+ };
34
+ }
35
+ }
@@ -0,0 +1,13 @@
1
+ import type { Content } from 'mdast';
2
+ import type { Dictionary, MaybeArray } from 'util-ts-types';
3
+ import type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
4
+ import type { MdxjsEsm } from 'mdast-util-mdxjs-esm';
5
+ export interface ComponentRegistration<ComponentMetaProvider = any> {
6
+ componentName: string;
7
+ propsProvider?: (input: ComponentMetaProvider) => Dictionary<unknown>;
8
+ childrenProvider?: (input: ComponentMetaProvider) => Content[];
9
+ }
10
+ export declare class MdxJsxElementFactory {
11
+ static createMdxJsxImportStatementNode(spcifiers: MaybeArray<string>, source: string): MdxjsEsm;
12
+ static createMdxJsxFlowElementNode<ComponentMetaProvider>(meta: ComponentMetaProvider, component: string | ComponentRegistration<ComponentMetaProvider>): MdxJsxFlowElement;
13
+ }
@@ -0,0 +1,33 @@
1
+ import { ensureArray } from '../Utils/ensureArray';
2
+ import { ESTreeNodeFactory } from './ESTreeNodeFactory';
3
+ import { MdxAttrNodeFactory } from './MdxAttrNodeFactory';
4
+ export class MdxJsxElementFactory {
5
+ static createMdxJsxImportStatementNode(spcifiers, source) {
6
+ return {
7
+ type: 'mdxjsEsm',
8
+ value: Array.isArray(spcifiers)
9
+ ? `import { ${spcifiers.join(', ')} } from '${source}';`
10
+ : `import ${spcifiers} from '${source}';`,
11
+ data: {
12
+ estree: ESTreeNodeFactory.createESTreeProgramNode([
13
+ Array.isArray(spcifiers)
14
+ ? ESTreeNodeFactory.createNamedImportDeclarationNode(spcifiers, source)
15
+ : ESTreeNodeFactory.createDefaultImportDeclarationNode(spcifiers, source),
16
+ ]),
17
+ },
18
+ };
19
+ }
20
+ static createMdxJsxFlowElementNode(meta, component) {
21
+ var _a, _b, _c, _d;
22
+ const componentProvider = typeof component === 'string' ? { componentName: component } : component;
23
+ return {
24
+ type: 'mdxJsxFlowElement',
25
+ name: componentProvider.componentName,
26
+ // @ts-expect-error
27
+ children: meta
28
+ ? ensureArray((_b = (_a = componentProvider.childrenProvider) === null || _a === void 0 ? void 0 : _a.call(componentProvider, meta)) !== null && _b !== void 0 ? _b : [])
29
+ : [],
30
+ attributes: MdxAttrNodeFactory.createMdxJsxAttributeNodes(meta ? (_d = (_c = componentProvider.propsProvider) === null || _c === void 0 ? void 0 : _c.call(componentProvider, meta)) !== null && _d !== void 0 ? _d : {} : {}),
31
+ };
32
+ }
33
+ }
@@ -0,0 +1,15 @@
1
+ import { RemarkPluginFactoryBase, type ComponentRegistration } from './FactoryBase';
2
+ import type { Plugin } from 'unified';
3
+ import type { Root } from 'mdast';
4
+ interface ComponentTransform extends ComponentRegistration<string> {
5
+ lang: string;
6
+ }
7
+ interface Options {
8
+ components: ComponentTransform[];
9
+ }
10
+ export declare class RemarkCodeBlockToGlobalComponentPluginFactory extends RemarkPluginFactoryBase {
11
+ private readonly options;
12
+ constructor(options: Options);
13
+ get remarkPlugin(): Plugin<[unknown], Root>;
14
+ }
15
+ export {};
@@ -0,0 +1,29 @@
1
+ import { RemarkPluginFactoryBase, } from './FactoryBase';
2
+ import { unistVisit } from '../Exports/Unist';
3
+ import { MdxJsxElementFactory } from '../NodeFactory/MdxJsxElementFactory';
4
+ import { getComponentName } from '../Utils/registerComponent';
5
+ export class RemarkCodeBlockToGlobalComponentPluginFactory extends RemarkPluginFactoryBase {
6
+ constructor(options) {
7
+ super(options);
8
+ this.options = options;
9
+ }
10
+ get remarkPlugin() {
11
+ var _a, _b;
12
+ const components = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.components) !== null && _b !== void 0 ? _b : [];
13
+ return () => (tree, vfile) => {
14
+ unistVisit(tree, 'code', (code, index = 0, parent) => {
15
+ components.forEach(({ lang, componentPath, propsProvider, childrenProvider }) => {
16
+ if (code.lang === lang) {
17
+ parent.children.splice(index, 1,
18
+ // @ts-expect-error
19
+ MdxJsxElementFactory.createMdxJsxFlowElementNode(code.value, {
20
+ componentName: getComponentName(componentPath),
21
+ propsProvider,
22
+ childrenProvider,
23
+ }));
24
+ }
25
+ });
26
+ });
27
+ };
28
+ }
29
+ }
@@ -0,0 +1,18 @@
1
+ import type { RspressPlugin } from '@rspress-theme-anatole/shared';
2
+ import type { Content } from 'mdast';
3
+ import type { Dictionary } from 'util-ts-types';
4
+ type RsbuildConfig = NonNullable<RspressPlugin['builderConfig']>;
5
+ export interface ComponentRegistration<ComponentMetaProvider = void> {
6
+ componentPath: string;
7
+ propsProvider?: (input: ComponentMetaProvider) => Dictionary<any>;
8
+ childrenProvider?: (input: ComponentMetaProvider) => Content[];
9
+ }
10
+ export declare class RemarkPluginFactoryBase {
11
+ private readonly baseOptions;
12
+ constructor(baseOptions: {
13
+ components: ComponentRegistration<any>[];
14
+ });
15
+ get mdxComponents(): string[];
16
+ get builderConfig(): RsbuildConfig;
17
+ }
18
+ export {};
@@ -0,0 +1,23 @@
1
+ import { uniqArray } from '../Utils/uniqArray';
2
+ export class RemarkPluginFactoryBase {
3
+ constructor(baseOptions) {
4
+ this.baseOptions = baseOptions;
5
+ }
6
+ get mdxComponents() {
7
+ return uniqArray(this.baseOptions.components.map(({ componentPath }) => componentPath));
8
+ }
9
+ get builderConfig() {
10
+ return {
11
+ tools: {
12
+ bundlerChain(chain) {
13
+ chain.module
14
+ .rule('Raw')
15
+ .resourceQuery(/raw/)
16
+ .type('asset/source')
17
+ .end();
18
+ chain.resolve.extensions.prepend('.md').prepend('.mdx');
19
+ },
20
+ },
21
+ };
22
+ }
23
+ }
@@ -0,0 +1,16 @@
1
+ import { RemarkPluginFactoryBase, type ComponentRegistration } from './FactoryBase';
2
+ import type { Plugin } from 'unified';
3
+ import type { Root } from 'mdast';
4
+ type InsertPosition = 'pre' | 'post' | 'after-first-heading';
5
+ interface ComponentInsertDescriptor extends ComponentRegistration<void> {
6
+ position: InsertPosition;
7
+ }
8
+ interface Options {
9
+ components: ComponentInsertDescriptor[];
10
+ }
11
+ export declare class RemarkInsertComponentPluginFactory extends RemarkPluginFactoryBase {
12
+ readonly options: Options;
13
+ constructor(options: Options);
14
+ get remarkPlugin(): Plugin<[unknown], Root>;
15
+ }
16
+ export {};
@@ -0,0 +1,48 @@
1
+ import { MdxJsxElementFactory } from '../NodeFactory/MdxJsxElementFactory';
2
+ import { RemarkPluginFactoryBase, } from './FactoryBase';
3
+ import { getComponentName } from '../Utils/registerComponent';
4
+ export class RemarkInsertComponentPluginFactory extends RemarkPluginFactoryBase {
5
+ constructor(options) {
6
+ super(options);
7
+ this.options = options;
8
+ }
9
+ get remarkPlugin() {
10
+ var _a, _b;
11
+ const components = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.components) !== null && _b !== void 0 ? _b : [];
12
+ return () => (tree, vfile) => {
13
+ if (!(components === null || components === void 0 ? void 0 : components.length))
14
+ return;
15
+ function getInsertIndex(position) {
16
+ var _a;
17
+ if (!((_a = tree.children) === null || _a === void 0 ? void 0 : _a.length))
18
+ return 0;
19
+ switch (position) {
20
+ case 'pre':
21
+ return (
22
+ // @ts-expect-error
23
+ tree.children.findLastIndex((node) => node.type === 'mdxjsEsm') +
24
+ 1);
25
+ case 'post':
26
+ const beforeInsertCount = components.filter(({ position }) => position === 'pre' || position === 'after-first-heading').length;
27
+ const insertIndexAtPost = tree.children.length + beforeInsertCount;
28
+ return insertIndexAtPost;
29
+ case 'after-first-heading':
30
+ const firstHeadingIndex = tree.children.findIndex((node) => node.type === 'heading');
31
+ return firstHeadingIndex + 1;
32
+ default:
33
+ throw new Error(`Unknown insert position: ${position}`);
34
+ }
35
+ }
36
+ components.forEach(({ position, componentPath, propsProvider, childrenProvider }) => {
37
+ const insertIndex = getInsertIndex(position);
38
+ tree.children.splice(insertIndex, 0,
39
+ // @ts-expect-error
40
+ MdxJsxElementFactory.createMdxJsxFlowElementNode({}, {
41
+ componentName: getComponentName(componentPath),
42
+ propsProvider,
43
+ childrenProvider,
44
+ }));
45
+ });
46
+ };
47
+ }
48
+ }
@@ -0,0 +1,4 @@
1
+ export type PresetLocale = 'zh-CN' | 'en-US';
2
+ export interface WithDefaultLocale {
3
+ defaultLocale?: PresetLocale;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export type Primitive = string | number | boolean | null | undefined;
package/dist/Shared.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Project, InterfaceDeclaration, TypeAliasDeclaration } from 'ts-morph';
2
+ import { FunctionDeclaration, VariableStatement, SourceFile } from 'ts-morph';
3
+ export declare class TSParserUtils {
4
+ static ParserProject: Project;
5
+ static isFunctionDeclaration(input: FunctionDeclaration | VariableStatement): input is FunctionDeclaration;
6
+ static getFunctionDeclaration(source: SourceFile, name: string): FunctionDeclaration | VariableStatement | undefined;
7
+ static isInterfaceDeclaration(input: InterfaceDeclaration | TypeAliasDeclaration): input is InterfaceDeclaration;
8
+ static getTypingDeclaration(source: SourceFile, name: string): InterfaceDeclaration | TypeAliasDeclaration | undefined;
9
+ }
@@ -0,0 +1,16 @@
1
+ import { SyntaxKind, Project, } from 'ts-morph';
2
+ export class TSParserUtils {
3
+ static isFunctionDeclaration(input) {
4
+ return input.getKind() === SyntaxKind.FunctionDeclaration;
5
+ }
6
+ static getFunctionDeclaration(source, name) {
7
+ return source.getFunction(name) || source.getVariableStatement(name);
8
+ }
9
+ static isInterfaceDeclaration(input) {
10
+ return input.getKind() === SyntaxKind.InterfaceDeclaration;
11
+ }
12
+ static getTypingDeclaration(source, name) {
13
+ return source.getTypeAlias(name) || source.getInterface(name);
14
+ }
15
+ }
16
+ TSParserUtils.ParserProject = new Project();
@@ -0,0 +1,17 @@
1
+ import { Nullable } from 'util-ts-types';
2
+ export interface ParsedTypingDescriptionMember {
3
+ name: string;
4
+ description: string;
5
+ typingDescription: string;
6
+ default: Nullable<string>;
7
+ required: boolean;
8
+ }
9
+ export interface ParsedTypingDescription {
10
+ name: string;
11
+ members: ParsedTypingDescriptionMember[];
12
+ description: string;
13
+ }
14
+ export declare class TSSourceParser {
15
+ static parseTypingDeclaration(filePath: string, name: string): Nullable<ParsedTypingDescription>;
16
+ static findTargetExport(filePath: string, functionName: string): Nullable<string>;
17
+ }
@@ -0,0 +1,84 @@
1
+ import { SyntaxKind } from 'ts-morph';
2
+ import { TSParserUtils } from './ParserUtils.mjs';
3
+ export class TSSourceParser {
4
+ static parseTypingDeclaration(filePath, name) {
5
+ var _a, _b;
6
+ const source = TSParserUtils.ParserProject.addSourceFileAtPath(filePath);
7
+ const input = TSParserUtils.getTypingDeclaration(source, name);
8
+ if (!input)
9
+ return null;
10
+ const declarationName = input.getName();
11
+ const declarationDescription = (_b = (_a = input
12
+ .getJsDocs()[0]) === null || _a === void 0 ? void 0 : _a.getComment()) === null || _b === void 0 ? void 0 : _b.toString();
13
+ const parsedMembers = [];
14
+ input
15
+ .getType()
16
+ .getProperties()
17
+ .forEach((propertyKey) => {
18
+ var _a;
19
+ const property = propertyKey
20
+ .getValueDeclarationOrThrow()
21
+ .asKind(SyntaxKind.PropertySignature);
22
+ const memberName = propertyKey.getName();
23
+ const memberType = property === null || property === void 0 ? void 0 : property.getType().getText();
24
+ const memberRequired = !property.hasQuestionToken();
25
+ const memberJSDocComment = property.getJsDocs()[0];
26
+ if (!memberJSDocComment) {
27
+ parsedMembers.push({
28
+ name: memberName,
29
+ typingDescription: memberType,
30
+ required: memberRequired,
31
+ description: '',
32
+ default: null,
33
+ });
34
+ return;
35
+ }
36
+ const memberDescription = memberJSDocComment.getCommentText();
37
+ const memberDefault = (_a = memberJSDocComment
38
+ .getTags()
39
+ .find((tag) => tag.getTagName() === 'default')) === null || _a === void 0 ? void 0 : _a.getCommentText();
40
+ parsedMembers.push({
41
+ name: memberName,
42
+ description: memberDescription || '',
43
+ typingDescription: memberType,
44
+ default: memberDefault || null,
45
+ required: memberRequired,
46
+ });
47
+ });
48
+ TSParserUtils.ParserProject.removeSourceFile(source);
49
+ return {
50
+ name: declarationName,
51
+ description: declarationDescription || '',
52
+ members: parsedMembers,
53
+ };
54
+ }
55
+ static findTargetExport(filePath, functionName) {
56
+ var _a, _b;
57
+ const source = TSParserUtils.ParserProject.addSourceFileAtPath(filePath);
58
+ const allExports = source.getStatements();
59
+ const targetExport = allExports.find((statement) => {
60
+ var _a, _b, _c;
61
+ const kind = statement.getKind();
62
+ if (kind === SyntaxKind.FunctionDeclaration) {
63
+ const currentFunctionName = (_a = statement
64
+ .asKind(SyntaxKind.FunctionDeclaration)) === null || _a === void 0 ? void 0 : _a.getName();
65
+ return currentFunctionName && currentFunctionName === functionName;
66
+ }
67
+ if (kind === SyntaxKind.VariableStatement) {
68
+ const declaration = (_b = statement
69
+ .asKind(SyntaxKind.VariableStatement)) === null || _b === void 0 ? void 0 : _b.getDeclarations()[0];
70
+ const isArrowFunc = ((_c = declaration === null || declaration === void 0 ? void 0 : declaration.getInitializer()) === null || _c === void 0 ? void 0 : _c.getKind()) === SyntaxKind.ArrowFunction;
71
+ if (!isArrowFunc)
72
+ return false;
73
+ const currentFunctionName = declaration === null || declaration === void 0 ? void 0 : declaration.getName();
74
+ return currentFunctionName && currentFunctionName === functionName;
75
+ }
76
+ });
77
+ if (!targetExport)
78
+ return null;
79
+ const jsdocContent = (_b = (_a = targetExport
80
+ .asKind(SyntaxKind.VariableStatement)) === null || _a === void 0 ? void 0 : _a.getJsDocs()[0]) === null || _b === void 0 ? void 0 : _b.getText();
81
+ TSParserUtils.ParserProject.removeSourceFile(source);
82
+ return `${jsdocContent}\n${targetExport.getText()}`;
83
+ }
84
+ }
@@ -0,0 +1,3 @@
1
+ export declare const createTuple: <const T extends string>(...input: T[]) => string[] & {
2
+ _type: T;
3
+ };
@@ -0,0 +1,4 @@
1
+ export const createTuple = (...input) => {
2
+ // @ts-expect-error
3
+ return input;
4
+ };
@@ -0,0 +1,2 @@
1
+ import type { MaybeArray } from 'util-ts-types';
2
+ export declare const ensureArray: <T>(val: MaybeArray<T>) => T[];
@@ -0,0 +1,3 @@
1
+ export const ensureArray = (val) => {
2
+ return Array.isArray(val) ? val : [val];
3
+ };
@@ -0,0 +1,3 @@
1
+ import { Dictionary } from 'util-ts-types';
2
+ export declare function isObject(value: unknown): value is Dictionary;
3
+ export declare function isPrimitive(value: unknown): value is string | number | boolean;
@@ -0,0 +1,8 @@
1
+ export function isObject(value) {
2
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
3
+ }
4
+ export function isPrimitive(value) {
5
+ return (typeof value === 'string' ||
6
+ typeof value === 'number' ||
7
+ typeof value === 'boolean');
8
+ }
@@ -0,0 +1 @@
1
+ export declare function getComponentName(componentPath: string): string;
@@ -0,0 +1,4 @@
1
+ import path from 'path';
2
+ export function getComponentName(componentPath) {
3
+ return path.basename(componentPath, '.tsx');
4
+ }
@@ -0,0 +1 @@
1
+ export declare function resolveSourcePath(inputSourcePath: string, currentFilePath: string): string;
@@ -0,0 +1,15 @@
1
+ import path from 'path';
2
+ export function resolveSourcePath(inputSourcePath, currentFilePath) {
3
+ // source=src/... → resolve from workspace root
4
+ // source=./src/... → resolve from current file
5
+ // source=/src/... → check is already absolute path, if not, resolve from workspace root
6
+ if (inputSourcePath.startsWith('/')) {
7
+ return path.isAbsolute(inputSourcePath)
8
+ ? inputSourcePath
9
+ : path.resolve(inputSourcePath);
10
+ }
11
+ if (inputSourcePath.startsWith('.')) {
12
+ return path.resolve(path.dirname(currentFilePath), inputSourcePath);
13
+ }
14
+ return path.resolve(inputSourcePath);
15
+ }
@@ -0,0 +1 @@
1
+ export declare function uniqArray<T>(arr: T[]): T[];
@@ -0,0 +1,3 @@
1
+ export function uniqArray(arr) {
2
+ return Array.from(new Set(arr));
3
+ }
@@ -0,0 +1,18 @@
1
+ export { RemarkCodeBlockToGlobalComponentPluginFactory } from './RemarkPluginFactory/CodeBlock2GlobalComponent';
2
+ export { RemarkInsertComponentPluginFactory } from './RemarkPluginFactory/InsertComponent';
3
+ export { PresetConfigMutator } from './ConfigMutator/index';
4
+ export type * from 'util-ts-types';
5
+ export * from './Exports/Unist';
6
+ export { type DirectiveTypes, type DirectiveTransformerTypes, type RemarkDirectiveTransformer, type RemarkTransformDirectiveOptions, remarkTransformDirective, remarkParseDirective, } from './DirectivesTransformer';
7
+ export { MDASTNodeFactory } from './NodeFactory/MdAstNodeFactory';
8
+ export { ESTreeNodeFactory } from './NodeFactory/ESTreeNodeFactory';
9
+ export { MdxAttrNodeFactory } from './NodeFactory/MdxAttrNodeFactory';
10
+ export { MdxJsxElementFactory } from './NodeFactory/MdxJsxElementFactory';
11
+ export { TSSourceParser } from './SourceParser/TS.mjs';
12
+ export { createTuple } from './Utils/createTuple';
13
+ export { ensureArray } from './Utils/ensureArray';
14
+ export { uniqArray } from './Utils/uniqArray';
15
+ export { resolveSourcePath } from './Utils//resolveSourcePath';
16
+ export * from './Utils/registerComponent';
17
+ export * from './Utils/is';
18
+ export * from './Shared/SharedPluginOptions';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ export { RemarkCodeBlockToGlobalComponentPluginFactory } from './RemarkPluginFactory/CodeBlock2GlobalComponent';
2
+ export { RemarkInsertComponentPluginFactory } from './RemarkPluginFactory/InsertComponent';
3
+ export { PresetConfigMutator } from './ConfigMutator/index';
4
+ export * from './Exports/Unist';
5
+ export { remarkTransformDirective, remarkParseDirective, } from './DirectivesTransformer';
6
+ export { MDASTNodeFactory } from './NodeFactory/MdAstNodeFactory';
7
+ export { ESTreeNodeFactory } from './NodeFactory/ESTreeNodeFactory';
8
+ export { MdxAttrNodeFactory } from './NodeFactory/MdxAttrNodeFactory';
9
+ export { MdxJsxElementFactory } from './NodeFactory/MdxJsxElementFactory';
10
+ export { TSSourceParser } from './SourceParser/TS.mjs';
11
+ export { createTuple } from './Utils/createTuple';
12
+ export { ensureArray } from './Utils/ensureArray';
13
+ export { uniqArray } from './Utils/uniqArray';
14
+ export { resolveSourcePath } from './Utils//resolveSourcePath';
15
+ export * from './Utils/registerComponent';
16
+ export * from './Utils/is';
17
+ export * from './Shared/SharedPluginOptions';
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@rspress-theme-anatole/rspress-plugin-devkit",
3
+ "version": "0.0.1",
4
+ "files": [
5
+ "dist"
6
+ ],
7
+ "keywords": [
8
+ "rspress",
9
+ "plugin",
10
+ "devkit"
11
+ ],
12
+ "license": "MIT",
13
+ "main": "dist/index.js",
14
+ "types": "dist/index.d.ts",
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "dependencies": {
19
+ "@rspress-theme-anatole/shared": "0.1.18",
20
+ "@types/estree-jsx": "^1.0.5",
21
+ "@types/hast": "^2.3.4",
22
+ "@types/mdast": "^3.0.15",
23
+ "@types/node": "^20.12.5",
24
+ "clsx": "^2.1.0",
25
+ "lodash-es": "^4.17.21",
26
+ "mdast-util-from-markdown": "^1.3.1",
27
+ "mdast-util-mdx-jsx": "^3.1.2",
28
+ "mdast-util-mdxjs-esm": "^2.0.1",
29
+ "mdast-util-to-markdown": "^1.5.0",
30
+ "mdast-util-to-string": "^4.0.0",
31
+ "remark-mdc": "1.2.0",
32
+ "ts-morph": "^22.0.0",
33
+ "unified": "^10.1.2",
34
+ "unist-util-visit": "^5.0.0",
35
+ "unist-util-visit-parents": "^6.0.1",
36
+ "util-ts-types": "^1.0.0",
37
+ "vfile": "^5.3.7",
38
+ "vfile-reporter": "^7.0.5"
39
+ },
40
+ "devDependencies": {
41
+ "@types/lodash-es": "^4.17.12"
42
+ },
43
+ "peerDependencies": {
44
+ "rspress": "*"
45
+ }
46
+ }