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