@slidev/cli 0.48.0-beta.2 → 0.48.0-beta.4

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.
@@ -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
  }
@@ -0,0 +1,155 @@
1
+ import {
2
+ ViteSlidevPlugin,
3
+ checkEngine,
4
+ mergeViteConfigs,
5
+ require_semver,
6
+ version
7
+ } from "./chunk-JNK5R5DL.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
+ };
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-YFMRSFTO.mjs";
9
+ import {
11
10
  version
12
- } from "./chunk-PDMXU2K7.mjs";
13
- import "./chunk-FIXL4WBO.mjs";
11
+ } from "./chunk-JNK5R5DL.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,12 +26,12 @@ 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";
34
+ import { uniq } from "@antfu/utils";
35
35
  import { checkPort } from "get-port-please";
36
36
  var CONFIG_RESTART_FIELDS = [
37
37
  "highlighter",
@@ -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;
@@ -120,7 +109,7 @@ cli.command(
120
109
  port,
121
110
  strictPort: true,
122
111
  open,
123
- host: remote !== void 0 ? "0.0.0.0" : "localhost",
112
+ host: remote !== void 0 ? bind : "localhost",
124
113
  // @ts-expect-error Vite <= 4
125
114
  force
126
115
  },
@@ -131,14 +120,27 @@ cli.command(
131
120
  logLevel: log
132
121
  },
133
122
  {
134
- async onDataReload(newData, data) {
135
- if (!theme && await resolveThemeName(newData.config.theme) !== await resolveThemeName(data.config.theme)) {
123
+ async loadData() {
124
+ const { data: oldData, entry: entry2 } = options;
125
+ const loaded = await parser.load(options.userRoot, entry2);
126
+ const themeRaw = theme || loaded.headmatter.theme || "default";
127
+ if (options.themeRaw !== themeRaw) {
136
128
  console.log(yellow("\n restarting on theme change\n"));
137
129
  initServer();
138
- } else if (CONFIG_RESTART_FIELDS.some((i) => !equal(newData.config[i], data.config[i]))) {
130
+ return false;
131
+ }
132
+ const themeMeta = options.themeRoots[0] ? await getThemeMeta(themeRaw, options.themeRoots[0]) : void 0;
133
+ const newData = {
134
+ ...loaded,
135
+ themeMeta,
136
+ config: parser.resolveConfig(loaded.headmatter, themeMeta, entry2)
137
+ };
138
+ if (CONFIG_RESTART_FIELDS.some((i) => !equal(newData.config[i], oldData.config[i]))) {
139
139
  console.log(yellow("\n restarting on config change\n"));
140
140
  initServer();
141
+ return false;
141
142
  }
143
+ return newData;
142
144
  }
143
145
  }
144
146
  );
@@ -269,7 +271,7 @@ cli.command(
269
271
  }).strict().help(),
270
272
  async (args) => {
271
273
  const { entry, theme, watch, base, download, out, inspect } = args;
272
- const { build } = await import("./build-BVDM4ZAC.mjs");
274
+ const { build } = await import("./build-LWZZ63IN.mjs");
273
275
  for (const entryFile of entry) {
274
276
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
275
277
  if (download && !options.data.config.download)
@@ -291,9 +293,9 @@ cli.command(
291
293
  (args) => commonOptions(args).strict().help(),
292
294
  async ({ entry }) => {
293
295
  for (const entryFile of entry) {
294
- const data = await parser.load(entryFile);
295
- parser.prettify(data);
296
- await parser.save(data);
296
+ const md = await parser.parse(await fs.readFile(entryFile, "utf-8"), entryFile);
297
+ parser.prettify(md);
298
+ await parser.save(md);
297
299
  }
298
300
  }
299
301
  );
@@ -309,30 +311,27 @@ cli.command(
309
311
  default: "theme"
310
312
  }),
311
313
  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") {
314
+ const roots = await getRoots();
315
+ const data = await parser.load(roots.userRoot, entry);
316
+ const themeRaw = themeInput || data.headmatter.theme || "default";
317
+ if (themeRaw === "none") {
315
318
  console.error('Cannot eject theme "none"');
316
319
  process.exit(1);
317
320
  }
318
- if (isPath(theme)) {
321
+ if ("/.".includes(themeRaw[0]) || themeRaw[0] !== "@" && themeRaw.includes("/")) {
319
322
  console.error("Theme is already ejected");
320
323
  process.exit(1);
321
324
  }
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];
325
+ const [name, root] = await resolveTheme(themeRaw, entry);
328
326
  await fs.copy(root, path.resolve(dir), {
329
327
  filter: (i) => !/node_modules|.git/.test(path.relative(root, i))
330
328
  });
331
329
  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}"`);
330
+ const firstSlide = data.entry.slides[0];
331
+ firstSlide.frontmatter.theme = dirPath;
332
+ parser.prettifySlide(firstSlide);
333
+ await parser.save(data.entry);
334
+ console.log(`Theme "${name}" ejected successfully to "${dirPath}"`);
336
335
  }
337
336
  );
338
337
  },
@@ -347,7 +346,7 @@ cli.command(
347
346
  (args) => exportOptions(commonOptions(args)).strict().help(),
348
347
  async (args) => {
349
348
  const { entry, theme } = args;
350
- const { exportSlides, getExportOptions } = await import("./export-MLH55TH5.mjs");
349
+ const { exportSlides, getExportOptions } = await import("./export-SM2ZATWB.mjs");
351
350
  const port = await findFreePort(12445);
352
351
  for (const entryFile of entry) {
353
352
  const options = await resolveOptions({ entry: entryFile, theme }, "export");
@@ -360,7 +359,6 @@ cli.command(
360
359
  );
361
360
  await server.listen(port);
362
361
  printInfo(options);
363
- parser.filterDisabled(options.data);
364
362
  const result = await exportSlides({
365
363
  port,
366
364
  ...getExportOptions({ ...args, entry: entryFile }, options)
@@ -392,7 +390,7 @@ cli.command(
392
390
  output,
393
391
  timeout
394
392
  }) => {
395
- const { exportNotes } = await import("./export-MLH55TH5.mjs");
393
+ const { exportNotes } = await import("./export-SM2ZATWB.mjs");
396
394
  const port = await findFreePort(12445);
397
395
  for (const entryFile of entry) {
398
396
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -405,7 +403,6 @@ cli.command(
405
403
  );
406
404
  await server.listen(port);
407
405
  printInfo(options);
408
- parser.filterDisabled(options.data);
409
406
  const result = await exportNotes({
410
407
  port,
411
408
  output: output || (options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${path.basename(entryFile, ".md")}-export-notes`),
@@ -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-PDMXU2K7.mjs";
5
+ } from "./chunk-YFMRSFTO.mjs";
13
6
  import {
14
7
  ViteSlidevPlugin
15
- } from "./chunk-FIXL4WBO.mjs";
16
- import "./chunk-CTBVOVLQ.mjs";
17
- import "./chunk-DWXI5WEO.mjs";
8
+ } from "./chunk-JNK5R5DL.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(",");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.48.0-beta.2",
3
+ "version": "0.48.0-beta.4",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -47,9 +47,9 @@
47
47
  "@iconify-json/ph": "^1.1.11",
48
48
  "@lillallol/outline-pdf": "^4.0.0",
49
49
  "@mrdrogdrog/optional": "^1.2.1",
50
- "@shikijs/markdown-it": "^1.1.3",
51
- "@shikijs/twoslash": "^1.1.3",
52
- "@shikijs/vitepress-twoslash": "^1.1.3",
50
+ "@shikijs/markdown-it": "^1.1.6",
51
+ "@shikijs/twoslash": "^1.1.6",
52
+ "@shikijs/vitepress-twoslash": "^1.1.6",
53
53
  "@unocss/extractor-mdc": "^0.58.5",
54
54
  "@unocss/reset": "^0.58.5",
55
55
  "@vitejs/plugin-vue": "^5.0.4",
@@ -76,7 +76,7 @@
76
76
  "markdown-it-mdc": "^0.2.3",
77
77
  "mlly": "^1.5.0",
78
78
  "monaco-editor": "^0.37.1",
79
- "nanoid": "^5.0.5",
79
+ "nanoid": "^5.0.6",
80
80
  "open": "^10.0.3",
81
81
  "pdf-lib": "^1.17.1",
82
82
  "plantuml-encoder": "^1.4.0",
@@ -87,7 +87,7 @@
87
87
  "resolve": "^1.22.8",
88
88
  "resolve-from": "^5.0.0",
89
89
  "resolve-global": "^2.0.0",
90
- "shiki": "^1.1.3",
90
+ "shiki": "^1.1.6",
91
91
  "sirv": "^2.0.4",
92
92
  "typescript": "^5.3.3",
93
93
  "unocss": "^0.58.5",
@@ -104,9 +104,9 @@
104
104
  "vitefu": "^0.2.5",
105
105
  "vue": "^3.4.19",
106
106
  "yargs": "^17.7.2",
107
- "@slidev/client": "0.48.0-beta.2",
108
- "@slidev/types": "0.48.0-beta.2",
109
- "@slidev/parser": "0.48.0-beta.2"
107
+ "@slidev/client": "0.48.0-beta.4",
108
+ "@slidev/parser": "0.48.0-beta.4",
109
+ "@slidev/types": "0.48.0-beta.4"
110
110
  },
111
111
  "devDependencies": {
112
112
  "@hedgedoc/markdown-it-plugins": "^2.1.4",