@hejiayue/x-markdown-test 0.0.1-beta.108 → 0.0.1-beta.110

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.
@@ -464,8 +464,6 @@ function useClipboard(options = {}) {
464
464
  copy
465
465
  };
466
466
  }
467
- const SHIKI_PKG = "shiki";
468
- const SHIKI_STREAM_PKG = "shiki-stream";
469
467
  let shikiModulePromise = null;
470
468
  let shikiStreamModulePromise = null;
471
469
  let hasShownDependencyHint = false;
@@ -490,21 +488,31 @@ const showDependencyHint = () => {
490
488
  "color: #999; font-size: 12px;"
491
489
  );
492
490
  };
493
- const loadShiki = () => {
491
+ const loadShiki = async () => {
494
492
  if (!shikiModulePromise) {
495
- shikiModulePromise = import(SHIKI_PKG).catch(() => {
496
- showDependencyHint();
497
- return null;
498
- });
493
+ shikiModulePromise = (async () => {
494
+ try {
495
+ const mod = await import("shiki");
496
+ return mod;
497
+ } catch {
498
+ showDependencyHint();
499
+ return null;
500
+ }
501
+ })();
499
502
  }
500
503
  return shikiModulePromise;
501
504
  };
502
- const loadShikiStream = () => {
505
+ const loadShikiStream = async () => {
503
506
  if (!shikiStreamModulePromise) {
504
- shikiStreamModulePromise = import(SHIKI_STREAM_PKG).catch(() => {
505
- showDependencyHint();
506
- return null;
507
- });
507
+ shikiStreamModulePromise = (async () => {
508
+ try {
509
+ const mod = await import("shiki-stream");
510
+ return mod;
511
+ } catch {
512
+ showDependencyHint();
513
+ return null;
514
+ }
515
+ })();
508
516
  }
509
517
  return shikiStreamModulePromise;
510
518
  };
@@ -1136,7 +1144,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1136
1144
  }
1137
1145
  });
1138
1146
  const CodeLine = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-97166d5b"]]);
1139
- const Mermaid = defineAsyncComponent(() => import("./index-BjeepIV6.js"));
1147
+ const Mermaid = defineAsyncComponent(() => import("./index-DoC1ohUF.js"));
1140
1148
  const _sfc_main = defineComponent({
1141
1149
  props: {
1142
1150
  raw: { type: Object, default: () => ({}) },
@@ -1318,9 +1326,29 @@ function downloadSvgAsPng(svg2) {
1318
1326
  console.error("Failed to download SVG:", error);
1319
1327
  }
1320
1328
  }
1321
- const MERMAID_PKG = "mermaid";
1322
1329
  let mermaidPromise = null;
1323
1330
  let hasShownMermaidHint = false;
1331
+ let mermaidAvailableCache = null;
1332
+ let mermaidCheckPromise = null;
1333
+ async function checkMermaidAvailable() {
1334
+ if (mermaidAvailableCache !== null) {
1335
+ return mermaidAvailableCache;
1336
+ }
1337
+ if (mermaidCheckPromise) {
1338
+ return mermaidCheckPromise;
1339
+ }
1340
+ mermaidCheckPromise = (async () => {
1341
+ try {
1342
+ await import("mermaid");
1343
+ mermaidAvailableCache = true;
1344
+ return true;
1345
+ } catch (error) {
1346
+ mermaidAvailableCache = false;
1347
+ return false;
1348
+ }
1349
+ })();
1350
+ return mermaidCheckPromise;
1351
+ }
1324
1352
  const showMermaidHint = () => {
1325
1353
  if (hasShownMermaidHint) return;
1326
1354
  hasShownMermaidHint = true;
@@ -1345,10 +1373,15 @@ const showMermaidHint = () => {
1345
1373
  async function loadMermaid() {
1346
1374
  if (typeof window === "undefined") return null;
1347
1375
  if (!mermaidPromise) {
1348
- mermaidPromise = import(MERMAID_PKG).then((m) => m.default).catch(() => {
1349
- showMermaidHint();
1350
- return null;
1351
- });
1376
+ mermaidPromise = (async () => {
1377
+ try {
1378
+ const mod = await import("mermaid");
1379
+ return mod.default;
1380
+ } catch {
1381
+ showMermaidHint();
1382
+ return null;
1383
+ }
1384
+ })();
1352
1385
  }
1353
1386
  return mermaidPromise;
1354
1387
  }
@@ -1837,20 +1870,21 @@ export {
1837
1870
  VueMarkdown as V,
1838
1871
  useMermaidZoom as a,
1839
1872
  useClipboard as b,
1840
- VueMarkdownAsync as c,
1873
+ checkMermaidAvailable as c,
1841
1874
  downloadSvgAsPng as d,
1842
- MarkdownRendererAsync as e,
1843
- renderChildren as f,
1875
+ VueMarkdownAsync as e,
1876
+ MarkdownRendererAsync as f,
1844
1877
  getVNodeInfos as g,
1845
- createProcessor as h,
1846
- useMarkdownProcessor as i,
1847
- useComponents as j,
1848
- useHighlight as k,
1849
- useProcessMarkdown as l,
1850
- usePlugins as m,
1851
- useTheme as n,
1878
+ renderChildren as h,
1879
+ createProcessor as i,
1880
+ useMarkdownProcessor as j,
1881
+ useComponents as k,
1882
+ useHighlight as l,
1883
+ useProcessMarkdown as m,
1884
+ usePlugins as n,
1885
+ useTheme as o,
1852
1886
  preprocessLaTeX as p,
1853
1887
  render as r,
1854
1888
  useMermaid as u
1855
1889
  };
1856
- //# sourceMappingURL=index-Ys7-7uFi.js.map
1890
+ //# sourceMappingURL=index-BL_6QZNq.js.map