slidev-workspace 0.6.2 → 0.7.0
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/cli.js +31 -1
- package/dist/plugin-slides.js +31 -1
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -11,11 +11,12 @@ import { cpSync, existsSync as existsSync$1, readFileSync, readdirSync as readdi
|
|
|
11
11
|
import { basename, join as join$1, resolve as resolve$1 } from "path";
|
|
12
12
|
import { parse } from "yaml";
|
|
13
13
|
import { spawn } from "child_process";
|
|
14
|
+
import { createHead, transformHtmlTemplate } from "unhead/server";
|
|
14
15
|
|
|
15
16
|
//#region src/scripts/config.ts
|
|
16
17
|
const DEFAULT_CONFIG = {
|
|
17
18
|
slidesDir: ["./slides"],
|
|
18
|
-
outputDir: "./
|
|
19
|
+
outputDir: "./dist",
|
|
19
20
|
baseUrl: "/",
|
|
20
21
|
exclude: ["node_modules", ".git"],
|
|
21
22
|
hero: {
|
|
@@ -213,12 +214,41 @@ function stopAllDevServers(devServers) {
|
|
|
213
214
|
runningServers.clear();
|
|
214
215
|
}
|
|
215
216
|
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/vite/transformIndexHtml.ts
|
|
219
|
+
/**
|
|
220
|
+
* Transform the index.html file to inject the hero metadata
|
|
221
|
+
*/
|
|
222
|
+
async function transformIndexHtml(html) {
|
|
223
|
+
try {
|
|
224
|
+
const config = loadConfig();
|
|
225
|
+
const head = createHead({ disableDefaults: true });
|
|
226
|
+
head.push({
|
|
227
|
+
title: config.hero.title,
|
|
228
|
+
meta: [{
|
|
229
|
+
property: "og:title",
|
|
230
|
+
content: config.hero.title
|
|
231
|
+
}, {
|
|
232
|
+
property: "og:description",
|
|
233
|
+
content: config.hero.description
|
|
234
|
+
}]
|
|
235
|
+
});
|
|
236
|
+
return await transformHtmlTemplate(head, html);
|
|
237
|
+
} catch (error) {
|
|
238
|
+
console.warn("Failed to inject hero metadata:", error);
|
|
239
|
+
return html;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
216
243
|
//#endregion
|
|
217
244
|
//#region src/vite/plugin-slides.ts
|
|
218
245
|
function slidesPlugin() {
|
|
219
246
|
let devServers = [];
|
|
220
247
|
return {
|
|
221
248
|
name: "vite-plugin-slides",
|
|
249
|
+
async transformIndexHtml(html) {
|
|
250
|
+
return await transformIndexHtml(html);
|
|
251
|
+
},
|
|
222
252
|
async closeBundle() {
|
|
223
253
|
try {
|
|
224
254
|
const config = loadConfig();
|
package/dist/plugin-slides.js
CHANGED
|
@@ -2,11 +2,12 @@ import { cpSync, existsSync, readFileSync, readdirSync, watch } from "fs";
|
|
|
2
2
|
import { basename, join, resolve } from "path";
|
|
3
3
|
import { parse } from "yaml";
|
|
4
4
|
import { spawn } from "child_process";
|
|
5
|
+
import { createHead, transformHtmlTemplate } from "unhead/server";
|
|
5
6
|
|
|
6
7
|
//#region src/scripts/config.ts
|
|
7
8
|
const DEFAULT_CONFIG = {
|
|
8
9
|
slidesDir: ["./slides"],
|
|
9
|
-
outputDir: "./
|
|
10
|
+
outputDir: "./dist",
|
|
10
11
|
baseUrl: "/",
|
|
11
12
|
exclude: ["node_modules", ".git"],
|
|
12
13
|
hero: {
|
|
@@ -204,12 +205,41 @@ function stopAllDevServers(devServers) {
|
|
|
204
205
|
runningServers.clear();
|
|
205
206
|
}
|
|
206
207
|
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/vite/transformIndexHtml.ts
|
|
210
|
+
/**
|
|
211
|
+
* Transform the index.html file to inject the hero metadata
|
|
212
|
+
*/
|
|
213
|
+
async function transformIndexHtml(html) {
|
|
214
|
+
try {
|
|
215
|
+
const config = loadConfig();
|
|
216
|
+
const head = createHead({ disableDefaults: true });
|
|
217
|
+
head.push({
|
|
218
|
+
title: config.hero.title,
|
|
219
|
+
meta: [{
|
|
220
|
+
property: "og:title",
|
|
221
|
+
content: config.hero.title
|
|
222
|
+
}, {
|
|
223
|
+
property: "og:description",
|
|
224
|
+
content: config.hero.description
|
|
225
|
+
}]
|
|
226
|
+
});
|
|
227
|
+
return await transformHtmlTemplate(head, html);
|
|
228
|
+
} catch (error) {
|
|
229
|
+
console.warn("Failed to inject hero metadata:", error);
|
|
230
|
+
return html;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
207
234
|
//#endregion
|
|
208
235
|
//#region src/vite/plugin-slides.ts
|
|
209
236
|
function slidesPlugin() {
|
|
210
237
|
let devServers = [];
|
|
211
238
|
return {
|
|
212
239
|
name: "vite-plugin-slides",
|
|
240
|
+
async transformIndexHtml(html) {
|
|
241
|
+
return await transformIndexHtml(html);
|
|
242
|
+
},
|
|
213
243
|
async closeBundle() {
|
|
214
244
|
try {
|
|
215
245
|
const config = loadConfig();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slidev-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "A workspace tool for managing multiple Slidev presentations with API-based content management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"lucide-vue-next": "^0.525.0",
|
|
44
44
|
"tailwind-merge": "^3.3.1",
|
|
45
45
|
"tw-animate-css": "^1.3.5",
|
|
46
|
+
"unhead": "^2.0.19",
|
|
46
47
|
"vite": "npm:rolldown-vite@latest",
|
|
47
48
|
"vue": "^3.5.17",
|
|
48
49
|
"yaml": "^2.8.0"
|