@slidev/parser 0.49.20 → 0.49.21

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.d.mts CHANGED
@@ -7,7 +7,7 @@ declare function injectPreparserExtensionLoader(fn: PreparserExtensionLoader): v
7
7
  * because config and themeMeta depends on the theme to be loaded.
8
8
  */
9
9
  type LoadedSlidevData = Omit<SlidevData, 'config' | 'themeMeta'>;
10
- declare function load(userRoot: string, filepath: string, content?: string, mode?: string): Promise<LoadedSlidevData>;
10
+ declare function load(userRoot: string, filepath: string, loadedSource?: Record<string, string>, mode?: string): Promise<LoadedSlidevData>;
11
11
  declare function save(markdown: SlidevMarkdown): Promise<string>;
12
12
 
13
13
  export { type LoadedSlidevData, injectPreparserExtensionLoader, load, save };
package/dist/fs.mjs CHANGED
@@ -24,8 +24,8 @@ var preparserExtensionLoader = null;
24
24
  function injectPreparserExtensionLoader(fn) {
25
25
  preparserExtensionLoader = fn;
26
26
  }
27
- async function load(userRoot, filepath, content, mode) {
28
- const markdown = content ?? fs.readFileSync(filepath, "utf-8");
27
+ async function load(userRoot, filepath, loadedSource = {}, mode) {
28
+ const markdown = loadedSource[filepath] ?? fs.readFileSync(filepath, "utf-8");
29
29
  let extensions;
30
30
  if (preparserExtensionLoader) {
31
31
  const lines = markdown.split(/\r?\n/g);
@@ -44,7 +44,7 @@ async function load(userRoot, filepath, content, mode) {
44
44
  async function loadMarkdown(path, range, frontmatterOverride, importers) {
45
45
  let md = markdownFiles[path];
46
46
  if (!md) {
47
- const raw = fs.readFileSync(path, "utf-8");
47
+ const raw = loadedSource[path] ?? fs.readFileSync(path, "utf-8");
48
48
  md = await parse(raw, path, extensions);
49
49
  markdownFiles[path] = md;
50
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/parser",
3
- "version": "0.49.20",
3
+ "version": "0.49.21",
4
4
  "description": "Markdown parser for Slidev",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "@antfu/utils": "^0.7.10",
40
40
  "yaml": "^2.4.5",
41
- "@slidev/types": "0.49.20"
41
+ "@slidev/types": "0.49.21"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "rimraf dist && tsup src/index.ts src/core.ts src/fs.ts",