dumi 2.4.29 → 2.4.31
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/crates/swc_plugin_react_demo.wasm +0 -0
- package/dist/assetParsers/BaseParser.d.ts +55 -0
- package/dist/assetParsers/atom.d.ts +21 -0
- package/dist/assetParsers/block.d.ts +25 -0
- package/dist/assetParsers/utils.d.ts +79 -0
- package/dist/cli.d.ts +1 -0
- package/dist/client/misc/reactDemoCompiler.d.ts +3 -0
- package/dist/client/pages/404.d.ts +1 -0
- package/dist/client/pages/Demo/index.d.ts +4 -0
- package/dist/client/pages/Loading.d.ts +1 -0
- package/dist/client/theme-api/AtomRenderer.d.ts +13 -0
- package/dist/client/theme-api/DumiDemo/DemoErrorBoundary.d.ts +5 -0
- package/dist/client/theme-api/DumiDemo/index.d.ts +10 -0
- package/dist/client/theme-api/DumiDemoGrid.d.ts +7 -0
- package/dist/client/theme-api/DumiPage.d.ts +4 -0
- package/dist/client/theme-api/context.d.ts +21 -0
- package/dist/client/theme-api/index.d.ts +18 -0
- package/dist/client/theme-api/openCodeSandbox.d.ts +10 -0
- package/dist/client/theme-api/openStackBlitz.d.ts +2 -0
- package/dist/client/theme-api/types.d.ts +258 -0
- package/dist/client/theme-api/useAtomAssets.d.ts +4 -0
- package/dist/client/theme-api/useLiveDemo.d.ts +10 -0
- package/dist/client/theme-api/useLocale.d.ts +2 -0
- package/dist/client/theme-api/useNavData.d.ts +5 -0
- package/dist/client/theme-api/usePrefersColor.d.ts +7 -0
- package/dist/client/theme-api/useRenderer.d.ts +11 -0
- package/dist/client/theme-api/useRouteMeta.d.ts +17 -0
- package/dist/client/theme-api/useSidebarData.d.ts +29 -0
- package/dist/client/theme-api/useSiteSearch/index.d.ts +24 -0
- package/dist/client/theme-api/useSiteSearch/useSearchData.d.ts +12 -0
- package/dist/client/theme-api/useTabMeta.d.ts +4 -0
- package/dist/client/theme-api/utils.d.ts +31 -0
- package/dist/constants.d.ts +23 -0
- package/dist/features/assets.d.ts +20 -0
- package/dist/features/assets.js +2 -1
- package/dist/features/autoAlias.d.ts +3 -0
- package/dist/features/compile/babelLoaderCustomize.d.ts +4 -0
- package/dist/features/compile/index.d.ts +4 -0
- package/dist/features/compile/makoHooks.d.ts +8 -0
- package/dist/features/compile/utils.d.ts +2 -0
- package/dist/features/compile/utoopackLoaders.d.ts +8 -0
- package/dist/features/configPlugins/index.d.ts +3 -0
- package/dist/features/configPlugins/schema.d.ts +4 -0
- package/dist/features/derivative.d.ts +11 -0
- package/dist/features/exportStatic.d.ts +3 -0
- package/dist/features/exports.d.ts +3 -0
- package/dist/features/html2sketch.d.ts +3 -0
- package/dist/features/locales.d.ts +3 -0
- package/dist/features/meta.d.ts +5 -0
- package/dist/features/parser.d.ts +3 -0
- package/dist/features/routes.d.ts +3 -0
- package/dist/features/sideEffects/docSideEffectsWebpackPlugin.d.ts +14 -0
- package/dist/features/sideEffects/index.d.ts +7 -0
- package/dist/features/sitemap.d.ts +3 -0
- package/dist/features/sitemap.js +5 -2
- package/dist/features/tabs.d.ts +17 -0
- package/dist/features/tabs.js +7 -4
- package/dist/features/theme/index.d.ts +3 -0
- package/dist/features/theme/index.js +6 -4
- package/dist/features/theme/loader.d.ts +55 -0
- package/dist/index.d.ts +6 -0
- package/dist/loaders/demo/index.d.ts +6 -0
- package/dist/loaders/markdown/index.d.ts +27 -0
- package/dist/loaders/markdown/transformer/index.d.ts +69 -0
- package/dist/loaders/markdown/transformer/rehypeDemo.d.ts +15 -0
- package/dist/loaders/markdown/transformer/rehypeDesc.d.ts +6 -0
- package/dist/loaders/markdown/transformer/rehypeEnhancedTag.d.ts +3 -0
- package/dist/loaders/markdown/transformer/rehypeHighlightLine.d.ts +4 -0
- package/dist/loaders/markdown/transformer/rehypeImg.d.ts +6 -0
- package/dist/loaders/markdown/transformer/rehypeIsolation.d.ts +7 -0
- package/dist/loaders/markdown/transformer/rehypeJsxify.d.ts +2 -0
- package/dist/loaders/markdown/transformer/rehypeLink.d.ts +6 -0
- package/dist/loaders/markdown/transformer/rehypeRaw.d.ts +6 -0
- package/dist/loaders/markdown/transformer/rehypeSlug.d.ts +4 -0
- package/dist/loaders/markdown/transformer/rehypeStrip.d.ts +3 -0
- package/dist/loaders/markdown/transformer/rehypeText.d.ts +4 -0
- package/dist/loaders/markdown/transformer/remarkBreaks.d.ts +3 -0
- package/dist/loaders/markdown/transformer/remarkContainer.d.ts +3 -0
- package/dist/loaders/markdown/transformer/remarkEmbed.d.ts +4 -0
- package/dist/loaders/markdown/transformer/remarkMeta.d.ts +8 -0
- package/dist/loaders/null/index.d.ts +2 -0
- package/dist/loaders/page/index.d.ts +1 -0
- package/dist/loaders/post-raw/index.d.ts +4 -0
- package/dist/loaders/pre-raw/index.d.ts +4 -0
- package/dist/preset.d.ts +5 -0
- package/dist/registerMethods.d.ts +3 -0
- package/dist/service/cli.d.ts +5 -0
- package/dist/service/constants.d.ts +4 -0
- package/dist/service/dev.d.ts +1 -0
- package/dist/service/forkedDev.d.ts +1 -0
- package/dist/service/printHelp.d.ts +1 -0
- package/dist/service/service.d.ts +13 -0
- package/dist/techStacks/react.d.ts +7 -0
- package/dist/techStacks/utils.d.ts +40 -0
- package/dist/types.d.ts +159 -0
- package/dist/utils.d.ts +66 -0
- package/dumi-types.d.ts +115 -0
- package/index.d.ts +64 -5
- package/package.json +12 -8
- package/theme-api.d.ts +319 -0
- package/theme-default/builtins/API/index.d.ts +7 -0
- package/theme-default/builtins/Badge/index.d.ts +7 -0
- package/theme-default/builtins/CodeGroup/index.d.ts +3 -0
- package/theme-default/builtins/Container/index.d.ts +8 -0
- package/theme-default/builtins/Previewer/index.d.ts +5 -0
- package/theme-default/builtins/SourceCode/index.d.ts +14 -0
- package/theme-default/builtins/Table/index.d.ts +6 -0
- package/theme-default/builtins/Tree/index.d.ts +5 -0
- package/theme-default/builtins/Tree/index.js +11 -11
- package/theme-default/layouts/DocLayout/index.d.ts +4 -0
- package/theme-default/slots/ColorSwitch/index.d.ts +4 -0
- package/theme-default/slots/Content/index.d.ts +7 -0
- package/theme-default/slots/ContentFooter/index.d.ts +4 -0
- package/theme-default/slots/ContentTabs/index.d.ts +11 -0
- package/theme-default/slots/Features/index.d.ts +4 -0
- package/theme-default/slots/Footer/index.d.ts +4 -0
- package/theme-default/slots/Header/index.d.ts +4 -0
- package/theme-default/slots/Header/index.js +5 -2
- package/theme-default/slots/HeaderExtra/index.d.ts +3 -0
- package/theme-default/slots/Hero/index.d.ts +4 -0
- package/theme-default/slots/HeroTitle/index.d.ts +6 -0
- package/theme-default/slots/LangSwitch/index.d.ts +4 -0
- package/theme-default/slots/Loading/index.d.ts +5 -0
- package/theme-default/slots/Logo/index.d.ts +4 -0
- package/theme-default/slots/Navbar/index.d.ts +4 -0
- package/theme-default/slots/NavbarExtra/index.d.ts +3 -0
- package/theme-default/slots/NotFound/index.d.ts +4 -0
- package/theme-default/slots/PreviewerActions/index.d.ts +27 -0
- package/theme-default/slots/PreviewerActionsExtra/index.d.ts +4 -0
- package/theme-default/slots/RtlSwitch/index.d.ts +4 -0
- package/theme-default/slots/SearchBar/Input.d.ts +6 -0
- package/theme-default/slots/SearchBar/Mask.d.ts +9 -0
- package/theme-default/slots/SearchBar/index.d.ts +6 -0
- package/theme-default/slots/SearchResult/index.d.ts +10 -0
- package/theme-default/slots/Sidebar/index.d.ts +4 -0
- package/theme-default/slots/SocialIcon/index.d.ts +15 -0
- package/theme-default/slots/SourceCodeEditor/index.d.ts +19 -0
- package/theme-default/slots/Tabs/index.d.ts +6 -0
- package/theme-default/slots/Toc/index.d.ts +4 -0
- package/theme-modules.d.ts +62 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface IHighlightText {
|
|
2
|
+
highlighted?: boolean;
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ISearchNavResult {
|
|
6
|
+
title?: string;
|
|
7
|
+
priority: number;
|
|
8
|
+
hints: {
|
|
9
|
+
type: 'page' | 'title' | 'demo' | 'content';
|
|
10
|
+
link: string;
|
|
11
|
+
priority: number;
|
|
12
|
+
pageTitle: string;
|
|
13
|
+
highlightTitleTexts: IHighlightText[];
|
|
14
|
+
highlightTexts: IHighlightText[];
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
17
|
+
export type ISearchResult = ISearchNavResult[];
|
|
18
|
+
export declare const useSiteSearch: () => {
|
|
19
|
+
keywords: string;
|
|
20
|
+
setKeywords: (val: string) => void;
|
|
21
|
+
result: ISearchResult;
|
|
22
|
+
loading: boolean;
|
|
23
|
+
load: () => Promise<void>;
|
|
24
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getFullDemos } from 'dumi';
|
|
2
|
+
import { useLocaleDocRoutes } from '../utils';
|
|
3
|
+
type IDemosData = Record<string, Partial<Awaited<ReturnType<typeof getFullDemos>>[string]>>;
|
|
4
|
+
type ISearchData = [
|
|
5
|
+
routes: ReturnType<typeof useLocaleDocRoutes>,
|
|
6
|
+
demos: IDemosData
|
|
7
|
+
];
|
|
8
|
+
export default function useSearchData(): [
|
|
9
|
+
ISearchData | null,
|
|
10
|
+
() => Promise<void>
|
|
11
|
+
];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PluginManager } from 'dumi';
|
|
2
|
+
import { useLayoutEffect } from 'react';
|
|
3
|
+
import type { AgnosticComponentModule, IDemoData, ILocale, INav, INavItem, IRouteMeta, IRoutesById, IUserNavValue } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* private instance, do not use it in your code
|
|
6
|
+
*/
|
|
7
|
+
export declare let pluginManager: PluginManager;
|
|
8
|
+
export declare const setPluginManager: (pm: PluginManager) => void;
|
|
9
|
+
export declare const useLocaleDocRoutes: () => IRoutesById;
|
|
10
|
+
/**
|
|
11
|
+
* 在 react 18 中需要新的 render 方式,这个函数用来处理不同的 jsx 模式。
|
|
12
|
+
* @param version react version
|
|
13
|
+
* @returns code string
|
|
14
|
+
*/
|
|
15
|
+
export declare const genReactRenderCode: (version: string) => string;
|
|
16
|
+
export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
|
|
17
|
+
/**
|
|
18
|
+
* common comparer for sidebar/nav items
|
|
19
|
+
*/
|
|
20
|
+
export declare const useRouteDataComparer: <T extends {
|
|
21
|
+
order?: number;
|
|
22
|
+
link?: string;
|
|
23
|
+
path?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
}>() => (a: T, b: T) => number;
|
|
26
|
+
/**
|
|
27
|
+
* common util for pick meta to sort sidebar/nav items
|
|
28
|
+
*/
|
|
29
|
+
export declare const pickRouteSortMeta: (original: Partial<Pick<INavItem, 'order' | 'title'>>, field: 'nav' | 'nav.second' | 'group', fm: IRouteMeta['frontmatter']) => Partial<Pick<INavItem, "order" | "title">>;
|
|
30
|
+
export declare function getLocaleNav(nav: IUserNavValue | INav, locale: ILocale): import("./types").IUserNavItems;
|
|
31
|
+
export declare function getAgnosticComponentModule(component: IDemoData['component']): Promise<AgnosticComponentModule>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const LOCAL_DUMI_DIR = ".dumi";
|
|
2
|
+
export declare const LOCAL_THEME_DIR = ".dumi/theme";
|
|
3
|
+
export declare const LOCAL_PAGES_DIR = ".dumi/pages";
|
|
4
|
+
export declare const THEME_PREFIX = "dumi-theme-";
|
|
5
|
+
export declare const SP_ROUTE_PREFIX = "~";
|
|
6
|
+
export declare const PREFERS_COLOR_ATTR = "data-prefers-color";
|
|
7
|
+
export declare const PREFERS_COLOR_LS_KEY = "dumi:prefers-color";
|
|
8
|
+
export declare const PICKED_PKG_FIELDS: {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
version: string;
|
|
12
|
+
license: string;
|
|
13
|
+
repository: string;
|
|
14
|
+
author: string;
|
|
15
|
+
authors: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const USELESS_TMP_FILES: string[];
|
|
18
|
+
export declare const VERSION_2_LEVEL_NAV = "^2.2.0";
|
|
19
|
+
export declare const VERSION_2_DEPRECATE_SOFT_BREAKS = "^2.2.0";
|
|
20
|
+
export declare const DEFAULT_DEMO_MODULE_EXTENSIONS: string[];
|
|
21
|
+
export declare const DEFAULT_DEMO_PLAIN_TEXT_EXTENSIONS: string[];
|
|
22
|
+
export declare const FS_CACHE_DIR = "node_modules/.cache/dumi";
|
|
23
|
+
export declare const SHOULD_SKIP_LIVEDEMO_ERROR: string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IApi } from '../types';
|
|
2
|
+
import type { AtomAsset, ExampleAsset } from 'dumi-assets-types';
|
|
3
|
+
declare const examples: ExampleAsset[];
|
|
4
|
+
/**
|
|
5
|
+
* internal function to add example assets
|
|
6
|
+
*/
|
|
7
|
+
export declare function addExampleAssets(data: typeof examples): void;
|
|
8
|
+
/**
|
|
9
|
+
* internal function to get atom assets
|
|
10
|
+
*/
|
|
11
|
+
export declare function getExampleAssets(): ExampleAsset[];
|
|
12
|
+
/**
|
|
13
|
+
* internal function to add meta for atom
|
|
14
|
+
*/
|
|
15
|
+
export declare function addAtomMeta(atomId: string, data: Partial<AtomAsset>): void;
|
|
16
|
+
/**
|
|
17
|
+
* plugin for generate assets.json
|
|
18
|
+
*/
|
|
19
|
+
declare const _default: (api: IApi) => void;
|
|
20
|
+
export default _default;
|
package/dist/features/assets.js
CHANGED
|
@@ -76,6 +76,7 @@ var assets_default = (api) => {
|
|
|
76
76
|
// allow generate assets.json without atoms when parser is not available
|
|
77
77
|
{ components: {} }
|
|
78
78
|
);
|
|
79
|
+
const atomComponents = components;
|
|
79
80
|
return await api.applyPlugins({
|
|
80
81
|
key: "modifyAssetsMetadata",
|
|
81
82
|
initialValue: {
|
|
@@ -87,7 +88,7 @@ var assets_default = (api) => {
|
|
|
87
88
|
homepage: api.pkg.homepage,
|
|
88
89
|
repository: api.pkg.repository,
|
|
89
90
|
assets: {
|
|
90
|
-
atoms: Object.values(
|
|
91
|
+
atoms: Object.values(atomComponents).map(
|
|
91
92
|
(atom) => (
|
|
92
93
|
// assign extra meta data from md frontmatter
|
|
93
94
|
Object.assign(atom, atomsMeta[atom.id] || {})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IApi, IDumiTechStack } from '../../types';
|
|
2
|
+
export declare const UTOOPACK_LOADER_CTX_KEY = "__dumiLoaderContextPath";
|
|
3
|
+
export declare const LOADER_CTX_FILENAME = "dumi-loader-ctx.cjs";
|
|
4
|
+
export declare function buildLoaderContextContent(techStacks: IDumiTechStack[], builtins?: Record<string, {
|
|
5
|
+
specifier: string;
|
|
6
|
+
source: string;
|
|
7
|
+
}>, routes?: Record<string, unknown>): string;
|
|
8
|
+
export declare const getUtoopackRules: (api: IApi, config?: IApi['config']) => Record<string, unknown>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IApi } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* exclude pre-compiling modules in mfsu mode
|
|
4
|
+
* and make sure there has no multiple instances problem (such as react)
|
|
5
|
+
*/
|
|
6
|
+
export declare function safeExcludeInMFSU(api: IApi, excludes: RegExp[]): void;
|
|
7
|
+
/**
|
|
8
|
+
* plugin for derive default behaviors from umi
|
|
9
|
+
*/
|
|
10
|
+
declare const _default: (api: IApi) => void;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { webpack } from 'umi';
|
|
2
|
+
interface IOpts {
|
|
3
|
+
sideEffects: string[];
|
|
4
|
+
pkgPath: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* webpack plugin for add extra sideEffects item if user configured sideEffects in package.json
|
|
8
|
+
*/
|
|
9
|
+
export default class docSideEffectsWebpackPlugin {
|
|
10
|
+
opts: IOpts;
|
|
11
|
+
constructor(opts: IOpts);
|
|
12
|
+
apply(compiler: webpack.Compiler): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IApi } from 'umi';
|
|
2
|
+
/**
|
|
3
|
+
* plugin for register the doc side-effects webpack plugin
|
|
4
|
+
* to avoid tree-shaking for .umi & .dumi/theme directory if package.json has sideEffects: false
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: (api: IApi) => void;
|
|
7
|
+
export default _default;
|
package/dist/features/sitemap.js
CHANGED
|
@@ -49,11 +49,14 @@ var sitemap_default = (api) => {
|
|
|
49
49
|
enableBy: ({ userConfig, env }) => userConfig.sitemap && env === "production"
|
|
50
50
|
});
|
|
51
51
|
api.onBuildComplete(async () => {
|
|
52
|
+
const sitemap = api.config.sitemap;
|
|
53
|
+
if (!sitemap)
|
|
54
|
+
return;
|
|
52
55
|
const smis = new import_sitemap.SitemapStream({
|
|
53
|
-
hostname:
|
|
56
|
+
hostname: sitemap.hostname,
|
|
54
57
|
xmlns: { video: false, image: false, news: false, xhtml: false }
|
|
55
58
|
});
|
|
56
|
-
const exclude = ["/404"].concat(
|
|
59
|
+
const exclude = ["/404"].concat(sitemap.exclude || []);
|
|
57
60
|
const writeStream = import_fs.default.createWriteStream(
|
|
58
61
|
import_path.default.join(api.paths.absOutputPath, "sitemap.xml")
|
|
59
62
|
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IApi } from '../types';
|
|
2
|
+
export interface IContentTab {
|
|
3
|
+
key: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
test?: RegExp;
|
|
6
|
+
title?: string;
|
|
7
|
+
titleIntlId?: string;
|
|
8
|
+
component: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function isTabRouteFile(file: string): boolean;
|
|
11
|
+
export declare function getTabKeyFromFile(file: string): string;
|
|
12
|
+
export declare function getHostForTabRouteFile(file: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* plugin for add conventional tab and plugin tab into page content
|
|
15
|
+
*/
|
|
16
|
+
declare const _default: (api: IApi) => void;
|
|
17
|
+
export default _default;
|
package/dist/features/tabs.js
CHANGED
|
@@ -84,11 +84,14 @@ var tabs_default = (api) => {
|
|
|
84
84
|
routesTabMapping[parentFile].push(routeId);
|
|
85
85
|
}
|
|
86
86
|
} else {
|
|
87
|
+
const routeFile = route.file;
|
|
88
|
+
if (!routeFile)
|
|
89
|
+
return;
|
|
87
90
|
tabsFromPlugins.forEach((tab) => {
|
|
88
|
-
var _a2
|
|
89
|
-
if ((!tab.test || route.absPath.match(tab.test)) && !((_a2 = routesTabMapping[
|
|
90
|
-
routesTabMapping[
|
|
91
|
-
routesTabMapping[
|
|
91
|
+
var _a2;
|
|
92
|
+
if ((!tab.test || route.absPath.match(tab.test)) && !((_a2 = routesTabMapping[routeFile]) == null ? void 0 : _a2.includes(tab.id))) {
|
|
93
|
+
routesTabMapping[routeFile] ?? (routesTabMapping[routeFile] = []);
|
|
94
|
+
routesTabMapping[routeFile].push(tab.id);
|
|
92
95
|
}
|
|
93
96
|
});
|
|
94
97
|
}
|
|
@@ -273,7 +273,7 @@ export default DumiLoading;
|
|
|
273
273
|
}
|
|
274
274
|
});
|
|
275
275
|
api.onGenerateFiles(async () => {
|
|
276
|
-
var _a, _b, _c
|
|
276
|
+
var _a, _b, _c;
|
|
277
277
|
const pAll = themeMapKeys.flatMap(
|
|
278
278
|
(key) => Object.values(originalThemeData[key] || {}).map(async (item) => {
|
|
279
279
|
if (item.source === "dumi")
|
|
@@ -317,8 +317,10 @@ export default DumiLoading;
|
|
|
317
317
|
pkg: JSON.stringify(
|
|
318
318
|
import_plugin_utils.lodash.pick(api.pkg, ...Object.keys(import_constants.PICKED_PKG_FIELDS))
|
|
319
319
|
),
|
|
320
|
-
historyType:
|
|
321
|
-
hostname: String(
|
|
320
|
+
historyType: api.config.history ? api.config.history.type : "browser",
|
|
321
|
+
hostname: String(
|
|
322
|
+
JSON.stringify(api.config.sitemap ? api.config.sitemap.hostname : "")
|
|
323
|
+
),
|
|
322
324
|
themeConfig: JSON.stringify(
|
|
323
325
|
Object.assign(
|
|
324
326
|
import_plugin_utils.lodash.pick(api.config, "logo", "description", "title"),
|
|
@@ -331,7 +333,7 @@ export default DumiLoading;
|
|
|
331
333
|
_2_level_nav_available: api.appData._2LevelNavAvailable
|
|
332
334
|
}
|
|
333
335
|
});
|
|
334
|
-
const primaryColor = typeof ((
|
|
336
|
+
const primaryColor = typeof ((_a = api.config) == null ? void 0 : _a.theme) === "object" ? (_c = (_b = api.config) == null ? void 0 : _b.theme) == null ? void 0 : _c["@c-primary"] : "#1677ff";
|
|
335
337
|
api.writeTmpFile({
|
|
336
338
|
noPluginDir: true,
|
|
337
339
|
path: "dumi/theme/nprogress.css",
|
|
@@ -0,0 +1,55 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,69 @@
|
|
|
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;
|
|
@@ -0,0 +1,15 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,7 @@
|
|
|
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>;
|
|
@@ -0,0 +1,6 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,6 @@
|
|
|
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 {};
|