edgeone 1.0.12 → 1.0.14-beta.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.
- package/edgeone-dist/cli.js +31 -20
- package/package.json +1 -1
package/edgeone-dist/cli.js
CHANGED
|
@@ -102539,7 +102539,7 @@ var yargs_default = Yargs;
|
|
|
102539
102539
|
// package.json
|
|
102540
102540
|
var package_default = {
|
|
102541
102541
|
name: "edgeone",
|
|
102542
|
-
version: "1.0.
|
|
102542
|
+
version: "1.0.14",
|
|
102543
102543
|
description: "Command-line interface for TencentCloud Pages Functions",
|
|
102544
102544
|
bin: {
|
|
102545
102545
|
edgeone: "./edgeone-bin/edgeone.js"
|
|
@@ -113231,13 +113231,21 @@ var BuildFunctionGenerator = class {
|
|
|
113231
113231
|
|
|
113232
113232
|
const params = {};
|
|
113233
113233
|
if (routeParams.id) {
|
|
113234
|
-
|
|
113235
|
-
|
|
113236
|
-
|
|
113237
|
-
|
|
113234
|
+
if (routeParams.mode === 1) {
|
|
113235
|
+
const value = urlInfo.pathname.match(routeParams.left);
|
|
113236
|
+
for (let i = 1; i < value.length; i++) {
|
|
113237
|
+
params[routeParams.id[i - 1]] = value[i];
|
|
113238
|
+
}
|
|
113238
113239
|
} else {
|
|
113239
|
-
|
|
113240
|
+
const value = urlInfo.pathname.replace(routeParams.left, '');
|
|
113241
|
+
const splitedValue = value.split('/');
|
|
113242
|
+
if (splitedValue.length === 1) {
|
|
113243
|
+
params[routeParams.id] = splitedValue[0];
|
|
113244
|
+
} else {
|
|
113245
|
+
params[routeParams.id] = splitedValue;
|
|
113246
|
+
}
|
|
113240
113247
|
}
|
|
113248
|
+
|
|
113241
113249
|
}
|
|
113242
113250
|
if(!matchedFunc){
|
|
113243
113251
|
pagesFunctionResponse = function() {
|
|
@@ -113308,7 +113316,6 @@ var BuildFunctionGenerator = class {
|
|
|
113308
113316
|
return false;
|
|
113309
113317
|
}
|
|
113310
113318
|
matchPath(path9) {
|
|
113311
|
-
const regex12 = /^\/(?:[^/]+\/)*\[(.+?)\]$/;
|
|
113312
113319
|
const regex22 = /^\/(?:[^/]+\/)*\[\[(.+?)\]\]$/;
|
|
113313
113320
|
if (regex22.test(path9) && path9.indexOf("[[") > -1) {
|
|
113314
113321
|
const match = regex22.exec(path9);
|
|
@@ -113319,13 +113326,21 @@ var BuildFunctionGenerator = class {
|
|
|
113319
113326
|
left: path9.replace(`[[${match[1]}]]`, "")
|
|
113320
113327
|
};
|
|
113321
113328
|
}
|
|
113322
|
-
} else if (
|
|
113323
|
-
const match =
|
|
113329
|
+
} else if (regex1.test(path9)) {
|
|
113330
|
+
const match = regex1.exec(path9);
|
|
113331
|
+
const regex = /\[(.*?)\]/g;
|
|
113332
|
+
const matches = path9.match(regex);
|
|
113333
|
+
const parameters = matches.map((match2) => match2.slice(1, -1));
|
|
113334
|
+
let leftPart = JSON.parse(JSON.stringify(path9));
|
|
113335
|
+
parameters == null ? void 0 : parameters.forEach((item) => {
|
|
113336
|
+
leftPart = leftPart.replace(`[${item}]`, `([^/]*)`);
|
|
113337
|
+
});
|
|
113338
|
+
leftPart = leftPart.replace(/\//g, "\\/");
|
|
113324
113339
|
if (match[1]) {
|
|
113325
113340
|
return {
|
|
113326
|
-
id:
|
|
113341
|
+
id: parameters,
|
|
113327
113342
|
mode: 1,
|
|
113328
|
-
left:
|
|
113343
|
+
left: leftPart
|
|
113329
113344
|
};
|
|
113330
113345
|
}
|
|
113331
113346
|
} else {
|
|
@@ -113353,10 +113368,8 @@ var BuildFunctionGenerator = class {
|
|
|
113353
113368
|
`;
|
|
113354
113369
|
this.recordFunc(stringMap, "onRequest");
|
|
113355
113370
|
} else if (routeParams.mode === 1) {
|
|
113356
|
-
const match = regex1.exec(`${stringMap.path}`);
|
|
113357
|
-
const leftPart = `${stringMap.path}`.replace(`[${match[1]}]`, "").replace(/\//g, "\\/");
|
|
113358
113371
|
this.logicText += `
|
|
113359
|
-
if(/^${
|
|
113372
|
+
if(/^${routeParams.left}$/.test(urlInfo.pathname)) {
|
|
113360
113373
|
routeParams = ${JSON.stringify(routeParams)};
|
|
113361
113374
|
matchedFunc = true;
|
|
113362
113375
|
${tempResult}
|
|
@@ -113391,10 +113404,8 @@ var BuildFunctionGenerator = class {
|
|
|
113391
113404
|
`;
|
|
113392
113405
|
this.recordFunc(stringMap, item.funcName);
|
|
113393
113406
|
} else if (routeParams.mode === 1) {
|
|
113394
|
-
const match = regex1.exec(`${stringMap.path}`);
|
|
113395
|
-
const leftPart = `${stringMap.path}`.replace(`[${match[1]}]`, "").replace(/\//g, "\\/");
|
|
113396
113407
|
this.logicText += `
|
|
113397
|
-
if(/^${
|
|
113408
|
+
if(/^${routeParams.left}$/.test(urlInfo.pathname)) {
|
|
113398
113409
|
routeParams = ${JSON.stringify(routeParams)};
|
|
113399
113410
|
matchedFunc = true;
|
|
113400
113411
|
${tempResult}
|
|
@@ -113403,7 +113414,7 @@ var BuildFunctionGenerator = class {
|
|
|
113403
113414
|
this.recordFunc(stringMap, item.funcName);
|
|
113404
113415
|
} else if (routeParams.mode === 2) {
|
|
113405
113416
|
const match = regex2.exec(`${stringMap.path}`);
|
|
113406
|
-
const leftPart = `${stringMap.path}`.replace(`[${match[1]}]`, "").replace(/\//g, "\\/");
|
|
113417
|
+
const leftPart = `${stringMap.path}`.replace(`[[${match[1]}]]`, "").replace(/\//g, "\\/");
|
|
113407
113418
|
this.logicText += `
|
|
113408
113419
|
if(/^${leftPart}(.+?)$/.test(urlInfo.pathname) && request.method === '${item.method}') {
|
|
113409
113420
|
routeParams = ${JSON.stringify(routeParams)};
|
|
@@ -113795,10 +113806,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
113795
113806
|
return 1;
|
|
113796
113807
|
}
|
|
113797
113808
|
if ("CI" in env2) {
|
|
113798
|
-
if (
|
|
113809
|
+
if ("GITHUB_ACTIONS" in env2 || "GITEA_ACTIONS" in env2) {
|
|
113799
113810
|
return 3;
|
|
113800
113811
|
}
|
|
113801
|
-
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
|
|
113812
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
|
|
113802
113813
|
return 1;
|
|
113803
113814
|
}
|
|
113804
113815
|
return min;
|