@slidev/cli 0.33.1 → 0.34.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/README.md +2 -3
- package/dist/{build-JAORN7ES.mjs → build-F5QDKRVS.mjs} +4 -5
- package/dist/{build-OWDFSW6Q.js → build-ZRCGLMWG.js} +13 -14
- package/dist/{chunk-MVE4F2AE.mjs → chunk-4BYU5VF4.mjs} +40 -39
- package/dist/{chunk-DGFMEJWT.mjs → chunk-4NHF5SPM.mjs} +125 -63
- package/dist/{chunk-LIMOCTLS.js → chunk-EN47OEVJ.js} +172 -171
- package/dist/{chunk-IWKTUAXD.mjs → chunk-GVA336JI.mjs} +0 -32
- package/dist/{chunk-IP7ZGKHI.js → chunk-SQLX75IO.js} +1 -33
- package/dist/{chunk-WGEHDK3K.js → chunk-XIB52LE6.js} +166 -104
- package/dist/cli.js +28 -25
- package/dist/cli.mjs +9 -6
- package/dist/{export-Z44PM4CT.mjs → export-5OVMZQWE.mjs} +1 -1
- package/dist/{export-JHIU6OQI.js → export-TH7MNEXN.js} +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -6
- package/dist/index.mjs +3 -3
- package/package.json +16 -14
|
@@ -2,8 +2,6 @@ import {
|
|
|
2
2
|
__commonJS,
|
|
3
3
|
__filename,
|
|
4
4
|
__require,
|
|
5
|
-
__spreadProps,
|
|
6
|
-
__spreadValues,
|
|
7
5
|
__toESM,
|
|
8
6
|
generateGoogleFontsUrl,
|
|
9
7
|
init_esm_shims,
|
|
@@ -11,7 +9,7 @@ import {
|
|
|
11
9
|
resolveImportPath,
|
|
12
10
|
stringifyMarkdownTokens,
|
|
13
11
|
toAtFS
|
|
14
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GVA336JI.mjs";
|
|
15
13
|
|
|
16
14
|
// ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
|
|
17
15
|
var require_fast_deep_equal = __commonJS({
|
|
@@ -118,7 +116,6 @@ init_esm_shims();
|
|
|
118
116
|
import { dirname, resolve as resolve2 } from "path";
|
|
119
117
|
import { existsSync as existsSync3 } from "fs";
|
|
120
118
|
import { slash, uniq as uniq2 } from "@antfu/utils";
|
|
121
|
-
import WindiCSS, { defaultConfigureFiles } from "vite-plugin-windicss";
|
|
122
119
|
import jiti2 from "jiti";
|
|
123
120
|
|
|
124
121
|
// node/plugins/setupNode.ts
|
|
@@ -128,7 +125,7 @@ import { existsSync as existsSync2 } from "fs-extra";
|
|
|
128
125
|
import { isObject } from "@antfu/utils";
|
|
129
126
|
import jiti from "jiti";
|
|
130
127
|
function deepMerge(a, b, rootPath = "") {
|
|
131
|
-
a =
|
|
128
|
+
a = { ...a };
|
|
132
129
|
Object.keys(b).forEach((key) => {
|
|
133
130
|
if (isObject(a[key]))
|
|
134
131
|
a[key] = deepMerge(a[key], b[key], rootPath ? `${rootPath}.${key}` : key);
|
|
@@ -156,6 +153,7 @@ async function loadSetups(roots, name, arg, initial, merge = true) {
|
|
|
156
153
|
|
|
157
154
|
// node/plugins/windicss.ts
|
|
158
155
|
async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRoot, roots, data }, { windicss: windiOptions }) {
|
|
156
|
+
const { default: WindiCSS, defaultConfigureFiles } = await Promise.resolve().then(() => __toESM(__require("vite-plugin-windicss")));
|
|
159
157
|
const configFiles = uniq2([
|
|
160
158
|
...defaultConfigureFiles.map((i) => resolve2(userRoot, i)),
|
|
161
159
|
...themeRoots.map((i) => `${i}/windi.config.ts`),
|
|
@@ -167,7 +165,7 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
|
|
|
167
165
|
if (config.default)
|
|
168
166
|
config = config.default;
|
|
169
167
|
config = await loadSetups(roots, "windicss.ts", {}, config, true);
|
|
170
|
-
return WindiCSS(
|
|
168
|
+
return WindiCSS({
|
|
171
169
|
configFiles: [configFile],
|
|
172
170
|
config,
|
|
173
171
|
onConfigResolved(config2) {
|
|
@@ -196,12 +194,14 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
|
|
|
196
194
|
config2.scanOptions.exclude.push(dirname(resolveImportPath("monaco-editor/package.json", true)));
|
|
197
195
|
config2.scanOptions.exclude.push(dirname(resolveImportPath("katex/package.json", true)));
|
|
198
196
|
config2.scanOptions.exclude.push(dirname(resolveImportPath("prettier/package.json", true)));
|
|
199
|
-
}
|
|
200
|
-
|
|
197
|
+
},
|
|
198
|
+
...windiOptions
|
|
199
|
+
});
|
|
201
200
|
}
|
|
202
201
|
|
|
203
202
|
// node/plugins/preset.ts
|
|
204
203
|
init_esm_shims();
|
|
204
|
+
import { join as join8 } from "path";
|
|
205
205
|
import Vue from "@vitejs/plugin-vue";
|
|
206
206
|
import Icons from "unplugin-icons/vite";
|
|
207
207
|
import IconsResolver from "unplugin-icons/resolver";
|
|
@@ -268,7 +268,8 @@ var dependencies = {
|
|
|
268
268
|
"@antfu/utils": "^0.5.2",
|
|
269
269
|
"@slidev/parser": "workspace:*",
|
|
270
270
|
"@slidev/types": "workspace:*",
|
|
271
|
-
"@
|
|
271
|
+
"@unocss/reset": "^0.42.0",
|
|
272
|
+
"@vueuse/core": "^8.7.5",
|
|
272
273
|
"@vueuse/head": "^0.7.6",
|
|
273
274
|
"@vueuse/motion": "^2.0.0-beta.18",
|
|
274
275
|
codemirror: "^5.65.5",
|
|
@@ -278,17 +279,18 @@ var dependencies = {
|
|
|
278
279
|
"js-base64": "^3.7.2",
|
|
279
280
|
"js-yaml": "^4.1.0",
|
|
280
281
|
katex: "^0.16.0",
|
|
281
|
-
mermaid: "^9.1.
|
|
282
|
+
mermaid: "^9.1.3",
|
|
282
283
|
"monaco-editor": "^0.33.0",
|
|
283
284
|
nanoid: "^4.0.0",
|
|
284
285
|
prettier: "^2.7.1",
|
|
285
286
|
recordrtc: "^5.6.2",
|
|
286
287
|
resolve: "^1.22.1",
|
|
287
|
-
|
|
288
|
-
|
|
288
|
+
unocss: "^0.42.0",
|
|
289
|
+
"vite-plugin-windicss": "^1.8.6",
|
|
290
|
+
vue: "^3.2.37",
|
|
289
291
|
"vue-router": "^4.0.16",
|
|
290
292
|
"vue-starport": "^0.3.0",
|
|
291
|
-
windicss: "^3.5.
|
|
293
|
+
windicss: "^3.5.5"
|
|
292
294
|
};
|
|
293
295
|
|
|
294
296
|
// node/vite/searchRoot.ts
|
|
@@ -340,6 +342,8 @@ var EXCLUDE = [
|
|
|
340
342
|
"@slidev/types",
|
|
341
343
|
"@vueuse/core",
|
|
342
344
|
"@vueuse/shared",
|
|
345
|
+
"@unocss/reset",
|
|
346
|
+
"unocss",
|
|
343
347
|
"mermaid",
|
|
344
348
|
"vite-plugin-windicss",
|
|
345
349
|
"vue-demi"
|
|
@@ -347,7 +351,7 @@ var EXCLUDE = [
|
|
|
347
351
|
function createConfigPlugin(options) {
|
|
348
352
|
return {
|
|
349
353
|
name: "slidev:config",
|
|
350
|
-
config(config) {
|
|
354
|
+
async config(config) {
|
|
351
355
|
const injection = {
|
|
352
356
|
define: getDefine(options),
|
|
353
357
|
resolve: {
|
|
@@ -373,6 +377,13 @@ function createConfigPlugin(options) {
|
|
|
373
377
|
],
|
|
374
378
|
exclude: EXCLUDE
|
|
375
379
|
},
|
|
380
|
+
css: options.data.config.css === "unocss" ? {
|
|
381
|
+
postcss: {
|
|
382
|
+
plugins: [
|
|
383
|
+
await Promise.resolve().then(() => __toESM(__require("postcss-nested"))).then((r) => r.default())
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
} : {},
|
|
376
387
|
server: {
|
|
377
388
|
fs: {
|
|
378
389
|
strict: true,
|
|
@@ -431,13 +442,13 @@ import * as parser from "@slidev/parser/fs";
|
|
|
431
442
|
var regexId = /^\/\@slidev\/slide\/(\d+)\.(md|json)(?:\?import)?$/;
|
|
432
443
|
var regexIdQuery = /(\d+?)\.(md|json)$/;
|
|
433
444
|
function getBodyJson(req) {
|
|
434
|
-
return new Promise((
|
|
445
|
+
return new Promise((resolve6, reject) => {
|
|
435
446
|
let body = "";
|
|
436
447
|
req.on("data", (chunk) => body += chunk);
|
|
437
448
|
req.on("error", reject);
|
|
438
449
|
req.on("end", () => {
|
|
439
450
|
try {
|
|
440
|
-
|
|
451
|
+
resolve6(JSON.parse(body) || {});
|
|
441
452
|
} catch (e) {
|
|
442
453
|
reject(e);
|
|
443
454
|
}
|
|
@@ -452,9 +463,10 @@ md.use(mila, {
|
|
|
452
463
|
}
|
|
453
464
|
});
|
|
454
465
|
function prepareSlideInfo(data) {
|
|
455
|
-
return
|
|
466
|
+
return {
|
|
467
|
+
...data,
|
|
456
468
|
notesHTML: md.render((data == null ? void 0 : data.note) || "")
|
|
457
|
-
}
|
|
469
|
+
};
|
|
458
470
|
}
|
|
459
471
|
function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, userRoot, roots, remote }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
|
|
460
472
|
const slidePrefix = "/@slidev/slides/";
|
|
@@ -543,13 +555,14 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
543
555
|
const file = `${slidePrefix}${i + 1}.md`;
|
|
544
556
|
try {
|
|
545
557
|
const md2 = await transformMarkdown(await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file), i, newData);
|
|
546
|
-
return await VuePlugin.handleHotUpdate(
|
|
558
|
+
return await VuePlugin.handleHotUpdate({
|
|
559
|
+
...ctx,
|
|
547
560
|
modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
|
|
548
561
|
file,
|
|
549
562
|
read() {
|
|
550
563
|
return md2;
|
|
551
564
|
}
|
|
552
|
-
})
|
|
565
|
+
});
|
|
553
566
|
} catch {
|
|
554
567
|
}
|
|
555
568
|
}))).flatMap((i) => i || []);
|
|
@@ -592,7 +605,7 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
592
605
|
code: data.slides.map(({ title }, i) => {
|
|
593
606
|
return `<template ${i === 0 ? "v-if" : "v-else-if"}="+no === ${i + 1}">${title}</template>`;
|
|
594
607
|
}).join(""),
|
|
595
|
-
map: {}
|
|
608
|
+
map: { mappings: "" }
|
|
596
609
|
};
|
|
597
610
|
}
|
|
598
611
|
if (id.startsWith(slidePrefix)) {
|
|
@@ -604,13 +617,13 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
604
617
|
if (type === "md") {
|
|
605
618
|
return {
|
|
606
619
|
code: (_a = data.slides[pageNo]) == null ? void 0 : _a.content,
|
|
607
|
-
map: {}
|
|
620
|
+
map: { mappings: "" }
|
|
608
621
|
};
|
|
609
622
|
}
|
|
610
623
|
}
|
|
611
624
|
return {
|
|
612
625
|
code: "",
|
|
613
|
-
map: {}
|
|
626
|
+
map: { mappings: "" }
|
|
614
627
|
};
|
|
615
628
|
}
|
|
616
629
|
}
|
|
@@ -660,7 +673,10 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
660
673
|
async function transformMarkdown(code, pageNo, data2) {
|
|
661
674
|
var _a, _b;
|
|
662
675
|
const layouts = await getLayouts();
|
|
663
|
-
const frontmatter =
|
|
676
|
+
const frontmatter = {
|
|
677
|
+
...((_a = data2.headmatter) == null ? void 0 : _a.defaults) || {},
|
|
678
|
+
...((_b = data2.slides[pageNo]) == null ? void 0 : _b.frontmatter) || {}
|
|
679
|
+
};
|
|
664
680
|
const layoutName = (frontmatter == null ? void 0 : frontmatter.layout) || (pageNo === 0 ? "cover" : "default");
|
|
665
681
|
if (!layouts[layoutName])
|
|
666
682
|
throw new Error(`Unknown layout "${layoutName}"`);
|
|
@@ -797,6 +813,13 @@ defineProps<{ no: number | string }>()`);
|
|
|
797
813
|
}
|
|
798
814
|
if (data.features.katex)
|
|
799
815
|
imports.push(`import "${toAtFS(resolveImportPath("katex/dist/katex.min.css", true))}"`);
|
|
816
|
+
if (data.config.css === "unocss") {
|
|
817
|
+
imports.unshift('import "@unocss/reset/tailwind.css"', 'import "uno:preflights.css"', 'import "uno:typography.css"', 'import "uno:shortcuts.css"');
|
|
818
|
+
imports.push('import "uno.css"');
|
|
819
|
+
} else {
|
|
820
|
+
imports.unshift('import "virtual:windi-components.css"', 'import "virtual:windi-base.css"');
|
|
821
|
+
imports.push('import "virtual:windi-utilities.css"', 'import "virtual:windi-devtools"');
|
|
822
|
+
}
|
|
800
823
|
return imports.join("\n");
|
|
801
824
|
}
|
|
802
825
|
async function generateMonacoTypes() {
|
|
@@ -827,11 +850,12 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
|
|
|
827
850
|
return void 0;
|
|
828
851
|
imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
|
|
829
852
|
const additions = {
|
|
830
|
-
slide:
|
|
853
|
+
slide: {
|
|
854
|
+
...prepareSlideInfo(i),
|
|
831
855
|
filepath: ((_b = i.source) == null ? void 0 : _b.filepath) || entry,
|
|
832
856
|
id: idx,
|
|
833
857
|
no
|
|
834
|
-
}
|
|
858
|
+
},
|
|
835
859
|
__clicksElements: [],
|
|
836
860
|
__preloaded: false
|
|
837
861
|
};
|
|
@@ -849,7 +873,7 @@ ${routes.join(",\n")}
|
|
|
849
873
|
return [...imports, routesStr].join("\n");
|
|
850
874
|
}
|
|
851
875
|
function generateConfigs() {
|
|
852
|
-
const config =
|
|
876
|
+
const config = { ...data.config, remote };
|
|
853
877
|
if (isString(config.title)) {
|
|
854
878
|
const tokens = md.parseInline(config.title, {});
|
|
855
879
|
config.title = stringifyMarkdownTokens(tokens);
|
|
@@ -1234,13 +1258,14 @@ function resolveShikiOptions(options) {
|
|
|
1234
1258
|
themes.push(options.theme);
|
|
1235
1259
|
}
|
|
1236
1260
|
}
|
|
1237
|
-
return
|
|
1261
|
+
return {
|
|
1262
|
+
...options,
|
|
1238
1263
|
themes,
|
|
1239
1264
|
darkModeThemes: darkModeThemes ? {
|
|
1240
1265
|
dark: getThemeName(darkModeThemes.dark),
|
|
1241
1266
|
light: getThemeName(darkModeThemes.light)
|
|
1242
1267
|
} : void 0
|
|
1243
|
-
}
|
|
1268
|
+
};
|
|
1244
1269
|
}
|
|
1245
1270
|
function trimEndNewLine(code) {
|
|
1246
1271
|
return code.replace(/\n$/, "");
|
|
@@ -1251,11 +1276,11 @@ var MarkdownItShiki = (markdownit, options = {}) => {
|
|
|
1251
1276
|
markdownit.options.highlight = (code, lang) => {
|
|
1252
1277
|
if (darkModeThemes) {
|
|
1253
1278
|
const trimmed = trimEndNewLine(code);
|
|
1254
|
-
const dark = _highlighter.codeToHtml(trimmed, lang || "text", darkModeThemes.dark).replace('<pre class="shiki"', '<pre class="slidev-code shiki shiki-dark"');
|
|
1255
|
-
const light = _highlighter.codeToHtml(trimmed, lang || "text", darkModeThemes.light).replace('<pre class="shiki"', '<pre class="slidev-code shiki shiki-light"');
|
|
1279
|
+
const dark = _highlighter.codeToHtml(trimmed, { lang: lang || "text", theme: darkModeThemes.dark }).replace('<pre class="shiki"', '<pre class="slidev-code shiki shiki-dark"');
|
|
1280
|
+
const light = _highlighter.codeToHtml(trimmed, { lang: lang || "text", theme: darkModeThemes.light }).replace('<pre class="shiki"', '<pre class="slidev-code shiki shiki-light"');
|
|
1256
1281
|
return escapeVueInCode(`<pre class="shiki-container">${dark}${light}</pre>`);
|
|
1257
1282
|
} else {
|
|
1258
|
-
return escapeVueInCode(_highlighter.codeToHtml(code, lang || "text").replace('<pre class="shiki"', '<pre class="slidev-code shiki"'));
|
|
1283
|
+
return escapeVueInCode(_highlighter.codeToHtml(code, { lang: lang || "text" }).replace('<pre class="shiki"', '<pre class="slidev-code shiki"'));
|
|
1259
1284
|
}
|
|
1260
1285
|
};
|
|
1261
1286
|
};
|
|
@@ -1281,17 +1306,18 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1281
1306
|
setups.push((md2) => md2.use(markdownItPrism));
|
|
1282
1307
|
}
|
|
1283
1308
|
const KatexOptions = await loadSetups(roots, "katex.ts", {}, { strict: false }, false);
|
|
1284
|
-
return Markdown2(
|
|
1309
|
+
return Markdown2({
|
|
1285
1310
|
wrapperClasses: "",
|
|
1286
1311
|
headEnabled: false,
|
|
1287
1312
|
frontmatter: false,
|
|
1288
|
-
markdownItOptions:
|
|
1313
|
+
markdownItOptions: {
|
|
1289
1314
|
quotes: `""''`,
|
|
1290
1315
|
html: true,
|
|
1291
1316
|
xhtmlOut: true,
|
|
1292
|
-
linkify: true
|
|
1293
|
-
|
|
1294
|
-
|
|
1317
|
+
linkify: true,
|
|
1318
|
+
...mdOptions == null ? void 0 : mdOptions.markdownItOptions
|
|
1319
|
+
},
|
|
1320
|
+
...mdOptions,
|
|
1295
1321
|
markdownItSetup(md2) {
|
|
1296
1322
|
var _a;
|
|
1297
1323
|
md2.use(mila2, {
|
|
@@ -1319,7 +1345,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1319
1345
|
return code;
|
|
1320
1346
|
}
|
|
1321
1347
|
}
|
|
1322
|
-
})
|
|
1348
|
+
});
|
|
1323
1349
|
}
|
|
1324
1350
|
function transformMarkdownMonaco(md2) {
|
|
1325
1351
|
md2 = md2.replace(/^```(\w+?)\s*{monaco}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg, (full, lang = "ts", options = "{}", code) => {
|
|
@@ -1352,18 +1378,18 @@ function transformSlotSugar(md2) {
|
|
|
1352
1378
|
return lines.join("\n");
|
|
1353
1379
|
}
|
|
1354
1380
|
function transformHighlighter(md2) {
|
|
1355
|
-
return md2.replace(/^```(\w+?)
|
|
1381
|
+
return md2.replace(/^```(\w+?)(?:\s*{([\d\w*,\|-]+)}\s*?({.*?})?\s*?)?\n([\s\S]+?)^```/mg, (full, lang = "", rangeStr = "", options = "", code) => {
|
|
1356
1382
|
const ranges = rangeStr.split(/\|/g).map((i) => i.trim());
|
|
1357
1383
|
code = code.trimEnd();
|
|
1358
1384
|
options = options.trim() || "{}";
|
|
1359
1385
|
return `
|
|
1360
|
-
<
|
|
1386
|
+
<CodeBlockWrapper v-bind="${options}" :ranges='${JSON.stringify(ranges)}'>
|
|
1361
1387
|
|
|
1362
1388
|
\`\`\`${lang}
|
|
1363
1389
|
${code}
|
|
1364
1390
|
\`\`\`
|
|
1365
1391
|
|
|
1366
|
-
</
|
|
1392
|
+
</CodeBlockWrapper>`;
|
|
1367
1393
|
});
|
|
1368
1394
|
}
|
|
1369
1395
|
function getCodeBlocks(md2) {
|
|
@@ -1441,6 +1467,36 @@ function createFixPlugins(options) {
|
|
|
1441
1467
|
];
|
|
1442
1468
|
}
|
|
1443
1469
|
|
|
1470
|
+
// node/plugins/unocss.ts
|
|
1471
|
+
init_esm_shims();
|
|
1472
|
+
import { resolve as resolve5 } from "path";
|
|
1473
|
+
import { existsSync as existsSync6 } from "fs";
|
|
1474
|
+
import { deepMerge as deepMerge2, uniq as uniq6 } from "@antfu/utils";
|
|
1475
|
+
import jiti3 from "jiti";
|
|
1476
|
+
async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, data }, { unocss: unoOptions }) {
|
|
1477
|
+
var _a, _b, _c, _d;
|
|
1478
|
+
const UnoCSS = await Promise.resolve().then(() => __toESM(__require("unocss/vite"))).then((r) => r.default);
|
|
1479
|
+
const configFiles = uniq6([
|
|
1480
|
+
...themeRoots.map((i) => `${i}/uno.config.ts`),
|
|
1481
|
+
...addonRoots.map((i) => `${i}/uno.config.ts`),
|
|
1482
|
+
resolve5(clientRoot, "uno.config.ts")
|
|
1483
|
+
]);
|
|
1484
|
+
const configFile = configFiles.find((i) => existsSync6(i));
|
|
1485
|
+
let config = jiti3(__filename)(configFile);
|
|
1486
|
+
if ("default" in config)
|
|
1487
|
+
config = config.default;
|
|
1488
|
+
config = await loadSetups(roots, "unocss.ts", {}, config, true);
|
|
1489
|
+
config.theme || (config.theme = {});
|
|
1490
|
+
(_a = config.theme).fontFamily || (_a.fontFamily = {});
|
|
1491
|
+
(_b = config.theme.fontFamily).sans || (_b.sans = data.config.fonts.sans.join(","));
|
|
1492
|
+
(_c = config.theme.fontFamily).mono || (_c.mono = data.config.fonts.mono.join(","));
|
|
1493
|
+
(_d = config.theme.fontFamily).serif || (_d.serif = data.config.fonts.serif.join(","));
|
|
1494
|
+
return UnoCSS({
|
|
1495
|
+
configFile: false,
|
|
1496
|
+
...deepMerge2(config, unoOptions || {})
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1444
1500
|
// node/plugins/preset.ts
|
|
1445
1501
|
var customElements = /* @__PURE__ */ new Set([
|
|
1446
1502
|
"annotation",
|
|
@@ -1486,31 +1542,33 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1486
1542
|
clientRoot,
|
|
1487
1543
|
data: { config }
|
|
1488
1544
|
} = options;
|
|
1489
|
-
const VuePlugin = Vue(
|
|
1545
|
+
const VuePlugin = Vue({
|
|
1490
1546
|
include: [/\.vue$/, /\.md$/],
|
|
1491
1547
|
exclude: [],
|
|
1492
|
-
template:
|
|
1548
|
+
template: {
|
|
1493
1549
|
compilerOptions: {
|
|
1494
1550
|
isCustomElement(tag) {
|
|
1495
1551
|
return customElements.has(tag);
|
|
1496
1552
|
}
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1553
|
+
},
|
|
1554
|
+
...vueOptions == null ? void 0 : vueOptions.template
|
|
1555
|
+
},
|
|
1556
|
+
...vueOptions
|
|
1557
|
+
});
|
|
1500
1558
|
const MarkdownPlugin = await createMarkdownPlugin(options, pluginOptions);
|
|
1501
1559
|
const drawingData = await loadDrawings(options);
|
|
1502
1560
|
return [
|
|
1503
|
-
await createWindiCSSPlugin(options, pluginOptions),
|
|
1561
|
+
config.css === "unocss" ? await createUnocssPlugin(options, pluginOptions) : await createWindiCSSPlugin(options, pluginOptions),
|
|
1504
1562
|
MarkdownPlugin,
|
|
1505
1563
|
VuePlugin,
|
|
1506
1564
|
createSlidesLoader(options, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin),
|
|
1507
|
-
Components(
|
|
1565
|
+
Components({
|
|
1508
1566
|
extensions: ["vue", "md", "ts"],
|
|
1509
1567
|
dirs: [
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
...themeRoots.map((i) =>
|
|
1513
|
-
...addonRoots.map((i) =>
|
|
1568
|
+
join8(clientRoot, "builtin"),
|
|
1569
|
+
join8(clientRoot, "components"),
|
|
1570
|
+
...themeRoots.map((i) => join8(i, "components")),
|
|
1571
|
+
...addonRoots.map((i) => join8(i, "components")),
|
|
1514
1572
|
"src/components",
|
|
1515
1573
|
"components"
|
|
1516
1574
|
],
|
|
@@ -1521,13 +1579,15 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1521
1579
|
prefix: "",
|
|
1522
1580
|
customCollections: Object.keys(iconsOptions.customCollections || [])
|
|
1523
1581
|
})
|
|
1524
|
-
]
|
|
1525
|
-
|
|
1526
|
-
|
|
1582
|
+
],
|
|
1583
|
+
...componentsOptions
|
|
1584
|
+
}),
|
|
1585
|
+
Icons({
|
|
1527
1586
|
defaultClass: "slidev-icon",
|
|
1528
|
-
autoInstall: true
|
|
1529
|
-
|
|
1530
|
-
|
|
1587
|
+
autoInstall: true,
|
|
1588
|
+
...iconsOptions
|
|
1589
|
+
}),
|
|
1590
|
+
config.remoteAssets === true || config.remoteAssets === mode ? RemoteAssets({
|
|
1531
1591
|
rules: [
|
|
1532
1592
|
...DefaultRules,
|
|
1533
1593
|
{
|
|
@@ -1536,18 +1596,20 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1536
1596
|
}
|
|
1537
1597
|
],
|
|
1538
1598
|
resolveMode: (id) => id.endsWith("index.html") ? "relative" : "@fs",
|
|
1539
|
-
awaitDownload: mode === "build"
|
|
1540
|
-
|
|
1599
|
+
awaitDownload: mode === "build",
|
|
1600
|
+
...remoteAssetsOptions
|
|
1601
|
+
}) : null,
|
|
1541
1602
|
ServerRef({
|
|
1542
1603
|
debug: process.env.NODE_ENV === "development",
|
|
1543
|
-
state:
|
|
1604
|
+
state: {
|
|
1544
1605
|
sync: false,
|
|
1545
1606
|
nav: {
|
|
1546
1607
|
page: 0,
|
|
1547
1608
|
clicks: 0
|
|
1548
1609
|
},
|
|
1549
|
-
drawings: drawingData
|
|
1550
|
-
|
|
1610
|
+
drawings: drawingData,
|
|
1611
|
+
...serverRefOptions.state
|
|
1612
|
+
},
|
|
1551
1613
|
onChanged(key, data, patch, timestamp) {
|
|
1552
1614
|
serverRefOptions.onChanged && serverRefOptions.onChanged(key, data, patch, timestamp);
|
|
1553
1615
|
if (!options.data.config.drawings.persist)
|