@slidev/cli 0.29.0 → 0.30.0
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-NHXJRHBN.mjs → build-C73NWEPF.mjs} +5 -5
- package/dist/{build-VM52TR6Q.js → build-ZQJFWYTE.js} +12 -12
- package/dist/{chunk-G22DGVU7.mjs → chunk-46RYGQQC.mjs} +2 -2
- package/dist/{chunk-UEIFQWPY.mjs → chunk-4AVLCCHB.mjs} +81 -15
- package/dist/{chunk-7F2QYO53.js → chunk-7FQD47HM.js} +133 -67
- package/dist/{chunk-5BL2KALH.js → chunk-HBDQZUZK.js} +4 -4
- package/dist/{chunk-7QXPSYEZ.js → chunk-IXNT7VMK.js} +16 -16
- package/dist/{chunk-WMQA2JLO.mjs → chunk-KZHGLGA5.mjs} +1868 -1896
- package/dist/{chunk-VYBQLH2X.mjs → chunk-XMETW2MS.mjs} +12 -16
- package/dist/{chunk-OOHN7CTS.js → chunk-ZDBME6IC.js} +1962 -1989
- package/dist/cli.js +29 -28
- package/dist/cli.mjs +12 -11
- package/dist/{export-OVSG7H7S.mjs → export-OZQCWKXN.mjs} +69 -64
- package/dist/{export-GML5GDLW.js → export-SQVJKP3A.js} +69 -64
- package/dist/index.js +7 -7
- package/dist/index.mjs +4 -4
- package/package.json +17 -18
- package/template.md +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
getIndexHtml
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4AVLCCHB.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__require,
|
|
7
7
|
__spreadValues,
|
|
8
|
-
|
|
8
|
+
__toESM,
|
|
9
9
|
init_esm_shims
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XMETW2MS.mjs";
|
|
11
11
|
|
|
12
12
|
// node/build.ts
|
|
13
13
|
init_esm_shims();
|
|
@@ -37,7 +37,7 @@ function totalist(dir, callback, pre = "") {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
// ../../node_modules/.pnpm/@polka+url@1.0.0-next.
|
|
40
|
+
// ../../node_modules/.pnpm/@polka+url@1.0.0-next.21/node_modules/@polka/url/build.mjs
|
|
41
41
|
init_esm_shims();
|
|
42
42
|
import * as qs from "querystring";
|
|
43
43
|
function parse2(req) {
|
|
@@ -710,7 +710,7 @@ async function build(options, viteConfig = {}) {
|
|
|
710
710
|
await fs2.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
711
711
|
`, "utf-8");
|
|
712
712
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
713
|
-
const { exportSlides } = await Promise.resolve().then(() =>
|
|
713
|
+
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-OZQCWKXN.mjs")));
|
|
714
714
|
const port = 12445;
|
|
715
715
|
const app = connect();
|
|
716
716
|
const server = http.createServer(app);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk7FQD47HMjs = require('./chunk-7FQD47HM.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkIXNT7VMKjs = require('./chunk-IXNT7VMK.js');
|
|
11
11
|
|
|
12
12
|
// node/build.ts
|
|
13
|
-
|
|
13
|
+
_chunkIXNT7VMKjs.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
|
+
_chunkIXNT7VMKjs.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
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
function totalist(dir, callback, pre = "") {
|
|
@@ -37,8 +37,8 @@ function totalist(dir, callback, pre = "") {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
// ../../node_modules/.pnpm/@polka+url@1.0.0-next.
|
|
41
|
-
|
|
40
|
+
// ../../node_modules/.pnpm/@polka+url@1.0.0-next.21/node_modules/@polka/url/build.mjs
|
|
41
|
+
_chunkIXNT7VMKjs.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
|
+
_chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
|
|
66
66
|
var mimes = {
|
|
67
67
|
"ez": "application/andrew-inset",
|
|
68
68
|
"aw": "application/applixware",
|
|
@@ -527,7 +527,7 @@ function is404(req, res) {
|
|
|
527
527
|
}
|
|
528
528
|
function send(req, res, file, stats, headers) {
|
|
529
529
|
let code = 200, tmp, opts = {};
|
|
530
|
-
headers =
|
|
530
|
+
headers = _chunkIXNT7VMKjs.__spreadValues.call(void 0, {}, headers);
|
|
531
531
|
for (let key in headers) {
|
|
532
532
|
tmp = res.getHeader(key);
|
|
533
533
|
if (tmp)
|
|
@@ -655,12 +655,12 @@ async function build(options, viteConfig = {}) {
|
|
|
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 _chunk7FQD47HMjs.getIndexHtml.call(void 0, options), "utf-8");
|
|
659
659
|
let config = void 0;
|
|
660
660
|
try {
|
|
661
661
|
const inlineConfig = _vite.mergeConfig.call(void 0, viteConfig, {
|
|
662
662
|
plugins: [
|
|
663
|
-
await
|
|
663
|
+
await _chunk7FQD47HMjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
|
|
664
664
|
{
|
|
665
665
|
name: "resolve-config",
|
|
666
666
|
configResolved(_config) {
|
|
@@ -710,7 +710,7 @@ async function build(options, viteConfig = {}) {
|
|
|
710
710
|
await _fsextra2.default.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
711
711
|
`, "utf-8");
|
|
712
712
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
713
|
-
const { exportSlides } = await Promise.resolve().then(() =>
|
|
713
|
+
const { exportSlides } = await Promise.resolve().then(() => _chunkIXNT7VMKjs.__toESM.call(void 0, _chunkIXNT7VMKjs.__require.call(void 0, "./export-SQVJKP3A.js")));
|
|
714
714
|
const port = 12445;
|
|
715
715
|
const app = _connect2.default.call(void 0, );
|
|
716
716
|
const server = _http2.default.createServer(app);
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
__require,
|
|
5
5
|
__spreadProps,
|
|
6
6
|
__spreadValues,
|
|
7
|
-
|
|
7
|
+
__toESM,
|
|
8
8
|
generateGoogleFontsUrl,
|
|
9
9
|
init_esm_shims,
|
|
10
10
|
resolveGlobalImportPath,
|
|
11
11
|
resolveImportPath,
|
|
12
12
|
stringifyMarkdownTokens,
|
|
13
13
|
toAtFS
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XMETW2MS.mjs";
|
|
15
15
|
|
|
16
16
|
// ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
|
|
17
17
|
var require_fast_deep_equal = __commonJS({
|
|
@@ -240,27 +240,29 @@ import { uniq as uniq3 } from "@antfu/utils";
|
|
|
240
240
|
|
|
241
241
|
// ../client/package.json
|
|
242
242
|
var dependencies = {
|
|
243
|
-
"@antfu/utils": "^0.5.
|
|
243
|
+
"@antfu/utils": "^0.5.1",
|
|
244
244
|
"@slidev/parser": "workspace:*",
|
|
245
245
|
"@slidev/types": "workspace:*",
|
|
246
|
-
"@vueuse/core": "^8.
|
|
246
|
+
"@vueuse/core": "^8.2.5",
|
|
247
247
|
"@vueuse/head": "^0.7.5",
|
|
248
|
-
"@vueuse/motion": "^2.0.0-beta.
|
|
248
|
+
"@vueuse/motion": "^2.0.0-beta.18",
|
|
249
249
|
codemirror: "^5.65.2",
|
|
250
|
+
defu: "^6.0.0",
|
|
250
251
|
drauu: "^0.3.0",
|
|
251
252
|
"file-saver": "^2.0.5",
|
|
252
253
|
"js-base64": "^3.7.2",
|
|
253
254
|
"js-yaml": "^4.1.0",
|
|
254
255
|
katex: "^0.15.3",
|
|
255
|
-
mermaid: "^
|
|
256
|
+
mermaid: "^9.0.0",
|
|
256
257
|
"monaco-editor": "^0.33.0",
|
|
257
|
-
nanoid: "^3.3.
|
|
258
|
-
prettier: "^2.6.
|
|
258
|
+
nanoid: "^3.3.2",
|
|
259
|
+
prettier: "^2.6.2",
|
|
259
260
|
recordrtc: "^5.6.2",
|
|
260
261
|
resolve: "^1.22.0",
|
|
261
|
-
"vite-plugin-windicss": "^1.8.
|
|
262
|
-
vue: "^3.2.
|
|
262
|
+
"vite-plugin-windicss": "^1.8.4",
|
|
263
|
+
vue: "^3.2.32",
|
|
263
264
|
"vue-router": "^4.0.14",
|
|
265
|
+
"vue-starport": "^0.2.4",
|
|
264
266
|
windicss: "^3.5.1"
|
|
265
267
|
};
|
|
266
268
|
|
|
@@ -392,7 +394,7 @@ function getDefine(options) {
|
|
|
392
394
|
|
|
393
395
|
// node/plugins/loaders.ts
|
|
394
396
|
init_esm_shims();
|
|
395
|
-
var import_fast_deep_equal =
|
|
397
|
+
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
|
396
398
|
import { basename as basename2, join as join5 } from "path";
|
|
397
399
|
import { isString, notNullish, objectMap, range, slash as slash2, uniq as uniq4 } from "@antfu/utils";
|
|
398
400
|
import fg2 from "fast-glob";
|
|
@@ -593,6 +595,15 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
|
|
|
593
595
|
const pageNo = parseInt(no) - 1;
|
|
594
596
|
return transformMarkdown(code, pageNo, data);
|
|
595
597
|
}
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: "slidev:context-transform:pre",
|
|
601
|
+
enforce: "pre",
|
|
602
|
+
async transform(code, id) {
|
|
603
|
+
if (!id.endsWith(".vue"))
|
|
604
|
+
return;
|
|
605
|
+
return transformVue(code);
|
|
606
|
+
}
|
|
596
607
|
}
|
|
597
608
|
];
|
|
598
609
|
function updateServerWatcher() {
|
|
@@ -610,8 +621,11 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
|
|
|
610
621
|
throw new Error(`Unknown layout "${layoutName}"`);
|
|
611
622
|
delete frontmatter.title;
|
|
612
623
|
const imports = [
|
|
624
|
+
'import { inject as vueInject } from "vue"',
|
|
613
625
|
`import InjectedLayout from "${toAtFS(layouts[layoutName])}"`,
|
|
614
|
-
|
|
626
|
+
'import { injectionSlidevContext } from "@slidev/client/constants"',
|
|
627
|
+
`const frontmatter = ${JSON.stringify(frontmatter)}`,
|
|
628
|
+
"const $slidev = vueInject(injectionSlidevContext)"
|
|
615
629
|
];
|
|
616
630
|
code = code.replace(/(<script setup.*>)/g, `$1
|
|
617
631
|
${imports.join("\n")}
|
|
@@ -628,6 +642,59 @@ ${body}
|
|
|
628
642
|
${code.slice(injectB)}`;
|
|
629
643
|
return code;
|
|
630
644
|
}
|
|
645
|
+
function transformVue(code) {
|
|
646
|
+
if (code.includes("injectionSlidevContext"))
|
|
647
|
+
return code;
|
|
648
|
+
const imports = [
|
|
649
|
+
'import { inject as vueInject } from "vue"',
|
|
650
|
+
'import { injectionSlidevContext } from "@slidev/client/constants"',
|
|
651
|
+
"const $slidev = vueInject(injectionSlidevContext)"
|
|
652
|
+
];
|
|
653
|
+
const matchScript = code.match(/<script((?!setup).)*(setup)?.*>/);
|
|
654
|
+
if (matchScript && matchScript[2]) {
|
|
655
|
+
return code.replace(/(<script.*>)/g, `$1
|
|
656
|
+
${imports.join("\n")}
|
|
657
|
+
`);
|
|
658
|
+
} else if (matchScript && !matchScript[2]) {
|
|
659
|
+
const matchExport = code.match(/export\s+default\s+[^{]*{/);
|
|
660
|
+
if (matchExport) {
|
|
661
|
+
const exportIndex = (matchExport.index || 0) + matchExport[0].length;
|
|
662
|
+
let component = code.slice(exportIndex);
|
|
663
|
+
component = component.slice(0, component.indexOf("<\/script>"));
|
|
664
|
+
if (component.match(/setup\s*\(/)) {
|
|
665
|
+
const scriptIndex = (matchScript.index || 0) + matchScript[0].length;
|
|
666
|
+
const provideImport = '\nimport { injectionSlidevContext } from "@slidev/client/constants"\n';
|
|
667
|
+
code = `${code.slice(0, scriptIndex)}${provideImport}${code.slice(scriptIndex)}`;
|
|
668
|
+
let injectIndex = exportIndex + provideImport.length;
|
|
669
|
+
let injectObject = "$slidev: { from: injectionSlidevContext },";
|
|
670
|
+
const matchInject = component.match(/.*inject\s*:\s*([\[{])/);
|
|
671
|
+
if (matchInject) {
|
|
672
|
+
injectIndex += (matchInject.index || 0) + matchInject[0].length;
|
|
673
|
+
if (matchInject[1] === "[") {
|
|
674
|
+
let injects = component.slice((matchInject.index || 0) + matchInject[0].length);
|
|
675
|
+
const injectEndIndex = injects.indexOf("]");
|
|
676
|
+
injects = injects.slice(0, injectEndIndex);
|
|
677
|
+
injectObject += injects.split(",").map((inject) => `${inject}: {from: ${inject}}`).join(",");
|
|
678
|
+
return `${code.slice(0, injectIndex - 1)}{
|
|
679
|
+
${injectObject}
|
|
680
|
+
}${code.slice(injectIndex + injectEndIndex + 1)}`;
|
|
681
|
+
} else {
|
|
682
|
+
return `${code.slice(0, injectIndex)}
|
|
683
|
+
${injectObject}
|
|
684
|
+
${code.slice(injectIndex)}`;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
return `${code.slice(0, injectIndex)}
|
|
688
|
+
inject: { ${injectObject} },
|
|
689
|
+
${code.slice(injectIndex)}`;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return `<script setup>
|
|
694
|
+
${imports.join("\n")}
|
|
695
|
+
<\/script>
|
|
696
|
+
${code}`;
|
|
697
|
+
}
|
|
631
698
|
async function getLayouts() {
|
|
632
699
|
const now = Date.now();
|
|
633
700
|
if (now - _layouts_cache_time < 2e3)
|
|
@@ -1159,7 +1226,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
|
|
|
1159
1226
|
const setups = [];
|
|
1160
1227
|
const entryPath = slash5(entry);
|
|
1161
1228
|
if (config.highlighter === "shiki") {
|
|
1162
|
-
const { getHighlighter } = await Promise.resolve().then(() =>
|
|
1229
|
+
const { getHighlighter } = await Promise.resolve().then(() => __toESM(__require("shiki")));
|
|
1163
1230
|
const shikiOptions = await loadSetups(roots, "shiki.ts", Shiki, DEFAULT_SHIKI_OPTIONS, false);
|
|
1164
1231
|
const { langs, themes } = resolveShikiOptions(shikiOptions);
|
|
1165
1232
|
shikiOptions.highlighter = await getHighlighter({ themes, langs });
|
|
@@ -1278,8 +1345,7 @@ function transformPageCSS(md2, id) {
|
|
|
1278
1345
|
if (!page)
|
|
1279
1346
|
return md2;
|
|
1280
1347
|
const { isInsideCodeblocks } = getCodeBlocks(md2);
|
|
1281
|
-
const result = md2.replace(/(\n<style[^>]*?>)([\s\S]+?)(<\/style>)/g, (full, start, css, end) => {
|
|
1282
|
-
const index = md2.indexOf(full);
|
|
1348
|
+
const result = md2.replace(/(\n<style[^>]*?>)([\s\S]+?)(<\/style>)/g, (full, start, css, end, index) => {
|
|
1283
1349
|
if (index < 0 || isInsideCodeblocks(index))
|
|
1284
1350
|
return full;
|
|
1285
1351
|
if (!start.includes("scoped"))
|