@slidev/cli 52.15.0 → 52.15.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.
@@ -1,5 +1,5 @@
1
1
  import "./resolver-XedCEhxI.mjs";
2
- import { t as resolveViteConfigs } from "./shared-DDjOjYqG.mjs";
2
+ import { t as resolveViteConfigs } from "./shared-ClfjhvJo.mjs";
3
3
  import { join, resolve } from "node:path";
4
4
  import { build as build$1 } from "vite";
5
5
  import { existsSync } from "node:fs";
@@ -53,7 +53,7 @@ async function build(options, viteConfig = {}, args) {
53
53
  dev: true
54
54
  }));
55
55
  server.listen(port);
56
- const { exportSlides } = await import("./export-Dv3OTWhO.mjs");
56
+ const { exportSlides } = await import("./export-DA_9kPXd.mjs");
57
57
  const tempDir = resolve(outDir, "temp");
58
58
  await fs$1.mkdir(tempDir, { recursive: true });
59
59
  await exportSlides({
@@ -94,7 +94,7 @@ async function build(options, viteConfig = {}, args) {
94
94
  "true",
95
95
  "auto"
96
96
  ].includes(options.data.config.download)) {
97
- const { exportSlides, getExportOptions } = await import("./export-Dv3OTWhO.mjs");
97
+ const { exportSlides, getExportOptions } = await import("./export-DA_9kPXd.mjs");
98
98
  const port = 12445;
99
99
  const app = connect();
100
100
  const server = http.createServer(app);
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as resolveEntry, n as getRoots, r as isInstalledGlobally } from "./resolver-XedCEhxI.mjs";
2
- import { a as parser, c as resolveAddons, d as updateFrontmatterPatch, i as resolveOptions, l as version, o as getThemeMeta, s as resolveTheme, u as loadSetups } from "./shared-DDjOjYqG.mjs";
3
- import { t as createServer } from "./serve-BSv6omQ6.mjs";
2
+ import { a as parser, c as resolveAddons, d as updateFrontmatterPatch, i as resolveOptions, l as version, o as getThemeMeta, s as resolveTheme, u as loadSetups } from "./shared-ClfjhvJo.mjs";
3
+ import { t as createServer } from "./serve-CYSWeFFN.mjs";
4
4
  import path from "node:path";
5
5
  import process from "node:process";
6
6
  import fs from "node:fs/promises";
@@ -294,7 +294,7 @@ cli.command("build [entry..]", "Build hostable SPA", (args) => exportOptions(com
294
294
  describe: "enable the inspect plugin for debugging"
295
295
  }).strict().help(), async (args) => {
296
296
  const { entry, theme, base, download, out, inspect, "without-notes": withoutNotes, "router-mode": routerMode } = args;
297
- const { build } = await import("./build-BiWc4dXo.mjs");
297
+ const { build } = await import("./build-yk6Ejluk.mjs");
298
298
  for (const entryFile of entry) {
299
299
  const options = await resolveOptions({
300
300
  entry: entryFile,
@@ -359,7 +359,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
359
359
  });
360
360
  cli.command("export [entry..]", "Export slides to PDF", (args) => exportOptions(commonOptions(args)).strict().help(), async (args) => {
361
361
  const { entry, theme } = args;
362
- const { exportSlides, getExportOptions } = await import("./export-Dv3OTWhO.mjs");
362
+ const { exportSlides, getExportOptions } = await import("./export-DA_9kPXd.mjs");
363
363
  const candidatePort = await getPort(12445);
364
364
  let warned = false;
365
365
  for (const entryFile of entry) {
@@ -411,7 +411,7 @@ cli.command("export-notes [entry..]", "Export slide notes to PDF", (args) => arg
411
411
  type: "number",
412
412
  describe: "wait for the specified ms before exporting"
413
413
  }).strict().help(), async ({ entry, output, timeout, wait }) => {
414
- const { exportNotes } = await import("./export-Dv3OTWhO.mjs");
414
+ const { exportNotes } = await import("./export-DA_9kPXd.mjs");
415
415
  const candidatePort = await getPort(12445);
416
416
  for (const entryFile of entry) {
417
417
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -160,7 +160,7 @@ async function exportSlides({ port = 18724, total = 0, range: range$1, format =
160
160
  }
161
161
  {
162
162
  const frames = page.frames();
163
- await Promise.all(frames.map((frame) => frame.waitForLoadState()));
163
+ await Promise.all(frames.map((frame) => frame.waitForLoadState(void 0, { timeout })));
164
164
  }
165
165
  {
166
166
  const container = slide.locator("#mermaid-rendering-container");
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./resolver-XedCEhxI.mjs";
2
- import { a as parser, i as resolveOptions, n as ViteSlidevPlugin, r as createDataUtils } from "./shared-DDjOjYqG.mjs";
3
- import { t as createServer } from "./serve-BSv6omQ6.mjs";
2
+ import { a as parser, i as resolveOptions, n as ViteSlidevPlugin, r as createDataUtils } from "./shared-ClfjhvJo.mjs";
3
+ import { t as createServer } from "./serve-CYSWeFFN.mjs";
4
4
 
5
5
  export { ViteSlidevPlugin, createDataUtils, createServer, parser, resolveOptions };
@@ -1,4 +1,4 @@
1
- import { t as resolveViteConfigs } from "./shared-DDjOjYqG.mjs";
1
+ import { t as resolveViteConfigs } from "./shared-ClfjhvJo.mjs";
2
2
  import { join } from "node:path";
3
3
  import process from "node:process";
4
4
  import { createServer } from "vite";
@@ -1,6 +1,6 @@
1
1
  import { a as resolveImportPath, c as toAtFS, i as resolveEntry, n as getRoots, o as resolveImportUrl, r as isInstalledGlobally, s as resolveSourceFiles, t as createResolver } from "./resolver-XedCEhxI.mjs";
2
2
  import { builtinModules } from "node:module";
3
- import path, { basename, dirname, join, relative, resolve } from "node:path";
3
+ import path, { basename, dirname, join, relative, resolve, win32 } from "node:path";
4
4
  import { loadConfigFromFile, mergeConfig } from "vite";
5
5
  import MarkdownExit from "markdown-exit";
6
6
  import fs, { existsSync } from "node:fs";
@@ -70,6 +70,7 @@ function MarkdownItLink(md) {
70
70
  const RE_WHITESPACE_ONLY = /^\s*$/;
71
71
  const RE_QUOTED_STRING = /^(['"])(.*)\1$/;
72
72
  const RE_WHITESPACE = /\s+/g;
73
+ const RE_WINDOWS_DRIVE = /^[A-Z]:\//i;
73
74
  let jiti;
74
75
  function loadModule(absolutePath) {
75
76
  jiti ??= createJiti(fileURLToPath(import.meta.url), { moduleCache: false });
@@ -131,11 +132,21 @@ function getBodyJson(req) {
131
132
  });
132
133
  });
133
134
  }
134
- function makeAbsoluteImportGlob(self, globs, options = {}) {
135
- const relativeGlobs = globs.map((glob) => `${slash(relative(self, glob))}`);
135
+ function getImportGlobRelativePath(from, to) {
136
+ const normalizedFrom = slash(from);
137
+ const normalizedTo = slash(to);
138
+ return slash(RE_WINDOWS_DRIVE.test(normalizedFrom) || RE_WINDOWS_DRIVE.test(normalizedTo) ? win32.relative(normalizedFrom, normalizedTo) : relative(normalizedFrom, normalizedTo));
139
+ }
140
+ function makeAbsoluteImportGlob(self, globs, options = {}, baseRoot) {
141
+ const root = baseRoot && globs.some((glob) => RE_WINDOWS_DRIVE.test(slash(glob))) ? baseRoot : void 0;
142
+ const relativeGlobs = globs.map((glob) => {
143
+ const relativeGlob = getImportGlobRelativePath(root ?? self, glob);
144
+ return root && !relativeGlob.startsWith(".") && !RE_WINDOWS_DRIVE.test(relativeGlob) ? `./${relativeGlob}` : relativeGlob;
145
+ });
136
146
  const opts = {
137
147
  eager: true,
138
148
  exhaustive: true,
149
+ ...root ? { base: "/" } : {},
139
150
  ...options
140
151
  };
141
152
  return `import.meta.glob(${JSON.stringify(relativeGlobs)}, ${JSON.stringify(opts)})`;
@@ -522,7 +533,7 @@ function createLayoutWrapperPlugin({ data, utils }) {
522
533
 
523
534
  //#endregion
524
535
  //#region package.json
525
- var version = "52.15.0";
536
+ var version = "52.15.1";
526
537
 
527
538
  //#endregion
528
539
  //#region node/integrations/addons.ts
@@ -1085,13 +1096,13 @@ function MarkdownItKatex(md, options) {
1085
1096
  const id$1 = "/@slidev/conditional-styles";
1086
1097
  const templateConditionalStyles = {
1087
1098
  id: id$1,
1088
- async getContent({ data, roots }) {
1099
+ async getContent({ data, roots, userRoot }) {
1089
1100
  const imports = [];
1090
1101
  for (const root of roots) imports.push(makeAbsoluteImportGlob(id$1, [
1091
1102
  join(root, "styles/index.{ts,js,css}"),
1092
1103
  join(root, "styles.{ts,js,css}"),
1093
1104
  join(root, "style.{ts,js,css}")
1094
- ]));
1105
+ ], {}, userRoot));
1095
1106
  if (data.features.katex) imports.push(`import "${await resolveImportUrl("katex/dist/katex.min.css")}"`);
1096
1107
  return imports.join("\n");
1097
1108
  }
@@ -1150,13 +1161,13 @@ console.warn('/@slidev/titles.md is deprecated, import from #slidev/title-render
1150
1161
  const id = `/@slidev/global-layers`;
1151
1162
  const templateGlobalLayers = {
1152
1163
  id,
1153
- getContent({ roots }) {
1164
+ getContent({ roots, userRoot }) {
1154
1165
  function* getComponent(name, names) {
1155
1166
  yield `const ${name}Components = [\n`;
1156
1167
  for (const root of roots) {
1157
1168
  const globs = names.map((name$1) => join(root, `${name$1}.{ts,js,vue}`));
1158
1169
  yield " Object.values(";
1159
- yield makeAbsoluteImportGlob(id, globs, { import: "default" });
1170
+ yield makeAbsoluteImportGlob(id, globs, { import: "default" }, userRoot);
1160
1171
  yield ")[0],\n";
1161
1172
  }
1162
1173
  yield `].filter(Boolean)\n`;
@@ -1275,9 +1286,9 @@ function createSetupTemplate(name) {
1275
1286
  const id$2 = `/@slidev/setups/${name}`;
1276
1287
  return {
1277
1288
  id: id$2,
1278
- getContent({ roots }) {
1289
+ getContent({ roots, userRoot }) {
1279
1290
  return `export default [${roots.map((root) => {
1280
- return `Object.values(${makeAbsoluteImportGlob(id$2, [join(root, `setup/${name}.{ts,js,mts,mjs}`)], { import: "default" })})[0]`;
1291
+ return `Object.values(${makeAbsoluteImportGlob(id$2, [join(root, `setup/${name}.{ts,js,mts,mjs}`)], { import: "default" }, userRoot)})[0]`;
1281
1292
  }).join(", ")}].filter(Boolean)`;
1282
1293
  }
1283
1294
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
3
  "type": "module",
4
- "version": "52.15.0",
4
+ "version": "52.15.1",
5
5
  "description": "Presentation slides for developers",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -111,9 +111,9 @@
111
111
  "vue": "^3.5.33",
112
112
  "yaml": "^2.8.3",
113
113
  "yargs": "^18.0.0",
114
- "@slidev/client": "52.15.0",
115
- "@slidev/parser": "52.15.0",
116
- "@slidev/types": "52.15.0"
114
+ "@slidev/types": "52.15.1",
115
+ "@slidev/parser": "52.15.1",
116
+ "@slidev/client": "52.15.1"
117
117
  },
118
118
  "devDependencies": {
119
119
  "@hedgedoc/markdown-it-plugins": "^2.1.4",