@slidev/cli 0.32.3 → 0.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/slidev.js +1 -1
- package/dist/{build-YVXTTUTD.mjs → build-JAORN7ES.mjs} +13 -11
- package/dist/{build-M2QTEV63.js → build-OWDFSW6Q.js} +19 -17
- package/dist/{chunk-WZ6OPJJF.mjs → chunk-DGFMEJWT.mjs} +43 -27
- package/dist/{chunk-JWGORJY6.js → chunk-IP7ZGKHI.js} +2 -2
- package/dist/{chunk-NOFZO6W4.mjs → chunk-IWKTUAXD.mjs} +2 -2
- package/dist/{chunk-N7XL66RP.js → chunk-LIMOCTLS.js} +164 -158
- package/dist/{chunk-M2TT7ZMD.mjs → chunk-MVE4F2AE.mjs} +17 -11
- package/dist/{chunk-IW3TSLZF.js → chunk-WGEHDK3K.js} +102 -86
- package/dist/cli.js +25 -25
- package/dist/cli.mjs +6 -6
- package/dist/{export-M6HJUIFY.js → export-JHIU6OQI.js} +4 -4
- package/dist/{export-GIPHUNUX.mjs → export-Z44PM4CT.mjs} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +3 -3
- package/package.json +28 -28
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ViteSlidevPlugin
|
|
3
|
-
|
|
2
|
+
ViteSlidevPlugin,
|
|
3
|
+
mergeViteConfigs
|
|
4
|
+
} from "./chunk-DGFMEJWT.mjs";
|
|
4
5
|
import {
|
|
5
6
|
__commonJS,
|
|
6
7
|
__dirname,
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
init_esm_shims,
|
|
16
17
|
packageExists,
|
|
17
18
|
resolveImportPath
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-IWKTUAXD.mjs";
|
|
19
20
|
|
|
20
21
|
// ../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/internal/constants.js
|
|
21
22
|
var require_constants = __commonJS({
|
|
@@ -2378,12 +2379,12 @@ var require_semver2 = __commonJS({
|
|
|
2378
2379
|
// node/server.ts
|
|
2379
2380
|
init_esm_shims();
|
|
2380
2381
|
import { join } from "path";
|
|
2381
|
-
import { createServer as createViteServer,
|
|
2382
|
+
import { createServer as createViteServer, resolveConfig } from "vite";
|
|
2382
2383
|
async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
2383
2384
|
const rawConfig = await resolveConfig({}, "serve");
|
|
2384
2385
|
const pluginOptions = rawConfig.slidev || {};
|
|
2385
2386
|
process.env.EDITOR = process.env.EDITOR || "code";
|
|
2386
|
-
const server = await createViteServer(
|
|
2387
|
+
const server = await createViteServer(await mergeViteConfigs(options, viteConfig, {
|
|
2387
2388
|
optimizeDeps: {
|
|
2388
2389
|
entries: [
|
|
2389
2390
|
join(options.clientRoot, "main.ts")
|
|
@@ -2392,7 +2393,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
|
2392
2393
|
plugins: [
|
|
2393
2394
|
await ViteSlidevPlugin(options, pluginOptions, serverOptions)
|
|
2394
2395
|
]
|
|
2395
|
-
}));
|
|
2396
|
+
}, "serve"));
|
|
2396
2397
|
return server;
|
|
2397
2398
|
}
|
|
2398
2399
|
|
|
@@ -2401,7 +2402,7 @@ init_esm_shims();
|
|
|
2401
2402
|
import * as parser from "@slidev/parser/fs";
|
|
2402
2403
|
|
|
2403
2404
|
// package.json
|
|
2404
|
-
var version = "0.
|
|
2405
|
+
var version = "0.33.1";
|
|
2405
2406
|
|
|
2406
2407
|
// node/themes.ts
|
|
2407
2408
|
init_esm_shims();
|
|
@@ -9504,19 +9505,22 @@ init_esm_shims();
|
|
|
9504
9505
|
var import_semver = __toESM(require_semver2());
|
|
9505
9506
|
import fs2 from "fs-extra";
|
|
9506
9507
|
function getPackageJson(root) {
|
|
9507
|
-
|
|
9508
|
+
const file = resolveImportPath(`${root}/package.json`, true);
|
|
9509
|
+
if (file && fs2.existsSync(file))
|
|
9510
|
+
return fs2.readJSON(file);
|
|
9511
|
+
return {};
|
|
9508
9512
|
}
|
|
9509
9513
|
async function getAddons(userRoot, config2) {
|
|
9510
9514
|
const { slidev = {} } = await getPackageJson(userRoot);
|
|
9511
|
-
const configAddons = config2.addons
|
|
9512
|
-
const addons = configAddons.concat(slidev
|
|
9515
|
+
const configAddons = Array.isArray(config2.addons) ? config2.addons : [];
|
|
9516
|
+
const addons = configAddons.concat(Array.isArray(slidev == null ? void 0 : slidev.addons) ? slidev.addons : []);
|
|
9513
9517
|
return getRecursivePlugins(addons.map(resolvePluginName));
|
|
9514
9518
|
}
|
|
9515
9519
|
async function getRecursivePlugins(addons) {
|
|
9516
9520
|
const addonsArray = await Promise.all(addons.map(async (addon) => {
|
|
9517
9521
|
const { slidev = {}, engines = {} } = await getPackageJson(addon);
|
|
9518
9522
|
checkEngine(addon, engines);
|
|
9519
|
-
let addons2 = slidev
|
|
9523
|
+
let addons2 = Array.isArray(slidev == null ? void 0 : slidev.addons) ? slidev.addons : [];
|
|
9520
9524
|
if (addons2.length > 0)
|
|
9521
9525
|
addons2 = await getRecursivePlugins(addons2.map(resolvePluginName));
|
|
9522
9526
|
addons2.push(addon);
|
|
@@ -9661,6 +9665,8 @@ function resolveThemeName(name) {
|
|
|
9661
9665
|
return name;
|
|
9662
9666
|
if (officialThemes[name] != null)
|
|
9663
9667
|
return officialThemes[name];
|
|
9668
|
+
if (name.indexOf("@") === 0 && name.includes("/"))
|
|
9669
|
+
return name;
|
|
9664
9670
|
return `slidev-theme-${name}`;
|
|
9665
9671
|
}
|
|
9666
9672
|
async function promptForThemeInstallation(name) {
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkIP7ZGKHIjs = require('./chunk-IP7ZGKHI.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 = _chunkIP7ZGKHIjs.__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
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
20
20
|
module.exports = function equal2(a, b) {
|
|
21
21
|
if (a === b)
|
|
22
22
|
return true;
|
|
@@ -59,10 +59,11 @@ var require_fast_deep_equal = _chunkJWGORJY6js.__commonJS.call(void 0, {
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
// node/common.ts
|
|
62
|
-
|
|
62
|
+
_chunkIP7ZGKHIjs.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');
|
|
66
|
+
var _vite = require('vite');
|
|
66
67
|
async function getIndexHtml({ clientRoot, themeRoots, data, userRoot }) {
|
|
67
68
|
var _a, _b;
|
|
68
69
|
let main = await _fs.promises.readFile(_path.join.call(void 0, clientRoot, "index.html"), "utf-8");
|
|
@@ -87,13 +88,32 @@ ${(((_b = index.match(/<body>([\s\S]*?)<\/body>/im)) == null ? void 0 : _b[1]) |
|
|
|
87
88
|
body += '\n<script async src="https://platform.twitter.com/widgets.js"><\/script>';
|
|
88
89
|
if (data.config.fonts.webfonts.length && data.config.fonts.provider !== "none")
|
|
89
90
|
head += `
|
|
90
|
-
<link rel="stylesheet" href="${
|
|
91
|
-
main = main.replace("__ENTRY__",
|
|
91
|
+
<link rel="stylesheet" href="${_chunkIP7ZGKHIjs.generateGoogleFontsUrl.call(void 0, data.config.fonts)}" type="text/css">`;
|
|
92
|
+
main = main.replace("__ENTRY__", _chunkIP7ZGKHIjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "main.ts"))).replace("<!-- head -->", head).replace("<!-- body -->", body);
|
|
92
93
|
return main;
|
|
93
94
|
}
|
|
95
|
+
async function mergeViteConfigs({ addonRoots, themeRoots }, viteConfig, config, command) {
|
|
96
|
+
const configEnv = {
|
|
97
|
+
mode: "development",
|
|
98
|
+
command
|
|
99
|
+
};
|
|
100
|
+
const files = _utils.uniq.call(void 0, [
|
|
101
|
+
...themeRoots,
|
|
102
|
+
...addonRoots
|
|
103
|
+
]).map((i) => _path.join.call(void 0, i, "vite.config.ts"));
|
|
104
|
+
for await (const file of files) {
|
|
105
|
+
if (!_fs.existsSync.call(void 0, file))
|
|
106
|
+
continue;
|
|
107
|
+
const viteConfig2 = await _vite.loadConfigFromFile.call(void 0, configEnv, file);
|
|
108
|
+
if (!(viteConfig2 == null ? void 0 : viteConfig2.config))
|
|
109
|
+
continue;
|
|
110
|
+
config = _vite.mergeConfig.call(void 0, config, viteConfig2.config);
|
|
111
|
+
}
|
|
112
|
+
return _vite.mergeConfig.call(void 0, viteConfig, config);
|
|
113
|
+
}
|
|
94
114
|
|
|
95
115
|
// node/plugins/windicss.ts
|
|
96
|
-
|
|
116
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
97
117
|
|
|
98
118
|
|
|
99
119
|
|
|
@@ -101,13 +121,13 @@ var _vitepluginwindicss = require('vite-plugin-windicss'); var _vitepluginwindic
|
|
|
101
121
|
var _jiti = require('jiti'); var _jiti2 = _interopRequireDefault(_jiti);
|
|
102
122
|
|
|
103
123
|
// node/plugins/setupNode.ts
|
|
104
|
-
|
|
124
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
105
125
|
|
|
106
126
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
107
127
|
|
|
108
128
|
|
|
109
129
|
function deepMerge(a, b, rootPath = "") {
|
|
110
|
-
a =
|
|
130
|
+
a = _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {}, a);
|
|
111
131
|
Object.keys(b).forEach((key) => {
|
|
112
132
|
if (_utils.isObject.call(void 0, a[key]))
|
|
113
133
|
a[key] = deepMerge(a[key], b[key], rootPath ? `${rootPath}.${key}` : key);
|
|
@@ -146,7 +166,7 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
|
|
|
146
166
|
if (config.default)
|
|
147
167
|
config = config.default;
|
|
148
168
|
config = await loadSetups(roots, "windicss.ts", {}, config, true);
|
|
149
|
-
return _vitepluginwindicss2.default.call(void 0,
|
|
169
|
+
return _vitepluginwindicss2.default.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {
|
|
150
170
|
configFiles: [configFile],
|
|
151
171
|
config,
|
|
152
172
|
onConfigResolved(config2) {
|
|
@@ -164,33 +184,33 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
|
|
|
164
184
|
},
|
|
165
185
|
onOptionsResolved(config2) {
|
|
166
186
|
themeRoots.forEach((i) => {
|
|
167
|
-
config2.scanOptions.include.push(`${i}/components
|
|
168
|
-
config2.scanOptions.include.push(`${i}/layouts
|
|
187
|
+
config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
|
|
188
|
+
config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
|
|
169
189
|
});
|
|
170
190
|
addonRoots.forEach((i) => {
|
|
171
|
-
config2.scanOptions.include.push(`${i}/components
|
|
172
|
-
config2.scanOptions.include.push(`${i}/layouts
|
|
191
|
+
config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
|
|
192
|
+
config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
|
|
173
193
|
});
|
|
174
194
|
config2.scanOptions.include.push(`!${_utils.slash.call(void 0, _path.resolve.call(void 0, userRoot, "node_modules"))}`);
|
|
175
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
176
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
177
|
-
config2.scanOptions.exclude.push(_path.dirname.call(void 0,
|
|
195
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkIP7ZGKHIjs.resolveImportPath.call(void 0, "monaco-editor/package.json", true)));
|
|
196
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkIP7ZGKHIjs.resolveImportPath.call(void 0, "katex/package.json", true)));
|
|
197
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkIP7ZGKHIjs.resolveImportPath.call(void 0, "prettier/package.json", true)));
|
|
178
198
|
}
|
|
179
199
|
}, windiOptions));
|
|
180
200
|
}
|
|
181
201
|
|
|
182
202
|
// node/plugins/preset.ts
|
|
183
|
-
|
|
203
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
184
204
|
var _pluginvue = require('@vitejs/plugin-vue'); var _pluginvue2 = _interopRequireDefault(_pluginvue);
|
|
185
|
-
var
|
|
205
|
+
var _vite3 = require('unplugin-icons/vite'); var _vite4 = _interopRequireDefault(_vite3);
|
|
186
206
|
var _resolver = require('unplugin-icons/resolver'); var _resolver2 = _interopRequireDefault(_resolver);
|
|
187
|
-
var
|
|
207
|
+
var _vite5 = require('unplugin-vue-components/vite'); var _vite6 = _interopRequireDefault(_vite5);
|
|
188
208
|
var _vitepluginremoteassets = require('vite-plugin-remote-assets'); var _vitepluginremoteassets2 = _interopRequireDefault(_vitepluginremoteassets);
|
|
189
209
|
var _vitepluginvueserverref = require('vite-plugin-vue-server-ref'); var _vitepluginvueserverref2 = _interopRequireDefault(_vitepluginvueserverref);
|
|
190
210
|
|
|
191
211
|
|
|
192
212
|
// node/drawings.ts
|
|
193
|
-
|
|
213
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
194
214
|
|
|
195
215
|
|
|
196
216
|
var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);
|
|
@@ -236,9 +256,9 @@ ${value}
|
|
|
236
256
|
}
|
|
237
257
|
|
|
238
258
|
// node/plugins/extendConfig.ts
|
|
239
|
-
|
|
259
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
260
|
+
|
|
240
261
|
|
|
241
|
-
var _vite5 = require('vite');
|
|
242
262
|
var _isinstalledglobally = require('is-installed-globally'); var _isinstalledglobally2 = _interopRequireDefault(_isinstalledglobally);
|
|
243
263
|
|
|
244
264
|
|
|
@@ -247,31 +267,31 @@ var dependencies = {
|
|
|
247
267
|
"@antfu/utils": "^0.5.2",
|
|
248
268
|
"@slidev/parser": "workspace:*",
|
|
249
269
|
"@slidev/types": "workspace:*",
|
|
250
|
-
"@vueuse/core": "^8.
|
|
270
|
+
"@vueuse/core": "^8.7.4",
|
|
251
271
|
"@vueuse/head": "^0.7.6",
|
|
252
272
|
"@vueuse/motion": "^2.0.0-beta.18",
|
|
253
|
-
codemirror: "^5.65.
|
|
273
|
+
codemirror: "^5.65.5",
|
|
254
274
|
defu: "^6.0.0",
|
|
255
275
|
drauu: "^0.3.0",
|
|
256
276
|
"file-saver": "^2.0.5",
|
|
257
277
|
"js-base64": "^3.7.2",
|
|
258
278
|
"js-yaml": "^4.1.0",
|
|
259
|
-
katex: "^0.
|
|
260
|
-
mermaid: "^9.1.
|
|
279
|
+
katex: "^0.16.0",
|
|
280
|
+
mermaid: "^9.1.2",
|
|
261
281
|
"monaco-editor": "^0.33.0",
|
|
262
|
-
nanoid: "^
|
|
263
|
-
prettier: "^2.
|
|
282
|
+
nanoid: "^4.0.0",
|
|
283
|
+
prettier: "^2.7.1",
|
|
264
284
|
recordrtc: "^5.6.2",
|
|
265
|
-
resolve: "^1.22.
|
|
285
|
+
resolve: "^1.22.1",
|
|
266
286
|
"vite-plugin-windicss": "^1.8.4",
|
|
267
|
-
vue: "^3.2.
|
|
268
|
-
"vue-router": "^4.0.
|
|
269
|
-
"vue-starport": "^0.
|
|
287
|
+
vue: "^3.2.36",
|
|
288
|
+
"vue-router": "^4.0.16",
|
|
289
|
+
"vue-starport": "^0.3.0",
|
|
270
290
|
windicss: "^3.5.4"
|
|
271
291
|
};
|
|
272
292
|
|
|
273
293
|
// node/vite/searchRoot.ts
|
|
274
|
-
|
|
294
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
275
295
|
|
|
276
296
|
|
|
277
297
|
var ROOT_FILES = [
|
|
@@ -331,7 +351,7 @@ function createConfigPlugin(options) {
|
|
|
331
351
|
define: getDefine(options),
|
|
332
352
|
resolve: {
|
|
333
353
|
alias: {
|
|
334
|
-
"@slidev/client/": `${
|
|
354
|
+
"@slidev/client/": `${_chunkIP7ZGKHIjs.toAtFS.call(void 0, options.clientRoot)}/`
|
|
335
355
|
}
|
|
336
356
|
},
|
|
337
357
|
optimizeDeps: {
|
|
@@ -358,7 +378,7 @@ function createConfigPlugin(options) {
|
|
|
358
378
|
allow: _utils.uniq.call(void 0, [
|
|
359
379
|
searchForWorkspaceRoot(options.userRoot),
|
|
360
380
|
searchForWorkspaceRoot(options.cliRoot),
|
|
361
|
-
..._isinstalledglobally2.default ? [_path.dirname.call(void 0,
|
|
381
|
+
..._isinstalledglobally2.default ? [_path.dirname.call(void 0, _chunkIP7ZGKHIjs.resolveGlobalImportPath.call(void 0, "@slidev/client/package.json")), _path.dirname.call(void 0, _chunkIP7ZGKHIjs.resolveGlobalImportPath.call(void 0, "katex/package.json"))] : []
|
|
362
382
|
])
|
|
363
383
|
}
|
|
364
384
|
}
|
|
@@ -367,9 +387,9 @@ function createConfigPlugin(options) {
|
|
|
367
387
|
injection.cacheDir = _path.join.call(void 0, options.cliRoot, "node_modules/.vite");
|
|
368
388
|
injection.publicDir = _path.join.call(void 0, options.userRoot, "public");
|
|
369
389
|
injection.root = options.cliRoot;
|
|
370
|
-
injection.resolve.alias.vue = `${
|
|
390
|
+
injection.resolve.alias.vue = `${_chunkIP7ZGKHIjs.resolveImportPath.call(void 0, "vue/dist/vue.esm-browser.js", true)}`;
|
|
371
391
|
}
|
|
372
|
-
return
|
|
392
|
+
return _vite.mergeConfig.call(void 0, config, injection);
|
|
373
393
|
},
|
|
374
394
|
configureServer(server) {
|
|
375
395
|
return () => {
|
|
@@ -388,7 +408,7 @@ function createConfigPlugin(options) {
|
|
|
388
408
|
}
|
|
389
409
|
function getDefine(options) {
|
|
390
410
|
return {
|
|
391
|
-
__SLIDEV_CLIENT_ROOT__: JSON.stringify(
|
|
411
|
+
__SLIDEV_CLIENT_ROOT__: JSON.stringify(_chunkIP7ZGKHIjs.toAtFS.call(void 0, options.clientRoot)),
|
|
392
412
|
__SLIDEV_HASH_ROUTE__: JSON.stringify(options.data.config.routerMode === "hash"),
|
|
393
413
|
__SLIDEV_FEATURE_DRAWINGS__: JSON.stringify(options.data.config.drawings.enabled === true || options.data.config.drawings.enabled === options.mode),
|
|
394
414
|
__SLIDEV_FEATURE_DRAWINGS_PERSIST__: JSON.stringify(!!options.data.config.drawings.persist === true),
|
|
@@ -398,8 +418,8 @@ function getDefine(options) {
|
|
|
398
418
|
}
|
|
399
419
|
|
|
400
420
|
// node/plugins/loaders.ts
|
|
401
|
-
|
|
402
|
-
var import_fast_deep_equal =
|
|
421
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
422
|
+
var import_fast_deep_equal = _chunkIP7ZGKHIjs.__toESM.call(void 0, require_fast_deep_equal());
|
|
403
423
|
|
|
404
424
|
|
|
405
425
|
|
|
@@ -431,7 +451,7 @@ md.use(_markdownitlinkattributes2.default, {
|
|
|
431
451
|
}
|
|
432
452
|
});
|
|
433
453
|
function prepareSlideInfo(data) {
|
|
434
|
-
return
|
|
454
|
+
return _chunkIP7ZGKHIjs.__spreadProps.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {}, data), {
|
|
435
455
|
notesHTML: md.render((data == null ? void 0 : data.note) || "")
|
|
436
456
|
});
|
|
437
457
|
}
|
|
@@ -522,7 +542,7 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
522
542
|
const file = `${slidePrefix}${i + 1}.md`;
|
|
523
543
|
try {
|
|
524
544
|
const md2 = await transformMarkdown(await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file), i, newData);
|
|
525
|
-
return await VuePlugin.handleHotUpdate(
|
|
545
|
+
return await VuePlugin.handleHotUpdate(_chunkIP7ZGKHIjs.__spreadProps.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {}, ctx), {
|
|
526
546
|
modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
|
|
527
547
|
file,
|
|
528
548
|
read() {
|
|
@@ -639,14 +659,14 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
639
659
|
async function transformMarkdown(code, pageNo, data2) {
|
|
640
660
|
var _a, _b;
|
|
641
661
|
const layouts = await getLayouts();
|
|
642
|
-
const frontmatter =
|
|
662
|
+
const frontmatter = _chunkIP7ZGKHIjs.__spreadValues.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {}, ((_a = data2.headmatter) == null ? void 0 : _a.defaults) || {}), ((_b = data2.slides[pageNo]) == null ? void 0 : _b.frontmatter) || {});
|
|
643
663
|
const layoutName = (frontmatter == null ? void 0 : frontmatter.layout) || (pageNo === 0 ? "cover" : "default");
|
|
644
664
|
if (!layouts[layoutName])
|
|
645
665
|
throw new Error(`Unknown layout "${layoutName}"`);
|
|
646
666
|
delete frontmatter.title;
|
|
647
667
|
const imports = [
|
|
648
668
|
'import { inject as vueInject } from "vue"',
|
|
649
|
-
`import InjectedLayout from "${
|
|
669
|
+
`import InjectedLayout from "${_chunkIP7ZGKHIjs.toAtFS.call(void 0, layouts[layoutName])}"`,
|
|
650
670
|
'import { injectionSlidevContext } from "@slidev/client/constants"',
|
|
651
671
|
`const frontmatter = ${JSON.stringify(frontmatter)}`,
|
|
652
672
|
"const $slidev = vueInject(injectionSlidevContext)"
|
|
@@ -733,7 +753,7 @@ defineProps<{ no: number | string }>()`);
|
|
|
733
753
|
clientRoot
|
|
734
754
|
]);
|
|
735
755
|
for (const root of roots2) {
|
|
736
|
-
const layoutPaths = await _fastglob2.default.call(void 0, "layouts
|
|
756
|
+
const layoutPaths = await _fastglob2.default.call(void 0, "layouts/**/*.{vue,ts}", {
|
|
737
757
|
cwd: root,
|
|
738
758
|
absolute: true
|
|
739
759
|
});
|
|
@@ -750,9 +770,9 @@ defineProps<{ no: number | string }>()`);
|
|
|
750
770
|
}
|
|
751
771
|
async function generateUserStyles() {
|
|
752
772
|
const imports = [
|
|
753
|
-
`import "${
|
|
754
|
-
`import "${
|
|
755
|
-
`import "${
|
|
773
|
+
`import "${_chunkIP7ZGKHIjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/vars.css"))}"`,
|
|
774
|
+
`import "${_chunkIP7ZGKHIjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/index.css"))}"`,
|
|
775
|
+
`import "${_chunkIP7ZGKHIjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/code.css"))}"`
|
|
756
776
|
];
|
|
757
777
|
const roots2 = _utils.uniq.call(void 0, [
|
|
758
778
|
...themeRoots,
|
|
@@ -769,13 +789,13 @@ defineProps<{ no: number | string }>()`);
|
|
|
769
789
|
];
|
|
770
790
|
for (const style of styles) {
|
|
771
791
|
if (_fsextra.existsSync.call(void 0, style)) {
|
|
772
|
-
imports.push(`import "${
|
|
792
|
+
imports.push(`import "${_chunkIP7ZGKHIjs.toAtFS.call(void 0, style)}"`);
|
|
773
793
|
continue;
|
|
774
794
|
}
|
|
775
795
|
}
|
|
776
796
|
}
|
|
777
797
|
if (data.features.katex)
|
|
778
|
-
imports.push(`import "${
|
|
798
|
+
imports.push(`import "${_chunkIP7ZGKHIjs.toAtFS.call(void 0, _chunkIP7ZGKHIjs.resolveImportPath.call(void 0, "katex/dist/katex.min.css", true))}"`);
|
|
779
799
|
return imports.join("\n");
|
|
780
800
|
}
|
|
781
801
|
async function generateMonacoTypes() {
|
|
@@ -784,7 +804,7 @@ defineProps<{ no: number | string }>()`);
|
|
|
784
804
|
async function generateLayouts() {
|
|
785
805
|
const imports = [];
|
|
786
806
|
const layouts = _utils.objectMap.call(void 0, await getLayouts(), (k, v) => {
|
|
787
|
-
imports.push(`import __layout_${k} from "${
|
|
807
|
+
imports.push(`import __layout_${k} from "${_chunkIP7ZGKHIjs.toAtFS.call(void 0, v)}"`);
|
|
788
808
|
return [k, `__layout_${k}`];
|
|
789
809
|
});
|
|
790
810
|
return [
|
|
@@ -806,16 +826,11 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
|
|
|
806
826
|
return void 0;
|
|
807
827
|
imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
|
|
808
828
|
const additions = {
|
|
809
|
-
slide: {
|
|
810
|
-
start: i.start,
|
|
811
|
-
end: i.end,
|
|
812
|
-
note: i.note,
|
|
829
|
+
slide: _chunkIP7ZGKHIjs.__spreadProps.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {}, prepareSlideInfo(i)), {
|
|
813
830
|
filepath: ((_b = i.source) == null ? void 0 : _b.filepath) || entry,
|
|
814
831
|
id: idx,
|
|
815
|
-
no
|
|
816
|
-
|
|
817
|
-
level: i.level
|
|
818
|
-
},
|
|
832
|
+
no
|
|
833
|
+
}),
|
|
819
834
|
__clicksElements: [],
|
|
820
835
|
__preloaded: false
|
|
821
836
|
};
|
|
@@ -833,10 +848,10 @@ ${routes.join(",\n")}
|
|
|
833
848
|
return [...imports, routesStr].join("\n");
|
|
834
849
|
}
|
|
835
850
|
function generateConfigs() {
|
|
836
|
-
const config =
|
|
851
|
+
const config = _chunkIP7ZGKHIjs.__spreadProps.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {}, data.config), { remote });
|
|
837
852
|
if (_utils.isString.call(void 0, config.title)) {
|
|
838
853
|
const tokens = md.parseInline(config.title, {});
|
|
839
|
-
config.title =
|
|
854
|
+
config.title = _chunkIP7ZGKHIjs.stringifyMarkdownTokens.call(void 0, tokens);
|
|
840
855
|
}
|
|
841
856
|
if (_utils.isString.call(void 0, config.info))
|
|
842
857
|
config.info = md.render(config.info);
|
|
@@ -857,7 +872,7 @@ ${routes.join(",\n")}
|
|
|
857
872
|
];
|
|
858
873
|
}
|
|
859
874
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
860
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${
|
|
875
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunkIP7ZGKHIjs.toAtFS.call(void 0, i)}'`).join("\n");
|
|
861
876
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
862
877
|
return `
|
|
863
878
|
${imports}
|
|
@@ -876,7 +891,7 @@ export default {
|
|
|
876
891
|
_path.join.call(void 0, root, "CustomNavControls.vue")
|
|
877
892
|
];
|
|
878
893
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
879
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${
|
|
894
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunkIP7ZGKHIjs.toAtFS.call(void 0, i)}'`).join("\n");
|
|
880
895
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
881
896
|
return `
|
|
882
897
|
${imports}
|
|
@@ -891,7 +906,7 @@ export default {
|
|
|
891
906
|
}
|
|
892
907
|
|
|
893
908
|
// node/plugins/monacoTransform.ts
|
|
894
|
-
|
|
909
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
895
910
|
|
|
896
911
|
|
|
897
912
|
|
|
@@ -907,7 +922,7 @@ function createMonacoTypesLoader() {
|
|
|
907
922
|
const match = id.match(/^\/\@slidev-monaco-types\/(.*)$/);
|
|
908
923
|
if (match) {
|
|
909
924
|
const pkg = match[1];
|
|
910
|
-
const info =
|
|
925
|
+
const info = _vite.resolvePackageData.call(void 0, pkg, process.cwd());
|
|
911
926
|
if (!info)
|
|
912
927
|
return;
|
|
913
928
|
const typePath = info.data.types || info.data.typings;
|
|
@@ -925,7 +940,7 @@ function createMonacoTypesLoader() {
|
|
|
925
940
|
}
|
|
926
941
|
|
|
927
942
|
// node/plugins/setupClient.ts
|
|
928
|
-
|
|
943
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
929
944
|
|
|
930
945
|
|
|
931
946
|
|
|
@@ -948,7 +963,7 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
|
|
|
948
963
|
setups.forEach((path, idx) => {
|
|
949
964
|
if (!_fs.existsSync.call(void 0, path))
|
|
950
965
|
return;
|
|
951
|
-
imports.push(`import __n${idx} from '${
|
|
966
|
+
imports.push(`import __n${idx} from '${_chunkIP7ZGKHIjs.toAtFS.call(void 0, path)}'`);
|
|
952
967
|
let fn = `__n${idx}`;
|
|
953
968
|
let awaitFn = `await __n${idx}`;
|
|
954
969
|
if (/\binjection_return\b/g.test(code)) {
|
|
@@ -976,8 +991,8 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
|
|
|
976
991
|
}
|
|
977
992
|
|
|
978
993
|
// node/plugins/markdown.ts
|
|
979
|
-
|
|
980
|
-
var
|
|
994
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
995
|
+
var _vitepluginvuemarkdown = require('vite-plugin-vue-markdown'); var _vitepluginvuemarkdown2 = _interopRequireDefault(_vitepluginvuemarkdown);
|
|
981
996
|
var _jsbase64 = require('js-base64'); var base64 = _interopRequireWildcard(_jsbase64);
|
|
982
997
|
|
|
983
998
|
|
|
@@ -986,7 +1001,7 @@ var _shiki = require('shiki'); var Shiki = _interopRequireWildcard(_shiki);
|
|
|
986
1001
|
var _plantumlencoder = require('plantuml-encoder');
|
|
987
1002
|
|
|
988
1003
|
// node/plugins/markdown-it-katex.ts
|
|
989
|
-
|
|
1004
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
990
1005
|
var _katex = require('katex'); var _katex2 = _interopRequireDefault(_katex);
|
|
991
1006
|
function isValidDelim(state, pos) {
|
|
992
1007
|
const max = state.posMax;
|
|
@@ -1133,7 +1148,7 @@ function math_plugin(md2, options) {
|
|
|
1133
1148
|
}
|
|
1134
1149
|
|
|
1135
1150
|
// node/plugins/markdown-it-prism.ts
|
|
1136
|
-
|
|
1151
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
1137
1152
|
var _prismjs = require('prismjs'); var _prismjs2 = _interopRequireDefault(_prismjs);
|
|
1138
1153
|
var _ = require('prismjs/components/'); var _2 = _interopRequireDefault(_);
|
|
1139
1154
|
var DEFAULTS = {
|
|
@@ -1156,7 +1171,7 @@ function loadPrismLang(lang) {
|
|
|
1156
1171
|
}
|
|
1157
1172
|
function loadPrismPlugin(name) {
|
|
1158
1173
|
try {
|
|
1159
|
-
|
|
1174
|
+
_chunkIP7ZGKHIjs.__require.call(void 0, `prismjs/plugins/${name}/prism-${name}`);
|
|
1160
1175
|
} catch (e) {
|
|
1161
1176
|
throw new Error(`Cannot load Prism plugin "${name}". Please check the spelling.`);
|
|
1162
1177
|
}
|
|
@@ -1196,7 +1211,7 @@ function markdownItPrism(markdownit, useroptions) {
|
|
|
1196
1211
|
}
|
|
1197
1212
|
|
|
1198
1213
|
// node/plugins/markdown-it-shiki.ts
|
|
1199
|
-
|
|
1214
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
1200
1215
|
function getThemeName(theme) {
|
|
1201
1216
|
if (typeof theme === "string")
|
|
1202
1217
|
return theme;
|
|
@@ -1218,7 +1233,7 @@ function resolveShikiOptions(options) {
|
|
|
1218
1233
|
themes.push(options.theme);
|
|
1219
1234
|
}
|
|
1220
1235
|
}
|
|
1221
|
-
return
|
|
1236
|
+
return _chunkIP7ZGKHIjs.__spreadProps.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {}, options), {
|
|
1222
1237
|
themes,
|
|
1223
1238
|
darkModeThemes: darkModeThemes ? {
|
|
1224
1239
|
dark: getThemeName(darkModeThemes.dark),
|
|
@@ -1256,7 +1271,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1256
1271
|
const setups = [];
|
|
1257
1272
|
const entryPath = _utils.slash.call(void 0, entry);
|
|
1258
1273
|
if (config.highlighter === "shiki") {
|
|
1259
|
-
const { getHighlighter } = await Promise.resolve().then(() =>
|
|
1274
|
+
const { getHighlighter } = await Promise.resolve().then(() => _chunkIP7ZGKHIjs.__toESM.call(void 0, _chunkIP7ZGKHIjs.__require.call(void 0, "shiki")));
|
|
1260
1275
|
const shikiOptions = await loadSetups(roots, "shiki.ts", Shiki, DEFAULT_SHIKI_OPTIONS, false);
|
|
1261
1276
|
const { langs, themes } = resolveShikiOptions(shikiOptions);
|
|
1262
1277
|
shikiOptions.highlighter = await getHighlighter({ themes, langs });
|
|
@@ -1265,11 +1280,11 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1265
1280
|
setups.push((md2) => md2.use(markdownItPrism));
|
|
1266
1281
|
}
|
|
1267
1282
|
const KatexOptions = await loadSetups(roots, "katex.ts", {}, { strict: false }, false);
|
|
1268
|
-
return
|
|
1283
|
+
return _vitepluginvuemarkdown2.default.call(void 0, _chunkIP7ZGKHIjs.__spreadProps.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {
|
|
1269
1284
|
wrapperClasses: "",
|
|
1270
1285
|
headEnabled: false,
|
|
1271
1286
|
frontmatter: false,
|
|
1272
|
-
markdownItOptions:
|
|
1287
|
+
markdownItOptions: _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {
|
|
1273
1288
|
quotes: `""''`,
|
|
1274
1289
|
html: true,
|
|
1275
1290
|
xhtmlOut: true,
|
|
@@ -1405,7 +1420,7 @@ function escapeVueInCode(md2) {
|
|
|
1405
1420
|
}
|
|
1406
1421
|
|
|
1407
1422
|
// node/plugins/patchTransform.ts
|
|
1408
|
-
|
|
1423
|
+
_chunkIP7ZGKHIjs.init_cjs_shims.call(void 0, );
|
|
1409
1424
|
|
|
1410
1425
|
function createFixPlugins(options) {
|
|
1411
1426
|
const define = _utils.objectEntries.call(void 0, getDefine(options));
|
|
@@ -1470,10 +1485,10 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1470
1485
|
clientRoot,
|
|
1471
1486
|
data: { config }
|
|
1472
1487
|
} = options;
|
|
1473
|
-
const VuePlugin = _pluginvue2.default.call(void 0,
|
|
1488
|
+
const VuePlugin = _pluginvue2.default.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {
|
|
1474
1489
|
include: [/\.vue$/, /\.md$/],
|
|
1475
1490
|
exclude: [],
|
|
1476
|
-
template:
|
|
1491
|
+
template: _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {
|
|
1477
1492
|
compilerOptions: {
|
|
1478
1493
|
isCustomElement(tag) {
|
|
1479
1494
|
return customElements.has(tag);
|
|
@@ -1488,7 +1503,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1488
1503
|
MarkdownPlugin,
|
|
1489
1504
|
VuePlugin,
|
|
1490
1505
|
createSlidesLoader(options, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin),
|
|
1491
|
-
|
|
1506
|
+
_vite6.default.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {
|
|
1492
1507
|
extensions: ["vue", "md", "ts"],
|
|
1493
1508
|
dirs: [
|
|
1494
1509
|
`${clientRoot}/builtin`,
|
|
@@ -1507,11 +1522,11 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1507
1522
|
})
|
|
1508
1523
|
]
|
|
1509
1524
|
}, componentsOptions)),
|
|
1510
|
-
|
|
1525
|
+
_vite4.default.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {
|
|
1511
1526
|
defaultClass: "slidev-icon",
|
|
1512
1527
|
autoInstall: true
|
|
1513
1528
|
}, iconsOptions)),
|
|
1514
|
-
config.remoteAssets === true || config.remoteAssets === mode ? _vitepluginremoteassets2.default.call(void 0,
|
|
1529
|
+
config.remoteAssets === true || config.remoteAssets === mode ? _vitepluginremoteassets2.default.call(void 0, _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {
|
|
1515
1530
|
rules: [
|
|
1516
1531
|
..._vitepluginremoteassets.DefaultRules,
|
|
1517
1532
|
{
|
|
@@ -1524,7 +1539,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1524
1539
|
}, remoteAssetsOptions)) : null,
|
|
1525
1540
|
_vitepluginvueserverref2.default.call(void 0, {
|
|
1526
1541
|
debug: process.env.NODE_ENV === "development",
|
|
1527
|
-
state:
|
|
1542
|
+
state: _chunkIP7ZGKHIjs.__spreadValues.call(void 0, {
|
|
1528
1543
|
sync: false,
|
|
1529
1544
|
nav: {
|
|
1530
1545
|
page: 0,
|
|
@@ -1552,4 +1567,5 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1552
1567
|
|
|
1553
1568
|
|
|
1554
1569
|
|
|
1555
|
-
|
|
1570
|
+
|
|
1571
|
+
exports.getIndexHtml = getIndexHtml; exports.mergeViteConfigs = mergeViteConfigs; exports.require_fast_deep_equal = require_fast_deep_equal; exports.createWindiCSSPlugin = createWindiCSSPlugin; exports.ViteSlidevPlugin = ViteSlidevPlugin;
|