@slidev/cli 0.48.0-beta.1 → 0.48.0-beta.11

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,155 @@
1
+ import {
2
+ ViteSlidevPlugin,
3
+ checkEngine,
4
+ mergeViteConfigs,
5
+ require_semver,
6
+ version
7
+ } from "./chunk-7HWAUX7C.mjs";
8
+ import {
9
+ createResolver,
10
+ getRoots,
11
+ resolveEntry
12
+ } from "./chunk-7HOZGSL4.mjs";
13
+ import {
14
+ __toESM
15
+ } from "./chunk-BXO7ZPPU.mjs";
16
+
17
+ // node/server.ts
18
+ import { join } from "node:path";
19
+ import process from "node:process";
20
+ import { createServer as createViteServer, mergeConfig } from "vite";
21
+ async function createServer(options, viteConfig = {}, serverOptions = {}) {
22
+ process.env.EDITOR = process.env.EDITOR || "code";
23
+ const config = await mergeViteConfigs(
24
+ options,
25
+ viteConfig,
26
+ {
27
+ root: options.userRoot,
28
+ optimizeDeps: {
29
+ entries: [
30
+ join(options.clientRoot, "main.ts")
31
+ ]
32
+ }
33
+ },
34
+ "serve"
35
+ );
36
+ const server = await createViteServer(
37
+ mergeConfig(
38
+ config,
39
+ {
40
+ plugins: [
41
+ await ViteSlidevPlugin(options, config.slidev || {}, serverOptions)
42
+ ],
43
+ define: {
44
+ // Fixes Vue production mode breaking PDF Export #1245
45
+ __VUE_PROD_DEVTOOLS__: JSON.stringify(true)
46
+ }
47
+ }
48
+ )
49
+ );
50
+ return server;
51
+ }
52
+
53
+ // node/parser.ts
54
+ import * as parser from "@slidev/parser/fs";
55
+
56
+ // node/themes.ts
57
+ var import_semver = __toESM(require_semver());
58
+ import { join as join2 } from "node:path";
59
+ import fs from "fs-extra";
60
+ var officialThemes = {
61
+ "none": "",
62
+ "default": "@slidev/theme-default",
63
+ "seriph": "@slidev/theme-seriph",
64
+ "apple-basic": "@slidev/theme-apple-basic",
65
+ "shibainu": "@slidev/theme-shibainu",
66
+ "bricks": "@slidev/theme-bricks"
67
+ };
68
+ var resolveTheme = createResolver("theme", officialThemes);
69
+ async function getThemeMeta(name, root) {
70
+ const path = join2(root, "package.json");
71
+ if (!fs.existsSync(path))
72
+ return {};
73
+ const { slidev = {}, engines = {} } = await fs.readJSON(path);
74
+ if (engines.slidev && !(0, import_semver.satisfies)(version, engines.slidev, { includePrerelease: true }))
75
+ throw new Error(`[slidev] theme "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
76
+ return slidev;
77
+ }
78
+
79
+ // node/addons.ts
80
+ import { resolve } from "node:path";
81
+ import fs2 from "fs-extra";
82
+ async function resolveAddons(addonsInConfig) {
83
+ const { userRoot, userPkgJson } = await getRoots();
84
+ const resolved = [];
85
+ const resolveAddonNameAndRoot = createResolver("addon", {});
86
+ async function resolveAddon(name, parent) {
87
+ const [, pkgRoot] = await resolveAddonNameAndRoot(name, parent);
88
+ if (!pkgRoot)
89
+ return;
90
+ resolved.push(pkgRoot);
91
+ const { slidev, engines } = await fs2.readJSON(resolve(pkgRoot, "package.json"));
92
+ checkEngine(name, engines);
93
+ if (Array.isArray(slidev?.addons))
94
+ await Promise.all(slidev.addons.map((addon) => resolveAddon(addon, pkgRoot)));
95
+ }
96
+ if (Array.isArray(addonsInConfig))
97
+ await Promise.all(addonsInConfig.map((addon) => resolveAddon(addon, userRoot)));
98
+ if (Array.isArray(userPkgJson.slidev?.addons))
99
+ await Promise.all(userPkgJson.slidev.addons.map((addon) => resolveAddon(addon, userRoot)));
100
+ return resolved;
101
+ }
102
+
103
+ // node/options.ts
104
+ import { uniq } from "@antfu/utils";
105
+ import _debug from "debug";
106
+ var debug = _debug("slidev:options");
107
+ async function resolveOptions(options, mode) {
108
+ const rootsInfo = await getRoots();
109
+ const entry = await resolveEntry(options.entry || "slides.md", rootsInfo);
110
+ const loaded = await parser.load(rootsInfo.userRoot, entry);
111
+ const themeRaw = options.theme || loaded.headmatter.theme || "default";
112
+ const [theme, themeRoot] = await resolveTheme(themeRaw, entry);
113
+ const themeRoots = themeRoot ? [themeRoot] : [];
114
+ const themeMeta = themeRoot ? await getThemeMeta(theme, themeRoot) : void 0;
115
+ const config = parser.resolveConfig(loaded.headmatter, themeMeta, options.entry);
116
+ const addonRoots = await resolveAddons(config.addons);
117
+ const roots = uniq([...themeRoots, ...addonRoots, rootsInfo.userRoot]);
118
+ debug({
119
+ ...rootsInfo,
120
+ ...options,
121
+ config,
122
+ mode,
123
+ entry,
124
+ themeRaw,
125
+ theme,
126
+ themeRoots,
127
+ addonRoots,
128
+ roots
129
+ });
130
+ return {
131
+ ...rootsInfo,
132
+ ...options,
133
+ data: {
134
+ ...loaded,
135
+ config,
136
+ themeMeta
137
+ },
138
+ mode,
139
+ entry,
140
+ themeRaw,
141
+ theme,
142
+ themeRoots,
143
+ addonRoots,
144
+ roots
145
+ };
146
+ }
147
+
148
+ export {
149
+ createServer,
150
+ parser,
151
+ resolveTheme,
152
+ getThemeMeta,
153
+ resolveAddons,
154
+ resolveOptions
155
+ };
@@ -2,29 +2,17 @@
2
2
  import { resolve } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import fs from "fs-extra";
5
- import { isObject } from "@antfu/utils";
5
+ import { deepMergeWithArray } from "@antfu/utils";
6
6
  import jiti from "jiti";
7
- function deepMerge(a, b, rootPath = "") {
8
- a = { ...a };
9
- Object.keys(b).forEach((key) => {
10
- if (isObject(a[key]))
11
- a[key] = deepMerge(a[key], b[key], rootPath ? `${rootPath}.${key}` : key);
12
- else if (Array.isArray(a[key]))
13
- a[key] = [...a[key], ...b[key]];
14
- else
15
- a[key] = b[key];
16
- });
17
- return a;
18
- }
19
- async function loadSetups(roots, name, arg, initial, merge = true) {
7
+ async function loadSetups(clientRoot, roots, name, arg, initial, merge = true) {
20
8
  let returns = initial;
21
- for (const root of roots) {
9
+ for (const root of [clientRoot, ...roots].reverse()) {
22
10
  const path = resolve(root, "setup", name);
23
11
  if (fs.existsSync(path)) {
24
12
  const { default: setup } = jiti(fileURLToPath(import.meta.url))(path);
25
13
  const result = await setup(arg);
26
14
  if (result !== null) {
27
- returns = typeof merge === "function" ? merge(returns, result) : merge ? deepMerge(returns, result) : result;
15
+ returns = typeof merge === "function" ? merge(returns, result) : merge ? deepMergeWithArray(returns, result) : result;
28
16
  }
29
17
  }
30
18
  }
package/dist/cli.mjs CHANGED
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  createServer,
3
- getAddonRoots,
4
- getClientRoot,
5
- getThemeRoots,
6
- getUserRoot,
7
- isPath,
3
+ getThemeMeta,
8
4
  parser,
5
+ resolveAddons,
9
6
  resolveOptions,
10
- resolveThemeName,
7
+ resolveTheme
8
+ } from "./chunk-DFSBG7Q2.mjs";
9
+ import {
11
10
  version
12
- } from "./chunk-MFKPLZWW.mjs";
13
- import "./chunk-JHZKCONU.mjs";
11
+ } from "./chunk-7HWAUX7C.mjs";
14
12
  import {
15
13
  loadSetups
16
- } from "./chunk-CTBVOVLQ.mjs";
17
- import "./chunk-DWXI5WEO.mjs";
14
+ } from "./chunk-O6TYYGU6.mjs";
15
+ import {
16
+ getRoots
17
+ } from "./chunk-7HOZGSL4.mjs";
18
18
  import "./chunk-BXO7ZPPU.mjs";
19
19
 
20
20
  // node/cli.ts
@@ -26,13 +26,13 @@ import process from "node:process";
26
26
  import fs from "fs-extra";
27
27
  import openBrowser from "open";
28
28
  import yargs from "yargs";
29
- import prompts from "prompts";
30
29
  import { blue, bold, cyan, dim, gray, green, underline, yellow } from "kolorist";
31
30
  import isInstalledGlobally from "is-installed-globally";
32
31
  import equal from "fast-deep-equal";
33
32
  import { verifyConfig } from "@slidev/parser";
34
33
  import { injectPreparserExtensionLoader } from "@slidev/parser/fs";
35
- import { checkPort } from "get-port-please";
34
+ import { uniq } from "@antfu/utils";
35
+ import { getPort } from "get-port-please";
36
36
  var CONFIG_RESTART_FIELDS = [
37
37
  "highlighter",
38
38
  "monaco",
@@ -40,20 +40,19 @@ var CONFIG_RESTART_FIELDS = [
40
40
  "fonts",
41
41
  "css",
42
42
  "mdc",
43
- "editor"
43
+ "editor",
44
+ "theme"
44
45
  ];
45
46
  injectPreparserExtensionLoader(async (headmatter, filepath) => {
46
47
  const addons = headmatter?.addons ?? [];
47
- const roots = (
48
- /* uniq */
49
- [
50
- getUserRoot({}).userRoot,
51
- ...await getAddonRoots(addons, ""),
52
- await getClientRoot()
53
- ]
54
- );
48
+ const { clientRoot, userRoot } = await getRoots();
49
+ const roots = uniq([
50
+ clientRoot,
51
+ userRoot,
52
+ ...await resolveAddons(addons)
53
+ ]);
55
54
  const mergeArrays = (a, b) => a.concat(b);
56
- return await loadSetups(roots, "preparser.ts", { filepath, headmatter }, [], mergeArrays);
55
+ return await loadSetups(clientRoot, roots, "preparser.ts", { filepath, headmatter }, [], mergeArrays);
57
56
  });
58
57
  var cli = yargs(process.argv.slice(2)).scriptName("slidev").usage("$0 [args]").version(version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
59
58
  cli.command(
@@ -89,22 +88,12 @@ cli.command(
89
88
  default: false,
90
89
  type: "boolean",
91
90
  describe: "force the optimizer to ignore the cache and re-bundle "
91
+ }).option("bind", {
92
+ type: "string",
93
+ default: "0.0.0.0",
94
+ describe: "specify which IP addresses the server should listen on in remote mode"
92
95
  }).strict().help(),
93
- async ({ entry, theme, port: userPort, open, log, remote, tunnel, force, inspect }) => {
94
- if (!fs.existsSync(entry) && !entry.endsWith(".md"))
95
- entry = `${entry}.md`;
96
- if (!fs.existsSync(entry)) {
97
- const { create } = await prompts({
98
- name: "create",
99
- type: "confirm",
100
- initial: "Y",
101
- message: `Entry file ${yellow(`"${entry}"`)} does not exist, do you want to create it?`
102
- });
103
- if (create)
104
- await fs.copyFile(new URL("../template.md", import.meta.url), entry);
105
- else
106
- process.exit(0);
107
- }
96
+ async ({ entry, theme, port: userPort, open, log, remote, tunnel, force, inspect, bind }) => {
108
97
  let server;
109
98
  let port = 3030;
110
99
  let lastRemoteUrl;
@@ -112,7 +101,13 @@ cli.command(
112
101
  if (server)
113
102
  await server.close();
114
103
  const options = await resolveOptions({ entry, remote, theme, inspect }, "dev");
115
- port = userPort || await findFreePort(3030);
104
+ const host = remote !== void 0 ? bind : "localhost";
105
+ port = userPort || await getPort({
106
+ port: 3030,
107
+ random: false,
108
+ portRange: [3030, 4e3],
109
+ host
110
+ });
116
111
  server = await createServer(
117
112
  options,
118
113
  {
@@ -120,7 +115,7 @@ cli.command(
120
115
  port,
121
116
  strictPort: true,
122
117
  open,
123
- host: remote !== void 0 ? "0.0.0.0" : "localhost",
118
+ host,
124
119
  // @ts-expect-error Vite <= 4
125
120
  force
126
121
  },
@@ -131,14 +126,27 @@ cli.command(
131
126
  logLevel: log
132
127
  },
133
128
  {
134
- async onDataReload(newData, data) {
135
- if (!theme && await resolveThemeName(newData.config.theme) !== await resolveThemeName(data.config.theme)) {
129
+ async loadData() {
130
+ const { data: oldData, entry: entry2 } = options;
131
+ const loaded = await parser.load(options.userRoot, entry2);
132
+ const themeRaw = theme || loaded.headmatter.theme || "default";
133
+ if (options.themeRaw !== themeRaw) {
136
134
  console.log(yellow("\n restarting on theme change\n"));
137
135
  initServer();
138
- } else if (CONFIG_RESTART_FIELDS.some((i) => !equal(newData.config[i], data.config[i]))) {
136
+ return false;
137
+ }
138
+ const themeMeta = options.themeRoots[0] ? await getThemeMeta(themeRaw, options.themeRoots[0]) : void 0;
139
+ const newData = {
140
+ ...loaded,
141
+ themeMeta,
142
+ config: parser.resolveConfig(loaded.headmatter, themeMeta, entry2)
143
+ };
144
+ if (CONFIG_RESTART_FIELDS.some((i) => !equal(newData.config[i], oldData.config[i]))) {
139
145
  console.log(yellow("\n restarting on config change\n"));
140
146
  initServer();
147
+ return false;
141
148
  }
149
+ return newData;
142
150
  }
143
151
  }
144
152
  );
@@ -269,7 +277,7 @@ cli.command(
269
277
  }).strict().help(),
270
278
  async (args) => {
271
279
  const { entry, theme, watch, base, download, out, inspect } = args;
272
- const { build } = await import("./build-M6ETMXB4.mjs");
280
+ const { build } = await import("./build-DTVJA6KF.mjs");
273
281
  for (const entryFile of entry) {
274
282
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
275
283
  if (download && !options.data.config.download)
@@ -291,9 +299,9 @@ cli.command(
291
299
  (args) => commonOptions(args).strict().help(),
292
300
  async ({ entry }) => {
293
301
  for (const entryFile of entry) {
294
- const data = await parser.load(entryFile);
295
- parser.prettify(data);
296
- await parser.save(data);
302
+ const md = await parser.parse(await fs.readFile(entryFile, "utf-8"), entryFile);
303
+ parser.prettify(md);
304
+ await parser.save(md);
297
305
  }
298
306
  }
299
307
  );
@@ -309,30 +317,27 @@ cli.command(
309
317
  default: "theme"
310
318
  }),
311
319
  async ({ entry, dir, theme: themeInput }) => {
312
- const data = await parser.load(entry);
313
- const theme = await resolveThemeName(themeInput || data.config.theme);
314
- if (theme === "none") {
320
+ const roots = await getRoots();
321
+ const data = await parser.load(roots.userRoot, entry);
322
+ const themeRaw = themeInput || data.headmatter.theme || "default";
323
+ if (themeRaw === "none") {
315
324
  console.error('Cannot eject theme "none"');
316
325
  process.exit(1);
317
326
  }
318
- if (isPath(theme)) {
327
+ if ("/.".includes(themeRaw[0]) || themeRaw[0] !== "@" && themeRaw.includes("/")) {
319
328
  console.error("Theme is already ejected");
320
329
  process.exit(1);
321
330
  }
322
- const roots = await getThemeRoots(theme, entry);
323
- if (!roots.length) {
324
- console.error(`Could not find theme "${theme}"`);
325
- process.exit(1);
326
- }
327
- const root = roots[0];
331
+ const [name, root] = await resolveTheme(themeRaw, entry);
328
332
  await fs.copy(root, path.resolve(dir), {
329
333
  filter: (i) => !/node_modules|.git/.test(path.relative(root, i))
330
334
  });
331
335
  const dirPath = `./${dir}`;
332
- data.slides[0].frontmatter.theme = dirPath;
333
- data.slides[0].raw = null;
334
- await parser.save(data);
335
- console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
336
+ const firstSlide = data.entry.slides[0];
337
+ firstSlide.frontmatter.theme = dirPath;
338
+ parser.prettifySlide(firstSlide);
339
+ await parser.save(data.entry);
340
+ console.log(`Theme "${name}" ejected successfully to "${dirPath}"`);
336
341
  }
337
342
  );
338
343
  },
@@ -347,9 +352,8 @@ cli.command(
347
352
  (args) => exportOptions(commonOptions(args)).strict().help(),
348
353
  async (args) => {
349
354
  const { entry, theme } = args;
350
- process.env.NODE_ENV = "production";
351
- const { exportSlides, getExportOptions } = await import("./export-MLH55TH5.mjs");
352
- const port = await findFreePort(12445);
355
+ const { exportSlides, getExportOptions } = await import("./export-SM2ZATWB.mjs");
356
+ const port = await getPort(12445);
353
357
  for (const entryFile of entry) {
354
358
  const options = await resolveOptions({ entry: entryFile, theme }, "export");
355
359
  const server = await createServer(
@@ -361,7 +365,6 @@ cli.command(
361
365
  );
362
366
  await server.listen(port);
363
367
  printInfo(options);
364
- parser.filterDisabled(options.data);
365
368
  const result = await exportSlides({
366
369
  port,
367
370
  ...getExportOptions({ ...args, entry: entryFile }, options)
@@ -393,9 +396,8 @@ cli.command(
393
396
  output,
394
397
  timeout
395
398
  }) => {
396
- process.env.NODE_ENV = "production";
397
- const { exportNotes } = await import("./export-MLH55TH5.mjs");
398
- const port = await findFreePort(12445);
399
+ const { exportNotes } = await import("./export-SM2ZATWB.mjs");
400
+ const port = await getPort(12445);
399
401
  for (const entryFile of entry) {
400
402
  const options = await resolveOptions({ entry: entryFile }, "export");
401
403
  const server = await createServer(
@@ -407,7 +409,6 @@ cli.command(
407
409
  );
408
410
  await server.listen(port);
409
411
  printInfo(options);
410
- parser.filterDisabled(options.data);
411
412
  const result = await exportNotes({
412
413
  port,
413
414
  output: output || (options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${path.basename(entryFile, ".md")}-export-notes`),
@@ -510,8 +511,3 @@ function printInfo(options, port, remote, tunnelUrl, publicIp) {
510
511
  return lastRemoteUrl;
511
512
  }
512
513
  }
513
- async function findFreePort(start) {
514
- if (await checkPort(start) !== false)
515
- return start;
516
- return findFreePort(start + 1);
517
- }
@@ -1,7 +1,6 @@
1
1
  import {
2
- packageExists,
3
- resolveGlobalImportPath
4
- } from "./chunk-DWXI5WEO.mjs";
2
+ getRoots
3
+ } from "./chunk-7HOZGSL4.mjs";
5
4
  import "./chunk-BXO7ZPPU.mjs";
6
5
 
7
6
  // node/export.ts
@@ -14,7 +13,7 @@ import { parseRangeString } from "@slidev/parser/core";
14
13
  import { outlinePdfFactory } from "@lillallol/outline-pdf";
15
14
  import * as pdfLib from "pdf-lib";
16
15
  import { PDFDocument } from "pdf-lib";
17
- import isInstalledGlobally from "is-installed-globally";
16
+ import { resolve } from "mlly";
18
17
  function addToTree(tree, info, slideIndexes, level = 1) {
19
18
  const titleLevel = info.level;
20
19
  if (titleLevel && titleLevel > level && tree.length > 0) {
@@ -384,18 +383,27 @@ function getExportOptions(args, options, outDir, outFilename) {
384
383
  };
385
384
  }
386
385
  async function importPlaywright() {
387
- if (await packageExists("playwright-chromium"))
388
- return await import("playwright-chromium");
389
- let globalPath = isInstalledGlobally ? await resolveGlobalImportPath("playwright-chromium") : void 0;
390
- if (globalPath)
391
- return await import(globalPath);
386
+ const { userRoot, userWorkspaceRoot } = await getRoots();
387
+ try {
388
+ return await import(await resolve("playwright-chromium", { url: userRoot }));
389
+ } catch {
390
+ }
391
+ if (userWorkspaceRoot !== userRoot) {
392
+ try {
393
+ return await import(await resolve("playwright-chromium", { url: userWorkspaceRoot }));
394
+ } catch {
395
+ }
396
+ }
392
397
  const { resolveGlobal } = await import("resolve-global");
393
398
  try {
394
- globalPath = resolveGlobal("playwright-chromium");
399
+ const imported = await import(resolveGlobal("playwright-chromium"));
400
+ return imported.default ?? imported;
401
+ } catch {
402
+ }
403
+ try {
404
+ return await import("playwright-chromium");
395
405
  } catch {
396
406
  }
397
- if (globalPath)
398
- return await import(globalPath);
399
407
  throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
400
408
  }
401
409
  export {
package/dist/index.d.mts CHANGED
@@ -7,12 +7,20 @@ import { VitePluginConfig } from 'unocss/vite';
7
7
  import RemoteAssets from 'vite-plugin-remote-assets';
8
8
  import ServerRef from 'vite-plugin-vue-server-ref';
9
9
  import { ArgumentsType } from '@antfu/utils';
10
- import { SlidevMarkdown } from '@slidev/types';
10
+ import { SlidevData } from '@slidev/types';
11
11
  import * as vite from 'vite';
12
12
  import { InlineConfig, Plugin } from 'vite';
13
13
  import * as fs from '@slidev/parser/fs';
14
14
  export { fs as parser };
15
15
 
16
+ interface RootsInfo {
17
+ cliRoot: string;
18
+ clientRoot: string;
19
+ userRoot: string;
20
+ userPkgJson: Record<string, any>;
21
+ userWorkspaceRoot: string;
22
+ }
23
+
16
24
  interface SlidevEntryOptions {
17
25
  /**
18
26
  * Markdown entry
@@ -28,26 +36,21 @@ interface SlidevEntryOptions {
28
36
  * Remote password
29
37
  */
30
38
  remote?: string;
31
- /**
32
- * Root path
33
- *
34
- * @default process.cwd()
35
- */
36
- userRoot?: string;
37
39
  /**
38
40
  * Enable inspect plugin
39
41
  */
40
42
  inspect?: boolean;
41
43
  }
42
- interface ResolvedSlidevOptions {
43
- data: SlidevMarkdown;
44
+ interface ResolvedSlidevOptions extends RootsInfo {
45
+ data: SlidevData;
44
46
  entry: string;
45
- userRoot: string;
46
- cliRoot: string;
47
- clientRoot: string;
47
+ themeRaw: string;
48
48
  theme: string;
49
49
  themeRoots: string[];
50
50
  addonRoots: string[];
51
+ /**
52
+ * =`[...themeRoots, ...addonRoots, userRoot]` (`clientRoot` excluded)
53
+ */
51
54
  roots: string[];
52
55
  mode: 'dev' | 'build' | 'export';
53
56
  remote?: string;
@@ -64,19 +67,12 @@ interface SlidevPluginOptions extends SlidevEntryOptions {
64
67
  unocss?: VitePluginConfig;
65
68
  }
66
69
  interface SlidevServerOptions {
67
- onDataReload?: (newData: SlidevMarkdown, data: SlidevMarkdown) => void;
70
+ /**
71
+ * @returns `false` if server should be restarted
72
+ */
73
+ loadData?: () => Promise<SlidevData | false>;
68
74
  }
69
- declare function getClientRoot(): Promise<string>;
70
- declare function getCLIRoot(): string;
71
- declare function isPath(name: string): boolean;
72
- declare function getThemeRoots(name: string, entry: string): Promise<string[]>;
73
- declare function getAddonRoots(addons: string[], entry: string): Promise<string[]>;
74
- declare function getRoot(name: string, entry: string): Promise<string>;
75
- declare function getUserRoot(options: SlidevEntryOptions): {
76
- entry: string;
77
- userRoot: string;
78
- };
79
- declare function resolveOptions(options: SlidevEntryOptions, mode: ResolvedSlidevOptions['mode'], promptForInstallation?: boolean): Promise<ResolvedSlidevOptions>;
75
+ declare function resolveOptions(options: SlidevEntryOptions, mode: ResolvedSlidevOptions['mode']): Promise<ResolvedSlidevOptions>;
80
76
 
81
77
  declare module 'vite' {
82
78
  interface UserConfig {
@@ -93,4 +89,4 @@ declare function createServer(options: ResolvedSlidevOptions, viteConfig?: Inlin
93
89
 
94
90
  declare function ViteSlidevPlugin(options: ResolvedSlidevOptions, pluginOptions: SlidevPluginOptions, serverOptions?: SlidevServerOptions): Promise<Plugin[]>;
95
91
 
96
- export { type ResolvedSlidevOptions, type SlidevEntryOptions, type SlidevPluginOptions, type SlidevServerOptions, ViteSlidevPlugin, createServer, getAddonRoots, getCLIRoot, getClientRoot, getRoot, getThemeRoots, getUserRoot, isPath, resolveOptions };
92
+ export { type ResolvedSlidevOptions, type SlidevEntryOptions, type SlidevPluginOptions, type SlidevServerOptions, ViteSlidevPlugin, createServer, resolveOptions };
package/dist/index.mjs CHANGED
@@ -1,31 +1,17 @@
1
1
  import {
2
2
  createServer,
3
- getAddonRoots,
4
- getCLIRoot,
5
- getClientRoot,
6
- getRoot,
7
- getThemeRoots,
8
- getUserRoot,
9
- isPath,
10
3
  parser,
11
4
  resolveOptions
12
- } from "./chunk-MFKPLZWW.mjs";
5
+ } from "./chunk-DFSBG7Q2.mjs";
13
6
  import {
14
7
  ViteSlidevPlugin
15
- } from "./chunk-JHZKCONU.mjs";
16
- import "./chunk-CTBVOVLQ.mjs";
17
- import "./chunk-DWXI5WEO.mjs";
8
+ } from "./chunk-7HWAUX7C.mjs";
9
+ import "./chunk-O6TYYGU6.mjs";
10
+ import "./chunk-7HOZGSL4.mjs";
18
11
  import "./chunk-BXO7ZPPU.mjs";
19
12
  export {
20
13
  ViteSlidevPlugin,
21
14
  createServer,
22
- getAddonRoots,
23
- getCLIRoot,
24
- getClientRoot,
25
- getRoot,
26
- getThemeRoots,
27
- getUserRoot,
28
- isPath,
29
15
  parser,
30
16
  resolveOptions
31
17
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadSetups
3
- } from "./chunk-CTBVOVLQ.mjs";
3
+ } from "./chunk-O6TYYGU6.mjs";
4
4
  import "./chunk-BXO7ZPPU.mjs";
5
5
 
6
6
  // node/plugins/unocss.ts
@@ -11,7 +11,7 @@ import { uniq } from "@antfu/utils";
11
11
  import { mergeConfigs } from "unocss";
12
12
  import jiti from "jiti";
13
13
  import UnoCSS from "unocss/vite";
14
- async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, userRoot, data }, { unocss: unoOptions = {} }) {
14
+ async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, data, userRoot }, { unocss: unoOptions = {} }) {
15
15
  const configFiles = uniq([
16
16
  resolve(userRoot, "uno.config.ts"),
17
17
  resolve(userRoot, "unocss.config.ts"),
@@ -29,7 +29,7 @@ async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, u
29
29
  }).filter(Boolean);
30
30
  configs.reverse();
31
31
  let config = mergeConfigs([...configs, unoOptions]);
32
- config = await loadSetups(roots, "unocss.ts", {}, config, (a, b) => mergeConfigs([a, b]));
32
+ config = await loadSetups(clientRoot, roots, "unocss.ts", {}, config, (a, b) => mergeConfigs([a, b]));
33
33
  config.theme ||= {};
34
34
  config.theme.fontFamily ||= {};
35
35
  config.theme.fontFamily.sans ||= data.config.fonts.sans.join(",");