@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
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
getIndexHtml,
|
|
4
4
|
mergeViteConfigs
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DRWWOOWC.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__require,
|
|
8
8
|
__toESM,
|
|
9
9
|
init_esm_shims
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-IAMILGBS.mjs";
|
|
11
11
|
|
|
12
12
|
// node/build.ts
|
|
13
13
|
init_esm_shims();
|
|
@@ -650,7 +650,7 @@ function build_default(dir, opts = {}) {
|
|
|
650
650
|
import { blue, yellow } from "kolorist";
|
|
651
651
|
async function build(options, viteConfig = {}) {
|
|
652
652
|
const indexPath = resolve3(options.userRoot, "index.html");
|
|
653
|
-
const rawConfig = await resolveConfig({}, "build");
|
|
653
|
+
const rawConfig = await resolveConfig({}, "build", options.entry);
|
|
654
654
|
const pluginOptions = rawConfig.slidev || {};
|
|
655
655
|
let originalIndexHTML;
|
|
656
656
|
if (fs2.existsSync(indexPath))
|
|
@@ -658,45 +658,57 @@ async function build(options, viteConfig = {}) {
|
|
|
658
658
|
await fs2.writeFile(indexPath, await getIndexHtml(options), "utf-8");
|
|
659
659
|
let config = void 0;
|
|
660
660
|
try {
|
|
661
|
-
const inlineConfig = await mergeViteConfigs(
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
661
|
+
const inlineConfig = await mergeViteConfigs(
|
|
662
|
+
options,
|
|
663
|
+
viteConfig,
|
|
664
|
+
{
|
|
665
|
+
root: options.userRoot,
|
|
666
|
+
plugins: [
|
|
667
|
+
await ViteSlidevPlugin(options, pluginOptions),
|
|
668
|
+
{
|
|
669
|
+
name: "resolve-config",
|
|
670
|
+
configResolved(_config) {
|
|
671
|
+
config = _config;
|
|
672
|
+
}
|
|
669
673
|
}
|
|
674
|
+
],
|
|
675
|
+
build: {
|
|
676
|
+
chunkSizeWarningLimit: 2e3
|
|
670
677
|
}
|
|
671
|
-
|
|
672
|
-
build
|
|
673
|
-
|
|
674
|
-
}
|
|
675
|
-
}, "build");
|
|
678
|
+
},
|
|
679
|
+
"build"
|
|
680
|
+
);
|
|
676
681
|
await viteBuild(inlineConfig);
|
|
677
682
|
if (options.data.features.monaco) {
|
|
678
683
|
if (options.data.config.monaco === "dev") {
|
|
679
684
|
console.log(yellow(" Monaco is disabled in the build, to enabled it, set `monaco: true` in the frontmatter"));
|
|
680
685
|
} else {
|
|
681
686
|
console.log(blue(" building for Monaco...\n"));
|
|
682
|
-
await viteBuild(
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
687
|
+
await viteBuild(
|
|
688
|
+
await mergeViteConfigs(
|
|
689
|
+
options,
|
|
690
|
+
inlineConfig,
|
|
691
|
+
{
|
|
692
|
+
root: join3(options.clientRoot, "iframes/monaco"),
|
|
693
|
+
base: `${config.base}iframes/monaco/`,
|
|
694
|
+
build: {
|
|
695
|
+
outDir: resolve3(config.build.outDir, "iframes/monaco"),
|
|
696
|
+
rollupOptions: {
|
|
697
|
+
output: {
|
|
698
|
+
manualChunks: {
|
|
699
|
+
jsonWorker: ["monaco-editor/esm/vs/language/json/json.worker"],
|
|
700
|
+
cssWorker: ["monaco-editor/esm/vs/language/css/css.worker"],
|
|
701
|
+
htmlWorker: ["monaco-editor/esm/vs/language/html/html.worker"],
|
|
702
|
+
tsWorker: ["monaco-editor/esm/vs/language/typescript/ts.worker"],
|
|
703
|
+
editorWorker: ["monaco-editor/esm/vs/editor/editor.worker"]
|
|
704
|
+
}
|
|
705
|
+
}
|
|
695
706
|
}
|
|
696
707
|
}
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
|
|
708
|
+
},
|
|
709
|
+
"build"
|
|
710
|
+
)
|
|
711
|
+
);
|
|
700
712
|
}
|
|
701
713
|
}
|
|
702
714
|
} finally {
|
|
@@ -713,15 +725,18 @@ async function build(options, viteConfig = {}) {
|
|
|
713
725
|
await fs2.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
714
726
|
`, "utf-8");
|
|
715
727
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
716
|
-
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-
|
|
728
|
+
const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-26FXNM7P.mjs")));
|
|
717
729
|
const port = 12445;
|
|
718
730
|
const app = connect();
|
|
719
731
|
const server = http.createServer(app);
|
|
720
|
-
app.use(
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
732
|
+
app.use(
|
|
733
|
+
config.base,
|
|
734
|
+
build_default(outDir, {
|
|
735
|
+
etag: true,
|
|
736
|
+
single: true,
|
|
737
|
+
dev: true
|
|
738
|
+
})
|
|
739
|
+
);
|
|
725
740
|
server.listen(port);
|
|
726
741
|
await exportSlides({
|
|
727
742
|
port,
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkL3B76JRZjs = require('./chunk-L3B76JRZ.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk74QPSS6Tjs = require('./chunk-74QPSS6T.js');
|
|
11
11
|
|
|
12
12
|
// node/build.ts
|
|
13
|
-
|
|
13
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
14
14
|
var _path = require('path');
|
|
15
15
|
var _http = require('http'); var _http2 = _interopRequireDefault(_http);
|
|
16
16
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
@@ -18,12 +18,12 @@ var _vite = require('vite');
|
|
|
18
18
|
var _connect = require('connect'); var _connect2 = _interopRequireDefault(_connect);
|
|
19
19
|
|
|
20
20
|
// ../../node_modules/.pnpm/sirv@2.0.2/node_modules/sirv/build.mjs
|
|
21
|
-
|
|
21
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
22
22
|
var _fs = require('fs'); var fs = _interopRequireWildcard(_fs);
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
// ../../node_modules/.pnpm/totalist@3.0.0/node_modules/totalist/sync/index.mjs
|
|
26
|
-
|
|
26
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
function totalist(dir, callback, pre = "") {
|
|
@@ -38,7 +38,7 @@ function totalist(dir, callback, pre = "") {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// ../../node_modules/.pnpm/@polka+url@1.0.0-next.21/node_modules/@polka/url/build.mjs
|
|
41
|
-
|
|
41
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
42
42
|
var _querystring = require('querystring'); var qs = _interopRequireWildcard(_querystring);
|
|
43
43
|
function parse2(req) {
|
|
44
44
|
let raw = req.url;
|
|
@@ -62,7 +62,7 @@ function parse2(req) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// ../../node_modules/.pnpm/mrmime@1.0.0/node_modules/mrmime/index.mjs
|
|
65
|
-
|
|
65
|
+
_chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
|
|
66
66
|
var mimes = {
|
|
67
67
|
"ez": "application/andrew-inset",
|
|
68
68
|
"aw": "application/applixware",
|
|
@@ -650,53 +650,65 @@ function build_default(dir, opts = {}) {
|
|
|
650
650
|
var _kolorist = require('kolorist');
|
|
651
651
|
async function build(options, viteConfig = {}) {
|
|
652
652
|
const indexPath = _path.resolve.call(void 0, options.userRoot, "index.html");
|
|
653
|
-
const rawConfig = await _vite.resolveConfig.call(void 0, {}, "build");
|
|
653
|
+
const rawConfig = await _vite.resolveConfig.call(void 0, {}, "build", options.entry);
|
|
654
654
|
const pluginOptions = rawConfig.slidev || {};
|
|
655
655
|
let originalIndexHTML;
|
|
656
656
|
if (_fsextra2.default.existsSync(indexPath))
|
|
657
657
|
originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
|
|
658
|
-
await _fsextra2.default.writeFile(indexPath, await
|
|
658
|
+
await _fsextra2.default.writeFile(indexPath, await _chunkL3B76JRZjs.getIndexHtml.call(void 0, options), "utf-8");
|
|
659
659
|
let config = void 0;
|
|
660
660
|
try {
|
|
661
|
-
const inlineConfig = await
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
661
|
+
const inlineConfig = await _chunkL3B76JRZjs.mergeViteConfigs.call(void 0,
|
|
662
|
+
options,
|
|
663
|
+
viteConfig,
|
|
664
|
+
{
|
|
665
|
+
root: options.userRoot,
|
|
666
|
+
plugins: [
|
|
667
|
+
await _chunkL3B76JRZjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
|
|
668
|
+
{
|
|
669
|
+
name: "resolve-config",
|
|
670
|
+
configResolved(_config) {
|
|
671
|
+
config = _config;
|
|
672
|
+
}
|
|
669
673
|
}
|
|
674
|
+
],
|
|
675
|
+
build: {
|
|
676
|
+
chunkSizeWarningLimit: 2e3
|
|
670
677
|
}
|
|
671
|
-
|
|
672
|
-
build
|
|
673
|
-
|
|
674
|
-
}
|
|
675
|
-
}, "build");
|
|
678
|
+
},
|
|
679
|
+
"build"
|
|
680
|
+
);
|
|
676
681
|
await _vite.build.call(void 0, inlineConfig);
|
|
677
682
|
if (options.data.features.monaco) {
|
|
678
683
|
if (options.data.config.monaco === "dev") {
|
|
679
684
|
console.log(_kolorist.yellow.call(void 0, " Monaco is disabled in the build, to enabled it, set `monaco: true` in the frontmatter"));
|
|
680
685
|
} else {
|
|
681
686
|
console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
|
|
682
|
-
await _vite.build.call(void 0,
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
687
|
+
await _vite.build.call(void 0,
|
|
688
|
+
await _chunkL3B76JRZjs.mergeViteConfigs.call(void 0,
|
|
689
|
+
options,
|
|
690
|
+
inlineConfig,
|
|
691
|
+
{
|
|
692
|
+
root: _path.join.call(void 0, options.clientRoot, "iframes/monaco"),
|
|
693
|
+
base: `${config.base}iframes/monaco/`,
|
|
694
|
+
build: {
|
|
695
|
+
outDir: _path.resolve.call(void 0, config.build.outDir, "iframes/monaco"),
|
|
696
|
+
rollupOptions: {
|
|
697
|
+
output: {
|
|
698
|
+
manualChunks: {
|
|
699
|
+
jsonWorker: ["monaco-editor/esm/vs/language/json/json.worker"],
|
|
700
|
+
cssWorker: ["monaco-editor/esm/vs/language/css/css.worker"],
|
|
701
|
+
htmlWorker: ["monaco-editor/esm/vs/language/html/html.worker"],
|
|
702
|
+
tsWorker: ["monaco-editor/esm/vs/language/typescript/ts.worker"],
|
|
703
|
+
editorWorker: ["monaco-editor/esm/vs/editor/editor.worker"]
|
|
704
|
+
}
|
|
705
|
+
}
|
|
695
706
|
}
|
|
696
707
|
}
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
|
|
708
|
+
},
|
|
709
|
+
"build"
|
|
710
|
+
)
|
|
711
|
+
);
|
|
700
712
|
}
|
|
701
713
|
}
|
|
702
714
|
} finally {
|
|
@@ -713,15 +725,18 @@ async function build(options, viteConfig = {}) {
|
|
|
713
725
|
await _fsextra2.default.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
714
726
|
`, "utf-8");
|
|
715
727
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
716
|
-
const { exportSlides } = await Promise.resolve().then(() =>
|
|
728
|
+
const { exportSlides } = await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "./export-WKFHZNBT.js")));
|
|
717
729
|
const port = 12445;
|
|
718
730
|
const app = _connect2.default.call(void 0, );
|
|
719
731
|
const server = _http2.default.createServer(app);
|
|
720
|
-
app.use(
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
732
|
+
app.use(
|
|
733
|
+
config.base,
|
|
734
|
+
build_default(outDir, {
|
|
735
|
+
etag: true,
|
|
736
|
+
single: true,
|
|
737
|
+
dev: true
|
|
738
|
+
})
|
|
739
|
+
);
|
|
725
740
|
server.listen(port);
|
|
726
741
|
await exportSlides({
|
|
727
742
|
port,
|
|
@@ -25,7 +25,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
25
25
|
}
|
|
26
26
|
return to;
|
|
27
27
|
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
29
32
|
var __accessCheck = (obj, member, msg) => {
|
|
30
33
|
if (!member.has(obj))
|
|
31
34
|
throw TypeError("Cannot " + msg);
|
|
@@ -55,9 +58,9 @@ var __privateWrapper = (obj, member, setter, getter) => {
|
|
|
55
58
|
};
|
|
56
59
|
};
|
|
57
60
|
|
|
58
|
-
// ../../node_modules/.pnpm/tsup@5.12.9_typescript@4.
|
|
61
|
+
// ../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.3/node_modules/tsup/assets/cjs_shims.js
|
|
59
62
|
var init_cjs_shims = __esm({
|
|
60
|
-
"../../node_modules/.pnpm/tsup@5.12.9_typescript@4.
|
|
63
|
+
"../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.3/node_modules/tsup/assets/cjs_shims.js"() {
|
|
61
64
|
}
|
|
62
65
|
});
|
|
63
66
|
|
|
@@ -108,10 +111,12 @@ function resolveGlobalImportPath(importName) {
|
|
|
108
111
|
throw new Error(`Failed to resolve global package "${importName}"`);
|
|
109
112
|
}
|
|
110
113
|
function stringifyMarkdownTokens(tokens) {
|
|
111
|
-
return tokens.map(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
return tokens.map(
|
|
115
|
+
(token) => {
|
|
116
|
+
var _a;
|
|
117
|
+
return (_a = token.children) == null ? void 0 : _a.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ");
|
|
118
|
+
}
|
|
119
|
+
).filter(Boolean).join(" ");
|
|
115
120
|
}
|
|
116
121
|
function generateGoogleFontsUrl(options) {
|
|
117
122
|
const weights = options.weights.flatMap((i) => options.italic ? [`0,${i}`, `1,${i}`] : [`${i}`]).sort().join(";");
|