edgeone 1.0.2 → 1.0.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/edgeone-dist/cli.js +25 -8
- package/package.json +1 -1
package/edgeone-dist/cli.js
CHANGED
|
@@ -103299,7 +103299,7 @@ var yargs_default = Yargs;
|
|
|
103299
103299
|
// package.json
|
|
103300
103300
|
var package_default = {
|
|
103301
103301
|
name: "edgeone",
|
|
103302
|
-
version: "1.0.
|
|
103302
|
+
version: "1.0.3",
|
|
103303
103303
|
description: "Command-line interface for TencentCloud Pages Functions",
|
|
103304
103304
|
bin: {
|
|
103305
103305
|
edgeone: "./edgeone-bin/edgeone.js"
|
|
@@ -113013,7 +113013,7 @@ var Min_Len = 1;
|
|
|
113013
113013
|
var Error_Message = {
|
|
113014
113014
|
invalid_type: "invalid type error",
|
|
113015
113015
|
max_length: "max length error",
|
|
113016
|
-
min_length: "min
|
|
113016
|
+
min_length: "min length error",
|
|
113017
113017
|
min_string: "string min error",
|
|
113018
113018
|
max_string: "string max error",
|
|
113019
113019
|
char_match: "char match error",
|
|
@@ -113050,6 +113050,26 @@ function isSource(v) {
|
|
|
113050
113050
|
return Error_Message.char_match;
|
|
113051
113051
|
}
|
|
113052
113052
|
}
|
|
113053
|
+
function isDestination(v) {
|
|
113054
|
+
var _a6;
|
|
113055
|
+
v = v.replace(/^https?:\/\//, "");
|
|
113056
|
+
if (v.length === 0) {
|
|
113057
|
+
return Error_Message.min_string;
|
|
113058
|
+
}
|
|
113059
|
+
if (v.length > 500) {
|
|
113060
|
+
return Error_Message.max_string;
|
|
113061
|
+
}
|
|
113062
|
+
const illegal = /[^a-zA-Z0-9_\-/:*.~=?#!$&+,;%@ ]/;
|
|
113063
|
+
if (illegal.test(v)) {
|
|
113064
|
+
return Error_Message.char_match;
|
|
113065
|
+
}
|
|
113066
|
+
if (((_a6 = v.match(/\*/g)) == null ? void 0 : _a6.length) > 1) {
|
|
113067
|
+
return Error_Message.char_match;
|
|
113068
|
+
}
|
|
113069
|
+
if (/(?<![a-zA-Z0-9_\-/:*.~=?#!$&+,;%@ ]):/.test(v) || /:(?![a-zA-Z0-9]+)/.test(v)) {
|
|
113070
|
+
return Error_Message.char_match;
|
|
113071
|
+
}
|
|
113072
|
+
}
|
|
113053
113073
|
function isKey(v) {
|
|
113054
113074
|
if (v.length === 0) {
|
|
113055
113075
|
return Error_Message.min_string;
|
|
@@ -113072,9 +113092,6 @@ function isValue(v) {
|
|
|
113072
113092
|
return Error_Message.char_match;
|
|
113073
113093
|
}
|
|
113074
113094
|
}
|
|
113075
|
-
function isDestination(v) {
|
|
113076
|
-
return isSource(v);
|
|
113077
|
-
}
|
|
113078
113095
|
function isStatusCode(v) {
|
|
113079
113096
|
if (![301, 302, 303, 304, 307, 308].includes(v)) {
|
|
113080
113097
|
return Error_Message.value_match;
|
|
@@ -113145,7 +113162,7 @@ function parseHeaders(config, path9) {
|
|
|
113145
113162
|
path: [...path9],
|
|
113146
113163
|
message: Error_Message.invalid_type
|
|
113147
113164
|
});
|
|
113148
|
-
return
|
|
113165
|
+
return [result, message];
|
|
113149
113166
|
}
|
|
113150
113167
|
for (const index in config) {
|
|
113151
113168
|
const header2 = config[index];
|
|
@@ -113180,7 +113197,7 @@ function parseHeaders(config, path9) {
|
|
|
113180
113197
|
});
|
|
113181
113198
|
result_h = result_h.slice(0, Max_Len);
|
|
113182
113199
|
}
|
|
113183
|
-
if (headers.length < Min_Len && result_h.length < Min_Len) {
|
|
113200
|
+
if ((headers == null ? void 0 : headers.length) < Min_Len && result_h.length < Min_Len) {
|
|
113184
113201
|
message_h.push({
|
|
113185
113202
|
path: [...path9, `[${index}]`, "headers"],
|
|
113186
113203
|
message: Error_Message.min_length
|
|
@@ -113357,7 +113374,7 @@ function parse2(config, path9) {
|
|
|
113357
113374
|
});
|
|
113358
113375
|
return [result, message];
|
|
113359
113376
|
}
|
|
113360
|
-
const { headers, redirects, rewrites } = config;
|
|
113377
|
+
const { headers = [], redirects = [], rewrites = [] } = config;
|
|
113361
113378
|
const [result_h, message_h] = parseHeaders(headers, [...path9, "headers"]);
|
|
113362
113379
|
const [result_r, message_r] = parseRedirects(redirects, [...path9, "redirects"]);
|
|
113363
113380
|
const [result_w, message_w] = parseRewrites(rewrites, [...path9, "rewrites"]);
|