@slidev/cli 0.48.0-beta.4 → 0.48.0-beta.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.
|
@@ -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.5";
|
|
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 = "";
|
|
@@ -3087,21 +3077,12 @@ Unknown layout "${bold(layoutName)}".${yellow(" Available layouts are:")}`) + Ob
|
|
|
3087
3077
|
}
|
|
3088
3078
|
delete frontmatter.title;
|
|
3089
3079
|
const imports = [
|
|
3090
|
-
...vueContextImports,
|
|
3091
3080
|
`import InjectedLayout from "${toAtFS(layouts[layoutName])}"`,
|
|
3092
3081
|
`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
|
-
"})();"
|
|
3082
|
+
templateImportContextUtils,
|
|
3083
|
+
"_provideFrontmatter(frontmatter)",
|
|
3084
|
+
templateInitContext,
|
|
3085
|
+
templateInjectionMarker
|
|
3105
3086
|
];
|
|
3106
3087
|
code = code.replace(/(<script setup.*>)/g, `$1
|
|
3107
3088
|
${imports.join("\n")}
|
|
@@ -3112,18 +3093,19 @@ ${imports.join("\n")}
|
|
|
3112
3093
|
if (body.startsWith("<div>") && body.endsWith("</div>"))
|
|
3113
3094
|
body = body.slice(5, -6);
|
|
3114
3095
|
code = `${code.slice(0, injectA)}
|
|
3115
|
-
<InjectedLayout v-bind="
|
|
3096
|
+
<InjectedLayout v-bind="_frontmatterToProps(frontmatter,${pageNo})">
|
|
3116
3097
|
${body}
|
|
3117
3098
|
</InjectedLayout>
|
|
3118
3099
|
${code.slice(injectB)}`;
|
|
3119
3100
|
return code;
|
|
3120
3101
|
}
|
|
3121
3102
|
function transformVue(code) {
|
|
3122
|
-
if (code.includes(
|
|
3103
|
+
if (code.includes(templateInjectionMarker) || code.includes("useSlideContext()"))
|
|
3123
3104
|
return code;
|
|
3124
3105
|
const imports = [
|
|
3125
|
-
|
|
3126
|
-
|
|
3106
|
+
templateImportContextUtils,
|
|
3107
|
+
templateInitContext,
|
|
3108
|
+
templateInjectionMarker
|
|
3127
3109
|
];
|
|
3128
3110
|
const matchScript = code.match(/<script((?!setup).)*(setup)?.*>/);
|
|
3129
3111
|
if (matchScript && matchScript[2]) {
|
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-CV7O37IO.mjs";
|
|
9
9
|
import {
|
|
10
10
|
version
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-U44GKKNH.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-C6G7F24X.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-CV7O37IO.mjs";
|
|
6
6
|
import {
|
|
7
7
|
ViteSlidevPlugin
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-U44GKKNH.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.5",
|
|
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/client": "0.48.0-beta.
|
|
108
|
-
"@slidev/parser": "0.48.0-beta.
|
|
109
|
-
"@slidev/types": "0.48.0-beta.
|
|
107
|
+
"@slidev/client": "0.48.0-beta.5",
|
|
108
|
+
"@slidev/parser": "0.48.0-beta.5",
|
|
109
|
+
"@slidev/types": "0.48.0-beta.5"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@hedgedoc/markdown-it-plugins": "^2.1.4",
|