@slidev/cli 0.46.2 → 0.47.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.
- package/dist/{build-IAPZKWXB.mjs → build-7YSBEMD4.mjs} +3 -3
- package/dist/{chunk-EX3A73BD.mjs → chunk-33SFA22E.mjs} +35 -30
- package/dist/{chunk-A2SUQOYQ.mjs → chunk-F4EYMCDV.mjs} +203 -151
- package/dist/chunk-LU235VRZ.mjs +6829 -0
- package/dist/cli.mjs +13 -13
- package/dist/{export-WYWYD5MK.mjs → export-4ZUYYVOP.mjs} +21 -8
- package/dist/index.d.mts +5 -9
- package/dist/index.mjs +3 -7
- package/dist/main-WUYKLJA4.mjs +1563 -0
- package/package.json +20 -23
- package/template.md +1 -1
- package/dist/chunk-5L3XKTHL.mjs +0 -75
- package/dist/chunk-GLZC72RJ.mjs +0 -66
- package/dist/windicss-V4JJMSQI.mjs +0 -9
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
getIndexHtml,
|
|
4
4
|
mergeViteConfigs
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-F4EYMCDV.mjs";
|
|
6
6
|
import "./chunk-CTBVOVLQ.mjs";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-LU235VRZ.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-
|
|
101
|
+
const { exportSlides, getExportOptions } = await import("./export-4ZUYYVOP.mjs");
|
|
102
102
|
const port = 12445;
|
|
103
103
|
const app = connect();
|
|
104
104
|
const server = http.createServer(app);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
mergeViteConfigs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-F4EYMCDV.mjs";
|
|
5
5
|
import {
|
|
6
6
|
packageExists,
|
|
7
7
|
resolveImportPath
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LU235VRZ.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.
|
|
2526
|
+
var version = "0.47.0";
|
|
2527
2527
|
|
|
2528
2528
|
// node/themes.ts
|
|
2529
2529
|
import prompts2 from "prompts";
|
|
@@ -7911,7 +7911,7 @@ var import_semver = __toESM(require_semver2());
|
|
|
7911
7911
|
import fs2 from "fs-extra";
|
|
7912
7912
|
async function getPackageJson(root) {
|
|
7913
7913
|
try {
|
|
7914
|
-
const file = resolveImportPath(`${root}/package.json`, true);
|
|
7914
|
+
const file = await resolveImportPath(`${root}/package.json`, true);
|
|
7915
7915
|
if (file && fs2.existsSync(file))
|
|
7916
7916
|
return await fs2.readJSON(file);
|
|
7917
7917
|
return {};
|
|
@@ -7923,7 +7923,7 @@ async function getAddons(userRoot, config2) {
|
|
|
7923
7923
|
const { slidev = {} } = await getPackageJson(userRoot);
|
|
7924
7924
|
const configAddons = Array.isArray(config2.addons) ? config2.addons : [];
|
|
7925
7925
|
const addons = configAddons.concat(Array.isArray(slidev?.addons) ? slidev.addons : []);
|
|
7926
|
-
return (await getRecursivePlugins(addons.map(resolvePluginName), 3)).filter(Boolean);
|
|
7926
|
+
return (await getRecursivePlugins(await Promise.all(addons.map(resolvePluginName)), 3)).filter(Boolean);
|
|
7927
7927
|
}
|
|
7928
7928
|
async function getRecursivePlugins(addons, depth) {
|
|
7929
7929
|
const addonsArray = await Promise.all(addons.map(async (addon) => {
|
|
@@ -7941,47 +7941,52 @@ async function checkEngine(name, engines) {
|
|
|
7941
7941
|
if (engines.slidev && !(0, import_semver.satisfies)(version, engines.slidev, { includePrerelease: true }))
|
|
7942
7942
|
throw new Error(`[slidev] addon "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
|
|
7943
7943
|
}
|
|
7944
|
-
function resolvePluginName(name) {
|
|
7944
|
+
async function resolvePluginName(name) {
|
|
7945
7945
|
if (!name)
|
|
7946
7946
|
return "";
|
|
7947
7947
|
if (isPath(name))
|
|
7948
7948
|
return name;
|
|
7949
|
-
if (packageExists(`slidev-addon-${name}`))
|
|
7949
|
+
if (await packageExists(`slidev-addon-${name}`))
|
|
7950
7950
|
return `slidev-addon-${name}`;
|
|
7951
7951
|
return name;
|
|
7952
7952
|
}
|
|
7953
7953
|
|
|
7954
7954
|
// node/options.ts
|
|
7955
7955
|
var debug = _debug("slidev:options");
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
return dirname2(resolveImportPath("@slidev/client/package.json", true));
|
|
7956
|
+
async function getClientRoot() {
|
|
7957
|
+
return dirname2(await resolveImportPath("@slidev/client/package.json", true));
|
|
7959
7958
|
}
|
|
7960
7959
|
function getCLIRoot() {
|
|
7961
|
-
return
|
|
7960
|
+
return fileURLToPath2(new URL("..", import.meta.url));
|
|
7962
7961
|
}
|
|
7963
7962
|
function isPath(name) {
|
|
7964
7963
|
return name.startsWith("/") || /^\.\.?[\/\\]/.test(name);
|
|
7965
7964
|
}
|
|
7966
|
-
function getThemeRoots(name, entry) {
|
|
7965
|
+
async function getThemeRoots(name, entry) {
|
|
7967
7966
|
if (!name)
|
|
7968
7967
|
return [];
|
|
7969
|
-
return [getRoot(name, entry)];
|
|
7968
|
+
return [await getRoot(name, entry)];
|
|
7970
7969
|
}
|
|
7971
|
-
function getAddonRoots(addons, entry) {
|
|
7970
|
+
async function getAddonRoots(addons, entry) {
|
|
7972
7971
|
if (addons.length === 0)
|
|
7973
7972
|
return [];
|
|
7974
|
-
return addons.map((name) => getRoot(name, entry));
|
|
7973
|
+
return await Promise.all(addons.map((name) => getRoot(name, entry)));
|
|
7975
7974
|
}
|
|
7976
|
-
function getRoot(name, entry) {
|
|
7975
|
+
async function getRoot(name, entry) {
|
|
7977
7976
|
if (isPath(name))
|
|
7978
7977
|
return resolve2(dirname2(entry), name);
|
|
7979
|
-
return dirname2(resolveImportPath(`${name}/package.json`, true));
|
|
7978
|
+
return dirname2(await resolveImportPath(`${name}/package.json`, true));
|
|
7980
7979
|
}
|
|
7981
7980
|
function getUserRoot(options2) {
|
|
7982
|
-
const {
|
|
7981
|
+
const {
|
|
7982
|
+
entry: rawEntry = "slides.md",
|
|
7983
|
+
userRoot = process3.cwd()
|
|
7984
|
+
} = options2;
|
|
7983
7985
|
const fullEntry = resolve2(userRoot, rawEntry);
|
|
7984
|
-
return {
|
|
7986
|
+
return {
|
|
7987
|
+
entry: fullEntry,
|
|
7988
|
+
userRoot: dirname2(fullEntry)
|
|
7989
|
+
};
|
|
7985
7990
|
}
|
|
7986
7991
|
async function resolveOptions(options2, mode2, promptForInstallation = true) {
|
|
7987
7992
|
const { remote, inspect } = options2;
|
|
@@ -7990,21 +7995,21 @@ async function resolveOptions(options2, mode2, promptForInstallation = true) {
|
|
|
7990
7995
|
userRoot
|
|
7991
7996
|
} = getUserRoot(options2);
|
|
7992
7997
|
const data = await parser.load(entry);
|
|
7993
|
-
const theme = resolveThemeName(options2.theme || data.config.theme);
|
|
7998
|
+
const theme = await resolveThemeName(options2.theme || data.config.theme);
|
|
7994
7999
|
if (promptForInstallation) {
|
|
7995
8000
|
if (await promptForThemeInstallation(theme) === false)
|
|
7996
8001
|
process3.exit(1);
|
|
7997
8002
|
} else {
|
|
7998
|
-
if (!packageExists(theme)) {
|
|
8003
|
+
if (!await packageExists(theme)) {
|
|
7999
8004
|
console.error(`Theme "${theme}" not found, have you installed it?`);
|
|
8000
8005
|
process3.exit(1);
|
|
8001
8006
|
}
|
|
8002
8007
|
}
|
|
8003
|
-
const clientRoot = getClientRoot();
|
|
8008
|
+
const clientRoot = await getClientRoot();
|
|
8004
8009
|
const cliRoot = getCLIRoot();
|
|
8005
|
-
const themeRoots = getThemeRoots(theme, entry);
|
|
8010
|
+
const themeRoots = await getThemeRoots(theme, entry);
|
|
8006
8011
|
const addons = await getAddons(userRoot, data.config);
|
|
8007
|
-
const addonRoots = getAddonRoots(addons, entry);
|
|
8012
|
+
const addonRoots = await getAddonRoots(addons, entry);
|
|
8008
8013
|
const roots = uniq([clientRoot, ...themeRoots, ...addonRoots, userRoot]);
|
|
8009
8014
|
if (themeRoots.length) {
|
|
8010
8015
|
const themeMeta = await getThemeMeta(theme, join3(themeRoots[0], "package.json"));
|
|
@@ -8061,18 +8066,18 @@ async function getThemeMeta(name, path2) {
|
|
|
8061
8066
|
}
|
|
8062
8067
|
return void 0;
|
|
8063
8068
|
}
|
|
8064
|
-
function resolveThemeName(name) {
|
|
8069
|
+
async function resolveThemeName(name) {
|
|
8065
8070
|
if (!name || name === "none")
|
|
8066
8071
|
return "";
|
|
8067
8072
|
if (name.startsWith("@slidev/theme-") || name.startsWith("slidev-theme-"))
|
|
8068
8073
|
return name;
|
|
8069
8074
|
if (isPath(name))
|
|
8070
8075
|
return name;
|
|
8071
|
-
if (packageExists(`@slidev/theme-${name}`))
|
|
8076
|
+
if (await packageExists(`@slidev/theme-${name}`))
|
|
8072
8077
|
return `@slidev/theme-${name}`;
|
|
8073
|
-
if (packageExists(`slidev-theme-${name}`))
|
|
8078
|
+
if (await packageExists(`slidev-theme-${name}`))
|
|
8074
8079
|
return `slidev-theme-${name}`;
|
|
8075
|
-
if (packageExists(name))
|
|
8080
|
+
if (await packageExists(name))
|
|
8076
8081
|
return name;
|
|
8077
8082
|
if (officialThemes[name] != null)
|
|
8078
8083
|
return officialThemes[name];
|
|
@@ -8081,10 +8086,10 @@ function resolveThemeName(name) {
|
|
|
8081
8086
|
return `slidev-theme-${name}`;
|
|
8082
8087
|
}
|
|
8083
8088
|
async function promptForThemeInstallation(name) {
|
|
8084
|
-
name = resolveThemeName(name);
|
|
8089
|
+
name = await resolveThemeName(name);
|
|
8085
8090
|
if (!name)
|
|
8086
8091
|
return name;
|
|
8087
|
-
if (isPath(name) || packageExists(name))
|
|
8092
|
+
if (isPath(name) || await packageExists(name))
|
|
8088
8093
|
return name;
|
|
8089
8094
|
const { confirm: confirm2 } = await prompts2({
|
|
8090
8095
|
name: "confirm",
|