@slidev/cli 0.29.2 → 0.30.2

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,16 +1,16 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
3
 
4
- var _chunkNPCPO6ETjs = require('./chunk-NPCPO6ET.js');
4
+ var _chunkRSHUQSN4js = require('./chunk-RSHUQSN4.js');
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunk7QXPSYEZjs = require('./chunk-7QXPSYEZ.js');
10
+ var _chunkIXNT7VMKjs = require('./chunk-IXNT7VMK.js');
11
11
 
12
12
  // node/build.ts
13
- _chunk7QXPSYEZjs.init_cjs_shims.call(void 0, );
13
+ _chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
14
14
  var _path = require('path');
15
15
  var _http = require('http'); var _http2 = _interopRequireDefault(_http);
16
16
  var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
@@ -18,12 +18,12 @@ var _vite = require('vite');
18
18
  var _connect = require('connect'); var _connect2 = _interopRequireDefault(_connect);
19
19
 
20
20
  // ../../node_modules/.pnpm/sirv@2.0.2/node_modules/sirv/build.mjs
21
- _chunk7QXPSYEZjs.init_cjs_shims.call(void 0, );
21
+ _chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
22
22
  var _fs = require('fs'); var fs = _interopRequireWildcard(_fs);
23
23
 
24
24
 
25
25
  // ../../node_modules/.pnpm/totalist@3.0.0/node_modules/totalist/sync/index.mjs
26
- _chunk7QXPSYEZjs.init_cjs_shims.call(void 0, );
26
+ _chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
27
27
 
28
28
 
29
29
  function totalist(dir, callback, pre = "") {
@@ -37,8 +37,8 @@ function totalist(dir, callback, pre = "") {
37
37
  }
38
38
  }
39
39
 
40
- // ../../node_modules/.pnpm/@polka+url@1.0.0-next.20/node_modules/@polka/url/build.mjs
41
- _chunk7QXPSYEZjs.init_cjs_shims.call(void 0, );
40
+ // ../../node_modules/.pnpm/@polka+url@1.0.0-next.21/node_modules/@polka/url/build.mjs
41
+ _chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
42
42
  var _querystring = require('querystring'); var qs = _interopRequireWildcard(_querystring);
43
43
  function parse2(req) {
44
44
  let raw = req.url;
@@ -62,7 +62,7 @@ function parse2(req) {
62
62
  }
63
63
 
64
64
  // ../../node_modules/.pnpm/mrmime@1.0.0/node_modules/mrmime/index.mjs
65
- _chunk7QXPSYEZjs.init_cjs_shims.call(void 0, );
65
+ _chunkIXNT7VMKjs.init_cjs_shims.call(void 0, );
66
66
  var mimes = {
67
67
  "ez": "application/andrew-inset",
68
68
  "aw": "application/applixware",
@@ -527,7 +527,7 @@ function is404(req, res) {
527
527
  }
528
528
  function send(req, res, file, stats, headers) {
529
529
  let code = 200, tmp, opts = {};
530
- headers = _chunk7QXPSYEZjs.__spreadValues.call(void 0, {}, headers);
530
+ headers = _chunkIXNT7VMKjs.__spreadValues.call(void 0, {}, headers);
531
531
  for (let key in headers) {
532
532
  tmp = res.getHeader(key);
533
533
  if (tmp)
@@ -655,12 +655,13 @@ async function build(options, viteConfig = {}) {
655
655
  let originalIndexHTML;
656
656
  if (_fsextra2.default.existsSync(indexPath))
657
657
  originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
658
- await _fsextra2.default.writeFile(indexPath, await _chunkNPCPO6ETjs.getIndexHtml.call(void 0, options), "utf-8");
658
+ await _fsextra2.default.writeFile(indexPath, await _chunkRSHUQSN4js.getIndexHtml.call(void 0, options), "utf-8");
659
659
  let config = void 0;
660
660
  try {
661
661
  const inlineConfig = _vite.mergeConfig.call(void 0, viteConfig, {
662
+ root: options.userRoot,
662
663
  plugins: [
663
- await _chunkNPCPO6ETjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
664
+ await _chunkRSHUQSN4js.ViteSlidevPlugin.call(void 0, options, pluginOptions),
664
665
  {
665
666
  name: "resolve-config",
666
667
  configResolved(_config) {
@@ -704,17 +705,19 @@ async function build(options, viteConfig = {}) {
704
705
  else
705
706
  await _fsextra2.default.unlink(indexPath);
706
707
  }
707
- await _fsextra2.default.copyFile(_path.resolve.call(void 0, config.build.outDir, "index.html"), _path.resolve.call(void 0, config.build.outDir, "404.html"));
708
- const redirectsPath = _path.resolve.call(void 0, config.build.outDir, "_redirects");
708
+ const outDir = _path.resolve.call(void 0, options.userRoot, config.build.outDir);
709
+ const outFilename = options.data.config.exportFilename || "slidev-exported.pdf";
710
+ await _fsextra2.default.copyFile(_path.resolve.call(void 0, outDir, "index.html"), _path.resolve.call(void 0, outDir, "404.html"));
711
+ const redirectsPath = _path.resolve.call(void 0, outDir, "_redirects");
709
712
  if (!_fsextra2.default.existsSync(redirectsPath))
710
713
  await _fsextra2.default.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
711
714
  `, "utf-8");
712
715
  if ([true, "true", "auto"].includes(options.data.config.download)) {
713
- const { exportSlides } = await Promise.resolve().then(() => _chunk7QXPSYEZjs.__toModule.call(void 0, _chunk7QXPSYEZjs.__require.call(void 0, "./export-XA3FQNS5.js")));
716
+ const { exportSlides } = await Promise.resolve().then(() => _chunkIXNT7VMKjs.__toESM.call(void 0, _chunkIXNT7VMKjs.__require.call(void 0, "./export-AKEY52VC.js")));
714
717
  const port = 12445;
715
718
  const app = _connect2.default.call(void 0, );
716
719
  const server = _http2.default.createServer(app);
717
- app.use(config.base, build_default(config.build.outDir, {
720
+ app.use(config.base, build_default(outDir, {
718
721
  etag: true,
719
722
  single: true,
720
723
  dev: true
@@ -724,7 +727,7 @@ async function build(options, viteConfig = {}) {
724
727
  port,
725
728
  total: options.data.slides.length,
726
729
  format: "pdf",
727
- output: _path.join.call(void 0, config.build.outDir, "slidev-exported.pdf"),
730
+ output: _path.join.call(void 0, outDir, outFilename),
728
731
  base: config.base,
729
732
  dark: options.data.config.colorSchema === "dark",
730
733
  width: 1920,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  getIndexHtml
4
- } from "./chunk-NQIXBLV4.mjs";
4
+ } from "./chunk-MBZTOLHN.mjs";
5
5
  import {
6
6
  __require,
7
7
  __spreadValues,
8
- __toModule,
8
+ __toESM,
9
9
  init_esm_shims
10
- } from "./chunk-VYBQLH2X.mjs";
10
+ } from "./chunk-XMETW2MS.mjs";
11
11
 
12
12
  // node/build.ts
13
13
  init_esm_shims();
@@ -37,7 +37,7 @@ function totalist(dir, callback, pre = "") {
37
37
  }
38
38
  }
39
39
 
40
- // ../../node_modules/.pnpm/@polka+url@1.0.0-next.20/node_modules/@polka/url/build.mjs
40
+ // ../../node_modules/.pnpm/@polka+url@1.0.0-next.21/node_modules/@polka/url/build.mjs
41
41
  init_esm_shims();
42
42
  import * as qs from "querystring";
43
43
  function parse2(req) {
@@ -659,6 +659,7 @@ async function build(options, viteConfig = {}) {
659
659
  let config = void 0;
660
660
  try {
661
661
  const inlineConfig = mergeConfig(viteConfig, {
662
+ root: options.userRoot,
662
663
  plugins: [
663
664
  await ViteSlidevPlugin(options, pluginOptions),
664
665
  {
@@ -704,17 +705,19 @@ async function build(options, viteConfig = {}) {
704
705
  else
705
706
  await fs2.unlink(indexPath);
706
707
  }
707
- await fs2.copyFile(resolve3(config.build.outDir, "index.html"), resolve3(config.build.outDir, "404.html"));
708
- const redirectsPath = resolve3(config.build.outDir, "_redirects");
708
+ const outDir = resolve3(options.userRoot, config.build.outDir);
709
+ const outFilename = options.data.config.exportFilename || "slidev-exported.pdf";
710
+ await fs2.copyFile(resolve3(outDir, "index.html"), resolve3(outDir, "404.html"));
711
+ const redirectsPath = resolve3(outDir, "_redirects");
709
712
  if (!fs2.existsSync(redirectsPath))
710
713
  await fs2.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
711
714
  `, "utf-8");
712
715
  if ([true, "true", "auto"].includes(options.data.config.download)) {
713
- const { exportSlides } = await Promise.resolve().then(() => __toModule(__require("./export-4MUQJ4DB.mjs")));
716
+ const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-RFCVIBYE.mjs")));
714
717
  const port = 12445;
715
718
  const app = connect();
716
719
  const server = http.createServer(app);
717
- app.use(config.base, build_default(config.build.outDir, {
720
+ app.use(config.base, build_default(outDir, {
718
721
  etag: true,
719
722
  single: true,
720
723
  dev: true
@@ -724,7 +727,7 @@ async function build(options, viteConfig = {}) {
724
727
  port,
725
728
  total: options.data.slides.length,
726
729
  format: "pdf",
727
- output: join3(config.build.outDir, "slidev-exported.pdf"),
730
+ output: join3(outDir, outFilename),
728
731
  base: config.base,
729
732
  dark: options.data.config.colorSchema === "dark",
730
733
  width: 1920,