@cloudbase/cli 2.8.20 → 2.8.21
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 +6 -4
- package/package.json +1 -1
- package/build/entries/ccr-main.js +0 -15
- package/build/entries/cli-main.js +0 -36
- package/build/launchers/ccr +0 -32
- package/build/launchers/cloudbase +0 -32
- package/build/launchers/cloudbase-mcp +0 -32
- package/build/launchers/tcb +0 -33
- package/build/patches/ccr-cli-patch.js +0 -40
- package/build/shims/cloud-api-pkg.cjs +0 -6
- package/build/shims/framework-core-pkg.cjs +0 -6
- package/build/shims/functions-framework-pkg.cjs +0 -6
- package/build/shims/generic-pkg.cjs +0 -9
- package/build/shims/hexoid.cjs +0 -14
- package/build/shims/iac-core-pkg.cjs +0 -6
- package/build/shims/lowcode-pkg.cjs +0 -8
- package/build/shims/manager-node-pkg.cjs +0 -6
- package/build/shims/prettier.cjs +0 -11
- package/build/shims/read-pkg-up.cjs +0 -21
- package/build/shims/toolbox-pkg.cjs +0 -6
- package/build/shims/update-notifier.cjs +0 -9
- package/build/webpack/ccr.cjs +0 -85
- package/build/webpack/cli.cjs +0 -114
package/dist/standalone/cli.js
CHANGED
|
@@ -313,9 +313,11 @@ async function main() {
|
|
|
313
313
|
updateCheckInterval: CheckInterval
|
|
314
314
|
})
|
|
315
315
|
|
|
316
|
-
notifier.
|
|
317
|
-
|
|
318
|
-
|
|
316
|
+
if (notifier.update) {
|
|
317
|
+
console.log('\n发现新版本:' + notifier.update.latest)
|
|
318
|
+
console.log('当前版本:' + notifier.update.current)
|
|
319
|
+
console.log('请参考升级文档:https://docs.cloudbase.net/cli-v1/install\n')
|
|
320
|
+
}
|
|
319
321
|
}
|
|
320
322
|
|
|
321
323
|
if (__webpack_require__.c[__webpack_require__.s] === module) {
|
|
@@ -617770,7 +617772,7 @@ module.exports = {"version":"3.13.1"};
|
|
|
617770
617772
|
/***/ ((module) => {
|
|
617771
617773
|
|
|
617772
617774
|
"use strict";
|
|
617773
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.8.
|
|
617775
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.8.20","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","out:prune":"bash build/scripts/prune-out.sh"},"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","ccr":"bin/ccr.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.32","@cloudbase/framework-core":"^1.9.7","@cloudbase/functions-framework":"1.16.0","@cloudbase/iac-core":"0.0.3-alpha.11","@cloudbase/lowcode-cli":"^0.22.2","@cloudbase/manager-node":"4.4.4","@cloudbase/toolbox":"^0.7.7","@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","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","open":"^7.0.0","ora":"^4.0.2","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","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":{"@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","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"}');
|
|
617774
617776
|
|
|
617775
617777
|
/***/ })
|
|
617776
617778
|
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict'
|
|
3
|
-
|
|
4
|
-
// Suppress noisy Node deprecation warnings in standalone runtime
|
|
5
|
-
if (!process.env.NODE_NO_WARNINGS) {
|
|
6
|
-
process.env.NODE_NO_WARNINGS = '1'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// Load and run the ccr command from @musistudio/claude-code-router
|
|
10
|
-
try {
|
|
11
|
-
require('@musistudio/claude-code-router/dist/cli.js')
|
|
12
|
-
} catch (error) {
|
|
13
|
-
console.error('Failed to load ccr:', error)
|
|
14
|
-
process.exit(1)
|
|
15
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict'
|
|
3
|
-
|
|
4
|
-
// Suppress noisy Node deprecation warnings in standalone runtime
|
|
5
|
-
if (!process.env.NODE_NO_WARNINGS) {
|
|
6
|
-
process.env.NODE_NO_WARNINGS = '1'
|
|
7
|
-
}
|
|
8
|
-
try {
|
|
9
|
-
// Swallow runtime warnings (e.g., punycode deprecation)
|
|
10
|
-
process.emitWarning = function () { /* no-op */ }
|
|
11
|
-
process.on('warning', function () { /* no-op */ })
|
|
12
|
-
} catch (_) {}
|
|
13
|
-
|
|
14
|
-
// Guard against accidental console.log([NaN]) from bundled deps when showing help
|
|
15
|
-
try {
|
|
16
|
-
const originalConsoleLog = console.log
|
|
17
|
-
console.log = function patchedConsoleLog(...args) {
|
|
18
|
-
if (
|
|
19
|
-
args.length === 1 &&
|
|
20
|
-
Array.isArray(args[0]) &&
|
|
21
|
-
args[0].length === 1 &&
|
|
22
|
-
Number.isNaN(args[0][0])
|
|
23
|
-
) {
|
|
24
|
-
try {
|
|
25
|
-
// Debug trace for locating [NaN] origin during dev
|
|
26
|
-
// eslint-disable-next-line no-console
|
|
27
|
-
originalConsoleLog('[NaN] suppressed; caller stack below:')
|
|
28
|
-
console.trace()
|
|
29
|
-
} catch (_) {}
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
return originalConsoleLog.apply(this, args)
|
|
33
|
-
}
|
|
34
|
-
} catch (_) {}
|
|
35
|
-
|
|
36
|
-
require('../../bin/tcb').main()
|
package/build/launchers/ccr
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -eo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT_PATH="${BASH_SOURCE[0]}"
|
|
5
|
-
while [ -L "$SCRIPT_PATH" ]; do
|
|
6
|
-
TARGET="$(readlink "$SCRIPT_PATH")"
|
|
7
|
-
if [[ "$TARGET" == /* ]]; then
|
|
8
|
-
SCRIPT_PATH="$TARGET"
|
|
9
|
-
else
|
|
10
|
-
SCRIPT_PATH="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)/$TARGET"
|
|
11
|
-
fi
|
|
12
|
-
done
|
|
13
|
-
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
14
|
-
|
|
15
|
-
export CLI_BIN_NAME=ccr
|
|
16
|
-
|
|
17
|
-
# 检测是否为 Android/Termux 环境
|
|
18
|
-
if [[ -f "/data/data/com.termux/files/usr/bin/bash" ]] ||
|
|
19
|
-
[[ "$PREFIX" == "/data/data/com.termux/files/usr" ]] ||
|
|
20
|
-
[[ -n "$TERMUX_VERSION" ]] ||
|
|
21
|
-
[[ "$(uname -o 2>/dev/null)" == "Android" ]]; then
|
|
22
|
-
# Android/Termux: 使用系统 node
|
|
23
|
-
if command -v node >/dev/null 2>&1; then
|
|
24
|
-
node "${SCRIPT_DIR}/../ccr.js" "$@"
|
|
25
|
-
else
|
|
26
|
-
echo "error: Node.js not found. Please install it with: pkg install nodejs" >&2
|
|
27
|
-
exit 1
|
|
28
|
-
fi
|
|
29
|
-
else
|
|
30
|
-
# 标准 Linux/macOS: 使用打包的 node
|
|
31
|
-
"${SCRIPT_DIR}/../node" "${SCRIPT_DIR}/../ccr.js" "$@"
|
|
32
|
-
fi
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -eo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT_PATH="${BASH_SOURCE[0]}"
|
|
5
|
-
while [ -L "$SCRIPT_PATH" ]; do
|
|
6
|
-
TARGET="$(readlink "$SCRIPT_PATH")"
|
|
7
|
-
if [[ "$TARGET" == /* ]]; then
|
|
8
|
-
SCRIPT_PATH="$TARGET"
|
|
9
|
-
else
|
|
10
|
-
SCRIPT_PATH="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)/$TARGET"
|
|
11
|
-
fi
|
|
12
|
-
done
|
|
13
|
-
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
14
|
-
|
|
15
|
-
export CLI_BIN_NAME=cloudbase
|
|
16
|
-
|
|
17
|
-
# 检测是否为 Android/Termux 环境
|
|
18
|
-
if [[ -f "/data/data/com.termux/files/usr/bin/bash" ]] ||
|
|
19
|
-
[[ "$PREFIX" == "/data/data/com.termux/files/usr" ]] ||
|
|
20
|
-
[[ -n "$TERMUX_VERSION" ]] ||
|
|
21
|
-
[[ "$(uname -o 2>/dev/null)" == "Android" ]]; then
|
|
22
|
-
# Android/Termux: 使用系统 node
|
|
23
|
-
if command -v node >/dev/null 2>&1; then
|
|
24
|
-
node "${SCRIPT_DIR}/../cli.js" "$@"
|
|
25
|
-
else
|
|
26
|
-
echo "error: Node.js not found. Please install it with: pkg install nodejs" >&2
|
|
27
|
-
exit 1
|
|
28
|
-
fi
|
|
29
|
-
else
|
|
30
|
-
# 标准 Linux/macOS: 使用打包的 node
|
|
31
|
-
"${SCRIPT_DIR}/../node" "${SCRIPT_DIR}/../cli.js" "$@"
|
|
32
|
-
fi
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -eo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT_PATH="${BASH_SOURCE[0]}"
|
|
5
|
-
while [ -L "$SCRIPT_PATH" ]; do
|
|
6
|
-
TARGET="$(readlink "$SCRIPT_PATH")"
|
|
7
|
-
if [[ "$TARGET" == /* ]]; then
|
|
8
|
-
SCRIPT_PATH="$TARGET"
|
|
9
|
-
else
|
|
10
|
-
SCRIPT_PATH="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)/$TARGET"
|
|
11
|
-
fi
|
|
12
|
-
done
|
|
13
|
-
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
14
|
-
|
|
15
|
-
export CLI_BIN_NAME=cloudbase-mcp
|
|
16
|
-
|
|
17
|
-
# 检测是否为 Android/Termux 环境
|
|
18
|
-
if [[ -f "/data/data/com.termux/files/usr/bin/bash" ]] ||
|
|
19
|
-
[[ "$PREFIX" == "/data/data/com.termux/files/usr" ]] ||
|
|
20
|
-
[[ -n "$TERMUX_VERSION" ]] ||
|
|
21
|
-
[[ "$(uname -o 2>/dev/null)" == "Android" ]]; then
|
|
22
|
-
# Android/Termux: 使用系统 node
|
|
23
|
-
if command -v node >/dev/null 2>&1; then
|
|
24
|
-
node "${SCRIPT_DIR}/../mcp.js" "$@"
|
|
25
|
-
else
|
|
26
|
-
echo "error: Node.js not found. Please install it with: pkg install nodejs" >&2
|
|
27
|
-
exit 1
|
|
28
|
-
fi
|
|
29
|
-
else
|
|
30
|
-
# 标准 Linux/macOS: 使用打包的 node
|
|
31
|
-
"${SCRIPT_DIR}/../node" "${SCRIPT_DIR}/../mcp.js" "$@"
|
|
32
|
-
fi
|
package/build/launchers/tcb
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -eo pipefail
|
|
3
|
-
|
|
4
|
-
# Resolve symlink to real script path
|
|
5
|
-
SCRIPT_PATH="${BASH_SOURCE[0]}"
|
|
6
|
-
while [ -L "$SCRIPT_PATH" ]; do
|
|
7
|
-
TARGET="$(readlink "$SCRIPT_PATH")"
|
|
8
|
-
if [[ "$TARGET" == /* ]]; then
|
|
9
|
-
SCRIPT_PATH="$TARGET"
|
|
10
|
-
else
|
|
11
|
-
SCRIPT_PATH="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)/$TARGET"
|
|
12
|
-
fi
|
|
13
|
-
done
|
|
14
|
-
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
15
|
-
|
|
16
|
-
export CLI_BIN_NAME=tcb
|
|
17
|
-
|
|
18
|
-
# 检测是否为 Android/Termux 环境
|
|
19
|
-
if [[ -f "/data/data/com.termux/files/usr/bin/bash" ]] ||
|
|
20
|
-
[[ "${PREFIX:-}" == "/data/data/com.termux/files/usr" ]] ||
|
|
21
|
-
[[ -n "${TERMUX_VERSION:-}" ]] ||
|
|
22
|
-
[[ "$(uname -o 2>/dev/null)" == "Android" ]]; then
|
|
23
|
-
# Android/Termux: 使用系统 node
|
|
24
|
-
if command -v node >/dev/null 2>&1; then
|
|
25
|
-
node "${SCRIPT_DIR}/../cli.js" "$@"
|
|
26
|
-
else
|
|
27
|
-
echo "error: Node.js not found. Please install it with: pkg install nodejs" >&2
|
|
28
|
-
exit 1
|
|
29
|
-
fi
|
|
30
|
-
else
|
|
31
|
-
# 标准 Linux/macOS: 使用打包的 node
|
|
32
|
-
"${SCRIPT_DIR}/../node" "${SCRIPT_DIR}/../cli.js" "$@"
|
|
33
|
-
fi
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require('fs')
|
|
4
|
-
const path = require('path')
|
|
5
|
-
|
|
6
|
-
const cliPath = path.resolve(__dirname, '../../node_modules/@musistudio/claude-code-router/dist/cli.js')
|
|
7
|
-
|
|
8
|
-
// 读取原始文件
|
|
9
|
-
let content = fs.readFileSync(cliPath, 'utf8')
|
|
10
|
-
|
|
11
|
-
// 替换所有的 node cliPath 为 ccr
|
|
12
|
-
// 1. 第77872行附近
|
|
13
|
-
content = content.replace(
|
|
14
|
-
/const startProcess2 = \(0, import_child_process3\.spawn\)\("node", \[cliPath2, "start"\],/g,
|
|
15
|
-
'const startProcess2 = (0, import_child_process3.spawn)("ccr", ["start"],'
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
// 2. 第77899行附近
|
|
19
|
-
content = content.replace(
|
|
20
|
-
/const startProcess2 = \(0, import_child_process3\.spawn\)\("node", \[cliPath2, "start"\],/g,
|
|
21
|
-
'const startProcess2 = (0, import_child_process3.spawn)("ccr", ["start"],'
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
// 3. 第77936行附近
|
|
25
|
-
content = content.replace(
|
|
26
|
-
/const restartProcess = \(0, import_child_process3\.spawn\)\("node", \[cliPath2, "start"\],/g,
|
|
27
|
-
'const restartProcess = (0, import_child_process3.spawn)("ccr", ["start"],'
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
// 4. 第78007行附近
|
|
31
|
-
content = content.replace(
|
|
32
|
-
/const startProcess = \(0, import_child_process3\.spawn\)\("node", \[cliPath, "start"\],/g,
|
|
33
|
-
'const startProcess = (0, import_child_process3.spawn)("ccr", ["start"],'
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
// 写回文件
|
|
37
|
-
fs.writeFileSync(cliPath, content, 'utf8')
|
|
38
|
-
|
|
39
|
-
console.log('✅ CCR CLI patch applied successfully!')
|
|
40
|
-
console.log('Modified file:', cliPath)
|
package/build/shims/hexoid.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Minimal hexoid compatible shim for standalone bundle
|
|
2
|
-
// Usage: const toHexoId = hexoid(25); const id = toHexoId();
|
|
3
|
-
const crypto = require('crypto')
|
|
4
|
-
|
|
5
|
-
function hexoid(length = 16) {
|
|
6
|
-
const bytes = Math.ceil(length / 2)
|
|
7
|
-
return function generateHexId() {
|
|
8
|
-
return crypto.randomBytes(bytes).toString('hex').slice(0, length)
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
module.exports = hexoid
|
|
13
|
-
|
|
14
|
-
|
package/build/shims/prettier.cjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Mock prettier to avoid runtime errors
|
|
2
|
-
module.exports = {
|
|
3
|
-
format: (code, options) => {
|
|
4
|
-
// Return the code as-is without formatting
|
|
5
|
-
return code;
|
|
6
|
-
},
|
|
7
|
-
resolveConfig: () => ({}),
|
|
8
|
-
getFileInfo: () => ({ ignored: false }),
|
|
9
|
-
check: () => true,
|
|
10
|
-
version: '0.0.0'
|
|
11
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
// Shim for read-pkg-up to avoid package.json access issues in standalone bundle
|
|
4
|
-
function sync(options = {}) {
|
|
5
|
-
// Return a mock package.json object with version information
|
|
6
|
-
return {
|
|
7
|
-
packageJson: {
|
|
8
|
-
name: '@cloudbase/functions-framework',
|
|
9
|
-
version: process.env.CLOUDBASE_FUNCTIONS_FRAMEWORK_VERSION || '1.16.0',
|
|
10
|
-
description: 'CloudBase Functions Framework',
|
|
11
|
-
main: 'index.js',
|
|
12
|
-
dependencies: {},
|
|
13
|
-
devDependencies: {}
|
|
14
|
-
},
|
|
15
|
-
path: '/mock/package.json'
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = {
|
|
20
|
-
sync
|
|
21
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// No-op shim for update-notifier in standalone bundle
|
|
2
|
-
// Usage: const notifier = updateNotifier(opts); notifier.notify({ isGlobal: true })
|
|
3
|
-
module.exports = function updateNotifier() {
|
|
4
|
-
return {
|
|
5
|
-
notify: function notify() {
|
|
6
|
-
// intentionally no-op in standalone distribution
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
}
|
package/build/webpack/ccr.cjs
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/* CCR standalone bundle config
|
|
2
|
-
* - Entries: ccr-main.js
|
|
3
|
-
* - Output: dist/standalone/ccr.js
|
|
4
|
-
*/
|
|
5
|
-
const path = require('path')
|
|
6
|
-
const webpack = require('webpack')
|
|
7
|
-
|
|
8
|
-
/** @type {import('webpack').Configuration} */
|
|
9
|
-
module.exports = {
|
|
10
|
-
mode: 'production',
|
|
11
|
-
target: 'node',
|
|
12
|
-
entry: {
|
|
13
|
-
ccr: path.resolve(__dirname, '../entries/ccr-main.js')
|
|
14
|
-
},
|
|
15
|
-
output: {
|
|
16
|
-
path: path.resolve(__dirname, '../../dist/standalone'),
|
|
17
|
-
filename: '[name].js',
|
|
18
|
-
libraryTarget: 'commonjs2',
|
|
19
|
-
clean: false // 不清理,因为要和 cli.js 共存
|
|
20
|
-
},
|
|
21
|
-
resolve: {
|
|
22
|
-
extensions: ['.js', '.json'],
|
|
23
|
-
alias: {
|
|
24
|
-
// Mock read-pkg-up to avoid dynamic package.json access
|
|
25
|
-
'read-pkg-up': path.resolve(__dirname, '../shims/read-pkg-up.cjs')
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
module: {
|
|
29
|
-
rules: [
|
|
30
|
-
{
|
|
31
|
-
test: /\.wasm$/,
|
|
32
|
-
type: 'asset/resource'
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
|
-
optimization: {
|
|
37
|
-
minimize: false,
|
|
38
|
-
splitChunks: false,
|
|
39
|
-
runtimeChunk: false
|
|
40
|
-
},
|
|
41
|
-
plugins: [
|
|
42
|
-
// Force single-file bundle
|
|
43
|
-
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
|
|
44
|
-
|
|
45
|
-
// Add shebang to the output file
|
|
46
|
-
new webpack.BannerPlugin({
|
|
47
|
-
banner: '#!/usr/bin/env node',
|
|
48
|
-
raw: true
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
// 处理动态 require 的 package.json 访问
|
|
52
|
-
new webpack.NormalModuleReplacementPlugin(
|
|
53
|
-
/^([^/]+)\/package\.json$/,
|
|
54
|
-
(resource) => {
|
|
55
|
-
const packageName = resource.request.match(/^([^/]+)\/package\.json$/)[1]
|
|
56
|
-
if (packageName.startsWith('@musistudio/')) {
|
|
57
|
-
resource.request = path.resolve(__dirname, '../shims/generic-pkg.cjs')
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
),
|
|
61
|
-
|
|
62
|
-
// 处理 read-pkg-up 的访问
|
|
63
|
-
new webpack.NormalModuleReplacementPlugin(
|
|
64
|
-
/^read-pkg-up$/,
|
|
65
|
-
(resource) => {
|
|
66
|
-
resource.request = path.resolve(__dirname, '../shims/read-pkg-up.cjs')
|
|
67
|
-
}
|
|
68
|
-
)
|
|
69
|
-
],
|
|
70
|
-
externals: [
|
|
71
|
-
function ({ context, request }, callback) {
|
|
72
|
-
const externals = new Set([
|
|
73
|
-
'fsevents', 'esbuild', 'bufferutil', 'utf-8-validate',
|
|
74
|
-
'canvas', 'sharp', 'serialport', 'node-pty', 'keytar'
|
|
75
|
-
])
|
|
76
|
-
if (externals.has(request)) {
|
|
77
|
-
return callback(null, 'commonjs ' + request)
|
|
78
|
-
}
|
|
79
|
-
return callback()
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
stats: {
|
|
83
|
-
errorDetails: true
|
|
84
|
-
}
|
|
85
|
-
}
|
package/build/webpack/cli.cjs
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/* CLI standalone bundle config (tidy layout)
|
|
2
|
-
* - Entries: cli.js (main)
|
|
3
|
-
* - Output: dist/standalone/cli.js
|
|
4
|
-
*/
|
|
5
|
-
const path = require('path')
|
|
6
|
-
const webpack = require('webpack')
|
|
7
|
-
|
|
8
|
-
/** @type {import('webpack').Configuration} */
|
|
9
|
-
module.exports = {
|
|
10
|
-
mode: 'production',
|
|
11
|
-
target: 'node',
|
|
12
|
-
entry: {
|
|
13
|
-
cli: path.resolve(__dirname, '../entries/cli-main.js')
|
|
14
|
-
},
|
|
15
|
-
output: {
|
|
16
|
-
path: path.resolve(__dirname, '../../dist/standalone'),
|
|
17
|
-
filename: '[name].js',
|
|
18
|
-
libraryTarget: 'commonjs2',
|
|
19
|
-
clean: true
|
|
20
|
-
},
|
|
21
|
-
resolve: {
|
|
22
|
-
extensions: ['.js', '.json'],
|
|
23
|
-
alias: {
|
|
24
|
-
hexoid: path.resolve(__dirname, '../shims/hexoid.cjs'),
|
|
25
|
-
// Replace update-notifier with a no-op shim to avoid pulling optional deps like is-ci
|
|
26
|
-
'update-notifier': path.resolve(__dirname, '../shims/update-notifier.cjs'),
|
|
27
|
-
// Mock lowcode package.json to avoid hard dep in tcb --version
|
|
28
|
-
'@cloudbase/lowcode-cli/package.json': path.resolve(__dirname, '../shims/lowcode-pkg.cjs'),
|
|
29
|
-
// Mock cloud-api package.json to avoid SDKVersion error
|
|
30
|
-
'@cloudbase/cloud-api/package.json': path.resolve(__dirname, '../shims/cloud-api-pkg.cjs'),
|
|
31
|
-
// Mock other CloudBase packages to avoid package.json access errors
|
|
32
|
-
'@cloudbase/toolbox/package.json': path.resolve(__dirname, '../shims/toolbox-pkg.cjs'),
|
|
33
|
-
'@cloudbase/manager-node/package.json': path.resolve(__dirname, '../shims/manager-node-pkg.cjs'),
|
|
34
|
-
'@cloudbase/functions-framework/package.json': path.resolve(__dirname, '../shims/functions-framework-pkg.cjs'),
|
|
35
|
-
'@cloudbase/framework-core/package.json': path.resolve(__dirname, '../shims/framework-core-pkg.cjs'),
|
|
36
|
-
'@cloudbase/iac-core/package.json': path.resolve(__dirname, '../shims/iac-core-pkg.cjs'),
|
|
37
|
-
// Mock read-pkg-up to avoid dynamic package.json access
|
|
38
|
-
'read-pkg-up': path.resolve(__dirname, '../shims/read-pkg-up.cjs')
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
module: {
|
|
42
|
-
rules: []
|
|
43
|
-
},
|
|
44
|
-
optimization: {
|
|
45
|
-
minimize: false,
|
|
46
|
-
splitChunks: false,
|
|
47
|
-
runtimeChunk: false
|
|
48
|
-
},
|
|
49
|
-
plugins: [
|
|
50
|
-
// Force single-file bundle
|
|
51
|
-
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
|
|
52
|
-
|
|
53
|
-
// 剔除低码链路及其重型依赖,避免被静态收集(但保留 package.json 以便 -v 读取,交由 alias mock)
|
|
54
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^@cloudbase\/lowcode-cli(?!\/package\.json)(\/.*)?$/ }),
|
|
55
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^@cloudbase\/lowcode-builder(\/.*)?$/ }),
|
|
56
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^@cloudbase\/lowcode-deployer(\/.*)?$/ }),
|
|
57
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^vue-loader(\/.*)?$/ }),
|
|
58
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^@vue\/compiler-sfc(\/.*)?$/ }),
|
|
59
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^consolidate(\/.*)?$/ }),
|
|
60
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^@pmmmwh\/react-refresh-webpack-plugin(\/.*)?$/ }),
|
|
61
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^webpack-dev-server(\/.*)?$/ }),
|
|
62
|
-
// 将 prettier 替换为 mock(必须在 IgnorePlugin 之前)
|
|
63
|
-
new webpack.NormalModuleReplacementPlugin(
|
|
64
|
-
/^prettier$/,
|
|
65
|
-
(resource) => {
|
|
66
|
-
resource.request = path.resolve(__dirname, '../shims/prettier.cjs')
|
|
67
|
-
}
|
|
68
|
-
),
|
|
69
|
-
|
|
70
|
-
// 剔除开发期进程树相关依赖,避免在 bundle 中出现 CLI 副作用输出(数组打印)
|
|
71
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^nodemon(\/.*)?$/ }),
|
|
72
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^ps-tree(\/.*)?$/ }),
|
|
73
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^pidtree(\/.*)?$/ }),
|
|
74
|
-
|
|
75
|
-
// 剔除 prettier 依赖,避免在运行时包含格式化工具
|
|
76
|
-
new webpack.IgnorePlugin({ resourceRegExp: /^prettier(\/.*)?$/ }),
|
|
77
|
-
|
|
78
|
-
// 处理动态 require 的 package.json 访问
|
|
79
|
-
new webpack.NormalModuleReplacementPlugin(
|
|
80
|
-
/^([^/]+)\/package\.json$/,
|
|
81
|
-
(resource) => {
|
|
82
|
-
const packageName = resource.request.match(/^([^/]+)\/package\.json$/)[1]
|
|
83
|
-
if (packageName.startsWith('@cloudbase/')) {
|
|
84
|
-
resource.request = path.resolve(__dirname, '../shims/generic-pkg.cjs')
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
),
|
|
88
|
-
|
|
89
|
-
// 处理 read-pkg-up 的访问
|
|
90
|
-
new webpack.NormalModuleReplacementPlugin(
|
|
91
|
-
/^read-pkg-up$/,
|
|
92
|
-
(resource) => {
|
|
93
|
-
resource.request = path.resolve(__dirname, '../shims/read-pkg-up.cjs')
|
|
94
|
-
}
|
|
95
|
-
)
|
|
96
|
-
],
|
|
97
|
-
externals: [
|
|
98
|
-
function ({ context, request }, callback) {
|
|
99
|
-
const externals = new Set([
|
|
100
|
-
'fsevents', 'esbuild', 'bufferutil', 'utf-8-validate',
|
|
101
|
-
'canvas', 'sharp', 'serialport', 'node-pty', 'keytar',
|
|
102
|
-
// 以防万一,即便未被 IgnorePlugin 命中,也不将其打入包内
|
|
103
|
-
'nodemon', 'ps-tree', 'pidtree'
|
|
104
|
-
])
|
|
105
|
-
if (externals.has(request)) {
|
|
106
|
-
return callback(null, 'commonjs ' + request)
|
|
107
|
-
}
|
|
108
|
-
return callback()
|
|
109
|
-
}
|
|
110
|
-
],
|
|
111
|
-
stats: {
|
|
112
|
-
errorDetails: true
|
|
113
|
-
}
|
|
114
|
-
}
|