@slidev/cli 51.6.0 → 51.6.2
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-oRYT3yXD.js +62 -0
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +518 -594
- package/dist/export-D1Zqc-n1.js +433 -0
- package/dist/index.d.ts +12 -7
- package/dist/index.js +5 -17
- package/dist/resolver-BShaA6qw.js +155 -0
- package/dist/serve-D6FyjIir.js +14 -0
- package/dist/shared-D3tuRsUE.js +2475 -0
- package/package.json +23 -23
- package/dist/build-Z7GTSSXD.js +0 -77
- package/dist/chunk-BCA62OS7.js +0 -29
- package/dist/chunk-TJFRPB4N.js +0 -190
- package/dist/chunk-Y2DHOFI5.js +0 -2761
- package/dist/export-5TR5BGLG.js +0 -520
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "51.6.
|
|
4
|
+
"version": "51.6.2",
|
|
5
5
|
"description": "Presentation slides for developers",
|
|
6
|
-
"author": "
|
|
6
|
+
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"funding": "https://github.com/sponsors/antfu",
|
|
9
9
|
"homepage": "https://sli.dev",
|
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
"@iconify-json/ph": "^1.2.2",
|
|
49
49
|
"@iconify-json/svg-spinners": "^1.2.2",
|
|
50
50
|
"@lillallol/outline-pdf": "^4.0.0",
|
|
51
|
-
"@shikijs/markdown-it": "^3.
|
|
52
|
-
"@shikijs/twoslash": "^3.
|
|
53
|
-
"@shikijs/vitepress-twoslash": "^3.
|
|
54
|
-
"@unocss/extractor-mdc": "^66.
|
|
55
|
-
"@unocss/reset": "^66.
|
|
56
|
-
"@vitejs/plugin-vue": "^5.2.
|
|
51
|
+
"@shikijs/markdown-it": "^3.4.2",
|
|
52
|
+
"@shikijs/twoslash": "^3.4.2",
|
|
53
|
+
"@shikijs/vitepress-twoslash": "^3.4.2",
|
|
54
|
+
"@unocss/extractor-mdc": "^66.1.2",
|
|
55
|
+
"@unocss/reset": "^66.1.2",
|
|
56
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
57
57
|
"@vitejs/plugin-vue-jsx": "^4.1.2",
|
|
58
|
-
"ansis": "^
|
|
58
|
+
"ansis": "^4.0.0",
|
|
59
59
|
"chokidar": "^4.0.3",
|
|
60
60
|
"cli-progress": "^3.12.0",
|
|
61
61
|
"connect": "^3.7.0",
|
|
62
|
-
"debug": "^4.4.
|
|
62
|
+
"debug": "^4.4.1",
|
|
63
63
|
"fast-deep-equal": "^3.1.3",
|
|
64
64
|
"fast-glob": "^3.3.3",
|
|
65
65
|
"get-port-please": "^3.1.2",
|
|
@@ -77,41 +77,41 @@
|
|
|
77
77
|
"markdown-it-mdc": "^0.2.5",
|
|
78
78
|
"mlly": "^1.7.4",
|
|
79
79
|
"monaco-editor": "0.51.0",
|
|
80
|
-
"open": "^10.1.
|
|
80
|
+
"open": "^10.1.2",
|
|
81
81
|
"pdf-lib": "^1.17.1",
|
|
82
82
|
"picomatch": "^4.0.2",
|
|
83
83
|
"plantuml-encoder": "^1.4.0",
|
|
84
84
|
"postcss-nested": "^7.0.2",
|
|
85
|
-
"pptxgenjs": "^
|
|
85
|
+
"pptxgenjs": "^4.0.0",
|
|
86
86
|
"prompts": "^2.4.2",
|
|
87
87
|
"public-ip": "^7.0.1",
|
|
88
88
|
"resolve-from": "^5.0.0",
|
|
89
89
|
"resolve-global": "^2.0.0",
|
|
90
|
-
"semver": "^7.7.
|
|
91
|
-
"shiki": "^3.
|
|
90
|
+
"semver": "^7.7.2",
|
|
91
|
+
"shiki": "^3.4.2",
|
|
92
92
|
"shiki-magic-move": "^1.1.0",
|
|
93
93
|
"sirv": "^3.0.1",
|
|
94
94
|
"source-map-js": "^1.2.1",
|
|
95
95
|
"typescript": "^5.8.3",
|
|
96
96
|
"unhead": "^2.0.8",
|
|
97
|
-
"unocss": "^66.
|
|
97
|
+
"unocss": "^66.1.2",
|
|
98
98
|
"unplugin-icons": "^22.1.0",
|
|
99
99
|
"unplugin-vue-components": "^28.5.0",
|
|
100
100
|
"unplugin-vue-markdown": "^28.3.1",
|
|
101
101
|
"untun": "^0.1.3",
|
|
102
102
|
"uqr": "^0.1.2",
|
|
103
|
-
"vite": "^6.3.
|
|
103
|
+
"vite": "^6.3.5",
|
|
104
104
|
"vite-plugin-inspect": "^11.0.1",
|
|
105
105
|
"vite-plugin-remote-assets": "^2.0.0",
|
|
106
|
-
"vite-plugin-static-copy": "^
|
|
106
|
+
"vite-plugin-static-copy": "^3.0.0",
|
|
107
107
|
"vite-plugin-vue-server-ref": "^1.0.0",
|
|
108
108
|
"vitefu": "^1.0.6",
|
|
109
|
-
"vue": "^3.5.
|
|
110
|
-
"yaml": "^2.
|
|
109
|
+
"vue": "^3.5.14",
|
|
110
|
+
"yaml": "^2.8.0",
|
|
111
111
|
"yargs": "^17.7.2",
|
|
112
|
-
"@slidev/client": "51.6.
|
|
113
|
-
"@slidev/parser": "51.6.
|
|
114
|
-
"@slidev/types": "51.6.
|
|
112
|
+
"@slidev/client": "51.6.2",
|
|
113
|
+
"@slidev/parser": "51.6.2",
|
|
114
|
+
"@slidev/types": "51.6.2"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@hedgedoc/markdown-it-plugins": "^2.1.4",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"@types/plantuml-encoder": "^1.4.2"
|
|
120
120
|
},
|
|
121
121
|
"scripts": {
|
|
122
|
-
"build": "
|
|
122
|
+
"build": "tsdown node/index.ts node/cli.ts",
|
|
123
123
|
"dev": "nr build --watch",
|
|
124
124
|
"start": "tsx node/cli.ts"
|
|
125
125
|
}
|
package/dist/build-Z7GTSSXD.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveViteConfigs
|
|
3
|
-
} from "./chunk-Y2DHOFI5.js";
|
|
4
|
-
import "./chunk-TJFRPB4N.js";
|
|
5
|
-
|
|
6
|
-
// node/commands/build.ts
|
|
7
|
-
import { existsSync } from "node:fs";
|
|
8
|
-
import fs from "node:fs/promises";
|
|
9
|
-
import http from "node:http";
|
|
10
|
-
import { join, resolve } from "node:path";
|
|
11
|
-
import connect from "connect";
|
|
12
|
-
import sirv from "sirv";
|
|
13
|
-
import { build as viteBuild } from "vite";
|
|
14
|
-
async function build(options, viteConfig = {}, args) {
|
|
15
|
-
const indexPath = resolve(options.userRoot, "index.html");
|
|
16
|
-
let originalIndexHTML;
|
|
17
|
-
if (existsSync(indexPath))
|
|
18
|
-
originalIndexHTML = await fs.readFile(indexPath, "utf-8");
|
|
19
|
-
await fs.writeFile(indexPath, options.utils.indexHtml, "utf-8");
|
|
20
|
-
let config = void 0;
|
|
21
|
-
try {
|
|
22
|
-
const inlineConfig = await resolveViteConfigs(
|
|
23
|
-
options,
|
|
24
|
-
{
|
|
25
|
-
plugins: [
|
|
26
|
-
{
|
|
27
|
-
name: "resolve-config",
|
|
28
|
-
configResolved(_config) {
|
|
29
|
-
config = _config;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
build: {
|
|
34
|
-
chunkSizeWarningLimit: 2e3
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
viteConfig,
|
|
38
|
-
"build"
|
|
39
|
-
);
|
|
40
|
-
await viteBuild(inlineConfig);
|
|
41
|
-
} finally {
|
|
42
|
-
if (originalIndexHTML != null)
|
|
43
|
-
await fs.writeFile(indexPath, originalIndexHTML, "utf-8");
|
|
44
|
-
else
|
|
45
|
-
await fs.unlink(indexPath);
|
|
46
|
-
}
|
|
47
|
-
const outDir = resolve(options.userRoot, config.build.outDir);
|
|
48
|
-
await fs.copyFile(resolve(outDir, "index.html"), resolve(outDir, "404.html"));
|
|
49
|
-
const redirectsPath = resolve(outDir, "_redirects");
|
|
50
|
-
if (!existsSync(redirectsPath))
|
|
51
|
-
await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
52
|
-
`, "utf-8");
|
|
53
|
-
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
54
|
-
const { exportSlides, getExportOptions } = await import("./export-5TR5BGLG.js");
|
|
55
|
-
const port = 12445;
|
|
56
|
-
const app = connect();
|
|
57
|
-
const server = http.createServer(app);
|
|
58
|
-
app.use(
|
|
59
|
-
config.base,
|
|
60
|
-
sirv(outDir, {
|
|
61
|
-
etag: true,
|
|
62
|
-
single: true,
|
|
63
|
-
dev: true
|
|
64
|
-
})
|
|
65
|
-
);
|
|
66
|
-
server.listen(port);
|
|
67
|
-
await exportSlides({
|
|
68
|
-
port,
|
|
69
|
-
base: config.base,
|
|
70
|
-
...getExportOptions(args, options, join(outDir, "slidev-exported.pdf"))
|
|
71
|
-
});
|
|
72
|
-
server.close();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export {
|
|
76
|
-
build
|
|
77
|
-
};
|
package/dist/chunk-BCA62OS7.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveViteConfigs
|
|
3
|
-
} from "./chunk-Y2DHOFI5.js";
|
|
4
|
-
|
|
5
|
-
// node/commands/serve.ts
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import process from "node:process";
|
|
8
|
-
import { createServer as createViteServer } from "vite";
|
|
9
|
-
async function createServer(options, viteConfig = {}, serverOptions) {
|
|
10
|
-
process.env.EDITOR = process.env.EDITOR || "code";
|
|
11
|
-
const inlineConfig = await resolveViteConfigs(
|
|
12
|
-
options,
|
|
13
|
-
{
|
|
14
|
-
optimizeDeps: {
|
|
15
|
-
entries: [
|
|
16
|
-
join(options.clientRoot, "main.ts")
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
viteConfig,
|
|
21
|
-
"serve",
|
|
22
|
-
serverOptions
|
|
23
|
-
);
|
|
24
|
-
return await createViteServer(inlineConfig);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
createServer
|
|
29
|
-
};
|
package/dist/chunk-TJFRPB4N.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
// node/resolver.ts
|
|
2
|
-
import * as fs from "node:fs";
|
|
3
|
-
import { dirname, join, relative, resolve } from "node:path";
|
|
4
|
-
import process from "node:process";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { parseNi, run } from "@antfu/ni";
|
|
7
|
-
import { ensurePrefix, slash } from "@antfu/utils";
|
|
8
|
-
import { underline, yellow } from "ansis";
|
|
9
|
-
import globalDirs from "global-directory";
|
|
10
|
-
import { resolvePath } from "mlly";
|
|
11
|
-
import prompts from "prompts";
|
|
12
|
-
import { resolveGlobal } from "resolve-global";
|
|
13
|
-
import { findClosestPkgJsonPath, findDepPkgJsonPath } from "vitefu";
|
|
14
|
-
var cliRoot = fileURLToPath(new URL("..", import.meta.url));
|
|
15
|
-
var isInstalledGlobally = {};
|
|
16
|
-
async function resolveImportUrl(id) {
|
|
17
|
-
return toAtFS(await resolveImportPath(id, true));
|
|
18
|
-
}
|
|
19
|
-
function toAtFS(path) {
|
|
20
|
-
return `/@fs${ensurePrefix("/", slash(path))}`;
|
|
21
|
-
}
|
|
22
|
-
async function resolveImportPath(importName, ensure = false) {
|
|
23
|
-
try {
|
|
24
|
-
return await resolvePath(importName, {
|
|
25
|
-
url: import.meta.url
|
|
26
|
-
});
|
|
27
|
-
} catch {
|
|
28
|
-
}
|
|
29
|
-
if (isInstalledGlobally.value) {
|
|
30
|
-
try {
|
|
31
|
-
return resolveGlobal(importName);
|
|
32
|
-
} catch {
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (ensure)
|
|
36
|
-
throw new Error(`Failed to resolve package "${importName}"`);
|
|
37
|
-
}
|
|
38
|
-
async function findPkgRoot(dep, parent, ensure = false) {
|
|
39
|
-
const pkgJsonPath = await findDepPkgJsonPath(dep, parent);
|
|
40
|
-
const path = pkgJsonPath ? dirname(pkgJsonPath) : isInstalledGlobally.value ? await findGlobalPkgRoot(dep, false) : void 0;
|
|
41
|
-
if (ensure && !path)
|
|
42
|
-
throw new Error(`Failed to resolve package "${dep}"`);
|
|
43
|
-
return path;
|
|
44
|
-
}
|
|
45
|
-
async function findGlobalPkgRoot(name, ensure = false) {
|
|
46
|
-
const yarnPath = join(globalDirs.yarn.packages, name);
|
|
47
|
-
if (fs.existsSync(`${yarnPath}/package.json`))
|
|
48
|
-
return yarnPath;
|
|
49
|
-
const npmPath = join(globalDirs.npm.packages, name);
|
|
50
|
-
if (fs.existsSync(`${npmPath}/package.json`))
|
|
51
|
-
return npmPath;
|
|
52
|
-
if (ensure)
|
|
53
|
-
throw new Error(`Failed to resolve global package "${name}"`);
|
|
54
|
-
}
|
|
55
|
-
async function resolveEntry(entryRaw) {
|
|
56
|
-
if (!fs.existsSync(entryRaw) && !entryRaw.endsWith(".md") && !/[/\\]/.test(entryRaw))
|
|
57
|
-
entryRaw += ".md";
|
|
58
|
-
const entry = resolve(entryRaw);
|
|
59
|
-
if (!fs.existsSync(entry)) {
|
|
60
|
-
const { create } = await prompts({
|
|
61
|
-
name: "create",
|
|
62
|
-
type: "confirm",
|
|
63
|
-
initial: "Y",
|
|
64
|
-
message: `Entry file ${yellow(`"${entry}"`)} does not exist, do you want to create it?`
|
|
65
|
-
});
|
|
66
|
-
if (create)
|
|
67
|
-
fs.copyFileSync(resolve(cliRoot, "template.md"), entry);
|
|
68
|
-
else
|
|
69
|
-
process.exit(0);
|
|
70
|
-
}
|
|
71
|
-
return slash(entry);
|
|
72
|
-
}
|
|
73
|
-
function createResolver(type, officials) {
|
|
74
|
-
async function promptForInstallation(pkgName) {
|
|
75
|
-
const { confirm } = await prompts({
|
|
76
|
-
name: "confirm",
|
|
77
|
-
initial: "Y",
|
|
78
|
-
type: "confirm",
|
|
79
|
-
message: `The ${type} "${pkgName}" was not found ${underline(isInstalledGlobally.value ? "globally" : "in your project")}, do you want to install it now?`
|
|
80
|
-
});
|
|
81
|
-
if (!confirm)
|
|
82
|
-
process.exit(1);
|
|
83
|
-
if (isInstalledGlobally.value)
|
|
84
|
-
await run(parseNi, ["-g", pkgName]);
|
|
85
|
-
else
|
|
86
|
-
await run(parseNi, [pkgName]);
|
|
87
|
-
}
|
|
88
|
-
return async function(name, importer) {
|
|
89
|
-
const { userRoot } = await getRoots();
|
|
90
|
-
if (name === "none")
|
|
91
|
-
return ["", null];
|
|
92
|
-
if (name[0] === "/")
|
|
93
|
-
return [name, name];
|
|
94
|
-
if (name.startsWith("@/"))
|
|
95
|
-
return [name, resolve(userRoot, name.slice(2))];
|
|
96
|
-
if (name[0] === "." || name[0] !== "@" && name.includes("/"))
|
|
97
|
-
return [name, resolve(dirname(importer), name)];
|
|
98
|
-
if (name.startsWith(`@slidev/${type}-`) || name.startsWith(`slidev-${type}-`)) {
|
|
99
|
-
const pkgRoot = await findPkgRoot(name, importer);
|
|
100
|
-
if (!pkgRoot)
|
|
101
|
-
await promptForInstallation(name);
|
|
102
|
-
return [name, await findPkgRoot(name, importer, true)];
|
|
103
|
-
}
|
|
104
|
-
{
|
|
105
|
-
const possiblePkgNames = [
|
|
106
|
-
`@slidev/${type}-${name}`,
|
|
107
|
-
`slidev-${type}-${name}`,
|
|
108
|
-
name
|
|
109
|
-
];
|
|
110
|
-
for (const pkgName2 of possiblePkgNames) {
|
|
111
|
-
const pkgRoot = await findPkgRoot(pkgName2, importer);
|
|
112
|
-
if (pkgRoot)
|
|
113
|
-
return [pkgName2, pkgRoot];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const pkgName = officials[name] ?? (name[0] === "@" ? name : `slidev-${type}-${name}`);
|
|
117
|
-
await promptForInstallation(pkgName);
|
|
118
|
-
return [pkgName, await findPkgRoot(pkgName, importer, true)];
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
function getUserPkgJson(userRoot) {
|
|
122
|
-
const path = resolve(userRoot, "package.json");
|
|
123
|
-
if (fs.existsSync(path))
|
|
124
|
-
return JSON.parse(fs.readFileSync(path, "utf-8"));
|
|
125
|
-
return {};
|
|
126
|
-
}
|
|
127
|
-
function hasWorkspacePackageJSON(root) {
|
|
128
|
-
const path = join(root, "package.json");
|
|
129
|
-
try {
|
|
130
|
-
fs.accessSync(path, fs.constants.R_OK);
|
|
131
|
-
} catch {
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
const content = JSON.parse(fs.readFileSync(path, "utf-8")) || {};
|
|
135
|
-
return !!content.workspaces;
|
|
136
|
-
}
|
|
137
|
-
function hasRootFile(root) {
|
|
138
|
-
const ROOT_FILES = [
|
|
139
|
-
// '.git',
|
|
140
|
-
// https://pnpm.js.org/workspaces/
|
|
141
|
-
"pnpm-workspace.yaml"
|
|
142
|
-
// https://rushjs.io/pages/advanced/config_files/
|
|
143
|
-
// 'rush.json',
|
|
144
|
-
// https://nx.dev/latest/react/getting-started/nx-setup
|
|
145
|
-
// 'workspace.json',
|
|
146
|
-
// 'nx.json'
|
|
147
|
-
];
|
|
148
|
-
return ROOT_FILES.some((file) => fs.existsSync(join(root, file)));
|
|
149
|
-
}
|
|
150
|
-
function searchForWorkspaceRoot(current, root = current) {
|
|
151
|
-
if (hasRootFile(current))
|
|
152
|
-
return current;
|
|
153
|
-
if (hasWorkspacePackageJSON(current))
|
|
154
|
-
return current;
|
|
155
|
-
const dir = dirname(current);
|
|
156
|
-
if (!dir || dir === current)
|
|
157
|
-
return root;
|
|
158
|
-
return searchForWorkspaceRoot(dir, root);
|
|
159
|
-
}
|
|
160
|
-
var rootsInfo = null;
|
|
161
|
-
async function getRoots(entry) {
|
|
162
|
-
if (rootsInfo)
|
|
163
|
-
return rootsInfo;
|
|
164
|
-
if (!entry)
|
|
165
|
-
throw new Error("[slidev] Cannot find roots without entry");
|
|
166
|
-
const userRoot = dirname(entry);
|
|
167
|
-
isInstalledGlobally.value = slash(relative(userRoot, process.argv[1])).includes("/.pnpm/") || (await import("is-installed-globally")).default;
|
|
168
|
-
const clientRoot = await findPkgRoot("@slidev/client", cliRoot, true);
|
|
169
|
-
const closestPkgRoot = dirname(await findClosestPkgJsonPath(userRoot) || userRoot);
|
|
170
|
-
const userPkgJson = getUserPkgJson(closestPkgRoot);
|
|
171
|
-
const userWorkspaceRoot = searchForWorkspaceRoot(closestPkgRoot);
|
|
172
|
-
rootsInfo = {
|
|
173
|
-
cliRoot,
|
|
174
|
-
clientRoot,
|
|
175
|
-
userRoot,
|
|
176
|
-
userPkgJson,
|
|
177
|
-
userWorkspaceRoot
|
|
178
|
-
};
|
|
179
|
-
return rootsInfo;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export {
|
|
183
|
-
isInstalledGlobally,
|
|
184
|
-
resolveImportUrl,
|
|
185
|
-
toAtFS,
|
|
186
|
-
resolveImportPath,
|
|
187
|
-
resolveEntry,
|
|
188
|
-
createResolver,
|
|
189
|
-
getRoots
|
|
190
|
-
};
|