@slidev/cli 0.49.0-beta.4 → 0.49.0-beta.6
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.
- package/dist/{build-ULWOL6YC.mjs → build-4R4CW3SG.mjs} +3 -3
- package/dist/{chunk-AQQIBD5X.mjs → chunk-ALXAQLRA.mjs} +13 -10
- package/dist/{chunk-NZM6E5T7.mjs → chunk-DF3ZEVPQ.mjs} +250 -229
- package/dist/{chunk-DRELQPK4.mjs → chunk-R7SOIPTZ.mjs} +3 -3
- package/dist/cli.mjs +8 -8
- package/dist/{export-OGDZIGG2.mjs → export-D7UWWRHH.mjs} +1 -1
- package/dist/index.mjs +3 -3
- package/package.json +24 -25
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
getIndexHtml,
|
|
4
4
|
mergeViteConfigs
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DF3ZEVPQ.mjs";
|
|
6
6
|
import "./chunk-LOUKLO2C.mjs";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-ALXAQLRA.mjs";
|
|
8
8
|
import "./chunk-BXO7ZPPU.mjs";
|
|
9
9
|
|
|
10
10
|
// node/commands/build.ts
|
|
@@ -63,7 +63,7 @@ async function build(options, viteConfig = {}, args) {
|
|
|
63
63
|
await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
64
64
|
`, "utf-8");
|
|
65
65
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
66
|
-
const { exportSlides, getExportOptions } = await import("./export-
|
|
66
|
+
const { exportSlides, getExportOptions } = await import("./export-D7UWWRHH.mjs");
|
|
67
67
|
const port = 12445;
|
|
68
68
|
const app = connect();
|
|
69
69
|
const server = http.createServer(app);
|
|
@@ -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
|
-
|
|
169
|
-
const
|
|
167
|
+
isInstalledGlobally.value = slash(relative(userRoot, process.argv[1])).includes("/.pnpm/") || (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,
|