@geek-fun/serverlessinsight 0.7.1 → 0.7.5
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/CHANGELOG.md +26 -0
- package/dist/package.json +12 -12
- package/dist/src/commands/index.js +1 -3
- package/dist/src/commands/local.js +1 -2
- package/dist/src/common/iacHelper.js +8 -2
- package/dist/src/lang/en.js +1 -1
- package/dist/src/lang/zh-CN.js +1 -1
- package/dist/src/stack/localStack/aliyunFc.js +15 -5
- package/dist/src/stack/localStack/event.js +1 -1
- package/dist/src/stack/localStack/functionRunner.js +4 -1
- package/dist/src/stack/localStack/localServer.js +3 -6
- package/package.json +12 -12
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.7.2] - 2026-06-26
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Remove misleading `-p`/`--port` flag from `si local` command. The local stack
|
|
13
|
+
is a single unified HTTP server that multiplexes across all simulated cloud
|
|
14
|
+
services (API Gateway, functions, buckets) — a single port flag creates false
|
|
15
|
+
expectations about which service's port is being controlled.
|
|
16
|
+
|
|
17
|
+
## [0.7.1] - 2026-06-26
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Always set errorDocument=indexDocument and enable SupportSubDir for OSS
|
|
22
|
+
static websites (#196) (#197)
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- CDN integration with OSS and API Gateway CDN support (#195)
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "Full life cycle cross providers serverless application management for your fast-growing business.",
|
|
5
5
|
"homepage": "https://serverlessinsight.geekfun.club",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"@alicloud/cas20200407": "^3.2.8",
|
|
58
58
|
"@alicloud/cdn20180510": "^9.2.0",
|
|
59
59
|
"@alicloud/cloudapi20160714": "^4.8.0",
|
|
60
|
-
"@alicloud/ecs20140526": "^7.8.
|
|
60
|
+
"@alicloud/ecs20140526": "^7.8.6",
|
|
61
61
|
"@alicloud/es-serverless20230627": "^2.3.1",
|
|
62
|
-
"@alicloud/fc20230330": "^4.7.
|
|
62
|
+
"@alicloud/fc20230330": "^4.7.7",
|
|
63
63
|
"@alicloud/ims20190815": "^2.3.6",
|
|
64
64
|
"@alicloud/nas20170626": "^3.4.2",
|
|
65
65
|
"@alicloud/openapi-client": "^0.4.15",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"pino": "^10.3.1",
|
|
80
80
|
"pino-pretty": "^13.1.3",
|
|
81
81
|
"tablestore": "^5.6.5",
|
|
82
|
-
"tencentcloud-sdk-nodejs-cynosdb": "^4.1.
|
|
83
|
-
"tencentcloud-sdk-nodejs-dnspod": "^4.1.
|
|
84
|
-
"tencentcloud-sdk-nodejs-es": "^4.1.
|
|
82
|
+
"tencentcloud-sdk-nodejs-cynosdb": "^4.1.257",
|
|
83
|
+
"tencentcloud-sdk-nodejs-dnspod": "^4.1.257",
|
|
84
|
+
"tencentcloud-sdk-nodejs-es": "^4.1.257",
|
|
85
85
|
"tencentcloud-sdk-nodejs-scf": "^4.1.168",
|
|
86
86
|
"tencentcloud-sdk-nodejs-ssl": "^4.1.239",
|
|
87
87
|
"yaml": "^2.9.0"
|
|
@@ -93,17 +93,17 @@
|
|
|
93
93
|
"@types/i18n": "^0.13.12",
|
|
94
94
|
"@types/jest": "^30.0.0",
|
|
95
95
|
"@types/lodash": "^4.17.24",
|
|
96
|
-
"@types/node": "^
|
|
97
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
98
|
-
"@typescript-eslint/parser": "^8.
|
|
96
|
+
"@types/node": "^26.0.1",
|
|
97
|
+
"@typescript-eslint/eslint-plugin": "^8.62.0",
|
|
98
|
+
"@typescript-eslint/parser": "^8.62.0",
|
|
99
99
|
"cross-env": "^10.1.0",
|
|
100
|
-
"eslint": "^10.
|
|
100
|
+
"eslint": "^10.6.0",
|
|
101
101
|
"eslint-config-prettier": "^10.1.8",
|
|
102
102
|
"eslint-plugin-prettier": "^5.5.6",
|
|
103
|
-
"globals": "^17.
|
|
103
|
+
"globals": "^17.7.0",
|
|
104
104
|
"husky": "^9.1.7",
|
|
105
105
|
"jest": "^30.4.2",
|
|
106
|
-
"prettier": "^3.8.
|
|
106
|
+
"prettier": "^3.8.5",
|
|
107
107
|
"ts-jest": "^29.4.11",
|
|
108
108
|
"ts-node": "^10.9.2",
|
|
109
109
|
"typescript": "^6.0.3"
|
|
@@ -162,13 +162,11 @@ program
|
|
|
162
162
|
.description('run Serverless application locally for debugging')
|
|
163
163
|
.option('-f, --file <path>', 'specify the yaml file')
|
|
164
164
|
.option('-s, --stage <stage>', 'specify the stage', 'default')
|
|
165
|
-
.option('-p, --port <port>', 'specify the port', '3000')
|
|
166
165
|
.option('-d, --debug', 'enable debug mode')
|
|
167
166
|
.option('-w, --watch', 'enable file watch', true)
|
|
168
|
-
.action(actionWrapper('local', async ({ stage,
|
|
167
|
+
.action(actionWrapper('local', async ({ stage, debug, watch, file }) => {
|
|
169
168
|
await (0, local_1.runLocal)({
|
|
170
169
|
stage,
|
|
171
|
-
port: Number(port) || 3000,
|
|
172
170
|
debug: !!debug,
|
|
173
171
|
watch: typeof watch === 'boolean' ? watch : true,
|
|
174
172
|
location: file,
|
|
@@ -6,7 +6,7 @@ const localStack_1 = require("../stack/localStack");
|
|
|
6
6
|
const parser_1 = require("../parser");
|
|
7
7
|
const lang_1 = require("../lang");
|
|
8
8
|
const runLocal = async (opts) => {
|
|
9
|
-
const { stage,
|
|
9
|
+
const { stage, debug, watch, location } = opts;
|
|
10
10
|
const iacLocation = (0, common_1.getIacLocation)(location);
|
|
11
11
|
const rawIac = (0, parser_1.parseYaml)(iacLocation);
|
|
12
12
|
await (0, common_1.setContext)({ stage, app: rawIac.app, service: rawIac.service, location });
|
|
@@ -16,7 +16,6 @@ const runLocal = async (opts) => {
|
|
|
16
16
|
(0, common_1.setIac)(iac);
|
|
17
17
|
common_1.logger.info(lang_1.lang.__('RUN_LOCAL_STARTING', {
|
|
18
18
|
stage,
|
|
19
|
-
port: String(port),
|
|
20
19
|
debug: String(debug),
|
|
21
20
|
watch: String(watch),
|
|
22
21
|
}));
|
|
@@ -25,7 +25,12 @@ const readCodeSize = (location) => {
|
|
|
25
25
|
};
|
|
26
26
|
exports.readCodeSize = readCodeSize;
|
|
27
27
|
const getParam = (key, records) => {
|
|
28
|
-
|
|
28
|
+
if (!records)
|
|
29
|
+
return undefined;
|
|
30
|
+
if (Array.isArray(records)) {
|
|
31
|
+
return records.find((param) => param.key === key)?.value;
|
|
32
|
+
}
|
|
33
|
+
return records[key];
|
|
29
34
|
};
|
|
30
35
|
// Attempt to infer the type of the value if it was a template reference
|
|
31
36
|
const inferType = (value, wasTemplateRef) => {
|
|
@@ -73,7 +78,8 @@ const calcValue = (rawValue, ctx, iacVars) => {
|
|
|
73
78
|
}
|
|
74
79
|
if (containsMap?.length) {
|
|
75
80
|
value = value.replace(/\$\{stages\.(\w+)}/g, (_, key) => {
|
|
76
|
-
const
|
|
81
|
+
const stageConfig = (0, lodash_1.get)(ctx.stages, `${ctx.stage}`, {});
|
|
82
|
+
const stageValue = getParam(key, stageConfig);
|
|
77
83
|
if (!stageValue) {
|
|
78
84
|
logger_1.logger.warn(lang_1.lang.__('STAGE_VARIABLE_NOT_FOUND', {
|
|
79
85
|
key,
|
package/dist/src/lang/en.js
CHANGED
|
@@ -48,7 +48,7 @@ exports.en = {
|
|
|
48
48
|
LOCAL_SERVER_STOPPED: 'localServer stopped',
|
|
49
49
|
LOCAL_GATEWAY_ERROR: 'Local gateway error',
|
|
50
50
|
ERROR_STOPPING_LOCAL_SERVER: 'Error stopping localServer',
|
|
51
|
-
RUN_LOCAL_STARTING: 'run-local starting: stage={{stage}}
|
|
51
|
+
RUN_LOCAL_STARTING: 'run-local starting: stage={{stage}} debug={{debug}} watch={{watch}}',
|
|
52
52
|
// Function execution
|
|
53
53
|
FUNCTION_REQUEST_RECEIVED: 'Function request received by local server -> {{method}} {{identifier}} ',
|
|
54
54
|
INVOKING_WORKER_WITH_EVENT_TYPE: 'Invoking worker with event type: {{eventType}} and context',
|
package/dist/src/lang/zh-CN.js
CHANGED
|
@@ -48,7 +48,7 @@ exports.zhCN = {
|
|
|
48
48
|
LOCAL_SERVER_STOPPED: '本地服务器已停止',
|
|
49
49
|
LOCAL_GATEWAY_ERROR: '本地网关错误',
|
|
50
50
|
ERROR_STOPPING_LOCAL_SERVER: '停止本地服务器时出错',
|
|
51
|
-
RUN_LOCAL_STARTING: '启动本地运行: stage={{stage}}
|
|
51
|
+
RUN_LOCAL_STARTING: '启动本地运行: stage={{stage}} debug={{debug}} watch={{watch}}',
|
|
52
52
|
// Function execution
|
|
53
53
|
FUNCTION_REQUEST_RECEIVED: '本地服务器收到函数请求 -> {{method}} {{identifier}} ',
|
|
54
54
|
INVOKING_WORKER_WITH_EVENT_TYPE: '使用事件类型调用工作进程: {{eventType}} 和上下文',
|
|
@@ -105,12 +105,22 @@ const transformFCResponse = (result) => {
|
|
|
105
105
|
if (isBase64Encoded && typeof body === 'string') {
|
|
106
106
|
body = Buffer.from(body, 'base64').toString('utf-8');
|
|
107
107
|
}
|
|
108
|
+
// Only JSON-parse if the response Content-Type indicates JSON — otherwise pass through as-is.
|
|
109
|
+
// Aliyun API Gateway PASSTHROUGH mode sends raw body; si-local mirrors this behavior.
|
|
108
110
|
if (typeof body === 'string') {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
const contentType = typeof headers === 'object' && headers
|
|
112
|
+
? (Object.values(headers).find((v) => typeof v === 'string' && v.toLowerCase().includes('application/json')) ??
|
|
113
|
+
Object.keys(headers).find((k) => k.toLowerCase() === 'content-type' &&
|
|
114
|
+
typeof headers[k] === 'string' &&
|
|
115
|
+
headers[k].toLowerCase().includes('application/json')))
|
|
116
|
+
: undefined;
|
|
117
|
+
if (contentType || /^\s*[{[]/.test(body)) {
|
|
118
|
+
try {
|
|
119
|
+
body = JSON.parse(body);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
// keep as string
|
|
123
|
+
}
|
|
114
124
|
}
|
|
115
125
|
}
|
|
116
126
|
return { statusCode, headers, body };
|
|
@@ -15,7 +15,7 @@ const node_fs_1 = __importDefault(require("node:fs"));
|
|
|
15
15
|
const utils_1 = require("./utils");
|
|
16
16
|
const lang_1 = require("../../lang");
|
|
17
17
|
const matchTrigger = (req, trigger) => {
|
|
18
|
-
if (
|
|
18
|
+
if (trigger.method !== 'ANY' && req.method !== trigger.method) {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
21
|
const normalize = (s) => s.replace(/^\/+|\/+$/g, '');
|
|
@@ -54,8 +54,11 @@ const loadHandlerModule = async (handlerPath) => {
|
|
|
54
54
|
return require(handlerPath);
|
|
55
55
|
}
|
|
56
56
|
catch {
|
|
57
|
+
// Dynamic import — use Function constructor to prevent TypeScript CJS transform
|
|
58
|
+
// which would replace import() with require() that breaks with file:// URLs
|
|
59
|
+
const importModule = new Function('specifier', 'return import(specifier)');
|
|
57
60
|
const fileUrl = (0, node_url_1.pathToFileURL)(handlerPath + '.js').href;
|
|
58
|
-
return (
|
|
61
|
+
return importModule(fileUrl);
|
|
59
62
|
}
|
|
60
63
|
};
|
|
61
64
|
const getHandlerFunction = (handlerModule, handlerMethod, handlerPath) => {
|
|
@@ -64,12 +64,9 @@ const servLocal = async (handlers, iac) => {
|
|
|
64
64
|
respondJson(res, 204, {});
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
outcome.headers?.['Content-Type'] &&
|
|
71
|
-
outcome.headers?.['Content-Length'];
|
|
72
|
-
if (isRawResponse) {
|
|
67
|
+
// Cloud API Gateway in PASSTHROUGH mode passes through all responses as-is.
|
|
68
|
+
// Si-local mirrors this by always using respondRaw for function responses.
|
|
69
|
+
if (typeof outcome.body === 'string' || Buffer.isBuffer(outcome.body)) {
|
|
73
70
|
respondRaw(res, outcome.statusCode, outcome.body, outcome.headers);
|
|
74
71
|
}
|
|
75
72
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "Full life cycle cross providers serverless application management for your fast-growing business.",
|
|
5
5
|
"homepage": "https://serverlessinsight.geekfun.club",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"@alicloud/cas20200407": "^3.2.8",
|
|
58
58
|
"@alicloud/cdn20180510": "^9.2.0",
|
|
59
59
|
"@alicloud/cloudapi20160714": "^4.8.0",
|
|
60
|
-
"@alicloud/ecs20140526": "^7.8.
|
|
60
|
+
"@alicloud/ecs20140526": "^7.8.6",
|
|
61
61
|
"@alicloud/es-serverless20230627": "^2.3.1",
|
|
62
|
-
"@alicloud/fc20230330": "^4.7.
|
|
62
|
+
"@alicloud/fc20230330": "^4.7.7",
|
|
63
63
|
"@alicloud/ims20190815": "^2.3.6",
|
|
64
64
|
"@alicloud/nas20170626": "^3.4.2",
|
|
65
65
|
"@alicloud/openapi-client": "^0.4.15",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"pino": "^10.3.1",
|
|
80
80
|
"pino-pretty": "^13.1.3",
|
|
81
81
|
"tablestore": "^5.6.5",
|
|
82
|
-
"tencentcloud-sdk-nodejs-cynosdb": "^4.1.
|
|
83
|
-
"tencentcloud-sdk-nodejs-dnspod": "^4.1.
|
|
84
|
-
"tencentcloud-sdk-nodejs-es": "^4.1.
|
|
82
|
+
"tencentcloud-sdk-nodejs-cynosdb": "^4.1.257",
|
|
83
|
+
"tencentcloud-sdk-nodejs-dnspod": "^4.1.257",
|
|
84
|
+
"tencentcloud-sdk-nodejs-es": "^4.1.257",
|
|
85
85
|
"tencentcloud-sdk-nodejs-scf": "^4.1.168",
|
|
86
86
|
"tencentcloud-sdk-nodejs-ssl": "^4.1.239",
|
|
87
87
|
"yaml": "^2.9.0"
|
|
@@ -93,17 +93,17 @@
|
|
|
93
93
|
"@types/i18n": "^0.13.12",
|
|
94
94
|
"@types/jest": "^30.0.0",
|
|
95
95
|
"@types/lodash": "^4.17.24",
|
|
96
|
-
"@types/node": "^
|
|
97
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
98
|
-
"@typescript-eslint/parser": "^8.
|
|
96
|
+
"@types/node": "^26.0.1",
|
|
97
|
+
"@typescript-eslint/eslint-plugin": "^8.62.0",
|
|
98
|
+
"@typescript-eslint/parser": "^8.62.0",
|
|
99
99
|
"cross-env": "^10.1.0",
|
|
100
|
-
"eslint": "^10.
|
|
100
|
+
"eslint": "^10.6.0",
|
|
101
101
|
"eslint-config-prettier": "^10.1.8",
|
|
102
102
|
"eslint-plugin-prettier": "^5.5.6",
|
|
103
|
-
"globals": "^17.
|
|
103
|
+
"globals": "^17.7.0",
|
|
104
104
|
"husky": "^9.1.7",
|
|
105
105
|
"jest": "^30.4.2",
|
|
106
|
-
"prettier": "^3.8.
|
|
106
|
+
"prettier": "^3.8.5",
|
|
107
107
|
"ts-jest": "^29.4.11",
|
|
108
108
|
"ts-node": "^10.9.2",
|
|
109
109
|
"typescript": "^6.0.3"
|