dumi 2.4.52 → 2.4.53
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/file-system-cache/LICENSE +134 -0
- package/compiled/file-system-cache/index.d.ts +3 -0
- package/compiled/file-system-cache/index.js +1 -0
- package/compiled/file-system-cache/package.json +1 -0
- package/dist/assetParsers/block.js +32 -10
- package/dist/features/compile/index.js +5 -1
- package/dist/features/compile/utoopackLoaders.d.ts +3 -2
- package/dist/features/compile/utoopackLoaders.js +7 -6
- package/dist/features/meta.js +4 -4
- package/dist/features/tabs/utils.d.ts +3 -0
- package/dist/features/tabs/utils.js +41 -0
- package/dist/features/tabs.d.ts +1 -3
- package/dist/features/tabs.js +12 -19
- package/dist/loaders/constants.d.ts +2 -0
- package/dist/loaders/constants.js +32 -0
- package/dist/loaders/demo/index.js +3 -3
- package/dist/loaders/markdown/index.js +137 -67
- package/dist/loaders/markdown/transformer/rehypeDemo.js +7 -7
- package/dist/loaders/markdown/transformer/rehypeJsxify.js +1 -1
- package/dist/loaders/markdown/transformer/rehypeLink.js +32 -18
- package/dist/loaders/markdown/transformer/rehypeRaw.js +2 -2
- package/dist/loaders/markdown/transformer/rehypeText.d.ts +2 -1
- package/dist/loaders/markdown/transformer/rehypeText.js +3 -3
- package/dist/loaders/markdown/transformer/remarkBreaks.js +4 -4
- package/dist/loaders/markdown/transformer/remarkEmbed.js +2 -2
- package/dist/loaders/markdown/transformer/remarkMeta.js +9 -9
- package/dist/techStacks/utils.js +2 -2
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +16 -16
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { UTOOPACK_LOADER_CTX_KEY } from '../../loaders/constants';
|
|
1
2
|
import type { IApi, IDumiTechStack } from '../../types';
|
|
2
|
-
export
|
|
3
|
+
export { UTOOPACK_LOADER_CTX_KEY };
|
|
3
4
|
export declare const LOADER_CTX_FILENAME = "dumi-loader-ctx.cjs";
|
|
4
5
|
export declare const UTOOPACK_DEMO_ASSETS_FILENAME = "dumi-utoopack-demo-assets.jsonl";
|
|
5
6
|
export declare function buildLoaderContextContent(techStacks: IDumiTechStack[], builtins?: Record<string, {
|
|
6
7
|
specifier: string;
|
|
7
8
|
source: string;
|
|
8
|
-
}>, routes?: Record<string, unknown>, extraRemarkPlugins?: IApi['config']['extraRemarkPlugins'], extraRehypePlugins?: IApi['config']['extraRehypePlugins'], sourceFiles?: string[], demoAssetsFile?: string, alias?: IApi['config']['alias']): string;
|
|
9
|
+
}>, routes?: Record<string, unknown>, extraRemarkPlugins?: IApi['config']['extraRemarkPlugins'], extraRehypePlugins?: IApi['config']['extraRehypePlugins'], sourceFiles?: string[], demoAssetsFile?: string, alias?: IApi['config']['alias'], cacheSession?: string): string;
|
|
9
10
|
export declare const getUtoopackRules: (api: IApi, config?: IApi['config']) => Record<string, unknown>;
|
|
@@ -31,11 +31,12 @@ var utoopackLoaders_exports = {};
|
|
|
31
31
|
__export(utoopackLoaders_exports, {
|
|
32
32
|
LOADER_CTX_FILENAME: () => LOADER_CTX_FILENAME,
|
|
33
33
|
UTOOPACK_DEMO_ASSETS_FILENAME: () => UTOOPACK_DEMO_ASSETS_FILENAME,
|
|
34
|
-
UTOOPACK_LOADER_CTX_KEY: () => UTOOPACK_LOADER_CTX_KEY,
|
|
34
|
+
UTOOPACK_LOADER_CTX_KEY: () => import_constants.UTOOPACK_LOADER_CTX_KEY,
|
|
35
35
|
buildLoaderContextContent: () => buildLoaderContextContent,
|
|
36
36
|
getUtoopackRules: () => getUtoopackRules
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(utoopackLoaders_exports);
|
|
39
|
+
var import_constants = require("../../loaders/constants");
|
|
39
40
|
var import_esbuild = __toESM(require("@umijs/bundler-utils/compiled/esbuild"));
|
|
40
41
|
var import_utils = require("@umijs/utils");
|
|
41
42
|
var import_path = __toESM(require("path"));
|
|
@@ -43,7 +44,6 @@ var import_utils2 = require("./utils");
|
|
|
43
44
|
var mdLoaderPath = require.resolve("../../loaders/markdown");
|
|
44
45
|
var utilsRegisterPath = require.resolve("@umijs/utils");
|
|
45
46
|
var esbuildImplementorPath = require.resolve("@umijs/bundler-utils/compiled/esbuild");
|
|
46
|
-
var UTOOPACK_LOADER_CTX_KEY = "__dumiLoaderContextPath";
|
|
47
47
|
var LOADER_CTX_FILENAME = "dumi-loader-ctx.cjs";
|
|
48
48
|
var UTOOPACK_DEMO_ASSETS_FILENAME = "dumi-utoopack-demo-assets.jsonl";
|
|
49
49
|
function toSerializable(value) {
|
|
@@ -171,7 +171,7 @@ function toPluginRefs(plugins = [], sourceFiles = []) {
|
|
|
171
171
|
return toPluginTargetRef(plugin, sourceFiles);
|
|
172
172
|
}).join(", ")}]`;
|
|
173
173
|
}
|
|
174
|
-
function buildLoaderContextContent(techStacks, builtins = {}, routes = {}, extraRemarkPlugins = [], extraRehypePlugins = [], sourceFiles = [], demoAssetsFile, alias) {
|
|
174
|
+
function buildLoaderContextContent(techStacks, builtins = {}, routes = {}, extraRemarkPlugins = [], extraRehypePlugins = [], sourceFiles = [], demoAssetsFile, alias, cacheSession) {
|
|
175
175
|
const refs = toTechStackRefs(techStacks);
|
|
176
176
|
return `'use strict';
|
|
177
177
|
try {
|
|
@@ -187,7 +187,8 @@ exports.techStacks = [${refs.join(", ")}];
|
|
|
187
187
|
exports.builtins = ${JSON.stringify(builtins)};
|
|
188
188
|
exports.routes = ${JSON.stringify(routes)};
|
|
189
189
|
exports.alias = ${JSON.stringify(alias)};
|
|
190
|
-
exports.
|
|
190
|
+
` + (cacheSession === void 0 ? "" : `exports.cacheSession = ${JSON.stringify(cacheSession)};
|
|
191
|
+
`) + `exports.demoAssetsFile = ${JSON.stringify(demoAssetsFile)};
|
|
191
192
|
exports.extraRemarkPlugins = ${toPluginRefs(
|
|
192
193
|
extraRemarkPlugins,
|
|
193
194
|
sourceFiles
|
|
@@ -224,13 +225,13 @@ var getUtoopackRules = (api, config = api.config) => {
|
|
|
224
225
|
config.extraBabelPlugins,
|
|
225
226
|
api.cwd
|
|
226
227
|
),
|
|
227
|
-
[UTOOPACK_LOADER_CTX_KEY]: loaderContextPath
|
|
228
|
+
[import_constants.UTOOPACK_LOADER_CTX_KEY]: loaderContextPath
|
|
228
229
|
});
|
|
229
230
|
const externalDemoLoader = {
|
|
230
231
|
loader: require.resolve("../../loaders/demo"),
|
|
231
232
|
options: toSerializable({
|
|
232
233
|
cwd: api.cwd,
|
|
233
|
-
[UTOOPACK_LOADER_CTX_KEY]: loaderContextPath
|
|
234
|
+
[import_constants.UTOOPACK_LOADER_CTX_KEY]: loaderContextPath
|
|
234
235
|
})
|
|
235
236
|
};
|
|
236
237
|
return {
|
package/dist/features/meta.js
CHANGED
|
@@ -36,9 +36,9 @@ __export(meta_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(meta_exports);
|
|
38
38
|
var import_utils = require("../utils");
|
|
39
|
+
var import_utils2 = require("@umijs/utils");
|
|
39
40
|
var import_path = __toESM(require("path"));
|
|
40
|
-
var
|
|
41
|
-
var import_tabs = require("./tabs");
|
|
41
|
+
var import_utils3 = require("./tabs/utils");
|
|
42
42
|
var TABS_META_PATH = "dumi/meta/tabs.ts";
|
|
43
43
|
var ATOMS_META_PATH = "dumi/meta/atoms.ts";
|
|
44
44
|
var DEMO_INDEX_META_PATH = "dumi/meta/demoIndex.ts";
|
|
@@ -51,10 +51,10 @@ var meta_default = (api) => {
|
|
|
51
51
|
fn: (routes) => {
|
|
52
52
|
metaFiles.length = 0;
|
|
53
53
|
Object.values(routes).forEach((route) => {
|
|
54
|
-
if (!route.isLayout && !/\*|:/.test(route.path) && route.file && !(0,
|
|
54
|
+
if (!route.isLayout && !/\*|:/.test(route.path) && route.file && !(0, import_utils3.isTabRouteFile)(route.file)) {
|
|
55
55
|
metaFiles.push({
|
|
56
56
|
index: metaFiles.length,
|
|
57
|
-
file: (0,
|
|
57
|
+
file: (0, import_utils2.winPath)(route.file),
|
|
58
58
|
id: route.id
|
|
59
59
|
});
|
|
60
60
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/features/tabs/utils.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
getHostForTabRouteFile: () => getHostForTabRouteFile,
|
|
23
|
+
getTabKeyFromFile: () => getTabKeyFromFile,
|
|
24
|
+
isTabRouteFile: () => isTabRouteFile
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(utils_exports);
|
|
27
|
+
function isTabRouteFile(file) {
|
|
28
|
+
return file.includes("$tab-");
|
|
29
|
+
}
|
|
30
|
+
function getTabKeyFromFile(file) {
|
|
31
|
+
return file.match(/\$tab-([^.]+)/)[1];
|
|
32
|
+
}
|
|
33
|
+
function getHostForTabRouteFile(file) {
|
|
34
|
+
return file.replace(/\$tab-[^.]+\./, "");
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
getHostForTabRouteFile,
|
|
39
|
+
getTabKeyFromFile,
|
|
40
|
+
isTabRouteFile
|
|
41
|
+
});
|
package/dist/features/tabs.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IApi } from '../types';
|
|
2
|
+
export { getHostForTabRouteFile, getTabKeyFromFile, isTabRouteFile, } from './tabs/utils';
|
|
2
3
|
export interface IContentTab {
|
|
3
4
|
key: string;
|
|
4
5
|
id?: string;
|
|
@@ -7,9 +8,6 @@ export interface IContentTab {
|
|
|
7
8
|
titleIntlId?: string;
|
|
8
9
|
component: string;
|
|
9
10
|
}
|
|
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
11
|
export default _default;
|
|
14
12
|
/**
|
|
15
13
|
* plugin for add conventional tab and plugin tab into page content
|
package/dist/features/tabs.js
CHANGED
|
@@ -30,24 +30,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var tabs_exports = {};
|
|
31
31
|
__export(tabs_exports, {
|
|
32
32
|
default: () => tabs_default,
|
|
33
|
-
getHostForTabRouteFile: () => getHostForTabRouteFile,
|
|
34
|
-
getTabKeyFromFile: () => getTabKeyFromFile,
|
|
35
|
-
isTabRouteFile: () => isTabRouteFile
|
|
33
|
+
getHostForTabRouteFile: () => import_utils4.getHostForTabRouteFile,
|
|
34
|
+
getTabKeyFromFile: () => import_utils4.getTabKeyFromFile,
|
|
35
|
+
isTabRouteFile: () => import_utils4.isTabRouteFile
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(tabs_exports);
|
|
38
38
|
var import_utils = require("@umijs/core/dist/route/utils");
|
|
39
|
+
var import_utils2 = require("@umijs/utils");
|
|
39
40
|
var import_path = __toESM(require("path"));
|
|
40
|
-
var import_plugin_utils = require("umi/plugin-utils");
|
|
41
41
|
var import_meta = require("./meta");
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
function getTabKeyFromFile(file) {
|
|
46
|
-
return file.match(/\$tab-([^.]+)/)[1];
|
|
47
|
-
}
|
|
48
|
-
function getHostForTabRouteFile(file) {
|
|
49
|
-
return file.replace(/\$tab-[^.]+\./, "");
|
|
50
|
-
}
|
|
42
|
+
var import_utils3 = require("./tabs/utils");
|
|
43
|
+
var import_utils4 = require("./tabs/utils");
|
|
51
44
|
var tabs_default = (api) => {
|
|
52
45
|
let tabsFromPlugins;
|
|
53
46
|
const routesTabMapping = {};
|
|
@@ -59,7 +52,7 @@ var tabs_default = (api) => {
|
|
|
59
52
|
});
|
|
60
53
|
tabsFromPlugins.forEach((tab) => {
|
|
61
54
|
tab.id ?? (tab.id = `plugin-tab-${tab.key}`);
|
|
62
|
-
tab.component = (0,
|
|
55
|
+
tab.component = (0, import_utils2.winPath)(tab.component);
|
|
63
56
|
});
|
|
64
57
|
return memo;
|
|
65
58
|
});
|
|
@@ -67,11 +60,11 @@ var tabs_default = (api) => {
|
|
|
67
60
|
tabs.length = 0;
|
|
68
61
|
Object.values(routes).forEach((route) => {
|
|
69
62
|
var _a;
|
|
70
|
-
if (route.file && isTabRouteFile(route.file)) {
|
|
63
|
+
if (route.file && (0, import_utils3.isTabRouteFile)(route.file)) {
|
|
71
64
|
delete routes[route.id];
|
|
72
|
-
const rtlFile = (0,
|
|
65
|
+
const rtlFile = (0, import_utils2.winPath)(import_path.default.relative(api.cwd, route.file));
|
|
73
66
|
const routeId = (0, import_utils.createRouteId)(rtlFile);
|
|
74
|
-
const tabKey = getTabKeyFromFile(rtlFile);
|
|
67
|
+
const tabKey = (0, import_utils3.getTabKeyFromFile)(rtlFile);
|
|
75
68
|
const parentFile = route.file.replace(/\$tab-[^.]+\./, "");
|
|
76
69
|
tabs.push({
|
|
77
70
|
index: tabs.length,
|
|
@@ -101,7 +94,7 @@ var tabs_default = (api) => {
|
|
|
101
94
|
index: tabs.length + index,
|
|
102
95
|
key: tab.key,
|
|
103
96
|
id: tab.id,
|
|
104
|
-
title: tab.title ||
|
|
97
|
+
title: tab.title || import_utils2.lodash.startCase(import_path.default.parse(tab.component).name),
|
|
105
98
|
titleIntlId: tab.titleIntlId,
|
|
106
99
|
file: tab.component
|
|
107
100
|
}))
|
|
@@ -133,7 +126,7 @@ var tabs_default = (api) => {
|
|
|
133
126
|
api.writeTmpFile({
|
|
134
127
|
noPluginDir: true,
|
|
135
128
|
path: import_meta.TABS_META_PATH,
|
|
136
|
-
content:
|
|
129
|
+
content: import_utils2.Mustache.render(
|
|
137
130
|
`{{#tabs}}
|
|
138
131
|
import * as tab{{{index}}} from '{{{file}}}';
|
|
139
132
|
{{/tabs}}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/loaders/constants.ts
|
|
20
|
+
var constants_exports = {};
|
|
21
|
+
__export(constants_exports, {
|
|
22
|
+
CONTENT_TEXTS_OBJ_NAME: () => CONTENT_TEXTS_OBJ_NAME,
|
|
23
|
+
UTOOPACK_LOADER_CTX_KEY: () => UTOOPACK_LOADER_CTX_KEY
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(constants_exports);
|
|
26
|
+
var UTOOPACK_LOADER_CTX_KEY = "__dumiLoaderContextPath";
|
|
27
|
+
var CONTENT_TEXTS_OBJ_NAME = "$$contentTexts";
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
CONTENT_TEXTS_OBJ_NAME,
|
|
31
|
+
UTOOPACK_LOADER_CTX_KEY
|
|
32
|
+
});
|
|
@@ -22,13 +22,13 @@ __export(demo_exports, {
|
|
|
22
22
|
default: () => demoLoader
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(demo_exports);
|
|
25
|
-
var
|
|
25
|
+
var import_constants = require("../constants");
|
|
26
26
|
var import_utils = require("@umijs/utils");
|
|
27
27
|
function demoLoader(raw) {
|
|
28
28
|
const opts = this.getOptions();
|
|
29
29
|
let techStacks = opts.techStacks;
|
|
30
|
-
if (!techStacks && opts[
|
|
31
|
-
const ctx = require(opts[
|
|
30
|
+
if (!techStacks && opts[import_constants.UTOOPACK_LOADER_CTX_KEY]) {
|
|
31
|
+
const ctx = require(opts[import_constants.UTOOPACK_LOADER_CTX_KEY]);
|
|
32
32
|
techStacks = ctx.techStacks;
|
|
33
33
|
}
|
|
34
34
|
const techStackName = new URLSearchParams(this.resourceQuery).get(
|