@slidev/cli 0.27.16 → 0.28.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-IHQEXPWU.js +746 -0
- package/dist/build-MGE5AXXE.mjs +746 -0
- package/dist/{chunk-L7QFSRQN.mjs → chunk-2E3KKOOJ.mjs} +52 -37
- package/dist/{chunk-7EYE5BOQ.js → chunk-BYTWGCY3.js} +9 -5
- package/dist/chunk-FHAYPMSG.js +13300 -0
- package/dist/{chunk-DVHCB7TL.js → chunk-INYQJTKA.js} +84 -87
- package/dist/chunk-MP2CDYSZ.mjs +13301 -0
- package/dist/{chunk-QQD2JVXL.mjs → chunk-OXQUV4ZP.mjs} +28 -2
- package/dist/{chunk-6HK3HED2.mjs → chunk-RLNIZC66.mjs} +5 -1
- package/dist/{chunk-3QMXOBKW.js → chunk-Z64T7ZBU.js} +4 -4
- package/dist/cli.js +29 -36
- package/dist/cli.mjs +19 -23
- package/dist/{export-Y4JCWLGL.mjs → export-7GHMNSMB.mjs} +7 -5
- package/dist/{export-U55WC23C.js → export-WXQSOLRA.js} +7 -7
- package/dist/index.d.ts +68 -4
- package/dist/index.js +9 -11
- package/dist/index.mjs +12 -6
- package/package.json +35 -34
- package/dist/build-452HX3AZ.js +0 -407
- package/dist/build-K3CIZYMA.mjs +0 -399
- package/dist/chunk-634GWLT5.mjs +0 -10264
- package/dist/chunk-VG5IYO5P.js +0 -10316
|
@@ -29,9 +29,17 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
29
29
|
return require.apply(this, arguments);
|
|
30
30
|
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
31
31
|
});
|
|
32
|
+
var __esm = (fn, res) => function __init() {
|
|
33
|
+
return fn && (res = (0, fn[Object.keys(fn)[0]])(fn = 0)), res;
|
|
34
|
+
};
|
|
32
35
|
var __commonJS = (cb, mod) => function __require2() {
|
|
33
36
|
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
34
37
|
};
|
|
38
|
+
var __export = (target, all) => {
|
|
39
|
+
__markAsModule(target);
|
|
40
|
+
for (var name in all)
|
|
41
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
42
|
+
};
|
|
35
43
|
var __reExport = (target, module, desc) => {
|
|
36
44
|
if (module && typeof module === "object" || typeof module === "function") {
|
|
37
45
|
for (let key of __getOwnPropNames(module))
|
|
@@ -44,14 +52,28 @@ var __toModule = (module) => {
|
|
|
44
52
|
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
|
|
45
53
|
};
|
|
46
54
|
|
|
55
|
+
// ../../node_modules/.pnpm/tsup@5.11.11_typescript@4.5.4/node_modules/tsup/assets/esm_shims.js
|
|
56
|
+
import { fileURLToPath } from "url";
|
|
57
|
+
import path from "path";
|
|
58
|
+
var getFilename, getDirname, __dirname, __filename;
|
|
59
|
+
var init_esm_shims = __esm({
|
|
60
|
+
"../../node_modules/.pnpm/tsup@5.11.11_typescript@4.5.4/node_modules/tsup/assets/esm_shims.js"() {
|
|
61
|
+
getFilename = () => fileURLToPath(import.meta.url);
|
|
62
|
+
getDirname = () => path.dirname(getFilename());
|
|
63
|
+
__dirname = /* @__PURE__ */ getDirname();
|
|
64
|
+
__filename = /* @__PURE__ */ getFilename();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
47
68
|
// node/utils.ts
|
|
69
|
+
init_esm_shims();
|
|
48
70
|
import { join } from "path";
|
|
49
71
|
import { ensurePrefix, slash } from "@antfu/utils";
|
|
50
72
|
import isInstalledGlobally from "is-installed-globally";
|
|
51
73
|
import { sync as resolve } from "resolve";
|
|
52
74
|
import globalDirs from "global-dirs";
|
|
53
|
-
function toAtFS(
|
|
54
|
-
return `/@fs${ensurePrefix("/", slash(
|
|
75
|
+
function toAtFS(path2) {
|
|
76
|
+
return `/@fs${ensurePrefix("/", slash(path2))}`;
|
|
55
77
|
}
|
|
56
78
|
function resolveImportPath(importName, ensure = false) {
|
|
57
79
|
try {
|
|
@@ -106,7 +128,11 @@ export {
|
|
|
106
128
|
__spreadProps,
|
|
107
129
|
__require,
|
|
108
130
|
__commonJS,
|
|
131
|
+
__export,
|
|
109
132
|
__toModule,
|
|
133
|
+
__dirname,
|
|
134
|
+
__filename,
|
|
135
|
+
init_esm_shims,
|
|
110
136
|
toAtFS,
|
|
111
137
|
resolveImportPath,
|
|
112
138
|
resolveGlobalImportPath,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ViteSlidevPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2E3KKOOJ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
init_esm_shims
|
|
6
|
+
} from "./chunk-OXQUV4ZP.mjs";
|
|
4
7
|
|
|
5
8
|
// node/server.ts
|
|
9
|
+
init_esm_shims();
|
|
6
10
|
import { join } from "path";
|
|
7
11
|
import { createServer as createViteServer, mergeConfig, resolveConfig } from "vite";
|
|
8
12
|
async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkINYQJTKAjs = require('./chunk-INYQJTKA.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkBYTWGCY3js = require('./chunk-BYTWGCY3.js');
|
|
7
7
|
|
|
8
8
|
// node/server.ts
|
|
9
|
-
|
|
9
|
+
_chunkBYTWGCY3js.init_cjs_shims.call(void 0, );
|
|
10
10
|
var _path = require('path');
|
|
11
11
|
var _vite = require('vite');
|
|
12
12
|
async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
@@ -20,7 +20,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
22
|
plugins: [
|
|
23
|
-
await
|
|
23
|
+
await _chunkINYQJTKAjs.ViteSlidevPlugin.call(void 0, options, pluginOptions, serverOptions)
|
|
24
24
|
]
|
|
25
25
|
}));
|
|
26
26
|
return server;
|
package/dist/cli.js
CHANGED
|
@@ -1,43 +1,36 @@
|
|
|
1
|
-
"use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
|
|
3
|
+
var _chunkZ64T7ZBUjs = require('./chunk-Z64T7ZBU.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var _chunkVG5IYO5Pjs = require('./chunk-VG5IYO5P.js');
|
|
11
10
|
|
|
11
|
+
var _chunkFHAYPMSGjs = require('./chunk-FHAYPMSG.js');
|
|
12
12
|
|
|
13
|
-
var _chunkDVHCB7TLjs = require('./chunk-DVHCB7TL.js');
|
|
14
13
|
|
|
14
|
+
var _chunkINYQJTKAjs = require('./chunk-INYQJTKA.js');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
var _chunkBYTWGCY3js = require('./chunk-BYTWGCY3.js');
|
|
19
20
|
|
|
20
21
|
// node/cli.ts
|
|
21
|
-
|
|
22
|
-
var import_fast_deep_equal =
|
|
22
|
+
_chunkBYTWGCY3js.init_cjs_shims.call(void 0, );
|
|
23
|
+
var import_fast_deep_equal = _chunkBYTWGCY3js.__toModule.call(void 0, _chunkINYQJTKAjs.require_fast_deep_equal.call(void 0, ));
|
|
23
24
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
24
25
|
var _net = require('net'); var _net2 = _interopRequireDefault(_net);
|
|
25
26
|
var _os = require('os'); var _os2 = _interopRequireDefault(_os);
|
|
26
27
|
var _child_process = require('child_process');
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var _readline = require('readline');
|
|
28
|
+
var _readline = require('readline'); var readline = _interopRequireWildcard(_readline);
|
|
30
29
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
31
30
|
var _open = require('open'); var _open2 = _interopRequireDefault(_open);
|
|
32
31
|
var _yargs = require('yargs'); var _yargs2 = _interopRequireDefault(_yargs);
|
|
33
32
|
var _prompts = require('prompts'); var _prompts2 = _interopRequireDefault(_prompts);
|
|
34
33
|
var _kolorist = require('kolorist');
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var _fs = require('@slidev/parser/fs');
|
|
41
34
|
var _isinstalledglobally = require('is-installed-globally'); var _isinstalledglobally2 = _interopRequireDefault(_isinstalledglobally);
|
|
42
35
|
var CONFIG_RESTART_FIELDS = [
|
|
43
36
|
"highlighter",
|
|
@@ -45,7 +38,7 @@ var CONFIG_RESTART_FIELDS = [
|
|
|
45
38
|
"routerMode",
|
|
46
39
|
"fonts"
|
|
47
40
|
];
|
|
48
|
-
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(
|
|
41
|
+
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkFHAYPMSGjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
|
|
49
42
|
cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOptions(args).option("port", {
|
|
50
43
|
alias: "p",
|
|
51
44
|
type: "number",
|
|
@@ -89,9 +82,9 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
|
|
|
89
82
|
async function initServer() {
|
|
90
83
|
if (server)
|
|
91
84
|
await server.close();
|
|
92
|
-
const options = await
|
|
85
|
+
const options = await _chunkFHAYPMSGjs.resolveOptions.call(void 0, { entry, theme }, "dev");
|
|
93
86
|
port = userPort || await findFreePort(3030);
|
|
94
|
-
server = await
|
|
87
|
+
server = await _chunkZ64T7ZBUjs.createServer.call(void 0, options, {
|
|
95
88
|
server: {
|
|
96
89
|
port,
|
|
97
90
|
strictPort: true,
|
|
@@ -102,7 +95,7 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
|
|
|
102
95
|
logLevel: log
|
|
103
96
|
}, {
|
|
104
97
|
onDataReload(newData, data) {
|
|
105
|
-
if (!theme &&
|
|
98
|
+
if (!theme && _chunkFHAYPMSGjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunkFHAYPMSGjs.resolveThemeName.call(void 0, data.config.theme)) {
|
|
106
99
|
console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
|
|
107
100
|
initServer();
|
|
108
101
|
} else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
|
|
@@ -140,7 +133,7 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
|
|
|
140
133
|
function bindShortcut() {
|
|
141
134
|
process.stdin.resume();
|
|
142
135
|
process.stdin.setEncoding("utf8");
|
|
143
|
-
|
|
136
|
+
readline.emitKeypressEvents(process.stdin);
|
|
144
137
|
if (process.stdin.isTTY)
|
|
145
138
|
process.stdin.setRawMode(true);
|
|
146
139
|
process.stdin.on("keypress", (str, key) => {
|
|
@@ -178,8 +171,8 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
|
|
|
178
171
|
type: "boolean",
|
|
179
172
|
describe: "allow download as PDF"
|
|
180
173
|
}).strict().help(), async ({ entry, theme, watch, base, download, out }) => {
|
|
181
|
-
const { build } = await Promise.resolve().then(() =>
|
|
182
|
-
const options = await
|
|
174
|
+
const { build } = await Promise.resolve().then(() => _chunkBYTWGCY3js.__toModule.call(void 0, _chunkBYTWGCY3js.__require.call(void 0, "./build-IHQEXPWU.js")));
|
|
175
|
+
const options = await _chunkFHAYPMSGjs.resolveOptions.call(void 0, { entry, theme }, "build");
|
|
183
176
|
if (download && !options.data.config.download)
|
|
184
177
|
options.data.config.download = download;
|
|
185
178
|
printInfo(options);
|
|
@@ -192,26 +185,26 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
|
|
|
192
185
|
});
|
|
193
186
|
});
|
|
194
187
|
cli.command("format [entry]", "Format the markdown file", (args) => commonOptions(args).strict().help(), async ({ entry }) => {
|
|
195
|
-
const data = await
|
|
196
|
-
|
|
197
|
-
await
|
|
188
|
+
const data = await _chunkFHAYPMSGjs.fs_exports.load(entry);
|
|
189
|
+
_chunkFHAYPMSGjs.fs_exports.prettify(data);
|
|
190
|
+
await _chunkFHAYPMSGjs.fs_exports.save(data);
|
|
198
191
|
});
|
|
199
192
|
cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
200
193
|
return command.command("eject", "Eject current theme into local file system", (args) => commonOptions(args).option("dir", {
|
|
201
194
|
type: "string",
|
|
202
195
|
default: "theme"
|
|
203
196
|
}), async ({ entry, dir, theme: themeInput }) => {
|
|
204
|
-
const data = await
|
|
205
|
-
const theme =
|
|
197
|
+
const data = await _chunkFHAYPMSGjs.fs_exports.load(entry);
|
|
198
|
+
const theme = _chunkFHAYPMSGjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
|
|
206
199
|
if (theme === "none") {
|
|
207
200
|
console.error('Can not eject theme "none"');
|
|
208
201
|
process.exit(1);
|
|
209
202
|
}
|
|
210
|
-
if (
|
|
203
|
+
if (_chunkFHAYPMSGjs.isPath.call(void 0, theme)) {
|
|
211
204
|
console.error("Theme is already ejected");
|
|
212
205
|
process.exit(1);
|
|
213
206
|
}
|
|
214
|
-
const roots =
|
|
207
|
+
const roots = _chunkFHAYPMSGjs.getThemeRoots.call(void 0, theme, entry);
|
|
215
208
|
if (!roots.length) {
|
|
216
209
|
console.error(`Does not found theme "${theme}"`);
|
|
217
210
|
process.exit(1);
|
|
@@ -223,7 +216,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
|
223
216
|
const dirPath = `./${dir}`;
|
|
224
217
|
data.slides[0].frontmatter.theme = dirPath;
|
|
225
218
|
data.slides[0].raw = null;
|
|
226
|
-
await
|
|
219
|
+
await _chunkFHAYPMSGjs.fs_exports.save(data);
|
|
227
220
|
console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
|
|
228
221
|
});
|
|
229
222
|
}, () => {
|
|
@@ -266,16 +259,16 @@ cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(ar
|
|
|
266
259
|
}) => {
|
|
267
260
|
output = output || `${_path2.default.basename(entry, ".md")}-export`;
|
|
268
261
|
process.env.NODE_ENV = "production";
|
|
269
|
-
const { exportSlides } = await Promise.resolve().then(() =>
|
|
262
|
+
const { exportSlides } = await Promise.resolve().then(() => _chunkBYTWGCY3js.__toModule.call(void 0, _chunkBYTWGCY3js.__require.call(void 0, "./export-WXQSOLRA.js")));
|
|
270
263
|
const port = await findFreePort(12445);
|
|
271
|
-
const options = await
|
|
272
|
-
const server = await
|
|
264
|
+
const options = await _chunkFHAYPMSGjs.resolveOptions.call(void 0, { entry, theme }, "build");
|
|
265
|
+
const server = await _chunkZ64T7ZBUjs.createServer.call(void 0, options, {
|
|
273
266
|
server: { port },
|
|
274
267
|
clearScreen: false
|
|
275
268
|
});
|
|
276
269
|
await server.listen(port);
|
|
277
270
|
printInfo(options);
|
|
278
|
-
|
|
271
|
+
_chunkFHAYPMSGjs.fs_exports.filterDisabled(options.data);
|
|
279
272
|
const width = 1920;
|
|
280
273
|
const height = Math.round(width / options.data.config.aspectRatio);
|
|
281
274
|
output = await exportSlides({
|
|
@@ -312,7 +305,7 @@ function printInfo(options, port, remote) {
|
|
|
312
305
|
console.log();
|
|
313
306
|
console.log();
|
|
314
307
|
console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
|
|
315
|
-
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${
|
|
308
|
+
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkFHAYPMSGjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
|
|
316
309
|
console.log();
|
|
317
310
|
console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
|
|
318
311
|
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));
|
package/dist/cli.mjs
CHANGED
|
@@ -1,41 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RLNIZC66.mjs";
|
|
4
4
|
import {
|
|
5
|
+
fs_exports,
|
|
5
6
|
getThemeRoots,
|
|
6
7
|
isPath,
|
|
7
8
|
resolveOptions,
|
|
8
9
|
resolveThemeName,
|
|
9
10
|
version
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MP2CDYSZ.mjs";
|
|
11
12
|
import {
|
|
12
13
|
require_fast_deep_equal
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-2E3KKOOJ.mjs";
|
|
14
15
|
import {
|
|
16
|
+
__dirname,
|
|
15
17
|
__require,
|
|
16
|
-
__toModule
|
|
17
|
-
|
|
18
|
+
__toModule,
|
|
19
|
+
init_esm_shims
|
|
20
|
+
} from "./chunk-OXQUV4ZP.mjs";
|
|
18
21
|
|
|
19
22
|
// node/cli.ts
|
|
23
|
+
init_esm_shims();
|
|
20
24
|
var import_fast_deep_equal = __toModule(require_fast_deep_equal());
|
|
21
25
|
import path from "path";
|
|
22
26
|
import net from "net";
|
|
23
27
|
import os from "os";
|
|
24
28
|
import { exec } from "child_process";
|
|
25
|
-
import
|
|
26
|
-
emitKeypressEvents
|
|
27
|
-
} from "readline";
|
|
29
|
+
import * as readline from "readline";
|
|
28
30
|
import fs from "fs-extra";
|
|
29
31
|
import openBrowser from "open";
|
|
30
32
|
import yargs from "yargs";
|
|
31
33
|
import prompts from "prompts";
|
|
32
34
|
import { blue, bold, cyan, dim, gray, green, underline, yellow } from "kolorist";
|
|
33
|
-
import {
|
|
34
|
-
filterDisabled,
|
|
35
|
-
load,
|
|
36
|
-
prettify,
|
|
37
|
-
save
|
|
38
|
-
} from "@slidev/parser/fs";
|
|
39
35
|
import isInstalledGlobally from "is-installed-globally";
|
|
40
36
|
var CONFIG_RESTART_FIELDS = [
|
|
41
37
|
"highlighter",
|
|
@@ -138,7 +134,7 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
|
|
|
138
134
|
function bindShortcut() {
|
|
139
135
|
process.stdin.resume();
|
|
140
136
|
process.stdin.setEncoding("utf8");
|
|
141
|
-
emitKeypressEvents(process.stdin);
|
|
137
|
+
readline.emitKeypressEvents(process.stdin);
|
|
142
138
|
if (process.stdin.isTTY)
|
|
143
139
|
process.stdin.setRawMode(true);
|
|
144
140
|
process.stdin.on("keypress", (str, key) => {
|
|
@@ -176,7 +172,7 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
|
|
|
176
172
|
type: "boolean",
|
|
177
173
|
describe: "allow download as PDF"
|
|
178
174
|
}).strict().help(), async ({ entry, theme, watch, base, download, out }) => {
|
|
179
|
-
const { build } = await Promise.resolve().then(() => __toModule(__require("./build-
|
|
175
|
+
const { build } = await Promise.resolve().then(() => __toModule(__require("./build-MGE5AXXE.mjs")));
|
|
180
176
|
const options = await resolveOptions({ entry, theme }, "build");
|
|
181
177
|
if (download && !options.data.config.download)
|
|
182
178
|
options.data.config.download = download;
|
|
@@ -190,16 +186,16 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
|
|
|
190
186
|
});
|
|
191
187
|
});
|
|
192
188
|
cli.command("format [entry]", "Format the markdown file", (args) => commonOptions(args).strict().help(), async ({ entry }) => {
|
|
193
|
-
const data = await load(entry);
|
|
194
|
-
prettify(data);
|
|
195
|
-
await save(data);
|
|
189
|
+
const data = await fs_exports.load(entry);
|
|
190
|
+
fs_exports.prettify(data);
|
|
191
|
+
await fs_exports.save(data);
|
|
196
192
|
});
|
|
197
193
|
cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
198
194
|
return command.command("eject", "Eject current theme into local file system", (args) => commonOptions(args).option("dir", {
|
|
199
195
|
type: "string",
|
|
200
196
|
default: "theme"
|
|
201
197
|
}), async ({ entry, dir, theme: themeInput }) => {
|
|
202
|
-
const data = await load(entry);
|
|
198
|
+
const data = await fs_exports.load(entry);
|
|
203
199
|
const theme = resolveThemeName(themeInput || data.config.theme);
|
|
204
200
|
if (theme === "none") {
|
|
205
201
|
console.error('Can not eject theme "none"');
|
|
@@ -221,7 +217,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
|
221
217
|
const dirPath = `./${dir}`;
|
|
222
218
|
data.slides[0].frontmatter.theme = dirPath;
|
|
223
219
|
data.slides[0].raw = null;
|
|
224
|
-
await save(data);
|
|
220
|
+
await fs_exports.save(data);
|
|
225
221
|
console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
|
|
226
222
|
});
|
|
227
223
|
}, () => {
|
|
@@ -264,7 +260,7 @@ cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(ar
|
|
|
264
260
|
}) => {
|
|
265
261
|
output = output || `${path.basename(entry, ".md")}-export`;
|
|
266
262
|
process.env.NODE_ENV = "production";
|
|
267
|
-
const { exportSlides } = await Promise.resolve().then(() => __toModule(__require("./export-
|
|
263
|
+
const { exportSlides } = await Promise.resolve().then(() => __toModule(__require("./export-7GHMNSMB.mjs")));
|
|
268
264
|
const port = await findFreePort(12445);
|
|
269
265
|
const options = await resolveOptions({ entry, theme }, "build");
|
|
270
266
|
const server = await createServer(options, {
|
|
@@ -273,7 +269,7 @@ cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(ar
|
|
|
273
269
|
});
|
|
274
270
|
await server.listen(port);
|
|
275
271
|
printInfo(options);
|
|
276
|
-
filterDisabled(options.data);
|
|
272
|
+
fs_exports.filterDisabled(options.data);
|
|
277
273
|
const width = 1920;
|
|
278
274
|
const height = Math.round(width / options.data.config.aspectRatio);
|
|
279
275
|
output = await exportSlides({
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
packageExists
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MP2CDYSZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__require,
|
|
6
|
-
__toModule
|
|
7
|
-
|
|
6
|
+
__toModule,
|
|
7
|
+
init_esm_shims
|
|
8
|
+
} from "./chunk-OXQUV4ZP.mjs";
|
|
8
9
|
|
|
9
10
|
// node/export.ts
|
|
11
|
+
init_esm_shims();
|
|
10
12
|
import path from "path";
|
|
11
13
|
import fs from "fs-extra";
|
|
12
14
|
import { PDFDocument } from "pdf-lib";
|
|
@@ -75,8 +77,8 @@ async function exportSlides({
|
|
|
75
77
|
const progress = createSlidevProgress();
|
|
76
78
|
async function go(no, clicks) {
|
|
77
79
|
progress.update(no);
|
|
78
|
-
const path2 = `${
|
|
79
|
-
const url = routerMode === "hash" ? `http://localhost:${port}
|
|
80
|
+
const path2 = `${no}?print${withClicks ? "=clicks" : ""}${clicks ? `&clicks=${clicks}` : ""}`;
|
|
81
|
+
const url = routerMode === "hash" ? `http://localhost:${port}${base}#${path2}` : `http://localhost:${port}${base}${path2}`;
|
|
80
82
|
await page.goto(url, {
|
|
81
83
|
waitUntil: "networkidle"
|
|
82
84
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkFHAYPMSGjs = require('./chunk-FHAYPMSG.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkBYTWGCY3js = require('./chunk-BYTWGCY3.js');
|
|
9
9
|
|
|
10
10
|
// node/export.ts
|
|
11
|
-
|
|
11
|
+
_chunkBYTWGCY3js.init_cjs_shims.call(void 0, );
|
|
12
12
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
13
13
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
14
14
|
var _pdflib = require('pdf-lib');
|
|
@@ -62,9 +62,9 @@ async function exportSlides({
|
|
|
62
62
|
height = 1080,
|
|
63
63
|
withClicks = false
|
|
64
64
|
}) {
|
|
65
|
-
if (!
|
|
65
|
+
if (!_chunkFHAYPMSGjs.packageExists.call(void 0, "playwright-chromium"))
|
|
66
66
|
throw new Error("The exporting for Slidev is powered by Playwright, please installed it via `npm i playwright-chromium`");
|
|
67
|
-
const { chromium } = await Promise.resolve().then(() =>
|
|
67
|
+
const { chromium } = await Promise.resolve().then(() => _chunkBYTWGCY3js.__toModule.call(void 0, _chunkBYTWGCY3js.__require.call(void 0, "playwright-chromium")));
|
|
68
68
|
const browser = await chromium.launch();
|
|
69
69
|
const context = await browser.newContext({
|
|
70
70
|
viewport: {
|
|
@@ -77,8 +77,8 @@ async function exportSlides({
|
|
|
77
77
|
const progress = createSlidevProgress();
|
|
78
78
|
async function go(no, clicks) {
|
|
79
79
|
progress.update(no);
|
|
80
|
-
const path2 = `${
|
|
81
|
-
const url = routerMode === "hash" ? `http://localhost:${port}
|
|
80
|
+
const path2 = `${no}?print${withClicks ? "=clicks" : ""}${clicks ? `&clicks=${clicks}` : ""}`;
|
|
81
|
+
const url = routerMode === "hash" ? `http://localhost:${port}${base}#${path2}` : `http://localhost:${port}${base}${path2}`;
|
|
82
82
|
await page.goto(url, {
|
|
83
83
|
waitUntil: "networkidle"
|
|
84
84
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,9 @@ import Markdown from 'vite-plugin-md';
|
|
|
5
5
|
import WindiCSS from 'vite-plugin-windicss';
|
|
6
6
|
import RemoteAssets from 'vite-plugin-remote-assets';
|
|
7
7
|
import { ArgumentsType } from '@antfu/utils';
|
|
8
|
-
import { SlidevMarkdown } from '@slidev/types';
|
|
8
|
+
import { SlidevMarkdown, SlidevThemeMeta, SlidevConfig, FontOptions, ResolvedFontOptions, SlideInfoBase, SlidevFeatureFlags, SlideInfoWithPath } from '@slidev/types';
|
|
9
9
|
import * as vite from 'vite';
|
|
10
10
|
import { InlineConfig, Plugin } from 'vite';
|
|
11
|
-
import * as fs from '@slidev/parser/fs';
|
|
12
|
-
export { fs as parser };
|
|
13
11
|
|
|
14
12
|
interface SlidevEntryOptions {
|
|
15
13
|
/**
|
|
@@ -78,4 +76,70 @@ declare function ViteSlidevPlugin(options: ResolvedSlidevOptions, pluginOptions:
|
|
|
78
76
|
|
|
79
77
|
declare function createWindiCSSPlugin({ themeRoots, clientRoot, userRoot, roots, data }: ResolvedSlidevOptions, { windicss: windiOptions }: SlidevPluginOptions): Promise<vite.Plugin[]>;
|
|
80
78
|
|
|
81
|
-
|
|
79
|
+
/**
|
|
80
|
+
* 1,3-5,8 => [1, 3, 4, 5, 8]
|
|
81
|
+
*/
|
|
82
|
+
declare function parseRangeString(total: number, rangeStr?: string): number[];
|
|
83
|
+
/**
|
|
84
|
+
* Accepts `16/9` `1:1` `3x4`
|
|
85
|
+
*/
|
|
86
|
+
declare function parseAspectRatio(str: string | number): number;
|
|
87
|
+
|
|
88
|
+
declare function resolveConfig(headmatter: any, themeMeta?: SlidevThemeMeta): SlidevConfig;
|
|
89
|
+
declare function resolveFonts(fonts?: FontOptions): ResolvedFontOptions;
|
|
90
|
+
|
|
91
|
+
declare function stringify(data: SlidevMarkdown): string;
|
|
92
|
+
declare function filterDisabled(data: SlidevMarkdown): SlidevMarkdown;
|
|
93
|
+
declare function stringifySlide(data: SlideInfoBase, idx?: number): string;
|
|
94
|
+
declare function prettifySlide(data: SlideInfoBase): SlideInfoBase;
|
|
95
|
+
declare function prettify(data: SlidevMarkdown): SlidevMarkdown;
|
|
96
|
+
declare function detectFeatures(code: string): SlidevFeatureFlags;
|
|
97
|
+
declare function parseSlide(raw: string): SlideInfoBase;
|
|
98
|
+
declare function parse(markdown: string, filepath?: string, themeMeta?: SlidevThemeMeta): SlidevMarkdown;
|
|
99
|
+
declare function mergeFeatureFlags(a: SlidevFeatureFlags, b: SlidevFeatureFlags): SlidevFeatureFlags;
|
|
100
|
+
declare function scanMonacoModules(md: string): string[];
|
|
101
|
+
|
|
102
|
+
declare function load(filepath: string, themeMeta?: SlidevThemeMeta, content?: string): Promise<SlidevMarkdown>;
|
|
103
|
+
declare function save(data: SlidevMarkdown, filepath?: string): Promise<void>;
|
|
104
|
+
declare function saveExternalSlide(slide: SlideInfoWithPath): Promise<void>;
|
|
105
|
+
|
|
106
|
+
declare const fs_load: typeof load;
|
|
107
|
+
declare const fs_save: typeof save;
|
|
108
|
+
declare const fs_saveExternalSlide: typeof saveExternalSlide;
|
|
109
|
+
declare const fs_parseRangeString: typeof parseRangeString;
|
|
110
|
+
declare const fs_parseAspectRatio: typeof parseAspectRatio;
|
|
111
|
+
declare const fs_resolveConfig: typeof resolveConfig;
|
|
112
|
+
declare const fs_resolveFonts: typeof resolveFonts;
|
|
113
|
+
declare const fs_stringify: typeof stringify;
|
|
114
|
+
declare const fs_filterDisabled: typeof filterDisabled;
|
|
115
|
+
declare const fs_stringifySlide: typeof stringifySlide;
|
|
116
|
+
declare const fs_prettifySlide: typeof prettifySlide;
|
|
117
|
+
declare const fs_prettify: typeof prettify;
|
|
118
|
+
declare const fs_detectFeatures: typeof detectFeatures;
|
|
119
|
+
declare const fs_parseSlide: typeof parseSlide;
|
|
120
|
+
declare const fs_parse: typeof parse;
|
|
121
|
+
declare const fs_mergeFeatureFlags: typeof mergeFeatureFlags;
|
|
122
|
+
declare const fs_scanMonacoModules: typeof scanMonacoModules;
|
|
123
|
+
declare namespace fs {
|
|
124
|
+
export {
|
|
125
|
+
fs_load as load,
|
|
126
|
+
fs_save as save,
|
|
127
|
+
fs_saveExternalSlide as saveExternalSlide,
|
|
128
|
+
fs_parseRangeString as parseRangeString,
|
|
129
|
+
fs_parseAspectRatio as parseAspectRatio,
|
|
130
|
+
fs_resolveConfig as resolveConfig,
|
|
131
|
+
fs_resolveFonts as resolveFonts,
|
|
132
|
+
fs_stringify as stringify,
|
|
133
|
+
fs_filterDisabled as filterDisabled,
|
|
134
|
+
fs_stringifySlide as stringifySlide,
|
|
135
|
+
fs_prettifySlide as prettifySlide,
|
|
136
|
+
fs_prettify as prettify,
|
|
137
|
+
fs_detectFeatures as detectFeatures,
|
|
138
|
+
fs_parseSlide as parseSlide,
|
|
139
|
+
fs_parse as parse,
|
|
140
|
+
fs_mergeFeatureFlags as mergeFeatureFlags,
|
|
141
|
+
fs_scanMonacoModules as scanMonacoModules,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { ResolvedSlidevOptions, SlidevEntryOptions, SlidevPluginOptions, SlidevServerOptions, ViteSlidevPlugin, createServer, createWindiCSSPlugin, getCLIRoot, getClientRoot, getThemeRoots, getUserRoot, isPath, fs as parser, resolveOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZ64T7ZBUjs = require('./chunk-Z64T7ZBU.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -8,23 +8,21 @@ var _chunk3QMXOBKWjs = require('./chunk-3QMXOBKW.js');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var _chunkVG5IYO5Pjs = require('./chunk-VG5IYO5P.js');
|
|
12
11
|
|
|
12
|
+
var _chunkFHAYPMSGjs = require('./chunk-FHAYPMSG.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var _chunkDVHCB7TLjs = require('./chunk-DVHCB7TL.js');
|
|
16
15
|
|
|
16
|
+
var _chunkINYQJTKAjs = require('./chunk-INYQJTKA.js');
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
var _chunkBYTWGCY3js = require('./chunk-BYTWGCY3.js');
|
|
19
20
|
|
|
20
21
|
// node/index.ts
|
|
21
|
-
|
|
22
|
+
_chunkBYTWGCY3js.init_cjs_shims.call(void 0, );
|
|
22
23
|
|
|
23
24
|
// node/declare.ts
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// node/index.ts
|
|
27
|
-
var _fs = require('@slidev/parser/fs'); var parser = _interopRequireWildcard(_fs);
|
|
25
|
+
_chunkBYTWGCY3js.init_cjs_shims.call(void 0, );
|
|
28
26
|
|
|
29
27
|
|
|
30
28
|
|
|
@@ -36,4 +34,4 @@ var _fs = require('@slidev/parser/fs'); var parser = _interopRequireWildcard(_fs
|
|
|
36
34
|
|
|
37
35
|
|
|
38
36
|
|
|
39
|
-
exports.ViteSlidevPlugin =
|
|
37
|
+
exports.ViteSlidevPlugin = _chunkINYQJTKAjs.ViteSlidevPlugin; exports.createServer = _chunkZ64T7ZBUjs.createServer; exports.createWindiCSSPlugin = _chunkINYQJTKAjs.createWindiCSSPlugin; exports.getCLIRoot = _chunkFHAYPMSGjs.getCLIRoot; exports.getClientRoot = _chunkFHAYPMSGjs.getClientRoot; exports.getThemeRoots = _chunkFHAYPMSGjs.getThemeRoots; exports.getUserRoot = _chunkFHAYPMSGjs.getUserRoot; exports.isPath = _chunkFHAYPMSGjs.isPath; exports.parser = _chunkFHAYPMSGjs.fs_exports; exports.resolveOptions = _chunkFHAYPMSGjs.resolveOptions;
|
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RLNIZC66.mjs";
|
|
4
4
|
import {
|
|
5
|
+
fs_exports,
|
|
5
6
|
getCLIRoot,
|
|
6
7
|
getClientRoot,
|
|
7
8
|
getThemeRoots,
|
|
8
9
|
getUserRoot,
|
|
9
10
|
isPath,
|
|
10
11
|
resolveOptions
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MP2CDYSZ.mjs";
|
|
12
13
|
import {
|
|
13
14
|
ViteSlidevPlugin,
|
|
14
15
|
createWindiCSSPlugin
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import
|
|
16
|
+
} from "./chunk-2E3KKOOJ.mjs";
|
|
17
|
+
import {
|
|
18
|
+
init_esm_shims
|
|
19
|
+
} from "./chunk-OXQUV4ZP.mjs";
|
|
17
20
|
|
|
18
21
|
// node/index.ts
|
|
19
|
-
|
|
22
|
+
init_esm_shims();
|
|
23
|
+
|
|
24
|
+
// node/declare.ts
|
|
25
|
+
init_esm_shims();
|
|
20
26
|
export {
|
|
21
27
|
ViteSlidevPlugin,
|
|
22
28
|
createServer,
|
|
@@ -26,6 +32,6 @@ export {
|
|
|
26
32
|
getThemeRoots,
|
|
27
33
|
getUserRoot,
|
|
28
34
|
isPath,
|
|
29
|
-
parser,
|
|
35
|
+
fs_exports as parser,
|
|
30
36
|
resolveOptions
|
|
31
37
|
};
|