@slidev/cli 0.48.0-beta.22 → 0.48.0-beta.23
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-LKM3MI3R.mjs → build-PDGXAWGC.mjs} +2 -2
- package/dist/{chunk-ADTW2LD4.mjs → chunk-7IY2RRV6.mjs} +22 -11
- package/dist/{chunk-BUGWF6XJ.mjs → chunk-TKQ4IRDS.mjs} +1 -1
- package/dist/cli.mjs +57 -7
- package/dist/{export-QZQV5HQF.mjs → export-2XPAFE22.mjs} +37 -9
- package/dist/index.mjs +2 -2
- package/package.json +8 -7
- package/template.md +2 -2
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
getIndexHtml,
|
|
4
4
|
mergeViteConfigs
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-7IY2RRV6.mjs";
|
|
6
6
|
import "./chunk-O6TYYGU6.mjs";
|
|
7
7
|
import "./chunk-CV7OWJOF.mjs";
|
|
8
8
|
|
|
@@ -62,7 +62,7 @@ async function build(options, viteConfig = {}, args) {
|
|
|
62
62
|
await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
63
63
|
`, "utf-8");
|
|
64
64
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
65
|
-
const { exportSlides, getExportOptions } = await import("./export-
|
|
65
|
+
const { exportSlides, getExportOptions } = await import("./export-2XPAFE22.mjs");
|
|
66
66
|
const port = 12445;
|
|
67
67
|
const app = connect();
|
|
68
68
|
const server = http.createServer(app);
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-CV7OWJOF.mjs";
|
|
8
8
|
|
|
9
9
|
// package.json
|
|
10
|
-
var version = "0.48.0-beta.
|
|
10
|
+
var version = "0.48.0-beta.23";
|
|
11
11
|
|
|
12
12
|
// node/common.ts
|
|
13
13
|
import { existsSync, promises as fs } from "node:fs";
|
|
@@ -168,15 +168,16 @@ var dependencies = {
|
|
|
168
168
|
"js-yaml": "^4.1.0",
|
|
169
169
|
katex: "^0.16.9",
|
|
170
170
|
"lz-string": "^1.5.0",
|
|
171
|
-
mermaid: "^10.
|
|
171
|
+
mermaid: "^10.9.0",
|
|
172
172
|
"monaco-editor": "^0.46.0",
|
|
173
173
|
prettier: "^3.2.5",
|
|
174
174
|
recordrtc: "^5.6.2",
|
|
175
175
|
shiki: "^1.1.7",
|
|
176
|
-
"shiki-magic-move": "^0.3.
|
|
177
|
-
typescript: "^5.
|
|
176
|
+
"shiki-magic-move": "^0.3.4",
|
|
177
|
+
typescript: "^5.4.2",
|
|
178
178
|
unocss: "^0.58.5",
|
|
179
179
|
vue: "^3.4.21",
|
|
180
|
+
"vue-demi": "^0.14.7",
|
|
180
181
|
"vue-router": "^4.3.0"
|
|
181
182
|
};
|
|
182
183
|
|
|
@@ -204,6 +205,7 @@ var EXCLUDE = [
|
|
|
204
205
|
"@slidev/client/constants",
|
|
205
206
|
"@slidev/client/logic/dark",
|
|
206
207
|
"@vueuse/core",
|
|
208
|
+
"@vueuse/math",
|
|
207
209
|
"@vueuse/shared",
|
|
208
210
|
"@unocss/reset",
|
|
209
211
|
"unocss",
|
|
@@ -948,6 +950,15 @@ function transformMarkdownMonaco(md2) {
|
|
|
948
950
|
return `<Monaco code-lz="${encoded}" lang="${lang}" v-bind="${options}" />`;
|
|
949
951
|
}
|
|
950
952
|
);
|
|
953
|
+
md2 = md2.replace(
|
|
954
|
+
/^```(\w+?)\s*{monaco-run}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg,
|
|
955
|
+
(full, lang = "ts", options = "{}", code) => {
|
|
956
|
+
lang = lang.trim();
|
|
957
|
+
options = options.trim() || "{}";
|
|
958
|
+
const encoded = lz.compressToBase64(code);
|
|
959
|
+
return `<Monaco runnable code-lz="${encoded}" lang="${lang}" v-bind="${options}" />`;
|
|
960
|
+
}
|
|
961
|
+
);
|
|
951
962
|
return md2;
|
|
952
963
|
}
|
|
953
964
|
function scanMonacoModules(md2) {
|
|
@@ -1227,7 +1238,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode, userRoot },
|
|
|
1227
1238
|
for (let i = 0; i < length; i++) {
|
|
1228
1239
|
const a = data.slides[i];
|
|
1229
1240
|
const b = newData.slides[i];
|
|
1230
|
-
if (a.content.trim() === b.content.trim() && a.title?.trim() === b.title?.trim() && equal(a.frontmatter, b.frontmatter) && Object.entries(a.snippetsUsed ?? {}).every(([file, oldContent]) => {
|
|
1241
|
+
if (!hmrPages.has(i) && a.content.trim() === b.content.trim() && a.title?.trim() === b.title?.trim() && equal(a.frontmatter, b.frontmatter) && Object.entries(a.snippetsUsed ?? {}).every(([file, oldContent]) => {
|
|
1231
1242
|
try {
|
|
1232
1243
|
const newContent = fs5.readFileSync(file, "utf-8");
|
|
1233
1244
|
return oldContent === newContent;
|
|
@@ -1239,7 +1250,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode, userRoot },
|
|
|
1239
1250
|
ctx.server.hot.send(
|
|
1240
1251
|
"slidev:update-note",
|
|
1241
1252
|
{
|
|
1242
|
-
|
|
1253
|
+
no: i + 1,
|
|
1243
1254
|
note: b.note || "",
|
|
1244
1255
|
noteHTML: renderNote(b.note || "")
|
|
1245
1256
|
}
|
|
@@ -1250,7 +1261,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode, userRoot },
|
|
|
1250
1261
|
ctx.server.hot.send(
|
|
1251
1262
|
"slidev:update-slide",
|
|
1252
1263
|
{
|
|
1253
|
-
|
|
1264
|
+
no: i + 1,
|
|
1254
1265
|
data: withRenderedNote(newData.slides[i])
|
|
1255
1266
|
}
|
|
1256
1267
|
);
|
|
@@ -1590,8 +1601,7 @@ defineProps<{ no: number | string }>()`);
|
|
|
1590
1601
|
`import "${resolveUrlOfClient("styles/index.css")}"`,
|
|
1591
1602
|
`import "${resolveUrlOfClient("styles/code.css")}"`,
|
|
1592
1603
|
`import "${resolveUrlOfClient("styles/katex.css")}"`,
|
|
1593
|
-
`import "${resolveUrlOfClient("styles/transitions.css")}"
|
|
1594
|
-
`import "${resolveUrlOfClient("styles/monaco.css")}"`
|
|
1604
|
+
`import "${resolveUrlOfClient("styles/transitions.css")}"`
|
|
1595
1605
|
];
|
|
1596
1606
|
for (const root of roots) {
|
|
1597
1607
|
const styles = [
|
|
@@ -1636,7 +1646,7 @@ defineProps<{ no: number | string }>()`);
|
|
|
1636
1646
|
result += `addFile(import(${JSON.stringify(url)}), ${JSON.stringify(file)})
|
|
1637
1647
|
`;
|
|
1638
1648
|
}
|
|
1639
|
-
const deps = data.config.monacoTypesAdditionalPackages;
|
|
1649
|
+
const deps = [...data.config.monacoTypesAdditionalPackages];
|
|
1640
1650
|
if (data.config.monacoTypesSource === "local")
|
|
1641
1651
|
deps.push(...scanMonacoModules(data.slides.map((s) => s.source.raw).join()));
|
|
1642
1652
|
function mapModuleNameToModule(moduleSpecifier) {
|
|
@@ -2070,7 +2080,8 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
2070
2080
|
...remoteAssetsOptions
|
|
2071
2081
|
})) : null,
|
|
2072
2082
|
ServerRef({
|
|
2073
|
-
debug:
|
|
2083
|
+
debug: false,
|
|
2084
|
+
// process.env.NODE_ENV === 'development',
|
|
2074
2085
|
state: {
|
|
2075
2086
|
sync: false,
|
|
2076
2087
|
nav: {
|
package/dist/cli.mjs
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
resolveAddons,
|
|
6
6
|
resolveOptions,
|
|
7
7
|
resolveTheme
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TKQ4IRDS.mjs";
|
|
9
9
|
import {
|
|
10
10
|
version
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7IY2RRV6.mjs";
|
|
12
12
|
import {
|
|
13
13
|
loadSetups
|
|
14
14
|
} from "./chunk-O6TYYGU6.mjs";
|
|
@@ -42,6 +42,20 @@ var CONFIG_RESTART_FIELDS = [
|
|
|
42
42
|
"editor",
|
|
43
43
|
"theme"
|
|
44
44
|
];
|
|
45
|
+
var FILES_CREATE_RESTART_GLOBS = [
|
|
46
|
+
"global-bottom.vue",
|
|
47
|
+
"global-top.vue",
|
|
48
|
+
"uno.config.js",
|
|
49
|
+
"uno.config.ts",
|
|
50
|
+
"unocss.config.js",
|
|
51
|
+
"unocss.config.ts"
|
|
52
|
+
];
|
|
53
|
+
var FILES_CHANGE_RESTART_GLOBS = [
|
|
54
|
+
"vite.config.*",
|
|
55
|
+
"setup/shiki.ts",
|
|
56
|
+
"setup/katex.ts",
|
|
57
|
+
"setup/preparser.ts"
|
|
58
|
+
];
|
|
45
59
|
injectPreparserExtensionLoader(async (headmatter, filepath, mode) => {
|
|
46
60
|
const addons = headmatter?.addons ?? [];
|
|
47
61
|
const { clientRoot, userRoot } = await getRoots();
|
|
@@ -96,6 +110,14 @@ cli.command(
|
|
|
96
110
|
let server;
|
|
97
111
|
let port = 3030;
|
|
98
112
|
let lastRemoteUrl;
|
|
113
|
+
let restartTimer;
|
|
114
|
+
function restartServer() {
|
|
115
|
+
clearTimeout(restartTimer);
|
|
116
|
+
restartTimer = setTimeout(() => {
|
|
117
|
+
console.log(yellow("\n restarting...\n"));
|
|
118
|
+
initServer();
|
|
119
|
+
}, 500);
|
|
120
|
+
}
|
|
99
121
|
async function initServer() {
|
|
100
122
|
if (server)
|
|
101
123
|
await server.close();
|
|
@@ -131,7 +153,7 @@ cli.command(
|
|
|
131
153
|
const themeRaw = theme || loaded.headmatter.theme || "default";
|
|
132
154
|
if (options.themeRaw !== themeRaw) {
|
|
133
155
|
console.log(yellow("\n restarting on theme change\n"));
|
|
134
|
-
|
|
156
|
+
restartServer();
|
|
135
157
|
return false;
|
|
136
158
|
}
|
|
137
159
|
const themeMeta = options.themeRoots[0] ? await getThemeMeta(themeRaw, options.themeRoots[0]) : void 0;
|
|
@@ -142,7 +164,7 @@ cli.command(
|
|
|
142
164
|
};
|
|
143
165
|
if (CONFIG_RESTART_FIELDS.some((i) => !equal(newData.config[i], oldData.config[i]))) {
|
|
144
166
|
console.log(yellow("\n restarting on config change\n"));
|
|
145
|
-
|
|
167
|
+
restartServer();
|
|
146
168
|
return false;
|
|
147
169
|
}
|
|
148
170
|
return newData;
|
|
@@ -248,6 +270,34 @@ ${dim(" Public IP: ")} ${blue(publicIp)}
|
|
|
248
270
|
}
|
|
249
271
|
initServer();
|
|
250
272
|
bindShortcut();
|
|
273
|
+
const { watch } = await import("chokidar");
|
|
274
|
+
const watcher = watch([
|
|
275
|
+
...FILES_CREATE_RESTART_GLOBS,
|
|
276
|
+
...FILES_CHANGE_RESTART_GLOBS
|
|
277
|
+
], {
|
|
278
|
+
ignored: ["node_modules", ".git"],
|
|
279
|
+
ignoreInitial: true
|
|
280
|
+
});
|
|
281
|
+
watcher.on("unlink", (file) => {
|
|
282
|
+
console.log(yellow(`
|
|
283
|
+
file ${file} removed, restarting...
|
|
284
|
+
`));
|
|
285
|
+
restartServer();
|
|
286
|
+
});
|
|
287
|
+
watcher.on("add", (file) => {
|
|
288
|
+
console.log(yellow(`
|
|
289
|
+
file ${file} added, restarting...
|
|
290
|
+
`));
|
|
291
|
+
restartServer();
|
|
292
|
+
});
|
|
293
|
+
watcher.on("change", (file) => {
|
|
294
|
+
if (FILES_CREATE_RESTART_GLOBS.includes(file))
|
|
295
|
+
return;
|
|
296
|
+
console.log(yellow(`
|
|
297
|
+
file ${file} changed, restarting...
|
|
298
|
+
`));
|
|
299
|
+
restartServer();
|
|
300
|
+
});
|
|
251
301
|
}
|
|
252
302
|
);
|
|
253
303
|
cli.command(
|
|
@@ -276,7 +326,7 @@ cli.command(
|
|
|
276
326
|
}).strict().help(),
|
|
277
327
|
async (args) => {
|
|
278
328
|
const { entry, theme, watch, base, download, out, inspect } = args;
|
|
279
|
-
const { build } = await import("./build-
|
|
329
|
+
const { build } = await import("./build-PDGXAWGC.mjs");
|
|
280
330
|
for (const entryFile of entry) {
|
|
281
331
|
const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
|
|
282
332
|
if (download && !options.data.config.download)
|
|
@@ -351,7 +401,7 @@ cli.command(
|
|
|
351
401
|
(args) => exportOptions(commonOptions(args)).strict().help(),
|
|
352
402
|
async (args) => {
|
|
353
403
|
const { entry, theme } = args;
|
|
354
|
-
const { exportSlides, getExportOptions } = await import("./export-
|
|
404
|
+
const { exportSlides, getExportOptions } = await import("./export-2XPAFE22.mjs");
|
|
355
405
|
const port = await getPort(12445);
|
|
356
406
|
for (const entryFile of entry) {
|
|
357
407
|
const options = await resolveOptions({ entry: entryFile, theme }, "export");
|
|
@@ -395,7 +445,7 @@ cli.command(
|
|
|
395
445
|
output,
|
|
396
446
|
timeout
|
|
397
447
|
}) => {
|
|
398
|
-
const { exportNotes } = await import("./export-
|
|
448
|
+
const { exportNotes } = await import("./export-2XPAFE22.mjs");
|
|
399
449
|
const port = await getPort(12445);
|
|
400
450
|
for (const entryFile of entry) {
|
|
401
451
|
const options = await resolveOptions({ entry: entryFile }, "export");
|
|
@@ -144,16 +144,44 @@ async function exportSlides({
|
|
|
144
144
|
});
|
|
145
145
|
await page.waitForLoadState("networkidle");
|
|
146
146
|
await page.emulateMedia({ colorScheme: dark ? "dark" : "light", media: "screen" });
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
{
|
|
148
|
+
const elements = page.locator(".slidev-slide-loading");
|
|
149
|
+
const count = await elements.count();
|
|
150
|
+
for (let index = 0; index < count; index++)
|
|
151
|
+
await elements.nth(index).waitFor({ state: "detached" });
|
|
152
|
+
}
|
|
153
|
+
{
|
|
154
|
+
const elements = page.locator("[data-waitfor]");
|
|
155
|
+
const count = await elements.count();
|
|
156
|
+
for (let index = 0; index < count; index++) {
|
|
157
|
+
const element = elements.nth(index);
|
|
158
|
+
const attribute = await element.getAttribute("data-waitfor");
|
|
159
|
+
if (attribute)
|
|
160
|
+
await element.locator(attribute).waitFor();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
{
|
|
164
|
+
const frames = page.frames();
|
|
165
|
+
await Promise.all(frames.map((frame) => frame.waitForLoadState()));
|
|
166
|
+
}
|
|
167
|
+
{
|
|
168
|
+
const container = page.locator("#mermaid-rendering-container");
|
|
169
|
+
while (true) {
|
|
170
|
+
const element = container.locator("div").first();
|
|
171
|
+
if (await element.count() === 0)
|
|
172
|
+
break;
|
|
173
|
+
await element.waitFor({ state: "detached" });
|
|
174
|
+
}
|
|
175
|
+
await container.evaluate((node) => node.style.display = "none");
|
|
176
|
+
}
|
|
177
|
+
{
|
|
178
|
+
const elements = page.locator(".monaco-aria-container");
|
|
179
|
+
const count = await elements.count();
|
|
180
|
+
for (let index = 0; index < count; index++) {
|
|
181
|
+
const element = elements.nth(index);
|
|
182
|
+
await element.evaluate((node) => node.style.display = "none");
|
|
183
|
+
}
|
|
154
184
|
}
|
|
155
|
-
const frames = page.frames();
|
|
156
|
-
await Promise.all(frames.map((frame) => frame.waitForLoadState()));
|
|
157
185
|
}
|
|
158
186
|
async function getSlidesIndex() {
|
|
159
187
|
const clicksBySlide = {};
|
package/dist/index.mjs
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
createServer,
|
|
3
3
|
parser,
|
|
4
4
|
resolveOptions
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TKQ4IRDS.mjs";
|
|
6
6
|
import {
|
|
7
7
|
ViteSlidevPlugin
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7IY2RRV6.mjs";
|
|
9
9
|
import "./chunk-O6TYYGU6.mjs";
|
|
10
10
|
import "./chunk-CV7OWJOF.mjs";
|
|
11
11
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/cli",
|
|
3
|
-
"version": "0.48.0-beta.
|
|
3
|
+
"version": "0.48.0-beta.23",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@unocss/reset": "^0.58.5",
|
|
56
56
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
57
57
|
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
|
58
|
+
"chokidar": "^3.6.0",
|
|
58
59
|
"cli-progress": "^3.12.0",
|
|
59
60
|
"codemirror": "^5.65.16",
|
|
60
61
|
"connect": "^3.7.0",
|
|
@@ -88,16 +89,16 @@
|
|
|
88
89
|
"resolve-global": "^2.0.0",
|
|
89
90
|
"semver": "^7.6.0",
|
|
90
91
|
"shiki": "^1.1.7",
|
|
91
|
-
"shiki-magic-move": "^0.3.
|
|
92
|
+
"shiki-magic-move": "^0.3.4",
|
|
92
93
|
"sirv": "^2.0.4",
|
|
93
|
-
"typescript": "^5.
|
|
94
|
+
"typescript": "^5.4.2",
|
|
94
95
|
"unocss": "^0.58.5",
|
|
95
96
|
"unplugin-icons": "^0.18.5",
|
|
96
97
|
"unplugin-vue-components": "^0.26.0",
|
|
97
98
|
"unplugin-vue-markdown": "^0.26.0",
|
|
98
99
|
"untun": "^0.1.3",
|
|
99
100
|
"uqr": "^0.1.2",
|
|
100
|
-
"vite": "^5.1.
|
|
101
|
+
"vite": "^5.1.5",
|
|
101
102
|
"vite-plugin-inspect": "^0.8.3",
|
|
102
103
|
"vite-plugin-remote-assets": "^0.4.1",
|
|
103
104
|
"vite-plugin-static-copy": "^1.0.1",
|
|
@@ -105,9 +106,9 @@
|
|
|
105
106
|
"vitefu": "^0.2.5",
|
|
106
107
|
"vue": "^3.4.21",
|
|
107
108
|
"yargs": "^17.7.2",
|
|
108
|
-
"@slidev/
|
|
109
|
-
"@slidev/
|
|
110
|
-
"@slidev/
|
|
109
|
+
"@slidev/parser": "0.48.0-beta.23",
|
|
110
|
+
"@slidev/client": "0.48.0-beta.23",
|
|
111
|
+
"@slidev/types": "0.48.0-beta.23"
|
|
111
112
|
},
|
|
112
113
|
"devDependencies": {
|
|
113
114
|
"@hedgedoc/markdown-it-plugins": "^2.1.4",
|
package/template.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
theme: seriph
|
|
4
4
|
# random image from a curated Unsplash collection by Anthony
|
|
5
5
|
# like them? see https://unsplash.com/collections/94734566/slidev
|
|
6
|
-
background: https://
|
|
6
|
+
background: https://cover.sli.dev
|
|
7
7
|
# apply any unocss classes to the current slide
|
|
8
8
|
class: 'text-center'
|
|
9
9
|
# https://sli.dev/custom/highlighters.html
|
|
@@ -126,7 +126,7 @@ Hover on the bottom-left corner to see the navigation's controls panel, [learn m
|
|
|
126
126
|
|
|
127
127
|
---
|
|
128
128
|
layout: image-right
|
|
129
|
-
image: https://
|
|
129
|
+
image: https://cover.sli.dev
|
|
130
130
|
---
|
|
131
131
|
|
|
132
132
|
# Code
|