@youtyan/code-viewer 0.11.1 → 0.11.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youtyan/code-viewer",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
4
4
  "description": "Local browser-based code and git diff viewer",
5
5
  "type": "module",
6
6
  "bin": {
package/web/app.js CHANGED
@@ -8381,6 +8381,22 @@ ${lines.join("\n")}
8381
8381
  md.core.ruler.after("inline", "footnote_tail", footnote_tail);
8382
8382
  }
8383
8383
 
8384
+ // web-src/core/lazy-bundle.ts
8385
+ function createBundleLoader(bundleFile, init) {
8386
+ let pending = null;
8387
+ return () => {
8388
+ if (!pending) {
8389
+ pending = import(
8390
+ /* @vite-ignore */
8391
+ `/${bundleFile}`
8392
+ ).then(
8393
+ (mod) => init ? init(mod) : mod
8394
+ );
8395
+ }
8396
+ return pending;
8397
+ };
8398
+ }
8399
+
8384
8400
  // web-src/core/mermaid-loader.ts
8385
8401
  var DEFAULT_CONFIG = {
8386
8402
  startOnLoad: false,
@@ -8388,18 +8404,19 @@ ${lines.join("\n")}
8388
8404
  theme: "default",
8389
8405
  er: { useMaxWidth: false }
8390
8406
  };
8407
+ var loadMermaidModule = createBundleLoader("mermaid.js");
8391
8408
  var mermaidPromise = null;
8392
8409
  var initialized = false;
8393
8410
  function loadMermaid() {
8394
8411
  if (!mermaidPromise) {
8395
- mermaidPromise = import(`/${"mermaid.js"}`).then((mod) => {
8412
+ mermaidPromise = loadMermaidModule().then((mod) => {
8396
8413
  const mermaid = mod.default;
8397
8414
  if (!initialized) {
8398
8415
  mermaid.initialize(DEFAULT_CONFIG);
8399
8416
  initialized = true;
8400
8417
  }
8401
8418
  return mermaid;
8402
- }).catch(() => null);
8419
+ });
8403
8420
  }
8404
8421
  return mermaidPromise;
8405
8422
  }
@@ -8417,6 +8434,7 @@ ${lines.join("\n")}
8417
8434
  const pre = template.content.querySelector("pre");
8418
8435
  return pre ? pre.innerHTML : "";
8419
8436
  }
8437
+ var loadShikiModule = createBundleLoader("shiki.js");
8420
8438
  var cache = /* @__PURE__ */ new Map();
8421
8439
  function loadShikiHighlighter(options) {
8422
8440
  const key = JSON.stringify({
@@ -8425,12 +8443,12 @@ ${lines.join("\n")}
8425
8443
  });
8426
8444
  const cached = cache.get(key);
8427
8445
  if (cached) return cached;
8428
- const promise = import(`/${"shiki.js"}`).then(
8446
+ const promise = loadShikiModule().then(
8429
8447
  (mod) => mod.createHighlighter({
8430
8448
  themes: options.themes,
8431
8449
  langs: options.langs
8432
8450
  })
8433
- ).catch(() => null);
8451
+ );
8434
8452
  cache.set(key, promise);
8435
8453
  return promise;
8436
8454
  }
@@ -40180,17 +40198,6 @@ code-viewer annotate add-db --db app.db --tab query \\
40180
40198
  return null;
40181
40199
  }
40182
40200
 
40183
- // web-src/core/lazy-bundle.ts
40184
- function createBundleLoader(bundleFile, init) {
40185
- let pending = null;
40186
- return () => {
40187
- if (!pending) {
40188
- pending = import(`/${bundleFile}`).then((mod) => init ? init(mod) : mod).catch(() => null);
40189
- }
40190
- return pending;
40191
- };
40192
- }
40193
-
40194
40201
  // web-src/core/xterm-loader.ts
40195
40202
  var loadXterm = createBundleLoader("xterm.js");
40196
40203