dumi 2.4.1 → 2.4.3
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.
|
@@ -108,8 +108,8 @@ var compile_default = (api) => {
|
|
|
108
108
|
locales: api.config.locales,
|
|
109
109
|
pkg: api.pkg
|
|
110
110
|
};
|
|
111
|
+
memo.module.rule("watch-parent").pre().resourceQuery(/watch=parent/).use("null-loader").loader(require.resolve("../../loaders/null")).end();
|
|
111
112
|
const mdRule = memo.module.rule("dumi-md").type("javascript/auto").test(/\.md$/);
|
|
112
|
-
mdRule.oneOf("md-null").pre().resourceQuery(/watch=parent/).use("null-loader").loader(require.resolve("../../loaders/null")).end();
|
|
113
113
|
["frontmatter", "text", "demo-index"].forEach((type) => {
|
|
114
114
|
mdRule.oneOf(`md-${type}`).resourceQuery(new RegExp(`${type}$`)).use(`md-${type}-loader`).loader(loaderPath).options({
|
|
115
115
|
...loaderBaseOpts,
|
|
@@ -114,8 +114,12 @@ export const demos = {
|
|
|
114
114
|
Object.keys(this.resolveMap).forEach((file) => {
|
|
115
115
|
var _a;
|
|
116
116
|
if (((_a = asset.dependencies[file]) == null ? void 0 : _a.type) === "FILE") {
|
|
117
|
+
let assetValue = `{{{require('-!${resolveMap[file]}?dumi-raw').default}}}`;
|
|
118
|
+
if (process.env.OKAM) {
|
|
119
|
+
assetValue = `{{{require('${resolveMap[file]}?dumi-raw').default}}}`;
|
|
120
|
+
}
|
|
117
121
|
asset = import_plugin_utils.lodash.cloneDeep(asset);
|
|
118
|
-
asset.dependencies[file].value =
|
|
122
|
+
asset.dependencies[file].value = assetValue;
|
|
119
123
|
}
|
|
120
124
|
});
|
|
121
125
|
return JSON.stringify(asset, null, 2).replace(/"{{{|}}}"/g, "");
|
|
@@ -147,41 +147,29 @@ export function getRouteMetaById<T extends { syncOnly?: boolean }>(
|
|
|
147
147
|
toc,
|
|
148
148
|
texts: [],
|
|
149
149
|
};
|
|
150
|
-
if (filesMeta[id]) {
|
|
151
|
-
const { frontmatter, toc, textGetter, tabs } = filesMeta[id];
|
|
152
|
-
routeMeta.frontmatter = frontmatter;
|
|
153
|
-
routeMeta.toc = toc;
|
|
154
150
|
|
|
155
|
-
|
|
151
|
+
if (opts?.syncOnly) {
|
|
152
|
+
if (tabs) {
|
|
153
|
+
routeMeta.tabs = tabs.map((tabId) =>
|
|
154
|
+
genTab(tabId, getRouteMetaById(tabId, opts)),
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
return routeMeta;
|
|
158
|
+
} else {
|
|
159
|
+
return new Promise(async (resolve) => {
|
|
160
|
+
if (textGetter) {
|
|
161
|
+
({ texts: routeMeta.texts } = await textGetter());
|
|
162
|
+
}
|
|
156
163
|
if (tabs) {
|
|
157
|
-
routeMeta.tabs =
|
|
158
|
-
|
|
164
|
+
routeMeta.tabs = await Promise.all(
|
|
165
|
+
tabs.map(async (tabId) =>
|
|
166
|
+
genTab(tabId, await getRouteMetaById(tabId, opts)),
|
|
167
|
+
),
|
|
159
168
|
);
|
|
160
169
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
} else {
|
|
164
|
-
return new Promise(async (resolve) => {
|
|
165
|
-
if (textGetter) {
|
|
166
|
-
({ texts: routeMeta.texts } = await textGetter());
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (tabs) {
|
|
170
|
-
routeMeta.tabs = await Promise.all(
|
|
171
|
-
tabs.map(async (tabId) =>
|
|
172
|
-
genTab(tabId, await getRouteMetaById(tabId, opts)),
|
|
173
|
-
),
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
resolve(routeMeta);
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (opts?.syncOnly) {
|
|
182
|
-
return routeMeta;
|
|
170
|
+
resolve(routeMeta);
|
|
171
|
+
});
|
|
183
172
|
}
|
|
184
|
-
return Promise.resolve(routeMeta);
|
|
185
173
|
}
|
|
186
174
|
}
|
|
187
175
|
|