dumi 2.3.6 → 2.3.8
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.
|
@@ -41,14 +41,19 @@ function getCachedRouteMeta(route) {
|
|
|
41
41
|
var proxyGetter = function proxyGetter(target, prop) {
|
|
42
42
|
if (ASYNC_META_PROPS.includes(prop)) {
|
|
43
43
|
if (!asyncCache.get(cacheKey)) {
|
|
44
|
+
var routeMetaPromise = getRouteMetaById(route.id);
|
|
44
45
|
// load async meta then replace cache
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
if (routeMetaPromise) {
|
|
47
|
+
asyncCache.set(cacheKey, routeMetaPromise.then(function (full) {
|
|
48
|
+
return cache.set(cacheKey, merge(full)).get(cacheKey);
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
48
51
|
}
|
|
49
|
-
|
|
50
52
|
// throw promise to trigger suspense
|
|
51
|
-
|
|
53
|
+
var currentCache = asyncCache.get(cacheKey);
|
|
54
|
+
if (currentCache) {
|
|
55
|
+
throw currentCache;
|
|
56
|
+
}
|
|
52
57
|
}
|
|
53
58
|
return target[prop];
|
|
54
59
|
};
|
|
@@ -140,11 +140,12 @@ export function getRouteMetaById<T extends { syncOnly?: boolean }>(
|
|
|
140
140
|
): T extends { syncOnly: true }
|
|
141
141
|
? IRouteMeta | undefined
|
|
142
142
|
: Promise<IRouteMeta> | undefined {
|
|
143
|
+
|
|
143
144
|
if (filesMeta[id]) {
|
|
144
145
|
const { frontmatter, toc, textGetter, tabs } = filesMeta[id];
|
|
145
146
|
const routeMeta: IRouteMeta = {
|
|
146
147
|
frontmatter,
|
|
147
|
-
toc
|
|
148
|
+
toc,
|
|
148
149
|
texts: [],
|
|
149
150
|
};
|
|
150
151
|
|
package/package.json
CHANGED
|
@@ -262,7 +262,7 @@ var API = function API(props) {
|
|
|
262
262
|
id: 'api.component.description'
|
|
263
263
|
})), /*#__PURE__*/React.createElement("th", null, intl.formatMessage({
|
|
264
264
|
id: 'api.component.type'
|
|
265
|
-
})),
|
|
265
|
+
})), type === 'props' && /*#__PURE__*/React.createElement("th", null, intl.formatMessage({
|
|
266
266
|
id: 'api.component.default'
|
|
267
267
|
})))), /*#__PURE__*/React.createElement("tbody", null, Object.keys(properties).length ? Object.entries(properties).map(function (_ref9) {
|
|
268
268
|
var _definition$propsConf;
|
|
@@ -274,7 +274,7 @@ var API = function API(props) {
|
|
|
274
274
|
}, /*#__PURE__*/React.createElement("td", null, releaseInfo[name] ? /*#__PURE__*/React.createElement(APIRelease, {
|
|
275
275
|
name: name,
|
|
276
276
|
info: releaseInfo[name]
|
|
277
|
-
}) : name), /*#__PURE__*/React.createElement("td", null, prop.description || '--'), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(APIType, prop)),
|
|
277
|
+
}) : name), /*#__PURE__*/React.createElement("td", null, prop.description || '--'), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(APIType, prop)), type === 'props' && /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("code", null, (_definition$propsConf = definition.propsConfig.required) !== null && _definition$propsConf !== void 0 && _definition$propsConf.includes(name) ? intl.formatMessage({
|
|
278
278
|
id: 'api.component.required'
|
|
279
279
|
}) : JSON.stringify(prop.default) || '--')));
|
|
280
280
|
}) : /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|