@slidev/cli 0.33.0 → 0.34.1
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-P4Q57V2J.mjs → build-AZXVYLTZ.mjs} +4 -5
- package/dist/{build-JMQRM5SA.js → build-ONMHHPBT.js} +13 -14
- package/dist/{chunk-C7GPMAIX.mjs → chunk-BQ63PXSA.mjs} +121 -60
- package/dist/{chunk-UNBXPUSG.js → chunk-FD6XUAB4.js} +162 -101
- package/dist/{chunk-ZWCVPYOA.mjs → chunk-GVA336JI.mjs} +2 -34
- package/dist/{chunk-JQEMHC65.js → chunk-PNKOKFFZ.js} +172 -171
- package/dist/{chunk-FFZLS6QK.js → chunk-SQLX75IO.js} +3 -35
- package/dist/{chunk-ORQ3SHUX.mjs → chunk-VO7LIZVO.mjs} +40 -39
- package/dist/cli.js +28 -25
- package/dist/cli.mjs +9 -6
- package/dist/{export-5R6FV775.mjs → export-5OVMZQWE.mjs} +1 -1
- package/dist/{export-LOKLMK66.js → export-TH7MNEXN.js} +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +3 -3
- package/package.json +21 -19
|
@@ -8,15 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _chunkFFZLS6QKjs = require('./chunk-FFZLS6QK.js');
|
|
11
|
+
var _chunkSQLX75IOjs = require('./chunk-SQLX75IO.js');
|
|
14
12
|
|
|
15
13
|
// ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
|
|
16
|
-
var require_fast_deep_equal =
|
|
14
|
+
var require_fast_deep_equal = _chunkSQLX75IOjs.__commonJS.call(void 0, {
|
|
17
15
|
"../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports, module) {
|
|
18
16
|
"use strict";
|
|
19
|
-
|
|
17
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
20
18
|
module.exports = function equal2(a, b) {
|
|
21
19
|
if (a === b)
|
|
22
20
|
return true;
|
|
@@ -59,7 +57,7 @@ var require_fast_deep_equal = _chunkFFZLS6QKjs.__commonJS.call(void 0, {
|
|
|
59
57
|
});
|
|
60
58
|
|
|
61
59
|
// node/common.ts
|
|
62
|
-
|
|
60
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
63
61
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
64
62
|
var _path = require('path');
|
|
65
63
|
var _utils = require('@antfu/utils');
|
|
@@ -88,8 +86,8 @@ ${(((_b = index.match(/<body>([\s\S]*?)<\/body>/im)) == null ? void 0 : _b[1]) |
|
|
|
88
86
|
body += '\n<script async src="https://platform.twitter.com/widgets.js"><\/script>';
|
|
89
87
|
if (data.config.fonts.webfonts.length && data.config.fonts.provider !== "none")
|
|
90
88
|
head += `
|
|
91
|
-
<link rel="stylesheet" href="${
|
|
92
|
-
main = main.replace("__ENTRY__",
|
|
89
|
+
<link rel="stylesheet" href="${_chunkSQLX75IOjs.generateGoogleFontsUrl.call(void 0, data.config.fonts)}" type="text/css">`;
|
|
90
|
+
main = main.replace("__ENTRY__", _chunkSQLX75IOjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "main.ts"))).replace("<!-- head -->", head).replace("<!-- body -->", body);
|
|
93
91
|
return main;
|
|
94
92
|
}
|
|
95
93
|
async function mergeViteConfigs({ addonRoots, themeRoots }, viteConfig, config, command) {
|
|
@@ -113,21 +111,20 @@ async function mergeViteConfigs({ addonRoots, themeRoots }, viteConfig, config,
|
|
|
113
111
|
}
|
|
114
112
|
|
|
115
113
|
// node/plugins/windicss.ts
|
|
116
|
-
|
|
114
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
117
115
|
|
|
118
116
|
|
|
119
117
|
|
|
120
|
-
var _vitepluginwindicss = require('vite-plugin-windicss'); var _vitepluginwindicss2 = _interopRequireDefault(_vitepluginwindicss);
|
|
121
118
|
var _jiti = require('jiti'); var _jiti2 = _interopRequireDefault(_jiti);
|
|
122
119
|
|
|
123
120
|
// node/plugins/setupNode.ts
|
|
124
|
-
|
|
121
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
125
122
|
|
|
126
123
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
127
124
|
|
|
128
125
|
|
|
129
126
|
function deepMerge(a, b, rootPath = "") {
|
|
130
|
-
a =
|
|
127
|
+
a = { ...a };
|
|
131
128
|
Object.keys(b).forEach((key) => {
|
|
132
129
|
if (_utils.isObject.call(void 0, a[key]))
|
|
133
130
|
a[key] = deepMerge(a[key], b[key], rootPath ? `${rootPath}.${key}` : key);
|
|
@@ -155,8 +152,9 @@ async function loadSetups(roots, name, arg, initial, merge = true) {
|
|
|
155
152
|
|
|
156
153
|
// node/plugins/windicss.ts
|
|
157
154
|
async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRoot, roots, data }, { windicss: windiOptions }) {
|
|
155
|
+
const { default: WindiCSS, defaultConfigureFiles } = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "vite-plugin-windicss")));
|
|
158
156
|
const configFiles = _utils.uniq.call(void 0, [
|
|
159
|
-
...
|
|
157
|
+
...defaultConfigureFiles.map((i) => _path.resolve.call(void 0, userRoot, i)),
|
|
160
158
|
...themeRoots.map((i) => `${i}/windi.config.ts`),
|
|
161
159
|
...addonRoots.map((i) => `${i}/windi.config.ts`),
|
|
162
160
|
_path.resolve.call(void 0, clientRoot, "windi.config.ts")
|
|
@@ -166,7 +164,7 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
|
|
|
166
164
|
if (config.default)
|
|
167
165
|
config = config.default;
|
|
168
166
|
config = await loadSetups(roots, "windicss.ts", {}, config, true);
|
|
169
|
-
return
|
|
167
|
+
return WindiCSS({
|
|
170
168
|
configFiles: [configFile],
|
|
171
169
|
config,
|
|
172
170
|
onConfigResolved(config2) {
|
|
@@ -192,15 +190,16 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
|
|
|
192
190
|
config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
|
|
193
191
|
});
|
|
194
192
|
config2.scanOptions.include.push(`!${_utils.slash.call(void 0, _path.resolve.call(void 0, userRoot, "node_modules"))}`);
|
|
195
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
196
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
197
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
198
|
-
}
|
|
199
|
-
|
|
193
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkSQLX75IOjs.resolveImportPath.call(void 0, "monaco-editor/package.json", true)));
|
|
194
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkSQLX75IOjs.resolveImportPath.call(void 0, "katex/package.json", true)));
|
|
195
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkSQLX75IOjs.resolveImportPath.call(void 0, "prettier/package.json", true)));
|
|
196
|
+
},
|
|
197
|
+
...windiOptions
|
|
198
|
+
});
|
|
200
199
|
}
|
|
201
200
|
|
|
202
201
|
// node/plugins/preset.ts
|
|
203
|
-
|
|
202
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
204
203
|
var _pluginvue = require('@vitejs/plugin-vue'); var _pluginvue2 = _interopRequireDefault(_pluginvue);
|
|
205
204
|
var _vite3 = require('unplugin-icons/vite'); var _vite4 = _interopRequireDefault(_vite3);
|
|
206
205
|
var _resolver = require('unplugin-icons/resolver'); var _resolver2 = _interopRequireDefault(_resolver);
|
|
@@ -210,7 +209,7 @@ var _vitepluginvueserverref = require('vite-plugin-vue-server-ref'); var _vitepl
|
|
|
210
209
|
|
|
211
210
|
|
|
212
211
|
// node/drawings.ts
|
|
213
|
-
|
|
212
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
214
213
|
|
|
215
214
|
|
|
216
215
|
var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);
|
|
@@ -256,7 +255,7 @@ ${value}
|
|
|
256
255
|
}
|
|
257
256
|
|
|
258
257
|
// node/plugins/extendConfig.ts
|
|
259
|
-
|
|
258
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
260
259
|
|
|
261
260
|
|
|
262
261
|
var _isinstalledglobally = require('is-installed-globally'); var _isinstalledglobally2 = _interopRequireDefault(_isinstalledglobally);
|
|
@@ -267,7 +266,8 @@ var dependencies = {
|
|
|
267
266
|
"@antfu/utils": "^0.5.2",
|
|
268
267
|
"@slidev/parser": "workspace:*",
|
|
269
268
|
"@slidev/types": "workspace:*",
|
|
270
|
-
"@
|
|
269
|
+
"@unocss/reset": "^0.42.0",
|
|
270
|
+
"@vueuse/core": "^8.7.5",
|
|
271
271
|
"@vueuse/head": "^0.7.6",
|
|
272
272
|
"@vueuse/motion": "^2.0.0-beta.18",
|
|
273
273
|
codemirror: "^5.65.5",
|
|
@@ -276,22 +276,23 @@ var dependencies = {
|
|
|
276
276
|
"file-saver": "^2.0.5",
|
|
277
277
|
"js-base64": "^3.7.2",
|
|
278
278
|
"js-yaml": "^4.1.0",
|
|
279
|
-
katex: "^0.
|
|
280
|
-
mermaid: "^9.1.
|
|
279
|
+
katex: "^0.16.0",
|
|
280
|
+
mermaid: "^9.1.3",
|
|
281
281
|
"monaco-editor": "^0.33.0",
|
|
282
|
-
nanoid: "^
|
|
283
|
-
prettier: "^2.
|
|
282
|
+
nanoid: "^4.0.0",
|
|
283
|
+
prettier: "^2.7.1",
|
|
284
284
|
recordrtc: "^5.6.2",
|
|
285
|
-
resolve: "^1.22.
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
"vue-
|
|
290
|
-
|
|
285
|
+
resolve: "^1.22.1",
|
|
286
|
+
unocss: "^0.42.0",
|
|
287
|
+
"vite-plugin-windicss": "^1.8.6",
|
|
288
|
+
vue: "^3.2.37",
|
|
289
|
+
"vue-router": "^4.0.16",
|
|
290
|
+
"vue-starport": "^0.3.0",
|
|
291
|
+
windicss: "^3.5.5"
|
|
291
292
|
};
|
|
292
293
|
|
|
293
294
|
// node/vite/searchRoot.ts
|
|
294
|
-
|
|
295
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
295
296
|
|
|
296
297
|
|
|
297
298
|
var ROOT_FILES = [
|
|
@@ -339,6 +340,8 @@ var EXCLUDE = [
|
|
|
339
340
|
"@slidev/types",
|
|
340
341
|
"@vueuse/core",
|
|
341
342
|
"@vueuse/shared",
|
|
343
|
+
"@unocss/reset",
|
|
344
|
+
"unocss",
|
|
342
345
|
"mermaid",
|
|
343
346
|
"vite-plugin-windicss",
|
|
344
347
|
"vue-demi"
|
|
@@ -346,12 +349,12 @@ var EXCLUDE = [
|
|
|
346
349
|
function createConfigPlugin(options) {
|
|
347
350
|
return {
|
|
348
351
|
name: "slidev:config",
|
|
349
|
-
config(config) {
|
|
352
|
+
async config(config) {
|
|
350
353
|
const injection = {
|
|
351
354
|
define: getDefine(options),
|
|
352
355
|
resolve: {
|
|
353
356
|
alias: {
|
|
354
|
-
"@slidev/client/": `${
|
|
357
|
+
"@slidev/client/": `${_chunkSQLX75IOjs.toAtFS.call(void 0, options.clientRoot)}/`
|
|
355
358
|
}
|
|
356
359
|
},
|
|
357
360
|
optimizeDeps: {
|
|
@@ -372,13 +375,20 @@ function createConfigPlugin(options) {
|
|
|
372
375
|
],
|
|
373
376
|
exclude: EXCLUDE
|
|
374
377
|
},
|
|
378
|
+
css: options.data.config.css === "unocss" ? {
|
|
379
|
+
postcss: {
|
|
380
|
+
plugins: [
|
|
381
|
+
await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "postcss-nested"))).then((r) => r.default())
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
} : {},
|
|
375
385
|
server: {
|
|
376
386
|
fs: {
|
|
377
387
|
strict: true,
|
|
378
388
|
allow: _utils.uniq.call(void 0, [
|
|
379
389
|
searchForWorkspaceRoot(options.userRoot),
|
|
380
390
|
searchForWorkspaceRoot(options.cliRoot),
|
|
381
|
-
..._isinstalledglobally2.default ? [_path.dirname.call(void 0,
|
|
391
|
+
..._isinstalledglobally2.default ? [_path.dirname.call(void 0, _chunkSQLX75IOjs.resolveGlobalImportPath.call(void 0, "@slidev/client/package.json")), _path.dirname.call(void 0, _chunkSQLX75IOjs.resolveGlobalImportPath.call(void 0, "katex/package.json"))] : []
|
|
382
392
|
])
|
|
383
393
|
}
|
|
384
394
|
}
|
|
@@ -387,7 +397,7 @@ function createConfigPlugin(options) {
|
|
|
387
397
|
injection.cacheDir = _path.join.call(void 0, options.cliRoot, "node_modules/.vite");
|
|
388
398
|
injection.publicDir = _path.join.call(void 0, options.userRoot, "public");
|
|
389
399
|
injection.root = options.cliRoot;
|
|
390
|
-
injection.resolve.alias.vue = `${
|
|
400
|
+
injection.resolve.alias.vue = `${_chunkSQLX75IOjs.resolveImportPath.call(void 0, "vue/dist/vue.esm-browser.js", true)}`;
|
|
391
401
|
}
|
|
392
402
|
return _vite.mergeConfig.call(void 0, config, injection);
|
|
393
403
|
},
|
|
@@ -408,7 +418,7 @@ function createConfigPlugin(options) {
|
|
|
408
418
|
}
|
|
409
419
|
function getDefine(options) {
|
|
410
420
|
return {
|
|
411
|
-
__SLIDEV_CLIENT_ROOT__: JSON.stringify(
|
|
421
|
+
__SLIDEV_CLIENT_ROOT__: JSON.stringify(_chunkSQLX75IOjs.toAtFS.call(void 0, options.clientRoot)),
|
|
412
422
|
__SLIDEV_HASH_ROUTE__: JSON.stringify(options.data.config.routerMode === "hash"),
|
|
413
423
|
__SLIDEV_FEATURE_DRAWINGS__: JSON.stringify(options.data.config.drawings.enabled === true || options.data.config.drawings.enabled === options.mode),
|
|
414
424
|
__SLIDEV_FEATURE_DRAWINGS_PERSIST__: JSON.stringify(!!options.data.config.drawings.persist === true),
|
|
@@ -418,8 +428,8 @@ function getDefine(options) {
|
|
|
418
428
|
}
|
|
419
429
|
|
|
420
430
|
// node/plugins/loaders.ts
|
|
421
|
-
|
|
422
|
-
var import_fast_deep_equal =
|
|
431
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
432
|
+
var import_fast_deep_equal = _chunkSQLX75IOjs.__toESM.call(void 0, require_fast_deep_equal());
|
|
423
433
|
|
|
424
434
|
|
|
425
435
|
|
|
@@ -430,13 +440,13 @@ var _fs3 = require('@slidev/parser/fs'); var parser = _interopRequireWildcard(_f
|
|
|
430
440
|
var regexId = /^\/\@slidev\/slide\/(\d+)\.(md|json)(?:\?import)?$/;
|
|
431
441
|
var regexIdQuery = /(\d+?)\.(md|json)$/;
|
|
432
442
|
function getBodyJson(req) {
|
|
433
|
-
return new Promise((
|
|
443
|
+
return new Promise((resolve6, reject) => {
|
|
434
444
|
let body = "";
|
|
435
445
|
req.on("data", (chunk) => body += chunk);
|
|
436
446
|
req.on("error", reject);
|
|
437
447
|
req.on("end", () => {
|
|
438
448
|
try {
|
|
439
|
-
|
|
449
|
+
resolve6(JSON.parse(body) || {});
|
|
440
450
|
} catch (e) {
|
|
441
451
|
reject(e);
|
|
442
452
|
}
|
|
@@ -451,9 +461,10 @@ md.use(_markdownitlinkattributes2.default, {
|
|
|
451
461
|
}
|
|
452
462
|
});
|
|
453
463
|
function prepareSlideInfo(data) {
|
|
454
|
-
return
|
|
464
|
+
return {
|
|
465
|
+
...data,
|
|
455
466
|
notesHTML: md.render((data == null ? void 0 : data.note) || "")
|
|
456
|
-
}
|
|
467
|
+
};
|
|
457
468
|
}
|
|
458
469
|
function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, userRoot, roots, remote }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
|
|
459
470
|
const slidePrefix = "/@slidev/slides/";
|
|
@@ -542,13 +553,14 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
542
553
|
const file = `${slidePrefix}${i + 1}.md`;
|
|
543
554
|
try {
|
|
544
555
|
const md2 = await transformMarkdown(await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file), i, newData);
|
|
545
|
-
return await VuePlugin.handleHotUpdate(
|
|
556
|
+
return await VuePlugin.handleHotUpdate({
|
|
557
|
+
...ctx,
|
|
546
558
|
modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
|
|
547
559
|
file,
|
|
548
560
|
read() {
|
|
549
561
|
return md2;
|
|
550
562
|
}
|
|
551
|
-
})
|
|
563
|
+
});
|
|
552
564
|
} catch (e3) {
|
|
553
565
|
}
|
|
554
566
|
}))).flatMap((i) => i || []);
|
|
@@ -591,7 +603,7 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
591
603
|
code: data.slides.map(({ title }, i) => {
|
|
592
604
|
return `<template ${i === 0 ? "v-if" : "v-else-if"}="+no === ${i + 1}">${title}</template>`;
|
|
593
605
|
}).join(""),
|
|
594
|
-
map: {}
|
|
606
|
+
map: { mappings: "" }
|
|
595
607
|
};
|
|
596
608
|
}
|
|
597
609
|
if (id.startsWith(slidePrefix)) {
|
|
@@ -603,13 +615,13 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
603
615
|
if (type === "md") {
|
|
604
616
|
return {
|
|
605
617
|
code: (_a = data.slides[pageNo]) == null ? void 0 : _a.content,
|
|
606
|
-
map: {}
|
|
618
|
+
map: { mappings: "" }
|
|
607
619
|
};
|
|
608
620
|
}
|
|
609
621
|
}
|
|
610
622
|
return {
|
|
611
623
|
code: "",
|
|
612
|
-
map: {}
|
|
624
|
+
map: { mappings: "" }
|
|
613
625
|
};
|
|
614
626
|
}
|
|
615
627
|
}
|
|
@@ -659,14 +671,17 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
659
671
|
async function transformMarkdown(code, pageNo, data2) {
|
|
660
672
|
var _a, _b;
|
|
661
673
|
const layouts = await getLayouts();
|
|
662
|
-
const frontmatter =
|
|
674
|
+
const frontmatter = {
|
|
675
|
+
...((_a = data2.headmatter) == null ? void 0 : _a.defaults) || {},
|
|
676
|
+
...((_b = data2.slides[pageNo]) == null ? void 0 : _b.frontmatter) || {}
|
|
677
|
+
};
|
|
663
678
|
const layoutName = (frontmatter == null ? void 0 : frontmatter.layout) || (pageNo === 0 ? "cover" : "default");
|
|
664
679
|
if (!layouts[layoutName])
|
|
665
680
|
throw new Error(`Unknown layout "${layoutName}"`);
|
|
666
681
|
delete frontmatter.title;
|
|
667
682
|
const imports = [
|
|
668
683
|
'import { inject as vueInject } from "vue"',
|
|
669
|
-
`import InjectedLayout from "${
|
|
684
|
+
`import InjectedLayout from "${_chunkSQLX75IOjs.toAtFS.call(void 0, layouts[layoutName])}"`,
|
|
670
685
|
'import { injectionSlidevContext } from "@slidev/client/constants"',
|
|
671
686
|
`const frontmatter = ${JSON.stringify(frontmatter)}`,
|
|
672
687
|
"const $slidev = vueInject(injectionSlidevContext)"
|
|
@@ -770,9 +785,9 @@ defineProps<{ no: number | string }>()`);
|
|
|
770
785
|
}
|
|
771
786
|
async function generateUserStyles() {
|
|
772
787
|
const imports = [
|
|
773
|
-
`import "${
|
|
774
|
-
`import "${
|
|
775
|
-
`import "${
|
|
788
|
+
`import "${_chunkSQLX75IOjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/vars.css"))}"`,
|
|
789
|
+
`import "${_chunkSQLX75IOjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/index.css"))}"`,
|
|
790
|
+
`import "${_chunkSQLX75IOjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/code.css"))}"`
|
|
776
791
|
];
|
|
777
792
|
const roots2 = _utils.uniq.call(void 0, [
|
|
778
793
|
...themeRoots,
|
|
@@ -789,13 +804,20 @@ defineProps<{ no: number | string }>()`);
|
|
|
789
804
|
];
|
|
790
805
|
for (const style of styles) {
|
|
791
806
|
if (_fsextra.existsSync.call(void 0, style)) {
|
|
792
|
-
imports.push(`import "${
|
|
807
|
+
imports.push(`import "${_chunkSQLX75IOjs.toAtFS.call(void 0, style)}"`);
|
|
793
808
|
continue;
|
|
794
809
|
}
|
|
795
810
|
}
|
|
796
811
|
}
|
|
797
812
|
if (data.features.katex)
|
|
798
|
-
imports.push(`import "${
|
|
813
|
+
imports.push(`import "${_chunkSQLX75IOjs.toAtFS.call(void 0, _chunkSQLX75IOjs.resolveImportPath.call(void 0, "katex/dist/katex.min.css", true))}"`);
|
|
814
|
+
if (data.config.css === "unocss") {
|
|
815
|
+
imports.unshift('import "@unocss/reset/tailwind.css"', 'import "uno:preflights.css"', 'import "uno:typography.css"', 'import "uno:shortcuts.css"');
|
|
816
|
+
imports.push('import "uno.css"');
|
|
817
|
+
} else {
|
|
818
|
+
imports.unshift('import "virtual:windi-components.css"', 'import "virtual:windi-base.css"');
|
|
819
|
+
imports.push('import "virtual:windi-utilities.css"', 'import "virtual:windi-devtools"');
|
|
820
|
+
}
|
|
799
821
|
return imports.join("\n");
|
|
800
822
|
}
|
|
801
823
|
async function generateMonacoTypes() {
|
|
@@ -804,7 +826,7 @@ defineProps<{ no: number | string }>()`);
|
|
|
804
826
|
async function generateLayouts() {
|
|
805
827
|
const imports = [];
|
|
806
828
|
const layouts = _utils.objectMap.call(void 0, await getLayouts(), (k, v) => {
|
|
807
|
-
imports.push(`import __layout_${k} from "${
|
|
829
|
+
imports.push(`import __layout_${k} from "${_chunkSQLX75IOjs.toAtFS.call(void 0, v)}"`);
|
|
808
830
|
return [k, `__layout_${k}`];
|
|
809
831
|
});
|
|
810
832
|
return [
|
|
@@ -826,11 +848,12 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
|
|
|
826
848
|
return void 0;
|
|
827
849
|
imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
|
|
828
850
|
const additions = {
|
|
829
|
-
slide:
|
|
851
|
+
slide: {
|
|
852
|
+
...prepareSlideInfo(i),
|
|
830
853
|
filepath: ((_b = i.source) == null ? void 0 : _b.filepath) || entry,
|
|
831
854
|
id: idx,
|
|
832
855
|
no
|
|
833
|
-
}
|
|
856
|
+
},
|
|
834
857
|
__clicksElements: [],
|
|
835
858
|
__preloaded: false
|
|
836
859
|
};
|
|
@@ -848,10 +871,10 @@ ${routes.join(",\n")}
|
|
|
848
871
|
return [...imports, routesStr].join("\n");
|
|
849
872
|
}
|
|
850
873
|
function generateConfigs() {
|
|
851
|
-
const config =
|
|
874
|
+
const config = { ...data.config, remote };
|
|
852
875
|
if (_utils.isString.call(void 0, config.title)) {
|
|
853
876
|
const tokens = md.parseInline(config.title, {});
|
|
854
|
-
config.title =
|
|
877
|
+
config.title = _chunkSQLX75IOjs.stringifyMarkdownTokens.call(void 0, tokens);
|
|
855
878
|
}
|
|
856
879
|
if (_utils.isString.call(void 0, config.info))
|
|
857
880
|
config.info = md.render(config.info);
|
|
@@ -872,7 +895,7 @@ ${routes.join(",\n")}
|
|
|
872
895
|
];
|
|
873
896
|
}
|
|
874
897
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
875
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${
|
|
898
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunkSQLX75IOjs.toAtFS.call(void 0, i)}'`).join("\n");
|
|
876
899
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
877
900
|
return `
|
|
878
901
|
${imports}
|
|
@@ -891,7 +914,7 @@ export default {
|
|
|
891
914
|
_path.join.call(void 0, root, "CustomNavControls.vue")
|
|
892
915
|
];
|
|
893
916
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
894
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${
|
|
917
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunkSQLX75IOjs.toAtFS.call(void 0, i)}'`).join("\n");
|
|
895
918
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
896
919
|
return `
|
|
897
920
|
${imports}
|
|
@@ -906,7 +929,7 @@ export default {
|
|
|
906
929
|
}
|
|
907
930
|
|
|
908
931
|
// node/plugins/monacoTransform.ts
|
|
909
|
-
|
|
932
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
910
933
|
|
|
911
934
|
|
|
912
935
|
|
|
@@ -940,7 +963,7 @@ function createMonacoTypesLoader() {
|
|
|
940
963
|
}
|
|
941
964
|
|
|
942
965
|
// node/plugins/setupClient.ts
|
|
943
|
-
|
|
966
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
944
967
|
|
|
945
968
|
|
|
946
969
|
|
|
@@ -963,7 +986,7 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
|
|
|
963
986
|
setups.forEach((path, idx) => {
|
|
964
987
|
if (!_fs.existsSync.call(void 0, path))
|
|
965
988
|
return;
|
|
966
|
-
imports.push(`import __n${idx} from '${
|
|
989
|
+
imports.push(`import __n${idx} from '${_chunkSQLX75IOjs.toAtFS.call(void 0, path)}'`);
|
|
967
990
|
let fn = `__n${idx}`;
|
|
968
991
|
let awaitFn = `await __n${idx}`;
|
|
969
992
|
if (/\binjection_return\b/g.test(code)) {
|
|
@@ -991,8 +1014,8 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
|
|
|
991
1014
|
}
|
|
992
1015
|
|
|
993
1016
|
// node/plugins/markdown.ts
|
|
994
|
-
|
|
995
|
-
var
|
|
1017
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1018
|
+
var _vitepluginvuemarkdown = require('vite-plugin-vue-markdown'); var _vitepluginvuemarkdown2 = _interopRequireDefault(_vitepluginvuemarkdown);
|
|
996
1019
|
var _jsbase64 = require('js-base64'); var base64 = _interopRequireWildcard(_jsbase64);
|
|
997
1020
|
|
|
998
1021
|
|
|
@@ -1001,7 +1024,7 @@ var _shiki = require('shiki'); var Shiki = _interopRequireWildcard(_shiki);
|
|
|
1001
1024
|
var _plantumlencoder = require('plantuml-encoder');
|
|
1002
1025
|
|
|
1003
1026
|
// node/plugins/markdown-it-katex.ts
|
|
1004
|
-
|
|
1027
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1005
1028
|
var _katex = require('katex'); var _katex2 = _interopRequireDefault(_katex);
|
|
1006
1029
|
function isValidDelim(state, pos) {
|
|
1007
1030
|
const max = state.posMax;
|
|
@@ -1148,7 +1171,7 @@ function math_plugin(md2, options) {
|
|
|
1148
1171
|
}
|
|
1149
1172
|
|
|
1150
1173
|
// node/plugins/markdown-it-prism.ts
|
|
1151
|
-
|
|
1174
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1152
1175
|
var _prismjs = require('prismjs'); var _prismjs2 = _interopRequireDefault(_prismjs);
|
|
1153
1176
|
var _ = require('prismjs/components/'); var _2 = _interopRequireDefault(_);
|
|
1154
1177
|
var DEFAULTS = {
|
|
@@ -1171,7 +1194,7 @@ function loadPrismLang(lang) {
|
|
|
1171
1194
|
}
|
|
1172
1195
|
function loadPrismPlugin(name) {
|
|
1173
1196
|
try {
|
|
1174
|
-
|
|
1197
|
+
_chunkSQLX75IOjs.__require.call(void 0, `prismjs/plugins/${name}/prism-${name}`);
|
|
1175
1198
|
} catch (e) {
|
|
1176
1199
|
throw new Error(`Cannot load Prism plugin "${name}". Please check the spelling.`);
|
|
1177
1200
|
}
|
|
@@ -1211,7 +1234,7 @@ function markdownItPrism(markdownit, useroptions) {
|
|
|
1211
1234
|
}
|
|
1212
1235
|
|
|
1213
1236
|
// node/plugins/markdown-it-shiki.ts
|
|
1214
|
-
|
|
1237
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1215
1238
|
function getThemeName(theme) {
|
|
1216
1239
|
if (typeof theme === "string")
|
|
1217
1240
|
return theme;
|
|
@@ -1233,13 +1256,14 @@ function resolveShikiOptions(options) {
|
|
|
1233
1256
|
themes.push(options.theme);
|
|
1234
1257
|
}
|
|
1235
1258
|
}
|
|
1236
|
-
return
|
|
1259
|
+
return {
|
|
1260
|
+
...options,
|
|
1237
1261
|
themes,
|
|
1238
1262
|
darkModeThemes: darkModeThemes ? {
|
|
1239
1263
|
dark: getThemeName(darkModeThemes.dark),
|
|
1240
1264
|
light: getThemeName(darkModeThemes.light)
|
|
1241
1265
|
} : void 0
|
|
1242
|
-
}
|
|
1266
|
+
};
|
|
1243
1267
|
}
|
|
1244
1268
|
function trimEndNewLine(code) {
|
|
1245
1269
|
return code.replace(/\n$/, "");
|
|
@@ -1271,7 +1295,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1271
1295
|
const setups = [];
|
|
1272
1296
|
const entryPath = _utils.slash.call(void 0, entry);
|
|
1273
1297
|
if (config.highlighter === "shiki") {
|
|
1274
|
-
const { getHighlighter } = await Promise.resolve().then(() =>
|
|
1298
|
+
const { getHighlighter } = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "shiki")));
|
|
1275
1299
|
const shikiOptions = await loadSetups(roots, "shiki.ts", Shiki, DEFAULT_SHIKI_OPTIONS, false);
|
|
1276
1300
|
const { langs, themes } = resolveShikiOptions(shikiOptions);
|
|
1277
1301
|
shikiOptions.highlighter = await getHighlighter({ themes, langs });
|
|
@@ -1280,17 +1304,18 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1280
1304
|
setups.push((md2) => md2.use(markdownItPrism));
|
|
1281
1305
|
}
|
|
1282
1306
|
const KatexOptions = await loadSetups(roots, "katex.ts", {}, { strict: false }, false);
|
|
1283
|
-
return
|
|
1307
|
+
return _vitepluginvuemarkdown2.default.call(void 0, {
|
|
1284
1308
|
wrapperClasses: "",
|
|
1285
1309
|
headEnabled: false,
|
|
1286
1310
|
frontmatter: false,
|
|
1287
|
-
markdownItOptions:
|
|
1311
|
+
markdownItOptions: {
|
|
1288
1312
|
quotes: `""''`,
|
|
1289
1313
|
html: true,
|
|
1290
1314
|
xhtmlOut: true,
|
|
1291
|
-
linkify: true
|
|
1292
|
-
|
|
1293
|
-
|
|
1315
|
+
linkify: true,
|
|
1316
|
+
...mdOptions == null ? void 0 : mdOptions.markdownItOptions
|
|
1317
|
+
},
|
|
1318
|
+
...mdOptions,
|
|
1294
1319
|
markdownItSetup(md2) {
|
|
1295
1320
|
var _a;
|
|
1296
1321
|
md2.use(_markdownitlinkattributes2.default, {
|
|
@@ -1318,7 +1343,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1318
1343
|
return code;
|
|
1319
1344
|
}
|
|
1320
1345
|
}
|
|
1321
|
-
})
|
|
1346
|
+
});
|
|
1322
1347
|
}
|
|
1323
1348
|
function transformMarkdownMonaco(md2) {
|
|
1324
1349
|
md2 = md2.replace(/^```(\w+?)\s*{monaco}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg, (full, lang = "ts", options = "{}", code) => {
|
|
@@ -1420,7 +1445,7 @@ function escapeVueInCode(md2) {
|
|
|
1420
1445
|
}
|
|
1421
1446
|
|
|
1422
1447
|
// node/plugins/patchTransform.ts
|
|
1423
|
-
|
|
1448
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1424
1449
|
|
|
1425
1450
|
function createFixPlugins(options) {
|
|
1426
1451
|
const define = _utils.objectEntries.call(void 0, getDefine(options));
|
|
@@ -1440,6 +1465,36 @@ function createFixPlugins(options) {
|
|
|
1440
1465
|
];
|
|
1441
1466
|
}
|
|
1442
1467
|
|
|
1468
|
+
// node/plugins/unocss.ts
|
|
1469
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
|
|
1474
|
+
async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, data }, { unocss: unoOptions }) {
|
|
1475
|
+
var _a, _b, _c, _d;
|
|
1476
|
+
const UnoCSS = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "unocss/vite"))).then((r) => r.default);
|
|
1477
|
+
const configFiles = _utils.uniq.call(void 0, [
|
|
1478
|
+
...themeRoots.map((i) => `${i}/uno.config.ts`),
|
|
1479
|
+
...addonRoots.map((i) => `${i}/uno.config.ts`),
|
|
1480
|
+
_path.resolve.call(void 0, clientRoot, "uno.config.ts")
|
|
1481
|
+
]);
|
|
1482
|
+
const configFile = configFiles.find((i) => _fs.existsSync.call(void 0, i));
|
|
1483
|
+
let config = _jiti2.default.call(void 0, __filename)(configFile);
|
|
1484
|
+
if ("default" in config)
|
|
1485
|
+
config = config.default;
|
|
1486
|
+
config = await loadSetups(roots, "unocss.ts", {}, config, true);
|
|
1487
|
+
config.theme || (config.theme = {});
|
|
1488
|
+
(_a = config.theme).fontFamily || (_a.fontFamily = {});
|
|
1489
|
+
(_b = config.theme.fontFamily).sans || (_b.sans = data.config.fonts.sans.join(","));
|
|
1490
|
+
(_c = config.theme.fontFamily).mono || (_c.mono = data.config.fonts.mono.join(","));
|
|
1491
|
+
(_d = config.theme.fontFamily).serif || (_d.serif = data.config.fonts.serif.join(","));
|
|
1492
|
+
return UnoCSS({
|
|
1493
|
+
configFile: false,
|
|
1494
|
+
..._utils.deepMerge.call(void 0, config, unoOptions || {})
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1443
1498
|
// node/plugins/preset.ts
|
|
1444
1499
|
var customElements = /* @__PURE__ */ new Set([
|
|
1445
1500
|
"annotation",
|
|
@@ -1485,25 +1540,27 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1485
1540
|
clientRoot,
|
|
1486
1541
|
data: { config }
|
|
1487
1542
|
} = options;
|
|
1488
|
-
const VuePlugin = _pluginvue2.default.call(void 0,
|
|
1543
|
+
const VuePlugin = _pluginvue2.default.call(void 0, {
|
|
1489
1544
|
include: [/\.vue$/, /\.md$/],
|
|
1490
1545
|
exclude: [],
|
|
1491
|
-
template:
|
|
1546
|
+
template: {
|
|
1492
1547
|
compilerOptions: {
|
|
1493
1548
|
isCustomElement(tag) {
|
|
1494
1549
|
return customElements.has(tag);
|
|
1495
1550
|
}
|
|
1496
|
-
}
|
|
1497
|
-
|
|
1498
|
-
|
|
1551
|
+
},
|
|
1552
|
+
...vueOptions == null ? void 0 : vueOptions.template
|
|
1553
|
+
},
|
|
1554
|
+
...vueOptions
|
|
1555
|
+
});
|
|
1499
1556
|
const MarkdownPlugin = await createMarkdownPlugin(options, pluginOptions);
|
|
1500
1557
|
const drawingData = await loadDrawings(options);
|
|
1501
1558
|
return [
|
|
1502
|
-
await createWindiCSSPlugin(options, pluginOptions),
|
|
1559
|
+
config.css === "unocss" ? await createUnocssPlugin(options, pluginOptions) : await createWindiCSSPlugin(options, pluginOptions),
|
|
1503
1560
|
MarkdownPlugin,
|
|
1504
1561
|
VuePlugin,
|
|
1505
1562
|
createSlidesLoader(options, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin),
|
|
1506
|
-
_vite6.default.call(void 0,
|
|
1563
|
+
_vite6.default.call(void 0, {
|
|
1507
1564
|
extensions: ["vue", "md", "ts"],
|
|
1508
1565
|
dirs: [
|
|
1509
1566
|
`${clientRoot}/builtin`,
|
|
@@ -1520,13 +1577,15 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1520
1577
|
prefix: "",
|
|
1521
1578
|
customCollections: Object.keys(iconsOptions.customCollections || [])
|
|
1522
1579
|
})
|
|
1523
|
-
]
|
|
1524
|
-
|
|
1525
|
-
|
|
1580
|
+
],
|
|
1581
|
+
...componentsOptions
|
|
1582
|
+
}),
|
|
1583
|
+
_vite4.default.call(void 0, {
|
|
1526
1584
|
defaultClass: "slidev-icon",
|
|
1527
|
-
autoInstall: true
|
|
1528
|
-
|
|
1529
|
-
|
|
1585
|
+
autoInstall: true,
|
|
1586
|
+
...iconsOptions
|
|
1587
|
+
}),
|
|
1588
|
+
config.remoteAssets === true || config.remoteAssets === mode ? _vitepluginremoteassets2.default.call(void 0, {
|
|
1530
1589
|
rules: [
|
|
1531
1590
|
..._vitepluginremoteassets.DefaultRules,
|
|
1532
1591
|
{
|
|
@@ -1535,18 +1594,20 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1535
1594
|
}
|
|
1536
1595
|
],
|
|
1537
1596
|
resolveMode: (id) => id.endsWith("index.html") ? "relative" : "@fs",
|
|
1538
|
-
awaitDownload: mode === "build"
|
|
1539
|
-
|
|
1597
|
+
awaitDownload: mode === "build",
|
|
1598
|
+
...remoteAssetsOptions
|
|
1599
|
+
}) : null,
|
|
1540
1600
|
_vitepluginvueserverref2.default.call(void 0, {
|
|
1541
1601
|
debug: process.env.NODE_ENV === "development",
|
|
1542
|
-
state:
|
|
1602
|
+
state: {
|
|
1543
1603
|
sync: false,
|
|
1544
1604
|
nav: {
|
|
1545
1605
|
page: 0,
|
|
1546
1606
|
clicks: 0
|
|
1547
1607
|
},
|
|
1548
|
-
drawings: drawingData
|
|
1549
|
-
|
|
1608
|
+
drawings: drawingData,
|
|
1609
|
+
...serverRefOptions.state
|
|
1610
|
+
},
|
|
1550
1611
|
onChanged(key, data, patch, timestamp) {
|
|
1551
1612
|
serverRefOptions.onChanged && serverRefOptions.onChanged(key, data, patch, timestamp);
|
|
1552
1613
|
if (!options.data.config.drawings.persist)
|