@slidev/cli 0.40.5 → 0.40.6

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,7 +2,7 @@ import {
2
2
  ViteSlidevPlugin,
3
3
  getIndexHtml,
4
4
  mergeViteConfigs
5
- } from "./chunk-46GOGODM.mjs";
5
+ } from "./chunk-IBT35HXF.mjs";
6
6
  import "./chunk-CTG3GV2W.mjs";
7
7
 
8
8
  // node/build.ts
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkFT5Y6KDWjs = require('./chunk-FT5Y6KDW.js');
5
+ var _chunkIZ3FTOWYjs = require('./chunk-IZ3FTOWY.js');
6
6
  require('./chunk-GE7W2DBE.js');
7
7
 
8
8
  // node/build.ts
@@ -646,16 +646,16 @@ async function build(options, viteConfig = {}, args) {
646
646
  let originalIndexHTML;
647
647
  if (_fsextra2.default.existsSync(indexPath))
648
648
  originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
649
- await _fsextra2.default.writeFile(indexPath, await _chunkFT5Y6KDWjs.getIndexHtml.call(void 0, options), "utf-8");
649
+ await _fsextra2.default.writeFile(indexPath, await _chunkIZ3FTOWYjs.getIndexHtml.call(void 0, options), "utf-8");
650
650
  let config = void 0;
651
651
  try {
652
- const inlineConfig = await _chunkFT5Y6KDWjs.mergeViteConfigs.call(void 0,
652
+ const inlineConfig = await _chunkIZ3FTOWYjs.mergeViteConfigs.call(void 0,
653
653
  options,
654
654
  viteConfig,
655
655
  {
656
656
  root: options.userRoot,
657
657
  plugins: [
658
- await _chunkFT5Y6KDWjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
658
+ await _chunkIZ3FTOWYjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
659
659
  {
660
660
  name: "resolve-config",
661
661
  configResolved(_config) {
@@ -676,7 +676,7 @@ async function build(options, viteConfig = {}, args) {
676
676
  } else {
677
677
  console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
678
678
  await _vite.build.call(void 0,
679
- await _chunkFT5Y6KDWjs.mergeViteConfigs.call(void 0,
679
+ await _chunkIZ3FTOWYjs.mergeViteConfigs.call(void 0,
680
680
  options,
681
681
  inlineConfig,
682
682
  {
@@ -278,13 +278,14 @@ var dependencies = {
278
278
  defu: "^6.1.2",
279
279
  drauu: "^0.3.2",
280
280
  "file-saver": "^2.0.5",
281
+ "fuse.js": "^6.6.2",
281
282
  "js-base64": "^3.7.5",
282
283
  "js-yaml": "^4.1.0",
283
284
  katex: "^0.16.4",
284
285
  mermaid: "^9.4.3",
285
286
  "monaco-editor": "^0.33.0",
286
- nanoid: "^4.0.1",
287
- prettier: "^2.8.6",
287
+ nanoid: "^4.0.2",
288
+ prettier: "^2.8.7",
288
289
  recordrtc: "^5.6.2",
289
290
  resolve: "^1.22.1",
290
291
  unocss: "^0.50.6",
@@ -414,7 +415,7 @@ function createConfigPlugin(options) {
414
415
  injection.root = options.cliRoot;
415
416
  injection.resolve.alias.vue = `${resolveImportPath("vue/dist/vue.esm-browser.js", true)}`;
416
417
  }
417
- return mergeConfig2(config, injection);
418
+ return mergeConfig2(injection, config);
418
419
  },
419
420
  configureServer(server) {
420
421
  return () => {
@@ -278,13 +278,14 @@ var dependencies = {
278
278
  defu: "^6.1.2",
279
279
  drauu: "^0.3.2",
280
280
  "file-saver": "^2.0.5",
281
+ "fuse.js": "^6.6.2",
281
282
  "js-base64": "^3.7.5",
282
283
  "js-yaml": "^4.1.0",
283
284
  katex: "^0.16.4",
284
285
  mermaid: "^9.4.3",
285
286
  "monaco-editor": "^0.33.0",
286
- nanoid: "^4.0.1",
287
- prettier: "^2.8.6",
287
+ nanoid: "^4.0.2",
288
+ prettier: "^2.8.7",
288
289
  recordrtc: "^5.6.2",
289
290
  resolve: "^1.22.1",
290
291
  unocss: "^0.50.6",
@@ -414,7 +415,7 @@ function createConfigPlugin(options) {
414
415
  injection.root = options.cliRoot;
415
416
  injection.resolve.alias.vue = `${_chunkGE7W2DBEjs.resolveImportPath.call(void 0, "vue/dist/vue.esm-browser.js", true)}`;
416
417
  }
417
- return _vite.mergeConfig.call(void 0, config, injection);
418
+ return _vite.mergeConfig.call(void 0, injection, config);
418
419
  },
419
420
  configureServer(server) {
420
421
  return () => {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-46GOGODM.mjs";
4
+ } from "./chunk-IBT35HXF.mjs";
5
5
  import {
6
6
  __commonJS,
7
7
  __privateAdd,
@@ -2406,29 +2406,30 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
2406
2406
  import * as parser from "@slidev/parser/fs";
2407
2407
 
2408
2408
  // package.json
2409
- var version = "0.40.5";
2409
+ var version = "0.40.6";
2410
2410
 
2411
2411
  // node/themes.ts
2412
2412
  import prompts2 from "prompts";
2413
2413
 
2414
- // ../../node_modules/.pnpm/@antfu+ni@0.20.0/node_modules/@antfu/ni/dist/shared/ni.dfba777f.mjs
2415
- import require$$0, { resolve } from "path";
2416
- import require$$0$6 from "readline";
2414
+ // ../../node_modules/.pnpm/@antfu+ni@0.21.2/node_modules/@antfu/ni/dist/shared/ni.ff5047d2.mjs
2415
+ import path$3, { join as join$1, dirname, resolve } from "path";
2416
+ import require$$0$7 from "readline";
2417
2417
  import require$$2 from "events";
2418
2418
  import { Buffer as Buffer$1 } from "buffer";
2419
- import path$3 from "path";
2420
- import childProcess from "child_process";
2419
+ import childProcess, { ChildProcess } from "child_process";
2421
2420
  import process$2 from "process";
2422
- import require$$0$1, { execSync } from "child_process";
2423
- import fs$1 from "fs";
2421
+ import require$$0$2 from "child_process";
2422
+ import require$$0$1 from "path";
2423
+ import require$$0 from "fs";
2424
2424
  import url, { fileURLToPath } from "url";
2425
- import require$$0$5, { constants } from "os";
2426
- import os$1 from "os";
2427
- import require$$0$2 from "assert";
2428
- import require$$0$4 from "buffer";
2429
- import require$$0$3 from "stream";
2425
+ import os$1, { constants } from "os";
2426
+ import require$$0$3 from "assert";
2427
+ import fs$1, { promises, createWriteStream, createReadStream, existsSync } from "fs";
2428
+ import require$$0$5 from "buffer";
2429
+ import require$$0$4 from "stream";
2430
2430
  import require$$2$1 from "util";
2431
- import { promises } from "fs";
2431
+ import { debuglog } from "util";
2432
+ import require$$0$6 from "os";
2432
2433
  import require$$1 from "tty";
2433
2434
  var npmRun = (agent) => (args) => {
2434
2435
  if (args.length > 1)
@@ -2902,7 +2903,7 @@ async function findUp(name, options = {}) {
2902
2903
  }
2903
2904
  var customRcPath = process.env.NI_CONFIG_FILE;
2904
2905
  var home = process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME;
2905
- var defaultRcPath = require$$0.join(home || "~/", ".nirc");
2906
+ var defaultRcPath = path$3.join(home || "~/", ".nirc");
2906
2907
  var rcPath = customRcPath || defaultRcPath;
2907
2908
  var defaultConfig = {
2908
2909
  defaultAgent: "prompt",
@@ -2952,7 +2953,7 @@ function requireWindows() {
2952
2953
  hasRequiredWindows = 1;
2953
2954
  windows = isexe2;
2954
2955
  isexe2.sync = sync2;
2955
- var fs4 = fs$1;
2956
+ var fs4 = require$$0;
2956
2957
  function checkPathExt(path2, options) {
2957
2958
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
2958
2959
  if (!pathext) {
@@ -2994,7 +2995,7 @@ function requireMode() {
2994
2995
  hasRequiredMode = 1;
2995
2996
  mode = isexe2;
2996
2997
  isexe2.sync = sync2;
2997
- var fs4 = fs$1;
2998
+ var fs4 = require$$0;
2998
2999
  function isexe2(path2, options, cb) {
2999
3000
  fs4.stat(path2, function(er, stat) {
3000
3001
  cb(er, er ? false : checkStat(stat, options));
@@ -3070,7 +3071,7 @@ function sync(path2, options) {
3070
3071
  }
3071
3072
  }
3072
3073
  var isWindows$1 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
3073
- var path$2 = require$$0;
3074
+ var path$2 = require$$0$1;
3074
3075
  var COLON = isWindows$1 ? ";" : ":";
3075
3076
  var isexe$1 = isexe_1;
3076
3077
  var getNotFoundError$1 = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -3178,7 +3179,7 @@ var pathKey$1 = (options = {}) => {
3178
3179
  };
3179
3180
  pathKey$2.exports = pathKey$1;
3180
3181
  pathKeyExports.default = pathKey$1;
3181
- var path$1 = require$$0;
3182
+ var path$1 = require$$0$1;
3182
3183
  var which$1 = which_1;
3183
3184
  var getPathKey = pathKeyExports;
3184
3185
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -3246,7 +3247,7 @@ var shebangCommand$1 = (string = "") => {
3246
3247
  }
3247
3248
  return argument ? `${binary} ${argument}` : binary;
3248
3249
  };
3249
- var fs = fs$1;
3250
+ var fs = require$$0;
3250
3251
  var shebangCommand = shebangCommand$1;
3251
3252
  function readShebang$1(command) {
3252
3253
  const size = 150;
@@ -3261,7 +3262,7 @@ function readShebang$1(command) {
3261
3262
  return shebangCommand(buffer.toString());
3262
3263
  }
3263
3264
  var readShebang_1 = readShebang$1;
3264
- var path = require$$0;
3265
+ var path = require$$0$1;
3265
3266
  var resolveCommand = resolveCommand_1;
3266
3267
  var escape = _escape;
3267
3268
  var readShebang = readShebang_1;
@@ -3359,7 +3360,7 @@ var enoent$1 = {
3359
3360
  verifyENOENTSync,
3360
3361
  notFoundError
3361
3362
  };
3362
- var cp = require$$0$1;
3363
+ var cp = require$$0$2;
3363
3364
  var parse = parse_1;
3364
3365
  var enoent = enoent$1;
3365
3366
  function spawn(command, args, options) {
@@ -3496,19 +3497,17 @@ onetime.callCount = (function_) => {
3496
3497
  }
3497
3498
  return calledFunctions.get(function_);
3498
3499
  };
3499
- var getRealtimeSignals = function() {
3500
+ var getRealtimeSignals = () => {
3500
3501
  const length = SIGRTMAX - SIGRTMIN + 1;
3501
3502
  return Array.from({ length }, getRealtimeSignal);
3502
3503
  };
3503
- var getRealtimeSignal = function(value, index) {
3504
- return {
3505
- name: `SIGRT${index + 1}`,
3506
- number: SIGRTMIN + index,
3507
- action: "terminate",
3508
- description: "Application-specific signal (realtime)",
3509
- standard: "posix"
3510
- };
3511
- };
3504
+ var getRealtimeSignal = (value, index) => ({
3505
+ name: `SIGRT${index + 1}`,
3506
+ number: SIGRTMIN + index,
3507
+ action: "terminate",
3508
+ description: "Application-specific signal (realtime)",
3509
+ standard: "posix"
3510
+ });
3512
3511
  var SIGRTMIN = 34;
3513
3512
  var SIGRTMAX = 64;
3514
3513
  var SIGNALS = [
@@ -3782,19 +3781,19 @@ var SIGNALS = [
3782
3781
  standard: "other"
3783
3782
  }
3784
3783
  ];
3785
- var getSignals = function() {
3784
+ var getSignals = () => {
3786
3785
  const realtimeSignals = getRealtimeSignals();
3787
3786
  const signals = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
3788
3787
  return signals;
3789
3788
  };
3790
- var normalizeSignal = function({
3789
+ var normalizeSignal = ({
3791
3790
  name,
3792
3791
  number: defaultNumber,
3793
3792
  description,
3794
3793
  action: action2,
3795
3794
  forced = false,
3796
3795
  standard
3797
- }) {
3796
+ }) => {
3798
3797
  const {
3799
3798
  signals: { [name]: constantSignal }
3800
3799
  } = constants;
@@ -3802,24 +3801,27 @@ var normalizeSignal = function({
3802
3801
  const number2 = supported ? constantSignal : defaultNumber;
3803
3802
  return { name, number: number2, description, supported, action: action2, forced, standard };
3804
3803
  };
3805
- var getSignalsByName = function() {
3804
+ var getSignalsByName = () => {
3806
3805
  const signals = getSignals();
3807
- return signals.reduce(getSignalByName, {});
3808
- };
3809
- var getSignalByName = function(signalByNameMemo, { name, number: number2, description, supported, action: action2, forced, standard }) {
3810
- return {
3811
- ...signalByNameMemo,
3812
- [name]: { name, number: number2, description, supported, action: action2, forced, standard }
3813
- };
3806
+ return Object.fromEntries(signals.map(getSignalByName));
3814
3807
  };
3808
+ var getSignalByName = ({
3809
+ name,
3810
+ number: number2,
3811
+ description,
3812
+ supported,
3813
+ action: action2,
3814
+ forced,
3815
+ standard
3816
+ }) => [name, { name, number: number2, description, supported, action: action2, forced, standard }];
3815
3817
  var signalsByName = getSignalsByName();
3816
- var getSignalsByNumber = function() {
3818
+ var getSignalsByNumber = () => {
3817
3819
  const signals = getSignals();
3818
3820
  const length = SIGRTMAX + 1;
3819
3821
  const signalsA = Array.from({ length }, (value, number2) => getSignalByNumber(number2, signals));
3820
3822
  return Object.assign({}, ...signalsA);
3821
3823
  };
3822
- var getSignalByNumber = function(number2, signals) {
3824
+ var getSignalByNumber = (number2, signals) => {
3823
3825
  const signal = findSignalByNumber(number2, signals);
3824
3826
  if (signal === void 0) {
3825
3827
  return {};
@@ -3837,7 +3839,7 @@ var getSignalByNumber = function(number2, signals) {
3837
3839
  }
3838
3840
  };
3839
3841
  };
3840
- var findSignalByNumber = function(number2, signals) {
3842
+ var findSignalByNumber = (number2, signals) => {
3841
3843
  const signal = signals.find(({ name }) => constants.signals[name] === number2);
3842
3844
  if (signal !== void 0) {
3843
3845
  return signal;
@@ -4003,7 +4005,7 @@ if (!processOk(process$1)) {
4003
4005
  };
4004
4006
  };
4005
4007
  } else {
4006
- assert = require$$0$2;
4008
+ assert = require$$0$3;
4007
4009
  signals = requireSignals();
4008
4010
  isWin = /^win/i.test(process$1.platform);
4009
4011
  EE = require$$2;
@@ -4219,6 +4221,39 @@ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
4219
4221
  function isStream(stream2) {
4220
4222
  return stream2 !== null && typeof stream2 === "object" && typeof stream2.pipe === "function";
4221
4223
  }
4224
+ function isWritableStream(stream2) {
4225
+ return isStream(stream2) && stream2.writable !== false && typeof stream2._write === "function" && typeof stream2._writableState === "object";
4226
+ }
4227
+ var isExecaChildProcess = (target) => target instanceof ChildProcess && typeof target.then === "function";
4228
+ var pipeToTarget = (spawned, streamName, target) => {
4229
+ if (typeof target === "string") {
4230
+ spawned[streamName].pipe(createWriteStream(target));
4231
+ return spawned;
4232
+ }
4233
+ if (isWritableStream(target)) {
4234
+ spawned[streamName].pipe(target);
4235
+ return spawned;
4236
+ }
4237
+ if (!isExecaChildProcess(target)) {
4238
+ throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
4239
+ }
4240
+ if (!isWritableStream(target.stdin)) {
4241
+ throw new TypeError("The target child process's stdin must be available.");
4242
+ }
4243
+ spawned[streamName].pipe(target.stdin);
4244
+ return target;
4245
+ };
4246
+ var addPipeMethods = (spawned) => {
4247
+ if (spawned.stdout !== null) {
4248
+ spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
4249
+ }
4250
+ if (spawned.stderr !== null) {
4251
+ spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
4252
+ }
4253
+ if (spawned.all !== void 0) {
4254
+ spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
4255
+ }
4256
+ };
4222
4257
  var getStreamExports = {};
4223
4258
  var getStream$1 = {
4224
4259
  get exports() {
@@ -4228,7 +4263,7 @@ var getStream$1 = {
4228
4263
  getStreamExports = v;
4229
4264
  }
4230
4265
  };
4231
- var { PassThrough: PassThroughStream } = require$$0$3;
4266
+ var { PassThrough: PassThroughStream } = require$$0$4;
4232
4267
  var bufferStream$1 = (options) => {
4233
4268
  options = { ...options };
4234
4269
  const { array } = options;
@@ -4266,8 +4301,8 @@ var bufferStream$1 = (options) => {
4266
4301
  stream2.getBufferedLength = () => length;
4267
4302
  return stream2;
4268
4303
  };
4269
- var { constants: BufferConstants } = require$$0$4;
4270
- var stream = require$$0$3;
4304
+ var { constants: BufferConstants } = require$$0$5;
4305
+ var stream = require$$0$4;
4271
4306
  var { promisify } = require$$2$1;
4272
4307
  var bufferStream = bufferStream$1;
4273
4308
  var streamPipelinePromisified = promisify(stream.pipeline);
@@ -4314,7 +4349,7 @@ getStream$1.exports = getStream;
4314
4349
  getStreamExports.buffer = (stream2, options) => getStream(stream2, { ...options, encoding: "buffer" });
4315
4350
  getStreamExports.array = (stream2, options) => getStream(stream2, { ...options, array: true });
4316
4351
  getStreamExports.MaxBufferError = MaxBufferError;
4317
- var { PassThrough } = require$$0$3;
4352
+ var { PassThrough } = require$$0$4;
4318
4353
  var mergeStream = function() {
4319
4354
  var sources = [];
4320
4355
  var output = new PassThrough({ objectMode: true });
@@ -4347,8 +4382,21 @@ var mergeStream = function() {
4347
4382
  }
4348
4383
  }
4349
4384
  };
4350
- var handleInput = (spawned, input) => {
4351
- if (input === void 0 || spawned.stdin === void 0) {
4385
+ var validateInputOptions = (input) => {
4386
+ if (input !== void 0) {
4387
+ throw new TypeError("The `input` and `inputFile` options cannot be both set.");
4388
+ }
4389
+ };
4390
+ var getInput = ({ input, inputFile }) => {
4391
+ if (typeof inputFile !== "string") {
4392
+ return input;
4393
+ }
4394
+ validateInputOptions(input);
4395
+ return createReadStream(inputFile);
4396
+ };
4397
+ var handleInput = (spawned, options) => {
4398
+ const input = getInput(options);
4399
+ if (input === void 0) {
4352
4400
  return;
4353
4401
  }
4354
4402
  if (isStream(input)) {
@@ -4371,7 +4419,7 @@ var makeAllStream = (spawned, { all }) => {
4371
4419
  return mixed;
4372
4420
  };
4373
4421
  var getBufferedData = async (stream2, streamPromise) => {
4374
- if (!stream2) {
4422
+ if (!stream2 || streamPromise === void 0) {
4375
4423
  return;
4376
4424
  }
4377
4425
  stream2.destroy();
@@ -4416,7 +4464,6 @@ var mergePromise = (spawned, promise) => {
4416
4464
  const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
4417
4465
  Reflect.defineProperty(spawned, property, { ...descriptor, value });
4418
4466
  }
4419
- return spawned;
4420
4467
  };
4421
4468
  var getSpawnedPromise = (spawned) => new Promise((resolve3, reject) => {
4422
4469
  spawned.on("exit", (exitCode, signal) => {
@@ -4460,6 +4507,19 @@ var parseCommand = (command) => {
4460
4507
  }
4461
4508
  return tokens;
4462
4509
  };
4510
+ var verboseDefault = debuglog("execa").enabled;
4511
+ var padField = (field, padding) => String(field).padStart(padding, "0");
4512
+ var getTimestamp = () => {
4513
+ const date2 = /* @__PURE__ */ new Date();
4514
+ return `${padField(date2.getHours(), 2)}:${padField(date2.getMinutes(), 2)}:${padField(date2.getSeconds(), 2)}.${padField(date2.getMilliseconds(), 3)}`;
4515
+ };
4516
+ var logCommand = (escapedCommand, { verbose }) => {
4517
+ if (!verbose) {
4518
+ return;
4519
+ }
4520
+ process$2.stderr.write(`[${getTimestamp()}] ${escapedCommand}
4521
+ `);
4522
+ };
4463
4523
  var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
4464
4524
  var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
4465
4525
  const env2 = extendEnv ? { ...process$2.env, ...envOption } : envOption;
@@ -4486,6 +4546,7 @@ var handleArguments = (file, args, options = {}) => {
4486
4546
  cleanup: true,
4487
4547
  all: false,
4488
4548
  windowsHide: true,
4549
+ verbose: verboseDefault,
4489
4550
  ...options
4490
4551
  };
4491
4552
  options.env = getEnv(options);
@@ -4508,6 +4569,7 @@ function execa(file, args, options) {
4508
4569
  const parsed = handleArguments(file, args, options);
4509
4570
  const command = joinCommand(file, args);
4510
4571
  const escapedCommand = getEscapedCommand(file, args);
4572
+ logCommand(escapedCommand, parsed.options);
4511
4573
  validateTimeout(parsed.options);
4512
4574
  let spawned;
4513
4575
  try {
@@ -4526,7 +4588,8 @@ function execa(file, args, options) {
4526
4588
  isCanceled: false,
4527
4589
  killed: false
4528
4590
  }));
4529
- return mergePromise(dummySpawned, errorPromise);
4591
+ mergePromise(dummySpawned, errorPromise);
4592
+ return dummySpawned;
4530
4593
  }
4531
4594
  const spawnedPromise = getSpawnedPromise(spawned);
4532
4595
  const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
@@ -4551,7 +4614,7 @@ function execa(file, args, options) {
4551
4614
  escapedCommand,
4552
4615
  parsed,
4553
4616
  timedOut,
4554
- isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
4617
+ isCanceled: parsed.options.signal ? parsed.options.signal.aborted : false,
4555
4618
  killed: spawned.killed
4556
4619
  });
4557
4620
  if (!parsed.options.reject) {
@@ -4573,9 +4636,11 @@ function execa(file, args, options) {
4573
4636
  };
4574
4637
  };
4575
4638
  const handlePromiseOnce = onetime(handlePromise);
4576
- handleInput(spawned, parsed.options.input);
4639
+ handleInput(spawned, parsed.options);
4577
4640
  spawned.all = makeAllStream(spawned, parsed.options);
4578
- return mergePromise(spawned, handlePromiseOnce);
4641
+ addPipeMethods(spawned);
4642
+ mergePromise(spawned, handlePromiseOnce);
4643
+ return spawned;
4579
4644
  }
4580
4645
  function execaCommand(command, options) {
4581
4646
  const [file, ...args] = parseCommand(command);
@@ -4706,7 +4771,7 @@ var hasFlag$2 = (flag, argv = process.argv) => {
4706
4771
  const terminatorPosition = argv.indexOf("--");
4707
4772
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
4708
4773
  };
4709
- var os = require$$0$5;
4774
+ var os = require$$0$6;
4710
4775
  var tty = require$$1;
4711
4776
  var hasFlag$1 = hasFlag$2;
4712
4777
  var { env } = process;
@@ -5368,7 +5433,7 @@ function requirePrompt$1() {
5368
5433
  if (hasRequiredPrompt$1)
5369
5434
  return prompt$1;
5370
5435
  hasRequiredPrompt$1 = 1;
5371
- const readline = require$$0$6;
5436
+ const readline = require$$0$7;
5372
5437
  const _require = requireUtil$1(), action2 = _require.action;
5373
5438
  const EventEmitter = require$$2;
5374
5439
  const _require2 = requireSrc(), beep = _require2.beep, cursor = _require2.cursor;
@@ -7916,7 +7981,7 @@ function requirePrompt() {
7916
7981
  if (hasRequiredPrompt)
7917
7982
  return prompt;
7918
7983
  hasRequiredPrompt = 1;
7919
- const readline = require$$0$6;
7984
+ const readline = require$$0$7;
7920
7985
  const { action: action2 } = requireUtil();
7921
7986
  const EventEmitter = require$$2;
7922
7987
  const { beep, cursor } = requireSrc();
@@ -9955,7 +10020,7 @@ function isNodeLT(tar) {
9955
10020
  }
9956
10021
  var prompts = isNodeLT("8.6.0") ? requireDist() : requireLib();
9957
10022
  var isexe = isexe_1;
9958
- var { join: join2, delimiter, sep, posix } = require$$0;
10023
+ var { join: join2, delimiter, sep, posix } = require$$0$1;
9959
10024
  var isWindows = process.platform === "win32";
9960
10025
  var rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
9961
10026
  var rRel = new RegExp(`^\\.${rSlash.source}`);
@@ -10036,6 +10101,7 @@ var whichSync = (cmd, opt = {}) => {
10036
10101
  };
10037
10102
  var lib = which;
10038
10103
  which.sync = whichSync;
10104
+ var CLI_TEMP_DIR = join$1(os$1.tmpdir(), "antfu-ni");
10039
10105
  function remove(arr, v) {
10040
10106
  const index = arr.indexOf(v);
10041
10107
  if (index >= 0)
@@ -10043,39 +10109,34 @@ function remove(arr, v) {
10043
10109
  return arr;
10044
10110
  }
10045
10111
  function exclude(arr, v) {
10046
- return remove(arr.slice(), v);
10112
+ return arr.slice().filter((item) => item !== v);
10047
10113
  }
10048
10114
  function cmdExists(cmd) {
10049
- try {
10050
- execSync(
10051
- require$$0$5.platform() === "win32" ? `cmd /c "(help ${cmd} > nul || exit 0) && where ${cmd} > nul 2> nul"` : `command -v ${cmd}`
10052
- );
10053
- return true;
10054
- } catch {
10055
- return false;
10056
- }
10115
+ return lib.sync(cmd, { nothrow: true }) !== null;
10057
10116
  }
10058
10117
  function getVoltaPrefix() {
10059
10118
  const VOLTA_PREFIX = "volta run";
10060
- const hasVoltaCommand = lib.sync("volta", { nothrow: true }) !== null;
10119
+ const hasVoltaCommand = cmdExists("volta");
10061
10120
  return hasVoltaCommand ? VOLTA_PREFIX : "";
10062
10121
  }
10063
10122
  async function detect({ autoInstall, cwd } = {}) {
10064
10123
  let agent = null;
10124
+ let version3 = null;
10065
10125
  const lockPath = await findUp(Object.keys(LOCKS), { cwd });
10066
10126
  let packageJsonPath;
10067
10127
  if (lockPath)
10068
- packageJsonPath = require$$0.resolve(lockPath, "../package.json");
10128
+ packageJsonPath = path$3.resolve(lockPath, "../package.json");
10069
10129
  else
10070
10130
  packageJsonPath = await findUp("package.json", { cwd });
10071
10131
  if (packageJsonPath && fs$1.existsSync(packageJsonPath)) {
10072
10132
  try {
10073
10133
  const pkg = JSON.parse(fs$1.readFileSync(packageJsonPath, "utf8"));
10074
10134
  if (typeof pkg.packageManager === "string") {
10075
- const [name, version3] = pkg.packageManager.split("@");
10076
- if (name === "yarn" && parseInt(version3) > 1)
10135
+ const [name, ver] = pkg.packageManager.split("@");
10136
+ version3 = ver;
10137
+ if (name === "yarn" && parseInt(ver) > 1)
10077
10138
  agent = "yarn@berry";
10078
- else if (name === "pnpm" && parseInt(version3) < 7)
10139
+ else if (name === "pnpm" && parseInt(ver) < 7)
10079
10140
  agent = "pnpm@6";
10080
10141
  else if (name in AGENTS)
10081
10142
  agent = name;
@@ -10086,7 +10147,7 @@ async function detect({ autoInstall, cwd } = {}) {
10086
10147
  }
10087
10148
  }
10088
10149
  if (!agent && lockPath)
10089
- agent = LOCKS[require$$0.basename(lockPath)];
10150
+ agent = LOCKS[path$3.basename(lockPath)];
10090
10151
  if (agent && !cmdExists(agent.split("@")[0])) {
10091
10152
  if (!autoInstall) {
10092
10153
  console.warn(`[ni] Detected ${agent} but it doesn't seem to be installed.
@@ -10102,10 +10163,15 @@ async function detect({ autoInstall, cwd } = {}) {
10102
10163
  if (!tryInstall)
10103
10164
  process.exit(1);
10104
10165
  }
10105
- await execaCommand(`npm i -g ${agent}`, { stdio: "inherit", cwd });
10166
+ await execaCommand(`npm i -g ${agent}${version3 ? `@${version3}` : ""}`, { stdio: "inherit", cwd });
10106
10167
  }
10107
10168
  return agent;
10108
10169
  }
10170
+ var UnsupportedCommand = class extends Error {
10171
+ constructor({ agent, command }) {
10172
+ super(`Command "${command}" is not support by agent "${agent}"`);
10173
+ }
10174
+ };
10109
10175
  function getCommand(agent, command, args = []) {
10110
10176
  if (!(agent in AGENTS))
10111
10177
  throw new Error(`Unsupported agent "${agent}"`);
@@ -10113,7 +10179,7 @@ function getCommand(agent, command, args = []) {
10113
10179
  if (typeof c === "function")
10114
10180
  return c(args);
10115
10181
  if (!c)
10116
- throw new Error(`Command "${command}" is not support by agent "${agent}"`);
10182
+ throw new UnsupportedCommand({ agent, command });
10117
10183
  return c.replace("{0}", args.join(" ")).trim();
10118
10184
  }
10119
10185
  var parseNi = (agent, args, ctx) => {
@@ -10228,7 +10294,7 @@ function init(open, close) {
10228
10294
  return txt === void 0 ? chain([open], [blk]) : $.enabled ? run$1([blk], txt + "") : txt + "";
10229
10295
  };
10230
10296
  }
10231
- var version2 = "0.20.0";
10297
+ var version2 = "0.21.2";
10232
10298
  var DEBUG_SIGN = "?";
10233
10299
  async function run(fn, args, options = {}) {
10234
10300
  const debug2 = args.includes(DEBUG_SIGN);
@@ -10246,7 +10312,7 @@ async function run(fn, args, options = {}) {
10246
10312
  `));
10247
10313
  console.log(`ni ${dash} install`);
10248
10314
  console.log(`nr ${dash} run`);
10249
- console.log(`nix ${dash} execute`);
10315
+ console.log(`nlx ${dash} execute`);
10250
10316
  console.log(`nu ${dash} upgrade`);
10251
10317
  console.log(`nun ${dash} uninstall`);
10252
10318
  console.log(`nci ${dash} clean install`);
@@ -10297,7 +10363,7 @@ import { underline } from "kolorist";
10297
10363
  import fs3 from "fs-extra";
10298
10364
 
10299
10365
  // node/options.ts
10300
- import { dirname, join as join3, resolve as resolve2 } from "path";
10366
+ import { dirname as dirname2, join as join3, resolve as resolve2 } from "path";
10301
10367
  import { uniq } from "@antfu/utils";
10302
10368
  import _debug from "debug";
10303
10369
 
@@ -10349,7 +10415,7 @@ function resolvePluginName(name) {
10349
10415
  // node/options.ts
10350
10416
  var debug = _debug("slidev:options");
10351
10417
  function getClientRoot() {
10352
- return dirname(resolveImportPath("@slidev/client/package.json", true));
10418
+ return dirname2(resolveImportPath("@slidev/client/package.json", true));
10353
10419
  }
10354
10420
  function getCLIRoot() {
10355
10421
  return resolve2(__dirname, "..");
@@ -10369,13 +10435,13 @@ function getAddonRoots(addons, entry) {
10369
10435
  }
10370
10436
  function getRoot(name, entry) {
10371
10437
  if (isPath(name))
10372
- return resolve2(dirname(entry), name);
10373
- return dirname(resolveImportPath(`${name}/package.json`, true));
10438
+ return resolve2(dirname2(entry), name);
10439
+ return dirname2(resolveImportPath(`${name}/package.json`, true));
10374
10440
  }
10375
10441
  function getUserRoot(options) {
10376
10442
  const { entry: rawEntry = "slides.md", userRoot = process.cwd() } = options;
10377
10443
  const fullEntry = resolve2(userRoot, rawEntry);
10378
- return { entry: fullEntry, userRoot: dirname(fullEntry) };
10444
+ return { entry: fullEntry, userRoot: dirname2(fullEntry) };
10379
10445
  }
10380
10446
  async function resolveOptions(options, mode2, promptForInstallation = true) {
10381
10447
  const { remote, inspect } = options;