@kevisual/cli 0.0.89 → 0.0.90
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-opencode.js +96 -18
- package/dist/assistant-server.js +135 -57
- package/dist/envision.js +2 -2
- package/package.json +2 -1
|
@@ -59484,6 +59484,71 @@ var getConfigFile = (opts) => {
|
|
|
59484
59484
|
return lastLastPath;
|
|
59485
59485
|
return "";
|
|
59486
59486
|
};
|
|
59487
|
+
var getConfig = (opts) => {
|
|
59488
|
+
let quiet = opts?.quite ?? true;
|
|
59489
|
+
const showError = opts?.showError ?? false;
|
|
59490
|
+
if (opts?.dotenvOpts) {
|
|
59491
|
+
const prased = import_dotenv2.default.config({ quiet, ...opts.dotenvOpts }).parsed;
|
|
59492
|
+
if (prased) {
|
|
59493
|
+
return prased;
|
|
59494
|
+
} else {
|
|
59495
|
+
if (showError) {
|
|
59496
|
+
if (!quiet) {
|
|
59497
|
+
console.warn("config 读取失败");
|
|
59498
|
+
}
|
|
59499
|
+
throw new Error("未找到配置文件");
|
|
59500
|
+
}
|
|
59501
|
+
return {};
|
|
59502
|
+
}
|
|
59503
|
+
}
|
|
59504
|
+
const filePath = getConfigFile(opts);
|
|
59505
|
+
if (!quiet && filePath) {
|
|
59506
|
+
console.log("config pathname:", filePath);
|
|
59507
|
+
}
|
|
59508
|
+
if (!filePath) {
|
|
59509
|
+
if (showError) {
|
|
59510
|
+
if (!quiet) {
|
|
59511
|
+
console.warn("config 路径未找到");
|
|
59512
|
+
}
|
|
59513
|
+
throw new Error("未找到配置文件");
|
|
59514
|
+
}
|
|
59515
|
+
return {};
|
|
59516
|
+
}
|
|
59517
|
+
const value = import_dotenv2.default.config({ quiet: true, path: filePath }).parsed;
|
|
59518
|
+
return value;
|
|
59519
|
+
};
|
|
59520
|
+
var useConfig = (onlyInitConfig, force) => {
|
|
59521
|
+
const config2 = global.config;
|
|
59522
|
+
let _config = config2 || getConfig(onlyInitConfig);
|
|
59523
|
+
!config2 && (global["config"] = _config);
|
|
59524
|
+
if (force && onlyInitConfig) {
|
|
59525
|
+
const _newConfig = getConfig(onlyInitConfig);
|
|
59526
|
+
_config = mergeConfig(_newConfig);
|
|
59527
|
+
}
|
|
59528
|
+
return _config;
|
|
59529
|
+
};
|
|
59530
|
+
var mergeConfig = (config2) => {
|
|
59531
|
+
const _config = global.config || {};
|
|
59532
|
+
Object.assign(_config, config2);
|
|
59533
|
+
global.config = _config;
|
|
59534
|
+
return _config;
|
|
59535
|
+
};
|
|
59536
|
+
var useKey = (key, opts) => {
|
|
59537
|
+
let v = useConfig()[key];
|
|
59538
|
+
if (!v) {
|
|
59539
|
+
v = process.env[key];
|
|
59540
|
+
}
|
|
59541
|
+
if (!v) {
|
|
59542
|
+
return opts?.defaultValue || null;
|
|
59543
|
+
}
|
|
59544
|
+
if (opts?.isNumber && typeof v === "string") {
|
|
59545
|
+
return Number(v);
|
|
59546
|
+
}
|
|
59547
|
+
if (opts?.isBoolean && typeof v === "string") {
|
|
59548
|
+
return v === "true";
|
|
59549
|
+
}
|
|
59550
|
+
return v;
|
|
59551
|
+
};
|
|
59487
59552
|
var useFileStore = (str, opts) => {
|
|
59488
59553
|
const publicPath = process.cwd();
|
|
59489
59554
|
const filePath = path2.join(publicPath, str);
|
|
@@ -76548,10 +76613,10 @@ var createConfig = (override = {}) => ({
|
|
|
76548
76613
|
// ../node_modules/.pnpm/@opencode-ai+sdk@1.1.26/node_modules/@opencode-ai/sdk/dist/gen/client/client.gen.js
|
|
76549
76614
|
var createClient = (config3 = {}) => {
|
|
76550
76615
|
let _config = mergeConfigs(createConfig(), config3);
|
|
76551
|
-
const
|
|
76616
|
+
const getConfig2 = () => ({ ..._config });
|
|
76552
76617
|
const setConfig = (config4) => {
|
|
76553
76618
|
_config = mergeConfigs(_config, config4);
|
|
76554
|
-
return
|
|
76619
|
+
return getConfig2();
|
|
76555
76620
|
};
|
|
76556
76621
|
const interceptors = createInterceptors();
|
|
76557
76622
|
const beforeRequest = async (options) => {
|
|
@@ -76680,7 +76745,7 @@ var createClient = (config3 = {}) => {
|
|
|
76680
76745
|
connect: makeMethod("CONNECT"),
|
|
76681
76746
|
delete: makeMethod("DELETE"),
|
|
76682
76747
|
get: makeMethod("GET"),
|
|
76683
|
-
getConfig,
|
|
76748
|
+
getConfig: getConfig2,
|
|
76684
76749
|
head: makeMethod("HEAD"),
|
|
76685
76750
|
interceptors,
|
|
76686
76751
|
options: makeMethod("OPTIONS"),
|
|
@@ -77758,7 +77823,13 @@ app.route({
|
|
|
77758
77823
|
}
|
|
77759
77824
|
}).define(async (ctx) => {
|
|
77760
77825
|
const url3 = await opencodeManager.getUrl();
|
|
77761
|
-
|
|
77826
|
+
const cnbURL = useKey("CNB_VSCODE_PROXY_URI");
|
|
77827
|
+
let content = `本地访问地址: ${url3}`;
|
|
77828
|
+
if (cnbURL) {
|
|
77829
|
+
content += `
|
|
77830
|
+
云端访问地址: ${cnbURL.replace("{{port}}", "5000")}`;
|
|
77831
|
+
}
|
|
77832
|
+
ctx.body = { content };
|
|
77762
77833
|
}).addTo(app);
|
|
77763
77834
|
app.route({
|
|
77764
77835
|
path: "opencode",
|
|
@@ -79105,8 +79176,8 @@ app.route({
|
|
|
79105
79176
|
|
|
79106
79177
|
// src/routes-simple/upload.ts
|
|
79107
79178
|
var import_busboy = __toESM(require_lib4(), 1);
|
|
79108
|
-
import
|
|
79109
|
-
import
|
|
79179
|
+
import path12 from "path";
|
|
79180
|
+
import fs12 from "fs";
|
|
79110
79181
|
|
|
79111
79182
|
// ../node_modules/.pnpm/@kevisual+router@0.0.57/node_modules/@kevisual/router/src/server/cookie.ts
|
|
79112
79183
|
var NullObject2 = /* @__PURE__ */ (() => {
|
|
@@ -79741,7 +79812,14 @@ class InitEnv3 {
|
|
|
79741
79812
|
InitEnv3.init();
|
|
79742
79813
|
|
|
79743
79814
|
// src/routes-simple/router.ts
|
|
79744
|
-
|
|
79815
|
+
import os7 from "node:os";
|
|
79816
|
+
import path10 from "node:path";
|
|
79817
|
+
import fs10 from "node:fs";
|
|
79818
|
+
var defaultCachePath = path10.join(os7.homedir(), ".envision", "cache-file");
|
|
79819
|
+
if (!fs10.existsSync(defaultCachePath)) {
|
|
79820
|
+
fs10.mkdirSync(defaultCachePath, { recursive: true });
|
|
79821
|
+
}
|
|
79822
|
+
var cacheFilePath = defaultCachePath;
|
|
79745
79823
|
var eventClientsInit = () => {
|
|
79746
79824
|
const clients = new Map;
|
|
79747
79825
|
return clients;
|
|
@@ -79806,8 +79884,8 @@ var validateDirectory = (directory) => {
|
|
|
79806
79884
|
};
|
|
79807
79885
|
|
|
79808
79886
|
// src/module/upload/mv.ts
|
|
79809
|
-
import
|
|
79810
|
-
import
|
|
79887
|
+
import fs11 from "node:fs";
|
|
79888
|
+
import path11 from "node:path";
|
|
79811
79889
|
|
|
79812
79890
|
class UploadManager {
|
|
79813
79891
|
config;
|
|
@@ -79818,12 +79896,12 @@ class UploadManager {
|
|
|
79818
79896
|
const { type, temppath, targetPath } = opts;
|
|
79819
79897
|
if (type === "file") {
|
|
79820
79898
|
const pageDir = this.config.configPath?.pagesDir;
|
|
79821
|
-
const fullTargetPath = targetPath.startsWith("/") ? targetPath :
|
|
79899
|
+
const fullTargetPath = targetPath.startsWith("/") ? targetPath : path11.join(pageDir, targetPath);
|
|
79822
79900
|
const targetDir = fullTargetPath.substring(0, fullTargetPath.lastIndexOf("/"));
|
|
79823
|
-
if (!
|
|
79824
|
-
|
|
79901
|
+
if (!fs11.existsSync(targetDir)) {
|
|
79902
|
+
fs11.mkdirSync(targetDir, { recursive: true });
|
|
79825
79903
|
}
|
|
79826
|
-
|
|
79904
|
+
fs11.renameSync(temppath, fullTargetPath);
|
|
79827
79905
|
return fullTargetPath;
|
|
79828
79906
|
}
|
|
79829
79907
|
}
|
|
@@ -79878,8 +79956,8 @@ var uploadResources = async (req, res) => {
|
|
|
79878
79956
|
});
|
|
79879
79957
|
busboy.on("file", (fieldname, fileStream, info) => {
|
|
79880
79958
|
const { filename, encoding, mimeType } = info;
|
|
79881
|
-
const tempPath =
|
|
79882
|
-
const writeStream =
|
|
79959
|
+
const tempPath = path12.join(cacheFilePath, `${Date.now()}-${Math.random().toString(36).substring(7)}`);
|
|
79960
|
+
const writeStream = fs12.createWriteStream(tempPath);
|
|
79883
79961
|
const filePromise = new Promise((resolve, reject) => {
|
|
79884
79962
|
fileStream.on("data", (chunk) => {
|
|
79885
79963
|
bytesReceived += chunk.length;
|
|
@@ -79918,8 +79996,8 @@ var uploadResources = async (req, res) => {
|
|
|
79918
79996
|
}
|
|
79919
79997
|
const clearFiles = () => {
|
|
79920
79998
|
files.forEach((file3) => {
|
|
79921
|
-
if (file3?.filepath &&
|
|
79922
|
-
|
|
79999
|
+
if (file3?.filepath && fs12.existsSync(file3.filepath)) {
|
|
80000
|
+
fs12.unlinkSync(file3.filepath);
|
|
79923
80001
|
}
|
|
79924
80002
|
});
|
|
79925
80003
|
};
|
|
@@ -79961,7 +80039,7 @@ var uploadResources = async (req, res) => {
|
|
|
79961
80039
|
targetPath: minioPath
|
|
79962
80040
|
});
|
|
79963
80041
|
if (type !== "file") {
|
|
79964
|
-
|
|
80042
|
+
fs12.unlinkSync(tempPath);
|
|
79965
80043
|
}
|
|
79966
80044
|
}
|
|
79967
80045
|
res.writeHead(200, { "Content-Type": "application/json" });
|
package/dist/assistant-server.js
CHANGED
|
@@ -76767,8 +76767,8 @@ var require_suggestSimilar = __commonJS((exports) => {
|
|
|
76767
76767
|
var require_command = __commonJS((exports) => {
|
|
76768
76768
|
var EventEmitter5 = __require("node:events").EventEmitter;
|
|
76769
76769
|
var childProcess = __require("node:child_process");
|
|
76770
|
-
var
|
|
76771
|
-
var
|
|
76770
|
+
var path17 = __require("node:path");
|
|
76771
|
+
var fs17 = __require("node:fs");
|
|
76772
76772
|
var process7 = __require("node:process");
|
|
76773
76773
|
var { Argument, humanReadableArgName } = require_argument();
|
|
76774
76774
|
var { CommanderError } = require_error2();
|
|
@@ -77303,7 +77303,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
77303
77303
|
this.processedArgs = [];
|
|
77304
77304
|
}
|
|
77305
77305
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
77306
|
-
if (
|
|
77306
|
+
if (fs17.existsSync(executableFile))
|
|
77307
77307
|
return;
|
|
77308
77308
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
77309
77309
|
const executableMissing = `'${executableFile}' does not exist
|
|
@@ -77317,12 +77317,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
77317
77317
|
let launchWithNode = false;
|
|
77318
77318
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
77319
77319
|
function findFile(baseDir, baseName) {
|
|
77320
|
-
const localBin =
|
|
77321
|
-
if (
|
|
77320
|
+
const localBin = path17.resolve(baseDir, baseName);
|
|
77321
|
+
if (fs17.existsSync(localBin))
|
|
77322
77322
|
return localBin;
|
|
77323
|
-
if (sourceExt.includes(
|
|
77323
|
+
if (sourceExt.includes(path17.extname(baseName)))
|
|
77324
77324
|
return;
|
|
77325
|
-
const foundExt = sourceExt.find((ext) =>
|
|
77325
|
+
const foundExt = sourceExt.find((ext) => fs17.existsSync(`${localBin}${ext}`));
|
|
77326
77326
|
if (foundExt)
|
|
77327
77327
|
return `${localBin}${foundExt}`;
|
|
77328
77328
|
return;
|
|
@@ -77334,23 +77334,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
77334
77334
|
if (this._scriptPath) {
|
|
77335
77335
|
let resolvedScriptPath;
|
|
77336
77336
|
try {
|
|
77337
|
-
resolvedScriptPath =
|
|
77337
|
+
resolvedScriptPath = fs17.realpathSync(this._scriptPath);
|
|
77338
77338
|
} catch {
|
|
77339
77339
|
resolvedScriptPath = this._scriptPath;
|
|
77340
77340
|
}
|
|
77341
|
-
executableDir =
|
|
77341
|
+
executableDir = path17.resolve(path17.dirname(resolvedScriptPath), executableDir);
|
|
77342
77342
|
}
|
|
77343
77343
|
if (executableDir) {
|
|
77344
77344
|
let localFile = findFile(executableDir, executableFile);
|
|
77345
77345
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
77346
|
-
const legacyName =
|
|
77346
|
+
const legacyName = path17.basename(this._scriptPath, path17.extname(this._scriptPath));
|
|
77347
77347
|
if (legacyName !== this._name) {
|
|
77348
77348
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
77349
77349
|
}
|
|
77350
77350
|
}
|
|
77351
77351
|
executableFile = localFile || executableFile;
|
|
77352
77352
|
}
|
|
77353
|
-
launchWithNode = sourceExt.includes(
|
|
77353
|
+
launchWithNode = sourceExt.includes(path17.extname(executableFile));
|
|
77354
77354
|
let proc;
|
|
77355
77355
|
if (process7.platform !== "win32") {
|
|
77356
77356
|
if (launchWithNode) {
|
|
@@ -77939,13 +77939,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
77939
77939
|
cmd.helpGroup(this._defaultCommandGroup);
|
|
77940
77940
|
}
|
|
77941
77941
|
nameFromFilename(filename) {
|
|
77942
|
-
this._name =
|
|
77942
|
+
this._name = path17.basename(filename, path17.extname(filename));
|
|
77943
77943
|
return this;
|
|
77944
77944
|
}
|
|
77945
|
-
executableDir(
|
|
77946
|
-
if (
|
|
77945
|
+
executableDir(path18) {
|
|
77946
|
+
if (path18 === undefined)
|
|
77947
77947
|
return this._executableDir;
|
|
77948
|
-
this._executableDir =
|
|
77948
|
+
this._executableDir = path18;
|
|
77949
77949
|
return this;
|
|
77950
77950
|
}
|
|
77951
77951
|
helpInformation(contextOptions) {
|
|
@@ -98381,6 +98381,71 @@ var getConfigFile = (opts) => {
|
|
|
98381
98381
|
return lastLastPath;
|
|
98382
98382
|
return "";
|
|
98383
98383
|
};
|
|
98384
|
+
var getConfig = (opts) => {
|
|
98385
|
+
let quiet = opts?.quite ?? true;
|
|
98386
|
+
const showError = opts?.showError ?? false;
|
|
98387
|
+
if (opts?.dotenvOpts) {
|
|
98388
|
+
const prased = import_dotenv2.default.config({ quiet, ...opts.dotenvOpts }).parsed;
|
|
98389
|
+
if (prased) {
|
|
98390
|
+
return prased;
|
|
98391
|
+
} else {
|
|
98392
|
+
if (showError) {
|
|
98393
|
+
if (!quiet) {
|
|
98394
|
+
console.warn("config 读取失败");
|
|
98395
|
+
}
|
|
98396
|
+
throw new Error("未找到配置文件");
|
|
98397
|
+
}
|
|
98398
|
+
return {};
|
|
98399
|
+
}
|
|
98400
|
+
}
|
|
98401
|
+
const filePath = getConfigFile(opts);
|
|
98402
|
+
if (!quiet && filePath) {
|
|
98403
|
+
console.log("config pathname:", filePath);
|
|
98404
|
+
}
|
|
98405
|
+
if (!filePath) {
|
|
98406
|
+
if (showError) {
|
|
98407
|
+
if (!quiet) {
|
|
98408
|
+
console.warn("config 路径未找到");
|
|
98409
|
+
}
|
|
98410
|
+
throw new Error("未找到配置文件");
|
|
98411
|
+
}
|
|
98412
|
+
return {};
|
|
98413
|
+
}
|
|
98414
|
+
const value = import_dotenv2.default.config({ quiet: true, path: filePath }).parsed;
|
|
98415
|
+
return value;
|
|
98416
|
+
};
|
|
98417
|
+
var useConfig = (onlyInitConfig, force) => {
|
|
98418
|
+
const config2 = global.config;
|
|
98419
|
+
let _config = config2 || getConfig(onlyInitConfig);
|
|
98420
|
+
!config2 && (global["config"] = _config);
|
|
98421
|
+
if (force && onlyInitConfig) {
|
|
98422
|
+
const _newConfig = getConfig(onlyInitConfig);
|
|
98423
|
+
_config = mergeConfig(_newConfig);
|
|
98424
|
+
}
|
|
98425
|
+
return _config;
|
|
98426
|
+
};
|
|
98427
|
+
var mergeConfig = (config2) => {
|
|
98428
|
+
const _config = global.config || {};
|
|
98429
|
+
Object.assign(_config, config2);
|
|
98430
|
+
global.config = _config;
|
|
98431
|
+
return _config;
|
|
98432
|
+
};
|
|
98433
|
+
var useKey = (key, opts) => {
|
|
98434
|
+
let v = useConfig()[key];
|
|
98435
|
+
if (!v) {
|
|
98436
|
+
v = process.env[key];
|
|
98437
|
+
}
|
|
98438
|
+
if (!v) {
|
|
98439
|
+
return opts?.defaultValue || null;
|
|
98440
|
+
}
|
|
98441
|
+
if (opts?.isNumber && typeof v === "string") {
|
|
98442
|
+
return Number(v);
|
|
98443
|
+
}
|
|
98444
|
+
if (opts?.isBoolean && typeof v === "string") {
|
|
98445
|
+
return v === "true";
|
|
98446
|
+
}
|
|
98447
|
+
return v;
|
|
98448
|
+
};
|
|
98384
98449
|
var useFileStore = (str, opts) => {
|
|
98385
98450
|
const publicPath = process.cwd();
|
|
98386
98451
|
const filePath = path5.join(publicPath, str);
|
|
@@ -114662,10 +114727,10 @@ var createConfig = (override = {}) => ({
|
|
|
114662
114727
|
// ../node_modules/.pnpm/@opencode-ai+sdk@1.1.26/node_modules/@opencode-ai/sdk/dist/gen/client/client.gen.js
|
|
114663
114728
|
var createClient = (config3 = {}) => {
|
|
114664
114729
|
let _config = mergeConfigs(createConfig(), config3);
|
|
114665
|
-
const
|
|
114730
|
+
const getConfig2 = () => ({ ..._config });
|
|
114666
114731
|
const setConfig = (config4) => {
|
|
114667
114732
|
_config = mergeConfigs(_config, config4);
|
|
114668
|
-
return
|
|
114733
|
+
return getConfig2();
|
|
114669
114734
|
};
|
|
114670
114735
|
const interceptors = createInterceptors();
|
|
114671
114736
|
const beforeRequest = async (options) => {
|
|
@@ -114794,7 +114859,7 @@ var createClient = (config3 = {}) => {
|
|
|
114794
114859
|
connect: makeMethod("CONNECT"),
|
|
114795
114860
|
delete: makeMethod("DELETE"),
|
|
114796
114861
|
get: makeMethod("GET"),
|
|
114797
|
-
getConfig,
|
|
114862
|
+
getConfig: getConfig2,
|
|
114798
114863
|
head: makeMethod("HEAD"),
|
|
114799
114864
|
interceptors,
|
|
114800
114865
|
options: makeMethod("OPTIONS"),
|
|
@@ -115894,7 +115959,13 @@ app.route({
|
|
|
115894
115959
|
}
|
|
115895
115960
|
}).define(async (ctx) => {
|
|
115896
115961
|
const url3 = await opencodeManager.getUrl();
|
|
115897
|
-
|
|
115962
|
+
const cnbURL = useKey("CNB_VSCODE_PROXY_URI");
|
|
115963
|
+
let content = `本地访问地址: ${url3}`;
|
|
115964
|
+
if (cnbURL) {
|
|
115965
|
+
content += `
|
|
115966
|
+
云端访问地址: ${cnbURL.replace("{{port}}", "5000")}`;
|
|
115967
|
+
}
|
|
115968
|
+
ctx.body = { content };
|
|
115898
115969
|
}).addTo(app);
|
|
115899
115970
|
app.route({
|
|
115900
115971
|
path: "opencode",
|
|
@@ -117571,8 +117642,8 @@ var createProxyInfo = (proxyApiItem) => {
|
|
|
117571
117642
|
|
|
117572
117643
|
// src/routes-simple/upload.ts
|
|
117573
117644
|
var import_busboy = __toESM(require_lib4(), 1);
|
|
117574
|
-
import
|
|
117575
|
-
import
|
|
117645
|
+
import path16 from "path";
|
|
117646
|
+
import fs16 from "fs";
|
|
117576
117647
|
|
|
117577
117648
|
// ../node_modules/.pnpm/@kevisual+router@0.0.57/node_modules/@kevisual/router/src/server/cookie.ts
|
|
117578
117649
|
var NullObject2 = /* @__PURE__ */ (() => {
|
|
@@ -118207,7 +118278,14 @@ class InitEnv2 {
|
|
|
118207
118278
|
InitEnv2.init();
|
|
118208
118279
|
|
|
118209
118280
|
// src/routes-simple/router.ts
|
|
118210
|
-
|
|
118281
|
+
import os7 from "node:os";
|
|
118282
|
+
import path14 from "node:path";
|
|
118283
|
+
import fs14 from "node:fs";
|
|
118284
|
+
var defaultCachePath = path14.join(os7.homedir(), ".envision", "cache-file");
|
|
118285
|
+
if (!fs14.existsSync(defaultCachePath)) {
|
|
118286
|
+
fs14.mkdirSync(defaultCachePath, { recursive: true });
|
|
118287
|
+
}
|
|
118288
|
+
var cacheFilePath = defaultCachePath;
|
|
118211
118289
|
var eventClientsInit = () => {
|
|
118212
118290
|
const clients = new Map;
|
|
118213
118291
|
return clients;
|
|
@@ -118272,8 +118350,8 @@ var validateDirectory = (directory) => {
|
|
|
118272
118350
|
};
|
|
118273
118351
|
|
|
118274
118352
|
// src/module/upload/mv.ts
|
|
118275
|
-
import
|
|
118276
|
-
import
|
|
118353
|
+
import fs15 from "node:fs";
|
|
118354
|
+
import path15 from "node:path";
|
|
118277
118355
|
|
|
118278
118356
|
class UploadManager {
|
|
118279
118357
|
config;
|
|
@@ -118284,12 +118362,12 @@ class UploadManager {
|
|
|
118284
118362
|
const { type, temppath, targetPath } = opts;
|
|
118285
118363
|
if (type === "file") {
|
|
118286
118364
|
const pageDir = this.config.configPath?.pagesDir;
|
|
118287
|
-
const fullTargetPath = targetPath.startsWith("/") ? targetPath :
|
|
118365
|
+
const fullTargetPath = targetPath.startsWith("/") ? targetPath : path15.join(pageDir, targetPath);
|
|
118288
118366
|
const targetDir = fullTargetPath.substring(0, fullTargetPath.lastIndexOf("/"));
|
|
118289
|
-
if (!
|
|
118290
|
-
|
|
118367
|
+
if (!fs15.existsSync(targetDir)) {
|
|
118368
|
+
fs15.mkdirSync(targetDir, { recursive: true });
|
|
118291
118369
|
}
|
|
118292
|
-
|
|
118370
|
+
fs15.renameSync(temppath, fullTargetPath);
|
|
118293
118371
|
return fullTargetPath;
|
|
118294
118372
|
}
|
|
118295
118373
|
}
|
|
@@ -118344,8 +118422,8 @@ var uploadResources = async (req, res) => {
|
|
|
118344
118422
|
});
|
|
118345
118423
|
busboy.on("file", (fieldname, fileStream, info) => {
|
|
118346
118424
|
const { filename, encoding, mimeType } = info;
|
|
118347
|
-
const tempPath =
|
|
118348
|
-
const writeStream =
|
|
118425
|
+
const tempPath = path16.join(cacheFilePath, `${Date.now()}-${Math.random().toString(36).substring(7)}`);
|
|
118426
|
+
const writeStream = fs16.createWriteStream(tempPath);
|
|
118349
118427
|
const filePromise = new Promise((resolve, reject) => {
|
|
118350
118428
|
fileStream.on("data", (chunk) => {
|
|
118351
118429
|
bytesReceived += chunk.length;
|
|
@@ -118384,8 +118462,8 @@ var uploadResources = async (req, res) => {
|
|
|
118384
118462
|
}
|
|
118385
118463
|
const clearFiles = () => {
|
|
118386
118464
|
files.forEach((file3) => {
|
|
118387
|
-
if (file3?.filepath &&
|
|
118388
|
-
|
|
118465
|
+
if (file3?.filepath && fs16.existsSync(file3.filepath)) {
|
|
118466
|
+
fs16.unlinkSync(file3.filepath);
|
|
118389
118467
|
}
|
|
118390
118468
|
});
|
|
118391
118469
|
};
|
|
@@ -118427,7 +118505,7 @@ var uploadResources = async (req, res) => {
|
|
|
118427
118505
|
targetPath: minioPath
|
|
118428
118506
|
});
|
|
118429
118507
|
if (type !== "file") {
|
|
118430
|
-
|
|
118508
|
+
fs16.unlinkSync(tempPath);
|
|
118431
118509
|
}
|
|
118432
118510
|
}
|
|
118433
118511
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
@@ -118460,10 +118538,10 @@ var {
|
|
|
118460
118538
|
|
|
118461
118539
|
// src/server.ts
|
|
118462
118540
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
118463
|
-
import
|
|
118541
|
+
import path18 from "node:path";
|
|
118464
118542
|
// src/module/get-bun-path.ts
|
|
118465
|
-
import
|
|
118466
|
-
import
|
|
118543
|
+
import fs17 from "node:fs";
|
|
118544
|
+
import path17 from "node:path";
|
|
118467
118545
|
import { execSync as execSync2 } from "node:child_process";
|
|
118468
118546
|
var getBunPath = () => {
|
|
118469
118547
|
const isWindows = process.platform === "win32";
|
|
@@ -118474,8 +118552,8 @@ var getBunPath = () => {
|
|
|
118474
118552
|
if (isWindows) {
|
|
118475
118553
|
try {
|
|
118476
118554
|
const globalNodeModules = execSync2("npm root -g", { encoding: "utf-8" }).trim();
|
|
118477
|
-
const bunExePath =
|
|
118478
|
-
if (
|
|
118555
|
+
const bunExePath = path17.join(globalNodeModules, "bun", "bin", "bun.exe");
|
|
118556
|
+
if (fs17.existsSync(bunExePath)) {
|
|
118479
118557
|
return bunExePath;
|
|
118480
118558
|
}
|
|
118481
118559
|
} catch (error4) {}
|
|
@@ -118486,9 +118564,9 @@ var getBunPath = () => {
|
|
|
118486
118564
|
return bunPath;
|
|
118487
118565
|
}
|
|
118488
118566
|
if (bunPath) {
|
|
118489
|
-
const bunDir =
|
|
118490
|
-
const bunExePath =
|
|
118491
|
-
if (
|
|
118567
|
+
const bunDir = path17.dirname(bunPath);
|
|
118568
|
+
const bunExePath = path17.join(bunDir, "node_modules", "bun", "bin", "bun.exe");
|
|
118569
|
+
if (fs17.existsSync(bunExePath)) {
|
|
118492
118570
|
return bunExePath;
|
|
118493
118571
|
}
|
|
118494
118572
|
}
|
|
@@ -118496,7 +118574,7 @@ var getBunPath = () => {
|
|
|
118496
118574
|
} else {
|
|
118497
118575
|
try {
|
|
118498
118576
|
const bunPath = execSync2("which bun", { encoding: "utf-8" }).trim();
|
|
118499
|
-
if (bunPath &&
|
|
118577
|
+
if (bunPath && fs17.existsSync(bunPath)) {
|
|
118500
118578
|
return bunPath;
|
|
118501
118579
|
}
|
|
118502
118580
|
} catch (error4) {}
|
|
@@ -118508,7 +118586,7 @@ var getBunPath = () => {
|
|
|
118508
118586
|
"C:\\Bun\\bun.exe"
|
|
118509
118587
|
];
|
|
118510
118588
|
for (const p of commonPaths) {
|
|
118511
|
-
if (
|
|
118589
|
+
if (fs17.existsSync(p)) {
|
|
118512
118590
|
return p;
|
|
118513
118591
|
}
|
|
118514
118592
|
}
|
|
@@ -118924,14 +119002,14 @@ class KeyStore {
|
|
|
118924
119002
|
}
|
|
118925
119003
|
}
|
|
118926
119004
|
function createKey(key) {
|
|
118927
|
-
let
|
|
119005
|
+
let path18 = null;
|
|
118928
119006
|
let id2 = null;
|
|
118929
119007
|
let src = null;
|
|
118930
119008
|
let weight = 1;
|
|
118931
119009
|
let getFn = null;
|
|
118932
119010
|
if (isString(key) || isArray3(key)) {
|
|
118933
119011
|
src = key;
|
|
118934
|
-
|
|
119012
|
+
path18 = createKeyPath(key);
|
|
118935
119013
|
id2 = createKeyId(key);
|
|
118936
119014
|
} else {
|
|
118937
119015
|
if (!hasOwn.call(key, "name")) {
|
|
@@ -118945,11 +119023,11 @@ function createKey(key) {
|
|
|
118945
119023
|
throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
|
|
118946
119024
|
}
|
|
118947
119025
|
}
|
|
118948
|
-
|
|
119026
|
+
path18 = createKeyPath(name);
|
|
118949
119027
|
id2 = createKeyId(name);
|
|
118950
119028
|
getFn = key.getFn;
|
|
118951
119029
|
}
|
|
118952
|
-
return { path:
|
|
119030
|
+
return { path: path18, id: id2, weight, src, getFn };
|
|
118953
119031
|
}
|
|
118954
119032
|
function createKeyPath(key) {
|
|
118955
119033
|
return isArray3(key) ? key : key.split(".");
|
|
@@ -118957,34 +119035,34 @@ function createKeyPath(key) {
|
|
|
118957
119035
|
function createKeyId(key) {
|
|
118958
119036
|
return isArray3(key) ? key.join(".") : key;
|
|
118959
119037
|
}
|
|
118960
|
-
function get(obj,
|
|
119038
|
+
function get(obj, path18) {
|
|
118961
119039
|
let list4 = [];
|
|
118962
119040
|
let arr = false;
|
|
118963
|
-
const deepGet = (obj2,
|
|
119041
|
+
const deepGet = (obj2, path19, index2) => {
|
|
118964
119042
|
if (!isDefined(obj2)) {
|
|
118965
119043
|
return;
|
|
118966
119044
|
}
|
|
118967
|
-
if (!
|
|
119045
|
+
if (!path19[index2]) {
|
|
118968
119046
|
list4.push(obj2);
|
|
118969
119047
|
} else {
|
|
118970
|
-
let key =
|
|
119048
|
+
let key = path19[index2];
|
|
118971
119049
|
const value = obj2[key];
|
|
118972
119050
|
if (!isDefined(value)) {
|
|
118973
119051
|
return;
|
|
118974
119052
|
}
|
|
118975
|
-
if (index2 ===
|
|
119053
|
+
if (index2 === path19.length - 1 && (isString(value) || isNumber2(value) || isBoolean(value))) {
|
|
118976
119054
|
list4.push(toString(value));
|
|
118977
119055
|
} else if (isArray3(value)) {
|
|
118978
119056
|
arr = true;
|
|
118979
119057
|
for (let i = 0, len = value.length;i < len; i += 1) {
|
|
118980
|
-
deepGet(value[i],
|
|
119058
|
+
deepGet(value[i], path19, index2 + 1);
|
|
118981
119059
|
}
|
|
118982
|
-
} else if (
|
|
118983
|
-
deepGet(value,
|
|
119060
|
+
} else if (path19.length) {
|
|
119061
|
+
deepGet(value, path19, index2 + 1);
|
|
118984
119062
|
}
|
|
118985
119063
|
}
|
|
118986
119064
|
};
|
|
118987
|
-
deepGet(obj, isString(
|
|
119065
|
+
deepGet(obj, isString(path18) ? path18.split(".") : path18, 0);
|
|
118988
119066
|
return arr ? list4 : list4[0];
|
|
118989
119067
|
}
|
|
118990
119068
|
var MatchOptions = {
|
|
@@ -120525,7 +120603,7 @@ program.description("启动服务").option("-d, --daemon", "是否以守护进
|
|
|
120525
120603
|
const [_interpreter, execPath] = process.argv;
|
|
120526
120604
|
const name = options.name;
|
|
120527
120605
|
const port = options.port;
|
|
120528
|
-
const runPath =
|
|
120606
|
+
const runPath = path18.resolve(execPath);
|
|
120529
120607
|
const escapePath = (p) => {
|
|
120530
120608
|
let normalized = p.replace(/\\/g, "/");
|
|
120531
120609
|
return normalized.includes(" ") ? `"${normalized}"` : normalized;
|
package/dist/envision.js
CHANGED
|
@@ -22327,8 +22327,8 @@ InitEnv.init();
|
|
|
22327
22327
|
var version = useContextKey("version", () => {
|
|
22328
22328
|
let version2 = "0.0.64";
|
|
22329
22329
|
try {
|
|
22330
|
-
if ("0.0.
|
|
22331
|
-
version2 = "0.0.
|
|
22330
|
+
if ("0.0.90")
|
|
22331
|
+
version2 = "0.0.90";
|
|
22332
22332
|
} catch (e) {}
|
|
22333
22333
|
return version2;
|
|
22334
22334
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevisual/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.90",
|
|
4
4
|
"description": "envision 命令行工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"basename": "/root/cli",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"busboy": "^1.6.0",
|
|
54
54
|
"eventemitter3": "^5.0.4",
|
|
55
55
|
"lowdb": "^7.0.1",
|
|
56
|
+
"pm2": "latest",
|
|
56
57
|
"lru-cache": "^11.2.4",
|
|
57
58
|
"micromatch": "^4.0.8",
|
|
58
59
|
"semver": "^7.7.3",
|