@slidev/cli 0.34.0 → 0.34.3
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-3A4647TA.js +743 -0
- package/dist/build-A6ASQ6Y3.mjs +743 -0
- package/dist/chunk-4MU7RGP4.js +1637 -0
- package/dist/{chunk-QE663OGO.mjs → chunk-C3EQABQP.mjs} +48 -44
- package/dist/{chunk-5GSPMDNU.js → chunk-DQTRW726.js} +178 -174
- package/dist/{chunk-IWKTUAXD.mjs → chunk-GVA336JI.mjs} +0 -32
- package/dist/{chunk-SO7T6GEW.js → chunk-SQLX75IO.js} +1 -37
- package/dist/chunk-VI5P2KM6.mjs +1638 -0
- package/dist/cli.js +24 -24
- package/dist/cli.mjs +5 -5
- package/dist/{export-Z44PM4CT.mjs → export-5OVMZQWE.mjs} +1 -1
- package/dist/{export-URR4VZNO.js → export-TH7MNEXN.js} +4 -4
- package/dist/index.js +6 -6
- package/dist/index.mjs +3 -3
- package/package.json +7 -7
- package/dist/build-GQNLL4B2.js +0 -113
- package/dist/build-Y3ZVSXFT.mjs +0 -113
- package/dist/chunk-FROLEDLC.js +0 -10916
- package/dist/chunk-OGKTSZVU.mjs +0 -10917
package/dist/cli.js
CHANGED
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkDQTRW726js = require('./chunk-DQTRW726.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunk4MU7RGP4js = require('./chunk-4MU7RGP4.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkSQLX75IOjs = require('./chunk-SQLX75IO.js');
|
|
18
18
|
|
|
19
19
|
// node/cli.ts
|
|
20
|
-
|
|
21
|
-
var import_fast_deep_equal =
|
|
20
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
21
|
+
var import_fast_deep_equal = _chunkSQLX75IOjs.__toESM.call(void 0, _chunk4MU7RGP4js.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,7 +38,7 @@ var CONFIG_RESTART_FIELDS = [
|
|
|
38
38
|
"fonts",
|
|
39
39
|
"css"
|
|
40
40
|
];
|
|
41
|
-
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(
|
|
41
|
+
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkDQTRW726js.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
|
|
42
42
|
cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOptions(args).option("port", {
|
|
43
43
|
alias: "p",
|
|
44
44
|
type: "number",
|
|
@@ -81,9 +81,9 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
|
|
|
81
81
|
async function initServer() {
|
|
82
82
|
if (server)
|
|
83
83
|
await server.close();
|
|
84
|
-
const options = await
|
|
84
|
+
const options = await _chunkDQTRW726js.resolveOptions.call(void 0, { entry, remote, theme }, "dev");
|
|
85
85
|
port = userPort || await findFreePort(3030);
|
|
86
|
-
server = await
|
|
86
|
+
server = await _chunkDQTRW726js.createServer.call(void 0, options, {
|
|
87
87
|
server: {
|
|
88
88
|
port,
|
|
89
89
|
strictPort: true,
|
|
@@ -94,7 +94,7 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
|
|
|
94
94
|
logLevel: log
|
|
95
95
|
}, {
|
|
96
96
|
onDataReload(newData, data) {
|
|
97
|
-
if (!theme &&
|
|
97
|
+
if (!theme && _chunkDQTRW726js.resolveThemeName.call(void 0, newData.config.theme) !== _chunkDQTRW726js.resolveThemeName.call(void 0, data.config.theme)) {
|
|
98
98
|
console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
|
|
99
99
|
initServer();
|
|
100
100
|
} else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
|
|
@@ -170,8 +170,8 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
|
|
|
170
170
|
type: "boolean",
|
|
171
171
|
describe: "allow download as PDF"
|
|
172
172
|
}).strict().help(), async ({ entry, theme, watch, base, download, out }) => {
|
|
173
|
-
const { build } = await Promise.resolve().then(() =>
|
|
174
|
-
const options = await
|
|
173
|
+
const { build } = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "./build-3A4647TA.js")));
|
|
174
|
+
const options = await _chunkDQTRW726js.resolveOptions.call(void 0, { entry, theme }, "build");
|
|
175
175
|
if (download && !options.data.config.download)
|
|
176
176
|
options.data.config.download = download;
|
|
177
177
|
printInfo(options);
|
|
@@ -184,26 +184,26 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
|
|
|
184
184
|
});
|
|
185
185
|
});
|
|
186
186
|
cli.command("format [entry]", "Format the markdown file", (args) => commonOptions(args).strict().help(), async ({ entry }) => {
|
|
187
|
-
const data = await
|
|
188
|
-
|
|
189
|
-
await
|
|
187
|
+
const data = await _chunkDQTRW726js.parser.load(entry);
|
|
188
|
+
_chunkDQTRW726js.parser.prettify(data);
|
|
189
|
+
await _chunkDQTRW726js.parser.save(data);
|
|
190
190
|
});
|
|
191
191
|
cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
192
192
|
return command.command("eject", "Eject current theme into local file system", (args) => commonOptions(args).option("dir", {
|
|
193
193
|
type: "string",
|
|
194
194
|
default: "theme"
|
|
195
195
|
}), async ({ entry, dir, theme: themeInput }) => {
|
|
196
|
-
const data = await
|
|
197
|
-
const theme =
|
|
196
|
+
const data = await _chunkDQTRW726js.parser.load(entry);
|
|
197
|
+
const theme = _chunkDQTRW726js.resolveThemeName.call(void 0, themeInput || data.config.theme);
|
|
198
198
|
if (theme === "none") {
|
|
199
199
|
console.error('Can not eject theme "none"');
|
|
200
200
|
process.exit(1);
|
|
201
201
|
}
|
|
202
|
-
if (
|
|
202
|
+
if (_chunkDQTRW726js.isPath.call(void 0, theme)) {
|
|
203
203
|
console.error("Theme is already ejected");
|
|
204
204
|
process.exit(1);
|
|
205
205
|
}
|
|
206
|
-
const roots =
|
|
206
|
+
const roots = _chunkDQTRW726js.getThemeRoots.call(void 0, theme, entry);
|
|
207
207
|
if (!roots.length) {
|
|
208
208
|
console.error(`Does not found theme "${theme}"`);
|
|
209
209
|
process.exit(1);
|
|
@@ -215,7 +215,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
|
215
215
|
const dirPath = `./${dir}`;
|
|
216
216
|
data.slides[0].frontmatter.theme = dirPath;
|
|
217
217
|
data.slides[0].raw = null;
|
|
218
|
-
await
|
|
218
|
+
await _chunkDQTRW726js.parser.save(data);
|
|
219
219
|
console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
|
|
220
220
|
});
|
|
221
221
|
}, () => {
|
|
@@ -257,17 +257,17 @@ cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(ar
|
|
|
257
257
|
"with-clicks": withClicks
|
|
258
258
|
}) => {
|
|
259
259
|
process.env.NODE_ENV = "production";
|
|
260
|
-
const { exportSlides } = await Promise.resolve().then(() =>
|
|
260
|
+
const { exportSlides } = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "./export-TH7MNEXN.js")));
|
|
261
261
|
const port = await findFreePort(12445);
|
|
262
|
-
const options = await
|
|
262
|
+
const options = await _chunkDQTRW726js.resolveOptions.call(void 0, { entry, theme }, "build");
|
|
263
263
|
output = output || options.data.config.exportFilename || `${_path2.default.basename(entry, ".md")}-export`;
|
|
264
|
-
const server = await
|
|
264
|
+
const server = await _chunkDQTRW726js.createServer.call(void 0, options, {
|
|
265
265
|
server: { port },
|
|
266
266
|
clearScreen: false
|
|
267
267
|
});
|
|
268
268
|
await server.listen(port);
|
|
269
269
|
printInfo(options);
|
|
270
|
-
|
|
270
|
+
_chunkDQTRW726js.parser.filterDisabled(options.data);
|
|
271
271
|
const width = options.data.config.canvasWidth;
|
|
272
272
|
const height = Math.round(width / options.data.config.aspectRatio);
|
|
273
273
|
output = await exportSlides({
|
|
@@ -305,7 +305,7 @@ function printInfo(options, port, remote) {
|
|
|
305
305
|
console.log();
|
|
306
306
|
console.log();
|
|
307
307
|
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${
|
|
308
|
+
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkDQTRW726js.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
|
|
309
309
|
console.log();
|
|
310
310
|
console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
|
|
311
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
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
resolveOptions,
|
|
7
7
|
resolveThemeName,
|
|
8
8
|
version
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-C3EQABQP.mjs";
|
|
10
10
|
import {
|
|
11
11
|
require_fast_deep_equal
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VI5P2KM6.mjs";
|
|
13
13
|
import {
|
|
14
14
|
__dirname,
|
|
15
15
|
__require,
|
|
16
16
|
__toESM,
|
|
17
17
|
init_esm_shims
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-GVA336JI.mjs";
|
|
19
19
|
|
|
20
20
|
// node/cli.ts
|
|
21
21
|
init_esm_shims();
|
|
@@ -171,7 +171,7 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
|
|
|
171
171
|
type: "boolean",
|
|
172
172
|
describe: "allow download as PDF"
|
|
173
173
|
}).strict().help(), async ({ entry, theme, watch, base, download, out }) => {
|
|
174
|
-
const { build } = await Promise.resolve().then(() => __toESM(__require("./build-
|
|
174
|
+
const { build } = await Promise.resolve().then(() => __toESM(__require("./build-A6ASQ6Y3.mjs")));
|
|
175
175
|
const options = await resolveOptions({ entry, theme }, "build");
|
|
176
176
|
if (download && !options.data.config.download)
|
|
177
177
|
options.data.config.download = download;
|
|
@@ -258,7 +258,7 @@ cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(ar
|
|
|
258
258
|
"with-clicks": withClicks
|
|
259
259
|
}) => {
|
|
260
260
|
process.env.NODE_ENV = "production";
|
|
261
|
-
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-
|
|
261
|
+
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-5OVMZQWE.mjs")));
|
|
262
262
|
const port = await findFreePort(12445);
|
|
263
263
|
const options = await resolveOptions({ entry, theme }, "build");
|
|
264
264
|
output = output || options.data.config.exportFilename || `${path.basename(entry, ".md")}-export`;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkSQLX75IOjs = require('./chunk-SQLX75IO.js');
|
|
7
7
|
|
|
8
8
|
// node/export.ts
|
|
9
|
-
|
|
9
|
+
_chunkSQLX75IOjs.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');
|
|
@@ -60,10 +60,10 @@ async function exportSlides({
|
|
|
60
60
|
height = 1080,
|
|
61
61
|
withClicks = false
|
|
62
62
|
}) {
|
|
63
|
-
if (!
|
|
63
|
+
if (!_chunkSQLX75IOjs.packageExists.call(void 0, "playwright-chromium"))
|
|
64
64
|
throw new Error("The exporting for Slidev is powered by Playwright, please installed it via `npm i -D playwright-chromium`");
|
|
65
65
|
const pages = _core.parseRangeString.call(void 0, total, range);
|
|
66
|
-
const { chromium } = await Promise.resolve().then(() =>
|
|
66
|
+
const { chromium } = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "playwright-chromium")));
|
|
67
67
|
const browser = await chromium.launch();
|
|
68
68
|
const context = await browser.newContext({
|
|
69
69
|
viewport: {
|
package/dist/index.js
CHANGED
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkDQTRW726js = require('./chunk-DQTRW726.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunk4MU7RGP4js = require('./chunk-4MU7RGP4.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkSQLX75IOjs = require('./chunk-SQLX75IO.js');
|
|
20
20
|
|
|
21
21
|
// node/index.ts
|
|
22
|
-
|
|
22
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
23
23
|
|
|
24
24
|
// node/declare.ts
|
|
25
|
-
|
|
25
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
@@ -36,4 +36,4 @@ _chunkSO7T6GEWjs.init_cjs_shims.call(void 0, );
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
exports.ViteSlidevPlugin =
|
|
39
|
+
exports.ViteSlidevPlugin = _chunk4MU7RGP4js.ViteSlidevPlugin; exports.createServer = _chunkDQTRW726js.createServer; exports.createWindiCSSPlugin = _chunk4MU7RGP4js.createWindiCSSPlugin; exports.getAddonRoots = _chunkDQTRW726js.getAddonRoots; exports.getCLIRoot = _chunkDQTRW726js.getCLIRoot; exports.getClientRoot = _chunkDQTRW726js.getClientRoot; exports.getRoot = _chunkDQTRW726js.getRoot; exports.getThemeRoots = _chunkDQTRW726js.getThemeRoots; exports.getUserRoot = _chunkDQTRW726js.getUserRoot; exports.isPath = _chunkDQTRW726js.isPath; exports.parser = _chunkDQTRW726js.parser; exports.resolveOptions = _chunkDQTRW726js.resolveOptions;
|
package/dist/index.mjs
CHANGED
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
isPath,
|
|
10
10
|
parser,
|
|
11
11
|
resolveOptions
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-C3EQABQP.mjs";
|
|
13
13
|
import {
|
|
14
14
|
ViteSlidevPlugin,
|
|
15
15
|
createWindiCSSPlugin
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VI5P2KM6.mjs";
|
|
17
17
|
import {
|
|
18
18
|
init_esm_shims
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-GVA336JI.mjs";
|
|
20
20
|
|
|
21
21
|
// node/index.ts
|
|
22
22
|
init_esm_shims();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/cli",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.3",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@antfu/utils": "^0.5.2",
|
|
46
|
+
"@hedgedoc/markdown-it-task-lists": "^1.0.4",
|
|
46
47
|
"@iconify-json/carbon": "^1.1.6",
|
|
47
48
|
"@iconify-json/ph": "^1.1.2",
|
|
48
|
-
"@slidev/client": "0.34.
|
|
49
|
-
"@slidev/parser": "0.34.
|
|
50
|
-
"@slidev/types": "0.34.
|
|
51
|
-
"@unocss/reset": "^0.42.0",
|
|
49
|
+
"@slidev/client": "0.34.3",
|
|
50
|
+
"@slidev/parser": "0.34.3",
|
|
51
|
+
"@slidev/types": "0.34.3",
|
|
52
52
|
"@vitejs/plugin-vue": "^2.3.3",
|
|
53
53
|
"@vue/compiler-sfc": "^3.2.37",
|
|
54
54
|
"cli-progress": "^3.11.2",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"resolve-from": "^5.0.0",
|
|
79
79
|
"resolve-global": "^1.0.0",
|
|
80
80
|
"shiki": "^0.10.1",
|
|
81
|
+
"unocss": "^0.42.0",
|
|
81
82
|
"unplugin-icons": "^0.14.6",
|
|
82
83
|
"unplugin-vue-components": "^0.20.1",
|
|
83
84
|
"vite": "^2.9.13",
|
|
@@ -93,8 +94,7 @@
|
|
|
93
94
|
"@types/plantuml-encoder": "^1.4.0",
|
|
94
95
|
"fast-deep-equal": "^3.1.3",
|
|
95
96
|
"semver": "^7.3.7",
|
|
96
|
-
"sirv": "^2.0.2"
|
|
97
|
-
"unocss": "^0.42.0"
|
|
97
|
+
"sirv": "^2.0.2"
|
|
98
98
|
},
|
|
99
99
|
"scripts": {
|
|
100
100
|
"build": "rimraf dist && tsup node/index.ts node/cli.ts --dts --format cjs,esm --splitting --external @slidev/client/package.json",
|
package/dist/build-GQNLL4B2.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkFROLEDLCjs = require('./chunk-FROLEDLC.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _chunkSO7T6GEWjs = require('./chunk-SO7T6GEW.js');
|
|
12
|
-
|
|
13
|
-
// node/build.ts
|
|
14
|
-
_chunkSO7T6GEWjs.init_cjs_shims.call(void 0, );
|
|
15
|
-
var _path = require('path');
|
|
16
|
-
var _http = require('http'); var _http2 = _interopRequireDefault(_http);
|
|
17
|
-
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
18
|
-
var _vite = require('vite');
|
|
19
|
-
var _connect = require('connect'); var _connect2 = _interopRequireDefault(_connect);
|
|
20
|
-
var _kolorist = require('kolorist');
|
|
21
|
-
async function build(options, viteConfig = {}) {
|
|
22
|
-
const indexPath = _path.resolve.call(void 0, options.userRoot, "index.html");
|
|
23
|
-
const rawConfig = await _vite.resolveConfig.call(void 0, {}, "build");
|
|
24
|
-
const pluginOptions = rawConfig.slidev || {};
|
|
25
|
-
let originalIndexHTML;
|
|
26
|
-
if (_fsextra2.default.existsSync(indexPath))
|
|
27
|
-
originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
|
|
28
|
-
await _fsextra2.default.writeFile(indexPath, await _chunkFROLEDLCjs.getIndexHtml.call(void 0, options), "utf-8");
|
|
29
|
-
let config = void 0;
|
|
30
|
-
try {
|
|
31
|
-
const inlineConfig = await _chunkFROLEDLCjs.mergeViteConfigs.call(void 0, options, viteConfig, {
|
|
32
|
-
root: options.userRoot,
|
|
33
|
-
plugins: [
|
|
34
|
-
await _chunkFROLEDLCjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
|
|
35
|
-
{
|
|
36
|
-
name: "resolve-config",
|
|
37
|
-
configResolved(_config) {
|
|
38
|
-
config = _config;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
build: {
|
|
43
|
-
chunkSizeWarningLimit: 2e3
|
|
44
|
-
}
|
|
45
|
-
}, "build");
|
|
46
|
-
await _vite.build.call(void 0, inlineConfig);
|
|
47
|
-
if (options.data.features.monaco) {
|
|
48
|
-
if (options.data.config.monaco === "dev") {
|
|
49
|
-
console.log(_kolorist.yellow.call(void 0, " Monaco is disabled in the build, to enabled it, set `monaco: true` in the frontmatter"));
|
|
50
|
-
} else {
|
|
51
|
-
console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
|
|
52
|
-
await _vite.build.call(void 0, await _chunkFROLEDLCjs.mergeViteConfigs.call(void 0, options, inlineConfig, {
|
|
53
|
-
root: _path.join.call(void 0, options.clientRoot, "iframes/monaco"),
|
|
54
|
-
base: `${config.base}iframes/monaco/`,
|
|
55
|
-
build: {
|
|
56
|
-
outDir: _path.resolve.call(void 0, config.build.outDir, "iframes/monaco"),
|
|
57
|
-
rollupOptions: {
|
|
58
|
-
output: {
|
|
59
|
-
manualChunks: {
|
|
60
|
-
jsonWorker: ["monaco-editor/esm/vs/language/json/json.worker"],
|
|
61
|
-
cssWorker: ["monaco-editor/esm/vs/language/css/css.worker"],
|
|
62
|
-
htmlWorker: ["monaco-editor/esm/vs/language/html/html.worker"],
|
|
63
|
-
tsWorker: ["monaco-editor/esm/vs/language/typescript/ts.worker"],
|
|
64
|
-
editorWorker: ["monaco-editor/esm/vs/editor/editor.worker"]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}, "build"));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
} finally {
|
|
73
|
-
if (originalIndexHTML != null)
|
|
74
|
-
await _fsextra2.default.writeFile(indexPath, originalIndexHTML, "utf-8");
|
|
75
|
-
else
|
|
76
|
-
await _fsextra2.default.unlink(indexPath);
|
|
77
|
-
}
|
|
78
|
-
const outDir = _path.resolve.call(void 0, options.userRoot, config.build.outDir);
|
|
79
|
-
const outFilename = options.data.config.exportFilename || "slidev-exported.pdf";
|
|
80
|
-
await _fsextra2.default.copyFile(_path.resolve.call(void 0, outDir, "index.html"), _path.resolve.call(void 0, outDir, "404.html"));
|
|
81
|
-
const redirectsPath = _path.resolve.call(void 0, outDir, "_redirects");
|
|
82
|
-
if (!_fsextra2.default.existsSync(redirectsPath))
|
|
83
|
-
await _fsextra2.default.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
84
|
-
`, "utf-8");
|
|
85
|
-
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
86
|
-
const { exportSlides } = await Promise.resolve().then(() => _chunkSO7T6GEWjs.__toESM.call(void 0, _chunkSO7T6GEWjs.__require.call(void 0, "./export-URR4VZNO.js")));
|
|
87
|
-
const port = 12445;
|
|
88
|
-
const app = _connect2.default.call(void 0, );
|
|
89
|
-
const server = _http2.default.createServer(app);
|
|
90
|
-
app.use(config.base, _chunkFROLEDLCjs.build_default.call(void 0, outDir, {
|
|
91
|
-
etag: true,
|
|
92
|
-
single: true,
|
|
93
|
-
dev: true
|
|
94
|
-
}));
|
|
95
|
-
server.listen(port);
|
|
96
|
-
await exportSlides({
|
|
97
|
-
port,
|
|
98
|
-
slides: options.data.slides,
|
|
99
|
-
total: options.data.slides.length,
|
|
100
|
-
format: "pdf",
|
|
101
|
-
output: _path.join.call(void 0, outDir, outFilename),
|
|
102
|
-
base: config.base,
|
|
103
|
-
dark: options.data.config.colorSchema === "dark",
|
|
104
|
-
width: options.data.config.canvasWidth,
|
|
105
|
-
height: Math.round(options.data.config.canvasWidth / options.data.config.aspectRatio),
|
|
106
|
-
routerMode: options.data.config.routerMode
|
|
107
|
-
});
|
|
108
|
-
server.close();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
exports.build = build;
|
package/dist/build-Y3ZVSXFT.mjs
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ViteSlidevPlugin,
|
|
3
|
-
build_default,
|
|
4
|
-
getIndexHtml,
|
|
5
|
-
mergeViteConfigs
|
|
6
|
-
} from "./chunk-OGKTSZVU.mjs";
|
|
7
|
-
import {
|
|
8
|
-
__require,
|
|
9
|
-
__toESM,
|
|
10
|
-
init_esm_shims
|
|
11
|
-
} from "./chunk-IWKTUAXD.mjs";
|
|
12
|
-
|
|
13
|
-
// node/build.ts
|
|
14
|
-
init_esm_shims();
|
|
15
|
-
import { join, resolve } from "path";
|
|
16
|
-
import http from "http";
|
|
17
|
-
import fs from "fs-extra";
|
|
18
|
-
import { resolveConfig, build as viteBuild } from "vite";
|
|
19
|
-
import connect from "connect";
|
|
20
|
-
import { blue, yellow } from "kolorist";
|
|
21
|
-
async function build(options, viteConfig = {}) {
|
|
22
|
-
const indexPath = resolve(options.userRoot, "index.html");
|
|
23
|
-
const rawConfig = await resolveConfig({}, "build");
|
|
24
|
-
const pluginOptions = rawConfig.slidev || {};
|
|
25
|
-
let originalIndexHTML;
|
|
26
|
-
if (fs.existsSync(indexPath))
|
|
27
|
-
originalIndexHTML = await fs.readFile(indexPath, "utf-8");
|
|
28
|
-
await fs.writeFile(indexPath, await getIndexHtml(options), "utf-8");
|
|
29
|
-
let config = void 0;
|
|
30
|
-
try {
|
|
31
|
-
const inlineConfig = await mergeViteConfigs(options, viteConfig, {
|
|
32
|
-
root: options.userRoot,
|
|
33
|
-
plugins: [
|
|
34
|
-
await ViteSlidevPlugin(options, pluginOptions),
|
|
35
|
-
{
|
|
36
|
-
name: "resolve-config",
|
|
37
|
-
configResolved(_config) {
|
|
38
|
-
config = _config;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
build: {
|
|
43
|
-
chunkSizeWarningLimit: 2e3
|
|
44
|
-
}
|
|
45
|
-
}, "build");
|
|
46
|
-
await viteBuild(inlineConfig);
|
|
47
|
-
if (options.data.features.monaco) {
|
|
48
|
-
if (options.data.config.monaco === "dev") {
|
|
49
|
-
console.log(yellow(" Monaco is disabled in the build, to enabled it, set `monaco: true` in the frontmatter"));
|
|
50
|
-
} else {
|
|
51
|
-
console.log(blue(" building for Monaco...\n"));
|
|
52
|
-
await viteBuild(await mergeViteConfigs(options, inlineConfig, {
|
|
53
|
-
root: join(options.clientRoot, "iframes/monaco"),
|
|
54
|
-
base: `${config.base}iframes/monaco/`,
|
|
55
|
-
build: {
|
|
56
|
-
outDir: resolve(config.build.outDir, "iframes/monaco"),
|
|
57
|
-
rollupOptions: {
|
|
58
|
-
output: {
|
|
59
|
-
manualChunks: {
|
|
60
|
-
jsonWorker: ["monaco-editor/esm/vs/language/json/json.worker"],
|
|
61
|
-
cssWorker: ["monaco-editor/esm/vs/language/css/css.worker"],
|
|
62
|
-
htmlWorker: ["monaco-editor/esm/vs/language/html/html.worker"],
|
|
63
|
-
tsWorker: ["monaco-editor/esm/vs/language/typescript/ts.worker"],
|
|
64
|
-
editorWorker: ["monaco-editor/esm/vs/editor/editor.worker"]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}, "build"));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
} finally {
|
|
73
|
-
if (originalIndexHTML != null)
|
|
74
|
-
await fs.writeFile(indexPath, originalIndexHTML, "utf-8");
|
|
75
|
-
else
|
|
76
|
-
await fs.unlink(indexPath);
|
|
77
|
-
}
|
|
78
|
-
const outDir = resolve(options.userRoot, config.build.outDir);
|
|
79
|
-
const outFilename = options.data.config.exportFilename || "slidev-exported.pdf";
|
|
80
|
-
await fs.copyFile(resolve(outDir, "index.html"), resolve(outDir, "404.html"));
|
|
81
|
-
const redirectsPath = resolve(outDir, "_redirects");
|
|
82
|
-
if (!fs.existsSync(redirectsPath))
|
|
83
|
-
await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
84
|
-
`, "utf-8");
|
|
85
|
-
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
86
|
-
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-Z44PM4CT.mjs")));
|
|
87
|
-
const port = 12445;
|
|
88
|
-
const app = connect();
|
|
89
|
-
const server = http.createServer(app);
|
|
90
|
-
app.use(config.base, build_default(outDir, {
|
|
91
|
-
etag: true,
|
|
92
|
-
single: true,
|
|
93
|
-
dev: true
|
|
94
|
-
}));
|
|
95
|
-
server.listen(port);
|
|
96
|
-
await exportSlides({
|
|
97
|
-
port,
|
|
98
|
-
slides: options.data.slides,
|
|
99
|
-
total: options.data.slides.length,
|
|
100
|
-
format: "pdf",
|
|
101
|
-
output: join(outDir, outFilename),
|
|
102
|
-
base: config.base,
|
|
103
|
-
dark: options.data.config.colorSchema === "dark",
|
|
104
|
-
width: options.data.config.canvasWidth,
|
|
105
|
-
height: Math.round(options.data.config.canvasWidth / options.data.config.aspectRatio),
|
|
106
|
-
routerMode: options.data.config.routerMode
|
|
107
|
-
});
|
|
108
|
-
server.close();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
export {
|
|
112
|
-
build
|
|
113
|
-
};
|