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