@slidev/parser 0.33.0 → 0.34.1
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/{chunk-3H7RL27G.mjs → chunk-4YHYLMJ3.mjs} +35 -31
- package/dist/{chunk-ZWMIEBCO.js → chunk-NWLQAI2Y.js} +36 -32
- package/dist/core.d.ts +3 -2
- package/dist/core.js +4 -2
- package/dist/core.mjs +5 -3
- package/dist/fs.d.ts +1 -1
- package/dist/fs.js +19 -16
- package/dist/fs.mjs +16 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -2
- package/dist/index.mjs +5 -3
- package/package.json +2 -2
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
1
|
var __accessCheck = (obj, member, msg) => {
|
|
21
2
|
if (!member.has(obj))
|
|
22
3
|
throw TypeError("Cannot " + msg);
|
|
@@ -173,7 +154,7 @@ function parseAspectRatio(str) {
|
|
|
173
154
|
}
|
|
174
155
|
|
|
175
156
|
// src/config.ts
|
|
176
|
-
function resolveConfig(headmatter, themeMeta = {}) {
|
|
157
|
+
function resolveConfig(headmatter, themeMeta = {}, verify = false) {
|
|
177
158
|
var _a, _b;
|
|
178
159
|
const themeHightlighter = ["prism", "shiki"].includes(themeMeta.highlighter || "") ? themeMeta.highlighter : void 0;
|
|
179
160
|
const themeColorSchema = ["light", "dark"].includes(themeMeta.colorSchema || "") ? themeMeta.colorSchema : void 0;
|
|
@@ -199,22 +180,45 @@ function resolveConfig(headmatter, themeMeta = {}) {
|
|
|
199
180
|
favicon: "https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png",
|
|
200
181
|
drawings: {},
|
|
201
182
|
plantUmlServer: "https://www.plantuml.com/plantuml",
|
|
202
|
-
record: "dev"
|
|
183
|
+
record: "dev",
|
|
184
|
+
css: "windicss"
|
|
203
185
|
};
|
|
204
|
-
const config =
|
|
205
|
-
|
|
186
|
+
const config = {
|
|
187
|
+
...defaultConfig,
|
|
188
|
+
...themeMeta.defaults,
|
|
189
|
+
...headmatter.config,
|
|
190
|
+
...headmatter,
|
|
191
|
+
fonts: resolveFonts({
|
|
192
|
+
...(_a = themeMeta.defaults) == null ? void 0 : _a.fonts,
|
|
193
|
+
...(_b = headmatter.config) == null ? void 0 : _b.fonts,
|
|
194
|
+
...headmatter == null ? void 0 : headmatter.fonts
|
|
195
|
+
}),
|
|
206
196
|
drawings: resolveDrawings(headmatter.drawings)
|
|
207
|
-
}
|
|
197
|
+
};
|
|
208
198
|
if (config.colorSchema !== "dark" && config.colorSchema !== "light")
|
|
209
199
|
config.colorSchema = "auto";
|
|
210
200
|
if (themeColorSchema && config.colorSchema === "auto")
|
|
211
201
|
config.colorSchema = themeColorSchema;
|
|
212
202
|
config.aspectRatio = parseAspectRatio(config.aspectRatio);
|
|
203
|
+
if (verify)
|
|
204
|
+
verifyConfig(config, themeMeta);
|
|
205
|
+
return config;
|
|
206
|
+
}
|
|
207
|
+
function verifyConfig(config, themeMeta = {}, warn = (v) => console.warn(`[slidev] ${v}`)) {
|
|
208
|
+
const themeHightlighter = ["prism", "shiki"].includes(themeMeta.highlighter || "") ? themeMeta.highlighter : void 0;
|
|
209
|
+
const themeColorSchema = ["light", "dark"].includes(themeMeta.colorSchema || "") ? themeMeta.colorSchema : void 0;
|
|
213
210
|
if (themeColorSchema && config.colorSchema !== themeColorSchema)
|
|
214
|
-
|
|
211
|
+
warn(`Color schema "${config.colorSchema}" does not supported by the theme`);
|
|
215
212
|
if (themeHightlighter && config.highlighter !== themeHightlighter)
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
warn(`Syntax highlighter "${config.highlighter}" does not supported by the theme`);
|
|
214
|
+
if (!["windicss", "unocss", void 0].includes(config.css)) {
|
|
215
|
+
warn(`Unsupported Atomic CSS engine "${config.css}", fallback to Windi CSS`);
|
|
216
|
+
config.css = "windicss";
|
|
217
|
+
}
|
|
218
|
+
if (config.css === "unocss") {
|
|
219
|
+
warn("UnoCSS support is experimental, the styling might break without following semver.");
|
|
220
|
+
warn("We suggest pinning the version of Slidev when using experimental features.");
|
|
221
|
+
}
|
|
218
222
|
}
|
|
219
223
|
function resolveFonts(fonts = {}) {
|
|
220
224
|
const {
|
|
@@ -402,11 +406,12 @@ function parse(markdown, filepath, themeMeta) {
|
|
|
402
406
|
if (start === end)
|
|
403
407
|
return;
|
|
404
408
|
const raw = lines.slice(start, end).join("\n");
|
|
405
|
-
slides.push(
|
|
409
|
+
slides.push({
|
|
410
|
+
...parseSlide(raw),
|
|
406
411
|
index: slides.length,
|
|
407
412
|
start,
|
|
408
413
|
end
|
|
409
|
-
})
|
|
414
|
+
});
|
|
410
415
|
start = end + 1;
|
|
411
416
|
}
|
|
412
417
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -461,11 +466,10 @@ function scanMonacoModules(md) {
|
|
|
461
466
|
}
|
|
462
467
|
|
|
463
468
|
export {
|
|
464
|
-
__spreadValues,
|
|
465
|
-
__spreadProps,
|
|
466
469
|
parseRangeString,
|
|
467
470
|
parseAspectRatio,
|
|
468
471
|
resolveConfig,
|
|
472
|
+
verifyConfig,
|
|
469
473
|
resolveFonts,
|
|
470
474
|
stringify,
|
|
471
475
|
filterDisabled,
|
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __accessCheck = (obj, member, msg) => {
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __accessCheck = (obj, member, msg) => {
|
|
21
2
|
if (!member.has(obj))
|
|
22
3
|
throw TypeError("Cannot " + msg);
|
|
23
4
|
};
|
|
@@ -173,7 +154,7 @@ function parseAspectRatio(str) {
|
|
|
173
154
|
}
|
|
174
155
|
|
|
175
156
|
// src/config.ts
|
|
176
|
-
function resolveConfig(headmatter, themeMeta = {}) {
|
|
157
|
+
function resolveConfig(headmatter, themeMeta = {}, verify = false) {
|
|
177
158
|
var _a, _b;
|
|
178
159
|
const themeHightlighter = ["prism", "shiki"].includes(themeMeta.highlighter || "") ? themeMeta.highlighter : void 0;
|
|
179
160
|
const themeColorSchema = ["light", "dark"].includes(themeMeta.colorSchema || "") ? themeMeta.colorSchema : void 0;
|
|
@@ -199,22 +180,45 @@ function resolveConfig(headmatter, themeMeta = {}) {
|
|
|
199
180
|
favicon: "https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png",
|
|
200
181
|
drawings: {},
|
|
201
182
|
plantUmlServer: "https://www.plantuml.com/plantuml",
|
|
202
|
-
record: "dev"
|
|
183
|
+
record: "dev",
|
|
184
|
+
css: "windicss"
|
|
203
185
|
};
|
|
204
|
-
const config =
|
|
205
|
-
|
|
186
|
+
const config = {
|
|
187
|
+
...defaultConfig,
|
|
188
|
+
...themeMeta.defaults,
|
|
189
|
+
...headmatter.config,
|
|
190
|
+
...headmatter,
|
|
191
|
+
fonts: resolveFonts({
|
|
192
|
+
...(_a = themeMeta.defaults) == null ? void 0 : _a.fonts,
|
|
193
|
+
...(_b = headmatter.config) == null ? void 0 : _b.fonts,
|
|
194
|
+
...headmatter == null ? void 0 : headmatter.fonts
|
|
195
|
+
}),
|
|
206
196
|
drawings: resolveDrawings(headmatter.drawings)
|
|
207
|
-
}
|
|
197
|
+
};
|
|
208
198
|
if (config.colorSchema !== "dark" && config.colorSchema !== "light")
|
|
209
199
|
config.colorSchema = "auto";
|
|
210
200
|
if (themeColorSchema && config.colorSchema === "auto")
|
|
211
201
|
config.colorSchema = themeColorSchema;
|
|
212
202
|
config.aspectRatio = parseAspectRatio(config.aspectRatio);
|
|
203
|
+
if (verify)
|
|
204
|
+
verifyConfig(config, themeMeta);
|
|
205
|
+
return config;
|
|
206
|
+
}
|
|
207
|
+
function verifyConfig(config, themeMeta = {}, warn = (v) => console.warn(`[slidev] ${v}`)) {
|
|
208
|
+
const themeHightlighter = ["prism", "shiki"].includes(themeMeta.highlighter || "") ? themeMeta.highlighter : void 0;
|
|
209
|
+
const themeColorSchema = ["light", "dark"].includes(themeMeta.colorSchema || "") ? themeMeta.colorSchema : void 0;
|
|
213
210
|
if (themeColorSchema && config.colorSchema !== themeColorSchema)
|
|
214
|
-
|
|
211
|
+
warn(`Color schema "${config.colorSchema}" does not supported by the theme`);
|
|
215
212
|
if (themeHightlighter && config.highlighter !== themeHightlighter)
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
warn(`Syntax highlighter "${config.highlighter}" does not supported by the theme`);
|
|
214
|
+
if (!["windicss", "unocss", void 0].includes(config.css)) {
|
|
215
|
+
warn(`Unsupported Atomic CSS engine "${config.css}", fallback to Windi CSS`);
|
|
216
|
+
config.css = "windicss";
|
|
217
|
+
}
|
|
218
|
+
if (config.css === "unocss") {
|
|
219
|
+
warn("UnoCSS support is experimental, the styling might break without following semver.");
|
|
220
|
+
warn("We suggest pinning the version of Slidev when using experimental features.");
|
|
221
|
+
}
|
|
218
222
|
}
|
|
219
223
|
function resolveFonts(fonts = {}) {
|
|
220
224
|
const {
|
|
@@ -402,11 +406,12 @@ function parse(markdown, filepath, themeMeta) {
|
|
|
402
406
|
if (start === end)
|
|
403
407
|
return;
|
|
404
408
|
const raw = lines.slice(start, end).join("\n");
|
|
405
|
-
slides.push(
|
|
409
|
+
slides.push({
|
|
410
|
+
...parseSlide(raw),
|
|
406
411
|
index: slides.length,
|
|
407
412
|
start,
|
|
408
413
|
end
|
|
409
|
-
})
|
|
414
|
+
});
|
|
410
415
|
start = end + 1;
|
|
411
416
|
}
|
|
412
417
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -476,5 +481,4 @@ function scanMonacoModules(md) {
|
|
|
476
481
|
|
|
477
482
|
|
|
478
483
|
|
|
479
|
-
|
|
480
|
-
exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.parseRangeString = parseRangeString; exports.parseAspectRatio = parseAspectRatio; exports.resolveConfig = resolveConfig; exports.resolveFonts = resolveFonts; exports.stringify = stringify; exports.filterDisabled = filterDisabled; exports.stringifySlide = stringifySlide; exports.prettifySlide = prettifySlide; exports.prettify = prettify; exports.detectFeatures = detectFeatures; exports.parseSlide = parseSlide; exports.parse = parse; exports.mergeFeatureFlags = mergeFeatureFlags; exports.scanMonacoModules = scanMonacoModules;
|
|
484
|
+
exports.parseRangeString = parseRangeString; exports.parseAspectRatio = parseAspectRatio; exports.resolveConfig = resolveConfig; exports.verifyConfig = verifyConfig; exports.resolveFonts = resolveFonts; exports.stringify = stringify; exports.filterDisabled = filterDisabled; exports.stringifySlide = stringifySlide; exports.prettifySlide = prettifySlide; exports.prettify = prettify; exports.detectFeatures = detectFeatures; exports.parseSlide = parseSlide; exports.parse = parse; exports.mergeFeatureFlags = mergeFeatureFlags; exports.scanMonacoModules = scanMonacoModules;
|
package/dist/core.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ declare function parseRangeString(total: number, rangeStr?: string): number[];
|
|
|
9
9
|
*/
|
|
10
10
|
declare function parseAspectRatio(str: string | number): number;
|
|
11
11
|
|
|
12
|
-
declare function resolveConfig(headmatter: any, themeMeta?: SlidevThemeMeta): SlidevConfig;
|
|
12
|
+
declare function resolveConfig(headmatter: any, themeMeta?: SlidevThemeMeta, verify?: boolean): SlidevConfig;
|
|
13
|
+
declare function verifyConfig(config: SlidevConfig, themeMeta?: SlidevThemeMeta, warn?: (v: string) => void): void;
|
|
13
14
|
declare function resolveFonts(fonts?: FontOptions): ResolvedFontOptions;
|
|
14
15
|
|
|
15
16
|
declare function stringify(data: SlidevMarkdown): string;
|
|
@@ -23,4 +24,4 @@ declare function parse(markdown: string, filepath?: string, themeMeta?: SlidevTh
|
|
|
23
24
|
declare function mergeFeatureFlags(a: SlidevFeatureFlags, b: SlidevFeatureFlags): SlidevFeatureFlags;
|
|
24
25
|
declare function scanMonacoModules(md: string): string[];
|
|
25
26
|
|
|
26
|
-
export { detectFeatures, filterDisabled, mergeFeatureFlags, parse, parseAspectRatio, parseRangeString, parseSlide, prettify, prettifySlide, resolveConfig, resolveFonts, scanMonacoModules, stringify, stringifySlide };
|
|
27
|
+
export { detectFeatures, filterDisabled, mergeFeatureFlags, parse, parseAspectRatio, parseRangeString, parseSlide, prettify, prettifySlide, resolveConfig, resolveFonts, scanMonacoModules, stringify, stringifySlide, verifyConfig };
|
package/dist/core.js
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var _chunkZWMIEBCOjs = require('./chunk-ZWMIEBCO.js');
|
|
17
16
|
|
|
17
|
+
var _chunkNWLQAI2Yjs = require('./chunk-NWLQAI2Y.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -29,4 +29,6 @@ var _chunkZWMIEBCOjs = require('./chunk-ZWMIEBCO.js');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
exports.detectFeatures = _chunkNWLQAI2Yjs.detectFeatures; exports.filterDisabled = _chunkNWLQAI2Yjs.filterDisabled; exports.mergeFeatureFlags = _chunkNWLQAI2Yjs.mergeFeatureFlags; exports.parse = _chunkNWLQAI2Yjs.parse; exports.parseAspectRatio = _chunkNWLQAI2Yjs.parseAspectRatio; exports.parseRangeString = _chunkNWLQAI2Yjs.parseRangeString; exports.parseSlide = _chunkNWLQAI2Yjs.parseSlide; exports.prettify = _chunkNWLQAI2Yjs.prettify; exports.prettifySlide = _chunkNWLQAI2Yjs.prettifySlide; exports.resolveConfig = _chunkNWLQAI2Yjs.resolveConfig; exports.resolveFonts = _chunkNWLQAI2Yjs.resolveFonts; exports.scanMonacoModules = _chunkNWLQAI2Yjs.scanMonacoModules; exports.stringify = _chunkNWLQAI2Yjs.stringify; exports.stringifySlide = _chunkNWLQAI2Yjs.stringifySlide; exports.verifyConfig = _chunkNWLQAI2Yjs.verifyConfig;
|
package/dist/core.mjs
CHANGED
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
resolveFonts,
|
|
13
13
|
scanMonacoModules,
|
|
14
14
|
stringify,
|
|
15
|
-
stringifySlide
|
|
16
|
-
|
|
15
|
+
stringifySlide,
|
|
16
|
+
verifyConfig
|
|
17
|
+
} from "./chunk-4YHYLMJ3.mjs";
|
|
17
18
|
export {
|
|
18
19
|
detectFeatures,
|
|
19
20
|
filterDisabled,
|
|
@@ -28,5 +29,6 @@ export {
|
|
|
28
29
|
resolveFonts,
|
|
29
30
|
scanMonacoModules,
|
|
30
31
|
stringify,
|
|
31
|
-
stringifySlide
|
|
32
|
+
stringifySlide,
|
|
33
|
+
verifyConfig
|
|
32
34
|
};
|
package/dist/fs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SlidevThemeMeta, SlidevMarkdown, SlideInfoWithPath } from '@slidev/types';
|
|
2
|
-
export { detectFeatures, filterDisabled, mergeFeatureFlags, parse, parseAspectRatio, parseRangeString, parseSlide, prettify, prettifySlide, resolveConfig, resolveFonts, scanMonacoModules, stringify, stringifySlide } from './core.js';
|
|
2
|
+
export { detectFeatures, filterDisabled, mergeFeatureFlags, parse, parseAspectRatio, parseRangeString, parseSlide, prettify, prettifySlide, resolveConfig, resolveFonts, scanMonacoModules, stringify, stringifySlide, verifyConfig } from './core.js';
|
|
3
3
|
|
|
4
4
|
declare function load(filepath: string, themeMeta?: SlidevThemeMeta, content?: string): Promise<SlidevMarkdown>;
|
|
5
5
|
declare function save(data: SlidevMarkdown, filepath?: string): Promise<void>;
|
package/dist/fs.js
CHANGED
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
var _chunkZWMIEBCOjs = require('./chunk-ZWMIEBCO.js');
|
|
17
|
+
var _chunkNWLQAI2Yjs = require('./chunk-NWLQAI2Y.js');
|
|
19
18
|
|
|
20
19
|
// src/fs.ts
|
|
21
20
|
var _fs = require('fs');
|
|
@@ -23,7 +22,7 @@ var _path = require('path');
|
|
|
23
22
|
async function load(filepath, themeMeta, content) {
|
|
24
23
|
const dir = _path.dirname.call(void 0, filepath);
|
|
25
24
|
const markdown = content != null ? content : await _fs.promises.readFile(filepath, "utf-8");
|
|
26
|
-
const data =
|
|
25
|
+
const data = _chunkNWLQAI2Yjs.parse.call(void 0, markdown, filepath, themeMeta);
|
|
27
26
|
const entries = /* @__PURE__ */ new Set([
|
|
28
27
|
filepath
|
|
29
28
|
]);
|
|
@@ -37,25 +36,28 @@ async function load(filepath, themeMeta, content) {
|
|
|
37
36
|
const srcExpression = baseSlide.frontmatter.src;
|
|
38
37
|
const path = _path.resolve.call(void 0, dir, srcExpression);
|
|
39
38
|
const raw = await _fs.promises.readFile(path, "utf-8");
|
|
40
|
-
const subSlides =
|
|
39
|
+
const subSlides = _chunkNWLQAI2Yjs.parse.call(void 0, raw, path, themeMeta);
|
|
41
40
|
for (const [offset, subSlide] of subSlides.slides.entries()) {
|
|
42
|
-
const slide =
|
|
43
|
-
slide.source =
|
|
44
|
-
filepath: path
|
|
45
|
-
|
|
41
|
+
const slide = { ...baseSlide };
|
|
42
|
+
slide.source = {
|
|
43
|
+
filepath: path,
|
|
44
|
+
...subSlide
|
|
45
|
+
};
|
|
46
46
|
if (offset === 0 && !baseSlide.frontmatter.srcSequence) {
|
|
47
|
-
slide.inline =
|
|
47
|
+
slide.inline = { ...baseSlide };
|
|
48
48
|
delete slide.inline.frontmatter.src;
|
|
49
49
|
Object.assign(slide, slide.source, { raw: null });
|
|
50
50
|
} else {
|
|
51
51
|
Object.assign(slide, slide.source);
|
|
52
52
|
}
|
|
53
|
-
const baseSlideFrontMatterWithoutSrc =
|
|
53
|
+
const baseSlideFrontMatterWithoutSrc = { ...baseSlide.frontmatter };
|
|
54
54
|
delete baseSlideFrontMatterWithoutSrc.src;
|
|
55
|
-
slide.frontmatter =
|
|
55
|
+
slide.frontmatter = {
|
|
56
|
+
...subSlide.frontmatter,
|
|
57
|
+
...baseSlideFrontMatterWithoutSrc,
|
|
56
58
|
srcSequence: `${baseSlide.frontmatter.srcSequence ? `${baseSlide.frontmatter.srcSequence},` : ""}${srcExpression}`
|
|
57
|
-
}
|
|
58
|
-
data.features =
|
|
59
|
+
};
|
|
60
|
+
data.features = _chunkNWLQAI2Yjs.mergeFeatureFlags.call(void 0, data.features, _chunkNWLQAI2Yjs.detectFeatures.call(void 0, raw));
|
|
59
61
|
entries.add(path);
|
|
60
62
|
data.slides.splice(iSlide + offset, 0, slide);
|
|
61
63
|
}
|
|
@@ -67,10 +69,10 @@ async function load(filepath, themeMeta, content) {
|
|
|
67
69
|
}
|
|
68
70
|
async function save(data, filepath) {
|
|
69
71
|
filepath = filepath || data.filepath;
|
|
70
|
-
await _fs.promises.writeFile(filepath,
|
|
72
|
+
await _fs.promises.writeFile(filepath, _chunkNWLQAI2Yjs.stringify.call(void 0, data), "utf-8");
|
|
71
73
|
}
|
|
72
74
|
async function saveExternalSlide(slide) {
|
|
73
|
-
await _fs.promises.writeFile(slide.filepath,
|
|
75
|
+
await _fs.promises.writeFile(slide.filepath, _chunkNWLQAI2Yjs.stringifySlide.call(void 0, slide), "utf-8");
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
|
|
@@ -90,4 +92,5 @@ async function saveExternalSlide(slide) {
|
|
|
90
92
|
|
|
91
93
|
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
|
|
96
|
+
exports.detectFeatures = _chunkNWLQAI2Yjs.detectFeatures; exports.filterDisabled = _chunkNWLQAI2Yjs.filterDisabled; exports.load = load; exports.mergeFeatureFlags = _chunkNWLQAI2Yjs.mergeFeatureFlags; exports.parse = _chunkNWLQAI2Yjs.parse; exports.parseAspectRatio = _chunkNWLQAI2Yjs.parseAspectRatio; exports.parseRangeString = _chunkNWLQAI2Yjs.parseRangeString; exports.parseSlide = _chunkNWLQAI2Yjs.parseSlide; exports.prettify = _chunkNWLQAI2Yjs.prettify; exports.prettifySlide = _chunkNWLQAI2Yjs.prettifySlide; exports.resolveConfig = _chunkNWLQAI2Yjs.resolveConfig; exports.resolveFonts = _chunkNWLQAI2Yjs.resolveFonts; exports.save = save; exports.saveExternalSlide = saveExternalSlide; exports.scanMonacoModules = _chunkNWLQAI2Yjs.scanMonacoModules; exports.stringify = _chunkNWLQAI2Yjs.stringify; exports.stringifySlide = _chunkNWLQAI2Yjs.stringifySlide; exports.verifyConfig = _chunkNWLQAI2Yjs.verifyConfig;
|
package/dist/fs.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__spreadProps,
|
|
3
|
-
__spreadValues,
|
|
4
2
|
detectFeatures,
|
|
5
3
|
filterDisabled,
|
|
6
4
|
mergeFeatureFlags,
|
|
@@ -14,8 +12,9 @@ import {
|
|
|
14
12
|
resolveFonts,
|
|
15
13
|
scanMonacoModules,
|
|
16
14
|
stringify,
|
|
17
|
-
stringifySlide
|
|
18
|
-
|
|
15
|
+
stringifySlide,
|
|
16
|
+
verifyConfig
|
|
17
|
+
} from "./chunk-4YHYLMJ3.mjs";
|
|
19
18
|
|
|
20
19
|
// src/fs.ts
|
|
21
20
|
import { promises as fs } from "fs";
|
|
@@ -39,22 +38,25 @@ async function load(filepath, themeMeta, content) {
|
|
|
39
38
|
const raw = await fs.readFile(path, "utf-8");
|
|
40
39
|
const subSlides = parse(raw, path, themeMeta);
|
|
41
40
|
for (const [offset, subSlide] of subSlides.slides.entries()) {
|
|
42
|
-
const slide =
|
|
43
|
-
slide.source =
|
|
44
|
-
filepath: path
|
|
45
|
-
|
|
41
|
+
const slide = { ...baseSlide };
|
|
42
|
+
slide.source = {
|
|
43
|
+
filepath: path,
|
|
44
|
+
...subSlide
|
|
45
|
+
};
|
|
46
46
|
if (offset === 0 && !baseSlide.frontmatter.srcSequence) {
|
|
47
|
-
slide.inline =
|
|
47
|
+
slide.inline = { ...baseSlide };
|
|
48
48
|
delete slide.inline.frontmatter.src;
|
|
49
49
|
Object.assign(slide, slide.source, { raw: null });
|
|
50
50
|
} else {
|
|
51
51
|
Object.assign(slide, slide.source);
|
|
52
52
|
}
|
|
53
|
-
const baseSlideFrontMatterWithoutSrc =
|
|
53
|
+
const baseSlideFrontMatterWithoutSrc = { ...baseSlide.frontmatter };
|
|
54
54
|
delete baseSlideFrontMatterWithoutSrc.src;
|
|
55
|
-
slide.frontmatter =
|
|
55
|
+
slide.frontmatter = {
|
|
56
|
+
...subSlide.frontmatter,
|
|
57
|
+
...baseSlideFrontMatterWithoutSrc,
|
|
56
58
|
srcSequence: `${baseSlide.frontmatter.srcSequence ? `${baseSlide.frontmatter.srcSequence},` : ""}${srcExpression}`
|
|
57
|
-
}
|
|
59
|
+
};
|
|
58
60
|
data.features = mergeFeatureFlags(data.features, detectFeatures(raw));
|
|
59
61
|
entries.add(path);
|
|
60
62
|
data.slides.splice(iSlide + offset, 0, slide);
|
|
@@ -89,5 +91,6 @@ export {
|
|
|
89
91
|
saveExternalSlide,
|
|
90
92
|
scanMonacoModules,
|
|
91
93
|
stringify,
|
|
92
|
-
stringifySlide
|
|
94
|
+
stringifySlide,
|
|
95
|
+
verifyConfig
|
|
93
96
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { detectFeatures, filterDisabled, mergeFeatureFlags, parse, parseAspectRatio, parseRangeString, parseSlide, prettify, prettifySlide, resolveConfig, resolveFonts, scanMonacoModules, stringify, stringifySlide } from './core.js';
|
|
1
|
+
export { detectFeatures, filterDisabled, mergeFeatureFlags, parse, parseAspectRatio, parseRangeString, parseSlide, prettify, prettifySlide, resolveConfig, resolveFonts, scanMonacoModules, stringify, stringifySlide, verifyConfig } from './core.js';
|
|
2
2
|
import '@slidev/types';
|
package/dist/index.js
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var _chunkZWMIEBCOjs = require('./chunk-ZWMIEBCO.js');
|
|
17
16
|
|
|
17
|
+
var _chunkNWLQAI2Yjs = require('./chunk-NWLQAI2Y.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -29,4 +29,6 @@ var _chunkZWMIEBCOjs = require('./chunk-ZWMIEBCO.js');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
exports.detectFeatures = _chunkNWLQAI2Yjs.detectFeatures; exports.filterDisabled = _chunkNWLQAI2Yjs.filterDisabled; exports.mergeFeatureFlags = _chunkNWLQAI2Yjs.mergeFeatureFlags; exports.parse = _chunkNWLQAI2Yjs.parse; exports.parseAspectRatio = _chunkNWLQAI2Yjs.parseAspectRatio; exports.parseRangeString = _chunkNWLQAI2Yjs.parseRangeString; exports.parseSlide = _chunkNWLQAI2Yjs.parseSlide; exports.prettify = _chunkNWLQAI2Yjs.prettify; exports.prettifySlide = _chunkNWLQAI2Yjs.prettifySlide; exports.resolveConfig = _chunkNWLQAI2Yjs.resolveConfig; exports.resolveFonts = _chunkNWLQAI2Yjs.resolveFonts; exports.scanMonacoModules = _chunkNWLQAI2Yjs.scanMonacoModules; exports.stringify = _chunkNWLQAI2Yjs.stringify; exports.stringifySlide = _chunkNWLQAI2Yjs.stringifySlide; exports.verifyConfig = _chunkNWLQAI2Yjs.verifyConfig;
|
package/dist/index.mjs
CHANGED
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
resolveFonts,
|
|
13
13
|
scanMonacoModules,
|
|
14
14
|
stringify,
|
|
15
|
-
stringifySlide
|
|
16
|
-
|
|
15
|
+
stringifySlide,
|
|
16
|
+
verifyConfig
|
|
17
|
+
} from "./chunk-4YHYLMJ3.mjs";
|
|
17
18
|
export {
|
|
18
19
|
detectFeatures,
|
|
19
20
|
filterDisabled,
|
|
@@ -28,5 +29,6 @@ export {
|
|
|
28
29
|
resolveFonts,
|
|
29
30
|
scanMonacoModules,
|
|
30
31
|
stringify,
|
|
31
|
-
stringifySlide
|
|
32
|
+
stringifySlide,
|
|
33
|
+
verifyConfig
|
|
32
34
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.1",
|
|
4
4
|
"description": "Markdown parser for Slidev",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"node": ">=14.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@slidev/types": "0.
|
|
42
|
+
"@slidev/types": "0.34.1",
|
|
43
43
|
"js-yaml": "^4.1.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|