@slidev/parser 0.38.1 → 0.38.2
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/fs.js +13 -3
- package/dist/fs.mjs +13 -3
- package/package.json +2 -2
package/dist/fs.js
CHANGED
|
@@ -24,14 +24,18 @@ function injectPreparserExtensionLoader(fn) {
|
|
|
24
24
|
preparserExtensionLoader = fn;
|
|
25
25
|
}
|
|
26
26
|
async function load(filepath, themeMeta, content) {
|
|
27
|
+
var _a;
|
|
27
28
|
const dir = _path.dirname.call(void 0, filepath);
|
|
28
29
|
const markdown = content != null ? content : await _fs.promises.readFile(filepath, "utf-8");
|
|
29
30
|
const preparserExtensions = [];
|
|
30
31
|
const data = await _chunkC3OTKWGWjs.parse.call(void 0, markdown, filepath, themeMeta, [], async (headmatter, exts, filepath2) => {
|
|
31
|
-
|
|
32
|
+
preparserExtensions.splice(
|
|
33
|
+
0,
|
|
34
|
+
preparserExtensions.length,
|
|
32
35
|
...exts,
|
|
33
36
|
...preparserExtensionLoader ? await preparserExtensionLoader(headmatter, filepath2) : []
|
|
34
|
-
|
|
37
|
+
);
|
|
38
|
+
return preparserExtensions;
|
|
35
39
|
});
|
|
36
40
|
const entries = /* @__PURE__ */ new Set([
|
|
37
41
|
filepath
|
|
@@ -46,7 +50,13 @@ async function load(filepath, themeMeta, content) {
|
|
|
46
50
|
if (baseSlide.frontmatter.hide)
|
|
47
51
|
continue;
|
|
48
52
|
const srcExpression = baseSlide.frontmatter.src;
|
|
49
|
-
|
|
53
|
+
let path;
|
|
54
|
+
if (srcExpression.startsWith("/"))
|
|
55
|
+
path = _path.resolve.call(void 0, dir, srcExpression.substring(1));
|
|
56
|
+
else if ((_a = baseSlide.source) == null ? void 0 : _a.filepath)
|
|
57
|
+
path = _path.resolve.call(void 0, _path.dirname.call(void 0, baseSlide.source.filepath), srcExpression);
|
|
58
|
+
else
|
|
59
|
+
path = _path.resolve.call(void 0, dir, srcExpression);
|
|
50
60
|
const raw = await _fs.promises.readFile(path, "utf-8");
|
|
51
61
|
const subSlides = await _chunkC3OTKWGWjs.parse.call(void 0, raw, path, themeMeta, preparserExtensions);
|
|
52
62
|
for (const [offset, subSlide] of subSlides.slides.entries()) {
|
package/dist/fs.mjs
CHANGED
|
@@ -24,14 +24,18 @@ function injectPreparserExtensionLoader(fn) {
|
|
|
24
24
|
preparserExtensionLoader = fn;
|
|
25
25
|
}
|
|
26
26
|
async function load(filepath, themeMeta, content) {
|
|
27
|
+
var _a;
|
|
27
28
|
const dir = dirname(filepath);
|
|
28
29
|
const markdown = content != null ? content : await fs.readFile(filepath, "utf-8");
|
|
29
30
|
const preparserExtensions = [];
|
|
30
31
|
const data = await parse(markdown, filepath, themeMeta, [], async (headmatter, exts, filepath2) => {
|
|
31
|
-
|
|
32
|
+
preparserExtensions.splice(
|
|
33
|
+
0,
|
|
34
|
+
preparserExtensions.length,
|
|
32
35
|
...exts,
|
|
33
36
|
...preparserExtensionLoader ? await preparserExtensionLoader(headmatter, filepath2) : []
|
|
34
|
-
|
|
37
|
+
);
|
|
38
|
+
return preparserExtensions;
|
|
35
39
|
});
|
|
36
40
|
const entries = /* @__PURE__ */ new Set([
|
|
37
41
|
filepath
|
|
@@ -46,7 +50,13 @@ async function load(filepath, themeMeta, content) {
|
|
|
46
50
|
if (baseSlide.frontmatter.hide)
|
|
47
51
|
continue;
|
|
48
52
|
const srcExpression = baseSlide.frontmatter.src;
|
|
49
|
-
|
|
53
|
+
let path;
|
|
54
|
+
if (srcExpression.startsWith("/"))
|
|
55
|
+
path = resolve(dir, srcExpression.substring(1));
|
|
56
|
+
else if ((_a = baseSlide.source) == null ? void 0 : _a.filepath)
|
|
57
|
+
path = resolve(dirname(baseSlide.source.filepath), srcExpression);
|
|
58
|
+
else
|
|
59
|
+
path = resolve(dir, srcExpression);
|
|
50
60
|
const raw = await fs.readFile(path, "utf-8");
|
|
51
61
|
const subSlides = await parse(raw, path, themeMeta, preparserExtensions);
|
|
52
62
|
for (const [offset, subSlide] of subSlides.slides.entries()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/parser",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.2",
|
|
4
4
|
"description": "Markdown parser for Slidev",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"js-yaml": "^4.1.0",
|
|
43
|
-
"@slidev/types": "0.38.
|
|
43
|
+
"@slidev/types": "0.38.2"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "rimraf dist && tsup src/index.ts src/core.ts src/fs.ts --format cjs,esm --dts --splitting --no-shims",
|