dumi 2.3.2 → 2.3.3-beta.0
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/block.js +1 -1
- package/dist/features/compile/babelLoaderCustomize.js +3 -1
- package/dist/features/meta.js +2 -1
- package/dist/features/theme/index.js +3 -1
- package/dist/loaders/markdown/transformer/index.js +2 -4
- package/dist/templates/ContextWrapper.ts.tpl +1 -1
- package/dist/templates/meta/runtime.ts.tpl +1 -1
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +11 -0
- package/package.json +1 -1
|
@@ -144,7 +144,7 @@ async function parseBlockAsset(opts) {
|
|
|
144
144
|
}
|
|
145
145
|
);
|
|
146
146
|
["description", "title"].forEach((key) => {
|
|
147
|
-
frontmatter[key]
|
|
147
|
+
frontmatter[key] = frontmatter[`${key}.${opts.fileLocale}`] || frontmatter[key];
|
|
148
148
|
});
|
|
149
149
|
result.frontmatter = frontmatter;
|
|
150
150
|
}
|
|
@@ -26,7 +26,9 @@ function babelLoaderCustomize() {
|
|
|
26
26
|
return {
|
|
27
27
|
config(config) {
|
|
28
28
|
const context = this;
|
|
29
|
-
if (config.options.filename &&
|
|
29
|
+
if (config.options.filename && ["type=demo", "type=frontmatter", "type=demo-index", "type=text"].some(
|
|
30
|
+
(v) => context.resourceQuery.includes(v)
|
|
31
|
+
)) {
|
|
30
32
|
config.options.filename += context.resourceQuery;
|
|
31
33
|
}
|
|
32
34
|
return config.options;
|
package/dist/features/meta.js
CHANGED
|
@@ -98,7 +98,8 @@ var meta_default = (api) => {
|
|
|
98
98
|
path: "dumi/meta/runtime.ts",
|
|
99
99
|
tplPath: require.resolve("../templates/meta/runtime.ts.tpl"),
|
|
100
100
|
context: {
|
|
101
|
-
deepmerge: (0, import_plugin_utils.winPath)(import_path.default.dirname(require.resolve("deepmerge/package")))
|
|
101
|
+
deepmerge: (0, import_plugin_utils.winPath)(import_path.default.dirname(require.resolve("deepmerge/package"))),
|
|
102
|
+
rc_util: (0, import_plugin_utils.winPath)(import_path.default.dirname(require.resolve("rc-util/package")))
|
|
102
103
|
}
|
|
103
104
|
});
|
|
104
105
|
api.writeTmpFile({
|
|
@@ -33,6 +33,7 @@ __export(theme_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(theme_exports);
|
|
35
35
|
var import_constants = require("../../constants");
|
|
36
|
+
var import_utils = require("../../utils");
|
|
36
37
|
var import_bundler_utils = require("@umijs/bundler-utils");
|
|
37
38
|
var import_child_process = require("child_process");
|
|
38
39
|
var import_fs = __toESM(require("fs"));
|
|
@@ -87,7 +88,7 @@ function checkMinor2ByPkg(pkg) {
|
|
|
87
88
|
if ((_a = pkg.name) == null ? void 0 : _a.startsWith("@examples/"))
|
|
88
89
|
return true;
|
|
89
90
|
const ver = ((_b = pkg.peerDependencies) == null ? void 0 : _b.dumi) || ((_c = pkg.devDependencies) == null ? void 0 : _c.dumi) || "^2.0.0";
|
|
90
|
-
return
|
|
91
|
+
return (0, import_utils.isVersionInRange)(ver, import_constants.VERSION_2_LEVEL_NAV);
|
|
91
92
|
}
|
|
92
93
|
var theme_default = (api) => {
|
|
93
94
|
const defaultThemeData = (0, import_loader.default)(DEFAULT_THEME_PATH);
|
|
@@ -318,6 +319,7 @@ export default DumiLoading;
|
|
|
318
319
|
api.config.themeConfig
|
|
319
320
|
)
|
|
320
321
|
),
|
|
322
|
+
rc_util: (0, import_plugin_utils.winPath)(import_path.default.dirname(require.resolve("rc-util/package"))),
|
|
321
323
|
_2_level_nav_available: api.appData._2LevelNavAvailable
|
|
322
324
|
}
|
|
323
325
|
});
|
|
@@ -33,8 +33,8 @@ __export(transformer_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(transformer_exports);
|
|
35
35
|
var import_constants = require("../../../constants");
|
|
36
|
+
var import_utils = require("../../../utils");
|
|
36
37
|
var import_enhanced_resolve = __toESM(require("enhanced-resolve"));
|
|
37
|
-
var import_plugin_utils = require("umi/plugin-utils");
|
|
38
38
|
var import_rehypeDemo = __toESM(require("./rehypeDemo"));
|
|
39
39
|
var import_rehypeDesc = __toESM(require("./rehypeDesc"));
|
|
40
40
|
var import_rehypeEnhancedTag = __toESM(require("./rehypeEnhancedTag"));
|
|
@@ -56,9 +56,7 @@ function keepSoftBreak(pkg) {
|
|
|
56
56
|
if (((_a = pkg == null ? void 0 : pkg.name) == null ? void 0 : _a.startsWith("@examples/")) || (pkg == null ? void 0 : pkg.name) === "dumi")
|
|
57
57
|
return false;
|
|
58
58
|
const ver = ((_b = pkg == null ? void 0 : pkg.devDependencies) == null ? void 0 : _b.dumi) ?? ((_c = pkg == null ? void 0 : pkg.dependencies) == null ? void 0 : _c.dumi) ?? "^2.0.0";
|
|
59
|
-
return !
|
|
60
|
-
includePrerelease: true
|
|
61
|
-
});
|
|
59
|
+
return !(0, import_utils.isVersionInRange)(ver, import_constants.VERSION_2_DEPRECATE_SOFT_BREAKS);
|
|
62
60
|
}
|
|
63
61
|
async function applyUnifiedPlugin(opts) {
|
|
64
62
|
const [plugin, options] = Array.isArray(opts.plugin) ? opts.plugin : [opts.plugin];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react';
|
|
2
2
|
import { useOutlet, history } from 'dumi';
|
|
3
|
-
import { warning } from '
|
|
3
|
+
import { warning } from '{{{rc_util}}}';
|
|
4
4
|
import { SiteContext, type ISiteContext } from '{{{contextPath}}}';
|
|
5
5
|
import { components } from '../meta/atoms';
|
|
6
6
|
import { locales } from '../locales/config';
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Range, RangeOptions } from '@umijs/utils/compiled/semver';
|
|
1
2
|
import Cache from 'file-system-cache';
|
|
2
3
|
/**
|
|
3
4
|
* get route path from file-system path
|
|
@@ -47,4 +48,8 @@ export declare function generateMetaChunkName(path: string, cwd: string, locales
|
|
|
47
48
|
* generate hash for string
|
|
48
49
|
*/
|
|
49
50
|
export declare function getContentHash(content: string, length?: number): string;
|
|
51
|
+
/**
|
|
52
|
+
* check if version is in range
|
|
53
|
+
*/
|
|
54
|
+
export declare function isVersionInRange(version: string, range: string | Range, options?: RangeOptions): boolean;
|
|
50
55
|
export {};
|
package/dist/utils.js
CHANGED
|
@@ -38,6 +38,7 @@ __export(utils_exports, {
|
|
|
38
38
|
getFileIdFromFsPath: () => getFileIdFromFsPath,
|
|
39
39
|
getFileRangeLines: () => getFileRangeLines,
|
|
40
40
|
getProjectRoot: () => getProjectRoot,
|
|
41
|
+
isVersionInRange: () => isVersionInRange,
|
|
41
42
|
parseCodeFrontmatter: () => parseCodeFrontmatter,
|
|
42
43
|
tryFatherBuildConfigs: () => tryFatherBuildConfigs
|
|
43
44
|
});
|
|
@@ -159,6 +160,15 @@ function generateMetaChunkName(path2, cwd, locales = []) {
|
|
|
159
160
|
function getContentHash(content2, length = 8) {
|
|
160
161
|
return (0, import_crypto.createHash)("md5").update(content2).digest("hex").slice(0, length);
|
|
161
162
|
}
|
|
163
|
+
function isVersionInRange(version, range, options = { includePrerelease: true }) {
|
|
164
|
+
if (import_plugin_utils.semver.valid(version)) {
|
|
165
|
+
return import_plugin_utils.semver.satisfies(version, range, options);
|
|
166
|
+
}
|
|
167
|
+
if (import_plugin_utils.semver.validRange(version)) {
|
|
168
|
+
return import_plugin_utils.semver.subset(version, range, options);
|
|
169
|
+
}
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
162
172
|
// Annotate the CommonJS export names for ESM import in node:
|
|
163
173
|
0 && (module.exports = {
|
|
164
174
|
_setFSCacheDir,
|
|
@@ -170,6 +180,7 @@ function getContentHash(content2, length = 8) {
|
|
|
170
180
|
getFileIdFromFsPath,
|
|
171
181
|
getFileRangeLines,
|
|
172
182
|
getProjectRoot,
|
|
183
|
+
isVersionInRange,
|
|
173
184
|
parseCodeFrontmatter,
|
|
174
185
|
tryFatherBuildConfigs
|
|
175
186
|
});
|