@slidev/cli 0.41.1 → 0.42.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.
@@ -2,8 +2,10 @@ import {
2
2
  ViteSlidevPlugin,
3
3
  getIndexHtml,
4
4
  mergeViteConfigs
5
- } from "./chunk-AV6T2PNJ.mjs";
6
- import "./chunk-CTG3GV2W.mjs";
5
+ } from "./chunk-C5RFODBO.mjs";
6
+ import "./chunk-6XVZLT3I.mjs";
7
+ import "./chunk-CIUEQ4TI.mjs";
8
+ import "./chunk-L5QH2WZE.mjs";
7
9
 
8
10
  // node/build.ts
9
11
  import { join as join3, resolve as resolve3 } from "path";
@@ -720,7 +722,7 @@ async function build(options, viteConfig = {}, args) {
720
722
  await fs2.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
721
723
  `, "utf-8");
722
724
  if ([true, "true", "auto"].includes(options.data.config.download)) {
723
- const { exportSlides, getExportOptions } = await import("./export-KPPDUO6Z.mjs");
725
+ const { exportSlides, getExportOptions } = await import("./export-KRS4L4HC.mjs");
724
726
  const port = 12445;
725
727
  const app = connect();
726
728
  const server = http.createServer(app);
@@ -2,8 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkUJUM4LW4js = require('./chunk-UJUM4LW4.js');
6
- require('./chunk-GE7W2DBE.js');
5
+ var _chunkF4LLVFU7js = require('./chunk-F4LLVFU7.js');
6
+ require('./chunk-KKGXM3XL.js');
7
+ require('./chunk-6ZL4B4HQ.js');
8
+ require('./chunk-MJQETB73.js');
7
9
 
8
10
  // node/build.ts
9
11
  var _path = require('path');
@@ -649,16 +651,16 @@ async function build(options, viteConfig = {}, args) {
649
651
  let originalIndexHTML;
650
652
  if (_fsextra2.default.existsSync(indexPath))
651
653
  originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
652
- await _fsextra2.default.writeFile(indexPath, await _chunkUJUM4LW4js.getIndexHtml.call(void 0, options), "utf-8");
654
+ await _fsextra2.default.writeFile(indexPath, await _chunkF4LLVFU7js.getIndexHtml.call(void 0, options), "utf-8");
653
655
  let config = void 0;
654
656
  try {
655
- const inlineConfig = await _chunkUJUM4LW4js.mergeViteConfigs.call(void 0,
657
+ const inlineConfig = await _chunkF4LLVFU7js.mergeViteConfigs.call(void 0,
656
658
  options,
657
659
  viteConfig,
658
660
  {
659
661
  root: options.userRoot,
660
662
  plugins: [
661
- await _chunkUJUM4LW4js.ViteSlidevPlugin.call(void 0, options, pluginOptions),
663
+ await _chunkF4LLVFU7js.ViteSlidevPlugin.call(void 0, options, pluginOptions),
662
664
  {
663
665
  name: "resolve-config",
664
666
  configResolved(_config) {
@@ -679,7 +681,7 @@ async function build(options, viteConfig = {}, args) {
679
681
  } else {
680
682
  console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
681
683
  await _vite.build.call(void 0,
682
- await _chunkUJUM4LW4js.mergeViteConfigs.call(void 0,
684
+ await _chunkF4LLVFU7js.mergeViteConfigs.call(void 0,
683
685
  options,
684
686
  inlineConfig,
685
687
  {
@@ -720,7 +722,7 @@ async function build(options, viteConfig = {}, args) {
720
722
  await _fsextra2.default.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
721
723
  `, "utf-8");
722
724
  if ([true, "true", "auto"].includes(options.data.config.download)) {
723
- const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-GTPZJWVE.js"));
725
+ const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-PN4EOI4Z.js"));
724
726
  const port = 12445;
725
727
  const app = _connect2.default.call(void 0, );
726
728
  const server = _http2.default.createServer(app);
@@ -0,0 +1,35 @@
1
+ // node/plugins/setupNode.ts
2
+ import { resolve } from "path";
3
+ import { pathExists } from "fs-extra";
4
+ import { isObject } from "@antfu/utils";
5
+ import jiti from "jiti";
6
+ function deepMerge(a, b, rootPath = "") {
7
+ a = { ...a };
8
+ Object.keys(b).forEach((key) => {
9
+ if (isObject(a[key]))
10
+ a[key] = deepMerge(a[key], b[key], rootPath ? `${rootPath}.${key}` : key);
11
+ else if (Array.isArray(a[key]))
12
+ a[key] = [...a[key], ...b[key]];
13
+ else
14
+ a[key] = b[key];
15
+ });
16
+ return a;
17
+ }
18
+ async function loadSetups(roots, name, arg, initial, merge = true, accumulate) {
19
+ let returns = initial;
20
+ for (const root of roots) {
21
+ const path = resolve(root, "setup", name);
22
+ if (await pathExists(path)) {
23
+ const { default: setup } = jiti(__filename)(path);
24
+ const result = await setup(arg);
25
+ if (result !== null) {
26
+ returns = merge ? deepMerge(returns, result) : accumulate ? accumulate(returns, result) : result;
27
+ }
28
+ }
29
+ }
30
+ return returns;
31
+ }
32
+
33
+ export {
34
+ loadSetups
35
+ };
@@ -0,0 +1,76 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+ var _chunkMJQETB73js = require('./chunk-MJQETB73.js');
4
+
5
+ // node/utils.ts
6
+ var _path = require('path');
7
+ var _utils = require('@antfu/utils');
8
+ var _isinstalledglobally = require('is-installed-globally'); var _isinstalledglobally2 = _interopRequireDefault(_isinstalledglobally);
9
+ var _resolve = require('resolve');
10
+ var _globaldirs = require('global-dirs'); var _globaldirs2 = _interopRequireDefault(_globaldirs);
11
+ function toAtFS(path) {
12
+ return `/@fs${_utils.ensurePrefix.call(void 0, "/", _utils.slash.call(void 0, path))}`;
13
+ }
14
+ function resolveImportPath(importName, ensure = false) {
15
+ try {
16
+ return _resolve.sync.call(void 0, importName, {
17
+ preserveSymlinks: false
18
+ });
19
+ } catch (e) {
20
+ }
21
+ if (_isinstalledglobally2.default) {
22
+ try {
23
+ return _chunkMJQETB73js.__require.resolve(_path.join.call(void 0, _globaldirs2.default.yarn.packages, importName));
24
+ } catch (e2) {
25
+ }
26
+ try {
27
+ return _chunkMJQETB73js.__require.resolve(_path.join.call(void 0, _globaldirs2.default.npm.packages, importName));
28
+ } catch (e3) {
29
+ }
30
+ }
31
+ if (ensure)
32
+ throw new Error(`Failed to resolve package "${importName}"`);
33
+ return void 0;
34
+ }
35
+ function resolveGlobalImportPath(importName) {
36
+ try {
37
+ return _resolve.sync.call(void 0, importName, { preserveSymlinks: false, basedir: __dirname });
38
+ } catch (e4) {
39
+ }
40
+ try {
41
+ return _chunkMJQETB73js.__require.resolve(_path.join.call(void 0, _globaldirs2.default.yarn.packages, importName));
42
+ } catch (e5) {
43
+ }
44
+ try {
45
+ return _chunkMJQETB73js.__require.resolve(_path.join.call(void 0, _globaldirs2.default.npm.packages, importName));
46
+ } catch (e6) {
47
+ }
48
+ throw new Error(`Failed to resolve global package "${importName}"`);
49
+ }
50
+ function stringifyMarkdownTokens(tokens) {
51
+ return tokens.map(
52
+ (token) => {
53
+ var _a;
54
+ return (_a = token.children) == null ? void 0 : _a.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ");
55
+ }
56
+ ).filter(Boolean).join(" ");
57
+ }
58
+ function generateGoogleFontsUrl(options) {
59
+ const weights = options.weights.flatMap((i) => options.italic ? [`0,${i}`, `1,${i}`] : [`${i}`]).sort().join(";");
60
+ const fonts = options.webfonts.map((i) => `family=${i.replace(/^(['"])(.*)\1$/, "$1").replace(/\s+/g, "+")}:${options.italic ? "ital," : ""}wght@${weights}`).join("&");
61
+ return `https://fonts.googleapis.com/css2?${fonts}&display=swap`;
62
+ }
63
+ function packageExists(name) {
64
+ if (resolveImportPath(`${name}/package.json`))
65
+ return true;
66
+ return false;
67
+ }
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ exports.toAtFS = toAtFS; exports.resolveImportPath = resolveImportPath; exports.resolveGlobalImportPath = resolveGlobalImportPath; exports.stringifyMarkdownTokens = stringifyMarkdownTokens; exports.generateGoogleFontsUrl = generateGoogleFontsUrl; exports.packageExists = packageExists;
@@ -1,17 +1,19 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-AV6T2PNJ.mjs";
4
+ } from "./chunk-C5RFODBO.mjs";
5
+ import {
6
+ packageExists,
7
+ resolveImportPath
8
+ } from "./chunk-CIUEQ4TI.mjs";
5
9
  import {
6
10
  __commonJS,
7
11
  __privateAdd,
8
12
  __privateGet,
9
13
  __privateSet,
10
14
  __privateWrapper,
11
- __toESM,
12
- packageExists,
13
- resolveImportPath
14
- } from "./chunk-CTG3GV2W.mjs";
15
+ __toESM
16
+ } from "./chunk-L5QH2WZE.mjs";
15
17
 
16
18
  // ../../node_modules/.pnpm/semver@7.5.1/node_modules/semver/internal/constants.js
17
19
  var require_constants = __commonJS({
@@ -2452,7 +2454,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
2452
2454
  import * as parser from "@slidev/parser/fs";
2453
2455
 
2454
2456
  // package.json
2455
- var version = "0.41.1";
2457
+ var version = "0.42.0";
2456
2458
 
2457
2459
  // node/themes.ts
2458
2460
  import prompts2 from "prompts";