@slidev/cli 0.38.4 → 0.38.5

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,7 +1,7 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-NTTNCVJU.mjs";
4
+ } from "./chunk-MDHB5JSE.mjs";
5
5
  import {
6
6
  __commonJS,
7
7
  __dirname,
@@ -2451,19 +2451,19 @@ init_esm_shims();
2451
2451
  import * as parser from "@slidev/parser/fs";
2452
2452
 
2453
2453
  // package.json
2454
- var version = "0.38.4";
2454
+ var version = "0.38.5";
2455
2455
 
2456
2456
  // node/themes.ts
2457
2457
  init_esm_shims();
2458
2458
  import prompts2 from "prompts";
2459
2459
 
2460
- // ../../node_modules/.pnpm/@antfu+ni@0.18.8/node_modules/@antfu/ni/dist/index.mjs
2460
+ // ../../node_modules/.pnpm/@antfu+ni@0.19.0/node_modules/@antfu/ni/dist/index.mjs
2461
2461
  init_esm_shims();
2462
2462
 
2463
- // ../../node_modules/.pnpm/@antfu+ni@0.18.8/node_modules/@antfu/ni/dist/shared/ni.e5a4e327.mjs
2463
+ // ../../node_modules/.pnpm/@antfu+ni@0.19.0/node_modules/@antfu/ni/dist/shared/ni.e4583e4e.mjs
2464
2464
  init_esm_shims();
2465
2465
  import require$$0, { resolve } from "path";
2466
- import require$$0$5 from "readline";
2466
+ import require$$0$6 from "readline";
2467
2467
  import require$$2 from "events";
2468
2468
  import { Buffer as Buffer$1 } from "buffer";
2469
2469
  import path$3 from "path";
@@ -2472,8 +2472,8 @@ import process$2 from "process";
2472
2472
  import require$$0$1, { execSync } from "child_process";
2473
2473
  import fs$1 from "fs";
2474
2474
  import url, { fileURLToPath } from "url";
2475
- import os$1, { constants } from "os";
2476
- import os$2 from "os";
2475
+ import require$$0$5, { constants } from "os";
2476
+ import os$1 from "os";
2477
2477
  import require$$0$2 from "assert";
2478
2478
  import require$$0$4 from "buffer";
2479
2479
  import require$$0$3 from "stream";
@@ -2521,7 +2521,7 @@ var bun = {
2521
2521
  "add": "bun add {0}",
2522
2522
  "upgrade": null,
2523
2523
  "upgrade-interactive": null,
2524
- "execute": null,
2524
+ "execute": "bunx {0}",
2525
2525
  "uninstall": "bun remove {0}",
2526
2526
  "global_uninstall": "bun remove -g {0}"
2527
2527
  };
@@ -2573,268 +2573,6 @@ var INSTALL_PAGE = {
2573
2573
  "npm": "https://docs.npmjs.com/cli/v8/configuring-npm/install"
2574
2574
  };
2575
2575
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
2576
- var windows;
2577
- var hasRequiredWindows;
2578
- function requireWindows() {
2579
- if (hasRequiredWindows)
2580
- return windows;
2581
- hasRequiredWindows = 1;
2582
- windows = isexe2;
2583
- isexe2.sync = sync2;
2584
- var fs4 = fs$1;
2585
- function checkPathExt(path2, options) {
2586
- var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
2587
- if (!pathext) {
2588
- return true;
2589
- }
2590
- pathext = pathext.split(";");
2591
- if (pathext.indexOf("") !== -1) {
2592
- return true;
2593
- }
2594
- for (var i = 0; i < pathext.length; i++) {
2595
- var p = pathext[i].toLowerCase();
2596
- if (p && path2.substr(-p.length).toLowerCase() === p) {
2597
- return true;
2598
- }
2599
- }
2600
- return false;
2601
- }
2602
- function checkStat(stat, path2, options) {
2603
- if (!stat.isSymbolicLink() && !stat.isFile()) {
2604
- return false;
2605
- }
2606
- return checkPathExt(path2, options);
2607
- }
2608
- function isexe2(path2, options, cb) {
2609
- fs4.stat(path2, function(er, stat) {
2610
- cb(er, er ? false : checkStat(stat, path2, options));
2611
- });
2612
- }
2613
- function sync2(path2, options) {
2614
- return checkStat(fs4.statSync(path2), path2, options);
2615
- }
2616
- return windows;
2617
- }
2618
- var mode;
2619
- var hasRequiredMode;
2620
- function requireMode() {
2621
- if (hasRequiredMode)
2622
- return mode;
2623
- hasRequiredMode = 1;
2624
- mode = isexe2;
2625
- isexe2.sync = sync2;
2626
- var fs4 = fs$1;
2627
- function isexe2(path2, options, cb) {
2628
- fs4.stat(path2, function(er, stat) {
2629
- cb(er, er ? false : checkStat(stat, options));
2630
- });
2631
- }
2632
- function sync2(path2, options) {
2633
- return checkStat(fs4.statSync(path2), options);
2634
- }
2635
- function checkStat(stat, options) {
2636
- return stat.isFile() && checkMode(stat, options);
2637
- }
2638
- function checkMode(stat, options) {
2639
- var mod = stat.mode;
2640
- var uid = stat.uid;
2641
- var gid = stat.gid;
2642
- var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
2643
- var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
2644
- var u = parseInt("100", 8);
2645
- var g = parseInt("010", 8);
2646
- var o = parseInt("001", 8);
2647
- var ug = u | g;
2648
- var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
2649
- return ret;
2650
- }
2651
- return mode;
2652
- }
2653
- var core;
2654
- if (process.platform === "win32" || commonjsGlobal.TESTING_WINDOWS) {
2655
- core = requireWindows();
2656
- } else {
2657
- core = requireMode();
2658
- }
2659
- var isexe_1 = isexe$1;
2660
- isexe$1.sync = sync;
2661
- function isexe$1(path2, options, cb) {
2662
- if (typeof options === "function") {
2663
- cb = options;
2664
- options = {};
2665
- }
2666
- if (!cb) {
2667
- if (typeof Promise !== "function") {
2668
- throw new TypeError("callback not provided");
2669
- }
2670
- return new Promise(function(resolve3, reject) {
2671
- isexe$1(path2, options || {}, function(er, is) {
2672
- if (er) {
2673
- reject(er);
2674
- } else {
2675
- resolve3(is);
2676
- }
2677
- });
2678
- });
2679
- }
2680
- core(path2, options || {}, function(er, is) {
2681
- if (er) {
2682
- if (er.code === "EACCES" || options && options.ignoreErrors) {
2683
- er = null;
2684
- is = false;
2685
- }
2686
- }
2687
- cb(er, is);
2688
- });
2689
- }
2690
- function sync(path2, options) {
2691
- try {
2692
- return core.sync(path2, options || {});
2693
- } catch (er) {
2694
- if (options && options.ignoreErrors || er.code === "EACCES") {
2695
- return false;
2696
- } else {
2697
- throw er;
2698
- }
2699
- }
2700
- }
2701
- var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
2702
- var path$2 = require$$0;
2703
- var COLON = isWindows ? ";" : ":";
2704
- var isexe = isexe_1;
2705
- var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
2706
- var getPathInfo = (cmd, opt) => {
2707
- const colon = opt.colon || COLON;
2708
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
2709
- ...isWindows ? [process.cwd()] : [],
2710
- ...(opt.path || process.env.PATH || "").split(colon)
2711
- ];
2712
- const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
2713
- const pathExt = isWindows ? pathExtExe.split(colon) : [""];
2714
- if (isWindows) {
2715
- if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
2716
- pathExt.unshift("");
2717
- }
2718
- return {
2719
- pathEnv,
2720
- pathExt,
2721
- pathExtExe
2722
- };
2723
- };
2724
- var which$1 = (cmd, opt, cb) => {
2725
- if (typeof opt === "function") {
2726
- cb = opt;
2727
- opt = {};
2728
- }
2729
- if (!opt)
2730
- opt = {};
2731
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
2732
- const found = [];
2733
- const step = (i) => new Promise((resolve3, reject) => {
2734
- if (i === pathEnv.length)
2735
- return opt.all && found.length ? resolve3(found) : reject(getNotFoundError(cmd));
2736
- const ppRaw = pathEnv[i];
2737
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
2738
- const pCmd = path$2.join(pathPart, cmd);
2739
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
2740
- resolve3(subStep(p, i, 0));
2741
- });
2742
- const subStep = (p, i, ii) => new Promise((resolve3, reject) => {
2743
- if (ii === pathExt.length)
2744
- return resolve3(step(i + 1));
2745
- const ext = pathExt[ii];
2746
- isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
2747
- if (!er && is) {
2748
- if (opt.all)
2749
- found.push(p + ext);
2750
- else
2751
- return resolve3(p + ext);
2752
- }
2753
- return resolve3(subStep(p, i, ii + 1));
2754
- });
2755
- });
2756
- return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
2757
- };
2758
- var whichSync = (cmd, opt) => {
2759
- opt = opt || {};
2760
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
2761
- const found = [];
2762
- for (let i = 0; i < pathEnv.length; i++) {
2763
- const ppRaw = pathEnv[i];
2764
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
2765
- const pCmd = path$2.join(pathPart, cmd);
2766
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
2767
- for (let j = 0; j < pathExt.length; j++) {
2768
- const cur = p + pathExt[j];
2769
- try {
2770
- const is = isexe.sync(cur, { pathExt: pathExtExe });
2771
- if (is) {
2772
- if (opt.all)
2773
- found.push(cur);
2774
- else
2775
- return cur;
2776
- }
2777
- } catch (ex) {
2778
- }
2779
- }
2780
- }
2781
- if (opt.all && found.length)
2782
- return found;
2783
- if (opt.nothrow)
2784
- return null;
2785
- throw getNotFoundError(cmd);
2786
- };
2787
- var which_1 = which$1;
2788
- which$1.sync = whichSync;
2789
- function remove(arr, v) {
2790
- const index = arr.indexOf(v);
2791
- if (index >= 0)
2792
- arr.splice(index, 1);
2793
- return arr;
2794
- }
2795
- function exclude(arr, v) {
2796
- return remove(arr.slice(), v);
2797
- }
2798
- function cmdExists(cmd) {
2799
- try {
2800
- execSync(
2801
- os$1.platform() === "win32" ? `cmd /c "(help ${cmd} > nul || exit 0) && where ${cmd} > nul 2> nul"` : `command -v ${cmd}`
2802
- );
2803
- return true;
2804
- } catch {
2805
- return false;
2806
- }
2807
- }
2808
- function getVoltaPrefix() {
2809
- const VOLTA_PREFIX = "volta run";
2810
- const hasVoltaCommand = which_1.sync("volta", { nothrow: true }) !== null;
2811
- return hasVoltaCommand ? VOLTA_PREFIX : "";
2812
- }
2813
- function getCommand(agent, command, args = []) {
2814
- if (!(agent in AGENTS))
2815
- throw new Error(`Unsupported agent "${agent}"`);
2816
- const c = AGENTS[agent][command];
2817
- if (typeof c === "function")
2818
- return c(args);
2819
- if (!c)
2820
- throw new Error(`Command "${command}" is not support by agent "${agent}"`);
2821
- return c.replace("{0}", args.join(" ")).trim();
2822
- }
2823
- var parseNi = (agent, args, ctx) => {
2824
- if (agent === "bun")
2825
- args = args.map((i) => i === "-D" ? "-d" : i);
2826
- if (args.includes("-g"))
2827
- return getCommand(agent, "global", exclude(args, "-g"));
2828
- if (args.includes("--frozen-if-present")) {
2829
- args = exclude(args, "--frozen-if-present");
2830
- return getCommand(agent, (ctx == null ? void 0 : ctx.hasLock) ? "frozen" : "install", args);
2831
- }
2832
- if (args.includes("--frozen"))
2833
- return getCommand(agent, "frozen", exclude(args, "--frozen"));
2834
- if (args.length === 0 || args.every((i) => i.startsWith("-")))
2835
- return getCommand(agent, "install", args);
2836
- return getCommand(agent, "add", args);
2837
- };
2838
2576
  var { hasOwnProperty } = Object.prototype;
2839
2577
  var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
2840
2578
  var encode = (obj, opt) => {
@@ -3151,103 +2889,332 @@ function checkType(type) {
3151
2889
  }
3152
2890
  throw new Error(`Invalid type specified: ${type}`);
3153
2891
  }
3154
- var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
3155
- var toPath$1 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
3156
- async function locatePath(paths, {
3157
- cwd = process$2.cwd(),
3158
- type = "file",
3159
- allowSymlinks = true,
3160
- concurrency,
3161
- preserveOrder
3162
- } = {}) {
3163
- checkType(type);
3164
- cwd = toPath$1(cwd);
3165
- const statFunction = allowSymlinks ? promises.stat : promises.lstat;
3166
- return pLocate(paths, async (path_) => {
3167
- try {
3168
- const stat = await statFunction(path$3.resolve(cwd, path_));
3169
- return matchType(type, stat);
3170
- } catch {
2892
+ var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
2893
+ var toPath$1 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
2894
+ async function locatePath(paths, {
2895
+ cwd = process$2.cwd(),
2896
+ type = "file",
2897
+ allowSymlinks = true,
2898
+ concurrency,
2899
+ preserveOrder
2900
+ } = {}) {
2901
+ checkType(type);
2902
+ cwd = toPath$1(cwd);
2903
+ const statFunction = allowSymlinks ? promises.stat : promises.lstat;
2904
+ return pLocate(paths, async (path_) => {
2905
+ try {
2906
+ const stat = await statFunction(path$3.resolve(cwd, path_));
2907
+ return matchType(type, stat);
2908
+ } catch {
2909
+ return false;
2910
+ }
2911
+ }, { concurrency, preserveOrder });
2912
+ }
2913
+ var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
2914
+ var findUpStop = Symbol("findUpStop");
2915
+ async function findUpMultiple(name, options = {}) {
2916
+ let directory = path$3.resolve(toPath(options.cwd) || "");
2917
+ const { root } = path$3.parse(directory);
2918
+ const stopAt = path$3.resolve(directory, options.stopAt || root);
2919
+ const limit = options.limit || Number.POSITIVE_INFINITY;
2920
+ const paths = [name].flat();
2921
+ const runMatcher = async (locateOptions) => {
2922
+ if (typeof name !== "function") {
2923
+ return locatePath(paths, locateOptions);
2924
+ }
2925
+ const foundPath = await name(locateOptions.cwd);
2926
+ if (typeof foundPath === "string") {
2927
+ return locatePath([foundPath], locateOptions);
2928
+ }
2929
+ return foundPath;
2930
+ };
2931
+ const matches = [];
2932
+ while (true) {
2933
+ const foundPath = await runMatcher({ ...options, cwd: directory });
2934
+ if (foundPath === findUpStop) {
2935
+ break;
2936
+ }
2937
+ if (foundPath) {
2938
+ matches.push(path$3.resolve(directory, foundPath));
2939
+ }
2940
+ if (directory === stopAt || matches.length >= limit) {
2941
+ break;
2942
+ }
2943
+ directory = path$3.dirname(directory);
2944
+ }
2945
+ return matches;
2946
+ }
2947
+ async function findUp(name, options = {}) {
2948
+ const matches = await findUpMultiple(name, { ...options, limit: 1 });
2949
+ return matches[0];
2950
+ }
2951
+ var customRcPath = process.env.NI_CONFIG_FILE;
2952
+ var home = process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME;
2953
+ var defaultRcPath = require$$0.join(home || "~/", ".nirc");
2954
+ var rcPath = customRcPath || defaultRcPath;
2955
+ var defaultConfig = {
2956
+ defaultAgent: "prompt",
2957
+ globalAgent: "npm"
2958
+ };
2959
+ var config;
2960
+ async function getConfig() {
2961
+ var _a;
2962
+ if (!config) {
2963
+ const result = await findUp("package.json") || "";
2964
+ let packageManager = "";
2965
+ if (result)
2966
+ packageManager = (_a = JSON.parse(fs$1.readFileSync(result, "utf8")).packageManager) != null ? _a : "";
2967
+ const [, agent, version3] = packageManager.match(new RegExp(`^(${Object.values(LOCKS).join("|")})@(d).*?$`)) || [];
2968
+ if (agent)
2969
+ config = Object.assign({}, defaultConfig, { defaultAgent: agent === "yarn" && parseInt(version3) > 1 ? "yarn@berry" : agent });
2970
+ else if (!fs$1.existsSync(rcPath))
2971
+ config = defaultConfig;
2972
+ else
2973
+ config = Object.assign({}, defaultConfig, ini.parse(fs$1.readFileSync(rcPath, "utf-8")));
2974
+ }
2975
+ return config;
2976
+ }
2977
+ async function getDefaultAgent() {
2978
+ const { defaultAgent } = await getConfig();
2979
+ if (defaultAgent === "prompt" && process.env.CI)
2980
+ return "npm";
2981
+ return defaultAgent;
2982
+ }
2983
+ async function getGlobalAgent() {
2984
+ const { globalAgent } = await getConfig();
2985
+ return globalAgent;
2986
+ }
2987
+ var crossSpawnExports = {};
2988
+ var crossSpawn = {
2989
+ get exports() {
2990
+ return crossSpawnExports;
2991
+ },
2992
+ set exports(v) {
2993
+ crossSpawnExports = v;
2994
+ }
2995
+ };
2996
+ var windows;
2997
+ var hasRequiredWindows;
2998
+ function requireWindows() {
2999
+ if (hasRequiredWindows)
3000
+ return windows;
3001
+ hasRequiredWindows = 1;
3002
+ windows = isexe2;
3003
+ isexe2.sync = sync2;
3004
+ var fs4 = fs$1;
3005
+ function checkPathExt(path2, options) {
3006
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
3007
+ if (!pathext) {
3008
+ return true;
3009
+ }
3010
+ pathext = pathext.split(";");
3011
+ if (pathext.indexOf("") !== -1) {
3012
+ return true;
3013
+ }
3014
+ for (var i = 0; i < pathext.length; i++) {
3015
+ var p = pathext[i].toLowerCase();
3016
+ if (p && path2.substr(-p.length).toLowerCase() === p) {
3017
+ return true;
3018
+ }
3019
+ }
3020
+ return false;
3021
+ }
3022
+ function checkStat(stat, path2, options) {
3023
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
3024
+ return false;
3025
+ }
3026
+ return checkPathExt(path2, options);
3027
+ }
3028
+ function isexe2(path2, options, cb) {
3029
+ fs4.stat(path2, function(er, stat) {
3030
+ cb(er, er ? false : checkStat(stat, path2, options));
3031
+ });
3032
+ }
3033
+ function sync2(path2, options) {
3034
+ return checkStat(fs4.statSync(path2), path2, options);
3035
+ }
3036
+ return windows;
3037
+ }
3038
+ var mode;
3039
+ var hasRequiredMode;
3040
+ function requireMode() {
3041
+ if (hasRequiredMode)
3042
+ return mode;
3043
+ hasRequiredMode = 1;
3044
+ mode = isexe2;
3045
+ isexe2.sync = sync2;
3046
+ var fs4 = fs$1;
3047
+ function isexe2(path2, options, cb) {
3048
+ fs4.stat(path2, function(er, stat) {
3049
+ cb(er, er ? false : checkStat(stat, options));
3050
+ });
3051
+ }
3052
+ function sync2(path2, options) {
3053
+ return checkStat(fs4.statSync(path2), options);
3054
+ }
3055
+ function checkStat(stat, options) {
3056
+ return stat.isFile() && checkMode(stat, options);
3057
+ }
3058
+ function checkMode(stat, options) {
3059
+ var mod = stat.mode;
3060
+ var uid = stat.uid;
3061
+ var gid = stat.gid;
3062
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
3063
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
3064
+ var u = parseInt("100", 8);
3065
+ var g = parseInt("010", 8);
3066
+ var o = parseInt("001", 8);
3067
+ var ug = u | g;
3068
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
3069
+ return ret;
3070
+ }
3071
+ return mode;
3072
+ }
3073
+ var core;
3074
+ if (process.platform === "win32" || commonjsGlobal.TESTING_WINDOWS) {
3075
+ core = requireWindows();
3076
+ } else {
3077
+ core = requireMode();
3078
+ }
3079
+ var isexe_1 = isexe$2;
3080
+ isexe$2.sync = sync;
3081
+ function isexe$2(path2, options, cb) {
3082
+ if (typeof options === "function") {
3083
+ cb = options;
3084
+ options = {};
3085
+ }
3086
+ if (!cb) {
3087
+ if (typeof Promise !== "function") {
3088
+ throw new TypeError("callback not provided");
3089
+ }
3090
+ return new Promise(function(resolve3, reject) {
3091
+ isexe$2(path2, options || {}, function(er, is) {
3092
+ if (er) {
3093
+ reject(er);
3094
+ } else {
3095
+ resolve3(is);
3096
+ }
3097
+ });
3098
+ });
3099
+ }
3100
+ core(path2, options || {}, function(er, is) {
3101
+ if (er) {
3102
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
3103
+ er = null;
3104
+ is = false;
3105
+ }
3106
+ }
3107
+ cb(er, is);
3108
+ });
3109
+ }
3110
+ function sync(path2, options) {
3111
+ try {
3112
+ return core.sync(path2, options || {});
3113
+ } catch (er) {
3114
+ if (options && options.ignoreErrors || er.code === "EACCES") {
3171
3115
  return false;
3116
+ } else {
3117
+ throw er;
3172
3118
  }
3173
- }, { concurrency, preserveOrder });
3119
+ }
3174
3120
  }
3175
- var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
3176
- var findUpStop = Symbol("findUpStop");
3177
- async function findUpMultiple(name, options = {}) {
3178
- let directory = path$3.resolve(toPath(options.cwd) || "");
3179
- const { root } = path$3.parse(directory);
3180
- const stopAt = path$3.resolve(directory, options.stopAt || root);
3181
- const limit = options.limit || Number.POSITIVE_INFINITY;
3182
- const paths = [name].flat();
3183
- const runMatcher = async (locateOptions) => {
3184
- if (typeof name !== "function") {
3185
- return locatePath(paths, locateOptions);
3186
- }
3187
- const foundPath = await name(locateOptions.cwd);
3188
- if (typeof foundPath === "string") {
3189
- return locatePath([foundPath], locateOptions);
3190
- }
3191
- return foundPath;
3121
+ var isWindows$1 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
3122
+ var path$2 = require$$0;
3123
+ var COLON = isWindows$1 ? ";" : ":";
3124
+ var isexe$1 = isexe_1;
3125
+ var getNotFoundError$1 = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
3126
+ var getPathInfo$1 = (cmd, opt) => {
3127
+ const colon = opt.colon || COLON;
3128
+ const pathEnv = cmd.match(/\//) || isWindows$1 && cmd.match(/\\/) ? [""] : [
3129
+ ...isWindows$1 ? [process.cwd()] : [],
3130
+ ...(opt.path || process.env.PATH || "").split(colon)
3131
+ ];
3132
+ const pathExtExe = isWindows$1 ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
3133
+ const pathExt = isWindows$1 ? pathExtExe.split(colon) : [""];
3134
+ if (isWindows$1) {
3135
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
3136
+ pathExt.unshift("");
3137
+ }
3138
+ return {
3139
+ pathEnv,
3140
+ pathExt,
3141
+ pathExtExe
3192
3142
  };
3193
- const matches = [];
3194
- while (true) {
3195
- const foundPath = await runMatcher({ ...options, cwd: directory });
3196
- if (foundPath === findUpStop) {
3197
- break;
3198
- }
3199
- if (foundPath) {
3200
- matches.push(path$3.resolve(directory, foundPath));
3201
- }
3202
- if (directory === stopAt || matches.length >= limit) {
3203
- break;
3143
+ };
3144
+ var which$2 = (cmd, opt, cb) => {
3145
+ if (typeof opt === "function") {
3146
+ cb = opt;
3147
+ opt = {};
3148
+ }
3149
+ if (!opt)
3150
+ opt = {};
3151
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo$1(cmd, opt);
3152
+ const found = [];
3153
+ const step = (i) => new Promise((resolve3, reject) => {
3154
+ if (i === pathEnv.length)
3155
+ return opt.all && found.length ? resolve3(found) : reject(getNotFoundError$1(cmd));
3156
+ const ppRaw = pathEnv[i];
3157
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
3158
+ const pCmd = path$2.join(pathPart, cmd);
3159
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
3160
+ resolve3(subStep(p, i, 0));
3161
+ });
3162
+ const subStep = (p, i, ii) => new Promise((resolve3, reject) => {
3163
+ if (ii === pathExt.length)
3164
+ return resolve3(step(i + 1));
3165
+ const ext = pathExt[ii];
3166
+ isexe$1(p + ext, { pathExt: pathExtExe }, (er, is) => {
3167
+ if (!er && is) {
3168
+ if (opt.all)
3169
+ found.push(p + ext);
3170
+ else
3171
+ return resolve3(p + ext);
3172
+ }
3173
+ return resolve3(subStep(p, i, ii + 1));
3174
+ });
3175
+ });
3176
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
3177
+ };
3178
+ var whichSync$1 = (cmd, opt) => {
3179
+ opt = opt || {};
3180
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo$1(cmd, opt);
3181
+ const found = [];
3182
+ for (let i = 0; i < pathEnv.length; i++) {
3183
+ const ppRaw = pathEnv[i];
3184
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
3185
+ const pCmd = path$2.join(pathPart, cmd);
3186
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
3187
+ for (let j = 0; j < pathExt.length; j++) {
3188
+ const cur = p + pathExt[j];
3189
+ try {
3190
+ const is = isexe$1.sync(cur, { pathExt: pathExtExe });
3191
+ if (is) {
3192
+ if (opt.all)
3193
+ found.push(cur);
3194
+ else
3195
+ return cur;
3196
+ }
3197
+ } catch (ex) {
3198
+ }
3204
3199
  }
3205
- directory = path$3.dirname(directory);
3206
3200
  }
3207
- return matches;
3208
- }
3209
- async function findUp(name, options = {}) {
3210
- const matches = await findUpMultiple(name, { ...options, limit: 1 });
3211
- return matches[0];
3212
- }
3213
- var customRcPath = process.env.NI_CONFIG_FILE;
3214
- var home = process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME;
3215
- var defaultRcPath = require$$0.join(home || "~/", ".nirc");
3216
- var rcPath = customRcPath || defaultRcPath;
3217
- var defaultConfig = {
3218
- defaultAgent: "prompt",
3219
- globalAgent: "npm"
3201
+ if (opt.all && found.length)
3202
+ return found;
3203
+ if (opt.nothrow)
3204
+ return null;
3205
+ throw getNotFoundError$1(cmd);
3220
3206
  };
3221
- var config;
3222
- async function getConfig() {
3223
- var _a;
3224
- if (!config) {
3225
- const result = await findUp("package.json") || "";
3226
- let packageManager = "";
3227
- if (result)
3228
- packageManager = (_a = JSON.parse(fs$1.readFileSync(result, "utf8")).packageManager) != null ? _a : "";
3229
- const [, agent, version3] = packageManager.match(new RegExp(`^(${Object.values(LOCKS).join("|")})@(d).*?$`)) || [];
3230
- if (agent)
3231
- config = Object.assign({}, defaultConfig, { defaultAgent: agent === "yarn" && parseInt(version3) > 1 ? "yarn@berry" : agent });
3232
- else if (!fs$1.existsSync(rcPath))
3233
- config = defaultConfig;
3234
- else
3235
- config = Object.assign({}, defaultConfig, ini.parse(fs$1.readFileSync(rcPath, "utf-8")));
3207
+ var which_1 = which$2;
3208
+ which$2.sync = whichSync$1;
3209
+ var pathKeyExports = {};
3210
+ var pathKey$2 = {
3211
+ get exports() {
3212
+ return pathKeyExports;
3213
+ },
3214
+ set exports(v) {
3215
+ pathKeyExports = v;
3236
3216
  }
3237
- return config;
3238
- }
3239
- async function getDefaultAgent() {
3240
- const { defaultAgent } = await getConfig();
3241
- if (defaultAgent === "prompt" && process.env.CI)
3242
- return "npm";
3243
- return defaultAgent;
3244
- }
3245
- async function getGlobalAgent() {
3246
- const { globalAgent } = await getConfig();
3247
- return globalAgent;
3248
- }
3249
- var crossSpawn = { exports: {} };
3250
- var pathKey$2 = { exports: {} };
3217
+ };
3251
3218
  var pathKey$1 = (options = {}) => {
3252
3219
  const environment = options.env || process.env;
3253
3220
  const platform = options.platform || process.platform;
@@ -3257,10 +3224,10 @@ var pathKey$1 = (options = {}) => {
3257
3224
  return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
3258
3225
  };
3259
3226
  pathKey$2.exports = pathKey$1;
3260
- pathKey$2.exports.default = pathKey$1;
3227
+ pathKeyExports.default = pathKey$1;
3261
3228
  var path$1 = require$$0;
3262
- var which = which_1;
3263
- var getPathKey = pathKey$2.exports;
3229
+ var which$1 = which_1;
3230
+ var getPathKey = pathKeyExports;
3264
3231
  function resolveCommandAttempt(parsed, withoutPathExt) {
3265
3232
  const env2 = parsed.options.env || process.env;
3266
3233
  const cwd = process.cwd();
@@ -3274,7 +3241,7 @@ function resolveCommandAttempt(parsed, withoutPathExt) {
3274
3241
  }
3275
3242
  let resolved;
3276
3243
  try {
3277
- resolved = which.sync(parsed.command, {
3244
+ resolved = which$1.sync(parsed.command, {
3278
3245
  path: env2[getPathKey({ env: env2 })],
3279
3246
  pathExt: withoutPathExt ? path$1.delimiter : void 0
3280
3247
  });
@@ -3455,10 +3422,10 @@ function spawnSync(command, args, options) {
3455
3422
  return result;
3456
3423
  }
3457
3424
  crossSpawn.exports = spawn;
3458
- crossSpawn.exports.spawn = spawn;
3459
- crossSpawn.exports.sync = spawnSync;
3460
- crossSpawn.exports._parse = parse;
3461
- crossSpawn.exports._enoent = enoent;
3425
+ crossSpawnExports.spawn = spawn;
3426
+ crossSpawnExports.sync = spawnSync;
3427
+ crossSpawnExports._parse = parse;
3428
+ crossSpawnExports._enoent = enoent;
3462
3429
  function stripFinalNewline(input) {
3463
3430
  const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
3464
3431
  const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
@@ -4015,12 +3982,28 @@ var normalizeStdio = (options) => {
4015
3982
  const length = Math.max(stdio.length, aliases.length);
4016
3983
  return Array.from({ length }, (value, index) => stdio[index]);
4017
3984
  };
4018
- var signalExit = { exports: {} };
4019
- var signals$1 = { exports: {} };
3985
+ var signalExitExports = {};
3986
+ var signalExit = {
3987
+ get exports() {
3988
+ return signalExitExports;
3989
+ },
3990
+ set exports(v) {
3991
+ signalExitExports = v;
3992
+ }
3993
+ };
3994
+ var signalsExports = {};
3995
+ var signals$1 = {
3996
+ get exports() {
3997
+ return signalsExports;
3998
+ },
3999
+ set exports(v) {
4000
+ signalsExports = v;
4001
+ }
4002
+ };
4020
4003
  var hasRequiredSignals;
4021
4004
  function requireSignals() {
4022
4005
  if (hasRequiredSignals)
4023
- return signals$1.exports;
4006
+ return signalsExports;
4024
4007
  hasRequiredSignals = 1;
4025
4008
  (function(module) {
4026
4009
  module.exports = [
@@ -4052,7 +4035,7 @@ function requireSignals() {
4052
4035
  );
4053
4036
  }
4054
4037
  })(signals$1);
4055
- return signals$1.exports;
4038
+ return signalsExports;
4056
4039
  }
4057
4040
  var process$1 = commonjsGlobal.process;
4058
4041
  var processOk = function(process2) {
@@ -4119,7 +4102,7 @@ if (!processOk(process$1)) {
4119
4102
  process$1.reallyExit = originalProcessReallyExit;
4120
4103
  emitter.count -= 1;
4121
4104
  };
4122
- signalExit.exports.unload = unload;
4105
+ signalExitExports.unload = unload;
4123
4106
  emit = function emit2(event, code, signal) {
4124
4107
  if (emitter.emitted[event]) {
4125
4108
  return;
@@ -4145,7 +4128,7 @@ if (!processOk(process$1)) {
4145
4128
  }
4146
4129
  };
4147
4130
  });
4148
- signalExit.exports.signals = function() {
4131
+ signalExitExports.signals = function() {
4149
4132
  return signals;
4150
4133
  };
4151
4134
  loaded = false;
@@ -4166,7 +4149,7 @@ if (!processOk(process$1)) {
4166
4149
  process$1.emit = processEmit;
4167
4150
  process$1.reallyExit = processReallyExit;
4168
4151
  };
4169
- signalExit.exports.load = load;
4152
+ signalExitExports.load = load;
4170
4153
  originalProcessReallyExit = process$1.reallyExit;
4171
4154
  processReallyExit = function processReallyExit2(code) {
4172
4155
  if (!processOk(commonjsGlobal.process)) {
@@ -4225,7 +4208,7 @@ var setKillTimeout = (kill, signal, options, killResult) => {
4225
4208
  }
4226
4209
  };
4227
4210
  var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
4228
- var isSigterm = (signal) => signal === os$2.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
4211
+ var isSigterm = (signal) => signal === os$1.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
4229
4212
  var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
4230
4213
  if (forceKillAfterTimeout === true) {
4231
4214
  return DEFAULT_FORCE_KILL_TIMEOUT;
@@ -4269,7 +4252,7 @@ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
4269
4252
  if (!cleanup || detached) {
4270
4253
  return timedPromise;
4271
4254
  }
4272
- const removeExitHandler = signalExit.exports(() => {
4255
+ const removeExitHandler = signalExitExports(() => {
4273
4256
  spawned.kill();
4274
4257
  });
4275
4258
  return timedPromise.finally(() => {
@@ -4279,7 +4262,15 @@ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
4279
4262
  function isStream(stream2) {
4280
4263
  return stream2 !== null && typeof stream2 === "object" && typeof stream2.pipe === "function";
4281
4264
  }
4282
- var getStream$1 = { exports: {} };
4265
+ var getStreamExports = {};
4266
+ var getStream$1 = {
4267
+ get exports() {
4268
+ return getStreamExports;
4269
+ },
4270
+ set exports(v) {
4271
+ getStreamExports = v;
4272
+ }
4273
+ };
4283
4274
  var { PassThrough: PassThroughStream } = require$$0$3;
4284
4275
  var bufferStream$1 = (options) => {
4285
4276
  options = { ...options };
@@ -4363,9 +4354,9 @@ async function getStream(inputStream, options) {
4363
4354
  return stream2.getBufferedValue();
4364
4355
  }
4365
4356
  getStream$1.exports = getStream;
4366
- getStream$1.exports.buffer = (stream2, options) => getStream(stream2, { ...options, encoding: "buffer" });
4367
- getStream$1.exports.array = (stream2, options) => getStream(stream2, { ...options, array: true });
4368
- getStream$1.exports.MaxBufferError = MaxBufferError;
4357
+ getStreamExports.buffer = (stream2, options) => getStream(stream2, { ...options, encoding: "buffer" });
4358
+ getStreamExports.array = (stream2, options) => getStream(stream2, { ...options, array: true });
4359
+ getStreamExports.MaxBufferError = MaxBufferError;
4369
4360
  var { PassThrough } = require$$0$3;
4370
4361
  var mergeStream = function() {
4371
4362
  var sources = [];
@@ -4438,9 +4429,9 @@ var getStreamPromise = (stream2, { encoding, buffer, maxBuffer }) => {
4438
4429
  return;
4439
4430
  }
4440
4431
  if (encoding) {
4441
- return getStream$1.exports(stream2, { encoding, maxBuffer });
4432
+ return getStreamExports(stream2, { encoding, maxBuffer });
4442
4433
  }
4443
- return getStream$1.exports.buffer(stream2, { maxBuffer });
4434
+ return getStreamExports.buffer(stream2, { maxBuffer });
4444
4435
  };
4445
4436
  var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
4446
4437
  const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
@@ -4521,7 +4512,7 @@ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) =>
4521
4512
  return env2;
4522
4513
  };
4523
4514
  var handleArguments = (file, args, options = {}) => {
4524
- const parsed = crossSpawn.exports._parse(file, args, options);
4515
+ const parsed = crossSpawnExports._parse(file, args, options);
4525
4516
  file = parsed.command;
4526
4517
  args = parsed.args;
4527
4518
  options = parsed.options;
@@ -4752,7 +4743,7 @@ var hasFlag$2 = (flag, argv = process.argv) => {
4752
4743
  const terminatorPosition = argv.indexOf("--");
4753
4744
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
4754
4745
  };
4755
- var os = os$1;
4746
+ var os = require$$0$5;
4756
4747
  var tty = require$$1;
4757
4748
  var hasFlag$1 = hasFlag$2;
4758
4749
  var { env } = process;
@@ -5322,14 +5313,14 @@ function requireStyle$1() {
5322
5313
  default: c.cyan("?")
5323
5314
  });
5324
5315
  const symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default;
5325
- const delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
5316
+ const delimiter2 = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
5326
5317
  const item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
5327
5318
  style$1 = {
5328
5319
  styles,
5329
5320
  render,
5330
5321
  symbols,
5331
5322
  symbol,
5332
- delimiter,
5323
+ delimiter: delimiter2,
5333
5324
  item
5334
5325
  };
5335
5326
  return style$1;
@@ -5411,7 +5402,7 @@ function requirePrompt$1() {
5411
5402
  if (hasRequiredPrompt$1)
5412
5403
  return prompt$1;
5413
5404
  hasRequiredPrompt$1 = 1;
5414
- const readline = require$$0$5;
5405
+ const readline = require$$0$6;
5415
5406
  const _require = requireUtil$1(), action2 = _require.action;
5416
5407
  const EventEmitter = require$$2;
5417
5408
  const _require2 = requireSrc(), beep = _require2.beep, cursor = _require2.cursor;
@@ -7437,9 +7428,9 @@ function requirePrompts$1() {
7437
7428
  $2.date = (args) => toPrompt("DatePrompt", args);
7438
7429
  $2.confirm = (args) => toPrompt("ConfirmPrompt", args);
7439
7430
  $2.list = (args) => {
7440
- const sep = args.separator || ",";
7431
+ const sep2 = args.separator || ",";
7441
7432
  return toPrompt("TextPrompt", args, {
7442
- onSubmit: (str) => str.split(sep).map((s) => s.trim())
7433
+ onSubmit: (str) => str.split(sep2).map((s) => s.trim())
7443
7434
  });
7444
7435
  };
7445
7436
  $2.toggle = (args) => toPrompt("TogglePrompt", args);
@@ -7863,14 +7854,14 @@ function requireStyle() {
7863
7854
  default: c.cyan("?")
7864
7855
  });
7865
7856
  const symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default;
7866
- const delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
7857
+ const delimiter2 = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
7867
7858
  const item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
7868
7859
  style = {
7869
7860
  styles,
7870
7861
  render,
7871
7862
  symbols,
7872
7863
  symbol,
7873
- delimiter,
7864
+ delimiter: delimiter2,
7874
7865
  item
7875
7866
  };
7876
7867
  return style;
@@ -7949,7 +7940,7 @@ function requirePrompt() {
7949
7940
  if (hasRequiredPrompt)
7950
7941
  return prompt;
7951
7942
  hasRequiredPrompt = 1;
7952
- const readline = require$$0$5;
7943
+ const readline = require$$0$6;
7953
7944
  const { action: action2 } = requireUtil();
7954
7945
  const EventEmitter = require$$2;
7955
7946
  const { beep, cursor } = requireSrc();
@@ -9853,9 +9844,9 @@ function requirePrompts() {
9853
9844
  $2.date = (args) => toPrompt("DatePrompt", args);
9854
9845
  $2.confirm = (args) => toPrompt("ConfirmPrompt", args);
9855
9846
  $2.list = (args) => {
9856
- const sep = args.separator || ",";
9847
+ const sep2 = args.separator || ",";
9857
9848
  return toPrompt("TextPrompt", args, {
9858
- onSubmit: (str) => str.split(sep).map((s) => s.trim())
9849
+ onSubmit: (str) => str.split(sep2).map((s) => s.trim())
9859
9850
  });
9860
9851
  };
9861
9852
  $2.toggle = (args) => toPrompt("TogglePrompt", args);
@@ -9887,11 +9878,11 @@ function requirePrompts() {
9887
9878
  })(prompts$1);
9888
9879
  return prompts$1;
9889
9880
  }
9890
- var lib;
9881
+ var lib$1;
9891
9882
  var hasRequiredLib;
9892
9883
  function requireLib() {
9893
9884
  if (hasRequiredLib)
9894
- return lib;
9885
+ return lib$1;
9895
9886
  hasRequiredLib = 1;
9896
9887
  const prompts3 = requirePrompts();
9897
9888
  const passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
@@ -9962,8 +9953,8 @@ function requireLib() {
9962
9953
  function override(answers) {
9963
9954
  prompt2._override = Object.assign({}, answers);
9964
9955
  }
9965
- lib = Object.assign(prompt2, { prompt: prompt2, prompts: prompts3, inject, override });
9966
- return lib;
9956
+ lib$1 = Object.assign(prompt2, { prompt: prompt2, prompts: prompts3, inject, override });
9957
+ return lib$1;
9967
9958
  }
9968
9959
  function isNodeLT(tar) {
9969
9960
  tar = (Array.isArray(tar) ? tar : tar.split(".")).map(Number);
@@ -9977,7 +9968,111 @@ function isNodeLT(tar) {
9977
9968
  return false;
9978
9969
  }
9979
9970
  var prompts = isNodeLT("8.6.0") ? requireDist() : requireLib();
9980
- async function detect({ autoInstall, cwd }) {
9971
+ var isexe = isexe_1;
9972
+ var { join: join2, delimiter, sep, posix } = require$$0;
9973
+ var isWindows = process.platform === "win32";
9974
+ var rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
9975
+ var rRel = new RegExp(`^\\.${rSlash.source}`);
9976
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
9977
+ var getPathInfo = (cmd, {
9978
+ path: optPath = process.env.PATH,
9979
+ pathExt: optPathExt = process.env.PATHEXT,
9980
+ delimiter: optDelimiter = delimiter
9981
+ }) => {
9982
+ const pathEnv = cmd.match(rSlash) ? [""] : [
9983
+ ...isWindows ? [process.cwd()] : [],
9984
+ ...(optPath || "").split(optDelimiter)
9985
+ ];
9986
+ if (isWindows) {
9987
+ const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
9988
+ const pathExt = pathExtExe.split(optDelimiter);
9989
+ if (cmd.includes(".") && pathExt[0] !== "") {
9990
+ pathExt.unshift("");
9991
+ }
9992
+ return { pathEnv, pathExt, pathExtExe };
9993
+ }
9994
+ return { pathEnv, pathExt: [""] };
9995
+ };
9996
+ var getPathPart = (raw, cmd) => {
9997
+ const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
9998
+ const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
9999
+ return prefix + join2(pathPart, cmd);
10000
+ };
10001
+ var which = async (cmd, opt = {}) => {
10002
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
10003
+ const found = [];
10004
+ for (const envPart of pathEnv) {
10005
+ const p = getPathPart(envPart, cmd);
10006
+ for (const ext of pathExt) {
10007
+ const withExt = p + ext;
10008
+ const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true });
10009
+ if (is) {
10010
+ if (!opt.all) {
10011
+ return withExt;
10012
+ }
10013
+ found.push(withExt);
10014
+ }
10015
+ }
10016
+ }
10017
+ if (opt.all && found.length) {
10018
+ return found;
10019
+ }
10020
+ if (opt.nothrow) {
10021
+ return null;
10022
+ }
10023
+ throw getNotFoundError(cmd);
10024
+ };
10025
+ var whichSync = (cmd, opt = {}) => {
10026
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
10027
+ const found = [];
10028
+ for (const pathEnvPart of pathEnv) {
10029
+ const p = getPathPart(pathEnvPart, cmd);
10030
+ for (const ext of pathExt) {
10031
+ const withExt = p + ext;
10032
+ const is = isexe.sync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
10033
+ if (is) {
10034
+ if (!opt.all) {
10035
+ return withExt;
10036
+ }
10037
+ found.push(withExt);
10038
+ }
10039
+ }
10040
+ }
10041
+ if (opt.all && found.length) {
10042
+ return found;
10043
+ }
10044
+ if (opt.nothrow) {
10045
+ return null;
10046
+ }
10047
+ throw getNotFoundError(cmd);
10048
+ };
10049
+ var lib = which;
10050
+ which.sync = whichSync;
10051
+ function remove(arr, v) {
10052
+ const index = arr.indexOf(v);
10053
+ if (index >= 0)
10054
+ arr.splice(index, 1);
10055
+ return arr;
10056
+ }
10057
+ function exclude(arr, v) {
10058
+ return remove(arr.slice(), v);
10059
+ }
10060
+ function cmdExists(cmd) {
10061
+ try {
10062
+ execSync(
10063
+ require$$0$5.platform() === "win32" ? `cmd /c "(help ${cmd} > nul || exit 0) && where ${cmd} > nul 2> nul"` : `command -v ${cmd}`
10064
+ );
10065
+ return true;
10066
+ } catch {
10067
+ return false;
10068
+ }
10069
+ }
10070
+ function getVoltaPrefix() {
10071
+ const VOLTA_PREFIX = "volta run";
10072
+ const hasVoltaCommand = lib.sync("volta", { nothrow: true }) !== null;
10073
+ return hasVoltaCommand ? VOLTA_PREFIX : "";
10074
+ }
10075
+ async function detect({ autoInstall, cwd } = {}) {
9981
10076
  let agent = null;
9982
10077
  const lockPath = await findUp(Object.keys(LOCKS), { cwd });
9983
10078
  let packageJsonPath;
@@ -10023,6 +10118,31 @@ async function detect({ autoInstall, cwd }) {
10023
10118
  }
10024
10119
  return agent;
10025
10120
  }
10121
+ function getCommand(agent, command, args = []) {
10122
+ if (!(agent in AGENTS))
10123
+ throw new Error(`Unsupported agent "${agent}"`);
10124
+ const c = AGENTS[agent][command];
10125
+ if (typeof c === "function")
10126
+ return c(args);
10127
+ if (!c)
10128
+ throw new Error(`Command "${command}" is not support by agent "${agent}"`);
10129
+ return c.replace("{0}", args.join(" ")).trim();
10130
+ }
10131
+ var parseNi = (agent, args, ctx) => {
10132
+ if (agent === "bun")
10133
+ args = args.map((i) => i === "-D" ? "-d" : i);
10134
+ if (args.includes("-g"))
10135
+ return getCommand(agent, "global", exclude(args, "-g"));
10136
+ if (args.includes("--frozen-if-present")) {
10137
+ args = exclude(args, "--frozen-if-present");
10138
+ return getCommand(agent, (ctx == null ? void 0 : ctx.hasLock) ? "frozen" : "install", args);
10139
+ }
10140
+ if (args.includes("--frozen"))
10141
+ return getCommand(agent, "frozen", exclude(args, "--frozen"));
10142
+ if (args.length === 0 || args.every((i) => i.startsWith("-")))
10143
+ return getCommand(agent, "install", args);
10144
+ return getCommand(agent, "add", args);
10145
+ };
10026
10146
  var FORCE_COLOR;
10027
10147
  var NODE_DISABLE_COLORS;
10028
10148
  var NO_COLOR;
@@ -10117,7 +10237,7 @@ function init(open, close) {
10117
10237
  return txt === void 0 ? chain([open], [blk]) : $.enabled ? run$1([blk], txt + "") : txt + "";
10118
10238
  };
10119
10239
  }
10120
- var version2 = "0.18.8";
10240
+ var version2 = "0.19.0";
10121
10241
  var DEBUG_SIGN = "?";
10122
10242
  async function run(fn, args, options = {}) {
10123
10243
  const debug2 = args.includes(DEBUG_SIGN);
@@ -10187,7 +10307,7 @@ import fs3 from "fs-extra";
10187
10307
 
10188
10308
  // node/options.ts
10189
10309
  init_esm_shims();
10190
- import { dirname, join as join2, resolve as resolve2 } from "path";
10310
+ import { dirname, join as join3, resolve as resolve2 } from "path";
10191
10311
  import { uniq } from "@antfu/utils";
10192
10312
  import _debug from "debug";
10193
10313
 
@@ -10292,7 +10412,7 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
10292
10412
  const addonRoots = getAddonRoots(addons, entry);
10293
10413
  const roots = uniq([clientRoot, ...themeRoots, ...addonRoots, userRoot]);
10294
10414
  if (themeRoots.length) {
10295
- const themeMeta = await getThemeMeta(theme, join2(themeRoots[0], "package.json"));
10415
+ const themeMeta = await getThemeMeta(theme, join3(themeRoots[0], "package.json"));
10296
10416
  data.themeMeta = themeMeta;
10297
10417
  if (themeMeta)
10298
10418
  data.config = parser.resolveConfig(data.headmatter, themeMeta, options.entry);