@slidev/parser 52.17.1 → 52.17.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/core.d.mts +2 -2
- package/dist/core.mjs +2 -2
- package/dist/fs.d.mts +7 -1
- package/dist/fs.mjs +13 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{utils-CmpEoa5K.d.mts → utils-DpcPp-I0.d.mts} +1 -7
- package/dist/utils.d.mts +2 -2
- package/dist/utils.mjs +1 -13
- package/package.json +3 -2
package/dist/core.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as TimesplitOutput, i as TimesplitInput, n as parseRangeString, o as parseTimesplits, r as parseTimeString, t as parseAspectRatio } from "./utils-DpcPp-I0.mjs";
|
|
2
2
|
import { FontOptions, ResolvedFontOptions, SlidevConfig, SlidevDetectedFeatures, SlidevMarkdown, SlidevPreparserExtension, SlidevThemeMeta, SourceSlideInfo } from "@slidev/types";
|
|
3
3
|
//#region src/config.d.ts
|
|
4
4
|
declare function getDefaultConfig(): SlidevConfig;
|
|
@@ -25,4 +25,4 @@ declare function parseSlide(raw: string, options?: SlidevParserOptions): Omit<So
|
|
|
25
25
|
declare function parse(markdown: string, filepath: string, extensions?: SlidevPreparserExtension[], options?: SlidevParserOptions): Promise<SlidevMarkdown>;
|
|
26
26
|
declare function parseSync(markdown: string, filepath: string, options?: SlidevParserOptions): SlidevMarkdown;
|
|
27
27
|
//#endregion
|
|
28
|
-
export { SlidevParserOptions, TimesplitInput, TimesplitOutput, detectFeatures, extractImagesUsage, getDefaultConfig,
|
|
28
|
+
export { SlidevParserOptions, TimesplitInput, TimesplitOutput, detectFeatures, extractImagesUsage, getDefaultConfig, parse, parseAspectRatio, parseRangeString, parseSlide, parseSync, parseTimeString, parseTimesplits, prettify, prettifySlide, resolveConfig, resolveFonts, stringify, stringifySlide, verifyConfig };
|
package/dist/core.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseAspectRatio, parseRangeString, parseTimeString, parseTimesplits } from "./utils.mjs";
|
|
2
2
|
import { ensurePrefix, toArray, uniq } from "@antfu/utils";
|
|
3
3
|
import YAML from "yaml";
|
|
4
4
|
//#region src/config.ts
|
|
@@ -478,4 +478,4 @@ function hash(str) {
|
|
|
478
478
|
return hash.toString(36).slice(0, 12);
|
|
479
479
|
}
|
|
480
480
|
//#endregion
|
|
481
|
-
export { detectFeatures, extractImagesUsage, getDefaultConfig,
|
|
481
|
+
export { detectFeatures, extractImagesUsage, getDefaultConfig, parse, parseAspectRatio, parseRangeString, parseSlide, parseSync, parseTimeString, parseTimesplits, prettify, prettifySlide, resolveConfig, resolveFonts, stringify, stringifySlide, verifyConfig };
|
package/dist/fs.d.mts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as TimesplitOutput, i as TimesplitInput, n as parseRangeString, o as parseTimesplits, r as parseTimeString, t as parseAspectRatio } from "./utils-DpcPp-I0.mjs";
|
|
2
2
|
import { SlidevParserOptions, detectFeatures, extractImagesUsage, getDefaultConfig, parse, parseSlide, parseSync, prettify, prettifySlide, resolveConfig, resolveFonts, stringify, stringifySlide, verifyConfig } from "./core.mjs";
|
|
3
3
|
import { PreparserExtensionLoader, SlidevData, SlidevMarkdown } from "@slidev/types";
|
|
4
4
|
//#region src/fs.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Whether `filePath` resolves inside any of `roots` (no `..` escape).
|
|
7
|
+
* Inlined here (rather than imported from the `slidev` package) because
|
|
8
|
+
* `@slidev/parser` must stay independent of `@slidev/slidev`.
|
|
9
|
+
*/
|
|
10
|
+
declare function isPathInsideRoots(filePath: string, roots: string[]): boolean;
|
|
5
11
|
declare function injectPreparserExtensionLoader(fn: PreparserExtensionLoader): void;
|
|
6
12
|
interface LoadRootsInfo {
|
|
7
13
|
roots: string[];
|
package/dist/fs.mjs
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseAspectRatio, parseRangeString, parseTimeString, parseTimesplits } from "./utils.mjs";
|
|
2
2
|
import { detectFeatures, extractImagesUsage, getDefaultConfig, parse, parseSlide, parseSync, prettify, prettifySlide, resolveConfig, resolveFonts, stringify, stringifySlide, verifyConfig } from "./core.mjs";
|
|
3
3
|
import { slash } from "@antfu/utils";
|
|
4
4
|
import YAML from "yaml";
|
|
5
|
-
import { dirname, resolve } from "node:path";
|
|
6
5
|
import { existsSync } from "node:fs";
|
|
7
6
|
import { readFile, writeFile } from "node:fs/promises";
|
|
7
|
+
import { dirname, isAbsolute, relative, resolve } from "pathe";
|
|
8
8
|
//#region src/fs.ts
|
|
9
|
+
/**
|
|
10
|
+
* Whether `filePath` resolves inside any of `roots` (no `..` escape).
|
|
11
|
+
* Inlined here (rather than imported from the `slidev` package) because
|
|
12
|
+
* `@slidev/parser` must stay independent of `@slidev/slidev`.
|
|
13
|
+
*/
|
|
14
|
+
function isPathInsideRoots(filePath, roots) {
|
|
15
|
+
return roots.some((root) => {
|
|
16
|
+
const rel = relative(root, filePath);
|
|
17
|
+
return rel === "" || !!rel && !rel.startsWith("..") && !isAbsolute(rel);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
9
20
|
const RE_FRONTMATTER_START = /^---(?:[^-].*)?$/;
|
|
10
21
|
const RE_BLANK_LINE = /^\s*$/;
|
|
11
22
|
const RE_FRONTMATTER_END = /^---$/;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as TimesplitOutput, i as TimesplitInput, n as parseRangeString, o as parseTimesplits, r as parseTimeString, t as parseAspectRatio } from "./utils-DpcPp-I0.mjs";
|
|
2
2
|
import { SlidevParserOptions, detectFeatures, extractImagesUsage, getDefaultConfig, parse, parseSlide, parseSync, prettify, prettifySlide, resolveConfig, resolveFonts, stringify, stringifySlide, verifyConfig } from "./core.mjs";
|
|
3
|
-
export { SlidevParserOptions, TimesplitInput, TimesplitOutput, detectFeatures, extractImagesUsage, getDefaultConfig,
|
|
3
|
+
export { SlidevParserOptions, TimesplitInput, TimesplitOutput, detectFeatures, extractImagesUsage, getDefaultConfig, parse, parseAspectRatio, parseRangeString, parseSlide, parseSync, parseTimeString, parseTimesplits, prettify, prettifySlide, resolveConfig, resolveFonts, stringify, stringifySlide, verifyConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseAspectRatio, parseRangeString, parseTimeString, parseTimesplits } from "./utils.mjs";
|
|
2
2
|
import { detectFeatures, extractImagesUsage, getDefaultConfig, parse, parseSlide, parseSync, prettify, prettifySlide, resolveConfig, resolveFonts, stringify, stringifySlide, verifyConfig } from "./core.mjs";
|
|
3
|
-
export { detectFeatures, extractImagesUsage, getDefaultConfig,
|
|
3
|
+
export { detectFeatures, extractImagesUsage, getDefaultConfig, parse, parseAspectRatio, parseRangeString, parseSlide, parseSync, parseTimeString, parseTimesplits, prettify, prettifySlide, resolveConfig, resolveFonts, stringify, stringifySlide, verifyConfig };
|
|
@@ -20,12 +20,6 @@ declare function parseTimeString(timestamp: string | number): {
|
|
|
20
20
|
};
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/utils.d.ts
|
|
23
|
-
/**
|
|
24
|
-
* Whether `filePath` resolves inside any of `roots` (no `..` escape).
|
|
25
|
-
* Inlined here (rather than imported from the `slidev` package) because
|
|
26
|
-
* `@slidev/parser` must stay independent of `@slidev/slidev`.
|
|
27
|
-
*/
|
|
28
|
-
declare function isPathInsideRoots(filePath: string, roots: string[]): boolean;
|
|
29
23
|
/**
|
|
30
24
|
* 1,3-5,8 => [1, 3, 4, 5, 8]
|
|
31
25
|
*/
|
|
@@ -35,4 +29,4 @@ declare function parseRangeString(total: number, rangeStr?: string): number[];
|
|
|
35
29
|
*/
|
|
36
30
|
declare function parseAspectRatio(str: string | number): number;
|
|
37
31
|
//#endregion
|
|
38
|
-
export {
|
|
32
|
+
export { TimesplitOutput as a, TimesplitInput as i, parseRangeString as n, parseTimesplits as o, parseTimeString as r, parseAspectRatio as t };
|
package/dist/utils.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { TimesplitInput, TimesplitOutput,
|
|
1
|
+
import { a as TimesplitOutput, i as TimesplitInput, n as parseRangeString, o as parseTimesplits, r as parseTimeString, t as parseAspectRatio } from "./utils-DpcPp-I0.mjs";
|
|
2
|
+
export { TimesplitInput, TimesplitOutput, parseAspectRatio, parseRangeString, parseTimeString, parseTimesplits };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isNumber, range, uniq } from "@antfu/utils";
|
|
2
|
-
import { isAbsolute, relative } from "node:path";
|
|
3
2
|
//#region src/timesplit/timestring.ts
|
|
4
3
|
/**
|
|
5
4
|
* Parse timestamp into seconds
|
|
@@ -114,17 +113,6 @@ function parseTimesplits(inputs) {
|
|
|
114
113
|
}
|
|
115
114
|
//#endregion
|
|
116
115
|
//#region src/utils.ts
|
|
117
|
-
/**
|
|
118
|
-
* Whether `filePath` resolves inside any of `roots` (no `..` escape).
|
|
119
|
-
* Inlined here (rather than imported from the `slidev` package) because
|
|
120
|
-
* `@slidev/parser` must stay independent of `@slidev/slidev`.
|
|
121
|
-
*/
|
|
122
|
-
function isPathInsideRoots(filePath, roots) {
|
|
123
|
-
return roots.some((root) => {
|
|
124
|
-
const rel = relative(root, filePath);
|
|
125
|
-
return rel === "" || !!rel && !rel.startsWith("..") && !isAbsolute(rel);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
116
|
const RE_ASPECT_RATIO_SEPARATOR = /[:/x|]/;
|
|
129
117
|
/**
|
|
130
118
|
* 1,3-5,8 => [1, 3, 4, 5, 8]
|
|
@@ -153,4 +141,4 @@ function parseAspectRatio(str) {
|
|
|
153
141
|
return w / h;
|
|
154
142
|
}
|
|
155
143
|
//#endregion
|
|
156
|
-
export {
|
|
144
|
+
export { parseAspectRatio, parseRangeString, parseTimeString, parseTimesplits };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/parser",
|
|
3
|
-
"version": "52.17.
|
|
3
|
+
"version": "52.17.2",
|
|
4
4
|
"description": "Markdown parser for Slidev",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,8 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@antfu/utils": "^9.3.0",
|
|
33
|
+
"pathe": "^2.0.3",
|
|
33
34
|
"yaml": "^2.9.0",
|
|
34
|
-
"@slidev/types": "52.17.
|
|
35
|
+
"@slidev/types": "52.17.2"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"tsdown-stale-guard": "^0.1.2"
|