@slidev/cli 0.47.0 → 0.47.1

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,9 +2,9 @@ import {
2
2
  ViteSlidevPlugin,
3
3
  getIndexHtml,
4
4
  mergeViteConfigs
5
- } from "./chunk-F4EYMCDV.mjs";
5
+ } from "./chunk-SCUI4URK.mjs";
6
6
  import "./chunk-CTBVOVLQ.mjs";
7
- import "./chunk-LU235VRZ.mjs";
7
+ import "./chunk-O6VUSZMJ.mjs";
8
8
  import "./chunk-BXO7ZPPU.mjs";
9
9
 
10
10
  // node/build.ts
@@ -98,7 +98,7 @@ async function build(options, viteConfig = {}, args) {
98
98
  await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
99
99
  `, "utf-8");
100
100
  if ([true, "true", "auto"].includes(options.data.config.download)) {
101
- const { exportSlides, getExportOptions } = await import("./export-4ZUYYVOP.mjs");
101
+ const { exportSlides, getExportOptions } = await import("./export-DBOVADXI.mjs");
102
102
  const port = 12445;
103
103
  const app = connect();
104
104
  const server = http.createServer(app);
@@ -0,0 +1,72 @@
1
+ // node/utils.ts
2
+ import { join } from "node:path";
3
+ import { createRequire } from "node:module";
4
+ import { fileURLToPath } from "node:url";
5
+ import { ensurePrefix, slash } from "@antfu/utils";
6
+ import isInstalledGlobally from "is-installed-globally";
7
+ import { resolvePath } from "mlly";
8
+ import globalDirs from "global-directory";
9
+ var require2 = createRequire(import.meta.url);
10
+ function toAtFS(path) {
11
+ return `/@fs${ensurePrefix("/", slash(path))}`;
12
+ }
13
+ async function resolveImportPath(importName, ensure = false) {
14
+ try {
15
+ return resolvePath(importName, {
16
+ url: fileURLToPath(import.meta.url)
17
+ });
18
+ } catch {
19
+ }
20
+ if (isInstalledGlobally) {
21
+ try {
22
+ return require2.resolve(join(globalDirs.yarn.packages, importName));
23
+ } catch {
24
+ }
25
+ try {
26
+ return require2.resolve(join(globalDirs.npm.packages, importName));
27
+ } catch {
28
+ }
29
+ }
30
+ if (ensure)
31
+ throw new Error(`Failed to resolve package "${importName}"`);
32
+ return void 0;
33
+ }
34
+ async function resolveGlobalImportPath(importName) {
35
+ try {
36
+ return resolvePath(importName, {
37
+ url: fileURLToPath(import.meta.url)
38
+ });
39
+ } catch {
40
+ }
41
+ try {
42
+ return require2.resolve(join(globalDirs.yarn.packages, importName));
43
+ } catch {
44
+ }
45
+ try {
46
+ return require2.resolve(join(globalDirs.npm.packages, importName));
47
+ } catch {
48
+ }
49
+ throw new Error(`Failed to resolve global package "${importName}"`);
50
+ }
51
+ function stringifyMarkdownTokens(tokens) {
52
+ return tokens.map((token) => token.children?.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ")).filter(Boolean).join(" ");
53
+ }
54
+ function generateGoogleFontsUrl(options) {
55
+ const weights = options.weights.flatMap((i) => options.italic ? [`0,${i}`, `1,${i}`] : [`${i}`]).sort().join(";");
56
+ const fonts = options.webfonts.map((i) => `family=${i.replace(/^(['"])(.*)\1$/, "$1").replace(/\s+/g, "+")}:${options.italic ? "ital," : ""}wght@${weights}`).join("&");
57
+ return `https://fonts.googleapis.com/css2?${fonts}&display=swap`;
58
+ }
59
+ async function packageExists(name) {
60
+ if (await resolveImportPath(`${name}/package.json`))
61
+ return true;
62
+ return false;
63
+ }
64
+
65
+ export {
66
+ toAtFS,
67
+ resolveImportPath,
68
+ resolveGlobalImportPath,
69
+ stringifyMarkdownTokens,
70
+ generateGoogleFontsUrl,
71
+ packageExists
72
+ };
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-F4EYMCDV.mjs";
4
+ } from "./chunk-SCUI4URK.mjs";
5
5
  import {
6
6
  packageExists,
7
7
  resolveImportPath
8
- } from "./chunk-LU235VRZ.mjs";
8
+ } from "./chunk-O6VUSZMJ.mjs";
9
9
  import {
10
10
  __commonJS,
11
11
  __toESM
@@ -2523,7 +2523,7 @@ async function createServer(options2, viteConfig = {}, serverOptions = {}) {
2523
2523
  import * as parser from "@slidev/parser/fs";
2524
2524
 
2525
2525
  // package.json
2526
- var version = "0.47.0";
2526
+ var version = "0.47.1";
2527
2527
 
2528
2528
  // node/themes.ts
2529
2529
  import prompts2 from "prompts";
@@ -7,7 +7,7 @@ import {
7
7
  resolveImportPath,
8
8
  stringifyMarkdownTokens,
9
9
  toAtFS
10
- } from "./chunk-LU235VRZ.mjs";
10
+ } from "./chunk-O6VUSZMJ.mjs";
11
11
 
12
12
  // node/common.ts
13
13
  import { existsSync, promises as fs } from "node:fs";
@@ -134,37 +134,6 @@ import { mergeConfig as mergeConfig2 } from "vite";
134
134
  import isInstalledGlobally from "is-installed-globally";
135
135
  import { uniq as uniq2 } from "@antfu/utils";
136
136
 
137
- // ../client/package.json
138
- var dependencies = {
139
- "@antfu/utils": "^0.7.7",
140
- "@shikijs/vitepress-twoslash": "^1.0.0-beta.3",
141
- "@slidev/parser": "workspace:*",
142
- "@slidev/types": "workspace:*",
143
- "@unhead/vue": "^1.8.10",
144
- "@unocss/reset": "^0.58.4",
145
- "@vueuse/core": "^10.7.2",
146
- "@vueuse/math": "^10.7.2",
147
- "@vueuse/motion": "^2.0.0",
148
- codemirror: "^5.65.5",
149
- defu: "^6.1.4",
150
- drauu: "^0.3.7",
151
- "file-saver": "^2.0.5",
152
- "floating-vue": "^5.2.2",
153
- "fuse.js": "^7.0.0",
154
- "js-base64": "^3.7.6",
155
- "js-yaml": "^4.1.0",
156
- katex: "^0.16.9",
157
- mermaid: "^10.8.0",
158
- "monaco-editor": "^0.37.1",
159
- nanoid: "^5.0.5",
160
- prettier: "^3.2.4",
161
- recordrtc: "^5.6.2",
162
- resolve: "^1.22.8",
163
- unocss: "^0.58.4",
164
- vue: "^3.4.15",
165
- "vue-router": "^4.2.5"
166
- };
167
-
168
137
  // node/vite/searchRoot.ts
169
138
  import fs3 from "node:fs";
170
139
  import { dirname as dirname2, join as join3 } from "node:path";
@@ -242,21 +211,6 @@ function createConfigPlugin(options) {
242
211
  dedupe: ["vue"]
243
212
  },
244
213
  optimizeDeps: {
245
- include: [
246
- ...Object.keys(dependencies).filter((i) => !EXCLUDE.includes(i)),
247
- "codemirror/mode/javascript/javascript",
248
- "codemirror/mode/css/css",
249
- "codemirror/mode/markdown/markdown",
250
- "codemirror/mode/xml/xml",
251
- "codemirror/mode/htmlmixed/htmlmixed",
252
- "codemirror/addon/display/placeholder",
253
- "prettier/plugins/babel",
254
- "prettier/plugins/html",
255
- "prettier/plugins/typescript",
256
- "mermaid/dist/mermaid.esm.min.mjs",
257
- "mermaid/dist/mermaid.esm.mjs",
258
- "vite-plugin-vue-server-ref/client"
259
- ],
260
214
  exclude: EXCLUDE
261
215
  },
262
216
  css: options.data.config.css === "unocss" ? {
package/dist/cli.mjs CHANGED
@@ -9,12 +9,12 @@ import {
9
9
  resolveOptions,
10
10
  resolveThemeName,
11
11
  version
12
- } from "./chunk-33SFA22E.mjs";
13
- import "./chunk-F4EYMCDV.mjs";
12
+ } from "./chunk-R2UPIVJX.mjs";
13
+ import "./chunk-SCUI4URK.mjs";
14
14
  import {
15
15
  loadSetups
16
16
  } from "./chunk-CTBVOVLQ.mjs";
17
- import "./chunk-LU235VRZ.mjs";
17
+ import "./chunk-O6VUSZMJ.mjs";
18
18
  import "./chunk-BXO7ZPPU.mjs";
19
19
 
20
20
  // node/cli.ts
@@ -269,7 +269,7 @@ cli.command(
269
269
  }).strict().help(),
270
270
  async (args) => {
271
271
  const { entry, theme, watch, base, download, out, inspect } = args;
272
- const { build } = await import("./build-7YSBEMD4.mjs");
272
+ const { build } = await import("./build-MGE5JI2Q.mjs");
273
273
  for (const entryFile of entry) {
274
274
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
275
275
  if (download && !options.data.config.download)
@@ -348,7 +348,7 @@ cli.command(
348
348
  async (args) => {
349
349
  const { entry, theme } = args;
350
350
  process.env.NODE_ENV = "production";
351
- const { exportSlides, getExportOptions } = await import("./export-4ZUYYVOP.mjs");
351
+ const { exportSlides, getExportOptions } = await import("./export-DBOVADXI.mjs");
352
352
  const port = await findFreePort(12445);
353
353
  for (const entryFile of entry) {
354
354
  const options = await resolveOptions({ entry: entryFile, theme }, "export");
@@ -394,7 +394,7 @@ cli.command(
394
394
  timeout
395
395
  }) => {
396
396
  process.env.NODE_ENV = "production";
397
- const { exportNotes } = await import("./export-4ZUYYVOP.mjs");
397
+ const { exportNotes } = await import("./export-DBOVADXI.mjs");
398
398
  const port = await findFreePort(12445);
399
399
  for (const entryFile of entry) {
400
400
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  packageExists,
3
3
  resolveGlobalImportPath
4
- } from "./chunk-LU235VRZ.mjs";
4
+ } from "./chunk-O6VUSZMJ.mjs";
5
5
  import "./chunk-BXO7ZPPU.mjs";
6
6
 
7
7
  // node/export.ts
package/dist/index.mjs CHANGED
@@ -9,12 +9,12 @@ import {
9
9
  isPath,
10
10
  parser,
11
11
  resolveOptions
12
- } from "./chunk-33SFA22E.mjs";
12
+ } from "./chunk-R2UPIVJX.mjs";
13
13
  import {
14
14
  ViteSlidevPlugin
15
- } from "./chunk-F4EYMCDV.mjs";
15
+ } from "./chunk-SCUI4URK.mjs";
16
16
  import "./chunk-CTBVOVLQ.mjs";
17
- import "./chunk-LU235VRZ.mjs";
17
+ import "./chunk-O6VUSZMJ.mjs";
18
18
  import "./chunk-BXO7ZPPU.mjs";
19
19
  export {
20
20
  ViteSlidevPlugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.47.0",
3
+ "version": "0.47.1",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -64,7 +64,6 @@
64
64
  "get-port-please": "^3.1.2",
65
65
  "global-directory": "^4.0.1",
66
66
  "htmlparser2": "^9.1.0",
67
- "import-from": "^4.0.0",
68
67
  "is-installed-globally": "^1.0.0",
69
68
  "jiti": "^1.21.0",
70
69
  "js-base64": "^3.7.6",
@@ -76,6 +75,7 @@
76
75
  "markdown-it-footnote": "^4.0.0",
77
76
  "markdown-it-link-attributes": "^4.0.1",
78
77
  "markdown-it-mdc": "^0.2.1",
78
+ "mlly": "^1.5.0",
79
79
  "monaco-editor": "^0.37.1",
80
80
  "nanoid": "^5.0.5",
81
81
  "open": "^10.0.3",
@@ -99,13 +99,13 @@
99
99
  "vite-plugin-inspect": "^0.8.3",
100
100
  "vite-plugin-remote-assets": "^0.4.1",
101
101
  "vite-plugin-static-copy": "^1.0.1",
102
- "vite-plugin-vue-server-ref": "^0.4.0",
102
+ "vite-plugin-vue-server-ref": "^0.4.1",
103
103
  "vitefu": "^0.2.5",
104
104
  "vue": "^3.4.15",
105
105
  "yargs": "^17.7.2",
106
- "@slidev/parser": "0.47.0",
107
- "@slidev/types": "0.47.0",
108
- "@slidev/client": "0.47.0"
106
+ "@slidev/types": "0.47.1",
107
+ "@slidev/parser": "0.47.1",
108
+ "@slidev/client": "0.47.1"
109
109
  },
110
110
  "devDependencies": {
111
111
  "@hedgedoc/markdown-it-plugins": "^2.1.4",