@slidev/cli 0.35.5 → 0.36.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/dist/{build-RBCFVFDG.mjs → build-LS63HRWN.mjs} +53 -38
- package/dist/{build-PO2PXBSF.js → build-VLQNNPIA.js} +59 -44
- package/dist/{chunk-SQLX75IO.js → chunk-74QPSS6T.js} +12 -7
- package/dist/{chunk-AHXRM5NG.js → chunk-CG3QPKUJ.js} +199 -161
- package/dist/{chunk-QPGEWKWZ.mjs → chunk-DRWWOOWC.mjs} +141 -109
- package/dist/{chunk-GVA336JI.mjs → chunk-IAMILGBS.mjs} +12 -7
- package/dist/{chunk-ZJSOFQBR.js → chunk-L3B76JRZ.js} +181 -149
- package/dist/{chunk-SWNG6UPD.mjs → chunk-S3HDHTBQ.mjs} +69 -31
- package/dist/cli.js +301 -252
- package/dist/cli.mjs +296 -247
- package/dist/{export-U7F6XGP6.mjs → export-26FXNM7P.mjs} +1 -1
- package/dist/{export-JXFGVO7B.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 +19 -18
|
@@ -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 = _chunkSQLX75IOjs.__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`),
|
|
@@ -164,42 +164,44 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
|
|
|
164
164
|
if (config.default)
|
|
165
165
|
config = config.default;
|
|
166
166
|
config = await loadSetups(roots, "windicss.ts", {}, config, true);
|
|
167
|
-
return WindiCSS(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
config2.theme
|
|
173
|
-
|
|
174
|
-
config2.theme.extend
|
|
175
|
-
|
|
176
|
-
config2.theme.extend.fontFamily
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
167
|
+
return WindiCSS(
|
|
168
|
+
{
|
|
169
|
+
configFiles: [configFile],
|
|
170
|
+
config,
|
|
171
|
+
onConfigResolved(config2) {
|
|
172
|
+
if (!config2.theme)
|
|
173
|
+
config2.theme = {};
|
|
174
|
+
if (!config2.theme.extend)
|
|
175
|
+
config2.theme.extend = {};
|
|
176
|
+
if (!config2.theme.extend.fontFamily)
|
|
177
|
+
config2.theme.extend.fontFamily = {};
|
|
178
|
+
const fontFamily = config2.theme.extend.fontFamily;
|
|
179
|
+
fontFamily.sans || (fontFamily.sans = data.config.fonts.sans.join(","));
|
|
180
|
+
fontFamily.mono || (fontFamily.mono = data.config.fonts.mono.join(","));
|
|
181
|
+
fontFamily.serif || (fontFamily.serif = data.config.fonts.serif.join(","));
|
|
182
|
+
return config2;
|
|
183
|
+
},
|
|
184
|
+
onOptionsResolved(config2) {
|
|
185
|
+
themeRoots.forEach((i) => {
|
|
186
|
+
config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
|
|
187
|
+
config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
|
|
188
|
+
});
|
|
189
|
+
addonRoots.forEach((i) => {
|
|
190
|
+
config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
|
|
191
|
+
config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
|
|
192
|
+
});
|
|
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, _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
|
+
},
|
|
198
|
+
...windiOptions
|
|
199
|
+
}
|
|
200
|
+
);
|
|
199
201
|
}
|
|
200
202
|
|
|
201
203
|
// node/plugins/preset.ts
|
|
202
|
-
|
|
204
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
203
205
|
|
|
204
206
|
var _pluginvue = require('@vitejs/plugin-vue'); var _pluginvue2 = _interopRequireDefault(_pluginvue);
|
|
205
207
|
var _vite3 = require('unplugin-icons/vite'); var _vite4 = _interopRequireDefault(_vite3);
|
|
@@ -208,14 +210,18 @@ var _vite5 = require('unplugin-vue-components/vite'); var _vite6 = _interopRequi
|
|
|
208
210
|
var _vitepluginremoteassets = require('vite-plugin-remote-assets'); var _vitepluginremoteassets2 = _interopRequireDefault(_vitepluginremoteassets);
|
|
209
211
|
var _vitepluginvueserverref = require('vite-plugin-vue-server-ref'); var _vitepluginvueserverref2 = _interopRequireDefault(_vitepluginvueserverref);
|
|
210
212
|
|
|
213
|
+
var _viteplugininspect = require('vite-plugin-inspect'); var _viteplugininspect2 = _interopRequireDefault(_viteplugininspect);
|
|
211
214
|
|
|
212
215
|
// node/drawings.ts
|
|
213
|
-
|
|
216
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
214
217
|
|
|
215
218
|
|
|
216
219
|
var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);
|
|
217
220
|
function resolveDrawingsDir(options) {
|
|
218
|
-
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;
|
|
219
225
|
}
|
|
220
226
|
async function loadDrawings(options) {
|
|
221
227
|
const dir = resolveDrawingsDir(options);
|
|
@@ -246,18 +252,20 @@ async function writeDrawings(options, drawing) {
|
|
|
246
252
|
const height = Math.round(width / options.data.config.aspectRatio);
|
|
247
253
|
const SVG_HEAD = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">`;
|
|
248
254
|
await _fsextra2.default.ensureDir(dir);
|
|
249
|
-
return Promise.all(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
255
|
+
return Promise.all(
|
|
256
|
+
Object.entries(drawing).map(async ([key, value]) => {
|
|
257
|
+
if (!value)
|
|
258
|
+
return;
|
|
259
|
+
const svg = `${SVG_HEAD}
|
|
253
260
|
${value}
|
|
254
261
|
</svg>`;
|
|
255
|
-
|
|
256
|
-
|
|
262
|
+
await _fsextra2.default.writeFile(_path.join.call(void 0, dir, `${key}.svg`), svg, "utf-8");
|
|
263
|
+
})
|
|
264
|
+
);
|
|
257
265
|
}
|
|
258
266
|
|
|
259
267
|
// node/plugins/extendConfig.ts
|
|
260
|
-
|
|
268
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
261
269
|
|
|
262
270
|
|
|
263
271
|
var _isinstalledglobally = require('is-installed-globally'); var _isinstalledglobally2 = _interopRequireDefault(_isinstalledglobally);
|
|
@@ -268,34 +276,34 @@ var dependencies = {
|
|
|
268
276
|
"@antfu/utils": "^0.5.2",
|
|
269
277
|
"@slidev/parser": "workspace:*",
|
|
270
278
|
"@slidev/types": "workspace:*",
|
|
271
|
-
"@unocss/reset": "^0.45.
|
|
272
|
-
"@vueuse/core": "^9.
|
|
273
|
-
"@vueuse/head": "^0.7.
|
|
274
|
-
"@vueuse/math": "^9.
|
|
275
|
-
"@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",
|
|
276
284
|
codemirror: "^5.65.5",
|
|
277
|
-
defu: "^6.
|
|
278
|
-
drauu: "^0.3.
|
|
285
|
+
defu: "^6.1.0",
|
|
286
|
+
drauu: "^0.3.1",
|
|
279
287
|
"file-saver": "^2.0.5",
|
|
280
288
|
"js-base64": "^3.7.2",
|
|
281
289
|
"js-yaml": "^4.1.0",
|
|
282
|
-
katex: "^0.16.
|
|
283
|
-
mermaid: "^9.1.
|
|
284
|
-
"monaco-editor": "^0.
|
|
290
|
+
katex: "^0.16.2",
|
|
291
|
+
mermaid: "^9.1.6",
|
|
292
|
+
"monaco-editor": "^0.33.0",
|
|
285
293
|
nanoid: "^4.0.0",
|
|
286
294
|
prettier: "^2.7.1",
|
|
287
295
|
recordrtc: "^5.6.2",
|
|
288
296
|
resolve: "^1.22.1",
|
|
289
|
-
unocss: "^0.45.
|
|
290
|
-
"vite-plugin-windicss": "^1.8.
|
|
291
|
-
vue: "^3.2.
|
|
292
|
-
"vue-router": "^4.1.
|
|
297
|
+
unocss: "^0.45.20",
|
|
298
|
+
"vite-plugin-windicss": "^1.8.8",
|
|
299
|
+
vue: "^3.2.39",
|
|
300
|
+
"vue-router": "^4.1.5",
|
|
293
301
|
"vue-starport": "^0.3.0",
|
|
294
302
|
windicss: "^3.5.6"
|
|
295
303
|
};
|
|
296
304
|
|
|
297
305
|
// node/vite/searchRoot.ts
|
|
298
|
-
|
|
306
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
299
307
|
|
|
300
308
|
|
|
301
309
|
var ROOT_FILES = [
|
|
@@ -360,7 +368,7 @@ function createConfigPlugin(options) {
|
|
|
360
368
|
define: getDefine(options),
|
|
361
369
|
resolve: {
|
|
362
370
|
alias: {
|
|
363
|
-
"@slidev/client/": `${
|
|
371
|
+
"@slidev/client/": `${_chunk74QPSS6Tjs.toAtFS.call(void 0, options.clientRoot)}/`
|
|
364
372
|
}
|
|
365
373
|
},
|
|
366
374
|
optimizeDeps: {
|
|
@@ -384,7 +392,7 @@ function createConfigPlugin(options) {
|
|
|
384
392
|
css: options.data.config.css === "unocss" ? {
|
|
385
393
|
postcss: {
|
|
386
394
|
plugins: [
|
|
387
|
-
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())
|
|
388
396
|
]
|
|
389
397
|
}
|
|
390
398
|
} : {},
|
|
@@ -394,7 +402,7 @@ function createConfigPlugin(options) {
|
|
|
394
402
|
allow: _utils.uniq.call(void 0, [
|
|
395
403
|
searchForWorkspaceRoot(options.userRoot),
|
|
396
404
|
searchForWorkspaceRoot(options.cliRoot),
|
|
397
|
-
..._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"))] : []
|
|
398
406
|
])
|
|
399
407
|
}
|
|
400
408
|
}
|
|
@@ -403,7 +411,7 @@ function createConfigPlugin(options) {
|
|
|
403
411
|
injection.cacheDir = _path.join.call(void 0, options.cliRoot, "node_modules/.vite");
|
|
404
412
|
injection.publicDir = _path.join.call(void 0, options.userRoot, "public");
|
|
405
413
|
injection.root = options.cliRoot;
|
|
406
|
-
injection.resolve.alias.vue = `${
|
|
414
|
+
injection.resolve.alias.vue = `${_chunk74QPSS6Tjs.resolveImportPath.call(void 0, "vue/dist/vue.esm-browser.js", true)}`;
|
|
407
415
|
}
|
|
408
416
|
return _vite.mergeConfig.call(void 0, config, injection);
|
|
409
417
|
},
|
|
@@ -424,7 +432,7 @@ function createConfigPlugin(options) {
|
|
|
424
432
|
}
|
|
425
433
|
function getDefine(options) {
|
|
426
434
|
return {
|
|
427
|
-
__SLIDEV_CLIENT_ROOT__: JSON.stringify(
|
|
435
|
+
__SLIDEV_CLIENT_ROOT__: JSON.stringify(_chunk74QPSS6Tjs.toAtFS.call(void 0, options.clientRoot)),
|
|
428
436
|
__SLIDEV_HASH_ROUTE__: JSON.stringify(options.data.config.routerMode === "hash"),
|
|
429
437
|
__SLIDEV_FEATURE_DRAWINGS__: JSON.stringify(options.data.config.drawings.enabled === true || options.data.config.drawings.enabled === options.mode),
|
|
430
438
|
__SLIDEV_FEATURE_DRAWINGS_PERSIST__: JSON.stringify(!!options.data.config.drawings.persist === true),
|
|
@@ -434,8 +442,8 @@ function getDefine(options) {
|
|
|
434
442
|
}
|
|
435
443
|
|
|
436
444
|
// node/plugins/loaders.ts
|
|
437
|
-
|
|
438
|
-
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());
|
|
439
447
|
|
|
440
448
|
|
|
441
449
|
|
|
@@ -554,22 +562,25 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
554
562
|
Object.assign(data, newData);
|
|
555
563
|
if (hmrPages.size > 0)
|
|
556
564
|
moduleIds.add("/@slidev/titles.md");
|
|
557
|
-
const vueModules = (await Promise.all(
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
565
|
+
const vueModules = (await Promise.all(
|
|
566
|
+
Array.from(hmrPages).map(async (i) => {
|
|
567
|
+
var _a2;
|
|
568
|
+
const file = `${slidePrefix}${i + 1}.md`;
|
|
569
|
+
try {
|
|
570
|
+
const md2 = await transformMarkdown(await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file), i, newData);
|
|
571
|
+
const handleHotUpdate = "handler" in VuePlugin.handleHotUpdate ? VuePlugin.handleHotUpdate.handler : VuePlugin.handleHotUpdate;
|
|
572
|
+
return await handleHotUpdate({
|
|
573
|
+
...ctx,
|
|
574
|
+
modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
|
|
575
|
+
file,
|
|
576
|
+
read() {
|
|
577
|
+
return md2;
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
} catch (e3) {
|
|
581
|
+
}
|
|
582
|
+
})
|
|
583
|
+
)).flatMap((i) => i || []);
|
|
573
584
|
hmrPages.clear();
|
|
574
585
|
const moduleEntries = [
|
|
575
586
|
...vueModules,
|
|
@@ -687,7 +698,7 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
687
698
|
delete frontmatter.title;
|
|
688
699
|
const imports = [
|
|
689
700
|
'import { inject as vueInject } from "vue"',
|
|
690
|
-
`import InjectedLayout from "${
|
|
701
|
+
`import InjectedLayout from "${_chunk74QPSS6Tjs.toAtFS.call(void 0, layouts[layoutName])}"`,
|
|
691
702
|
'import { injectionSlidevContext } from "@slidev/client/constants"',
|
|
692
703
|
`const frontmatter = ${JSON.stringify(frontmatter)}`,
|
|
693
704
|
"const $slidev = vueInject(injectionSlidevContext)"
|
|
@@ -792,9 +803,9 @@ defineProps<{ no: number | string }>()`);
|
|
|
792
803
|
}
|
|
793
804
|
async function generateUserStyles() {
|
|
794
805
|
const imports = [
|
|
795
|
-
`import "${
|
|
796
|
-
`import "${
|
|
797
|
-
`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"))}"`
|
|
798
809
|
];
|
|
799
810
|
const roots2 = _utils.uniq.call(void 0, [
|
|
800
811
|
...themeRoots,
|
|
@@ -811,19 +822,30 @@ defineProps<{ no: number | string }>()`);
|
|
|
811
822
|
];
|
|
812
823
|
for (const style of styles) {
|
|
813
824
|
if (_fsextra.existsSync.call(void 0, style)) {
|
|
814
|
-
imports.push(`import "${
|
|
825
|
+
imports.push(`import "${_chunk74QPSS6Tjs.toAtFS.call(void 0, style)}"`);
|
|
815
826
|
continue;
|
|
816
827
|
}
|
|
817
828
|
}
|
|
818
829
|
}
|
|
819
830
|
if (data.features.katex)
|
|
820
|
-
imports.push(`import "${
|
|
831
|
+
imports.push(`import "${_chunk74QPSS6Tjs.toAtFS.call(void 0, _chunk74QPSS6Tjs.resolveImportPath.call(void 0, "katex/dist/katex.min.css", true))}"`);
|
|
821
832
|
if (data.config.css === "unocss") {
|
|
822
|
-
imports.unshift(
|
|
833
|
+
imports.unshift(
|
|
834
|
+
'import "@unocss/reset/tailwind.css"',
|
|
835
|
+
'import "uno:preflights.css"',
|
|
836
|
+
'import "uno:typography.css"',
|
|
837
|
+
'import "uno:shortcuts.css"'
|
|
838
|
+
);
|
|
823
839
|
imports.push('import "uno.css"');
|
|
824
840
|
} else {
|
|
825
|
-
imports.unshift(
|
|
826
|
-
|
|
841
|
+
imports.unshift(
|
|
842
|
+
'import "virtual:windi-components.css"',
|
|
843
|
+
'import "virtual:windi-base.css"'
|
|
844
|
+
);
|
|
845
|
+
imports.push(
|
|
846
|
+
'import "virtual:windi-utilities.css"',
|
|
847
|
+
'import "virtual:windi-devtools"'
|
|
848
|
+
);
|
|
827
849
|
}
|
|
828
850
|
return imports.join("\n");
|
|
829
851
|
}
|
|
@@ -832,10 +854,13 @@ defineProps<{ no: number | string }>()`);
|
|
|
832
854
|
}
|
|
833
855
|
async function generateLayouts() {
|
|
834
856
|
const imports = [];
|
|
835
|
-
const layouts = _utils.objectMap.call(void 0,
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
857
|
+
const layouts = _utils.objectMap.call(void 0,
|
|
858
|
+
await getLayouts(),
|
|
859
|
+
(k, v) => {
|
|
860
|
+
imports.push(`import __layout_${k} from "${_chunk74QPSS6Tjs.toAtFS.call(void 0, v)}"`);
|
|
861
|
+
return [k, `__layout_${k}`];
|
|
862
|
+
}
|
|
863
|
+
);
|
|
839
864
|
return [
|
|
840
865
|
imports.join("\n"),
|
|
841
866
|
`export default {
|
|
@@ -881,7 +906,7 @@ ${routes.join(",\n")}
|
|
|
881
906
|
const config = { ...data.config, remote };
|
|
882
907
|
if (_utils.isString.call(void 0, config.title)) {
|
|
883
908
|
const tokens = md.parseInline(config.title, {});
|
|
884
|
-
config.title =
|
|
909
|
+
config.title = _chunk74QPSS6Tjs.stringifyMarkdownTokens.call(void 0, tokens);
|
|
885
910
|
}
|
|
886
911
|
if (_utils.isString.call(void 0, config.info))
|
|
887
912
|
config.info = md.render(config.info);
|
|
@@ -902,7 +927,7 @@ ${routes.join(",\n")}
|
|
|
902
927
|
];
|
|
903
928
|
}
|
|
904
929
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
905
|
-
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");
|
|
906
931
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
907
932
|
return `
|
|
908
933
|
${imports}
|
|
@@ -921,7 +946,7 @@ export default {
|
|
|
921
946
|
_path.join.call(void 0, root, "CustomNavControls.vue")
|
|
922
947
|
];
|
|
923
948
|
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
924
|
-
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");
|
|
925
950
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
926
951
|
return `
|
|
927
952
|
${imports}
|
|
@@ -936,7 +961,7 @@ export default {
|
|
|
936
961
|
}
|
|
937
962
|
|
|
938
963
|
// node/plugins/monacoTransform.ts
|
|
939
|
-
|
|
964
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
940
965
|
|
|
941
966
|
|
|
942
967
|
|
|
@@ -970,7 +995,7 @@ function createMonacoTypesLoader() {
|
|
|
970
995
|
}
|
|
971
996
|
|
|
972
997
|
// node/plugins/setupClient.ts
|
|
973
|
-
|
|
998
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
974
999
|
|
|
975
1000
|
|
|
976
1001
|
|
|
@@ -981,10 +1006,13 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
|
|
|
981
1006
|
enforce: "pre",
|
|
982
1007
|
async transform(code, id) {
|
|
983
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;
|
|
984
1013
|
const name = id.slice(setupEntry.length + 1);
|
|
985
1014
|
const imports = [];
|
|
986
1015
|
const injections = [];
|
|
987
|
-
const asyncInjections = [];
|
|
988
1016
|
const setups = _utils.uniq.call(void 0, [
|
|
989
1017
|
...themeRoots,
|
|
990
1018
|
...addonRoots,
|
|
@@ -993,36 +1021,29 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
|
|
|
993
1021
|
setups.forEach((path, idx) => {
|
|
994
1022
|
if (!_fs.existsSync.call(void 0, path))
|
|
995
1023
|
return;
|
|
996
|
-
imports.push(`import __n${idx} from '${
|
|
997
|
-
let fn =
|
|
998
|
-
|
|
999
|
-
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))
|
|
1000
1027
|
fn = `injection_return = ${fn}`;
|
|
1001
|
-
awaitFn = `injection_return = ${awaitFn}`;
|
|
1002
|
-
}
|
|
1003
1028
|
if (/\binjection_arg\b/g.test(code)) {
|
|
1004
1029
|
fn += "(";
|
|
1005
|
-
awaitFn += "(";
|
|
1006
1030
|
const matches = Array.from(code.matchAll(/\binjection_arg(_\d+)?\b/g));
|
|
1007
1031
|
const dedupedMatches = Array.from(new Set(matches.map((m) => m[0])));
|
|
1008
|
-
dedupedMatches.
|
|
1009
|
-
|
|
1010
|
-
const arg = key + (isLast ? "" : ",");
|
|
1011
|
-
fn += arg;
|
|
1012
|
-
awaitFn += arg;
|
|
1013
|
-
});
|
|
1014
|
-
fn += ")";
|
|
1015
|
-
awaitFn += ")";
|
|
1032
|
+
fn += dedupedMatches.join(", ");
|
|
1033
|
+
fn += ", :LAST:)";
|
|
1016
1034
|
} else {
|
|
1017
|
-
fn += "()";
|
|
1018
|
-
awaitFn += "()";
|
|
1035
|
+
fn += "(:LAST:)";
|
|
1019
1036
|
}
|
|
1020
|
-
injections.push(
|
|
1021
|
-
|
|
1037
|
+
injections.push(
|
|
1038
|
+
`// ${path}`,
|
|
1039
|
+
fn
|
|
1040
|
+
);
|
|
1022
1041
|
});
|
|
1023
1042
|
code = code.replace("/* __imports__ */", imports.join("\n"));
|
|
1024
|
-
code = code.replace("/* __injections__ */",
|
|
1025
|
-
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));
|
|
1026
1047
|
return code;
|
|
1027
1048
|
}
|
|
1028
1049
|
return null;
|
|
@@ -1031,7 +1052,7 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
|
|
|
1031
1052
|
}
|
|
1032
1053
|
|
|
1033
1054
|
// node/plugins/markdown.ts
|
|
1034
|
-
|
|
1055
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1035
1056
|
var _vitepluginvuemarkdown = require('vite-plugin-vue-markdown'); var _vitepluginvuemarkdown2 = _interopRequireDefault(_vitepluginvuemarkdown);
|
|
1036
1057
|
var _jsbase64 = require('js-base64'); var base64 = _interopRequireWildcard(_jsbase64);
|
|
1037
1058
|
|
|
@@ -1042,7 +1063,7 @@ var _shiki = require('shiki'); var Shiki = _interopRequireWildcard(_shiki);
|
|
|
1042
1063
|
var _plantumlencoder = require('plantuml-encoder');
|
|
1043
1064
|
|
|
1044
1065
|
// node/plugins/markdown-it-katex.ts
|
|
1045
|
-
|
|
1066
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1046
1067
|
var _katex = require('katex'); var _katex2 = _interopRequireDefault(_katex);
|
|
1047
1068
|
function isValidDelim(state, pos) {
|
|
1048
1069
|
const max = state.posMax;
|
|
@@ -1189,7 +1210,7 @@ function math_plugin(md2, options) {
|
|
|
1189
1210
|
}
|
|
1190
1211
|
|
|
1191
1212
|
// node/plugins/markdown-it-prism.ts
|
|
1192
|
-
|
|
1213
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1193
1214
|
var _prismjs = require('prismjs'); var _prismjs2 = _interopRequireDefault(_prismjs);
|
|
1194
1215
|
var _ = require('prismjs/components/'); var _2 = _interopRequireDefault(_);
|
|
1195
1216
|
var DEFAULTS = {
|
|
@@ -1212,7 +1233,7 @@ function loadPrismLang(lang) {
|
|
|
1212
1233
|
}
|
|
1213
1234
|
function loadPrismPlugin(name) {
|
|
1214
1235
|
try {
|
|
1215
|
-
|
|
1236
|
+
_chunk74QPSS6Tjs.__require.call(void 0, `prismjs/plugins/${name}/prism-${name}`);
|
|
1216
1237
|
} catch (e) {
|
|
1217
1238
|
throw new Error(`Cannot load Prism plugin "${name}". Please check the spelling.`);
|
|
1218
1239
|
}
|
|
@@ -1252,7 +1273,7 @@ function markdownItPrism(markdownit, useroptions) {
|
|
|
1252
1273
|
}
|
|
1253
1274
|
|
|
1254
1275
|
// node/plugins/markdown-it-shiki.ts
|
|
1255
|
-
|
|
1276
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1256
1277
|
function getThemeName(theme) {
|
|
1257
1278
|
if (typeof theme === "string")
|
|
1258
1279
|
return theme;
|
|
@@ -1296,7 +1317,9 @@ var MarkdownItShiki = (markdownit, options = {}) => {
|
|
|
1296
1317
|
const light = _highlighter.codeToHtml(trimmed, { lang: lang || "text", theme: darkModeThemes.light }).replace('<pre class="shiki"', '<pre class="slidev-code shiki shiki-light"');
|
|
1297
1318
|
return escapeVueInCode(`<pre class="shiki-container">${dark}${light}</pre>`);
|
|
1298
1319
|
} else {
|
|
1299
|
-
return escapeVueInCode(
|
|
1320
|
+
return escapeVueInCode(
|
|
1321
|
+
_highlighter.codeToHtml(code, { lang: lang || "text" }).replace('<pre class="shiki"', '<pre class="slidev-code shiki"')
|
|
1322
|
+
);
|
|
1300
1323
|
}
|
|
1301
1324
|
};
|
|
1302
1325
|
};
|
|
@@ -1313,7 +1336,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1313
1336
|
const setups = [];
|
|
1314
1337
|
const entryPath = _utils.slash.call(void 0, entry);
|
|
1315
1338
|
if (config.highlighter === "shiki") {
|
|
1316
|
-
const { getHighlighter } = await Promise.resolve().then(() =>
|
|
1339
|
+
const { getHighlighter } = await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "shiki")));
|
|
1317
1340
|
const shikiOptions = await loadSetups(roots, "shiki.ts", Shiki, DEFAULT_SHIKI_OPTIONS, false);
|
|
1318
1341
|
const { langs, themes } = resolveShikiOptions(shikiOptions);
|
|
1319
1342
|
shikiOptions.highlighter = await getHighlighter({ themes, langs });
|
|
@@ -1434,14 +1457,17 @@ function transformPageCSS(md2, id) {
|
|
|
1434
1457
|
if (!page)
|
|
1435
1458
|
return md2;
|
|
1436
1459
|
const { isInsideCodeblocks } = getCodeBlocks(md2);
|
|
1437
|
-
const result = md2.replace(
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1460
|
+
const result = md2.replace(
|
|
1461
|
+
/(\n<style[^>]*?>)([\s\S]+?)(<\/style>)/g,
|
|
1462
|
+
(full, start, css, end, index) => {
|
|
1463
|
+
if (index < 0 || isInsideCodeblocks(index))
|
|
1464
|
+
return full;
|
|
1465
|
+
if (!start.includes("scoped"))
|
|
1466
|
+
start = start.replace("<style", "<style scoped");
|
|
1467
|
+
return `${start}
|
|
1443
1468
|
${css}${end}`;
|
|
1444
|
-
|
|
1469
|
+
}
|
|
1470
|
+
);
|
|
1445
1471
|
return result;
|
|
1446
1472
|
}
|
|
1447
1473
|
function transformMermaid(md2) {
|
|
@@ -1464,7 +1490,7 @@ function escapeVueInCode(md2) {
|
|
|
1464
1490
|
}
|
|
1465
1491
|
|
|
1466
1492
|
// node/plugins/patchTransform.ts
|
|
1467
|
-
|
|
1493
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1468
1494
|
|
|
1469
1495
|
function createFixPlugins(options) {
|
|
1470
1496
|
const define = _utils.objectEntries.call(void 0, getDefine(options));
|
|
@@ -1473,11 +1499,13 @@ function createFixPlugins(options) {
|
|
|
1473
1499
|
name: "slidev:flags",
|
|
1474
1500
|
enforce: "pre",
|
|
1475
1501
|
transform(code, id) {
|
|
1476
|
-
if (id.
|
|
1502
|
+
if (id.match(/\.vue($|\?)/)) {
|
|
1503
|
+
const original = code;
|
|
1477
1504
|
define.forEach(([from, to]) => {
|
|
1478
1505
|
code = code.replace(new RegExp(from, "g"), to);
|
|
1479
1506
|
});
|
|
1480
|
-
|
|
1507
|
+
if (original !== code)
|
|
1508
|
+
return code;
|
|
1481
1509
|
}
|
|
1482
1510
|
}
|
|
1483
1511
|
}
|
|
@@ -1485,14 +1513,14 @@ function createFixPlugins(options) {
|
|
|
1485
1513
|
}
|
|
1486
1514
|
|
|
1487
1515
|
// node/plugins/unocss.ts
|
|
1488
|
-
|
|
1516
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
1489
1517
|
|
|
1490
1518
|
|
|
1491
1519
|
|
|
1492
1520
|
|
|
1493
1521
|
async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, data }, { unocss: unoOptions }) {
|
|
1494
1522
|
var _a, _b, _c, _d;
|
|
1495
|
-
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);
|
|
1496
1524
|
const configFiles = _utils.uniq.call(void 0, [
|
|
1497
1525
|
...themeRoots.map((i) => `${i}/uno.config.ts`),
|
|
1498
1526
|
...addonRoots.map((i) => `${i}/uno.config.ts`),
|
|
@@ -1638,7 +1666,11 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1638
1666
|
createConfigPlugin(options),
|
|
1639
1667
|
createClientSetupPlugin(options),
|
|
1640
1668
|
createMonacoTypesLoader(),
|
|
1641
|
-
createFixPlugins(options)
|
|
1669
|
+
createFixPlugins(options),
|
|
1670
|
+
options.inspect ? _viteplugininspect2.default.call(void 0, {
|
|
1671
|
+
dev: true,
|
|
1672
|
+
build: true
|
|
1673
|
+
}) : null
|
|
1642
1674
|
].flat().filter(_utils.notNullish);
|
|
1643
1675
|
}
|
|
1644
1676
|
|