@slidev/cli 0.43.8 → 0.43.10

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,381 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkCGJOXW6Ijs = require('./chunk-CGJOXW6I.js');
4
- require('./chunk-YUG22S6W.js');
5
-
6
- // node/export.ts
7
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
8
- var _buffer = require('buffer');
9
- var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
10
- var _kolorist = require('kolorist');
11
- var _cliprogress = require('cli-progress');
12
- var _core = require('@slidev/parser/core');
13
- var _outlinepdf = require('@lillallol/outline-pdf');
14
- var _pdflib = require('pdf-lib'); var pdfLib = _interopRequireWildcard(_pdflib);
15
-
16
- function addToTree(tree, info, slideIndexes, level = 1) {
17
- const titleLevel = info.level;
18
- if (titleLevel && titleLevel > level && tree.length > 0) {
19
- addToTree(tree[tree.length - 1].children, info, slideIndexes, level + 1);
20
- } else {
21
- tree.push({
22
- children: [],
23
- level,
24
- path: String(slideIndexes[info.index + 1]),
25
- hideInToc: Boolean(_optionalChain([info, 'access', _ => _.frontmatter, 'optionalAccess', _2 => _2.hideInToc])),
26
- title: info.title
27
- });
28
- }
29
- }
30
- function makeOutline(tree) {
31
- return tree.map(({ title, path: path2, level, children }) => {
32
- const rootOutline = title ? `${path2}|${"-".repeat(level - 1)}|${title}` : null;
33
- const childrenOutline = makeOutline(children);
34
- return childrenOutline.length > 0 ? `${rootOutline}
35
- ${childrenOutline}` : rootOutline;
36
- }).filter((outline) => !!outline).join("\n");
37
- }
38
- function createSlidevProgress(indeterminate = false) {
39
- function getSpinner(n = 0) {
40
- return [_kolorist.cyan.call(void 0, "\u25CF"), _kolorist.green.call(void 0, "\u25C6"), _kolorist.blue.call(void 0, "\u25A0"), _kolorist.yellow.call(void 0, "\u25B2")][n % 4];
41
- }
42
- let current = 0;
43
- let spinner = 0;
44
- let timer;
45
- const progress = new (0, _cliprogress.SingleBar)({
46
- clearOnComplete: true,
47
- hideCursor: true,
48
- format: ` {spin} ${_kolorist.yellow.call(void 0, "rendering")}${indeterminate ? _kolorist.dim.call(void 0, _kolorist.yellow.call(void 0, "...")) : " {bar} {value}/{total}"}`,
49
- linewrap: false,
50
- barsize: 30
51
- }, _cliprogress.Presets.shades_grey);
52
- return {
53
- bar: progress,
54
- start(total) {
55
- progress.start(total, 0, { spin: getSpinner(spinner) });
56
- timer = setInterval(() => {
57
- spinner += 1;
58
- progress.update(current, { spin: getSpinner(spinner) });
59
- }, 200);
60
- },
61
- update(v) {
62
- current = v;
63
- progress.update(v, { spin: getSpinner(spinner) });
64
- },
65
- stop() {
66
- clearInterval(timer);
67
- progress.stop();
68
- }
69
- };
70
- }
71
- async function exportNotes({
72
- port = 18724,
73
- base = "/",
74
- output = "notes",
75
- timeout = 3e4
76
- }) {
77
- if (!_chunkCGJOXW6Ijs.packageExists.call(void 0, "playwright-chromium"))
78
- throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
79
- const { chromium } = await Promise.resolve().then(() => _interopRequireWildcard(require("playwright-chromium")));
80
- const browser = await chromium.launch();
81
- const context = await browser.newContext();
82
- const page = await context.newPage();
83
- const progress = createSlidevProgress(true);
84
- progress.start(1);
85
- if (!output.endsWith(".pdf"))
86
- output = `${output}.pdf`;
87
- await page.goto(`http://localhost:${port}${base}presenter/print`, { waitUntil: "networkidle", timeout });
88
- await page.waitForLoadState("networkidle");
89
- await page.emulateMedia({ media: "screen" });
90
- await page.pdf({
91
- path: output,
92
- margin: {
93
- left: 0,
94
- top: 0,
95
- right: 0,
96
- bottom: 0
97
- },
98
- printBackground: true,
99
- preferCSSPageSize: true
100
- });
101
- progress.stop();
102
- browser.close();
103
- return output;
104
- }
105
- async function exportSlides({
106
- port = 18724,
107
- total = 0,
108
- range,
109
- format = "pdf",
110
- output = "slides",
111
- slides,
112
- base = "/",
113
- timeout = 3e4,
114
- dark = false,
115
- routerMode = "history",
116
- width = 1920,
117
- height = 1080,
118
- withClicks = false,
119
- executablePath = void 0,
120
- withToc = false,
121
- perSlide = false
122
- }) {
123
- if (!_chunkCGJOXW6Ijs.packageExists.call(void 0, "playwright-chromium"))
124
- throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
125
- const pages = _core.parseRangeString.call(void 0, total, range);
126
- const { chromium } = await Promise.resolve().then(() => _interopRequireWildcard(require("playwright-chromium")));
127
- const browser = await chromium.launch({
128
- executablePath
129
- });
130
- const context = await browser.newContext({
131
- viewport: {
132
- width,
133
- // Calculate height for every slides to be in the viewport to trigger the rendering of iframes (twitter, youtube...)
134
- height: perSlide ? height : height * pages.length
135
- },
136
- deviceScaleFactor: 1
137
- });
138
- const page = await context.newPage();
139
- const progress = createSlidevProgress(!perSlide);
140
- async function go(no, clicks) {
141
- const path2 = `${no}?print${withClicks ? "=clicks" : ""}${clicks ? `&clicks=${clicks}` : ""}${range ? `&range=${range}` : ""}`;
142
- const url = routerMode === "hash" ? `http://localhost:${port}${base}#${path2}` : `http://localhost:${port}${base}${path2}`;
143
- await page.goto(url, {
144
- waitUntil: "networkidle",
145
- timeout
146
- });
147
- await page.waitForLoadState("networkidle");
148
- await page.emulateMedia({ colorScheme: dark ? "dark" : "light", media: "screen" });
149
- const elements = page.locator("[data-waitfor]");
150
- const count = await elements.count();
151
- for (let index = 0; index < count; index++) {
152
- const element = elements.nth(index);
153
- const attribute = await element.getAttribute("data-waitfor");
154
- if (attribute)
155
- await element.locator(attribute).waitFor();
156
- }
157
- const frames = page.frames();
158
- await Promise.all(frames.map((frame) => frame.waitForLoadState()));
159
- }
160
- async function getSlidesIndex() {
161
- const clicksBySlide = {};
162
- const slides2 = page.locator(".print-slide-container");
163
- const count = await slides2.count();
164
- for (let i = 0; i < count; i++) {
165
- const id = await slides2.nth(i).getAttribute("id") || "";
166
- const path2 = Number(id.split("-")[0]);
167
- clicksBySlide[path2] = (clicksBySlide[path2] || 0) + 1;
168
- }
169
- const slideIndexes = Object.fromEntries(Object.entries(clicksBySlide).reduce((acc, [path2, clicks], i) => {
170
- acc.push([path2, clicks + (_nullishCoalesce(_optionalChain([acc, 'access', _3 => _3[i - 1], 'optionalAccess', _4 => _4[1]]), () => ( 0)))]);
171
- return acc;
172
- }, []));
173
- return slideIndexes;
174
- }
175
- function getClicksFromUrl(url) {
176
- return _optionalChain([url, 'access', _5 => _5.match, 'call', _6 => _6(/clicks=([1-9][0-9]*)/), 'optionalAccess', _7 => _7[1]]);
177
- }
178
- async function genPageWithClicks(fn, i, clicks) {
179
- await fn(i, clicks);
180
- if (withClicks) {
181
- await page.keyboard.press("ArrowRight", { delay: 100 });
182
- const _clicks = getClicksFromUrl(page.url());
183
- if (_clicks && clicks !== _clicks)
184
- await genPageWithClicks(fn, i, _clicks);
185
- }
186
- }
187
- async function genPagePdfPerSlide() {
188
- const buffers = [];
189
- const genPdfBuffer = async (i, clicks) => {
190
- await go(i, clicks);
191
- const pdf = await page.pdf({
192
- width,
193
- height,
194
- margin: {
195
- left: 0,
196
- top: 0,
197
- right: 0,
198
- bottom: 0
199
- },
200
- pageRanges: "1",
201
- printBackground: true,
202
- preferCSSPageSize: true
203
- });
204
- buffers.push(pdf);
205
- };
206
- let idx = 0;
207
- for (const i of pages) {
208
- await genPageWithClicks(genPdfBuffer, i);
209
- progress.update(++idx);
210
- }
211
- const mergedPdf = await _pdflib.PDFDocument.create({});
212
- for (const pdfBytes of buffers) {
213
- const pdf = await _pdflib.PDFDocument.load(pdfBytes);
214
- const copiedPages = await mergedPdf.copyPages(pdf, pdf.getPageIndices());
215
- copiedPages.forEach((page2) => {
216
- mergedPdf.addPage(page2);
217
- });
218
- }
219
- const buffer = await mergedPdf.save();
220
- await _fsextra2.default.writeFile(output, buffer);
221
- }
222
- async function genPagePdfOnePiece() {
223
- await go("print");
224
- const slideIndexes = await getSlidesIndex();
225
- await page.pdf({
226
- path: output,
227
- width,
228
- height,
229
- margin: {
230
- left: 0,
231
- top: 0,
232
- right: 0,
233
- bottom: 0
234
- },
235
- printBackground: true,
236
- preferCSSPageSize: true
237
- });
238
- let pdfData = await _fsextra2.default.readFile(output);
239
- let pdf = await _pdflib.PDFDocument.load(pdfData);
240
- const titleSlide = slides[0];
241
- if (_optionalChain([titleSlide, 'optionalAccess', _8 => _8.title]))
242
- pdf.setTitle(titleSlide.title);
243
- if (_optionalChain([titleSlide, 'optionalAccess', _9 => _9.frontmatter, 'optionalAccess', _10 => _10.info]))
244
- pdf.setSubject(titleSlide.frontmatter.info);
245
- if (_optionalChain([titleSlide, 'optionalAccess', _11 => _11.frontmatter, 'optionalAccess', _12 => _12.author]))
246
- pdf.setAuthor(titleSlide.frontmatter.author);
247
- if (_optionalChain([titleSlide, 'optionalAccess', _13 => _13.frontmatter, 'optionalAccess', _14 => _14.keywords])) {
248
- if (Array.isArray(_optionalChain([titleSlide, 'optionalAccess', _15 => _15.frontmatter, 'optionalAccess', _16 => _16.keywords])))
249
- pdf.setKeywords(_optionalChain([titleSlide, 'optionalAccess', _17 => _17.frontmatter, 'optionalAccess', _18 => _18.keywords]));
250
- else
251
- pdf.setKeywords(_optionalChain([titleSlide, 'optionalAccess', _19 => _19.frontmatter, 'optionalAccess', _20 => _20.keywords, 'access', _21 => _21.split, 'call', _22 => _22(",")]));
252
- }
253
- if (withToc) {
254
- const outlinePdf = _outlinepdf.outlinePdfFactory.call(void 0, pdfLib);
255
- const tocTree = slides.filter((slide) => slide.title).reduce((acc, slide) => {
256
- addToTree(acc, slide, slideIndexes);
257
- return acc;
258
- }, []);
259
- const outline = makeOutline(tocTree);
260
- pdf = await outlinePdf({ outline, pdf });
261
- }
262
- pdfData = _buffer.Buffer.from(await pdf.save());
263
- await _fsextra2.default.writeFile(output, pdfData);
264
- }
265
- async function genPagePngOnePiece() {
266
- await go("print");
267
- await _fsextra2.default.emptyDir(output);
268
- const slides2 = await page.locator(".print-slide-container");
269
- const count = await slides2.count();
270
- for (let i = 0; i < count; i++) {
271
- progress.update(i + 1);
272
- let id = await slides2.nth(i).getAttribute("id") || "";
273
- id = withClicks ? id : id.split("-")[0];
274
- const buffer = await slides2.nth(i).screenshot();
275
- await _fsextra2.default.writeFile(_path2.default.join(output, `${id}.png`), buffer);
276
- }
277
- }
278
- async function genPagePngPerSlide() {
279
- const genScreenshot = async (i, clicks) => {
280
- await go(i, clicks);
281
- await page.screenshot({
282
- omitBackground: false,
283
- path: _path2.default.join(
284
- output,
285
- `${i.toString().padStart(2, "0")}${clicks ? `-${clicks}` : ""}.png`
286
- )
287
- });
288
- };
289
- for (const i of pages)
290
- await genPageWithClicks(genScreenshot, i);
291
- }
292
- function genPagePdf() {
293
- if (!output.endsWith(".pdf"))
294
- output = `${output}.pdf`;
295
- return perSlide ? genPagePdfPerSlide() : genPagePdfOnePiece();
296
- }
297
- function genPagePng() {
298
- return perSlide ? genPagePngPerSlide() : genPagePngOnePiece();
299
- }
300
- async function genPageMd(slides2) {
301
- const files = await _fsextra2.default.readdir(output);
302
- const mds = files.map((file, i, files2) => {
303
- const slideIndex = getSlideIndex(file);
304
- const mdImg = `![${_optionalChain([slides2, 'access', _23 => _23[slideIndex], 'optionalAccess', _24 => _24.title])}](./${_path2.default.join(output, file)})
305
-
306
- `;
307
- if ((i + 1 === files2.length || getSlideIndex(files2[i + 1]) !== slideIndex) && _optionalChain([slides2, 'access', _25 => _25[slideIndex], 'optionalAccess', _26 => _26.note]))
308
- return `${mdImg}${_optionalChain([slides2, 'access', _27 => _27[slideIndex], 'optionalAccess', _28 => _28.note])}
309
-
310
- `;
311
- return mdImg;
312
- });
313
- if (!output.endsWith(".md"))
314
- output = `${output}.md`;
315
- await _fsextra2.default.writeFile(output, mds.join(""));
316
- }
317
- function getSlideIndex(file) {
318
- const slideId = file.substring(0, file.indexOf(".")).split("-")[0];
319
- return Number(slideId) - 1;
320
- }
321
- progress.start(pages.length);
322
- if (format === "pdf") {
323
- await genPagePdf();
324
- } else if (format === "png") {
325
- await genPagePng();
326
- } else if (format === "md") {
327
- await genPagePng();
328
- await genPageMd(slides);
329
- } else {
330
- throw new Error(`Unsupported exporting format "${format}"`);
331
- }
332
- progress.stop();
333
- browser.close();
334
- return output;
335
- }
336
- function getExportOptions(args, options, outDir, outFilename) {
337
- const config = {
338
- ...options.data.config.export,
339
- ...args,
340
- withClicks: args["with-clicks"],
341
- executablePath: args["executable-path"],
342
- withToc: args["with-toc"],
343
- perSlide: args["per-slide"]
344
- };
345
- const {
346
- entry,
347
- output,
348
- format,
349
- timeout,
350
- range,
351
- dark,
352
- withClicks,
353
- executablePath,
354
- withToc,
355
- perSlide
356
- } = config;
357
- outFilename = output || options.data.config.exportFilename || outFilename || `${_path2.default.basename(entry, ".md")}-export`;
358
- if (outDir)
359
- outFilename = _path2.default.join(outDir, outFilename);
360
- return {
361
- output: outFilename,
362
- slides: options.data.slides,
363
- total: options.data.slides.length,
364
- range,
365
- format: format || "pdf",
366
- timeout: _nullishCoalesce(timeout, () => ( 3e4)),
367
- dark: dark || options.data.config.colorSchema === "dark",
368
- routerMode: options.data.config.routerMode,
369
- width: options.data.config.canvasWidth,
370
- height: Math.round(options.data.config.canvasWidth / options.data.config.aspectRatio),
371
- withClicks: withClicks || false,
372
- executablePath,
373
- withToc: withToc || false,
374
- perSlide: perSlide || false
375
- };
376
- }
377
-
378
-
379
-
380
-
381
- exports.exportNotes = exportNotes; exports.exportSlides = exportSlides; exports.getExportOptions = getExportOptions;
package/dist/index.d.ts DELETED
@@ -1,100 +0,0 @@
1
- import Vue from '@vitejs/plugin-vue';
2
- import VueJsx from '@vitejs/plugin-vue-jsx';
3
- import Icons from 'unplugin-icons/vite';
4
- import Components from 'unplugin-vue-components/vite';
5
- import Markdown from 'unplugin-vue-markdown/vite';
6
- import WindiCSS from 'vite-plugin-windicss';
7
- import { VitePluginConfig } from 'unocss/vite';
8
- import RemoteAssets from 'vite-plugin-remote-assets';
9
- import ServerRef from 'vite-plugin-vue-server-ref';
10
- import { ArgumentsType } from '@antfu/utils';
11
- import { SlidevMarkdown } from '@slidev/types';
12
- import * as vite from 'vite';
13
- import { InlineConfig, Plugin } from 'vite';
14
- import * as fs from '@slidev/parser/fs';
15
- export { fs as parser };
16
-
17
- interface SlidevEntryOptions {
18
- /**
19
- * Markdown entry
20
- *
21
- * @default 'slides.md'
22
- */
23
- entry?: string;
24
- /**
25
- * Theme id
26
- */
27
- theme?: string;
28
- /**
29
- * Remote password
30
- */
31
- remote?: string;
32
- /**
33
- * Root path
34
- *
35
- * @default process.cwd()
36
- */
37
- userRoot?: string;
38
- /**
39
- * Enable inspect plugin
40
- */
41
- inspect?: boolean;
42
- }
43
- interface ResolvedSlidevOptions {
44
- data: SlidevMarkdown;
45
- entry: string;
46
- userRoot: string;
47
- cliRoot: string;
48
- clientRoot: string;
49
- theme: string;
50
- themeRoots: string[];
51
- addonRoots: string[];
52
- roots: string[];
53
- mode: 'dev' | 'build' | 'export';
54
- remote?: string;
55
- inspect?: boolean;
56
- }
57
- interface SlidevPluginOptions extends SlidevEntryOptions {
58
- vue?: ArgumentsType<typeof Vue>[0];
59
- vuejsx?: ArgumentsType<typeof VueJsx>[0];
60
- markdown?: ArgumentsType<typeof Markdown>[0];
61
- components?: ArgumentsType<typeof Components>[0];
62
- windicss?: ArgumentsType<typeof WindiCSS>[0];
63
- icons?: ArgumentsType<typeof Icons>[0];
64
- remoteAssets?: ArgumentsType<typeof RemoteAssets>[0];
65
- serverRef?: ArgumentsType<typeof ServerRef>[0];
66
- unocss?: VitePluginConfig;
67
- }
68
- interface SlidevServerOptions {
69
- onDataReload?: (newData: SlidevMarkdown, data: SlidevMarkdown) => void;
70
- }
71
- declare function getClientRoot(): string;
72
- declare function getCLIRoot(): string;
73
- declare function isPath(name: string): boolean;
74
- declare function getThemeRoots(name: string, entry: string): string[];
75
- declare function getAddonRoots(addons: string[], entry: string): string[];
76
- declare function getRoot(name: string, entry: string): string;
77
- declare function getUserRoot(options: SlidevEntryOptions): {
78
- entry: string;
79
- userRoot: string;
80
- };
81
- declare function resolveOptions(options: SlidevEntryOptions, mode: ResolvedSlidevOptions['mode'], promptForInstallation?: boolean): Promise<ResolvedSlidevOptions>;
82
-
83
- declare module 'vite' {
84
- interface UserConfig {
85
- /**
86
- * Custom internal plugin options for Slidev (advanced)
87
- *
88
- * @see https://github.com/slidevjs/slidev/blob/main/packages/slidev/node/options.ts#L50
89
- */
90
- slidev?: SlidevPluginOptions;
91
- }
92
- }
93
-
94
- declare function createServer(options: ResolvedSlidevOptions, viteConfig?: InlineConfig, serverOptions?: SlidevServerOptions): Promise<vite.ViteDevServer>;
95
-
96
- declare function ViteSlidevPlugin(options: ResolvedSlidevOptions, pluginOptions: SlidevPluginOptions, serverOptions?: SlidevServerOptions): Promise<Plugin[]>;
97
-
98
- declare function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRoot, roots, data }: ResolvedSlidevOptions, { windicss: windiOptions }: SlidevPluginOptions): Promise<vite.Plugin[]>;
99
-
100
- export { ResolvedSlidevOptions, SlidevEntryOptions, SlidevPluginOptions, SlidevServerOptions, ViteSlidevPlugin, createServer, createWindiCSSPlugin, getAddonRoots, getCLIRoot, getClientRoot, getRoot, getThemeRoots, getUserRoot, isPath, resolveOptions };
package/dist/index.js DELETED
@@ -1,35 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
- var _chunkOW5PGXQSjs = require('./chunk-OW5PGXQS.js');
13
-
14
-
15
- var _chunkCPRFICJ7js = require('./chunk-CPRFICJ7.js');
16
-
17
-
18
- var _chunk6CPLPGEJjs = require('./chunk-6CPLPGEJ.js');
19
- require('./chunk-UWTQKD35.js');
20
- require('./chunk-CGJOXW6I.js');
21
- require('./chunk-YUG22S6W.js');
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
- exports.ViteSlidevPlugin = _chunk6CPLPGEJjs.ViteSlidevPlugin; exports.createServer = _chunkOW5PGXQSjs.createServer; exports.createWindiCSSPlugin = _chunkCPRFICJ7js.createWindiCSSPlugin; exports.getAddonRoots = _chunkOW5PGXQSjs.getAddonRoots; exports.getCLIRoot = _chunkOW5PGXQSjs.getCLIRoot; exports.getClientRoot = _chunkOW5PGXQSjs.getClientRoot; exports.getRoot = _chunkOW5PGXQSjs.getRoot; exports.getThemeRoots = _chunkOW5PGXQSjs.getThemeRoots; exports.getUserRoot = _chunkOW5PGXQSjs.getUserRoot; exports.isPath = _chunkOW5PGXQSjs.isPath; exports.parser = _chunkOW5PGXQSjs.parser; exports.resolveOptions = _chunkOW5PGXQSjs.resolveOptions;
@@ -1,45 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
-
3
- var _chunkUWTQKD35js = require('./chunk-UWTQKD35.js');
4
- require('./chunk-YUG22S6W.js');
5
-
6
- // node/plugins/unocss.ts
7
- var _path = require('path');
8
- var _fs = require('fs');
9
- var _utils = require('@antfu/utils');
10
- var _unocss = require('unocss');
11
- var _jiti = require('jiti'); var _jiti2 = _interopRequireDefault(_jiti);
12
- var _vite = require('unocss/vite'); var _vite2 = _interopRequireDefault(_vite);
13
- async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, userRoot, data }, { unocss: unoOptions = {} }) {
14
- const configFiles = _utils.uniq.call(void 0, [
15
- _path.resolve.call(void 0, userRoot, "uno.config.ts"),
16
- _path.resolve.call(void 0, userRoot, "unocss.config.ts"),
17
- ...themeRoots.map((i) => `${i}/uno.config.ts`),
18
- ...themeRoots.map((i) => `${i}/unocss.config.ts`),
19
- ...addonRoots.map((i) => `${i}/uno.config.ts`),
20
- ...addonRoots.map((i) => `${i}/unocss.config.ts`),
21
- _path.resolve.call(void 0, clientRoot, "uno.config.ts"),
22
- _path.resolve.call(void 0, clientRoot, "unocss.config.ts")
23
- ]).filter((i) => _fs.existsSync.call(void 0, i));
24
- const configs = configFiles.map((i) => {
25
- const loaded = _jiti2.default.call(void 0, __filename)(i);
26
- const config2 = "default" in loaded ? loaded.default : loaded;
27
- return config2;
28
- }).filter(Boolean);
29
- configs.reverse();
30
- let config = _unocss.mergeConfigs.call(void 0, [...configs, unoOptions]);
31
- config = await _chunkUWTQKD35js.loadSetups.call(void 0, roots, "unocss.ts", {}, config, (a, b) => _unocss.mergeConfigs.call(void 0, [a, b]));
32
- config.theme ||= {};
33
- config.theme.fontFamily ||= {};
34
- config.theme.fontFamily.sans ||= data.config.fonts.sans.join(",");
35
- config.theme.fontFamily.mono ||= data.config.fonts.mono.join(",");
36
- config.theme.fontFamily.serif ||= data.config.fonts.serif.join(",");
37
- return _vite2.default.call(void 0, {
38
- configFile: false,
39
- configDeps: configFiles,
40
- ...config
41
- });
42
- }
43
-
44
-
45
- exports.createUnocssPlugin = createUnocssPlugin;
@@ -1,9 +0,0 @@
1
- import {
2
- createWindiCSSPlugin
3
- } from "./chunk-PZQGSMNY.mjs";
4
- import "./chunk-43ON36K4.mjs";
5
- import "./chunk-CPYGYVJ2.mjs";
6
- import "./chunk-QHOBBTS4.mjs";
7
- export {
8
- createWindiCSSPlugin
9
- };
@@ -1,9 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkCPRFICJ7js = require('./chunk-CPRFICJ7.js');
4
- require('./chunk-UWTQKD35.js');
5
- require('./chunk-CGJOXW6I.js');
6
- require('./chunk-YUG22S6W.js');
7
-
8
-
9
- exports.createWindiCSSPlugin = _chunkCPRFICJ7js.createWindiCSSPlugin;