@slidev/cli 0.41.1 → 0.42.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/README.md +2 -2
- package/dist/{build-3GLTTQXV.js → build-FNP2QTPG.js} +9 -7
- package/dist/{build-KUT3K5TN.mjs → build-KRDVURNJ.mjs} +5 -3
- package/dist/chunk-6XVZLT3I.mjs +35 -0
- package/dist/chunk-6ZL4B4HQ.js +76 -0
- package/dist/chunk-CIUEQ4TI.mjs +76 -0
- package/dist/{chunk-AV6T2PNJ.mjs → chunk-EQTZCSMP.mjs} +63 -184
- package/dist/chunk-KKGXM3XL.js +35 -0
- package/dist/{chunk-CTG3GV2W.mjs → chunk-L5QH2WZE.mjs} +1 -71
- package/dist/chunk-MJQETB73.js +68 -0
- package/dist/{chunk-5QG2FB7Y.mjs → chunk-PL2KGP4V.mjs} +8 -6
- package/dist/{chunk-UJUM4LW4.js → chunk-QL6EDWJQ.js} +56 -177
- package/dist/{chunk-OM6HSZVY.js → chunk-TRSAM62K.js} +82 -80
- package/dist/chunk-X7P5WRYP.mjs +65 -0
- package/dist/chunk-YI4ZV27K.js +65 -0
- package/dist/cli.js +38 -36
- package/dist/cli.mjs +14 -12
- package/dist/{export-KPPDUO6Z.mjs → export-KRS4L4HC.mjs} +2 -1
- package/dist/{export-GTPZJWVE.js → export-PN4EOI4Z.js} +4 -3
- package/dist/index.js +8 -4
- package/dist/index.mjs +8 -4
- package/dist/unocss-2CJUFE63.js +46 -0
- package/dist/unocss-ZLGTDCD7.mjs +46 -0
- package/dist/windicss-OSTDR2Z6.mjs +9 -0
- package/dist/windicss-YNIIPANV.js +9 -0
- package/package.json +9 -9
- package/dist/chunk-GE7W2DBE.js +0 -138
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Presentation <b>slide</b>s for <b>dev</b>elopers 🧑💻👩💻👨
|
|
|
39
39
|
- 📝 [**Markdown-based**](https://sli.dev/guide/syntax.html) - use your favorite editors and workflow
|
|
40
40
|
- 🧑💻 [**Developer Friendly**](https://sli.dev/guide/syntax.html#code-blocks) - built-in syntax highlighting, live coding, etc.
|
|
41
41
|
- 🎨 [**Themable**](https://sli.dev/themes/gallery.html) - theme can be shared and used with npm packages.
|
|
42
|
-
- 🌈 [**Stylish**](https://sli.dev/guide/syntax.html#embedded-styles) - on-demand utilities via [
|
|
42
|
+
- 🌈 [**Stylish**](https://sli.dev/guide/syntax.html#embedded-styles) - on-demand utilities via [UnoCSS](https://github.com/unocss/unocss).
|
|
43
43
|
- 🤹 [**Interactive**](https://sli.dev/custom/directory-structure.html#components) - embedding Vue components seamlessly.
|
|
44
44
|
- 🎙 [**Presenter Mode**](https://sli.dev/guide/presenter-mode.html) - use another window, or even your phone to control your slides.
|
|
45
45
|
- 🧮 [**LaTeX**](https://sli.dev/guide/syntax.html#latex) - built-in LaTeX math equations support.
|
|
@@ -78,7 +78,7 @@ For a full example, you can check the [demo](https://github.com/slidevjs/slidev/
|
|
|
78
78
|
|
|
79
79
|
- [Vite](https://vitejs.dev) - An extremely fast frontend tooling
|
|
80
80
|
- [Vue 3](https://v3.vuejs.org/) powered [Markdown](https://daringfireball.net/projects/markdown/syntax) - Focus on the content while having the power of HTML and Vue components whenever needed
|
|
81
|
-
- [
|
|
81
|
+
- [UnoCSS](https://github.com/unocss/unocss) - On-demand utility-first CSS engine, style your slides at ease
|
|
82
82
|
- [Prism](https://github.com/PrismJS/prism), [Shiki](https://github.com/shikijs/shiki), [Monaco Editor](https://github.com/Microsoft/monaco-editor) - First-class code snippets support with live coding capability
|
|
83
83
|
- [RecordRTC](https://recordrtc.org) - Built-in recording and camera view
|
|
84
84
|
- [VueUse](https://vueuse.org) family - [`@vueuse/core`](https://github.com/vueuse/vueuse), [`@vueuse/head`](https://github.com/vueuse/head), [`@vueuse/motion`](https://github.com/vueuse/motion), etc.
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var _chunkQL6EDWJQjs = require('./chunk-QL6EDWJQ.js');
|
|
6
|
+
require('./chunk-KKGXM3XL.js');
|
|
7
|
+
require('./chunk-6ZL4B4HQ.js');
|
|
8
|
+
require('./chunk-MJQETB73.js');
|
|
7
9
|
|
|
8
10
|
// node/build.ts
|
|
9
11
|
var _path = require('path');
|
|
@@ -649,16 +651,16 @@ async function build(options, viteConfig = {}, args) {
|
|
|
649
651
|
let originalIndexHTML;
|
|
650
652
|
if (_fsextra2.default.existsSync(indexPath))
|
|
651
653
|
originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
|
|
652
|
-
await _fsextra2.default.writeFile(indexPath, await
|
|
654
|
+
await _fsextra2.default.writeFile(indexPath, await _chunkQL6EDWJQjs.getIndexHtml.call(void 0, options), "utf-8");
|
|
653
655
|
let config = void 0;
|
|
654
656
|
try {
|
|
655
|
-
const inlineConfig = await
|
|
657
|
+
const inlineConfig = await _chunkQL6EDWJQjs.mergeViteConfigs.call(void 0,
|
|
656
658
|
options,
|
|
657
659
|
viteConfig,
|
|
658
660
|
{
|
|
659
661
|
root: options.userRoot,
|
|
660
662
|
plugins: [
|
|
661
|
-
await
|
|
663
|
+
await _chunkQL6EDWJQjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
|
|
662
664
|
{
|
|
663
665
|
name: "resolve-config",
|
|
664
666
|
configResolved(_config) {
|
|
@@ -679,7 +681,7 @@ async function build(options, viteConfig = {}, args) {
|
|
|
679
681
|
} else {
|
|
680
682
|
console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
|
|
681
683
|
await _vite.build.call(void 0,
|
|
682
|
-
await
|
|
684
|
+
await _chunkQL6EDWJQjs.mergeViteConfigs.call(void 0,
|
|
683
685
|
options,
|
|
684
686
|
inlineConfig,
|
|
685
687
|
{
|
|
@@ -720,7 +722,7 @@ async function build(options, viteConfig = {}, args) {
|
|
|
720
722
|
await _fsextra2.default.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
721
723
|
`, "utf-8");
|
|
722
724
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
723
|
-
const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-
|
|
725
|
+
const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-PN4EOI4Z.js"));
|
|
724
726
|
const port = 12445;
|
|
725
727
|
const app = _connect2.default.call(void 0, );
|
|
726
728
|
const server = _http2.default.createServer(app);
|
|
@@ -2,8 +2,10 @@ import {
|
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
getIndexHtml,
|
|
4
4
|
mergeViteConfigs
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-EQTZCSMP.mjs";
|
|
6
|
+
import "./chunk-6XVZLT3I.mjs";
|
|
7
|
+
import "./chunk-CIUEQ4TI.mjs";
|
|
8
|
+
import "./chunk-L5QH2WZE.mjs";
|
|
7
9
|
|
|
8
10
|
// node/build.ts
|
|
9
11
|
import { join as join3, resolve as resolve3 } from "path";
|
|
@@ -720,7 +722,7 @@ async function build(options, viteConfig = {}, args) {
|
|
|
720
722
|
await fs2.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
721
723
|
`, "utf-8");
|
|
722
724
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
723
|
-
const { exportSlides, getExportOptions } = await import("./export-
|
|
725
|
+
const { exportSlides, getExportOptions } = await import("./export-KRS4L4HC.mjs");
|
|
724
726
|
const port = 12445;
|
|
725
727
|
const app = connect();
|
|
726
728
|
const server = http.createServer(app);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// node/plugins/setupNode.ts
|
|
2
|
+
import { resolve } from "path";
|
|
3
|
+
import { pathExists } from "fs-extra";
|
|
4
|
+
import { isObject } from "@antfu/utils";
|
|
5
|
+
import jiti from "jiti";
|
|
6
|
+
function deepMerge(a, b, rootPath = "") {
|
|
7
|
+
a = { ...a };
|
|
8
|
+
Object.keys(b).forEach((key) => {
|
|
9
|
+
if (isObject(a[key]))
|
|
10
|
+
a[key] = deepMerge(a[key], b[key], rootPath ? `${rootPath}.${key}` : key);
|
|
11
|
+
else if (Array.isArray(a[key]))
|
|
12
|
+
a[key] = [...a[key], ...b[key]];
|
|
13
|
+
else
|
|
14
|
+
a[key] = b[key];
|
|
15
|
+
});
|
|
16
|
+
return a;
|
|
17
|
+
}
|
|
18
|
+
async function loadSetups(roots, name, arg, initial, merge = true, accumulate) {
|
|
19
|
+
let returns = initial;
|
|
20
|
+
for (const root of roots) {
|
|
21
|
+
const path = resolve(root, "setup", name);
|
|
22
|
+
if (await pathExists(path)) {
|
|
23
|
+
const { default: setup } = jiti(__filename)(path);
|
|
24
|
+
const result = await setup(arg);
|
|
25
|
+
if (result !== null) {
|
|
26
|
+
returns = merge ? deepMerge(returns, result) : accumulate ? accumulate(returns, result) : result;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return returns;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
loadSetups
|
|
35
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
var _chunkMJQETB73js = require('./chunk-MJQETB73.js');
|
|
4
|
+
|
|
5
|
+
// node/utils.ts
|
|
6
|
+
var _path = require('path');
|
|
7
|
+
var _utils = require('@antfu/utils');
|
|
8
|
+
var _isinstalledglobally = require('is-installed-globally'); var _isinstalledglobally2 = _interopRequireDefault(_isinstalledglobally);
|
|
9
|
+
var _resolve = require('resolve');
|
|
10
|
+
var _globaldirs = require('global-dirs'); var _globaldirs2 = _interopRequireDefault(_globaldirs);
|
|
11
|
+
function toAtFS(path) {
|
|
12
|
+
return `/@fs${_utils.ensurePrefix.call(void 0, "/", _utils.slash.call(void 0, path))}`;
|
|
13
|
+
}
|
|
14
|
+
function resolveImportPath(importName, ensure = false) {
|
|
15
|
+
try {
|
|
16
|
+
return _resolve.sync.call(void 0, importName, {
|
|
17
|
+
preserveSymlinks: false
|
|
18
|
+
});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
}
|
|
21
|
+
if (_isinstalledglobally2.default) {
|
|
22
|
+
try {
|
|
23
|
+
return _chunkMJQETB73js.__require.resolve(_path.join.call(void 0, _globaldirs2.default.yarn.packages, importName));
|
|
24
|
+
} catch (e2) {
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
return _chunkMJQETB73js.__require.resolve(_path.join.call(void 0, _globaldirs2.default.npm.packages, importName));
|
|
28
|
+
} catch (e3) {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (ensure)
|
|
32
|
+
throw new Error(`Failed to resolve package "${importName}"`);
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
function resolveGlobalImportPath(importName) {
|
|
36
|
+
try {
|
|
37
|
+
return _resolve.sync.call(void 0, importName, { preserveSymlinks: false, basedir: __dirname });
|
|
38
|
+
} catch (e4) {
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
return _chunkMJQETB73js.__require.resolve(_path.join.call(void 0, _globaldirs2.default.yarn.packages, importName));
|
|
42
|
+
} catch (e5) {
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
return _chunkMJQETB73js.__require.resolve(_path.join.call(void 0, _globaldirs2.default.npm.packages, importName));
|
|
46
|
+
} catch (e6) {
|
|
47
|
+
}
|
|
48
|
+
throw new Error(`Failed to resolve global package "${importName}"`);
|
|
49
|
+
}
|
|
50
|
+
function stringifyMarkdownTokens(tokens) {
|
|
51
|
+
return tokens.map(
|
|
52
|
+
(token) => {
|
|
53
|
+
var _a;
|
|
54
|
+
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(" ");
|
|
55
|
+
}
|
|
56
|
+
).filter(Boolean).join(" ");
|
|
57
|
+
}
|
|
58
|
+
function generateGoogleFontsUrl(options) {
|
|
59
|
+
const weights = options.weights.flatMap((i) => options.italic ? [`0,${i}`, `1,${i}`] : [`${i}`]).sort().join(";");
|
|
60
|
+
const fonts = options.webfonts.map((i) => `family=${i.replace(/^(['"])(.*)\1$/, "$1").replace(/\s+/g, "+")}:${options.italic ? "ital," : ""}wght@${weights}`).join("&");
|
|
61
|
+
return `https://fonts.googleapis.com/css2?${fonts}&display=swap`;
|
|
62
|
+
}
|
|
63
|
+
function packageExists(name) {
|
|
64
|
+
if (resolveImportPath(`${name}/package.json`))
|
|
65
|
+
return true;
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
exports.toAtFS = toAtFS; exports.resolveImportPath = resolveImportPath; exports.resolveGlobalImportPath = resolveGlobalImportPath; exports.stringifyMarkdownTokens = stringifyMarkdownTokens; exports.generateGoogleFontsUrl = generateGoogleFontsUrl; exports.packageExists = packageExists;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__require
|
|
3
|
+
} from "./chunk-L5QH2WZE.mjs";
|
|
4
|
+
|
|
5
|
+
// node/utils.ts
|
|
6
|
+
import { join } from "path";
|
|
7
|
+
import { ensurePrefix, slash } from "@antfu/utils";
|
|
8
|
+
import isInstalledGlobally from "is-installed-globally";
|
|
9
|
+
import { sync as resolve } from "resolve";
|
|
10
|
+
import globalDirs from "global-dirs";
|
|
11
|
+
function toAtFS(path) {
|
|
12
|
+
return `/@fs${ensurePrefix("/", slash(path))}`;
|
|
13
|
+
}
|
|
14
|
+
function resolveImportPath(importName, ensure = false) {
|
|
15
|
+
try {
|
|
16
|
+
return resolve(importName, {
|
|
17
|
+
preserveSymlinks: false
|
|
18
|
+
});
|
|
19
|
+
} catch {
|
|
20
|
+
}
|
|
21
|
+
if (isInstalledGlobally) {
|
|
22
|
+
try {
|
|
23
|
+
return __require.resolve(join(globalDirs.yarn.packages, importName));
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
return __require.resolve(join(globalDirs.npm.packages, importName));
|
|
28
|
+
} catch {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (ensure)
|
|
32
|
+
throw new Error(`Failed to resolve package "${importName}"`);
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
function resolveGlobalImportPath(importName) {
|
|
36
|
+
try {
|
|
37
|
+
return resolve(importName, { preserveSymlinks: false, basedir: __dirname });
|
|
38
|
+
} catch {
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
return __require.resolve(join(globalDirs.yarn.packages, importName));
|
|
42
|
+
} catch {
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
return __require.resolve(join(globalDirs.npm.packages, importName));
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
throw new Error(`Failed to resolve global package "${importName}"`);
|
|
49
|
+
}
|
|
50
|
+
function stringifyMarkdownTokens(tokens) {
|
|
51
|
+
return tokens.map(
|
|
52
|
+
(token) => {
|
|
53
|
+
var _a;
|
|
54
|
+
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(" ");
|
|
55
|
+
}
|
|
56
|
+
).filter(Boolean).join(" ");
|
|
57
|
+
}
|
|
58
|
+
function generateGoogleFontsUrl(options) {
|
|
59
|
+
const weights = options.weights.flatMap((i) => options.italic ? [`0,${i}`, `1,${i}`] : [`${i}`]).sort().join(";");
|
|
60
|
+
const fonts = options.webfonts.map((i) => `family=${i.replace(/^(['"])(.*)\1$/, "$1").replace(/\s+/g, "+")}:${options.italic ? "ital," : ""}wght@${weights}`).join("&");
|
|
61
|
+
return `https://fonts.googleapis.com/css2?${fonts}&display=swap`;
|
|
62
|
+
}
|
|
63
|
+
function packageExists(name) {
|
|
64
|
+
if (resolveImportPath(`${name}/package.json`))
|
|
65
|
+
return true;
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
toAtFS,
|
|
71
|
+
resolveImportPath,
|
|
72
|
+
resolveGlobalImportPath,
|
|
73
|
+
stringifyMarkdownTokens,
|
|
74
|
+
generateGoogleFontsUrl,
|
|
75
|
+
packageExists
|
|
76
|
+
};
|