@slidev/cli 0.29.2 → 0.30.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/dist/{build-IGNJAAON.js → build-23SNLQAJ.js} +19 -16
- package/dist/{build-RNBUEMO5.mjs → build-YFDGZUAK.mjs} +12 -9
- package/dist/{chunk-Z6YPUFV4.js → chunk-2LNCAUCD.js} +1965 -1997
- package/dist/{chunk-XI447TZR.js → chunk-E4IOOAKN.js} +4 -4
- package/dist/{chunk-7QXPSYEZ.js → chunk-IXNT7VMK.js} +16 -16
- package/dist/{chunk-NQIXBLV4.mjs → chunk-MBZTOLHN.mjs} +107 -17
- package/dist/{chunk-XMJRAMYY.mjs → chunk-O57F34AM.mjs} +2 -2
- package/dist/{chunk-XDEB4KBK.mjs → chunk-OII7IQD2.mjs} +1870 -1903
- package/dist/{chunk-NPCPO6ET.js → chunk-RSHUQSN4.js} +159 -69
- package/dist/{chunk-VYBQLH2X.mjs → chunk-XMETW2MS.mjs} +12 -16
- package/dist/cli.js +31 -30
- package/dist/cli.mjs +14 -13
- package/dist/{export-XA3FQNS5.js → export-AKEY52VC.js} +71 -66
- package/dist/{export-4MUQJ4DB.mjs → export-RFCVIBYE.mjs} +71 -66
- package/dist/index.js +7 -7
- package/dist/index.mjs +4 -4
- package/package.json +17 -18
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkIXNT7VMKjs = require('./chunk-IXNT7VMK.js');
|
|
14
14
|
|
|
15
15
|
// ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
|
|
16
|
-
var require_fast_deep_equal =
|
|
16
|
+
var require_fast_deep_equal = _chunkIXNT7VMKjs.__commonJS.call(void 0, {
|
|
17
17
|
"../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports, module) {
|
|
18
18
|
"use strict";
|
|
19
|
-
|
|
19
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
20
20
|
module.exports = function equal2(a, b) {
|
|
21
21
|
if (a === b)
|
|
22
22
|
return true;
|
|
@@ -59,7 +59,7 @@ var require_fast_deep_equal = _chunk7QXPSYEZjs.__commonJS.call(void 0, {
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
// node/common.ts
|
|
62
|
-
|
|
62
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
63
63
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
64
64
|
var _path = require('path');
|
|
65
65
|
var _utils = require('@antfu/utils');
|
|
@@ -87,13 +87,13 @@ ${(((_b = index.match(/<body>([\s\S]*?)<\/body>/im)) == null ? void 0 : _b[1]) |
|
|
|
87
87
|
body += '\n<script async src="https://platform.twitter.com/widgets.js"><\/script>';
|
|
88
88
|
if (data.config.fonts.webfonts.length && data.config.fonts.provider !== "none")
|
|
89
89
|
head += `
|
|
90
|
-
<link rel="stylesheet" href="${
|
|
91
|
-
main = main.replace("__ENTRY__",
|
|
90
|
+
<link rel="stylesheet" href="${_chunkIXNT7VMKjs.generateGoogleFontsUrl.call(void 0, data.config.fonts)}" type="text/css">`;
|
|
91
|
+
main = main.replace("__ENTRY__", _chunkIXNT7VMKjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "main.ts"))).replace("<!-- head -->", head).replace("<!-- body -->", body);
|
|
92
92
|
return main;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
// node/plugins/windicss.ts
|
|
96
|
-
|
|
96
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
|
|
@@ -101,13 +101,13 @@ var _vitepluginwindicss = require('vite-plugin-windicss'); var _vitepluginwindic
|
|
|
101
101
|
var _jiti = require('jiti'); var _jiti2 = _interopRequireDefault(_jiti);
|
|
102
102
|
|
|
103
103
|
// node/plugins/setupNode.ts
|
|
104
|
-
|
|
104
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
105
105
|
|
|
106
106
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
function deepMerge(a, b, rootPath = "") {
|
|
110
|
-
a =
|
|
110
|
+
a = _chunkIXNT7VMKjs.__spreadValues.call(void 0, {}, a);
|
|
111
111
|
Object.keys(b).forEach((key) => {
|
|
112
112
|
if (_utils.isObject.call(void 0, a[key]))
|
|
113
113
|
a[key] = deepMerge(a[key], b[key], rootPath ? `${rootPath}.${key}` : key);
|
|
@@ -145,7 +145,7 @@ async function createWindiCSSPlugin({ themeRoots, clientRoot, userRoot, roots, d
|
|
|
145
145
|
if (config.default)
|
|
146
146
|
config = config.default;
|
|
147
147
|
config = await loadSetups(roots, "windicss.ts", {}, config, true);
|
|
148
|
-
return _vitepluginwindicss2.default.call(void 0,
|
|
148
|
+
return _vitepluginwindicss2.default.call(void 0, _chunkIXNT7VMKjs.__spreadValues.call(void 0, {
|
|
149
149
|
configFiles: [configFile],
|
|
150
150
|
config,
|
|
151
151
|
onConfigResolved(config2) {
|
|
@@ -167,15 +167,15 @@ async function createWindiCSSPlugin({ themeRoots, clientRoot, userRoot, roots, d
|
|
|
167
167
|
config2.scanOptions.include.push(`${i}/layouts/*.{vue,ts}`);
|
|
168
168
|
});
|
|
169
169
|
config2.scanOptions.include.push(`!${_utils.slash.call(void 0, _path.resolve.call(void 0, userRoot, "node_modules"))}`);
|
|
170
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
171
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
172
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
170
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkIXNT7VMKjs.resolveImportPath.call(void 0, "monaco-editor/package.json", true)));
|
|
171
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkIXNT7VMKjs.resolveImportPath.call(void 0, "katex/package.json", true)));
|
|
172
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkIXNT7VMKjs.resolveImportPath.call(void 0, "prettier/package.json", true)));
|
|
173
173
|
}
|
|
174
174
|
}, windiOptions));
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
// node/plugins/preset.ts
|
|
178
|
-
|
|
178
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
179
179
|
var _pluginvue = require('@vitejs/plugin-vue'); var _pluginvue2 = _interopRequireDefault(_pluginvue);
|
|
180
180
|
var _vite = require('unplugin-icons/vite'); var _vite2 = _interopRequireDefault(_vite);
|
|
181
181
|
var _resolver = require('unplugin-icons/resolver'); var _resolver2 = _interopRequireDefault(_resolver);
|
|
@@ -185,7 +185,7 @@ var _vitepluginvueserverref = require('vite-plugin-vue-server-ref'); var _vitepl
|
|
|
185
185
|
|
|
186
186
|
|
|
187
187
|
// node/drawings.ts
|
|
188
|
-
|
|
188
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
189
189
|
|
|
190
190
|
|
|
191
191
|
var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);
|
|
@@ -231,7 +231,7 @@ ${value}
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
// node/plugins/extendConfig.ts
|
|
234
|
-
|
|
234
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
235
235
|
|
|
236
236
|
var _vite5 = require('vite');
|
|
237
237
|
var _isinstalledglobally = require('is-installed-globally'); var _isinstalledglobally2 = _interopRequireDefault(_isinstalledglobally);
|
|
@@ -239,32 +239,34 @@ var _isinstalledglobally = require('is-installed-globally'); var _isinstalledglo
|
|
|
239
239
|
|
|
240
240
|
// ../client/package.json
|
|
241
241
|
var dependencies = {
|
|
242
|
-
"@antfu/utils": "^0.5.
|
|
242
|
+
"@antfu/utils": "^0.5.1",
|
|
243
243
|
"@slidev/parser": "workspace:*",
|
|
244
244
|
"@slidev/types": "workspace:*",
|
|
245
|
-
"@vueuse/core": "^8.
|
|
245
|
+
"@vueuse/core": "^8.2.5",
|
|
246
246
|
"@vueuse/head": "^0.7.5",
|
|
247
|
-
"@vueuse/motion": "^2.0.0-beta.
|
|
247
|
+
"@vueuse/motion": "^2.0.0-beta.18",
|
|
248
248
|
codemirror: "^5.65.2",
|
|
249
|
+
defu: "^6.0.0",
|
|
249
250
|
drauu: "^0.3.0",
|
|
250
251
|
"file-saver": "^2.0.5",
|
|
251
252
|
"js-base64": "^3.7.2",
|
|
252
253
|
"js-yaml": "^4.1.0",
|
|
253
254
|
katex: "^0.15.3",
|
|
254
|
-
mermaid: "^
|
|
255
|
+
mermaid: "^9.0.0",
|
|
255
256
|
"monaco-editor": "^0.33.0",
|
|
256
|
-
nanoid: "^3.3.
|
|
257
|
-
prettier: "^2.6.
|
|
257
|
+
nanoid: "^3.3.2",
|
|
258
|
+
prettier: "^2.6.2",
|
|
258
259
|
recordrtc: "^5.6.2",
|
|
259
260
|
resolve: "^1.22.0",
|
|
260
|
-
"vite-plugin-windicss": "^1.8.
|
|
261
|
-
vue: "^3.2.
|
|
261
|
+
"vite-plugin-windicss": "^1.8.4",
|
|
262
|
+
vue: "^3.2.32",
|
|
262
263
|
"vue-router": "^4.0.14",
|
|
264
|
+
"vue-starport": "^0.2.4",
|
|
263
265
|
windicss: "^3.5.1"
|
|
264
266
|
};
|
|
265
267
|
|
|
266
268
|
// node/vite/searchRoot.ts
|
|
267
|
-
|
|
269
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
268
270
|
|
|
269
271
|
|
|
270
272
|
var ROOT_FILES = [
|
|
@@ -324,7 +326,7 @@ function createConfigPlugin(options) {
|
|
|
324
326
|
define: getDefine(options),
|
|
325
327
|
resolve: {
|
|
326
328
|
alias: {
|
|
327
|
-
"@slidev/client/": `${
|
|
329
|
+
"@slidev/client/": `${_chunkIXNT7VMKjs.toAtFS.call(void 0, options.clientRoot)}/`
|
|
328
330
|
}
|
|
329
331
|
},
|
|
330
332
|
optimizeDeps: {
|
|
@@ -351,7 +353,7 @@ function createConfigPlugin(options) {
|
|
|
351
353
|
allow: _utils.uniq.call(void 0, [
|
|
352
354
|
searchForWorkspaceRoot(options.userRoot),
|
|
353
355
|
searchForWorkspaceRoot(options.cliRoot),
|
|
354
|
-
..._isinstalledglobally2.default ? [_path.dirname.call(void 0,
|
|
356
|
+
..._isinstalledglobally2.default ? [_path.dirname.call(void 0, _chunkIXNT7VMKjs.resolveGlobalImportPath.call(void 0, "@slidev/client/package.json")), _path.dirname.call(void 0, _chunkIXNT7VMKjs.resolveGlobalImportPath.call(void 0, "katex/package.json"))] : []
|
|
355
357
|
])
|
|
356
358
|
}
|
|
357
359
|
}
|
|
@@ -360,7 +362,7 @@ function createConfigPlugin(options) {
|
|
|
360
362
|
injection.cacheDir = _path.join.call(void 0, options.cliRoot, "node_modules/.vite");
|
|
361
363
|
injection.publicDir = _path.join.call(void 0, options.userRoot, "public");
|
|
362
364
|
injection.root = options.cliRoot;
|
|
363
|
-
injection.resolve.alias.vue = `${
|
|
365
|
+
injection.resolve.alias.vue = `${_chunkIXNT7VMKjs.resolveImportPath.call(void 0, "vue/dist/vue.esm-browser.js", true)}`;
|
|
364
366
|
}
|
|
365
367
|
return _vite5.mergeConfig.call(void 0, config, injection);
|
|
366
368
|
},
|
|
@@ -381,7 +383,7 @@ function createConfigPlugin(options) {
|
|
|
381
383
|
}
|
|
382
384
|
function getDefine(options) {
|
|
383
385
|
return {
|
|
384
|
-
__SLIDEV_CLIENT_ROOT__: JSON.stringify(
|
|
386
|
+
__SLIDEV_CLIENT_ROOT__: JSON.stringify(_chunkIXNT7VMKjs.toAtFS.call(void 0, options.clientRoot)),
|
|
385
387
|
__SLIDEV_HASH_ROUTE__: JSON.stringify(options.data.config.routerMode === "hash"),
|
|
386
388
|
__SLIDEV_FEATURE_DRAWINGS__: JSON.stringify(options.data.config.drawings.enabled === true || options.data.config.drawings.enabled === options.mode),
|
|
387
389
|
__SLIDEV_FEATURE_DRAWINGS_PERSIST__: JSON.stringify(!!options.data.config.drawings.persist === true),
|
|
@@ -390,8 +392,8 @@ function getDefine(options) {
|
|
|
390
392
|
}
|
|
391
393
|
|
|
392
394
|
// node/plugins/loaders.ts
|
|
393
|
-
|
|
394
|
-
var import_fast_deep_equal =
|
|
395
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
396
|
+
var import_fast_deep_equal = _chunkIXNT7VMKjs.__toESM.call(void 0, require_fast_deep_equal());
|
|
395
397
|
|
|
396
398
|
|
|
397
399
|
|
|
@@ -423,7 +425,7 @@ md.use(_markdownitlinkattributes2.default, {
|
|
|
423
425
|
}
|
|
424
426
|
});
|
|
425
427
|
function prepareSlideInfo(data) {
|
|
426
|
-
return
|
|
428
|
+
return _chunkIXNT7VMKjs.__spreadProps.call(void 0, _chunkIXNT7VMKjs.__spreadValues.call(void 0, {}, data), {
|
|
427
429
|
notesHTML: md.render((data == null ? void 0 : data.note) || "")
|
|
428
430
|
});
|
|
429
431
|
}
|
|
@@ -469,7 +471,7 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
|
|
|
469
471
|
});
|
|
470
472
|
},
|
|
471
473
|
async handleHotUpdate(ctx) {
|
|
472
|
-
var _a;
|
|
474
|
+
var _a, _b, _c;
|
|
473
475
|
if (!data.entries.some((i) => _utils.slash.call(void 0, i) === ctx.file))
|
|
474
476
|
return;
|
|
475
477
|
const newData = await parser.load(entry, data.themeMeta);
|
|
@@ -493,7 +495,7 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
|
|
|
493
495
|
for (let i = 0; i < length; i++) {
|
|
494
496
|
const a = data.slides[i];
|
|
495
497
|
const b = newData.slides[i];
|
|
496
|
-
if ((a == null ? void 0 : a.content.trim()) === (b == null ? void 0 : b.content.trim()) && (a == null ? void 0 : a.note) === (b == null ? void 0 : b.note) && (0, import_fast_deep_equal.default)(a.frontmatter, b.frontmatter))
|
|
498
|
+
if ((a == null ? void 0 : a.content.trim()) === (b == null ? void 0 : b.content.trim()) && ((_a = a == null ? void 0 : a.title) == null ? void 0 : _a.trim()) === ((_b = b == null ? void 0 : b.title) == null ? void 0 : _b.trim()) && (a == null ? void 0 : a.note) === (b == null ? void 0 : b.note) && (0, import_fast_deep_equal.default)(a.frontmatter, b.frontmatter))
|
|
497
499
|
continue;
|
|
498
500
|
ctx.server.ws.send({
|
|
499
501
|
type: "custom",
|
|
@@ -505,14 +507,16 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
|
|
|
505
507
|
});
|
|
506
508
|
hmrPages.add(i);
|
|
507
509
|
}
|
|
508
|
-
(
|
|
510
|
+
(_c = serverOptions.onDataReload) == null ? void 0 : _c.call(serverOptions, newData, data);
|
|
509
511
|
Object.assign(data, newData);
|
|
512
|
+
if (hmrPages.size > 0)
|
|
513
|
+
moduleIds.add("/@slidev/titles.md");
|
|
510
514
|
const vueModules = (await Promise.all(Array.from(hmrPages).map(async (i) => {
|
|
511
515
|
var _a2;
|
|
512
516
|
const file = `${slidePrefix}${i + 1}.md`;
|
|
513
517
|
try {
|
|
514
|
-
const md2 = await transformMarkdown(MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file), i, newData);
|
|
515
|
-
return await VuePlugin.handleHotUpdate(
|
|
518
|
+
const md2 = await transformMarkdown(await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file), i, newData);
|
|
519
|
+
return await VuePlugin.handleHotUpdate(_chunkIXNT7VMKjs.__spreadProps.call(void 0, _chunkIXNT7VMKjs.__spreadValues.call(void 0, {}, ctx), {
|
|
516
520
|
modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
|
|
517
521
|
file,
|
|
518
522
|
read() {
|
|
@@ -556,6 +560,14 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
|
|
|
556
560
|
return generateGlobalComponents("bottom");
|
|
557
561
|
if (id === "/@slidev/custom-nav-controls")
|
|
558
562
|
return generateCustomNavControls();
|
|
563
|
+
if (id === "/@slidev/titles.md") {
|
|
564
|
+
return {
|
|
565
|
+
code: data.slides.map(({ title }, i) => {
|
|
566
|
+
return `<template ${i === 0 ? "v-if" : "v-else-if"}="+no === ${i + 1}">${title}</template>`;
|
|
567
|
+
}).join(""),
|
|
568
|
+
map: {}
|
|
569
|
+
};
|
|
570
|
+
}
|
|
559
571
|
if (id.startsWith(slidePrefix)) {
|
|
560
572
|
const remaning = id.slice(slidePrefix.length);
|
|
561
573
|
const match = remaning.match(regexIdQuery);
|
|
@@ -592,6 +604,24 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
|
|
|
592
604
|
const pageNo = parseInt(no) - 1;
|
|
593
605
|
return transformMarkdown(code, pageNo, data);
|
|
594
606
|
}
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
name: "slidev:context-transform:pre",
|
|
610
|
+
enforce: "pre",
|
|
611
|
+
async transform(code, id) {
|
|
612
|
+
if (!id.endsWith(".vue"))
|
|
613
|
+
return;
|
|
614
|
+
return transformVue(code);
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
name: "slidev:title-transform:pre",
|
|
619
|
+
enforce: "pre",
|
|
620
|
+
transform(code, id) {
|
|
621
|
+
if (id !== "/@slidev/titles.md")
|
|
622
|
+
return;
|
|
623
|
+
return transformTitles(code);
|
|
624
|
+
}
|
|
595
625
|
}
|
|
596
626
|
];
|
|
597
627
|
function updateServerWatcher() {
|
|
@@ -603,14 +633,17 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
|
|
|
603
633
|
async function transformMarkdown(code, pageNo, data2) {
|
|
604
634
|
var _a, _b;
|
|
605
635
|
const layouts = await getLayouts();
|
|
606
|
-
const frontmatter =
|
|
636
|
+
const frontmatter = _chunkIXNT7VMKjs.__spreadValues.call(void 0, _chunkIXNT7VMKjs.__spreadValues.call(void 0, {}, ((_a = data2.headmatter) == null ? void 0 : _a.defaults) || {}), ((_b = data2.slides[pageNo]) == null ? void 0 : _b.frontmatter) || {});
|
|
607
637
|
const layoutName = (frontmatter == null ? void 0 : frontmatter.layout) || (pageNo === 0 ? "cover" : "default");
|
|
608
638
|
if (!layouts[layoutName])
|
|
609
639
|
throw new Error(`Unknown layout "${layoutName}"`);
|
|
610
640
|
delete frontmatter.title;
|
|
611
641
|
const imports = [
|
|
612
|
-
|
|
613
|
-
`
|
|
642
|
+
'import { inject as vueInject } from "vue"',
|
|
643
|
+
`import InjectedLayout from "${_chunkIXNT7VMKjs.toAtFS.call(void 0, layouts[layoutName])}"`,
|
|
644
|
+
'import { injectionSlidevContext } from "@slidev/client/constants"',
|
|
645
|
+
`const frontmatter = ${JSON.stringify(frontmatter)}`,
|
|
646
|
+
"const $slidev = vueInject(injectionSlidevContext)"
|
|
614
647
|
];
|
|
615
648
|
code = code.replace(/(<script setup.*>)/g, `$1
|
|
616
649
|
${imports.join("\n")}
|
|
@@ -627,6 +660,63 @@ ${body}
|
|
|
627
660
|
${code.slice(injectB)}`;
|
|
628
661
|
return code;
|
|
629
662
|
}
|
|
663
|
+
function transformVue(code) {
|
|
664
|
+
if (code.includes("injectionSlidevContext"))
|
|
665
|
+
return code;
|
|
666
|
+
const imports = [
|
|
667
|
+
'import { inject as vueInject } from "vue"',
|
|
668
|
+
'import { injectionSlidevContext } from "@slidev/client/constants"',
|
|
669
|
+
"const $slidev = vueInject(injectionSlidevContext)"
|
|
670
|
+
];
|
|
671
|
+
const matchScript = code.match(/<script((?!setup).)*(setup)?.*>/);
|
|
672
|
+
if (matchScript && matchScript[2]) {
|
|
673
|
+
return code.replace(/(<script.*>)/g, `$1
|
|
674
|
+
${imports.join("\n")}
|
|
675
|
+
`);
|
|
676
|
+
} else if (matchScript && !matchScript[2]) {
|
|
677
|
+
const matchExport = code.match(/export\s+default\s+[^{]*{/);
|
|
678
|
+
if (matchExport) {
|
|
679
|
+
const exportIndex = (matchExport.index || 0) + matchExport[0].length;
|
|
680
|
+
let component = code.slice(exportIndex);
|
|
681
|
+
component = component.slice(0, component.indexOf("<\/script>"));
|
|
682
|
+
if (component.match(/setup\s*\(/)) {
|
|
683
|
+
const scriptIndex = (matchScript.index || 0) + matchScript[0].length;
|
|
684
|
+
const provideImport = '\nimport { injectionSlidevContext } from "@slidev/client/constants"\n';
|
|
685
|
+
code = `${code.slice(0, scriptIndex)}${provideImport}${code.slice(scriptIndex)}`;
|
|
686
|
+
let injectIndex = exportIndex + provideImport.length;
|
|
687
|
+
let injectObject = "$slidev: { from: injectionSlidevContext },";
|
|
688
|
+
const matchInject = component.match(/.*inject\s*:\s*([\[{])/);
|
|
689
|
+
if (matchInject) {
|
|
690
|
+
injectIndex += (matchInject.index || 0) + matchInject[0].length;
|
|
691
|
+
if (matchInject[1] === "[") {
|
|
692
|
+
let injects = component.slice((matchInject.index || 0) + matchInject[0].length);
|
|
693
|
+
const injectEndIndex = injects.indexOf("]");
|
|
694
|
+
injects = injects.slice(0, injectEndIndex);
|
|
695
|
+
injectObject += injects.split(",").map((inject) => `${inject}: {from: ${inject}}`).join(",");
|
|
696
|
+
return `${code.slice(0, injectIndex - 1)}{
|
|
697
|
+
${injectObject}
|
|
698
|
+
}${code.slice(injectIndex + injectEndIndex + 1)}`;
|
|
699
|
+
} else {
|
|
700
|
+
return `${code.slice(0, injectIndex)}
|
|
701
|
+
${injectObject}
|
|
702
|
+
${code.slice(injectIndex)}`;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
return `${code.slice(0, injectIndex)}
|
|
706
|
+
inject: { ${injectObject} },
|
|
707
|
+
${code.slice(injectIndex)}`;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return `<script setup>
|
|
712
|
+
${imports.join("\n")}
|
|
713
|
+
<\/script>
|
|
714
|
+
${code}`;
|
|
715
|
+
}
|
|
716
|
+
function transformTitles(code) {
|
|
717
|
+
return code.replace(/<template>\s*<div>\s*<p>/, "<template>").replace(/<\/p>\s*<\/div>\s*<\/template>/, "</template>").replace(/<script\ssetup>/, `<script setup lang="ts">
|
|
718
|
+
defineProps<{ no: number | string }>()`);
|
|
719
|
+
}
|
|
630
720
|
async function getLayouts() {
|
|
631
721
|
const now = Date.now();
|
|
632
722
|
if (now - _layouts_cache_time < 2e3)
|
|
@@ -655,9 +745,9 @@ ${code.slice(injectB)}`;
|
|
|
655
745
|
}
|
|
656
746
|
async function generateUserStyles() {
|
|
657
747
|
const imports = [
|
|
658
|
-
`import "${
|
|
659
|
-
`import "${
|
|
660
|
-
`import "${
|
|
748
|
+
`import "${_chunkIXNT7VMKjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/vars.css"))}"`,
|
|
749
|
+
`import "${_chunkIXNT7VMKjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/index.css"))}"`,
|
|
750
|
+
`import "${_chunkIXNT7VMKjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/code.css"))}"`
|
|
661
751
|
];
|
|
662
752
|
const roots2 = _utils.uniq.call(void 0, [
|
|
663
753
|
...themeRoots,
|
|
@@ -673,13 +763,13 @@ ${code.slice(injectB)}`;
|
|
|
673
763
|
];
|
|
674
764
|
for (const style of styles) {
|
|
675
765
|
if (_fsextra.existsSync.call(void 0, style)) {
|
|
676
|
-
imports.push(`import "${
|
|
766
|
+
imports.push(`import "${_chunkIXNT7VMKjs.toAtFS.call(void 0, style)}"`);
|
|
677
767
|
continue;
|
|
678
768
|
}
|
|
679
769
|
}
|
|
680
770
|
}
|
|
681
771
|
if (data.features.katex)
|
|
682
|
-
imports.push(`import "${
|
|
772
|
+
imports.push(`import "${_chunkIXNT7VMKjs.toAtFS.call(void 0, _chunkIXNT7VMKjs.resolveImportPath.call(void 0, "katex/dist/katex.min.css", true))}"`);
|
|
683
773
|
return imports.join("\n");
|
|
684
774
|
}
|
|
685
775
|
async function generateMonacoTypes() {
|
|
@@ -688,7 +778,7 @@ ${code.slice(injectB)}`;
|
|
|
688
778
|
async function generateLayouts() {
|
|
689
779
|
const imports = [];
|
|
690
780
|
const layouts = _utils.objectMap.call(void 0, await getLayouts(), (k, v) => {
|
|
691
|
-
imports.push(`import __layout_${k} from "${
|
|
781
|
+
imports.push(`import __layout_${k} from "${_chunkIXNT7VMKjs.toAtFS.call(void 0, v)}"`);
|
|
692
782
|
return [k, `__layout_${k}`];
|
|
693
783
|
});
|
|
694
784
|
return [
|
|
@@ -736,10 +826,10 @@ ${routes.join(",\n")}
|
|
|
736
826
|
return [...imports, routesStr].join("\n");
|
|
737
827
|
}
|
|
738
828
|
function generateConfigs() {
|
|
739
|
-
const config =
|
|
829
|
+
const config = _chunkIXNT7VMKjs.__spreadValues.call(void 0, {}, data.config);
|
|
740
830
|
if (_utils.isString.call(void 0, config.title)) {
|
|
741
831
|
const tokens = md.parseInline(config.title, {});
|
|
742
|
-
config.title =
|
|
832
|
+
config.title = _chunkIXNT7VMKjs.stringifyMarkdownTokens.call(void 0, tokens);
|
|
743
833
|
}
|
|
744
834
|
if (_utils.isString.call(void 0, config.info))
|
|
745
835
|
config.info = md.render(config.info);
|
|
@@ -760,7 +850,7 @@ ${routes.join(",\n")}
|
|
|
760
850
|
];
|
|
761
851
|
}
|
|
762
852
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
763
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${
|
|
853
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunkIXNT7VMKjs.toAtFS.call(void 0, i)}'`).join("\n");
|
|
764
854
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
765
855
|
return `
|
|
766
856
|
${imports}
|
|
@@ -779,7 +869,7 @@ export default {
|
|
|
779
869
|
_path.join.call(void 0, root, "CustomNavControls.vue")
|
|
780
870
|
];
|
|
781
871
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
782
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${
|
|
872
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunkIXNT7VMKjs.toAtFS.call(void 0, i)}'`).join("\n");
|
|
783
873
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
784
874
|
return `
|
|
785
875
|
${imports}
|
|
@@ -794,7 +884,7 @@ export default {
|
|
|
794
884
|
}
|
|
795
885
|
|
|
796
886
|
// node/plugins/monacoTransform.ts
|
|
797
|
-
|
|
887
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
798
888
|
|
|
799
889
|
|
|
800
890
|
|
|
@@ -828,7 +918,7 @@ function createMonacoTypesLoader() {
|
|
|
828
918
|
}
|
|
829
919
|
|
|
830
920
|
// node/plugins/setupClient.ts
|
|
831
|
-
|
|
921
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
832
922
|
|
|
833
923
|
|
|
834
924
|
|
|
@@ -850,7 +940,7 @@ function createClientSetupPlugin({ clientRoot, themeRoots, userRoot }) {
|
|
|
850
940
|
setups.forEach((path, idx) => {
|
|
851
941
|
if (!_fs.existsSync.call(void 0, path))
|
|
852
942
|
return;
|
|
853
|
-
imports.push(`import __n${idx} from '${
|
|
943
|
+
imports.push(`import __n${idx} from '${_chunkIXNT7VMKjs.toAtFS.call(void 0, path)}'`);
|
|
854
944
|
let fn = `__n${idx}`;
|
|
855
945
|
let awaitFn = `await __n${idx}`;
|
|
856
946
|
if (/\binjection_return\b/g.test(code)) {
|
|
@@ -878,7 +968,7 @@ function createClientSetupPlugin({ clientRoot, themeRoots, userRoot }) {
|
|
|
878
968
|
}
|
|
879
969
|
|
|
880
970
|
// node/plugins/markdown.ts
|
|
881
|
-
|
|
971
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
882
972
|
var _vitepluginmd = require('vite-plugin-md'); var _vitepluginmd2 = _interopRequireDefault(_vitepluginmd);
|
|
883
973
|
var _jsbase64 = require('js-base64'); var base64 = _interopRequireWildcard(_jsbase64);
|
|
884
974
|
|
|
@@ -888,7 +978,7 @@ var _shiki = require('shiki'); var Shiki = _interopRequireWildcard(_shiki);
|
|
|
888
978
|
var _plantumlencoder = require('plantuml-encoder');
|
|
889
979
|
|
|
890
980
|
// node/plugins/markdown-it-katex.ts
|
|
891
|
-
|
|
981
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
892
982
|
var _katex = require('katex'); var _katex2 = _interopRequireDefault(_katex);
|
|
893
983
|
function isValidDelim(state, pos) {
|
|
894
984
|
const max = state.posMax;
|
|
@@ -1035,7 +1125,7 @@ function math_plugin(md2, options) {
|
|
|
1035
1125
|
}
|
|
1036
1126
|
|
|
1037
1127
|
// node/plugins/markdown-it-prism.ts
|
|
1038
|
-
|
|
1128
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
1039
1129
|
var _prismjs = require('prismjs'); var _prismjs2 = _interopRequireDefault(_prismjs);
|
|
1040
1130
|
var _ = require('prismjs/components/'); var _2 = _interopRequireDefault(_);
|
|
1041
1131
|
var DEFAULTS = {
|
|
@@ -1058,7 +1148,7 @@ function loadPrismLang(lang) {
|
|
|
1058
1148
|
}
|
|
1059
1149
|
function loadPrismPlugin(name) {
|
|
1060
1150
|
try {
|
|
1061
|
-
|
|
1151
|
+
_chunkIXNT7VMKjs.__require.call(void 0, `prismjs/plugins/${name}/prism-${name}`);
|
|
1062
1152
|
} catch (e) {
|
|
1063
1153
|
throw new Error(`Cannot load Prism plugin "${name}". Please check the spelling.`);
|
|
1064
1154
|
}
|
|
@@ -1098,7 +1188,7 @@ function markdownItPrism(markdownit, useroptions) {
|
|
|
1098
1188
|
}
|
|
1099
1189
|
|
|
1100
1190
|
// node/plugins/markdown-it-shiki.ts
|
|
1101
|
-
|
|
1191
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
1102
1192
|
function getThemeName(theme) {
|
|
1103
1193
|
if (typeof theme === "string")
|
|
1104
1194
|
return theme;
|
|
@@ -1120,7 +1210,7 @@ function resolveShikiOptions(options) {
|
|
|
1120
1210
|
themes.push(options.theme);
|
|
1121
1211
|
}
|
|
1122
1212
|
}
|
|
1123
|
-
return
|
|
1213
|
+
return _chunkIXNT7VMKjs.__spreadProps.call(void 0, _chunkIXNT7VMKjs.__spreadValues.call(void 0, {}, options), {
|
|
1124
1214
|
themes,
|
|
1125
1215
|
darkModeThemes: darkModeThemes ? {
|
|
1126
1216
|
dark: getThemeName(darkModeThemes.dark),
|
|
@@ -1158,7 +1248,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1158
1248
|
const setups = [];
|
|
1159
1249
|
const entryPath = _utils.slash.call(void 0, entry);
|
|
1160
1250
|
if (config.highlighter === "shiki") {
|
|
1161
|
-
const { getHighlighter } = await Promise.resolve().then(() =>
|
|
1251
|
+
const { getHighlighter } = await Promise.resolve().then(() => _chunkIXNT7VMKjs.__toESM.call(void 0, _chunkIXNT7VMKjs.__require.call(void 0, "shiki")));
|
|
1162
1252
|
const shikiOptions = await loadSetups(roots, "shiki.ts", Shiki, DEFAULT_SHIKI_OPTIONS, false);
|
|
1163
1253
|
const { langs, themes } = resolveShikiOptions(shikiOptions);
|
|
1164
1254
|
shikiOptions.highlighter = await getHighlighter({ themes, langs });
|
|
@@ -1167,11 +1257,11 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1167
1257
|
setups.push((md2) => md2.use(markdownItPrism));
|
|
1168
1258
|
}
|
|
1169
1259
|
const KatexOptions = await loadSetups(roots, "katex.ts", {}, { strict: false }, false);
|
|
1170
|
-
return _vitepluginmd2.default.call(void 0,
|
|
1260
|
+
return _vitepluginmd2.default.call(void 0, _chunkIXNT7VMKjs.__spreadProps.call(void 0, _chunkIXNT7VMKjs.__spreadValues.call(void 0, {
|
|
1171
1261
|
wrapperClasses: "",
|
|
1172
1262
|
headEnabled: false,
|
|
1173
1263
|
frontmatter: false,
|
|
1174
|
-
markdownItOptions:
|
|
1264
|
+
markdownItOptions: _chunkIXNT7VMKjs.__spreadValues.call(void 0, {
|
|
1175
1265
|
quotes: `""''`,
|
|
1176
1266
|
html: true,
|
|
1177
1267
|
xhtmlOut: true,
|
|
@@ -1307,7 +1397,7 @@ function escapeVueInCode(md2) {
|
|
|
1307
1397
|
}
|
|
1308
1398
|
|
|
1309
1399
|
// node/plugins/patchTransform.ts
|
|
1310
|
-
|
|
1400
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
1311
1401
|
|
|
1312
1402
|
function createFixPlugins(options) {
|
|
1313
1403
|
const define = _utils.objectEntries.call(void 0, getDefine(options));
|
|
@@ -1371,10 +1461,10 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1371
1461
|
clientRoot,
|
|
1372
1462
|
data: { config }
|
|
1373
1463
|
} = options;
|
|
1374
|
-
const VuePlugin = _pluginvue2.default.call(void 0,
|
|
1464
|
+
const VuePlugin = _pluginvue2.default.call(void 0, _chunkIXNT7VMKjs.__spreadValues.call(void 0, {
|
|
1375
1465
|
include: [/\.vue$/, /\.md$/],
|
|
1376
1466
|
exclude: [],
|
|
1377
|
-
template:
|
|
1467
|
+
template: _chunkIXNT7VMKjs.__spreadValues.call(void 0, {
|
|
1378
1468
|
compilerOptions: {
|
|
1379
1469
|
isCustomElement(tag) {
|
|
1380
1470
|
return customElements.has(tag);
|
|
@@ -1389,7 +1479,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1389
1479
|
MarkdownPlugin,
|
|
1390
1480
|
VuePlugin,
|
|
1391
1481
|
createSlidesLoader(options, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin),
|
|
1392
|
-
_vite4.default.call(void 0,
|
|
1482
|
+
_vite4.default.call(void 0, _chunkIXNT7VMKjs.__spreadValues.call(void 0, {
|
|
1393
1483
|
extensions: ["vue", "md", "ts"],
|
|
1394
1484
|
dirs: [
|
|
1395
1485
|
`${clientRoot}/builtin`,
|
|
@@ -1407,11 +1497,11 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1407
1497
|
})
|
|
1408
1498
|
]
|
|
1409
1499
|
}, componentsOptions)),
|
|
1410
|
-
_vite2.default.call(void 0,
|
|
1500
|
+
_vite2.default.call(void 0, _chunkIXNT7VMKjs.__spreadValues.call(void 0, {
|
|
1411
1501
|
defaultClass: "slidev-icon",
|
|
1412
1502
|
autoInstall: true
|
|
1413
1503
|
}, iconsOptions)),
|
|
1414
|
-
config.remoteAssets === true || config.remoteAssets === mode ? _vitepluginremoteassets2.default.call(void 0,
|
|
1504
|
+
config.remoteAssets === true || config.remoteAssets === mode ? _vitepluginremoteassets2.default.call(void 0, _chunkIXNT7VMKjs.__spreadValues.call(void 0, {
|
|
1415
1505
|
rules: [
|
|
1416
1506
|
..._vitepluginremoteassets.DefaultRules,
|
|
1417
1507
|
{
|
|
@@ -1424,7 +1514,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1424
1514
|
}, remoteAssetsOptions)) : null,
|
|
1425
1515
|
_vitepluginvueserverref2.default.call(void 0, {
|
|
1426
1516
|
debug: process.env.NODE_ENV === "development",
|
|
1427
|
-
state:
|
|
1517
|
+
state: _chunkIXNT7VMKjs.__spreadValues.call(void 0, {
|
|
1428
1518
|
sync: false,
|
|
1429
1519
|
nav: {
|
|
1430
1520
|
page: 0,
|
|
@@ -21,7 +21,6 @@ var __spreadValues = (a, b) => {
|
|
|
21
21
|
return a;
|
|
22
22
|
};
|
|
23
23
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
24
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
26
25
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
27
26
|
}) : x)(function(x) {
|
|
@@ -30,34 +29,31 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
30
29
|
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
31
30
|
});
|
|
32
31
|
var __esm = (fn, res) => function __init() {
|
|
33
|
-
return fn && (res = (0, fn[
|
|
32
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
34
33
|
};
|
|
35
34
|
var __commonJS = (cb, mod) => function __require2() {
|
|
36
|
-
return mod || (0, cb[
|
|
35
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
37
36
|
};
|
|
38
37
|
var __export = (target, all) => {
|
|
39
|
-
__markAsModule(target);
|
|
40
38
|
for (var name in all)
|
|
41
39
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
42
40
|
};
|
|
43
|
-
var
|
|
44
|
-
if (
|
|
45
|
-
for (let key of __getOwnPropNames(
|
|
46
|
-
if (!__hasOwnProp.call(
|
|
47
|
-
__defProp(
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
48
46
|
}
|
|
49
|
-
return
|
|
50
|
-
};
|
|
51
|
-
var __toModule = (module) => {
|
|
52
|
-
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
|
|
47
|
+
return to;
|
|
53
48
|
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
54
50
|
|
|
55
|
-
// ../../node_modules/.pnpm/tsup@5.
|
|
51
|
+
// ../../node_modules/.pnpm/tsup@5.12.5_typescript@4.6.3/node_modules/tsup/assets/esm_shims.js
|
|
56
52
|
import { fileURLToPath } from "url";
|
|
57
53
|
import path from "path";
|
|
58
54
|
var getFilename, getDirname, __dirname, __filename;
|
|
59
55
|
var init_esm_shims = __esm({
|
|
60
|
-
"../../node_modules/.pnpm/tsup@5.
|
|
56
|
+
"../../node_modules/.pnpm/tsup@5.12.5_typescript@4.6.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
61
57
|
getFilename = () => fileURLToPath(import.meta.url);
|
|
62
58
|
getDirname = () => path.dirname(getFilename());
|
|
63
59
|
__dirname = /* @__PURE__ */ getDirname();
|
|
@@ -129,7 +125,7 @@ export {
|
|
|
129
125
|
__require,
|
|
130
126
|
__commonJS,
|
|
131
127
|
__export,
|
|
132
|
-
|
|
128
|
+
__toESM,
|
|
133
129
|
__dirname,
|
|
134
130
|
__filename,
|
|
135
131
|
init_esm_shims,
|