@slidev/cli 0.46.3 → 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-XIN6SGB6.mjs → build-7YSBEMD4.mjs} +3 -3
- package/dist/{chunk-P5XEHWCU.mjs → chunk-33SFA22E.mjs} +35 -30
- package/dist/{chunk-BDBBIE6Z.mjs → chunk-F4EYMCDV.mjs} +197 -146
- 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 +16 -19
- 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
package/dist/cli.mjs
CHANGED
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
resolveOptions,
|
|
10
10
|
resolveThemeName,
|
|
11
11
|
version
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-33SFA22E.mjs";
|
|
13
|
+
import "./chunk-F4EYMCDV.mjs";
|
|
14
14
|
import {
|
|
15
15
|
loadSetups
|
|
16
16
|
} from "./chunk-CTBVOVLQ.mjs";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-LU235VRZ.mjs";
|
|
18
18
|
import "./chunk-BXO7ZPPU.mjs";
|
|
19
19
|
|
|
20
20
|
// node/cli.ts
|
|
@@ -48,8 +48,8 @@ injectPreparserExtensionLoader(async (headmatter, filepath) => {
|
|
|
48
48
|
/* uniq */
|
|
49
49
|
[
|
|
50
50
|
getUserRoot({}).userRoot,
|
|
51
|
-
...getAddonRoots(addons, ""),
|
|
52
|
-
getClientRoot()
|
|
51
|
+
...await getAddonRoots(addons, ""),
|
|
52
|
+
await getClientRoot()
|
|
53
53
|
]
|
|
54
54
|
);
|
|
55
55
|
const mergeArrays = (a, b) => a.concat(b);
|
|
@@ -101,7 +101,7 @@ cli.command(
|
|
|
101
101
|
message: `Entry file ${yellow(`"${entry}"`)} does not exist, do you want to create it?`
|
|
102
102
|
});
|
|
103
103
|
if (create)
|
|
104
|
-
await fs.copyFile(
|
|
104
|
+
await fs.copyFile(new URL("../template.md", import.meta.url), entry);
|
|
105
105
|
else
|
|
106
106
|
process.exit(0);
|
|
107
107
|
}
|
|
@@ -131,8 +131,8 @@ cli.command(
|
|
|
131
131
|
logLevel: log
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
|
-
onDataReload(newData, data) {
|
|
135
|
-
if (!theme && resolveThemeName(newData.config.theme) !== resolveThemeName(data.config.theme)) {
|
|
134
|
+
async onDataReload(newData, data) {
|
|
135
|
+
if (!theme && await resolveThemeName(newData.config.theme) !== await resolveThemeName(data.config.theme)) {
|
|
136
136
|
console.log(yellow("\n restarting on theme change\n"));
|
|
137
137
|
initServer();
|
|
138
138
|
} else if (CONFIG_RESTART_FIELDS.some((i) => !equal(newData.config[i], data.config[i]))) {
|
|
@@ -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-
|
|
272
|
+
const { build } = await import("./build-7YSBEMD4.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)
|
|
@@ -310,7 +310,7 @@ cli.command(
|
|
|
310
310
|
}),
|
|
311
311
|
async ({ entry, dir, theme: themeInput }) => {
|
|
312
312
|
const data = await parser.load(entry);
|
|
313
|
-
const theme = resolveThemeName(themeInput || data.config.theme);
|
|
313
|
+
const theme = await resolveThemeName(themeInput || data.config.theme);
|
|
314
314
|
if (theme === "none") {
|
|
315
315
|
console.error('Cannot eject theme "none"');
|
|
316
316
|
process.exit(1);
|
|
@@ -319,7 +319,7 @@ cli.command(
|
|
|
319
319
|
console.error("Theme is already ejected");
|
|
320
320
|
process.exit(1);
|
|
321
321
|
}
|
|
322
|
-
const roots = getThemeRoots(theme, entry);
|
|
322
|
+
const roots = await getThemeRoots(theme, entry);
|
|
323
323
|
if (!roots.length) {
|
|
324
324
|
console.error(`Could not find theme "${theme}"`);
|
|
325
325
|
process.exit(1);
|
|
@@ -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-
|
|
351
|
+
const { exportSlides, getExportOptions } = await import("./export-4ZUYYVOP.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-
|
|
397
|
+
const { exportNotes } = await import("./export-4ZUYYVOP.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,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
packageExists
|
|
3
|
-
|
|
2
|
+
packageExists,
|
|
3
|
+
resolveGlobalImportPath
|
|
4
|
+
} from "./chunk-LU235VRZ.mjs";
|
|
4
5
|
import "./chunk-BXO7ZPPU.mjs";
|
|
5
6
|
|
|
6
7
|
// node/export.ts
|
|
@@ -13,6 +14,7 @@ import { parseRangeString } from "@slidev/parser/core";
|
|
|
13
14
|
import { outlinePdfFactory } from "@lillallol/outline-pdf";
|
|
14
15
|
import * as pdfLib from "pdf-lib";
|
|
15
16
|
import { PDFDocument } from "pdf-lib";
|
|
17
|
+
import isInstalledGlobally from "is-installed-globally";
|
|
16
18
|
function addToTree(tree, info, slideIndexes, level = 1) {
|
|
17
19
|
const titleLevel = info.level;
|
|
18
20
|
if (titleLevel && titleLevel > level && tree.length > 0) {
|
|
@@ -74,9 +76,7 @@ async function exportNotes({
|
|
|
74
76
|
output = "notes",
|
|
75
77
|
timeout = 3e4
|
|
76
78
|
}) {
|
|
77
|
-
|
|
78
|
-
throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
|
|
79
|
-
const { chromium } = await import("playwright-chromium");
|
|
79
|
+
const { chromium } = await importPlaywright();
|
|
80
80
|
const browser = await chromium.launch();
|
|
81
81
|
const context = await browser.newContext();
|
|
82
82
|
const page = await context.newPage();
|
|
@@ -120,10 +120,8 @@ async function exportSlides({
|
|
|
120
120
|
withToc = false,
|
|
121
121
|
perSlide = false
|
|
122
122
|
}) {
|
|
123
|
-
if (!packageExists("playwright-chromium"))
|
|
124
|
-
throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
|
|
125
123
|
const pages = parseRangeString(total, range);
|
|
126
|
-
const { chromium } = await
|
|
124
|
+
const { chromium } = await importPlaywright();
|
|
127
125
|
const browser = await chromium.launch({
|
|
128
126
|
executablePath
|
|
129
127
|
});
|
|
@@ -382,6 +380,21 @@ function getExportOptions(args, options, outDir, outFilename) {
|
|
|
382
380
|
perSlide: perSlide || false
|
|
383
381
|
};
|
|
384
382
|
}
|
|
383
|
+
async function importPlaywright() {
|
|
384
|
+
if (await packageExists("playwright-chromium"))
|
|
385
|
+
return await import("playwright-chromium");
|
|
386
|
+
let globalPath = isInstalledGlobally ? await resolveGlobalImportPath("playwright-chromium") : void 0;
|
|
387
|
+
if (globalPath)
|
|
388
|
+
return await import(globalPath);
|
|
389
|
+
const { resolveGlobal } = await import("resolve-global");
|
|
390
|
+
try {
|
|
391
|
+
globalPath = resolveGlobal("playwright-chromium");
|
|
392
|
+
} catch {
|
|
393
|
+
}
|
|
394
|
+
if (globalPath)
|
|
395
|
+
return await import(globalPath);
|
|
396
|
+
throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
|
|
397
|
+
}
|
|
385
398
|
export {
|
|
386
399
|
exportNotes,
|
|
387
400
|
exportSlides,
|
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ import VueJsx from '@vitejs/plugin-vue-jsx';
|
|
|
3
3
|
import Icons from 'unplugin-icons/vite';
|
|
4
4
|
import Components from 'unplugin-vue-components/vite';
|
|
5
5
|
import Markdown from 'unplugin-vue-markdown/vite';
|
|
6
|
-
import WindiCSS from 'vite-plugin-windicss';
|
|
7
6
|
import { VitePluginConfig } from 'unocss/vite';
|
|
8
7
|
import RemoteAssets from 'vite-plugin-remote-assets';
|
|
9
8
|
import ServerRef from 'vite-plugin-vue-server-ref';
|
|
@@ -59,7 +58,6 @@ interface SlidevPluginOptions extends SlidevEntryOptions {
|
|
|
59
58
|
vuejsx?: ArgumentsType<typeof VueJsx>[0];
|
|
60
59
|
markdown?: ArgumentsType<typeof Markdown>[0];
|
|
61
60
|
components?: ArgumentsType<typeof Components>[0];
|
|
62
|
-
windicss?: ArgumentsType<typeof WindiCSS>[0];
|
|
63
61
|
icons?: ArgumentsType<typeof Icons>[0];
|
|
64
62
|
remoteAssets?: ArgumentsType<typeof RemoteAssets>[0];
|
|
65
63
|
serverRef?: ArgumentsType<typeof ServerRef>[0];
|
|
@@ -68,12 +66,12 @@ interface SlidevPluginOptions extends SlidevEntryOptions {
|
|
|
68
66
|
interface SlidevServerOptions {
|
|
69
67
|
onDataReload?: (newData: SlidevMarkdown, data: SlidevMarkdown) => void;
|
|
70
68
|
}
|
|
71
|
-
declare function getClientRoot(): string
|
|
69
|
+
declare function getClientRoot(): Promise<string>;
|
|
72
70
|
declare function getCLIRoot(): string;
|
|
73
71
|
declare function isPath(name: string): boolean;
|
|
74
|
-
declare function getThemeRoots(name: string, entry: string): string[]
|
|
75
|
-
declare function getAddonRoots(addons: string[], entry: string): string[]
|
|
76
|
-
declare function getRoot(name: string, entry: string): string
|
|
72
|
+
declare function getThemeRoots(name: string, entry: string): Promise<string[]>;
|
|
73
|
+
declare function getAddonRoots(addons: string[], entry: string): Promise<string[]>;
|
|
74
|
+
declare function getRoot(name: string, entry: string): Promise<string>;
|
|
77
75
|
declare function getUserRoot(options: SlidevEntryOptions): {
|
|
78
76
|
entry: string;
|
|
79
77
|
userRoot: string;
|
|
@@ -95,6 +93,4 @@ declare function createServer(options: ResolvedSlidevOptions, viteConfig?: Inlin
|
|
|
95
93
|
|
|
96
94
|
declare function ViteSlidevPlugin(options: ResolvedSlidevOptions, pluginOptions: SlidevPluginOptions, serverOptions?: SlidevServerOptions): Promise<Plugin[]>;
|
|
97
95
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
export { type ResolvedSlidevOptions, type SlidevEntryOptions, type SlidevPluginOptions, type SlidevServerOptions, ViteSlidevPlugin, createServer, createWindiCSSPlugin, getAddonRoots, getCLIRoot, getClientRoot, getRoot, getThemeRoots, getUserRoot, isPath, resolveOptions };
|
|
96
|
+
export { type ResolvedSlidevOptions, type SlidevEntryOptions, type SlidevPluginOptions, type SlidevServerOptions, ViteSlidevPlugin, createServer, getAddonRoots, getCLIRoot, getClientRoot, getRoot, getThemeRoots, getUserRoot, isPath, resolveOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -9,20 +9,16 @@ import {
|
|
|
9
9
|
isPath,
|
|
10
10
|
parser,
|
|
11
11
|
resolveOptions
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
createWindiCSSPlugin
|
|
15
|
-
} from "./chunk-GLZC72RJ.mjs";
|
|
12
|
+
} from "./chunk-33SFA22E.mjs";
|
|
16
13
|
import {
|
|
17
14
|
ViteSlidevPlugin
|
|
18
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-F4EYMCDV.mjs";
|
|
19
16
|
import "./chunk-CTBVOVLQ.mjs";
|
|
20
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-LU235VRZ.mjs";
|
|
21
18
|
import "./chunk-BXO7ZPPU.mjs";
|
|
22
19
|
export {
|
|
23
20
|
ViteSlidevPlugin,
|
|
24
21
|
createServer,
|
|
25
|
-
createWindiCSSPlugin,
|
|
26
22
|
getAddonRoots,
|
|
27
23
|
getCLIRoot,
|
|
28
24
|
getClientRoot,
|