@slidev/cli 0.44.0 → 0.46.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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-WSLI6C3D.mjs";
4
+ } from "./chunk-HJK7CHXL.mjs";
5
5
  import {
6
6
  packageExists,
7
7
  resolveImportPath
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  __commonJS,
11
11
  __toESM
12
- } from "./chunk-65ITIFTL.mjs";
12
+ } from "./chunk-BXO7ZPPU.mjs";
13
13
 
14
14
  // ../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/internal/constants.js
15
15
  var require_constants = __commonJS({
@@ -2490,26 +2490,30 @@ var require_semver2 = __commonJS({
2490
2490
  // node/server.ts
2491
2491
  import { join } from "node:path";
2492
2492
  import process2 from "node:process";
2493
- import { createServer as createViteServer, resolveConfig } from "vite";
2493
+ import { createServer as createViteServer, mergeConfig } from "vite";
2494
2494
  async function createServer(options2, viteConfig = {}, serverOptions = {}) {
2495
- const rawConfig = await resolveConfig({}, "serve", options2.entry);
2496
- const pluginOptions = rawConfig.slidev || {};
2497
2495
  process2.env.EDITOR = process2.env.EDITOR || "code";
2496
+ const config2 = await mergeViteConfigs(
2497
+ options2,
2498
+ viteConfig,
2499
+ {
2500
+ root: options2.userRoot,
2501
+ optimizeDeps: {
2502
+ entries: [
2503
+ join(options2.clientRoot, "main.ts")
2504
+ ]
2505
+ }
2506
+ },
2507
+ "serve"
2508
+ );
2498
2509
  const server = await createViteServer(
2499
- await mergeViteConfigs(
2500
- options2,
2501
- viteConfig,
2510
+ mergeConfig(
2511
+ config2,
2502
2512
  {
2503
- optimizeDeps: {
2504
- entries: [
2505
- join(options2.clientRoot, "main.ts")
2506
- ]
2507
- },
2508
2513
  plugins: [
2509
- await ViteSlidevPlugin(options2, pluginOptions, serverOptions)
2514
+ await ViteSlidevPlugin(options2, config2.slidev || {}, serverOptions)
2510
2515
  ]
2511
- },
2512
- "serve"
2516
+ }
2513
2517
  )
2514
2518
  );
2515
2519
  return server;
@@ -2519,12 +2523,12 @@ async function createServer(options2, viteConfig = {}, serverOptions = {}) {
2519
2523
  import * as parser from "@slidev/parser/fs";
2520
2524
 
2521
2525
  // package.json
2522
- var version = "0.44.0";
2526
+ var version = "0.46.0";
2523
2527
 
2524
2528
  // node/themes.ts
2525
2529
  import prompts2 from "prompts";
2526
2530
 
2527
- // ../../node_modules/.pnpm/@antfu+ni@0.21.9/node_modules/@antfu/ni/dist/shared/ni.d43835c0.mjs
2531
+ // ../../node_modules/.pnpm/@antfu+ni@0.21.12/node_modules/@antfu/ni/dist/shared/ni.f699cf8a.mjs
2528
2532
  import fs$1, { createWriteStream, createReadStream, promises, existsSync } from "node:fs";
2529
2533
  import path$3, { join as join$1, dirname, resolve } from "node:path";
2530
2534
  import process$2 from "node:process";
@@ -4480,8 +4484,8 @@ var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBu
4480
4484
  ]);
4481
4485
  }
4482
4486
  };
4483
- var nativePromisePrototype = (/* @__PURE__ */ (async () => {
4484
- })()).constructor.prototype;
4487
+ var nativePromisePrototype = (async () => {
4488
+ })().constructor.prototype;
4485
4489
  var descriptors = ["then", "catch", "finally"].map((property) => [
4486
4490
  property,
4487
4491
  Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
@@ -4806,12 +4810,12 @@ var typeMappings = {
4806
4810
  file: "isFile"
4807
4811
  };
4808
4812
  function checkType(type) {
4809
- if (type in typeMappings) {
4813
+ if (Object.hasOwnProperty.call(typeMappings, type)) {
4810
4814
  return;
4811
4815
  }
4812
4816
  throw new Error(`Invalid type specified: ${type}`);
4813
4817
  }
4814
- var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
4818
+ var matchType = (type, stat) => stat[typeMappings[type]]();
4815
4819
  var toPath$1 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
4816
4820
  async function locatePath(paths, {
4817
4821
  cwd = process$2.cwd(),
@@ -7611,14 +7615,16 @@ async function detect({ autoInstall, programmatic, cwd } = {}) {
7611
7615
  if (typeof pkg.packageManager === "string") {
7612
7616
  const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
7613
7617
  version3 = ver;
7614
- if (name === "yarn" && Number.parseInt(ver) > 1)
7618
+ if (name === "yarn" && Number.parseInt(ver) > 1) {
7615
7619
  agent = "yarn@berry";
7616
- else if (name === "pnpm" && Number.parseInt(ver) < 7)
7620
+ version3 = "berry";
7621
+ } else if (name === "pnpm" && Number.parseInt(ver) < 7) {
7617
7622
  agent = "pnpm@6";
7618
- else if (name in AGENTS)
7623
+ } else if (name in AGENTS) {
7619
7624
  agent = name;
7620
- else if (!programmatic)
7625
+ } else if (!programmatic) {
7621
7626
  console.warn("[ni] Unknown packageManager:", pkg.packageManager);
7627
+ }
7622
7628
  }
7623
7629
  } catch {
7624
7630
  }
@@ -7640,7 +7646,7 @@ async function detect({ autoInstall, programmatic, cwd } = {}) {
7640
7646
  if (!tryInstall)
7641
7647
  process$2.exit(1);
7642
7648
  }
7643
- await execaCommand(`npm i -g ${agent}${version3 ? `@${version3}` : ""}`, { stdio: "inherit", cwd });
7649
+ await execaCommand(`npm i -g ${agent.split("@")[0]}${version3 ? `@${version3}` : ""}`, { stdio: "inherit", cwd });
7644
7650
  }
7645
7651
  return agent;
7646
7652
  }
@@ -7655,11 +7661,14 @@ var defaultConfig = {
7655
7661
  var config;
7656
7662
  async function getConfig() {
7657
7663
  if (!config) {
7664
+ config = Object.assign(
7665
+ {},
7666
+ defaultConfig,
7667
+ fs$1.existsSync(rcPath) ? ini$1.parse(fs$1.readFileSync(rcPath, "utf-8")) : null
7668
+ );
7658
7669
  const agent = await detect({ programmatic: true });
7659
7670
  if (agent)
7660
- config = { ...defaultConfig, defaultAgent: agent };
7661
- else
7662
- config = Object.assign({}, defaultConfig, ini$1.parse(fs$1.readFileSync(rcPath, "utf-8")));
7671
+ config.defaultAgent = agent;
7663
7672
  }
7664
7673
  return config;
7665
7674
  }
@@ -7801,7 +7810,7 @@ function init(open, close) {
7801
7810
  return txt === void 0 ? chain([open], [blk]) : $.enabled ? run$1([blk], txt + "") : txt + "";
7802
7811
  };
7803
7812
  }
7804
- var version2 = "0.21.9";
7813
+ var version2 = "0.21.12";
7805
7814
  var DEBUG_SIGN = "?";
7806
7815
  async function getCliCommand(fn, args, options2 = {}, cwd = options2.cwd ?? process$2.cwd()) {
7807
7816
  const isGlobal = args.includes("-g");
package/dist/cli.d.mts CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export { }
2
+ export { }
package/dist/cli.mjs CHANGED
@@ -9,20 +9,15 @@ import {
9
9
  resolveOptions,
10
10
  resolveThemeName,
11
11
  version
12
- } from "./chunk-BG3X5KM2.mjs";
13
- import {
14
- require_fast_deep_equal
15
- } from "./chunk-WSLI6C3D.mjs";
12
+ } from "./chunk-LJCKPP2I.mjs";
13
+ import "./chunk-HJK7CHXL.mjs";
16
14
  import {
17
15
  loadSetups
18
- } from "./chunk-CYLMMBRG.mjs";
16
+ } from "./chunk-CTBVOVLQ.mjs";
19
17
  import "./chunk-5L3XKTHL.mjs";
20
- import {
21
- __toESM
22
- } from "./chunk-65ITIFTL.mjs";
18
+ import "./chunk-BXO7ZPPU.mjs";
23
19
 
24
20
  // node/cli.ts
25
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
26
21
  import path from "node:path";
27
22
  import os from "node:os";
28
23
  import { exec } from "node:child_process";
@@ -34,6 +29,7 @@ import yargs from "yargs";
34
29
  import prompts from "prompts";
35
30
  import { blue, bold, cyan, dim, gray, green, underline, yellow } from "kolorist";
36
31
  import isInstalledGlobally from "is-installed-globally";
32
+ import equal from "fast-deep-equal";
37
33
  import { verifyConfig } from "@slidev/parser";
38
34
  import { injectPreparserExtensionLoader } from "@slidev/parser/fs";
39
35
  import { checkPort } from "get-port-please";
@@ -125,6 +121,11 @@ cli.command(
125
121
  strictPort: true,
126
122
  open,
127
123
  host: remote !== void 0 ? "0.0.0.0" : "localhost",
124
+ // @ts-expect-error Vite <= 4
125
+ force
126
+ },
127
+ optimizeDeps: {
128
+ // Vite 5
128
129
  force
129
130
  },
130
131
  logLevel: log
@@ -134,7 +135,7 @@ cli.command(
134
135
  if (!theme && resolveThemeName(newData.config.theme) !== resolveThemeName(data.config.theme)) {
135
136
  console.log(yellow("\n restarting on theme change\n"));
136
137
  initServer();
137
- } else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
138
+ } else if (CONFIG_RESTART_FIELDS.some((i) => !equal(newData.config[i], data.config[i]))) {
138
139
  console.log(yellow("\n restarting on config change\n"));
139
140
  initServer();
140
141
  }
@@ -268,7 +269,7 @@ cli.command(
268
269
  }).strict().help(),
269
270
  async (args) => {
270
271
  const { entry, theme, watch, base, download, out, inspect } = args;
271
- const { build } = await import("./build-33WYS4TI.mjs");
272
+ const { build } = await import("./build-YLYTHH42.mjs");
272
273
  for (const entryFile of entry) {
273
274
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
274
275
  if (download && !options.data.config.download)
@@ -347,7 +348,7 @@ cli.command(
347
348
  async (args) => {
348
349
  const { entry, theme } = args;
349
350
  process.env.NODE_ENV = "production";
350
- const { exportSlides, getExportOptions } = await import("./export-LYIOCUF2.mjs");
351
+ const { exportSlides, getExportOptions } = await import("./export-T7HYPK5J.mjs");
351
352
  const port = await findFreePort(12445);
352
353
  for (const entryFile of entry) {
353
354
  const options = await resolveOptions({ entry: entryFile, theme }, "export");
@@ -393,7 +394,7 @@ cli.command(
393
394
  timeout
394
395
  }) => {
395
396
  process.env.NODE_ENV = "production";
396
- const { exportNotes } = await import("./export-LYIOCUF2.mjs");
397
+ const { exportNotes } = await import("./export-T7HYPK5J.mjs");
397
398
  const port = await findFreePort(12445);
398
399
  for (const entryFile of entry) {
399
400
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  packageExists
3
3
  } from "./chunk-5L3XKTHL.mjs";
4
- import "./chunk-65ITIFTL.mjs";
4
+ import "./chunk-BXO7ZPPU.mjs";
5
5
 
6
6
  // node/export.ts
7
7
  import path from "node:path";
package/dist/index.d.mts CHANGED
@@ -95,6 +95,6 @@ declare function createServer(options: ResolvedSlidevOptions, viteConfig?: Inlin
95
95
 
96
96
  declare function ViteSlidevPlugin(options: ResolvedSlidevOptions, pluginOptions: SlidevPluginOptions, serverOptions?: SlidevServerOptions): Promise<Plugin[]>;
97
97
 
98
- declare function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRoot, roots, data }: ResolvedSlidevOptions, { windicss: windiOptions }: SlidevPluginOptions): Promise<vite.Plugin[]>;
98
+ declare function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRoot, roots, data }: ResolvedSlidevOptions, { windicss: windiOptions }: SlidevPluginOptions): Promise<vite.Plugin<any>[]>;
99
99
 
100
- export { ResolvedSlidevOptions, SlidevEntryOptions, SlidevPluginOptions, SlidevServerOptions, ViteSlidevPlugin, createServer, createWindiCSSPlugin, getAddonRoots, getCLIRoot, getClientRoot, getRoot, getThemeRoots, getUserRoot, isPath, resolveOptions };
100
+ export { type ResolvedSlidevOptions, type SlidevEntryOptions, type SlidevPluginOptions, type SlidevServerOptions, ViteSlidevPlugin, createServer, createWindiCSSPlugin, getAddonRoots, getCLIRoot, getClientRoot, getRoot, getThemeRoots, getUserRoot, isPath, resolveOptions };
package/dist/index.mjs CHANGED
@@ -9,16 +9,16 @@ import {
9
9
  isPath,
10
10
  parser,
11
11
  resolveOptions
12
- } from "./chunk-BG3X5KM2.mjs";
12
+ } from "./chunk-LJCKPP2I.mjs";
13
13
  import {
14
14
  createWindiCSSPlugin
15
- } from "./chunk-A7WCFT3T.mjs";
15
+ } from "./chunk-GLZC72RJ.mjs";
16
16
  import {
17
17
  ViteSlidevPlugin
18
- } from "./chunk-WSLI6C3D.mjs";
19
- import "./chunk-CYLMMBRG.mjs";
18
+ } from "./chunk-HJK7CHXL.mjs";
19
+ import "./chunk-CTBVOVLQ.mjs";
20
20
  import "./chunk-5L3XKTHL.mjs";
21
- import "./chunk-65ITIFTL.mjs";
21
+ import "./chunk-BXO7ZPPU.mjs";
22
22
  export {
23
23
  ViteSlidevPlugin,
24
24
  createServer,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadSetups
3
- } from "./chunk-CYLMMBRG.mjs";
4
- import "./chunk-65ITIFTL.mjs";
3
+ } from "./chunk-CTBVOVLQ.mjs";
4
+ import "./chunk-BXO7ZPPU.mjs";
5
5
 
6
6
  // node/plugins/unocss.ts
7
7
  import { resolve } from "node:path";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createWindiCSSPlugin
3
- } from "./chunk-A7WCFT3T.mjs";
4
- import "./chunk-CYLMMBRG.mjs";
3
+ } from "./chunk-GLZC72RJ.mjs";
4
+ import "./chunk-CTBVOVLQ.mjs";
5
5
  import "./chunk-5L3XKTHL.mjs";
6
- import "./chunk-65ITIFTL.mjs";
6
+ import "./chunk-BXO7ZPPU.mjs";
7
7
  export {
8
8
  createWindiCSSPlugin
9
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.44.0",
3
+ "version": "0.46.0",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -42,23 +42,23 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "@antfu/utils": "^0.7.6",
46
- "@hedgedoc/markdown-it-plugins": "^2.1.4",
47
- "@iconify-json/carbon": "^1.1.21",
48
- "@iconify-json/ph": "^1.1.6",
45
+ "@antfu/utils": "^0.7.7",
46
+ "@iconify-json/carbon": "^1.1.26",
47
+ "@iconify-json/ph": "^1.1.9",
49
48
  "@lillallol/outline-pdf": "^4.0.0",
50
49
  "@mrdrogdrog/optional": "^1.2.1",
51
- "@unocss/extractor-mdc": "^0.57.4",
52
- "@unocss/reset": "^0.57.4",
53
- "@vitejs/plugin-vue": "^4.4.1",
54
- "@vitejs/plugin-vue-jsx": "^3.0.2",
55
- "@windicss/config": "^1.9.1",
50
+ "@unocss/extractor-mdc": "^0.58.0",
51
+ "@unocss/reset": "^0.58.0",
52
+ "@vitejs/plugin-vue": "^4.5.2",
53
+ "@vitejs/plugin-vue-jsx": "^3.1.0",
54
+ "@windicss/config": "^1.9.2",
56
55
  "cli-progress": "^3.12.0",
57
56
  "codemirror": "^5.65.5",
58
57
  "connect": "^3.7.0",
59
58
  "debug": "^4.3.4",
59
+ "fast-deep-equal": "^3.1.3",
60
60
  "fast-glob": "^3.3.2",
61
- "fs-extra": "^11.1.1",
61
+ "fs-extra": "^11.2.0",
62
62
  "get-port-please": "^3.1.1",
63
63
  "global-directory": "^4.0.1",
64
64
  "htmlparser2": "^9.0.0",
@@ -68,13 +68,15 @@
68
68
  "js-base64": "^3.7.5",
69
69
  "katex": "^0.16.9",
70
70
  "kolorist": "^1.8.0",
71
+ "local-pkg": "^0.5.0",
71
72
  "localtunnel": "^2.0.2",
72
- "markdown-it": "^13.0.2",
73
- "markdown-it-footnote": "^3.0.3",
73
+ "markdown-it": "^14.0.0",
74
+ "markdown-it-footnote": "^4.0.0",
74
75
  "markdown-it-link-attributes": "^4.0.1",
75
- "markdown-it-mdc": "^0.1.4",
76
+ "markdown-it-mdc": "^0.2.1",
77
+ "markdown-it-shikiji": "^0.8.7",
76
78
  "monaco-editor": "^0.37.1",
77
- "nanoid": "^5.0.3",
79
+ "nanoid": "^5.0.4",
78
80
  "open": "^9.1.0",
79
81
  "pdf-lib": "^1.17.1",
80
82
  "plantuml-encoder": "^1.4.0",
@@ -85,32 +87,33 @@
85
87
  "resolve": "^1.22.8",
86
88
  "resolve-from": "^5.0.0",
87
89
  "resolve-global": "^2.0.0",
88
- "shiki": "npm:shikiji-compat@^0.6.13",
89
- "unocss": "^0.57.4",
90
- "unplugin-icons": "^0.17.4",
91
- "unplugin-vue-components": "^0.25.2",
92
- "unplugin-vue-markdown": "^0.25.1",
90
+ "shiki": "npm:shikiji-compat@^0.8.7",
91
+ "shikiji": "^0.8.7",
92
+ "shikiji-twoslash": "^0.8.7",
93
+ "sirv": "^2.0.3",
94
+ "unocss": "^0.58.0",
95
+ "unplugin-icons": "^0.18.1",
96
+ "unplugin-vue-components": "^0.26.0",
97
+ "unplugin-vue-markdown": "^0.25.2",
93
98
  "uqr": "^0.1.2",
94
- "vite": "^4.5.0",
95
- "vite-plugin-inspect": "^0.7.42",
96
- "vite-plugin-remote-assets": "^0.3.2",
97
- "vite-plugin-static-copy": "^0.17.0",
98
- "vite-plugin-vue-server-ref": "^0.3.4",
99
- "vite-plugin-windicss": "^1.9.1",
99
+ "vite": "^5.0.8",
100
+ "vite-plugin-inspect": "^0.8.1",
101
+ "vite-plugin-remote-assets": "^0.4.0",
102
+ "vite-plugin-static-copy": "^1.0.0",
103
+ "vite-plugin-vue-server-ref": "^0.4.0",
104
+ "vite-plugin-windicss": "^1.9.2",
100
105
  "vitefu": "^0.2.5",
101
- "vue": "^3.3.8",
106
+ "vue": "^3.3.11",
102
107
  "windicss": "^3.5.6",
103
108
  "yargs": "^17.7.2",
104
- "@slidev/client": "0.44.0",
105
- "@slidev/parser": "0.44.0",
106
- "@slidev/types": "0.44.0"
109
+ "@slidev/client": "0.46.0",
110
+ "@slidev/parser": "0.46.0",
111
+ "@slidev/types": "0.46.0"
107
112
  },
108
113
  "devDependencies": {
114
+ "@hedgedoc/markdown-it-plugins": "^2.1.4",
109
115
  "@types/plantuml-encoder": "^1.4.2",
110
- "fast-deep-equal": "^3.1.3",
111
- "local-pkg": "^0.5.0",
112
- "semver": "^7.5.4",
113
- "sirv": "^2.0.3"
116
+ "semver": "^7.5.4"
114
117
  },
115
118
  "scripts": {
116
119
  "build": "rimraf dist && tsup node/index.ts node/cli.ts",
package/template.md CHANGED
@@ -155,7 +155,6 @@ Check out [the guides](https://sli.dev/builtin/components.html) for more.
155
155
  </div>
156
156
  </div>
157
157
 
158
-
159
158
  ---
160
159
  class: px-20
161
160
  ---
@@ -164,7 +163,7 @@ class: px-20
164
163
 
165
164
  Slidev comes with powerful theming support. Themes are able to provide styles, layouts, components, or even configurations for tools. Switching between themes by just **one edit** in your frontmatter:
166
165
 
167
- <div grid="~ cols-2 gap-2" m="-t-2">
166
+ <div grid="~ cols-2 gap-2" m="t-2">
168
167
 
169
168
  ```yaml
170
169
  ---
@@ -319,7 +318,6 @@ C -->|Two| E[Result 2]
319
318
 
320
319
  [Learn More](https://sli.dev/guide/syntax.html#diagrams)
321
320
 
322
-
323
321
  ---
324
322
  layout: center
325
323
  class: text-center