@slidev/parser 0.27.17 → 0.28.0

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.
@@ -0,0 +1,393 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }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
+
21
+ // src/core.ts
22
+ var _jsyaml = require('js-yaml'); var _jsyaml2 = _interopRequireDefault(_jsyaml);
23
+
24
+ // ../../node_modules/.pnpm/@antfu+utils@0.4.0/node_modules/@antfu/utils/dist/index.mjs
25
+ function toArray(array) {
26
+ array = array || [];
27
+ if (Array.isArray(array))
28
+ return array;
29
+ return [array];
30
+ }
31
+ function uniq(array) {
32
+ return Array.from(new Set(array));
33
+ }
34
+ function range(...args) {
35
+ let start, stop, step;
36
+ if (args.length === 1) {
37
+ start = 0;
38
+ step = 1;
39
+ [stop] = args;
40
+ } else {
41
+ [start, stop, step = 1] = args;
42
+ }
43
+ const arr = [];
44
+ let current = start;
45
+ while (current < stop) {
46
+ arr.push(current);
47
+ current += step || 1;
48
+ }
49
+ return arr;
50
+ }
51
+ var toString = (v) => Object.prototype.toString.call(v);
52
+ function notNullish(v) {
53
+ return v != null;
54
+ }
55
+ function isTruthy(v) {
56
+ return Boolean(v);
57
+ }
58
+ var isNumber = (val) => typeof val === "number";
59
+ var isObject = (val) => toString(val) === "[object Object]";
60
+ function objectMap(obj, fn) {
61
+ return Object.fromEntries(Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish));
62
+ }
63
+
64
+ // src/utils.ts
65
+ function parseRangeString(total, rangeStr) {
66
+ if (!rangeStr || rangeStr === "all" || rangeStr === "*")
67
+ return range(1, total + 1);
68
+ const pages = [];
69
+ for (const part of rangeStr.split(/[,;]/g)) {
70
+ if (!part.includes("-")) {
71
+ pages.push(+part);
72
+ } else {
73
+ const [start, end] = part.split("-", 2);
74
+ pages.push(...range(+start, !end ? total + 1 : +end + 1));
75
+ }
76
+ }
77
+ return uniq(pages).filter((i) => i <= total).sort((a, b) => a - b);
78
+ }
79
+ function parseAspectRatio(str) {
80
+ if (isNumber(str))
81
+ return str;
82
+ if (!isNaN(+str))
83
+ return +str;
84
+ const [wStr = "", hStr = ""] = str.split(/[:\/x\|]/);
85
+ const w = parseFloat(wStr.trim());
86
+ const h = parseFloat(hStr.trim());
87
+ if (isNaN(w) || isNaN(h) || h === 0)
88
+ throw new Error(`Invalid aspect ratio "${str}"`);
89
+ return w / h;
90
+ }
91
+
92
+ // src/config.ts
93
+ function resolveConfig(headmatter, themeMeta = {}) {
94
+ var _a, _b;
95
+ const themeHightlighter = ["prism", "shiki"].includes(themeMeta.highlighter || "") ? themeMeta.highlighter : void 0;
96
+ const themeColorSchema = ["light", "dark"].includes(themeMeta.colorSchema || "") ? themeMeta.colorSchema : void 0;
97
+ const defaultConfig = {
98
+ theme: "default",
99
+ title: "Slidev",
100
+ titleTemplate: "%s - Slidev",
101
+ remoteAssets: false,
102
+ monaco: "dev",
103
+ download: false,
104
+ info: false,
105
+ highlighter: themeHightlighter || "prism",
106
+ lineNumbers: false,
107
+ colorSchema: themeColorSchema || "auto",
108
+ routerMode: "history",
109
+ aspectRatio: 16 / 9,
110
+ canvasWidth: 980,
111
+ selectable: false,
112
+ themeConfig: {},
113
+ fonts: {},
114
+ favicon: "https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png",
115
+ drawings: {},
116
+ plantUmlServer: "https://www.plantuml.com/plantuml"
117
+ };
118
+ const config = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, defaultConfig), themeMeta.defaults), headmatter.config), headmatter), {
119
+ fonts: resolveFonts(__spreadValues(__spreadValues(__spreadValues({}, (_a = themeMeta.defaults) == null ? void 0 : _a.fonts), (_b = headmatter.config) == null ? void 0 : _b.fonts), headmatter == null ? void 0 : headmatter.fonts)),
120
+ drawings: resolveDarwings(headmatter.drawings)
121
+ });
122
+ if (config.colorSchema !== "dark" && config.colorSchema !== "light")
123
+ config.colorSchema = "auto";
124
+ if (themeColorSchema && config.colorSchema === "auto")
125
+ config.colorSchema = themeColorSchema;
126
+ config.aspectRatio = parseAspectRatio(config.aspectRatio);
127
+ if (themeColorSchema && config.colorSchema !== themeColorSchema)
128
+ console.warn(`[slidev] Color schema "${config.colorSchema}" does not supported by the theme`);
129
+ if (themeHightlighter && config.highlighter !== themeHightlighter)
130
+ console.warn(`[slidev] Syntax highlighter "${config.highlighter}" does not supported by the theme`);
131
+ return config;
132
+ }
133
+ function resolveFonts(fonts = {}) {
134
+ const {
135
+ fallbacks = true,
136
+ italic = false,
137
+ provider = "google"
138
+ } = fonts;
139
+ let sans = toArray(fonts.sans).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
140
+ let serif = toArray(fonts.serif).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
141
+ let mono = toArray(fonts.mono).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
142
+ const weights = toArray(fonts.weights || "200,400,600").flatMap((i) => i.toString().split(/,\s*/g)).map((i) => i.trim());
143
+ const custom = toArray(fonts.custom).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
144
+ const local = toArray(fonts.local).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
145
+ const webfonts = fonts.webfonts ? fonts.webfonts : fallbacks ? uniq([...sans, ...serif, ...mono, ...custom]) : [];
146
+ webfonts.filter((i) => local.includes(i));
147
+ function toQuoted(font) {
148
+ if (/^(['"]).*\1$/.test(font))
149
+ return font;
150
+ return `"${font}"`;
151
+ }
152
+ if (fallbacks) {
153
+ sans = uniq([
154
+ ...sans.map(toQuoted),
155
+ "ui-sans-serif",
156
+ "system-ui",
157
+ "-apple-system",
158
+ "BlinkMacSystemFont",
159
+ '"Segoe UI"',
160
+ "Roboto",
161
+ '"Helvetica Neue"',
162
+ "Arial",
163
+ '"Noto Sans"',
164
+ "sans-serif",
165
+ '"Apple Color Emoji"',
166
+ '"Segoe UI Emoji"',
167
+ '"Segoe UI Symbol"',
168
+ '"Noto Color Emoji"'
169
+ ]);
170
+ serif = uniq([
171
+ ...serif.map(toQuoted),
172
+ "ui-serif",
173
+ "Georgia",
174
+ "Cambria",
175
+ '"Times New Roman"',
176
+ "Times",
177
+ "serif"
178
+ ]);
179
+ mono = uniq([
180
+ ...mono.map(toQuoted),
181
+ "ui-monospace",
182
+ "SFMono-Regular",
183
+ "Menlo",
184
+ "Monaco",
185
+ "Consolas",
186
+ '"Liberation Mono"',
187
+ '"Courier New"',
188
+ "monospace"
189
+ ]);
190
+ }
191
+ return {
192
+ sans,
193
+ serif,
194
+ mono,
195
+ webfonts,
196
+ provider,
197
+ local,
198
+ italic,
199
+ weights
200
+ };
201
+ }
202
+ function resolveDarwings(options = {}) {
203
+ const {
204
+ enabled = true,
205
+ persist = false,
206
+ presenterOnly = false,
207
+ syncAll = true
208
+ } = options;
209
+ const persistPath = typeof persist === "string" ? persist : persist ? ".slidev/drawings" : false;
210
+ return {
211
+ enabled,
212
+ persist: persistPath,
213
+ presenterOnly,
214
+ syncAll
215
+ };
216
+ }
217
+
218
+ // src/core.ts
219
+ function stringify(data) {
220
+ return `${data.slides.map((slide, idx) => stringifySlide(slide.inline || slide, idx)).join("\n").trim()}
221
+ `;
222
+ }
223
+ function filterDisabled(data) {
224
+ data.slides = data.slides.filter((i) => {
225
+ var _a;
226
+ return !((_a = i.frontmatter) == null ? void 0 : _a.disabled);
227
+ });
228
+ return data;
229
+ }
230
+ function stringifySlide(data, idx = 0) {
231
+ if (data.raw == null)
232
+ prettifySlide(data);
233
+ return data.raw.startsWith("---") || idx === 0 ? data.raw : `---
234
+ ${data.raw.startsWith("\n") ? data.raw : `
235
+ ${data.raw}`}`;
236
+ }
237
+ function prettifySlide(data) {
238
+ data.content = `
239
+ ${data.content.trim()}
240
+ `;
241
+ data.raw = Object.keys(data.frontmatter || {}).length ? `---
242
+ ${_jsyaml2.default.dump(data.frontmatter).trim()}
243
+ ---
244
+ ${data.content}` : data.content;
245
+ if (data.note)
246
+ data.raw += `
247
+ <!--
248
+ ${data.note.trim()}
249
+ -->
250
+ `;
251
+ else
252
+ data.raw += "\n";
253
+ return data;
254
+ }
255
+ function prettify(data) {
256
+ data.slides.forEach(prettifySlide);
257
+ return data;
258
+ }
259
+ function matter(code) {
260
+ let data = {};
261
+ const content = code.replace(/^---.*\r?\n([\s\S]*?)---/, (_, d) => {
262
+ data = _jsyaml2.default.load(d);
263
+ if (!isObject(data))
264
+ data = {};
265
+ return "";
266
+ });
267
+ return { data, content };
268
+ }
269
+ function detectFeatures(code) {
270
+ return {
271
+ katex: !!code.match(/\$.*?\$/) || !!code.match(/$\$\$/),
272
+ monaco: !!code.match(/{monaco.*}/),
273
+ tweet: !!code.match(/<Tweet\b/),
274
+ mermaid: !!code.match(/^```mermaid/m)
275
+ };
276
+ }
277
+ function parseSlide(raw) {
278
+ var _a, _b;
279
+ const result = matter(raw);
280
+ let note;
281
+ const frontmatter = result.data || {};
282
+ let content = result.content.trim();
283
+ const comments = Array.from(content.matchAll(/<!--([\s\S]*?)-->/g));
284
+ if (comments.length) {
285
+ const last = comments[comments.length - 1];
286
+ if (last.index && last.index + last[0].length >= content.length) {
287
+ note = last[1].trim();
288
+ content = content.slice(0, last.index).trim();
289
+ }
290
+ }
291
+ let title;
292
+ let level;
293
+ if (frontmatter.title || frontmatter.name) {
294
+ title = frontmatter.title || frontmatter.name;
295
+ level = frontmatter.level || 1;
296
+ } else {
297
+ const match = content.match(/^(#+) (.*)$/m);
298
+ title = (_a = match == null ? void 0 : match[2]) == null ? void 0 : _a.trim();
299
+ level = (_b = match == null ? void 0 : match[1]) == null ? void 0 : _b.length;
300
+ }
301
+ return {
302
+ raw,
303
+ title,
304
+ level,
305
+ content,
306
+ frontmatter,
307
+ note
308
+ };
309
+ }
310
+ function parse(markdown, filepath, themeMeta) {
311
+ var _a, _b;
312
+ const lines = markdown.split(/\r?\n/g);
313
+ const slides = [];
314
+ let start = 0;
315
+ function slice(end) {
316
+ if (start === end)
317
+ return;
318
+ const raw = lines.slice(start, end).join("\n");
319
+ slides.push(__spreadProps(__spreadValues({}, parseSlide(raw)), {
320
+ index: slides.length,
321
+ start,
322
+ end
323
+ }));
324
+ start = end + 1;
325
+ }
326
+ for (let i = 0; i < lines.length; i++) {
327
+ const line = lines[i].trimEnd();
328
+ if (line.match(/^---+/)) {
329
+ slice(i);
330
+ const next = lines[i + 1];
331
+ if (line.match(/^---([^-].*)?$/) && !(next == null ? void 0 : next.match(/^\s*$/))) {
332
+ start = i;
333
+ for (i += 1; i < lines.length; i++) {
334
+ if (lines[i].trimEnd().match(/^---$/))
335
+ break;
336
+ }
337
+ }
338
+ } else if (line.startsWith("```")) {
339
+ for (i += 1; i < lines.length; i++) {
340
+ if (lines[i].startsWith("```"))
341
+ break;
342
+ }
343
+ }
344
+ }
345
+ if (start <= lines.length - 1)
346
+ slice(lines.length);
347
+ const headmatter = ((_a = slides[0]) == null ? void 0 : _a.frontmatter) || {};
348
+ headmatter.title = headmatter.title || ((_b = slides[0]) == null ? void 0 : _b.title);
349
+ const config = resolveConfig(headmatter, themeMeta);
350
+ const features = detectFeatures(markdown);
351
+ return {
352
+ raw: markdown,
353
+ filepath,
354
+ slides,
355
+ config,
356
+ features,
357
+ headmatter,
358
+ themeMeta
359
+ };
360
+ }
361
+ function mergeFeatureFlags(a, b) {
362
+ return objectMap(a, (k, v) => [k, v || b[k]]);
363
+ }
364
+ function scanMonacoModules(md) {
365
+ const typeModules = /* @__PURE__ */ new Set();
366
+ md.replace(/^```(\w+?)\s*{monaco([\w:,-]*)}[\s\n]*([\s\S]+?)^```/mg, (full, lang = "ts", options, code) => {
367
+ options = options || "";
368
+ lang = lang.trim();
369
+ if (lang === "ts" || lang === "typescript") {
370
+ Array.from(code.matchAll(/\s+from\s+(["'])([\/\w@-]+)\1/g)).map((i) => i[2]).filter(isTruthy).map((i) => typeModules.add(i));
371
+ }
372
+ return "";
373
+ });
374
+ return Array.from(typeModules);
375
+ }
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+ exports.__spreadValues = __spreadValues; 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;
package/dist/core.js CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
 
15
15
 
16
- var _chunk4MLX4OSAjs = require('./chunk-4MLX4OSA.js');
16
+ var _chunkWBX4FRCIjs = require('./chunk-WBX4FRCI.js');
17
17
 
18
18
 
19
19
 
@@ -29,4 +29,4 @@ var _chunk4MLX4OSAjs = require('./chunk-4MLX4OSA.js');
29
29
 
30
30
 
31
31
 
32
- exports.detectFeatures = _chunk4MLX4OSAjs.detectFeatures; exports.filterDisabled = _chunk4MLX4OSAjs.filterDisabled; exports.mergeFeatureFlags = _chunk4MLX4OSAjs.mergeFeatureFlags; exports.parse = _chunk4MLX4OSAjs.parse; exports.parseAspectRatio = _chunk4MLX4OSAjs.parseAspectRatio; exports.parseRangeString = _chunk4MLX4OSAjs.parseRangeString; exports.parseSlide = _chunk4MLX4OSAjs.parseSlide; exports.prettify = _chunk4MLX4OSAjs.prettify; exports.prettifySlide = _chunk4MLX4OSAjs.prettifySlide; exports.resolveConfig = _chunk4MLX4OSAjs.resolveConfig; exports.resolveFonts = _chunk4MLX4OSAjs.resolveFonts; exports.scanMonacoModules = _chunk4MLX4OSAjs.scanMonacoModules; exports.stringify = _chunk4MLX4OSAjs.stringify; exports.stringifySlide = _chunk4MLX4OSAjs.stringifySlide;
32
+ exports.detectFeatures = _chunkWBX4FRCIjs.detectFeatures; exports.filterDisabled = _chunkWBX4FRCIjs.filterDisabled; exports.mergeFeatureFlags = _chunkWBX4FRCIjs.mergeFeatureFlags; exports.parse = _chunkWBX4FRCIjs.parse; exports.parseAspectRatio = _chunkWBX4FRCIjs.parseAspectRatio; exports.parseRangeString = _chunkWBX4FRCIjs.parseRangeString; exports.parseSlide = _chunkWBX4FRCIjs.parseSlide; exports.prettify = _chunkWBX4FRCIjs.prettify; exports.prettifySlide = _chunkWBX4FRCIjs.prettifySlide; exports.resolveConfig = _chunkWBX4FRCIjs.resolveConfig; exports.resolveFonts = _chunkWBX4FRCIjs.resolveFonts; exports.scanMonacoModules = _chunkWBX4FRCIjs.scanMonacoModules; exports.stringify = _chunkWBX4FRCIjs.stringify; exports.stringifySlide = _chunkWBX4FRCIjs.stringifySlide;
package/dist/core.mjs CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  scanMonacoModules,
14
14
  stringify,
15
15
  stringifySlide
16
- } from "./chunk-W27AU6TD.mjs";
16
+ } from "./chunk-HINA34KW.mjs";
17
17
  export {
18
18
  detectFeatures,
19
19
  filterDisabled,
package/dist/fs.js CHANGED
@@ -14,18 +14,16 @@
14
14
 
15
15
 
16
16
 
17
-
18
- var _chunk4MLX4OSAjs = require('./chunk-4MLX4OSA.js');
17
+ var _chunkWBX4FRCIjs = require('./chunk-WBX4FRCI.js');
19
18
 
20
19
  // src/fs.ts
21
- _chunk4MLX4OSAjs.init_cjs_shims.call(void 0, );
22
20
  var _fs = require('fs');
23
21
  var _path = require('path');
24
22
  async function load(filepath, themeMeta, content) {
25
23
  const dir = _path.dirname.call(void 0, filepath);
26
24
  const markdown = content != null ? content : await _fs.promises.readFile(filepath, "utf-8");
27
- const data = _chunk4MLX4OSAjs.parse.call(void 0, markdown, filepath, themeMeta);
28
- const entries = new Set([
25
+ const data = _chunkWBX4FRCIjs.parse.call(void 0, markdown, filepath, themeMeta);
26
+ const entries = /* @__PURE__ */ new Set([
29
27
  filepath
30
28
  ]);
31
29
  for (const slide of data.slides) {
@@ -33,15 +31,15 @@ async function load(filepath, themeMeta, content) {
33
31
  continue;
34
32
  const path = _path.resolve.call(void 0, dir, slide.frontmatter.src);
35
33
  const raw = await _fs.promises.readFile(path, "utf-8");
36
- const source = _chunk4MLX4OSAjs.parseSlide.call(void 0, raw);
37
- const inline = _chunk4MLX4OSAjs.__spreadValues.call(void 0, {}, slide);
38
- slide.source = _chunk4MLX4OSAjs.__spreadValues.call(void 0, {
34
+ const source = _chunkWBX4FRCIjs.parseSlide.call(void 0, raw);
35
+ const inline = _chunkWBX4FRCIjs.__spreadValues.call(void 0, {}, slide);
36
+ slide.source = _chunkWBX4FRCIjs.__spreadValues.call(void 0, {
39
37
  filepath: path
40
38
  }, source);
41
39
  slide.inline = inline;
42
40
  Object.assign(slide, slide.source);
43
- slide.frontmatter = _chunk4MLX4OSAjs.__spreadValues.call(void 0, _chunk4MLX4OSAjs.__spreadValues.call(void 0, {}, slide.source.frontmatter), inline.frontmatter);
44
- data.features = _chunk4MLX4OSAjs.mergeFeatureFlags.call(void 0, data.features, _chunk4MLX4OSAjs.detectFeatures.call(void 0, raw));
41
+ slide.frontmatter = _chunkWBX4FRCIjs.__spreadValues.call(void 0, _chunkWBX4FRCIjs.__spreadValues.call(void 0, {}, slide.source.frontmatter), inline.frontmatter);
42
+ data.features = _chunkWBX4FRCIjs.mergeFeatureFlags.call(void 0, data.features, _chunkWBX4FRCIjs.detectFeatures.call(void 0, raw));
45
43
  entries.add(path);
46
44
  }
47
45
  data.entries = Array.from(entries);
@@ -49,10 +47,10 @@ async function load(filepath, themeMeta, content) {
49
47
  }
50
48
  async function save(data, filepath) {
51
49
  filepath = filepath || data.filepath;
52
- await _fs.promises.writeFile(filepath, _chunk4MLX4OSAjs.stringify.call(void 0, data), "utf-8");
50
+ await _fs.promises.writeFile(filepath, _chunkWBX4FRCIjs.stringify.call(void 0, data), "utf-8");
53
51
  }
54
52
  async function saveExternalSlide(slide) {
55
- await _fs.promises.writeFile(slide.filepath, _chunk4MLX4OSAjs.stringifySlide.call(void 0, slide), "utf-8");
53
+ await _fs.promises.writeFile(slide.filepath, _chunkWBX4FRCIjs.stringifySlide.call(void 0, slide), "utf-8");
56
54
  }
57
55
 
58
56
 
@@ -72,4 +70,4 @@ async function saveExternalSlide(slide) {
72
70
 
73
71
 
74
72
 
75
- exports.detectFeatures = _chunk4MLX4OSAjs.detectFeatures; exports.filterDisabled = _chunk4MLX4OSAjs.filterDisabled; exports.load = load; exports.mergeFeatureFlags = _chunk4MLX4OSAjs.mergeFeatureFlags; exports.parse = _chunk4MLX4OSAjs.parse; exports.parseAspectRatio = _chunk4MLX4OSAjs.parseAspectRatio; exports.parseRangeString = _chunk4MLX4OSAjs.parseRangeString; exports.parseSlide = _chunk4MLX4OSAjs.parseSlide; exports.prettify = _chunk4MLX4OSAjs.prettify; exports.prettifySlide = _chunk4MLX4OSAjs.prettifySlide; exports.resolveConfig = _chunk4MLX4OSAjs.resolveConfig; exports.resolveFonts = _chunk4MLX4OSAjs.resolveFonts; exports.save = save; exports.saveExternalSlide = saveExternalSlide; exports.scanMonacoModules = _chunk4MLX4OSAjs.scanMonacoModules; exports.stringify = _chunk4MLX4OSAjs.stringify; exports.stringifySlide = _chunk4MLX4OSAjs.stringifySlide;
73
+ exports.detectFeatures = _chunkWBX4FRCIjs.detectFeatures; exports.filterDisabled = _chunkWBX4FRCIjs.filterDisabled; exports.load = load; exports.mergeFeatureFlags = _chunkWBX4FRCIjs.mergeFeatureFlags; exports.parse = _chunkWBX4FRCIjs.parse; exports.parseAspectRatio = _chunkWBX4FRCIjs.parseAspectRatio; exports.parseRangeString = _chunkWBX4FRCIjs.parseRangeString; exports.parseSlide = _chunkWBX4FRCIjs.parseSlide; exports.prettify = _chunkWBX4FRCIjs.prettify; exports.prettifySlide = _chunkWBX4FRCIjs.prettifySlide; exports.resolveConfig = _chunkWBX4FRCIjs.resolveConfig; exports.resolveFonts = _chunkWBX4FRCIjs.resolveFonts; exports.save = save; exports.saveExternalSlide = saveExternalSlide; exports.scanMonacoModules = _chunkWBX4FRCIjs.scanMonacoModules; exports.stringify = _chunkWBX4FRCIjs.stringify; exports.stringifySlide = _chunkWBX4FRCIjs.stringifySlide;
package/dist/fs.mjs CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  scanMonacoModules,
15
15
  stringify,
16
16
  stringifySlide
17
- } from "./chunk-W27AU6TD.mjs";
17
+ } from "./chunk-HINA34KW.mjs";
18
18
 
19
19
  // src/fs.ts
20
20
  import { promises as fs } from "fs";
@@ -23,7 +23,7 @@ async function load(filepath, themeMeta, content) {
23
23
  const dir = dirname(filepath);
24
24
  const markdown = content != null ? content : await fs.readFile(filepath, "utf-8");
25
25
  const data = parse(markdown, filepath, themeMeta);
26
- const entries = new Set([
26
+ const entries = /* @__PURE__ */ new Set([
27
27
  filepath
28
28
  ]);
29
29
  for (const slide of data.slides) {
package/dist/index.js CHANGED
@@ -13,11 +13,9 @@
13
13
 
14
14
 
15
15
 
16
+ var _chunkWBX4FRCIjs = require('./chunk-WBX4FRCI.js');
16
17
 
17
- var _chunk4MLX4OSAjs = require('./chunk-4MLX4OSA.js');
18
18
 
19
- // src/index.ts
20
- _chunk4MLX4OSAjs.init_cjs_shims.call(void 0, );
21
19
 
22
20
 
23
21
 
@@ -31,6 +29,4 @@ _chunk4MLX4OSAjs.init_cjs_shims.call(void 0, );
31
29
 
32
30
 
33
31
 
34
-
35
-
36
- exports.detectFeatures = _chunk4MLX4OSAjs.detectFeatures; exports.filterDisabled = _chunk4MLX4OSAjs.filterDisabled; exports.mergeFeatureFlags = _chunk4MLX4OSAjs.mergeFeatureFlags; exports.parse = _chunk4MLX4OSAjs.parse; exports.parseAspectRatio = _chunk4MLX4OSAjs.parseAspectRatio; exports.parseRangeString = _chunk4MLX4OSAjs.parseRangeString; exports.parseSlide = _chunk4MLX4OSAjs.parseSlide; exports.prettify = _chunk4MLX4OSAjs.prettify; exports.prettifySlide = _chunk4MLX4OSAjs.prettifySlide; exports.resolveConfig = _chunk4MLX4OSAjs.resolveConfig; exports.resolveFonts = _chunk4MLX4OSAjs.resolveFonts; exports.scanMonacoModules = _chunk4MLX4OSAjs.scanMonacoModules; exports.stringify = _chunk4MLX4OSAjs.stringify; exports.stringifySlide = _chunk4MLX4OSAjs.stringifySlide;
32
+ exports.detectFeatures = _chunkWBX4FRCIjs.detectFeatures; exports.filterDisabled = _chunkWBX4FRCIjs.filterDisabled; exports.mergeFeatureFlags = _chunkWBX4FRCIjs.mergeFeatureFlags; exports.parse = _chunkWBX4FRCIjs.parse; exports.parseAspectRatio = _chunkWBX4FRCIjs.parseAspectRatio; exports.parseRangeString = _chunkWBX4FRCIjs.parseRangeString; exports.parseSlide = _chunkWBX4FRCIjs.parseSlide; exports.prettify = _chunkWBX4FRCIjs.prettify; exports.prettifySlide = _chunkWBX4FRCIjs.prettifySlide; exports.resolveConfig = _chunkWBX4FRCIjs.resolveConfig; exports.resolveFonts = _chunkWBX4FRCIjs.resolveFonts; exports.scanMonacoModules = _chunkWBX4FRCIjs.scanMonacoModules; exports.stringify = _chunkWBX4FRCIjs.stringify; exports.stringifySlide = _chunkWBX4FRCIjs.stringifySlide;
package/dist/index.mjs CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  scanMonacoModules,
14
14
  stringify,
15
15
  stringifySlide
16
- } from "./chunk-W27AU6TD.mjs";
16
+ } from "./chunk-HINA34KW.mjs";
17
17
  export {
18
18
  detectFeatures,
19
19
  filterDisabled,
package/fs.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/fs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/parser",
3
- "version": "0.27.17",
3
+ "version": "0.28.0",
4
4
  "description": "Markdown parser for Slidev",
5
5
  "homepage": "https://sli.dev",
6
6
  "bugs": "https://github.com/slidevjs/slidev/issues",
@@ -13,27 +13,30 @@
13
13
  "author": "antfu <anthonyfu117@hotmail.com>",
14
14
  "files": [
15
15
  "dist",
16
- "index.d.ts"
16
+ "*.d.ts"
17
17
  ],
18
18
  "exports": {
19
19
  ".": {
20
20
  "import": "./dist/index.mjs",
21
- "require": "./dist/index.js"
21
+ "require": "./dist/index.js",
22
+ "types": "./dist/index.d.ts"
22
23
  },
23
24
  "./core": {
24
25
  "import": "./dist/core.mjs",
25
- "require": "./dist/core.js"
26
+ "require": "./dist/core.js",
27
+ "types": "./dist/core.d.ts"
26
28
  },
27
29
  "./fs": {
28
30
  "import": "./dist/fs.mjs",
29
- "require": "./dist/fs.js"
31
+ "require": "./dist/fs.js",
32
+ "types": "./fs.d.ts"
30
33
  }
31
34
  },
32
35
  "main": "dist/index.js",
33
36
  "module": "dist/index.mjs",
34
37
  "types": "dist/index.d.ts",
35
38
  "dependencies": {
36
- "@slidev/types": "0.27.17",
39
+ "@slidev/types": "0.28.0",
37
40
  "js-yaml": "^4.1.0"
38
41
  },
39
42
  "engines": {
@@ -42,5 +45,6 @@
42
45
  "scripts": {
43
46
  "build": "rimraf dist && tsup src/index.ts src/core.ts src/fs.ts --format cjs,esm --dts --splitting",
44
47
  "dev": "nr build --watch"
45
- }
48
+ },
49
+ "readme": "# @slidev/parser\n\n[![NPM version](https://img.shields.io/npm/v/@slidev/parser?color=3AB9D4&label=)](https://www.npmjs.com/package/@slidev/parser)\n\nSlides markdown parser for [Slidev](https://sli.dev).\n\nLearn more about the [Syntax](https://sli.dev/guide/syntax.html)\n\nRefer to the TypeScript definitions for API.\n\n## License\n\nMIT License © 2021 [Anthony Fu](https://github.com/antfu)\n\n"
46
50
  }