dumi 2.4.40-alpha.0 → 2.4.41
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.
|
@@ -27,5 +27,6 @@ type MdLoaderCache = {
|
|
|
27
27
|
getSync: (key: string, defaultValue: any) => any;
|
|
28
28
|
};
|
|
29
29
|
export declare function getMdLoaderCacheSync<T>(cache: MdLoaderCache, key: string, defaultValue: T): T;
|
|
30
|
+
export declare function getDemoSourceFiles(demos?: IMdTransformerResult['meta']['demos']): string[];
|
|
30
31
|
export default function mdLoader(this: any, content: string): void;
|
|
31
32
|
export {};
|
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var markdown_exports = {};
|
|
31
31
|
__export(markdown_exports, {
|
|
32
32
|
default: () => mdLoader,
|
|
33
|
+
getDemoSourceFiles: () => getDemoSourceFiles,
|
|
33
34
|
getMdLoaderCacheSync: () => getMdLoaderCacheSync
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(markdown_exports);
|
|
@@ -55,15 +56,24 @@ function getMdLoaderCacheSync(cache, key, defaultValue) {
|
|
|
55
56
|
throw err;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
59
|
+
function getDemoSidecarFiles(file) {
|
|
60
|
+
const { dir, name } = import_path.default.parse(file);
|
|
61
|
+
const mdFile = import_path.default.join(dir, `${name}.md`);
|
|
62
|
+
return import_fs.default.existsSync(mdFile) ? [mdFile] : [];
|
|
63
|
+
}
|
|
58
64
|
function getDemoSourceFiles(demos = []) {
|
|
59
|
-
|
|
65
|
+
const files = /* @__PURE__ */ new Set();
|
|
66
|
+
demos.forEach((demo) => {
|
|
60
67
|
if ("resolveMap" in demo) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
Object.values(demo.resolveMap).filter((p) => import_path.default.isAbsolute(p)).forEach((file) => {
|
|
69
|
+
files.add(file);
|
|
70
|
+
getDemoSidecarFiles(file).forEach(
|
|
71
|
+
(sidecarFile) => files.add(sidecarFile)
|
|
72
|
+
);
|
|
73
|
+
});
|
|
64
74
|
}
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
});
|
|
76
|
+
return Array.from(files);
|
|
67
77
|
}
|
|
68
78
|
function isRelativePath(path2) {
|
|
69
79
|
return /^\.{1,2}(?!\w)/.test(path2);
|
|
@@ -417,5 +427,6 @@ function mdLoader(content) {
|
|
|
417
427
|
}
|
|
418
428
|
// Annotate the CommonJS export names for ESM import in node:
|
|
419
429
|
0 && (module.exports = {
|
|
430
|
+
getDemoSourceFiles,
|
|
420
431
|
getMdLoaderCacheSync
|
|
421
432
|
});
|