@cloudbase/cli 2.12.3-beta.3 → 2.12.3
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/standalone/cli.js +51 -41
- package/package.json +1 -1
package/dist/standalone/cli.js
CHANGED
|
@@ -326169,7 +326169,7 @@ module.exports = function generate_pattern(it, $keyword, $ruleType) {
|
|
|
326169
326169
|
/***/ ((module) => {
|
|
326170
326170
|
|
|
326171
326171
|
"use strict";
|
|
326172
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.12.3
|
|
326172
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.12.3","description":"cli tool for cloudbase","main":"lib/index.js","scripts":{"build":"rimraf lib types && tsc --resolveJsonModule && cpx \\"src/**/*.html\\" lib","watch":"rimraf lib types && tsc -w","dev":"rimraf lib types && cpx \\"src/**/*.html\\" lib && tsc -w","eslint":"eslint \\"./**/*.ts\\"","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand --forceExit --detectOpenHandles --coverage --verbose --testTimeout=10000","tsc":"tsc","pkg":"pkg ./bin/cloudbase.js --out-path ./pkg","postinstall":"node ./post-install.js || exit 0 && patch-package","prepublishOnly":"node ./scripts/check-publish-source.js","debug":"bin/tcb.js lowcode watch","build:bundle":"webpack --config build/webpack/cli.cjs && webpack --config build/webpack/ccr.cjs && node build/scripts/copy-figlet-fonts.js","package:darwin-arm64":"OS=darwin ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:darwin-x64":"OS=darwin ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-arm64":"OS=linux ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-x64":"OS=linux ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:all":"bash build/scripts/build-all.sh","node:fetch:one":"node -e \\"require(\'child_process\').execSync(\'bash build/scripts/fetch-node.sh\',{stdio:\'inherit\'})\\"","node:fetch:all":"NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh --all","node:fetch:win-x64":"OS=windows ARCH=x64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","node:fetch:win-arm64":"OS=windows ARCH=arm64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","package:windows-x64":"OS=windows ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-arm64":"OS=windows ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-all":"npm run -s node:fetch:win-x64 && npm run -s node:fetch:win-arm64 && npm run -s package:windows-x64 && npm run -s package:windows-arm64","package:npm":"npm run build && npm run build:bundle && bash build/scripts/prepare-publish.sh","out:prune":"bash build/scripts/prune-out.sh","i18n:scan":"i18next-scanner --config locales/i18next-scanner.config.js && node locales/scripts/generate.js","i18n:sync":"node locales/scripts/sync.js sync","publish":"node ./scripts/publish.js"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloud-base-cli.git"},"bin":{"cloudbase":"bin/cloudbase.js","cloudbase-mcp":"bin/cloudbase-mcp.cjs","tcb":"bin/tcb.js"},"husky":{"hooks":{"pre-commit":"npm run build"}},"author":"cwuyiqing@gmail.com","license":"ISC","dependencies":{"@cloudbase/cloud-api":"^0.5.5","@cloudbase/cloudbase-mcp":"^2.7.3","@cloudbase/framework-core":"^1.9.7","@cloudbase/functions-framework":"1.16.0","@cloudbase/iac-core":"0.0.3-alpha.14","@cloudbase/lowcode-cli":"^0.23.0","@cloudbase/manager-node":"4.7.4","@cloudbase/toolbox":"0.7.16","@dotenvx/dotenvx":"^1.48.3","@musistudio/claude-code-router":"1.0.36","address":"^1.1.2","camelcase-keys":"^7.0.2","chalk":"^2.4.2","cli-table3":"^0.5.1","commander":"7","del":"^5.1.0","didyoumean":"^1.2.2","enquirer":"^2.3.6","execa":"^4.0.3","figlet":"^1.7.0","fs-extra":"^8.1.0","gradient-string":"^2.0.2","https-proxy-agent":"^5.0.1","i":"^0.3.7","inquirer":"^6.5.0","json-schema-to-typescript":"^14.0.5","lodash":"^4.17.21","log-symbols":"^3.0.0","lowdb":"^1.0.0","make-dir":"^3.0.0","node-fetch":"^2.6.0","nodemon":"^3.1.4","npm":"^11.5.2","open":"^7.0.0","ora":"^4.0.2","os-locale":"5.0.0","patch-package":"^8.0.0","portfinder":"^1.0.28","progress":"^2.0.3","query-string":"^6.8.1","reflect-metadata":"^0.1.13","semver":"^7.3.7","simple-git":"^3.28.0","tar-fs":"^2.0.1","terminal-link":"^2.1.1","toml":"^3.0.0","unzipper":"^0.10.10","update-notifier":"^4.0.0","xdg-basedir":"^4.0.0","yargs":"^16.2.0","yargs-parser":"^21.0.1","zod":"^4.0.13"},"devDependencies":{"@babel/parser":"^7.28.4","@babel/traverse":"^7.28.4","@babel/types":"^7.28.4","@types/fs-extra":"^11.0.4","@types/jest":"^27","@types/koa__router":"^8.0.11","@types/lodash":"^4.14.182","@types/node":"^12.12.38","@types/node-fetch":"^2.5.4","@types/react":"^17.0.37","@types/semver":"^7.3.9","@types/unzipper":"^0.10.11","@types/webpack-dev-server":"^3.11.1","@typescript-eslint/eslint-plugin":"^4.8.1","@typescript-eslint/parser":"^4.8.1","cpx":"^1.5.0","eslint":"^7.14.0","eslint-config-alloy":"^3.8.2","husky":"^3.0.9","i18next-scanner":"^4.6.0","jest":"^27","rimraf":"^3.0.2","ts-jest":"^27","typescript":"^4.7.2","webpack":"^5.92.0","webpack-cli":"^5.1.4"},"packageManager":"yarn@3.6.2+sha512.2c2f8b9615e6659773f65cdec7cf92ef773a98a99e611579601f61c7a91ec94c89c929aac86f1cee819421a9b0db7acfd53ec3ebb95af44f77f77634b08b9557"}');
|
|
326173
326173
|
|
|
326174
326174
|
/***/ }),
|
|
326175
326175
|
|
|
@@ -410283,10 +410283,10 @@ exports.getDataFromWeb = void 0;
|
|
|
410283
410283
|
const open_1 = __importDefault(__webpack_require__(30353));
|
|
410284
410284
|
const query_string_1 = __importDefault(__webpack_require__(86663));
|
|
410285
410285
|
const http_1 = __importDefault(__webpack_require__(58611));
|
|
410286
|
+
const child_process_1 = __webpack_require__(35317);
|
|
410286
410287
|
const system_1 = __webpack_require__(62179);
|
|
410287
410288
|
const error_1 = __webpack_require__(64119);
|
|
410288
410289
|
const html_1 = __webpack_require__(74856);
|
|
410289
|
-
const child_process_1 = __webpack_require__(35317);
|
|
410290
410290
|
// 创建本地 Web 服务器,接受 Web 控制台传入的信息
|
|
410291
410291
|
function createLocalServer() {
|
|
410292
410292
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -410327,31 +410327,58 @@ function isTruthyFlag(value) {
|
|
|
410327
410327
|
return ['1', 'true', 'yes', 'on'].includes(String(value).trim().toLowerCase());
|
|
410328
410328
|
}
|
|
410329
410329
|
function isVSCodeEnvironment() {
|
|
410330
|
-
return
|
|
410330
|
+
return Boolean(process.env.VSCODE_IPC_HOOK_CLI
|
|
410331
|
+
|| process.env.VSCODE_PID
|
|
410332
|
+
|| process.env.TERM_PROGRAM === 'vscode');
|
|
410333
|
+
}
|
|
410334
|
+
function parseBrowserCommand(browser) {
|
|
410335
|
+
const parts = browser.match(/(?:[^\s"]+|"[^"]*")+/g) || [];
|
|
410336
|
+
return parts.map((item) => item.replace(/^"(.*)"$/, '$1'));
|
|
410331
410337
|
}
|
|
410332
|
-
function
|
|
410338
|
+
function openUrlByBrowserEnv(url) {
|
|
410339
|
+
var _a;
|
|
410333
410340
|
return __awaiter(this, void 0, void 0, function* () {
|
|
410334
|
-
|
|
410335
|
-
|
|
410336
|
-
|
|
410337
|
-
|
|
410338
|
-
|
|
410339
|
-
|
|
410340
|
-
|
|
410341
|
+
const browser = (_a = process.env.BROWSER) === null || _a === void 0 ? void 0 : _a.trim();
|
|
410342
|
+
if (!browser) {
|
|
410343
|
+
return false;
|
|
410344
|
+
}
|
|
410345
|
+
const [command, ...args] = parseBrowserCommand(browser);
|
|
410346
|
+
if (!command) {
|
|
410347
|
+
return false;
|
|
410348
|
+
}
|
|
410349
|
+
const finalArgs = args.map((arg) => (arg === '%s' ? url : arg));
|
|
410350
|
+
if (!args.includes('%s')) {
|
|
410351
|
+
finalArgs.push(url);
|
|
410352
|
+
}
|
|
410353
|
+
return new Promise((resolve) => {
|
|
410354
|
+
(0, child_process_1.execFile)(command, finalArgs, (error) => {
|
|
410355
|
+
resolve(!error);
|
|
410341
410356
|
});
|
|
410342
410357
|
});
|
|
410343
410358
|
});
|
|
410344
410359
|
}
|
|
410345
|
-
function
|
|
410360
|
+
function shouldUseBrowserEnvFallback() {
|
|
410361
|
+
return process.platform === 'linux' && isVSCodeEnvironment();
|
|
410362
|
+
}
|
|
410363
|
+
function openUrl(url) {
|
|
410346
410364
|
return __awaiter(this, void 0, void 0, function* () {
|
|
410347
|
-
|
|
410365
|
+
try {
|
|
410366
|
+
const child = yield (0, open_1.default)(url, { url: true });
|
|
410367
|
+
if (child === null || child === void 0 ? void 0 : child.once) {
|
|
410368
|
+
child.once('error', (error) => __awaiter(this, void 0, void 0, function* () {
|
|
410369
|
+
if (shouldUseBrowserEnvFallback()) {
|
|
410370
|
+
yield openUrlByBrowserEnv(url);
|
|
410371
|
+
}
|
|
410372
|
+
}));
|
|
410373
|
+
}
|
|
410348
410374
|
return true;
|
|
410349
410375
|
}
|
|
410350
|
-
|
|
410351
|
-
|
|
410352
|
-
|
|
410353
|
-
}
|
|
410354
|
-
|
|
410376
|
+
catch (e) {
|
|
410377
|
+
if (shouldUseBrowserEnvFallback()) {
|
|
410378
|
+
return openUrlByBrowserEnv(url);
|
|
410379
|
+
}
|
|
410380
|
+
return false;
|
|
410381
|
+
}
|
|
410355
410382
|
});
|
|
410356
410383
|
}
|
|
410357
410384
|
// 从 Web 页面中获取数据
|
|
@@ -410365,30 +410392,13 @@ function getDataFromWeb(getUrl, type, options = {}) {
|
|
|
410365
410392
|
throw new error_1.CloudBaseError('callbackTimeout must be a positive number');
|
|
410366
410393
|
}
|
|
410367
410394
|
const url = getUrl(port);
|
|
410368
|
-
console.log('\n\n
|
|
410369
|
-
console.log(`\n${url}`);
|
|
410395
|
+
console.log('\n\n若链接未自动打开,请手动复制至浏览器,或尝试其他登录方式:');
|
|
410396
|
+
console.log(`\n${url}\n`);
|
|
410370
410397
|
if (!noBrowser) {
|
|
410371
|
-
|
|
410372
|
-
|
|
410373
|
-
|
|
410374
|
-
|
|
410375
|
-
// https://github.com/sindresorhus/open/blob/master/index.js#L48
|
|
410376
|
-
try {
|
|
410377
|
-
yield (0, open_1.default)(url, { url: true });
|
|
410378
|
-
}
|
|
410379
|
-
catch (e) {
|
|
410380
|
-
const code = (e === null || e === void 0 ? void 0 : e.code) || 'UNKNOWN';
|
|
410381
|
-
console.warn(`自动打开浏览器失败(${code})。`);
|
|
410382
|
-
}
|
|
410383
|
-
}
|
|
410384
|
-
if (isVSCodeEnvironment()) {
|
|
410385
|
-
try {
|
|
410386
|
-
yield openUrlByVSCode(url);
|
|
410387
|
-
}
|
|
410388
|
-
catch (vscodeError) {
|
|
410389
|
-
// ignore error
|
|
410390
|
-
}
|
|
410391
|
-
}
|
|
410398
|
+
// 对 url 转码, 避免 wsl 无法正常打开地址
|
|
410399
|
+
// https://www.npmjs.com/package/open#url
|
|
410400
|
+
// https://github.com/sindresorhus/open/blob/master/index.js#L48
|
|
410401
|
+
yield openUrl(url);
|
|
410392
410402
|
}
|
|
410393
410403
|
return new Promise((resolve, reject) => {
|
|
410394
410404
|
let finished = false;
|