@slidev/parser 0.49.0-beta.4 → 0.49.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.
@@ -1,43 +1,9 @@
1
1
  // src/core.ts
2
2
  import YAML from "yaml";
3
-
4
- // ../../node_modules/.pnpm/@antfu+utils@0.7.7/node_modules/@antfu/utils/dist/index.mjs
5
- function toArray(array) {
6
- array = array ?? [];
7
- return Array.isArray(array) ? array : [array];
8
- }
9
- function uniq(array) {
10
- return Array.from(new Set(array));
11
- }
12
- function range(...args) {
13
- let start, stop, step;
14
- if (args.length === 1) {
15
- start = 0;
16
- step = 1;
17
- [stop] = args;
18
- } else {
19
- [start, stop, step = 1] = args;
20
- }
21
- const arr = [];
22
- let current = start;
23
- while (current < stop) {
24
- arr.push(current);
25
- current += step || 1;
26
- }
27
- return arr;
28
- }
29
- var isNumber = (val) => typeof val === "number";
30
- function slash(str) {
31
- return str.replace(/\\/g, "/");
32
- }
33
- function ensurePrefix(prefix, str) {
34
- if (!str.startsWith(prefix))
35
- return prefix + str;
36
- return str;
37
- }
38
- var VOID = Symbol("p-void");
3
+ import { ensurePrefix } from "@antfu/utils";
39
4
 
40
5
  // src/utils.ts
6
+ import { isNumber, range, uniq } from "@antfu/utils";
41
7
  function parseRangeString(total, rangeStr) {
42
8
  if (!rangeStr || rangeStr === "all" || rangeStr === "*")
43
9
  return range(1, total + 1);
@@ -70,6 +36,7 @@ function parseAspectRatio(str) {
70
36
  }
71
37
 
72
38
  // src/config.ts
39
+ import { toArray, uniq as uniq2 } from "@antfu/utils";
73
40
  function getDefaultConfig() {
74
41
  return {
75
42
  theme: "default",
@@ -168,7 +135,7 @@ function resolveFonts(fonts = {}) {
168
135
  const weights = toArray(fonts.weights || "200,400,600").flatMap((i) => i.toString().split(/,\s*/g)).map((i) => i.trim());
169
136
  const custom = toArray(fonts.custom).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
170
137
  const local = toArray(fonts.local).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
171
- const webfonts = fonts.webfonts ? fonts.webfonts : fallbacks ? uniq([...sans, ...serif, ...mono, ...custom]) : [];
138
+ const webfonts = fonts.webfonts ? fonts.webfonts : fallbacks ? uniq2([...sans, ...serif, ...mono, ...custom]) : [];
172
139
  webfonts.filter((i) => local.includes(i));
173
140
  function toQuoted(font) {
174
141
  if (/^(['"]).*\1$/.test(font))
@@ -176,7 +143,7 @@ function resolveFonts(fonts = {}) {
176
143
  return `"${font}"`;
177
144
  }
178
145
  if (fallbacks) {
179
- sans = uniq([
146
+ sans = uniq2([
180
147
  ...sans.map(toQuoted),
181
148
  "ui-sans-serif",
182
149
  "system-ui",
@@ -193,7 +160,7 @@ function resolveFonts(fonts = {}) {
193
160
  '"Segoe UI Symbol"',
194
161
  '"Noto Color Emoji"'
195
162
  ]);
196
- serif = uniq([
163
+ serif = uniq2([
197
164
  ...serif.map(toQuoted),
198
165
  "ui-serif",
199
166
  "Georgia",
@@ -202,7 +169,7 @@ function resolveFonts(fonts = {}) {
202
169
  "Times",
203
170
  "serif"
204
171
  ]);
205
- mono = uniq([
172
+ mono = uniq2([
206
173
  ...mono.map(toQuoted),
207
174
  "ui-monospace",
208
175
  "SFMono-Regular",
@@ -430,7 +397,6 @@ function scanMonacoReferencedMods(md) {
430
397
  }
431
398
 
432
399
  export {
433
- slash,
434
400
  parseRangeString,
435
401
  parseAspectRatio,
436
402
  getDefaultConfig,
package/dist/core.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  stringify,
13
13
  stringifySlide,
14
14
  verifyConfig
15
- } from "./chunk-VLJJ245M.mjs";
15
+ } from "./chunk-G3BCFBME.mjs";
16
16
  export {
17
17
  detectFeatures,
18
18
  getDefaultConfig,
package/dist/fs.mjs CHANGED
@@ -9,16 +9,16 @@ import {
9
9
  prettifySlide,
10
10
  resolveConfig,
11
11
  resolveFonts,
12
- slash,
13
12
  stringify,
14
13
  stringifySlide,
15
14
  verifyConfig
16
- } from "./chunk-VLJJ245M.mjs";
15
+ } from "./chunk-G3BCFBME.mjs";
17
16
 
18
17
  // src/fs.ts
19
18
  import { promises as fs } from "node:fs";
20
19
  import { dirname, resolve } from "node:path";
21
20
  import YAML from "yaml";
21
+ import { slash } from "@antfu/utils";
22
22
  var preparserExtensionLoader = null;
23
23
  function injectPreparserExtensionLoader(fn) {
24
24
  preparserExtensionLoader = fn;
package/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  stringify,
13
13
  stringifySlide,
14
14
  verifyConfig
15
- } from "./chunk-VLJJ245M.mjs";
15
+ } from "./chunk-G3BCFBME.mjs";
16
16
  export {
17
17
  detectFeatures,
18
18
  getDefaultConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/parser",
3
- "version": "0.49.0-beta.4",
3
+ "version": "0.49.0-beta.5",
4
4
  "description": "Markdown parser for Slidev",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -39,8 +39,9 @@
39
39
  "node": ">=18.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "yaml": "^2.4.1",
43
- "@slidev/types": "0.49.0-beta.4"
42
+ "@antfu/utils": "^0.7.7",
43
+ "yaml": "^2.4.2",
44
+ "@slidev/types": "0.49.0-beta.5"
44
45
  },
45
46
  "scripts": {
46
47
  "build": "rimraf dist && tsup src/index.ts src/core.ts src/fs.ts",