edgeone 1.0.1 → 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/README.md +1 -1
- package/edgeone-dist/cli.js +28 -8
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ EdgeOne CLI can help you manage and debug Pages Functions in the project more ef
|
|
|
22
22
|
|
|
23
23
|
- Create a [Pages project](https://edgeone.ai/pages/new?s_url=https://console.tencentcloud.com/edgeone/pages) in the Console, and clone the repository to Local.
|
|
24
24
|
|
|
25
|
-
*If you are a China site user, please go to the corresponding [Pages](https://console.cloud.tencent.com/edgeone/pages)
|
|
25
|
+
*If you are a China site user, please go to the corresponding [Pages](https://console.cloud.tencent.com/edgeone/pages) console.*
|
|
26
26
|
|
|
27
27
|
<br />
|
|
28
28
|
|
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"
|
|
@@ -103321,9 +103321,11 @@ var package_default = {
|
|
|
103321
103321
|
scripts: {
|
|
103322
103322
|
clean: "rimraf ./edgeone-dist ./edgeone-bin",
|
|
103323
103323
|
copy: "cp -r ./src/command/init/templates ./edgeone-dist/templates",
|
|
103324
|
+
xcopy: "xcopy /QEY .\\src\\command\\init\\templates .\\edgeone-dist\\templates",
|
|
103324
103325
|
bundle: "node -r esbuild-register ./scripts/bundle.ts",
|
|
103325
103326
|
watch: "node -r esbuild-register ./scripts/bundle.ts watch",
|
|
103326
103327
|
build: "npm run clean && npm run bundle && npm run copy",
|
|
103328
|
+
buildWin: "npm run clean && npm run bundle && npm run xcopy",
|
|
103327
103329
|
test: "jest --no-cache"
|
|
103328
103330
|
},
|
|
103329
103331
|
dependencies: {
|
|
@@ -113011,7 +113013,7 @@ var Min_Len = 1;
|
|
|
113011
113013
|
var Error_Message = {
|
|
113012
113014
|
invalid_type: "invalid type error",
|
|
113013
113015
|
max_length: "max length error",
|
|
113014
|
-
min_length: "min
|
|
113016
|
+
min_length: "min length error",
|
|
113015
113017
|
min_string: "string min error",
|
|
113016
113018
|
max_string: "string max error",
|
|
113017
113019
|
char_match: "char match error",
|
|
@@ -113048,6 +113050,26 @@ function isSource(v) {
|
|
|
113048
113050
|
return Error_Message.char_match;
|
|
113049
113051
|
}
|
|
113050
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
|
+
}
|
|
113051
113073
|
function isKey(v) {
|
|
113052
113074
|
if (v.length === 0) {
|
|
113053
113075
|
return Error_Message.min_string;
|
|
@@ -113070,9 +113092,6 @@ function isValue(v) {
|
|
|
113070
113092
|
return Error_Message.char_match;
|
|
113071
113093
|
}
|
|
113072
113094
|
}
|
|
113073
|
-
function isDestination(v) {
|
|
113074
|
-
return isSource(v);
|
|
113075
|
-
}
|
|
113076
113095
|
function isStatusCode(v) {
|
|
113077
113096
|
if (![301, 302, 303, 304, 307, 308].includes(v)) {
|
|
113078
113097
|
return Error_Message.value_match;
|
|
@@ -113143,7 +113162,7 @@ function parseHeaders(config, path9) {
|
|
|
113143
113162
|
path: [...path9],
|
|
113144
113163
|
message: Error_Message.invalid_type
|
|
113145
113164
|
});
|
|
113146
|
-
return
|
|
113165
|
+
return [result, message];
|
|
113147
113166
|
}
|
|
113148
113167
|
for (const index in config) {
|
|
113149
113168
|
const header2 = config[index];
|
|
@@ -113178,7 +113197,7 @@ function parseHeaders(config, path9) {
|
|
|
113178
113197
|
});
|
|
113179
113198
|
result_h = result_h.slice(0, Max_Len);
|
|
113180
113199
|
}
|
|
113181
|
-
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) {
|
|
113182
113201
|
message_h.push({
|
|
113183
113202
|
path: [...path9, `[${index}]`, "headers"],
|
|
113184
113203
|
message: Error_Message.min_length
|
|
@@ -113355,7 +113374,7 @@ function parse2(config, path9) {
|
|
|
113355
113374
|
});
|
|
113356
113375
|
return [result, message];
|
|
113357
113376
|
}
|
|
113358
|
-
const { headers, redirects, rewrites } = config;
|
|
113377
|
+
const { headers = [], redirects = [], rewrites = [] } = config;
|
|
113359
113378
|
const [result_h, message_h] = parseHeaders(headers, [...path9, "headers"]);
|
|
113360
113379
|
const [result_r, message_r] = parseRedirects(redirects, [...path9, "redirects"]);
|
|
113361
113380
|
const [result_w, message_w] = parseRewrites(rewrites, [...path9, "rewrites"]);
|
|
@@ -113887,6 +113906,7 @@ var BuildFunctionGenerator = class {
|
|
|
113887
113906
|
});
|
|
113888
113907
|
const regex = /\.(js|ts|cjs|tsx|jsx)$/;
|
|
113889
113908
|
const bundledCode = result.outputFiles[0].text;
|
|
113909
|
+
filePath = filePath.replace(/\\/g, "/");
|
|
113890
113910
|
const extractedPath = filePath.replace(/\/index\.(js|ts|cjs|tsx|jsx)/, ".js").replace(regex, "").replace("functions", "");
|
|
113891
113911
|
return {
|
|
113892
113912
|
filePath: filePath.replace("functions/", ""),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edgeone",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Command-line interface for TencentCloud Pages Functions",
|
|
5
5
|
"bin": {
|
|
6
6
|
"edgeone": "./edgeone-bin/edgeone.js"
|
|
@@ -22,9 +22,11 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"clean": "rimraf ./edgeone-dist ./edgeone-bin",
|
|
24
24
|
"copy": "cp -r ./src/command/init/templates ./edgeone-dist/templates",
|
|
25
|
+
"xcopy": "xcopy /QEY .\\src\\command\\init\\templates .\\edgeone-dist\\templates",
|
|
25
26
|
"bundle": "node -r esbuild-register ./scripts/bundle.ts",
|
|
26
27
|
"watch": "node -r esbuild-register ./scripts/bundle.ts watch",
|
|
27
28
|
"build": "npm run clean && npm run bundle && npm run copy",
|
|
29
|
+
"buildWin": "npm run clean && npm run bundle && npm run xcopy",
|
|
28
30
|
"test": "jest --no-cache"
|
|
29
31
|
},
|
|
30
32
|
"dependencies": {
|