dumi 2.1.19 → 2.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assetParsers/atom.d.ts +2 -0
- package/dist/assetParsers/atom.js +18 -11
- package/dist/features/autoAlias.js +20 -23
- package/dist/features/derivative.js +0 -1
- package/dist/features/routes.js +17 -9
- package/dist/features/theme/index.js +1 -2
- package/dist/loaders/markdown/transformer/rehypeDemo.js +35 -9
- package/dist/utils.d.ts +0 -4
- package/dist/utils.js +0 -14
- package/package.json +2 -1
|
@@ -9,6 +9,7 @@ declare class AtomAssetsParser {
|
|
|
9
9
|
private watcher;
|
|
10
10
|
private cbs;
|
|
11
11
|
private resolveFilter;
|
|
12
|
+
private watchArgs;
|
|
12
13
|
constructor(opts: {
|
|
13
14
|
entryFile: string;
|
|
14
15
|
resolveDir: string;
|
|
@@ -23,6 +24,7 @@ declare class AtomAssetsParser {
|
|
|
23
24
|
}>;
|
|
24
25
|
watch(cb: AtomAssetsParser['cbs'][number]): void;
|
|
25
26
|
unwatch(cb: AtomAssetsParser['cbs'][number]): void;
|
|
27
|
+
patchWatchArgs(handler: (args: AtomAssetsParser['watchArgs']) => AtomAssetsParser['watchArgs']): void;
|
|
26
28
|
destroyWorker(): void;
|
|
27
29
|
}
|
|
28
30
|
export default AtomAssetsParser;
|
|
@@ -47,6 +47,20 @@ var AtomAssetsParser = class {
|
|
|
47
47
|
mode: "worker",
|
|
48
48
|
parseOptions: opts.parseOptions
|
|
49
49
|
});
|
|
50
|
+
this.watchArgs = {
|
|
51
|
+
paths: this.entryDir,
|
|
52
|
+
options: {
|
|
53
|
+
cwd: this.resolveDir,
|
|
54
|
+
ignored: [
|
|
55
|
+
"**/.*",
|
|
56
|
+
"**/.*/**",
|
|
57
|
+
"**/_*",
|
|
58
|
+
"**/_*/**",
|
|
59
|
+
"**/*.{md,less,scss,sass,styl,css}"
|
|
60
|
+
],
|
|
61
|
+
ignoreInitial: true
|
|
62
|
+
}
|
|
63
|
+
};
|
|
50
64
|
}
|
|
51
65
|
async parse() {
|
|
52
66
|
if (!this.parseDeferrer || this.unresolvedFiles.length && !this.isParsing) {
|
|
@@ -115,17 +129,7 @@ var AtomAssetsParser = class {
|
|
|
115
129
|
const lazyParse = import_plugin_utils.lodash.debounce(() => {
|
|
116
130
|
this.parse().then((data) => this.cbs.forEach((cb2) => cb2(data)));
|
|
117
131
|
}, 100);
|
|
118
|
-
this.watcher = import_plugin_utils.chokidar.watch(this.
|
|
119
|
-
cwd: this.resolveDir,
|
|
120
|
-
ignored: [
|
|
121
|
-
"**/.*",
|
|
122
|
-
"**/.*/**",
|
|
123
|
-
"**/_*",
|
|
124
|
-
"**/_*/**",
|
|
125
|
-
"**/*.{md,less,scss,sass,styl,css}"
|
|
126
|
-
],
|
|
127
|
-
ignoreInitial: true
|
|
128
|
-
}).on("all", (ev, file) => {
|
|
132
|
+
this.watcher = import_plugin_utils.chokidar.watch(this.watchArgs.paths, this.watchArgs.options).on("all", (ev, file) => {
|
|
129
133
|
if (["add", "change"].includes(ev) && /((?<!\.d)\.ts|\.(jsx?|tsx))$/.test(file)) {
|
|
130
134
|
this.unresolvedFiles.push(import_path.default.join(this.resolveDir, file));
|
|
131
135
|
lazyParse();
|
|
@@ -137,6 +141,9 @@ var AtomAssetsParser = class {
|
|
|
137
141
|
unwatch(cb) {
|
|
138
142
|
this.cbs.splice(this.cbs.indexOf(cb), 1);
|
|
139
143
|
}
|
|
144
|
+
patchWatchArgs(handler) {
|
|
145
|
+
this.watchArgs = handler(this.watchArgs);
|
|
146
|
+
}
|
|
140
147
|
destroyWorker() {
|
|
141
148
|
if (this.parseDeferrer) {
|
|
142
149
|
this.parseDeferrer.finally(() => this.parser.$$destroyWorker());
|
|
@@ -29,7 +29,6 @@ var import_utils = require("../utils");
|
|
|
29
29
|
var import_fs = __toESM(require("fs"));
|
|
30
30
|
var import_path = __toESM(require("path"));
|
|
31
31
|
var autoAlias_default = (api) => {
|
|
32
|
-
let entryDir;
|
|
33
32
|
api.describe({
|
|
34
33
|
key: "autoAlias",
|
|
35
34
|
config: {
|
|
@@ -37,33 +36,31 @@ var autoAlias_default = (api) => {
|
|
|
37
36
|
},
|
|
38
37
|
enableBy: () => !!api.pkg.name
|
|
39
38
|
});
|
|
40
|
-
api.
|
|
41
|
-
var _a;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
memo.fatherConfigs = await (0, import_utils.tryFatherBuildConfigs)(api.cwd);
|
|
48
|
-
return memo;
|
|
49
|
-
});
|
|
50
|
-
api.chainWebpack((memo) => {
|
|
51
|
-
const fatherConfigs = api.appData.fatherConfigs;
|
|
39
|
+
api.modifyConfig(async (memo) => {
|
|
40
|
+
var _a, _b, _c;
|
|
41
|
+
const fatherConfigs = await api.applyPlugins({
|
|
42
|
+
key: "dumi.modifyFatherConfigs",
|
|
43
|
+
type: api.ApplyPluginsType.modify,
|
|
44
|
+
initialValue: await (0, import_utils.tryFatherBuildConfigs)(api.cwd)
|
|
45
|
+
});
|
|
52
46
|
fatherConfigs.sort((a, b) => {
|
|
53
|
-
var
|
|
54
|
-
const aLevel = (((
|
|
55
|
-
const bLevel = (((
|
|
47
|
+
var _a2, _b2;
|
|
48
|
+
const aLevel = (((_a2 = a.output) == null ? void 0 : _a2.path) || a.output).split("/").length;
|
|
49
|
+
const bLevel = (((_b2 = b.output) == null ? void 0 : _b2.path) || b.output).split("/").length;
|
|
56
50
|
return bLevel - aLevel;
|
|
57
51
|
});
|
|
58
52
|
fatherConfigs.forEach((item) => {
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
if (!memo.resolve.alias.has(key)) {
|
|
62
|
-
memo.resolve.alias.set(key, import_path.default.join(api.cwd, item.entry || item.input));
|
|
63
|
-
}
|
|
53
|
+
var _a2, _b2, _c2;
|
|
54
|
+
(_b2 = memo.alias)[_c2 = `${api.pkg.name}/${((_a2 = item.output) == null ? void 0 : _a2.path) || item.output}`] ?? (_b2[_c2] = import_path.default.join(api.cwd, item.entry || item.input));
|
|
64
55
|
});
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
let entryDir = "";
|
|
57
|
+
if ((_a = memo.resolve) == null ? void 0 : _a.entryFile) {
|
|
58
|
+
entryDir = import_path.default.resolve(api.cwd, memo.resolve.entryFile);
|
|
59
|
+
} else if (import_fs.default.existsSync(import_path.default.join(api.cwd, "src"))) {
|
|
60
|
+
entryDir = import_path.default.join(api.cwd, "src");
|
|
61
|
+
}
|
|
62
|
+
if (entryDir) {
|
|
63
|
+
(_b = memo.alias)[_c = api.pkg.name] ?? (_b[_c] = entryDir);
|
|
67
64
|
}
|
|
68
65
|
return memo;
|
|
69
66
|
});
|
package/dist/features/routes.js
CHANGED
|
@@ -26,13 +26,15 @@ __export(routes_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(routes_exports);
|
|
28
28
|
var import_constants = require("../constants");
|
|
29
|
-
var import_utils = require("../utils");
|
|
30
29
|
var import_core = require("@umijs/core");
|
|
31
|
-
var
|
|
30
|
+
var import_utils = require("@umijs/core/dist/route/utils");
|
|
32
31
|
var import_path = __toESM(require("path"));
|
|
33
32
|
var import_pluralize = require("pluralize");
|
|
34
33
|
var import_plugin_utils = require("umi/plugin-utils");
|
|
35
34
|
var CTX_LAYOUT_ID = "dumi-context-layout";
|
|
35
|
+
var ALIAS_THEME_TMP = "@/dumi__theme";
|
|
36
|
+
var ALIAS_LAYOUTS_TMP = "@/dumi__theme__layouts";
|
|
37
|
+
var ALIAS_INTERNAL_PAGES = "@/dumi__pages";
|
|
36
38
|
function normalizeDocDir(docDir) {
|
|
37
39
|
return typeof docDir === "object" ? docDir : { dir: docDir };
|
|
38
40
|
}
|
|
@@ -81,6 +83,12 @@ var routes_default = (api) => {
|
|
|
81
83
|
memo.resolve[key] = [];
|
|
82
84
|
});
|
|
83
85
|
}
|
|
86
|
+
memo.alias[ALIAS_THEME_TMP] = (0, import_plugin_utils.winPath)(import_path.default.join(api.paths.absTmpPath, "dumi/theme"));
|
|
87
|
+
memo.alias[ALIAS_LAYOUTS_TMP] = [
|
|
88
|
+
(0, import_plugin_utils.winPath)(import_path.default.join(api.cwd, import_constants.LOCAL_THEME_DIR, "layouts")),
|
|
89
|
+
`${ALIAS_THEME_TMP}/layouts`
|
|
90
|
+
];
|
|
91
|
+
memo.alias[ALIAS_INTERNAL_PAGES] = (0, import_plugin_utils.winPath)(import_path.default.join(__dirname, "../client/pages"));
|
|
84
92
|
return memo;
|
|
85
93
|
});
|
|
86
94
|
api.modifyRoutes((oRoutes) => {
|
|
@@ -104,7 +112,7 @@ var routes_default = (api) => {
|
|
|
104
112
|
routes[DocLayout.specifier] = {
|
|
105
113
|
id: DocLayout.specifier,
|
|
106
114
|
path: "/",
|
|
107
|
-
file: DocLayout
|
|
115
|
+
file: `${ALIAS_LAYOUTS_TMP}/DocLayout`,
|
|
108
116
|
parentId: lastLayoutId,
|
|
109
117
|
absPath: "/",
|
|
110
118
|
isLayout: true
|
|
@@ -115,7 +123,7 @@ var routes_default = (api) => {
|
|
|
115
123
|
routes[DemoLayout.specifier] = {
|
|
116
124
|
id: DemoLayout.specifier,
|
|
117
125
|
path: "/",
|
|
118
|
-
file: DemoLayout
|
|
126
|
+
file: `${ALIAS_LAYOUTS_TMP}/DemoLayout`,
|
|
119
127
|
parentId: lastLayoutId,
|
|
120
128
|
absPath: "/",
|
|
121
129
|
isLayout: true
|
|
@@ -148,7 +156,7 @@ var routes_default = (api) => {
|
|
|
148
156
|
atomFiles.forEach((file) => {
|
|
149
157
|
const routeFile = (0, import_plugin_utils.winPath)(import_path.default.join((0, import_pluralize.plural)(type), file));
|
|
150
158
|
const routePath = routeFile.replace(/(\/index|\/README)?\.md$/, "").replace(/\./g, "/");
|
|
151
|
-
const routeId = (0,
|
|
159
|
+
const routeId = (0, import_utils.createRouteId)(routeFile);
|
|
152
160
|
routes[routeId] = {
|
|
153
161
|
id: routeId,
|
|
154
162
|
path: routePath,
|
|
@@ -173,7 +181,7 @@ var routes_default = (api) => {
|
|
|
173
181
|
path: "*",
|
|
174
182
|
absPath: "/*",
|
|
175
183
|
parentId: docLayoutId,
|
|
176
|
-
file:
|
|
184
|
+
file: `${ALIAS_INTERNAL_PAGES}/404`
|
|
177
185
|
};
|
|
178
186
|
}
|
|
179
187
|
routes["demo-render"] = {
|
|
@@ -181,7 +189,7 @@ var routes_default = (api) => {
|
|
|
181
189
|
path: `${import_constants.SP_ROUTE_PREFIX}demos/:id`,
|
|
182
190
|
absPath: `/${import_constants.SP_ROUTE_PREFIX}demos/:id`,
|
|
183
191
|
parentId: demoLayoutId,
|
|
184
|
-
file:
|
|
192
|
+
file: `${ALIAS_INTERNAL_PAGES}/Demo`
|
|
185
193
|
};
|
|
186
194
|
return routes;
|
|
187
195
|
});
|
|
@@ -189,14 +197,14 @@ var routes_default = (api) => {
|
|
|
189
197
|
const layouts = [
|
|
190
198
|
{
|
|
191
199
|
id: CTX_LAYOUT_ID,
|
|
192
|
-
file: `${
|
|
200
|
+
file: `${ALIAS_THEME_TMP}/ContextWrapper`
|
|
193
201
|
}
|
|
194
202
|
];
|
|
195
203
|
const { GlobalLayout } = api.service.themeData.layouts;
|
|
196
204
|
if (GlobalLayout) {
|
|
197
205
|
layouts.unshift({
|
|
198
206
|
id: GlobalLayout.specifier,
|
|
199
|
-
file: GlobalLayout
|
|
207
|
+
file: `${ALIAS_LAYOUTS_TMP}/GlobalLayout`
|
|
200
208
|
});
|
|
201
209
|
}
|
|
202
210
|
return layouts;
|
|
@@ -26,13 +26,13 @@ __export(theme_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(theme_exports);
|
|
28
28
|
var import_constants = require("../../constants");
|
|
29
|
-
var import_utils = require("../../utils");
|
|
30
29
|
var import_bundler_utils = require("@umijs/bundler-utils");
|
|
31
30
|
var import_fs = __toESM(require("fs"));
|
|
32
31
|
var import_path = __toESM(require("path"));
|
|
33
32
|
var import_plugin_utils = require("umi/plugin-utils");
|
|
34
33
|
var import_derivative = require("../derivative");
|
|
35
34
|
var import_loader = __toESM(require("./loader"));
|
|
35
|
+
var DEFAULT_THEME_PATH = import_path.default.join(__dirname, "../../../theme-default");
|
|
36
36
|
function getPkgThemeName(api) {
|
|
37
37
|
const validDeps = Object.assign({}, api.pkg.dependencies, api.pkg.devDependencies);
|
|
38
38
|
const pkgThemeName = Object.keys(validDeps).find((pkg) => pkg.split("/").pop().startsWith(import_constants.THEME_PREFIX));
|
|
@@ -52,7 +52,6 @@ function getModuleExports(modulePath) {
|
|
|
52
52
|
})[1];
|
|
53
53
|
}
|
|
54
54
|
var theme_default = (api) => {
|
|
55
|
-
const DEFAULT_THEME_PATH = import_path.default.join((0, import_utils.getClientDistFile)("package.json", api.cwd), "../theme-default");
|
|
56
55
|
const defaultThemeData = (0, import_loader.default)(DEFAULT_THEME_PATH);
|
|
57
56
|
const pkgThemePath = getPkgThemePath(api);
|
|
58
57
|
const pkgThemeData = (0, import_plugin_utils.deepmerge)(defaultThemeData, pkgThemePath ? (0, import_loader.default)(import_path.default.join(pkgThemePath, "dist")) : {});
|
|
@@ -34,6 +34,7 @@ var import_path = __toESM(require("path"));
|
|
|
34
34
|
var import_plugin_utils = require("umi/plugin-utils");
|
|
35
35
|
var visit;
|
|
36
36
|
var SKIP;
|
|
37
|
+
var EXIT;
|
|
37
38
|
var toString;
|
|
38
39
|
var isElement;
|
|
39
40
|
var DEMO_NODE_CONTAINER = "$demo-container";
|
|
@@ -41,7 +42,7 @@ var DEMO_PROP_VALUE_KEY = "$demo-prop-value-key";
|
|
|
41
42
|
var DUMI_DEMO_TAG = "DumiDemo";
|
|
42
43
|
var DUMI_DEMO_GRID_TAG = "DumiDemoGrid";
|
|
43
44
|
(async () => {
|
|
44
|
-
({ visit, SKIP } = await import("unist-util-visit"));
|
|
45
|
+
({ visit, SKIP, EXIT } = await import("unist-util-visit"));
|
|
45
46
|
({ toString } = await import("hast-util-to-string"));
|
|
46
47
|
({ isElement } = await import("hast-util-is-element"));
|
|
47
48
|
})();
|
|
@@ -125,13 +126,35 @@ function rehypeDemo(opts) {
|
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
});
|
|
129
|
+
let hasOnlySign = false;
|
|
130
|
+
let hasSkipSign = false;
|
|
128
131
|
visit(tree, "element", (node) => {
|
|
129
132
|
var _a;
|
|
133
|
+
if (isElement(node, "p") && ((_a = node.data) == null ? void 0 : _a[DEMO_NODE_CONTAINER])) {
|
|
134
|
+
for (const codeNode of node.children) {
|
|
135
|
+
if (isElement(codeNode, "code")) {
|
|
136
|
+
hasSkipSign || (hasSkipSign = "skip" in codeNode.properties);
|
|
137
|
+
if ("only" in codeNode.properties) {
|
|
138
|
+
hasOnlySign = true;
|
|
139
|
+
return EXIT;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
if (process.env.NODE_ENV === "production" && (hasOnlySign || hasSkipSign)) {
|
|
146
|
+
import_plugin_utils.logger.warn(`The 'only' or 'skip' mark is not supported in production environment, please remove it. at ${vFile.data.frontmatter.filename}`);
|
|
147
|
+
}
|
|
148
|
+
visit(tree, "element", (node) => {
|
|
149
|
+
var _a, _b, _c;
|
|
130
150
|
if (isElement(node, "p") && ((_a = node.data) == null ? void 0 : _a[DEMO_NODE_CONTAINER])) {
|
|
131
151
|
const demosPropData = [];
|
|
132
|
-
node.children
|
|
133
|
-
var _a2, _b;
|
|
152
|
+
for (const codeNode of node.children) {
|
|
134
153
|
if (isElement(codeNode, "code")) {
|
|
154
|
+
const shouldSkipNonOnlyDemos = hasOnlySign && !("only" in codeNode.properties);
|
|
155
|
+
if (process.env.NODE_ENV !== "production" && ("skip" in codeNode.properties || shouldSkipNonOnlyDemos)) {
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
135
158
|
const codeType = codeNode.data.type;
|
|
136
159
|
const techStack = codeNode.data.techStack;
|
|
137
160
|
const codeValue = toString(codeNode).trim();
|
|
@@ -147,12 +170,12 @@ function rehypeDemo(opts) {
|
|
|
147
170
|
if (codeType === "external") {
|
|
148
171
|
const chunkName = [vFile.data.frontmatter.atomId, "demos"].filter(Boolean).join("__");
|
|
149
172
|
parseOpts.fileAbsPath = (0, import_plugin_utils.winPath)(codeNode.properties.src);
|
|
150
|
-
let localId = ((
|
|
173
|
+
let localId = ((_b = codeNode.properties) == null ? void 0 : _b.id) ?? import_path.default.parse(parseOpts.fileAbsPath.replace(/\/index\.(j|t)sx?$/, "")).name;
|
|
151
174
|
parseOpts.id = getCodeId(opts.cwd, opts.fileAbsPath, localId, vFile.data.frontmatter.atomId);
|
|
152
175
|
component = `React.lazy(() => import( /* webpackChunkName: "${chunkName}" */ '${(0, import_plugin_utils.winPath)(parseOpts.fileAbsPath)}?techStack=${techStack.name}'))`;
|
|
153
176
|
if (codeValue)
|
|
154
177
|
codeNode.properties.title = codeValue;
|
|
155
|
-
(
|
|
178
|
+
(_c = codeNode.properties).filename ?? (_c.filename = (0, import_plugin_utils.winPath)(import_path.default.relative(opts.cwd, parseOpts.fileAbsPath)));
|
|
156
179
|
} else {
|
|
157
180
|
parseOpts.fileAbsPath = opts.fileAbsPath.replace(".md", ".tsx");
|
|
158
181
|
parseOpts.id = getCodeId(opts.cwd, opts.fileAbsPath, String(index++), vFile.data.frontmatter.atomId);
|
|
@@ -164,9 +187,9 @@ function rehypeDemo(opts) {
|
|
|
164
187
|
const propDemo = { id: parseOpts.id };
|
|
165
188
|
demoIds.push(parseOpts.id);
|
|
166
189
|
deferrers.push((0, import_block.default)(parseOpts).then(async ({ asset, sources, frontmatter }) => {
|
|
167
|
-
var
|
|
190
|
+
var _a2, _b2, _c2;
|
|
168
191
|
if (demoIds.indexOf(parseOpts.id) !== demoIds.lastIndexOf(parseOpts.id)) {
|
|
169
|
-
const startLine = (
|
|
192
|
+
const startLine = (_a2 = node.position) == null ? void 0 : _a2.start.line;
|
|
170
193
|
const suffix = startLine ? `:${startLine}` : "";
|
|
171
194
|
import_plugin_utils.logger.warn(`Duplicate demo id found due to filename conflicts, please consider adding a unique id to code tag to resolve this.
|
|
172
195
|
at ${opts.fileAbsPath}${suffix}`);
|
|
@@ -199,7 +222,7 @@ function rehypeDemo(opts) {
|
|
|
199
222
|
component
|
|
200
223
|
};
|
|
201
224
|
}
|
|
202
|
-
Object.assign(previewerProps, await ((
|
|
225
|
+
Object.assign(previewerProps, await ((_c2 = techStack.generatePreviewerProps) == null ? void 0 : _c2.call(techStack, originalProps, techStackOpts)) || originalProps);
|
|
203
226
|
if (previewerProps.description) {
|
|
204
227
|
const { unified } = await import("unified");
|
|
205
228
|
const { default: remarkParse } = await import("remark-parse");
|
|
@@ -224,8 +247,11 @@ function rehypeDemo(opts) {
|
|
|
224
247
|
demo: propDemo,
|
|
225
248
|
previewerProps
|
|
226
249
|
});
|
|
250
|
+
if (process.env.NODE_ENV !== "production" && "only" in codeNode.properties) {
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
227
253
|
}
|
|
228
|
-
}
|
|
254
|
+
}
|
|
229
255
|
replaceNodes.push(node);
|
|
230
256
|
node.children = [];
|
|
231
257
|
if (demosPropData.length === 1) {
|
package/dist/utils.d.ts
CHANGED
|
@@ -34,8 +34,4 @@ export declare function tryFatherBuildConfigs(cwd: string): Promise<any[]>;
|
|
|
34
34
|
* get root dir for monorepo project
|
|
35
35
|
*/
|
|
36
36
|
export declare function getProjectRoot(cwd: string): string;
|
|
37
|
-
/**
|
|
38
|
-
* get dumi client dist file and preserve symlink(pnpm, tnpm & etc.) to make chunk name clean
|
|
39
|
-
*/
|
|
40
|
-
export declare function getClientDistFile(file: string, cwd: string): string;
|
|
41
37
|
export {};
|
package/dist/utils.js
CHANGED
|
@@ -23,7 +23,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
23
23
|
var utils_exports = {};
|
|
24
24
|
__export(utils_exports, {
|
|
25
25
|
getCache: () => getCache,
|
|
26
|
-
getClientDistFile: () => getClientDistFile,
|
|
27
26
|
getFileContentByRegExp: () => getFileContentByRegExp,
|
|
28
27
|
getFileRangeLines: () => getFileRangeLines,
|
|
29
28
|
getProjectRoot: () => getProjectRoot,
|
|
@@ -118,22 +117,9 @@ function getProjectRoot(cwd) {
|
|
|
118
117
|
}
|
|
119
118
|
return (0, import_plugin_utils.winPath)(cwd);
|
|
120
119
|
}
|
|
121
|
-
function getClientDistFile(file, cwd) {
|
|
122
|
-
let clientFile;
|
|
123
|
-
try {
|
|
124
|
-
clientFile = import_plugin_utils.resolve.sync(`dumi/${file}`, {
|
|
125
|
-
basedir: cwd,
|
|
126
|
-
preserveSymlinks: true
|
|
127
|
-
});
|
|
128
|
-
} catch {
|
|
129
|
-
clientFile = require.resolve(`../${file}`);
|
|
130
|
-
}
|
|
131
|
-
return (0, import_plugin_utils.winPath)(clientFile);
|
|
132
|
-
}
|
|
133
120
|
// Annotate the CommonJS export names for ESM import in node:
|
|
134
121
|
0 && (module.exports = {
|
|
135
122
|
getCache,
|
|
136
|
-
getClientDistFile,
|
|
137
123
|
getFileContentByRegExp,
|
|
138
124
|
getFileRangeLines,
|
|
139
125
|
getProjectRoot,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dumi",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.20",
|
|
4
4
|
"description": "📖 Documentation Generator of React Component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"generator",
|
|
@@ -147,6 +147,7 @@
|
|
|
147
147
|
"@umijs/plugins": "4.0.32",
|
|
148
148
|
"dumi-theme-mobile": "workspace:*",
|
|
149
149
|
"eslint": "^8.20.0",
|
|
150
|
+
"fast-glob": "^3.2.12",
|
|
150
151
|
"father": "^4.1.0",
|
|
151
152
|
"highlight-words-core": "^1.2.2",
|
|
152
153
|
"husky": "^8.0.1",
|