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.
- package/compiled/@umijs/plugins/index.js +1 -1
- package/compiled/@umijs/plugins/package.json +1 -1
- package/compiled/crates/swc_plugin_react_demo.wasm +0 -0
- package/dist/client/misc/reactDemoCompiler.js +2 -2
- package/dist/client/theme-api/AtomRenderer.js +6 -6
- package/dist/client/theme-api/DumiDemo/index.js +1 -1
- package/dist/client/theme-api/DumiDemoGrid.js +1 -1
- package/dist/client/theme-api/DumiPage.js +1 -1
- package/dist/client/theme-api/openCodeSandbox.js +1 -1
- package/dist/client/theme-api/openStackBlitz.js +1 -1
- package/dist/client/theme-api/useLiveDemo.js +4 -4
- package/dist/client/theme-api/useLocale.js +1 -1
- package/dist/client/theme-api/useNavData.js +6 -6
- package/dist/client/theme-api/usePrefersColor.js +4 -4
- package/dist/client/theme-api/useRenderer.js +6 -6
- package/dist/client/theme-api/useRouteMeta.js +2 -2
- package/dist/client/theme-api/useSidebarData.js +7 -7
- package/dist/client/theme-api/useSiteSearch/index.js +1 -1
- package/dist/client/theme-api/useSiteSearch/useSearchData.js +7 -7
- package/dist/client/theme-api/useTabMeta.js +2 -2
- package/dist/client/theme-api/utils.js +4 -4
- package/dist/loaders/markdown/index.js +19 -11
- package/dist/templates/meta/index.ts.tpl +4 -2
- package/package.json +8 -8
- package/theme-default/builtins/API/index.js +8 -8
- package/theme-default/builtins/CodeGroup/index.js +1 -1
- package/theme-default/builtins/Container/index.js +1 -1
- package/theme-default/builtins/Previewer/index.js +1 -1
- package/theme-default/builtins/SourceCode/index.js +1 -1
- package/theme-default/builtins/Table/index.js +1 -1
- package/theme-default/builtins/Tree/index.js +7 -7
- package/theme-default/layouts/DocLayout/index.js +1 -1
- package/theme-default/slots/ColorSwitch/index.js +1 -1
- package/theme-default/slots/ContentFooter/index.js +1 -1
- package/theme-default/slots/Header/index.js +1 -1
- package/theme-default/slots/LangSwitch/index.js +1 -1
- package/theme-default/slots/Navbar/index.js +1 -1
- package/theme-default/slots/PreviewerActions/index.js +6 -6
- package/theme-default/slots/RtlSwitch/index.js +1 -1
- package/theme-default/slots/SearchBar/Mask.js +1 -1
- package/theme-default/slots/SearchBar/index.js +2 -2
- package/theme-default/slots/SearchResult/index.js +3 -3
- package/theme-default/slots/SourceCodeEditor/index.js +3 -3
- package/theme-default/slots/Toc/index.js +1 -1
- package/dist/assetParsers/BaseParser.d.ts +0 -55
- package/dist/assetParsers/atom.d.ts +0 -21
- package/dist/assetParsers/block.d.ts +0 -25
- package/dist/assetParsers/utils.d.ts +0 -79
- package/dist/cli.d.ts +0 -1
- package/dist/client/misc/reactDemoCompiler.d.ts +0 -3
- package/dist/client/pages/404.d.ts +0 -1
- package/dist/client/pages/Demo/index.d.ts +0 -4
- package/dist/client/pages/Loading.d.ts +0 -1
- package/dist/client/theme-api/AtomRenderer.d.ts +0 -13
- package/dist/client/theme-api/DumiDemo/DemoErrorBoundary.d.ts +0 -5
- package/dist/client/theme-api/DumiDemo/index.d.ts +0 -10
- package/dist/client/theme-api/DumiDemoGrid.d.ts +0 -7
- package/dist/client/theme-api/DumiPage.d.ts +0 -4
- package/dist/client/theme-api/context.d.ts +0 -22
- package/dist/client/theme-api/index.d.ts +0 -18
- package/dist/client/theme-api/openCodeSandbox.d.ts +0 -9
- package/dist/client/theme-api/openStackBlitz.d.ts +0 -1
- package/dist/client/theme-api/types.d.ts +0 -258
- package/dist/client/theme-api/useAtomAssets.d.ts +0 -4
- package/dist/client/theme-api/useLiveDemo.d.ts +0 -10
- package/dist/client/theme-api/useLocale.d.ts +0 -2
- package/dist/client/theme-api/useNavData.d.ts +0 -5
- package/dist/client/theme-api/usePrefersColor.d.ts +0 -7
- package/dist/client/theme-api/useRenderer.d.ts +0 -12
- package/dist/client/theme-api/useRouteMeta.d.ts +0 -17
- package/dist/client/theme-api/useSidebarData.d.ts +0 -29
- package/dist/client/theme-api/useSiteSearch/index.d.ts +0 -24
- package/dist/client/theme-api/useSiteSearch/useSearchData.d.ts +0 -12
- package/dist/client/theme-api/useTabMeta.d.ts +0 -4
- package/dist/client/theme-api/utils.d.ts +0 -31
- package/dist/constants.d.ts +0 -23
- package/dist/features/assets.d.ts +0 -20
- package/dist/features/autoAlias.d.ts +0 -3
- package/dist/features/compile/babelLoaderCustomize.d.ts +0 -4
- package/dist/features/compile/index.d.ts +0 -4
- package/dist/features/compile/makoHooks.d.ts +0 -8
- package/dist/features/compile/utils.d.ts +0 -2
- package/dist/features/compile/utoopackLoaders.d.ts +0 -8
- package/dist/features/configPlugins/index.d.ts +0 -3
- package/dist/features/configPlugins/schema.d.ts +0 -4
- package/dist/features/derivative.d.ts +0 -11
- package/dist/features/exportStatic.d.ts +0 -3
- package/dist/features/exports.d.ts +0 -3
- package/dist/features/html2sketch.d.ts +0 -3
- package/dist/features/locales.d.ts +0 -3
- package/dist/features/meta.d.ts +0 -5
- package/dist/features/parser.d.ts +0 -3
- package/dist/features/routes.d.ts +0 -3
- package/dist/features/sideEffects/docSideEffectsWebpackPlugin.d.ts +0 -14
- package/dist/features/sideEffects/index.d.ts +0 -7
- package/dist/features/sitemap.d.ts +0 -3
- package/dist/features/tabs.d.ts +0 -17
- package/dist/features/theme/index.d.ts +0 -3
- package/dist/features/theme/loader.d.ts +0 -55
- package/dist/index.d.ts +0 -6
- package/dist/loaders/demo/index.d.ts +0 -6
- package/dist/loaders/markdown/index.d.ts +0 -27
- package/dist/loaders/markdown/transformer/index.d.ts +0 -69
- package/dist/loaders/markdown/transformer/rehypeDemo.d.ts +0 -15
- package/dist/loaders/markdown/transformer/rehypeDesc.d.ts +0 -6
- package/dist/loaders/markdown/transformer/rehypeEnhancedTag.d.ts +0 -3
- package/dist/loaders/markdown/transformer/rehypeHighlightLine.d.ts +0 -4
- package/dist/loaders/markdown/transformer/rehypeImg.d.ts +0 -6
- package/dist/loaders/markdown/transformer/rehypeIsolation.d.ts +0 -7
- package/dist/loaders/markdown/transformer/rehypeJsxify.d.ts +0 -2
- package/dist/loaders/markdown/transformer/rehypeLink.d.ts +0 -6
- package/dist/loaders/markdown/transformer/rehypeRaw.d.ts +0 -6
- package/dist/loaders/markdown/transformer/rehypeSlug.d.ts +0 -4
- package/dist/loaders/markdown/transformer/rehypeStrip.d.ts +0 -3
- package/dist/loaders/markdown/transformer/rehypeText.d.ts +0 -4
- package/dist/loaders/markdown/transformer/remarkBreaks.d.ts +0 -3
- package/dist/loaders/markdown/transformer/remarkContainer.d.ts +0 -3
- package/dist/loaders/markdown/transformer/remarkEmbed.d.ts +0 -4
- package/dist/loaders/markdown/transformer/remarkMeta.d.ts +0 -8
- package/dist/loaders/null/index.d.ts +0 -2
- package/dist/loaders/page/index.d.ts +0 -1
- package/dist/loaders/post-raw/index.d.ts +0 -4
- package/dist/loaders/pre-raw/index.d.ts +0 -4
- package/dist/preset.d.ts +0 -5
- package/dist/registerMethods.d.ts +0 -3
- package/dist/service/cli.d.ts +0 -5
- package/dist/service/constants.d.ts +0 -4
- package/dist/service/dev.d.ts +0 -1
- package/dist/service/forkedDev.d.ts +0 -1
- package/dist/service/printHelp.d.ts +0 -1
- package/dist/service/service.d.ts +0 -13
- package/dist/techStacks/react.d.ts +0 -7
- package/dist/techStacks/utils.d.ts +0 -40
- package/dist/types.d.ts +0 -159
- package/dist/utils.d.ts +0 -67
- package/theme-default/builtins/API/index.d.ts +0 -7
- package/theme-default/builtins/Badge/index.d.ts +0 -7
- package/theme-default/builtins/CodeGroup/index.d.ts +0 -3
- package/theme-default/builtins/Container/index.d.ts +0 -8
- package/theme-default/builtins/Previewer/index.d.ts +0 -5
- package/theme-default/builtins/SourceCode/index.d.ts +0 -14
- package/theme-default/builtins/Table/index.d.ts +0 -6
- package/theme-default/builtins/Tree/index.d.ts +0 -5
- package/theme-default/layouts/DocLayout/index.d.ts +0 -4
- package/theme-default/slots/ColorSwitch/index.d.ts +0 -4
- package/theme-default/slots/Content/index.d.ts +0 -7
- package/theme-default/slots/ContentFooter/index.d.ts +0 -4
- package/theme-default/slots/ContentTabs/index.d.ts +0 -11
- package/theme-default/slots/Features/index.d.ts +0 -4
- package/theme-default/slots/Footer/index.d.ts +0 -4
- package/theme-default/slots/Header/index.d.ts +0 -4
- package/theme-default/slots/HeaderExtra/index.d.ts +0 -3
- package/theme-default/slots/Hero/index.d.ts +0 -4
- package/theme-default/slots/HeroTitle/index.d.ts +0 -6
- package/theme-default/slots/LangSwitch/index.d.ts +0 -4
- package/theme-default/slots/Loading/index.d.ts +0 -5
- package/theme-default/slots/Logo/index.d.ts +0 -4
- package/theme-default/slots/Navbar/index.d.ts +0 -4
- package/theme-default/slots/NavbarExtra/index.d.ts +0 -3
- package/theme-default/slots/NotFound/index.d.ts +0 -4
- package/theme-default/slots/PreviewerActions/index.d.ts +0 -27
- package/theme-default/slots/PreviewerActionsExtra/index.d.ts +0 -4
- package/theme-default/slots/RtlSwitch/index.d.ts +0 -4
- package/theme-default/slots/SearchBar/Input.d.ts +0 -6
- package/theme-default/slots/SearchBar/Mask.d.ts +0 -9
- package/theme-default/slots/SearchBar/index.d.ts +0 -6
- package/theme-default/slots/SearchResult/index.d.ts +0 -10
- package/theme-default/slots/Sidebar/index.d.ts +0 -4
- package/theme-default/slots/SocialIcon/index.d.ts +0 -13
- package/theme-default/slots/SourceCodeEditor/index.d.ts +0 -19
- package/theme-default/slots/Tabs/index.d.ts +0 -6
- 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,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,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,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,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 +0,0 @@
|
|
|
1
|
-
export default function pageMetaLoader(this: any, raw: string): string;
|
package/dist/preset.d.ts
DELETED
package/dist/service/cli.d.ts
DELETED
package/dist/service/dev.d.ts
DELETED
|
@@ -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;
|