@slidev/cli 0.31.1 → 0.31.4
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-WXX7THGM.js → build-5QYEFLVL.js} +11 -11
- package/dist/{build-6XVXRYOT.mjs → build-QLCAUS73.mjs} +3 -3
- package/dist/{chunk-D6ZT4BYV.mjs → chunk-25USV2L5.mjs} +0 -5
- package/dist/{chunk-DQJN3MWP.js → chunk-6FP4S4BJ.js} +4 -4
- package/dist/{chunk-6URMXVHV.mjs → chunk-7HNXF4RI.mjs} +222 -3278
- package/dist/{chunk-T33EPP2B.mjs → chunk-A6EFYWHQ.mjs} +2 -2
- package/dist/{chunk-SJH4ZSSX.mjs → chunk-NKDK3BW7.mjs} +26 -28
- package/dist/{chunk-OVW2G2MH.js → chunk-OYCSUJS7.js} +1 -6
- package/dist/{chunk-W64GQHIH.js → chunk-RQ7QDWD6.js} +80 -82
- package/dist/{chunk-IIMPX7JQ.js → chunk-VNV7XQUU.js} +505 -3561
- package/dist/cli.js +37 -35
- package/dist/cli.mjs +26 -24
- package/dist/{export-7O4RPYTW.mjs → export-RFA6N32W.mjs} +2 -2
- package/dist/{export-HDUCFTTI.js → export-W52T2VBO.js} +5 -5
- package/dist/index.d.ts +9 -68
- package/dist/index.js +7 -7
- package/dist/index.mjs +6 -6
- package/package.json +11 -11
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
resolveImportPath,
|
|
12
12
|
stringifyMarkdownTokens,
|
|
13
13
|
toAtFS
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-25USV2L5.mjs";
|
|
15
15
|
|
|
16
16
|
// ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
|
|
17
17
|
var require_fast_deep_equal = __commonJS({
|
|
@@ -240,10 +240,10 @@ import { uniq as uniq3 } from "@antfu/utils";
|
|
|
240
240
|
|
|
241
241
|
// ../client/package.json
|
|
242
242
|
var dependencies = {
|
|
243
|
-
"@antfu/utils": "^0.5.
|
|
243
|
+
"@antfu/utils": "^0.5.2",
|
|
244
244
|
"@slidev/parser": "workspace:*",
|
|
245
245
|
"@slidev/types": "workspace:*",
|
|
246
|
-
"@vueuse/core": "^8.4.
|
|
246
|
+
"@vueuse/core": "^8.4.2",
|
|
247
247
|
"@vueuse/head": "^0.7.6",
|
|
248
248
|
"@vueuse/motion": "^2.0.0-beta.18",
|
|
249
249
|
codemirror: "^5.65.3",
|
|
@@ -253,7 +253,7 @@ var dependencies = {
|
|
|
253
253
|
"js-base64": "^3.7.2",
|
|
254
254
|
"js-yaml": "^4.1.0",
|
|
255
255
|
katex: "^0.15.3",
|
|
256
|
-
mermaid: "^9.
|
|
256
|
+
mermaid: "^9.1.1",
|
|
257
257
|
"monaco-editor": "^0.33.0",
|
|
258
258
|
nanoid: "^3.3.4",
|
|
259
259
|
prettier: "^2.6.2",
|
|
@@ -263,7 +263,7 @@ var dependencies = {
|
|
|
263
263
|
vue: "^3.2.33",
|
|
264
264
|
"vue-router": "^4.0.15",
|
|
265
265
|
"vue-starport": "^0.2.10",
|
|
266
|
-
windicss: "^3.5.
|
|
266
|
+
windicss: "^3.5.3"
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
// node/vite/searchRoot.ts
|
|
@@ -431,7 +431,7 @@ function prepareSlideInfo(data) {
|
|
|
431
431
|
notesHTML: md.render((data == null ? void 0 : data.note) || "")
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
-
function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roots }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
|
|
434
|
+
function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roots, remote }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
|
|
435
435
|
const slidePrefix = "/@slidev/slides/";
|
|
436
436
|
const hmrPages = /* @__PURE__ */ new Set();
|
|
437
437
|
let server;
|
|
@@ -676,38 +676,36 @@ ${code.slice(injectB)}`;
|
|
|
676
676
|
${imports.join("\n")}
|
|
677
677
|
`);
|
|
678
678
|
} else if (matchScript && !matchScript[2]) {
|
|
679
|
-
const matchExport = code.match(/export\s+default\s+
|
|
679
|
+
const matchExport = code.match(/export\s+default\s+{/);
|
|
680
680
|
if (matchExport) {
|
|
681
681
|
const exportIndex = (matchExport.index || 0) + matchExport[0].length;
|
|
682
682
|
let component = code.slice(exportIndex);
|
|
683
683
|
component = component.slice(0, component.indexOf("<\/script>"));
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
return `${code.slice(0, injectIndex - 1)}{
|
|
684
|
+
const scriptIndex = (matchScript.index || 0) + matchScript[0].length;
|
|
685
|
+
const provideImport = '\nimport { injectionSlidevContext } from "@slidev/client/constants"\n';
|
|
686
|
+
code = `${code.slice(0, scriptIndex)}${provideImport}${code.slice(scriptIndex)}`;
|
|
687
|
+
let injectIndex = exportIndex + provideImport.length;
|
|
688
|
+
let injectObject = "$slidev: { from: injectionSlidevContext },";
|
|
689
|
+
const matchInject = component.match(/.*inject\s*:\s*([\[{])/);
|
|
690
|
+
if (matchInject) {
|
|
691
|
+
injectIndex += (matchInject.index || 0) + matchInject[0].length;
|
|
692
|
+
if (matchInject[1] === "[") {
|
|
693
|
+
let injects = component.slice((matchInject.index || 0) + matchInject[0].length);
|
|
694
|
+
const injectEndIndex = injects.indexOf("]");
|
|
695
|
+
injects = injects.slice(0, injectEndIndex);
|
|
696
|
+
injectObject += injects.split(",").map((inject) => `${inject}: {from: ${inject}}`).join(",");
|
|
697
|
+
return `${code.slice(0, injectIndex - 1)}{
|
|
699
698
|
${injectObject}
|
|
700
699
|
}${code.slice(injectIndex + injectEndIndex + 1)}`;
|
|
701
|
-
|
|
702
|
-
|
|
700
|
+
} else {
|
|
701
|
+
return `${code.slice(0, injectIndex)}
|
|
703
702
|
${injectObject}
|
|
704
703
|
${code.slice(injectIndex)}`;
|
|
705
|
-
}
|
|
706
704
|
}
|
|
707
|
-
|
|
705
|
+
}
|
|
706
|
+
return `${code.slice(0, injectIndex)}
|
|
708
707
|
inject: { ${injectObject} },
|
|
709
708
|
${code.slice(injectIndex)}`;
|
|
710
|
-
}
|
|
711
709
|
}
|
|
712
710
|
}
|
|
713
711
|
return `<script setup>
|
|
@@ -829,7 +827,7 @@ ${routes.join(",\n")}
|
|
|
829
827
|
return [...imports, routesStr].join("\n");
|
|
830
828
|
}
|
|
831
829
|
function generateConfigs() {
|
|
832
|
-
const config = __spreadValues({}, data.config);
|
|
830
|
+
const config = __spreadProps(__spreadValues({}, data.config), { remote });
|
|
833
831
|
if (isString(config.title)) {
|
|
834
832
|
const tokens = md.parseInline(config.title, {});
|
|
835
833
|
config.title = stringifyMarkdownTokens(tokens);
|
|
@@ -46,10 +46,6 @@ var __esm = (fn, res) => function __init() {
|
|
|
46
46
|
var __commonJS = (cb, mod) => function __require2() {
|
|
47
47
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
48
48
|
};
|
|
49
|
-
var __export = (target, all) => {
|
|
50
|
-
for (var name in all)
|
|
51
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
52
|
-
};
|
|
53
49
|
var __copyProps = (to, from, except, desc) => {
|
|
54
50
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
55
51
|
for (let key of __getOwnPropNames(from))
|
|
@@ -169,5 +165,4 @@ function generateGoogleFontsUrl(options) {
|
|
|
169
165
|
|
|
170
166
|
|
|
171
167
|
|
|
172
|
-
|
|
173
|
-
exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.__require = __require; exports.__objRest = __objRest; exports.__commonJS = __commonJS; exports.__export = __export; exports.__toESM = __toESM; exports.__privateGet = __privateGet; exports.__privateAdd = __privateAdd; exports.__privateSet = __privateSet; exports.__privateWrapper = __privateWrapper; exports.init_cjs_shims = init_cjs_shims; exports.toAtFS = toAtFS; exports.resolveImportPath = resolveImportPath; exports.resolveGlobalImportPath = resolveGlobalImportPath; exports.stringifyMarkdownTokens = stringifyMarkdownTokens; exports.generateGoogleFontsUrl = generateGoogleFontsUrl;
|
|
168
|
+
exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.__require = __require; exports.__objRest = __objRest; exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.__privateGet = __privateGet; exports.__privateAdd = __privateAdd; exports.__privateSet = __privateSet; exports.__privateWrapper = __privateWrapper; exports.init_cjs_shims = init_cjs_shims; exports.toAtFS = toAtFS; exports.resolveImportPath = resolveImportPath; exports.resolveGlobalImportPath = resolveGlobalImportPath; exports.stringifyMarkdownTokens = stringifyMarkdownTokens; exports.generateGoogleFontsUrl = generateGoogleFontsUrl;
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkOYCSUJS7js = require('./chunk-OYCSUJS7.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 = _chunkOYCSUJS7js.__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
|
+
_chunkOYCSUJS7js.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 = _chunkOVW2G2MHjs.__commonJS.call(void 0, {
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
// node/common.ts
|
|
62
|
-
|
|
62
|
+
_chunkOYCSUJS7js.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="${_chunkOYCSUJS7js.generateGoogleFontsUrl.call(void 0, data.config.fonts)}" type="text/css">`;
|
|
91
|
+
main = main.replace("__ENTRY__", _chunkOYCSUJS7js.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
|
+
_chunkOYCSUJS7js.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
|
+
_chunkOYCSUJS7js.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 = _chunkOYCSUJS7js.__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, _chunkOYCSUJS7js.__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, _chunkOYCSUJS7js.resolveImportPath.call(void 0, "monaco-editor/package.json", true)));
|
|
171
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkOYCSUJS7js.resolveImportPath.call(void 0, "katex/package.json", true)));
|
|
172
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkOYCSUJS7js.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
|
+
_chunkOYCSUJS7js.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
|
+
_chunkOYCSUJS7js.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
|
+
_chunkOYCSUJS7js.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,10 +239,10 @@ 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.2",
|
|
243
243
|
"@slidev/parser": "workspace:*",
|
|
244
244
|
"@slidev/types": "workspace:*",
|
|
245
|
-
"@vueuse/core": "^8.4.
|
|
245
|
+
"@vueuse/core": "^8.4.2",
|
|
246
246
|
"@vueuse/head": "^0.7.6",
|
|
247
247
|
"@vueuse/motion": "^2.0.0-beta.18",
|
|
248
248
|
codemirror: "^5.65.3",
|
|
@@ -252,7 +252,7 @@ var dependencies = {
|
|
|
252
252
|
"js-base64": "^3.7.2",
|
|
253
253
|
"js-yaml": "^4.1.0",
|
|
254
254
|
katex: "^0.15.3",
|
|
255
|
-
mermaid: "^9.
|
|
255
|
+
mermaid: "^9.1.1",
|
|
256
256
|
"monaco-editor": "^0.33.0",
|
|
257
257
|
nanoid: "^3.3.4",
|
|
258
258
|
prettier: "^2.6.2",
|
|
@@ -262,11 +262,11 @@ var dependencies = {
|
|
|
262
262
|
vue: "^3.2.33",
|
|
263
263
|
"vue-router": "^4.0.15",
|
|
264
264
|
"vue-starport": "^0.2.10",
|
|
265
|
-
windicss: "^3.5.
|
|
265
|
+
windicss: "^3.5.3"
|
|
266
266
|
};
|
|
267
267
|
|
|
268
268
|
// node/vite/searchRoot.ts
|
|
269
|
-
|
|
269
|
+
_chunkOYCSUJS7js.init_cjs_shims.call(void 0, );
|
|
270
270
|
|
|
271
271
|
|
|
272
272
|
var ROOT_FILES = [
|
|
@@ -326,7 +326,7 @@ function createConfigPlugin(options) {
|
|
|
326
326
|
define: getDefine(options),
|
|
327
327
|
resolve: {
|
|
328
328
|
alias: {
|
|
329
|
-
"@slidev/client/": `${
|
|
329
|
+
"@slidev/client/": `${_chunkOYCSUJS7js.toAtFS.call(void 0, options.clientRoot)}/`
|
|
330
330
|
}
|
|
331
331
|
},
|
|
332
332
|
optimizeDeps: {
|
|
@@ -353,7 +353,7 @@ function createConfigPlugin(options) {
|
|
|
353
353
|
allow: _utils.uniq.call(void 0, [
|
|
354
354
|
searchForWorkspaceRoot(options.userRoot),
|
|
355
355
|
searchForWorkspaceRoot(options.cliRoot),
|
|
356
|
-
..._isinstalledglobally2.default ? [_path.dirname.call(void 0,
|
|
356
|
+
..._isinstalledglobally2.default ? [_path.dirname.call(void 0, _chunkOYCSUJS7js.resolveGlobalImportPath.call(void 0, "@slidev/client/package.json")), _path.dirname.call(void 0, _chunkOYCSUJS7js.resolveGlobalImportPath.call(void 0, "katex/package.json"))] : []
|
|
357
357
|
])
|
|
358
358
|
}
|
|
359
359
|
}
|
|
@@ -362,7 +362,7 @@ function createConfigPlugin(options) {
|
|
|
362
362
|
injection.cacheDir = _path.join.call(void 0, options.cliRoot, "node_modules/.vite");
|
|
363
363
|
injection.publicDir = _path.join.call(void 0, options.userRoot, "public");
|
|
364
364
|
injection.root = options.cliRoot;
|
|
365
|
-
injection.resolve.alias.vue = `${
|
|
365
|
+
injection.resolve.alias.vue = `${_chunkOYCSUJS7js.resolveImportPath.call(void 0, "vue/dist/vue.esm-browser.js", true)}`;
|
|
366
366
|
}
|
|
367
367
|
return _vite5.mergeConfig.call(void 0, config, injection);
|
|
368
368
|
},
|
|
@@ -383,7 +383,7 @@ function createConfigPlugin(options) {
|
|
|
383
383
|
}
|
|
384
384
|
function getDefine(options) {
|
|
385
385
|
return {
|
|
386
|
-
__SLIDEV_CLIENT_ROOT__: JSON.stringify(
|
|
386
|
+
__SLIDEV_CLIENT_ROOT__: JSON.stringify(_chunkOYCSUJS7js.toAtFS.call(void 0, options.clientRoot)),
|
|
387
387
|
__SLIDEV_HASH_ROUTE__: JSON.stringify(options.data.config.routerMode === "hash"),
|
|
388
388
|
__SLIDEV_FEATURE_DRAWINGS__: JSON.stringify(options.data.config.drawings.enabled === true || options.data.config.drawings.enabled === options.mode),
|
|
389
389
|
__SLIDEV_FEATURE_DRAWINGS_PERSIST__: JSON.stringify(!!options.data.config.drawings.persist === true),
|
|
@@ -393,8 +393,8 @@ function getDefine(options) {
|
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
// node/plugins/loaders.ts
|
|
396
|
-
|
|
397
|
-
var import_fast_deep_equal =
|
|
396
|
+
_chunkOYCSUJS7js.init_cjs_shims.call(void 0, );
|
|
397
|
+
var import_fast_deep_equal = _chunkOYCSUJS7js.__toESM.call(void 0, require_fast_deep_equal());
|
|
398
398
|
|
|
399
399
|
|
|
400
400
|
|
|
@@ -426,11 +426,11 @@ md.use(_markdownitlinkattributes2.default, {
|
|
|
426
426
|
}
|
|
427
427
|
});
|
|
428
428
|
function prepareSlideInfo(data) {
|
|
429
|
-
return
|
|
429
|
+
return _chunkOYCSUJS7js.__spreadProps.call(void 0, _chunkOYCSUJS7js.__spreadValues.call(void 0, {}, data), {
|
|
430
430
|
notesHTML: md.render((data == null ? void 0 : data.note) || "")
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
|
-
function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roots }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
|
|
433
|
+
function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roots, remote }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
|
|
434
434
|
const slidePrefix = "/@slidev/slides/";
|
|
435
435
|
const hmrPages = /* @__PURE__ */ new Set();
|
|
436
436
|
let server;
|
|
@@ -517,7 +517,7 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
|
|
|
517
517
|
const file = `${slidePrefix}${i + 1}.md`;
|
|
518
518
|
try {
|
|
519
519
|
const md2 = await transformMarkdown(await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file), i, newData);
|
|
520
|
-
return await VuePlugin.handleHotUpdate(
|
|
520
|
+
return await VuePlugin.handleHotUpdate(_chunkOYCSUJS7js.__spreadProps.call(void 0, _chunkOYCSUJS7js.__spreadValues.call(void 0, {}, ctx), {
|
|
521
521
|
modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
|
|
522
522
|
file,
|
|
523
523
|
read() {
|
|
@@ -634,14 +634,14 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
|
|
|
634
634
|
async function transformMarkdown(code, pageNo, data2) {
|
|
635
635
|
var _a, _b;
|
|
636
636
|
const layouts = await getLayouts();
|
|
637
|
-
const frontmatter =
|
|
637
|
+
const frontmatter = _chunkOYCSUJS7js.__spreadValues.call(void 0, _chunkOYCSUJS7js.__spreadValues.call(void 0, {}, ((_a = data2.headmatter) == null ? void 0 : _a.defaults) || {}), ((_b = data2.slides[pageNo]) == null ? void 0 : _b.frontmatter) || {});
|
|
638
638
|
const layoutName = (frontmatter == null ? void 0 : frontmatter.layout) || (pageNo === 0 ? "cover" : "default");
|
|
639
639
|
if (!layouts[layoutName])
|
|
640
640
|
throw new Error(`Unknown layout "${layoutName}"`);
|
|
641
641
|
delete frontmatter.title;
|
|
642
642
|
const imports = [
|
|
643
643
|
'import { inject as vueInject } from "vue"',
|
|
644
|
-
`import InjectedLayout from "${
|
|
644
|
+
`import InjectedLayout from "${_chunkOYCSUJS7js.toAtFS.call(void 0, layouts[layoutName])}"`,
|
|
645
645
|
'import { injectionSlidevContext } from "@slidev/client/constants"',
|
|
646
646
|
`const frontmatter = ${JSON.stringify(frontmatter)}`,
|
|
647
647
|
"const $slidev = vueInject(injectionSlidevContext)"
|
|
@@ -675,38 +675,36 @@ ${code.slice(injectB)}`;
|
|
|
675
675
|
${imports.join("\n")}
|
|
676
676
|
`);
|
|
677
677
|
} else if (matchScript && !matchScript[2]) {
|
|
678
|
-
const matchExport = code.match(/export\s+default\s+
|
|
678
|
+
const matchExport = code.match(/export\s+default\s+{/);
|
|
679
679
|
if (matchExport) {
|
|
680
680
|
const exportIndex = (matchExport.index || 0) + matchExport[0].length;
|
|
681
681
|
let component = code.slice(exportIndex);
|
|
682
682
|
component = component.slice(0, component.indexOf("<\/script>"));
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
return `${code.slice(0, injectIndex - 1)}{
|
|
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)}{
|
|
698
697
|
${injectObject}
|
|
699
698
|
}${code.slice(injectIndex + injectEndIndex + 1)}`;
|
|
700
|
-
|
|
701
|
-
|
|
699
|
+
} else {
|
|
700
|
+
return `${code.slice(0, injectIndex)}
|
|
702
701
|
${injectObject}
|
|
703
702
|
${code.slice(injectIndex)}`;
|
|
704
|
-
}
|
|
705
703
|
}
|
|
706
|
-
|
|
704
|
+
}
|
|
705
|
+
return `${code.slice(0, injectIndex)}
|
|
707
706
|
inject: { ${injectObject} },
|
|
708
707
|
${code.slice(injectIndex)}`;
|
|
709
|
-
}
|
|
710
708
|
}
|
|
711
709
|
}
|
|
712
710
|
return `<script setup>
|
|
@@ -746,9 +744,9 @@ defineProps<{ no: number | string }>()`);
|
|
|
746
744
|
}
|
|
747
745
|
async function generateUserStyles() {
|
|
748
746
|
const imports = [
|
|
749
|
-
`import "${
|
|
750
|
-
`import "${
|
|
751
|
-
`import "${
|
|
747
|
+
`import "${_chunkOYCSUJS7js.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/vars.css"))}"`,
|
|
748
|
+
`import "${_chunkOYCSUJS7js.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/index.css"))}"`,
|
|
749
|
+
`import "${_chunkOYCSUJS7js.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/code.css"))}"`
|
|
752
750
|
];
|
|
753
751
|
const roots2 = _utils.uniq.call(void 0, [
|
|
754
752
|
...themeRoots,
|
|
@@ -764,13 +762,13 @@ defineProps<{ no: number | string }>()`);
|
|
|
764
762
|
];
|
|
765
763
|
for (const style of styles) {
|
|
766
764
|
if (_fsextra.existsSync.call(void 0, style)) {
|
|
767
|
-
imports.push(`import "${
|
|
765
|
+
imports.push(`import "${_chunkOYCSUJS7js.toAtFS.call(void 0, style)}"`);
|
|
768
766
|
continue;
|
|
769
767
|
}
|
|
770
768
|
}
|
|
771
769
|
}
|
|
772
770
|
if (data.features.katex)
|
|
773
|
-
imports.push(`import "${
|
|
771
|
+
imports.push(`import "${_chunkOYCSUJS7js.toAtFS.call(void 0, _chunkOYCSUJS7js.resolveImportPath.call(void 0, "katex/dist/katex.min.css", true))}"`);
|
|
774
772
|
return imports.join("\n");
|
|
775
773
|
}
|
|
776
774
|
async function generateMonacoTypes() {
|
|
@@ -779,7 +777,7 @@ defineProps<{ no: number | string }>()`);
|
|
|
779
777
|
async function generateLayouts() {
|
|
780
778
|
const imports = [];
|
|
781
779
|
const layouts = _utils.objectMap.call(void 0, await getLayouts(), (k, v) => {
|
|
782
|
-
imports.push(`import __layout_${k} from "${
|
|
780
|
+
imports.push(`import __layout_${k} from "${_chunkOYCSUJS7js.toAtFS.call(void 0, v)}"`);
|
|
783
781
|
return [k, `__layout_${k}`];
|
|
784
782
|
});
|
|
785
783
|
return [
|
|
@@ -828,10 +826,10 @@ ${routes.join(",\n")}
|
|
|
828
826
|
return [...imports, routesStr].join("\n");
|
|
829
827
|
}
|
|
830
828
|
function generateConfigs() {
|
|
831
|
-
const config =
|
|
829
|
+
const config = _chunkOYCSUJS7js.__spreadProps.call(void 0, _chunkOYCSUJS7js.__spreadValues.call(void 0, {}, data.config), { remote });
|
|
832
830
|
if (_utils.isString.call(void 0, config.title)) {
|
|
833
831
|
const tokens = md.parseInline(config.title, {});
|
|
834
|
-
config.title =
|
|
832
|
+
config.title = _chunkOYCSUJS7js.stringifyMarkdownTokens.call(void 0, tokens);
|
|
835
833
|
}
|
|
836
834
|
if (_utils.isString.call(void 0, config.info))
|
|
837
835
|
config.info = md.render(config.info);
|
|
@@ -852,7 +850,7 @@ ${routes.join(",\n")}
|
|
|
852
850
|
];
|
|
853
851
|
}
|
|
854
852
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
855
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${
|
|
853
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunkOYCSUJS7js.toAtFS.call(void 0, i)}'`).join("\n");
|
|
856
854
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
857
855
|
return `
|
|
858
856
|
${imports}
|
|
@@ -871,7 +869,7 @@ export default {
|
|
|
871
869
|
_path.join.call(void 0, root, "CustomNavControls.vue")
|
|
872
870
|
];
|
|
873
871
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
874
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${
|
|
872
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunkOYCSUJS7js.toAtFS.call(void 0, i)}'`).join("\n");
|
|
875
873
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
876
874
|
return `
|
|
877
875
|
${imports}
|
|
@@ -886,7 +884,7 @@ export default {
|
|
|
886
884
|
}
|
|
887
885
|
|
|
888
886
|
// node/plugins/monacoTransform.ts
|
|
889
|
-
|
|
887
|
+
_chunkOYCSUJS7js.init_cjs_shims.call(void 0, );
|
|
890
888
|
|
|
891
889
|
|
|
892
890
|
|
|
@@ -920,7 +918,7 @@ function createMonacoTypesLoader() {
|
|
|
920
918
|
}
|
|
921
919
|
|
|
922
920
|
// node/plugins/setupClient.ts
|
|
923
|
-
|
|
921
|
+
_chunkOYCSUJS7js.init_cjs_shims.call(void 0, );
|
|
924
922
|
|
|
925
923
|
|
|
926
924
|
|
|
@@ -942,7 +940,7 @@ function createClientSetupPlugin({ clientRoot, themeRoots, userRoot }) {
|
|
|
942
940
|
setups.forEach((path, idx) => {
|
|
943
941
|
if (!_fs.existsSync.call(void 0, path))
|
|
944
942
|
return;
|
|
945
|
-
imports.push(`import __n${idx} from '${
|
|
943
|
+
imports.push(`import __n${idx} from '${_chunkOYCSUJS7js.toAtFS.call(void 0, path)}'`);
|
|
946
944
|
let fn = `__n${idx}`;
|
|
947
945
|
let awaitFn = `await __n${idx}`;
|
|
948
946
|
if (/\binjection_return\b/g.test(code)) {
|
|
@@ -970,7 +968,7 @@ function createClientSetupPlugin({ clientRoot, themeRoots, userRoot }) {
|
|
|
970
968
|
}
|
|
971
969
|
|
|
972
970
|
// node/plugins/markdown.ts
|
|
973
|
-
|
|
971
|
+
_chunkOYCSUJS7js.init_cjs_shims.call(void 0, );
|
|
974
972
|
var _vitepluginmd = require('vite-plugin-md'); var _vitepluginmd2 = _interopRequireDefault(_vitepluginmd);
|
|
975
973
|
var _jsbase64 = require('js-base64'); var base64 = _interopRequireWildcard(_jsbase64);
|
|
976
974
|
|
|
@@ -980,7 +978,7 @@ var _shiki = require('shiki'); var Shiki = _interopRequireWildcard(_shiki);
|
|
|
980
978
|
var _plantumlencoder = require('plantuml-encoder');
|
|
981
979
|
|
|
982
980
|
// node/plugins/markdown-it-katex.ts
|
|
983
|
-
|
|
981
|
+
_chunkOYCSUJS7js.init_cjs_shims.call(void 0, );
|
|
984
982
|
var _katex = require('katex'); var _katex2 = _interopRequireDefault(_katex);
|
|
985
983
|
function isValidDelim(state, pos) {
|
|
986
984
|
const max = state.posMax;
|
|
@@ -1127,7 +1125,7 @@ function math_plugin(md2, options) {
|
|
|
1127
1125
|
}
|
|
1128
1126
|
|
|
1129
1127
|
// node/plugins/markdown-it-prism.ts
|
|
1130
|
-
|
|
1128
|
+
_chunkOYCSUJS7js.init_cjs_shims.call(void 0, );
|
|
1131
1129
|
var _prismjs = require('prismjs'); var _prismjs2 = _interopRequireDefault(_prismjs);
|
|
1132
1130
|
var _ = require('prismjs/components/'); var _2 = _interopRequireDefault(_);
|
|
1133
1131
|
var DEFAULTS = {
|
|
@@ -1150,7 +1148,7 @@ function loadPrismLang(lang) {
|
|
|
1150
1148
|
}
|
|
1151
1149
|
function loadPrismPlugin(name) {
|
|
1152
1150
|
try {
|
|
1153
|
-
|
|
1151
|
+
_chunkOYCSUJS7js.__require.call(void 0, `prismjs/plugins/${name}/prism-${name}`);
|
|
1154
1152
|
} catch (e) {
|
|
1155
1153
|
throw new Error(`Cannot load Prism plugin "${name}". Please check the spelling.`);
|
|
1156
1154
|
}
|
|
@@ -1190,7 +1188,7 @@ function markdownItPrism(markdownit, useroptions) {
|
|
|
1190
1188
|
}
|
|
1191
1189
|
|
|
1192
1190
|
// node/plugins/markdown-it-shiki.ts
|
|
1193
|
-
|
|
1191
|
+
_chunkOYCSUJS7js.init_cjs_shims.call(void 0, );
|
|
1194
1192
|
function getThemeName(theme) {
|
|
1195
1193
|
if (typeof theme === "string")
|
|
1196
1194
|
return theme;
|
|
@@ -1212,7 +1210,7 @@ function resolveShikiOptions(options) {
|
|
|
1212
1210
|
themes.push(options.theme);
|
|
1213
1211
|
}
|
|
1214
1212
|
}
|
|
1215
|
-
return
|
|
1213
|
+
return _chunkOYCSUJS7js.__spreadProps.call(void 0, _chunkOYCSUJS7js.__spreadValues.call(void 0, {}, options), {
|
|
1216
1214
|
themes,
|
|
1217
1215
|
darkModeThemes: darkModeThemes ? {
|
|
1218
1216
|
dark: getThemeName(darkModeThemes.dark),
|
|
@@ -1250,7 +1248,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1250
1248
|
const setups = [];
|
|
1251
1249
|
const entryPath = _utils.slash.call(void 0, entry);
|
|
1252
1250
|
if (config.highlighter === "shiki") {
|
|
1253
|
-
const { getHighlighter } = await Promise.resolve().then(() =>
|
|
1251
|
+
const { getHighlighter } = await Promise.resolve().then(() => _chunkOYCSUJS7js.__toESM.call(void 0, _chunkOYCSUJS7js.__require.call(void 0, "shiki")));
|
|
1254
1252
|
const shikiOptions = await loadSetups(roots, "shiki.ts", Shiki, DEFAULT_SHIKI_OPTIONS, false);
|
|
1255
1253
|
const { langs, themes } = resolveShikiOptions(shikiOptions);
|
|
1256
1254
|
shikiOptions.highlighter = await getHighlighter({ themes, langs });
|
|
@@ -1259,11 +1257,11 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1259
1257
|
setups.push((md2) => md2.use(markdownItPrism));
|
|
1260
1258
|
}
|
|
1261
1259
|
const KatexOptions = await loadSetups(roots, "katex.ts", {}, { strict: false }, false);
|
|
1262
|
-
return _vitepluginmd2.default.call(void 0,
|
|
1260
|
+
return _vitepluginmd2.default.call(void 0, _chunkOYCSUJS7js.__spreadProps.call(void 0, _chunkOYCSUJS7js.__spreadValues.call(void 0, {
|
|
1263
1261
|
wrapperClasses: "",
|
|
1264
1262
|
headEnabled: false,
|
|
1265
1263
|
frontmatter: false,
|
|
1266
|
-
markdownItOptions:
|
|
1264
|
+
markdownItOptions: _chunkOYCSUJS7js.__spreadValues.call(void 0, {
|
|
1267
1265
|
quotes: `""''`,
|
|
1268
1266
|
html: true,
|
|
1269
1267
|
xhtmlOut: true,
|
|
@@ -1399,7 +1397,7 @@ function escapeVueInCode(md2) {
|
|
|
1399
1397
|
}
|
|
1400
1398
|
|
|
1401
1399
|
// node/plugins/patchTransform.ts
|
|
1402
|
-
|
|
1400
|
+
_chunkOYCSUJS7js.init_cjs_shims.call(void 0, );
|
|
1403
1401
|
|
|
1404
1402
|
function createFixPlugins(options) {
|
|
1405
1403
|
const define = _utils.objectEntries.call(void 0, getDefine(options));
|
|
@@ -1463,10 +1461,10 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1463
1461
|
clientRoot,
|
|
1464
1462
|
data: { config }
|
|
1465
1463
|
} = options;
|
|
1466
|
-
const VuePlugin = _pluginvue2.default.call(void 0,
|
|
1464
|
+
const VuePlugin = _pluginvue2.default.call(void 0, _chunkOYCSUJS7js.__spreadValues.call(void 0, {
|
|
1467
1465
|
include: [/\.vue$/, /\.md$/],
|
|
1468
1466
|
exclude: [],
|
|
1469
|
-
template:
|
|
1467
|
+
template: _chunkOYCSUJS7js.__spreadValues.call(void 0, {
|
|
1470
1468
|
compilerOptions: {
|
|
1471
1469
|
isCustomElement(tag) {
|
|
1472
1470
|
return customElements.has(tag);
|
|
@@ -1481,7 +1479,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1481
1479
|
MarkdownPlugin,
|
|
1482
1480
|
VuePlugin,
|
|
1483
1481
|
createSlidesLoader(options, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin),
|
|
1484
|
-
_vite4.default.call(void 0,
|
|
1482
|
+
_vite4.default.call(void 0, _chunkOYCSUJS7js.__spreadValues.call(void 0, {
|
|
1485
1483
|
extensions: ["vue", "md", "ts"],
|
|
1486
1484
|
dirs: [
|
|
1487
1485
|
`${clientRoot}/builtin`,
|
|
@@ -1499,11 +1497,11 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1499
1497
|
})
|
|
1500
1498
|
]
|
|
1501
1499
|
}, componentsOptions)),
|
|
1502
|
-
_vite2.default.call(void 0,
|
|
1500
|
+
_vite2.default.call(void 0, _chunkOYCSUJS7js.__spreadValues.call(void 0, {
|
|
1503
1501
|
defaultClass: "slidev-icon",
|
|
1504
1502
|
autoInstall: true
|
|
1505
1503
|
}, iconsOptions)),
|
|
1506
|
-
config.remoteAssets === true || config.remoteAssets === mode ? _vitepluginremoteassets2.default.call(void 0,
|
|
1504
|
+
config.remoteAssets === true || config.remoteAssets === mode ? _vitepluginremoteassets2.default.call(void 0, _chunkOYCSUJS7js.__spreadValues.call(void 0, {
|
|
1507
1505
|
rules: [
|
|
1508
1506
|
..._vitepluginremoteassets.DefaultRules,
|
|
1509
1507
|
{
|
|
@@ -1516,7 +1514,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1516
1514
|
}, remoteAssetsOptions)) : null,
|
|
1517
1515
|
_vitepluginvueserverref2.default.call(void 0, {
|
|
1518
1516
|
debug: process.env.NODE_ENV === "development",
|
|
1519
|
-
state:
|
|
1517
|
+
state: _chunkOYCSUJS7js.__spreadValues.call(void 0, {
|
|
1520
1518
|
sync: false,
|
|
1521
1519
|
nav: {
|
|
1522
1520
|
page: 0,
|