@slidev/cli 0.42.4 → 0.42.5
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-KVCLJMZB.mjs → build-7A4AKFCP.mjs} +1 -1
- package/dist/{build-3TQML4LL.js → build-D4QSB7HD.js} +5 -5
- package/dist/{chunk-LNT2WGUR.js → chunk-35XQHQN5.js} +319 -271
- package/dist/{chunk-X2K32WHH.js → chunk-GPOP6RE3.js} +71 -33
- package/dist/{chunk-3JYF6GOD.mjs → chunk-Q3TKTGHS.mjs} +71 -33
- package/dist/{chunk-HO4HKNKG.mjs → chunk-YZMOU6XV.mjs} +316 -268
- package/dist/cli.js +27 -27
- package/dist/cli.mjs +3 -3
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/package.json +10 -9
|
@@ -186,10 +186,10 @@ var dependencies = {
|
|
|
186
186
|
"@antfu/utils": "^0.7.4",
|
|
187
187
|
"@slidev/parser": "workspace:*",
|
|
188
188
|
"@slidev/types": "workspace:*",
|
|
189
|
-
"@unocss/reset": "^0.53.
|
|
190
|
-
"@vueuse/core": "^10.
|
|
189
|
+
"@unocss/reset": "^0.53.1",
|
|
190
|
+
"@vueuse/core": "^10.2.0",
|
|
191
191
|
"@vueuse/head": "^1.1.26",
|
|
192
|
-
"@vueuse/math": "^10.
|
|
192
|
+
"@vueuse/math": "^10.2.0",
|
|
193
193
|
"@vueuse/motion": "^2.0.0",
|
|
194
194
|
codemirror: "^5.65.5",
|
|
195
195
|
defu: "^6.1.2",
|
|
@@ -199,13 +199,13 @@ var dependencies = {
|
|
|
199
199
|
"js-base64": "^3.7.5",
|
|
200
200
|
"js-yaml": "^4.1.0",
|
|
201
201
|
katex: "^0.16.7",
|
|
202
|
-
mermaid: "^10.2.
|
|
202
|
+
mermaid: "^10.2.3",
|
|
203
203
|
"monaco-editor": "^0.37.1",
|
|
204
204
|
nanoid: "^4.0.2",
|
|
205
205
|
prettier: "^2.8.8",
|
|
206
206
|
recordrtc: "^5.6.2",
|
|
207
207
|
resolve: "^1.22.2",
|
|
208
|
-
unocss: "^0.53.
|
|
208
|
+
unocss: "^0.53.1",
|
|
209
209
|
"vite-plugin-windicss": "^1.9.0",
|
|
210
210
|
vue: "^3.3.4",
|
|
211
211
|
"vue-router": "^4.2.2",
|
|
@@ -418,7 +418,7 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
418
418
|
if (!match)
|
|
419
419
|
return next();
|
|
420
420
|
const [, no, type] = match;
|
|
421
|
-
const idx = parseInt(no);
|
|
421
|
+
const idx = Number.parseInt(no);
|
|
422
422
|
if (type === "json" && req.method === "GET") {
|
|
423
423
|
res.write(JSON.stringify(prepareSlideInfo(data.slides[idx])));
|
|
424
424
|
return res.end();
|
|
@@ -553,7 +553,7 @@ ${title}
|
|
|
553
553
|
const match = remaning.match(regexIdQuery);
|
|
554
554
|
if (match) {
|
|
555
555
|
const [, no, type] = match;
|
|
556
|
-
const pageNo = parseInt(no) - 1;
|
|
556
|
+
const pageNo = Number.parseInt(no) - 1;
|
|
557
557
|
if (type === "md") {
|
|
558
558
|
return {
|
|
559
559
|
code: (_a = data.slides[pageNo]) == null ? void 0 : _a.content,
|
|
@@ -581,7 +581,7 @@ ${title}
|
|
|
581
581
|
const [, no, type] = match;
|
|
582
582
|
if (type !== "md")
|
|
583
583
|
return;
|
|
584
|
-
const pageNo = parseInt(no) - 1;
|
|
584
|
+
const pageNo = Number.parseInt(no) - 1;
|
|
585
585
|
return transformMarkdown(code, pageNo, data);
|
|
586
586
|
}
|
|
587
587
|
},
|
|
@@ -804,36 +804,39 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
|
|
|
804
804
|
}
|
|
805
805
|
async function generateRoutes() {
|
|
806
806
|
const imports = [];
|
|
807
|
+
const redirects = [];
|
|
807
808
|
const layouts = await getLayouts();
|
|
808
809
|
imports.push(`import __layout__end from '${layouts.end}'`);
|
|
809
810
|
let no = 1;
|
|
810
|
-
const routes =
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
];
|
|
811
|
+
const routes = data.slides.map((i, idx) => {
|
|
812
|
+
var _a, _b, _c, _d;
|
|
813
|
+
if ((_a = i.frontmatter) == null ? void 0 : _a.disabled)
|
|
814
|
+
return void 0;
|
|
815
|
+
imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
|
|
816
|
+
const additions = {
|
|
817
|
+
slide: {
|
|
818
|
+
...prepareSlideInfo(i),
|
|
819
|
+
filepath: ((_b = i.source) == null ? void 0 : _b.filepath) || entry,
|
|
820
|
+
id: idx,
|
|
821
|
+
no
|
|
822
|
+
},
|
|
823
|
+
__clicksElements: [],
|
|
824
|
+
__preloaded: false
|
|
825
|
+
};
|
|
826
|
+
const meta = Object.assign({}, i.frontmatter, additions);
|
|
827
|
+
const route = `{ path: '${no}', name: 'page-${no}', component: n${no}, meta: ${JSON.stringify(meta)} }`;
|
|
828
|
+
if ((_c = i.frontmatter) == null ? void 0 : _c.routeAlias)
|
|
829
|
+
redirects.push(`{ path: '${(_d = i.frontmatter) == null ? void 0 : _d.routeAlias}', redirect: { path: '${no}' } }`);
|
|
830
|
+
no += 1;
|
|
831
|
+
return route;
|
|
832
|
+
});
|
|
833
833
|
const routesStr = `export default [
|
|
834
834
|
${routes.join(",\n")}
|
|
835
835
|
]`;
|
|
836
|
-
|
|
836
|
+
const redirectsStr = `export const redirects = [
|
|
837
|
+
${redirects.join(",\n")}
|
|
838
|
+
]`;
|
|
839
|
+
return [...imports, routesStr, redirectsStr].join("\n");
|
|
837
840
|
}
|
|
838
841
|
function generateConfigs() {
|
|
839
842
|
const config = { ...data.config, remote };
|
|
@@ -1149,6 +1152,19 @@ function math_plugin(md2, options) {
|
|
|
1149
1152
|
// node/plugins/markdown-it-prism.ts
|
|
1150
1153
|
var _prismjs = require('prismjs'); var _prismjs2 = _interopRequireDefault(_prismjs);
|
|
1151
1154
|
var _ = require('prismjs/components/'); var _2 = _interopRequireDefault(_);
|
|
1155
|
+
var _htmlparser2 = require('htmlparser2'); var htmlparser2 = _interopRequireWildcard(_htmlparser2);
|
|
1156
|
+
var Tag = class {
|
|
1157
|
+
constructor(tagname, attributes) {
|
|
1158
|
+
this.tagname = tagname;
|
|
1159
|
+
this.attributes = attributes;
|
|
1160
|
+
}
|
|
1161
|
+
asOpen() {
|
|
1162
|
+
return `<${this.tagname} ${Object.entries(this.attributes).map(([key, value]) => `${key}="${value}"`).join(" ")}>`;
|
|
1163
|
+
}
|
|
1164
|
+
asClosed() {
|
|
1165
|
+
return `</${this.tagname}>`;
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1152
1168
|
var DEFAULTS = {
|
|
1153
1169
|
plugins: [],
|
|
1154
1170
|
init: () => {
|
|
@@ -1187,10 +1203,32 @@ function selectLanguage(options, lang) {
|
|
|
1187
1203
|
}
|
|
1188
1204
|
function highlight(markdownit, options, text, lang) {
|
|
1189
1205
|
const [langToUse, prismLang] = selectLanguage(options, lang);
|
|
1190
|
-
|
|
1206
|
+
let code = text.trimEnd();
|
|
1207
|
+
code = prismLang ? highlightPrism(code, prismLang, langToUse) : markdownit.utils.escapeHtml(code);
|
|
1208
|
+
code = code.split(/\r?\n/g).map((line) => `<span class="line">${line}</span>`).join("\n");
|
|
1191
1209
|
const classAttribute = langToUse ? ` class="slidev-code ${markdownit.options.langPrefix}${markdownit.utils.escapeHtml(langToUse)}"` : "";
|
|
1192
1210
|
return escapeVueInCode(`<pre${classAttribute}><code>${code}</code></pre>`);
|
|
1193
1211
|
}
|
|
1212
|
+
function highlightPrism(code, prismLang, langToUse) {
|
|
1213
|
+
const openTags = [];
|
|
1214
|
+
const parser2 = new htmlparser2.Parser({
|
|
1215
|
+
onopentag(tagname, attributes) {
|
|
1216
|
+
openTags.push(new Tag(tagname, attributes));
|
|
1217
|
+
},
|
|
1218
|
+
onclosetag() {
|
|
1219
|
+
openTags.pop();
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
code = _prismjs2.default.highlight(code, prismLang, langToUse);
|
|
1223
|
+
code = code.split(/\r?\n/g).map((line) => {
|
|
1224
|
+
const prefix = openTags.map((tag) => tag.asOpen()).join("");
|
|
1225
|
+
parser2.write(line);
|
|
1226
|
+
const postfix = openTags.reverse().map((tag) => tag.asClosed()).join("");
|
|
1227
|
+
return prefix + line + postfix;
|
|
1228
|
+
}).join("\n");
|
|
1229
|
+
parser2.end();
|
|
1230
|
+
return code;
|
|
1231
|
+
}
|
|
1194
1232
|
function checkLanguageOption(options, optionName) {
|
|
1195
1233
|
const language = options[optionName];
|
|
1196
1234
|
if (language !== void 0 && loadPrismLang(language) === void 0)
|
|
@@ -186,10 +186,10 @@ var dependencies = {
|
|
|
186
186
|
"@antfu/utils": "^0.7.4",
|
|
187
187
|
"@slidev/parser": "workspace:*",
|
|
188
188
|
"@slidev/types": "workspace:*",
|
|
189
|
-
"@unocss/reset": "^0.53.
|
|
190
|
-
"@vueuse/core": "^10.
|
|
189
|
+
"@unocss/reset": "^0.53.1",
|
|
190
|
+
"@vueuse/core": "^10.2.0",
|
|
191
191
|
"@vueuse/head": "^1.1.26",
|
|
192
|
-
"@vueuse/math": "^10.
|
|
192
|
+
"@vueuse/math": "^10.2.0",
|
|
193
193
|
"@vueuse/motion": "^2.0.0",
|
|
194
194
|
codemirror: "^5.65.5",
|
|
195
195
|
defu: "^6.1.2",
|
|
@@ -199,13 +199,13 @@ var dependencies = {
|
|
|
199
199
|
"js-base64": "^3.7.5",
|
|
200
200
|
"js-yaml": "^4.1.0",
|
|
201
201
|
katex: "^0.16.7",
|
|
202
|
-
mermaid: "^10.2.
|
|
202
|
+
mermaid: "^10.2.3",
|
|
203
203
|
"monaco-editor": "^0.37.1",
|
|
204
204
|
nanoid: "^4.0.2",
|
|
205
205
|
prettier: "^2.8.8",
|
|
206
206
|
recordrtc: "^5.6.2",
|
|
207
207
|
resolve: "^1.22.2",
|
|
208
|
-
unocss: "^0.53.
|
|
208
|
+
unocss: "^0.53.1",
|
|
209
209
|
"vite-plugin-windicss": "^1.9.0",
|
|
210
210
|
vue: "^3.3.4",
|
|
211
211
|
"vue-router": "^4.2.2",
|
|
@@ -418,7 +418,7 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
|
|
|
418
418
|
if (!match)
|
|
419
419
|
return next();
|
|
420
420
|
const [, no, type] = match;
|
|
421
|
-
const idx = parseInt(no);
|
|
421
|
+
const idx = Number.parseInt(no);
|
|
422
422
|
if (type === "json" && req.method === "GET") {
|
|
423
423
|
res.write(JSON.stringify(prepareSlideInfo(data.slides[idx])));
|
|
424
424
|
return res.end();
|
|
@@ -553,7 +553,7 @@ ${title}
|
|
|
553
553
|
const match = remaning.match(regexIdQuery);
|
|
554
554
|
if (match) {
|
|
555
555
|
const [, no, type] = match;
|
|
556
|
-
const pageNo = parseInt(no) - 1;
|
|
556
|
+
const pageNo = Number.parseInt(no) - 1;
|
|
557
557
|
if (type === "md") {
|
|
558
558
|
return {
|
|
559
559
|
code: (_a = data.slides[pageNo]) == null ? void 0 : _a.content,
|
|
@@ -581,7 +581,7 @@ ${title}
|
|
|
581
581
|
const [, no, type] = match;
|
|
582
582
|
if (type !== "md")
|
|
583
583
|
return;
|
|
584
|
-
const pageNo = parseInt(no) - 1;
|
|
584
|
+
const pageNo = Number.parseInt(no) - 1;
|
|
585
585
|
return transformMarkdown(code, pageNo, data);
|
|
586
586
|
}
|
|
587
587
|
},
|
|
@@ -804,36 +804,39 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
|
|
|
804
804
|
}
|
|
805
805
|
async function generateRoutes() {
|
|
806
806
|
const imports = [];
|
|
807
|
+
const redirects = [];
|
|
807
808
|
const layouts = await getLayouts();
|
|
808
809
|
imports.push(`import __layout__end from '${layouts.end}'`);
|
|
809
810
|
let no = 1;
|
|
810
|
-
const routes =
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
];
|
|
811
|
+
const routes = data.slides.map((i, idx) => {
|
|
812
|
+
var _a, _b, _c, _d;
|
|
813
|
+
if ((_a = i.frontmatter) == null ? void 0 : _a.disabled)
|
|
814
|
+
return void 0;
|
|
815
|
+
imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
|
|
816
|
+
const additions = {
|
|
817
|
+
slide: {
|
|
818
|
+
...prepareSlideInfo(i),
|
|
819
|
+
filepath: ((_b = i.source) == null ? void 0 : _b.filepath) || entry,
|
|
820
|
+
id: idx,
|
|
821
|
+
no
|
|
822
|
+
},
|
|
823
|
+
__clicksElements: [],
|
|
824
|
+
__preloaded: false
|
|
825
|
+
};
|
|
826
|
+
const meta = Object.assign({}, i.frontmatter, additions);
|
|
827
|
+
const route = `{ path: '${no}', name: 'page-${no}', component: n${no}, meta: ${JSON.stringify(meta)} }`;
|
|
828
|
+
if ((_c = i.frontmatter) == null ? void 0 : _c.routeAlias)
|
|
829
|
+
redirects.push(`{ path: '${(_d = i.frontmatter) == null ? void 0 : _d.routeAlias}', redirect: { path: '${no}' } }`);
|
|
830
|
+
no += 1;
|
|
831
|
+
return route;
|
|
832
|
+
});
|
|
833
833
|
const routesStr = `export default [
|
|
834
834
|
${routes.join(",\n")}
|
|
835
835
|
]`;
|
|
836
|
-
|
|
836
|
+
const redirectsStr = `export const redirects = [
|
|
837
|
+
${redirects.join(",\n")}
|
|
838
|
+
]`;
|
|
839
|
+
return [...imports, routesStr, redirectsStr].join("\n");
|
|
837
840
|
}
|
|
838
841
|
function generateConfigs() {
|
|
839
842
|
const config = { ...data.config, remote };
|
|
@@ -1149,6 +1152,19 @@ function math_plugin(md2, options) {
|
|
|
1149
1152
|
// node/plugins/markdown-it-prism.ts
|
|
1150
1153
|
import Prism from "prismjs";
|
|
1151
1154
|
import loadLanguages from "prismjs/components/";
|
|
1155
|
+
import * as htmlparser2 from "htmlparser2";
|
|
1156
|
+
var Tag = class {
|
|
1157
|
+
constructor(tagname, attributes) {
|
|
1158
|
+
this.tagname = tagname;
|
|
1159
|
+
this.attributes = attributes;
|
|
1160
|
+
}
|
|
1161
|
+
asOpen() {
|
|
1162
|
+
return `<${this.tagname} ${Object.entries(this.attributes).map(([key, value]) => `${key}="${value}"`).join(" ")}>`;
|
|
1163
|
+
}
|
|
1164
|
+
asClosed() {
|
|
1165
|
+
return `</${this.tagname}>`;
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1152
1168
|
var DEFAULTS = {
|
|
1153
1169
|
plugins: [],
|
|
1154
1170
|
init: () => {
|
|
@@ -1187,10 +1203,32 @@ function selectLanguage(options, lang) {
|
|
|
1187
1203
|
}
|
|
1188
1204
|
function highlight(markdownit, options, text, lang) {
|
|
1189
1205
|
const [langToUse, prismLang] = selectLanguage(options, lang);
|
|
1190
|
-
|
|
1206
|
+
let code = text.trimEnd();
|
|
1207
|
+
code = prismLang ? highlightPrism(code, prismLang, langToUse) : markdownit.utils.escapeHtml(code);
|
|
1208
|
+
code = code.split(/\r?\n/g).map((line) => `<span class="line">${line}</span>`).join("\n");
|
|
1191
1209
|
const classAttribute = langToUse ? ` class="slidev-code ${markdownit.options.langPrefix}${markdownit.utils.escapeHtml(langToUse)}"` : "";
|
|
1192
1210
|
return escapeVueInCode(`<pre${classAttribute}><code>${code}</code></pre>`);
|
|
1193
1211
|
}
|
|
1212
|
+
function highlightPrism(code, prismLang, langToUse) {
|
|
1213
|
+
const openTags = [];
|
|
1214
|
+
const parser2 = new htmlparser2.Parser({
|
|
1215
|
+
onopentag(tagname, attributes) {
|
|
1216
|
+
openTags.push(new Tag(tagname, attributes));
|
|
1217
|
+
},
|
|
1218
|
+
onclosetag() {
|
|
1219
|
+
openTags.pop();
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
code = Prism.highlight(code, prismLang, langToUse);
|
|
1223
|
+
code = code.split(/\r?\n/g).map((line) => {
|
|
1224
|
+
const prefix = openTags.map((tag) => tag.asOpen()).join("");
|
|
1225
|
+
parser2.write(line);
|
|
1226
|
+
const postfix = openTags.reverse().map((tag) => tag.asClosed()).join("");
|
|
1227
|
+
return prefix + line + postfix;
|
|
1228
|
+
}).join("\n");
|
|
1229
|
+
parser2.end();
|
|
1230
|
+
return code;
|
|
1231
|
+
}
|
|
1194
1232
|
function checkLanguageOption(options, optionName) {
|
|
1195
1233
|
const language = options[optionName];
|
|
1196
1234
|
if (language !== void 0 && loadPrismLang(language) === void 0)
|