@slidev/cli 0.31.4 → 0.32.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-5QYEFLVL.js → build-OV5R3MX7.js} +11 -11
- package/dist/{build-QLCAUS73.mjs → build-RKDPZPJ4.mjs} +3 -3
- package/dist/{chunk-NKDK3BW7.mjs → chunk-2OKC6HYP.mjs} +17 -7
- package/dist/{chunk-7HNXF4RI.mjs → chunk-36AQIIEM.mjs} +105 -36
- package/dist/{chunk-RQ7QDWD6.js → chunk-64ARPHPA.js} +72 -62
- package/dist/{chunk-VNV7XQUU.js → chunk-ALT27UGE.js} +242 -173
- package/dist/{chunk-OYCSUJS7.js → chunk-JWGORJY6.js} +7 -1
- package/dist/{chunk-25USV2L5.mjs → chunk-NOFZO6W4.mjs} +7 -1
- package/dist/cli.js +25 -27
- package/dist/cli.mjs +7 -9
- package/dist/{export-RFA6N32W.mjs → export-GIPHUNUX.mjs} +3 -5
- package/dist/{export-W52T2VBO.js → export-M6HJUIFY.js} +4 -6
- package/dist/index.d.ts +5 -2
- package/dist/index.js +9 -7
- package/dist/index.mjs +8 -6
- package/package.json +10 -10
- package/dist/chunk-6FP4S4BJ.js +0 -31
- package/dist/chunk-A6EFYWHQ.mjs +0 -31
|
@@ -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 _chunk64ARPHPAjs = require('./chunk-64ARPHPA.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkJWGORJY6js = require('./chunk-JWGORJY6.js');
|
|
11
11
|
|
|
12
12
|
// node/build.ts
|
|
13
|
-
|
|
13
|
+
_chunkJWGORJY6js.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
|
+
_chunkJWGORJY6js.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
|
+
_chunkJWGORJY6js.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
|
+
_chunkJWGORJY6js.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
|
+
_chunkJWGORJY6js.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 = _chunkJWGORJY6js.__spreadValues.call(void 0, {}, headers);
|
|
531
531
|
for (let key in headers) {
|
|
532
532
|
tmp = res.getHeader(key);
|
|
533
533
|
if (tmp)
|
|
@@ -655,13 +655,13 @@ 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 _chunk64ARPHPAjs.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
|
root: options.userRoot,
|
|
663
663
|
plugins: [
|
|
664
|
-
await
|
|
664
|
+
await _chunk64ARPHPAjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
|
|
665
665
|
{
|
|
666
666
|
name: "resolve-config",
|
|
667
667
|
configResolved(_config) {
|
|
@@ -713,7 +713,7 @@ async function build(options, viteConfig = {}) {
|
|
|
713
713
|
await _fsextra2.default.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
714
714
|
`, "utf-8");
|
|
715
715
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
716
|
-
const { exportSlides } = await Promise.resolve().then(() =>
|
|
716
|
+
const { exportSlides } = await Promise.resolve().then(() => _chunkJWGORJY6js.__toESM.call(void 0, _chunkJWGORJY6js.__require.call(void 0, "./export-M6HJUIFY.js")));
|
|
717
717
|
const port = 12445;
|
|
718
718
|
const app = _connect2.default.call(void 0, );
|
|
719
719
|
const server = _http2.default.createServer(app);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
getIndexHtml
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2OKC6HYP.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__require,
|
|
7
7
|
__spreadValues,
|
|
8
8
|
__toESM,
|
|
9
9
|
init_esm_shims
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NOFZO6W4.mjs";
|
|
11
11
|
|
|
12
12
|
// node/build.ts
|
|
13
13
|
init_esm_shims();
|
|
@@ -713,7 +713,7 @@ async function build(options, viteConfig = {}) {
|
|
|
713
713
|
await fs2.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
714
714
|
`, "utf-8");
|
|
715
715
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
716
|
-
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-
|
|
716
|
+
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-GIPHUNUX.mjs")));
|
|
717
717
|
const port = 12445;
|
|
718
718
|
const app = connect();
|
|
719
719
|
const server = http.createServer(app);
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
resolveImportPath,
|
|
12
12
|
stringifyMarkdownTokens,
|
|
13
13
|
toAtFS
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NOFZO6W4.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({
|
|
@@ -135,10 +135,11 @@ async function loadSetups(roots, name, arg, initial, merge = true) {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
// node/plugins/windicss.ts
|
|
138
|
-
async function createWindiCSSPlugin({ themeRoots, clientRoot, userRoot, roots, data }, { windicss: windiOptions }) {
|
|
138
|
+
async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRoot, roots, data }, { windicss: windiOptions }) {
|
|
139
139
|
const configFiles = uniq2([
|
|
140
140
|
...defaultConfigureFiles.map((i) => resolve2(userRoot, i)),
|
|
141
141
|
...themeRoots.map((i) => `${i}/windi.config.ts`),
|
|
142
|
+
...addonRoots.map((i) => `${i}/windi.config.ts`),
|
|
142
143
|
resolve2(clientRoot, "windi.config.ts")
|
|
143
144
|
]);
|
|
144
145
|
const configFile = configFiles.find((i) => existsSync3(i));
|
|
@@ -167,6 +168,10 @@ async function createWindiCSSPlugin({ themeRoots, clientRoot, userRoot, roots, d
|
|
|
167
168
|
config2.scanOptions.include.push(`${i}/components/*.{vue,ts}`);
|
|
168
169
|
config2.scanOptions.include.push(`${i}/layouts/*.{vue,ts}`);
|
|
169
170
|
});
|
|
171
|
+
addonRoots.forEach((i) => {
|
|
172
|
+
config2.scanOptions.include.push(`${i}/components/*.{vue,ts}`);
|
|
173
|
+
config2.scanOptions.include.push(`${i}/layouts/*.{vue,ts}`);
|
|
174
|
+
});
|
|
170
175
|
config2.scanOptions.include.push(`!${slash(resolve2(userRoot, "node_modules"))}`);
|
|
171
176
|
config2.scanOptions.exclude.push(dirname(resolveImportPath("monaco-editor/package.json", true)));
|
|
172
177
|
config2.scanOptions.exclude.push(dirname(resolveImportPath("katex/package.json", true)));
|
|
@@ -243,7 +248,7 @@ var dependencies = {
|
|
|
243
248
|
"@antfu/utils": "^0.5.2",
|
|
244
249
|
"@slidev/parser": "workspace:*",
|
|
245
250
|
"@slidev/types": "workspace:*",
|
|
246
|
-
"@vueuse/core": "^8.
|
|
251
|
+
"@vueuse/core": "^8.5.0",
|
|
247
252
|
"@vueuse/head": "^0.7.6",
|
|
248
253
|
"@vueuse/motion": "^2.0.0-beta.18",
|
|
249
254
|
codemirror: "^5.65.3",
|
|
@@ -260,10 +265,10 @@ var dependencies = {
|
|
|
260
265
|
recordrtc: "^5.6.2",
|
|
261
266
|
resolve: "^1.22.0",
|
|
262
267
|
"vite-plugin-windicss": "^1.8.4",
|
|
263
|
-
vue: "^3.2.
|
|
268
|
+
vue: "^3.2.34",
|
|
264
269
|
"vue-router": "^4.0.15",
|
|
265
270
|
"vue-starport": "^0.2.10",
|
|
266
|
-
windicss: "^3.5.
|
|
271
|
+
windicss: "^3.5.4"
|
|
267
272
|
};
|
|
268
273
|
|
|
269
274
|
// node/vite/searchRoot.ts
|
|
@@ -431,7 +436,7 @@ function prepareSlideInfo(data) {
|
|
|
431
436
|
notesHTML: md.render((data == null ? void 0 : data.note) || "")
|
|
432
437
|
});
|
|
433
438
|
}
|
|
434
|
-
function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roots, remote }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
|
|
439
|
+
function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, userRoot, roots, remote }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
|
|
435
440
|
const slidePrefix = "/@slidev/slides/";
|
|
436
441
|
const hmrPages = /* @__PURE__ */ new Set();
|
|
437
442
|
let server;
|
|
@@ -725,6 +730,7 @@ defineProps<{ no: number | string }>()`);
|
|
|
725
730
|
const roots2 = uniq4([
|
|
726
731
|
userRoot,
|
|
727
732
|
...themeRoots,
|
|
733
|
+
...addonRoots,
|
|
728
734
|
clientRoot
|
|
729
735
|
]);
|
|
730
736
|
for (const root of roots2) {
|
|
@@ -751,6 +757,7 @@ defineProps<{ no: number | string }>()`);
|
|
|
751
757
|
];
|
|
752
758
|
const roots2 = uniq4([
|
|
753
759
|
...themeRoots,
|
|
760
|
+
...addonRoots,
|
|
754
761
|
userRoot
|
|
755
762
|
]);
|
|
756
763
|
for (const root of roots2) {
|
|
@@ -923,7 +930,7 @@ init_esm_shims();
|
|
|
923
930
|
import { existsSync as existsSync5 } from "fs";
|
|
924
931
|
import { join as join7, resolve as resolve4 } from "path";
|
|
925
932
|
import { slash as slash4, uniq as uniq5 } from "@antfu/utils";
|
|
926
|
-
function createClientSetupPlugin({ clientRoot, themeRoots, userRoot }) {
|
|
933
|
+
function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot }) {
|
|
927
934
|
const setupEntry = slash4(resolve4(clientRoot, "setup"));
|
|
928
935
|
return {
|
|
929
936
|
name: "slidev:setup",
|
|
@@ -936,6 +943,7 @@ function createClientSetupPlugin({ clientRoot, themeRoots, userRoot }) {
|
|
|
936
943
|
const asyncInjections = [];
|
|
937
944
|
const setups = uniq5([
|
|
938
945
|
...themeRoots,
|
|
946
|
+
...addonRoots,
|
|
939
947
|
userRoot
|
|
940
948
|
]).map((i) => join7(i, "setup", name));
|
|
941
949
|
setups.forEach((path, idx) => {
|
|
@@ -1459,6 +1467,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1459
1467
|
const {
|
|
1460
1468
|
mode,
|
|
1461
1469
|
themeRoots,
|
|
1470
|
+
addonRoots,
|
|
1462
1471
|
clientRoot,
|
|
1463
1472
|
data: { config }
|
|
1464
1473
|
} = options;
|
|
@@ -1486,6 +1495,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1486
1495
|
`${clientRoot}/builtin`,
|
|
1487
1496
|
`${clientRoot}/components`,
|
|
1488
1497
|
...themeRoots.map((i) => `${i}/components`),
|
|
1498
|
+
...addonRoots.map((i) => `${i}/components`),
|
|
1489
1499
|
"src/components",
|
|
1490
1500
|
"components"
|
|
1491
1501
|
],
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ViteSlidevPlugin
|
|
3
|
+
} from "./chunk-2OKC6HYP.mjs";
|
|
1
4
|
import {
|
|
2
5
|
__commonJS,
|
|
3
6
|
__dirname,
|
|
@@ -10,8 +13,9 @@ import {
|
|
|
10
13
|
__spreadValues,
|
|
11
14
|
__toESM,
|
|
12
15
|
init_esm_shims,
|
|
16
|
+
packageExists,
|
|
13
17
|
resolveImportPath
|
|
14
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-NOFZO6W4.mjs";
|
|
15
19
|
|
|
16
20
|
// ../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/internal/constants.js
|
|
17
21
|
var require_constants = __commonJS({
|
|
@@ -1850,7 +1854,7 @@ var require_satisfies = __commonJS({
|
|
|
1850
1854
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/satisfies.js"(exports, module) {
|
|
1851
1855
|
init_esm_shims();
|
|
1852
1856
|
var Range = require_range();
|
|
1853
|
-
var
|
|
1857
|
+
var satisfies3 = (version3, range, options) => {
|
|
1854
1858
|
try {
|
|
1855
1859
|
range = new Range(range, options);
|
|
1856
1860
|
} catch (er) {
|
|
@@ -1858,7 +1862,7 @@ var require_satisfies = __commonJS({
|
|
|
1858
1862
|
}
|
|
1859
1863
|
return range.test(version3);
|
|
1860
1864
|
};
|
|
1861
|
-
module.exports =
|
|
1865
|
+
module.exports = satisfies3;
|
|
1862
1866
|
}
|
|
1863
1867
|
});
|
|
1864
1868
|
|
|
@@ -2011,7 +2015,7 @@ var require_outside = __commonJS({
|
|
|
2011
2015
|
var Comparator = require_comparator();
|
|
2012
2016
|
var { ANY } = Comparator;
|
|
2013
2017
|
var Range = require_range();
|
|
2014
|
-
var
|
|
2018
|
+
var satisfies3 = require_satisfies();
|
|
2015
2019
|
var gt = require_gt();
|
|
2016
2020
|
var lt = require_lt();
|
|
2017
2021
|
var lte = require_lte();
|
|
@@ -2038,7 +2042,7 @@ var require_outside = __commonJS({
|
|
|
2038
2042
|
default:
|
|
2039
2043
|
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
2040
2044
|
}
|
|
2041
|
-
if (
|
|
2045
|
+
if (satisfies3(version3, range, options)) {
|
|
2042
2046
|
return false;
|
|
2043
2047
|
}
|
|
2044
2048
|
for (let i = 0; i < range.set.length; ++i) {
|
|
@@ -2110,7 +2114,7 @@ var require_intersects = __commonJS({
|
|
|
2110
2114
|
var require_simplify = __commonJS({
|
|
2111
2115
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/ranges/simplify.js"(exports, module) {
|
|
2112
2116
|
init_esm_shims();
|
|
2113
|
-
var
|
|
2117
|
+
var satisfies3 = require_satisfies();
|
|
2114
2118
|
var compare = require_compare();
|
|
2115
2119
|
module.exports = (versions, range, options) => {
|
|
2116
2120
|
const set = [];
|
|
@@ -2118,7 +2122,7 @@ var require_simplify = __commonJS({
|
|
|
2118
2122
|
let prev = null;
|
|
2119
2123
|
const v = versions.sort((a, b) => compare(a, b, options));
|
|
2120
2124
|
for (const version3 of v) {
|
|
2121
|
-
const included =
|
|
2125
|
+
const included = satisfies3(version3, range, options);
|
|
2122
2126
|
if (included) {
|
|
2123
2127
|
prev = version3;
|
|
2124
2128
|
if (!first) {
|
|
@@ -2163,7 +2167,7 @@ var require_subset = __commonJS({
|
|
|
2163
2167
|
var Range = require_range();
|
|
2164
2168
|
var Comparator = require_comparator();
|
|
2165
2169
|
var { ANY } = Comparator;
|
|
2166
|
-
var
|
|
2170
|
+
var satisfies3 = require_satisfies();
|
|
2167
2171
|
var compare = require_compare();
|
|
2168
2172
|
var subset = (sub, dom, options = {}) => {
|
|
2169
2173
|
if (sub === dom) {
|
|
@@ -2231,14 +2235,14 @@ var require_subset = __commonJS({
|
|
|
2231
2235
|
}
|
|
2232
2236
|
}
|
|
2233
2237
|
for (const eq of eqSet) {
|
|
2234
|
-
if (gt && !
|
|
2238
|
+
if (gt && !satisfies3(eq, String(gt), options)) {
|
|
2235
2239
|
return null;
|
|
2236
2240
|
}
|
|
2237
|
-
if (lt && !
|
|
2241
|
+
if (lt && !satisfies3(eq, String(lt), options)) {
|
|
2238
2242
|
return null;
|
|
2239
2243
|
}
|
|
2240
2244
|
for (const c2 of dom) {
|
|
2241
|
-
if (!
|
|
2245
|
+
if (!satisfies3(eq, String(c2), options)) {
|
|
2242
2246
|
return false;
|
|
2243
2247
|
}
|
|
2244
2248
|
}
|
|
@@ -2265,7 +2269,7 @@ var require_subset = __commonJS({
|
|
|
2265
2269
|
if (higher === c2 && higher !== gt) {
|
|
2266
2270
|
return false;
|
|
2267
2271
|
}
|
|
2268
|
-
} else if (gt.operator === ">=" && !
|
|
2272
|
+
} else if (gt.operator === ">=" && !satisfies3(gt.semver, String(c2), options)) {
|
|
2269
2273
|
return false;
|
|
2270
2274
|
}
|
|
2271
2275
|
}
|
|
@@ -2280,7 +2284,7 @@ var require_subset = __commonJS({
|
|
|
2280
2284
|
if (lower === c2 && lower !== lt) {
|
|
2281
2285
|
return false;
|
|
2282
2286
|
}
|
|
2283
|
-
} else if (lt.operator === "<=" && !
|
|
2287
|
+
} else if (lt.operator === "<=" && !satisfies3(lt.semver, String(c2), options)) {
|
|
2284
2288
|
return false;
|
|
2285
2289
|
}
|
|
2286
2290
|
}
|
|
@@ -2371,12 +2375,33 @@ var require_semver2 = __commonJS({
|
|
|
2371
2375
|
}
|
|
2372
2376
|
});
|
|
2373
2377
|
|
|
2378
|
+
// node/server.ts
|
|
2379
|
+
init_esm_shims();
|
|
2380
|
+
import { join } from "path";
|
|
2381
|
+
import { createServer as createViteServer, mergeConfig, resolveConfig } from "vite";
|
|
2382
|
+
async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
2383
|
+
const rawConfig = await resolveConfig({}, "serve");
|
|
2384
|
+
const pluginOptions = rawConfig.slidev || {};
|
|
2385
|
+
process.env.EDITOR = process.env.EDITOR || "code";
|
|
2386
|
+
const server = await createViteServer(mergeConfig(viteConfig, {
|
|
2387
|
+
optimizeDeps: {
|
|
2388
|
+
entries: [
|
|
2389
|
+
join(options.clientRoot, "main.ts")
|
|
2390
|
+
]
|
|
2391
|
+
},
|
|
2392
|
+
plugins: [
|
|
2393
|
+
await ViteSlidevPlugin(options, pluginOptions, serverOptions)
|
|
2394
|
+
]
|
|
2395
|
+
}));
|
|
2396
|
+
return server;
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2374
2399
|
// node/parser.ts
|
|
2375
2400
|
init_esm_shims();
|
|
2376
2401
|
import * as parser from "@slidev/parser/fs";
|
|
2377
2402
|
|
|
2378
2403
|
// package.json
|
|
2379
|
-
var version = "0.
|
|
2404
|
+
var version = "0.32.1";
|
|
2380
2405
|
|
|
2381
2406
|
// node/themes.ts
|
|
2382
2407
|
init_esm_shims();
|
|
@@ -9463,16 +9488,57 @@ async function run(fn, args, options = {}) {
|
|
|
9463
9488
|
}
|
|
9464
9489
|
|
|
9465
9490
|
// node/themes.ts
|
|
9466
|
-
var
|
|
9491
|
+
var import_semver2 = __toESM(require_semver2());
|
|
9467
9492
|
import isInstalledGlobally from "is-installed-globally";
|
|
9468
9493
|
import { underline } from "kolorist";
|
|
9469
|
-
import
|
|
9494
|
+
import fs3 from "fs-extra";
|
|
9470
9495
|
|
|
9471
9496
|
// node/options.ts
|
|
9472
9497
|
init_esm_shims();
|
|
9473
|
-
import { dirname, join, resolve as resolve2 } from "path";
|
|
9498
|
+
import { dirname, join as join2, resolve as resolve2 } from "path";
|
|
9474
9499
|
import { uniq } from "@antfu/utils";
|
|
9475
9500
|
import _debug from "debug";
|
|
9501
|
+
|
|
9502
|
+
// node/addons.ts
|
|
9503
|
+
init_esm_shims();
|
|
9504
|
+
var import_semver = __toESM(require_semver2());
|
|
9505
|
+
import fs2 from "fs-extra";
|
|
9506
|
+
function getPackageJson(root) {
|
|
9507
|
+
return fs2.readJSON(resolveImportPath(`${root}/package.json`, true));
|
|
9508
|
+
}
|
|
9509
|
+
async function getAddons(userRoot, config2) {
|
|
9510
|
+
const { slidev = {} } = await getPackageJson(userRoot);
|
|
9511
|
+
const configAddons = config2.addons instanceof Array ? config2.addons : [];
|
|
9512
|
+
const addons = configAddons.concat(slidev.addons instanceof Array ? slidev.addons : []);
|
|
9513
|
+
return getRecursivePlugins(addons.map(resolvePluginName));
|
|
9514
|
+
}
|
|
9515
|
+
async function getRecursivePlugins(addons) {
|
|
9516
|
+
const addonsArray = await Promise.all(addons.map(async (addon) => {
|
|
9517
|
+
const { slidev = {}, engines = {} } = await getPackageJson(addon);
|
|
9518
|
+
checkEngine(addon, engines);
|
|
9519
|
+
let addons2 = slidev.addons instanceof Array ? slidev.addons : [];
|
|
9520
|
+
if (addons2.length > 0)
|
|
9521
|
+
addons2 = await getRecursivePlugins(addons2.map(resolvePluginName));
|
|
9522
|
+
addons2.push(addon);
|
|
9523
|
+
return addons2;
|
|
9524
|
+
}));
|
|
9525
|
+
return addonsArray.flat();
|
|
9526
|
+
}
|
|
9527
|
+
async function checkEngine(name, engines) {
|
|
9528
|
+
if (engines.slidev && !(0, import_semver.satisfies)(version, engines.slidev))
|
|
9529
|
+
throw new Error(`[slidev] addon "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
|
|
9530
|
+
}
|
|
9531
|
+
function resolvePluginName(name) {
|
|
9532
|
+
if (!name)
|
|
9533
|
+
return "";
|
|
9534
|
+
if (isPath(name))
|
|
9535
|
+
return name;
|
|
9536
|
+
if (packageExists(`slidev-addon-${name}`))
|
|
9537
|
+
return `slidev-addon-${name}`;
|
|
9538
|
+
return name;
|
|
9539
|
+
}
|
|
9540
|
+
|
|
9541
|
+
// node/options.ts
|
|
9476
9542
|
var debug = _debug("slidev:options");
|
|
9477
9543
|
function getClientRoot() {
|
|
9478
9544
|
return dirname(resolveImportPath("@slidev/client/package.json", true));
|
|
@@ -9486,15 +9552,17 @@ function isPath(name) {
|
|
|
9486
9552
|
function getThemeRoots(name, entry) {
|
|
9487
9553
|
if (!name)
|
|
9488
9554
|
return [];
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9555
|
+
return [getRoot(name, entry)];
|
|
9556
|
+
}
|
|
9557
|
+
function getAddonRoots(addons, entry) {
|
|
9558
|
+
if (addons.length === 0)
|
|
9559
|
+
return [];
|
|
9560
|
+
return addons.map((name) => getRoot(name, entry));
|
|
9561
|
+
}
|
|
9562
|
+
function getRoot(name, entry) {
|
|
9563
|
+
if (isPath(name))
|
|
9564
|
+
return resolve2(dirname(entry), name);
|
|
9565
|
+
return dirname(resolveImportPath(`${name}/package.json`, true));
|
|
9498
9566
|
}
|
|
9499
9567
|
function getUserRoot(options) {
|
|
9500
9568
|
const { entry: rawEntry = "slides.md", userRoot = process.cwd() } = options;
|
|
@@ -9521,9 +9589,11 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
|
|
|
9521
9589
|
const clientRoot = getClientRoot();
|
|
9522
9590
|
const cliRoot = getCLIRoot();
|
|
9523
9591
|
const themeRoots = getThemeRoots(theme, entry);
|
|
9592
|
+
const addons = await getAddons(userRoot, data.config);
|
|
9593
|
+
const addonRoots = getAddonRoots(addons, entry);
|
|
9524
9594
|
const roots = uniq([clientRoot, ...themeRoots, userRoot]);
|
|
9525
9595
|
if (themeRoots.length) {
|
|
9526
|
-
const themeMeta = await getThemeMeta(theme,
|
|
9596
|
+
const themeMeta = await getThemeMeta(theme, join2(themeRoots[0], "package.json"));
|
|
9527
9597
|
data.themeMeta = themeMeta;
|
|
9528
9598
|
if (themeMeta)
|
|
9529
9599
|
data.config = parser.resolveConfig(data.headmatter, themeMeta);
|
|
@@ -9537,6 +9607,7 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
|
|
|
9537
9607
|
clientRoot,
|
|
9538
9608
|
cliRoot,
|
|
9539
9609
|
themeRoots,
|
|
9610
|
+
addonRoots,
|
|
9540
9611
|
roots,
|
|
9541
9612
|
remote
|
|
9542
9613
|
});
|
|
@@ -9549,6 +9620,7 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
|
|
|
9549
9620
|
clientRoot,
|
|
9550
9621
|
cliRoot,
|
|
9551
9622
|
themeRoots,
|
|
9623
|
+
addonRoots,
|
|
9552
9624
|
roots,
|
|
9553
9625
|
remote
|
|
9554
9626
|
};
|
|
@@ -9563,17 +9635,12 @@ var officialThemes = {
|
|
|
9563
9635
|
"shibainu": "@slidev/theme-shibainu",
|
|
9564
9636
|
"bricks": "@slidev/theme-bricks"
|
|
9565
9637
|
};
|
|
9566
|
-
function packageExists(name) {
|
|
9567
|
-
if (resolveImportPath(`${name}/package.json`))
|
|
9568
|
-
return true;
|
|
9569
|
-
return false;
|
|
9570
|
-
}
|
|
9571
9638
|
async function getThemeMeta(name, path2) {
|
|
9572
|
-
if (!
|
|
9639
|
+
if (!fs3.existsSync(path2))
|
|
9573
9640
|
return {};
|
|
9574
9641
|
if (path2) {
|
|
9575
|
-
const { slidev = {}, engines = {} } = await
|
|
9576
|
-
if (engines.slidev && !(0,
|
|
9642
|
+
const { slidev = {}, engines = {} } = await fs3.readJSON(path2);
|
|
9643
|
+
if (engines.slidev && !(0, import_semver2.satisfies)(version, engines.slidev))
|
|
9577
9644
|
throw new Error(`[slidev] theme "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
|
|
9578
9645
|
return slidev;
|
|
9579
9646
|
}
|
|
@@ -9616,14 +9683,16 @@ async function promptForThemeInstallation(name) {
|
|
|
9616
9683
|
}
|
|
9617
9684
|
|
|
9618
9685
|
export {
|
|
9686
|
+
createServer,
|
|
9619
9687
|
parser,
|
|
9620
9688
|
version,
|
|
9621
|
-
packageExists,
|
|
9622
9689
|
resolveThemeName,
|
|
9623
9690
|
getClientRoot,
|
|
9624
9691
|
getCLIRoot,
|
|
9625
9692
|
isPath,
|
|
9626
9693
|
getThemeRoots,
|
|
9694
|
+
getAddonRoots,
|
|
9695
|
+
getRoot,
|
|
9627
9696
|
getUserRoot,
|
|
9628
9697
|
resolveOptions
|
|
9629
9698
|
};
|