dumi 2.0.0-beta.11 → 2.0.0-beta.12
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.
|
@@ -30,7 +30,7 @@ function getSchemas() {
|
|
|
30
30
|
resolve: (Joi) => Joi.object({
|
|
31
31
|
docDirs: Joi.array().items(Joi.alternatives(Joi.string(), Joi.object({ dir: Joi.string(), type: Joi.string().optional() }))).optional(),
|
|
32
32
|
atomDirs: Joi.array().items(Joi.object({ type: Joi.string(), dir: Joi.string() })).optional(),
|
|
33
|
-
entityDirs: Joi.forbidden().error(new Error("`entityDirs` is already deprecated, please rename it to `atomDirs` in `.
|
|
33
|
+
entityDirs: Joi.forbidden().error(new Error("`entityDirs` is already deprecated, please rename it to `atomDirs` in `.dumirc.ts`")),
|
|
34
34
|
codeBlockMode: Joi.string().valid("active", "passive").optional(),
|
|
35
35
|
entryFile: Joi.string().optional()
|
|
36
36
|
}).optional(),
|
|
@@ -39,7 +39,7 @@ function getPkgThemeName(api) {
|
|
|
39
39
|
}
|
|
40
40
|
function getPkgThemePath(api) {
|
|
41
41
|
const pkgThemeName = getPkgThemeName(api);
|
|
42
|
-
return pkgThemeName && import_path.default.
|
|
42
|
+
return pkgThemeName && import_path.default.dirname(require.resolve(`${pkgThemeName}/package.json`, { paths: [api.cwd] }));
|
|
43
43
|
}
|
|
44
44
|
var theme_default = (api) => {
|
|
45
45
|
const defaultThemeData = (0, import_loader.default)(DEFAULT_THEME_PATH);
|
|
@@ -147,6 +147,16 @@ export default function DumiContextWrapper() {
|
|
|
147
147
|
}`
|
|
148
148
|
});
|
|
149
149
|
});
|
|
150
|
+
if (require("@umijs/core/package").__npminstall_done && import_fs.default.existsSync(localThemePath) && import_fs.default.lstatSync(localThemePath).isSymbolicLink()) {
|
|
151
|
+
api.chainWebpack((memo) => {
|
|
152
|
+
const devThemeNodeModules = import_path.default.join(api.cwd, "../node_modules");
|
|
153
|
+
memo.snapshot((0, import_plugin_utils.deepmerge)(memo.get("snapshot"), {
|
|
154
|
+
immutablePaths: [devThemeNodeModules],
|
|
155
|
+
managedPaths: [devThemeNodeModules]
|
|
156
|
+
}));
|
|
157
|
+
return memo;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
150
160
|
};
|
|
151
161
|
// Annotate the CommonJS export names for ESM import in node:
|
|
152
162
|
0 && (module.exports = {});
|
|
@@ -49,7 +49,7 @@ function getCodeLang(node, opts) {
|
|
|
49
49
|
var _a, _b, _c, _d;
|
|
50
50
|
let lang = "";
|
|
51
51
|
if (typeof ((_a = node.properties) == null ? void 0 : _a.src) === "string") {
|
|
52
|
-
node.properties.src = opts.resolver(import_path.default.dirname(opts.fileAbsPath), node.properties.src);
|
|
52
|
+
node.properties.src = (0, import_plugin_utils.winPath)(opts.resolver(import_path.default.dirname(opts.fileAbsPath), node.properties.src));
|
|
53
53
|
lang = import_path.default.extname(node.properties.src).slice(1);
|
|
54
54
|
} else if (Array.isArray((_b = node.properties) == null ? void 0 : _b.className) && (opts.codeBlockMode === "passive" ? / demo/.test(String((_c = node.data) == null ? void 0 : _c.meta)) : !/ pure/.test(String((_d = node.data) == null ? void 0 : _d.meta)))) {
|
|
55
55
|
lang = String(node.properties.className[0]).replace("language-", "");
|
package/dist/preset.js
CHANGED
|
@@ -25,8 +25,21 @@ __export(preset_exports, {
|
|
|
25
25
|
default: () => preset_default
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(preset_exports);
|
|
28
|
+
var import_fs = __toESM(require("fs"));
|
|
29
|
+
var import_path = __toESM(require("path"));
|
|
30
|
+
var import_plugin_utils = require("umi/plugin-utils");
|
|
28
31
|
var preset_default = (api) => {
|
|
29
32
|
api.describe({ key: "dumi-preset" });
|
|
33
|
+
const legacyConfig = [
|
|
34
|
+
".umirc.ts",
|
|
35
|
+
".umirc.js",
|
|
36
|
+
"config/config.ts",
|
|
37
|
+
"config/config.js"
|
|
38
|
+
].find((file) => import_fs.default.existsSync(import_path.default.join(api.cwd, file)));
|
|
39
|
+
if (legacyConfig) {
|
|
40
|
+
import_plugin_utils.logger.warn(`Detected you are using legacy config file \`${legacyConfig}\`, it will no longer be loaded, please migrate to the new \`.dumirc.ts\` file, and the tmp file also from \`.umi\` to \`.dumi/tmp\`, please update related files such as \`.gitignore\`, \`tsconfig.json\` & etc.`);
|
|
41
|
+
import_plugin_utils.logger.warn(`\u68C0\u6D4B\u5230\u4F60\u5728\u4F7F\u7528\u65E7\u914D\u7F6E\u6587\u4EF6 \`${legacyConfig}\`\uFF0C\u5B83\u5DF2\u4E0D\u518D\u751F\u6548\uFF0C\u8BF7\u5C06\u5185\u5BB9\u8FC1\u79FB\u5230\u65B0\u7684 \`.dumirc.ts\` \u914D\u7F6E\u6587\u4EF6\u4E2D\uFF0C\u53E6\u5916\u4E34\u65F6\u6587\u4EF6\u5939\u4E5F\u4ECE \`.umi\` \u8FC1\u79FB\u5230 \`.dumi/tmp\`\uFF0C\u8BF7\u540C\u65F6\u66F4\u65B0\u76F8\u5173\u6587\u4EF6\u5982 \`.gitignore\`\u3001\`tsconfig.json\` \u7B49`);
|
|
42
|
+
}
|
|
30
43
|
return {
|
|
31
44
|
plugins: [
|
|
32
45
|
require.resolve("./registerMethods"),
|