@slidev/cli 0.35.5 → 0.36.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-RBCFVFDG.mjs → build-LS63HRWN.mjs} +53 -38
- package/dist/{build-PO2PXBSF.js → build-VLQNNPIA.js} +59 -44
- package/dist/{chunk-SQLX75IO.js → chunk-74QPSS6T.js} +12 -7
- package/dist/{chunk-AHXRM5NG.js → chunk-CG3QPKUJ.js} +199 -161
- package/dist/{chunk-QPGEWKWZ.mjs → chunk-DRWWOOWC.mjs} +141 -109
- package/dist/{chunk-GVA336JI.mjs → chunk-IAMILGBS.mjs} +12 -7
- package/dist/{chunk-ZJSOFQBR.js → chunk-L3B76JRZ.js} +181 -149
- package/dist/{chunk-SWNG6UPD.mjs → chunk-S3HDHTBQ.mjs} +69 -31
- package/dist/cli.js +301 -252
- package/dist/cli.mjs +296 -247
- package/dist/{export-U7F6XGP6.mjs → export-26FXNM7P.mjs} +1 -1
- package/dist/{export-JXFGVO7B.js → export-WKFHZNBT.js} +4 -4
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -6
- package/dist/index.mjs +3 -3
- package/package.json +19 -18
package/dist/cli.js
CHANGED
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkCG3QPKUJjs = require('./chunk-CG3QPKUJ.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkL3B76JRZjs = require('./chunk-L3B76JRZ.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunk74QPSS6Tjs = require('./chunk-74QPSS6T.js');
|
|
18
18
|
|
|
19
19
|
// node/cli.ts
|
|
20
|
-
|
|
21
|
-
var import_fast_deep_equal =
|
|
20
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
21
|
+
var import_fast_deep_equal = _chunk74QPSS6Tjs.__toESM.call(void 0, _chunkL3B76JRZjs.require_fast_deep_equal.call(void 0, ));
|
|
22
22
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
23
23
|
var _net = require('net'); var _net2 = _interopRequireDefault(_net);
|
|
24
24
|
var _os = require('os'); var _os2 = _interopRequireDefault(_os);
|
|
@@ -38,262 +38,307 @@ var CONFIG_RESTART_FIELDS = [
|
|
|
38
38
|
"fonts",
|
|
39
39
|
"css"
|
|
40
40
|
];
|
|
41
|
-
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(
|
|
42
|
-
cli.command(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}).option("
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
41
|
+
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkCG3QPKUJjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
|
|
42
|
+
cli.command(
|
|
43
|
+
"* [entry]",
|
|
44
|
+
"Start a local server for Slidev",
|
|
45
|
+
(args) => commonOptions(args).option("port", {
|
|
46
|
+
alias: "p",
|
|
47
|
+
type: "number",
|
|
48
|
+
describe: "port"
|
|
49
|
+
}).option("open", {
|
|
50
|
+
alias: "o",
|
|
51
|
+
default: false,
|
|
52
|
+
type: "boolean",
|
|
53
|
+
describe: "open in browser"
|
|
54
|
+
}).option("remote", {
|
|
55
|
+
type: "string",
|
|
56
|
+
describe: "listen public host and enable remote control"
|
|
57
|
+
}).option("log", {
|
|
58
|
+
default: "warn",
|
|
59
|
+
type: "string",
|
|
60
|
+
choices: ["error", "warn", "info", "silent"],
|
|
61
|
+
describe: "log level"
|
|
62
|
+
}).option("inspect", {
|
|
63
|
+
default: false,
|
|
64
|
+
type: "boolean",
|
|
65
|
+
describe: "enable the inspect plugin for debugging"
|
|
66
|
+
}).option("force", {
|
|
67
|
+
alias: "f",
|
|
68
|
+
default: false,
|
|
69
|
+
type: "boolean",
|
|
70
|
+
describe: "force the optimizer to ignore the cache and re-bundle "
|
|
71
|
+
}).strict().help(),
|
|
72
|
+
async ({ entry, theme, port: userPort, open, log, remote, force, inspect }) => {
|
|
73
|
+
if (!_fsextra2.default.existsSync(entry) && !entry.endsWith(".md"))
|
|
74
|
+
entry = `${entry}.md`;
|
|
75
|
+
if (!_fsextra2.default.existsSync(entry)) {
|
|
76
|
+
const { create } = await _prompts2.default.call(void 0, {
|
|
77
|
+
name: "create",
|
|
78
|
+
type: "confirm",
|
|
79
|
+
initial: "Y",
|
|
80
|
+
message: `Entry file ${_kolorist.yellow.call(void 0, `"${entry}"`)} does not exist, do you want to create it?`
|
|
81
|
+
});
|
|
82
|
+
if (create)
|
|
83
|
+
await _fsextra2.default.copyFile(_path2.default.resolve(__dirname, "../template.md"), entry);
|
|
84
|
+
else
|
|
85
|
+
process.exit(0);
|
|
86
|
+
}
|
|
87
|
+
let server;
|
|
88
|
+
let port = 3030;
|
|
89
|
+
async function initServer() {
|
|
90
|
+
if (server)
|
|
91
|
+
await server.close();
|
|
92
|
+
const options = await _chunkCG3QPKUJjs.resolveOptions.call(void 0, { entry, remote, theme, inspect }, "dev");
|
|
93
|
+
port = userPort || await findFreePort(3030);
|
|
94
|
+
server = await _chunkCG3QPKUJjs.createServer.call(void 0,
|
|
95
|
+
options,
|
|
96
|
+
{
|
|
97
|
+
server: {
|
|
98
|
+
port,
|
|
99
|
+
strictPort: true,
|
|
100
|
+
open,
|
|
101
|
+
host: remote !== void 0 ? "0.0.0.0" : "localhost",
|
|
102
|
+
force
|
|
103
|
+
},
|
|
104
|
+
logLevel: log
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
onDataReload(newData, data) {
|
|
108
|
+
if (!theme && _chunkCG3QPKUJjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunkCG3QPKUJjs.resolveThemeName.call(void 0, data.config.theme)) {
|
|
109
|
+
console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
|
|
110
|
+
initServer();
|
|
111
|
+
} else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
|
|
112
|
+
console.log(_kolorist.yellow.call(void 0, "\n restarting on config change\n"));
|
|
113
|
+
initServer();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
await server.listen();
|
|
119
|
+
printInfo(options, port, remote);
|
|
120
|
+
}
|
|
121
|
+
const SHORTCUTS = [
|
|
122
|
+
{
|
|
123
|
+
name: "r",
|
|
124
|
+
fullname: "restart",
|
|
125
|
+
action() {
|
|
102
126
|
initServer();
|
|
103
127
|
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "o",
|
|
131
|
+
fullname: "open",
|
|
132
|
+
action() {
|
|
133
|
+
_open2.default.call(void 0, `http://localhost:${port}`);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "e",
|
|
138
|
+
fullname: "edit",
|
|
139
|
+
action() {
|
|
140
|
+
_child_process.exec.call(void 0, `code "${entry}"`);
|
|
141
|
+
}
|
|
104
142
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "e",
|
|
126
|
-
fullname: "edit",
|
|
127
|
-
action() {
|
|
128
|
-
_child_process.exec.call(void 0, `code "${entry}"`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
];
|
|
132
|
-
function bindShortcut() {
|
|
133
|
-
process.stdin.resume();
|
|
134
|
-
process.stdin.setEncoding("utf8");
|
|
135
|
-
readline.emitKeypressEvents(process.stdin);
|
|
136
|
-
if (process.stdin.isTTY)
|
|
137
|
-
process.stdin.setRawMode(true);
|
|
138
|
-
process.stdin.on("keypress", (str, key) => {
|
|
139
|
-
if (key.ctrl && key.name === "c") {
|
|
140
|
-
process.exit();
|
|
141
|
-
} else {
|
|
142
|
-
const [sh] = SHORTCUTS.filter((item) => item.name === str);
|
|
143
|
-
if (sh) {
|
|
144
|
-
try {
|
|
145
|
-
sh.action();
|
|
146
|
-
} catch (err) {
|
|
147
|
-
console.error(`Failed to execute shortcut ${sh.fullname}`, err);
|
|
143
|
+
];
|
|
144
|
+
function bindShortcut() {
|
|
145
|
+
process.stdin.resume();
|
|
146
|
+
process.stdin.setEncoding("utf8");
|
|
147
|
+
readline.emitKeypressEvents(process.stdin);
|
|
148
|
+
if (process.stdin.isTTY)
|
|
149
|
+
process.stdin.setRawMode(true);
|
|
150
|
+
process.stdin.on("keypress", (str, key) => {
|
|
151
|
+
if (key.ctrl && key.name === "c") {
|
|
152
|
+
process.exit();
|
|
153
|
+
} else {
|
|
154
|
+
const [sh] = SHORTCUTS.filter((item) => item.name === str);
|
|
155
|
+
if (sh) {
|
|
156
|
+
try {
|
|
157
|
+
sh.action();
|
|
158
|
+
} catch (err) {
|
|
159
|
+
console.error(`Failed to execute shortcut ${sh.fullname}`, err);
|
|
160
|
+
}
|
|
148
161
|
}
|
|
149
162
|
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
initServer();
|
|
166
|
+
bindShortcut();
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
cli.command(
|
|
170
|
+
"build [entry]",
|
|
171
|
+
"Build hostable SPA",
|
|
172
|
+
(args) => commonOptions(args).option("watch", {
|
|
173
|
+
alias: "w",
|
|
174
|
+
default: false,
|
|
175
|
+
describe: "build watch"
|
|
176
|
+
}).option("out", {
|
|
177
|
+
alias: "o",
|
|
178
|
+
type: "string",
|
|
179
|
+
default: "dist",
|
|
180
|
+
describe: "output dir"
|
|
181
|
+
}).option("base", {
|
|
182
|
+
type: "string",
|
|
183
|
+
describe: "output base"
|
|
184
|
+
}).option("download", {
|
|
185
|
+
alias: "d",
|
|
186
|
+
type: "boolean",
|
|
187
|
+
describe: "allow download as PDF"
|
|
188
|
+
}).option("inspect", {
|
|
189
|
+
default: false,
|
|
190
|
+
type: "boolean",
|
|
191
|
+
describe: "enable the inspect plugin for debugging"
|
|
192
|
+
}).strict().help(),
|
|
193
|
+
async ({ entry, theme, watch, base, download, out, inspect }) => {
|
|
194
|
+
const { build } = await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "./build-VLQNNPIA.js")));
|
|
195
|
+
const options = await _chunkCG3QPKUJjs.resolveOptions.call(void 0, { entry, theme, inspect }, "build");
|
|
196
|
+
if (download && !options.data.config.download)
|
|
197
|
+
options.data.config.download = download;
|
|
198
|
+
printInfo(options);
|
|
199
|
+
await build(options, {
|
|
200
|
+
base,
|
|
201
|
+
build: {
|
|
202
|
+
watch: watch ? {} : void 0,
|
|
203
|
+
outDir: out
|
|
150
204
|
}
|
|
151
205
|
});
|
|
152
206
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
207
|
+
);
|
|
208
|
+
cli.command(
|
|
209
|
+
"format [entry]",
|
|
210
|
+
"Format the markdown file",
|
|
211
|
+
(args) => commonOptions(args).strict().help(),
|
|
212
|
+
async ({ entry }) => {
|
|
213
|
+
const data = await _chunkCG3QPKUJjs.parser.load(entry);
|
|
214
|
+
_chunkCG3QPKUJjs.parser.prettify(data);
|
|
215
|
+
await _chunkCG3QPKUJjs.parser.save(data);
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
cli.command(
|
|
219
|
+
"theme [subcommand]",
|
|
220
|
+
"Theme related operations",
|
|
221
|
+
(command) => {
|
|
222
|
+
return command.command(
|
|
223
|
+
"eject",
|
|
224
|
+
"Eject current theme into local file system",
|
|
225
|
+
(args) => commonOptions(args).option("dir", {
|
|
226
|
+
type: "string",
|
|
227
|
+
default: "theme"
|
|
228
|
+
}),
|
|
229
|
+
async ({ entry, dir, theme: themeInput }) => {
|
|
230
|
+
const data = await _chunkCG3QPKUJjs.parser.load(entry);
|
|
231
|
+
const theme = _chunkCG3QPKUJjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
|
|
232
|
+
if (theme === "none") {
|
|
233
|
+
console.error('Can not eject theme "none"');
|
|
234
|
+
process.exit(1);
|
|
235
|
+
}
|
|
236
|
+
if (_chunkCG3QPKUJjs.isPath.call(void 0, theme)) {
|
|
237
|
+
console.error("Theme is already ejected");
|
|
238
|
+
process.exit(1);
|
|
239
|
+
}
|
|
240
|
+
const roots = _chunkCG3QPKUJjs.getThemeRoots.call(void 0, theme, entry);
|
|
241
|
+
if (!roots.length) {
|
|
242
|
+
console.error(`Does not found theme "${theme}"`);
|
|
243
|
+
process.exit(1);
|
|
244
|
+
}
|
|
245
|
+
const root = roots[0];
|
|
246
|
+
await _fsextra2.default.copy(root, _path2.default.resolve(dir), {
|
|
247
|
+
filter: (i) => !/node_modules|.git/.test(_path2.default.relative(root, i))
|
|
248
|
+
});
|
|
249
|
+
const dirPath = `./${dir}`;
|
|
250
|
+
data.slides[0].frontmatter.theme = dirPath;
|
|
251
|
+
data.slides[0].raw = null;
|
|
252
|
+
await _chunkCG3QPKUJjs.parser.save(data);
|
|
253
|
+
console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
},
|
|
257
|
+
() => {
|
|
258
|
+
cli.showHelp();
|
|
259
|
+
process.exit(1);
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
cli.command(
|
|
263
|
+
"export [entry]",
|
|
264
|
+
"Export slides to PDF",
|
|
265
|
+
(args) => commonOptions(args).option("output", {
|
|
193
266
|
type: "string",
|
|
194
|
-
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
process.exit(1);
|
|
224
|
-
});
|
|
225
|
-
cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(args).option("output", {
|
|
226
|
-
type: "string",
|
|
227
|
-
describe: "path to the output"
|
|
228
|
-
}).option("format", {
|
|
229
|
-
default: "pdf",
|
|
230
|
-
type: "string",
|
|
231
|
-
choices: ["pdf", "png", "md"],
|
|
232
|
-
describe: "output format"
|
|
233
|
-
}).option("timeout", {
|
|
234
|
-
default: 3e4,
|
|
235
|
-
type: "number",
|
|
236
|
-
describe: "timeout for rendering the print page"
|
|
237
|
-
}).option("range", {
|
|
238
|
-
type: "string",
|
|
239
|
-
describe: 'page ranges to export, for example "1,4-5,6"'
|
|
240
|
-
}).option("dark", {
|
|
241
|
-
default: false,
|
|
242
|
-
type: "boolean",
|
|
243
|
-
describe: "export as dark theme"
|
|
244
|
-
}).option("with-clicks", {
|
|
245
|
-
alias: "c",
|
|
246
|
-
default: false,
|
|
247
|
-
type: "boolean",
|
|
248
|
-
describe: "export pages for every clicks"
|
|
249
|
-
}).option("executable-path", {
|
|
250
|
-
type: "string",
|
|
251
|
-
describe: "executable to override playwright bundled browser"
|
|
252
|
-
}).strict().help(), async ({
|
|
253
|
-
entry,
|
|
254
|
-
theme,
|
|
255
|
-
output,
|
|
256
|
-
format,
|
|
257
|
-
timeout,
|
|
258
|
-
range,
|
|
259
|
-
dark,
|
|
260
|
-
"with-clicks": withClicks,
|
|
261
|
-
"executable-path": executablePath
|
|
262
|
-
}) => {
|
|
263
|
-
process.env.NODE_ENV = "production";
|
|
264
|
-
const { exportSlides } = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "./export-JXFGVO7B.js")));
|
|
265
|
-
const port = await findFreePort(12445);
|
|
266
|
-
const options = await _chunkAHXRM5NGjs.resolveOptions.call(void 0, { entry, theme }, "build");
|
|
267
|
-
output = output || options.data.config.exportFilename || `${_path2.default.basename(entry, ".md")}-export`;
|
|
268
|
-
const server = await _chunkAHXRM5NGjs.createServer.call(void 0, options, {
|
|
269
|
-
server: { port },
|
|
270
|
-
clearScreen: false
|
|
271
|
-
});
|
|
272
|
-
await server.listen(port);
|
|
273
|
-
printInfo(options);
|
|
274
|
-
_chunkAHXRM5NGjs.parser.filterDisabled(options.data);
|
|
275
|
-
const width = options.data.config.canvasWidth;
|
|
276
|
-
const height = Math.round(width / options.data.config.aspectRatio);
|
|
277
|
-
output = await exportSlides({
|
|
278
|
-
port,
|
|
279
|
-
slides: options.data.slides,
|
|
280
|
-
total: options.data.slides.length,
|
|
281
|
-
range,
|
|
282
|
-
format,
|
|
267
|
+
describe: "path to the output"
|
|
268
|
+
}).option("format", {
|
|
269
|
+
default: "pdf",
|
|
270
|
+
type: "string",
|
|
271
|
+
choices: ["pdf", "png", "md"],
|
|
272
|
+
describe: "output format"
|
|
273
|
+
}).option("timeout", {
|
|
274
|
+
default: 3e4,
|
|
275
|
+
type: "number",
|
|
276
|
+
describe: "timeout for rendering the print page"
|
|
277
|
+
}).option("range", {
|
|
278
|
+
type: "string",
|
|
279
|
+
describe: 'page ranges to export, for example "1,4-5,6"'
|
|
280
|
+
}).option("dark", {
|
|
281
|
+
default: false,
|
|
282
|
+
type: "boolean",
|
|
283
|
+
describe: "export as dark theme"
|
|
284
|
+
}).option("with-clicks", {
|
|
285
|
+
alias: "c",
|
|
286
|
+
default: false,
|
|
287
|
+
type: "boolean",
|
|
288
|
+
describe: "export pages for every clicks"
|
|
289
|
+
}).option("executable-path", {
|
|
290
|
+
type: "string",
|
|
291
|
+
describe: "executable to override playwright bundled browser"
|
|
292
|
+
}).strict().help(),
|
|
293
|
+
async ({
|
|
294
|
+
entry,
|
|
295
|
+
theme,
|
|
283
296
|
output,
|
|
297
|
+
format,
|
|
284
298
|
timeout,
|
|
299
|
+
range,
|
|
285
300
|
dark,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
301
|
+
"with-clicks": withClicks,
|
|
302
|
+
"executable-path": executablePath
|
|
303
|
+
}) => {
|
|
304
|
+
process.env.NODE_ENV = "production";
|
|
305
|
+
const { exportSlides } = await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "./export-WKFHZNBT.js")));
|
|
306
|
+
const port = await findFreePort(12445);
|
|
307
|
+
const options = await _chunkCG3QPKUJjs.resolveOptions.call(void 0, { entry, theme }, "build");
|
|
308
|
+
output = output || options.data.config.exportFilename || `${_path2.default.basename(entry, ".md")}-export`;
|
|
309
|
+
const server = await _chunkCG3QPKUJjs.createServer.call(void 0,
|
|
310
|
+
options,
|
|
311
|
+
{
|
|
312
|
+
server: { port },
|
|
313
|
+
clearScreen: false
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
await server.listen(port);
|
|
317
|
+
printInfo(options);
|
|
318
|
+
_chunkCG3QPKUJjs.parser.filterDisabled(options.data);
|
|
319
|
+
const width = options.data.config.canvasWidth;
|
|
320
|
+
const height = Math.round(width / options.data.config.aspectRatio);
|
|
321
|
+
output = await exportSlides({
|
|
322
|
+
port,
|
|
323
|
+
slides: options.data.slides,
|
|
324
|
+
total: options.data.slides.length,
|
|
325
|
+
range,
|
|
326
|
+
format,
|
|
327
|
+
output,
|
|
328
|
+
timeout,
|
|
329
|
+
dark,
|
|
330
|
+
routerMode: options.data.config.routerMode,
|
|
331
|
+
width,
|
|
332
|
+
height,
|
|
333
|
+
withClicks,
|
|
334
|
+
executablePath
|
|
335
|
+
});
|
|
336
|
+
console.log(`${_kolorist.green.call(void 0, " \u2713 ")}${_kolorist.dim.call(void 0, "exported to ")}./${output}
|
|
293
337
|
`);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
338
|
+
server.close();
|
|
339
|
+
process.exit(0);
|
|
340
|
+
}
|
|
341
|
+
);
|
|
297
342
|
cli.help().parse();
|
|
298
343
|
function commonOptions(args) {
|
|
299
344
|
return args.positional("entry", {
|
|
@@ -310,7 +355,7 @@ function printInfo(options, port, remote) {
|
|
|
310
355
|
console.log();
|
|
311
356
|
console.log();
|
|
312
357
|
console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
|
|
313
|
-
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${
|
|
358
|
+
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkCG3QPKUJjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
|
|
314
359
|
console.log();
|
|
315
360
|
console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
|
|
316
361
|
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));
|
|
@@ -322,10 +367,14 @@ function printInfo(options, port, remote) {
|
|
|
322
367
|
if (query)
|
|
323
368
|
console.log(`${_kolorist.dim.call(void 0, " private slide show ")} > ${_kolorist.cyan.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}/${query}`)}`);
|
|
324
369
|
console.log(`${_kolorist.dim.call(void 0, " presenter mode ")} > ${_kolorist.blue.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}${presenterPath}`)}`);
|
|
370
|
+
if (options.inspect)
|
|
371
|
+
console.log(`${_kolorist.dim.call(void 0, " inspector")} > ${_kolorist.yellow.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}/__inspect/`)}`);
|
|
325
372
|
if (remote !== void 0) {
|
|
326
|
-
Object.values(_os2.default.networkInterfaces()).forEach(
|
|
327
|
-
|
|
328
|
-
|
|
373
|
+
Object.values(_os2.default.networkInterfaces()).forEach(
|
|
374
|
+
(v) => (v || []).filter((details) => String(details.family).slice(-1) === "4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
|
|
375
|
+
console.log(`${_kolorist.dim.call(void 0, " remote control ")} > ${_kolorist.blue.call(void 0, `http://${address}:${port}${presenterPath}`)}`);
|
|
376
|
+
})
|
|
377
|
+
);
|
|
329
378
|
} else {
|
|
330
379
|
console.log(`${_kolorist.dim.call(void 0, " remote control ")} > ${_kolorist.dim.call(void 0, "pass --remote to enable")}`);
|
|
331
380
|
}
|