@cloudbase/cli 2.10.1-alpha.0 → 2.10.1-alpha.1

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.
@@ -28141,6 +28141,99 @@ class MissingRefError extends Error {
28141
28141
  exports["default"] = MissingRefError;
28142
28142
  //# sourceMappingURL=ref_error.js.map
28143
28143
 
28144
+ /***/ }),
28145
+
28146
+ /***/ 5440:
28147
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
28148
+
28149
+ "use strict";
28150
+
28151
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
28152
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28153
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
28154
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
28155
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
28156
+ };
28157
+ var __metadata = (this && this.__metadata) || function (k, v) {
28158
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
28159
+ };
28160
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
28161
+ return function (target, key) { decorator(target, key, paramIndex); }
28162
+ };
28163
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
28164
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
28165
+ return new (P || (P = Promise))(function (resolve, reject) {
28166
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
28167
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
28168
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
28169
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28170
+ });
28171
+ };
28172
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
28173
+ exports.LowCodeDepsInstall = void 0;
28174
+ const common_1 = __webpack_require__(48431);
28175
+ const decorators_1 = __webpack_require__(93480);
28176
+ const error_1 = __webpack_require__(66759);
28177
+ const utils_1 = __webpack_require__(27821);
28178
+ let LowCodeDepsInstall = class LowCodeDepsInstall extends common_1.Command {
28179
+ get options() {
28180
+ return {
28181
+ cmd: 'lowcode',
28182
+ childCmd: 'deps install',
28183
+ options: [
28184
+ {
28185
+ flags: '--force',
28186
+ desc: '重新安装并覆盖已有低码依赖'
28187
+ },
28188
+ {
28189
+ flags: '--registry <registry>',
28190
+ desc: '指定 npm registry 地址'
28191
+ }
28192
+ ],
28193
+ desc: '安装低码依赖',
28194
+ requiredEnvId: false
28195
+ };
28196
+ }
28197
+ execute(options, log) {
28198
+ var _a, _b, _c, _d;
28199
+ return __awaiter(this, void 0, void 0, function* () {
28200
+ const meta = yield (0, utils_1.getInstalledLowcodeMeta)();
28201
+ if (meta.satisfied && !options.force) {
28202
+ (_a = log === null || log === void 0 ? void 0 : log.info) === null || _a === void 0 ? void 0 : _a.call(log, `已检测到 ${utils_1.LOWCODE_PACKAGE_NAME}@${meta.version || 'unknown'},若需重装请使用 --force`);
28203
+ return;
28204
+ }
28205
+ const registry = options.registry;
28206
+ if (registry) {
28207
+ (_b = log === null || log === void 0 ? void 0 : log.info) === null || _b === void 0 ? void 0 : _b.call(log, `使用 registry: ${registry}`);
28208
+ }
28209
+ (_c = log === null || log === void 0 ? void 0 : log.info) === null || _c === void 0 ? void 0 : _c.call(log, `开始安装 ${utils_1.LOWCODE_PACKAGE_NAME}@${utils_1.LOWCODE_PACKAGE_RANGE} 到 ${(0, utils_1.getLowcodeHome)()}`);
28210
+ try {
28211
+ yield (0, utils_1.installLowcodeDeps)({ force: options.force, registry });
28212
+ }
28213
+ catch (e) {
28214
+ const message = e instanceof Error ? e.message : String(e);
28215
+ throw new error_1.CloudBaseError(`低码依赖安装失败:${message}`);
28216
+ }
28217
+ (_d = log === null || log === void 0 ? void 0 : log.success) === null || _d === void 0 ? void 0 : _d.call(log, '低码依赖安装完成');
28218
+ });
28219
+ }
28220
+ };
28221
+ __decorate([
28222
+ (0, decorators_1.InjectParams)(),
28223
+ __param(0, (0, decorators_1.ArgsOptions)()),
28224
+ __param(1, (0, decorators_1.Log)()),
28225
+ __metadata("design:type", Function),
28226
+ __metadata("design:paramtypes", [Object, decorators_1.Logger]),
28227
+ __metadata("design:returntype", Promise)
28228
+ ], LowCodeDepsInstall.prototype, "execute", null);
28229
+ LowCodeDepsInstall = __decorate([
28230
+ (0, common_1.ICommand)({
28231
+ supportPrivate: true
28232
+ })
28233
+ ], LowCodeDepsInstall);
28234
+ exports.LowCodeDepsInstall = LowCodeDepsInstall;
28235
+
28236
+
28144
28237
  /***/ }),
28145
28238
 
28146
28239
  /***/ 5444:
@@ -47315,7 +47408,7 @@ module.exports = function generate_pattern(it, $keyword, $ruleType) {
47315
47408
  /***/ ((module) => {
47316
47409
 
47317
47410
  "use strict";
47318
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.10.1-alpha.0","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":"npm run build","debug":"bin/tcb.js lowcode watch","build:bundle":"webpack --config build/webpack/cli.cjs && webpack --config build/webpack/ccr.cjs","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":"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"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloud-base-cli.git"},"bin":{"ccr":"bin/ccr.js","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":"^1.8.44","@cloudbase/framework-core":"^1.9.7","@cloudbase/functions-framework":"1.16.0","@cloudbase/iac-core":"0.0.3-alpha.11","@cloudbase/lowcode-cli":"^0.23.0","@cloudbase/manager-node":"4.6.5","@cloudbase/toolbox":"^0.7.9","@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"}');
47411
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.10.1-alpha.1","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":"npm run build","debug":"bin/tcb.js lowcode watch","build:bundle":"webpack --config build/webpack/cli.cjs && webpack --config build/webpack/ccr.cjs","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":"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"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloud-base-cli.git"},"bin":{"ccr":"bin/ccr.js","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":"^1.8.44","@cloudbase/framework-core":"^1.9.7","@cloudbase/functions-framework":"1.16.0","@cloudbase/iac-core":"0.0.3-alpha.11","@cloudbase/lowcode-cli":"^0.23.0","@cloudbase/manager-node":"4.6.5","@cloudbase/toolbox":"^0.7.9","@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"}');
47319
47412
 
47320
47413
  /***/ }),
47321
47414
 
@@ -185762,29 +185855,6 @@ module.exports = SelectStream;
185762
185855
 
185763
185856
  "use strict";
185764
185857
 
185765
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
185766
- if (k2 === undefined) k2 = k;
185767
- var desc = Object.getOwnPropertyDescriptor(m, k);
185768
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
185769
- desc = { enumerable: true, get: function() { return m[k]; } };
185770
- }
185771
- Object.defineProperty(o, k2, desc);
185772
- }) : (function(o, m, k, k2) {
185773
- if (k2 === undefined) k2 = k;
185774
- o[k2] = m[k];
185775
- }));
185776
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
185777
- Object.defineProperty(o, "default", { enumerable: true, value: v });
185778
- }) : function(o, v) {
185779
- o["default"] = v;
185780
- });
185781
- var __importStar = (this && this.__importStar) || function (mod) {
185782
- if (mod && mod.__esModule) return mod;
185783
- var result = {};
185784
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
185785
- __setModuleDefault(result, mod);
185786
- return result;
185787
- };
185788
185858
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
185789
185859
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
185790
185860
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -185794,20 +185864,60 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
185794
185864
  step((generator = generator.apply(thisArg, _arguments || [])).next());
185795
185865
  });
185796
185866
  };
185867
+ var __importDefault = (this && this.__importDefault) || function (mod) {
185868
+ return (mod && mod.__esModule) ? mod : { "default": mod };
185869
+ };
185870
+ var _a;
185797
185871
  Object.defineProperty(exports, "__esModule", ({ value: true }));
185798
- exports.getMergedOptions = exports.getCmdConfig = exports.getLowcodeCli = exports.promisifyProcess = void 0;
185872
+ exports.getMergedOptions = exports.getCmdConfig = exports.getInstalledLowcodeMeta = exports.getLowcodeCli = exports.installLowcodeDeps = exports.getLowcodeManifestPath = exports.getLowcodeNodeModules = exports.getLowcodeHome = exports.promisifyProcess = exports.LOWCODE_PACKAGE_RANGE = exports.LOWCODE_PACKAGE_NAME = void 0;
185799
185873
  const lodash_1 = __webpack_require__(24924);
185800
185874
  const toolbox_1 = __webpack_require__(25901);
185875
+ const child_process_1 = __webpack_require__(35317);
185876
+ const os_1 = __importDefault(__webpack_require__(70857));
185877
+ const path_1 = __importDefault(__webpack_require__(16928));
185878
+ const fs_extra_1 = __importDefault(__webpack_require__(21605));
185879
+ const semver_1 = __importDefault(__webpack_require__(21970));
185880
+ const { createRequire } = __webpack_require__(73339);
185881
+ const LOWCODE_PKG_NAME = '@cloudbase/lowcode-cli';
185882
+ const LOWCODE_PKG_RANGE = ((_a = (__webpack_require__(8330).dependencies)) === null || _a === void 0 ? void 0 : _a[LOWCODE_PKG_NAME]) || 'latest';
185883
+ exports.LOWCODE_PACKAGE_NAME = LOWCODE_PKG_NAME;
185884
+ exports.LOWCODE_PACKAGE_RANGE = LOWCODE_PKG_RANGE;
185885
+ function resolveLowcodeHome() {
185886
+ const envHome = process.env.CLOUDBASE_LOWCODE_HOME;
185887
+ const normalize = (val) => {
185888
+ if (val === null || val === undefined)
185889
+ return '';
185890
+ return String(val).trim();
185891
+ };
185892
+ const envPath = normalize(envHome);
185893
+ if (envPath) {
185894
+ try {
185895
+ return path_1.default.resolve(envPath);
185896
+ }
185897
+ catch (e) {
185898
+ }
185899
+ }
185900
+ return path_1.default.join(String(os_1.default.homedir()), '.cloudbase', 'lowcode');
185901
+ }
185902
+ const LOWCODE_HOME = String(resolveLowcodeHome());
185903
+ const LOWCODE_NODE_MODULES = path_1.default.join(LOWCODE_HOME, 'node_modules');
185904
+ const LOWCODE_MANIFEST = path_1.default.join(LOWCODE_HOME, 'manifest.json');
185905
+ let lowcodeCliCache = null;
185801
185906
  function promisifyProcess(p, pipe = false) {
185802
185907
  return new Promise((resolve, reject) => {
185908
+ var _a, _b;
185803
185909
  let stdout = '';
185804
185910
  let stderr = '';
185805
- p.stdout.on('data', (data) => {
185806
- stdout += String(data);
185807
- });
185808
- p.stderr.on('data', (data) => {
185809
- stderr += String(data);
185810
- });
185911
+ if (p.stdout) {
185912
+ p.stdout.on('data', (data) => {
185913
+ stdout += String(data);
185914
+ });
185915
+ }
185916
+ if (p.stderr) {
185917
+ p.stderr.on('data', (data) => {
185918
+ stderr += String(data);
185919
+ });
185920
+ }
185811
185921
  p.on('error', reject);
185812
185922
  p.on('exit', (exitCode) => {
185813
185923
  exitCode === 0
@@ -185815,27 +185925,151 @@ function promisifyProcess(p, pipe = false) {
185815
185925
  : reject(new toolbox_1.CloudBaseError(stderr || String(exitCode)));
185816
185926
  });
185817
185927
  if (pipe) {
185818
- p.stdout.pipe(process.stdout);
185819
- p.stderr.pipe(process.stderr);
185928
+ (_a = p.stdout) === null || _a === void 0 ? void 0 : _a.pipe(process.stdout);
185929
+ (_b = p.stderr) === null || _b === void 0 ? void 0 : _b.pipe(process.stderr);
185820
185930
  }
185821
185931
  });
185822
185932
  }
185823
185933
  exports.promisifyProcess = promisifyProcess;
185934
+ function getLowcodeHome() {
185935
+ return LOWCODE_HOME;
185936
+ }
185937
+ exports.getLowcodeHome = getLowcodeHome;
185938
+ function getLowcodeNodeModules() {
185939
+ return LOWCODE_NODE_MODULES;
185940
+ }
185941
+ exports.getLowcodeNodeModules = getLowcodeNodeModules;
185942
+ function getLowcodeManifestPath() {
185943
+ return LOWCODE_MANIFEST;
185944
+ }
185945
+ exports.getLowcodeManifestPath = getLowcodeManifestPath;
185946
+ function resolveNpmInvocation() {
185947
+ const execPathEnv = process.env.npm_execpath;
185948
+ if (typeof execPathEnv === 'string' && execPathEnv.trim()) {
185949
+ const cliPath = execPathEnv.trim();
185950
+ if (fs_extra_1.default.existsSync(cliPath)) {
185951
+ return { command: String(process.execPath), baseArgs: [cliPath] };
185952
+ }
185953
+ }
185954
+ const whichNpm = (0, child_process_1.spawnSync)('npm', ['--version'], { stdio: 'ignore' });
185955
+ if (whichNpm.status === 0) {
185956
+ return { command: 'npm', baseArgs: [] };
185957
+ }
185958
+ return { command: 'npm', baseArgs: [] };
185959
+ }
185960
+ function formatInstallHint() {
185961
+ const cacheDir = getLowcodeHome();
185962
+ return [
185963
+ `缺少低码依赖 ${LOWCODE_PKG_NAME}@${LOWCODE_PKG_RANGE},请先安装:`,
185964
+ ` tcb lowcode deps install`,
185965
+ `默认安装路径:${cacheDir}`,
185966
+ '可通过环境变量 CLOUDBASE_LOWCODE_HOME 指定其他缓存目录。'
185967
+ ].join('\n');
185968
+ }
185969
+ function resolveInstalledLowcode() {
185970
+ return __awaiter(this, void 0, void 0, function* () {
185971
+ const pkgJsonPath = path_1.default.join(getLowcodeNodeModules(), LOWCODE_PKG_NAME, 'package.json');
185972
+ if (!(yield fs_extra_1.default.pathExists(pkgJsonPath))) {
185973
+ return null;
185974
+ }
185975
+ try {
185976
+ const pkgJson = yield fs_extra_1.default.readJson(pkgJsonPath);
185977
+ const req = createRequire(pkgJsonPath);
185978
+ const mod = req(LOWCODE_PKG_NAME);
185979
+ const satisfies = (pkgJson === null || pkgJson === void 0 ? void 0 : pkgJson.version)
185980
+ ? semver_1.default.satisfies(pkgJson.version, LOWCODE_PKG_RANGE, { includePrerelease: true })
185981
+ : true;
185982
+ return satisfies ? { module: mod, version: pkgJson.version } : null;
185983
+ }
185984
+ catch (e) {
185985
+ return null;
185986
+ }
185987
+ });
185988
+ }
185989
+ function installLowcodeDeps(options = {}) {
185990
+ return __awaiter(this, void 0, void 0, function* () {
185991
+ const prefixDir = String(LOWCODE_HOME || '');
185992
+ yield fs_extra_1.default.ensureDir(prefixDir);
185993
+ const npmCacheDir = path_1.default.join(prefixDir, '_npm_cache');
185994
+ yield fs_extra_1.default.ensureDir(npmCacheDir);
185995
+ const npmUserConfig = path_1.default.join(prefixDir, 'npmrc');
185996
+ if (!(yield fs_extra_1.default.pathExists(npmUserConfig))) {
185997
+ yield fs_extra_1.default.writeFile(npmUserConfig, '', 'utf8');
185998
+ }
185999
+ const existing = yield resolveInstalledLowcode();
186000
+ if (existing && !options.force) {
186001
+ return;
186002
+ }
186003
+ if (options.force) {
186004
+ yield fs_extra_1.default.remove(path_1.default.join(getLowcodeNodeModules(), LOWCODE_PKG_NAME));
186005
+ }
186006
+ const npmBin = resolveNpmInvocation();
186007
+ const args = [
186008
+ ...npmBin.baseArgs,
186009
+ 'install',
186010
+ `${LOWCODE_PKG_NAME}@${LOWCODE_PKG_RANGE}`,
186011
+ '--prefix',
186012
+ prefixDir,
186013
+ '--cache',
186014
+ npmCacheDir,
186015
+ '--no-package-lock',
186016
+ '--fund=false',
186017
+ '--audit=false',
186018
+ '--progress=false'
186019
+ ];
186020
+ if (options.registry) {
186021
+ args.push('--registry', options.registry);
186022
+ }
186023
+ const child = (0, child_process_1.spawn)(npmBin.command, args, {
186024
+ cwd: LOWCODE_HOME,
186025
+ env: Object.assign(Object.assign({}, process.env), { npm_config_update_notifier: 'false', npm_config_cache: npmCacheDir, npm_config_prefix: prefixDir, npm_config_userconfig: npmUserConfig })
186026
+ });
186027
+ yield promisifyProcess(child, true);
186028
+ let installedVersion = '';
186029
+ const pkgJsonPath = path_1.default.join(getLowcodeNodeModules(), LOWCODE_PKG_NAME, 'package.json');
186030
+ if (yield fs_extra_1.default.pathExists(pkgJsonPath)) {
186031
+ try {
186032
+ const pkgJson = yield fs_extra_1.default.readJson(pkgJsonPath);
186033
+ installedVersion = (pkgJson === null || pkgJson === void 0 ? void 0 : pkgJson.version) || '';
186034
+ }
186035
+ catch (e) {
186036
+ }
186037
+ }
186038
+ const manifest = {
186039
+ name: LOWCODE_PKG_NAME,
186040
+ range: LOWCODE_PKG_RANGE,
186041
+ version: installedVersion,
186042
+ installedAt: new Date().toISOString()
186043
+ };
186044
+ yield fs_extra_1.default.writeJSON(LOWCODE_MANIFEST, manifest, { spaces: 2 });
186045
+ });
186046
+ }
186047
+ exports.installLowcodeDeps = installLowcodeDeps;
185824
186048
  function getLowcodeCli() {
185825
186049
  return __awaiter(this, void 0, void 0, function* () {
185826
- var _a;
185827
- const key = '@cloudbase/lowcode-cli';
185828
- const cache = new Map();
185829
- let result;
185830
- if (!cache.get(key)) {
185831
- const module = yield (_a = key, Promise.resolve().then(() => __importStar(__webpack_require__(43845)(_a))));
185832
- cache.set(key, module);
186050
+ if (lowcodeCliCache) {
186051
+ return lowcodeCliCache;
185833
186052
  }
185834
- result = cache.get(key);
185835
- return result;
186053
+ const resolved = yield resolveInstalledLowcode();
186054
+ if (resolved === null || resolved === void 0 ? void 0 : resolved.module) {
186055
+ lowcodeCliCache = resolved.module;
186056
+ return lowcodeCliCache;
186057
+ }
186058
+ throw new toolbox_1.CloudBaseError(formatInstallHint());
185836
186059
  });
185837
186060
  }
185838
186061
  exports.getLowcodeCli = getLowcodeCli;
186062
+ function getInstalledLowcodeMeta() {
186063
+ return __awaiter(this, void 0, void 0, function* () {
186064
+ const resolved = yield resolveInstalledLowcode();
186065
+ return {
186066
+ version: resolved === null || resolved === void 0 ? void 0 : resolved.version,
186067
+ home: getLowcodeHome(),
186068
+ satisfied: Boolean(resolved)
186069
+ };
186070
+ });
186071
+ }
186072
+ exports.getInstalledLowcodeMeta = getInstalledLowcodeMeta;
185839
186073
  function getCmdConfig(config, options) {
185840
186074
  return (0, lodash_1.get)(config, `${options.cmd}["${options.childCmd}"]`);
185841
186075
  }
@@ -270820,21 +271054,6 @@ function baseAssignIn(object, source) {
270820
271054
  module.exports = baseAssignIn;
270821
271055
 
270822
271056
 
270823
- /***/ }),
270824
-
270825
- /***/ 43845:
270826
- /***/ ((module) => {
270827
-
270828
- function webpackEmptyContext(req) {
270829
- var e = new Error("Cannot find module '" + req + "'");
270830
- e.code = 'MODULE_NOT_FOUND';
270831
- throw e;
270832
- }
270833
- webpackEmptyContext.keys = () => ([]);
270834
- webpackEmptyContext.resolve = webpackEmptyContext;
270835
- webpackEmptyContext.id = 43845;
270836
- module.exports = webpackEmptyContext;
270837
-
270838
271057
  /***/ }),
270839
271058
 
270840
271059
  /***/ 43852:
@@ -467058,35 +467277,12 @@ module.exports = function (data) {
467058
467277
 
467059
467278
  "use strict";
467060
467279
 
467061
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
467062
- if (k2 === undefined) k2 = k;
467063
- var desc = Object.getOwnPropertyDescriptor(m, k);
467064
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
467065
- desc = { enumerable: true, get: function() { return m[k]; } };
467066
- }
467067
- Object.defineProperty(o, k2, desc);
467068
- }) : (function(o, m, k, k2) {
467069
- if (k2 === undefined) k2 = k;
467070
- o[k2] = m[k];
467071
- }));
467072
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
467073
- Object.defineProperty(o, "default", { enumerable: true, value: v });
467074
- }) : function(o, v) {
467075
- o["default"] = v;
467076
- });
467077
467280
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
467078
467281
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
467079
467282
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
467080
467283
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
467081
467284
  return c > 3 && r && Object.defineProperty(target, key, r), r;
467082
467285
  };
467083
- var __importStar = (this && this.__importStar) || function (mod) {
467084
- if (mod && mod.__esModule) return mod;
467085
- var result = {};
467086
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
467087
- __setModuleDefault(result, mod);
467088
- return result;
467089
- };
467090
467286
  var __metadata = (this && this.__metadata) || function (k, v) {
467091
467287
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
467092
467288
  };
@@ -467128,8 +467324,13 @@ const toolbox_1 = __webpack_require__(25901);
467128
467324
  const fs_extra_1 = __importDefault(__webpack_require__(21605));
467129
467325
  const dts_1 = __webpack_require__(61142);
467130
467326
  let lowcodeCli;
467131
- if (process.argv.includes('lowcode')) {
467132
- (0, utils_1.getLowcodeCli)().then((_) => (lowcodeCli = _));
467327
+ function ensureLowcodeCli() {
467328
+ return __awaiter(this, void 0, void 0, function* () {
467329
+ if (!lowcodeCli) {
467330
+ lowcodeCli = yield (0, utils_1.getLowcodeCli)();
467331
+ }
467332
+ return lowcodeCli;
467333
+ });
467133
467334
  }
467134
467335
  let LowCodeWatch = class LowCodeWatch extends common_1.Command {
467135
467336
  get options() {
@@ -467162,14 +467363,13 @@ let LowCodeWatch = class LowCodeWatch extends common_1.Command {
467162
467363
  return __awaiter(this, void 0, void 0, function* () {
467163
467364
  const config = (0, utils_1.getCmdConfig)(ctx.config, this.options);
467164
467365
  const mergesOptions = (0, utils_1.getMergedOptions)(config, options);
467165
- Promise.resolve().then(() => __importStar(__webpack_require__(Object(function webpackMissingModule() { var e = new Error("Cannot find module '@cloudbase/lowcode-cli'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())))).then((res) => __awaiter(this, void 0, void 0, function* () {
467166
- yield res.watchApp({
467167
- watchPort: 8288,
467168
- wxDevtoolPath: options === null || options === void 0 ? void 0 : options.wxDevtoolPath,
467169
- forceInstall: options === null || options === void 0 ? void 0 : options.forceInstall,
467170
- projectPath: options === null || options === void 0 ? void 0 : options.path
467171
- });
467172
- }));
467366
+ const lowcodeCli = yield ensureLowcodeCli();
467367
+ yield lowcodeCli.watchApp({
467368
+ watchPort: 8288,
467369
+ wxDevtoolPath: options === null || options === void 0 ? void 0 : options.wxDevtoolPath,
467370
+ forceInstall: options === null || options === void 0 ? void 0 : options.forceInstall,
467371
+ projectPath: options === null || options === void 0 ? void 0 : options.path
467372
+ });
467173
467373
  });
467174
467374
  }
467175
467375
  };
@@ -467210,6 +467410,7 @@ let LowCodeBuildApp = class LowCodeBuildApp extends common_1.Command {
467210
467410
  return __awaiter(this, void 0, void 0, function* () {
467211
467411
  const config = (0, utils_1.getCmdConfig)(ctx.config, this.options);
467212
467412
  const mergesOptions = (0, utils_1.getMergedOptions)(config, options);
467413
+ const lowcodeCli = yield ensureLowcodeCli();
467213
467414
  yield lowcodeCli.buildApp({
467214
467415
  envId: ctx.envId || ctx.config.envId,
467215
467416
  projectPath: process.cwd(),
@@ -467255,6 +467456,7 @@ let LowCodePreviewApp = class LowCodePreviewApp extends common_1.Command {
467255
467456
  return __awaiter(this, void 0, void 0, function* () {
467256
467457
  const config = (0, utils_1.getCmdConfig)(ctx.config, this.options);
467257
467458
  const mergesOptions = (0, utils_1.getMergedOptions)(config, options);
467459
+ const lowcodeCli = yield ensureLowcodeCli();
467258
467460
  yield lowcodeCli.previewApp({
467259
467461
  envId: ctx.envId || ctx.config.envId,
467260
467462
  projectPath: process.cwd(),
@@ -467304,6 +467506,7 @@ let LowCodeBuildAppConfig = class LowCodeBuildAppConfig extends common_1.Command
467304
467506
  return __awaiter(this, void 0, void 0, function* () {
467305
467507
  const config = (0, utils_1.getCmdConfig)(ctx.config, this.options);
467306
467508
  const mergesOptions = (0, utils_1.getMergedOptions)(config, options);
467509
+ const lowcodeCli = yield ensureLowcodeCli();
467307
467510
  yield lowcodeCli.buildAppConfig({
467308
467511
  envId: ctx.envId || ctx.config.envId,
467309
467512
  projectPath: process.cwd(),
@@ -467358,6 +467561,7 @@ let LowCodeDeployApp = class LowCodeDeployApp extends common_1.Command {
467358
467561
  else {
467359
467562
  credential = yield utils_2.authSupevisor.getLoginState();
467360
467563
  }
467564
+ const lowcodeCli = yield ensureLowcodeCli();
467361
467565
  yield lowcodeCli.deployApp({
467362
467566
  envId: ctx.envId || ctx.config.envId,
467363
467567
  projectPath: process.cwd(),
@@ -468910,8 +469114,13 @@ const cloud_api_1 = __webpack_require__(2090);
468910
469114
  const error_1 = __webpack_require__(66759);
468911
469115
  const utils_2 = __webpack_require__(27821);
468912
469116
  let lowcodeCli;
468913
- if (process.argv.includes('lowcode')) {
468914
- (0, utils_2.getLowcodeCli)().then((_) => (lowcodeCli = _));
469117
+ function ensureLowcodeCli() {
469118
+ return __awaiter(this, void 0, void 0, function* () {
469119
+ if (!lowcodeCli) {
469120
+ lowcodeCli = yield (0, utils_2.getLowcodeCli)();
469121
+ }
469122
+ return lowcodeCli;
469123
+ });
468915
469124
  }
468916
469125
  let LowCodeCreateComps = class LowCodeCreateComps extends common_1.Command {
468917
469126
  get options() {
@@ -468939,9 +469148,11 @@ let LowCodeCreateComps = class LowCodeCreateComps extends common_1.Command {
468939
469148
  if (!(params === null || params === void 0 ? void 0 : params[0])) {
468940
469149
  throw new error_1.CloudBaseError('skip validate 需要指定组件库名 eg: `tcb lowcode create mydemo`');
468941
469150
  }
469151
+ const lowcodeCli = yield ensureLowcodeCli();
468942
469152
  yield lowcodeCli.bootstrap(params === null || params === void 0 ? void 0 : params[0], log);
468943
469153
  return;
468944
469154
  }
469155
+ const lowcodeCli = yield ensureLowcodeCli();
468945
469156
  const privateSettings = (0, utils_1.getPrivateSettings)(config, this.options.cmd);
468946
469157
  if (process.env.CLOUDBASE_LOWCODE_CLOUDAPI_URL === undefined) {
468947
469158
  process.env.CLOUDBASE_LOWCODE_CLOUDAPI_URL =
@@ -469022,6 +469233,7 @@ let LowCodeBuildComps = class LowCodeBuildComps extends common_1.Command {
469022
469233
  return __awaiter(this, void 0, void 0, function* () {
469023
469234
  const config = ctx.config.lowcodeCustomComponents;
469024
469235
  if (config) {
469236
+ const lowcodeCli = yield ensureLowcodeCli();
469025
469237
  yield lowcodeCli.graceBuildComps(Object.assign(Object.assign({}, config), { context: config.context || process.cwd(), logger: log, privateSettings: (0, utils_1.getPrivateSettings)(ctx.config, this.options.cmd), envId: ctx.envId || ctx.config.envId }));
469026
469238
  return;
469027
469239
  }
@@ -469074,6 +469286,7 @@ let LowCodeDebugComps = class LowCodeDebugComps extends common_1.Command {
469074
469286
  if (config) {
469075
469287
  const cmdConfig = (0, utils_2.getCmdConfig)(ctx.config, this.options);
469076
469288
  const mergesOptions = (0, utils_2.getMergedOptions)(cmdConfig, options);
469289
+ const lowcodeCli = yield ensureLowcodeCli();
469077
469290
  yield lowcodeCli.graceDebugComps(Object.assign(Object.assign({}, config), { context: config.context || process.cwd(), debugPort: (mergesOptions === null || mergesOptions === void 0 ? void 0 : mergesOptions.debugPort) || 8388, logger: log, wxDevtoolPath: mergesOptions === null || mergesOptions === void 0 ? void 0 : mergesOptions.wxDevtoolPath, debugBaseUrl: (_a = privateSettings === null || privateSettings === void 0 ? void 0 : privateSettings.endpoints) === null || _a === void 0 ? void 0 : _a.editor, envId: ctx.envId || ctx.config.envId }));
469078
469291
  return;
469079
469292
  }
@@ -469121,6 +469334,7 @@ let LowCodePublishComps = class LowCodePublishComps extends common_1.Command {
469121
469334
  const config = ctx.config.lowcodeCustomComponents;
469122
469335
  if (config) {
469123
469336
  const mergesOptions = (0, utils_2.getMergedOptions)((0, utils_2.getCmdConfig)(ctx.config, this.options), options);
469337
+ const lowcodeCli = yield ensureLowcodeCli();
469124
469338
  yield lowcodeCli.gracePublishComps(Object.assign(Object.assign({}, config), { context: config.context || process.cwd(), logger: log, privateSettings: (0, utils_1.getPrivateSettings)(ctx.config, this.options.cmd), isAdmin: Boolean(mergesOptions.admin), envId: ctx.envId || ctx.config.envId }));
469125
469339
  log.success('组件库 - 已同步到云端,请到低码控制台发布该组件库!');
469126
469340
  return;
@@ -469187,6 +469401,7 @@ let LowCodePublishVersionComps = class LowCodePublishVersionComps extends common
469187
469401
  if (!config) {
469188
469402
  throw new error_1.CloudBaseError('组件库 - 请添加组件库配置到cloudbaserc.json 以使用该命令');
469189
469403
  }
469404
+ const lowcodeCli = yield ensureLowcodeCli();
469190
469405
  const res = yield lowcodeCli.publishVersion(Object.assign(Object.assign({}, config), { context: config.context || process.cwd(), logger: log, isAdmin: options.admin, privateSettings: (0, utils_1.getPrivateSettings)(ctx.config, this.options.cmd), envId: ctx.envId || ctx.config.envId }), comment, tag);
469191
469406
  if (res.data.code === 200) {
469192
469407
  log.success('组件库 - 已发布新版本!');
@@ -491240,6 +491455,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
491240
491455
  Object.defineProperty(exports, "__esModule", ({ value: true }));
491241
491456
  __exportStar(__webpack_require__(69511), exports);
491242
491457
  __exportStar(__webpack_require__(69892), exports);
491458
+ __exportStar(__webpack_require__(5440), exports);
491243
491459
 
491244
491460
 
491245
491461
  /***/ }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cli",
3
- "version": "2.10.1-alpha.0",
3
+ "version": "2.10.1-alpha.1",
4
4
  "description": "CLI for Tencent CloudBase (standalone bundle)",
5
5
  "bin": {
6
6
  "tcb": "bin/tcb",