dumi 2.4.28 → 2.4.29

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 (172) hide show
  1. package/compiled/@umijs/plugins/index.js +1 -1
  2. package/compiled/@umijs/plugins/package.json +1 -1
  3. package/compiled/crates/swc_plugin_react_demo.wasm +0 -0
  4. package/dist/client/misc/reactDemoCompiler.js +2 -2
  5. package/dist/client/theme-api/AtomRenderer.js +6 -6
  6. package/dist/client/theme-api/DumiDemo/index.js +1 -1
  7. package/dist/client/theme-api/DumiDemoGrid.js +1 -1
  8. package/dist/client/theme-api/DumiPage.js +1 -1
  9. package/dist/client/theme-api/openCodeSandbox.js +1 -1
  10. package/dist/client/theme-api/openStackBlitz.js +1 -1
  11. package/dist/client/theme-api/useLiveDemo.js +4 -4
  12. package/dist/client/theme-api/useLocale.js +1 -1
  13. package/dist/client/theme-api/useNavData.js +6 -6
  14. package/dist/client/theme-api/usePrefersColor.js +4 -4
  15. package/dist/client/theme-api/useRenderer.js +6 -6
  16. package/dist/client/theme-api/useRouteMeta.js +2 -2
  17. package/dist/client/theme-api/useSidebarData.js +7 -7
  18. package/dist/client/theme-api/useSiteSearch/index.js +1 -1
  19. package/dist/client/theme-api/useSiteSearch/useSearchData.js +7 -7
  20. package/dist/client/theme-api/useTabMeta.js +2 -2
  21. package/dist/client/theme-api/utils.js +4 -4
  22. package/dist/loaders/markdown/index.js +19 -11
  23. package/dist/templates/meta/index.ts.tpl +4 -2
  24. package/package.json +8 -8
  25. package/theme-default/builtins/API/index.js +8 -8
  26. package/theme-default/builtins/CodeGroup/index.js +1 -1
  27. package/theme-default/builtins/Container/index.js +1 -1
  28. package/theme-default/builtins/Previewer/index.js +1 -1
  29. package/theme-default/builtins/SourceCode/index.js +1 -1
  30. package/theme-default/builtins/Table/index.js +1 -1
  31. package/theme-default/builtins/Tree/index.js +7 -7
  32. package/theme-default/layouts/DocLayout/index.js +1 -1
  33. package/theme-default/slots/ColorSwitch/index.js +1 -1
  34. package/theme-default/slots/ContentFooter/index.js +1 -1
  35. package/theme-default/slots/Header/index.js +1 -1
  36. package/theme-default/slots/LangSwitch/index.js +1 -1
  37. package/theme-default/slots/Navbar/index.js +1 -1
  38. package/theme-default/slots/PreviewerActions/index.js +6 -6
  39. package/theme-default/slots/RtlSwitch/index.js +1 -1
  40. package/theme-default/slots/SearchBar/Mask.js +1 -1
  41. package/theme-default/slots/SearchBar/index.js +2 -2
  42. package/theme-default/slots/SearchResult/index.js +3 -3
  43. package/theme-default/slots/SourceCodeEditor/index.js +3 -3
  44. package/theme-default/slots/Toc/index.js +1 -1
  45. package/dist/assetParsers/BaseParser.d.ts +0 -55
  46. package/dist/assetParsers/atom.d.ts +0 -21
  47. package/dist/assetParsers/block.d.ts +0 -25
  48. package/dist/assetParsers/utils.d.ts +0 -79
  49. package/dist/cli.d.ts +0 -1
  50. package/dist/client/misc/reactDemoCompiler.d.ts +0 -3
  51. package/dist/client/pages/404.d.ts +0 -1
  52. package/dist/client/pages/Demo/index.d.ts +0 -4
  53. package/dist/client/pages/Loading.d.ts +0 -1
  54. package/dist/client/theme-api/AtomRenderer.d.ts +0 -13
  55. package/dist/client/theme-api/DumiDemo/DemoErrorBoundary.d.ts +0 -5
  56. package/dist/client/theme-api/DumiDemo/index.d.ts +0 -10
  57. package/dist/client/theme-api/DumiDemoGrid.d.ts +0 -7
  58. package/dist/client/theme-api/DumiPage.d.ts +0 -4
  59. package/dist/client/theme-api/context.d.ts +0 -22
  60. package/dist/client/theme-api/index.d.ts +0 -18
  61. package/dist/client/theme-api/openCodeSandbox.d.ts +0 -9
  62. package/dist/client/theme-api/openStackBlitz.d.ts +0 -1
  63. package/dist/client/theme-api/types.d.ts +0 -258
  64. package/dist/client/theme-api/useAtomAssets.d.ts +0 -4
  65. package/dist/client/theme-api/useLiveDemo.d.ts +0 -10
  66. package/dist/client/theme-api/useLocale.d.ts +0 -2
  67. package/dist/client/theme-api/useNavData.d.ts +0 -5
  68. package/dist/client/theme-api/usePrefersColor.d.ts +0 -7
  69. package/dist/client/theme-api/useRenderer.d.ts +0 -12
  70. package/dist/client/theme-api/useRouteMeta.d.ts +0 -17
  71. package/dist/client/theme-api/useSidebarData.d.ts +0 -29
  72. package/dist/client/theme-api/useSiteSearch/index.d.ts +0 -24
  73. package/dist/client/theme-api/useSiteSearch/useSearchData.d.ts +0 -12
  74. package/dist/client/theme-api/useTabMeta.d.ts +0 -4
  75. package/dist/client/theme-api/utils.d.ts +0 -31
  76. package/dist/constants.d.ts +0 -23
  77. package/dist/features/assets.d.ts +0 -20
  78. package/dist/features/autoAlias.d.ts +0 -3
  79. package/dist/features/compile/babelLoaderCustomize.d.ts +0 -4
  80. package/dist/features/compile/index.d.ts +0 -4
  81. package/dist/features/compile/makoHooks.d.ts +0 -8
  82. package/dist/features/compile/utils.d.ts +0 -2
  83. package/dist/features/compile/utoopackLoaders.d.ts +0 -8
  84. package/dist/features/configPlugins/index.d.ts +0 -3
  85. package/dist/features/configPlugins/schema.d.ts +0 -4
  86. package/dist/features/derivative.d.ts +0 -11
  87. package/dist/features/exportStatic.d.ts +0 -3
  88. package/dist/features/exports.d.ts +0 -3
  89. package/dist/features/html2sketch.d.ts +0 -3
  90. package/dist/features/locales.d.ts +0 -3
  91. package/dist/features/meta.d.ts +0 -5
  92. package/dist/features/parser.d.ts +0 -3
  93. package/dist/features/routes.d.ts +0 -3
  94. package/dist/features/sideEffects/docSideEffectsWebpackPlugin.d.ts +0 -14
  95. package/dist/features/sideEffects/index.d.ts +0 -7
  96. package/dist/features/sitemap.d.ts +0 -3
  97. package/dist/features/tabs.d.ts +0 -17
  98. package/dist/features/theme/index.d.ts +0 -3
  99. package/dist/features/theme/loader.d.ts +0 -55
  100. package/dist/index.d.ts +0 -6
  101. package/dist/loaders/demo/index.d.ts +0 -6
  102. package/dist/loaders/markdown/index.d.ts +0 -27
  103. package/dist/loaders/markdown/transformer/index.d.ts +0 -69
  104. package/dist/loaders/markdown/transformer/rehypeDemo.d.ts +0 -15
  105. package/dist/loaders/markdown/transformer/rehypeDesc.d.ts +0 -6
  106. package/dist/loaders/markdown/transformer/rehypeEnhancedTag.d.ts +0 -3
  107. package/dist/loaders/markdown/transformer/rehypeHighlightLine.d.ts +0 -4
  108. package/dist/loaders/markdown/transformer/rehypeImg.d.ts +0 -6
  109. package/dist/loaders/markdown/transformer/rehypeIsolation.d.ts +0 -7
  110. package/dist/loaders/markdown/transformer/rehypeJsxify.d.ts +0 -2
  111. package/dist/loaders/markdown/transformer/rehypeLink.d.ts +0 -6
  112. package/dist/loaders/markdown/transformer/rehypeRaw.d.ts +0 -6
  113. package/dist/loaders/markdown/transformer/rehypeSlug.d.ts +0 -4
  114. package/dist/loaders/markdown/transformer/rehypeStrip.d.ts +0 -3
  115. package/dist/loaders/markdown/transformer/rehypeText.d.ts +0 -4
  116. package/dist/loaders/markdown/transformer/remarkBreaks.d.ts +0 -3
  117. package/dist/loaders/markdown/transformer/remarkContainer.d.ts +0 -3
  118. package/dist/loaders/markdown/transformer/remarkEmbed.d.ts +0 -4
  119. package/dist/loaders/markdown/transformer/remarkMeta.d.ts +0 -8
  120. package/dist/loaders/null/index.d.ts +0 -2
  121. package/dist/loaders/page/index.d.ts +0 -1
  122. package/dist/loaders/post-raw/index.d.ts +0 -4
  123. package/dist/loaders/pre-raw/index.d.ts +0 -4
  124. package/dist/preset.d.ts +0 -5
  125. package/dist/registerMethods.d.ts +0 -3
  126. package/dist/service/cli.d.ts +0 -5
  127. package/dist/service/constants.d.ts +0 -4
  128. package/dist/service/dev.d.ts +0 -1
  129. package/dist/service/forkedDev.d.ts +0 -1
  130. package/dist/service/printHelp.d.ts +0 -1
  131. package/dist/service/service.d.ts +0 -13
  132. package/dist/techStacks/react.d.ts +0 -7
  133. package/dist/techStacks/utils.d.ts +0 -40
  134. package/dist/types.d.ts +0 -159
  135. package/dist/utils.d.ts +0 -67
  136. package/theme-default/builtins/API/index.d.ts +0 -7
  137. package/theme-default/builtins/Badge/index.d.ts +0 -7
  138. package/theme-default/builtins/CodeGroup/index.d.ts +0 -3
  139. package/theme-default/builtins/Container/index.d.ts +0 -8
  140. package/theme-default/builtins/Previewer/index.d.ts +0 -5
  141. package/theme-default/builtins/SourceCode/index.d.ts +0 -14
  142. package/theme-default/builtins/Table/index.d.ts +0 -6
  143. package/theme-default/builtins/Tree/index.d.ts +0 -5
  144. package/theme-default/layouts/DocLayout/index.d.ts +0 -4
  145. package/theme-default/slots/ColorSwitch/index.d.ts +0 -4
  146. package/theme-default/slots/Content/index.d.ts +0 -7
  147. package/theme-default/slots/ContentFooter/index.d.ts +0 -4
  148. package/theme-default/slots/ContentTabs/index.d.ts +0 -11
  149. package/theme-default/slots/Features/index.d.ts +0 -4
  150. package/theme-default/slots/Footer/index.d.ts +0 -4
  151. package/theme-default/slots/Header/index.d.ts +0 -4
  152. package/theme-default/slots/HeaderExtra/index.d.ts +0 -3
  153. package/theme-default/slots/Hero/index.d.ts +0 -4
  154. package/theme-default/slots/HeroTitle/index.d.ts +0 -6
  155. package/theme-default/slots/LangSwitch/index.d.ts +0 -4
  156. package/theme-default/slots/Loading/index.d.ts +0 -5
  157. package/theme-default/slots/Logo/index.d.ts +0 -4
  158. package/theme-default/slots/Navbar/index.d.ts +0 -4
  159. package/theme-default/slots/NavbarExtra/index.d.ts +0 -3
  160. package/theme-default/slots/NotFound/index.d.ts +0 -4
  161. package/theme-default/slots/PreviewerActions/index.d.ts +0 -27
  162. package/theme-default/slots/PreviewerActionsExtra/index.d.ts +0 -4
  163. package/theme-default/slots/RtlSwitch/index.d.ts +0 -4
  164. package/theme-default/slots/SearchBar/Input.d.ts +0 -6
  165. package/theme-default/slots/SearchBar/Mask.d.ts +0 -9
  166. package/theme-default/slots/SearchBar/index.d.ts +0 -6
  167. package/theme-default/slots/SearchResult/index.d.ts +0 -10
  168. package/theme-default/slots/Sidebar/index.d.ts +0 -4
  169. package/theme-default/slots/SocialIcon/index.d.ts +0 -13
  170. package/theme-default/slots/SourceCodeEditor/index.d.ts +0 -19
  171. package/theme-default/slots/Tabs/index.d.ts +0 -6
  172. package/theme-default/slots/Toc/index.d.ts +0 -4
@@ -1,55 +0,0 @@
1
- export interface IThemeComponent {
2
- specifier: string;
3
- source: string;
4
- }
5
- export interface IThemeLoadResult {
6
- /**
7
- * theme package name
8
- */
9
- name: string;
10
- /**
11
- * theme package path
12
- */
13
- path: string;
14
- /**
15
- * locale text data
16
- */
17
- locales: {
18
- [key: string]: Record<string, string>;
19
- };
20
- /**
21
- * builtin components
22
- */
23
- builtins: {
24
- [key: string]: IThemeComponent;
25
- };
26
- /**
27
- * slots components
28
- */
29
- slots: {
30
- [key: string]: IThemeComponent;
31
- };
32
- /**
33
- * layout components
34
- */
35
- layouts: {
36
- /**
37
- * apply for all routes
38
- */
39
- GlobalLayout?: IThemeComponent;
40
- /**
41
- * apply for doc routes
42
- */
43
- DocLayout?: IThemeComponent;
44
- /**
45
- * apply for demo routes /~demos/:id
46
- */
47
- DemoLayout?: IThemeComponent;
48
- } & Record<string, IThemeComponent>;
49
- /**
50
- * theme plugin path
51
- */
52
- plugin?: string;
53
- }
54
- declare const _default: (dir: string) => IThemeLoadResult;
55
- export default _default;
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { IDumiTechStack, IDumiTechStackRuntimeOpts, IDumiUserConfig } from "./types";
2
- declare let unistUtilVisit: typeof import('unist-util-visit');
3
- export * from 'umi';
4
- export { getProjectRoot } from './utils';
5
- export { unistUtilVisit, IDumiTechStack, IDumiTechStackRuntimeOpts };
6
- export declare const defineConfig: (config: IDumiUserConfig) => IDumiUserConfig;
@@ -1,6 +0,0 @@
1
- import type { IDumiTechStack } from "../../types";
2
- export interface IDemoLoaderOptions {
3
- techStacks: IDumiTechStack[];
4
- cwd: string;
5
- }
6
- export default function demoLoader(this: any, raw: string): string;
@@ -1,27 +0,0 @@
1
- import type { IThemeLoadResult } from "../../features/theme/loader";
2
- import { type IMdTransformerOptions, type IMdTransformerResult } from './transformer';
3
- interface IMdLoaderDefaultModeOptions extends Omit<IMdTransformerOptions, 'fileAbsPath'> {
4
- mode?: 'markdown';
5
- builtins: IThemeLoadResult['builtins'];
6
- onResolveDemos?: (demos: NonNullable<IMdTransformerResult['meta']['demos']>) => void;
7
- onResolveAtomMeta?: (atomId: string, meta: IMdTransformerResult['meta']['frontmatter']) => void;
8
- disableLiveDemo: boolean;
9
- }
10
- interface IMdLoaderDemosModeOptions extends Omit<IMdLoaderDefaultModeOptions, 'builtins' | 'mode'> {
11
- mode: 'meta';
12
- }
13
- interface IMdLoaderDemoModeOptions extends Omit<IMdLoaderDefaultModeOptions, 'builtins' | 'mode'> {
14
- mode: 'demo';
15
- }
16
- interface IMdLoaderDemoIndexModeOptions extends Omit<IMdLoaderDefaultModeOptions, 'builtins' | 'mode'> {
17
- mode: 'demo-index';
18
- }
19
- interface IMdLoaderFrontmatterModeOptions extends Omit<IMdLoaderDefaultModeOptions, 'builtins' | 'mode'> {
20
- mode: 'frontmatter';
21
- }
22
- interface IMdLoaderTextModeOptions extends Omit<IMdLoaderDefaultModeOptions, 'builtins' | 'mode'> {
23
- mode: 'text';
24
- }
25
- export type IMdLoaderOptions = IMdLoaderDefaultModeOptions | IMdLoaderDemosModeOptions | IMdLoaderDemoModeOptions | IMdLoaderFrontmatterModeOptions | IMdLoaderTextModeOptions | IMdLoaderDemoIndexModeOptions;
26
- export default function mdLoader(this: any, content: string): void;
27
- export {};
@@ -1,69 +0,0 @@
1
- import type { IParsedBlockAsset } from "../../../assetParsers/block";
2
- import type { ILocalesConfig, IRouteMeta } from "../../../client/theme-api/types";
3
- import type { IApi, IDumiConfig, IDumiTechStack } from "../../../types";
4
- import { type ResolveOptions } from 'enhanced-resolve';
5
- import type { IRoute } from 'umi';
6
- import type { Data } from 'vfile';
7
- declare module 'hast' {
8
- interface Element {
9
- JSXAttributes?: Array<{
10
- type: 'JSXAttribute';
11
- name: string;
12
- value: string;
13
- } | {
14
- type: 'JSXSpreadAttribute';
15
- argument: string;
16
- }>;
17
- }
18
- }
19
- declare module 'vfile' {
20
- interface DataMap {
21
- demos: ({
22
- id: string;
23
- component: string;
24
- asset: IParsedBlockAsset['asset'];
25
- resolveMap: IParsedBlockAsset['resolveMap'];
26
- renderOpts: {
27
- type?: string;
28
- rendererPath?: string;
29
- preflightPath?: string;
30
- compilePath?: string;
31
- };
32
- } | {
33
- id: string;
34
- component: string;
35
- renderOpts: {
36
- type?: string;
37
- rendererPath?: string;
38
- preflightPath?: string;
39
- compilePath?: string;
40
- };
41
- })[];
42
- texts: IRouteMeta['texts'];
43
- frontmatter: IRouteMeta['frontmatter'];
44
- toc: IRouteMeta['toc'];
45
- embeds: string[];
46
- }
47
- }
48
- export interface IMdTransformerOptions {
49
- cwd: string;
50
- fileAbsPath: string;
51
- alias: ResolveOptions['alias'];
52
- parentAbsPath?: string;
53
- techStacks: IDumiTechStack[];
54
- resolve: IDumiConfig['resolve'];
55
- extraRemarkPlugins?: IDumiConfig['extraRemarkPlugins'];
56
- extraRehypePlugins?: IDumiConfig['extraRehypePlugins'];
57
- routes: Record<string, IRoute>;
58
- locales: ILocalesConfig;
59
- pkg: IApi['pkg'];
60
- }
61
- export interface IMdTransformerResult {
62
- content: string;
63
- meta: Data;
64
- }
65
- declare const _default: (raw: string, opts: IMdTransformerOptions) => Promise<{
66
- content: string;
67
- meta: Data;
68
- }>;
69
- export default _default;
@@ -1,15 +0,0 @@
1
- import type { sync } from 'enhanced-resolve';
2
- import type { Root } from 'hast';
3
- import type { Transformer } from 'unified';
4
- import type { IMdTransformerOptions } from '.';
5
- export declare const DEMO_PROP_VALUE_KEY = "$demo-prop-value-key";
6
- export declare const DUMI_DEMO_TAG = "DumiDemo";
7
- export declare const DUMI_DEMO_GRID_TAG = "DumiDemoGrid";
8
- export declare const SKIP_DEMO_PARSE = "pure";
9
- type IRehypeDemoOptions = Pick<IMdTransformerOptions, 'techStacks' | 'cwd' | 'fileAbsPath' | 'resolve'> & {
10
- resolver: typeof sync;
11
- fileLocaleLessPath: string;
12
- fileLocale?: string;
13
- };
14
- export default function rehypeDemo(opts: IRehypeDemoOptions): Transformer<Root>;
15
- export {};
@@ -1,6 +0,0 @@
1
- import type { Root } from 'hast';
2
- import type { Transformer } from 'unified';
3
- /**
4
- * rehype plugin for extract fallback description from markdown content
5
- */
6
- export default function rehypeDesc(): Transformer<Root>;
@@ -1,3 +0,0 @@
1
- import type { Root } from 'hast';
2
- import type { Transformer } from 'unified';
3
- export default function rehypeEnhancedTag(): Transformer<Root>;
@@ -1,4 +0,0 @@
1
- import type { Root } from 'hast';
2
- import type { Transformer } from 'unified';
3
- declare function rehypeHighlightLine(): Transformer<Root>;
4
- export default rehypeHighlightLine;
@@ -1,6 +0,0 @@
1
- import type { Root } from 'hast';
2
- import type { Transformer } from 'unified';
3
- /**
4
- * rehype plugin to handle img source from local
5
- */
6
- export default function rehypeImg(): Transformer<Root>;
@@ -1,7 +0,0 @@
1
- import type { Element, Root } from 'hast';
2
- import type { Transformer } from 'unified';
3
- /**
4
- * Checks if `node` is a reactComponent
5
- */
6
- export declare function isReactComponent(node: Element): boolean;
7
- export default function rehypeIsolation(): Transformer<Root>;
@@ -1,2 +0,0 @@
1
- import type { FrozenProcessor } from 'unified';
2
- export default function rehypeJsxify(this: FrozenProcessor): void;
@@ -1,6 +0,0 @@
1
- import type { Root } from 'hast';
2
- import type { Transformer } from 'unified';
3
- import type { IMdTransformerOptions } from '.';
4
- type IRehypeLinkOptions = Pick<IMdTransformerOptions, 'fileAbsPath' | 'routes'>;
5
- export default function rehypeLink(opts: IRehypeLinkOptions): Transformer<Root>;
6
- export {};
@@ -1,6 +0,0 @@
1
- import type { Root } from 'hast';
2
- import type { Transformer } from 'unified';
3
- import type { IMdTransformerOptions } from '.';
4
- type IRehypeRawOptions = Pick<IMdTransformerOptions, 'fileAbsPath'>;
5
- export default function rehypeRaw(opts: IRehypeRawOptions): Transformer<Root>;
6
- export {};
@@ -1,4 +0,0 @@
1
- import type { Root } from 'hast';
2
- import type { Transformer } from 'unified';
3
- export declare const HEADING_TAGS: string[];
4
- export default function rehypeSlug(): Transformer<Root>;
@@ -1,3 +0,0 @@
1
- import type { Root } from 'hast';
2
- import type { Transformer } from 'unified';
3
- export default function rehypeStrip(): Transformer<Root>;
@@ -1,4 +0,0 @@
1
- import type { Root } from 'hast';
2
- import type { Transformer } from 'unified';
3
- export declare const CONTENT_TEXTS_OBJ_NAME = "$$contentTexts";
4
- export default function rehypeText(): Transformer<Root>;
@@ -1,3 +0,0 @@
1
- import type { IMdTransformerOptions } from "./index";
2
- import type { Root } from 'mdast';
3
- export default function remarkBreaks(opts: Pick<IMdTransformerOptions, 'fileAbsPath'>): (tree: Root) => void;
@@ -1,3 +0,0 @@
1
- import type { Root } from 'mdast';
2
- import type { Transformer } from 'unified';
3
- export default function remarkContainer(this: any): Transformer<Root>;
@@ -1,4 +0,0 @@
1
- import type { Root } from 'mdast';
2
- import type { Transformer } from 'unified';
3
- import type { IMdTransformerOptions } from '.';
4
- export default function remarkEmbed(opts: Pick<IMdTransformerOptions, 'fileAbsPath' | 'alias'>): Transformer<Root>;
@@ -1,8 +0,0 @@
1
- import type { Root } from 'mdast';
2
- import type { Transformer } from 'unified';
3
- import type { IMdTransformerOptions } from '.';
4
- type IRemarkMetaOpts = Pick<IMdTransformerOptions, 'cwd' | 'fileAbsPath' | 'resolve'> & {
5
- fileLocaleLessPath: string;
6
- };
7
- export default function remarkMeta(opts: IRemarkMetaOpts): Transformer<Root>;
8
- export {};
@@ -1,2 +0,0 @@
1
- export default function loader(): string;
2
- export declare function pitch(): string;
@@ -1 +0,0 @@
1
- export default function pageMetaLoader(this: any, raw: string): string;
@@ -1,4 +0,0 @@
1
- /**
2
- * loader for mako dumi-raw watch-parent
3
- */
4
- export default function postRawLoader(this: any, raw: string): string;
@@ -1,4 +0,0 @@
1
- /**
2
- * loader for discard frontmatter from code file content
3
- */
4
- export default function preRawLoader(this: any, raw: string): string;
package/dist/preset.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { IApi } from "./types";
2
- declare const _default: (api: IApi) => {
3
- plugins: string[];
4
- };
5
- export default _default;
@@ -1,3 +0,0 @@
1
- import type { IApi } from './types';
2
- declare const _default: (api: IApi) => void;
3
- export default _default;
@@ -1,5 +0,0 @@
1
- interface IOpts {
2
- presets?: string[];
3
- }
4
- export declare function run(opts?: IOpts): Promise<void>;
5
- export {};
@@ -1,4 +0,0 @@
1
- export declare const MIN_NODE_VERSION = 14;
2
- export declare const DEV_COMMAND = "dev";
3
- export declare const DEFAULT_CONFIG_FILES: string[];
4
- export declare const FRAMEWORK_NAME = "dumi";
@@ -1 +0,0 @@
1
- export declare function dev(): void;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare function printHelp(): void;
@@ -1,13 +0,0 @@
1
- import { Service } from 'umi';
2
- export declare class DumiService extends Service {
3
- constructor();
4
- getPaths(): Promise<{
5
- cwd: string;
6
- absSrcPath: string;
7
- absPagesPath: string;
8
- absApiRoutesPath: string;
9
- absTmpPath: string;
10
- absNodeModulesPath: string;
11
- absOutputPath: string;
12
- }>;
13
- }
@@ -1,7 +0,0 @@
1
- import type { IDumiTechStack } from "../types";
2
- export default class ReactTechStack implements IDumiTechStack {
3
- name: string;
4
- runtimeOpts?: IDumiTechStack['runtimeOpts'];
5
- isSupported(...[, lang]: Parameters<IDumiTechStack['isSupported']>): boolean;
6
- transformCode(...[raw, opts]: Parameters<IDumiTechStack['transformCode']>): string;
7
- }
@@ -1,40 +0,0 @@
1
- import type { ParserConfig } from '@swc/core';
2
- import { IDumiTechStack } from '../types';
3
- export { IDumiTechStack, IDumiTechStackOnBlockLoadArgs, IDumiTechStackOnBlockLoadResult, IDumiTechStackRuntimeOpts, } from '../types';
4
- /**
5
- * for frameworks like vue , we need to extract the JS fragments in their scripts
6
- * @param htmlLike HTML, vue and other html-like files are available
7
- * @returns js/ts code
8
- */
9
- export declare function extractScript(htmlLike: string): string;
10
- export interface IWrapDemoWithFnOptions {
11
- filename: string;
12
- parserConfig: ParserConfig;
13
- }
14
- /**
15
- * Use swc to convert es module into async function.
16
- * More transform process detail, refer to:
17
- * https://github.com/umijs/dumi/blob/master/crates/swc_plugin_react_demo/src/lib.rs#L126
18
- */
19
- export declare function wrapDemoWithFn(code: string, opts: IWrapDemoWithFnOptions): string;
20
- export type IDefineTechStackOptions = IDumiTechStack;
21
- /**
22
- * Define a tech stack
23
- * @param options techstack options
24
- * @returns function that returns {@link IDumiTechStack}, can be used to register a techstack
25
- *
26
- * @example
27
- * const ReactTechStack = defineTechStack({
28
- * name: 'jsx',
29
- * isSupported(_, lang) {
30
- * return ['jsx', 'tsx'].includes(lang);
31
- * },
32
- * transformCode() {
33
- * // ...
34
- * return '';
35
- * },
36
- * });
37
- *
38
- * api.registerTechStack(() => ReactTechStack);
39
- */
40
- export declare function defineTechStack(options: IDefineTechStackOptions): IDumiTechStack;
package/dist/types.d.ts DELETED
@@ -1,159 +0,0 @@
1
- import type { BaseAtomAssetsParser as IAtomAssetsParser } from "./assetParsers/BaseParser";
2
- import type { IParsedBlockAsset } from "./assetParsers/block";
3
- import type { IDumiDemoProps } from "./client/theme-api/DumiDemo";
4
- import type { ILocalesConfig, IThemeConfig } from "./client/theme-api/types";
5
- import type { IContentTab } from "./features/tabs";
6
- import type { IThemeLoadResult } from "./features/theme/loader";
7
- import { OnLoadArgs, OnLoadResult } from '@umijs/bundler-utils/compiled/esbuild';
8
- import type { IModify } from '@umijs/core';
9
- import type { AssetsPackage, ExampleBlockAsset } from 'dumi-assets-types';
10
- import type { Element } from 'hast';
11
- import type { IApi as IUmiApi, defineConfig as defineUmiConfig } from 'umi';
12
- type Subset<K> = {
13
- [attr in keyof K]?: K[attr] extends Array<any> ? K[attr] : K[attr] extends Function | undefined ? K[attr] : K[attr] extends object ? Subset<K[attr]> : K[attr] extends object | null ? Subset<K[attr]> | null : K[attr] extends object | null | undefined ? Subset<K[attr]> | null | undefined : K[attr];
14
- };
15
- type NoStringIndex<T> = {
16
- [K in keyof T as string extends K ? never : K]: T[K];
17
- };
18
- type IUmiConfig = Omit<NoStringIndex<Parameters<typeof defineUmiConfig>[0]>, 'resolve' | 'extraRemarkPlugins' | 'extraRehypePlugins' | 'themeConfig'>;
19
- interface IDumiExtendsConfig {
20
- resolve: {
21
- docDirs: (string | {
22
- type?: string;
23
- dir: string;
24
- })[];
25
- atomDirs: {
26
- type: string;
27
- subType?: string;
28
- dir: string;
29
- }[];
30
- codeBlockMode: 'active' | 'passive';
31
- entryFile?: string;
32
- forceKebabCaseRouting: boolean;
33
- };
34
- locales: ILocalesConfig;
35
- themeConfig: IThemeConfig;
36
- autoAlias?: boolean;
37
- /**
38
- * extra unified plugins
39
- */
40
- extraRemarkPlugins?: (string | Function | [string | Function, object])[];
41
- extraRehypePlugins?: (string | Function | [string | Function, object])[];
42
- }
43
- export type IDumiConfig = Omit<IUmiConfig, 'locales'> & IDumiExtendsConfig;
44
- export type IDumiUserConfig = Subset<Omit<IDumiConfig, 'locales'>> & {
45
- locales?: Exclude<IDumiConfig['locales'][0], {
46
- base: string;
47
- }>[] | Omit<Exclude<IDumiConfig['locales'][0], {
48
- suffix: string;
49
- }>, 'base'>[];
50
- [key: string]: any;
51
- };
52
- export interface IDumiTechStackOnBlockLoadResult {
53
- content: string;
54
- type: Required<OnLoadResult>['loader'];
55
- }
56
- export type IDumiTechStackOnBlockLoadArgs = OnLoadArgs & {
57
- entryPointCode: string;
58
- filename: string;
59
- };
60
- export interface IDumiTechStackRuntimeOpts {
61
- /**
62
- * Component detection function path,
63
- * used to detect errors that occur from application creation to component mounting.
64
- */
65
- preflightPath?: string;
66
- /**
67
- * path of the cancelable{@link IDemoCancelableFn} function
68
- * that manipulate(mount/unmount) third-party framework component
69
- */
70
- rendererPath?: string;
71
- /**
72
- * path to runtime compile function module
73
- */
74
- compilePath?: string;
75
- /**
76
- * path to runtime plugin for this tech stack
77
- */
78
- pluginPath?: string;
79
- }
80
- export declare abstract class IDumiTechStack {
81
- /**
82
- * tech stack name, such as 'react'
83
- */
84
- abstract name: string;
85
- /**
86
- * runtime options
87
- */
88
- abstract runtimeOpts?: IDumiTechStackRuntimeOpts;
89
- /**
90
- * Is the lang supported by the current tech stack?
91
- * @param lang
92
- * @param node hast Element https://github.com/syntax-tree/hast?tab=readme-ov-file#element
93
- */
94
- abstract isSupported(node: Element, lang: string): boolean;
95
- /**
96
- * transform for parse demo source to expression/function/class
97
- */
98
- abstract transformCode(raw: string, opts: {
99
- type: 'external' | 'code-block';
100
- fileAbsPath: string;
101
- }): string;
102
- /**
103
- * generator for return asset metadata
104
- */
105
- abstract generateMetadata?(asset: ExampleBlockAsset, opts: {
106
- type: Parameters<IDumiTechStack['transformCode']>[1]['type'];
107
- mdAbsPath: string;
108
- fileAbsPath?: string;
109
- entryPointCode?: string;
110
- }): Promise<ExampleBlockAsset> | ExampleBlockAsset;
111
- /**
112
- * generator for return previewer props
113
- */
114
- abstract generatePreviewerProps?(props: IDumiDemoProps['previewerProps'], opts: Parameters<NonNullable<IDumiTechStack['generateMetadata']>>[1]): Promise<IDumiDemoProps['previewerProps']> | IDumiDemoProps['previewerProps'];
115
- /**
116
- * generator for return file path of demo source
117
- */
118
- abstract generateSources?(source: IParsedBlockAsset['resolveMap'], opts: Parameters<NonNullable<IDumiTechStack['generateMetadata']>>[1]): Promise<IParsedBlockAsset['resolveMap']> | IParsedBlockAsset['resolveMap'];
119
- /**
120
- * Use current function as onLoad CallBack(https://esbuild.github.io/plugins/#on-load)
121
- * @description
122
- * Why use this method?
123
- * By default, dumi can only support the parsing of js/ts related code blocks,
124
- * but many front-end frameworks have custom extensions,
125
- * so this method is provided to facilitate developers to convert codes.
126
- */
127
- abstract onBlockLoad?(args: IDumiTechStackOnBlockLoadArgs): IDumiTechStackOnBlockLoadResult | null;
128
- }
129
- export type IApi = IUmiApi & {
130
- config: IDumiConfig & {
131
- [key: string]: any;
132
- };
133
- userConfig: IDumiUserConfig;
134
- service: IUmiApi['service'] & {
135
- themeData: IThemeLoadResult;
136
- atomParser: IAtomAssetsParser;
137
- };
138
- /**
139
- * register a new tech stack
140
- */
141
- registerTechStack: (fn: () => IDumiTechStack) => void;
142
- /**
143
- * modify original theme data
144
- */
145
- modifyTheme: IModify<IThemeLoadResult, null>;
146
- /**
147
- * add content tab
148
- */
149
- addContentTab: (fn: () => IContentTab) => void;
150
- /**
151
- * modify assets metadata
152
- */
153
- modifyAssetsMetadata: IModify<AssetsPackage, null>;
154
- /**
155
- * get assets metadata
156
- */
157
- getAssetsMetadata?: () => Promise<AssetsPackage>;
158
- };
159
- export {};
package/dist/utils.d.ts DELETED
@@ -1,67 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Range, RangeOptions } from '@umijs/utils/compiled/semver';
3
- import Cache from 'file-system-cache';
4
- import type { RunLoaderOption as InternalRunLoaderOption, RunLoaderResult } from '../compiled/loader-runner';
5
- export type * from '../compiled/loader-runner';
6
- export { getContext } from '../compiled/loader-runner';
7
- /**
8
- * get route path from file-system path
9
- */
10
- export declare function getFileIdFromFsPath(fsPath: string): string;
11
- /**
12
- * get range lines of markdown file
13
- */
14
- export declare const getFileRangeLines: (content: string, range: string) => string;
15
- /**
16
- * get file content by regular expression
17
- * @param content source file content
18
- * @param regexp regular expression string
19
- * @param filePath source file path
20
- */
21
- export declare const getFileContentByRegExp: (content: string, regexp: string, filePath: string) => string;
22
- /**
23
- * parse frontmatter from code string,
24
- * also supports html/xml comments
25
- */
26
- export declare function parseCodeFrontmatter(raw: string): {
27
- code: string;
28
- frontmatter: Record<string, any> | null;
29
- };
30
- declare const caches: Record<string, ReturnType<typeof Cache>>;
31
- export declare function _setFSCacheDir(dir: string): void;
32
- export declare function getCache(ns: string): (typeof caches)['0'];
33
- /**
34
- * try to get father config
35
- */
36
- export declare function tryFatherBuildConfigs(cwd: string): Promise<any[]>;
37
- /**
38
- * get root dir for monorepo project
39
- */
40
- export declare function getProjectRoot(cwd: string): string;
41
- /**
42
- *
43
- * transform component into webpack chunkName
44
- * @export
45
- * @param {string} component component path
46
- * @param {string} [cwdPath] current root path
47
- * @return {*} {string}
48
- */
49
- export declare function componentToChunkName(component: string, cwdPath?: string): string;
50
- export declare function generateMetaChunkName(path: string, cwd: string, locales?: string[]): string;
51
- /**
52
- * generate hash for string
53
- */
54
- export declare function getContentHash(content: string, length?: number): string;
55
- export type RunLoaderOption = Partial<InternalRunLoaderOption>;
56
- export declare function runLoaders(options: RunLoaderOption): Promise<RunLoaderResult>;
57
- export declare function runLoaders(options: RunLoaderOption, callback: undefined): Promise<RunLoaderResult>;
58
- export declare function runLoaders(options: RunLoaderOption, callback: (err: NodeJS.ErrnoException | null, result: RunLoaderResult) => any): void;
59
- /**
60
- * check if version is in range
61
- */
62
- export declare function isVersionInRange(version: string, range: string | Range, options?: RangeOptions): boolean;
63
- /**
64
- * normalize module specifier for generated import/export statements
65
- * keep package/bare specifiers unchanged and normalize path separators
66
- */
67
- export declare function toImportSpecifier(source: string): string;
@@ -1,7 +0,0 @@
1
- import { type FC } from 'react';
2
- import './index.less';
3
- declare const API: FC<{
4
- id?: string;
5
- type?: 'props' | 'events' | 'slots' | 'imperative';
6
- }>;
7
- export default API;
@@ -1,7 +0,0 @@
1
- import { type FC, type ReactNode } from 'react';
2
- import './index.less';
3
- declare const Badge: FC<{
4
- children: ReactNode;
5
- type: 'info' | 'warning' | 'error' | 'success';
6
- }>;
7
- export default Badge;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare function CodeGroup(props: React.PropsWithChildren): React.JSX.Element;
3
- export default CodeGroup;