@slidev/cli 0.42.11 → 0.43.0-beta.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-ITLUPWNS.mjs → build-C2GYF6EU.mjs} +7 -7
- package/dist/{build-I34EOBVM.js → build-J2XECXHU.js} +8 -8
- package/dist/{chunk-TH7JXF42.js → chunk-CJW2UL6K.js} +88 -96
- package/dist/chunk-HA2YGJJG.mjs +4837 -0
- package/dist/{chunk-VPD6PH2L.mjs → chunk-HO75FTDI.mjs} +7 -7
- package/dist/{chunk-RSZHGGR3.js → chunk-J7PXWEZ7.js} +7 -7
- package/dist/{chunk-6XVZLT3I.mjs → chunk-JDHANZ37.mjs} +1 -1
- package/dist/{chunk-34SGGZ4P.js → chunk-JQHGZJGJ.js} +7 -10
- package/dist/{chunk-KB3DQ2OE.mjs → chunk-QHOBBTS4.mjs} +1 -31
- package/dist/chunk-ROTHRPSW.js +4837 -0
- package/dist/{chunk-QVVA2G2Y.mjs → chunk-Y2TFMOHQ.mjs} +39 -47
- package/dist/{chunk-QDKRARRU.js → chunk-YUG22S6W.js} +1 -31
- package/dist/{chunk-MZBIET7Y.mjs → chunk-ZEKM4EGL.mjs} +3 -6
- package/dist/cli.js +36 -35
- package/dist/cli.mjs +17 -16
- package/dist/{export-6G7WYT32.mjs → export-I7B4PU6A.mjs} +17 -22
- package/dist/{export-BGMCS4F2.js → export-MCALG7XD.js} +18 -23
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- package/dist/{unocss-2T2KTWQ5.js → unocss-2DU67QXG.js} +6 -7
- package/dist/{unocss-ALFHEPHE.mjs → unocss-2UOAV4VT.mjs} +9 -10
- package/dist/windicss-FNELZNWD.js +9 -0
- package/dist/windicss-UVXCUIV4.mjs +9 -0
- package/package.json +7 -6
- package/template.md +1 -1
- package/dist/chunk-4O6GOAOC.js +0 -1634
- package/dist/chunk-UAV6RPFT.mjs +0 -1634
- package/dist/windicss-3HGYWXUJ.js +0 -9
- package/dist/windicss-TWSVDM4O.mjs +0 -9
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
mergeViteConfigs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HA2YGJJG.mjs";
|
|
5
5
|
import {
|
|
6
6
|
packageExists,
|
|
7
7
|
resolveImportPath
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZEKM4EGL.mjs";
|
|
9
9
|
import {
|
|
10
10
|
__commonJS,
|
|
11
|
-
__privateAdd,
|
|
12
|
-
__privateGet,
|
|
13
|
-
__privateSet,
|
|
14
|
-
__privateWrapper,
|
|
15
11
|
__toESM
|
|
16
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QHOBBTS4.mjs";
|
|
17
13
|
|
|
18
14
|
// ../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/internal/constants.js
|
|
19
15
|
var require_constants = __commonJS({
|
|
@@ -2492,8 +2488,8 @@ var require_semver2 = __commonJS({
|
|
|
2492
2488
|
});
|
|
2493
2489
|
|
|
2494
2490
|
// node/server.ts
|
|
2495
|
-
import { join } from "path";
|
|
2496
|
-
import process2 from "process";
|
|
2491
|
+
import { join } from "node:path";
|
|
2492
|
+
import process2 from "node:process";
|
|
2497
2493
|
import { createServer as createViteServer, resolveConfig } from "vite";
|
|
2498
2494
|
async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
2499
2495
|
const rawConfig = await resolveConfig({}, "serve", options.entry);
|
|
@@ -2523,28 +2519,28 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
|
2523
2519
|
import * as parser from "@slidev/parser/fs";
|
|
2524
2520
|
|
|
2525
2521
|
// package.json
|
|
2526
|
-
var version = "0.
|
|
2522
|
+
var version = "0.43.0-beta.1";
|
|
2527
2523
|
|
|
2528
2524
|
// node/themes.ts
|
|
2529
2525
|
import prompts2 from "prompts";
|
|
2530
2526
|
|
|
2531
2527
|
// ../../node_modules/.pnpm/@antfu+ni@0.21.6/node_modules/@antfu/ni/dist/shared/ni.add7487c.mjs
|
|
2532
|
-
import fs$1, { promises, createWriteStream, createReadStream, existsSync } from "fs";
|
|
2533
|
-
import path$3, { join as join$1, dirname, resolve } from "path";
|
|
2534
|
-
import process$2 from "process";
|
|
2535
|
-
import url, { fileURLToPath } from "url";
|
|
2536
|
-
import { Buffer as Buffer$1 } from "buffer";
|
|
2537
|
-
import childProcess, { ChildProcess } from "child_process";
|
|
2528
|
+
import fs$1, { promises, createWriteStream, createReadStream, existsSync } from "node:fs";
|
|
2529
|
+
import path$3, { join as join$1, dirname, resolve } from "node:path";
|
|
2530
|
+
import process$2 from "node:process";
|
|
2531
|
+
import url, { fileURLToPath } from "node:url";
|
|
2532
|
+
import { Buffer as Buffer$1 } from "node:buffer";
|
|
2533
|
+
import childProcess, { ChildProcess } from "node:child_process";
|
|
2538
2534
|
import require$$0$2 from "child_process";
|
|
2539
2535
|
import require$$0$1 from "path";
|
|
2540
2536
|
import require$$0 from "fs";
|
|
2541
|
-
import os$1, { constants } from "os";
|
|
2537
|
+
import os$1, { constants } from "node:os";
|
|
2542
2538
|
import require$$0$3 from "assert";
|
|
2543
2539
|
import require$$2 from "events";
|
|
2544
2540
|
import require$$0$5 from "buffer";
|
|
2545
2541
|
import require$$0$4 from "stream";
|
|
2546
2542
|
import require$$2$1 from "util";
|
|
2547
|
-
import { debuglog } from "util";
|
|
2543
|
+
import { debuglog } from "node:util";
|
|
2548
2544
|
import require$$0$6 from "os";
|
|
2549
2545
|
import require$$1 from "tty";
|
|
2550
2546
|
import require$$0$7 from "readline";
|
|
@@ -2749,7 +2745,7 @@ var decode = (str, opt = {}) => {
|
|
|
2749
2745
|
if (opt.bracketedArray) {
|
|
2750
2746
|
isArray = keyRaw.length > 2 && keyRaw.slice(-2) === "[]";
|
|
2751
2747
|
} else {
|
|
2752
|
-
duplicates[keyRaw] = (
|
|
2748
|
+
duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1;
|
|
2753
2749
|
isArray = duplicates[keyRaw] > 1;
|
|
2754
2750
|
}
|
|
2755
2751
|
const key = isArray ? keyRaw.slice(0, -2) : keyRaw;
|
|
@@ -2862,53 +2858,49 @@ var Node = class {
|
|
|
2862
2858
|
this.value = value;
|
|
2863
2859
|
}
|
|
2864
2860
|
};
|
|
2865
|
-
var _head, _tail, _size;
|
|
2866
2861
|
var Queue = class {
|
|
2862
|
+
#head;
|
|
2863
|
+
#tail;
|
|
2864
|
+
#size;
|
|
2867
2865
|
constructor() {
|
|
2868
|
-
__privateAdd(this, _head, void 0);
|
|
2869
|
-
__privateAdd(this, _tail, void 0);
|
|
2870
|
-
__privateAdd(this, _size, void 0);
|
|
2871
2866
|
this.clear();
|
|
2872
2867
|
}
|
|
2873
2868
|
enqueue(value) {
|
|
2874
2869
|
const node = new Node(value);
|
|
2875
|
-
if (
|
|
2876
|
-
|
|
2877
|
-
|
|
2870
|
+
if (this.#head) {
|
|
2871
|
+
this.#tail.next = node;
|
|
2872
|
+
this.#tail = node;
|
|
2878
2873
|
} else {
|
|
2879
|
-
|
|
2880
|
-
|
|
2874
|
+
this.#head = node;
|
|
2875
|
+
this.#tail = node;
|
|
2881
2876
|
}
|
|
2882
|
-
|
|
2877
|
+
this.#size++;
|
|
2883
2878
|
}
|
|
2884
2879
|
dequeue() {
|
|
2885
|
-
const current =
|
|
2880
|
+
const current = this.#head;
|
|
2886
2881
|
if (!current) {
|
|
2887
2882
|
return;
|
|
2888
2883
|
}
|
|
2889
|
-
|
|
2890
|
-
|
|
2884
|
+
this.#head = this.#head.next;
|
|
2885
|
+
this.#size--;
|
|
2891
2886
|
return current.value;
|
|
2892
2887
|
}
|
|
2893
2888
|
clear() {
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2889
|
+
this.#head = void 0;
|
|
2890
|
+
this.#tail = void 0;
|
|
2891
|
+
this.#size = 0;
|
|
2897
2892
|
}
|
|
2898
2893
|
get size() {
|
|
2899
|
-
return
|
|
2894
|
+
return this.#size;
|
|
2900
2895
|
}
|
|
2901
2896
|
*[Symbol.iterator]() {
|
|
2902
|
-
let current =
|
|
2897
|
+
let current = this.#head;
|
|
2903
2898
|
while (current) {
|
|
2904
2899
|
yield current.value;
|
|
2905
2900
|
current = current.next;
|
|
2906
2901
|
}
|
|
2907
2902
|
}
|
|
2908
2903
|
};
|
|
2909
|
-
_head = new WeakMap();
|
|
2910
|
-
_tail = new WeakMap();
|
|
2911
|
-
_size = new WeakMap();
|
|
2912
2904
|
function pLimit(concurrency) {
|
|
2913
2905
|
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
2914
2906
|
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
@@ -7426,7 +7418,7 @@ var parseNi = (agent, args, ctx) => {
|
|
|
7426
7418
|
return getCommand(agent, "global", exclude(args, "-g"));
|
|
7427
7419
|
if (args.includes("--frozen-if-present")) {
|
|
7428
7420
|
args = exclude(args, "--frozen-if-present");
|
|
7429
|
-
return getCommand(agent,
|
|
7421
|
+
return getCommand(agent, ctx?.hasLock ? "frozen" : "install", args);
|
|
7430
7422
|
}
|
|
7431
7423
|
if (args.includes("--frozen"))
|
|
7432
7424
|
return getCommand(agent, "frozen", exclude(args, "--frozen"));
|
|
@@ -7601,8 +7593,8 @@ import { underline } from "kolorist";
|
|
|
7601
7593
|
import fs3 from "fs-extra";
|
|
7602
7594
|
|
|
7603
7595
|
// node/options.ts
|
|
7604
|
-
import { dirname as dirname2, join as join3, resolve as resolve2 } from "path";
|
|
7605
|
-
import process3 from "process";
|
|
7596
|
+
import { dirname as dirname2, join as join3, resolve as resolve2 } from "node:path";
|
|
7597
|
+
import process3 from "node:process";
|
|
7606
7598
|
import { uniq } from "@antfu/utils";
|
|
7607
7599
|
import _debug from "debug";
|
|
7608
7600
|
|
|
@@ -7622,14 +7614,14 @@ async function getPackageJson(root) {
|
|
|
7622
7614
|
async function getAddons(userRoot, config2) {
|
|
7623
7615
|
const { slidev = {} } = await getPackageJson(userRoot);
|
|
7624
7616
|
const configAddons = Array.isArray(config2.addons) ? config2.addons : [];
|
|
7625
|
-
const addons = configAddons.concat(Array.isArray(slidev
|
|
7617
|
+
const addons = configAddons.concat(Array.isArray(slidev?.addons) ? slidev.addons : []);
|
|
7626
7618
|
return (await getRecursivePlugins(addons.map(resolvePluginName), 3)).filter(Boolean);
|
|
7627
7619
|
}
|
|
7628
7620
|
async function getRecursivePlugins(addons, depth) {
|
|
7629
7621
|
const addonsArray = await Promise.all(addons.map(async (addon) => {
|
|
7630
7622
|
const { slidev = {}, engines = {} } = await getPackageJson(addon);
|
|
7631
7623
|
checkEngine(addon, engines);
|
|
7632
|
-
let addons2 = Array.isArray(slidev
|
|
7624
|
+
let addons2 = Array.isArray(slidev?.addons) ? slidev.addons : [];
|
|
7633
7625
|
if (addons2.length > 0 && depth)
|
|
7634
7626
|
addons2 = await getRecursivePlugins(addons2.map(resolvePluginName), depth - 1);
|
|
7635
7627
|
addons2.push(addon);
|
|
@@ -7638,7 +7630,7 @@ async function getRecursivePlugins(addons, depth) {
|
|
|
7638
7630
|
return addonsArray.flat();
|
|
7639
7631
|
}
|
|
7640
7632
|
async function checkEngine(name, engines) {
|
|
7641
|
-
if (engines.slidev && !(0, import_semver.satisfies)(version, engines.slidev))
|
|
7633
|
+
if (engines.slidev && !(0, import_semver.satisfies)(version, engines.slidev, { includePrerelease: true }))
|
|
7642
7634
|
throw new Error(`[slidev] addon "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
|
|
7643
7635
|
}
|
|
7644
7636
|
function resolvePluginName(name) {
|
|
@@ -7754,7 +7746,7 @@ async function getThemeMeta(name, path2) {
|
|
|
7754
7746
|
return {};
|
|
7755
7747
|
if (path2) {
|
|
7756
7748
|
const { slidev = {}, engines = {} } = await fs3.readJSON(path2);
|
|
7757
|
-
if (engines.slidev && !(0, import_semver2.satisfies)(version, engines.slidev))
|
|
7749
|
+
if (engines.slidev && !(0, import_semver2.satisfies)(version, engines.slidev, { includePrerelease: true }))
|
|
7758
7750
|
throw new Error(`[slidev] theme "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
|
|
7759
7751
|
return slidev;
|
|
7760
7752
|
}
|
|
@@ -30,39 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
31
|
mod
|
|
32
32
|
));
|
|
33
|
-
var __accessCheck = (obj, member, msg) => {
|
|
34
|
-
if (!member.has(obj))
|
|
35
|
-
throw TypeError("Cannot " + msg);
|
|
36
|
-
};
|
|
37
|
-
var __privateGet = (obj, member, getter) => {
|
|
38
|
-
__accessCheck(obj, member, "read from private field");
|
|
39
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
40
|
-
};
|
|
41
|
-
var __privateAdd = (obj, member, value) => {
|
|
42
|
-
if (member.has(obj))
|
|
43
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
44
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
45
|
-
};
|
|
46
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
47
|
-
__accessCheck(obj, member, "write to private field");
|
|
48
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
49
|
-
return value;
|
|
50
|
-
};
|
|
51
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
52
|
-
set _(value) {
|
|
53
|
-
__privateSet(obj, member, value, setter);
|
|
54
|
-
},
|
|
55
|
-
get _() {
|
|
56
|
-
return __privateGet(obj, member, getter);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
33
|
|
|
64
34
|
|
|
65
35
|
|
|
66
36
|
|
|
67
37
|
|
|
68
|
-
exports.__require = __require; exports.__commonJS = __commonJS; exports.__toESM = __toESM;
|
|
38
|
+
exports.__require = __require; exports.__commonJS = __commonJS; exports.__toESM = __toESM;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__require
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QHOBBTS4.mjs";
|
|
4
4
|
|
|
5
5
|
// node/utils.ts
|
|
6
|
-
import { join } from "path";
|
|
6
|
+
import { join } from "node:path";
|
|
7
7
|
import { ensurePrefix, slash } from "@antfu/utils";
|
|
8
8
|
import isInstalledGlobally from "is-installed-globally";
|
|
9
9
|
import { sync as resolve } from "resolve";
|
|
@@ -49,10 +49,7 @@ function resolveGlobalImportPath(importName) {
|
|
|
49
49
|
}
|
|
50
50
|
function stringifyMarkdownTokens(tokens) {
|
|
51
51
|
return tokens.map(
|
|
52
|
-
(token) =>
|
|
53
|
-
var _a;
|
|
54
|
-
return (_a = token.children) == null ? void 0 : _a.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ");
|
|
55
|
-
}
|
|
52
|
+
(token) => token.children?.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ")
|
|
56
53
|
).filter(Boolean).join(" ");
|
|
57
54
|
}
|
|
58
55
|
function generateGoogleFontsUrl(options) {
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict"; 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 }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
1
|
+
"use strict"; 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 }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkCJW2UL6Kjs = require('./chunk-CJW2UL6K.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkROTHRPSWjs = require('./chunk-ROTHRPSW.js');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _chunkKKGXM3XLjs = require('./chunk-KKGXM3XL.js');
|
|
19
|
-
require('./chunk-
|
|
19
|
+
require('./chunk-JQHGZJGJ.js');
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _chunkYUG22S6Wjs = require('./chunk-YUG22S6W.js');
|
|
23
23
|
|
|
24
24
|
// node/cli.ts
|
|
25
|
-
var import_fast_deep_equal =
|
|
25
|
+
var import_fast_deep_equal = _chunkYUG22S6Wjs.__toESM.call(void 0, _chunkROTHRPSWjs.require_fast_deep_equal.call(void 0, ));
|
|
26
26
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
27
27
|
var _os = require('os'); var _os2 = _interopRequireDefault(_os);
|
|
28
28
|
var _child_process = require('child_process');
|
|
@@ -42,22 +42,23 @@ var CONFIG_RESTART_FIELDS = [
|
|
|
42
42
|
"monaco",
|
|
43
43
|
"routerMode",
|
|
44
44
|
"fonts",
|
|
45
|
-
"css"
|
|
45
|
+
"css",
|
|
46
|
+
"mdc"
|
|
46
47
|
];
|
|
47
48
|
_fs.injectPreparserExtensionLoader.call(void 0, async (headmatter, filepath) => {
|
|
48
|
-
const addons = _nullishCoalesce((headmatter
|
|
49
|
+
const addons = _nullishCoalesce(_optionalChain([headmatter, 'optionalAccess', _ => _.addons]), () => ( []));
|
|
49
50
|
const roots = (
|
|
50
51
|
/* uniq */
|
|
51
52
|
[
|
|
52
|
-
|
|
53
|
-
...
|
|
54
|
-
|
|
53
|
+
_chunkCJW2UL6Kjs.getUserRoot.call(void 0, {}).userRoot,
|
|
54
|
+
..._chunkCJW2UL6Kjs.getAddonRoots.call(void 0, addons, ""),
|
|
55
|
+
_chunkCJW2UL6Kjs.getClientRoot.call(void 0, )
|
|
55
56
|
]
|
|
56
57
|
);
|
|
57
58
|
const mergeArrays = (a, b) => a.concat(b);
|
|
58
59
|
return await _chunkKKGXM3XLjs.loadSetups.call(void 0, roots, "preparser.ts", { filepath, headmatter }, [], false, mergeArrays);
|
|
59
60
|
});
|
|
60
|
-
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(
|
|
61
|
+
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkCJW2UL6Kjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
|
|
61
62
|
cli.command(
|
|
62
63
|
"* [entry]",
|
|
63
64
|
"Start a local server for Slidev",
|
|
@@ -113,9 +114,9 @@ cli.command(
|
|
|
113
114
|
async function initServer() {
|
|
114
115
|
if (server)
|
|
115
116
|
await server.close();
|
|
116
|
-
const options = await
|
|
117
|
+
const options = await _chunkCJW2UL6Kjs.resolveOptions.call(void 0, { entry, remote, theme, inspect }, "dev");
|
|
117
118
|
port = userPort || await findFreePort(3030);
|
|
118
|
-
server = await
|
|
119
|
+
server = await _chunkCJW2UL6Kjs.createServer.call(void 0,
|
|
119
120
|
options,
|
|
120
121
|
{
|
|
121
122
|
server: {
|
|
@@ -129,7 +130,7 @@ cli.command(
|
|
|
129
130
|
},
|
|
130
131
|
{
|
|
131
132
|
onDataReload(newData, data) {
|
|
132
|
-
if (!theme &&
|
|
133
|
+
if (!theme && _chunkCJW2UL6Kjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunkCJW2UL6Kjs.resolveThemeName.call(void 0, data.config.theme)) {
|
|
133
134
|
console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
|
|
134
135
|
initServer();
|
|
135
136
|
} else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
|
|
@@ -184,7 +185,7 @@ cli.command(
|
|
|
184
185
|
fullname: "quit",
|
|
185
186
|
action() {
|
|
186
187
|
try {
|
|
187
|
-
server
|
|
188
|
+
_optionalChain([server, 'optionalAccess', _2 => _2.close, 'call', _3 => _3()]);
|
|
188
189
|
} finally {
|
|
189
190
|
_process2.default.exit();
|
|
190
191
|
}
|
|
@@ -258,9 +259,9 @@ cli.command(
|
|
|
258
259
|
}).strict().help(),
|
|
259
260
|
async (args) => {
|
|
260
261
|
const { entry, theme, watch, base, download, out, inspect } = args;
|
|
261
|
-
const { build } = await Promise.resolve().then(() => require("./build-
|
|
262
|
+
const { build } = await Promise.resolve().then(() => require("./build-J2XECXHU.js"));
|
|
262
263
|
for (const entryFile of entry) {
|
|
263
|
-
const options = await
|
|
264
|
+
const options = await _chunkCJW2UL6Kjs.resolveOptions.call(void 0, { entry: entryFile, theme, inspect }, "build");
|
|
264
265
|
if (download && !options.data.config.download)
|
|
265
266
|
options.data.config.download = download;
|
|
266
267
|
printInfo(options);
|
|
@@ -280,9 +281,9 @@ cli.command(
|
|
|
280
281
|
(args) => commonOptions(args).strict().help(),
|
|
281
282
|
async ({ entry }) => {
|
|
282
283
|
for (const entryFile of entry) {
|
|
283
|
-
const data = await
|
|
284
|
-
|
|
285
|
-
await
|
|
284
|
+
const data = await _chunkCJW2UL6Kjs.parser.load(entryFile);
|
|
285
|
+
_chunkCJW2UL6Kjs.parser.prettify(data);
|
|
286
|
+
await _chunkCJW2UL6Kjs.parser.save(data);
|
|
286
287
|
}
|
|
287
288
|
}
|
|
288
289
|
);
|
|
@@ -298,17 +299,17 @@ cli.command(
|
|
|
298
299
|
default: "theme"
|
|
299
300
|
}),
|
|
300
301
|
async ({ entry, dir, theme: themeInput }) => {
|
|
301
|
-
const data = await
|
|
302
|
-
const theme =
|
|
302
|
+
const data = await _chunkCJW2UL6Kjs.parser.load(entry);
|
|
303
|
+
const theme = _chunkCJW2UL6Kjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
|
|
303
304
|
if (theme === "none") {
|
|
304
305
|
console.error('Cannot eject theme "none"');
|
|
305
306
|
_process2.default.exit(1);
|
|
306
307
|
}
|
|
307
|
-
if (
|
|
308
|
+
if (_chunkCJW2UL6Kjs.isPath.call(void 0, theme)) {
|
|
308
309
|
console.error("Theme is already ejected");
|
|
309
310
|
_process2.default.exit(1);
|
|
310
311
|
}
|
|
311
|
-
const roots =
|
|
312
|
+
const roots = _chunkCJW2UL6Kjs.getThemeRoots.call(void 0, theme, entry);
|
|
312
313
|
if (!roots.length) {
|
|
313
314
|
console.error(`Could not find theme "${theme}"`);
|
|
314
315
|
_process2.default.exit(1);
|
|
@@ -320,7 +321,7 @@ cli.command(
|
|
|
320
321
|
const dirPath = `./${dir}`;
|
|
321
322
|
data.slides[0].frontmatter.theme = dirPath;
|
|
322
323
|
data.slides[0].raw = null;
|
|
323
|
-
await
|
|
324
|
+
await _chunkCJW2UL6Kjs.parser.save(data);
|
|
324
325
|
console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
|
|
325
326
|
}
|
|
326
327
|
);
|
|
@@ -337,11 +338,11 @@ cli.command(
|
|
|
337
338
|
async (args) => {
|
|
338
339
|
const { entry, theme } = args;
|
|
339
340
|
_process2.default.env.NODE_ENV = "production";
|
|
340
|
-
const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-
|
|
341
|
+
const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-MCALG7XD.js"));
|
|
341
342
|
const port = await findFreePort(12445);
|
|
342
343
|
for (const entryFile of entry) {
|
|
343
|
-
const options = await
|
|
344
|
-
const server = await
|
|
344
|
+
const options = await _chunkCJW2UL6Kjs.resolveOptions.call(void 0, { entry: entryFile, theme }, "export");
|
|
345
|
+
const server = await _chunkCJW2UL6Kjs.createServer.call(void 0,
|
|
345
346
|
options,
|
|
346
347
|
{
|
|
347
348
|
server: { port },
|
|
@@ -350,7 +351,7 @@ cli.command(
|
|
|
350
351
|
);
|
|
351
352
|
await server.listen(port);
|
|
352
353
|
printInfo(options);
|
|
353
|
-
|
|
354
|
+
_chunkCJW2UL6Kjs.parser.filterDisabled(options.data);
|
|
354
355
|
const result = await exportSlides({
|
|
355
356
|
port,
|
|
356
357
|
...getExportOptions({ ...args, entry: entryFile }, options)
|
|
@@ -383,11 +384,11 @@ cli.command(
|
|
|
383
384
|
timeout
|
|
384
385
|
}) => {
|
|
385
386
|
_process2.default.env.NODE_ENV = "production";
|
|
386
|
-
const { exportNotes } = await Promise.resolve().then(() => require("./export-
|
|
387
|
+
const { exportNotes } = await Promise.resolve().then(() => require("./export-MCALG7XD.js"));
|
|
387
388
|
const port = await findFreePort(12445);
|
|
388
389
|
for (const entryFile of entry) {
|
|
389
|
-
const options = await
|
|
390
|
-
const server = await
|
|
390
|
+
const options = await _chunkCJW2UL6Kjs.resolveOptions.call(void 0, { entry: entryFile }, "export");
|
|
391
|
+
const server = await _chunkCJW2UL6Kjs.createServer.call(void 0,
|
|
391
392
|
options,
|
|
392
393
|
{
|
|
393
394
|
server: { port },
|
|
@@ -396,7 +397,7 @@ cli.command(
|
|
|
396
397
|
);
|
|
397
398
|
await server.listen(port);
|
|
398
399
|
printInfo(options);
|
|
399
|
-
|
|
400
|
+
_chunkCJW2UL6Kjs.parser.filterDisabled(options.data);
|
|
400
401
|
const result = await exportNotes({
|
|
401
402
|
port,
|
|
402
403
|
output: output || (options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${_path2.default.basename(entryFile, ".md")}-export-notes`),
|
|
@@ -457,7 +458,7 @@ function printInfo(options, port, remote, tunnelUrl) {
|
|
|
457
458
|
console.log();
|
|
458
459
|
console.log();
|
|
459
460
|
console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
|
|
460
|
-
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${
|
|
461
|
+
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkCJW2UL6Kjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
|
|
461
462
|
console.log();
|
|
462
463
|
_parser.verifyConfig.call(void 0, options.data.config, options.data.themeMeta, (v) => console.warn(_kolorist.yellow.call(void 0, ` ! ${v}`)));
|
|
463
464
|
console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
|
package/dist/cli.mjs
CHANGED
|
@@ -9,25 +9,25 @@ import {
|
|
|
9
9
|
resolveOptions,
|
|
10
10
|
resolveThemeName,
|
|
11
11
|
version
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Y2TFMOHQ.mjs";
|
|
13
13
|
import {
|
|
14
14
|
require_fast_deep_equal
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HA2YGJJG.mjs";
|
|
16
16
|
import {
|
|
17
17
|
loadSetups
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-JDHANZ37.mjs";
|
|
19
|
+
import "./chunk-ZEKM4EGL.mjs";
|
|
20
20
|
import {
|
|
21
21
|
__toESM
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QHOBBTS4.mjs";
|
|
23
23
|
|
|
24
24
|
// node/cli.ts
|
|
25
25
|
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
|
26
|
-
import path from "path";
|
|
27
|
-
import os from "os";
|
|
28
|
-
import { exec } from "child_process";
|
|
29
|
-
import * as readline from "readline";
|
|
30
|
-
import process from "process";
|
|
26
|
+
import path from "node:path";
|
|
27
|
+
import os from "node:os";
|
|
28
|
+
import { exec } from "node:child_process";
|
|
29
|
+
import * as readline from "node:readline";
|
|
30
|
+
import process from "node:process";
|
|
31
31
|
import fs from "fs-extra";
|
|
32
32
|
import openBrowser from "open";
|
|
33
33
|
import yargs from "yargs";
|
|
@@ -42,10 +42,11 @@ var CONFIG_RESTART_FIELDS = [
|
|
|
42
42
|
"monaco",
|
|
43
43
|
"routerMode",
|
|
44
44
|
"fonts",
|
|
45
|
-
"css"
|
|
45
|
+
"css",
|
|
46
|
+
"mdc"
|
|
46
47
|
];
|
|
47
48
|
injectPreparserExtensionLoader(async (headmatter, filepath) => {
|
|
48
|
-
const addons =
|
|
49
|
+
const addons = headmatter?.addons ?? [];
|
|
49
50
|
const roots = (
|
|
50
51
|
/* uniq */
|
|
51
52
|
[
|
|
@@ -184,7 +185,7 @@ cli.command(
|
|
|
184
185
|
fullname: "quit",
|
|
185
186
|
action() {
|
|
186
187
|
try {
|
|
187
|
-
server
|
|
188
|
+
server?.close();
|
|
188
189
|
} finally {
|
|
189
190
|
process.exit();
|
|
190
191
|
}
|
|
@@ -258,7 +259,7 @@ cli.command(
|
|
|
258
259
|
}).strict().help(),
|
|
259
260
|
async (args) => {
|
|
260
261
|
const { entry, theme, watch, base, download, out, inspect } = args;
|
|
261
|
-
const { build } = await import("./build-
|
|
262
|
+
const { build } = await import("./build-C2GYF6EU.mjs");
|
|
262
263
|
for (const entryFile of entry) {
|
|
263
264
|
const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
|
|
264
265
|
if (download && !options.data.config.download)
|
|
@@ -337,7 +338,7 @@ cli.command(
|
|
|
337
338
|
async (args) => {
|
|
338
339
|
const { entry, theme } = args;
|
|
339
340
|
process.env.NODE_ENV = "production";
|
|
340
|
-
const { exportSlides, getExportOptions } = await import("./export-
|
|
341
|
+
const { exportSlides, getExportOptions } = await import("./export-I7B4PU6A.mjs");
|
|
341
342
|
const port = await findFreePort(12445);
|
|
342
343
|
for (const entryFile of entry) {
|
|
343
344
|
const options = await resolveOptions({ entry: entryFile, theme }, "export");
|
|
@@ -383,7 +384,7 @@ cli.command(
|
|
|
383
384
|
timeout
|
|
384
385
|
}) => {
|
|
385
386
|
process.env.NODE_ENV = "production";
|
|
386
|
-
const { exportNotes } = await import("./export-
|
|
387
|
+
const { exportNotes } = await import("./export-I7B4PU6A.mjs");
|
|
387
388
|
const port = await findFreePort(12445);
|
|
388
389
|
for (const entryFile of entry) {
|
|
389
390
|
const options = await resolveOptions({ entry: entryFile }, "export");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
packageExists
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-ZEKM4EGL.mjs";
|
|
4
|
+
import "./chunk-QHOBBTS4.mjs";
|
|
5
5
|
|
|
6
6
|
// node/export.ts
|
|
7
|
-
import path from "path";
|
|
8
|
-
import { Buffer } from "buffer";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { Buffer } from "node:buffer";
|
|
9
9
|
import fs from "fs-extra";
|
|
10
10
|
import { blue, cyan, dim, green, yellow } from "kolorist";
|
|
11
11
|
import { Presets, SingleBar } from "cli-progress";
|
|
@@ -14,7 +14,6 @@ import { outlinePdfFactory } from "@lillallol/outline-pdf";
|
|
|
14
14
|
import * as pdfLib from "pdf-lib";
|
|
15
15
|
import { PDFDocument } from "pdf-lib";
|
|
16
16
|
function addToTree(tree, info, slideIndexes, level = 1) {
|
|
17
|
-
var _a;
|
|
18
17
|
const titleLevel = info.level;
|
|
19
18
|
if (titleLevel && titleLevel > level && tree.length > 0) {
|
|
20
19
|
addToTree(tree[tree.length - 1].children, info, slideIndexes, level + 1);
|
|
@@ -23,7 +22,7 @@ function addToTree(tree, info, slideIndexes, level = 1) {
|
|
|
23
22
|
children: [],
|
|
24
23
|
level,
|
|
25
24
|
path: String(slideIndexes[info.index + 1]),
|
|
26
|
-
hideInToc: Boolean(
|
|
25
|
+
hideInToc: Boolean(info.frontmatter?.hideInToc),
|
|
27
26
|
title: info.title
|
|
28
27
|
});
|
|
29
28
|
}
|
|
@@ -170,15 +169,13 @@ async function exportSlides({
|
|
|
170
169
|
clicksBySlide[path2] = (clicksBySlide[path2] || 0) + 1;
|
|
171
170
|
}
|
|
172
171
|
const slideIndexes = Object.fromEntries(Object.entries(clicksBySlide).reduce((acc, [path2, clicks], i) => {
|
|
173
|
-
|
|
174
|
-
acc.push([path2, clicks + (((_a = acc[i - 1]) == null ? void 0 : _a[1]) ?? 0)]);
|
|
172
|
+
acc.push([path2, clicks + (acc[i - 1]?.[1] ?? 0)]);
|
|
175
173
|
return acc;
|
|
176
174
|
}, []));
|
|
177
175
|
return slideIndexes;
|
|
178
176
|
}
|
|
179
177
|
function getClicksFromUrl(url) {
|
|
180
|
-
|
|
181
|
-
return (_a = url.match(/clicks=([1-9][0-9]*)/)) == null ? void 0 : _a[1];
|
|
178
|
+
return url.match(/clicks=([1-9][0-9]*)/)?.[1];
|
|
182
179
|
}
|
|
183
180
|
async function genPageWithClicks(fn, i, clicks) {
|
|
184
181
|
await fn(i, clicks);
|
|
@@ -225,7 +222,6 @@ async function exportSlides({
|
|
|
225
222
|
await fs.writeFile(output, buffer);
|
|
226
223
|
}
|
|
227
224
|
async function genPagePdfOnePiece() {
|
|
228
|
-
var _a, _b, _c, _d, _e, _f;
|
|
229
225
|
await go("print");
|
|
230
226
|
const slideIndexes = await getSlidesIndex();
|
|
231
227
|
await page.pdf({
|
|
@@ -244,17 +240,17 @@ async function exportSlides({
|
|
|
244
240
|
let pdfData = await fs.readFile(output);
|
|
245
241
|
let pdf = await PDFDocument.load(pdfData);
|
|
246
242
|
const titleSlide = slides[0];
|
|
247
|
-
if (titleSlide
|
|
243
|
+
if (titleSlide?.title)
|
|
248
244
|
pdf.setTitle(titleSlide.title);
|
|
249
|
-
if (
|
|
245
|
+
if (titleSlide?.frontmatter?.info)
|
|
250
246
|
pdf.setSubject(titleSlide.frontmatter.info);
|
|
251
|
-
if (
|
|
247
|
+
if (titleSlide?.frontmatter?.author)
|
|
252
248
|
pdf.setAuthor(titleSlide.frontmatter.author);
|
|
253
|
-
if (
|
|
254
|
-
if (Array.isArray(
|
|
255
|
-
pdf.setKeywords(
|
|
249
|
+
if (titleSlide?.frontmatter?.keywords) {
|
|
250
|
+
if (Array.isArray(titleSlide?.frontmatter?.keywords))
|
|
251
|
+
pdf.setKeywords(titleSlide?.frontmatter?.keywords);
|
|
256
252
|
else
|
|
257
|
-
pdf.setKeywords(
|
|
253
|
+
pdf.setKeywords(titleSlide?.frontmatter?.keywords.split(","));
|
|
258
254
|
}
|
|
259
255
|
if (withToc) {
|
|
260
256
|
const outlinePdf = outlinePdfFactory(pdfLib);
|
|
@@ -306,13 +302,12 @@ async function exportSlides({
|
|
|
306
302
|
async function genPageMd(slides2) {
|
|
307
303
|
const files = await fs.readdir(output);
|
|
308
304
|
const mds = files.map((file, i, files2) => {
|
|
309
|
-
var _a, _b, _c;
|
|
310
305
|
const slideIndex = getSlideIndex(file);
|
|
311
|
-
const mdImg = `![${
|
|
306
|
+
const mdImg = `![${slides2[slideIndex]?.title}](./${path.join(output, file)})
|
|
312
307
|
|
|
313
308
|
`;
|
|
314
|
-
if ((i + 1 === files2.length || getSlideIndex(files2[i + 1]) !== slideIndex) &&
|
|
315
|
-
return `${mdImg}${
|
|
309
|
+
if ((i + 1 === files2.length || getSlideIndex(files2[i + 1]) !== slideIndex) && slides2[slideIndex]?.note)
|
|
310
|
+
return `${mdImg}${slides2[slideIndex]?.note}
|
|
316
311
|
|
|
317
312
|
`;
|
|
318
313
|
return mdImg;
|