@slidev/cli 0.31.2 → 0.32.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,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 _chunkN6ENRMDMjs = require('./chunk-N6ENRMDM.js');
4
+ var _chunk64ARPHPAjs = require('./chunk-64ARPHPA.js');
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunkOVW2G2MHjs = require('./chunk-OVW2G2MH.js');
10
+ var _chunkJWGORJY6js = require('./chunk-JWGORJY6.js');
11
11
 
12
12
  // node/build.ts
13
- _chunkOVW2G2MHjs.init_cjs_shims.call(void 0, );
13
+ _chunkJWGORJY6js.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
- _chunkOVW2G2MHjs.init_cjs_shims.call(void 0, );
21
+ _chunkJWGORJY6js.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
- _chunkOVW2G2MHjs.init_cjs_shims.call(void 0, );
26
+ _chunkJWGORJY6js.init_cjs_shims.call(void 0, );
27
27
 
28
28
 
29
29
  function totalist(dir, callback, pre = "") {
@@ -38,7 +38,7 @@ function totalist(dir, callback, pre = "") {
38
38
  }
39
39
 
40
40
  // ../../node_modules/.pnpm/@polka+url@1.0.0-next.21/node_modules/@polka/url/build.mjs
41
- _chunkOVW2G2MHjs.init_cjs_shims.call(void 0, );
41
+ _chunkJWGORJY6js.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
- _chunkOVW2G2MHjs.init_cjs_shims.call(void 0, );
65
+ _chunkJWGORJY6js.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 = _chunkOVW2G2MHjs.__spreadValues.call(void 0, {}, headers);
530
+ headers = _chunkJWGORJY6js.__spreadValues.call(void 0, {}, headers);
531
531
  for (let key in headers) {
532
532
  tmp = res.getHeader(key);
533
533
  if (tmp)
@@ -655,13 +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 _chunkN6ENRMDMjs.getIndexHtml.call(void 0, options), "utf-8");
658
+ await _fsextra2.default.writeFile(indexPath, await _chunk64ARPHPAjs.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
662
  root: options.userRoot,
663
663
  plugins: [
664
- await _chunkN6ENRMDMjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
664
+ await _chunk64ARPHPAjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
665
665
  {
666
666
  name: "resolve-config",
667
667
  configResolved(_config) {
@@ -713,7 +713,7 @@ async function build(options, viteConfig = {}) {
713
713
  await _fsextra2.default.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
714
714
  `, "utf-8");
715
715
  if ([true, "true", "auto"].includes(options.data.config.download)) {
716
- const { exportSlides } = await Promise.resolve().then(() => _chunkOVW2G2MHjs.__toESM.call(void 0, _chunkOVW2G2MHjs.__require.call(void 0, "./export-JHHUB6BA.js")));
716
+ const { exportSlides } = await Promise.resolve().then(() => _chunkJWGORJY6js.__toESM.call(void 0, _chunkJWGORJY6js.__require.call(void 0, "./export-M6HJUIFY.js")));
717
717
  const port = 12445;
718
718
  const app = _connect2.default.call(void 0, );
719
719
  const server = _http2.default.createServer(app);
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  getIndexHtml
4
- } from "./chunk-55JD2XFU.mjs";
4
+ } from "./chunk-2OKC6HYP.mjs";
5
5
  import {
6
6
  __require,
7
7
  __spreadValues,
8
8
  __toESM,
9
9
  init_esm_shims
10
- } from "./chunk-D6ZT4BYV.mjs";
10
+ } from "./chunk-NOFZO6W4.mjs";
11
11
 
12
12
  // node/build.ts
13
13
  init_esm_shims();
@@ -713,7 +713,7 @@ async function build(options, viteConfig = {}) {
713
713
  await fs2.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
714
714
  `, "utf-8");
715
715
  if ([true, "true", "auto"].includes(options.data.config.download)) {
716
- const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-HA4VXV3M.mjs")));
716
+ const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-GIPHUNUX.mjs")));
717
717
  const port = 12445;
718
718
  const app = connect();
719
719
  const server = http.createServer(app);
@@ -11,7 +11,7 @@ import {
11
11
  resolveImportPath,
12
12
  stringifyMarkdownTokens,
13
13
  toAtFS
14
- } from "./chunk-D6ZT4BYV.mjs";
14
+ } from "./chunk-NOFZO6W4.mjs";
15
15
 
16
16
  // ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
17
17
  var require_fast_deep_equal = __commonJS({
@@ -135,10 +135,11 @@ async function loadSetups(roots, name, arg, initial, merge = true) {
135
135
  }
136
136
 
137
137
  // node/plugins/windicss.ts
138
- async function createWindiCSSPlugin({ themeRoots, clientRoot, userRoot, roots, data }, { windicss: windiOptions }) {
138
+ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRoot, roots, data }, { windicss: windiOptions }) {
139
139
  const configFiles = uniq2([
140
140
  ...defaultConfigureFiles.map((i) => resolve2(userRoot, i)),
141
141
  ...themeRoots.map((i) => `${i}/windi.config.ts`),
142
+ ...addonRoots.map((i) => `${i}/windi.config.ts`),
142
143
  resolve2(clientRoot, "windi.config.ts")
143
144
  ]);
144
145
  const configFile = configFiles.find((i) => existsSync3(i));
@@ -167,6 +168,10 @@ async function createWindiCSSPlugin({ themeRoots, clientRoot, userRoot, roots, d
167
168
  config2.scanOptions.include.push(`${i}/components/*.{vue,ts}`);
168
169
  config2.scanOptions.include.push(`${i}/layouts/*.{vue,ts}`);
169
170
  });
171
+ addonRoots.forEach((i) => {
172
+ config2.scanOptions.include.push(`${i}/components/*.{vue,ts}`);
173
+ config2.scanOptions.include.push(`${i}/layouts/*.{vue,ts}`);
174
+ });
170
175
  config2.scanOptions.include.push(`!${slash(resolve2(userRoot, "node_modules"))}`);
171
176
  config2.scanOptions.exclude.push(dirname(resolveImportPath("monaco-editor/package.json", true)));
172
177
  config2.scanOptions.exclude.push(dirname(resolveImportPath("katex/package.json", true)));
@@ -240,10 +245,10 @@ import { uniq as uniq3 } from "@antfu/utils";
240
245
 
241
246
  // ../client/package.json
242
247
  var dependencies = {
243
- "@antfu/utils": "^0.5.1",
248
+ "@antfu/utils": "^0.5.2",
244
249
  "@slidev/parser": "workspace:*",
245
250
  "@slidev/types": "workspace:*",
246
- "@vueuse/core": "^8.4.2",
251
+ "@vueuse/core": "^8.5.0",
247
252
  "@vueuse/head": "^0.7.6",
248
253
  "@vueuse/motion": "^2.0.0-beta.18",
249
254
  codemirror: "^5.65.3",
@@ -253,17 +258,17 @@ var dependencies = {
253
258
  "js-base64": "^3.7.2",
254
259
  "js-yaml": "^4.1.0",
255
260
  katex: "^0.15.3",
256
- mermaid: "^9.0.1",
261
+ mermaid: "^9.1.1",
257
262
  "monaco-editor": "^0.33.0",
258
263
  nanoid: "^3.3.4",
259
264
  prettier: "^2.6.2",
260
265
  recordrtc: "^5.6.2",
261
266
  resolve: "^1.22.0",
262
267
  "vite-plugin-windicss": "^1.8.4",
263
- vue: "^3.2.33",
268
+ vue: "^3.2.34",
264
269
  "vue-router": "^4.0.15",
265
270
  "vue-starport": "^0.2.10",
266
- windicss: "^3.5.1"
271
+ windicss: "^3.5.4"
267
272
  };
268
273
 
269
274
  // node/vite/searchRoot.ts
@@ -431,7 +436,7 @@ function prepareSlideInfo(data) {
431
436
  notesHTML: md.render((data == null ? void 0 : data.note) || "")
432
437
  });
433
438
  }
434
- function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roots }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
439
+ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, userRoot, roots, remote }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
435
440
  const slidePrefix = "/@slidev/slides/";
436
441
  const hmrPages = /* @__PURE__ */ new Set();
437
442
  let server;
@@ -676,38 +681,36 @@ ${code.slice(injectB)}`;
676
681
  ${imports.join("\n")}
677
682
  `);
678
683
  } else if (matchScript && !matchScript[2]) {
679
- const matchExport = code.match(/export\s+default\s+[^{]*{/);
684
+ const matchExport = code.match(/export\s+default\s+{/);
680
685
  if (matchExport) {
681
686
  const exportIndex = (matchExport.index || 0) + matchExport[0].length;
682
687
  let component = code.slice(exportIndex);
683
688
  component = component.slice(0, component.indexOf("<\/script>"));
684
- if (component.match(/setup\s*\(/)) {
685
- const scriptIndex = (matchScript.index || 0) + matchScript[0].length;
686
- const provideImport = '\nimport { injectionSlidevContext } from "@slidev/client/constants"\n';
687
- code = `${code.slice(0, scriptIndex)}${provideImport}${code.slice(scriptIndex)}`;
688
- let injectIndex = exportIndex + provideImport.length;
689
- let injectObject = "$slidev: { from: injectionSlidevContext },";
690
- const matchInject = component.match(/.*inject\s*:\s*([\[{])/);
691
- if (matchInject) {
692
- injectIndex += (matchInject.index || 0) + matchInject[0].length;
693
- if (matchInject[1] === "[") {
694
- let injects = component.slice((matchInject.index || 0) + matchInject[0].length);
695
- const injectEndIndex = injects.indexOf("]");
696
- injects = injects.slice(0, injectEndIndex);
697
- injectObject += injects.split(",").map((inject) => `${inject}: {from: ${inject}}`).join(",");
698
- return `${code.slice(0, injectIndex - 1)}{
689
+ const scriptIndex = (matchScript.index || 0) + matchScript[0].length;
690
+ const provideImport = '\nimport { injectionSlidevContext } from "@slidev/client/constants"\n';
691
+ code = `${code.slice(0, scriptIndex)}${provideImport}${code.slice(scriptIndex)}`;
692
+ let injectIndex = exportIndex + provideImport.length;
693
+ let injectObject = "$slidev: { from: injectionSlidevContext },";
694
+ const matchInject = component.match(/.*inject\s*:\s*([\[{])/);
695
+ if (matchInject) {
696
+ injectIndex += (matchInject.index || 0) + matchInject[0].length;
697
+ if (matchInject[1] === "[") {
698
+ let injects = component.slice((matchInject.index || 0) + matchInject[0].length);
699
+ const injectEndIndex = injects.indexOf("]");
700
+ injects = injects.slice(0, injectEndIndex);
701
+ injectObject += injects.split(",").map((inject) => `${inject}: {from: ${inject}}`).join(",");
702
+ return `${code.slice(0, injectIndex - 1)}{
699
703
  ${injectObject}
700
704
  }${code.slice(injectIndex + injectEndIndex + 1)}`;
701
- } else {
702
- return `${code.slice(0, injectIndex)}
705
+ } else {
706
+ return `${code.slice(0, injectIndex)}
703
707
  ${injectObject}
704
708
  ${code.slice(injectIndex)}`;
705
- }
706
709
  }
707
- return `${code.slice(0, injectIndex)}
710
+ }
711
+ return `${code.slice(0, injectIndex)}
708
712
  inject: { ${injectObject} },
709
713
  ${code.slice(injectIndex)}`;
710
- }
711
714
  }
712
715
  }
713
716
  return `<script setup>
@@ -727,6 +730,7 @@ defineProps<{ no: number | string }>()`);
727
730
  const roots2 = uniq4([
728
731
  userRoot,
729
732
  ...themeRoots,
733
+ ...addonRoots,
730
734
  clientRoot
731
735
  ]);
732
736
  for (const root of roots2) {
@@ -753,6 +757,7 @@ defineProps<{ no: number | string }>()`);
753
757
  ];
754
758
  const roots2 = uniq4([
755
759
  ...themeRoots,
760
+ ...addonRoots,
756
761
  userRoot
757
762
  ]);
758
763
  for (const root of roots2) {
@@ -829,7 +834,7 @@ ${routes.join(",\n")}
829
834
  return [...imports, routesStr].join("\n");
830
835
  }
831
836
  function generateConfigs() {
832
- const config = __spreadValues({}, data.config);
837
+ const config = __spreadProps(__spreadValues({}, data.config), { remote });
833
838
  if (isString(config.title)) {
834
839
  const tokens = md.parseInline(config.title, {});
835
840
  config.title = stringifyMarkdownTokens(tokens);
@@ -925,7 +930,7 @@ init_esm_shims();
925
930
  import { existsSync as existsSync5 } from "fs";
926
931
  import { join as join7, resolve as resolve4 } from "path";
927
932
  import { slash as slash4, uniq as uniq5 } from "@antfu/utils";
928
- function createClientSetupPlugin({ clientRoot, themeRoots, userRoot }) {
933
+ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot }) {
929
934
  const setupEntry = slash4(resolve4(clientRoot, "setup"));
930
935
  return {
931
936
  name: "slidev:setup",
@@ -938,6 +943,7 @@ function createClientSetupPlugin({ clientRoot, themeRoots, userRoot }) {
938
943
  const asyncInjections = [];
939
944
  const setups = uniq5([
940
945
  ...themeRoots,
946
+ ...addonRoots,
941
947
  userRoot
942
948
  ]).map((i) => join7(i, "setup", name));
943
949
  setups.forEach((path, idx) => {
@@ -1461,6 +1467,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
1461
1467
  const {
1462
1468
  mode,
1463
1469
  themeRoots,
1470
+ addonRoots,
1464
1471
  clientRoot,
1465
1472
  data: { config }
1466
1473
  } = options;
@@ -1488,6 +1495,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
1488
1495
  `${clientRoot}/builtin`,
1489
1496
  `${clientRoot}/components`,
1490
1497
  ...themeRoots.map((i) => `${i}/components`),
1498
+ ...addonRoots.map((i) => `${i}/components`),
1491
1499
  "src/components",
1492
1500
  "components"
1493
1501
  ],