@slidev/cli 0.35.6 → 0.36.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-JJPJN7L3.mjs → build-363D63QG.mjs} +4 -4
- package/dist/{build-3OBKYP4E.js → build-SW7IIFF4.js} +13 -13
- package/dist/{chunk-AW7KQET4.js → chunk-74QPSS6T.js} +2 -2
- package/dist/{chunk-YUXTNPKA.js → chunk-DAM7DDLQ.js} +83 -82
- package/dist/{chunk-4UR3M5JD.js → chunk-F44MX6U6.js} +139 -138
- package/dist/{chunk-IY7QSYZ2.mjs → chunk-GVIE4JZ6.mjs} +39 -38
- package/dist/{chunk-57E5R3IA.mjs → chunk-IAMILGBS.mjs} +2 -2
- package/dist/{chunk-3VPTNK23.mjs → chunk-PUJ4PVRP.mjs} +8 -7
- package/dist/cli.js +36 -26
- package/dist/cli.mjs +19 -9
- package/dist/{export-I2KYMDHO.mjs → export-26FXNM7P.mjs} +1 -1
- package/dist/{export-3CTBMUMP.js → export-WKFHZNBT.js} +4 -4
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -6
- package/dist/index.mjs +3 -3
- package/package.json +16 -15
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
getIndexHtml,
|
|
4
4
|
mergeViteConfigs
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GVIE4JZ6.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__require,
|
|
8
8
|
__toESM,
|
|
9
9
|
init_esm_shims
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-IAMILGBS.mjs";
|
|
11
11
|
|
|
12
12
|
// node/build.ts
|
|
13
13
|
init_esm_shims();
|
|
@@ -650,7 +650,7 @@ function build_default(dir, opts = {}) {
|
|
|
650
650
|
import { blue, yellow } from "kolorist";
|
|
651
651
|
async function build(options, viteConfig = {}) {
|
|
652
652
|
const indexPath = resolve3(options.userRoot, "index.html");
|
|
653
|
-
const rawConfig = await resolveConfig({}, "build");
|
|
653
|
+
const rawConfig = await resolveConfig({}, "build", options.entry);
|
|
654
654
|
const pluginOptions = rawConfig.slidev || {};
|
|
655
655
|
let originalIndexHTML;
|
|
656
656
|
if (fs2.existsSync(indexPath))
|
|
@@ -725,7 +725,7 @@ async function build(options, viteConfig = {}) {
|
|
|
725
725
|
await fs2.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
726
726
|
`, "utf-8");
|
|
727
727
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
728
|
-
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-
|
|
728
|
+
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-26FXNM7P.mjs")));
|
|
729
729
|
const port = 12445;
|
|
730
730
|
const app = connect();
|
|
731
731
|
const server = http.createServer(app);
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkDAM7DDLQjs = require('./chunk-DAM7DDLQ.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk74QPSS6Tjs = require('./chunk-74QPSS6T.js');
|
|
11
11
|
|
|
12
12
|
// node/build.ts
|
|
13
|
-
|
|
13
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
14
14
|
var _path = require('path');
|
|
15
15
|
var _http = require('http'); var _http2 = _interopRequireDefault(_http);
|
|
16
16
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
@@ -18,12 +18,12 @@ var _vite = require('vite');
|
|
|
18
18
|
var _connect = require('connect'); var _connect2 = _interopRequireDefault(_connect);
|
|
19
19
|
|
|
20
20
|
// ../../node_modules/.pnpm/sirv@2.0.2/node_modules/sirv/build.mjs
|
|
21
|
-
|
|
21
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
22
22
|
var _fs = require('fs'); var fs = _interopRequireWildcard(_fs);
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
// ../../node_modules/.pnpm/totalist@3.0.0/node_modules/totalist/sync/index.mjs
|
|
26
|
-
|
|
26
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
function totalist(dir, callback, pre = "") {
|
|
@@ -38,7 +38,7 @@ function totalist(dir, callback, pre = "") {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// ../../node_modules/.pnpm/@polka+url@1.0.0-next.21/node_modules/@polka/url/build.mjs
|
|
41
|
-
|
|
41
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
42
42
|
var _querystring = require('querystring'); var qs = _interopRequireWildcard(_querystring);
|
|
43
43
|
function parse2(req) {
|
|
44
44
|
let raw = req.url;
|
|
@@ -62,7 +62,7 @@ function parse2(req) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// ../../node_modules/.pnpm/mrmime@1.0.0/node_modules/mrmime/index.mjs
|
|
65
|
-
|
|
65
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
66
66
|
var mimes = {
|
|
67
67
|
"ez": "application/andrew-inset",
|
|
68
68
|
"aw": "application/applixware",
|
|
@@ -650,21 +650,21 @@ function build_default(dir, opts = {}) {
|
|
|
650
650
|
var _kolorist = require('kolorist');
|
|
651
651
|
async function build(options, viteConfig = {}) {
|
|
652
652
|
const indexPath = _path.resolve.call(void 0, options.userRoot, "index.html");
|
|
653
|
-
const rawConfig = await _vite.resolveConfig.call(void 0, {}, "build");
|
|
653
|
+
const rawConfig = await _vite.resolveConfig.call(void 0, {}, "build", options.entry);
|
|
654
654
|
const pluginOptions = rawConfig.slidev || {};
|
|
655
655
|
let originalIndexHTML;
|
|
656
656
|
if (_fsextra2.default.existsSync(indexPath))
|
|
657
657
|
originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
|
|
658
|
-
await _fsextra2.default.writeFile(indexPath, await
|
|
658
|
+
await _fsextra2.default.writeFile(indexPath, await _chunkDAM7DDLQjs.getIndexHtml.call(void 0, options), "utf-8");
|
|
659
659
|
let config = void 0;
|
|
660
660
|
try {
|
|
661
|
-
const inlineConfig = await
|
|
661
|
+
const inlineConfig = await _chunkDAM7DDLQjs.mergeViteConfigs.call(void 0,
|
|
662
662
|
options,
|
|
663
663
|
viteConfig,
|
|
664
664
|
{
|
|
665
665
|
root: options.userRoot,
|
|
666
666
|
plugins: [
|
|
667
|
-
await
|
|
667
|
+
await _chunkDAM7DDLQjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
|
|
668
668
|
{
|
|
669
669
|
name: "resolve-config",
|
|
670
670
|
configResolved(_config) {
|
|
@@ -685,7 +685,7 @@ async function build(options, viteConfig = {}) {
|
|
|
685
685
|
} else {
|
|
686
686
|
console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
|
|
687
687
|
await _vite.build.call(void 0,
|
|
688
|
-
await
|
|
688
|
+
await _chunkDAM7DDLQjs.mergeViteConfigs.call(void 0,
|
|
689
689
|
options,
|
|
690
690
|
inlineConfig,
|
|
691
691
|
{
|
|
@@ -725,7 +725,7 @@ async function build(options, viteConfig = {}) {
|
|
|
725
725
|
await _fsextra2.default.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
726
726
|
`, "utf-8");
|
|
727
727
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
728
|
-
const { exportSlides } = await Promise.resolve().then(() =>
|
|
728
|
+
const { exportSlides } = await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "./export-WKFHZNBT.js")));
|
|
729
729
|
const port = 12445;
|
|
730
730
|
const app = _connect2.default.call(void 0, );
|
|
731
731
|
const server = _http2.default.createServer(app);
|
|
@@ -58,9 +58,9 @@ var __privateWrapper = (obj, member, setter, getter) => {
|
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
// ../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.
|
|
61
|
+
// ../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.3/node_modules/tsup/assets/cjs_shims.js
|
|
62
62
|
var init_cjs_shims = __esm({
|
|
63
|
-
"../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.
|
|
63
|
+
"../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.3/node_modules/tsup/assets/cjs_shims.js"() {
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk74QPSS6Tjs = require('./chunk-74QPSS6T.js');
|
|
12
12
|
|
|
13
13
|
// ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
|
|
14
|
-
var require_fast_deep_equal =
|
|
14
|
+
var require_fast_deep_equal = _chunk74QPSS6Tjs.__commonJS.call(void 0, {
|
|
15
15
|
"../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports, module) {
|
|
16
16
|
"use strict";
|
|
17
|
-
|
|
17
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
18
18
|
module.exports = function equal2(a, b) {
|
|
19
19
|
if (a === b)
|
|
20
20
|
return true;
|
|
@@ -57,7 +57,7 @@ var require_fast_deep_equal = _chunkAW7KQET4js.__commonJS.call(void 0, {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
// node/common.ts
|
|
60
|
-
|
|
60
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
61
61
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
62
62
|
var _path = require('path');
|
|
63
63
|
var _utils = require('@antfu/utils');
|
|
@@ -86,8 +86,8 @@ ${(((_b = index.match(/<body>([\s\S]*?)<\/body>/im)) == null ? void 0 : _b[1]) |
|
|
|
86
86
|
body += '\n<script async src="https://platform.twitter.com/widgets.js"><\/script>';
|
|
87
87
|
if (data.config.fonts.webfonts.length && data.config.fonts.provider !== "none")
|
|
88
88
|
head += `
|
|
89
|
-
<link rel="stylesheet" href="${
|
|
90
|
-
main = main.replace("__ENTRY__",
|
|
89
|
+
<link rel="stylesheet" href="${_chunk74QPSS6Tjs.generateGoogleFontsUrl.call(void 0, data.config.fonts)}" type="text/css">`;
|
|
90
|
+
main = main.replace("__ENTRY__", _chunk74QPSS6Tjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "main.ts"))).replace("<!-- head -->", head).replace("<!-- body -->", body);
|
|
91
91
|
return main;
|
|
92
92
|
}
|
|
93
93
|
async function mergeViteConfigs({ addonRoots, themeRoots }, viteConfig, config, command) {
|
|
@@ -111,14 +111,14 @@ async function mergeViteConfigs({ addonRoots, themeRoots }, viteConfig, config,
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
// node/plugins/windicss.ts
|
|
114
|
-
|
|
114
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
var _jiti = require('jiti'); var _jiti2 = _interopRequireDefault(_jiti);
|
|
119
119
|
|
|
120
120
|
// node/plugins/setupNode.ts
|
|
121
|
-
|
|
121
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
122
122
|
|
|
123
123
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
124
124
|
|
|
@@ -152,7 +152,7 @@ async function loadSetups(roots, name, arg, initial, merge = true) {
|
|
|
152
152
|
|
|
153
153
|
// node/plugins/windicss.ts
|
|
154
154
|
async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRoot, roots, data }, { windicss: windiOptions }) {
|
|
155
|
-
const { default: WindiCSS, defaultConfigureFiles } = await Promise.resolve().then(() =>
|
|
155
|
+
const { default: WindiCSS, defaultConfigureFiles } = await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "vite-plugin-windicss")));
|
|
156
156
|
const configFiles = _utils.uniq.call(void 0, [
|
|
157
157
|
...defaultConfigureFiles.map((i) => _path.resolve.call(void 0, userRoot, i)),
|
|
158
158
|
...themeRoots.map((i) => `${i}/windi.config.ts`),
|
|
@@ -191,9 +191,9 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
|
|
|
191
191
|
config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
|
|
192
192
|
});
|
|
193
193
|
config2.scanOptions.include.push(`!${_utils.slash.call(void 0, _path.resolve.call(void 0, userRoot, "node_modules"))}`);
|
|
194
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
195
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
196
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
194
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunk74QPSS6Tjs.resolveImportPath.call(void 0, "monaco-editor/package.json", true)));
|
|
195
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunk74QPSS6Tjs.resolveImportPath.call(void 0, "katex/package.json", true)));
|
|
196
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunk74QPSS6Tjs.resolveImportPath.call(void 0, "prettier/package.json", true)));
|
|
197
197
|
},
|
|
198
198
|
...windiOptions
|
|
199
199
|
}
|
|
@@ -201,7 +201,7 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
// node/plugins/preset.ts
|
|
204
|
-
|
|
204
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
205
205
|
|
|
206
206
|
var _pluginvue = require('@vitejs/plugin-vue'); var _pluginvue2 = _interopRequireDefault(_pluginvue);
|
|
207
207
|
var _vite3 = require('unplugin-icons/vite'); var _vite4 = _interopRequireDefault(_vite3);
|
|
@@ -210,14 +210,18 @@ var _vite5 = require('unplugin-vue-components/vite'); var _vite6 = _interopRequi
|
|
|
210
210
|
var _vitepluginremoteassets = require('vite-plugin-remote-assets'); var _vitepluginremoteassets2 = _interopRequireDefault(_vitepluginremoteassets);
|
|
211
211
|
var _vitepluginvueserverref = require('vite-plugin-vue-server-ref'); var _vitepluginvueserverref2 = _interopRequireDefault(_vitepluginvueserverref);
|
|
212
212
|
|
|
213
|
+
var _viteplugininspect = require('vite-plugin-inspect'); var _viteplugininspect2 = _interopRequireDefault(_viteplugininspect);
|
|
213
214
|
|
|
214
215
|
// node/drawings.ts
|
|
215
|
-
|
|
216
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
216
217
|
|
|
217
218
|
|
|
218
219
|
var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);
|
|
219
220
|
function resolveDrawingsDir(options) {
|
|
220
|
-
return options.data.config.drawings.persist ? _path.resolve.call(void 0,
|
|
221
|
+
return options.data.config.drawings.persist ? _path.resolve.call(void 0,
|
|
222
|
+
_path.dirname.call(void 0, options.entry),
|
|
223
|
+
options.data.config.drawings.persist
|
|
224
|
+
) : void 0;
|
|
221
225
|
}
|
|
222
226
|
async function loadDrawings(options) {
|
|
223
227
|
const dir = resolveDrawingsDir(options);
|
|
@@ -261,7 +265,7 @@ ${value}
|
|
|
261
265
|
}
|
|
262
266
|
|
|
263
267
|
// node/plugins/extendConfig.ts
|
|
264
|
-
|
|
268
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
265
269
|
|
|
266
270
|
|
|
267
271
|
var _isinstalledglobally = require('is-installed-globally'); var _isinstalledglobally2 = _interopRequireDefault(_isinstalledglobally);
|
|
@@ -272,11 +276,11 @@ var dependencies = {
|
|
|
272
276
|
"@antfu/utils": "^0.5.2",
|
|
273
277
|
"@slidev/parser": "workspace:*",
|
|
274
278
|
"@slidev/types": "workspace:*",
|
|
275
|
-
"@unocss/reset": "^0.45.
|
|
276
|
-
"@vueuse/core": "^9.
|
|
277
|
-
"@vueuse/head": "^0.7.
|
|
278
|
-
"@vueuse/math": "^9.
|
|
279
|
-
"@vueuse/motion": "^2.0.0-beta.
|
|
279
|
+
"@unocss/reset": "^0.45.20",
|
|
280
|
+
"@vueuse/core": "^9.2.0",
|
|
281
|
+
"@vueuse/head": "^0.7.10",
|
|
282
|
+
"@vueuse/math": "^9.2.0",
|
|
283
|
+
"@vueuse/motion": "^2.0.0-beta.22",
|
|
280
284
|
codemirror: "^5.65.5",
|
|
281
285
|
defu: "^6.1.0",
|
|
282
286
|
drauu: "^0.3.1",
|
|
@@ -290,16 +294,16 @@ var dependencies = {
|
|
|
290
294
|
prettier: "^2.7.1",
|
|
291
295
|
recordrtc: "^5.6.2",
|
|
292
296
|
resolve: "^1.22.1",
|
|
293
|
-
unocss: "^0.45.
|
|
294
|
-
"vite-plugin-windicss": "^1.8.
|
|
295
|
-
vue: "^3.2.
|
|
297
|
+
unocss: "^0.45.20",
|
|
298
|
+
"vite-plugin-windicss": "^1.8.8",
|
|
299
|
+
vue: "^3.2.39",
|
|
296
300
|
"vue-router": "^4.1.5",
|
|
297
301
|
"vue-starport": "^0.3.0",
|
|
298
302
|
windicss: "^3.5.6"
|
|
299
303
|
};
|
|
300
304
|
|
|
301
305
|
// node/vite/searchRoot.ts
|
|
302
|
-
|
|
306
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
303
307
|
|
|
304
308
|
|
|
305
309
|
var ROOT_FILES = [
|
|
@@ -364,7 +368,7 @@ function createConfigPlugin(options) {
|
|
|
364
368
|
define: getDefine(options),
|
|
365
369
|
resolve: {
|
|
366
370
|
alias: {
|
|
367
|
-
"@slidev/client/": `${
|
|
371
|
+
"@slidev/client/": `${_chunk74QPSS6Tjs.toAtFS.call(void 0, options.clientRoot)}/`
|
|
368
372
|
}
|
|
369
373
|
},
|
|
370
374
|
optimizeDeps: {
|
|
@@ -388,7 +392,7 @@ function createConfigPlugin(options) {
|
|
|
388
392
|
css: options.data.config.css === "unocss" ? {
|
|
389
393
|
postcss: {
|
|
390
394
|
plugins: [
|
|
391
|
-
await Promise.resolve().then(() =>
|
|
395
|
+
await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "postcss-nested"))).then((r) => r.default())
|
|
392
396
|
]
|
|
393
397
|
}
|
|
394
398
|
} : {},
|
|
@@ -398,7 +402,7 @@ function createConfigPlugin(options) {
|
|
|
398
402
|
allow: _utils.uniq.call(void 0, [
|
|
399
403
|
searchForWorkspaceRoot(options.userRoot),
|
|
400
404
|
searchForWorkspaceRoot(options.cliRoot),
|
|
401
|
-
..._isinstalledglobally2.default ? [_path.dirname.call(void 0,
|
|
405
|
+
..._isinstalledglobally2.default ? [_path.dirname.call(void 0, _chunk74QPSS6Tjs.resolveGlobalImportPath.call(void 0, "@slidev/client/package.json")), _path.dirname.call(void 0, _chunk74QPSS6Tjs.resolveGlobalImportPath.call(void 0, "katex/package.json"))] : []
|
|
402
406
|
])
|
|
403
407
|
}
|
|
404
408
|
}
|
|
@@ -407,7 +411,7 @@ function createConfigPlugin(options) {
|
|
|
407
411
|
injection.cacheDir = _path.join.call(void 0, options.cliRoot, "node_modules/.vite");
|
|
408
412
|
injection.publicDir = _path.join.call(void 0, options.userRoot, "public");
|
|
409
413
|
injection.root = options.cliRoot;
|
|
410
|
-
injection.resolve.alias.vue = `${
|
|
414
|
+
injection.resolve.alias.vue = `${_chunk74QPSS6Tjs.resolveImportPath.call(void 0, "vue/dist/vue.esm-browser.js", true)}`;
|
|
411
415
|
}
|
|
412
416
|
return _vite.mergeConfig.call(void 0, config, injection);
|
|
413
417
|
},
|
|
@@ -428,7 +432,7 @@ function createConfigPlugin(options) {
|
|
|
428
432
|
}
|
|
429
433
|
function getDefine(options) {
|
|
430
434
|
return {
|
|
431
|
-
__SLIDEV_CLIENT_ROOT__: JSON.stringify(
|
|
435
|
+
__SLIDEV_CLIENT_ROOT__: JSON.stringify(_chunk74QPSS6Tjs.toAtFS.call(void 0, options.clientRoot)),
|
|
432
436
|
__SLIDEV_HASH_ROUTE__: JSON.stringify(options.data.config.routerMode === "hash"),
|
|
433
437
|
__SLIDEV_FEATURE_DRAWINGS__: JSON.stringify(options.data.config.drawings.enabled === true || options.data.config.drawings.enabled === options.mode),
|
|
434
438
|
__SLIDEV_FEATURE_DRAWINGS_PERSIST__: JSON.stringify(!!options.data.config.drawings.persist === true),
|
|
@@ -438,8 +442,8 @@ function getDefine(options) {
|
|
|
438
442
|
}
|
|
439
443
|
|
|
440
444
|
// node/plugins/loaders.ts
|
|
441
|
-
|
|
442
|
-
var import_fast_deep_equal =
|
|
445
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
446
|
+
var import_fast_deep_equal = _chunk74QPSS6Tjs.__toESM.call(void 0, require_fast_deep_equal());
|
|
443
447
|
|
|
444
448
|
|
|
445
449
|
|
|
@@ -563,8 +567,9 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
563
567
|
var _a2;
|
|
564
568
|
const file = `${slidePrefix}${i + 1}.md`;
|
|
565
569
|
try {
|
|
566
|
-
const md2 = await transformMarkdown(await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file), i, newData);
|
|
567
|
-
|
|
570
|
+
const md2 = await transformMarkdown((await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file)).code, i, newData);
|
|
571
|
+
const handleHotUpdate = "handler" in VuePlugin.handleHotUpdate ? VuePlugin.handleHotUpdate.handler : VuePlugin.handleHotUpdate;
|
|
572
|
+
return await handleHotUpdate({
|
|
568
573
|
...ctx,
|
|
569
574
|
modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
|
|
570
575
|
file,
|
|
@@ -693,7 +698,7 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
693
698
|
delete frontmatter.title;
|
|
694
699
|
const imports = [
|
|
695
700
|
'import { inject as vueInject } from "vue"',
|
|
696
|
-
`import InjectedLayout from "${
|
|
701
|
+
`import InjectedLayout from "${_chunk74QPSS6Tjs.toAtFS.call(void 0, layouts[layoutName])}"`,
|
|
697
702
|
'import { injectionSlidevContext } from "@slidev/client/constants"',
|
|
698
703
|
`const frontmatter = ${JSON.stringify(frontmatter)}`,
|
|
699
704
|
"const $slidev = vueInject(injectionSlidevContext)"
|
|
@@ -798,9 +803,9 @@ defineProps<{ no: number | string }>()`);
|
|
|
798
803
|
}
|
|
799
804
|
async function generateUserStyles() {
|
|
800
805
|
const imports = [
|
|
801
|
-
`import "${
|
|
802
|
-
`import "${
|
|
803
|
-
`import "${
|
|
806
|
+
`import "${_chunk74QPSS6Tjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/vars.css"))}"`,
|
|
807
|
+
`import "${_chunk74QPSS6Tjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/index.css"))}"`,
|
|
808
|
+
`import "${_chunk74QPSS6Tjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/code.css"))}"`
|
|
804
809
|
];
|
|
805
810
|
const roots2 = _utils.uniq.call(void 0, [
|
|
806
811
|
...themeRoots,
|
|
@@ -817,13 +822,13 @@ defineProps<{ no: number | string }>()`);
|
|
|
817
822
|
];
|
|
818
823
|
for (const style of styles) {
|
|
819
824
|
if (_fsextra.existsSync.call(void 0, style)) {
|
|
820
|
-
imports.push(`import "${
|
|
825
|
+
imports.push(`import "${_chunk74QPSS6Tjs.toAtFS.call(void 0, style)}"`);
|
|
821
826
|
continue;
|
|
822
827
|
}
|
|
823
828
|
}
|
|
824
829
|
}
|
|
825
830
|
if (data.features.katex)
|
|
826
|
-
imports.push(`import "${
|
|
831
|
+
imports.push(`import "${_chunk74QPSS6Tjs.toAtFS.call(void 0, _chunk74QPSS6Tjs.resolveImportPath.call(void 0, "katex/dist/katex.min.css", true))}"`);
|
|
827
832
|
if (data.config.css === "unocss") {
|
|
828
833
|
imports.unshift(
|
|
829
834
|
'import "@unocss/reset/tailwind.css"',
|
|
@@ -852,7 +857,7 @@ defineProps<{ no: number | string }>()`);
|
|
|
852
857
|
const layouts = _utils.objectMap.call(void 0,
|
|
853
858
|
await getLayouts(),
|
|
854
859
|
(k, v) => {
|
|
855
|
-
imports.push(`import __layout_${k} from "${
|
|
860
|
+
imports.push(`import __layout_${k} from "${_chunk74QPSS6Tjs.toAtFS.call(void 0, v)}"`);
|
|
856
861
|
return [k, `__layout_${k}`];
|
|
857
862
|
}
|
|
858
863
|
);
|
|
@@ -901,7 +906,7 @@ ${routes.join(",\n")}
|
|
|
901
906
|
const config = { ...data.config, remote };
|
|
902
907
|
if (_utils.isString.call(void 0, config.title)) {
|
|
903
908
|
const tokens = md.parseInline(config.title, {});
|
|
904
|
-
config.title =
|
|
909
|
+
config.title = _chunk74QPSS6Tjs.stringifyMarkdownTokens.call(void 0, tokens);
|
|
905
910
|
}
|
|
906
911
|
if (_utils.isString.call(void 0, config.info))
|
|
907
912
|
config.info = md.render(config.info);
|
|
@@ -922,7 +927,7 @@ ${routes.join(",\n")}
|
|
|
922
927
|
];
|
|
923
928
|
}
|
|
924
929
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
925
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${
|
|
930
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunk74QPSS6Tjs.toAtFS.call(void 0, i)}'`).join("\n");
|
|
926
931
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
927
932
|
return `
|
|
928
933
|
${imports}
|
|
@@ -941,7 +946,7 @@ export default {
|
|
|
941
946
|
_path.join.call(void 0, root, "CustomNavControls.vue")
|
|
942
947
|
];
|
|
943
948
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
944
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${
|
|
949
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunk74QPSS6Tjs.toAtFS.call(void 0, i)}'`).join("\n");
|
|
945
950
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
946
951
|
return `
|
|
947
952
|
${imports}
|
|
@@ -956,7 +961,7 @@ export default {
|
|
|
956
961
|
}
|
|
957
962
|
|
|
958
963
|
// node/plugins/monacoTransform.ts
|
|
959
|
-
|
|
964
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
960
965
|
|
|
961
966
|
|
|
962
967
|
|
|
@@ -990,7 +995,7 @@ function createMonacoTypesLoader() {
|
|
|
990
995
|
}
|
|
991
996
|
|
|
992
997
|
// node/plugins/setupClient.ts
|
|
993
|
-
|
|
998
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
994
999
|
|
|
995
1000
|
|
|
996
1001
|
|
|
@@ -1001,10 +1006,13 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
|
|
|
1001
1006
|
enforce: "pre",
|
|
1002
1007
|
async transform(code, id) {
|
|
1003
1008
|
if (id.startsWith(setupEntry)) {
|
|
1009
|
+
let getInjections2 = function(isAwait = false, isChained = false) {
|
|
1010
|
+
return injections.join("\n").replace(/:AWAIT:/g, isAwait ? "await " : "").replace(/(,\s*)?:LAST:/g, isChained ? "$1injection_return" : "");
|
|
1011
|
+
};
|
|
1012
|
+
var getInjections = getInjections2;
|
|
1004
1013
|
const name = id.slice(setupEntry.length + 1);
|
|
1005
1014
|
const imports = [];
|
|
1006
1015
|
const injections = [];
|
|
1007
|
-
const asyncInjections = [];
|
|
1008
1016
|
const setups = _utils.uniq.call(void 0, [
|
|
1009
1017
|
...themeRoots,
|
|
1010
1018
|
...addonRoots,
|
|
@@ -1013,42 +1021,29 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
|
|
|
1013
1021
|
setups.forEach((path, idx) => {
|
|
1014
1022
|
if (!_fs.existsSync.call(void 0, path))
|
|
1015
1023
|
return;
|
|
1016
|
-
imports.push(`import __n${idx} from '${
|
|
1017
|
-
let fn =
|
|
1018
|
-
|
|
1019
|
-
if (/\binjection_return\b/g.test(code)) {
|
|
1024
|
+
imports.push(`import __n${idx} from '${_chunk74QPSS6Tjs.toAtFS.call(void 0, path)}'`);
|
|
1025
|
+
let fn = `:AWAIT:__n${idx}`;
|
|
1026
|
+
if (/\binjection_return\b/g.test(code))
|
|
1020
1027
|
fn = `injection_return = ${fn}`;
|
|
1021
|
-
awaitFn = `injection_return = ${awaitFn}`;
|
|
1022
|
-
}
|
|
1023
1028
|
if (/\binjection_arg\b/g.test(code)) {
|
|
1024
1029
|
fn += "(";
|
|
1025
|
-
awaitFn += "(";
|
|
1026
1030
|
const matches = Array.from(code.matchAll(/\binjection_arg(_\d+)?\b/g));
|
|
1027
1031
|
const dedupedMatches = Array.from(new Set(matches.map((m) => m[0])));
|
|
1028
|
-
dedupedMatches.
|
|
1029
|
-
|
|
1030
|
-
const arg = key + (isLast ? "" : ",");
|
|
1031
|
-
fn += arg;
|
|
1032
|
-
awaitFn += arg;
|
|
1033
|
-
});
|
|
1034
|
-
fn += ")";
|
|
1035
|
-
awaitFn += ")";
|
|
1032
|
+
fn += dedupedMatches.join(", ");
|
|
1033
|
+
fn += ", :LAST:)";
|
|
1036
1034
|
} else {
|
|
1037
|
-
fn += "()";
|
|
1038
|
-
awaitFn += "()";
|
|
1035
|
+
fn += "(:LAST:)";
|
|
1039
1036
|
}
|
|
1040
1037
|
injections.push(
|
|
1041
1038
|
`// ${path}`,
|
|
1042
1039
|
fn
|
|
1043
1040
|
);
|
|
1044
|
-
asyncInjections.push(
|
|
1045
|
-
`// ${path}`,
|
|
1046
|
-
awaitFn
|
|
1047
|
-
);
|
|
1048
1041
|
});
|
|
1049
1042
|
code = code.replace("/* __imports__ */", imports.join("\n"));
|
|
1050
|
-
code = code.replace("/* __injections__ */",
|
|
1051
|
-
code = code.replace("/* __async_injections__ */",
|
|
1043
|
+
code = code.replace("/* __injections__ */", getInjections2());
|
|
1044
|
+
code = code.replace("/* __async_injections__ */", getInjections2(true));
|
|
1045
|
+
code = code.replace("/* __chained_injections__ */", getInjections2(false, true));
|
|
1046
|
+
code = code.replace("/* __chained_async_injections__ */", getInjections2(true, true));
|
|
1052
1047
|
return code;
|
|
1053
1048
|
}
|
|
1054
1049
|
return null;
|
|
@@ -1057,7 +1052,7 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
|
|
|
1057
1052
|
}
|
|
1058
1053
|
|
|
1059
1054
|
// node/plugins/markdown.ts
|
|
1060
|
-
|
|
1055
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1061
1056
|
var _vitepluginvuemarkdown = require('vite-plugin-vue-markdown'); var _vitepluginvuemarkdown2 = _interopRequireDefault(_vitepluginvuemarkdown);
|
|
1062
1057
|
var _jsbase64 = require('js-base64'); var base64 = _interopRequireWildcard(_jsbase64);
|
|
1063
1058
|
|
|
@@ -1068,7 +1063,7 @@ var _shiki = require('shiki'); var Shiki = _interopRequireWildcard(_shiki);
|
|
|
1068
1063
|
var _plantumlencoder = require('plantuml-encoder');
|
|
1069
1064
|
|
|
1070
1065
|
// node/plugins/markdown-it-katex.ts
|
|
1071
|
-
|
|
1066
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1072
1067
|
var _katex = require('katex'); var _katex2 = _interopRequireDefault(_katex);
|
|
1073
1068
|
function isValidDelim(state, pos) {
|
|
1074
1069
|
const max = state.posMax;
|
|
@@ -1215,7 +1210,7 @@ function math_plugin(md2, options) {
|
|
|
1215
1210
|
}
|
|
1216
1211
|
|
|
1217
1212
|
// node/plugins/markdown-it-prism.ts
|
|
1218
|
-
|
|
1213
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1219
1214
|
var _prismjs = require('prismjs'); var _prismjs2 = _interopRequireDefault(_prismjs);
|
|
1220
1215
|
var _ = require('prismjs/components/'); var _2 = _interopRequireDefault(_);
|
|
1221
1216
|
var DEFAULTS = {
|
|
@@ -1238,7 +1233,7 @@ function loadPrismLang(lang) {
|
|
|
1238
1233
|
}
|
|
1239
1234
|
function loadPrismPlugin(name) {
|
|
1240
1235
|
try {
|
|
1241
|
-
|
|
1236
|
+
_chunk74QPSS6Tjs.__require.call(void 0, `prismjs/plugins/${name}/prism-${name}`);
|
|
1242
1237
|
} catch (e) {
|
|
1243
1238
|
throw new Error(`Cannot load Prism plugin "${name}". Please check the spelling.`);
|
|
1244
1239
|
}
|
|
@@ -1278,7 +1273,7 @@ function markdownItPrism(markdownit, useroptions) {
|
|
|
1278
1273
|
}
|
|
1279
1274
|
|
|
1280
1275
|
// node/plugins/markdown-it-shiki.ts
|
|
1281
|
-
|
|
1276
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1282
1277
|
function getThemeName(theme) {
|
|
1283
1278
|
if (typeof theme === "string")
|
|
1284
1279
|
return theme;
|
|
@@ -1341,7 +1336,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1341
1336
|
const setups = [];
|
|
1342
1337
|
const entryPath = _utils.slash.call(void 0, entry);
|
|
1343
1338
|
if (config.highlighter === "shiki") {
|
|
1344
|
-
const { getHighlighter } = await Promise.resolve().then(() =>
|
|
1339
|
+
const { getHighlighter } = await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "shiki")));
|
|
1345
1340
|
const shikiOptions = await loadSetups(roots, "shiki.ts", Shiki, DEFAULT_SHIKI_OPTIONS, false);
|
|
1346
1341
|
const { langs, themes } = resolveShikiOptions(shikiOptions);
|
|
1347
1342
|
shikiOptions.highlighter = await getHighlighter({ themes, langs });
|
|
@@ -1495,7 +1490,7 @@ function escapeVueInCode(md2) {
|
|
|
1495
1490
|
}
|
|
1496
1491
|
|
|
1497
1492
|
// node/plugins/patchTransform.ts
|
|
1498
|
-
|
|
1493
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1499
1494
|
|
|
1500
1495
|
function createFixPlugins(options) {
|
|
1501
1496
|
const define = _utils.objectEntries.call(void 0, getDefine(options));
|
|
@@ -1504,11 +1499,13 @@ function createFixPlugins(options) {
|
|
|
1504
1499
|
name: "slidev:flags",
|
|
1505
1500
|
enforce: "pre",
|
|
1506
1501
|
transform(code, id) {
|
|
1507
|
-
if (id.
|
|
1502
|
+
if (id.match(/\.vue($|\?)/)) {
|
|
1503
|
+
const original = code;
|
|
1508
1504
|
define.forEach(([from, to]) => {
|
|
1509
1505
|
code = code.replace(new RegExp(from, "g"), to);
|
|
1510
1506
|
});
|
|
1511
|
-
|
|
1507
|
+
if (original !== code)
|
|
1508
|
+
return code;
|
|
1512
1509
|
}
|
|
1513
1510
|
}
|
|
1514
1511
|
}
|
|
@@ -1516,14 +1513,14 @@ function createFixPlugins(options) {
|
|
|
1516
1513
|
}
|
|
1517
1514
|
|
|
1518
1515
|
// node/plugins/unocss.ts
|
|
1519
|
-
|
|
1516
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1520
1517
|
|
|
1521
1518
|
|
|
1522
1519
|
|
|
1523
1520
|
|
|
1524
1521
|
async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, data }, { unocss: unoOptions }) {
|
|
1525
1522
|
var _a, _b, _c, _d;
|
|
1526
|
-
const UnoCSS = await Promise.resolve().then(() =>
|
|
1523
|
+
const UnoCSS = await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "unocss/vite"))).then((r) => r.default);
|
|
1527
1524
|
const configFiles = _utils.uniq.call(void 0, [
|
|
1528
1525
|
...themeRoots.map((i) => `${i}/uno.config.ts`),
|
|
1529
1526
|
...addonRoots.map((i) => `${i}/uno.config.ts`),
|
|
@@ -1669,7 +1666,11 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1669
1666
|
createConfigPlugin(options),
|
|
1670
1667
|
createClientSetupPlugin(options),
|
|
1671
1668
|
createMonacoTypesLoader(),
|
|
1672
|
-
createFixPlugins(options)
|
|
1669
|
+
createFixPlugins(options),
|
|
1670
|
+
options.inspect ? _viteplugininspect2.default.call(void 0, {
|
|
1671
|
+
dev: true,
|
|
1672
|
+
build: true
|
|
1673
|
+
}) : null
|
|
1673
1674
|
].flat().filter(_utils.notNullish);
|
|
1674
1675
|
}
|
|
1675
1676
|
|