@kevisual/cli 0.0.64 → 0.0.65
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.
- package/dist/assistant-server.js +5930 -430
- package/dist/assistant.js +5670 -168
- package/dist/envision.js +1279 -603
- package/package.json +6 -2
package/dist/envision.js
CHANGED
|
@@ -22002,7 +22002,7 @@ var require_timespan = __commonJS((exports, module) => {
|
|
|
22002
22002
|
};
|
|
22003
22003
|
});
|
|
22004
22004
|
|
|
22005
|
-
// node_modules/.pnpm/semver@7.
|
|
22005
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js
|
|
22006
22006
|
var require_constants = __commonJS((exports, module) => {
|
|
22007
22007
|
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
22008
22008
|
var MAX_LENGTH = 256;
|
|
@@ -22030,13 +22030,13 @@ var require_constants = __commonJS((exports, module) => {
|
|
|
22030
22030
|
};
|
|
22031
22031
|
});
|
|
22032
22032
|
|
|
22033
|
-
// node_modules/.pnpm/semver@7.
|
|
22033
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js
|
|
22034
22034
|
var require_debug = __commonJS((exports, module) => {
|
|
22035
22035
|
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
22036
22036
|
module.exports = debug;
|
|
22037
22037
|
});
|
|
22038
22038
|
|
|
22039
|
-
// node_modules/.pnpm/semver@7.
|
|
22039
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js
|
|
22040
22040
|
var require_re = __commonJS((exports, module) => {
|
|
22041
22041
|
var {
|
|
22042
22042
|
MAX_SAFE_COMPONENT_LENGTH,
|
|
@@ -22048,6 +22048,7 @@ var require_re = __commonJS((exports, module) => {
|
|
|
22048
22048
|
var re = exports.re = [];
|
|
22049
22049
|
var safeRe = exports.safeRe = [];
|
|
22050
22050
|
var src = exports.src = [];
|
|
22051
|
+
var safeSrc = exports.safeSrc = [];
|
|
22051
22052
|
var t = exports.t = {};
|
|
22052
22053
|
var R = 0;
|
|
22053
22054
|
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
@@ -22068,6 +22069,7 @@ var require_re = __commonJS((exports, module) => {
|
|
|
22068
22069
|
debug(name, index, value);
|
|
22069
22070
|
t[name] = index;
|
|
22070
22071
|
src[index] = value;
|
|
22072
|
+
safeSrc[index] = safe;
|
|
22071
22073
|
re[index] = new RegExp(value, isGlobal ? "g" : undefined);
|
|
22072
22074
|
safeRe[index] = new RegExp(safe, isGlobal ? "g" : undefined);
|
|
22073
22075
|
};
|
|
@@ -22076,8 +22078,8 @@ var require_re = __commonJS((exports, module) => {
|
|
|
22076
22078
|
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
22077
22079
|
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`);
|
|
22078
22080
|
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
22079
|
-
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.
|
|
22080
|
-
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.
|
|
22081
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
22082
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
22081
22083
|
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
22082
22084
|
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
22083
22085
|
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
@@ -22119,7 +22121,7 @@ var require_re = __commonJS((exports, module) => {
|
|
|
22119
22121
|
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
22120
22122
|
});
|
|
22121
22123
|
|
|
22122
|
-
// node_modules/.pnpm/semver@7.
|
|
22124
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.js
|
|
22123
22125
|
var require_parse_options = __commonJS((exports, module) => {
|
|
22124
22126
|
var looseOption = Object.freeze({ loose: true });
|
|
22125
22127
|
var emptyOpts = Object.freeze({});
|
|
@@ -22135,10 +22137,13 @@ var require_parse_options = __commonJS((exports, module) => {
|
|
|
22135
22137
|
module.exports = parseOptions;
|
|
22136
22138
|
});
|
|
22137
22139
|
|
|
22138
|
-
// node_modules/.pnpm/semver@7.
|
|
22140
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js
|
|
22139
22141
|
var require_identifiers = __commonJS((exports, module) => {
|
|
22140
22142
|
var numeric = /^[0-9]+$/;
|
|
22141
22143
|
var compareIdentifiers = (a, b) => {
|
|
22144
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
22145
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
22146
|
+
}
|
|
22142
22147
|
const anum = numeric.test(a);
|
|
22143
22148
|
const bnum = numeric.test(b);
|
|
22144
22149
|
if (anum && bnum) {
|
|
@@ -22154,7 +22159,7 @@ var require_identifiers = __commonJS((exports, module) => {
|
|
|
22154
22159
|
};
|
|
22155
22160
|
});
|
|
22156
22161
|
|
|
22157
|
-
// node_modules/.pnpm/semver@7.
|
|
22162
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js
|
|
22158
22163
|
var require_semver = __commonJS((exports, module) => {
|
|
22159
22164
|
var debug = require_debug();
|
|
22160
22165
|
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
@@ -22241,7 +22246,25 @@ var require_semver = __commonJS((exports, module) => {
|
|
|
22241
22246
|
if (!(other instanceof SemVer)) {
|
|
22242
22247
|
other = new SemVer(other, this.options);
|
|
22243
22248
|
}
|
|
22244
|
-
|
|
22249
|
+
if (this.major < other.major) {
|
|
22250
|
+
return -1;
|
|
22251
|
+
}
|
|
22252
|
+
if (this.major > other.major) {
|
|
22253
|
+
return 1;
|
|
22254
|
+
}
|
|
22255
|
+
if (this.minor < other.minor) {
|
|
22256
|
+
return -1;
|
|
22257
|
+
}
|
|
22258
|
+
if (this.minor > other.minor) {
|
|
22259
|
+
return 1;
|
|
22260
|
+
}
|
|
22261
|
+
if (this.patch < other.patch) {
|
|
22262
|
+
return -1;
|
|
22263
|
+
}
|
|
22264
|
+
if (this.patch > other.patch) {
|
|
22265
|
+
return 1;
|
|
22266
|
+
}
|
|
22267
|
+
return 0;
|
|
22245
22268
|
}
|
|
22246
22269
|
comparePre(other) {
|
|
22247
22270
|
if (!(other instanceof SemVer)) {
|
|
@@ -22295,6 +22318,17 @@ var require_semver = __commonJS((exports, module) => {
|
|
|
22295
22318
|
} while (++i);
|
|
22296
22319
|
}
|
|
22297
22320
|
inc(release, identifier, identifierBase) {
|
|
22321
|
+
if (release.startsWith("pre")) {
|
|
22322
|
+
if (!identifier && identifierBase === false) {
|
|
22323
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
22324
|
+
}
|
|
22325
|
+
if (identifier) {
|
|
22326
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
22327
|
+
if (!match || match[1] !== identifier) {
|
|
22328
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
22329
|
+
}
|
|
22330
|
+
}
|
|
22331
|
+
}
|
|
22298
22332
|
switch (release) {
|
|
22299
22333
|
case "premajor":
|
|
22300
22334
|
this.prerelease.length = 0;
|
|
@@ -22320,6 +22354,12 @@ var require_semver = __commonJS((exports, module) => {
|
|
|
22320
22354
|
}
|
|
22321
22355
|
this.inc("pre", identifier, identifierBase);
|
|
22322
22356
|
break;
|
|
22357
|
+
case "release":
|
|
22358
|
+
if (this.prerelease.length === 0) {
|
|
22359
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
22360
|
+
}
|
|
22361
|
+
this.prerelease.length = 0;
|
|
22362
|
+
break;
|
|
22323
22363
|
case "major":
|
|
22324
22364
|
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
22325
22365
|
this.major++;
|
|
@@ -22343,9 +22383,6 @@ var require_semver = __commonJS((exports, module) => {
|
|
|
22343
22383
|
break;
|
|
22344
22384
|
case "pre": {
|
|
22345
22385
|
const base = Number(identifierBase) ? 1 : 0;
|
|
22346
|
-
if (!identifier && identifierBase === false) {
|
|
22347
|
-
throw new Error("invalid increment argument: identifier is empty");
|
|
22348
|
-
}
|
|
22349
22386
|
if (this.prerelease.length === 0) {
|
|
22350
22387
|
this.prerelease = [base];
|
|
22351
22388
|
} else {
|
|
@@ -22391,7 +22428,7 @@ var require_semver = __commonJS((exports, module) => {
|
|
|
22391
22428
|
module.exports = SemVer;
|
|
22392
22429
|
});
|
|
22393
22430
|
|
|
22394
|
-
// node_modules/.pnpm/semver@7.
|
|
22431
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js
|
|
22395
22432
|
var require_parse = __commonJS((exports, module) => {
|
|
22396
22433
|
var SemVer = require_semver();
|
|
22397
22434
|
var parse = (version2, options, throwErrors = false) => {
|
|
@@ -22410,7 +22447,7 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
22410
22447
|
module.exports = parse;
|
|
22411
22448
|
});
|
|
22412
22449
|
|
|
22413
|
-
// node_modules/.pnpm/semver@7.
|
|
22450
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js
|
|
22414
22451
|
var require_valid = __commonJS((exports, module) => {
|
|
22415
22452
|
var parse = require_parse();
|
|
22416
22453
|
var valid = (version2, options) => {
|
|
@@ -22420,7 +22457,7 @@ var require_valid = __commonJS((exports, module) => {
|
|
|
22420
22457
|
module.exports = valid;
|
|
22421
22458
|
});
|
|
22422
22459
|
|
|
22423
|
-
// node_modules/.pnpm/semver@7.
|
|
22460
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js
|
|
22424
22461
|
var require_clean = __commonJS((exports, module) => {
|
|
22425
22462
|
var parse = require_parse();
|
|
22426
22463
|
var clean = (version2, options) => {
|
|
@@ -22430,7 +22467,7 @@ var require_clean = __commonJS((exports, module) => {
|
|
|
22430
22467
|
module.exports = clean;
|
|
22431
22468
|
});
|
|
22432
22469
|
|
|
22433
|
-
// node_modules/.pnpm/semver@7.
|
|
22470
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js
|
|
22434
22471
|
var require_inc = __commonJS((exports, module) => {
|
|
22435
22472
|
var SemVer = require_semver();
|
|
22436
22473
|
var inc = (version2, release, options, identifier, identifierBase) => {
|
|
@@ -22448,7 +22485,7 @@ var require_inc = __commonJS((exports, module) => {
|
|
|
22448
22485
|
module.exports = inc;
|
|
22449
22486
|
});
|
|
22450
22487
|
|
|
22451
|
-
// node_modules/.pnpm/semver@7.
|
|
22488
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js
|
|
22452
22489
|
var require_diff = __commonJS((exports, module) => {
|
|
22453
22490
|
var parse = require_parse();
|
|
22454
22491
|
var diff = (version1, version2) => {
|
|
@@ -22467,13 +22504,12 @@ var require_diff = __commonJS((exports, module) => {
|
|
|
22467
22504
|
if (!lowVersion.patch && !lowVersion.minor) {
|
|
22468
22505
|
return "major";
|
|
22469
22506
|
}
|
|
22470
|
-
if (highVersion
|
|
22507
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
22508
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
22509
|
+
return "minor";
|
|
22510
|
+
}
|
|
22471
22511
|
return "patch";
|
|
22472
22512
|
}
|
|
22473
|
-
if (highVersion.minor) {
|
|
22474
|
-
return "minor";
|
|
22475
|
-
}
|
|
22476
|
-
return "major";
|
|
22477
22513
|
}
|
|
22478
22514
|
const prefix = highHasPre ? "pre" : "";
|
|
22479
22515
|
if (v1.major !== v2.major) {
|
|
@@ -22490,28 +22526,28 @@ var require_diff = __commonJS((exports, module) => {
|
|
|
22490
22526
|
module.exports = diff;
|
|
22491
22527
|
});
|
|
22492
22528
|
|
|
22493
|
-
// node_modules/.pnpm/semver@7.
|
|
22529
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.js
|
|
22494
22530
|
var require_major = __commonJS((exports, module) => {
|
|
22495
22531
|
var SemVer = require_semver();
|
|
22496
22532
|
var major = (a, loose) => new SemVer(a, loose).major;
|
|
22497
22533
|
module.exports = major;
|
|
22498
22534
|
});
|
|
22499
22535
|
|
|
22500
|
-
// node_modules/.pnpm/semver@7.
|
|
22536
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.js
|
|
22501
22537
|
var require_minor = __commonJS((exports, module) => {
|
|
22502
22538
|
var SemVer = require_semver();
|
|
22503
22539
|
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
22504
22540
|
module.exports = minor;
|
|
22505
22541
|
});
|
|
22506
22542
|
|
|
22507
|
-
// node_modules/.pnpm/semver@7.
|
|
22543
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.js
|
|
22508
22544
|
var require_patch = __commonJS((exports, module) => {
|
|
22509
22545
|
var SemVer = require_semver();
|
|
22510
22546
|
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
22511
22547
|
module.exports = patch;
|
|
22512
22548
|
});
|
|
22513
22549
|
|
|
22514
|
-
// node_modules/.pnpm/semver@7.
|
|
22550
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js
|
|
22515
22551
|
var require_prerelease = __commonJS((exports, module) => {
|
|
22516
22552
|
var parse = require_parse();
|
|
22517
22553
|
var prerelease = (version2, options) => {
|
|
@@ -22521,28 +22557,28 @@ var require_prerelease = __commonJS((exports, module) => {
|
|
|
22521
22557
|
module.exports = prerelease;
|
|
22522
22558
|
});
|
|
22523
22559
|
|
|
22524
|
-
// node_modules/.pnpm/semver@7.
|
|
22560
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js
|
|
22525
22561
|
var require_compare = __commonJS((exports, module) => {
|
|
22526
22562
|
var SemVer = require_semver();
|
|
22527
22563
|
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
22528
22564
|
module.exports = compare;
|
|
22529
22565
|
});
|
|
22530
22566
|
|
|
22531
|
-
// node_modules/.pnpm/semver@7.
|
|
22567
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.js
|
|
22532
22568
|
var require_rcompare = __commonJS((exports, module) => {
|
|
22533
22569
|
var compare = require_compare();
|
|
22534
22570
|
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
22535
22571
|
module.exports = rcompare;
|
|
22536
22572
|
});
|
|
22537
22573
|
|
|
22538
|
-
// node_modules/.pnpm/semver@7.
|
|
22574
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.js
|
|
22539
22575
|
var require_compare_loose = __commonJS((exports, module) => {
|
|
22540
22576
|
var compare = require_compare();
|
|
22541
22577
|
var compareLoose = (a, b) => compare(a, b, true);
|
|
22542
22578
|
module.exports = compareLoose;
|
|
22543
22579
|
});
|
|
22544
22580
|
|
|
22545
|
-
// node_modules/.pnpm/semver@7.
|
|
22581
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.js
|
|
22546
22582
|
var require_compare_build = __commonJS((exports, module) => {
|
|
22547
22583
|
var SemVer = require_semver();
|
|
22548
22584
|
var compareBuild = (a, b, loose) => {
|
|
@@ -22553,67 +22589,67 @@ var require_compare_build = __commonJS((exports, module) => {
|
|
|
22553
22589
|
module.exports = compareBuild;
|
|
22554
22590
|
});
|
|
22555
22591
|
|
|
22556
|
-
// node_modules/.pnpm/semver@7.
|
|
22592
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.js
|
|
22557
22593
|
var require_sort = __commonJS((exports, module) => {
|
|
22558
22594
|
var compareBuild = require_compare_build();
|
|
22559
22595
|
var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
22560
22596
|
module.exports = sort;
|
|
22561
22597
|
});
|
|
22562
22598
|
|
|
22563
|
-
// node_modules/.pnpm/semver@7.
|
|
22599
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.js
|
|
22564
22600
|
var require_rsort = __commonJS((exports, module) => {
|
|
22565
22601
|
var compareBuild = require_compare_build();
|
|
22566
22602
|
var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
22567
22603
|
module.exports = rsort;
|
|
22568
22604
|
});
|
|
22569
22605
|
|
|
22570
|
-
// node_modules/.pnpm/semver@7.
|
|
22606
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.js
|
|
22571
22607
|
var require_gt = __commonJS((exports, module) => {
|
|
22572
22608
|
var compare = require_compare();
|
|
22573
|
-
var
|
|
22574
|
-
module.exports =
|
|
22609
|
+
var gt2 = (a, b, loose) => compare(a, b, loose) > 0;
|
|
22610
|
+
module.exports = gt2;
|
|
22575
22611
|
});
|
|
22576
22612
|
|
|
22577
|
-
// node_modules/.pnpm/semver@7.
|
|
22613
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.js
|
|
22578
22614
|
var require_lt = __commonJS((exports, module) => {
|
|
22579
22615
|
var compare = require_compare();
|
|
22580
22616
|
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
22581
22617
|
module.exports = lt;
|
|
22582
22618
|
});
|
|
22583
22619
|
|
|
22584
|
-
// node_modules/.pnpm/semver@7.
|
|
22620
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.js
|
|
22585
22621
|
var require_eq = __commonJS((exports, module) => {
|
|
22586
22622
|
var compare = require_compare();
|
|
22587
22623
|
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
22588
22624
|
module.exports = eq;
|
|
22589
22625
|
});
|
|
22590
22626
|
|
|
22591
|
-
// node_modules/.pnpm/semver@7.
|
|
22627
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.js
|
|
22592
22628
|
var require_neq = __commonJS((exports, module) => {
|
|
22593
22629
|
var compare = require_compare();
|
|
22594
22630
|
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
22595
22631
|
module.exports = neq;
|
|
22596
22632
|
});
|
|
22597
22633
|
|
|
22598
|
-
// node_modules/.pnpm/semver@7.
|
|
22634
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js
|
|
22599
22635
|
var require_gte = __commonJS((exports, module) => {
|
|
22600
22636
|
var compare = require_compare();
|
|
22601
22637
|
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
22602
22638
|
module.exports = gte;
|
|
22603
22639
|
});
|
|
22604
22640
|
|
|
22605
|
-
// node_modules/.pnpm/semver@7.
|
|
22641
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.js
|
|
22606
22642
|
var require_lte = __commonJS((exports, module) => {
|
|
22607
22643
|
var compare = require_compare();
|
|
22608
22644
|
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
22609
22645
|
module.exports = lte;
|
|
22610
22646
|
});
|
|
22611
22647
|
|
|
22612
|
-
// node_modules/.pnpm/semver@7.
|
|
22648
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.js
|
|
22613
22649
|
var require_cmp = __commonJS((exports, module) => {
|
|
22614
22650
|
var eq = require_eq();
|
|
22615
22651
|
var neq = require_neq();
|
|
22616
|
-
var
|
|
22652
|
+
var gt2 = require_gt();
|
|
22617
22653
|
var gte = require_gte();
|
|
22618
22654
|
var lt = require_lt();
|
|
22619
22655
|
var lte = require_lte();
|
|
@@ -22642,7 +22678,7 @@ var require_cmp = __commonJS((exports, module) => {
|
|
|
22642
22678
|
case "!=":
|
|
22643
22679
|
return neq(a, b, loose);
|
|
22644
22680
|
case ">":
|
|
22645
|
-
return
|
|
22681
|
+
return gt2(a, b, loose);
|
|
22646
22682
|
case ">=":
|
|
22647
22683
|
return gte(a, b, loose);
|
|
22648
22684
|
case "<":
|
|
@@ -22656,7 +22692,7 @@ var require_cmp = __commonJS((exports, module) => {
|
|
|
22656
22692
|
module.exports = cmp;
|
|
22657
22693
|
});
|
|
22658
22694
|
|
|
22659
|
-
// node_modules/.pnpm/semver@7.
|
|
22695
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js
|
|
22660
22696
|
var require_coerce = __commonJS((exports, module) => {
|
|
22661
22697
|
var SemVer = require_semver();
|
|
22662
22698
|
var parse = require_parse();
|
|
@@ -22699,7 +22735,7 @@ var require_coerce = __commonJS((exports, module) => {
|
|
|
22699
22735
|
module.exports = coerce;
|
|
22700
22736
|
});
|
|
22701
22737
|
|
|
22702
|
-
// node_modules/.pnpm/semver@7.
|
|
22738
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.js
|
|
22703
22739
|
var require_lrucache = __commonJS((exports, module) => {
|
|
22704
22740
|
class LRUCache {
|
|
22705
22741
|
constructor() {
|
|
@@ -22734,7 +22770,7 @@ var require_lrucache = __commonJS((exports, module) => {
|
|
|
22734
22770
|
module.exports = LRUCache;
|
|
22735
22771
|
});
|
|
22736
22772
|
|
|
22737
|
-
// node_modules/.pnpm/semver@7.
|
|
22773
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.js
|
|
22738
22774
|
var require_range2 = __commonJS((exports, module) => {
|
|
22739
22775
|
var SPACE_CHARACTERS = /\s+/g;
|
|
22740
22776
|
|
|
@@ -22905,6 +22941,7 @@ var require_range2 = __commonJS((exports, module) => {
|
|
|
22905
22941
|
return result;
|
|
22906
22942
|
};
|
|
22907
22943
|
var parseComparator = (comp, options) => {
|
|
22944
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
22908
22945
|
debug("comp", comp, options);
|
|
22909
22946
|
comp = replaceCarets(comp, options);
|
|
22910
22947
|
debug("caret", comp);
|
|
@@ -23107,7 +23144,7 @@ var require_range2 = __commonJS((exports, module) => {
|
|
|
23107
23144
|
};
|
|
23108
23145
|
});
|
|
23109
23146
|
|
|
23110
|
-
// node_modules/.pnpm/semver@7.
|
|
23147
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.js
|
|
23111
23148
|
var require_comparator = __commonJS((exports, module) => {
|
|
23112
23149
|
var ANY = Symbol("SemVer ANY");
|
|
23113
23150
|
|
|
@@ -23218,7 +23255,7 @@ var require_comparator = __commonJS((exports, module) => {
|
|
|
23218
23255
|
var Range = require_range2();
|
|
23219
23256
|
});
|
|
23220
23257
|
|
|
23221
|
-
// node_modules/.pnpm/semver@7.
|
|
23258
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.js
|
|
23222
23259
|
var require_satisfies = __commonJS((exports, module) => {
|
|
23223
23260
|
var Range = require_range2();
|
|
23224
23261
|
var satisfies = (version2, range, options) => {
|
|
@@ -23232,14 +23269,14 @@ var require_satisfies = __commonJS((exports, module) => {
|
|
|
23232
23269
|
module.exports = satisfies;
|
|
23233
23270
|
});
|
|
23234
23271
|
|
|
23235
|
-
// node_modules/.pnpm/semver@7.
|
|
23272
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.js
|
|
23236
23273
|
var require_to_comparators = __commonJS((exports, module) => {
|
|
23237
23274
|
var Range = require_range2();
|
|
23238
23275
|
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
23239
23276
|
module.exports = toComparators;
|
|
23240
23277
|
});
|
|
23241
23278
|
|
|
23242
|
-
// node_modules/.pnpm/semver@7.
|
|
23279
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.js
|
|
23243
23280
|
var require_max_satisfying = __commonJS((exports, module) => {
|
|
23244
23281
|
var SemVer = require_semver();
|
|
23245
23282
|
var Range = require_range2();
|
|
@@ -23265,7 +23302,7 @@ var require_max_satisfying = __commonJS((exports, module) => {
|
|
|
23265
23302
|
module.exports = maxSatisfying;
|
|
23266
23303
|
});
|
|
23267
23304
|
|
|
23268
|
-
// node_modules/.pnpm/semver@7.
|
|
23305
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.js
|
|
23269
23306
|
var require_min_satisfying = __commonJS((exports, module) => {
|
|
23270
23307
|
var SemVer = require_semver();
|
|
23271
23308
|
var Range = require_range2();
|
|
@@ -23291,11 +23328,11 @@ var require_min_satisfying = __commonJS((exports, module) => {
|
|
|
23291
23328
|
module.exports = minSatisfying;
|
|
23292
23329
|
});
|
|
23293
23330
|
|
|
23294
|
-
// node_modules/.pnpm/semver@7.
|
|
23331
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.js
|
|
23295
23332
|
var require_min_version = __commonJS((exports, module) => {
|
|
23296
23333
|
var SemVer = require_semver();
|
|
23297
23334
|
var Range = require_range2();
|
|
23298
|
-
var
|
|
23335
|
+
var gt2 = require_gt();
|
|
23299
23336
|
var minVersion = (range, loose) => {
|
|
23300
23337
|
range = new Range(range, loose);
|
|
23301
23338
|
let minver = new SemVer("0.0.0");
|
|
@@ -23322,7 +23359,7 @@ var require_min_version = __commonJS((exports, module) => {
|
|
|
23322
23359
|
compver.raw = compver.format();
|
|
23323
23360
|
case "":
|
|
23324
23361
|
case ">=":
|
|
23325
|
-
if (!setMin ||
|
|
23362
|
+
if (!setMin || gt2(compver, setMin)) {
|
|
23326
23363
|
setMin = compver;
|
|
23327
23364
|
}
|
|
23328
23365
|
break;
|
|
@@ -23333,7 +23370,7 @@ var require_min_version = __commonJS((exports, module) => {
|
|
|
23333
23370
|
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
23334
23371
|
}
|
|
23335
23372
|
});
|
|
23336
|
-
if (setMin && (!minver ||
|
|
23373
|
+
if (setMin && (!minver || gt2(minver, setMin))) {
|
|
23337
23374
|
minver = setMin;
|
|
23338
23375
|
}
|
|
23339
23376
|
}
|
|
@@ -23345,7 +23382,7 @@ var require_min_version = __commonJS((exports, module) => {
|
|
|
23345
23382
|
module.exports = minVersion;
|
|
23346
23383
|
});
|
|
23347
23384
|
|
|
23348
|
-
// node_modules/.pnpm/semver@7.
|
|
23385
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.js
|
|
23349
23386
|
var require_valid2 = __commonJS((exports, module) => {
|
|
23350
23387
|
var Range = require_range2();
|
|
23351
23388
|
var validRange = (range, options) => {
|
|
@@ -23358,14 +23395,14 @@ var require_valid2 = __commonJS((exports, module) => {
|
|
|
23358
23395
|
module.exports = validRange;
|
|
23359
23396
|
});
|
|
23360
23397
|
|
|
23361
|
-
// node_modules/.pnpm/semver@7.
|
|
23398
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.js
|
|
23362
23399
|
var require_outside = __commonJS((exports, module) => {
|
|
23363
23400
|
var SemVer = require_semver();
|
|
23364
23401
|
var Comparator = require_comparator();
|
|
23365
23402
|
var { ANY } = Comparator;
|
|
23366
23403
|
var Range = require_range2();
|
|
23367
23404
|
var satisfies = require_satisfies();
|
|
23368
|
-
var
|
|
23405
|
+
var gt2 = require_gt();
|
|
23369
23406
|
var lt = require_lt();
|
|
23370
23407
|
var lte = require_lte();
|
|
23371
23408
|
var gte = require_gte();
|
|
@@ -23375,7 +23412,7 @@ var require_outside = __commonJS((exports, module) => {
|
|
|
23375
23412
|
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
23376
23413
|
switch (hilo) {
|
|
23377
23414
|
case ">":
|
|
23378
|
-
gtfn =
|
|
23415
|
+
gtfn = gt2;
|
|
23379
23416
|
ltefn = lte;
|
|
23380
23417
|
ltfn = lt;
|
|
23381
23418
|
comp = ">";
|
|
@@ -23384,7 +23421,7 @@ var require_outside = __commonJS((exports, module) => {
|
|
|
23384
23421
|
case "<":
|
|
23385
23422
|
gtfn = lt;
|
|
23386
23423
|
ltefn = gte;
|
|
23387
|
-
ltfn =
|
|
23424
|
+
ltfn = gt2;
|
|
23388
23425
|
comp = "<";
|
|
23389
23426
|
ecomp = "<=";
|
|
23390
23427
|
break;
|
|
@@ -23424,21 +23461,21 @@ var require_outside = __commonJS((exports, module) => {
|
|
|
23424
23461
|
module.exports = outside;
|
|
23425
23462
|
});
|
|
23426
23463
|
|
|
23427
|
-
// node_modules/.pnpm/semver@7.
|
|
23464
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.js
|
|
23428
23465
|
var require_gtr = __commonJS((exports, module) => {
|
|
23429
23466
|
var outside = require_outside();
|
|
23430
23467
|
var gtr = (version2, range, options) => outside(version2, range, ">", options);
|
|
23431
23468
|
module.exports = gtr;
|
|
23432
23469
|
});
|
|
23433
23470
|
|
|
23434
|
-
// node_modules/.pnpm/semver@7.
|
|
23471
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.js
|
|
23435
23472
|
var require_ltr = __commonJS((exports, module) => {
|
|
23436
23473
|
var outside = require_outside();
|
|
23437
23474
|
var ltr = (version2, range, options) => outside(version2, range, "<", options);
|
|
23438
23475
|
module.exports = ltr;
|
|
23439
23476
|
});
|
|
23440
23477
|
|
|
23441
|
-
// node_modules/.pnpm/semver@7.
|
|
23478
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.js
|
|
23442
23479
|
var require_intersects = __commonJS((exports, module) => {
|
|
23443
23480
|
var Range = require_range2();
|
|
23444
23481
|
var intersects = (r1, r2, options) => {
|
|
@@ -23449,7 +23486,7 @@ var require_intersects = __commonJS((exports, module) => {
|
|
|
23449
23486
|
module.exports = intersects;
|
|
23450
23487
|
});
|
|
23451
23488
|
|
|
23452
|
-
// node_modules/.pnpm/semver@7.
|
|
23489
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.js
|
|
23453
23490
|
var require_simplify = __commonJS((exports, module) => {
|
|
23454
23491
|
var satisfies = require_satisfies();
|
|
23455
23492
|
var compare = require_compare();
|
|
@@ -23496,7 +23533,7 @@ var require_simplify = __commonJS((exports, module) => {
|
|
|
23496
23533
|
};
|
|
23497
23534
|
});
|
|
23498
23535
|
|
|
23499
|
-
// node_modules/.pnpm/semver@7.
|
|
23536
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.js
|
|
23500
23537
|
var require_subset = __commonJS((exports, module) => {
|
|
23501
23538
|
var Range = require_range2();
|
|
23502
23539
|
var Comparator = require_comparator();
|
|
@@ -23548,10 +23585,10 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
23548
23585
|
}
|
|
23549
23586
|
}
|
|
23550
23587
|
const eqSet = new Set;
|
|
23551
|
-
let
|
|
23588
|
+
let gt2, lt;
|
|
23552
23589
|
for (const c of sub) {
|
|
23553
23590
|
if (c.operator === ">" || c.operator === ">=") {
|
|
23554
|
-
|
|
23591
|
+
gt2 = higherGT(gt2, c, options);
|
|
23555
23592
|
} else if (c.operator === "<" || c.operator === "<=") {
|
|
23556
23593
|
lt = lowerLT(lt, c, options);
|
|
23557
23594
|
} else {
|
|
@@ -23562,16 +23599,16 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
23562
23599
|
return null;
|
|
23563
23600
|
}
|
|
23564
23601
|
let gtltComp;
|
|
23565
|
-
if (
|
|
23566
|
-
gtltComp = compare(
|
|
23602
|
+
if (gt2 && lt) {
|
|
23603
|
+
gtltComp = compare(gt2.semver, lt.semver, options);
|
|
23567
23604
|
if (gtltComp > 0) {
|
|
23568
23605
|
return null;
|
|
23569
|
-
} else if (gtltComp === 0 && (
|
|
23606
|
+
} else if (gtltComp === 0 && (gt2.operator !== ">=" || lt.operator !== "<=")) {
|
|
23570
23607
|
return null;
|
|
23571
23608
|
}
|
|
23572
23609
|
}
|
|
23573
23610
|
for (const eq of eqSet) {
|
|
23574
|
-
if (
|
|
23611
|
+
if (gt2 && !satisfies(eq, String(gt2), options)) {
|
|
23575
23612
|
return null;
|
|
23576
23613
|
}
|
|
23577
23614
|
if (lt && !satisfies(eq, String(lt), options)) {
|
|
@@ -23587,25 +23624,25 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
23587
23624
|
let higher, lower;
|
|
23588
23625
|
let hasDomLT, hasDomGT;
|
|
23589
23626
|
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
23590
|
-
let needDomGTPre =
|
|
23627
|
+
let needDomGTPre = gt2 && !options.includePrerelease && gt2.semver.prerelease.length ? gt2.semver : false;
|
|
23591
23628
|
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
23592
23629
|
needDomLTPre = false;
|
|
23593
23630
|
}
|
|
23594
23631
|
for (const c of dom) {
|
|
23595
23632
|
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
23596
23633
|
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
23597
|
-
if (
|
|
23634
|
+
if (gt2) {
|
|
23598
23635
|
if (needDomGTPre) {
|
|
23599
23636
|
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
23600
23637
|
needDomGTPre = false;
|
|
23601
23638
|
}
|
|
23602
23639
|
}
|
|
23603
23640
|
if (c.operator === ">" || c.operator === ">=") {
|
|
23604
|
-
higher = higherGT(
|
|
23605
|
-
if (higher === c && higher !==
|
|
23641
|
+
higher = higherGT(gt2, c, options);
|
|
23642
|
+
if (higher === c && higher !== gt2) {
|
|
23606
23643
|
return false;
|
|
23607
23644
|
}
|
|
23608
|
-
} else if (
|
|
23645
|
+
} else if (gt2.operator === ">=" && !satisfies(gt2.semver, String(c), options)) {
|
|
23609
23646
|
return false;
|
|
23610
23647
|
}
|
|
23611
23648
|
}
|
|
@@ -23624,14 +23661,14 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
23624
23661
|
return false;
|
|
23625
23662
|
}
|
|
23626
23663
|
}
|
|
23627
|
-
if (!c.operator && (lt ||
|
|
23664
|
+
if (!c.operator && (lt || gt2) && gtltComp !== 0) {
|
|
23628
23665
|
return false;
|
|
23629
23666
|
}
|
|
23630
23667
|
}
|
|
23631
|
-
if (
|
|
23668
|
+
if (gt2 && hasDomLT && !lt && gtltComp !== 0) {
|
|
23632
23669
|
return false;
|
|
23633
23670
|
}
|
|
23634
|
-
if (lt && hasDomGT && !
|
|
23671
|
+
if (lt && hasDomGT && !gt2 && gtltComp !== 0) {
|
|
23635
23672
|
return false;
|
|
23636
23673
|
}
|
|
23637
23674
|
if (needDomGTPre || needDomLTPre) {
|
|
@@ -23656,7 +23693,7 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
23656
23693
|
module.exports = subset;
|
|
23657
23694
|
});
|
|
23658
23695
|
|
|
23659
|
-
// node_modules/.pnpm/semver@7.
|
|
23696
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.js
|
|
23660
23697
|
var require_semver2 = __commonJS((exports, module) => {
|
|
23661
23698
|
var internalRe = require_re();
|
|
23662
23699
|
var constants = require_constants();
|
|
@@ -23677,7 +23714,7 @@ var require_semver2 = __commonJS((exports, module) => {
|
|
|
23677
23714
|
var compareBuild = require_compare_build();
|
|
23678
23715
|
var sort = require_sort();
|
|
23679
23716
|
var rsort = require_rsort();
|
|
23680
|
-
var
|
|
23717
|
+
var gt2 = require_gt();
|
|
23681
23718
|
var lt = require_lt();
|
|
23682
23719
|
var eq = require_eq();
|
|
23683
23720
|
var neq = require_neq();
|
|
@@ -23715,7 +23752,7 @@ var require_semver2 = __commonJS((exports, module) => {
|
|
|
23715
23752
|
compareBuild,
|
|
23716
23753
|
sort,
|
|
23717
23754
|
rsort,
|
|
23718
|
-
gt,
|
|
23755
|
+
gt: gt2,
|
|
23719
23756
|
lt,
|
|
23720
23757
|
eq,
|
|
23721
23758
|
neq,
|
|
@@ -40050,219 +40087,775 @@ var {
|
|
|
40050
40087
|
|
|
40051
40088
|
// src/program.ts
|
|
40052
40089
|
import fs from "fs";
|
|
40053
|
-
var version = "0.0.1";
|
|
40054
|
-
try {
|
|
40055
|
-
if ("0.0.64")
|
|
40056
|
-
version = "0.0.64";
|
|
40057
|
-
} catch (e) {}
|
|
40058
|
-
program.name("app").description("A CLI tool with envison").version(version, "-V, --version");
|
|
40059
|
-
var ls = new Command("ls").description("List files in the current directory").action(() => {
|
|
40060
|
-
console.log("List files");
|
|
40061
|
-
console.log(fs.readdirSync(process.cwd()));
|
|
40062
|
-
});
|
|
40063
|
-
program.addCommand(ls);
|
|
40064
|
-
|
|
40065
|
-
// src/module/get-config.ts
|
|
40066
|
-
import os from "os";
|
|
40067
|
-
import path from "path";
|
|
40068
|
-
import fs2 from "fs";
|
|
40069
|
-
var envisionPath = path.join(os.homedir(), ".config", "envision");
|
|
40070
|
-
var configPath = path.join(os.homedir(), ".config", "envision", "config.json");
|
|
40071
|
-
var checkFileExists = (filePath) => {
|
|
40072
|
-
try {
|
|
40073
|
-
fs2.accessSync(filePath, fs2.constants.F_OK);
|
|
40074
|
-
return true;
|
|
40075
|
-
} catch (error) {
|
|
40076
|
-
return false;
|
|
40077
|
-
}
|
|
40078
|
-
};
|
|
40079
|
-
var getConfig = () => {
|
|
40080
|
-
if (!checkFileExists(envisionPath)) {
|
|
40081
|
-
fs2.mkdirSync(envisionPath, { recursive: true });
|
|
40082
|
-
}
|
|
40083
|
-
if (checkFileExists(configPath)) {
|
|
40084
|
-
const config = fs2.readFileSync(configPath, "utf-8");
|
|
40085
|
-
try {
|
|
40086
|
-
return JSON.parse(config);
|
|
40087
|
-
} catch (e) {
|
|
40088
|
-
return {};
|
|
40089
|
-
}
|
|
40090
|
-
}
|
|
40091
|
-
writeConfig({
|
|
40092
|
-
baseURL: "https://kevisual.cn"
|
|
40093
|
-
});
|
|
40094
|
-
return {};
|
|
40095
|
-
};
|
|
40096
|
-
var writeConfig = (config) => {
|
|
40097
|
-
fs2.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
40098
|
-
return config;
|
|
40099
|
-
};
|
|
40100
|
-
|
|
40101
|
-
// node_modules/.pnpm/@inquirer+core@11.0.1_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/key.js
|
|
40102
|
-
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
40103
|
-
var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
40104
|
-
var isSpaceKey = (key) => key.name === "space";
|
|
40105
|
-
var isBackspaceKey = (key) => key.name === "backspace";
|
|
40106
|
-
var isTabKey = (key) => key.name === "tab";
|
|
40107
|
-
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
40108
|
-
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
40109
|
-
// node_modules/.pnpm/@inquirer+core@11.0.1_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/errors.js
|
|
40110
|
-
class AbortPromptError extends Error {
|
|
40111
|
-
name = "AbortPromptError";
|
|
40112
|
-
message = "Prompt was aborted";
|
|
40113
|
-
constructor(options) {
|
|
40114
|
-
super();
|
|
40115
|
-
this.cause = options?.cause;
|
|
40116
|
-
}
|
|
40117
|
-
}
|
|
40118
|
-
|
|
40119
|
-
class CancelPromptError extends Error {
|
|
40120
|
-
name = "CancelPromptError";
|
|
40121
|
-
message = "Prompt was canceled";
|
|
40122
|
-
}
|
|
40123
|
-
|
|
40124
|
-
class ExitPromptError extends Error {
|
|
40125
|
-
name = "ExitPromptError";
|
|
40126
|
-
}
|
|
40127
|
-
|
|
40128
|
-
class HookError extends Error {
|
|
40129
|
-
name = "HookError";
|
|
40130
|
-
}
|
|
40131
|
-
|
|
40132
|
-
class ValidationError extends Error {
|
|
40133
|
-
name = "ValidationError";
|
|
40134
|
-
}
|
|
40135
|
-
// node_modules/.pnpm/@inquirer+core@11.0.1_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
40136
|
-
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
40137
40090
|
|
|
40138
|
-
// node_modules/.pnpm/@
|
|
40139
|
-
|
|
40140
|
-
|
|
40141
|
-
|
|
40142
|
-
const store = {
|
|
40143
|
-
rl,
|
|
40144
|
-
hooks: [],
|
|
40145
|
-
hooksCleanup: [],
|
|
40146
|
-
hooksEffect: [],
|
|
40147
|
-
index: 0,
|
|
40148
|
-
handleChange() {}
|
|
40149
|
-
};
|
|
40150
|
-
return store;
|
|
40091
|
+
// node_modules/.pnpm/@kevisual+context@0.0.4/node_modules/@kevisual/context/dist/app.js
|
|
40092
|
+
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
40093
|
+
function getDefaultExportFromCjs(x) {
|
|
40094
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
40151
40095
|
}
|
|
40152
|
-
|
|
40153
|
-
|
|
40154
|
-
|
|
40155
|
-
|
|
40156
|
-
|
|
40157
|
-
|
|
40158
|
-
|
|
40159
|
-
|
|
40160
|
-
|
|
40096
|
+
var eventemitter3 = { exports: {} };
|
|
40097
|
+
var hasRequiredEventemitter3;
|
|
40098
|
+
function requireEventemitter3() {
|
|
40099
|
+
if (hasRequiredEventemitter3)
|
|
40100
|
+
return eventemitter3.exports;
|
|
40101
|
+
hasRequiredEventemitter3 = 1;
|
|
40102
|
+
(function(module) {
|
|
40103
|
+
var has = Object.prototype.hasOwnProperty, prefix = "~";
|
|
40104
|
+
function Events() {}
|
|
40105
|
+
if (Object.create) {
|
|
40106
|
+
Events.prototype = Object.create(null);
|
|
40107
|
+
if (!new Events().__proto__)
|
|
40108
|
+
prefix = false;
|
|
40161
40109
|
}
|
|
40162
|
-
|
|
40163
|
-
|
|
40164
|
-
|
|
40165
|
-
|
|
40166
|
-
const store = hookStorage.getStore();
|
|
40167
|
-
if (!store) {
|
|
40168
|
-
throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
40169
|
-
}
|
|
40170
|
-
return store;
|
|
40171
|
-
}
|
|
40172
|
-
function readline() {
|
|
40173
|
-
return getStore().rl;
|
|
40174
|
-
}
|
|
40175
|
-
function withUpdates(fn) {
|
|
40176
|
-
const wrapped = (...args) => {
|
|
40177
|
-
const store = getStore();
|
|
40178
|
-
let shouldUpdate = false;
|
|
40179
|
-
const oldHandleChange = store.handleChange;
|
|
40180
|
-
store.handleChange = () => {
|
|
40181
|
-
shouldUpdate = true;
|
|
40182
|
-
};
|
|
40183
|
-
const returnValue = fn(...args);
|
|
40184
|
-
if (shouldUpdate) {
|
|
40185
|
-
oldHandleChange();
|
|
40110
|
+
function EE(fn, context, once) {
|
|
40111
|
+
this.fn = fn;
|
|
40112
|
+
this.context = context;
|
|
40113
|
+
this.once = once || false;
|
|
40186
40114
|
}
|
|
40187
|
-
|
|
40188
|
-
|
|
40189
|
-
|
|
40190
|
-
return AsyncResource.bind(wrapped);
|
|
40191
|
-
}
|
|
40192
|
-
function withPointer(cb) {
|
|
40193
|
-
const store = getStore();
|
|
40194
|
-
const { index } = store;
|
|
40195
|
-
const pointer = {
|
|
40196
|
-
get() {
|
|
40197
|
-
return store.hooks[index];
|
|
40198
|
-
},
|
|
40199
|
-
set(value) {
|
|
40200
|
-
store.hooks[index] = value;
|
|
40201
|
-
},
|
|
40202
|
-
initialized: index in store.hooks
|
|
40203
|
-
};
|
|
40204
|
-
const returnValue = cb(pointer);
|
|
40205
|
-
store.index++;
|
|
40206
|
-
return returnValue;
|
|
40207
|
-
}
|
|
40208
|
-
function handleChange() {
|
|
40209
|
-
getStore().handleChange();
|
|
40210
|
-
}
|
|
40211
|
-
var effectScheduler = {
|
|
40212
|
-
queue(cb) {
|
|
40213
|
-
const store = getStore();
|
|
40214
|
-
const { index } = store;
|
|
40215
|
-
store.hooksEffect.push(() => {
|
|
40216
|
-
store.hooksCleanup[index]?.();
|
|
40217
|
-
const cleanFn = cb(readline());
|
|
40218
|
-
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
40219
|
-
throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
40220
|
-
}
|
|
40221
|
-
store.hooksCleanup[index] = cleanFn;
|
|
40222
|
-
});
|
|
40223
|
-
},
|
|
40224
|
-
run() {
|
|
40225
|
-
const store = getStore();
|
|
40226
|
-
withUpdates(() => {
|
|
40227
|
-
store.hooksEffect.forEach((effect) => {
|
|
40228
|
-
effect();
|
|
40229
|
-
});
|
|
40230
|
-
store.hooksEffect.length = 0;
|
|
40231
|
-
})();
|
|
40232
|
-
},
|
|
40233
|
-
clearAll() {
|
|
40234
|
-
const store = getStore();
|
|
40235
|
-
store.hooksCleanup.forEach((cleanFn) => {
|
|
40236
|
-
cleanFn?.();
|
|
40237
|
-
});
|
|
40238
|
-
store.hooksEffect.length = 0;
|
|
40239
|
-
store.hooksCleanup.length = 0;
|
|
40240
|
-
}
|
|
40241
|
-
};
|
|
40242
|
-
|
|
40243
|
-
// node_modules/.pnpm/@inquirer+core@11.0.1_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
40244
|
-
function useState(defaultValue) {
|
|
40245
|
-
return withPointer((pointer) => {
|
|
40246
|
-
const setState = AsyncResource2.bind(function setState(newValue) {
|
|
40247
|
-
if (pointer.get() !== newValue) {
|
|
40248
|
-
pointer.set(newValue);
|
|
40249
|
-
handleChange();
|
|
40115
|
+
function addListener(emitter, event, fn, context, once) {
|
|
40116
|
+
if (typeof fn !== "function") {
|
|
40117
|
+
throw new TypeError("The listener must be a function");
|
|
40250
40118
|
}
|
|
40251
|
-
|
|
40252
|
-
|
|
40253
|
-
|
|
40119
|
+
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
|
40120
|
+
if (!emitter._events[evt])
|
|
40121
|
+
emitter._events[evt] = listener, emitter._eventsCount++;
|
|
40122
|
+
else if (!emitter._events[evt].fn)
|
|
40123
|
+
emitter._events[evt].push(listener);
|
|
40124
|
+
else
|
|
40125
|
+
emitter._events[evt] = [emitter._events[evt], listener];
|
|
40126
|
+
return emitter;
|
|
40254
40127
|
}
|
|
40255
|
-
|
|
40256
|
-
|
|
40257
|
-
|
|
40258
|
-
|
|
40259
|
-
|
|
40260
|
-
|
|
40261
|
-
|
|
40262
|
-
|
|
40263
|
-
|
|
40264
|
-
|
|
40265
|
-
|
|
40128
|
+
function clearEvent(emitter, evt) {
|
|
40129
|
+
if (--emitter._eventsCount === 0)
|
|
40130
|
+
emitter._events = new Events;
|
|
40131
|
+
else
|
|
40132
|
+
delete emitter._events[evt];
|
|
40133
|
+
}
|
|
40134
|
+
function EventEmitter() {
|
|
40135
|
+
this._events = new Events;
|
|
40136
|
+
this._eventsCount = 0;
|
|
40137
|
+
}
|
|
40138
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
40139
|
+
var names = [], events, name;
|
|
40140
|
+
if (this._eventsCount === 0)
|
|
40141
|
+
return names;
|
|
40142
|
+
for (name in events = this._events) {
|
|
40143
|
+
if (has.call(events, name))
|
|
40144
|
+
names.push(prefix ? name.slice(1) : name);
|
|
40145
|
+
}
|
|
40146
|
+
if (Object.getOwnPropertySymbols) {
|
|
40147
|
+
return names.concat(Object.getOwnPropertySymbols(events));
|
|
40148
|
+
}
|
|
40149
|
+
return names;
|
|
40150
|
+
};
|
|
40151
|
+
EventEmitter.prototype.listeners = function listeners(event) {
|
|
40152
|
+
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
40153
|
+
if (!handlers)
|
|
40154
|
+
return [];
|
|
40155
|
+
if (handlers.fn)
|
|
40156
|
+
return [handlers.fn];
|
|
40157
|
+
for (var i = 0, l = handlers.length, ee = new Array(l);i < l; i++) {
|
|
40158
|
+
ee[i] = handlers[i].fn;
|
|
40159
|
+
}
|
|
40160
|
+
return ee;
|
|
40161
|
+
};
|
|
40162
|
+
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
40163
|
+
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
40164
|
+
if (!listeners)
|
|
40165
|
+
return 0;
|
|
40166
|
+
if (listeners.fn)
|
|
40167
|
+
return 1;
|
|
40168
|
+
return listeners.length;
|
|
40169
|
+
};
|
|
40170
|
+
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
40171
|
+
var evt = prefix ? prefix + event : event;
|
|
40172
|
+
if (!this._events[evt])
|
|
40173
|
+
return false;
|
|
40174
|
+
var listeners = this._events[evt], len = arguments.length, args, i;
|
|
40175
|
+
if (listeners.fn) {
|
|
40176
|
+
if (listeners.once)
|
|
40177
|
+
this.removeListener(event, listeners.fn, undefined, true);
|
|
40178
|
+
switch (len) {
|
|
40179
|
+
case 1:
|
|
40180
|
+
return listeners.fn.call(listeners.context), true;
|
|
40181
|
+
case 2:
|
|
40182
|
+
return listeners.fn.call(listeners.context, a1), true;
|
|
40183
|
+
case 3:
|
|
40184
|
+
return listeners.fn.call(listeners.context, a1, a2), true;
|
|
40185
|
+
case 4:
|
|
40186
|
+
return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
40187
|
+
case 5:
|
|
40188
|
+
return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
40189
|
+
case 6:
|
|
40190
|
+
return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
40191
|
+
}
|
|
40192
|
+
for (i = 1, args = new Array(len - 1);i < len; i++) {
|
|
40193
|
+
args[i - 1] = arguments[i];
|
|
40194
|
+
}
|
|
40195
|
+
listeners.fn.apply(listeners.context, args);
|
|
40196
|
+
} else {
|
|
40197
|
+
var length = listeners.length, j;
|
|
40198
|
+
for (i = 0;i < length; i++) {
|
|
40199
|
+
if (listeners[i].once)
|
|
40200
|
+
this.removeListener(event, listeners[i].fn, undefined, true);
|
|
40201
|
+
switch (len) {
|
|
40202
|
+
case 1:
|
|
40203
|
+
listeners[i].fn.call(listeners[i].context);
|
|
40204
|
+
break;
|
|
40205
|
+
case 2:
|
|
40206
|
+
listeners[i].fn.call(listeners[i].context, a1);
|
|
40207
|
+
break;
|
|
40208
|
+
case 3:
|
|
40209
|
+
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
40210
|
+
break;
|
|
40211
|
+
case 4:
|
|
40212
|
+
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
40213
|
+
break;
|
|
40214
|
+
default:
|
|
40215
|
+
if (!args)
|
|
40216
|
+
for (j = 1, args = new Array(len - 1);j < len; j++) {
|
|
40217
|
+
args[j - 1] = arguments[j];
|
|
40218
|
+
}
|
|
40219
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
40220
|
+
}
|
|
40221
|
+
}
|
|
40222
|
+
}
|
|
40223
|
+
return true;
|
|
40224
|
+
};
|
|
40225
|
+
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
40226
|
+
return addListener(this, event, fn, context, false);
|
|
40227
|
+
};
|
|
40228
|
+
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
40229
|
+
return addListener(this, event, fn, context, true);
|
|
40230
|
+
};
|
|
40231
|
+
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
40232
|
+
var evt = prefix ? prefix + event : event;
|
|
40233
|
+
if (!this._events[evt])
|
|
40234
|
+
return this;
|
|
40235
|
+
if (!fn) {
|
|
40236
|
+
clearEvent(this, evt);
|
|
40237
|
+
return this;
|
|
40238
|
+
}
|
|
40239
|
+
var listeners = this._events[evt];
|
|
40240
|
+
if (listeners.fn) {
|
|
40241
|
+
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
|
|
40242
|
+
clearEvent(this, evt);
|
|
40243
|
+
}
|
|
40244
|
+
} else {
|
|
40245
|
+
for (var i = 0, events = [], length = listeners.length;i < length; i++) {
|
|
40246
|
+
if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
|
|
40247
|
+
events.push(listeners[i]);
|
|
40248
|
+
}
|
|
40249
|
+
}
|
|
40250
|
+
if (events.length)
|
|
40251
|
+
this._events[evt] = events.length === 1 ? events[0] : events;
|
|
40252
|
+
else
|
|
40253
|
+
clearEvent(this, evt);
|
|
40254
|
+
}
|
|
40255
|
+
return this;
|
|
40256
|
+
};
|
|
40257
|
+
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
40258
|
+
var evt;
|
|
40259
|
+
if (event) {
|
|
40260
|
+
evt = prefix ? prefix + event : event;
|
|
40261
|
+
if (this._events[evt])
|
|
40262
|
+
clearEvent(this, evt);
|
|
40263
|
+
} else {
|
|
40264
|
+
this._events = new Events;
|
|
40265
|
+
this._eventsCount = 0;
|
|
40266
|
+
}
|
|
40267
|
+
return this;
|
|
40268
|
+
};
|
|
40269
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
40270
|
+
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
40271
|
+
EventEmitter.prefixed = prefix;
|
|
40272
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
40273
|
+
{
|
|
40274
|
+
module.exports = EventEmitter;
|
|
40275
|
+
}
|
|
40276
|
+
})(eventemitter3);
|
|
40277
|
+
return eventemitter3.exports;
|
|
40278
|
+
}
|
|
40279
|
+
var eventemitter3Exports = requireEventemitter3();
|
|
40280
|
+
var EventEmitter = /* @__PURE__ */ getDefaultExportFromCjs(eventemitter3Exports);
|
|
40281
|
+
var reRunFn = (promiseOpts) => {
|
|
40282
|
+
const timeout = promiseOpts.timeout || 5 * 60 * 1000;
|
|
40283
|
+
const interval = promiseOpts.interval || 1000;
|
|
40284
|
+
const checkSuccess = promiseOpts?.checkSuccess || (() => true);
|
|
40285
|
+
const signal = promiseOpts.signal;
|
|
40286
|
+
return new Promise(async (resolve, reject) => {
|
|
40287
|
+
let intervalId;
|
|
40288
|
+
let timeoutId = setTimeout(() => {
|
|
40289
|
+
clearTimeout(intervalId);
|
|
40290
|
+
resolve({
|
|
40291
|
+
code: 500,
|
|
40292
|
+
message: "timeout"
|
|
40293
|
+
});
|
|
40294
|
+
}, timeout);
|
|
40295
|
+
const fn = promiseOpts.fn || (() => true);
|
|
40296
|
+
const runFn = async () => {
|
|
40297
|
+
if (signal?.aborted) {
|
|
40298
|
+
clearInterval(intervalId);
|
|
40299
|
+
clearTimeout(timeoutId);
|
|
40300
|
+
return resolve({
|
|
40301
|
+
code: 499,
|
|
40302
|
+
message: "operation cancelled"
|
|
40303
|
+
});
|
|
40304
|
+
}
|
|
40305
|
+
const res = await fn();
|
|
40306
|
+
if (!!checkSuccess(res)) {
|
|
40307
|
+
clearInterval(intervalId);
|
|
40308
|
+
clearTimeout(timeoutId);
|
|
40309
|
+
resolve({
|
|
40310
|
+
code: 200,
|
|
40311
|
+
data: res
|
|
40312
|
+
});
|
|
40313
|
+
} else {
|
|
40314
|
+
setTimeout(() => {
|
|
40315
|
+
runFn();
|
|
40316
|
+
}, interval);
|
|
40317
|
+
}
|
|
40318
|
+
};
|
|
40319
|
+
if (signal) {
|
|
40320
|
+
signal.addEventListener("abort", () => {
|
|
40321
|
+
clearInterval(intervalId);
|
|
40322
|
+
clearTimeout(timeoutId);
|
|
40323
|
+
resolve({
|
|
40324
|
+
code: 499,
|
|
40325
|
+
message: "operation cancelled"
|
|
40326
|
+
});
|
|
40327
|
+
});
|
|
40328
|
+
}
|
|
40329
|
+
runFn();
|
|
40330
|
+
});
|
|
40331
|
+
};
|
|
40332
|
+
|
|
40333
|
+
class BaseLoad {
|
|
40334
|
+
modules = new Map;
|
|
40335
|
+
event;
|
|
40336
|
+
loading;
|
|
40337
|
+
static reRunFn = reRunFn;
|
|
40338
|
+
timeout = 5 * 60 * 1000;
|
|
40339
|
+
constructor() {
|
|
40340
|
+
this.event = new EventEmitter;
|
|
40341
|
+
this.loading = false;
|
|
40342
|
+
}
|
|
40343
|
+
listenKey(key, listenOpts) {
|
|
40344
|
+
const timeout = listenOpts?.timeout ?? this.timeout;
|
|
40345
|
+
return new Promise((resolve) => {
|
|
40346
|
+
const timeoutId = setTimeout(() => {
|
|
40347
|
+
this.event.removeListener(key, onEvent);
|
|
40348
|
+
resolve({
|
|
40349
|
+
code: 500,
|
|
40350
|
+
message: "timeout"
|
|
40351
|
+
});
|
|
40352
|
+
}, timeout);
|
|
40353
|
+
const onEvent = (error) => {
|
|
40354
|
+
clearTimeout(timeoutId);
|
|
40355
|
+
if (error) {
|
|
40356
|
+
return resolve({
|
|
40357
|
+
code: 500,
|
|
40358
|
+
message: error
|
|
40359
|
+
});
|
|
40360
|
+
}
|
|
40361
|
+
const data = this.modules.get(key);
|
|
40362
|
+
if (data?.loadSuccessClear) {
|
|
40363
|
+
this.remove(key);
|
|
40364
|
+
}
|
|
40365
|
+
resolve({
|
|
40366
|
+
code: 200,
|
|
40367
|
+
data: data?.modules
|
|
40368
|
+
});
|
|
40369
|
+
};
|
|
40370
|
+
this.event.once(key, onEvent);
|
|
40371
|
+
});
|
|
40372
|
+
}
|
|
40373
|
+
async hasLoaded(key, hasLoadOpts) {
|
|
40374
|
+
if (!key) {
|
|
40375
|
+
return {
|
|
40376
|
+
code: 404,
|
|
40377
|
+
message: "key is required"
|
|
40378
|
+
};
|
|
40379
|
+
}
|
|
40380
|
+
const has = this.modules.has(key);
|
|
40381
|
+
if (!has) {
|
|
40382
|
+
const isExist = hasLoadOpts?.isExist ?? true;
|
|
40383
|
+
const timeout = hasLoadOpts?.timeout ?? this.timeout;
|
|
40384
|
+
if (isExist) {
|
|
40385
|
+
return await this.listenKey(key, { timeout });
|
|
40386
|
+
}
|
|
40387
|
+
return {
|
|
40388
|
+
code: 404
|
|
40389
|
+
};
|
|
40390
|
+
}
|
|
40391
|
+
const data = this.modules.get(key);
|
|
40392
|
+
if (data?.status === "loaded") {
|
|
40393
|
+
return {
|
|
40394
|
+
code: 200,
|
|
40395
|
+
data: data.modules
|
|
40396
|
+
};
|
|
40397
|
+
}
|
|
40398
|
+
if (data?.status === "loading") {
|
|
40399
|
+
return await this.listenKey(key, { timeout: hasLoadOpts?.timeout ?? this.timeout });
|
|
40400
|
+
}
|
|
40401
|
+
if (data?.status === "error") {
|
|
40402
|
+
return {
|
|
40403
|
+
code: 500,
|
|
40404
|
+
message: "load error"
|
|
40405
|
+
};
|
|
40406
|
+
}
|
|
40407
|
+
if (data?.status === "cancel") {
|
|
40408
|
+
return {
|
|
40409
|
+
code: 499,
|
|
40410
|
+
message: "operation cancelled"
|
|
40411
|
+
};
|
|
40412
|
+
}
|
|
40413
|
+
return {
|
|
40414
|
+
code: 404
|
|
40415
|
+
};
|
|
40416
|
+
}
|
|
40417
|
+
async loadFn(loadContent, opts) {
|
|
40418
|
+
const key = opts.key;
|
|
40419
|
+
if (!key) {
|
|
40420
|
+
return {
|
|
40421
|
+
code: 404,
|
|
40422
|
+
message: "key is required"
|
|
40423
|
+
};
|
|
40424
|
+
}
|
|
40425
|
+
const newModule = {
|
|
40426
|
+
key: opts.key,
|
|
40427
|
+
status: "loading",
|
|
40428
|
+
loading: true,
|
|
40429
|
+
loadSuccessClear: opts.loadSuccessClear ?? true
|
|
40430
|
+
};
|
|
40431
|
+
let errorMessage = "";
|
|
40432
|
+
try {
|
|
40433
|
+
const isReRun = opts.isReRun ?? false;
|
|
40434
|
+
let res;
|
|
40435
|
+
if (!isReRun) {
|
|
40436
|
+
this.modules.set(key, newModule);
|
|
40437
|
+
res = await loadContent();
|
|
40438
|
+
} else {
|
|
40439
|
+
newModule.controller = new AbortController;
|
|
40440
|
+
const signal = newModule.controller.signal;
|
|
40441
|
+
this.modules.set(key, newModule);
|
|
40442
|
+
const data = await reRunFn({
|
|
40443
|
+
timeout: opts.timeout,
|
|
40444
|
+
interval: opts.interval,
|
|
40445
|
+
checkSuccess: opts.checkSuccess,
|
|
40446
|
+
fn: loadContent,
|
|
40447
|
+
signal
|
|
40448
|
+
});
|
|
40449
|
+
newModule.controller = null;
|
|
40450
|
+
if (data.code === 499) {
|
|
40451
|
+
newModule.status = "cancel";
|
|
40452
|
+
return {
|
|
40453
|
+
code: 499,
|
|
40454
|
+
message: "operation cancelled"
|
|
40455
|
+
};
|
|
40456
|
+
}
|
|
40457
|
+
if (data.code !== 200) {
|
|
40458
|
+
throw new Error(data.message);
|
|
40459
|
+
}
|
|
40460
|
+
res = data.data;
|
|
40461
|
+
}
|
|
40462
|
+
newModule.modules = res;
|
|
40463
|
+
newModule.status = "loaded";
|
|
40464
|
+
return {
|
|
40465
|
+
code: 200,
|
|
40466
|
+
data: res
|
|
40467
|
+
};
|
|
40468
|
+
} catch (error) {
|
|
40469
|
+
errorMessage = error.message;
|
|
40470
|
+
newModule.status = "error";
|
|
40471
|
+
return {
|
|
40472
|
+
code: 500,
|
|
40473
|
+
message: error
|
|
40474
|
+
};
|
|
40475
|
+
} finally {
|
|
40476
|
+
newModule.loading = false;
|
|
40477
|
+
this.modules.set(opts.key, newModule);
|
|
40478
|
+
if (!errorMessage) {
|
|
40479
|
+
this.event.emit(opts.key);
|
|
40480
|
+
} else {
|
|
40481
|
+
this.event.emit(opts.key, errorMessage);
|
|
40482
|
+
}
|
|
40483
|
+
}
|
|
40484
|
+
}
|
|
40485
|
+
async load(loadContent, opts) {
|
|
40486
|
+
this.loading = true;
|
|
40487
|
+
const key = opts.key;
|
|
40488
|
+
if (!key) {
|
|
40489
|
+
return {
|
|
40490
|
+
code: 404,
|
|
40491
|
+
message: "key is required"
|
|
40492
|
+
};
|
|
40493
|
+
}
|
|
40494
|
+
if (opts?.force) {
|
|
40495
|
+
this.remove(key);
|
|
40496
|
+
}
|
|
40497
|
+
const has = this.modules.has(key);
|
|
40498
|
+
if (has) {
|
|
40499
|
+
return await this.hasLoaded(key);
|
|
40500
|
+
}
|
|
40501
|
+
if (typeof loadContent === "function") {
|
|
40502
|
+
return this.loadFn(loadContent, opts);
|
|
40503
|
+
}
|
|
40504
|
+
console.error("loadContent is not a function and not has loaded");
|
|
40505
|
+
}
|
|
40506
|
+
remove(key) {
|
|
40507
|
+
const has = this.modules.has(key);
|
|
40508
|
+
if (has) {
|
|
40509
|
+
this.checkRemoveController(key);
|
|
40510
|
+
this.modules.delete(key);
|
|
40511
|
+
}
|
|
40512
|
+
}
|
|
40513
|
+
emitLoaded(key) {
|
|
40514
|
+
this.checkRemoveController(key);
|
|
40515
|
+
this.event.emit(key);
|
|
40516
|
+
}
|
|
40517
|
+
setModule(key, data, loadData) {
|
|
40518
|
+
const newModule = {
|
|
40519
|
+
key,
|
|
40520
|
+
status: "loaded",
|
|
40521
|
+
loading: false,
|
|
40522
|
+
modules: data || {},
|
|
40523
|
+
...loadData
|
|
40524
|
+
};
|
|
40525
|
+
this.modules.set(key, newModule);
|
|
40526
|
+
this.emitLoaded(key);
|
|
40527
|
+
return newModule;
|
|
40528
|
+
}
|
|
40529
|
+
cancel(key) {
|
|
40530
|
+
this.checkRemoveController(key);
|
|
40531
|
+
}
|
|
40532
|
+
checkRemoveController(key) {
|
|
40533
|
+
const data = this.modules.get(key);
|
|
40534
|
+
if (data?.controller) {
|
|
40535
|
+
data.controller?.abort?.();
|
|
40536
|
+
delete data.controller;
|
|
40537
|
+
this.modules.set(key, data);
|
|
40538
|
+
}
|
|
40539
|
+
}
|
|
40540
|
+
}
|
|
40541
|
+
var gt = globalThis || window || self;
|
|
40542
|
+
var useEnv = (initEnv, initKey = "config", isOverwrite) => {
|
|
40543
|
+
const env = gt[initKey];
|
|
40544
|
+
const _env = env || initEnv;
|
|
40545
|
+
if (!env) {
|
|
40546
|
+
if (_env) {
|
|
40547
|
+
gt[initKey] = _env;
|
|
40548
|
+
} else {
|
|
40549
|
+
gt[initKey] = {};
|
|
40550
|
+
}
|
|
40551
|
+
} else if (isOverwrite) {
|
|
40552
|
+
gt[initKey] = { ...env, ...initEnv };
|
|
40553
|
+
}
|
|
40554
|
+
return gt[initKey];
|
|
40555
|
+
};
|
|
40556
|
+
var useEnvKey = (key, init, initKey = "config") => {
|
|
40557
|
+
const _env = useEnv({}, initKey);
|
|
40558
|
+
if (key && typeof _env[key] !== "undefined") {
|
|
40559
|
+
return _env[key];
|
|
40560
|
+
}
|
|
40561
|
+
if (key && init) {
|
|
40562
|
+
if (typeof init !== "function") {
|
|
40563
|
+
_env[key] = init;
|
|
40564
|
+
}
|
|
40565
|
+
if (typeof init === "function") {
|
|
40566
|
+
const result = init();
|
|
40567
|
+
if (result instanceof Promise) {
|
|
40568
|
+
return result.then((res) => {
|
|
40569
|
+
_env[key] = res;
|
|
40570
|
+
return res;
|
|
40571
|
+
});
|
|
40572
|
+
}
|
|
40573
|
+
_env[key] = result;
|
|
40574
|
+
}
|
|
40575
|
+
return _env[key];
|
|
40576
|
+
}
|
|
40577
|
+
if (key) {
|
|
40578
|
+
const baseLoad = new BaseLoad;
|
|
40579
|
+
const voidFn = async () => {
|
|
40580
|
+
return _env[key];
|
|
40581
|
+
};
|
|
40582
|
+
const checkFn = async () => {
|
|
40583
|
+
const loadRes = await baseLoad.load(voidFn, {
|
|
40584
|
+
key,
|
|
40585
|
+
isReRun: true,
|
|
40586
|
+
checkSuccess: () => _env[key],
|
|
40587
|
+
timeout: 5 * 60 * 1000,
|
|
40588
|
+
interval: 1000
|
|
40589
|
+
});
|
|
40590
|
+
if (loadRes.code !== 200) {
|
|
40591
|
+
console.error("load key error");
|
|
40592
|
+
return null;
|
|
40593
|
+
}
|
|
40594
|
+
return _env[key];
|
|
40595
|
+
};
|
|
40596
|
+
return checkFn();
|
|
40597
|
+
}
|
|
40598
|
+
console.error("key is empty ");
|
|
40599
|
+
return null;
|
|
40600
|
+
};
|
|
40601
|
+
var useEnvKeyNew = (key, initKey = "config", opts) => {
|
|
40602
|
+
const _env = useEnv({}, initKey);
|
|
40603
|
+
if (key) {
|
|
40604
|
+
delete _env[key];
|
|
40605
|
+
}
|
|
40606
|
+
if (opts?.getNew && opts.init) {
|
|
40607
|
+
return useEnvKey(key, opts.init, initKey);
|
|
40608
|
+
} else if (opts?.getNew) {
|
|
40609
|
+
return useEnvKey(key, null, initKey);
|
|
40610
|
+
}
|
|
40611
|
+
};
|
|
40612
|
+
var useContextKey = (key, init, isNew) => {
|
|
40613
|
+
if (isNew) {
|
|
40614
|
+
return useEnvKeyNew(key, "context", { getNew: true, init });
|
|
40615
|
+
}
|
|
40616
|
+
return useEnvKey(key, init, "context");
|
|
40617
|
+
};
|
|
40618
|
+
var use = useContextKey;
|
|
40619
|
+
var useConfigKey = (key, init, isNew) => {
|
|
40620
|
+
if (isNew) {
|
|
40621
|
+
return useEnvKeyNew(key, "config", { getNew: true, init });
|
|
40622
|
+
}
|
|
40623
|
+
return useEnvKey(key, init, "config");
|
|
40624
|
+
};
|
|
40625
|
+
class InitEnv {
|
|
40626
|
+
static isInit = false;
|
|
40627
|
+
static init(opts) {
|
|
40628
|
+
if (InitEnv.isInit) {
|
|
40629
|
+
return;
|
|
40630
|
+
}
|
|
40631
|
+
const { load = true, page = false } = opts || {};
|
|
40632
|
+
InitEnv.isInit = true;
|
|
40633
|
+
gt.useConfigKey = useConfigKey;
|
|
40634
|
+
gt.useContextKey = useContextKey;
|
|
40635
|
+
gt.use = use;
|
|
40636
|
+
gt.webEnv = { useConfigKey, useContextKey, use };
|
|
40637
|
+
load && (gt.Load = BaseLoad);
|
|
40638
|
+
}
|
|
40639
|
+
}
|
|
40640
|
+
InitEnv.init();
|
|
40641
|
+
|
|
40642
|
+
// src/program.ts
|
|
40643
|
+
var version = useContextKey("version", () => {
|
|
40644
|
+
let version2 = "0.0.64";
|
|
40645
|
+
try {
|
|
40646
|
+
if ("0.0.65")
|
|
40647
|
+
version2 = "0.0.65";
|
|
40648
|
+
} catch (e) {}
|
|
40649
|
+
return version2;
|
|
40650
|
+
});
|
|
40651
|
+
program.name("app").description("A CLI tool with envison").version(version, "-V, --version");
|
|
40652
|
+
var ls = new Command("ls").description("List files in the current directory").action(() => {
|
|
40653
|
+
console.log("List files");
|
|
40654
|
+
console.log(fs.readdirSync(process.cwd()));
|
|
40655
|
+
});
|
|
40656
|
+
program.addCommand(ls);
|
|
40657
|
+
|
|
40658
|
+
// src/module/get-config.ts
|
|
40659
|
+
import os from "os";
|
|
40660
|
+
import path from "path";
|
|
40661
|
+
import fs2 from "fs";
|
|
40662
|
+
var envisionPath = path.join(os.homedir(), ".config", "envision");
|
|
40663
|
+
var configPath = path.join(os.homedir(), ".config", "envision", "config.json");
|
|
40664
|
+
var checkFileExists = (filePath) => {
|
|
40665
|
+
try {
|
|
40666
|
+
fs2.accessSync(filePath, fs2.constants.F_OK);
|
|
40667
|
+
return true;
|
|
40668
|
+
} catch (error) {
|
|
40669
|
+
return false;
|
|
40670
|
+
}
|
|
40671
|
+
};
|
|
40672
|
+
var getConfig = () => {
|
|
40673
|
+
if (!checkFileExists(envisionPath)) {
|
|
40674
|
+
fs2.mkdirSync(envisionPath, { recursive: true });
|
|
40675
|
+
}
|
|
40676
|
+
if (checkFileExists(configPath)) {
|
|
40677
|
+
const config = fs2.readFileSync(configPath, "utf-8");
|
|
40678
|
+
try {
|
|
40679
|
+
return JSON.parse(config);
|
|
40680
|
+
} catch (e) {
|
|
40681
|
+
return {};
|
|
40682
|
+
}
|
|
40683
|
+
}
|
|
40684
|
+
writeConfig({
|
|
40685
|
+
baseURL: "https://kevisual.cn"
|
|
40686
|
+
});
|
|
40687
|
+
return {};
|
|
40688
|
+
};
|
|
40689
|
+
var writeConfig = (config) => {
|
|
40690
|
+
fs2.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
40691
|
+
return config;
|
|
40692
|
+
};
|
|
40693
|
+
|
|
40694
|
+
// node_modules/.pnpm/@inquirer+core@11.0.1_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/key.js
|
|
40695
|
+
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
40696
|
+
var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
40697
|
+
var isSpaceKey = (key) => key.name === "space";
|
|
40698
|
+
var isBackspaceKey = (key) => key.name === "backspace";
|
|
40699
|
+
var isTabKey = (key) => key.name === "tab";
|
|
40700
|
+
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
40701
|
+
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
40702
|
+
// node_modules/.pnpm/@inquirer+core@11.0.1_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/errors.js
|
|
40703
|
+
class AbortPromptError extends Error {
|
|
40704
|
+
name = "AbortPromptError";
|
|
40705
|
+
message = "Prompt was aborted";
|
|
40706
|
+
constructor(options) {
|
|
40707
|
+
super();
|
|
40708
|
+
this.cause = options?.cause;
|
|
40709
|
+
}
|
|
40710
|
+
}
|
|
40711
|
+
|
|
40712
|
+
class CancelPromptError extends Error {
|
|
40713
|
+
name = "CancelPromptError";
|
|
40714
|
+
message = "Prompt was canceled";
|
|
40715
|
+
}
|
|
40716
|
+
|
|
40717
|
+
class ExitPromptError extends Error {
|
|
40718
|
+
name = "ExitPromptError";
|
|
40719
|
+
}
|
|
40720
|
+
|
|
40721
|
+
class HookError extends Error {
|
|
40722
|
+
name = "HookError";
|
|
40723
|
+
}
|
|
40724
|
+
|
|
40725
|
+
class ValidationError extends Error {
|
|
40726
|
+
name = "ValidationError";
|
|
40727
|
+
}
|
|
40728
|
+
// node_modules/.pnpm/@inquirer+core@11.0.1_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
40729
|
+
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
40730
|
+
|
|
40731
|
+
// node_modules/.pnpm/@inquirer+core@11.0.1_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
40732
|
+
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
40733
|
+
var hookStorage = new AsyncLocalStorage;
|
|
40734
|
+
function createStore(rl) {
|
|
40735
|
+
const store = {
|
|
40736
|
+
rl,
|
|
40737
|
+
hooks: [],
|
|
40738
|
+
hooksCleanup: [],
|
|
40739
|
+
hooksEffect: [],
|
|
40740
|
+
index: 0,
|
|
40741
|
+
handleChange() {}
|
|
40742
|
+
};
|
|
40743
|
+
return store;
|
|
40744
|
+
}
|
|
40745
|
+
function withHooks(rl, cb) {
|
|
40746
|
+
const store = createStore(rl);
|
|
40747
|
+
return hookStorage.run(store, () => {
|
|
40748
|
+
function cycle(render) {
|
|
40749
|
+
store.handleChange = () => {
|
|
40750
|
+
store.index = 0;
|
|
40751
|
+
render();
|
|
40752
|
+
};
|
|
40753
|
+
store.handleChange();
|
|
40754
|
+
}
|
|
40755
|
+
return cb(cycle);
|
|
40756
|
+
});
|
|
40757
|
+
}
|
|
40758
|
+
function getStore() {
|
|
40759
|
+
const store = hookStorage.getStore();
|
|
40760
|
+
if (!store) {
|
|
40761
|
+
throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
40762
|
+
}
|
|
40763
|
+
return store;
|
|
40764
|
+
}
|
|
40765
|
+
function readline() {
|
|
40766
|
+
return getStore().rl;
|
|
40767
|
+
}
|
|
40768
|
+
function withUpdates(fn) {
|
|
40769
|
+
const wrapped = (...args) => {
|
|
40770
|
+
const store = getStore();
|
|
40771
|
+
let shouldUpdate = false;
|
|
40772
|
+
const oldHandleChange = store.handleChange;
|
|
40773
|
+
store.handleChange = () => {
|
|
40774
|
+
shouldUpdate = true;
|
|
40775
|
+
};
|
|
40776
|
+
const returnValue = fn(...args);
|
|
40777
|
+
if (shouldUpdate) {
|
|
40778
|
+
oldHandleChange();
|
|
40779
|
+
}
|
|
40780
|
+
store.handleChange = oldHandleChange;
|
|
40781
|
+
return returnValue;
|
|
40782
|
+
};
|
|
40783
|
+
return AsyncResource.bind(wrapped);
|
|
40784
|
+
}
|
|
40785
|
+
function withPointer(cb) {
|
|
40786
|
+
const store = getStore();
|
|
40787
|
+
const { index } = store;
|
|
40788
|
+
const pointer = {
|
|
40789
|
+
get() {
|
|
40790
|
+
return store.hooks[index];
|
|
40791
|
+
},
|
|
40792
|
+
set(value) {
|
|
40793
|
+
store.hooks[index] = value;
|
|
40794
|
+
},
|
|
40795
|
+
initialized: index in store.hooks
|
|
40796
|
+
};
|
|
40797
|
+
const returnValue = cb(pointer);
|
|
40798
|
+
store.index++;
|
|
40799
|
+
return returnValue;
|
|
40800
|
+
}
|
|
40801
|
+
function handleChange() {
|
|
40802
|
+
getStore().handleChange();
|
|
40803
|
+
}
|
|
40804
|
+
var effectScheduler = {
|
|
40805
|
+
queue(cb) {
|
|
40806
|
+
const store = getStore();
|
|
40807
|
+
const { index } = store;
|
|
40808
|
+
store.hooksEffect.push(() => {
|
|
40809
|
+
store.hooksCleanup[index]?.();
|
|
40810
|
+
const cleanFn = cb(readline());
|
|
40811
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
40812
|
+
throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
40813
|
+
}
|
|
40814
|
+
store.hooksCleanup[index] = cleanFn;
|
|
40815
|
+
});
|
|
40816
|
+
},
|
|
40817
|
+
run() {
|
|
40818
|
+
const store = getStore();
|
|
40819
|
+
withUpdates(() => {
|
|
40820
|
+
store.hooksEffect.forEach((effect) => {
|
|
40821
|
+
effect();
|
|
40822
|
+
});
|
|
40823
|
+
store.hooksEffect.length = 0;
|
|
40824
|
+
})();
|
|
40825
|
+
},
|
|
40826
|
+
clearAll() {
|
|
40827
|
+
const store = getStore();
|
|
40828
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
40829
|
+
cleanFn?.();
|
|
40830
|
+
});
|
|
40831
|
+
store.hooksEffect.length = 0;
|
|
40832
|
+
store.hooksCleanup.length = 0;
|
|
40833
|
+
}
|
|
40834
|
+
};
|
|
40835
|
+
|
|
40836
|
+
// node_modules/.pnpm/@inquirer+core@11.0.1_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
40837
|
+
function useState(defaultValue) {
|
|
40838
|
+
return withPointer((pointer) => {
|
|
40839
|
+
const setState = AsyncResource2.bind(function setState(newValue) {
|
|
40840
|
+
if (pointer.get() !== newValue) {
|
|
40841
|
+
pointer.set(newValue);
|
|
40842
|
+
handleChange();
|
|
40843
|
+
}
|
|
40844
|
+
});
|
|
40845
|
+
if (pointer.initialized) {
|
|
40846
|
+
return [pointer.get(), setState];
|
|
40847
|
+
}
|
|
40848
|
+
const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
40849
|
+
pointer.set(value);
|
|
40850
|
+
return [value, setState];
|
|
40851
|
+
});
|
|
40852
|
+
}
|
|
40853
|
+
|
|
40854
|
+
// node_modules/.pnpm/@inquirer+core@11.0.1_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
40855
|
+
function useEffect(cb, depArray) {
|
|
40856
|
+
withPointer((pointer) => {
|
|
40857
|
+
const oldDeps = pointer.get();
|
|
40858
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
40266
40859
|
if (hasChanged) {
|
|
40267
40860
|
effectScheduler.queue(cb);
|
|
40268
40861
|
}
|
|
@@ -44602,15 +45195,15 @@ var chalk2 = new Chalk({ level: 3 });
|
|
|
44602
45195
|
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
44603
45196
|
|
|
44604
45197
|
// node_modules/.pnpm/@kevisual+load@0.0.6/node_modules/@kevisual/load/dist/load.js
|
|
44605
|
-
function
|
|
45198
|
+
function getDefaultExportFromCjs2(x) {
|
|
44606
45199
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
44607
45200
|
}
|
|
44608
|
-
var
|
|
44609
|
-
var
|
|
44610
|
-
function
|
|
44611
|
-
if (
|
|
44612
|
-
return
|
|
44613
|
-
|
|
45201
|
+
var eventemitter32 = { exports: {} };
|
|
45202
|
+
var hasRequiredEventemitter32;
|
|
45203
|
+
function requireEventemitter32() {
|
|
45204
|
+
if (hasRequiredEventemitter32)
|
|
45205
|
+
return eventemitter32.exports;
|
|
45206
|
+
hasRequiredEventemitter32 = 1;
|
|
44614
45207
|
(function(module) {
|
|
44615
45208
|
var has = Object.prototype.hasOwnProperty, prefix = "~";
|
|
44616
45209
|
function Events() {}
|
|
@@ -44643,11 +45236,11 @@ function requireEventemitter3() {
|
|
|
44643
45236
|
else
|
|
44644
45237
|
delete emitter._events[evt];
|
|
44645
45238
|
}
|
|
44646
|
-
function
|
|
45239
|
+
function EventEmitter2() {
|
|
44647
45240
|
this._events = new Events;
|
|
44648
45241
|
this._eventsCount = 0;
|
|
44649
45242
|
}
|
|
44650
|
-
|
|
45243
|
+
EventEmitter2.prototype.eventNames = function eventNames() {
|
|
44651
45244
|
var names = [], events, name;
|
|
44652
45245
|
if (this._eventsCount === 0)
|
|
44653
45246
|
return names;
|
|
@@ -44660,7 +45253,7 @@ function requireEventemitter3() {
|
|
|
44660
45253
|
}
|
|
44661
45254
|
return names;
|
|
44662
45255
|
};
|
|
44663
|
-
|
|
45256
|
+
EventEmitter2.prototype.listeners = function listeners(event) {
|
|
44664
45257
|
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
44665
45258
|
if (!handlers)
|
|
44666
45259
|
return [];
|
|
@@ -44671,7 +45264,7 @@ function requireEventemitter3() {
|
|
|
44671
45264
|
}
|
|
44672
45265
|
return ee;
|
|
44673
45266
|
};
|
|
44674
|
-
|
|
45267
|
+
EventEmitter2.prototype.listenerCount = function listenerCount(event) {
|
|
44675
45268
|
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
44676
45269
|
if (!listeners)
|
|
44677
45270
|
return 0;
|
|
@@ -44679,7 +45272,7 @@ function requireEventemitter3() {
|
|
|
44679
45272
|
return 1;
|
|
44680
45273
|
return listeners.length;
|
|
44681
45274
|
};
|
|
44682
|
-
|
|
45275
|
+
EventEmitter2.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
44683
45276
|
var evt = prefix ? prefix + event : event;
|
|
44684
45277
|
if (!this._events[evt])
|
|
44685
45278
|
return false;
|
|
@@ -44734,13 +45327,13 @@ function requireEventemitter3() {
|
|
|
44734
45327
|
}
|
|
44735
45328
|
return true;
|
|
44736
45329
|
};
|
|
44737
|
-
|
|
45330
|
+
EventEmitter2.prototype.on = function on(event, fn, context) {
|
|
44738
45331
|
return addListener(this, event, fn, context, false);
|
|
44739
45332
|
};
|
|
44740
|
-
|
|
45333
|
+
EventEmitter2.prototype.once = function once(event, fn, context) {
|
|
44741
45334
|
return addListener(this, event, fn, context, true);
|
|
44742
45335
|
};
|
|
44743
|
-
|
|
45336
|
+
EventEmitter2.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
44744
45337
|
var evt = prefix ? prefix + event : event;
|
|
44745
45338
|
if (!this._events[evt])
|
|
44746
45339
|
return this;
|
|
@@ -44766,7 +45359,7 @@ function requireEventemitter3() {
|
|
|
44766
45359
|
}
|
|
44767
45360
|
return this;
|
|
44768
45361
|
};
|
|
44769
|
-
|
|
45362
|
+
EventEmitter2.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
44770
45363
|
var evt;
|
|
44771
45364
|
if (event) {
|
|
44772
45365
|
evt = prefix ? prefix + event : event;
|
|
@@ -44778,19 +45371,19 @@ function requireEventemitter3() {
|
|
|
44778
45371
|
}
|
|
44779
45372
|
return this;
|
|
44780
45373
|
};
|
|
44781
|
-
|
|
44782
|
-
|
|
44783
|
-
|
|
44784
|
-
|
|
45374
|
+
EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener;
|
|
45375
|
+
EventEmitter2.prototype.addListener = EventEmitter2.prototype.on;
|
|
45376
|
+
EventEmitter2.prefixed = prefix;
|
|
45377
|
+
EventEmitter2.EventEmitter = EventEmitter2;
|
|
44785
45378
|
{
|
|
44786
|
-
module.exports =
|
|
45379
|
+
module.exports = EventEmitter2;
|
|
44787
45380
|
}
|
|
44788
|
-
})(
|
|
44789
|
-
return
|
|
45381
|
+
})(eventemitter32);
|
|
45382
|
+
return eventemitter32.exports;
|
|
44790
45383
|
}
|
|
44791
|
-
var
|
|
44792
|
-
var
|
|
44793
|
-
var
|
|
45384
|
+
var eventemitter3Exports2 = requireEventemitter32();
|
|
45385
|
+
var EventEmitter2 = /* @__PURE__ */ getDefaultExportFromCjs2(eventemitter3Exports2);
|
|
45386
|
+
var reRunFn2 = (promiseOpts) => {
|
|
44794
45387
|
const timeout = promiseOpts.timeout || 5 * 60 * 1000;
|
|
44795
45388
|
const interval = promiseOpts.interval || 1000;
|
|
44796
45389
|
const checkSuccess = promiseOpts?.checkSuccess || (() => true);
|
|
@@ -44842,14 +45435,14 @@ var reRunFn = (promiseOpts) => {
|
|
|
44842
45435
|
});
|
|
44843
45436
|
};
|
|
44844
45437
|
|
|
44845
|
-
class
|
|
45438
|
+
class BaseLoad2 {
|
|
44846
45439
|
modules = new Map;
|
|
44847
45440
|
event;
|
|
44848
45441
|
loading;
|
|
44849
|
-
static reRunFn =
|
|
45442
|
+
static reRunFn = reRunFn2;
|
|
44850
45443
|
timeout = 5 * 60 * 1000;
|
|
44851
45444
|
constructor() {
|
|
44852
|
-
this.event = new
|
|
45445
|
+
this.event = new EventEmitter2;
|
|
44853
45446
|
this.loading = false;
|
|
44854
45447
|
}
|
|
44855
45448
|
listenKey(key, listenOpts) {
|
|
@@ -44951,7 +45544,7 @@ class BaseLoad {
|
|
|
44951
45544
|
newModule.controller = new AbortController;
|
|
44952
45545
|
const signal = newModule.controller.signal;
|
|
44953
45546
|
this.modules.set(key, newModule);
|
|
44954
|
-
const data = await
|
|
45547
|
+
const data = await reRunFn2({
|
|
44955
45548
|
timeout: opts.timeout,
|
|
44956
45549
|
interval: opts.interval,
|
|
44957
45550
|
checkSuccess: opts.checkSuccess,
|
|
@@ -45053,7 +45646,7 @@ class BaseLoad {
|
|
|
45053
45646
|
|
|
45054
45647
|
// src/module/login/login-by-web.ts
|
|
45055
45648
|
var pollLoginStatus = async (token, opts) => {
|
|
45056
|
-
const load2 = new
|
|
45649
|
+
const load2 = new BaseLoad2;
|
|
45057
45650
|
load2.load(async () => {
|
|
45058
45651
|
const res2 = await queryLogin.checkLoginStatus(token);
|
|
45059
45652
|
if (res2.code === 500) {
|
|
@@ -45136,6 +45729,8 @@ var loginCommand = new Command("login").description("Login to the application").
|
|
|
45136
45729
|
const res = await queryLogin.login({
|
|
45137
45730
|
username,
|
|
45138
45731
|
password
|
|
45732
|
+
}).catch((err) => {
|
|
45733
|
+
return { code: 500, message: err.message || "" };
|
|
45139
45734
|
});
|
|
45140
45735
|
if (res.code === 200) {
|
|
45141
45736
|
console.log("welcome", username);
|
|
@@ -46188,7 +46783,6 @@ var command2 = new Command("deploy").description("把前端文件传到服务器
|
|
|
46188
46783
|
dot,
|
|
46189
46784
|
absolute: true
|
|
46190
46785
|
});
|
|
46191
|
-
console.log("files", files);
|
|
46192
46786
|
const normalizeFilePath = (filePath2) => {
|
|
46193
46787
|
return filePath2.split(path3.sep).join("/");
|
|
46194
46788
|
};
|
|
@@ -46305,7 +46899,6 @@ var uploadFiles = async (files, directory, opts) => {
|
|
|
46305
46899
|
console.error("check failed", res);
|
|
46306
46900
|
return res;
|
|
46307
46901
|
}
|
|
46308
|
-
console.log("res", res);
|
|
46309
46902
|
let needUpload = false;
|
|
46310
46903
|
for (const file of files) {
|
|
46311
46904
|
const filePath = path3.join(directory, file);
|
|
@@ -46916,7 +47509,7 @@ async function collectFileInfo(filePath, baseDir = ".") {
|
|
|
46916
47509
|
}
|
|
46917
47510
|
return [];
|
|
46918
47511
|
}
|
|
46919
|
-
var copyFilesToPackDist = async (files, cwd, packDist = "pack-dist") => {
|
|
47512
|
+
var copyFilesToPackDist = async (files, cwd, packDist = "pack-dist", mergeDist = true) => {
|
|
46920
47513
|
const packDistPath = path6.join(cwd, packDist);
|
|
46921
47514
|
if (!fileIsExist(packDistPath)) {
|
|
46922
47515
|
fs9.mkdirSync(packDistPath, { recursive: true });
|
|
@@ -46926,10 +47519,12 @@ var copyFilesToPackDist = async (files, cwd, packDist = "pack-dist") => {
|
|
|
46926
47519
|
files.forEach((file) => {
|
|
46927
47520
|
const stat = fs9.statSync(path6.join(cwd, file));
|
|
46928
47521
|
let outputFile = file;
|
|
46929
|
-
if (
|
|
46930
|
-
|
|
46931
|
-
|
|
46932
|
-
|
|
47522
|
+
if (mergeDist) {
|
|
47523
|
+
if (file.startsWith("dist/")) {
|
|
47524
|
+
outputFile = file.replace(/^dist\//, "");
|
|
47525
|
+
} else if (file === "dist") {
|
|
47526
|
+
outputFile = "";
|
|
47527
|
+
}
|
|
46933
47528
|
}
|
|
46934
47529
|
if (stat.isDirectory()) {
|
|
46935
47530
|
fs9.cpSync(path6.join(cwd, file), path6.join(packDistPath, outputFile), { recursive: true });
|
|
@@ -46975,6 +47570,7 @@ ${filesString}
|
|
|
46975
47570
|
var pack = async (opts) => {
|
|
46976
47571
|
const cwd = process.cwd();
|
|
46977
47572
|
const collection = {};
|
|
47573
|
+
const mergeDist = opts.mergeDist !== false;
|
|
46978
47574
|
const packageJsonPath = path6.join(cwd, "package.json");
|
|
46979
47575
|
if (!fileIsExist(packageJsonPath)) {
|
|
46980
47576
|
console.error("package.json not found");
|
|
@@ -47020,7 +47616,7 @@ var pack = async (opts) => {
|
|
|
47020
47616
|
console.log(`version: ${packageJson.version}`);
|
|
47021
47617
|
console.log(`total files: ${allFiles.length}`);
|
|
47022
47618
|
try {
|
|
47023
|
-
copyFilesToPackDist(filesToInclude, cwd, opts.packDist);
|
|
47619
|
+
copyFilesToPackDist(filesToInclude, cwd, opts.packDist, mergeDist);
|
|
47024
47620
|
} catch (error) {
|
|
47025
47621
|
console.error("Error creating tarball:", error);
|
|
47026
47622
|
}
|
|
@@ -47042,11 +47638,6 @@ var getPackageInfo = async () => {
|
|
|
47042
47638
|
return {};
|
|
47043
47639
|
}
|
|
47044
47640
|
};
|
|
47045
|
-
var packLib = async ({
|
|
47046
|
-
packDist = "pack-dist"
|
|
47047
|
-
}) => {
|
|
47048
|
-
return await pack({ packDist });
|
|
47049
|
-
};
|
|
47050
47641
|
var publishCommand = new Command("publish").description("发布应用").option("-k, --key <key>", "应用 key").option("-v, --version <version>", "应用版本").action(async (options) => {
|
|
47051
47642
|
const { key, version: version2 } = options;
|
|
47052
47643
|
const config2 = await getConfig();
|
|
@@ -47090,8 +47681,10 @@ var deployLoadFn2 = async (id, fileKey, force = false, install2 = false) => {
|
|
|
47090
47681
|
}
|
|
47091
47682
|
return res;
|
|
47092
47683
|
};
|
|
47093
|
-
var packCommand = new Command("pack").description("打包应用, 使用 package.json 中的 files 字段,如果是 dist 的路径,直接复制到 pack-dist 的根目录").option("-p, --publish", "打包并发布").option("-u, --update", "发布后显示更新命令, show command for deploy to server").option("-d, --packDist <dist>", "打包到的目录").option("-y, --yes", "确定,直接打包", true).option("-c, --clean", "清理 package.json中的 devDependencies").action(async (opts) => {
|
|
47684
|
+
var packCommand = new Command("pack").description("打包应用, 使用 package.json 中的 files 字段,如果是 dist 的路径,直接复制到 pack-dist 的根目录").option("-p, --publish", "打包并发布").option("-u, --update", "发布后显示更新命令, show command for deploy to server").option("-d, --packDist <dist>", "打包到的目录").option("-m, --mergeDist <mergeDist>", "合并 dist 目录到 pack-dist 中", "true").option("-y, --yes <yes>", "确定,直接打包", "true").option("-c, --clean", "清理 package.json中的 devDependencies").action(async (opts) => {
|
|
47094
47685
|
const packDist = opts.packDist || "pack-dist";
|
|
47686
|
+
const mergeDist = opts.mergeDist === "true";
|
|
47687
|
+
const yes = opts.yes === "true";
|
|
47095
47688
|
const packageInfo = await getPackageInfo();
|
|
47096
47689
|
if (!packageInfo) {
|
|
47097
47690
|
console.error("Invalid package.json:");
|
|
@@ -47131,8 +47724,9 @@ var packCommand = new Command("pack").description("打包应用, 使用 package.
|
|
|
47131
47724
|
]);
|
|
47132
47725
|
appKey = answers.appKey || appKey;
|
|
47133
47726
|
}
|
|
47134
|
-
let value = await
|
|
47135
|
-
packDist
|
|
47727
|
+
let value = await pack({
|
|
47728
|
+
packDist,
|
|
47729
|
+
mergeDist
|
|
47136
47730
|
});
|
|
47137
47731
|
if (opts?.clean) {
|
|
47138
47732
|
const newPackageJson = { ...packageInfo };
|
|
@@ -47149,7 +47743,7 @@ var packCommand = new Command("pack").description("打包应用, 使用 package.
|
|
|
47149
47743
|
if (opts.update) {
|
|
47150
47744
|
deployCommand.push("-s");
|
|
47151
47745
|
}
|
|
47152
|
-
if (
|
|
47746
|
+
if (yes) {
|
|
47153
47747
|
deployCommand.push("-y", "yes");
|
|
47154
47748
|
}
|
|
47155
47749
|
console.log(chalk2.blue("deploy doing: "), deployCommand.slice(2).join(" "), `
|
|
@@ -47488,15 +48082,318 @@ var command7 = new Command("proxy").description("执行代理相关的命令").o
|
|
|
47488
48082
|
} else {
|
|
47489
48083
|
console.log(chalk2.red("请提供选项 -s 或 -u"));
|
|
47490
48084
|
}
|
|
47491
|
-
});
|
|
47492
|
-
program.addCommand(command7);
|
|
48085
|
+
});
|
|
48086
|
+
program.addCommand(command7);
|
|
48087
|
+
|
|
48088
|
+
// src/command/update.ts
|
|
48089
|
+
import { execSync } from "node:child_process";
|
|
48090
|
+
import path9 from "node:path";
|
|
48091
|
+
import fs12 from "node:fs";
|
|
48092
|
+
|
|
48093
|
+
// src/module/download/install.ts
|
|
48094
|
+
import path8 from "path";
|
|
48095
|
+
import fs11 from "fs";
|
|
48096
|
+
var import_fast_glob3 = __toESM(require_out4(), 1);
|
|
48097
|
+
var fetchLink = async (url = "", opts) => {
|
|
48098
|
+
const token2 = process.env.KEVISUAL_TOKEN || storage.getItem("token");
|
|
48099
|
+
const fetchURL = new URL(url);
|
|
48100
|
+
const check2 = opts?.check ?? false;
|
|
48101
|
+
const isKevisual = !!url.includes("kevisual");
|
|
48102
|
+
const setToken = opts?.setToken ?? isKevisual;
|
|
48103
|
+
if (check2) {
|
|
48104
|
+
if (!url.startsWith(baseURL)) {
|
|
48105
|
+
throw new Error("url must start with " + baseURL);
|
|
48106
|
+
}
|
|
48107
|
+
}
|
|
48108
|
+
if (token2 && setToken) {
|
|
48109
|
+
fetchURL.searchParams.set("token", token2);
|
|
48110
|
+
}
|
|
48111
|
+
if (opts?.hash) {
|
|
48112
|
+
fetchURL.searchParams.set("hash", opts.hash);
|
|
48113
|
+
}
|
|
48114
|
+
fetchURL.searchParams.set("download", "true");
|
|
48115
|
+
const res = await fetch(fetchURL.toString());
|
|
48116
|
+
const blob = await res.blob();
|
|
48117
|
+
const type = blob.type;
|
|
48118
|
+
let content;
|
|
48119
|
+
if (opts?.returnContent) {
|
|
48120
|
+
content = Buffer.from(await blob.arrayBuffer());
|
|
48121
|
+
}
|
|
48122
|
+
const pathname = fetchURL.pathname;
|
|
48123
|
+
const filename = pathname.split("/").pop();
|
|
48124
|
+
return {
|
|
48125
|
+
status: res.status,
|
|
48126
|
+
filename,
|
|
48127
|
+
blob,
|
|
48128
|
+
type,
|
|
48129
|
+
content
|
|
48130
|
+
};
|
|
48131
|
+
};
|
|
48132
|
+
var checkDelete = async (opts) => {
|
|
48133
|
+
const { force = false, dir = "", yes = false } = opts || {};
|
|
48134
|
+
if (force) {
|
|
48135
|
+
try {
|
|
48136
|
+
if (fileIsExist(dir)) {
|
|
48137
|
+
const files = await import_fast_glob3.glob(`${dir}/**/*`, { onlyFiles: true });
|
|
48138
|
+
const answers = await dist_default12.prompt([
|
|
48139
|
+
{
|
|
48140
|
+
type: "confirm",
|
|
48141
|
+
name: "confirm",
|
|
48142
|
+
message: `是否你需要删除 【${opts?.dir}】 目录下的文件. [${files.length}] 个?`,
|
|
48143
|
+
when: () => files.length > 0 && !yes
|
|
48144
|
+
}
|
|
48145
|
+
]);
|
|
48146
|
+
if (answers?.confirm || yes) {
|
|
48147
|
+
fs11.rmSync(dir, { recursive: true });
|
|
48148
|
+
console.log(chalk2.green("删除成功", dir));
|
|
48149
|
+
} else {
|
|
48150
|
+
console.log(chalk2.red("取消删除", dir));
|
|
48151
|
+
}
|
|
48152
|
+
}
|
|
48153
|
+
} catch (error) {
|
|
48154
|
+
console.error(error);
|
|
48155
|
+
} finally {
|
|
48156
|
+
fs11.mkdirSync(dir, { recursive: true });
|
|
48157
|
+
}
|
|
48158
|
+
}
|
|
48159
|
+
};
|
|
48160
|
+
var rewritePkg = (packagePath, pkg) => {
|
|
48161
|
+
const readJsonFile = (filePath) => {
|
|
48162
|
+
try {
|
|
48163
|
+
return JSON.parse(fs11.readFileSync(filePath, "utf-8"));
|
|
48164
|
+
} catch (error) {
|
|
48165
|
+
return {};
|
|
48166
|
+
}
|
|
48167
|
+
};
|
|
48168
|
+
try {
|
|
48169
|
+
const dirname2 = path8.dirname(packagePath);
|
|
48170
|
+
if (!fs11.existsSync(dirname2)) {
|
|
48171
|
+
fs11.mkdirSync(dirname2, { recursive: true });
|
|
48172
|
+
}
|
|
48173
|
+
const json = readJsonFile(packagePath);
|
|
48174
|
+
json.id = pkg?.id;
|
|
48175
|
+
json.appInfo = pkg;
|
|
48176
|
+
fs11.writeFileSync(packagePath, JSON.stringify(json, null, 2));
|
|
48177
|
+
} catch (error) {
|
|
48178
|
+
fs11.writeFileSync(packagePath, JSON.stringify({ appInfo: pkg, id: pkg?.id }, null, 2));
|
|
48179
|
+
}
|
|
48180
|
+
return pkg;
|
|
48181
|
+
};
|
|
48182
|
+
var installApp = async (app, opts = {}) => {
|
|
48183
|
+
const { appDir = "", kevisualUrl = "https://kevisual.cn" } = opts;
|
|
48184
|
+
const _app = app;
|
|
48185
|
+
try {
|
|
48186
|
+
let files = _app.data.files || [];
|
|
48187
|
+
const version2 = _app.version;
|
|
48188
|
+
const user = _app.user;
|
|
48189
|
+
const key = _app.key;
|
|
48190
|
+
const downloadDirPath = path8.join(appDir, user, key);
|
|
48191
|
+
await checkDelete({ force: opts?.force, yes: opts?.yes, dir: downloadDirPath });
|
|
48192
|
+
const packagePath = path8.join(appDir, `${user}/${key}/package.json`);
|
|
48193
|
+
const downFiles = files.filter((file) => file?.path).map((file) => {
|
|
48194
|
+
const name = file?.name || "";
|
|
48195
|
+
const noVersionPath = file.path.replace(`/${version2}`, "");
|
|
48196
|
+
let downloadPath = noVersionPath;
|
|
48197
|
+
let downloadUrl = "";
|
|
48198
|
+
if (file.path.startsWith("http")) {
|
|
48199
|
+
downloadUrl = file.path;
|
|
48200
|
+
} else {
|
|
48201
|
+
downloadUrl = `${kevisualUrl}/${noVersionPath}`;
|
|
48202
|
+
}
|
|
48203
|
+
return {
|
|
48204
|
+
...file,
|
|
48205
|
+
downloadPath: path8.join(appDir, downloadPath),
|
|
48206
|
+
downloadUrl
|
|
48207
|
+
};
|
|
48208
|
+
});
|
|
48209
|
+
const downloadTasks = downFiles;
|
|
48210
|
+
console.log("downloadTasks", downloadTasks);
|
|
48211
|
+
for (const file of downloadTasks) {
|
|
48212
|
+
const downloadPath = file.downloadPath;
|
|
48213
|
+
const downloadUrl = file.downloadUrl;
|
|
48214
|
+
const dir = path8.dirname(downloadPath);
|
|
48215
|
+
if (!fs11.existsSync(dir)) {
|
|
48216
|
+
fs11.mkdirSync(dir, { recursive: true });
|
|
48217
|
+
}
|
|
48218
|
+
console.log("downloadUrl", downloadUrl);
|
|
48219
|
+
const { blob, type } = await fetchLink(downloadUrl);
|
|
48220
|
+
if (type.includes("text/html")) {
|
|
48221
|
+
const html = await blob.text();
|
|
48222
|
+
if (html === "fetchRes is error") {
|
|
48223
|
+
console.log(chalk2.red("fetchRes is error"), "下载失败", downloadUrl);
|
|
48224
|
+
throw new Error("fetchRes is error");
|
|
48225
|
+
}
|
|
48226
|
+
}
|
|
48227
|
+
fs11.writeFileSync(downloadPath, Buffer.from(await blob.arrayBuffer()));
|
|
48228
|
+
}
|
|
48229
|
+
let indexHtml = files.find((file) => file.name === "index.html");
|
|
48230
|
+
_app.data.files = files;
|
|
48231
|
+
rewritePkg(packagePath, _app);
|
|
48232
|
+
return {
|
|
48233
|
+
code: 200,
|
|
48234
|
+
data: _app,
|
|
48235
|
+
message: "Install app success"
|
|
48236
|
+
};
|
|
48237
|
+
} catch (error) {
|
|
48238
|
+
console.error(error);
|
|
48239
|
+
return {
|
|
48240
|
+
code: 500,
|
|
48241
|
+
message: "Install app failed"
|
|
48242
|
+
};
|
|
48243
|
+
}
|
|
48244
|
+
};
|
|
48245
|
+
var checkAppDir = (appDir) => {
|
|
48246
|
+
try {
|
|
48247
|
+
const files = fs11.readdirSync(appDir);
|
|
48248
|
+
if (files.length === 0) {
|
|
48249
|
+
fs11.rmSync(appDir, { recursive: true });
|
|
48250
|
+
}
|
|
48251
|
+
} catch (error) {}
|
|
48252
|
+
};
|
|
48253
|
+
var checkFileExists2 = (path9) => {
|
|
48254
|
+
try {
|
|
48255
|
+
fs11.accessSync(path9);
|
|
48256
|
+
return true;
|
|
48257
|
+
} catch (error) {
|
|
48258
|
+
return false;
|
|
48259
|
+
}
|
|
48260
|
+
};
|
|
48261
|
+
var uninstallApp = async (app, opts = {}) => {
|
|
48262
|
+
const { appDir = "" } = opts;
|
|
48263
|
+
try {
|
|
48264
|
+
const { user, key } = app;
|
|
48265
|
+
const keyDir = path8.join(appDir, user, key);
|
|
48266
|
+
const parentDir = path8.join(appDir, user);
|
|
48267
|
+
if (!checkFileExists2(appDir) || !checkFileExists2(keyDir)) {
|
|
48268
|
+
return {
|
|
48269
|
+
code: 200,
|
|
48270
|
+
message: "uninstall app success"
|
|
48271
|
+
};
|
|
48272
|
+
}
|
|
48273
|
+
try {
|
|
48274
|
+
fs11.rmSync(keyDir, { recursive: true });
|
|
48275
|
+
} catch (error) {
|
|
48276
|
+
console.error(error);
|
|
48277
|
+
}
|
|
48278
|
+
checkAppDir(parentDir);
|
|
48279
|
+
return {
|
|
48280
|
+
code: 200,
|
|
48281
|
+
message: "Uninstall app success"
|
|
48282
|
+
};
|
|
48283
|
+
} catch (error) {
|
|
48284
|
+
console.error(error);
|
|
48285
|
+
return {
|
|
48286
|
+
code: 500,
|
|
48287
|
+
message: "Uninstall app failed"
|
|
48288
|
+
};
|
|
48289
|
+
}
|
|
48290
|
+
};
|
|
48291
|
+
var fetchAiList = async (url, opts) => {
|
|
48292
|
+
const token2 = process.env.KEVISUAL_TOKEN || storage.getItem("token");
|
|
48293
|
+
const _url = new URL(url);
|
|
48294
|
+
const dir = _url.searchParams.get("dir");
|
|
48295
|
+
if (!dir) {
|
|
48296
|
+
_url.searchParams.set("dir", "true");
|
|
48297
|
+
}
|
|
48298
|
+
if (opts?.recursive) {
|
|
48299
|
+
_url.searchParams.set("recursive", "true");
|
|
48300
|
+
}
|
|
48301
|
+
if (!_url.pathname.endsWith("/")) {
|
|
48302
|
+
_url.pathname += "/";
|
|
48303
|
+
}
|
|
48304
|
+
const res = await fetch(_url.toString(), {
|
|
48305
|
+
method: "GET",
|
|
48306
|
+
headers: {
|
|
48307
|
+
Authorization: "Bearer " + token2
|
|
48308
|
+
}
|
|
48309
|
+
});
|
|
48310
|
+
const data = await res.json();
|
|
48311
|
+
return data;
|
|
48312
|
+
};
|
|
47493
48313
|
|
|
47494
48314
|
// src/command/update.ts
|
|
47495
|
-
|
|
47496
|
-
var
|
|
48315
|
+
var import_semver = __toESM(require_semver2(), 1);
|
|
48316
|
+
var getRunFilePath = () => {
|
|
48317
|
+
const c = process.argv[1];
|
|
48318
|
+
const runFilePath = path9.resolve(c);
|
|
48319
|
+
const isJs = runFilePath.endsWith(".js");
|
|
48320
|
+
let distDir = "";
|
|
48321
|
+
if (isJs) {
|
|
48322
|
+
const dir = path9.dirname(runFilePath);
|
|
48323
|
+
distDir = path9.relative(dir, "../dist");
|
|
48324
|
+
}
|
|
48325
|
+
distDir = path9.resolve(process.cwd(), "dist");
|
|
48326
|
+
return distDir;
|
|
48327
|
+
};
|
|
48328
|
+
var distFiles = ["assistant-server.js", "assistant.js", "envision.js"];
|
|
48329
|
+
var downloadNewDistFiles = async (distDir) => {
|
|
48330
|
+
const baseURL3 = getConfig().baseURL || "https://kevisual.cn";
|
|
48331
|
+
const newData = distFiles.map((file) => {
|
|
48332
|
+
const url = `${baseURL3}/root/cli/dist/${file}`;
|
|
48333
|
+
const filePath = path9.join(distDir, file);
|
|
48334
|
+
const exist = fileIsExist(filePath);
|
|
48335
|
+
let hash = "";
|
|
48336
|
+
hash = getHash(filePath);
|
|
48337
|
+
return { url, filePath, exist, hash };
|
|
48338
|
+
});
|
|
48339
|
+
const promises = newData.map(async ({ url, filePath }) => {
|
|
48340
|
+
return await fetchLink(url, { returnContent: true });
|
|
48341
|
+
});
|
|
48342
|
+
let isUpdate = false;
|
|
48343
|
+
await Promise.all(promises).then((results) => {
|
|
48344
|
+
results.forEach((res, index) => {
|
|
48345
|
+
const data = newData[index];
|
|
48346
|
+
const filePath = data.filePath;
|
|
48347
|
+
const newHash = getBufferHash(res.content);
|
|
48348
|
+
if (data.hash === newHash) {
|
|
48349
|
+
return;
|
|
48350
|
+
}
|
|
48351
|
+
console.log("更新文件:", filePath);
|
|
48352
|
+
isUpdate = true;
|
|
48353
|
+
if (data.exist) {
|
|
48354
|
+
fs12.writeFileSync(filePath, res.content, "utf-8");
|
|
48355
|
+
} else {
|
|
48356
|
+
const dir = path9.dirname(filePath);
|
|
48357
|
+
if (!fs12.existsSync(dir)) {
|
|
48358
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
48359
|
+
}
|
|
48360
|
+
fs12.writeFileSync(filePath, res.content, "utf-8");
|
|
48361
|
+
}
|
|
48362
|
+
});
|
|
48363
|
+
if (isUpdate) {
|
|
48364
|
+
console.log("更新完成,请重新运行命令");
|
|
48365
|
+
} else {
|
|
48366
|
+
console.log("检测完成");
|
|
48367
|
+
}
|
|
48368
|
+
}).catch((error) => {
|
|
48369
|
+
console.error("Error downloading files:", error);
|
|
48370
|
+
});
|
|
48371
|
+
};
|
|
48372
|
+
var getVersion = async () => {
|
|
48373
|
+
const baseURL3 = getConfig().baseURL || "https://kevisual.cn";
|
|
48374
|
+
const file = "package.json";
|
|
48375
|
+
const url = `${baseURL3}/root/cli/${file}`;
|
|
48376
|
+
const res = await fetchLink(url, { returnContent: true });
|
|
48377
|
+
const text = res.content.toString("utf-8");
|
|
48378
|
+
const json = JSON.parse(text);
|
|
48379
|
+
const latestVersion = json.version;
|
|
48380
|
+
const version2 = useContextKey("version");
|
|
48381
|
+
if (import_semver.default.lt(version2, latestVersion)) {
|
|
48382
|
+
console.log("当前版本:", version2);
|
|
48383
|
+
console.log("最新版本:", latestVersion);
|
|
48384
|
+
downloadNewDistFiles(getRunFilePath());
|
|
48385
|
+
} else {
|
|
48386
|
+
console.log("已经是最新版本", version2);
|
|
48387
|
+
}
|
|
48388
|
+
};
|
|
48389
|
+
var update = new Command("update").option("-g --global", "update global").option("-n --npm", "use npm to update", false).description("update cli").action((opts) => {
|
|
47497
48390
|
try {
|
|
47498
|
-
|
|
47499
|
-
|
|
48391
|
+
if (opts.npm) {
|
|
48392
|
+
const cmd = opts.global ? "npm install -g @kevisual/envision-cli" : "npm install -D @kevisual/envision-cli";
|
|
48393
|
+
execSync(cmd, { stdio: "inherit", encoding: "utf-8" });
|
|
48394
|
+
} else {
|
|
48395
|
+
getVersion();
|
|
48396
|
+
}
|
|
47500
48397
|
} catch (error) {
|
|
47501
48398
|
console.error("Error updating CLI:", error);
|
|
47502
48399
|
}
|
|
@@ -47504,9 +48401,9 @@ var update = new Command("update").option("-g --global", "update global").descri
|
|
|
47504
48401
|
program.addCommand(update);
|
|
47505
48402
|
|
|
47506
48403
|
// src/command/sync/modules/base.ts
|
|
47507
|
-
import
|
|
47508
|
-
import
|
|
47509
|
-
var
|
|
48404
|
+
import path10 from "node:path";
|
|
48405
|
+
import fs13 from "node:fs";
|
|
48406
|
+
var import_fast_glob4 = __toESM(require_out4(), 1);
|
|
47510
48407
|
var import_micromatch = __toESM(require_micromatch(), 1);
|
|
47511
48408
|
var checkAuth = (value = "", baseURL3 = "") => {
|
|
47512
48409
|
if (value.startsWith(baseURL3)) {
|
|
@@ -47525,7 +48422,7 @@ class SyncBase {
|
|
|
47525
48422
|
const filename = opts?.configFilename || "kevisual.json";
|
|
47526
48423
|
const dir = opts?.dir || process.cwd();
|
|
47527
48424
|
this.#filename = filename;
|
|
47528
|
-
this.#dir =
|
|
48425
|
+
this.#dir = path10.resolve(dir);
|
|
47529
48426
|
this.baseURL = opts?.baseURL ?? "";
|
|
47530
48427
|
this.init();
|
|
47531
48428
|
}
|
|
@@ -47533,16 +48430,16 @@ class SyncBase {
|
|
|
47533
48430
|
try {
|
|
47534
48431
|
const dir = this.#dir;
|
|
47535
48432
|
const filename = this.#filename;
|
|
47536
|
-
const filepath =
|
|
48433
|
+
const filepath = path10.join(dir, filename);
|
|
47537
48434
|
if (!fileIsExist(filepath))
|
|
47538
48435
|
throw new Error("config file not found");
|
|
47539
|
-
const config2 = JSON.parse(
|
|
48436
|
+
const config2 = JSON.parse(fs13.readFileSync(filepath, "utf-8"));
|
|
47540
48437
|
const sync = config2.sync || {};
|
|
47541
48438
|
const keys = Object.keys(sync);
|
|
47542
48439
|
const newConfigSync = {};
|
|
47543
48440
|
for (let key of keys) {
|
|
47544
|
-
const keyPath =
|
|
47545
|
-
const newKey =
|
|
48441
|
+
const keyPath = path10.join(dir, key);
|
|
48442
|
+
const newKey = path10.relative(dir, keyPath);
|
|
47546
48443
|
newConfigSync[newKey] = sync[key];
|
|
47547
48444
|
}
|
|
47548
48445
|
config2.sync = newConfigSync;
|
|
@@ -47557,8 +48454,8 @@ class SyncBase {
|
|
|
47557
48454
|
if (!filename)
|
|
47558
48455
|
return false;
|
|
47559
48456
|
const dir = this.#dir;
|
|
47560
|
-
const file =
|
|
47561
|
-
return { relative:
|
|
48457
|
+
const file = path10.join(dir, filename);
|
|
48458
|
+
return { relative: path10.relative(dir, file), absolute: file };
|
|
47562
48459
|
}
|
|
47563
48460
|
async canDone(syncType, type) {
|
|
47564
48461
|
if (syncType === "sync")
|
|
@@ -47586,7 +48483,7 @@ class SyncBase {
|
|
|
47586
48483
|
const baseURL3 = this.baseURL;
|
|
47587
48484
|
const syncList = syncKeys.map((key) => {
|
|
47588
48485
|
const value = sync[key];
|
|
47589
|
-
const filepath =
|
|
48486
|
+
const filepath = path10.join(this.#dir, key);
|
|
47590
48487
|
if (typeof value === "string") {
|
|
47591
48488
|
const auth2 = checkAuth(value, baseURL3);
|
|
47592
48489
|
const type2 = auth2 ? "sync" : "none";
|
|
@@ -47650,7 +48547,7 @@ class SyncBase {
|
|
|
47650
48547
|
for (let item of syncDirectory) {
|
|
47651
48548
|
const { registry, ignore = [], files = [], replace = {}, metadata } = item;
|
|
47652
48549
|
const cwd = this.#dir;
|
|
47653
|
-
const glob_files = await
|
|
48550
|
+
const glob_files = await import_fast_glob4.default(files, {
|
|
47654
48551
|
ignore: this.getIngore(ignore),
|
|
47655
48552
|
onlyFiles: true,
|
|
47656
48553
|
cwd,
|
|
@@ -47663,7 +48560,7 @@ class SyncBase {
|
|
|
47663
48560
|
continue;
|
|
47664
48561
|
}
|
|
47665
48562
|
for (let file of glob_files) {
|
|
47666
|
-
const key =
|
|
48563
|
+
const key = path10.relative(cwd, file);
|
|
47667
48564
|
const _registryURL = new URL(registyURL);
|
|
47668
48565
|
const replaceKeys = Object.keys(replace);
|
|
47669
48566
|
let newKey = key;
|
|
@@ -47672,7 +48569,7 @@ class SyncBase {
|
|
|
47672
48569
|
newKey = key.replace(replaceKey, replace[replaceKey]);
|
|
47673
48570
|
}
|
|
47674
48571
|
}
|
|
47675
|
-
const pathname =
|
|
48572
|
+
const pathname = path10.join(_registryURL.pathname, newKey);
|
|
47676
48573
|
_registryURL.pathname = pathname;
|
|
47677
48574
|
keys.push(key);
|
|
47678
48575
|
obj[key] = { url: _registryURL.toString() };
|
|
@@ -47701,10 +48598,10 @@ class SyncBase {
|
|
|
47701
48598
|
}
|
|
47702
48599
|
getHash = getHash;
|
|
47703
48600
|
async getDir(filepath, check2 = false) {
|
|
47704
|
-
const dir =
|
|
48601
|
+
const dir = path10.dirname(filepath);
|
|
47705
48602
|
if (check2) {
|
|
47706
48603
|
if (!fileIsExist(dir)) {
|
|
47707
|
-
|
|
48604
|
+
fs13.mkdirSync(dir, { recursive: true });
|
|
47708
48605
|
}
|
|
47709
48606
|
}
|
|
47710
48607
|
return dir;
|
|
@@ -47713,230 +48610,9 @@ class SyncBase {
|
|
|
47713
48610
|
async upload() {}
|
|
47714
48611
|
}
|
|
47715
48612
|
|
|
47716
|
-
// src/module/download/install.ts
|
|
47717
|
-
import path9 from "path";
|
|
47718
|
-
import fs12 from "fs";
|
|
47719
|
-
var import_fast_glob4 = __toESM(require_out4(), 1);
|
|
47720
|
-
var fetchLink = async (url = "", opts) => {
|
|
47721
|
-
const token2 = process.env.KEVISUAL_TOKEN || storage.getItem("token");
|
|
47722
|
-
const fetchURL = new URL(url);
|
|
47723
|
-
const check2 = opts?.check ?? false;
|
|
47724
|
-
const isKevisual = !!url.includes("kevisual");
|
|
47725
|
-
const setToken = opts?.setToken ?? isKevisual;
|
|
47726
|
-
if (check2) {
|
|
47727
|
-
if (!url.startsWith(baseURL)) {
|
|
47728
|
-
throw new Error("url must start with " + baseURL);
|
|
47729
|
-
}
|
|
47730
|
-
}
|
|
47731
|
-
if (token2 && setToken) {
|
|
47732
|
-
fetchURL.searchParams.set("token", token2);
|
|
47733
|
-
}
|
|
47734
|
-
if (opts?.hash) {
|
|
47735
|
-
fetchURL.searchParams.set("hash", opts.hash);
|
|
47736
|
-
}
|
|
47737
|
-
fetchURL.searchParams.set("download", "true");
|
|
47738
|
-
const res = await fetch(fetchURL.toString());
|
|
47739
|
-
const blob = await res.blob();
|
|
47740
|
-
const type = blob.type;
|
|
47741
|
-
let content;
|
|
47742
|
-
if (opts?.returnContent) {
|
|
47743
|
-
content = Buffer.from(await blob.arrayBuffer());
|
|
47744
|
-
}
|
|
47745
|
-
const pathname = fetchURL.pathname;
|
|
47746
|
-
const filename = pathname.split("/").pop();
|
|
47747
|
-
return {
|
|
47748
|
-
status: res.status,
|
|
47749
|
-
filename,
|
|
47750
|
-
blob,
|
|
47751
|
-
type,
|
|
47752
|
-
content
|
|
47753
|
-
};
|
|
47754
|
-
};
|
|
47755
|
-
var checkDelete = async (opts) => {
|
|
47756
|
-
const { force = false, dir = "", yes = false } = opts || {};
|
|
47757
|
-
if (force) {
|
|
47758
|
-
try {
|
|
47759
|
-
if (fileIsExist(dir)) {
|
|
47760
|
-
const files = await import_fast_glob4.glob(`${dir}/**/*`, { onlyFiles: true });
|
|
47761
|
-
const answers = await dist_default12.prompt([
|
|
47762
|
-
{
|
|
47763
|
-
type: "confirm",
|
|
47764
|
-
name: "confirm",
|
|
47765
|
-
message: `是否你需要删除 【${opts?.dir}】 目录下的文件. [${files.length}] 个?`,
|
|
47766
|
-
when: () => files.length > 0 && !yes
|
|
47767
|
-
}
|
|
47768
|
-
]);
|
|
47769
|
-
if (answers?.confirm || yes) {
|
|
47770
|
-
fs12.rmSync(dir, { recursive: true });
|
|
47771
|
-
console.log(chalk2.green("删除成功", dir));
|
|
47772
|
-
} else {
|
|
47773
|
-
console.log(chalk2.red("取消删除", dir));
|
|
47774
|
-
}
|
|
47775
|
-
}
|
|
47776
|
-
} catch (error) {
|
|
47777
|
-
console.error(error);
|
|
47778
|
-
} finally {
|
|
47779
|
-
fs12.mkdirSync(dir, { recursive: true });
|
|
47780
|
-
}
|
|
47781
|
-
}
|
|
47782
|
-
};
|
|
47783
|
-
var rewritePkg = (packagePath, pkg) => {
|
|
47784
|
-
const readJsonFile = (filePath) => {
|
|
47785
|
-
try {
|
|
47786
|
-
return JSON.parse(fs12.readFileSync(filePath, "utf-8"));
|
|
47787
|
-
} catch (error) {
|
|
47788
|
-
return {};
|
|
47789
|
-
}
|
|
47790
|
-
};
|
|
47791
|
-
try {
|
|
47792
|
-
const dirname2 = path9.dirname(packagePath);
|
|
47793
|
-
if (!fs12.existsSync(dirname2)) {
|
|
47794
|
-
fs12.mkdirSync(dirname2, { recursive: true });
|
|
47795
|
-
}
|
|
47796
|
-
const json = readJsonFile(packagePath);
|
|
47797
|
-
json.id = pkg?.id;
|
|
47798
|
-
json.appInfo = pkg;
|
|
47799
|
-
fs12.writeFileSync(packagePath, JSON.stringify(json, null, 2));
|
|
47800
|
-
} catch (error) {
|
|
47801
|
-
fs12.writeFileSync(packagePath, JSON.stringify({ appInfo: pkg, id: pkg?.id }, null, 2));
|
|
47802
|
-
}
|
|
47803
|
-
return pkg;
|
|
47804
|
-
};
|
|
47805
|
-
var installApp = async (app, opts = {}) => {
|
|
47806
|
-
const { appDir = "", kevisualUrl = "https://kevisual.cn" } = opts;
|
|
47807
|
-
const _app = app;
|
|
47808
|
-
try {
|
|
47809
|
-
let files = _app.data.files || [];
|
|
47810
|
-
const version2 = _app.version;
|
|
47811
|
-
const user = _app.user;
|
|
47812
|
-
const key = _app.key;
|
|
47813
|
-
const downloadDirPath = path9.join(appDir, user, key);
|
|
47814
|
-
await checkDelete({ force: opts?.force, yes: opts?.yes, dir: downloadDirPath });
|
|
47815
|
-
const packagePath = path9.join(appDir, `${user}/${key}/package.json`);
|
|
47816
|
-
const downFiles = files.filter((file) => file?.path).map((file) => {
|
|
47817
|
-
const name = file?.name || "";
|
|
47818
|
-
const noVersionPath = file.path.replace(`/${version2}`, "");
|
|
47819
|
-
let downloadPath = noVersionPath;
|
|
47820
|
-
let downloadUrl = "";
|
|
47821
|
-
if (file.path.startsWith("http")) {
|
|
47822
|
-
downloadUrl = file.path;
|
|
47823
|
-
} else {
|
|
47824
|
-
downloadUrl = `${kevisualUrl}/${noVersionPath}`;
|
|
47825
|
-
}
|
|
47826
|
-
return {
|
|
47827
|
-
...file,
|
|
47828
|
-
downloadPath: path9.join(appDir, downloadPath),
|
|
47829
|
-
downloadUrl
|
|
47830
|
-
};
|
|
47831
|
-
});
|
|
47832
|
-
const downloadTasks = downFiles;
|
|
47833
|
-
console.log("downloadTasks", downloadTasks);
|
|
47834
|
-
for (const file of downloadTasks) {
|
|
47835
|
-
const downloadPath = file.downloadPath;
|
|
47836
|
-
const downloadUrl = file.downloadUrl;
|
|
47837
|
-
const dir = path9.dirname(downloadPath);
|
|
47838
|
-
if (!fs12.existsSync(dir)) {
|
|
47839
|
-
fs12.mkdirSync(dir, { recursive: true });
|
|
47840
|
-
}
|
|
47841
|
-
console.log("downloadUrl", downloadUrl);
|
|
47842
|
-
const { blob, type } = await fetchLink(downloadUrl);
|
|
47843
|
-
if (type.includes("text/html")) {
|
|
47844
|
-
const html = await blob.text();
|
|
47845
|
-
if (html === "fetchRes is error") {
|
|
47846
|
-
console.log(chalk2.red("fetchRes is error"), "下载失败", downloadUrl);
|
|
47847
|
-
throw new Error("fetchRes is error");
|
|
47848
|
-
}
|
|
47849
|
-
}
|
|
47850
|
-
fs12.writeFileSync(downloadPath, Buffer.from(await blob.arrayBuffer()));
|
|
47851
|
-
}
|
|
47852
|
-
let indexHtml = files.find((file) => file.name === "index.html");
|
|
47853
|
-
_app.data.files = files;
|
|
47854
|
-
rewritePkg(packagePath, _app);
|
|
47855
|
-
return {
|
|
47856
|
-
code: 200,
|
|
47857
|
-
data: _app,
|
|
47858
|
-
message: "Install app success"
|
|
47859
|
-
};
|
|
47860
|
-
} catch (error) {
|
|
47861
|
-
console.error(error);
|
|
47862
|
-
return {
|
|
47863
|
-
code: 500,
|
|
47864
|
-
message: "Install app failed"
|
|
47865
|
-
};
|
|
47866
|
-
}
|
|
47867
|
-
};
|
|
47868
|
-
var checkAppDir = (appDir) => {
|
|
47869
|
-
try {
|
|
47870
|
-
const files = fs12.readdirSync(appDir);
|
|
47871
|
-
if (files.length === 0) {
|
|
47872
|
-
fs12.rmSync(appDir, { recursive: true });
|
|
47873
|
-
}
|
|
47874
|
-
} catch (error) {}
|
|
47875
|
-
};
|
|
47876
|
-
var checkFileExists2 = (path10) => {
|
|
47877
|
-
try {
|
|
47878
|
-
fs12.accessSync(path10);
|
|
47879
|
-
return true;
|
|
47880
|
-
} catch (error) {
|
|
47881
|
-
return false;
|
|
47882
|
-
}
|
|
47883
|
-
};
|
|
47884
|
-
var uninstallApp = async (app, opts = {}) => {
|
|
47885
|
-
const { appDir = "" } = opts;
|
|
47886
|
-
try {
|
|
47887
|
-
const { user, key } = app;
|
|
47888
|
-
const keyDir = path9.join(appDir, user, key);
|
|
47889
|
-
const parentDir = path9.join(appDir, user);
|
|
47890
|
-
if (!checkFileExists2(appDir) || !checkFileExists2(keyDir)) {
|
|
47891
|
-
return {
|
|
47892
|
-
code: 200,
|
|
47893
|
-
message: "uninstall app success"
|
|
47894
|
-
};
|
|
47895
|
-
}
|
|
47896
|
-
try {
|
|
47897
|
-
fs12.rmSync(keyDir, { recursive: true });
|
|
47898
|
-
} catch (error) {
|
|
47899
|
-
console.error(error);
|
|
47900
|
-
}
|
|
47901
|
-
checkAppDir(parentDir);
|
|
47902
|
-
return {
|
|
47903
|
-
code: 200,
|
|
47904
|
-
message: "Uninstall app success"
|
|
47905
|
-
};
|
|
47906
|
-
} catch (error) {
|
|
47907
|
-
console.error(error);
|
|
47908
|
-
return {
|
|
47909
|
-
code: 500,
|
|
47910
|
-
message: "Uninstall app failed"
|
|
47911
|
-
};
|
|
47912
|
-
}
|
|
47913
|
-
};
|
|
47914
|
-
var fetchAiList = async (url, opts) => {
|
|
47915
|
-
const token2 = process.env.KEVISUAL_TOKEN || storage.getItem("token");
|
|
47916
|
-
const _url = new URL(url);
|
|
47917
|
-
const dir = _url.searchParams.get("dir");
|
|
47918
|
-
if (!dir) {
|
|
47919
|
-
_url.searchParams.set("dir", "true");
|
|
47920
|
-
}
|
|
47921
|
-
if (opts?.recursive) {
|
|
47922
|
-
_url.searchParams.set("recursive", "true");
|
|
47923
|
-
}
|
|
47924
|
-
if (!_url.pathname.endsWith("/")) {
|
|
47925
|
-
_url.pathname += "/";
|
|
47926
|
-
}
|
|
47927
|
-
const res = await fetch(_url.toString(), {
|
|
47928
|
-
method: "GET",
|
|
47929
|
-
headers: {
|
|
47930
|
-
Authorization: "Bearer " + token2
|
|
47931
|
-
}
|
|
47932
|
-
});
|
|
47933
|
-
const data = await res.json();
|
|
47934
|
-
return data;
|
|
47935
|
-
};
|
|
47936
|
-
|
|
47937
48613
|
// src/command/sync/sync.ts
|
|
47938
|
-
import
|
|
47939
|
-
import
|
|
48614
|
+
import fs14 from "node:fs";
|
|
48615
|
+
import path11 from "node:path";
|
|
47940
48616
|
var command8 = new Command("sync").option("-d --dir <dir>").description("同步项目").action(() => {
|
|
47941
48617
|
console.log("同步项目");
|
|
47942
48618
|
});
|
|
@@ -47966,7 +48642,7 @@ var syncUpload = new Command("upload").option("-d --dir <dir>", "配置目录").
|
|
|
47966
48642
|
}
|
|
47967
48643
|
const res = await upload({
|
|
47968
48644
|
token: token2,
|
|
47969
|
-
file:
|
|
48645
|
+
file: fs14.readFileSync(item.filepath),
|
|
47970
48646
|
url: item.url,
|
|
47971
48647
|
needHash: true,
|
|
47972
48648
|
hash: item.hash,
|
|
@@ -48013,7 +48689,7 @@ var syncDownload = new Command("download").option("-d --dir <dir>", "配置目
|
|
|
48013
48689
|
const { content, status } = await fetchLink(item.url, { setToken: item.auth, returnContent: true, hash });
|
|
48014
48690
|
if (status === 200) {
|
|
48015
48691
|
await sync.getDir(item.filepath, true);
|
|
48016
|
-
|
|
48692
|
+
fs14.writeFileSync(item.filepath, content);
|
|
48017
48693
|
logger.info("下载成功", item.key, chalk2.green(item.url));
|
|
48018
48694
|
} else if (status === 304) {
|
|
48019
48695
|
logger.info("文件未修改", item.key, chalk2.green(item.url));
|
|
@@ -48054,7 +48730,7 @@ var syncCreateList = new Command("create").option("-d --dir <dir>", "配置目
|
|
|
48054
48730
|
const filepath = sync.getRelativePath(opts.output);
|
|
48055
48731
|
if (filepath) {
|
|
48056
48732
|
logger.debug("输出文件", filepath);
|
|
48057
|
-
|
|
48733
|
+
fs14.writeFileSync(filepath.absolute, JSON.stringify(newJson, null, 2));
|
|
48058
48734
|
} else {
|
|
48059
48735
|
logger.info(`输出内容
|
|
48060
48736
|
`);
|
|
@@ -48080,7 +48756,7 @@ var checkDir = new Command("check").option("-d --dir <dir>", "配置目录").opt
|
|
|
48080
48756
|
if (res.code === 200) {
|
|
48081
48757
|
const data = res?.data || [];
|
|
48082
48758
|
let matchObjectList = data.filter((dataItem) => {
|
|
48083
|
-
dataItem.pathname =
|
|
48759
|
+
dataItem.pathname = path11.join(item.key || "", dataItem.path);
|
|
48084
48760
|
return dataItem;
|
|
48085
48761
|
});
|
|
48086
48762
|
matchObjectList = sync.getMatchList({ ignore: item.ignore, matchObjectList }).matchObjectList;
|
|
@@ -48109,7 +48785,7 @@ var checkDir = new Command("check").option("-d --dir <dir>", "配置目录").opt
|
|
|
48109
48785
|
if (needDownload) {
|
|
48110
48786
|
const { content, status } = await fetchLink(matchItem.url, { setToken: item.auth, returnContent: true, hash });
|
|
48111
48787
|
if (status === 200) {
|
|
48112
|
-
|
|
48788
|
+
fs14.writeFileSync(matchItem.absolute, content);
|
|
48113
48789
|
logger.info("下载成功", matchItem.pathname, chalk2.green(matchItem.url));
|
|
48114
48790
|
} else if (status === 304) {
|
|
48115
48791
|
logger.info("文件未修改", matchItem.pathname, chalk2.green(matchItem.url));
|
|
@@ -48132,8 +48808,8 @@ command8.addCommand(checkDir);
|
|
|
48132
48808
|
program.addCommand(command8);
|
|
48133
48809
|
|
|
48134
48810
|
// src/command/app/front-app/index.ts
|
|
48135
|
-
import
|
|
48136
|
-
import
|
|
48811
|
+
import fs15 from "fs";
|
|
48812
|
+
import path12 from "path";
|
|
48137
48813
|
var appCommand = new Command("app").description("app 命令").action(() => {
|
|
48138
48814
|
console.log("app");
|
|
48139
48815
|
});
|
|
@@ -48149,7 +48825,7 @@ app download -i root/code-center`).option("-i, --id <id>", "下载 app serve cli
|
|
|
48149
48825
|
if (output) {
|
|
48150
48826
|
const checkOutput = fileIsExist(output);
|
|
48151
48827
|
if (!checkOutput) {
|
|
48152
|
-
|
|
48828
|
+
fs15.mkdirSync(output, { recursive: true });
|
|
48153
48829
|
}
|
|
48154
48830
|
}
|
|
48155
48831
|
const [user, key] = id.split("/");
|
|
@@ -48188,7 +48864,7 @@ app download -i root/code-center`).option("-i, --id <id>", "下载 app serve cli
|
|
|
48188
48864
|
});
|
|
48189
48865
|
var uninstallAppCommand = new Command("uninstall").alias("remove").description("卸载 app serve client的包。 手动删除更简单。").option("-i, --id <id>", "user/key").option("-p, --path <path>", "删除的路径, 如果存在,则优先执行,不会去判断 id 和 type 。").action(async (options) => {
|
|
48190
48866
|
if (options.path) {
|
|
48191
|
-
const _path =
|
|
48867
|
+
const _path = path12.resolve(options.path);
|
|
48192
48868
|
try {
|
|
48193
48869
|
const checkPath = fileIsExist(_path);
|
|
48194
48870
|
if (!checkPath) {
|
|
@@ -48203,7 +48879,7 @@ var uninstallAppCommand = new Command("uninstall").alias("remove").description("
|
|
|
48203
48879
|
}
|
|
48204
48880
|
]);
|
|
48205
48881
|
if (answer.confirm) {
|
|
48206
|
-
|
|
48882
|
+
fs15.rmSync(_path, { recursive: true });
|
|
48207
48883
|
console.log(chalk2.green("删除成功", _path));
|
|
48208
48884
|
}
|
|
48209
48885
|
}
|
|
@@ -48247,25 +48923,25 @@ var link = new Command("link").argument("url").option("-o --output <output>", "
|
|
|
48247
48923
|
if (output) {
|
|
48248
48924
|
const checkOutput = fileIsExist(output);
|
|
48249
48925
|
if (!checkOutput) {
|
|
48250
|
-
|
|
48926
|
+
fs15.mkdirSync(output, { recursive: true });
|
|
48251
48927
|
}
|
|
48252
48928
|
}
|
|
48253
|
-
|
|
48929
|
+
fs15.writeFileSync(path12.join(output, filename), content);
|
|
48254
48930
|
});
|
|
48255
48931
|
appCommand.addCommand(link);
|
|
48256
48932
|
|
|
48257
48933
|
// src/command/gist/index.ts
|
|
48258
|
-
import
|
|
48259
|
-
import
|
|
48934
|
+
import path13 from "node:path";
|
|
48935
|
+
import fs16 from "node:fs";
|
|
48260
48936
|
import { spawn as spawn5 } from "child_process";
|
|
48261
48937
|
var command9 = new Command("gist").description("同步片段代码").option("-d, --dir <dir>", "配置目录").arguments("<link>").action((link2, opts) => {
|
|
48262
48938
|
if (!link2) {
|
|
48263
48939
|
console.log(chalk2.red("请提供链接"));
|
|
48264
48940
|
return;
|
|
48265
48941
|
}
|
|
48266
|
-
const dir =
|
|
48267
|
-
if (!
|
|
48268
|
-
|
|
48942
|
+
const dir = path13.resolve(opts.dir || process.cwd());
|
|
48943
|
+
if (!fs16.existsSync(dir)) {
|
|
48944
|
+
fs16.mkdirSync(dir, { recursive: true });
|
|
48269
48945
|
}
|
|
48270
48946
|
const cmd = `ev gist download -l ${link2} -s `;
|
|
48271
48947
|
console.log(chalk2.green("开始执行"), cmd);
|
|
@@ -48277,10 +48953,10 @@ var command9 = new Command("gist").description("同步片段代码").option("-d,
|
|
|
48277
48953
|
});
|
|
48278
48954
|
var download = new Command("download").option("-d --dir <dir>", "配置目录").option("-c --config <config>", "配置文件的名字", "kevisual.json").option("-s --sync", "下载配置成功后,是否需要同步文件").option("-l --link <link>", "下载配置链接").description("克隆代码片段").action(async (opts) => {
|
|
48279
48955
|
console.log("克隆代码片段", opts);
|
|
48280
|
-
const dir =
|
|
48956
|
+
const dir = path13.resolve(opts.dir || process.cwd());
|
|
48281
48957
|
const link2 = opts.link || "";
|
|
48282
48958
|
const configFilename = opts.config || "kevisual.json";
|
|
48283
|
-
const configPath2 =
|
|
48959
|
+
const configPath2 = path13.join(dir, configFilename);
|
|
48284
48960
|
if (!link2) {
|
|
48285
48961
|
console.log(chalk2.red("请提供链接"));
|
|
48286
48962
|
return;
|
|
@@ -48293,8 +48969,8 @@ var download = new Command("download").option("-d --dir <dir>", "配置目录").
|
|
|
48293
48969
|
console.log(chalk2.red("配置文件下载失败"));
|
|
48294
48970
|
throw "配置文件下载失败";
|
|
48295
48971
|
});
|
|
48296
|
-
|
|
48297
|
-
|
|
48972
|
+
fs16.mkdirSync(dir, { recursive: true });
|
|
48973
|
+
fs16.writeFileSync(configPath2, JSON.stringify(res, null, 2));
|
|
48298
48974
|
console.log(chalk2.green("配置文件下载成功: " + configPath2));
|
|
48299
48975
|
if (opts.sync) {
|
|
48300
48976
|
const cmd = `ev sync download --config "${configFilename}"`;
|