@slidev/cli 52.11.5 → 52.12.0

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.
@@ -1,5 +1,5 @@
1
1
  import "./resolver-B4CxEjJF.mjs";
2
- import { t as resolveViteConfigs } from "./shared-DHY1ulq4.mjs";
2
+ import { t as resolveViteConfigs } from "./shared-mR4BGOPs.mjs";
3
3
  import { join, resolve } from "node:path";
4
4
  import { build as build$1 } from "vite";
5
5
  import { existsSync } from "node:fs";
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as resolveEntry, n as getRoots, r as isInstalledGlobally } from "./resolver-B4CxEjJF.mjs";
2
- import { a as parser, c as resolveAddons, d as updateFrontmatterPatch, i as resolveOptions, l as version, o as getThemeMeta, s as resolveTheme, u as loadSetups } from "./shared-DHY1ulq4.mjs";
3
- import { t as createServer } from "./serve-imvXJyRN.mjs";
2
+ import { a as parser, c as resolveAddons, d as updateFrontmatterPatch, i as resolveOptions, l as version, o as getThemeMeta, s as resolveTheme, u as loadSetups } from "./shared-mR4BGOPs.mjs";
3
+ import { t as createServer } from "./serve-BptRm0xv.mjs";
4
4
  import path from "node:path";
5
5
  import process from "node:process";
6
6
  import fs from "node:fs/promises";
@@ -288,7 +288,7 @@ cli.command("build [entry..]", "Build hostable SPA", (args) => exportOptions(com
288
288
  describe: "enable the inspect plugin for debugging"
289
289
  }).strict().help(), async (args) => {
290
290
  const { entry, theme, base, download, out, inspect, "without-notes": withoutNotes } = args;
291
- const { build } = await import("./build-DnSiH_hX.mjs");
291
+ const { build } = await import("./build-DencOEqt.mjs");
292
292
  for (const entryFile of entry) {
293
293
  const options = await resolveOptions({
294
294
  entry: entryFile,
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./resolver-B4CxEjJF.mjs";
2
- import { a as parser, i as resolveOptions, n as ViteSlidevPlugin, r as createDataUtils } from "./shared-DHY1ulq4.mjs";
3
- import { t as createServer } from "./serve-imvXJyRN.mjs";
2
+ import { a as parser, i as resolveOptions, n as ViteSlidevPlugin, r as createDataUtils } from "./shared-mR4BGOPs.mjs";
3
+ import { t as createServer } from "./serve-BptRm0xv.mjs";
4
4
 
5
5
  export { ViteSlidevPlugin, createDataUtils, createServer, parser, resolveOptions };
@@ -1,4 +1,4 @@
1
- import { t as resolveViteConfigs } from "./shared-DHY1ulq4.mjs";
1
+ import { t as resolveViteConfigs } from "./shared-mR4BGOPs.mjs";
2
2
  import { join } from "node:path";
3
3
  import process from "node:process";
4
4
  import { createServer } from "vite";
@@ -505,7 +505,7 @@ function createLayoutWrapperPlugin({ data, utils }) {
505
505
 
506
506
  //#endregion
507
507
  //#region package.json
508
- var version = "52.11.5";
508
+ var version = "52.12.0";
509
509
 
510
510
  //#endregion
511
511
  //#region node/integrations/addons.ts
@@ -550,6 +550,27 @@ async function getThemeMeta(name, root) {
550
550
  function toAttrValue(unsafe) {
551
551
  return JSON.stringify(escapeHtml(String(unsafe)));
552
552
  }
553
+ function collectPreloadImages(data, base) {
554
+ if (data.config.preloadImages === false) return [];
555
+ const seen = /* @__PURE__ */ new Set();
556
+ const links = [];
557
+ const basePrefix = base ? base.replace(/\/$/, "") : "";
558
+ for (const slide of data.slides) {
559
+ const images = slide.images || slide.source?.images;
560
+ if (!images?.length) continue;
561
+ for (const url of images) {
562
+ if (seen.has(url)) continue;
563
+ seen.add(url);
564
+ const href = url.startsWith("http") || url.startsWith("//") ? url : `${basePrefix}${url.startsWith("/") ? url : `/${url}`}`;
565
+ links.push({
566
+ rel: "preload",
567
+ as: "image",
568
+ href
569
+ });
570
+ }
571
+ }
572
+ return links;
573
+ }
553
574
  async function setupIndexHtml({ mode, entry, clientRoot, userRoot, roots, data, base }) {
554
575
  let main = await readFile(join(clientRoot, "index.html"), "utf-8");
555
576
  let body = "";
@@ -589,10 +610,14 @@ async function setupIndexHtml({ mode, entry, clientRoot, userRoot, roots, data,
589
610
  const unhead = createHead({ init: [{
590
611
  htmlAttrs: data.headmatter.lang ? { lang: data.headmatter.lang } : void 0,
591
612
  title,
592
- link: [data.config.favicon ? {
593
- rel: "icon",
594
- href: data.config.favicon
595
- } : null, ...webFontsLink].filter((x) => x),
613
+ link: [
614
+ data.config.favicon ? {
615
+ rel: "icon",
616
+ href: data.config.favicon
617
+ } : null,
618
+ ...webFontsLink,
619
+ ...collectPreloadImages(data, base)
620
+ ].filter((x) => x),
596
621
  meta: [
597
622
  {
598
623
  "http-equiv": "Content-Type",
@@ -1301,12 +1326,12 @@ const templateStyle = {
1301
1326
  return toAtFS(join(clientRoot, name));
1302
1327
  }
1303
1328
  const imports = [
1304
- `import "${resolveUrlOfClient("styles/vars.css")}"`,
1305
- `import "${resolveUrlOfClient("styles/index.css")}"`,
1306
- `import "${resolveUrlOfClient("styles/code.css")}"`,
1307
- `import "${resolveUrlOfClient("styles/katex.css")}"`,
1308
- `import "${resolveUrlOfClient("styles/transitions.css")}"`
1309
- ];
1329
+ "styles/vars.css",
1330
+ "styles/index.css",
1331
+ "styles/code.css",
1332
+ "styles/katex.css",
1333
+ "styles/transitions.css"
1334
+ ].map((path$1) => makeAbsoluteImportGlob(userRoot, [join(clientRoot, path$1)]));
1310
1335
  for (const root of roots) imports.push(makeAbsoluteImportGlob(userRoot, [
1311
1336
  join(root, "styles/index.{ts,js,css}"),
1312
1337
  join(root, "styles.{ts,js,css}"),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
3
  "type": "module",
4
- "version": "52.11.5",
4
+ "version": "52.12.0",
5
5
  "description": "Presentation slides for developers",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -110,9 +110,9 @@
110
110
  "vue": "^3.5.27",
111
111
  "yaml": "^2.8.2",
112
112
  "yargs": "^18.0.0",
113
- "@slidev/client": "52.11.5",
114
- "@slidev/types": "52.11.5",
115
- "@slidev/parser": "52.11.5"
113
+ "@slidev/client": "52.12.0",
114
+ "@slidev/parser": "52.12.0",
115
+ "@slidev/types": "52.12.0"
116
116
  },
117
117
  "devDependencies": {
118
118
  "@hedgedoc/markdown-it-plugins": "^2.1.4",