@slidev/cli 0.49.0-beta.4 → 0.49.0-beta.5

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,18 +1,18 @@
1
1
  // node/resolver.ts
2
- import { dirname, join, resolve } from "node:path";
2
+ import { dirname, join, relative, resolve } from "node:path";
3
3
  import * as fs from "node:fs";
4
4
  import process from "node:process";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { ensurePrefix, slash } from "@antfu/utils";
7
- import isInstalledGlobally from "is-installed-globally";
8
7
  import { resolveGlobal } from "resolve-global";
9
- import { findDepPkgJsonPath } from "vitefu";
8
+ import { findClosestPkgJsonPath, findDepPkgJsonPath } from "vitefu";
10
9
  import { resolvePath } from "mlly";
11
10
  import globalDirs from "global-directory";
12
11
  import prompts from "prompts";
13
12
  import { parseNi, run } from "@antfu/ni";
14
13
  import { underline, yellow } from "kolorist";
15
14
  var cliRoot = fileURLToPath(new URL("..", import.meta.url));
15
+ var isInstalledGlobally = {};
16
16
  async function resolveImportUrl(id) {
17
17
  return toAtFS(await resolveImportPath(id, true));
18
18
  }
@@ -26,7 +26,7 @@ async function resolveImportPath(importName, ensure = false) {
26
26
  });
27
27
  } catch {
28
28
  }
29
- if (isInstalledGlobally) {
29
+ if (isInstalledGlobally.value) {
30
30
  try {
31
31
  return resolveGlobal(importName);
32
32
  } catch {
@@ -37,7 +37,7 @@ async function resolveImportPath(importName, ensure = false) {
37
37
  }
38
38
  async function findPkgRoot(dep, parent, ensure = false) {
39
39
  const pkgJsonPath = await findDepPkgJsonPath(dep, parent);
40
- const path = pkgJsonPath ? dirname(pkgJsonPath) : isInstalledGlobally ? await findGlobalPkgRoot(dep, false) : void 0;
40
+ const path = pkgJsonPath ? dirname(pkgJsonPath) : isInstalledGlobally.value ? await findGlobalPkgRoot(dep, false) : void 0;
41
41
  if (ensure && !path)
42
42
  throw new Error(`Failed to resolve package "${dep}"`);
43
43
  return path;
@@ -76,11 +76,11 @@ function createResolver(type, officials) {
76
76
  name: "confirm",
77
77
  initial: "Y",
78
78
  type: "confirm",
79
- message: `The ${type} "${pkgName}" was not found ${underline(isInstalledGlobally ? "globally" : "in your project")}, do you want to install it now?`
79
+ message: `The ${type} "${pkgName}" was not found ${underline(isInstalledGlobally.value ? "globally" : "in your project")}, do you want to install it now?`
80
80
  });
81
81
  if (!confirm)
82
82
  process.exit(1);
83
- if (isInstalledGlobally)
83
+ if (isInstalledGlobally.value)
84
84
  await run(parseNi, ["-g", pkgName]);
85
85
  else
86
86
  await run(parseNi, [pkgName]);
@@ -163,10 +163,12 @@ async function getRoots(entry) {
163
163
  return rootsInfo;
164
164
  if (!entry)
165
165
  throw new Error("[slidev] Cannot find roots without entry");
166
- const clientRoot = await findPkgRoot("@slidev/client", cliRoot, true);
167
166
  const userRoot = dirname(entry);
168
- const userPkgJson = getUserPkgJson(userRoot);
169
- const userWorkspaceRoot = searchForWorkspaceRoot(userRoot);
167
+ isInstalledGlobally.value = !/^(\.\.\/)*node_modules\//i.test(slash(relative(userRoot, cliRoot))) || (await import("is-installed-globally")).default;
168
+ const clientRoot = await findPkgRoot("@slidev/client", cliRoot, true);
169
+ const closestPkgRoot = dirname(await findClosestPkgJsonPath(userRoot) || userRoot);
170
+ const userPkgJson = getUserPkgJson(closestPkgRoot);
171
+ const userWorkspaceRoot = searchForWorkspaceRoot(closestPkgRoot);
170
172
  rootsInfo = {
171
173
  cliRoot,
172
174
  clientRoot,
@@ -178,6 +180,7 @@ async function getRoots(entry) {
178
180
  }
179
181
 
180
182
  export {
183
+ isInstalledGlobally,
181
184
  resolveImportUrl,
182
185
  toAtFS,
183
186
  resolveImportPath,
package/dist/cli.mjs CHANGED
@@ -6,15 +6,16 @@ import {
6
6
  resolveOptions,
7
7
  resolveTheme,
8
8
  version
9
- } from "./chunk-DRELQPK4.mjs";
10
- import "./chunk-NZM6E5T7.mjs";
9
+ } from "./chunk-DUS7IVGJ.mjs";
10
+ import "./chunk-NOHNQKED.mjs";
11
11
  import {
12
12
  loadSetups
13
13
  } from "./chunk-LOUKLO2C.mjs";
14
14
  import {
15
15
  getRoots,
16
+ isInstalledGlobally,
16
17
  resolveEntry
17
- } from "./chunk-AQQIBD5X.mjs";
18
+ } from "./chunk-W3YEGN62.mjs";
18
19
  import "./chunk-BXO7ZPPU.mjs";
19
20
 
20
21
  // node/cli.ts
@@ -27,7 +28,6 @@ import fs from "fs-extra";
27
28
  import openBrowser from "open";
28
29
  import yargs from "yargs";
29
30
  import { blue, bold, cyan, dim, gray, green, underline, yellow } from "kolorist";
30
- import isInstalledGlobally from "is-installed-globally";
31
31
  import equal from "fast-deep-equal";
32
32
  import { verifyConfig } from "@slidev/parser";
33
33
  import { injectPreparserExtensionLoader } from "@slidev/parser/fs";
@@ -326,7 +326,7 @@ cli.command(
326
326
  }).strict().help(),
327
327
  async (args) => {
328
328
  const { entry, theme, watch, base, download, out, inspect } = args;
329
- const { build } = await import("./build-ULWOL6YC.mjs");
329
+ const { build } = await import("./build-Q2ZQYXZS.mjs");
330
330
  for (const entryFile of entry) {
331
331
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
332
332
  if (download && !options.data.config.download)
@@ -407,7 +407,7 @@ cli.command(
407
407
  (args) => exportOptions(commonOptions(args)).strict().help(),
408
408
  async (args) => {
409
409
  const { entry, theme } = args;
410
- const { exportSlides, getExportOptions } = await import("./export-OGDZIGG2.mjs");
410
+ const { exportSlides, getExportOptions } = await import("./export-SAGFIALP.mjs");
411
411
  const port = await getPort(12445);
412
412
  for (const entryFile of entry) {
413
413
  const options = await resolveOptions({ entry: entryFile, theme }, "export");
@@ -456,7 +456,7 @@ cli.command(
456
456
  timeout,
457
457
  wait
458
458
  }) => {
459
- const { exportNotes } = await import("./export-OGDZIGG2.mjs");
459
+ const { exportNotes } = await import("./export-SAGFIALP.mjs");
460
460
  const port = await getPort(12445);
461
461
  for (const entryFile of entry) {
462
462
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -536,7 +536,7 @@ function printInfo(options, port, remote, tunnelUrl, publicIp) {
536
536
  console.log();
537
537
  console.log();
538
538
  console.log(` ${cyan("\u25CF") + blue("\u25A0") + yellow("\u25B2")}`);
539
- console.log(`${bold(" Slidev")} ${blue(`v${version}`)} ${isInstalledGlobally ? yellow("(global)") : ""}`);
539
+ console.log(`${bold(" Slidev")} ${blue(`v${version}`)} ${isInstalledGlobally.value ? yellow("(global)") : ""}`);
540
540
  console.log();
541
541
  verifyConfig(options.data.config, options.data.themeMeta, (v) => console.warn(yellow(` ! ${v}`)));
542
542
  console.log(dim(" theme ") + (options.theme ? green(options.theme) : gray("none")));
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getRoots
3
- } from "./chunk-AQQIBD5X.mjs";
3
+ } from "./chunk-W3YEGN62.mjs";
4
4
  import "./chunk-BXO7ZPPU.mjs";
5
5
 
6
6
  // node/commands/export.ts
package/dist/index.mjs CHANGED
@@ -2,12 +2,12 @@ import {
2
2
  createServer,
3
3
  parser,
4
4
  resolveOptions
5
- } from "./chunk-DRELQPK4.mjs";
5
+ } from "./chunk-DUS7IVGJ.mjs";
6
6
  import {
7
7
  ViteSlidevPlugin
8
- } from "./chunk-NZM6E5T7.mjs";
8
+ } from "./chunk-NOHNQKED.mjs";
9
9
  import "./chunk-LOUKLO2C.mjs";
10
- import "./chunk-AQQIBD5X.mjs";
10
+ import "./chunk-W3YEGN62.mjs";
11
11
  import "./chunk-BXO7ZPPU.mjs";
12
12
  export {
13
13
  ViteSlidevPlugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.49.0-beta.4",
3
+ "version": "0.49.0-beta.5",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -44,15 +44,15 @@
44
44
  "dependencies": {
45
45
  "@antfu/ni": "^0.21.12",
46
46
  "@antfu/utils": "^0.7.7",
47
- "@iconify-json/carbon": "^1.1.31",
47
+ "@iconify-json/carbon": "^1.1.32",
48
48
  "@iconify-json/ph": "^1.1.12",
49
49
  "@iconify-json/svg-spinners": "^1.1.2",
50
50
  "@lillallol/outline-pdf": "^4.0.0",
51
- "@shikijs/markdown-it": "^1.3.0",
52
- "@shikijs/twoslash": "^1.3.0",
53
- "@shikijs/vitepress-twoslash": "^1.3.0",
54
- "@unocss/extractor-mdc": "^0.59.3",
55
- "@unocss/reset": "^0.59.3",
51
+ "@shikijs/markdown-it": "^1.4.0",
52
+ "@shikijs/twoslash": "^1.4.0",
53
+ "@shikijs/vitepress-twoslash": "^1.4.0",
54
+ "@unocss/extractor-mdc": "^0.59.4",
55
+ "@unocss/reset": "^0.59.4",
56
56
  "@vitejs/plugin-vue": "^5.0.4",
57
57
  "@vitejs/plugin-vue-jsx": "^3.1.0",
58
58
  "chokidar": "^3.6.0",
@@ -72,14 +72,13 @@
72
72
  "kolorist": "^1.8.0",
73
73
  "local-pkg": "^0.5.0",
74
74
  "lz-string": "^1.5.0",
75
- "magic-string": "^0.30.9",
76
- "magic-string-stack": "^0.1.0",
75
+ "magic-string": "^0.30.10",
76
+ "magic-string-stack": "^0.1.1",
77
77
  "markdown-it": "^14.1.0",
78
78
  "markdown-it-footnote": "^4.0.0",
79
- "markdown-it-link-attributes": "^4.0.1",
80
79
  "markdown-it-mdc": "^0.2.3",
81
- "mlly": "^1.6.1",
82
- "monaco-editor": "^0.47.0",
80
+ "mlly": "^1.7.0",
81
+ "monaco-editor": "^0.48.0",
83
82
  "open": "^10.1.0",
84
83
  "pdf-lib": "^1.17.1",
85
84
  "plantuml-encoder": "^1.4.0",
@@ -90,28 +89,28 @@
90
89
  "resolve-from": "^5.0.0",
91
90
  "resolve-global": "^2.0.0",
92
91
  "semver": "^7.6.0",
93
- "shiki": "^1.3.0",
94
- "shiki-magic-move": "^0.3.6",
92
+ "shiki": "^1.4.0",
93
+ "shiki-magic-move": "^0.3.7",
95
94
  "sirv": "^2.0.4",
96
95
  "source-map-js": "^1.2.0",
97
96
  "typescript": "^5.4.5",
98
- "unocss": "^0.59.3",
99
- "unplugin-icons": "^0.18.5",
100
- "unplugin-vue-components": "^0.26.0",
101
- "unplugin-vue-markdown": "^0.26.1",
97
+ "unocss": "^0.59.4",
98
+ "unplugin-icons": "^0.19.0",
99
+ "unplugin-vue-components": "^0.27.0",
100
+ "unplugin-vue-markdown": "^0.26.2",
102
101
  "untun": "^0.1.3",
103
102
  "uqr": "^0.1.2",
104
- "vite": "^5.2.9",
105
- "vite-plugin-inspect": "^0.8.3",
103
+ "vite": "^5.2.11",
104
+ "vite-plugin-inspect": "^0.8.4",
106
105
  "vite-plugin-remote-assets": "^0.4.1",
107
- "vite-plugin-static-copy": "^1.0.2",
106
+ "vite-plugin-static-copy": "^1.0.4",
108
107
  "vite-plugin-vue-server-ref": "^0.4.2",
109
108
  "vitefu": "^0.2.5",
110
- "vue": "^3.4.22",
109
+ "vue": "^3.4.26",
111
110
  "yargs": "^17.7.2",
112
- "@slidev/client": "0.49.0-beta.4",
113
- "@slidev/parser": "0.49.0-beta.4",
114
- "@slidev/types": "0.49.0-beta.4"
111
+ "@slidev/client": "0.49.0-beta.5",
112
+ "@slidev/types": "0.49.0-beta.5",
113
+ "@slidev/parser": "0.49.0-beta.5"
115
114
  },
116
115
  "devDependencies": {
117
116
  "@hedgedoc/markdown-it-plugins": "^2.1.4",