@slidev/cli 0.31.3 → 0.32.2
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-TARUTLV7.js → build-M2QTEV63.js} +11 -11
- package/dist/{build-OBPH6VDP.mjs → build-YVXTTUTD.mjs} +3 -3
- package/dist/{chunk-BGLVULPK.js → chunk-IW3TSLZF.js} +77 -67
- package/dist/{chunk-OVW2G2MH.js → chunk-JWGORJY6.js} +6 -5
- package/dist/{chunk-ZSZGLQND.mjs → chunk-KIXPXAQ6.mjs} +441 -3428
- package/dist/{chunk-D6ZT4BYV.mjs → chunk-NOFZO6W4.mjs} +7 -6
- package/dist/{chunk-MCHS7HQA.mjs → chunk-WZ6OPJJF.mjs} +23 -13
- package/dist/{chunk-2MKHYABM.js → chunk-YCIQGGRR.js} +577 -3564
- package/dist/cli.js +37 -37
- package/dist/cli.mjs +27 -27
- package/dist/{export-F63P4ZXM.mjs → export-GIPHUNUX.mjs} +3 -5
- package/dist/{export-I6OGAJWC.js → export-M6HJUIFY.js} +4 -6
- package/dist/index.d.ts +13 -69
- package/dist/index.js +9 -7
- package/dist/index.mjs +10 -8
- package/package.json +17 -17
- package/dist/chunk-C4GAL67V.js +0 -31
- package/dist/chunk-EIZSCDHU.mjs +0 -31
package/dist/cli.js
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
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 }; }
|
|
2
2
|
|
|
3
|
-
var _chunkC4GAL67Vjs = require('./chunk-C4GAL67V.js');
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
|
|
9
|
+
var _chunkYCIQGGRRjs = require('./chunk-YCIQGGRR.js');
|
|
10
10
|
|
|
11
|
-
var _chunk2MKHYABMjs = require('./chunk-2MKHYABM.js');
|
|
12
11
|
|
|
12
|
+
var _chunkIW3TSLZFjs = require('./chunk-IW3TSLZF.js');
|
|
13
13
|
|
|
14
|
-
var _chunkBGLVULPKjs = require('./chunk-BGLVULPK.js');
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
var _chunkOVW2G2MHjs = require('./chunk-OVW2G2MH.js');
|
|
17
|
+
var _chunkJWGORJY6js = require('./chunk-JWGORJY6.js');
|
|
20
18
|
|
|
21
19
|
// node/cli.ts
|
|
22
|
-
|
|
23
|
-
var import_fast_deep_equal =
|
|
20
|
+
_chunkJWGORJY6js.init_cjs_shims.call(void 0, );
|
|
21
|
+
var import_fast_deep_equal = _chunkJWGORJY6js.__toESM.call(void 0, _chunkIW3TSLZFjs.require_fast_deep_equal.call(void 0, ));
|
|
24
22
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
25
23
|
var _net = require('net'); var _net2 = _interopRequireDefault(_net);
|
|
26
24
|
var _os = require('os'); var _os2 = _interopRequireDefault(_os);
|
|
@@ -38,7 +36,7 @@ var CONFIG_RESTART_FIELDS = [
|
|
|
38
36
|
"routerMode",
|
|
39
37
|
"fonts"
|
|
40
38
|
];
|
|
41
|
-
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(
|
|
39
|
+
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkYCIQGGRRjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
|
|
42
40
|
cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOptions(args).option("port", {
|
|
43
41
|
alias: "p",
|
|
44
42
|
type: "number",
|
|
@@ -49,8 +47,7 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
|
|
|
49
47
|
type: "boolean",
|
|
50
48
|
describe: "open in browser"
|
|
51
49
|
}).option("remote", {
|
|
52
|
-
|
|
53
|
-
type: "boolean",
|
|
50
|
+
type: "string",
|
|
54
51
|
describe: "listen public host and enable remote control"
|
|
55
52
|
}).option("log", {
|
|
56
53
|
default: "warn",
|
|
@@ -82,20 +79,20 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
|
|
|
82
79
|
async function initServer() {
|
|
83
80
|
if (server)
|
|
84
81
|
await server.close();
|
|
85
|
-
const options = await
|
|
82
|
+
const options = await _chunkYCIQGGRRjs.resolveOptions.call(void 0, { entry, remote, theme }, "dev");
|
|
86
83
|
port = userPort || await findFreePort(3030);
|
|
87
|
-
server = await
|
|
84
|
+
server = await _chunkYCIQGGRRjs.createServer.call(void 0, options, {
|
|
88
85
|
server: {
|
|
89
86
|
port,
|
|
90
87
|
strictPort: true,
|
|
91
88
|
open,
|
|
92
|
-
host: remote ? "0.0.0.0" : "localhost",
|
|
89
|
+
host: remote !== void 0 ? "0.0.0.0" : "localhost",
|
|
93
90
|
force
|
|
94
91
|
},
|
|
95
92
|
logLevel: log
|
|
96
93
|
}, {
|
|
97
94
|
onDataReload(newData, data) {
|
|
98
|
-
if (!theme &&
|
|
95
|
+
if (!theme && _chunkYCIQGGRRjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunkYCIQGGRRjs.resolveThemeName.call(void 0, data.config.theme)) {
|
|
99
96
|
console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
|
|
100
97
|
initServer();
|
|
101
98
|
} else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
|
|
@@ -171,8 +168,8 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
|
|
|
171
168
|
type: "boolean",
|
|
172
169
|
describe: "allow download as PDF"
|
|
173
170
|
}).strict().help(), async ({ entry, theme, watch, base, download, out }) => {
|
|
174
|
-
const { build } = await Promise.resolve().then(() =>
|
|
175
|
-
const options = await
|
|
171
|
+
const { build } = await Promise.resolve().then(() => _chunkJWGORJY6js.__toESM.call(void 0, _chunkJWGORJY6js.__require.call(void 0, "./build-M2QTEV63.js")));
|
|
172
|
+
const options = await _chunkYCIQGGRRjs.resolveOptions.call(void 0, { entry, theme }, "build");
|
|
176
173
|
if (download && !options.data.config.download)
|
|
177
174
|
options.data.config.download = download;
|
|
178
175
|
printInfo(options);
|
|
@@ -185,26 +182,26 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
|
|
|
185
182
|
});
|
|
186
183
|
});
|
|
187
184
|
cli.command("format [entry]", "Format the markdown file", (args) => commonOptions(args).strict().help(), async ({ entry }) => {
|
|
188
|
-
const data = await
|
|
189
|
-
|
|
190
|
-
await
|
|
185
|
+
const data = await _chunkYCIQGGRRjs.parser.load(entry);
|
|
186
|
+
_chunkYCIQGGRRjs.parser.prettify(data);
|
|
187
|
+
await _chunkYCIQGGRRjs.parser.save(data);
|
|
191
188
|
});
|
|
192
189
|
cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
193
190
|
return command.command("eject", "Eject current theme into local file system", (args) => commonOptions(args).option("dir", {
|
|
194
191
|
type: "string",
|
|
195
192
|
default: "theme"
|
|
196
193
|
}), async ({ entry, dir, theme: themeInput }) => {
|
|
197
|
-
const data = await
|
|
198
|
-
const theme =
|
|
194
|
+
const data = await _chunkYCIQGGRRjs.parser.load(entry);
|
|
195
|
+
const theme = _chunkYCIQGGRRjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
|
|
199
196
|
if (theme === "none") {
|
|
200
197
|
console.error('Can not eject theme "none"');
|
|
201
198
|
process.exit(1);
|
|
202
199
|
}
|
|
203
|
-
if (
|
|
200
|
+
if (_chunkYCIQGGRRjs.isPath.call(void 0, theme)) {
|
|
204
201
|
console.error("Theme is already ejected");
|
|
205
202
|
process.exit(1);
|
|
206
203
|
}
|
|
207
|
-
const roots =
|
|
204
|
+
const roots = _chunkYCIQGGRRjs.getThemeRoots.call(void 0, theme, entry);
|
|
208
205
|
if (!roots.length) {
|
|
209
206
|
console.error(`Does not found theme "${theme}"`);
|
|
210
207
|
process.exit(1);
|
|
@@ -216,7 +213,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
|
216
213
|
const dirPath = `./${dir}`;
|
|
217
214
|
data.slides[0].frontmatter.theme = dirPath;
|
|
218
215
|
data.slides[0].raw = null;
|
|
219
|
-
await
|
|
216
|
+
await _chunkYCIQGGRRjs.parser.save(data);
|
|
220
217
|
console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
|
|
221
218
|
});
|
|
222
219
|
}, () => {
|
|
@@ -225,7 +222,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
|
225
222
|
});
|
|
226
223
|
cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(args).option("output", {
|
|
227
224
|
type: "string",
|
|
228
|
-
describe: "path to the
|
|
225
|
+
describe: "path to the output"
|
|
229
226
|
}).option("format", {
|
|
230
227
|
default: "pdf",
|
|
231
228
|
type: "string",
|
|
@@ -258,17 +255,17 @@ cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(ar
|
|
|
258
255
|
"with-clicks": withClicks
|
|
259
256
|
}) => {
|
|
260
257
|
process.env.NODE_ENV = "production";
|
|
261
|
-
const { exportSlides } = await Promise.resolve().then(() =>
|
|
258
|
+
const { exportSlides } = await Promise.resolve().then(() => _chunkJWGORJY6js.__toESM.call(void 0, _chunkJWGORJY6js.__require.call(void 0, "./export-M6HJUIFY.js")));
|
|
262
259
|
const port = await findFreePort(12445);
|
|
263
|
-
const options = await
|
|
260
|
+
const options = await _chunkYCIQGGRRjs.resolveOptions.call(void 0, { entry, theme }, "build");
|
|
264
261
|
output = output || options.data.config.exportFilename || `${_path2.default.basename(entry, ".md")}-export`;
|
|
265
|
-
const server = await
|
|
262
|
+
const server = await _chunkYCIQGGRRjs.createServer.call(void 0, options, {
|
|
266
263
|
server: { port },
|
|
267
264
|
clearScreen: false
|
|
268
265
|
});
|
|
269
266
|
await server.listen(port);
|
|
270
267
|
printInfo(options);
|
|
271
|
-
|
|
268
|
+
_chunkYCIQGGRRjs.parser.filterDisabled(options.data);
|
|
272
269
|
const width = options.data.config.canvasWidth;
|
|
273
270
|
const height = Math.round(width / options.data.config.aspectRatio);
|
|
274
271
|
output = await exportSlides({
|
|
@@ -306,24 +303,27 @@ function printInfo(options, port, remote) {
|
|
|
306
303
|
console.log();
|
|
307
304
|
console.log();
|
|
308
305
|
console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
|
|
309
|
-
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${
|
|
306
|
+
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkYCIQGGRRjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
|
|
310
307
|
console.log();
|
|
311
308
|
console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
|
|
312
309
|
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));
|
|
313
310
|
if (port) {
|
|
314
|
-
const
|
|
311
|
+
const query = remote ? `?password=${remote}` : "";
|
|
312
|
+
const presenterPath = `${options.data.config.routerMode === "hash" ? "/#/" : "/"}presenter/${query}`;
|
|
315
313
|
console.log();
|
|
316
|
-
console.log(`${_kolorist.dim.call(void 0, " slide show
|
|
317
|
-
|
|
318
|
-
|
|
314
|
+
console.log(`${_kolorist.dim.call(void 0, " public slide show ")} > ${_kolorist.cyan.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}/`)}`);
|
|
315
|
+
if (query)
|
|
316
|
+
console.log(`${_kolorist.dim.call(void 0, " private slide show ")} > ${_kolorist.cyan.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}/${query}`)}`);
|
|
317
|
+
console.log(`${_kolorist.dim.call(void 0, " presenter mode ")} > ${_kolorist.blue.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}${presenterPath}`)}`);
|
|
318
|
+
if (remote !== void 0) {
|
|
319
319
|
Object.values(_os2.default.networkInterfaces()).forEach((v) => (v || []).filter((details) => details.family === "IPv4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
|
|
320
|
-
console.log(`${_kolorist.dim.call(void 0, " remote control ")}
|
|
320
|
+
console.log(`${_kolorist.dim.call(void 0, " remote control ")} > ${_kolorist.blue.call(void 0, `http://${address}:${port}${presenterPath}`)}`);
|
|
321
321
|
}));
|
|
322
322
|
} else {
|
|
323
|
-
console.log(`${_kolorist.dim.call(void 0, " remote control ")}
|
|
323
|
+
console.log(`${_kolorist.dim.call(void 0, " remote control ")} > ${_kolorist.dim.call(void 0, "pass --remote to enable")}`);
|
|
324
324
|
}
|
|
325
325
|
console.log();
|
|
326
|
-
console.log(`${_kolorist.dim.call(void 0, " shortcuts ")}
|
|
326
|
+
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")}`);
|
|
327
327
|
}
|
|
328
328
|
console.log();
|
|
329
329
|
console.log();
|
package/dist/cli.mjs
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createServer
|
|
3
|
-
} from "./chunk-EIZSCDHU.mjs";
|
|
4
|
-
import {
|
|
5
|
-
fs_exports,
|
|
2
|
+
createServer,
|
|
6
3
|
getThemeRoots,
|
|
7
4
|
isPath,
|
|
5
|
+
parser,
|
|
8
6
|
resolveOptions,
|
|
9
7
|
resolveThemeName,
|
|
10
8
|
version
|
|
11
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KIXPXAQ6.mjs";
|
|
12
10
|
import {
|
|
13
11
|
require_fast_deep_equal
|
|
14
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WZ6OPJJF.mjs";
|
|
15
13
|
import {
|
|
16
14
|
__dirname,
|
|
17
15
|
__require,
|
|
18
16
|
__toESM,
|
|
19
17
|
init_esm_shims
|
|
20
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-NOFZO6W4.mjs";
|
|
21
19
|
|
|
22
20
|
// node/cli.ts
|
|
23
21
|
init_esm_shims();
|
|
@@ -50,8 +48,7 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
|
|
|
50
48
|
type: "boolean",
|
|
51
49
|
describe: "open in browser"
|
|
52
50
|
}).option("remote", {
|
|
53
|
-
|
|
54
|
-
type: "boolean",
|
|
51
|
+
type: "string",
|
|
55
52
|
describe: "listen public host and enable remote control"
|
|
56
53
|
}).option("log", {
|
|
57
54
|
default: "warn",
|
|
@@ -83,14 +80,14 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
|
|
|
83
80
|
async function initServer() {
|
|
84
81
|
if (server)
|
|
85
82
|
await server.close();
|
|
86
|
-
const options = await resolveOptions({ entry, theme }, "dev");
|
|
83
|
+
const options = await resolveOptions({ entry, remote, theme }, "dev");
|
|
87
84
|
port = userPort || await findFreePort(3030);
|
|
88
85
|
server = await createServer(options, {
|
|
89
86
|
server: {
|
|
90
87
|
port,
|
|
91
88
|
strictPort: true,
|
|
92
89
|
open,
|
|
93
|
-
host: remote ? "0.0.0.0" : "localhost",
|
|
90
|
+
host: remote !== void 0 ? "0.0.0.0" : "localhost",
|
|
94
91
|
force
|
|
95
92
|
},
|
|
96
93
|
logLevel: log
|
|
@@ -172,7 +169,7 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
|
|
|
172
169
|
type: "boolean",
|
|
173
170
|
describe: "allow download as PDF"
|
|
174
171
|
}).strict().help(), async ({ entry, theme, watch, base, download, out }) => {
|
|
175
|
-
const { build } = await Promise.resolve().then(() => __toESM(__require("./build-
|
|
172
|
+
const { build } = await Promise.resolve().then(() => __toESM(__require("./build-YVXTTUTD.mjs")));
|
|
176
173
|
const options = await resolveOptions({ entry, theme }, "build");
|
|
177
174
|
if (download && !options.data.config.download)
|
|
178
175
|
options.data.config.download = download;
|
|
@@ -186,16 +183,16 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
|
|
|
186
183
|
});
|
|
187
184
|
});
|
|
188
185
|
cli.command("format [entry]", "Format the markdown file", (args) => commonOptions(args).strict().help(), async ({ entry }) => {
|
|
189
|
-
const data = await
|
|
190
|
-
|
|
191
|
-
await
|
|
186
|
+
const data = await parser.load(entry);
|
|
187
|
+
parser.prettify(data);
|
|
188
|
+
await parser.save(data);
|
|
192
189
|
});
|
|
193
190
|
cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
194
191
|
return command.command("eject", "Eject current theme into local file system", (args) => commonOptions(args).option("dir", {
|
|
195
192
|
type: "string",
|
|
196
193
|
default: "theme"
|
|
197
194
|
}), async ({ entry, dir, theme: themeInput }) => {
|
|
198
|
-
const data = await
|
|
195
|
+
const data = await parser.load(entry);
|
|
199
196
|
const theme = resolveThemeName(themeInput || data.config.theme);
|
|
200
197
|
if (theme === "none") {
|
|
201
198
|
console.error('Can not eject theme "none"');
|
|
@@ -217,7 +214,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
|
217
214
|
const dirPath = `./${dir}`;
|
|
218
215
|
data.slides[0].frontmatter.theme = dirPath;
|
|
219
216
|
data.slides[0].raw = null;
|
|
220
|
-
await
|
|
217
|
+
await parser.save(data);
|
|
221
218
|
console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
|
|
222
219
|
});
|
|
223
220
|
}, () => {
|
|
@@ -226,7 +223,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
|
226
223
|
});
|
|
227
224
|
cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(args).option("output", {
|
|
228
225
|
type: "string",
|
|
229
|
-
describe: "path to the
|
|
226
|
+
describe: "path to the output"
|
|
230
227
|
}).option("format", {
|
|
231
228
|
default: "pdf",
|
|
232
229
|
type: "string",
|
|
@@ -259,7 +256,7 @@ cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(ar
|
|
|
259
256
|
"with-clicks": withClicks
|
|
260
257
|
}) => {
|
|
261
258
|
process.env.NODE_ENV = "production";
|
|
262
|
-
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-
|
|
259
|
+
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-GIPHUNUX.mjs")));
|
|
263
260
|
const port = await findFreePort(12445);
|
|
264
261
|
const options = await resolveOptions({ entry, theme }, "build");
|
|
265
262
|
output = output || options.data.config.exportFilename || `${path.basename(entry, ".md")}-export`;
|
|
@@ -269,7 +266,7 @@ cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(ar
|
|
|
269
266
|
});
|
|
270
267
|
await server.listen(port);
|
|
271
268
|
printInfo(options);
|
|
272
|
-
|
|
269
|
+
parser.filterDisabled(options.data);
|
|
273
270
|
const width = options.data.config.canvasWidth;
|
|
274
271
|
const height = Math.round(width / options.data.config.aspectRatio);
|
|
275
272
|
output = await exportSlides({
|
|
@@ -312,19 +309,22 @@ function printInfo(options, port, remote) {
|
|
|
312
309
|
console.log(dim(" theme ") + (options.theme ? green(options.theme) : gray("none")));
|
|
313
310
|
console.log(dim(" entry ") + dim(path.dirname(options.entry) + path.sep) + path.basename(options.entry));
|
|
314
311
|
if (port) {
|
|
315
|
-
const
|
|
312
|
+
const query = remote ? `?password=${remote}` : "";
|
|
313
|
+
const presenterPath = `${options.data.config.routerMode === "hash" ? "/#/" : "/"}presenter/${query}`;
|
|
316
314
|
console.log();
|
|
317
|
-
console.log(`${dim(" slide show
|
|
318
|
-
|
|
319
|
-
|
|
315
|
+
console.log(`${dim(" public slide show ")} > ${cyan(`http://localhost:${bold(port)}/`)}`);
|
|
316
|
+
if (query)
|
|
317
|
+
console.log(`${dim(" private slide show ")} > ${cyan(`http://localhost:${bold(port)}/${query}`)}`);
|
|
318
|
+
console.log(`${dim(" presenter mode ")} > ${blue(`http://localhost:${bold(port)}${presenterPath}`)}`);
|
|
319
|
+
if (remote !== void 0) {
|
|
320
320
|
Object.values(os.networkInterfaces()).forEach((v) => (v || []).filter((details) => details.family === "IPv4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
|
|
321
|
-
console.log(`${dim(" remote control ")}
|
|
321
|
+
console.log(`${dim(" remote control ")} > ${blue(`http://${address}:${port}${presenterPath}`)}`);
|
|
322
322
|
}));
|
|
323
323
|
} else {
|
|
324
|
-
console.log(`${dim(" remote control ")}
|
|
324
|
+
console.log(`${dim(" remote control ")} > ${dim("pass --remote to enable")}`);
|
|
325
325
|
}
|
|
326
326
|
console.log();
|
|
327
|
-
console.log(`${dim(" shortcuts ")}
|
|
327
|
+
console.log(`${dim(" shortcuts ")} > ${underline("r")}${dim("estart | ")}${underline("o")}${dim("pen | ")}${underline("e")}${dim("dit")}`);
|
|
328
328
|
}
|
|
329
329
|
console.log();
|
|
330
330
|
console.log();
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
packageExists
|
|
3
|
-
} from "./chunk-ZSZGLQND.mjs";
|
|
4
1
|
import {
|
|
5
2
|
__require,
|
|
6
3
|
__toESM,
|
|
7
|
-
init_esm_shims
|
|
8
|
-
|
|
4
|
+
init_esm_shims,
|
|
5
|
+
packageExists
|
|
6
|
+
} from "./chunk-NOFZO6W4.mjs";
|
|
9
7
|
|
|
10
8
|
// node/export.ts
|
|
11
9
|
init_esm_shims();
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var _chunk2MKHYABMjs = require('./chunk-2MKHYABM.js');
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
var _chunkOVW2G2MHjs = require('./chunk-OVW2G2MH.js');
|
|
6
|
+
var _chunkJWGORJY6js = require('./chunk-JWGORJY6.js');
|
|
9
7
|
|
|
10
8
|
// node/export.ts
|
|
11
|
-
|
|
9
|
+
_chunkJWGORJY6js.init_cjs_shims.call(void 0, );
|
|
12
10
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
13
11
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
14
12
|
var _kolorist = require('kolorist');
|
|
@@ -62,10 +60,10 @@ async function exportSlides({
|
|
|
62
60
|
height = 1080,
|
|
63
61
|
withClicks = false
|
|
64
62
|
}) {
|
|
65
|
-
if (!
|
|
63
|
+
if (!_chunkJWGORJY6js.packageExists.call(void 0, "playwright-chromium"))
|
|
66
64
|
throw new Error("The exporting for Slidev is powered by Playwright, please installed it via `npm i -D playwright-chromium`");
|
|
67
65
|
const pages = _core.parseRangeString.call(void 0, total, range);
|
|
68
|
-
const { chromium } = await Promise.resolve().then(() =>
|
|
66
|
+
const { chromium } = await Promise.resolve().then(() => _chunkJWGORJY6js.__toESM.call(void 0, _chunkJWGORJY6js.__require.call(void 0, "playwright-chromium")));
|
|
69
67
|
const browser = await chromium.launch();
|
|
70
68
|
const context = await browser.newContext({
|
|
71
69
|
viewport: {
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,11 @@ import WindiCSS from 'vite-plugin-windicss';
|
|
|
6
6
|
import RemoteAssets from 'vite-plugin-remote-assets';
|
|
7
7
|
import ServerRef from 'vite-plugin-vue-server-ref';
|
|
8
8
|
import { ArgumentsType } from '@antfu/utils';
|
|
9
|
-
import { SlidevMarkdown
|
|
9
|
+
import { SlidevMarkdown } from '@slidev/types';
|
|
10
10
|
import * as vite from 'vite';
|
|
11
11
|
import { InlineConfig, Plugin } from 'vite';
|
|
12
|
+
import * as fs from '@slidev/parser/fs';
|
|
13
|
+
export { fs as parser };
|
|
12
14
|
|
|
13
15
|
interface SlidevEntryOptions {
|
|
14
16
|
/**
|
|
@@ -21,6 +23,10 @@ interface SlidevEntryOptions {
|
|
|
21
23
|
* Theme id
|
|
22
24
|
*/
|
|
23
25
|
theme?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Remote password
|
|
28
|
+
*/
|
|
29
|
+
remote?: string;
|
|
24
30
|
/**
|
|
25
31
|
* Root path
|
|
26
32
|
*
|
|
@@ -36,8 +42,10 @@ interface ResolvedSlidevOptions {
|
|
|
36
42
|
clientRoot: string;
|
|
37
43
|
theme: string;
|
|
38
44
|
themeRoots: string[];
|
|
45
|
+
addonRoots: string[];
|
|
39
46
|
roots: string[];
|
|
40
47
|
mode: 'dev' | 'build';
|
|
48
|
+
remote?: string;
|
|
41
49
|
}
|
|
42
50
|
interface SlidevPluginOptions extends SlidevEntryOptions {
|
|
43
51
|
vue?: ArgumentsType<typeof Vue>[0];
|
|
@@ -55,6 +63,8 @@ declare function getClientRoot(): string;
|
|
|
55
63
|
declare function getCLIRoot(): string;
|
|
56
64
|
declare function isPath(name: string): boolean;
|
|
57
65
|
declare function getThemeRoots(name: string, entry: string): string[];
|
|
66
|
+
declare function getAddonRoots(addons: string[], entry: string): string[];
|
|
67
|
+
declare function getRoot(name: string, entry: string): string;
|
|
58
68
|
declare function getUserRoot(options: SlidevEntryOptions): {
|
|
59
69
|
entry: string;
|
|
60
70
|
userRoot: string;
|
|
@@ -76,72 +86,6 @@ declare function createServer(options: ResolvedSlidevOptions, viteConfig?: Inlin
|
|
|
76
86
|
|
|
77
87
|
declare function ViteSlidevPlugin(options: ResolvedSlidevOptions, pluginOptions: SlidevPluginOptions, serverOptions?: SlidevServerOptions): Promise<Plugin[]>;
|
|
78
88
|
|
|
79
|
-
declare function createWindiCSSPlugin({ themeRoots, clientRoot, userRoot, roots, data }: ResolvedSlidevOptions, { windicss: windiOptions }: SlidevPluginOptions): Promise<vite.Plugin[]>;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* 1,3-5,8 => [1, 3, 4, 5, 8]
|
|
83
|
-
*/
|
|
84
|
-
declare function parseRangeString(total: number, rangeStr?: string): number[];
|
|
85
|
-
/**
|
|
86
|
-
* Accepts `16/9` `1:1` `3x4`
|
|
87
|
-
*/
|
|
88
|
-
declare function parseAspectRatio(str: string | number): number;
|
|
89
|
-
|
|
90
|
-
declare function resolveConfig(headmatter: any, themeMeta?: SlidevThemeMeta): SlidevConfig;
|
|
91
|
-
declare function resolveFonts(fonts?: FontOptions): ResolvedFontOptions;
|
|
92
|
-
|
|
93
|
-
declare function stringify(data: SlidevMarkdown): string;
|
|
94
|
-
declare function filterDisabled(data: SlidevMarkdown): SlidevMarkdown;
|
|
95
|
-
declare function stringifySlide(data: SlideInfoBase, idx?: number): string;
|
|
96
|
-
declare function prettifySlide(data: SlideInfoBase): SlideInfoBase;
|
|
97
|
-
declare function prettify(data: SlidevMarkdown): SlidevMarkdown;
|
|
98
|
-
declare function detectFeatures(code: string): SlidevFeatureFlags;
|
|
99
|
-
declare function parseSlide(raw: string): SlideInfoBase;
|
|
100
|
-
declare function parse(markdown: string, filepath?: string, themeMeta?: SlidevThemeMeta): SlidevMarkdown;
|
|
101
|
-
declare function mergeFeatureFlags(a: SlidevFeatureFlags, b: SlidevFeatureFlags): SlidevFeatureFlags;
|
|
102
|
-
declare function scanMonacoModules(md: string): string[];
|
|
103
|
-
|
|
104
|
-
declare function load(filepath: string, themeMeta?: SlidevThemeMeta, content?: string): Promise<SlidevMarkdown>;
|
|
105
|
-
declare function save(data: SlidevMarkdown, filepath?: string): Promise<void>;
|
|
106
|
-
declare function saveExternalSlide(slide: SlideInfoWithPath): Promise<void>;
|
|
107
|
-
|
|
108
|
-
declare const fs_load: typeof load;
|
|
109
|
-
declare const fs_save: typeof save;
|
|
110
|
-
declare const fs_saveExternalSlide: typeof saveExternalSlide;
|
|
111
|
-
declare const fs_parseRangeString: typeof parseRangeString;
|
|
112
|
-
declare const fs_parseAspectRatio: typeof parseAspectRatio;
|
|
113
|
-
declare const fs_resolveConfig: typeof resolveConfig;
|
|
114
|
-
declare const fs_resolveFonts: typeof resolveFonts;
|
|
115
|
-
declare const fs_stringify: typeof stringify;
|
|
116
|
-
declare const fs_filterDisabled: typeof filterDisabled;
|
|
117
|
-
declare const fs_stringifySlide: typeof stringifySlide;
|
|
118
|
-
declare const fs_prettifySlide: typeof prettifySlide;
|
|
119
|
-
declare const fs_prettify: typeof prettify;
|
|
120
|
-
declare const fs_detectFeatures: typeof detectFeatures;
|
|
121
|
-
declare const fs_parseSlide: typeof parseSlide;
|
|
122
|
-
declare const fs_parse: typeof parse;
|
|
123
|
-
declare const fs_mergeFeatureFlags: typeof mergeFeatureFlags;
|
|
124
|
-
declare const fs_scanMonacoModules: typeof scanMonacoModules;
|
|
125
|
-
declare namespace fs {
|
|
126
|
-
export {
|
|
127
|
-
fs_load as load,
|
|
128
|
-
fs_save as save,
|
|
129
|
-
fs_saveExternalSlide as saveExternalSlide,
|
|
130
|
-
fs_parseRangeString as parseRangeString,
|
|
131
|
-
fs_parseAspectRatio as parseAspectRatio,
|
|
132
|
-
fs_resolveConfig as resolveConfig,
|
|
133
|
-
fs_resolveFonts as resolveFonts,
|
|
134
|
-
fs_stringify as stringify,
|
|
135
|
-
fs_filterDisabled as filterDisabled,
|
|
136
|
-
fs_stringifySlide as stringifySlide,
|
|
137
|
-
fs_prettifySlide as prettifySlide,
|
|
138
|
-
fs_prettify as prettify,
|
|
139
|
-
fs_detectFeatures as detectFeatures,
|
|
140
|
-
fs_parseSlide as parseSlide,
|
|
141
|
-
fs_parse as parse,
|
|
142
|
-
fs_mergeFeatureFlags as mergeFeatureFlags,
|
|
143
|
-
fs_scanMonacoModules as scanMonacoModules,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
89
|
+
declare function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRoot, roots, data }: ResolvedSlidevOptions, { windicss: windiOptions }: SlidevPluginOptions): Promise<vite.Plugin[]>;
|
|
146
90
|
|
|
147
|
-
export { ResolvedSlidevOptions, SlidevEntryOptions, SlidevPluginOptions, SlidevServerOptions, ViteSlidevPlugin, createServer, createWindiCSSPlugin, getCLIRoot, getClientRoot, getThemeRoots, getUserRoot, isPath,
|
|
91
|
+
export { ResolvedSlidevOptions, SlidevEntryOptions, SlidevPluginOptions, SlidevServerOptions, ViteSlidevPlugin, createServer, createWindiCSSPlugin, getAddonRoots, getCLIRoot, getClientRoot, getRoot, getThemeRoots, getUserRoot, isPath, resolveOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var _chunkC4GAL67Vjs = require('./chunk-C4GAL67V.js');
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
|
|
@@ -9,20 +8,23 @@ var _chunkC4GAL67Vjs = require('./chunk-C4GAL67V.js');
|
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
|
|
12
|
-
var _chunk2MKHYABMjs = require('./chunk-2MKHYABM.js');
|
|
13
11
|
|
|
12
|
+
var _chunkYCIQGGRRjs = require('./chunk-YCIQGGRR.js');
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
var _chunkBGLVULPKjs = require('./chunk-BGLVULPK.js');
|
|
17
15
|
|
|
16
|
+
var _chunkIW3TSLZFjs = require('./chunk-IW3TSLZF.js');
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
|
|
19
|
+
var _chunkJWGORJY6js = require('./chunk-JWGORJY6.js');
|
|
20
20
|
|
|
21
21
|
// node/index.ts
|
|
22
|
-
|
|
22
|
+
_chunkJWGORJY6js.init_cjs_shims.call(void 0, );
|
|
23
23
|
|
|
24
24
|
// node/declare.ts
|
|
25
|
-
|
|
25
|
+
_chunkJWGORJY6js.init_cjs_shims.call(void 0, );
|
|
26
|
+
|
|
27
|
+
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
|
|
@@ -34,4 +36,4 @@ _chunkOVW2G2MHjs.init_cjs_shims.call(void 0, );
|
|
|
34
36
|
|
|
35
37
|
|
|
36
38
|
|
|
37
|
-
exports.ViteSlidevPlugin =
|
|
39
|
+
exports.ViteSlidevPlugin = _chunkIW3TSLZFjs.ViteSlidevPlugin; exports.createServer = _chunkYCIQGGRRjs.createServer; exports.createWindiCSSPlugin = _chunkIW3TSLZFjs.createWindiCSSPlugin; exports.getAddonRoots = _chunkYCIQGGRRjs.getAddonRoots; exports.getCLIRoot = _chunkYCIQGGRRjs.getCLIRoot; exports.getClientRoot = _chunkYCIQGGRRjs.getClientRoot; exports.getRoot = _chunkYCIQGGRRjs.getRoot; exports.getThemeRoots = _chunkYCIQGGRRjs.getThemeRoots; exports.getUserRoot = _chunkYCIQGGRRjs.getUserRoot; exports.isPath = _chunkYCIQGGRRjs.isPath; exports.parser = _chunkYCIQGGRRjs.parser; exports.resolveOptions = _chunkYCIQGGRRjs.resolveOptions;
|
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createServer
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
fs_exports,
|
|
2
|
+
createServer,
|
|
3
|
+
getAddonRoots,
|
|
6
4
|
getCLIRoot,
|
|
7
5
|
getClientRoot,
|
|
6
|
+
getRoot,
|
|
8
7
|
getThemeRoots,
|
|
9
8
|
getUserRoot,
|
|
10
9
|
isPath,
|
|
10
|
+
parser,
|
|
11
11
|
resolveOptions
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KIXPXAQ6.mjs";
|
|
13
13
|
import {
|
|
14
14
|
ViteSlidevPlugin,
|
|
15
15
|
createWindiCSSPlugin
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WZ6OPJJF.mjs";
|
|
17
17
|
import {
|
|
18
18
|
init_esm_shims
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NOFZO6W4.mjs";
|
|
20
20
|
|
|
21
21
|
// node/index.ts
|
|
22
22
|
init_esm_shims();
|
|
@@ -27,11 +27,13 @@ export {
|
|
|
27
27
|
ViteSlidevPlugin,
|
|
28
28
|
createServer,
|
|
29
29
|
createWindiCSSPlugin,
|
|
30
|
+
getAddonRoots,
|
|
30
31
|
getCLIRoot,
|
|
31
32
|
getClientRoot,
|
|
33
|
+
getRoot,
|
|
32
34
|
getThemeRoots,
|
|
33
35
|
getUserRoot,
|
|
34
36
|
isPath,
|
|
35
|
-
|
|
37
|
+
parser,
|
|
36
38
|
resolveOptions
|
|
37
39
|
};
|