@slidev/cli 0.39.0 → 0.40.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-LQUKCJTB.mjs → build-BGUF7J7N.mjs} +1 -1
- package/dist/{build-XQGKVESO.js → build-L4S5TZG4.js} +5 -5
- package/dist/{chunk-IM22HCOO.js → chunk-GE7PFCER.js} +4 -4
- package/dist/{chunk-DTAZRAWW.js → chunk-QU6XIJOB.js} +10 -9
- package/dist/{chunk-CRCTWL4B.mjs → chunk-Y7LPFI3G.mjs} +2 -2
- package/dist/{chunk-36C7XM4S.mjs → chunk-ZAT6O5HR.mjs} +10 -9
- package/dist/cli.js +76 -33
- package/dist/cli.mjs +51 -8
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/package.json +11 -9
- package/template.md +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkQU6XIJOBjs = require('./chunk-QU6XIJOB.js');
|
|
6
6
|
require('./chunk-UJ5GHVII.js');
|
|
7
7
|
|
|
8
8
|
// node/build.ts
|
|
@@ -646,16 +646,16 @@ async function build(options, viteConfig = {}, args) {
|
|
|
646
646
|
let originalIndexHTML;
|
|
647
647
|
if (_fsextra2.default.existsSync(indexPath))
|
|
648
648
|
originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
|
|
649
|
-
await _fsextra2.default.writeFile(indexPath, await
|
|
649
|
+
await _fsextra2.default.writeFile(indexPath, await _chunkQU6XIJOBjs.getIndexHtml.call(void 0, options), "utf-8");
|
|
650
650
|
let config = void 0;
|
|
651
651
|
try {
|
|
652
|
-
const inlineConfig = await
|
|
652
|
+
const inlineConfig = await _chunkQU6XIJOBjs.mergeViteConfigs.call(void 0,
|
|
653
653
|
options,
|
|
654
654
|
viteConfig,
|
|
655
655
|
{
|
|
656
656
|
root: options.userRoot,
|
|
657
657
|
plugins: [
|
|
658
|
-
await
|
|
658
|
+
await _chunkQU6XIJOBjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
|
|
659
659
|
{
|
|
660
660
|
name: "resolve-config",
|
|
661
661
|
configResolved(_config) {
|
|
@@ -676,7 +676,7 @@ async function build(options, viteConfig = {}, args) {
|
|
|
676
676
|
} else {
|
|
677
677
|
console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
|
|
678
678
|
await _vite.build.call(void 0,
|
|
679
|
-
await
|
|
679
|
+
await _chunkQU6XIJOBjs.mergeViteConfigs.call(void 0,
|
|
680
680
|
options,
|
|
681
681
|
inlineConfig,
|
|
682
682
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
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 }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQU6XIJOBjs = require('./chunk-QU6XIJOB.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -2377,7 +2377,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
|
2377
2377
|
const pluginOptions = rawConfig.slidev || {};
|
|
2378
2378
|
process.env.EDITOR = process.env.EDITOR || "code";
|
|
2379
2379
|
const server = await _vite.createServer.call(void 0,
|
|
2380
|
-
await
|
|
2380
|
+
await _chunkQU6XIJOBjs.mergeViteConfigs.call(void 0,
|
|
2381
2381
|
options,
|
|
2382
2382
|
viteConfig,
|
|
2383
2383
|
{
|
|
@@ -2387,7 +2387,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
|
2387
2387
|
]
|
|
2388
2388
|
},
|
|
2389
2389
|
plugins: [
|
|
2390
|
-
await
|
|
2390
|
+
await _chunkQU6XIJOBjs.ViteSlidevPlugin.call(void 0, options, pluginOptions, serverOptions)
|
|
2391
2391
|
]
|
|
2392
2392
|
},
|
|
2393
2393
|
"serve"
|
|
@@ -2400,7 +2400,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
|
2400
2400
|
var _fs = require('@slidev/parser/fs'); var parser = _interopRequireWildcard(_fs);
|
|
2401
2401
|
|
|
2402
2402
|
// package.json
|
|
2403
|
-
var version = "0.
|
|
2403
|
+
var version = "0.40.1";
|
|
2404
2404
|
|
|
2405
2405
|
// node/themes.ts
|
|
2406
2406
|
var _prompts = require('prompts'); var _prompts2 = _interopRequireDefault(_prompts);
|
|
@@ -269,10 +269,10 @@ var dependencies = {
|
|
|
269
269
|
"@antfu/utils": "^0.7.2",
|
|
270
270
|
"@slidev/parser": "workspace:*",
|
|
271
271
|
"@slidev/types": "workspace:*",
|
|
272
|
-
"@unocss/reset": "^0.49.
|
|
273
|
-
"@vueuse/core": "^9.
|
|
274
|
-
"@vueuse/head": "^1.0.
|
|
275
|
-
"@vueuse/math": "^9.
|
|
272
|
+
"@unocss/reset": "^0.49.4",
|
|
273
|
+
"@vueuse/core": "^9.12.0",
|
|
274
|
+
"@vueuse/head": "^1.0.24",
|
|
275
|
+
"@vueuse/math": "^9.12.0",
|
|
276
276
|
"@vueuse/motion": "^2.0.0-beta.27",
|
|
277
277
|
codemirror: "^5.65.5",
|
|
278
278
|
defu: "^6.1.2",
|
|
@@ -287,9 +287,9 @@ var dependencies = {
|
|
|
287
287
|
prettier: "^2.8.3",
|
|
288
288
|
recordrtc: "^5.6.2",
|
|
289
289
|
resolve: "^1.22.1",
|
|
290
|
-
unocss: "^0.49.
|
|
290
|
+
unocss: "^0.49.4",
|
|
291
291
|
"vite-plugin-windicss": "^1.8.10",
|
|
292
|
-
vue: "^3.2.
|
|
292
|
+
vue: "^3.2.47",
|
|
293
293
|
"vue-router": "^4.1.6",
|
|
294
294
|
"vue-starport": "^0.3.0",
|
|
295
295
|
windicss: "^3.5.6"
|
|
@@ -472,7 +472,7 @@ md.use(_markdownitlinkattributes2.default, {
|
|
|
472
472
|
function prepareSlideInfo(data) {
|
|
473
473
|
return {
|
|
474
474
|
...data,
|
|
475
|
-
|
|
475
|
+
noteHTML: md.render((data == null ? void 0 : data.note) || "")
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
478
|
function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, userRoot, roots, remote }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
|
|
@@ -1614,7 +1614,6 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1614
1614
|
const MarkdownPlugin = await createMarkdownPlugin(options, pluginOptions);
|
|
1615
1615
|
const drawingData = await loadDrawings(options);
|
|
1616
1616
|
return [
|
|
1617
|
-
config.css === "unocss" ? await createUnocssPlugin(options, pluginOptions) : await createWindiCSSPlugin(options, pluginOptions),
|
|
1618
1617
|
MarkdownPlugin,
|
|
1619
1618
|
VueJsxPlugin,
|
|
1620
1619
|
VuePlugin,
|
|
@@ -1637,6 +1636,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1637
1636
|
customCollections: Object.keys(iconsOptions.customCollections || [])
|
|
1638
1637
|
})
|
|
1639
1638
|
],
|
|
1639
|
+
dts: false,
|
|
1640
1640
|
...componentsOptions
|
|
1641
1641
|
}),
|
|
1642
1642
|
_vite4.default.call(void 0, {
|
|
@@ -1682,7 +1682,8 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1682
1682
|
options.inspect ? _viteplugininspect2.default.call(void 0, {
|
|
1683
1683
|
dev: true,
|
|
1684
1684
|
build: true
|
|
1685
|
-
}) : null
|
|
1685
|
+
}) : null,
|
|
1686
|
+
config.css === "unocss" ? await createUnocssPlugin(options, pluginOptions) : await createWindiCSSPlugin(options, pluginOptions)
|
|
1686
1687
|
].flat().filter(_utils.notNullish);
|
|
1687
1688
|
}
|
|
1688
1689
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
mergeViteConfigs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZAT6O5HR.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__privateAdd,
|
|
@@ -2400,7 +2400,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
|
2400
2400
|
import * as parser from "@slidev/parser/fs";
|
|
2401
2401
|
|
|
2402
2402
|
// package.json
|
|
2403
|
-
var version = "0.
|
|
2403
|
+
var version = "0.40.1";
|
|
2404
2404
|
|
|
2405
2405
|
// node/themes.ts
|
|
2406
2406
|
import prompts2 from "prompts";
|
|
@@ -269,10 +269,10 @@ var dependencies = {
|
|
|
269
269
|
"@antfu/utils": "^0.7.2",
|
|
270
270
|
"@slidev/parser": "workspace:*",
|
|
271
271
|
"@slidev/types": "workspace:*",
|
|
272
|
-
"@unocss/reset": "^0.49.
|
|
273
|
-
"@vueuse/core": "^9.
|
|
274
|
-
"@vueuse/head": "^1.0.
|
|
275
|
-
"@vueuse/math": "^9.
|
|
272
|
+
"@unocss/reset": "^0.49.4",
|
|
273
|
+
"@vueuse/core": "^9.12.0",
|
|
274
|
+
"@vueuse/head": "^1.0.24",
|
|
275
|
+
"@vueuse/math": "^9.12.0",
|
|
276
276
|
"@vueuse/motion": "^2.0.0-beta.27",
|
|
277
277
|
codemirror: "^5.65.5",
|
|
278
278
|
defu: "^6.1.2",
|
|
@@ -287,9 +287,9 @@ var dependencies = {
|
|
|
287
287
|
prettier: "^2.8.3",
|
|
288
288
|
recordrtc: "^5.6.2",
|
|
289
289
|
resolve: "^1.22.1",
|
|
290
|
-
unocss: "^0.49.
|
|
290
|
+
unocss: "^0.49.4",
|
|
291
291
|
"vite-plugin-windicss": "^1.8.10",
|
|
292
|
-
vue: "^3.2.
|
|
292
|
+
vue: "^3.2.47",
|
|
293
293
|
"vue-router": "^4.1.6",
|
|
294
294
|
"vue-starport": "^0.3.0",
|
|
295
295
|
windicss: "^3.5.6"
|
|
@@ -472,7 +472,7 @@ md.use(mila, {
|
|
|
472
472
|
function prepareSlideInfo(data) {
|
|
473
473
|
return {
|
|
474
474
|
...data,
|
|
475
|
-
|
|
475
|
+
noteHTML: md.render((data == null ? void 0 : data.note) || "")
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
478
|
function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, userRoot, roots, remote }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
|
|
@@ -1614,7 +1614,6 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1614
1614
|
const MarkdownPlugin = await createMarkdownPlugin(options, pluginOptions);
|
|
1615
1615
|
const drawingData = await loadDrawings(options);
|
|
1616
1616
|
return [
|
|
1617
|
-
config.css === "unocss" ? await createUnocssPlugin(options, pluginOptions) : await createWindiCSSPlugin(options, pluginOptions),
|
|
1618
1617
|
MarkdownPlugin,
|
|
1619
1618
|
VueJsxPlugin,
|
|
1620
1619
|
VuePlugin,
|
|
@@ -1637,6 +1636,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1637
1636
|
customCollections: Object.keys(iconsOptions.customCollections || [])
|
|
1638
1637
|
})
|
|
1639
1638
|
],
|
|
1639
|
+
dts: false,
|
|
1640
1640
|
...componentsOptions
|
|
1641
1641
|
}),
|
|
1642
1642
|
Icons({
|
|
@@ -1682,7 +1682,8 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
1682
1682
|
options.inspect ? Inspect({
|
|
1683
1683
|
dev: true,
|
|
1684
1684
|
build: true
|
|
1685
|
-
}) : null
|
|
1685
|
+
}) : null,
|
|
1686
|
+
config.css === "unocss" ? await createUnocssPlugin(options, pluginOptions) : await createWindiCSSPlugin(options, pluginOptions)
|
|
1686
1687
|
].flat().filter(notNullish2);
|
|
1687
1688
|
}
|
|
1688
1689
|
|
package/dist/cli.js
CHANGED
|
@@ -9,17 +9,17 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkGE7PFCERjs = require('./chunk-GE7PFCER.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkQU6XIJOBjs = require('./chunk-QU6XIJOB.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
var _chunkUJ5GHVIIjs = require('./chunk-UJ5GHVII.js');
|
|
20
20
|
|
|
21
21
|
// node/cli.ts
|
|
22
|
-
var import_fast_deep_equal = _chunkUJ5GHVIIjs.__toESM.call(void 0,
|
|
22
|
+
var import_fast_deep_equal = _chunkUJ5GHVIIjs.__toESM.call(void 0, _chunkQU6XIJOBjs.require_fast_deep_equal.call(void 0, ));
|
|
23
23
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
24
24
|
var _os = require('os'); var _os2 = _interopRequireDefault(_os);
|
|
25
25
|
var _child_process = require('child_process');
|
|
@@ -43,14 +43,14 @@ var CONFIG_RESTART_FIELDS = [
|
|
|
43
43
|
_fs.injectPreparserExtensionLoader.call(void 0, async (headmatter, filepath) => {
|
|
44
44
|
const addons = _nullishCoalesce((headmatter == null ? void 0 : headmatter.addons), () => ( []));
|
|
45
45
|
const roots = [
|
|
46
|
-
|
|
47
|
-
...
|
|
48
|
-
|
|
46
|
+
_chunkGE7PFCERjs.getUserRoot.call(void 0, {}).userRoot,
|
|
47
|
+
..._chunkGE7PFCERjs.getAddonRoots.call(void 0, addons, ""),
|
|
48
|
+
_chunkGE7PFCERjs.getClientRoot.call(void 0, )
|
|
49
49
|
];
|
|
50
50
|
const mergeArrays = (a, b) => a.concat(b);
|
|
51
|
-
return await
|
|
51
|
+
return await _chunkQU6XIJOBjs.loadSetups.call(void 0, roots, "preparser.ts", { filepath, headmatter }, [], false, mergeArrays);
|
|
52
52
|
});
|
|
53
|
-
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(
|
|
53
|
+
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkGE7PFCERjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
|
|
54
54
|
cli.command(
|
|
55
55
|
"* [entry]",
|
|
56
56
|
"Start a local server for Slidev",
|
|
@@ -66,6 +66,10 @@ cli.command(
|
|
|
66
66
|
}).option("remote", {
|
|
67
67
|
type: "string",
|
|
68
68
|
describe: "listen public host and enable remote control"
|
|
69
|
+
}).option("tunnel", {
|
|
70
|
+
default: false,
|
|
71
|
+
type: "boolean",
|
|
72
|
+
describe: "open localtunnel to make Slidev available on the internet"
|
|
69
73
|
}).option("log", {
|
|
70
74
|
default: "warn",
|
|
71
75
|
type: "string",
|
|
@@ -81,7 +85,7 @@ cli.command(
|
|
|
81
85
|
type: "boolean",
|
|
82
86
|
describe: "force the optimizer to ignore the cache and re-bundle "
|
|
83
87
|
}).strict().help(),
|
|
84
|
-
async ({ entry, theme, port: userPort, open, log, remote, force, inspect }) => {
|
|
88
|
+
async ({ entry, theme, port: userPort, open, log, remote, tunnel, force, inspect }) => {
|
|
85
89
|
if (!_fsextra2.default.existsSync(entry) && !entry.endsWith(".md"))
|
|
86
90
|
entry = `${entry}.md`;
|
|
87
91
|
if (!_fsextra2.default.existsSync(entry)) {
|
|
@@ -98,12 +102,13 @@ cli.command(
|
|
|
98
102
|
}
|
|
99
103
|
let server;
|
|
100
104
|
let port = 3030;
|
|
105
|
+
let lastRemoteUrl;
|
|
101
106
|
async function initServer() {
|
|
102
107
|
if (server)
|
|
103
108
|
await server.close();
|
|
104
|
-
const options = await
|
|
109
|
+
const options = await _chunkGE7PFCERjs.resolveOptions.call(void 0, { entry, remote, theme, inspect }, "dev");
|
|
105
110
|
port = userPort || await findFreePort(3030);
|
|
106
|
-
server = await
|
|
111
|
+
server = await _chunkGE7PFCERjs.createServer.call(void 0,
|
|
107
112
|
options,
|
|
108
113
|
{
|
|
109
114
|
server: {
|
|
@@ -117,7 +122,7 @@ cli.command(
|
|
|
117
122
|
},
|
|
118
123
|
{
|
|
119
124
|
onDataReload(newData, data) {
|
|
120
|
-
if (!theme &&
|
|
125
|
+
if (!theme && _chunkGE7PFCERjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunkGE7PFCERjs.resolveThemeName.call(void 0, data.config.theme)) {
|
|
121
126
|
console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
|
|
122
127
|
initServer();
|
|
123
128
|
} else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
|
|
@@ -128,7 +133,22 @@ cli.command(
|
|
|
128
133
|
}
|
|
129
134
|
);
|
|
130
135
|
await server.listen();
|
|
131
|
-
|
|
136
|
+
let tunnelUrl = "";
|
|
137
|
+
if (tunnel) {
|
|
138
|
+
if (remote != null)
|
|
139
|
+
tunnelUrl = await openTunnel(port);
|
|
140
|
+
else
|
|
141
|
+
console.log(_kolorist.yellow.call(void 0, "\n --remote is required for tunneling, localtunnel is not enabled.\n"));
|
|
142
|
+
}
|
|
143
|
+
lastRemoteUrl = printInfo(options, port, remote, tunnelUrl);
|
|
144
|
+
}
|
|
145
|
+
async function openTunnel(port2) {
|
|
146
|
+
const localtunnel = await Promise.resolve().then(() => require("localtunnel")).then((r) => r.default || r);
|
|
147
|
+
const tunnel2 = await localtunnel({
|
|
148
|
+
port: port2,
|
|
149
|
+
local_host: "0.0.0.0"
|
|
150
|
+
});
|
|
151
|
+
return tunnel2.url;
|
|
132
152
|
}
|
|
133
153
|
const SHORTCUTS = [
|
|
134
154
|
{
|
|
@@ -151,6 +171,22 @@ cli.command(
|
|
|
151
171
|
action() {
|
|
152
172
|
_child_process.exec.call(void 0, `code "${entry}"`);
|
|
153
173
|
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "c",
|
|
177
|
+
fullname: "qrcode",
|
|
178
|
+
async action() {
|
|
179
|
+
if (!lastRemoteUrl)
|
|
180
|
+
return;
|
|
181
|
+
const qrcode = await Promise.resolve().then(() => require("qrcode-terminal")).then((r) => r.default || r);
|
|
182
|
+
qrcode.generate(lastRemoteUrl, { small: true }, (v) => {
|
|
183
|
+
console.log(`
|
|
184
|
+
${_kolorist.dim.call(void 0, " QR Code for remote control: ")}
|
|
185
|
+
${_kolorist.blue.call(void 0, lastRemoteUrl)}
|
|
186
|
+
`);
|
|
187
|
+
console.log(v.split("\n").map((i) => ` ${i}`).join("\n"));
|
|
188
|
+
});
|
|
189
|
+
}
|
|
154
190
|
}
|
|
155
191
|
];
|
|
156
192
|
function bindShortcut() {
|
|
@@ -204,8 +240,8 @@ cli.command(
|
|
|
204
240
|
}).strict().help(),
|
|
205
241
|
async (args) => {
|
|
206
242
|
const { entry, theme, watch, base, download, out, inspect } = args;
|
|
207
|
-
const { build } = await Promise.resolve().then(() => require("./build-
|
|
208
|
-
const options = await
|
|
243
|
+
const { build } = await Promise.resolve().then(() => require("./build-L4S5TZG4.js"));
|
|
244
|
+
const options = await _chunkGE7PFCERjs.resolveOptions.call(void 0, { entry, theme, inspect }, "build");
|
|
209
245
|
if (download && !options.data.config.download)
|
|
210
246
|
options.data.config.download = download;
|
|
211
247
|
printInfo(options);
|
|
@@ -223,9 +259,9 @@ cli.command(
|
|
|
223
259
|
"Format the markdown file",
|
|
224
260
|
(args) => commonOptions(args).strict().help(),
|
|
225
261
|
async ({ entry }) => {
|
|
226
|
-
const data = await
|
|
227
|
-
|
|
228
|
-
await
|
|
262
|
+
const data = await _chunkGE7PFCERjs.parser.load(entry);
|
|
263
|
+
_chunkGE7PFCERjs.parser.prettify(data);
|
|
264
|
+
await _chunkGE7PFCERjs.parser.save(data);
|
|
229
265
|
}
|
|
230
266
|
);
|
|
231
267
|
cli.command(
|
|
@@ -240,17 +276,17 @@ cli.command(
|
|
|
240
276
|
default: "theme"
|
|
241
277
|
}),
|
|
242
278
|
async ({ entry, dir, theme: themeInput }) => {
|
|
243
|
-
const data = await
|
|
244
|
-
const theme =
|
|
279
|
+
const data = await _chunkGE7PFCERjs.parser.load(entry);
|
|
280
|
+
const theme = _chunkGE7PFCERjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
|
|
245
281
|
if (theme === "none") {
|
|
246
282
|
console.error('Cannot eject theme "none"');
|
|
247
283
|
process.exit(1);
|
|
248
284
|
}
|
|
249
|
-
if (
|
|
285
|
+
if (_chunkGE7PFCERjs.isPath.call(void 0, theme)) {
|
|
250
286
|
console.error("Theme is already ejected");
|
|
251
287
|
process.exit(1);
|
|
252
288
|
}
|
|
253
|
-
const roots =
|
|
289
|
+
const roots = _chunkGE7PFCERjs.getThemeRoots.call(void 0, theme, entry);
|
|
254
290
|
if (!roots.length) {
|
|
255
291
|
console.error(`Could not find theme "${theme}"`);
|
|
256
292
|
process.exit(1);
|
|
@@ -262,7 +298,7 @@ cli.command(
|
|
|
262
298
|
const dirPath = `./${dir}`;
|
|
263
299
|
data.slides[0].frontmatter.theme = dirPath;
|
|
264
300
|
data.slides[0].raw = null;
|
|
265
|
-
await
|
|
301
|
+
await _chunkGE7PFCERjs.parser.save(data);
|
|
266
302
|
console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
|
|
267
303
|
}
|
|
268
304
|
);
|
|
@@ -281,8 +317,8 @@ cli.command(
|
|
|
281
317
|
process.env.NODE_ENV = "production";
|
|
282
318
|
const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-BRPXINGP.js"));
|
|
283
319
|
const port = await findFreePort(12445);
|
|
284
|
-
const options = await
|
|
285
|
-
const server = await
|
|
320
|
+
const options = await _chunkGE7PFCERjs.resolveOptions.call(void 0, { entry, theme }, "export");
|
|
321
|
+
const server = await _chunkGE7PFCERjs.createServer.call(void 0,
|
|
286
322
|
options,
|
|
287
323
|
{
|
|
288
324
|
server: { port },
|
|
@@ -291,7 +327,7 @@ cli.command(
|
|
|
291
327
|
);
|
|
292
328
|
await server.listen(port);
|
|
293
329
|
printInfo(options);
|
|
294
|
-
|
|
330
|
+
_chunkGE7PFCERjs.parser.filterDisabled(options.data);
|
|
295
331
|
const output = await exportSlides({
|
|
296
332
|
port,
|
|
297
333
|
...getExportOptions(args, options)
|
|
@@ -325,10 +361,10 @@ cli.command(
|
|
|
325
361
|
process.env.NODE_ENV = "production";
|
|
326
362
|
const { exportNotes } = await Promise.resolve().then(() => require("./export-BRPXINGP.js"));
|
|
327
363
|
const port = await findFreePort(12445);
|
|
328
|
-
const options = await
|
|
364
|
+
const options = await _chunkGE7PFCERjs.resolveOptions.call(void 0, { entry }, "export");
|
|
329
365
|
if (!output)
|
|
330
366
|
output = options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${_path2.default.basename(entry, ".md")}-export-notes`;
|
|
331
|
-
const server = await
|
|
367
|
+
const server = await _chunkGE7PFCERjs.createServer.call(void 0,
|
|
332
368
|
options,
|
|
333
369
|
{
|
|
334
370
|
server: { port },
|
|
@@ -337,7 +373,7 @@ cli.command(
|
|
|
337
373
|
);
|
|
338
374
|
await server.listen(port);
|
|
339
375
|
printInfo(options);
|
|
340
|
-
|
|
376
|
+
_chunkGE7PFCERjs.parser.filterDisabled(options.data);
|
|
341
377
|
output = await exportNotes({
|
|
342
378
|
port,
|
|
343
379
|
output,
|
|
@@ -393,11 +429,11 @@ function exportOptions(args) {
|
|
|
393
429
|
describe: "slide slides slide by slide. Works better with global components, but will break cross slide links and TOC in PDF"
|
|
394
430
|
});
|
|
395
431
|
}
|
|
396
|
-
function printInfo(options, port, remote) {
|
|
432
|
+
function printInfo(options, port, remote, tunnelUrl) {
|
|
397
433
|
console.log();
|
|
398
434
|
console.log();
|
|
399
435
|
console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
|
|
400
|
-
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${
|
|
436
|
+
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkGE7PFCERjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
|
|
401
437
|
console.log();
|
|
402
438
|
console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
|
|
403
439
|
console.log(_kolorist.dim.call(void 0, " entry ") + _kolorist.dim.call(void 0, _path2.default.dirname(options.entry) + _path2.default.sep) + _path2.default.basename(options.entry));
|
|
@@ -411,17 +447,24 @@ function printInfo(options, port, remote) {
|
|
|
411
447
|
console.log(`${_kolorist.dim.call(void 0, " presenter mode ")} > ${_kolorist.blue.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}${presenterPath}`)}`);
|
|
412
448
|
if (options.inspect)
|
|
413
449
|
console.log(`${_kolorist.dim.call(void 0, " inspector")} > ${_kolorist.yellow.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}/__inspect/`)}`);
|
|
450
|
+
let lastRemoteUrl = "";
|
|
414
451
|
if (remote !== void 0) {
|
|
415
452
|
Object.values(_os2.default.networkInterfaces()).forEach(
|
|
416
453
|
(v) => (v || []).filter((details) => String(details.family).slice(-1) === "4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
|
|
417
|
-
|
|
454
|
+
lastRemoteUrl = `http://${address}:${port}${presenterPath}`;
|
|
455
|
+
console.log(`${_kolorist.dim.call(void 0, " remote control ")} > ${_kolorist.blue.call(void 0, lastRemoteUrl)}`);
|
|
418
456
|
})
|
|
419
457
|
);
|
|
458
|
+
if (tunnelUrl) {
|
|
459
|
+
lastRemoteUrl = `${tunnelUrl}${presenterPath}`;
|
|
460
|
+
console.log(`${_kolorist.dim.call(void 0, " remote via tunnel")} > ${_kolorist.yellow.call(void 0, lastRemoteUrl)}`);
|
|
461
|
+
}
|
|
420
462
|
} else {
|
|
421
463
|
console.log(`${_kolorist.dim.call(void 0, " remote control ")} > ${_kolorist.dim.call(void 0, "pass --remote to enable")}`);
|
|
422
464
|
}
|
|
423
465
|
console.log();
|
|
424
|
-
console.log(`${_kolorist.dim.call(void 0, " shortcuts ")} > ${_kolorist.underline.call(void 0, "r")}${_kolorist.dim.call(void 0, "estart | ")}${_kolorist.underline.call(void 0, "o")}${_kolorist.dim.call(void 0, "pen | ")}${_kolorist.underline.call(void 0, "e")}${_kolorist.dim.call(void 0, "dit")}`);
|
|
466
|
+
console.log(`${_kolorist.dim.call(void 0, " shortcuts ")} > ${_kolorist.underline.call(void 0, "r")}${_kolorist.dim.call(void 0, "estart | ")}${_kolorist.underline.call(void 0, "o")}${_kolorist.dim.call(void 0, "pen | ")}${_kolorist.underline.call(void 0, "e")}${_kolorist.dim.call(void 0, "dit")}${lastRemoteUrl ? ` | ${_kolorist.dim.call(void 0, "qr")}${_kolorist.underline.call(void 0, "c")}${_kolorist.dim.call(void 0, "ode")}` : ""}`);
|
|
467
|
+
return lastRemoteUrl;
|
|
425
468
|
}
|
|
426
469
|
console.log();
|
|
427
470
|
_parser.verifyConfig.call(void 0, options.data.config, options.data.themeMeta, (v) => console.warn(_kolorist.yellow.call(void 0, ` ! ${v}`)));
|
package/dist/cli.mjs
CHANGED
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
resolveOptions,
|
|
10
10
|
resolveThemeName,
|
|
11
11
|
version
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Y7LPFI3G.mjs";
|
|
13
13
|
import {
|
|
14
14
|
loadSetups,
|
|
15
15
|
require_fast_deep_equal
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZAT6O5HR.mjs";
|
|
17
17
|
import {
|
|
18
18
|
__toESM
|
|
19
19
|
} from "./chunk-VLEV37KF.mjs";
|
|
@@ -66,6 +66,10 @@ cli.command(
|
|
|
66
66
|
}).option("remote", {
|
|
67
67
|
type: "string",
|
|
68
68
|
describe: "listen public host and enable remote control"
|
|
69
|
+
}).option("tunnel", {
|
|
70
|
+
default: false,
|
|
71
|
+
type: "boolean",
|
|
72
|
+
describe: "open localtunnel to make Slidev available on the internet"
|
|
69
73
|
}).option("log", {
|
|
70
74
|
default: "warn",
|
|
71
75
|
type: "string",
|
|
@@ -81,7 +85,7 @@ cli.command(
|
|
|
81
85
|
type: "boolean",
|
|
82
86
|
describe: "force the optimizer to ignore the cache and re-bundle "
|
|
83
87
|
}).strict().help(),
|
|
84
|
-
async ({ entry, theme, port: userPort, open, log, remote, force, inspect }) => {
|
|
88
|
+
async ({ entry, theme, port: userPort, open, log, remote, tunnel, force, inspect }) => {
|
|
85
89
|
if (!fs.existsSync(entry) && !entry.endsWith(".md"))
|
|
86
90
|
entry = `${entry}.md`;
|
|
87
91
|
if (!fs.existsSync(entry)) {
|
|
@@ -98,6 +102,7 @@ cli.command(
|
|
|
98
102
|
}
|
|
99
103
|
let server;
|
|
100
104
|
let port = 3030;
|
|
105
|
+
let lastRemoteUrl;
|
|
101
106
|
async function initServer() {
|
|
102
107
|
if (server)
|
|
103
108
|
await server.close();
|
|
@@ -128,7 +133,22 @@ cli.command(
|
|
|
128
133
|
}
|
|
129
134
|
);
|
|
130
135
|
await server.listen();
|
|
131
|
-
|
|
136
|
+
let tunnelUrl = "";
|
|
137
|
+
if (tunnel) {
|
|
138
|
+
if (remote != null)
|
|
139
|
+
tunnelUrl = await openTunnel(port);
|
|
140
|
+
else
|
|
141
|
+
console.log(yellow("\n --remote is required for tunneling, localtunnel is not enabled.\n"));
|
|
142
|
+
}
|
|
143
|
+
lastRemoteUrl = printInfo(options, port, remote, tunnelUrl);
|
|
144
|
+
}
|
|
145
|
+
async function openTunnel(port2) {
|
|
146
|
+
const localtunnel = await import("localtunnel").then((r) => r.default || r);
|
|
147
|
+
const tunnel2 = await localtunnel({
|
|
148
|
+
port: port2,
|
|
149
|
+
local_host: "0.0.0.0"
|
|
150
|
+
});
|
|
151
|
+
return tunnel2.url;
|
|
132
152
|
}
|
|
133
153
|
const SHORTCUTS = [
|
|
134
154
|
{
|
|
@@ -151,6 +171,22 @@ cli.command(
|
|
|
151
171
|
action() {
|
|
152
172
|
exec(`code "${entry}"`);
|
|
153
173
|
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "c",
|
|
177
|
+
fullname: "qrcode",
|
|
178
|
+
async action() {
|
|
179
|
+
if (!lastRemoteUrl)
|
|
180
|
+
return;
|
|
181
|
+
const qrcode = await import("qrcode-terminal").then((r) => r.default || r);
|
|
182
|
+
qrcode.generate(lastRemoteUrl, { small: true }, (v) => {
|
|
183
|
+
console.log(`
|
|
184
|
+
${dim(" QR Code for remote control: ")}
|
|
185
|
+
${blue(lastRemoteUrl)}
|
|
186
|
+
`);
|
|
187
|
+
console.log(v.split("\n").map((i) => ` ${i}`).join("\n"));
|
|
188
|
+
});
|
|
189
|
+
}
|
|
154
190
|
}
|
|
155
191
|
];
|
|
156
192
|
function bindShortcut() {
|
|
@@ -204,7 +240,7 @@ cli.command(
|
|
|
204
240
|
}).strict().help(),
|
|
205
241
|
async (args) => {
|
|
206
242
|
const { entry, theme, watch, base, download, out, inspect } = args;
|
|
207
|
-
const { build } = await import("./build-
|
|
243
|
+
const { build } = await import("./build-BGUF7J7N.mjs");
|
|
208
244
|
const options = await resolveOptions({ entry, theme, inspect }, "build");
|
|
209
245
|
if (download && !options.data.config.download)
|
|
210
246
|
options.data.config.download = download;
|
|
@@ -393,7 +429,7 @@ function exportOptions(args) {
|
|
|
393
429
|
describe: "slide slides slide by slide. Works better with global components, but will break cross slide links and TOC in PDF"
|
|
394
430
|
});
|
|
395
431
|
}
|
|
396
|
-
function printInfo(options, port, remote) {
|
|
432
|
+
function printInfo(options, port, remote, tunnelUrl) {
|
|
397
433
|
console.log();
|
|
398
434
|
console.log();
|
|
399
435
|
console.log(` ${cyan("\u25CF") + blue("\u25A0") + yellow("\u25B2")}`);
|
|
@@ -411,17 +447,24 @@ function printInfo(options, port, remote) {
|
|
|
411
447
|
console.log(`${dim(" presenter mode ")} > ${blue(`http://localhost:${bold(port)}${presenterPath}`)}`);
|
|
412
448
|
if (options.inspect)
|
|
413
449
|
console.log(`${dim(" inspector")} > ${yellow(`http://localhost:${bold(port)}/__inspect/`)}`);
|
|
450
|
+
let lastRemoteUrl = "";
|
|
414
451
|
if (remote !== void 0) {
|
|
415
452
|
Object.values(os.networkInterfaces()).forEach(
|
|
416
453
|
(v) => (v || []).filter((details) => String(details.family).slice(-1) === "4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
|
|
417
|
-
|
|
454
|
+
lastRemoteUrl = `http://${address}:${port}${presenterPath}`;
|
|
455
|
+
console.log(`${dim(" remote control ")} > ${blue(lastRemoteUrl)}`);
|
|
418
456
|
})
|
|
419
457
|
);
|
|
458
|
+
if (tunnelUrl) {
|
|
459
|
+
lastRemoteUrl = `${tunnelUrl}${presenterPath}`;
|
|
460
|
+
console.log(`${dim(" remote via tunnel")} > ${yellow(lastRemoteUrl)}`);
|
|
461
|
+
}
|
|
420
462
|
} else {
|
|
421
463
|
console.log(`${dim(" remote control ")} > ${dim("pass --remote to enable")}`);
|
|
422
464
|
}
|
|
423
465
|
console.log();
|
|
424
|
-
console.log(`${dim(" shortcuts ")} > ${underline("r")}${dim("estart | ")}${underline("o")}${dim("pen | ")}${underline("e")}${dim("dit")}`);
|
|
466
|
+
console.log(`${dim(" shortcuts ")} > ${underline("r")}${dim("estart | ")}${underline("o")}${dim("pen | ")}${underline("e")}${dim("dit")}${lastRemoteUrl ? ` | ${dim("qr")}${underline("c")}${dim("ode")}` : ""}`);
|
|
467
|
+
return lastRemoteUrl;
|
|
425
468
|
}
|
|
426
469
|
console.log();
|
|
427
470
|
verifyConfig(options.data.config, options.data.themeMeta, (v) => console.warn(yellow(` ! ${v}`)));
|
package/dist/index.js
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkGE7PFCERjs = require('./chunk-GE7PFCER.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkQU6XIJOBjs = require('./chunk-QU6XIJOB.js');
|
|
17
17
|
require('./chunk-UJ5GHVII.js');
|
|
18
18
|
|
|
19
19
|
|
|
@@ -28,4 +28,4 @@ require('./chunk-UJ5GHVII.js');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
exports.ViteSlidevPlugin =
|
|
31
|
+
exports.ViteSlidevPlugin = _chunkQU6XIJOBjs.ViteSlidevPlugin; exports.createServer = _chunkGE7PFCERjs.createServer; exports.createWindiCSSPlugin = _chunkQU6XIJOBjs.createWindiCSSPlugin; exports.getAddonRoots = _chunkGE7PFCERjs.getAddonRoots; exports.getCLIRoot = _chunkGE7PFCERjs.getCLIRoot; exports.getClientRoot = _chunkGE7PFCERjs.getClientRoot; exports.getRoot = _chunkGE7PFCERjs.getRoot; exports.getThemeRoots = _chunkGE7PFCERjs.getThemeRoots; exports.getUserRoot = _chunkGE7PFCERjs.getUserRoot; exports.isPath = _chunkGE7PFCERjs.isPath; exports.parser = _chunkGE7PFCERjs.parser; exports.resolveOptions = _chunkGE7PFCERjs.resolveOptions;
|
package/dist/index.mjs
CHANGED
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
isPath,
|
|
10
10
|
parser,
|
|
11
11
|
resolveOptions
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Y7LPFI3G.mjs";
|
|
13
13
|
import {
|
|
14
14
|
ViteSlidevPlugin,
|
|
15
15
|
createWindiCSSPlugin
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZAT6O5HR.mjs";
|
|
17
17
|
import "./chunk-VLEV37KF.mjs";
|
|
18
18
|
export {
|
|
19
19
|
ViteSlidevPlugin,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.1",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
"jiti": "^1.16.2",
|
|
64
64
|
"js-base64": "^3.7.4",
|
|
65
65
|
"katex": "^0.16.4",
|
|
66
|
-
"kolorist": "^1.
|
|
66
|
+
"kolorist": "^1.7.0",
|
|
67
|
+
"localtunnel": "^2.0.2",
|
|
67
68
|
"markdown-it": "^13.0.1",
|
|
68
69
|
"markdown-it-footnote": "^3.0.3",
|
|
69
70
|
"markdown-it-link-attributes": "^4.0.1",
|
|
@@ -75,25 +76,26 @@
|
|
|
75
76
|
"postcss-nested": "^6.0.0",
|
|
76
77
|
"prismjs": "^1.29.0",
|
|
77
78
|
"prompts": "^2.4.2",
|
|
79
|
+
"qrcode-terminal": "^0.12.0",
|
|
78
80
|
"resolve": "^1.22.1",
|
|
79
81
|
"resolve-from": "^5.0.0",
|
|
80
82
|
"resolve-global": "^1.0.0",
|
|
81
|
-
"shiki": "^0.
|
|
82
|
-
"unocss": "^0.49.
|
|
83
|
+
"shiki": "^0.14.0",
|
|
84
|
+
"unocss": "^0.49.4",
|
|
83
85
|
"unplugin-icons": "^0.15.2",
|
|
84
86
|
"unplugin-vue-components": "^0.23.0",
|
|
85
|
-
"vite": "^4.
|
|
87
|
+
"vite": "^4.1.1",
|
|
86
88
|
"vite-plugin-inspect": "^0.7.15",
|
|
87
89
|
"vite-plugin-remote-assets": "^0.3.0",
|
|
88
90
|
"vite-plugin-vue-markdown": "^0.22.2",
|
|
89
91
|
"vite-plugin-vue-server-ref": "^0.3.0",
|
|
90
92
|
"vite-plugin-windicss": "^1.8.10",
|
|
91
|
-
"vue": "^3.2.
|
|
93
|
+
"vue": "^3.2.47",
|
|
92
94
|
"windicss": "^3.5.6",
|
|
93
95
|
"yargs": "^17.6.2",
|
|
94
|
-
"@slidev/client": "0.
|
|
95
|
-
"@slidev/parser": "0.
|
|
96
|
-
"@slidev/types": "0.
|
|
96
|
+
"@slidev/client": "0.40.1",
|
|
97
|
+
"@slidev/parser": "0.40.1",
|
|
98
|
+
"@slidev/types": "0.40.1"
|
|
97
99
|
},
|
|
98
100
|
"devDependencies": {
|
|
99
101
|
"@types/plantuml-encoder": "^1.4.0",
|
package/template.md
CHANGED
|
@@ -27,7 +27,7 @@ Presentation slides for developers
|
|
|
27
27
|
</div>
|
|
28
28
|
|
|
29
29
|
<a href="https://github.com/slidevjs/slidev" target="_blank" alt="GitHub"
|
|
30
|
-
class="abs-br m-6 text-xl icon-btn opacity-50 !border-none !hover:text-white">
|
|
30
|
+
class="abs-br m-6 text-xl slidev-icon-btn opacity-50 !border-none !hover:text-white">
|
|
31
31
|
<carbon-logo-github />
|
|
32
32
|
</a>
|
|
33
33
|
|