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