@slidev/cli 0.48.0-beta.4 → 0.48.0-beta.6
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.
|
@@ -2496,7 +2496,7 @@ var require_semver2 = __commonJS({
|
|
|
2496
2496
|
});
|
|
2497
2497
|
|
|
2498
2498
|
// package.json
|
|
2499
|
-
var version = "0.48.0-beta.
|
|
2499
|
+
var version = "0.48.0-beta.6";
|
|
2500
2500
|
|
|
2501
2501
|
// node/common.ts
|
|
2502
2502
|
import { existsSync, promises as fs } from "node:fs";
|
|
@@ -2728,23 +2728,13 @@ import * as parser from "@slidev/parser/fs";
|
|
|
2728
2728
|
import equal from "fast-deep-equal";
|
|
2729
2729
|
var regexId = /^\/\@slidev\/slide\/(\d+)\.(md|json)(?:\?import)?$/;
|
|
2730
2730
|
var regexIdQuery = /(\d+?)\.(md|json|frontmatter)$/;
|
|
2731
|
-
var
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
injectionFrontmatter as _injectionFrontmatter,
|
|
2739
|
-
filterFrontmatter as _filterFrontmatter,
|
|
2740
|
-
} from "@slidev/client/constants.ts"`.replace(/\n\s+/g, "\n"),
|
|
2741
|
-
"const $slidev = _vueInject(_injectionSlidevContext)",
|
|
2742
|
-
'const $nav = _vueToRef($slidev, "nav")',
|
|
2743
|
-
"const $clicksContext = _vueInject(_injectionClicksContext)?.value",
|
|
2744
|
-
'const $clicks = _vueToRef($clicksContext, "current")',
|
|
2745
|
-
"const $page = _vueInject(_injectionCurrentPage)",
|
|
2746
|
-
"const $renderContext = _vueInject(_injectionRenderContext)"
|
|
2747
|
-
];
|
|
2731
|
+
var templateInjectionMarker = "/* @slidev-injection */";
|
|
2732
|
+
var templateImportContextUtils = `import {
|
|
2733
|
+
useSlideContext,
|
|
2734
|
+
provideFrontmatter as _provideFrontmatter,
|
|
2735
|
+
frontmatterToProps as _frontmatterToProps,
|
|
2736
|
+
} from "@slidev/client/context.ts"`.replace(/\n\s*/g, " ");
|
|
2737
|
+
var templateInitContext = `const { $slidev, $nav, $clicksContext, $clicks, $page, $renderContext, $frontmatter } = useSlideContext()`;
|
|
2748
2738
|
function getBodyJson(req) {
|
|
2749
2739
|
return new Promise((resolve3, reject) => {
|
|
2750
2740
|
let body = "";
|
|
@@ -2797,8 +2787,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOpt
|
|
|
2797
2787
|
if (type === "json" && req.method === "POST") {
|
|
2798
2788
|
const body = await getBodyJson(req);
|
|
2799
2789
|
const slide = data.slides[idx];
|
|
2800
|
-
|
|
2801
|
-
if (!onlyNoteChanged)
|
|
2790
|
+
if (body.content && body.content !== slide.source.content)
|
|
2802
2791
|
hmrPages.add(idx);
|
|
2803
2792
|
Object.assign(slide.source, body);
|
|
2804
2793
|
parser.prettifySlide(slide.source);
|
|
@@ -3087,21 +3076,12 @@ Unknown layout "${bold(layoutName)}".${yellow(" Available layouts are:")}`) + Ob
|
|
|
3087
3076
|
}
|
|
3088
3077
|
delete frontmatter.title;
|
|
3089
3078
|
const imports = [
|
|
3090
|
-
...vueContextImports,
|
|
3091
3079
|
`import InjectedLayout from "${toAtFS(layouts[layoutName])}"`,
|
|
3092
3080
|
`import frontmatter from "${toAtFS(`${slidePrefix + (pageNo + 1)}.frontmatter`)}"`,
|
|
3093
|
-
|
|
3094
|
-
"
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
" const route = $slidev.nav.rawRoutes.find(i => i.path === String($page.value))",
|
|
3098
|
-
" if (route?.meta?.slide?.frontmatter) {",
|
|
3099
|
-
" Object.keys(route.meta.slide.frontmatter).forEach(key => {",
|
|
3100
|
-
" if (!(key in $frontmatter)) delete route.meta.slide.frontmatter[key]",
|
|
3101
|
-
" })",
|
|
3102
|
-
" Object.assign(route.meta.slide.frontmatter, frontmatter)",
|
|
3103
|
-
" }",
|
|
3104
|
-
"})();"
|
|
3081
|
+
templateImportContextUtils,
|
|
3082
|
+
"_provideFrontmatter(frontmatter)",
|
|
3083
|
+
templateInitContext,
|
|
3084
|
+
templateInjectionMarker
|
|
3105
3085
|
];
|
|
3106
3086
|
code = code.replace(/(<script setup.*>)/g, `$1
|
|
3107
3087
|
${imports.join("\n")}
|
|
@@ -3112,18 +3092,19 @@ ${imports.join("\n")}
|
|
|
3112
3092
|
if (body.startsWith("<div>") && body.endsWith("</div>"))
|
|
3113
3093
|
body = body.slice(5, -6);
|
|
3114
3094
|
code = `${code.slice(0, injectA)}
|
|
3115
|
-
<InjectedLayout v-bind="
|
|
3095
|
+
<InjectedLayout v-bind="_frontmatterToProps(frontmatter,${pageNo})">
|
|
3116
3096
|
${body}
|
|
3117
3097
|
</InjectedLayout>
|
|
3118
3098
|
${code.slice(injectB)}`;
|
|
3119
3099
|
return code;
|
|
3120
3100
|
}
|
|
3121
3101
|
function transformVue(code) {
|
|
3122
|
-
if (code.includes(
|
|
3102
|
+
if (code.includes(templateInjectionMarker) || code.includes("useSlideContext()"))
|
|
3123
3103
|
return code;
|
|
3124
3104
|
const imports = [
|
|
3125
|
-
|
|
3126
|
-
|
|
3105
|
+
templateImportContextUtils,
|
|
3106
|
+
templateInitContext,
|
|
3107
|
+
templateInjectionMarker
|
|
3127
3108
|
];
|
|
3128
3109
|
const matchScript = code.match(/<script((?!setup).)*(setup)?.*>/);
|
|
3129
3110
|
if (matchScript && matchScript[2]) {
|
|
@@ -4262,7 +4243,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
|
4262
4243
|
"components",
|
|
4263
4244
|
join7(process3.cwd(), "components")
|
|
4264
4245
|
],
|
|
4265
|
-
include: [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/, /\.md
|
|
4246
|
+
include: [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/, /\.md$/, /\.md\?vue/],
|
|
4266
4247
|
exclude: [],
|
|
4267
4248
|
resolvers: [
|
|
4268
4249
|
IconsResolver({
|
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-WV65JLWC.mjs";
|
|
9
9
|
import {
|
|
10
10
|
version
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MZGZ35RT.mjs";
|
|
12
12
|
import {
|
|
13
13
|
loadSetups
|
|
14
14
|
} from "./chunk-O6TYYGU6.mjs";
|
|
@@ -271,7 +271,7 @@ cli.command(
|
|
|
271
271
|
}).strict().help(),
|
|
272
272
|
async (args) => {
|
|
273
273
|
const { entry, theme, watch, base, download, out, inspect } = args;
|
|
274
|
-
const { build } = await import("./build-
|
|
274
|
+
const { build } = await import("./build-JXQZ3YBD.mjs");
|
|
275
275
|
for (const entryFile of entry) {
|
|
276
276
|
const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
|
|
277
277
|
if (download && !options.data.config.download)
|
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-WV65JLWC.mjs";
|
|
6
6
|
import {
|
|
7
7
|
ViteSlidevPlugin
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MZGZ35RT.mjs";
|
|
9
9
|
import "./chunk-O6TYYGU6.mjs";
|
|
10
10
|
import "./chunk-7HOZGSL4.mjs";
|
|
11
11
|
import "./chunk-BXO7ZPPU.mjs";
|
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.6",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -104,9 +104,9 @@
|
|
|
104
104
|
"vitefu": "^0.2.5",
|
|
105
105
|
"vue": "^3.4.19",
|
|
106
106
|
"yargs": "^17.7.2",
|
|
107
|
-
"@slidev/
|
|
108
|
-
"@slidev/
|
|
109
|
-
"@slidev/types": "0.48.0-beta.
|
|
107
|
+
"@slidev/parser": "0.48.0-beta.6",
|
|
108
|
+
"@slidev/client": "0.48.0-beta.6",
|
|
109
|
+
"@slidev/types": "0.48.0-beta.6"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@hedgedoc/markdown-it-plugins": "^2.1.4",
|